Skip to content

Commit

Permalink
Extract reserved-account-keys and sdk-ids crates (#3141)
Browse files Browse the repository at this point in the history
* minimize solana_sdk use in reserved_account_keys

* extract reserved-account-keys crate

* fix frozen-abi support in reserved-account-keys

* move id definitions to sdk-ids

* also move the IDs of zk_token_proof_program and zk_elgamal_proof_program

* fix some paths

* missing dev dep

* add doc_auto_cfg like in #3121

* fix copied sysvar id

* fix missing dep after rebase

* move stake::program::declare_id to stake::declare_id

* post-rebase fix
  • Loading branch information
kevinheavey authored Nov 7, 2024
1 parent 15b56c2 commit b8ac678
Show file tree
Hide file tree
Showing 60 changed files with 382 additions and 138 deletions.
34 changes: 33 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,9 @@ members = [
"sdk/program-pack",
"sdk/pubkey",
"sdk/rent",
"sdk/reserved-account-keys",
"sdk/sanitize",
"sdk/sdk-ids",
"sdk/seed-derivable",
"sdk/seed-phrase",
"sdk/serde-varint",
Expand Down Expand Up @@ -493,6 +495,7 @@ solana-quic-client = { path = "quic-client", version = "=2.2.0" }
solana-rayon-threadlimit = { path = "rayon-threadlimit", version = "=2.2.0" }
solana-remote-wallet = { path = "remote-wallet", version = "=2.2.0", default-features = false }
solana-rent = { path = "sdk/rent", version = "=2.2.0", default-features = false }
solana-reserved-account-keys = { path = "sdk/reserved-account-keys", version = "=2.2.0", default-features = false }
solana-reward-info = { path = "sdk/reward-info", version = "=2.2.0" }
solana-sanitize = { path = "sdk/sanitize", version = "=2.2.0" }
solana-seed-derivable = { path = "sdk/seed-derivable", version = "=2.2.0" }
Expand All @@ -515,6 +518,7 @@ solana-rpc-client-nonce-utils = { path = "rpc-client-nonce-utils", version = "=2
solana-runtime = { path = "runtime", version = "=2.2.0" }
solana-runtime-transaction = { path = "runtime-transaction", version = "=2.2.0" }
solana-sdk = { path = "sdk", version = "=2.2.0" }
solana-sdk-ids = { path = "sdk/sdk-ids", version = "=2.2.0" }
solana-sdk-macro = { path = "sdk/macro", version = "=2.2.0" }
solana-secp256k1-recover = { path = "curves/secp256k1-recover", version = "=2.2.0", default-features = false }
solana-send-transaction-service = { path = "send-transaction-service", version = "=2.2.0" }
Expand Down
31 changes: 30 additions & 1 deletion programs/sbf/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions sdk/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,10 @@ solana-presigner = { workspace = true, optional = true }
solana-program = { workspace = true }
solana-program-memory = { workspace = true }
solana-pubkey = { workspace = true, default-features = false, features = ["std"] }
solana-reserved-account-keys = { workspace = true }
solana-reward-info = { workspace = true, features = ["serde"] }
solana-sanitize = { workspace = true }
solana-sdk-ids = { workspace = true }
solana-sdk-macro = { workspace = true }
solana-secp256k1-recover = { workspace = true }
solana-seed-derivable = { workspace = true, optional = true }
Expand Down
3 changes: 2 additions & 1 deletion sdk/clock/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ edition = { workspace = true }
[dependencies]
serde = { workspace = true, optional = true }
serde_derive = { workspace = true, optional = true }
solana-sdk-ids = { workspace = true, optional = true }
solana-sdk-macro = { workspace = true }
solana-sysvar-id = { workspace = true, optional = true }

Expand All @@ -21,7 +22,7 @@ static_assertions = { workspace = true }

[features]
serde = ["dep:serde", "dep:serde_derive"]
sysvar = ["dep:solana-sysvar-id"]
sysvar = ["dep:solana-sdk-ids", "dep:solana-sysvar-id"]

[package.metadata.docs.rs]
targets = ["x86_64-unknown-linux-gnu"]
Expand Down
5 changes: 3 additions & 2 deletions sdk/clock/src/sysvar.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use {crate::Clock, solana_sysvar_id::declare_sysvar_id};
pub use solana_sdk_ids::sysvar::clock::{check_id, id, ID};
use {crate::Clock, solana_sysvar_id::impl_sysvar_id};

declare_sysvar_id!("SysvarC1ock11111111111111111111111111111111", Clock);
impl_sysvar_id!(Clock);
1 change: 1 addition & 0 deletions sdk/epoch-rewards/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ serde_derive = { workspace = true, optional = true }
solana-frozen-abi = { workspace = true, optional = true }
solana-frozen-abi-macro = { workspace = true, optional = true }
solana-hash = { workspace = true, default-features = false }
solana-sdk-ids = { workspace = true }
solana-sdk-macro = { workspace = true }
solana-sysvar-id = { workspace = true, optional = true }

Expand Down
5 changes: 3 additions & 2 deletions sdk/epoch-rewards/src/sysvar.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use {crate::EpochRewards, solana_sysvar_id::declare_sysvar_id};
pub use solana_sdk_ids::sysvar::epoch_rewards::{check_id, id, ID};
use {crate::EpochRewards, solana_sysvar_id::impl_sysvar_id};

declare_sysvar_id!("SysvarEpochRewards1111111111111111111111111", EpochRewards);
impl_sysvar_id!(EpochRewards);
3 changes: 2 additions & 1 deletion sdk/epoch-schedule/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ serde = { workspace = true, optional = true }
serde_derive = { workspace = true, optional = true }
solana-frozen-abi = { workspace = true, optional = true }
solana-frozen-abi-macro = { workspace = true, optional = true }
solana-sdk-ids = { workspace = true, optional = true }
solana-sdk-macro = { workspace = true }
solana-sysvar-id = { workspace = true, optional = true }

Expand All @@ -28,7 +29,7 @@ static_assertions = { workspace = true }
[features]
frozen-abi = ["dep:solana-frozen-abi", "dep:solana-frozen-abi-macro"]
serde = ["dep:serde", "dep:serde_derive"]
sysvar = ["dep:solana-sysvar-id"]
sysvar = ["dep:solana-sdk-ids", "dep:solana-sysvar-id"]

[lints]
workspace = true
5 changes: 3 additions & 2 deletions sdk/epoch-schedule/src/sysvar.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use {crate::EpochSchedule, solana_sysvar_id::declare_sysvar_id};
pub use solana_sdk_ids::sysvar::epoch_schedule::{check_id, id, ID};
use {crate::EpochSchedule, solana_sysvar_id::impl_sysvar_id};

declare_sysvar_id!("SysvarEpochSchedu1e111111111111111111111111", EpochSchedule);
impl_sysvar_id!(EpochSchedule);
1 change: 0 additions & 1 deletion sdk/feature-set/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ edition = { workspace = true }

[dependencies]
lazy_static = { workspace = true }
solana-clock = { workspace = true }
solana-epoch-schedule = { workspace = true }
solana-frozen-abi = { workspace = true, optional = true, features = [
"frozen-abi",
Expand Down
Loading

0 comments on commit b8ac678

Please sign in to comment.