From a7e305592d16cfb5664a36bbe58ca6dafc7bba4f Mon Sep 17 00:00:00 2001 From: Samuel Moelius Date: Thu, 17 Oct 2024 22:53:35 +0000 Subject: [PATCH] Update patches --- third-party/patches/agave.patch | 30 +++++----- third-party/patches/solana_rbpf.patch | 32 +++++----- .../substrate_client_transaction_pool.patch | 59 +++++++++---------- third-party/third_party.json | 6 +- 4 files changed, 61 insertions(+), 66 deletions(-) diff --git a/third-party/patches/agave.patch b/third-party/patches/agave.patch index 878d8a8b..1daeb912 100644 --- a/third-party/patches/agave.patch +++ b/third-party/patches/agave.patch @@ -168,7 +168,7 @@ index c96da3e..3abc16c 100644 impl<'a> InvokeContext<'a> { #[allow(clippy::too_many_arguments)] diff --git a/program-runtime/src/sysvar_cache.rs b/program-runtime/src/sysvar_cache.rs -index 8b4bc61..d8c791c 100644 +index 76496ce..811e4fc 100644 --- a/program-runtime/src/sysvar_cache.rs +++ b/program-runtime/src/sysvar_cache.rs @@ -25,5 +25,5 @@ impl ::solana_frozen_abi::abi_example::AbiExample for SysvarCache { @@ -205,17 +205,17 @@ index 5e81062..821afe7 100644 ) -> Result> { let log_collector = invoke_context.get_log_collector(); diff --git a/sdk/Cargo.toml b/sdk/Cargo.toml -index 8793f1e..a9dc134 100644 +index 4872798..ea622b2 100644 --- a/sdk/Cargo.toml +++ b/sdk/Cargo.toml -@@ -76,5 +76,5 @@ qualifier_attr = { workspace = true, optional = true } +@@ -79,5 +79,5 @@ qualifier_attr = { workspace = true, optional = true } rand = { workspace = true, optional = true } rand0-7 = { package = "rand", version = "0.7", optional = true } -serde = { workspace = true } +serde = { workspace = true, features = ["rc"] } serde_bytes = { workspace = true } serde_derive = { workspace = true } -@@ -109,4 +109,6 @@ solana-signature = { workspace = true, features = [ +@@ -117,4 +117,6 @@ solana-signature = { workspace = true, features = [ thiserror = { workspace = true } +test-fuzz = { path = "../../../test-fuzz" } @@ -223,21 +223,21 @@ index 8793f1e..a9dc134 100644 [target.'cfg(target_arch = "wasm32")'.dependencies] getrandom = { version = "0.1", features = ["wasm-bindgen"] } diff --git a/sdk/feature-set/Cargo.toml b/sdk/feature-set/Cargo.toml -index d6f2824..cd164aa 100644 +index 7352ff3..d7e4da2 100644 --- a/sdk/feature-set/Cargo.toml +++ b/sdk/feature-set/Cargo.toml -@@ -20,4 +20,6 @@ solana-frozen-abi-macro = { workspace = true, optional = true, features = [ - solana-program = { workspace = true } +@@ -24,4 +24,6 @@ solana-pubkey = { workspace = true } + solana-sha256-hasher = { workspace = true } +serde = { workspace = true } + [features] frozen-abi = [ diff --git a/sdk/feature-set/src/lib.rs b/sdk/feature-set/src/lib.rs -index 6567404..e35c427 100644 +index 83d5974..4c29279 100644 --- a/sdk/feature-set/src/lib.rs +++ b/sdk/feature-set/src/lib.rs -@@ -1123,5 +1123,5 @@ lazy_static! { +@@ -1121,5 +1121,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)] @@ -245,24 +245,24 @@ index 6567404..e35c427 100644 pub struct FeatureSet { pub active: HashMap, diff --git a/sdk/src/transaction_context.rs b/sdk/src/transaction_context.rs -index 0bb2f0e..72c11c2 100644 +index 95f65c3..94a5c8e 100644 --- a/sdk/src/transaction_context.rs +++ b/sdk/src/transaction_context.rs -@@ -36,5 +36,5 @@ pub type IndexOfAccount = u16; +@@ -33,5 +33,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` -@@ -57,5 +57,5 @@ pub struct InstructionAccount { +@@ -54,5 +54,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>, -@@ -130,9 +130,31 @@ impl TransactionAccounts { +@@ -127,9 +127,31 @@ impl TransactionAccounts { } +fn serialize_account_keys<'a, S>( @@ -295,7 +295,7 @@ index 0bb2f0e..72c11c2 100644 + )] account_keys: Pin>, accounts: Rc, -@@ -185,7 +207,7 @@ impl TransactionContext { +@@ -182,7 +204,7 @@ impl TransactionContext { } - Ok(Rc::try_unwrap(self.accounts) @@ -306,7 +306,7 @@ index 0bb2f0e..72c11c2 100644 + Ok((*self.accounts).clone().into_accounts()) } -@@ -450,5 +472,5 @@ pub struct TransactionReturnData { +@@ -447,5 +469,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 f8b33211..8d7adf0a 100644 --- a/third-party/patches/solana_rbpf.patch +++ b/third-party/patches/solana_rbpf.patch @@ -16,7 +16,7 @@ index 781ce87..a999428 100644 + +[workspace] diff --git a/src/memory_region.rs b/src/memory_region.rs -index e864855..a8a44e6 100644 +index e555bf6..9da7e4e 100644 --- a/src/memory_region.rs +++ b/src/memory_region.rs @@ -34,5 +34,5 @@ use std::{ @@ -138,7 +138,7 @@ index e864855..a8a44e6 100644 cow_cb: Option, } --impl<'a> fmt::Debug for UnalignedMemoryMapping<'a> { +-impl fmt::Debug for UnalignedMemoryMapping<'_> { +#[derive(serde::Deserialize, serde::Serialize)] +struct SerializableUnalignedMemoryMapping { + regions: Box<[MemoryRegion]>, @@ -223,7 +223,7 @@ index e864855..a8a44e6 100644 +impl fmt::Debug for UnalignedMemoryMapping { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.debug_struct("UnalignedMemoryMapping") -@@ -215,5 +377,5 @@ impl<'a> fmt::Debug for UnalignedMemoryMapping<'a> { +@@ -215,5 +377,5 @@ impl fmt::Debug for UnalignedMemoryMapping<'_> { } -impl<'a> UnalignedMemoryMapping<'a> { @@ -322,7 +322,7 @@ index e864855..a8a44e6 100644 cow_cb: Option, } -+impl<'a> Clone for AlignedMemoryMapping<'a> { ++impl Clone for AlignedMemoryMapping<'_> { + fn clone(&self) -> Self { + Self { + regions: self.regions.clone(), @@ -333,7 +333,7 @@ index e864855..a8a44e6 100644 + } +} + - impl<'a> fmt::Debug for AlignedMemoryMapping<'a> { + impl fmt::Debug for AlignedMemoryMapping<'_> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { @@ -728,5 +911,5 @@ impl<'a> AlignedMemoryMapping<'a> { @@ -357,24 +357,24 @@ index e864855..a8a44e6 100644 struct MappingCache { // The cached entries. diff --git a/src/program.rs b/src/program.rs -index cc80ec2..6f052ad 100644 +index 3c84431..e9e5de0 100644 --- a/src/program.rs +++ b/src/program.rs @@ -10,5 +10,5 @@ use { /// Defines a set of sbpf_version of an executable --#[derive(Debug, PartialEq, PartialOrd, Eq, Clone)] +-#[derive(Debug, PartialEq, PartialOrd, Eq, Clone, Copy)] +#[derive(Debug, PartialEq, PartialOrd, Eq, Clone, Copy, serde::Deserialize, serde::Serialize)] pub enum SBPFVersion { /// The legacy format -@@ -287,5 +287,5 @@ impl std::fmt::Debug for BuiltinProgram { +@@ -301,5 +301,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, -@@ -298,7 +298,9 @@ macro_rules! declare_builtin_function { +@@ -312,7 +312,9 @@ macro_rules! declare_builtin_function { $(#[$attr])* pub struct $name {} + #[test_fuzz::test_fuzz_impl] @@ -385,7 +385,7 @@ index cc80ec2..6f052ad 100644 + pub fn rust $(<$($lifetime),+>)? ( $vm: &mut $ContextObject, $arg_a: u64, -@@ -309,9 +311,12 @@ macro_rules! declare_builtin_function { +@@ -323,9 +325,12 @@ macro_rules! declare_builtin_function { $memory_mapping: &mut $MemoryMapping, ) -> $Result { + if matches!($memory_mapping, MemoryMapping::Identity) { @@ -399,14 +399,14 @@ index cc80ec2..6f052ad 100644 + pub fn vm $(<$($lifetime),+>)? ( $vm: *mut $crate::vm::EbpfVm<$ContextObject>, $arg_a: u64, -@@ -323,5 +328,5 @@ macro_rules! declare_builtin_function { +@@ -337,5 +342,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(); -@@ -329,5 +334,5 @@ macro_rules! declare_builtin_function { +@@ -343,5 +348,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),+>)?( @@ -502,7 +502,7 @@ index a8d398d..98f35a4 100644 ) -> Result> { println!( diff --git a/src/vm.rs b/src/vm.rs -index f4a9a15..01ded61 100644 +index 7bff55c..c06b82e 100644 --- a/src/vm.rs +++ b/src/vm.rs @@ -49,5 +49,5 @@ pub fn get_runtime_environment_key() -> i32 { @@ -520,17 +520,17 @@ index f4a9a15..01ded61 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 fae306d..07a48ff 100644 +index 760078d..7d6566b 100644 --- a/tests/execution.rs +++ b/tests/execution.rs -@@ -2534,5 +2534,5 @@ declare_builtin_function!( +@@ -2658,5 +2658,5 @@ declare_builtin_function!( /// For test_nested_vm_syscall() SyscallNestedVm, - fn rust( + fn rust<'a>( _context_object: &mut TestContextObject, depth: u64, -@@ -2541,5 +2541,5 @@ declare_builtin_function!( +@@ -2665,5 +2665,5 @@ declare_builtin_function!( _arg4: u64, _arg5: u64, - _memory_mapping: &mut MemoryMapping, diff --git a/third-party/patches/substrate_client_transaction_pool.patch b/third-party/patches/substrate_client_transaction_pool.patch index 601bd330..c5516b06 100644 --- a/third-party/patches/substrate_client_transaction_pool.patch +++ b/third-party/patches/substrate_client_transaction_pool.patch @@ -1,8 +1,8 @@ diff --git a/substrate/client/transaction-pool/Cargo.toml b/substrate/client/transaction-pool/Cargo.toml -index 98994cc..1b029b4 100644 +index d346add..d270d0f 100644 --- a/substrate/client/transaction-pool/Cargo.toml +++ b/substrate/client/transaction-pool/Cargo.toml -@@ -23,6 +23,6 @@ futures-timer = { workspace = true } +@@ -25,6 +25,6 @@ itertools = { workspace = true } linked-hash-map = { workspace = true } log = { workspace = true, default-features = true } -parking_lot = { workspace = true, default-features = true } @@ -11,14 +11,15 @@ index 98994cc..1b029b4 100644 +serde = { features = ["derive", "rc"], workspace = true, default-features = true } thiserror = { workspace = true } prometheus-endpoint = { workspace = true, default-features = true } -@@ -37,4 +37,5 @@ sp-runtime = { workspace = true, default-features = true } - sp-tracing = { workspace = true, default-features = true } - sp-transaction-pool = { workspace = true, default-features = true } -+test-fuzz = { path = "../../../../../test-fuzz" } +@@ -42,4 +42,6 @@ tokio-stream = { workspace = true } + tokio = { workspace = true, default-features = true, features = ["macros", "time"] } ++test-fuzz = { path = "../../../../../test-fuzz" } ++ [dev-dependencies] + array-bytes = { workspace = true, default-features = true } diff --git a/substrate/client/transaction-pool/src/graph/base_pool.rs b/substrate/client/transaction-pool/src/graph/base_pool.rs -index 3288562..0ba77bc 100644 +index e4c3a6c..dd840aa 100644 --- a/substrate/client/transaction-pool/src/graph/base_pool.rs +++ b/substrate/client/transaction-pool/src/graph/base_pool.rs @@ -85,5 +85,5 @@ pub struct PruneStatus { @@ -47,23 +48,23 @@ index 3288562..0ba77bc 100644 /// Create new pool given reject_future_transactions flag. pub fn new(reject_future_transactions: bool) -> Self { diff --git a/substrate/client/transaction-pool/src/graph/future.rs b/substrate/client/transaction-pool/src/graph/future.rs -index bad4663..b10e15c 100644 +index 2c1e64c..ca41c4f 100644 --- a/substrate/client/transaction-pool/src/graph/future.rs +++ b/substrate/client/transaction-pool/src/graph/future.rs -@@ -29,4 +29,5 @@ use std::time::Instant; - use super::base_pool::Transaction; +@@ -30,4 +30,5 @@ use super::base_pool::Transaction; + use crate::{common::log_xt::log_xt_trace, LOG_TARGET}; +#[derive(serde::Deserialize, serde::Serialize)] /// Transaction with partially satisfied dependencies. pub struct WaitingTransaction { -@@ -36,4 +37,5 @@ pub struct WaitingTransaction { +@@ -37,4 +38,5 @@ pub struct WaitingTransaction { pub missing_tags: HashSet, /// Time of import to the Future Queue. + #[serde(skip, default = "Instant::now")] pub imported_at: Instant, } diff --git a/substrate/client/transaction-pool/src/graph/ready.rs b/substrate/client/transaction-pool/src/graph/ready.rs -index b4a5d9e..f43a43d 100644 +index 860bcff..85a3b95 100644 --- a/substrate/client/transaction-pool/src/graph/ready.rs +++ b/substrate/client/transaction-pool/src/graph/ready.rs @@ -39,5 +39,5 @@ use super::{ @@ -83,7 +84,7 @@ index b4a5d9e..f43a43d 100644 @@ -107,5 +107,5 @@ qed /// Validated transactions that are block ready with all their dependencies met. --#[derive(Debug)] +-#[derive(Clone, Debug)] +#[derive(Clone, Debug, serde::Deserialize, serde::Serialize)] pub struct ReadyTransactions { /// Next free insertion id (used to indicate when a transaction was inserted into the pool). @@ -139,7 +140,7 @@ index b4a5d9e..f43a43d 100644 ready: &mut ReadyTransactions, tx: Transaction, diff --git a/substrate/client/transaction-pool/src/graph/tracked_map.rs b/substrate/client/transaction-pool/src/graph/tracked_map.rs -index 44c2c73..b616365 100644 +index 9e92dff..9c849f6 100644 --- a/substrate/client/transaction-pool/src/graph/tracked_map.rs +++ b/substrate/client/transaction-pool/src/graph/tracked_map.rs @@ -34,6 +34,9 @@ pub trait Size { @@ -154,30 +155,24 @@ index 44c2c73..b616365 100644 +{ index: Arc>>, bytes: AtomicIsize, -@@ -41,5 +44,21 @@ pub struct TrackedMap { +@@ -41,5 +44,8 @@ pub struct TrackedMap { } -impl Default for TrackedMap { -+impl Clone for TrackedMap -+where -+ K: Eq + std::hash::Hash, -+{ -+ fn clone(&self) -> Self { -+ Self { -+ index: Arc::new(self.clone_map().into()), -+ bytes: self.bytes.load(AtomicOrdering::Relaxed).into(), -+ length: self.length.load(AtomicOrdering::Relaxed).into(), -+ } -+ } -+} -+ +impl Default for TrackedMap +where + K: Eq + std::hash::Hash, +{ fn default() -> Self { Self { index: Arc::new(HashMap::default().into()), bytes: 0.into(), length: 0.into() } -@@ -47,5 +66,8 @@ impl Default for TrackedMap { +@@ -49,5 +55,5 @@ impl Default for TrackedMap { + impl Clone for TrackedMap + where +- K: Clone, ++ K: Clone + Eq + std::hash::Hash, + V: Clone, + { +@@ -61,5 +67,8 @@ where } -impl TrackedMap { @@ -187,7 +182,7 @@ index 44c2c73..b616365 100644 +{ /// Current tracked length of the content. pub fn len(&self) -> usize { -@@ -73,5 +95,8 @@ impl TrackedMap { +@@ -87,5 +96,8 @@ impl TrackedMap { } -impl TrackedMap { @@ -198,12 +193,12 @@ index 44c2c73..b616365 100644 /// Clone the inner map. pub fn clone_map(&self) -> HashMap { diff --git a/substrate/primitives/runtime/src/transaction_validity.rs b/substrate/primitives/runtime/src/transaction_validity.rs -index ffff94e..ea15881 100644 +index 2d800e2..a17a7ee 100644 --- a/substrate/primitives/runtime/src/transaction_validity.rs +++ b/substrate/primitives/runtime/src/transaction_validity.rs @@ -228,4 +228,5 @@ impl From for TransactionValidity { /// by our local node (for instance off-chain workers). - #[derive(Copy, Clone, PartialEq, Eq, Encode, Decode, RuntimeDebug, TypeInfo)] + #[derive(Copy, Clone, PartialEq, Eq, Encode, Decode, RuntimeDebug, TypeInfo, Hash)] +#[cfg_attr(feature = "std", derive(serde::Deserialize, serde::Serialize))] pub enum TransactionSource { /// Transaction is already included in block. diff --git a/third-party/third_party.json b/third-party/third_party.json index 962ce705..53c63b6e 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": "83e7d84bcc4cf438905d07279bc07e012a49afd9", + "rev": "2bde0fc99cbe0884516c0bbccc210d06a877d0b6", "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": "8614dc0e055d06de4a3774ac1da0a422b33f34e2", + "rev": "7240b474b92028a1645de6fdb9e0a8aa28dc86be", "patch": "substrate_client_transaction_pool.patch", "subdir": ".", "package": "sc-transaction-pool", @@ -38,7 +38,7 @@ { "flags": [], "url": "https://github.com/solana-labs/rbpf", - "rev": "073c6607d958391713e9fb6d8f756e531224a0ad", + "rev": "e1a9c32c7f2b33e57098ae74a95574de06640a0c", "patch": "solana_rbpf.patch", "subdir": ".", "package": "solana_rbpf",