Skip to content

Commit 949de95

Browse files
jamie-osecswaroop-osecjacobcreech
authored
feat: Update to Solana 3.0 (#4031)
* feat(lang): Update to Solana 3.0 * feat(client): Update to Solana 3.0 * feat(cli): Update to Solana 3.0 * feat(spl): Update to Solana 3.0 * fix: Lock `solana-sysvar` to 3.0.x * chore: Update test lockfiles * chore: Move `solana-*` dependencies into workspace `Cargo.toml` * chore: Update benchmarks * chore: update solana-invoke * chore: update solana-invoke in dependencies --------- Co-authored-by: swaroop-osec <swaroop@osec.io> Co-authored-by: jacobcreech <jacob.creech@solana.org>
1 parent 63b7177 commit 949de95

Some content is hidden

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

58 files changed

+3028
-4450
lines changed

Cargo.lock

Lines changed: 1343 additions & 2231 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 39 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
[workspace]
32
members = [
43
"avm",
@@ -13,11 +12,47 @@ members = [
1312
]
1413
exclude = ["tests/cfo/deps/openbook-dex", "tests/swap/deps/openbook-dex"]
1514
resolver = "2"
16-
[profile.release]
17-
lto = true
1815

1916
[workspace.dependencies]
20-
solana-signer = "2"
17+
solana-account = "3.0.0"
18+
solana-account-decoder = "3.0.0"
19+
solana-account-info = "3.0.0"
20+
solana-cli-config = "3.0.0"
21+
solana-clock = "3.0.0"
22+
solana-commitment-config = "3.0.0"
23+
solana-compute-budget-interface = "3.0.0"
24+
solana-cpi = "3.0.0"
25+
solana-define-syscall = "3.0.0"
26+
solana-faucet = "3.0.0"
27+
solana-feature-gate-interface = "3.0.0"
28+
solana-instruction = "3.0.0"
29+
solana-instructions-sysvar = "3.0.0"
30+
solana-invoke = "0.5.0"
31+
solana-keypair = "3.0.0"
32+
solana-loader-v3-interface = "6.0.0"
33+
solana-msg = "3.0.0"
34+
solana-program = "3.0.0"
35+
solana-program-entrypoint = "3.0.0"
36+
solana-program-error = "3.0.0"
37+
solana-program-memory = "3.0.0"
38+
solana-program-option = "3.0.0"
39+
solana-program-pack = "3.0.0"
40+
solana-pubkey = "4.0.0"
41+
solana-pubsub-client = "3.0.0"
42+
solana-rpc-client = "3.0.0"
43+
solana-rpc-client-api = "3.0.0"
44+
solana-sdk-ids = "3.0.0"
45+
solana-signature = "3.0.0"
46+
solana-signer = "3.0.0"
47+
solana-stake-interface = "2.0.0"
48+
solana-system-interface = "2.0.0"
49+
# FIXME: solana-sysvar 3.1.x contains breaking changes to sysvar retrieval
50+
solana-sysvar = "~3.0.0"
51+
solana-sysvar-id = "3.0.0"
52+
solana-transaction = "3.0.0"
53+
54+
[profile.release]
55+
lto = true
2156

2257
[profile.release.package.anchor-cli]
2358
codegen-units = 1

bench/BINARY_SIZE.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ Solana version: 2.3.0
2828

2929
Solana version: 2.3.0
3030

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

3535
### Notable changes
@@ -42,8 +42,8 @@ Solana version: 2.3.0
4242

4343
Solana version: 2.1.0
4444

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

4949
### Notable changes
@@ -66,8 +66,8 @@ Solana version: 2.1.0
6666

6767
Solana version: 2.1.0
6868

69-
| Program | Binary Size | - |
70-
| ------- | ----------- | ----------------------- |
69+
| Program | Binary Size | - |
70+
| ------- | ----------- | ------------------------ |
7171
| bench | 1,041,928 | 🔴 **+250,920 (31.72%)** |
7272

7373
### Notable changes
@@ -93,8 +93,8 @@ Solana version: 1.18.17
9393

9494
Solana version: 1.18.8
9595

96-
| Program | Binary Size | - |
97-
| ------- | ----------- | --------------------- |
96+
| Program | Binary Size | - |
97+
| ------- | ----------- | ---------------------- |
9898
| bench | 791,008 | 🔴 **+47,952 (6.45%)** |
9999

100100
### Notable changes
@@ -107,8 +107,8 @@ Solana version: 1.18.8
107107

108108
Solana version: 1.17.0
109109

110-
| Program | Binary Size | +/- |
111-
| ------- | ----------- | ----------------------- |
110+
| Program | Binary Size | +/- |
111+
| ------- | ----------- | ------------------------ |
112112
| bench | 743,056 | 🟢 **-417,904 (36.00%)** |
113113

114114
### Notable changes
@@ -123,8 +123,8 @@ Solana version: 1.17.0
123123

124124
Solana version: 1.16.0
125125

126-
| Program | Binary Size | +/- |
127-
| ------- | ----------- | --------------------- |
126+
| Program | Binary Size | +/- |
127+
| ------- | ----------- | ---------------------- |
128128
| bench | 1,160,960 | 🔴 **+23,272 (2.05%)** |
129129

130130
### Notable changes
@@ -141,4 +141,4 @@ Solana version: 1.14.16
141141
| ------- | ----------- | --- |
142142
| bench | 1,137,688 | N/A |
143143

144-
---
144+
---

bench/COMPUTE_UNITS.md

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

cli/Cargo.toml

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,19 @@ semver = "1.0.4"
3636
serde = { version = "1.0.130", features = ["derive"] }
3737
serde_json = "1.0"
3838
shellexpand = "2.1.0"
39-
solana-cli-config = "2"
40-
solana-faucet = "2"
41-
solana-rpc-client = "2"
42-
solana-sdk = "2"
39+
solana-cli-config.workspace = true
40+
solana-clock.workspace = true
41+
solana-commitment-config.workspace = true
42+
solana-compute-budget-interface.workspace = true
43+
solana-faucet = { workspace = true, features = ["agave-unstable-api"] }
44+
solana-instruction.workspace = true
45+
solana-keypair.workspace = true
46+
solana-pubkey.workspace = true
47+
solana-signature.workspace = true
4348
solana-signer.workspace = true
49+
solana-system-interface.workspace = true
50+
solana-transaction.workspace = true
51+
solana-rpc-client.workspace = true
4452
syn = { version = "1.0.60", features = ["full", "extra-traits"] }
4553
tar = "0.4.35"
4654
toml = "0.7.6"

cli/src/config.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ use serde::de::{self, MapAccess, Visitor};
1010
use serde::ser::SerializeMap;
1111
use serde::{Deserialize, Deserializer, Serialize, Serializer};
1212
use solana_cli_config::{Config as SolanaConfig, CONFIG_FILE};
13-
use solana_sdk::clock::Slot;
14-
use solana_sdk::pubkey::Pubkey;
15-
use solana_sdk::signature::Keypair;
13+
use solana_clock::Slot;
14+
use solana_keypair::Keypair;
15+
use solana_pubkey::Pubkey;
1616
use solana_signer::Signer;
1717
use std::collections::{BTreeMap, HashMap};
1818
use std::convert::TryFrom;

cli/src/lib.rs

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@ use regex::{Regex, RegexBuilder};
1818
use rust_template::{ProgramTemplate, TestTemplate};
1919
use semver::{Version, VersionReq};
2020
use serde_json::{json, Map, Value as JsonValue};
21+
use solana_commitment_config::CommitmentConfig;
22+
use solana_keypair::Keypair;
23+
use solana_pubkey::Pubkey;
2124
use solana_rpc_client::rpc_client::RpcClient;
22-
use solana_sdk::commitment_config::CommitmentConfig;
23-
use solana_sdk::pubkey::Pubkey;
24-
use solana_sdk::signature::{Keypair, Signer};
25-
use solana_signer::EncodableKey;
25+
use solana_signer::{EncodableKey, Signer};
2626
use std::collections::BTreeMap;
2727
use std::collections::HashMap;
2828
use std::collections::HashSet;
@@ -31,7 +31,6 @@ use std::fs::{self, File};
3131
use std::io::prelude::*;
3232
use std::path::{Path, PathBuf};
3333
use std::process::{Child, Command as ProcessCommand, Stdio};
34-
use std::str::FromStr;
3534
use std::string::ToString;
3635
use std::sync::LazyLock;
3736

@@ -487,7 +486,7 @@ pub enum ClusterCommand {
487486
}
488487

489488
fn get_keypair(path: &str) -> Result<Keypair> {
490-
solana_sdk::signature::read_keypair_file(path)
489+
solana_keypair::read_keypair_file(path)
491490
.map_err(|_| anyhow!("Unable to read keypair file ({path})"))
492491
}
493492

@@ -2402,7 +2401,7 @@ fn idl_ts(idl: &Idl) -> Result<String> {
24022401
let name = cur.get(1).unwrap().as_str();
24032402

24042403
// Do not modify pubkeys
2405-
if Pubkey::from_str(name).is_ok() {
2404+
if Pubkey::try_from(name).is_ok() {
24062405
return acc;
24072406
}
24082407

@@ -3032,7 +3031,7 @@ fn validator_flags(
30323031
.iter()
30333032
.map(|entry| {
30343033
let address = entry["address"].as_str().unwrap();
3035-
Pubkey::from_str(address)
3034+
Pubkey::try_from(address)
30363035
.map_err(|_| anyhow!("Invalid pubkey {}", address))
30373036
})
30383037
.collect::<Result<HashSet<Pubkey>>>()?
@@ -3070,7 +3069,7 @@ fn validator_flags(
30703069
.iter()
30713070
.map(|entry| {
30723071
let feature_flag = entry.as_str().unwrap();
3073-
Pubkey::from_str(feature_flag).map_err(|_| {
3072+
Pubkey::try_from(feature_flag).map_err(|_| {
30743073
anyhow!("Invalid pubkey (feature flag) {}", feature_flag)
30753074
})
30763075
})
@@ -3808,7 +3807,7 @@ fn keys_sync(cfg_override: &ConfigOverride, program_name: Option<String>) -> Res
38083807
println!("Found incorrect program id declaration in Anchor.toml for the program `{name}`");
38093808

38103809
// Update the program id
3811-
deployment.address = Pubkey::from_str(&actual_program_id).unwrap();
3810+
deployment.address = Pubkey::try_from(actual_program_id.as_str()).unwrap();
38123811
fs::write(cfg.path(), cfg.to_string())?;
38133812

38143813
println!("Updated to {actual_program_id}\n");

cli/src/rust_template.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,8 @@ use crate::{
55
use anyhow::Result;
66
use clap::{Parser, ValueEnum};
77
use heck::{ToLowerCamelCase, ToPascalCase, ToSnakeCase};
8-
use solana_sdk::{
9-
pubkey::Pubkey,
10-
signature::{read_keypair_file, write_keypair_file, Keypair},
11-
};
8+
use solana_keypair::{read_keypair_file, write_keypair_file, Keypair};
9+
use solana_pubkey::Pubkey;
1210
use solana_signer::Signer;
1311
use std::{
1412
fmt::Write as _,
@@ -792,7 +790,7 @@ fn test_initialize() {{
792790
let payer = read_keypair_file(&anchor_wallet).unwrap();
793791
794792
let client = Client::new_with_options(Cluster::Localnet, &payer, CommitmentConfig::confirmed());
795-
let program_id = Pubkey::from_str(program_id).unwrap();
793+
let program_id = Pubkey::try_from(program_id).unwrap();
796794
let program = client.program(program_id).unwrap();
797795
798796
let tx = program

client/Cargo.toml

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,17 @@ anyhow = "1"
2121
futures = "0.3"
2222
regex = "1"
2323
serde = { version = "1", features = ["derive"] }
24-
solana-account = "2"
25-
solana-account-decoder = "2"
26-
solana-pubsub-client = "2"
27-
solana-rpc-client = "2"
28-
solana-rpc-client-api = "2"
29-
solana-sdk = "2"
24+
solana-account.workspace = true
25+
solana-account-decoder.workspace = true
26+
solana-commitment-config.workspace = true
27+
solana-instruction.workspace = true
28+
solana-program.workspace = true
29+
solana-pubsub-client.workspace = true
30+
solana-rpc-client.workspace = true
31+
solana-rpc-client-api.workspace = true
32+
solana-signature.workspace = true
3033
solana-signer.workspace = true
34+
solana-transaction.workspace = true
3135
thiserror = "1"
3236
tokio = { version = "1", features = ["rt", "sync"] }
3337
url = "2"

client/example/Cargo.toml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ events = { path = "../../tests/events/programs/events", features = ["no-entrypoi
1919
anyhow = "1.0.32"
2020
clap = { version = "4.2.4", features = ["derive"] }
2121
shellexpand = "2.1.0"
22-
solana-sdk = "2"
22+
solana-commitment-config = "3.0.0"
23+
solana-sdk = "3.0.0"
24+
solana-signer = "3.0.0"
25+
solana-system-interface = "2.0.0"
2326
tokio = { version = "1", features = ["full"] }
24-
solana-signer = "2"

0 commit comments

Comments
 (0)