From 54cbd3c320c2428f5cdc2e21f9fac66188c491a2 Mon Sep 17 00:00:00 2001 From: Samuel Moelius Date: Thu, 5 Dec 2024 09:48:14 +0000 Subject: [PATCH] Update patches --- third-party/patches/agave.patch | 46 +++++++++++++------ third-party/patches/solana_rbpf.patch | 22 ++++----- .../substrate_client_transaction_pool.patch | 23 ++++++++-- third-party/third_party.json | 6 +-- 4 files changed, 64 insertions(+), 33 deletions(-) diff --git a/third-party/patches/agave.patch b/third-party/patches/agave.patch index b05d459f..3f25ea0c 100644 --- a/third-party/patches/agave.patch +++ b/third-party/patches/agave.patch @@ -210,7 +210,7 @@ index 3c62ccc..34b67a6 100644 [dev-dependencies] assert_matches = { workspace = true } diff --git a/programs/bpf_loader/src/lib.rs b/programs/bpf_loader/src/lib.rs -index 9f62c4f..ffbf6b8 100644 +index da9ca78..7093666 100644 --- a/programs/bpf_loader/src/lib.rs +++ b/programs/bpf_loader/src/lib.rs @@ -398,6 +398,7 @@ declare_builtin_function!( @@ -224,17 +224,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 1cc7507..0cf0eb6 100644 +index 4dabd2c..efe4646 100644 --- a/sdk/Cargo.toml +++ b/sdk/Cargo.toml -@@ -101,5 +101,5 @@ qualifier_attr = { workspace = true, optional = true } +@@ -109,5 +109,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 } -@@ -168,4 +168,6 @@ solana-transaction-error = { workspace = true, features = ["serde"], optional = +@@ -195,4 +195,6 @@ solana-transaction-error = { workspace = true, features = [ thiserror = { workspace = true } +test-fuzz = { path = "../../../test-fuzz" } @@ -242,29 +242,47 @@ index 1cc7507..0cf0eb6 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 19b9075..ab7ed50 100644 +index e0104fd..783a67c 100644 --- a/sdk/feature-set/Cargo.toml +++ b/sdk/feature-set/Cargo.toml -@@ -23,4 +23,6 @@ solana-pubkey = { workspace = true } +@@ -11,5 +11,5 @@ edition = { workspace = true } + + [dependencies] +-ahash = { workspace = true } ++ahash = { workspace = true, features = ["serde"] } + lazy_static = { workspace = true } + solana-epoch-schedule = { workspace = true } +@@ -24,4 +24,6 @@ solana-pubkey = { workspace = true } solana-sha256-hasher = { workspace = true } -+serde = { workspace = true } ++serde = { workspace = true, features = ["serde_derive"] } + [features] - frozen-abi = [ + frozen-abi = ["dep:solana-frozen-abi", "dep:solana-frozen-abi-macro"] diff --git a/sdk/feature-set/src/lib.rs b/sdk/feature-set/src/lib.rs -index c465fd1..ab914b2 100644 +index 04fe40e..89c3ce9 100644 --- a/sdk/feature-set/src/lib.rs +++ b/sdk/feature-set/src/lib.rs -@@ -1149,5 +1149,5 @@ lazy_static! { +@@ -1155,5 +1155,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, + pub active: AHashMap, +diff --git a/sdk/pubkey/Cargo.toml b/sdk/pubkey/Cargo.toml +index 1648f3a..dffc85d 100644 +--- a/sdk/pubkey/Cargo.toml ++++ b/sdk/pubkey/Cargo.toml +@@ -65,5 +65,5 @@ borsh = ["dep:borsh", "dep:borsh0-10", "std"] + bytemuck = ["dep:bytemuck", "dep:bytemuck_derive"] + curve25519 = ["dep:curve25519-dalek", "sha2"] +-default = ["std"] ++default = ["std", "serde"] + dev-context-only-utils = ["dep:arbitrary", "rand"] + frozen-abi = [ diff --git a/sdk/transaction-context/src/lib.rs b/sdk/transaction-context/src/lib.rs -index 33bd6bc..1fc2e93 100644 +index 1cd0854..326b077 100644 --- a/sdk/transaction-context/src/lib.rs +++ b/sdk/transaction-context/src/lib.rs @@ -57,5 +57,5 @@ pub type IndexOfAccount = u16; @@ -344,7 +362,7 @@ index c52b46a..5458d4c 100644 [package.metadata.docs.rs] targets = ["x86_64-unknown-linux-gnu"] diff --git a/timings/src/lib.rs b/timings/src/lib.rs -index 2cd7a49..388a027 100644 +index 3564559..058cd63 100644 --- a/timings/src/lib.rs +++ b/timings/src/lib.rs @@ -11,5 +11,5 @@ use { @@ -354,7 +372,7 @@ index 2cd7a49..388a027 100644 +#[derive(Default, Debug, PartialEq, Eq, Clone, serde::Deserialize, serde::Serialize)] pub struct ProgramTiming { pub accumulated_us: u64, -@@ -374,5 +374,5 @@ impl ExecuteAccessoryTimings { +@@ -373,5 +373,5 @@ impl ExecuteAccessoryTimings { } -#[derive(Default, Debug, PartialEq, Eq)] diff --git a/third-party/patches/solana_rbpf.patch b/third-party/patches/solana_rbpf.patch index ea475fe2..82363ee2 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 e0ebfe6..64f1fa0 100644 +index de5ffe5..eeca621 100644 --- a/src/memory_region.rs +++ b/src/memory_region.rs @@ -34,5 +34,5 @@ use std::{ @@ -336,7 +336,7 @@ index e0ebfe6..64f1fa0 100644 struct MappingCache { // The cached entries. diff --git a/src/program.rs b/src/program.rs -index 35f7ed4..ed362d2 100644 +index fe019dd..d82f8e3 100644 --- a/src/program.rs +++ b/src/program.rs @@ -10,5 +10,5 @@ use { @@ -346,14 +346,14 @@ index 35f7ed4..ed362d2 100644 +#[derive(Debug, PartialEq, PartialOrd, Eq, Clone, Copy, serde::Deserialize, serde::Serialize)] pub enum SBPFVersion { /// The legacy format -@@ -366,5 +366,5 @@ impl std::fmt::Debug for BuiltinProgram { +@@ -363,5 +363,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, -@@ -377,7 +377,9 @@ macro_rules! declare_builtin_function { +@@ -374,7 +374,9 @@ macro_rules! declare_builtin_function { $(#[$attr])* pub struct $name {} + #[test_fuzz::test_fuzz_impl] @@ -364,7 +364,7 @@ index 35f7ed4..ed362d2 100644 + pub fn rust $(<$($lifetime),+>)? ( $vm: &mut $ContextObject, $arg_a: u64, -@@ -388,9 +390,12 @@ macro_rules! declare_builtin_function { +@@ -385,9 +387,12 @@ macro_rules! declare_builtin_function { $memory_mapping: &mut $MemoryMapping, ) -> $Result { + if matches!($memory_mapping, MemoryMapping::Identity) { @@ -378,14 +378,14 @@ index 35f7ed4..ed362d2 100644 + pub fn vm $(<$($lifetime),+>)? ( $vm: *mut $crate::vm::EbpfVm<$ContextObject>, $arg_a: u64, -@@ -402,5 +407,5 @@ macro_rules! declare_builtin_function { +@@ -399,5 +404,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(); -@@ -408,5 +413,5 @@ macro_rules! declare_builtin_function { +@@ -405,5 +410,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),+>)?( @@ -481,7 +481,7 @@ index a8d398d..98f35a4 100644 ) -> Result> { println!( diff --git a/src/vm.rs b/src/vm.rs -index 690be74..d1c7d7c 100644 +index 3afa01b..06a58d9 100644 --- a/src/vm.rs +++ b/src/vm.rs @@ -49,5 +49,5 @@ pub fn get_runtime_environment_key() -> i32 { @@ -499,17 +499,17 @@ 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 4c6b857..19a86b3 100644 +index 9573c91..79c1a2d 100644 --- a/tests/execution.rs +++ b/tests/execution.rs -@@ -2595,5 +2595,5 @@ declare_builtin_function!( +@@ -2681,5 +2681,5 @@ declare_builtin_function!( /// For test_nested_vm_syscall() SyscallNestedVm, - fn rust( + fn rust<'a>( _context_object: &mut TestContextObject, depth: u64, -@@ -2602,5 +2602,5 @@ declare_builtin_function!( +@@ -2688,5 +2688,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 ea26ed1a..3888533c 100644 --- a/third-party/patches/substrate_client_transaction_pool.patch +++ b/third-party/patches/substrate_client_transaction_pool.patch @@ -19,17 +19,30 @@ index d346add..d270d0f 100644 [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 e4c3a6c..dd840aa 100644 +index 04eaa99..72cd43a 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 { + /// A transaction source that includes a timestamp indicating when the transaction was submitted. +-#[derive(Debug, Clone, PartialEq, Eq)] ++#[derive(Debug, Clone, PartialEq, Eq, serde::Deserialize, serde::Serialize)] + pub struct TimedTransactionSource { + /// The original source of the transaction. +@@ -91,4 +91,5 @@ pub struct TimedTransactionSource { + + /// The time at which the transaction was submitted. ++ #[serde(skip)] + pub timestamp: Option, + } +@@ -123,5 +124,5 @@ impl TimedTransactionSource { + /// Immutable transaction -#[derive(PartialEq, Eq, Clone)] +#[derive(PartialEq, Eq, Clone, serde::Deserialize, serde::Serialize)] pub struct Transaction { /// Raw extrinsic representing that transaction. -@@ -221,5 +221,7 @@ pub struct BasePool { +@@ -259,5 +260,7 @@ pub struct BasePool { } -impl Default for BasePool { @@ -38,7 +51,7 @@ index e4c3a6c..dd840aa 100644 +{ fn default() -> Self { Self::new(false) -@@ -227,5 +229,7 @@ impl Default for Bas +@@ -265,5 +268,7 @@ impl Default for Bas } -impl BasePool { @@ -64,7 +77,7 @@ index 2c1e64c..ca41c4f 100644 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 860bcff..85a3b95 100644 +index 9061d0e..2d9e31d 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::{ @@ -129,7 +142,7 @@ index 860bcff..85a3b95 100644 + } let tx = ready.get_mut(other).expect(HASH_READY); tx.unlocks.push(hash.clone()); -@@ -606,5 +621,8 @@ mod tests { +@@ -605,5 +620,8 @@ mod tests { } - fn import( diff --git a/third-party/third_party.json b/third-party/third_party.json index db73be02..f218bc01 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": "f9f54bcba0b75b7566a948c3441bc5e1d03152fc", + "rev": "5b8489fc14037001784bff0ab3ffbbbac33b4a12", "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": "bf20a9ee18f7215210bbbabf79e955c8c35b3360", + "rev": "f7838db506f48e48671f867f23d8c12858c5b67c", "patch": "substrate_client_transaction_pool.patch", "subdir": ".", "package": "sc-transaction-pool", @@ -38,7 +38,7 @@ { "flags": [], "url": "https://github.com/solana-labs/rbpf", - "rev": "b78c20f4a3527888da68254863c47f9e0a0a868e", + "rev": "ba886be3b248a4e5ca94a4a7929380479a8a3053", "patch": "solana_rbpf.patch", "subdir": ".", "package": "solana_rbpf",