From e4319c3d89738bc8b8f73ff485289fb28f383d4a Mon Sep 17 00:00:00 2001 From: Ashwin Sekar Date: Mon, 18 Dec 2023 19:01:24 -0500 Subject: [PATCH 1/2] replay: feature flag consumption of duplicate proofs from blockstore (#34372) * replay: feature flag consumption of duplicate proofs from blockstore * pr feedback: reorder check, add flag for restart logic (cherry picked from commit 4a8d27d92123ff1a5613e735612e28805d871d2e) # Conflicts: # sdk/src/feature_set.rs --- core/src/replay_stage.rs | 20 ++++++++++++++++---- sdk/src/feature_set.rs | 16 ++++++++++++++++ 2 files changed, 32 insertions(+), 4 deletions(-) diff --git a/core/src/replay_stage.rs b/core/src/replay_stage.rs index 77453fbf5a5d5e..b91b103fae3b12 100644 --- a/core/src/replay_stage.rs +++ b/core/src/replay_stage.rs @@ -66,6 +66,7 @@ use { }, solana_sdk::{ clock::{BankId, Slot, MAX_PROCESSING_AGE, NUM_CONSECUTIVE_LEADER_SLOTS}, + feature_set, genesis_config::ClusterType, hash::Hash, pubkey::Pubkey, @@ -1238,8 +1239,12 @@ impl ReplayStage { let duplicate_slots = blockstore .duplicate_slots_iterator(bank_forks.root_bank().slot()) .unwrap(); - let duplicate_slot_hashes = duplicate_slots - .filter_map(|slot| bank_forks.bank_hash(slot).map(|hash| (slot, hash))); + let duplicate_slot_hashes = duplicate_slots.filter_map(|slot| { + let bank = bank_forks.get(slot)?; + bank.feature_set + .is_active(&feature_set::consume_blockstore_duplicate_proofs::id()) + .then_some((slot, bank.hash())) + }); ( bank_forks.root_bank(), bank_forks.frozen_banks().values().cloned().collect(), @@ -2119,7 +2124,11 @@ impl ReplayStage { ); // If we previously marked this slot as duplicate in blockstore, let the state machine know - if !duplicate_slots_tracker.contains(&slot) && blockstore.get_duplicate_slot(slot).is_some() + if bank + .feature_set + .is_active(&feature_set::consume_blockstore_duplicate_proofs::id()) + && !duplicate_slots_tracker.contains(&slot) + && blockstore.get_duplicate_slot(slot).is_some() { let duplicate_state = DuplicateState::new_from_state( slot, @@ -2883,7 +2892,10 @@ impl ReplayStage { SlotStateUpdate::BankFrozen(bank_frozen_state), ); // If we previously marked this slot as duplicate in blockstore, let the state machine know - if !duplicate_slots_tracker.contains(&bank.slot()) + if bank + .feature_set + .is_active(&feature_set::consume_blockstore_duplicate_proofs::id()) + && !duplicate_slots_tracker.contains(&bank.slot()) && blockstore.get_duplicate_slot(bank.slot()).is_some() { let duplicate_state = DuplicateState::new_from_state( diff --git a/sdk/src/feature_set.rs b/sdk/src/feature_set.rs index 34dfdbcbbcbc29..cba1b38a47d454 100644 --- a/sdk/src/feature_set.rs +++ b/sdk/src/feature_set.rs @@ -732,6 +732,17 @@ pub mod drop_legacy_shreds { solana_sdk::declare_id!("GV49KKQdBNaiv2pgqhS2Dy3GWYJGXMTVYbYkdk91orRy"); } +<<<<<<< HEAD +======= +pub mod allow_commission_decrease_at_any_time { + solana_sdk::declare_id!("decoMktMcnmiq6t3u7g5BfgcQu91nKZr6RvMYf9z1Jb"); +} + +pub mod consume_blockstore_duplicate_proofs { + solana_sdk::declare_id!("6YsBCejwK96GZCkJ6mkZ4b68oP63z2PLoQmWjC7ggTqZ"); +} + +>>>>>>> 4a8d27d921 (replay: feature flag consumption of duplicate proofs from blockstore (#34372)) lazy_static! { /// Map of feature identifiers to user-visible description pub static ref FEATURE_NAMES: HashMap = [ @@ -910,6 +921,11 @@ lazy_static! { (validate_fee_collector_account::id(), "validate fee collector account #33888"), (enable_zk_transfer_with_fee::id(), "enable Zk Token proof program transfer with fee"), (drop_legacy_shreds::id(), "drops legacy shreds #34328"), +<<<<<<< HEAD +======= + (allow_commission_decrease_at_any_time::id(), "Allow commission decrease at any time in epoch #33843"), + (consume_blockstore_duplicate_proofs::id(), "consume duplicate proofs from blockstore in consensus #34372") +>>>>>>> 4a8d27d921 (replay: feature flag consumption of duplicate proofs from blockstore (#34372)) /*************** ADD NEW FEATURES HERE ***************/ ] .iter() From 515587be62dab47596f6d63e5c27aa78db08e965 Mon Sep 17 00:00:00 2001 From: Ashwin Sekar Date: Tue, 19 Dec 2023 00:05:13 +0000 Subject: [PATCH 2/2] fix feature set conflict --- sdk/src/feature_set.rs | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/sdk/src/feature_set.rs b/sdk/src/feature_set.rs index cba1b38a47d454..78b4369ac6387a 100644 --- a/sdk/src/feature_set.rs +++ b/sdk/src/feature_set.rs @@ -732,17 +732,10 @@ pub mod drop_legacy_shreds { solana_sdk::declare_id!("GV49KKQdBNaiv2pgqhS2Dy3GWYJGXMTVYbYkdk91orRy"); } -<<<<<<< HEAD -======= -pub mod allow_commission_decrease_at_any_time { - solana_sdk::declare_id!("decoMktMcnmiq6t3u7g5BfgcQu91nKZr6RvMYf9z1Jb"); -} - pub mod consume_blockstore_duplicate_proofs { solana_sdk::declare_id!("6YsBCejwK96GZCkJ6mkZ4b68oP63z2PLoQmWjC7ggTqZ"); } ->>>>>>> 4a8d27d921 (replay: feature flag consumption of duplicate proofs from blockstore (#34372)) lazy_static! { /// Map of feature identifiers to user-visible description pub static ref FEATURE_NAMES: HashMap = [ @@ -921,11 +914,7 @@ lazy_static! { (validate_fee_collector_account::id(), "validate fee collector account #33888"), (enable_zk_transfer_with_fee::id(), "enable Zk Token proof program transfer with fee"), (drop_legacy_shreds::id(), "drops legacy shreds #34328"), -<<<<<<< HEAD -======= - (allow_commission_decrease_at_any_time::id(), "Allow commission decrease at any time in epoch #33843"), (consume_blockstore_duplicate_proofs::id(), "consume duplicate proofs from blockstore in consensus #34372") ->>>>>>> 4a8d27d921 (replay: feature flag consumption of duplicate proofs from blockstore (#34372)) /*************** ADD NEW FEATURES HERE ***************/ ] .iter()