From 3c27b68eec10216d8e07287f3eefebfb8f8ff8fc Mon Sep 17 00:00:00 2001 From: Samuel Moelius Date: Thu, 14 Nov 2024 19:44:18 +0000 Subject: [PATCH 1/3] Update patches --- third-party/patches/agave.patch | 6 +++--- third-party/third_party.json | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/third-party/patches/agave.patch b/third-party/patches/agave.patch index 2d6b690c..5dcaab2b 100644 --- a/third-party/patches/agave.patch +++ b/third-party/patches/agave.patch @@ -191,10 +191,10 @@ index 8fb86df..4b48f84 100644 [dev-dependencies] assert_matches = { workspace = true } diff --git a/programs/bpf_loader/src/lib.rs b/programs/bpf_loader/src/lib.rs -index 883f0d2..05c9344 100644 +index 9f62c4f..ffbf6b8 100644 --- a/programs/bpf_loader/src/lib.rs +++ b/programs/bpf_loader/src/lib.rs -@@ -396,6 +396,7 @@ declare_builtin_function!( +@@ -398,6 +398,7 @@ declare_builtin_function!( ); -pub fn process_instruction_inner( @@ -205,7 +205,7 @@ index 883f0d2..05c9344 100644 ) -> Result> { let log_collector = invoke_context.get_log_collector(); diff --git a/sdk/Cargo.toml b/sdk/Cargo.toml -index 1b79c86..a02ef5d 100644 +index fb69474..7c400c6 100644 --- a/sdk/Cargo.toml +++ b/sdk/Cargo.toml @@ -90,5 +90,5 @@ qualifier_attr = { workspace = true, optional = true } diff --git a/third-party/third_party.json b/third-party/third_party.json index 78f705b3..92d34758 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": "938bd86722dc9dc8c6cb89e03df3445fc2cba170", + "rev": "8bf688fe71fb01ba74af9cfd975bfcc6f9d04641", "patch": "agave.patch", "subdir": ".", "package": "solana-bpf-loader-program", From 121a36148b7cf30d3b724404e4d0f3238fde026a Mon Sep 17 00:00:00 2001 From: Samuel Moelius Date: Thu, 14 Nov 2024 19:36:37 +0000 Subject: [PATCH 2/3] Simplify patches --- third-party/patches/agave.patch | 14 ++++---------- third-party/patches/solana.patch | 12 +++--------- third-party/patches/solana_rbpf.patch | 7 ++----- 3 files changed, 9 insertions(+), 24 deletions(-) diff --git a/third-party/patches/agave.patch b/third-party/patches/agave.patch index 5dcaab2b..56d41cc9 100644 --- a/third-party/patches/agave.patch +++ b/third-party/patches/agave.patch @@ -73,7 +73,7 @@ index a54e083..4681ab6 100644 +#[derive(Clone, serde::Deserialize, serde::Serialize)] pub struct BpfAllocator { len: u64, -@@ -149,10 +150,16 @@ impl BpfAllocator { +@@ -149,10 +150,13 @@ impl BpfAllocator { } +#[derive(Clone, Debug, serde::Deserialize, serde::Serialize)] @@ -84,10 +84,7 @@ index a54e083..4681ab6 100644 + #[serde(skip)] epoch_vote_accounts: Option<&'a VoteAccountsHashMap>, pub feature_set: Arc, -+ #[serde( -+ serialize_with = "test_fuzz::serialize_ref", -+ deserialize_with = "test_fuzz::deserialize_ref" -+ )] ++ #[serde(with = "test_fuzz::serde_ref")] sysvar_cache: &'a SysvarCache, } @@ -177,4 +184,5 @@ impl<'a> EnvironmentConfig<'a> { @@ -109,7 +106,7 @@ index a54e083..4681ab6 100644 +#[derive(Debug, Clone, serde::Deserialize, serde::Serialize)] pub struct SerializedAccountMetadata { pub original_data_len: usize, -@@ -192,9 +206,27 @@ pub struct SerializedAccountMetadata { +@@ -192,9 +206,24 @@ pub struct SerializedAccountMetadata { } +fn default_program_cache_for_tx_batch<'de, D>( @@ -125,10 +122,7 @@ index a54e083..4681ab6 100644 +#[derive(Debug, serde::Deserialize, serde::Serialize)] pub struct InvokeContext<'a> { /// Information about the currently executing transaction. -+ #[serde( -+ serialize_with = "test_fuzz::serialize_ref_mut", -+ deserialize_with = "test_fuzz::deserialize_ref_mut" -+ )] ++ #[serde(with = "test_fuzz::serde_ref_mut")] pub transaction_context: &'a mut TransactionContext, /// The local program cache for the transaction batch. + #[serde( diff --git a/third-party/patches/solana.patch b/third-party/patches/solana.patch index 9ed1d60b..b56eb94a 100644 --- a/third-party/patches/solana.patch +++ b/third-party/patches/solana.patch @@ -49,7 +49,7 @@ index 5b2d417..1ff0e77 100644 +#[derive(Debug, Clone, serde::Deserialize, serde::Serialize)] pub struct SerializedAccountMetadata { pub original_data_len: usize, -@@ -154,6 +162,22 @@ pub struct SerializedAccountMetadata { +@@ -154,6 +162,16 @@ pub struct SerializedAccountMetadata { } +fn default_loaded_programs<'de, D>(_: D) -> Result<&'static mut LoadedProgramsForTxBatch, D::Error> @@ -61,15 +61,9 @@ index 5b2d417..1ff0e77 100644 + +#[derive(Debug, serde::Deserialize, serde::Serialize)] pub struct InvokeContext<'a> { -+ #[serde( -+ serialize_with = "test_fuzz::serialize_ref_mut", -+ deserialize_with = "test_fuzz::deserialize_ref_mut" -+ )] ++ #[serde(with = "test_fuzz::serde_ref_mut")] pub transaction_context: &'a mut TransactionContext, -+ #[serde( -+ serialize_with = "test_fuzz::serialize_ref", -+ deserialize_with = "test_fuzz::deserialize_ref" -+ )] ++ #[serde(with = "test_fuzz::serde_ref")] sysvar_cache: &'a SysvarCache, log_collector: Option>>, @@ -161,5 +185,7 @@ pub struct InvokeContext<'a> { diff --git a/third-party/patches/solana_rbpf.patch b/third-party/patches/solana_rbpf.patch index 9f13f4e5..f8deeacd 100644 --- a/third-party/patches/solana_rbpf.patch +++ b/third-party/patches/solana_rbpf.patch @@ -284,7 +284,7 @@ index e0ebfe6..a724fd4 100644 + generate_access_violation(&self.config, self.sbpf_version, access_type, vm_addr, 0) .unwrap_err(), ) -@@ -549,15 +711,32 @@ impl<'a> UnalignedMemoryMapping<'a> { +@@ -549,15 +711,29 @@ impl<'a> UnalignedMemoryMapping<'a> { /// Memory mapping that uses the upper half of an address to identify the /// underlying memory region. +#[derive(serde::Deserialize, serde::Serialize)] @@ -292,10 +292,7 @@ index e0ebfe6..a724fd4 100644 /// Mapped memory regions regions: Box<[MemoryRegion]>, /// VM configuration -+ #[serde( -+ serialize_with = "test_fuzz::serialize_ref", -+ deserialize_with = "test_fuzz::deserialize_ref" -+ )] ++ #[serde(with = "test_fuzz::serde_ref")] config: &'a Config, /// Executable sbpf_version sbpf_version: SBPFVersion, From 2b1ff4f09dd19df5d1abc21f0f2985730c87a7b3 Mon Sep 17 00:00:00 2001 From: Samuel Moelius Date: Thu, 14 Nov 2024 19:45:54 +0000 Subject: [PATCH 3/3] Update patches --- third-party/patches/agave.patch | 12 ++++++------ third-party/patches/solana.patch | 6 +++--- third-party/patches/solana_rbpf.patch | 8 ++++---- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/third-party/patches/agave.patch b/third-party/patches/agave.patch index 56d41cc9..bf10f08c 100644 --- a/third-party/patches/agave.patch +++ b/third-party/patches/agave.patch @@ -64,7 +64,7 @@ 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..4681ab6 100644 +index a54e083..05b63f8 100644 --- a/program-runtime/src/invoke_context.rs +++ b/program-runtime/src/invoke_context.rs @@ -121,4 +121,5 @@ impl fmt::Display for AllocErr { @@ -87,13 +87,13 @@ index a54e083..4681ab6 100644 + #[serde(with = "test_fuzz::serde_ref")] sysvar_cache: &'a SysvarCache, } -@@ -177,4 +184,5 @@ impl<'a> EnvironmentConfig<'a> { +@@ -177,4 +181,5 @@ impl<'a> EnvironmentConfig<'a> { } +#[derive(Clone, serde::Deserialize, serde::Serialize)] pub struct SyscallContext { pub allocator: BpfAllocator, -@@ -183,5 +191,11 @@ pub struct SyscallContext { +@@ -183,5 +188,11 @@ pub struct SyscallContext { } -#[derive(Debug, Clone)] @@ -106,7 +106,7 @@ index a54e083..4681ab6 100644 +#[derive(Debug, Clone, serde::Deserialize, serde::Serialize)] pub struct SerializedAccountMetadata { pub original_data_len: usize, -@@ -192,9 +206,24 @@ pub struct SerializedAccountMetadata { +@@ -192,9 +203,24 @@ pub struct SerializedAccountMetadata { } +fn default_program_cache_for_tx_batch<'de, D>( @@ -131,13 +131,13 @@ index a54e083..4681ab6 100644 + )] pub program_cache_for_tx_batch: &'a mut ProgramCacheForTxBatch, /// Runtime configurations used to provision the invocation environment. -@@ -207,4 +239,5 @@ pub struct InvokeContext<'a> { +@@ -207,4 +233,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 +246,23 @@ pub struct InvokeContext<'a> { +@@ -213,4 +240,23 @@ pub struct InvokeContext<'a> { } +impl<'a> Clone for InvokeContext<'a> { diff --git a/third-party/patches/solana.patch b/third-party/patches/solana.patch index b56eb94a..bd2cadcf 100644 --- a/third-party/patches/solana.patch +++ b/third-party/patches/solana.patch @@ -21,7 +21,7 @@ index 0657df5..f1bd04f 100644 pub struct ComputeBudget { /// Number of compute units that a transaction or individual instruction is diff --git a/program-runtime/src/invoke_context.rs b/program-runtime/src/invoke_context.rs -index 5b2d417..1ff0e77 100644 +index 5b2d417..97c388f 100644 --- a/program-runtime/src/invoke_context.rs +++ b/program-runtime/src/invoke_context.rs @@ -111,4 +111,5 @@ impl fmt::Display for AllocErr { @@ -66,7 +66,7 @@ index 5b2d417..1ff0e77 100644 + #[serde(with = "test_fuzz::serde_ref")] sysvar_cache: &'a SysvarCache, log_collector: Option>>, -@@ -161,5 +185,7 @@ pub struct InvokeContext<'a> { +@@ -161,5 +179,7 @@ pub struct InvokeContext<'a> { current_compute_budget: ComputeBudget, compute_meter: RefCell, + #[serde(skip_serializing, deserialize_with = "default_loaded_programs")] @@ -74,7 +74,7 @@ index 5b2d417..1ff0e77 100644 + #[serde(skip_serializing, deserialize_with = "default_loaded_programs")] pub programs_modified_by_tx: &'a mut LoadedProgramsForTxBatch, pub feature_set: Arc, -@@ -171,4 +197,23 @@ pub struct InvokeContext<'a> { +@@ -171,4 +191,23 @@ pub struct InvokeContext<'a> { } +impl<'a> Clone for InvokeContext<'a> { diff --git a/third-party/patches/solana_rbpf.patch b/third-party/patches/solana_rbpf.patch index f8deeacd..98f797fa 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..a724fd4 100644 +index e0ebfe6..64f1fa0 100644 --- a/src/memory_region.rs +++ b/src/memory_region.rs @@ -34,5 +34,5 @@ use std::{ @@ -314,21 +314,21 @@ index e0ebfe6..a724fd4 100644 + impl fmt::Debug for AlignedMemoryMapping<'_> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { -@@ -728,5 +907,5 @@ impl<'a> AlignedMemoryMapping<'a> { +@@ -728,5 +904,5 @@ impl<'a> AlignedMemoryMapping<'a> { /// Maps virtual memory to host memory. -#[derive(Debug)] +#[derive(Debug, Clone, serde::Deserialize, serde::Serialize)] pub enum MemoryMapping<'a> { /// Used when address translation is disabled -@@ -736,5 +915,5 @@ pub enum MemoryMapping<'a> { +@@ -736,5 +912,5 @@ pub enum MemoryMapping<'a> { Aligned(AlignedMemoryMapping<'a>), /// Memory mapping that allows mapping unaligned memory regions. - Unaligned(UnalignedMemoryMapping<'a>), + Unaligned(UnalignedMemoryMapping), } -@@ -906,5 +1085,5 @@ fn generate_access_violation( +@@ -906,5 +1082,5 @@ fn generate_access_violation( /// Fast, small linear cache used to speed up unaligned memory mapping. -#[derive(Debug)]