Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
42dedca
Add a seal type for PoS consensus data
nullPointerEnjoyer Sep 20, 2026
18afc04
Add storage for PoS seal indexing and duplicate seal evidence
nullPointerEnjoyer Sep 20, 2026
65cea4d
Index PoS block seals during block integration
nullPointerEnjoyer Sep 20, 2026
9e6bc75
Add seal duplication tests and export the seal indexing helper
nullPointerEnjoyer Sep 20, 2026
9a27ce1
Drop the unused seal tracking builder and document the index deletion
nullPointerEnjoyer Sep 20, 2026
727f569
Bound the evidence records per seal and address review findings
nullPointerEnjoyer Sep 20, 2026
096933e
Remove the unused seal constructor and document the upgrade limitation
nullPointerEnjoyer Sep 20, 2026
f43124a
Pin the seal encoding with golden bytes and derive the test PoS height
nullPointerEnjoyer Sep 20, 2026
2f04c7a
Derive hashing and ordering for BlockSeal and gate the simulation ind…
nullPointerEnjoyer Sep 20, 2026
847d91e
Document the seal detection scope and drop the redundant error logging
nullPointerEnjoyer Sep 20, 2026
506455a
Key the seal evidence by seal and share the indexing gate
nullPointerEnjoyer Sep 21, 2026
fd9f1c4
Prefix the unused destructured block id in the disabled-tracking test
nullPointerEnjoyer Sep 21, 2026
10b4ac1
Backfill the missing seal evidence and keep indexing non-blocking
nullPointerEnjoyer Sep 21, 2026
22e47f6
Note the seal defaults and drop the duplicate logging and fetch
nullPointerEnjoyer Sep 21, 2026
f2f155f
Note the empty seal maps on upgrade and pin the value codecs
nullPointerEnjoyer Sep 21, 2026
6f48cfc
Note the advisory constraint and the growth bounds of the seal maps
nullPointerEnjoyer Sep 21, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions blockprod/src/tests/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ impl BlockprodTestSetupBuilder {
enable_db_reckless_mode_in_ibd: Default::default(),
max_orphan_blocks: Default::default(),
allow_checkpoints_mismatch: Default::default(),
pos_seal_duplication_tracking: Default::default(),
};

let mempool_config = self.mempool_config.unwrap_or_default();
Expand Down
9 changes: 9 additions & 0 deletions chainstate/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ use utils::make_config_setting;
make_config_setting!(MaxDbCommitAttempts, usize, 10);
make_config_setting!(MaxOrphanBlocks, usize, 512);
make_config_setting!(MaxTipAge, Duration, Duration::from_secs(60 * 60 * 24));
make_config_setting!(PosSealDuplicationTracking, bool, true);

/// The chainstate subsystem configuration.
#[derive(Debug, Clone, Default)]
Expand All @@ -47,6 +48,10 @@ pub struct ChainstateConfig {

/// If true, blocks and block headers will not be rejected if checkpoints mismatch is detected.
pub allow_checkpoints_mismatch: Option<bool>,

/// If true, the seals (stake pool id + VRF output) of the processed PoS blocks will be
/// indexed and the evidence of a seal seen on more than one block will be recorded.
pub pos_seal_duplication_tracking: PosSealDuplicationTracking,
}

impl ChainstateConfig {
Expand All @@ -70,6 +75,10 @@ impl ChainstateConfig {
self
}

pub fn pos_seal_duplication_tracking_enabled(&self) -> bool {
*self.pos_seal_duplication_tracking
}

pub fn db_reckless_mode_in_ibd_enabled(&self) -> bool {
self.enable_db_reckless_mode_in_ibd.unwrap_or(false)
}
Expand Down
16 changes: 16 additions & 0 deletions chainstate/src/detail/chainstateref/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ mod block_info;
mod consistency_checker;
mod epoch_seal;
mod in_memory_reorg;
pub(crate) mod seal_index;
mod tx_verifier_storage;

use itertools::Itertools;
Expand Down Expand Up @@ -1427,6 +1428,21 @@ impl<S: BlockchainStorageWrite, V: TransactionVerificationStrategy> ChainstateRe
self.db_tx.add_block(block).map_err(BlockError::from)
}

/// Index the seal of the given block, recording evidence if the seal was already
/// seen on another block. A no-op if seal duplication tracking is disabled.
pub fn index_block_seal_if_enabled(
&mut self,
block: &WithId<Block>,
block_height: BlockHeight,
) -> Result<(), BlockError> {
seal_index::index_block_seal_if_enabled(
self.chainstate_config,
&mut self.db_tx,
block,
block_height,
)
}

#[log_error]
pub fn set_block_index(&mut self, block_index: &BlockIndex) -> Result<(), BlockError> {
self.db_tx.set_block_index(block_index).map_err(BlockError::from)
Expand Down
Loading
Loading