From 395db14a793b764d27db0e5e904d65798ff21c45 Mon Sep 17 00:00:00 2001 From: Pankaj Garg Date: Tue, 10 Dec 2024 06:15:15 -0800 Subject: [PATCH] Split runtime-transaction crate and reduce SVM dependency (#3983) --- .github/CODEOWNERS | 5 +-- Cargo.lock | 26 ++++++++++-- Cargo.toml | 2 + compute-budget-instruction/Cargo.toml | 42 +++++++++++++++++++ .../process_compute_budget_instructions.rs | 2 +- .../src/builtin_programs_filter.rs | 6 ++- .../src/compute_budget_instruction_details.rs | 0 .../src/compute_budget_program_id_filter.rs | 4 +- .../src/instructions_processor.rs | 0 compute-budget-instruction/src/lib.rs | 6 +++ core/Cargo.toml | 1 + core/src/banking_stage/consumer.rs | 6 +-- .../immutable_deserialized_packet.rs | 6 +-- cost-model/Cargo.toml | 2 + cost-model/src/transaction_cost.rs | 2 +- programs/compute-budget-bench/Cargo.toml | 2 +- .../benches/compute_budget.rs | 2 +- programs/sbf/Cargo.lock | 21 +++++++++- programs/sbf/Cargo.toml | 4 ++ programs/sbf/tests/programs.rs | 6 +-- runtime-transaction/Cargo.toml | 9 ++-- runtime-transaction/src/lib.rs | 4 -- .../src/runtime_transaction.rs | 6 +-- runtime-transaction/src/transaction_meta.rs | 2 +- runtime/Cargo.toml | 1 + runtime/src/bank.rs | 2 +- svm/Cargo.toml | 2 +- svm/examples/Cargo.lock | 20 ++++++++- svm/src/transaction_processor.rs | 2 +- 29 files changed, 145 insertions(+), 48 deletions(-) create mode 100644 compute-budget-instruction/Cargo.toml rename {runtime-transaction => compute-budget-instruction}/benches/process_compute_budget_instructions.rs (98%) rename {runtime-transaction => compute-budget-instruction}/src/builtin_programs_filter.rs (93%) rename {runtime-transaction => compute-budget-instruction}/src/compute_budget_instruction_details.rs (100%) rename {runtime-transaction => compute-budget-instruction}/src/compute_budget_program_id_filter.rs (85%) rename {runtime-transaction => compute-budget-instruction}/src/instructions_processor.rs (100%) create mode 100644 compute-budget-instruction/src/lib.rs diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 59abc68d3d6988..8abad42daeba06 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -2,6 +2,7 @@ # repo and would like to avoid introducing dependencies in the meantime. /builtins-default-costs/ @anza-xyz/svm /compute-budget/ @anza-xyz/svm +/compute-budget-instruction/ @anza-xyz/svm /fee/ @anza-xyz/svm /log-collector/ @anza-xyz/svm /program-runtime/ @anza-xyz/svm @@ -9,10 +10,8 @@ /programs/compute-budget/ @anza-xyz/svm /programs/loader-v4/ @anza-xyz/svm /programs/system/ @anza-xyz/svm -/runtime-transaction/ @anza-xyz/svm /svm-conformance/ @anza-xyz/svm /svm-rent-collector/ @anza-xyz/svm /svm-transaction/ @anza-xyz/svm /svm/ @anza-xyz/svm -/svm/examples/Cargo.lock -/transaction-view/ @anza-xyz/svm +/svm/examples/Cargo.lock \ No newline at end of file diff --git a/Cargo.lock b/Cargo.lock index 05e1a84dc10d82..37a3faf1621377 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -6645,6 +6645,23 @@ dependencies = [ "solana-program-entrypoint", ] +[[package]] +name = "solana-compute-budget-instruction" +version = "2.2.0" +dependencies = [ + "bincode", + "criterion", + "log", + "rand 0.8.5", + "solana-builtins-default-costs", + "solana-compute-budget", + "solana-program", + "solana-pubkey", + "solana-sdk", + "solana-svm-transaction", + "thiserror 2.0.6", +] + [[package]] name = "solana-compute-budget-interface" version = "2.2.0" @@ -6672,8 +6689,8 @@ version = "2.2.0" dependencies = [ "criterion", "solana-compute-budget", + "solana-compute-budget-instruction", "solana-compute-budget-program", - "solana-runtime-transaction", "solana-sdk", "solana-svm-transaction", ] @@ -6763,6 +6780,7 @@ dependencies = [ "solana-builtins-default-costs", "solana-client", "solana-compute-budget", + "solana-compute-budget-instruction", "solana-compute-budget-program", "solana-connection-cache", "solana-core", @@ -6833,6 +6851,7 @@ dependencies = [ "rand 0.8.5", "solana-builtins-default-costs", "solana-compute-budget", + "solana-compute-budget-instruction", "solana-compute-budget-program", "solana-cost-model", "solana-feature-set", @@ -8589,6 +8608,7 @@ dependencies = [ "solana-bucket-map", "solana-builtins", "solana-compute-budget", + "solana-compute-budget-instruction", "solana-config-program", "solana-cost-model", "solana-feature-set", @@ -8638,8 +8658,8 @@ dependencies = [ "criterion", "log", "rand 0.8.5", - "solana-builtins-default-costs", "solana-compute-budget", + "solana-compute-budget-instruction", "solana-program", "solana-pubkey", "solana-sdk", @@ -9151,6 +9171,7 @@ dependencies = [ "shuttle", "solana-bpf-loader-program", "solana-compute-budget", + "solana-compute-budget-instruction", "solana-compute-budget-program", "solana-ed25519-program", "solana-feature-set", @@ -9162,7 +9183,6 @@ dependencies = [ "solana-logger", "solana-measure", "solana-program-runtime", - "solana-runtime-transaction", "solana-sdk", "solana-secp256r1-program", "solana-svm", diff --git a/Cargo.toml b/Cargo.toml index 15899367d86605..5acea97a85003b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -36,6 +36,7 @@ members = [ "client", "client-test", "compute-budget", + "compute-budget-instruction", "connection-cache", "core", "cost-model", @@ -457,6 +458,7 @@ solana-clock = { path = "sdk/clock", version = "=2.2.0" } solana-cluster-type = { path = "sdk/cluster-type", version = "=2.2.0" } solana-commitment-config = { path = "sdk/commitment-config", version = "=2.2.0" } solana-compute-budget = { path = "compute-budget", version = "=2.2.0" } +solana-compute-budget-instruction = { path = "compute-budget-instruction", version = "=2.2.0" } solana-compute-budget-interface = { path = "sdk/compute-budget-interface", version = "=2.2.0" } solana-compute-budget-program = { path = "programs/compute-budget", version = "=2.2.0" } solana-config-program = { path = "programs/config", version = "=2.2.0" } diff --git a/compute-budget-instruction/Cargo.toml b/compute-budget-instruction/Cargo.toml new file mode 100644 index 00000000000000..b8daccad80d7c5 --- /dev/null +++ b/compute-budget-instruction/Cargo.toml @@ -0,0 +1,42 @@ +[package] +name = "solana-compute-budget-instruction" +description = "Solana Compute Budget Instruction" +documentation = "https://docs.rs/solana-compute-budget-instruction" +version = { workspace = true } +authors = { workspace = true } +repository = { workspace = true } +homepage = { workspace = true } +license = { workspace = true } +edition = { workspace = true } + +[dependencies] +log = { workspace = true } +solana-builtins-default-costs = { workspace = true } +solana-compute-budget = { workspace = true } +solana-pubkey = { workspace = true } +solana-sdk = { workspace = true } +solana-svm-transaction = { workspace = true } +thiserror = { workspace = true } + +[lib] +crate-type = ["lib"] +name = "solana_compute_budget_instruction" + +[dev-dependencies] +bincode = { workspace = true } +criterion = { workspace = true } +rand = { workspace = true } +solana-program = { workspace = true } + +[package.metadata.docs.rs] +targets = ["x86_64-unknown-linux-gnu"] + +[features] +dev-context-only-utils = [] + +[[bench]] +name = "process_compute_budget_instructions" +harness = false + +[lints] +workspace = true diff --git a/runtime-transaction/benches/process_compute_budget_instructions.rs b/compute-budget-instruction/benches/process_compute_budget_instructions.rs similarity index 98% rename from runtime-transaction/benches/process_compute_budget_instructions.rs rename to compute-budget-instruction/benches/process_compute_budget_instructions.rs index c120b5681b5c29..21a9dd13c58092 100644 --- a/runtime-transaction/benches/process_compute_budget_instructions.rs +++ b/compute-budget-instruction/benches/process_compute_budget_instructions.rs @@ -1,6 +1,6 @@ use { criterion::{black_box, criterion_group, criterion_main, Criterion, Throughput}, - solana_runtime_transaction::instructions_processor::process_compute_budget_instructions, + solana_compute_budget_instruction::instructions_processor::process_compute_budget_instructions, solana_sdk::{ compute_budget::ComputeBudgetInstruction, feature_set::FeatureSet, diff --git a/runtime-transaction/src/builtin_programs_filter.rs b/compute-budget-instruction/src/builtin_programs_filter.rs similarity index 93% rename from runtime-transaction/src/builtin_programs_filter.rs rename to compute-budget-instruction/src/builtin_programs_filter.rs index fc935a023cfbf8..6dd81844b5df59 100644 --- a/runtime-transaction/src/builtin_programs_filter.rs +++ b/compute-budget-instruction/src/builtin_programs_filter.rs @@ -1,9 +1,11 @@ use { - agave_transaction_view::static_account_keys_frame::MAX_STATIC_ACCOUNTS_PER_PACKET as FILTER_SIZE, solana_builtins_default_costs::{is_builtin_program, MAYBE_BUILTIN_KEY}, - solana_sdk::pubkey::Pubkey, + solana_sdk::{packet::PACKET_DATA_SIZE, pubkey::Pubkey}, }; +// The maximum number of pubkeys that a packet can contain. +pub const FILTER_SIZE: u8 = (PACKET_DATA_SIZE / core::mem::size_of::()) as u8; + #[derive(Clone, Copy, Debug, PartialEq)] pub(crate) enum ProgramKind { NotBuiltin, diff --git a/runtime-transaction/src/compute_budget_instruction_details.rs b/compute-budget-instruction/src/compute_budget_instruction_details.rs similarity index 100% rename from runtime-transaction/src/compute_budget_instruction_details.rs rename to compute-budget-instruction/src/compute_budget_instruction_details.rs diff --git a/runtime-transaction/src/compute_budget_program_id_filter.rs b/compute-budget-instruction/src/compute_budget_program_id_filter.rs similarity index 85% rename from runtime-transaction/src/compute_budget_program_id_filter.rs rename to compute-budget-instruction/src/compute_budget_program_id_filter.rs index 59c6144a091229..62ec47b7209ef0 100644 --- a/runtime-transaction/src/compute_budget_program_id_filter.rs +++ b/compute-budget-instruction/src/compute_budget_program_id_filter.rs @@ -1,7 +1,7 @@ // static account keys has max use { - agave_transaction_view::static_account_keys_frame::MAX_STATIC_ACCOUNTS_PER_PACKET as FILTER_SIZE, - solana_builtins_default_costs::MAYBE_BUILTIN_KEY, solana_sdk::pubkey::Pubkey, + crate::builtin_programs_filter::FILTER_SIZE, solana_builtins_default_costs::MAYBE_BUILTIN_KEY, + solana_sdk::pubkey::Pubkey, }; pub(crate) struct ComputeBudgetProgramIdFilter { diff --git a/runtime-transaction/src/instructions_processor.rs b/compute-budget-instruction/src/instructions_processor.rs similarity index 100% rename from runtime-transaction/src/instructions_processor.rs rename to compute-budget-instruction/src/instructions_processor.rs diff --git a/compute-budget-instruction/src/lib.rs b/compute-budget-instruction/src/lib.rs new file mode 100644 index 00000000000000..032730b9f1bf56 --- /dev/null +++ b/compute-budget-instruction/src/lib.rs @@ -0,0 +1,6 @@ +#![allow(clippy::arithmetic_side_effects)] + +mod builtin_programs_filter; +pub mod compute_budget_instruction_details; +mod compute_budget_program_id_filter; +pub mod instructions_processor; diff --git a/core/Cargo.toml b/core/Cargo.toml index a9045d02dd09ed..bba797068b58f7 100644 --- a/core/Cargo.toml +++ b/core/Cargo.toml @@ -50,6 +50,7 @@ solana-bloom = { workspace = true } solana-builtins-default-costs = { workspace = true } solana-client = { workspace = true } solana-compute-budget = { workspace = true } +solana-compute-budget-instruction = { workspace = true } solana-connection-cache = { workspace = true } solana-cost-model = { workspace = true } solana-entry = { workspace = true } diff --git a/core/src/banking_stage/consumer.rs b/core/src/banking_stage/consumer.rs index ef03192576f6a1..2c8d46d46d7cdb 100644 --- a/core/src/banking_stage/consumer.rs +++ b/core/src/banking_stage/consumer.rs @@ -12,6 +12,7 @@ use { BankingStageStats, }, itertools::Itertools, + solana_compute_budget_instruction::instructions_processor::process_compute_budget_instructions, solana_feature_set as feature_set, solana_ledger::token_balances::collect_token_balances, solana_measure::{measure::Measure, measure_us}, @@ -24,10 +25,7 @@ use { transaction_batch::TransactionBatch, verify_precompiles::verify_precompiles, }, - solana_runtime_transaction::{ - instructions_processor::process_compute_budget_instructions, - transaction_with_meta::TransactionWithMeta, - }, + solana_runtime_transaction::transaction_with_meta::TransactionWithMeta, solana_sdk::{ clock::{FORWARD_TRANSACTIONS_TO_LEADER_AT_SLOT_OFFSET, MAX_PROCESSING_AGE}, fee::FeeBudgetLimits, diff --git a/core/src/banking_stage/immutable_deserialized_packet.rs b/core/src/banking_stage/immutable_deserialized_packet.rs index eec31181f6ed63..acedd3dc09e5b4 100644 --- a/core/src/banking_stage/immutable_deserialized_packet.rs +++ b/core/src/banking_stage/immutable_deserialized_packet.rs @@ -1,12 +1,10 @@ use { super::packet_filter::PacketFilterFailure, solana_compute_budget::compute_budget_limits::ComputeBudgetLimits, + solana_compute_budget_instruction::instructions_processor::process_compute_budget_instructions, solana_perf::packet::Packet, solana_runtime::bank::Bank, - solana_runtime_transaction::{ - instructions_processor::process_compute_budget_instructions, - runtime_transaction::RuntimeTransaction, - }, + solana_runtime_transaction::runtime_transaction::RuntimeTransaction, solana_sanitize::SanitizeError, solana_sdk::{ clock::Slot, diff --git a/cost-model/Cargo.toml b/cost-model/Cargo.toml index d6e9e5b6e2bd46..1e0593daedeeaa 100644 --- a/cost-model/Cargo.toml +++ b/cost-model/Cargo.toml @@ -15,6 +15,7 @@ lazy_static = { workspace = true } log = { workspace = true } solana-builtins-default-costs = { workspace = true } solana-compute-budget = { workspace = true } +solana-compute-budget-instruction = { workspace = true } solana-feature-set = { workspace = true } solana-frozen-abi = { workspace = true, optional = true, features = [ "frozen-abi", @@ -36,6 +37,7 @@ name = "solana_cost_model" itertools = { workspace = true } rand = "0.8.5" # See order-crates-for-publishing.py for using this unusual `path = "."` +solana-compute-budget-instruction = { workspace = true, features = ["dev-context-only-utils"] } solana-compute-budget-program = { workspace = true } solana-cost-model = { path = ".", features = ["dev-context-only-utils"] } solana-logger = { workspace = true } diff --git a/cost-model/src/transaction_cost.rs b/cost-model/src/transaction_cost.rs index 1b5f7a6265390f..b772e0b0d7b3ad 100644 --- a/cost-model/src/transaction_cost.rs +++ b/cost-model/src/transaction_cost.rs @@ -1,5 +1,5 @@ #[cfg(feature = "dev-context-only-utils")] -use solana_runtime_transaction::compute_budget_instruction_details::ComputeBudgetInstructionDetails; +use solana_compute_budget_instruction::compute_budget_instruction_details::ComputeBudgetInstructionDetails; use { crate::block_cost_limits, solana_runtime_transaction::transaction_with_meta::TransactionWithMeta, diff --git a/programs/compute-budget-bench/Cargo.toml b/programs/compute-budget-bench/Cargo.toml index 1555ea3d3f1788..e9071e2afa6e81 100644 --- a/programs/compute-budget-bench/Cargo.toml +++ b/programs/compute-budget-bench/Cargo.toml @@ -11,8 +11,8 @@ edition = { workspace = true } [dependencies] criterion = { workspace = true } solana-compute-budget = { workspace = true } +solana-compute-budget-instruction = { workspace = true } solana-compute-budget-program = { workspace = true } -solana-runtime-transaction = { workspace = true } solana-sdk = { workspace = true } solana-svm-transaction = { workspace = true } diff --git a/programs/compute-budget-bench/benches/compute_budget.rs b/programs/compute-budget-bench/benches/compute_budget.rs index 7c758d45c7ed05..6b2f2b92a9332e 100644 --- a/programs/compute-budget-bench/benches/compute_budget.rs +++ b/programs/compute-budget-bench/benches/compute_budget.rs @@ -1,7 +1,7 @@ use { criterion::{black_box, criterion_group, criterion_main, Criterion}, solana_compute_budget::compute_budget_limits::ComputeBudgetLimits, - solana_runtime_transaction::instructions_processor::process_compute_budget_instructions, + solana_compute_budget_instruction::instructions_processor::process_compute_budget_instructions, solana_sdk::{ compute_budget::ComputeBudgetInstruction, feature_set::FeatureSet, instruction::CompiledInstruction, diff --git a/programs/sbf/Cargo.lock b/programs/sbf/Cargo.lock index 4413415c55e15f..f5dcedd46f85ba 100644 --- a/programs/sbf/Cargo.lock +++ b/programs/sbf/Cargo.lock @@ -5362,6 +5362,19 @@ dependencies = [ "solana-program-entrypoint", ] +[[package]] +name = "solana-compute-budget-instruction" +version = "2.2.0" +dependencies = [ + "log", + "solana-builtins-default-costs", + "solana-compute-budget", + "solana-pubkey", + "solana-sdk", + "solana-svm-transaction", + "thiserror 2.0.6", +] + [[package]] name = "solana-compute-budget-interface" version = "2.2.0" @@ -5456,6 +5469,7 @@ dependencies = [ "solana-builtins-default-costs", "solana-client", "solana-compute-budget", + "solana-compute-budget-instruction", "solana-connection-cache", "solana-cost-model", "solana-entry", @@ -5512,6 +5526,7 @@ dependencies = [ "log", "solana-builtins-default-costs", "solana-compute-budget", + "solana-compute-budget-instruction", "solana-feature-set", "solana-metrics", "solana-runtime-transaction", @@ -6773,6 +6788,7 @@ dependencies = [ "solana-bucket-map", "solana-builtins", "solana-compute-budget", + "solana-compute-budget-instruction", "solana-config-program", "solana-cost-model", "solana-feature-set", @@ -6813,8 +6829,8 @@ version = "2.2.0" dependencies = [ "agave-transaction-view", "log", - "solana-builtins-default-costs", "solana-compute-budget", + "solana-compute-budget-instruction", "solana-pubkey", "solana-sdk", "solana-sdk-ids", @@ -6844,6 +6860,7 @@ dependencies = [ "solana-bpf-loader-program", "solana-cli-output", "solana-compute-budget", + "solana-compute-budget-instruction", "solana-feature-set", "solana-fee", "solana-ledger", @@ -7717,13 +7734,13 @@ dependencies = [ "serde_derive", "solana-bpf-loader-program", "solana-compute-budget", + "solana-compute-budget-instruction", "solana-feature-set", "solana-fee", "solana-loader-v4-program", "solana-log-collector", "solana-measure", "solana-program-runtime", - "solana-runtime-transaction", "solana-sdk", "solana-svm-rent-collector", "solana-svm-transaction", diff --git a/programs/sbf/Cargo.toml b/programs/sbf/Cargo.toml index 4e0a84483dd427..63a1bd5e9d4c8b 100644 --- a/programs/sbf/Cargo.toml +++ b/programs/sbf/Cargo.toml @@ -36,6 +36,7 @@ solana-bn254 = { path = "../../curves/bn254", version = "=2.2.0" } solana-bpf-loader-program = { path = "../bpf_loader", version = "=2.2.0" } solana-cli-output = { path = "../../cli-output", version = "=2.2.0" } solana-compute-budget = { path = "../../compute-budget", version = "=2.2.0" } +solana-compute-budget-instruction = { path = "../../compute-budget-instruction", version = "=2.2.0" } solana-curve25519 = { path = "../../curves/curve25519", version = "=2.2.0" } solana-decode-error = { path = "../../sdk/decode-error", version = "=2.2.0" } solana-feature-set = { path = "../../sdk/feature-set", version = "=2.2.0" } @@ -111,6 +112,9 @@ solana-accounts-db = { workspace = true } solana-bpf-loader-program = { workspace = true } solana-cli-output = { workspace = true } solana-compute-budget = { workspace = true } +solana-compute-budget-instruction = { workspace = true, features = [ + "dev-context-only-utils", +] } solana-feature-set = { workspace = true } solana-fee = { workspace = true } solana-ledger = { workspace = true } diff --git a/programs/sbf/tests/programs.rs b/programs/sbf/tests/programs.rs index 0426df7bd08d34..028d7c87aaf44f 100644 --- a/programs/sbf/tests/programs.rs +++ b/programs/sbf/tests/programs.rs @@ -15,6 +15,7 @@ use { parse_bpf_upgradeable_loader, BpfUpgradeableLoaderAccountType, }, solana_compute_budget::compute_budget::ComputeBudget, + solana_compute_budget_instruction::instructions_processor::process_compute_budget_instructions, solana_feature_set::{self as feature_set, FeatureSet}, solana_ledger::token_balances::collect_token_balances, solana_program_runtime::{ @@ -34,10 +35,7 @@ use { load_upgradeable_program_wrapper, set_upgrade_authority, upgrade_program, }, }, - solana_runtime_transaction::{ - instructions_processor::process_compute_budget_instructions, - runtime_transaction::RuntimeTransaction, - }, + solana_runtime_transaction::runtime_transaction::RuntimeTransaction, solana_sbf_rust_invoke_dep::*, solana_sbf_rust_realloc_dep::*, solana_sbf_rust_realloc_invoke_dep::*, diff --git a/runtime-transaction/Cargo.toml b/runtime-transaction/Cargo.toml index 7f925bda81a7bb..d63a1d1e089817 100644 --- a/runtime-transaction/Cargo.toml +++ b/runtime-transaction/Cargo.toml @@ -12,8 +12,8 @@ edition = { workspace = true } [dependencies] agave-transaction-view = { workspace = true } log = { workspace = true } -solana-builtins-default-costs = { workspace = true } solana-compute-budget = { workspace = true } +solana-compute-budget-instruction = { workspace = true } solana-pubkey = { workspace = true } solana-sdk = { workspace = true } solana-sdk-ids = { workspace = true } @@ -28,17 +28,14 @@ name = "solana_runtime_transaction" bincode = { workspace = true } criterion = { workspace = true } rand = { workspace = true } +solana-compute-budget-instruction = { workspace = true, features = ["dev-context-only-utils"] } solana-program = { workspace = true } [package.metadata.docs.rs] targets = ["x86_64-unknown-linux-gnu"] [features] -dev-context-only-utils = [] - -[[bench]] -name = "process_compute_budget_instructions" -harness = false +dev-context-only-utils = ["solana-compute-budget-instruction/dev-context-only-utils"] [[bench]] name = "get_signature_details" diff --git a/runtime-transaction/src/lib.rs b/runtime-transaction/src/lib.rs index 07731bcdaedac7..f4dbb3cbe067e3 100644 --- a/runtime-transaction/src/lib.rs +++ b/runtime-transaction/src/lib.rs @@ -1,10 +1,6 @@ #![cfg_attr(feature = "frozen-abi", feature(min_specialization))] #![allow(clippy::arithmetic_side_effects)] -mod builtin_programs_filter; -pub mod compute_budget_instruction_details; -mod compute_budget_program_id_filter; -pub mod instructions_processor; pub mod runtime_transaction; pub mod signature_details; pub mod transaction_meta; diff --git a/runtime-transaction/src/runtime_transaction.rs b/runtime-transaction/src/runtime_transaction.rs index 0903eb62ad236a..3dec0732050af3 100644 --- a/runtime-transaction/src/runtime_transaction.rs +++ b/runtime-transaction/src/runtime_transaction.rs @@ -10,11 +10,9 @@ //! ALT, RuntimeTransaction transits into Dynamically Loaded state, //! with its dynamic metadata loaded. use { - crate::{ - compute_budget_instruction_details::*, - transaction_meta::{DynamicMeta, StaticMeta, TransactionMeta}, - }, + crate::transaction_meta::{DynamicMeta, StaticMeta, TransactionMeta}, core::ops::Deref, + solana_compute_budget_instruction::compute_budget_instruction_details::*, solana_sdk::{ hash::Hash, message::{AccountKeys, TransactionSignatureDetails}, diff --git a/runtime-transaction/src/transaction_meta.rs b/runtime-transaction/src/transaction_meta.rs index d779fbd15cbaef..ec257c2926cfd2 100644 --- a/runtime-transaction/src/transaction_meta.rs +++ b/runtime-transaction/src/transaction_meta.rs @@ -12,7 +12,7 @@ //! RuntimeTransaction types, not the TransactionMeta itself. //! use { - crate::compute_budget_instruction_details::ComputeBudgetInstructionDetails, + solana_compute_budget_instruction::compute_budget_instruction_details::ComputeBudgetInstructionDetails, solana_sdk::{hash::Hash, message::TransactionSignatureDetails}, }; diff --git a/runtime/Cargo.toml b/runtime/Cargo.toml index 91c9c0f0539eed..0bec4f1ea64660 100644 --- a/runtime/Cargo.toml +++ b/runtime/Cargo.toml @@ -53,6 +53,7 @@ solana-bpf-loader-program = { workspace = true } solana-bucket-map = { workspace = true } solana-builtins = { workspace = true } solana-compute-budget = { workspace = true } +solana-compute-budget-instruction = { workspace = true } solana-config-program = { workspace = true } solana-cost-model = { workspace = true } solana-feature-set = { workspace = true } diff --git a/runtime/src/bank.rs b/runtime/src/bank.rs index a18f22167f58d2..10db11e0b09937 100644 --- a/runtime/src/bank.rs +++ b/runtime/src/bank.rs @@ -96,6 +96,7 @@ use { }, solana_builtins::{prototype::BuiltinPrototype, BUILTINS, STATELESS_BUILTINS}, solana_compute_budget::compute_budget::ComputeBudget, + solana_compute_budget_instruction::instructions_processor::process_compute_budget_instructions, solana_cost_model::cost_tracker::CostTracker, solana_feature_set::{ self as feature_set, remove_rounding_in_fee_calculation, reward_full_priority_fee, @@ -107,7 +108,6 @@ use { invoke_context::BuiltinFunctionWithContext, loaded_programs::ProgramCacheEntry, }, solana_runtime_transaction::{ - instructions_processor::process_compute_budget_instructions, runtime_transaction::RuntimeTransaction, transaction_with_meta::TransactionWithMeta, }, solana_sdk::{ diff --git a/svm/Cargo.toml b/svm/Cargo.toml index cfb8657c5a8051..e3ed11e14df0f0 100644 --- a/svm/Cargo.toml +++ b/svm/Cargo.toml @@ -19,6 +19,7 @@ serde = { workspace = true, features = ["rc"] } serde_derive = { workspace = true } solana-bpf-loader-program = { workspace = true } solana-compute-budget = { workspace = true } +solana-compute-budget-instruction = { workspace = true } solana-feature-set = { workspace = true } solana-fee = { workspace = true } solana-frozen-abi = { workspace = true, optional = true, features = [ @@ -31,7 +32,6 @@ solana-loader-v4-program = { workspace = true } solana-log-collector = { workspace = true } solana-measure = { workspace = true } solana-program-runtime = { workspace = true } -solana-runtime-transaction = { workspace = true } solana-sdk = { workspace = true } solana-svm-rent-collector = { workspace = true } solana-svm-transaction = { workspace = true } diff --git a/svm/examples/Cargo.lock b/svm/examples/Cargo.lock index e326abd8a08870..9f9fbb6c105260 100644 --- a/svm/examples/Cargo.lock +++ b/svm/examples/Cargo.lock @@ -5213,6 +5213,19 @@ dependencies = [ "solana-program-entrypoint", ] +[[package]] +name = "solana-compute-budget-instruction" +version = "2.2.0" +dependencies = [ + "log", + "solana-builtins-default-costs", + "solana-compute-budget", + "solana-pubkey", + "solana-sdk", + "solana-svm-transaction", + "thiserror 2.0.6", +] + [[package]] name = "solana-compute-budget-interface" version = "2.2.0" @@ -5307,6 +5320,7 @@ dependencies = [ "solana-builtins-default-costs", "solana-client", "solana-compute-budget", + "solana-compute-budget-instruction", "solana-connection-cache", "solana-cost-model", "solana-entry", @@ -5363,6 +5377,7 @@ dependencies = [ "log", "solana-builtins-default-costs", "solana-compute-budget", + "solana-compute-budget-instruction", "solana-feature-set", "solana-metrics", "solana-runtime-transaction", @@ -6593,6 +6608,7 @@ dependencies = [ "solana-bucket-map", "solana-builtins", "solana-compute-budget", + "solana-compute-budget-instruction", "solana-config-program", "solana-cost-model", "solana-feature-set", @@ -6632,8 +6648,8 @@ version = "2.2.0" dependencies = [ "agave-transaction-view", "log", - "solana-builtins-default-costs", "solana-compute-budget", + "solana-compute-budget-instruction", "solana-pubkey", "solana-sdk", "solana-sdk-ids", @@ -7036,13 +7052,13 @@ dependencies = [ "serde_derive", "solana-bpf-loader-program", "solana-compute-budget", + "solana-compute-budget-instruction", "solana-feature-set", "solana-fee", "solana-loader-v4-program", "solana-log-collector", "solana-measure", "solana-program-runtime", - "solana-runtime-transaction", "solana-sdk", "solana-svm-rent-collector", "solana-svm-transaction", diff --git a/svm/src/transaction_processor.rs b/svm/src/transaction_processor.rs index f8c307a010ef9b..21245436503456 100644 --- a/svm/src/transaction_processor.rs +++ b/svm/src/transaction_processor.rs @@ -24,6 +24,7 @@ use { create_program_runtime_environment_v1, create_program_runtime_environment_v2, }, solana_compute_budget::compute_budget::ComputeBudget, + solana_compute_budget_instruction::instructions_processor::process_compute_budget_instructions, solana_feature_set::{ enable_transaction_loading_failure_fees, remove_accounts_executable_flag_checks, remove_rounding_in_fee_calculation, FeatureSet, @@ -42,7 +43,6 @@ use { }, sysvar_cache::SysvarCache, }, - solana_runtime_transaction::instructions_processor::process_compute_budget_instructions, solana_sdk::{ account::{AccountSharedData, ReadableAccount, PROGRAM_OWNERS}, account_utils::StateMut,