Skip to content

Commit

Permalink
replay: feature flag consumption of duplicate proofs from blockstore (s…
Browse files Browse the repository at this point in the history
…olana-labs#34372)

* replay: feature flag consumption of duplicate proofs from blockstore

* pr feedback: reorder check, add flag for restart logic
  • Loading branch information
AshwinSekar authored Dec 19, 2023
1 parent 84a079e commit 4a8d27d
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
20 changes: 16 additions & 4 deletions core/src/replay_stage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ use {
},
solana_sdk::{
clock::{BankId, Slot, MAX_PROCESSING_AGE, NUM_CONSECUTIVE_LEADER_SLOTS},
feature_set,
genesis_config::ClusterType,
hash::Hash,
pubkey::Pubkey,
Expand Down Expand Up @@ -1228,8 +1229,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(),
Expand Down Expand Up @@ -2110,7 +2115,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,
Expand Down Expand Up @@ -2920,7 +2929,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(
Expand Down
5 changes: 5 additions & 0 deletions sdk/src/feature_set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -740,6 +740,10 @@ pub mod allow_commission_decrease_at_any_time {
solana_sdk::declare_id!("decoMktMcnmiq6t3u7g5BfgcQu91nKZr6RvMYf9z1Jb");
}

pub mod consume_blockstore_duplicate_proofs {
solana_sdk::declare_id!("6YsBCejwK96GZCkJ6mkZ4b68oP63z2PLoQmWjC7ggTqZ");
}

lazy_static! {
/// Map of feature identifiers to user-visible description
pub static ref FEATURE_NAMES: HashMap<Pubkey, &'static str> = [
Expand Down Expand Up @@ -920,6 +924,7 @@ lazy_static! {
(enable_zk_transfer_with_fee::id(), "enable Zk Token proof program transfer with fee"),
(drop_legacy_shreds::id(), "drops legacy shreds #34328"),
(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")
/*************** ADD NEW FEATURES HERE ***************/
]
.iter()
Expand Down

0 comments on commit 4a8d27d

Please sign in to comment.