diff --git a/third-party/patches/agave.patch b/third-party/patches/agave.patch index bf10f08c..655bb832 100644 --- a/third-party/patches/agave.patch +++ b/third-party/patches/agave.patch @@ -53,10 +53,10 @@ index 190abb3..c157072 100644 pub struct Measure { name: &'static str, diff --git a/program-runtime/Cargo.toml b/program-runtime/Cargo.toml -index 4e764de..93cfd6c 100644 +index b3a6228..b8bae66 100644 --- a/program-runtime/Cargo.toml +++ b/program-runtime/Cargo.toml -@@ -40,4 +40,6 @@ solana_rbpf = { workspace = true } +@@ -39,4 +39,6 @@ solana_rbpf = { workspace = true } thiserror = { workspace = true } +test-fuzz = { path = "../../../test-fuzz" } @@ -64,36 +64,36 @@ index 4e764de..93cfd6c 100644 [dev-dependencies] assert_matches = { workspace = true } diff --git a/program-runtime/src/invoke_context.rs b/program-runtime/src/invoke_context.rs -index a54e083..05b63f8 100644 +index f6e0e46..e275453 100644 --- a/program-runtime/src/invoke_context.rs +++ b/program-runtime/src/invoke_context.rs -@@ -121,4 +121,5 @@ impl fmt::Display for AllocErr { +@@ -120,4 +120,5 @@ impl fmt::Display for AllocErr { } +#[derive(Clone, serde::Deserialize, serde::Serialize)] pub struct BpfAllocator { len: u64, -@@ -149,10 +150,13 @@ impl BpfAllocator { +@@ -148,10 +149,13 @@ impl BpfAllocator { } +#[derive(Clone, Debug, serde::Deserialize, serde::Serialize)] pub struct EnvironmentConfig<'a> { pub blockhash: Hash, pub blockhash_lamports_per_signature: u64, - epoch_total_stake: Option, + epoch_total_stake: u64, + #[serde(skip)] - epoch_vote_accounts: Option<&'a VoteAccountsHashMap>, + get_epoch_vote_account_stake_callback: &'a dyn Fn(&'a Pubkey) -> u64, pub feature_set: Arc, + #[serde(with = "test_fuzz::serde_ref")] sysvar_cache: &'a SysvarCache, } -@@ -177,4 +181,5 @@ impl<'a> EnvironmentConfig<'a> { +@@ -176,4 +180,5 @@ impl<'a> EnvironmentConfig<'a> { } +#[derive(Clone, serde::Deserialize, serde::Serialize)] pub struct SyscallContext { pub allocator: BpfAllocator, -@@ -183,5 +188,11 @@ pub struct SyscallContext { +@@ -182,5 +187,11 @@ pub struct SyscallContext { } -#[derive(Debug, Clone)] @@ -106,7 +106,7 @@ index a54e083..05b63f8 100644 +#[derive(Debug, Clone, serde::Deserialize, serde::Serialize)] pub struct SerializedAccountMetadata { pub original_data_len: usize, -@@ -192,9 +203,24 @@ pub struct SerializedAccountMetadata { +@@ -191,9 +202,24 @@ pub struct SerializedAccountMetadata { } +fn default_program_cache_for_tx_batch<'de, D>( @@ -131,13 +131,13 @@ index a54e083..05b63f8 100644 + )] pub program_cache_for_tx_batch: &'a mut ProgramCacheForTxBatch, /// Runtime configurations used to provision the invocation environment. -@@ -207,4 +233,5 @@ pub struct InvokeContext<'a> { +@@ -206,4 +232,5 @@ pub struct InvokeContext<'a> { log_collector: Option>>, /// Latest measurement not yet accumulated in [ExecuteDetailsTimings::execute_us] + #[serde(skip)] pub execute_time: Option, pub timings: ExecuteDetailsTimings, -@@ -213,4 +240,23 @@ pub struct InvokeContext<'a> { +@@ -212,4 +239,23 @@ pub struct InvokeContext<'a> { } +impl<'a> Clone for InvokeContext<'a> { @@ -173,7 +173,7 @@ index 76496ce..811e4fc 100644 pub struct SysvarCache { // full account data as provided by bank, including any trailing zero bytes diff --git a/programs/bpf_loader/Cargo.toml b/programs/bpf_loader/Cargo.toml -index 8fb86df..4b48f84 100644 +index 3c62ccc..34b67a6 100644 --- a/programs/bpf_loader/Cargo.toml +++ b/programs/bpf_loader/Cargo.toml @@ -31,4 +31,7 @@ solana_rbpf = { workspace = true } @@ -199,17 +199,17 @@ index 9f62c4f..ffbf6b8 100644 ) -> Result> { let log_collector = invoke_context.get_log_collector(); diff --git a/sdk/Cargo.toml b/sdk/Cargo.toml -index fb69474..7c400c6 100644 +index 485a8d3..a15c3ff 100644 --- a/sdk/Cargo.toml +++ b/sdk/Cargo.toml -@@ -90,5 +90,5 @@ qualifier_attr = { workspace = true, optional = true } +@@ -94,5 +94,5 @@ qualifier_attr = { workspace = true, optional = true } rand = { workspace = true, optional = true } rand0-7 = { workspace = true, optional = true } -serde = { workspace = true } +serde = { workspace = true, features = ["rc"] } serde_bytes = { workspace = true } serde_derive = { workspace = true } -@@ -148,4 +148,6 @@ solana-transaction-error = { workspace = true, features = ["serde"], optional = +@@ -158,4 +158,6 @@ solana-transaction-error = { workspace = true, features = ["serde"], optional = thiserror = { workspace = true } +test-fuzz = { path = "../../../test-fuzz" } @@ -228,35 +228,35 @@ index 19b9075..ab7ed50 100644 [features] frozen-abi = [ diff --git a/sdk/feature-set/src/lib.rs b/sdk/feature-set/src/lib.rs -index a66da8b..81bc72b 100644 +index c465fd1..ab914b2 100644 --- a/sdk/feature-set/src/lib.rs +++ b/sdk/feature-set/src/lib.rs -@@ -1140,5 +1140,5 @@ lazy_static! { +@@ -1149,5 +1149,5 @@ lazy_static! { /// `FeatureSet` holds the set of currently active/inactive runtime features #[cfg_attr(feature = "frozen-abi", derive(solana_frozen_abi_macro::AbiExample))] -#[derive(Debug, Clone, Eq, PartialEq)] +#[derive(Debug, Clone, Eq, PartialEq, serde::Deserialize, serde::Serialize)] pub struct FeatureSet { pub active: HashMap, -diff --git a/sdk/src/transaction_context.rs b/sdk/src/transaction_context.rs -index 6cb9513..3363645 100644 ---- a/sdk/src/transaction_context.rs -+++ b/sdk/src/transaction_context.rs -@@ -33,5 +33,5 @@ pub type IndexOfAccount = u16; +diff --git a/sdk/transaction-context/src/lib.rs b/sdk/transaction-context/src/lib.rs +index 33bd6bc..1fc2e93 100644 +--- a/sdk/transaction-context/src/lib.rs ++++ b/sdk/transaction-context/src/lib.rs +@@ -57,5 +57,5 @@ pub type IndexOfAccount = u16; /// /// It also contains indices to other structures for faster lookup. -#[derive(Clone, Debug, Eq, PartialEq)] +#[derive(Clone, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize)] pub struct InstructionAccount { /// Points to the account and its key in the `TransactionContext` -@@ -54,5 +54,5 @@ pub struct InstructionAccount { +@@ -78,5 +78,5 @@ pub struct InstructionAccount { pub type TransactionAccount = (Pubkey, AccountSharedData); -#[derive(Clone, Debug, PartialEq)] +#[derive(Clone, Debug, PartialEq, serde::Deserialize, serde::Serialize)] pub struct TransactionAccounts { accounts: Vec>, -@@ -127,9 +127,31 @@ impl TransactionAccounts { +@@ -151,9 +151,31 @@ impl TransactionAccounts { } +fn serialize_account_keys<'a, S>( @@ -289,7 +289,7 @@ index 6cb9513..3363645 100644 + )] account_keys: Pin>, accounts: Rc, -@@ -190,7 +212,7 @@ impl TransactionContext { +@@ -222,7 +244,7 @@ impl TransactionContext { } - Ok(Rc::try_unwrap(self.accounts) @@ -300,7 +300,7 @@ index 6cb9513..3363645 100644 + Ok((*self.accounts).clone().into_accounts()) } -@@ -455,5 +477,5 @@ pub struct TransactionReturnData { +@@ -499,5 +521,5 @@ pub struct TransactionReturnData { /// /// This context is valid for the entire duration of a (possibly cross program) instruction being processed. -#[derive(Debug, Clone, Default, Eq, PartialEq)] diff --git a/third-party/patches/solana_rbpf.patch b/third-party/patches/solana_rbpf.patch index 98f797fa..ea475fe2 100644 --- a/third-party/patches/solana_rbpf.patch +++ b/third-party/patches/solana_rbpf.patch @@ -336,7 +336,7 @@ index e0ebfe6..64f1fa0 100644 struct MappingCache { // The cached entries. diff --git a/src/program.rs b/src/program.rs -index 183b058..116bb53 100644 +index 35f7ed4..ed362d2 100644 --- a/src/program.rs +++ b/src/program.rs @@ -10,5 +10,5 @@ use { @@ -346,14 +346,14 @@ index 183b058..116bb53 100644 +#[derive(Debug, PartialEq, PartialOrd, Eq, Clone, Copy, serde::Deserialize, serde::Serialize)] pub enum SBPFVersion { /// The legacy format -@@ -361,5 +361,5 @@ impl std::fmt::Debug for BuiltinProgram { +@@ -366,5 +366,5 @@ impl std::fmt::Debug for BuiltinProgram { #[macro_export] macro_rules! declare_builtin_function { - ($(#[$attr:meta])* $name:ident $(<$($generic_ident:tt : $generic_type:tt),+>)?, fn rust( + ($(#[$attr:meta])* $name:ident, fn rust $(<$($lifetime:tt),+>)? ( $vm:ident : &mut $ContextObject:ty, $arg_a:ident : u64, -@@ -372,7 +372,9 @@ macro_rules! declare_builtin_function { +@@ -377,7 +377,9 @@ macro_rules! declare_builtin_function { $(#[$attr])* pub struct $name {} + #[test_fuzz::test_fuzz_impl] @@ -364,7 +364,7 @@ index 183b058..116bb53 100644 + pub fn rust $(<$($lifetime),+>)? ( $vm: &mut $ContextObject, $arg_a: u64, -@@ -383,9 +385,12 @@ macro_rules! declare_builtin_function { +@@ -388,9 +390,12 @@ macro_rules! declare_builtin_function { $memory_mapping: &mut $MemoryMapping, ) -> $Result { + if matches!($memory_mapping, MemoryMapping::Identity) { @@ -378,14 +378,14 @@ index 183b058..116bb53 100644 + pub fn vm $(<$($lifetime),+>)? ( $vm: *mut $crate::vm::EbpfVm<$ContextObject>, $arg_a: u64, -@@ -397,5 +402,5 @@ macro_rules! declare_builtin_function { +@@ -402,5 +407,5 @@ macro_rules! declare_builtin_function { use $crate::vm::ContextObject; let vm = unsafe { - &mut *($vm.cast::().offset(-($crate::vm::get_runtime_environment_key() as isize)).cast::<$crate::vm::EbpfVm<$ContextObject>>()) + &mut *(($vm as *mut u64).offset(-($crate::vm::get_runtime_environment_key() as isize)) as *mut $crate::vm::EbpfVm<$ContextObject>) }; let config = vm.loader.get_config(); -@@ -403,5 +408,5 @@ macro_rules! declare_builtin_function { +@@ -408,5 +413,5 @@ macro_rules! declare_builtin_function { vm.context_object_pointer.consume(vm.previous_instruction_meter - vm.due_insn_count); } - let converted_result: $crate::error::ProgramResult = Self::rust $(::<$($generic_ident),+>)?( @@ -499,7 +499,7 @@ index 690be74..d1c7d7c 100644 pub struct TestContextObject { /// Contains the register state at every instruction in order of execution diff --git a/tests/execution.rs b/tests/execution.rs -index 67314ff..7d1da71 100644 +index 4c6b857..19a86b3 100644 --- a/tests/execution.rs +++ b/tests/execution.rs @@ -2595,5 +2595,5 @@ declare_builtin_function!( diff --git a/third-party/third_party.json b/third-party/third_party.json index 92d34758..80638abd 100644 --- a/third-party/third_party.json +++ b/third-party/third_party.json @@ -2,7 +2,7 @@ { "flags": ["EXPENSIVE", "SKIP_NIGHTLY"], "url": "https://github.com/anza-xyz/agave", - "rev": "8bf688fe71fb01ba74af9cfd975bfcc6f9d04641", + "rev": "86a70621aeabefdfdd574155e37520342d7e0680", "patch": "agave.patch", "subdir": ".", "package": "solana-bpf-loader-program", @@ -20,7 +20,7 @@ { "flags": ["EXPENSIVE", "SKIP_NIGHTLY"], "url": "https://github.com/paritytech/polkadot-sdk", - "rev": "ae4b68b36d6da1dd0d6a78643b634296b3fa8039", + "rev": "56d97c3ad8c86e602bc7ac368751210517c4309f", "patch": "substrate_client_transaction_pool.patch", "subdir": ".", "package": "sc-transaction-pool", @@ -38,7 +38,7 @@ { "flags": [], "url": "https://github.com/solana-labs/rbpf", - "rev": "8d36530b7071060e2837ebb26f25590db6816048", + "rev": "b78c20f4a3527888da68254863c47f9e0a0a868e", "patch": "solana_rbpf.patch", "subdir": ".", "package": "solana_rbpf",