Skip to content

Commit 2dc4136

Browse files
authored
Merge branch 'solana-foundation:master' into master
2 parents 4aad047 + a1f0743 commit 2dc4136

File tree

81 files changed

+1242
-549
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

81 files changed

+1242
-549
lines changed

.github/workflows/reusable-tests.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -422,6 +422,8 @@ jobs:
422422
path: tests/declare-id
423423
- cmd: cd tests/declare-program && anchor test --skip-lint
424424
path: tests/declare-program
425+
- cmd: cd tests/custom-program && anchor test --skip-lint
426+
path: tests/custom-program
425427
- cmd: cd tests/typescript && anchor test --skip-lint && npx tsc --noEmit
426428
path: tests/typescript
427429
# zero-copy tests cause `/usr/bin/ld: final link failed: No space left on device`

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ The minor version will be incremented upon a breaking change and the patch versi
3737
- cli: Replace `anchor verify` to use `solana-verify` under the hood, adding automatic installation via AVM, local path support, and future-proof argument passing ([#3768](https://github.com/solana-foundation/anchor/pull/3768)).
3838
- lang: Replace `solana-program` crate with smaller crates ([#3819](https://github.com/solana-foundation/anchor/pull/3819)).
3939
- cli: Make `anchor deploy` to upload the IDL to the cluster by default unless `--no-idl` is passed ([#3863](https://github.com/solana-foundation/anchor/pull/3863)).
40+
- lang: Add generic program validation support to `Program` type allowing `Program<'info>` for executable-only validation ([#3878](https://github.com/solana-foundation/anchor/pull/3878)).
4041
- lang: Use `solana-invoke` instead of `solana_cpi::invoke` ([#3900](https://github.com/solana-foundation/anchor/pull/3900)).
4142
- client: remove `solana-client` from `anchor-client` and `cli` ([#3877](https://github.com/solana-foundation/anchor/pull/3877)).
4243
- idl: Build IDL on stable Rustc ([#3842](https://github.com/solana-foundation/anchor/pull/3842)).

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bench/BINARY_SIZE.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ The programs and their tests are located in [/tests/bench](https://github.com/co
1616

1717
Solana version: 2.3.0
1818

19-
| Program | Binary Size | - |
20-
| ------- | ----------- | --- |
21-
| bench | 1,126,840 | - |
19+
| Program | Binary Size | - |
20+
| ------- | ----------- | ----------------------- |
21+
| bench | 1,024,096 | 🟢 **-102,744 (9.12%)** |
2222

2323
### Notable changes
2424

@@ -28,9 +28,9 @@ Solana version: 2.3.0
2828

2929
Solana version: 2.3.0
3030

31-
| Program | Binary Size | - |
32-
| ------- | ----------- | ---------------------- |
33-
| bench | 1,126,840 | 🔴 **+84,912 (8.15%)** |
31+
| Program | Binary Size | - |
32+
| ------- | ----------- | ------------------------ |
33+
| bench | 1,126,840 | 🔴 **+181,272 (19.17%)** |
3434

3535
### Notable changes
3636

@@ -42,9 +42,9 @@ Solana version: 2.3.0
4242

4343
Solana version: 2.1.0
4444

45-
| Program | Binary Size | - |
46-
| ------- | ----------- | --- |
47-
| bench | 1,041,928 | - |
45+
| Program | Binary Size | - |
46+
| ------- | ----------- | ---------------------- |
47+
| bench | 945,568 | 🟢 **-96,360 (9.25%)** |
4848

4949
### Notable changes
5050

bench/COMPUTE_UNITS.md

Lines changed: 205 additions & 205 deletions
Large diffs are not rendered by default.

cli/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ portpicker = "0.1.1"
3333
regex = "1.8.3"
3434
reqwest = { version = "0.11.4", default-features = false, features = ["multipart", "blocking", "rustls-tls"] }
3535
semver = "1.0.4"
36-
serde = { version = "1.0.122", features = ["derive"] }
36+
serde = { version = "1.0.130", features = ["derive"] }
3737
serde_json = "1.0"
3838
shellexpand = "2.1.0"
3939
solana-cli-config = "2"

cli/src/lib.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ pub enum Command {
9494
#[clap(long)]
9595
no_git: bool,
9696
/// Rust program template to use
97-
#[clap(value_enum, short, long, default_value = "single")]
97+
#[clap(value_enum, short, long, default_value = "multiple")]
9898
template: ProgramTemplate,
9999
/// Test template to use
100100
#[clap(value_enum, long, default_value = "mocha")]
@@ -235,7 +235,7 @@ pub enum Command {
235235
/// Program name
236236
name: String,
237237
/// Rust program template to use
238-
#[clap(value_enum, short, long, default_value = "single")]
238+
#[clap(value_enum, short, long, default_value = "multiple")]
239239
template: ProgramTemplate,
240240
/// Create new program even if there is already one
241241
#[clap(long, action)]
@@ -2870,12 +2870,10 @@ fn deserialize_idl_type_to_json(
28702870
}
28712871
IdlType::F64 => json!(<f64 as AnchorDeserialize>::deserialize(data)?),
28722872
IdlType::U128 => {
2873-
// TODO: Remove to_string once serde_json supports u128 deserialization
2874-
json!(<u128 as AnchorDeserialize>::deserialize(data)?.to_string())
2873+
json!(<u128 as AnchorDeserialize>::deserialize(data)?)
28752874
}
28762875
IdlType::I128 => {
2877-
// TODO: Remove to_string once serde_json supports i128 deserialization
2878-
json!(<i128 as AnchorDeserialize>::deserialize(data)?.to_string())
2876+
json!(<i128 as AnchorDeserialize>::deserialize(data)?)
28792877
}
28802878
IdlType::U256 => todo!("Upon completion of u256 IDL standard"),
28812879
IdlType::I256 => todo!("Upon completion of i256 IDL standard"),

cli/src/rust_template.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ const ANCHOR_MSRV: &str = "1.89.0";
2323
/// Program initialization template
2424
#[derive(Clone, Debug, Default, Eq, PartialEq, Parser, ValueEnum)]
2525
pub enum ProgramTemplate {
26-
/// Program with a single `lib.rs` file
27-
#[default]
26+
/// Program with a single `lib.rs` file (not recommended for production)
2827
Single,
29-
/// Program with multiple files for instructions, state...
28+
/// Program with multiple files for instructions, state... (recommended)
29+
#[default]
3030
Multiple,
3131
}
3232

@@ -44,7 +44,10 @@ pub fn create_program(name: &str, template: ProgramTemplate, with_mollusk: bool)
4444
];
4545

4646
let template_files = match template {
47-
ProgramTemplate::Single => create_program_template_single(name, &program_path),
47+
ProgramTemplate::Single => {
48+
println!("Note: Using single-file template. For better code organization and maintainability, consider using --template multiple (default).");
49+
create_program_template_single(name, &program_path)
50+
}
4851
ProgramTemplate::Multiple => create_program_template_multiple(name, &program_path),
4952
};
5053

client/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ solana-account-decoder = "2"
2525
solana-pubsub-client = "2"
2626
solana-rpc-client = "2"
2727
solana-rpc-client-api = "2"
28+
solana-account = "2"
2829
solana-sdk = "2"
2930
thiserror = "1"
3031
tokio = { version = "1", features = ["rt", "sync"] }

client/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ use anchor_lang::solana_program::pubkey::Pubkey;
7474
use anchor_lang::{AccountDeserialize, Discriminator, InstructionData, ToAccountMetas};
7575
use futures::{Future, StreamExt};
7676
use regex::Regex;
77+
use solana_account::Account;
7778
use solana_account_decoder::UiAccountEncoding;
7879
use solana_pubsub_client::nonblocking::pubsub_client::{PubsubClient, PubsubClientError};
7980
use solana_rpc_client::nonblocking::rpc_client::RpcClient as AsyncRpcClient;
@@ -86,7 +87,6 @@ use solana_rpc_client_api::{
8687
filter::{Memcmp, RpcFilterType},
8788
response::{Response as RpcResponse, RpcLogsResponse},
8889
};
89-
use solana_sdk::account::Account;
9090
use solana_sdk::commitment_config::CommitmentConfig;
9191
use solana_sdk::hash::Hash;
9292
use solana_sdk::instruction::{AccountMeta, Instruction};

0 commit comments

Comments
 (0)