From 7fea2e458aefc35a7f486163dc916c729c5ce91e Mon Sep 17 00:00:00 2001 From: Justin Starry Date: Wed, 26 Mar 2025 17:25:22 -0500 Subject: [PATCH 1/2] Add agave-reserved-account-keys crate (#5513) (cherry picked from commit df2d3d83c899d9d711324e714a20aedf3c2dec71) # Conflicts: # Cargo.lock # Cargo.toml # core/Cargo.toml # core/src/banking_stage/unprocessed_packet_batches.rs # ledger/Cargo.toml # programs/sbf/Cargo.lock # svm/examples/Cargo.lock --- Cargo.lock | 37 ++- Cargo.toml | 9 +- cli-output/Cargo.toml | 2 +- cli-output/src/display.rs | 2 +- core/Cargo.toml | 5 + core/src/banking_stage/consumer.rs | 2 +- .../unprocessed_packet_batches.rs | 5 + cost-model/Cargo.toml | 2 +- cost-model/src/transaction_cost.rs | 2 +- entry/Cargo.toml | 2 +- entry/benches/entry_sigverify.rs | 2 +- entry/src/entry.rs | 2 +- ledger-tool/Cargo.toml | 1 + ledger-tool/src/main.rs | 2 +- ledger/Cargo.toml | 5 + ...ransaction_address_lookup_table_scanner.rs | 2 +- programs/sbf/Cargo.lock | 23 +- programs/sbf/Cargo.toml | 2 + programs/sbf/tests/programs.rs | 2 +- reserved-account-keys/Cargo.toml | 37 +++ reserved-account-keys/src/lib.rs | 260 ++++++++++++++++++ rpc/Cargo.toml | 1 + rpc/src/rpc.rs | 2 +- rpc/src/transaction_status_service.rs | 2 +- runtime-transaction/Cargo.toml | 2 +- .../runtime_transaction/sdk_transactions.rs | 2 +- .../runtime_transaction/transaction_view.rs | 2 +- runtime/Cargo.toml | 1 + runtime/src/bank.rs | 2 +- runtime/src/snapshot_minimizer.rs | 2 +- storage-bigtable/Cargo.toml | 2 +- storage-bigtable/src/lib.rs | 2 +- svm/Cargo.toml | 2 +- svm/examples/Cargo.lock | 23 +- svm/examples/Cargo.toml | 1 + svm/examples/json-rpc/server/Cargo.toml | 1 + .../json-rpc/server/src/rpc_process.rs | 2 +- svm/src/account_loader.rs | 2 +- svm/src/message_processor.rs | 2 +- svm/src/transaction_account_state_info.rs | 2 +- svm/src/transaction_processor.rs | 2 +- svm/tests/transaction_builder.rs | 2 +- transaction-status/Cargo.toml | 2 +- transaction-status/src/lib.rs | 2 +- transaction-status/src/parse_accounts.rs | 4 +- 45 files changed, 428 insertions(+), 45 deletions(-) create mode 100644 reserved-account-keys/Cargo.toml create mode 100644 reserved-account-keys/src/lib.rs diff --git a/Cargo.lock b/Cargo.lock index c9dce7f0782..d93d1d052a9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -204,6 +204,7 @@ dependencies = [ name = "agave-ledger-tool" version = "2.2.6" dependencies = [ + "agave-reserved-account-keys", "assert_cmd", "bs58", "bytecount", @@ -259,6 +260,20 @@ dependencies = [ "tokio", ] +[[package]] +name = "agave-reserved-account-keys" +version = "2.3.0" +dependencies = [ + "lazy_static", + "solana-feature-set", + "solana-frozen-abi", + "solana-frozen-abi-macro", + "solana-message", + "solana-pubkey", + "solana-sdk-ids", + "solana-sysvar", +] + [[package]] name = "agave-store-histogram" version = "2.2.6" @@ -6897,6 +6912,7 @@ name = "solana-cli-output" version = "2.2.6" dependencies = [ "Inflector", + "agave-reserved-account-keys", "base64 0.22.1", "chrono", "clap 2.33.3", @@ -6922,7 +6938,6 @@ dependencies = [ "solana-packet", "solana-program", "solana-pubkey", - "solana-reserved-account-keys", "solana-rpc-client-api", "solana-sdk-ids", "solana-signature", @@ -7199,6 +7214,7 @@ name = "solana-core" version = "2.2.6" dependencies = [ "agave-banking-stage-ingress-types", + "agave-reserved-account-keys", "agave-transaction-view", "ahash 0.8.11", "anyhow", @@ -7307,6 +7323,7 @@ dependencies = [ name = "solana-cost-model" version = "2.2.6" dependencies = [ + "agave-reserved-account-keys", "ahash 0.8.11", "itertools 0.12.1", "lazy_static", @@ -7333,7 +7350,6 @@ dependencies = [ "solana-metrics", "solana-packet", "solana-pubkey", - "solana-reserved-account-keys", "solana-runtime-transaction", "solana-sdk-ids", "solana-signature", @@ -7475,6 +7491,7 @@ dependencies = [ name = "solana-entry" version = "2.2.6" dependencies = [ + "agave-reserved-account-keys", "assert_matches", "bincode", "crossbeam-channel", @@ -7495,7 +7512,6 @@ dependencies = [ "solana-perf", "solana-pubkey", "solana-rayon-threadlimit", - "solana-reserved-account-keys", "solana-runtime-transaction", "solana-sha256-hasher", "solana-signature", @@ -8079,6 +8095,11 @@ dependencies = [ name = "solana-ledger" version = "2.2.6" dependencies = [ +<<<<<<< HEAD +======= + "agave-reserved-account-keys", + "anyhow", +>>>>>>> df2d3d83c (Add agave-reserved-account-keys crate (#5513)) "assert_matches", "bincode", "bitflags 2.8.0", @@ -9067,6 +9088,7 @@ dependencies = [ name = "solana-rpc" version = "2.2.6" dependencies = [ + "agave-reserved-account-keys", "base64 0.22.1", "bincode", "bs58", @@ -9277,6 +9299,7 @@ dependencies = [ name = "solana-runtime" version = "2.2.6" dependencies = [ + "agave-reserved-account-keys", "agave-transaction-view", "ahash 0.8.11", "aquamarine", @@ -9376,6 +9399,7 @@ dependencies = [ name = "solana-runtime-transaction" version = "2.2.6" dependencies = [ + "agave-reserved-account-keys", "agave-transaction-view", "bincode", "criterion", @@ -9391,7 +9415,6 @@ dependencies = [ "solana-message", "solana-program", "solana-pubkey", - "solana-reserved-account-keys", "solana-sdk-ids", "solana-signature", "solana-signer", @@ -9827,6 +9850,7 @@ dependencies = [ name = "solana-storage-bigtable" version = "2.2.6" dependencies = [ + "agave-reserved-account-keys", "backoff", "bincode", "bytes", @@ -9851,7 +9875,6 @@ dependencies = [ "solana-message", "solana-metrics", "solana-pubkey", - "solana-reserved-account-keys", "solana-serde", "solana-signature", "solana-storage-proto", @@ -9944,6 +9967,7 @@ dependencies = [ name = "solana-svm" version = "2.2.6" dependencies = [ + "agave-reserved-account-keys", "ahash 0.8.11", "assert_matches", "bincode", @@ -9992,7 +10016,6 @@ dependencies = [ "solana-pubkey", "solana-rent", "solana-rent-debits", - "solana-reserved-account-keys", "solana-sbpf", "solana-sdk", "solana-sdk-ids", @@ -10488,6 +10511,7 @@ name = "solana-transaction-status" version = "2.2.6" dependencies = [ "Inflector", + "agave-reserved-account-keys", "base64 0.22.1", "bincode", "borsh 1.5.5", @@ -10506,7 +10530,6 @@ dependencies = [ "solana-message", "solana-program", "solana-pubkey", - "solana-reserved-account-keys", "solana-reward-info", "solana-sdk-ids", "solana-signature", diff --git a/Cargo.toml b/Cargo.toml index 5975af56bd7..d2e7b4b1130 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -103,6 +103,7 @@ members = [ "rayon-threadlimit", "rbpf-cli", "remote-wallet", + "reserved-account-keys", "rpc", "rpc-client", "rpc-client-api", @@ -173,8 +174,15 @@ check-cfg = [ [workspace.dependencies] Inflector = "0.11.4" axum = "0.7.9" +<<<<<<< HEAD agave-banking-stage-ingress-types = { path = "banking-stage-ingress-types", version = "=2.2.6" } agave-transaction-view = { path = "transaction-view", version = "=2.2.6" } +======= +agave-banking-stage-ingress-types = { path = "banking-stage-ingress-types", version = "=2.3.0" } +agave-feature-set = { path = "feature-set", version = "=2.3.0" } +agave-reserved-account-keys = { path = "reserved-account-keys", version = "=2.3.0" } +agave-transaction-view = { path = "transaction-view", version = "=2.3.0" } +>>>>>>> df2d3d83c (Add agave-reserved-account-keys crate (#5513)) aquamarine = "0.6.0" aes-gcm-siv = "0.11.1" ahash = "0.8.11" @@ -486,7 +494,6 @@ solana-remote-wallet = { path = "remote-wallet", version = "=2.2.6", default-fea solana-rent = "=2.2.1" solana-rent-collector = "=2.2.1" solana-rent-debits = "=2.2.1" -solana-reserved-account-keys = "=2.2.1" solana-reward-info = "=2.2.1" solana-sanitize = "=2.2.1" solana-secp256r1-program = "=2.2.1" diff --git a/cli-output/Cargo.toml b/cli-output/Cargo.toml index 95cc7767c72..3cc8cd9bc27 100644 --- a/cli-output/Cargo.toml +++ b/cli-output/Cargo.toml @@ -11,6 +11,7 @@ edition = { workspace = true } [dependencies] Inflector = { workspace = true } +agave-reserved-account-keys = { workspace = true } base64 = { workspace = true } chrono = { workspace = true, features = ["default", "serde"] } clap = "2.33.0" @@ -34,7 +35,6 @@ solana-native-token = { workspace = true } solana-packet = { workspace = true } solana-program = { workspace = true } solana-pubkey = { workspace = true } -solana-reserved-account-keys = { workspace = true } solana-rpc-client-api = { workspace = true } solana-sdk-ids = { workspace = true } solana-signature = { workspace = true } diff --git a/cli-output/src/display.rs b/cli-output/src/display.rs index 9a31d11692b..94c8f239172 100644 --- a/cli-output/src/display.rs +++ b/cli-output/src/display.rs @@ -1,5 +1,6 @@ use { crate::cli_output::CliSignatureVerificationStatus, + agave_reserved_account_keys::ReservedAccountKeys, base64::{prelude::BASE64_STANDARD, Engine}, chrono::{DateTime, Local, SecondsFormat, TimeZone, Utc}, console::style, @@ -12,7 +13,6 @@ use { solana_native_token::lamports_to_sol, solana_program::stake, solana_pubkey::Pubkey, - solana_reserved_account_keys::ReservedAccountKeys, solana_signature::Signature, solana_transaction::versioned::{TransactionVersion, VersionedTransaction}, solana_transaction_error::TransactionError, diff --git a/core/Cargo.toml b/core/Cargo.toml index 71582f828cd..8d68a306fe0 100644 --- a/core/Cargo.toml +++ b/core/Cargo.toml @@ -107,6 +107,11 @@ tokio = { workspace = true, features = ["full"] } trees = { workspace = true } [dev-dependencies] +<<<<<<< HEAD +======= +agave-reserved-account-keys = { workspace = true } +criterion = { workspace = true } +>>>>>>> df2d3d83c (Add agave-reserved-account-keys crate (#5513)) fs_extra = { workspace = true } serde_json = { workspace = true } serial_test = { workspace = true } diff --git a/core/src/banking_stage/consumer.rs b/core/src/banking_stage/consumer.rs index 3566f9df822..aa521088461 100644 --- a/core/src/banking_stage/consumer.rs +++ b/core/src/banking_stage/consumer.rs @@ -855,6 +855,7 @@ mod tests { unprocessed_packet_batches::{DeserializedPacket, UnprocessedPacketBatches}, unprocessed_transaction_storage::ThreadType, }, + agave_reserved_account_keys::ReservedAccountKeys, crossbeam_channel::{unbounded, Receiver}, solana_cost_model::{cost_model::CostModel, transaction_cost::TransactionCost}, solana_entry::entry::{next_entry, next_versioned_entry}, @@ -889,7 +890,6 @@ mod tests { nonce_account::verify_nonce_account, poh_config::PohConfig, pubkey::Pubkey, - reserved_account_keys::ReservedAccountKeys, signature::Keypair, signer::Signer, system_instruction, system_program, system_transaction, diff --git a/core/src/banking_stage/unprocessed_packet_batches.rs b/core/src/banking_stage/unprocessed_packet_batches.rs index 4c32a311875..5c89514b23e 100644 --- a/core/src/banking_stage/unprocessed_packet_batches.rs +++ b/core/src/banking_stage/unprocessed_packet_batches.rs @@ -295,12 +295,17 @@ impl UnprocessedPacketBatches { mod tests { use { super::*, + agave_reserved_account_keys::ReservedAccountKeys, solana_perf::packet::PacketFlags, solana_runtime::bank::Bank, solana_sdk::{ +<<<<<<< HEAD compute_budget::ComputeBudgetInstruction, message::Message, reserved_account_keys::ReservedAccountKeys, +======= + hash::Hash, +>>>>>>> df2d3d83c (Add agave-reserved-account-keys crate (#5513)) signature::{Keypair, Signer}, system_instruction, system_transaction, transaction::Transaction, diff --git a/cost-model/Cargo.toml b/cost-model/Cargo.toml index 821160d610a..a40cf3d4ee2 100644 --- a/cost-model/Cargo.toml +++ b/cost-model/Cargo.toml @@ -47,6 +47,7 @@ crate-type = ["lib"] name = "solana_cost_model" [dev-dependencies] +agave-reserved-account-keys = { workspace = true } itertools = { workspace = true } rand = "0.8.5" # See order-crates-for-publishing.py for using this unusual `path = "."` @@ -60,7 +61,6 @@ solana-instruction = { workspace = true } solana-keypair = { workspace = true } solana-logger = { workspace = true } solana-pubkey = { workspace = true, features = ["rand"] } -solana-reserved-account-keys = { workspace = true } solana-runtime-transaction = { workspace = true, features = [ "dev-context-only-utils", ] } diff --git a/cost-model/src/transaction_cost.rs b/cost-model/src/transaction_cost.rs index 824f447392f..f0676524c7f 100644 --- a/cost-model/src/transaction_cost.rs +++ b/cost-model/src/transaction_cost.rs @@ -291,11 +291,11 @@ mod tests { use { super::*, crate::cost_model::CostModel, + agave_reserved_account_keys::ReservedAccountKeys, solana_feature_set::FeatureSet, solana_hash::Hash, solana_keypair::Keypair, solana_message::SimpleAddressLoader, - solana_reserved_account_keys::ReservedAccountKeys, solana_runtime_transaction::runtime_transaction::RuntimeTransaction, solana_transaction::{sanitized::MessageHash, versioned::VersionedTransaction}, solana_vote_program::{vote_state::TowerSync, vote_transaction}, diff --git a/entry/Cargo.toml b/entry/Cargo.toml index 26d9f11ea8d..4ea3d9e58e5 100644 --- a/entry/Cargo.toml +++ b/entry/Cargo.toml @@ -31,13 +31,13 @@ solana-transaction = { workspace = true } solana-transaction-error = { workspace = true } [dev-dependencies] +agave-reserved-account-keys = { workspace = true } assert_matches = { workspace = true } solana-keypair = { workspace = true } solana-logger = { workspace = true } solana-message = { workspace = true } solana-perf = { workspace = true, features = ["dev-context-only-utils"] } solana-pubkey = { workspace = true } -solana-reserved-account-keys = { workspace = true } solana-signature = { workspace = true } solana-signer = { workspace = true } solana-system-transaction = { workspace = true } diff --git a/entry/benches/entry_sigverify.rs b/entry/benches/entry_sigverify.rs index a4488af586f..12b30e23200 100644 --- a/entry/benches/entry_sigverify.rs +++ b/entry/benches/entry_sigverify.rs @@ -1,11 +1,11 @@ #![feature(test)] extern crate test; use { + agave_reserved_account_keys::ReservedAccountKeys, solana_entry::entry::{self, VerifyRecyclers}, solana_hash::Hash, solana_message::SimpleAddressLoader, solana_perf::test_tx::test_tx, - solana_reserved_account_keys::ReservedAccountKeys, solana_runtime_transaction::runtime_transaction::RuntimeTransaction, solana_transaction::{ sanitized::{MessageHash, SanitizedTransaction}, diff --git a/entry/src/entry.rs b/entry/src/entry.rs index 6877e73dcb7..dcb60f140cc 100644 --- a/entry/src/entry.rs +++ b/entry/src/entry.rs @@ -974,12 +974,12 @@ pub fn thread_pool_for_benches() -> ThreadPool { mod tests { use { super::*, + agave_reserved_account_keys::ReservedAccountKeys, solana_hash::Hash, solana_keypair::Keypair, solana_message::SimpleAddressLoader, solana_perf::test_tx::{test_invalid_tx, test_tx}, solana_pubkey::Pubkey, - solana_reserved_account_keys::ReservedAccountKeys, solana_runtime_transaction::runtime_transaction::RuntimeTransaction, solana_sha256_hasher::hash, solana_signer::Signer, diff --git a/ledger-tool/Cargo.toml b/ledger-tool/Cargo.toml index 075b36826c3..74a7cdb58db 100644 --- a/ledger-tool/Cargo.toml +++ b/ledger-tool/Cargo.toml @@ -10,6 +10,7 @@ license = { workspace = true } edition = { workspace = true } [dependencies] +agave-reserved-account-keys = { workspace = true } bs58 = { workspace = true } chrono = { workspace = true, features = ["default"] } clap = { workspace = true } diff --git a/ledger-tool/src/main.rs b/ledger-tool/src/main.rs index 180b498e8f7..73195abafee 100644 --- a/ledger-tool/src/main.rs +++ b/ledger-tool/src/main.rs @@ -12,6 +12,7 @@ use { }, program::*, }, + agave_reserved_account_keys::ReservedAccountKeys, clap::{ crate_description, crate_name, value_t, value_t_or_exit, values_t_or_exit, App, AppSettings, Arg, ArgMatches, SubCommand, @@ -70,7 +71,6 @@ use { native_token::{lamports_to_sol, sol_to_lamports, Sol}, pubkey::Pubkey, rent::Rent, - reserved_account_keys::ReservedAccountKeys, shred_version::compute_shred_version, stake::{self, state::StakeStateV2}, system_program, diff --git a/ledger/Cargo.toml b/ledger/Cargo.toml index 836a81fc75b..80207e68f49 100644 --- a/ledger/Cargo.toml +++ b/ledger/Cargo.toml @@ -10,6 +10,11 @@ license = { workspace = true } edition = { workspace = true } [dependencies] +<<<<<<< HEAD +======= +agave-reserved-account-keys = { workspace = true } +anyhow = { workspace = true } +>>>>>>> df2d3d83c (Add agave-reserved-account-keys crate (#5513)) assert_matches = { workspace = true } bincode = { workspace = true } bitflags = { workspace = true, features = ["serde"] } diff --git a/ledger/src/transaction_address_lookup_table_scanner.rs b/ledger/src/transaction_address_lookup_table_scanner.rs index ec0e22059ac..12465357cf5 100644 --- a/ledger/src/transaction_address_lookup_table_scanner.rs +++ b/ledger/src/transaction_address_lookup_table_scanner.rs @@ -1,10 +1,10 @@ use { + agave_reserved_account_keys::ReservedAccountKeys, bincode::deserialize, lazy_static::lazy_static, solana_sdk::{ address_lookup_table::{self, instruction::ProgramInstruction}, pubkey::Pubkey, - reserved_account_keys::ReservedAccountKeys, transaction::SanitizedVersionedTransaction, }, std::collections::HashSet, diff --git a/programs/sbf/Cargo.lock b/programs/sbf/Cargo.lock index 825ea4d915c..2aba824302e 100644 --- a/programs/sbf/Cargo.lock +++ b/programs/sbf/Cargo.lock @@ -83,6 +83,16 @@ dependencies = [ "thiserror 2.0.11", ] +[[package]] +name = "agave-reserved-account-keys" +version = "2.3.0" +dependencies = [ + "lazy_static", + "solana-feature-set", + "solana-pubkey", + "solana-sdk-ids", +] + [[package]] name = "agave-transaction-view" version = "2.2.6" @@ -5447,6 +5457,7 @@ name = "solana-cli-output" version = "2.2.6" dependencies = [ "Inflector", + "agave-reserved-account-keys", "base64 0.22.1", "chrono", "clap", @@ -5470,7 +5481,6 @@ dependencies = [ "solana-packet", "solana-program", "solana-pubkey", - "solana-reserved-account-keys", "solana-rpc-client-api", "solana-sdk-ids", "solana-signature", @@ -6335,6 +6345,11 @@ dependencies = [ name = "solana-ledger" version = "2.2.6" dependencies = [ +<<<<<<< HEAD +======= + "agave-reserved-account-keys", + "anyhow", +>>>>>>> df2d3d83c (Add agave-reserved-account-keys crate (#5513)) "assert_matches", "bincode", "bitflags 2.8.0", @@ -7281,6 +7296,7 @@ dependencies = [ name = "solana-runtime" version = "2.2.6" dependencies = [ + "agave-reserved-account-keys", "ahash 0.8.11", "aquamarine", "arrayref", @@ -7391,6 +7407,7 @@ checksum = "61f1bc1357b8188d9c4a3af3fc55276e56987265eb7ad073ae6f8180ee54cecf" name = "solana-sbf-programs" version = "2.2.6" dependencies = [ + "agave-reserved-account-keys", "agave-validator", "bincode", "borsh 1.5.5", @@ -8256,6 +8273,7 @@ dependencies = [ name = "solana-storage-bigtable" version = "2.2.6" dependencies = [ + "agave-reserved-account-keys", "backoff", "bincode", "bytes", @@ -8278,7 +8296,6 @@ dependencies = [ "solana-message", "solana-metrics", "solana-pubkey", - "solana-reserved-account-keys", "solana-serde", "solana-signature", "solana-storage-proto", @@ -8717,6 +8734,7 @@ name = "solana-transaction-status" version = "2.2.6" dependencies = [ "Inflector", + "agave-reserved-account-keys", "base64 0.22.1", "bincode", "borsh 1.5.5", @@ -8734,7 +8752,6 @@ dependencies = [ "solana-message", "solana-program", "solana-pubkey", - "solana-reserved-account-keys", "solana-reward-info", "solana-sdk-ids", "solana-signature", diff --git a/programs/sbf/Cargo.toml b/programs/sbf/Cargo.toml index 25ebf474c4d..571396a3b6c 100644 --- a/programs/sbf/Cargo.toml +++ b/programs/sbf/Cargo.toml @@ -15,6 +15,7 @@ check-cfg = [ ] [workspace.dependencies] +agave-reserved-account-keys = { path = "../../reserved-account-keys", version = "=2.3.0" } array-bytes = "=1.4.1" bincode = { version = "1.1.4", default-features = false } blake3 = "1.0.0" @@ -101,6 +102,7 @@ dummy-for-ci-check = ["sbf_c", "sbf_rust"] frozen-abi = [] [dev-dependencies] +agave-reserved-account-keys = { workspace = true } agave-validator = { workspace = true } bincode = { workspace = true } borsh = { workspace = true } diff --git a/programs/sbf/tests/programs.rs b/programs/sbf/tests/programs.rs index 738aee26afe..7ccded41b22 100644 --- a/programs/sbf/tests/programs.rs +++ b/programs/sbf/tests/programs.rs @@ -9,6 +9,7 @@ #[cfg(feature = "sbf_rust")] use { + agave_reserved_account_keys::ReservedAccountKeys, borsh::{from_slice, to_vec, BorshDeserialize, BorshSerialize}, solana_compute_budget::compute_budget::ComputeBudget, solana_compute_budget_instruction::instructions_processor::process_compute_budget_instructions, @@ -47,7 +48,6 @@ use { message::{Message, SanitizedMessage}, pubkey::Pubkey, rent::Rent, - reserved_account_keys::ReservedAccountKeys, signature::{Keypair, Signer}, stake, system_instruction::MAX_PERMITTED_DATA_LENGTH, diff --git a/reserved-account-keys/Cargo.toml b/reserved-account-keys/Cargo.toml new file mode 100644 index 00000000000..94fe6c05c67 --- /dev/null +++ b/reserved-account-keys/Cargo.toml @@ -0,0 +1,37 @@ +[package] +name = "agave-reserved-account-keys" +description = "Reserved Solana account keys" +documentation = "https://docs.rs/agave-reserved-account-keys" +version = { workspace = true } +authors = { workspace = true } +repository = { workspace = true } +homepage = { workspace = true } +license = { workspace = true } +edition = { workspace = true } + +[dependencies] +lazy_static = { workspace = true } +solana-feature-set = { workspace = true } +solana-frozen-abi = { workspace = true, optional = true, features = [ + "frozen-abi", +] } +solana-frozen-abi-macro = { workspace = true, optional = true, features = [ + "frozen-abi", +] } +solana-pubkey = { workspace = true, default-features = false } +solana-sdk-ids = { workspace = true } + +[dev-dependencies] +solana-message = { workspace = true } +solana-sysvar = { workspace = true } + +[features] +frozen-abi = ["dep:solana-frozen-abi", "dep:solana-frozen-abi-macro"] + +[package.metadata.docs.rs] +targets = ["x86_64-unknown-linux-gnu"] +all-features = true +rustdoc-args = ["--cfg=docsrs"] + +[lints] +workspace = true diff --git a/reserved-account-keys/src/lib.rs b/reserved-account-keys/src/lib.rs new file mode 100644 index 00000000000..06cad17e20c --- /dev/null +++ b/reserved-account-keys/src/lib.rs @@ -0,0 +1,260 @@ +//! Collection of reserved account keys that cannot be write-locked by transactions. +//! New reserved account keys may be added as long as they specify a feature +//! gate that transitions the key into read-only at an epoch boundary. +#![cfg_attr(feature = "frozen-abi", feature(min_specialization))] +#![cfg_attr(docsrs, feature(doc_auto_cfg))] +use { + lazy_static::lazy_static, + solana_feature_set::{self as feature_set, FeatureSet}, + solana_pubkey::Pubkey, + solana_sdk_ids::{ + address_lookup_table, bpf_loader, bpf_loader_deprecated, bpf_loader_upgradeable, + compute_budget, config, ed25519_program, feature, loader_v4, native_loader, + secp256k1_program, secp256r1_program, stake, system_program, sysvar, vote, + zk_elgamal_proof_program, zk_token_proof_program, + }, + std::collections::{HashMap, HashSet}, +}; + +// ReservedAccountKeys is not serialized into or deserialized from bank +// snapshots but the bank requires this trait to be implemented anyways. +#[cfg(feature = "frozen-abi")] +impl ::solana_frozen_abi::abi_example::AbiExample for ReservedAccountKeys { + fn example() -> Self { + // ReservedAccountKeys is not Serialize so just rely on Default. + ReservedAccountKeys::default() + } +} + +/// `ReservedAccountKeys` holds the set of currently active/inactive +/// account keys that are reserved by the protocol and may not be write-locked +/// during transaction processing. +#[derive(Debug, Clone, PartialEq)] +pub struct ReservedAccountKeys { + /// Set of currently active reserved account keys + pub active: HashSet, + /// Set of currently inactive reserved account keys that will be moved to the + /// active set when their feature id is activated + inactive: HashMap, +} + +impl Default for ReservedAccountKeys { + fn default() -> Self { + Self::new(&RESERVED_ACCOUNTS) + } +} + +impl ReservedAccountKeys { + /// Compute a set of active / inactive reserved account keys from a list of + /// keys with a designated feature id. If a reserved account key doesn't + /// designate a feature id, it's already activated and should be inserted + /// into the active set. If it does have a feature id, insert the key and + /// its feature id into the inactive map. + fn new(reserved_accounts: &[ReservedAccount]) -> Self { + Self { + active: reserved_accounts + .iter() + .filter(|reserved| reserved.feature_id.is_none()) + .map(|reserved| reserved.key) + .collect(), + inactive: reserved_accounts + .iter() + .filter_map(|ReservedAccount { key, feature_id }| { + feature_id.as_ref().map(|feature_id| (*key, *feature_id)) + }) + .collect(), + } + } + + /// Compute a set with all reserved keys active, regardless of whether their + /// feature was activated. This is not to be used by the runtime. Useful for + /// off-chain utilities that need to filter out reserved accounts. + pub fn new_all_activated() -> Self { + Self { + active: Self::all_keys_iter().copied().collect(), + inactive: HashMap::default(), + } + } + + /// Returns whether the specified key is reserved + pub fn is_reserved(&self, key: &Pubkey) -> bool { + self.active.contains(key) + } + + /// Move inactive reserved account keys to the active set if their feature + /// is active. + pub fn update_active_set(&mut self, feature_set: &FeatureSet) { + self.inactive.retain(|reserved_key, feature_id| { + if feature_set.is_active(feature_id) { + self.active.insert(*reserved_key); + false + } else { + true + } + }); + } + + /// Return an iterator over all active / inactive reserved keys. This is not + /// to be used by the runtime. Useful for off-chain utilities that need to + /// filter out reserved accounts. + pub fn all_keys_iter() -> impl Iterator { + RESERVED_ACCOUNTS + .iter() + .map(|reserved_key| &reserved_key.key) + } + + /// Return an empty set of reserved keys for visibility when using in + /// tests where the dynamic reserved key set is not available + pub fn empty_key_set() -> HashSet { + HashSet::default() + } +} + +/// `ReservedAccount` represents a reserved account that will not be +/// write-lockable by transactions. If a feature id is set, the account will +/// become read-only only after the feature has been activated. +#[derive(Debug, Clone, Copy, Eq, PartialEq)] +struct ReservedAccount { + key: Pubkey, + feature_id: Option, +} + +impl ReservedAccount { + fn new_pending(key: Pubkey, feature_id: Pubkey) -> Self { + Self { + key, + feature_id: Some(feature_id), + } + } + + fn new_active(key: Pubkey) -> Self { + Self { + key, + feature_id: None, + } + } +} + +// New reserved accounts should be added in alphabetical order and must specify +// a feature id for activation. Reserved accounts cannot be removed from this +// list without breaking consensus. +lazy_static! { + static ref RESERVED_ACCOUNTS: Vec = [ + // builtin programs + ReservedAccount::new_pending(address_lookup_table::id(), feature_set::add_new_reserved_account_keys::id()), + ReservedAccount::new_active(bpf_loader::id()), + ReservedAccount::new_active(bpf_loader_deprecated::id()), + ReservedAccount::new_active(bpf_loader_upgradeable::id()), + ReservedAccount::new_pending(compute_budget::id(), feature_set::add_new_reserved_account_keys::id()), + ReservedAccount::new_active(config::id()), + ReservedAccount::new_pending(ed25519_program::id(), feature_set::add_new_reserved_account_keys::id()), + ReservedAccount::new_active(feature::id()), + ReservedAccount::new_pending(loader_v4::id(), feature_set::add_new_reserved_account_keys::id()), + ReservedAccount::new_pending(secp256k1_program::id(), feature_set::add_new_reserved_account_keys::id()), + ReservedAccount::new_pending(secp256r1_program::id(), feature_set::enable_secp256r1_precompile::id()), + #[allow(deprecated)] + ReservedAccount::new_active(stake::config::id()), + ReservedAccount::new_active(stake::id()), + ReservedAccount::new_active(system_program::id()), + ReservedAccount::new_active(vote::id()), + ReservedAccount::new_pending(zk_elgamal_proof_program::id(), feature_set::add_new_reserved_account_keys::id()), + ReservedAccount::new_pending(zk_token_proof_program::id(), feature_set::add_new_reserved_account_keys::id()), + + // sysvars + ReservedAccount::new_active(sysvar::clock::id()), + ReservedAccount::new_pending(sysvar::epoch_rewards::id(), feature_set::add_new_reserved_account_keys::id()), + ReservedAccount::new_active(sysvar::epoch_schedule::id()), + #[allow(deprecated)] + ReservedAccount::new_active(sysvar::fees::id()), + ReservedAccount::new_active(sysvar::instructions::id()), + ReservedAccount::new_pending(sysvar::last_restart_slot::id(), feature_set::add_new_reserved_account_keys::id()), + #[allow(deprecated)] + ReservedAccount::new_active(sysvar::recent_blockhashes::id()), + ReservedAccount::new_active(sysvar::rent::id()), + ReservedAccount::new_active(sysvar::rewards::id()), + ReservedAccount::new_active(sysvar::slot_hashes::id()), + ReservedAccount::new_active(sysvar::slot_history::id()), + ReservedAccount::new_active(sysvar::stake_history::id()), + + // other + ReservedAccount::new_active(native_loader::id()), + ReservedAccount::new_pending(sysvar::id(), feature_set::add_new_reserved_account_keys::id()), + ].to_vec(); +} + +#[cfg(test)] +mod tests { + #![allow(deprecated)] + use {super::*, solana_message::legacy::BUILTIN_PROGRAMS_KEYS, solana_sysvar::ALL_IDS}; + + #[test] + fn test_is_reserved() { + let feature_id = Pubkey::new_unique(); + let active_reserved_account = ReservedAccount::new_active(Pubkey::new_unique()); + let pending_reserved_account = + ReservedAccount::new_pending(Pubkey::new_unique(), feature_id); + let reserved_account_keys = + ReservedAccountKeys::new(&[active_reserved_account, pending_reserved_account]); + + assert!( + reserved_account_keys.is_reserved(&active_reserved_account.key), + "active reserved accounts should be inserted into the active set" + ); + assert!( + !reserved_account_keys.is_reserved(&pending_reserved_account.key), + "pending reserved accounts should NOT be inserted into the active set" + ); + } + + #[test] + fn test_update_active_set() { + let feature_ids = [Pubkey::new_unique(), Pubkey::new_unique()]; + let active_reserved_key = Pubkey::new_unique(); + let pending_reserved_keys = [Pubkey::new_unique(), Pubkey::new_unique()]; + let reserved_accounts = vec![ + ReservedAccount::new_active(active_reserved_key), + ReservedAccount::new_pending(pending_reserved_keys[0], feature_ids[0]), + ReservedAccount::new_pending(pending_reserved_keys[1], feature_ids[1]), + ]; + + let mut reserved_account_keys = ReservedAccountKeys::new(&reserved_accounts); + assert!(reserved_account_keys.is_reserved(&active_reserved_key)); + assert!(!reserved_account_keys.is_reserved(&pending_reserved_keys[0])); + assert!(!reserved_account_keys.is_reserved(&pending_reserved_keys[1])); + + // Updating the active set with a default feature set should be a no-op + let previous_reserved_account_keys = reserved_account_keys.clone(); + let mut feature_set = FeatureSet::default(); + reserved_account_keys.update_active_set(&feature_set); + assert_eq!(reserved_account_keys, previous_reserved_account_keys); + + // Updating the active set with an activated feature should also activate + // the corresponding reserved key from inactive to active + feature_set.active.insert(feature_ids[0], 0); + reserved_account_keys.update_active_set(&feature_set); + + assert!(reserved_account_keys.is_reserved(&active_reserved_key)); + assert!(reserved_account_keys.is_reserved(&pending_reserved_keys[0])); + assert!(!reserved_account_keys.is_reserved(&pending_reserved_keys[1])); + + // Update the active set again to ensure that the inactive map is + // properly retained + feature_set.active.insert(feature_ids[1], 0); + reserved_account_keys.update_active_set(&feature_set); + + assert!(reserved_account_keys.is_reserved(&active_reserved_key)); + assert!(reserved_account_keys.is_reserved(&pending_reserved_keys[0])); + assert!(reserved_account_keys.is_reserved(&pending_reserved_keys[1])); + } + + #[test] + fn test_static_list_compat() { + let mut static_set = HashSet::new(); + static_set.extend(ALL_IDS.iter().cloned()); + static_set.extend(BUILTIN_PROGRAMS_KEYS.iter().cloned()); + + let initial_active_set = ReservedAccountKeys::default().active; + + assert_eq!(initial_active_set, static_set); + } +} diff --git a/rpc/Cargo.toml b/rpc/Cargo.toml index 779e7e90517..320889bb9da 100644 --- a/rpc/Cargo.toml +++ b/rpc/Cargo.toml @@ -66,6 +66,7 @@ tokio = { workspace = true, features = ["full"] } tokio-util = { workspace = true, features = ["codec", "compat"] } [dev-dependencies] +agave-reserved-account-keys = { workspace = true } serial_test = { workspace = true } solana-net-utils = { workspace = true } solana-rpc = { path = ".", features = ["dev-context-only-utils"] } diff --git a/rpc/src/rpc.rs b/rpc/src/rpc.rs index 2e295c1d401..d5433a6ab6a 100644 --- a/rpc/src/rpc.rs +++ b/rpc/src/rpc.rs @@ -4511,6 +4511,7 @@ pub mod tests { rpc_service::service_runtime, rpc_subscriptions::RpcSubscriptions, }, + agave_reserved_account_keys::ReservedAccountKeys, bincode::deserialize, jsonrpc_core::{futures, ErrorCode, MetaIoHandler, Output, Response, Value}, jsonrpc_core_client::transports::local, @@ -4553,7 +4554,6 @@ pub mod tests { Message, MessageHeader, VersionedMessage, }, nonce::{self, state::DurableNonce}, - reserved_account_keys::ReservedAccountKeys, rpc_port, signature::{Keypair, Signer}, slot_hashes::SlotHashes, diff --git a/rpc/src/transaction_status_service.rs b/rpc/src/transaction_status_service.rs index b28f3b8c1a4..472eeb69754 100644 --- a/rpc/src/transaction_status_service.rs +++ b/rpc/src/transaction_status_service.rs @@ -261,6 +261,7 @@ pub(crate) mod tests { use { super::*, crate::transaction_notifier_interface::TransactionNotifier, + agave_reserved_account_keys::ReservedAccountKeys, crossbeam_channel::unbounded, dashmap::DashMap, solana_account_decoder::{ @@ -277,7 +278,6 @@ pub(crate) mod tests { nonce_account, pubkey::Pubkey, rent_debits::RentDebits, - reserved_account_keys::ReservedAccountKeys, signature::{Keypair, Signature, Signer}, system_transaction, transaction::{ diff --git a/runtime-transaction/Cargo.toml b/runtime-transaction/Cargo.toml index 438f53dce4f..5dc106db778 100644 --- a/runtime-transaction/Cargo.toml +++ b/runtime-transaction/Cargo.toml @@ -29,6 +29,7 @@ crate-type = ["lib"] name = "solana_runtime_transaction" [dev-dependencies] +agave-reserved-account-keys = { workspace = true } bincode = { workspace = true } criterion = { workspace = true } rand = { workspace = true } @@ -39,7 +40,6 @@ solana-instruction = { workspace = true } solana-keypair = { workspace = true } solana-program = { workspace = true } solana-pubkey = { workspace = true, features = ["rand"] } -solana-reserved-account-keys = { workspace = true } solana-signer = { workspace = true } solana-system-interface = { workspace = true, features = ["bincode"] } solana-system-transaction = { workspace = true } diff --git a/runtime-transaction/src/runtime_transaction/sdk_transactions.rs b/runtime-transaction/src/runtime_transaction/sdk_transactions.rs index 61167b7c253..89c33c31dda 100644 --- a/runtime-transaction/src/runtime_transaction/sdk_transactions.rs +++ b/runtime-transaction/src/runtime_transaction/sdk_transactions.rs @@ -153,6 +153,7 @@ impl RuntimeTransaction { mod tests { use { super::*, + agave_reserved_account_keys::ReservedAccountKeys, solana_compute_budget_interface::ComputeBudgetInstruction, solana_feature_set::FeatureSet, solana_hash::Hash, @@ -160,7 +161,6 @@ mod tests { solana_keypair::Keypair, solana_message::{Message, SimpleAddressLoader}, solana_program::vote::{self, state::Vote}, - solana_reserved_account_keys::ReservedAccountKeys, solana_signer::Signer, solana_system_interface::instruction as system_instruction, solana_transaction::{versioned::VersionedTransaction, Transaction}, diff --git a/runtime-transaction/src/runtime_transaction/transaction_view.rs b/runtime-transaction/src/runtime_transaction/transaction_view.rs index 0a09fc2c310..fb23922d3d7 100644 --- a/runtime-transaction/src/runtime_transaction/transaction_view.rs +++ b/runtime-transaction/src/runtime_transaction/transaction_view.rs @@ -192,10 +192,10 @@ impl TransactionWithMeta for RuntimeTransaction>>>>>> df2d3d83c (Add agave-reserved-account-keys crate (#5513)) "assert_matches", "bincode", "bitflags 2.8.0", @@ -7101,6 +7117,7 @@ dependencies = [ name = "solana-runtime" version = "2.2.6" dependencies = [ + "agave-reserved-account-keys", "ahash 0.8.11", "aquamarine", "arrayref", @@ -7576,6 +7593,7 @@ dependencies = [ name = "solana-storage-bigtable" version = "2.2.6" dependencies = [ + "agave-reserved-account-keys", "backoff", "bincode", "bytes", @@ -7598,7 +7616,6 @@ dependencies = [ "solana-message", "solana-metrics", "solana-pubkey", - "solana-reserved-account-keys", "solana-serde", "solana-signature", "solana-storage-proto", @@ -8054,6 +8071,7 @@ name = "solana-transaction-status" version = "2.2.6" dependencies = [ "Inflector", + "agave-reserved-account-keys", "base64 0.22.1", "bincode", "borsh 1.5.5", @@ -8071,7 +8089,6 @@ dependencies = [ "solana-message", "solana-program", "solana-pubkey", - "solana-reserved-account-keys", "solana-reward-info", "solana-sdk-ids", "solana-signature", diff --git a/svm/examples/Cargo.toml b/svm/examples/Cargo.toml index be42bcce965..3268d3e7d39 100644 --- a/svm/examples/Cargo.toml +++ b/svm/examples/Cargo.toml @@ -12,6 +12,7 @@ license = "Apache-2.0" edition = "2021" [workspace.dependencies] +agave-reserved-account-keys = { path = "../../reserved-account-keys" } base64 = "0.22.1" bincode = "1.3.3" borsh = { version = "1.5.2", features = ["derive"] } diff --git a/svm/examples/json-rpc/server/Cargo.toml b/svm/examples/json-rpc/server/Cargo.toml index fd0558a5cf9..a9d0a5a1b8d 100644 --- a/svm/examples/json-rpc/server/Cargo.toml +++ b/svm/examples/json-rpc/server/Cargo.toml @@ -6,6 +6,7 @@ edition = { workspace = true } publish = false [dependencies] +agave-reserved-account-keys = { workspace = true } base64 = { workspace = true } bincode = { workspace = true } bs58 = { workspace = true } diff --git a/svm/examples/json-rpc/server/src/rpc_process.rs b/svm/examples/json-rpc/server/src/rpc_process.rs index 8d0d51f5263..cfe795ac5e7 100644 --- a/svm/examples/json-rpc/server/src/rpc_process.rs +++ b/svm/examples/json-rpc/server/src/rpc_process.rs @@ -3,6 +3,7 @@ use { create_executable_environment, LoadAndExecuteTransactionsOutput, MockBankCallback, MockForkGraph, TransactionBatch, }, + agave_reserved_account_keys::ReservedAccountKeys, base64::{prelude::BASE64_STANDARD, Engine}, bincode::config::Options, jsonrpc_core::{types::error, Error, Metadata, Result}, @@ -35,7 +36,6 @@ use { }, nonce::state::DurableNonce, pubkey::Pubkey, - reserved_account_keys::ReservedAccountKeys, signature::Signature, system_instruction, sysvar, transaction::{ diff --git a/svm/src/account_loader.rs b/svm/src/account_loader.rs index 1a4f2bc7cd5..fd50f133200 100644 --- a/svm/src/account_loader.rs +++ b/svm/src/account_loader.rs @@ -641,6 +641,7 @@ mod tests { transaction_account_state_info::TransactionAccountStateInfo, transaction_processing_callback::TransactionProcessingCallback, }, + agave_reserved_account_keys::ReservedAccountKeys, solana_account::{Account, AccountSharedData, ReadableAccount, WritableAccount}, solana_compute_budget::{compute_budget::ComputeBudget, compute_budget_limits}, solana_epoch_schedule::EpochSchedule, @@ -659,7 +660,6 @@ mod tests { solana_pubkey::Pubkey, solana_rent::Rent, solana_rent_debits::RentDebits, - solana_reserved_account_keys::ReservedAccountKeys, solana_sdk::rent_collector::{RentCollector, RENT_EXEMPT_RENT_EPOCH}, solana_sdk_ids::{ bpf_loader, bpf_loader_upgradeable, native_loader, system_program, sysvar, diff --git a/svm/src/message_processor.rs b/svm/src/message_processor.rs index 87363eee8be..ff419c8db0b 100644 --- a/svm/src/message_processor.rs +++ b/svm/src/message_processor.rs @@ -116,6 +116,7 @@ pub(crate) fn process_message( mod tests { use { super::*, + agave_reserved_account_keys::ReservedAccountKeys, openssl::{ ec::{EcGroup, EcKey}, nid::Nid, @@ -136,7 +137,6 @@ mod tests { }, solana_pubkey::Pubkey, solana_rent::Rent, - solana_reserved_account_keys::ReservedAccountKeys, solana_sdk::native_loader::create_loadable_account_for_test, solana_sdk_ids::{ed25519_program, native_loader, secp256k1_program, system_program}, solana_secp256k1_program::new_secp256k1_instruction, diff --git a/svm/src/transaction_account_state_info.rs b/svm/src/transaction_account_state_info.rs index b8ce3785f8c..f12ba75f759 100644 --- a/svm/src/transaction_account_state_info.rs +++ b/svm/src/transaction_account_state_info.rs @@ -71,6 +71,7 @@ impl TransactionAccountStateInfo { mod test { use { super::*, + agave_reserved_account_keys::ReservedAccountKeys, solana_account::AccountSharedData, solana_hash::Hash, solana_keypair::Keypair, @@ -79,7 +80,6 @@ mod test { SanitizedMessage, }, solana_rent::Rent, - solana_reserved_account_keys::ReservedAccountKeys, solana_sdk::rent_collector::RentCollector, solana_signer::Signer, solana_transaction_context::TransactionContext, diff --git a/svm/src/transaction_processor.rs b/svm/src/transaction_processor.rs index 25227abf196..48ec2becd75 100644 --- a/svm/src/transaction_processor.rs +++ b/svm/src/transaction_processor.rs @@ -1205,6 +1205,7 @@ mod tests { rollback_accounts::RollbackAccounts, transaction_processing_callback::AccountState, }, + agave_reserved_account_keys::ReservedAccountKeys, solana_account::{create_account_shared_data_for_test, WritableAccount}, solana_clock::Clock, solana_compute_budget::compute_budget_limits::ComputeBudgetLimits, @@ -1220,7 +1221,6 @@ mod tests { solana_program_runtime::loaded_programs::{BlockRelation, ProgramCacheEntryType}, solana_rent::Rent, solana_rent_debits::RentDebits, - solana_reserved_account_keys::ReservedAccountKeys, solana_sdk::rent_collector::{RentCollector, RENT_EXEMPT_RENT_EPOCH}, solana_sdk_ids::{bpf_loader, system_program, sysvar}, solana_signature::Signature, diff --git a/svm/tests/transaction_builder.rs b/svm/tests/transaction_builder.rs index b3b1757cfa6..790862740f5 100644 --- a/svm/tests/transaction_builder.rs +++ b/svm/tests/transaction_builder.rs @@ -1,4 +1,5 @@ use { + agave_reserved_account_keys::ReservedAccountKeys, solana_sdk::{ hash::Hash, instruction::{AccountMeta, CompiledInstruction}, @@ -7,7 +8,6 @@ use { AddressLoader, AddressLoaderError, Message, MessageHeader, VersionedMessage, }, pubkey::Pubkey, - reserved_account_keys::ReservedAccountKeys, signature::Signature, transaction::{ SanitizedTransaction, SanitizedVersionedTransaction, TransactionError, diff --git a/transaction-status/Cargo.toml b/transaction-status/Cargo.toml index 1ade4045b8f..c14ae672020 100644 --- a/transaction-status/Cargo.toml +++ b/transaction-status/Cargo.toml @@ -11,6 +11,7 @@ edition = { workspace = true } [dependencies] Inflector = { workspace = true } +agave-reserved-account-keys = { workspace = true } base64 = { workspace = true } bincode = { workspace = true } borsh = { workspace = true } @@ -28,7 +29,6 @@ solana-loader-v2-interface = { workspace = true, features = ["bincode"] } solana-message = { workspace = true } solana-program = { workspace = true } solana-pubkey = { workspace = true } -solana-reserved-account-keys = { workspace = true } solana-reward-info = { workspace = true } solana-sdk-ids = { workspace = true } solana-signature = { workspace = true } diff --git a/transaction-status/src/lib.rs b/transaction-status/src/lib.rs index 9230c97f685..258935937ad 100644 --- a/transaction-status/src/lib.rs +++ b/transaction-status/src/lib.rs @@ -22,6 +22,7 @@ use { parse_accounts::{parse_legacy_message_accounts, parse_v0_message_accounts}, parse_instruction::parse, }, + agave_reserved_account_keys::ReservedAccountKeys, base64::{prelude::BASE64_STANDARD, Engine}, solana_clock::{Slot, UnixTimestamp}, solana_hash::Hash, @@ -31,7 +32,6 @@ use { AccountKeys, Message, VersionedMessage, }, solana_pubkey::Pubkey, - solana_reserved_account_keys::ReservedAccountKeys, solana_signature::Signature, solana_transaction::{ versioned::{TransactionVersion, VersionedTransaction}, diff --git a/transaction-status/src/parse_accounts.rs b/transaction-status/src/parse_accounts.rs index b40150e440f..0ec2a3073c3 100644 --- a/transaction-status/src/parse_accounts.rs +++ b/transaction-status/src/parse_accounts.rs @@ -1,7 +1,7 @@ pub use solana_transaction_status_client_types::{ParsedAccount, ParsedAccountSource}; use { + agave_reserved_account_keys::ReservedAccountKeys, solana_message::{v0::LoadedMessage, Message}, - solana_reserved_account_keys::ReservedAccountKeys, }; pub fn parse_legacy_message_accounts(message: &Message) -> Vec { @@ -40,9 +40,9 @@ pub fn parse_v0_message_accounts(message: &LoadedMessage) -> Vec mod test { use { super::*, + agave_reserved_account_keys::ReservedAccountKeys, solana_message::{v0, v0::LoadedAddresses, MessageHeader}, solana_pubkey::Pubkey, - solana_reserved_account_keys::ReservedAccountKeys, }; #[test] From 7218420f216df6f9d471f705e19415501ddf6068 Mon Sep 17 00:00:00 2001 From: Justin Starry Date: Wed, 26 Mar 2025 23:28:30 +0000 Subject: [PATCH 2/2] fix conflicts --- Cargo.lock | 6 +----- Cargo.toml | 9 ++------- core/Cargo.toml | 4 ---- core/src/banking_stage/unprocessed_packet_batches.rs | 6 +----- ledger/Cargo.toml | 4 ---- programs/sbf/Cargo.lock | 6 +----- programs/sbf/Cargo.toml | 2 +- svm/examples/Cargo.lock | 6 +----- 8 files changed, 7 insertions(+), 36 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d93d1d052a9..822ce4c2f2c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -262,7 +262,7 @@ dependencies = [ [[package]] name = "agave-reserved-account-keys" -version = "2.3.0" +version = "2.2.6" dependencies = [ "lazy_static", "solana-feature-set", @@ -8095,11 +8095,7 @@ dependencies = [ name = "solana-ledger" version = "2.2.6" dependencies = [ -<<<<<<< HEAD -======= "agave-reserved-account-keys", - "anyhow", ->>>>>>> df2d3d83c (Add agave-reserved-account-keys crate (#5513)) "assert_matches", "bincode", "bitflags 2.8.0", diff --git a/Cargo.toml b/Cargo.toml index d2e7b4b1130..9d29dbe8f6f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -174,15 +174,10 @@ check-cfg = [ [workspace.dependencies] Inflector = "0.11.4" axum = "0.7.9" -<<<<<<< HEAD agave-banking-stage-ingress-types = { path = "banking-stage-ingress-types", version = "=2.2.6" } +agave-feature-set = { path = "feature-set", version = "=2.2.6" } +agave-reserved-account-keys = { path = "reserved-account-keys", version = "=2.2.6" } agave-transaction-view = { path = "transaction-view", version = "=2.2.6" } -======= -agave-banking-stage-ingress-types = { path = "banking-stage-ingress-types", version = "=2.3.0" } -agave-feature-set = { path = "feature-set", version = "=2.3.0" } -agave-reserved-account-keys = { path = "reserved-account-keys", version = "=2.3.0" } -agave-transaction-view = { path = "transaction-view", version = "=2.3.0" } ->>>>>>> df2d3d83c (Add agave-reserved-account-keys crate (#5513)) aquamarine = "0.6.0" aes-gcm-siv = "0.11.1" ahash = "0.8.11" diff --git a/core/Cargo.toml b/core/Cargo.toml index 8d68a306fe0..9c50686c27d 100644 --- a/core/Cargo.toml +++ b/core/Cargo.toml @@ -107,11 +107,7 @@ tokio = { workspace = true, features = ["full"] } trees = { workspace = true } [dev-dependencies] -<<<<<<< HEAD -======= agave-reserved-account-keys = { workspace = true } -criterion = { workspace = true } ->>>>>>> df2d3d83c (Add agave-reserved-account-keys crate (#5513)) fs_extra = { workspace = true } serde_json = { workspace = true } serial_test = { workspace = true } diff --git a/core/src/banking_stage/unprocessed_packet_batches.rs b/core/src/banking_stage/unprocessed_packet_batches.rs index 5c89514b23e..de02ba47768 100644 --- a/core/src/banking_stage/unprocessed_packet_batches.rs +++ b/core/src/banking_stage/unprocessed_packet_batches.rs @@ -299,13 +299,9 @@ mod tests { solana_perf::packet::PacketFlags, solana_runtime::bank::Bank, solana_sdk::{ -<<<<<<< HEAD compute_budget::ComputeBudgetInstruction, - message::Message, - reserved_account_keys::ReservedAccountKeys, -======= hash::Hash, ->>>>>>> df2d3d83c (Add agave-reserved-account-keys crate (#5513)) + message::Message, signature::{Keypair, Signer}, system_instruction, system_transaction, transaction::Transaction, diff --git a/ledger/Cargo.toml b/ledger/Cargo.toml index 80207e68f49..9aabe99ed90 100644 --- a/ledger/Cargo.toml +++ b/ledger/Cargo.toml @@ -10,11 +10,7 @@ license = { workspace = true } edition = { workspace = true } [dependencies] -<<<<<<< HEAD -======= agave-reserved-account-keys = { workspace = true } -anyhow = { workspace = true } ->>>>>>> df2d3d83c (Add agave-reserved-account-keys crate (#5513)) assert_matches = { workspace = true } bincode = { workspace = true } bitflags = { workspace = true, features = ["serde"] } diff --git a/programs/sbf/Cargo.lock b/programs/sbf/Cargo.lock index 2aba824302e..05bf400eb45 100644 --- a/programs/sbf/Cargo.lock +++ b/programs/sbf/Cargo.lock @@ -85,7 +85,7 @@ dependencies = [ [[package]] name = "agave-reserved-account-keys" -version = "2.3.0" +version = "2.2.6" dependencies = [ "lazy_static", "solana-feature-set", @@ -6345,11 +6345,7 @@ dependencies = [ name = "solana-ledger" version = "2.2.6" dependencies = [ -<<<<<<< HEAD -======= "agave-reserved-account-keys", - "anyhow", ->>>>>>> df2d3d83c (Add agave-reserved-account-keys crate (#5513)) "assert_matches", "bincode", "bitflags 2.8.0", diff --git a/programs/sbf/Cargo.toml b/programs/sbf/Cargo.toml index 571396a3b6c..bb56b550d6e 100644 --- a/programs/sbf/Cargo.toml +++ b/programs/sbf/Cargo.toml @@ -15,7 +15,7 @@ check-cfg = [ ] [workspace.dependencies] -agave-reserved-account-keys = { path = "../../reserved-account-keys", version = "=2.3.0" } +agave-reserved-account-keys = { path = "../../reserved-account-keys", version = "=2.2.6" } array-bytes = "=1.4.1" bincode = { version = "1.1.4", default-features = false } blake3 = "1.0.0" diff --git a/svm/examples/Cargo.lock b/svm/examples/Cargo.lock index 6b677dc5edc..4c64d7e6f3a 100644 --- a/svm/examples/Cargo.lock +++ b/svm/examples/Cargo.lock @@ -85,7 +85,7 @@ dependencies = [ [[package]] name = "agave-reserved-account-keys" -version = "2.3.0" +version = "2.2.6" dependencies = [ "lazy_static", "solana-feature-set", @@ -6166,11 +6166,7 @@ dependencies = [ name = "solana-ledger" version = "2.2.6" dependencies = [ -<<<<<<< HEAD -======= "agave-reserved-account-keys", - "anyhow", ->>>>>>> df2d3d83c (Add agave-reserved-account-keys crate (#5513)) "assert_matches", "bincode", "bitflags 2.8.0",