You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Yesterday, the network experienced a stall in which:
At Bitcoin Block N, Miner A won and mined a normal tenure
At Bitcoin Block N+1, Miner B won, but their commit reorged Miner A. The signer set marks Miner B invalid, and Miner A successfully tenure extends into Bitcoin block N+1 and mines blocks.
At Bitcoin Block N+2, there's an empty sortition. Miner A stops mining and does not attempt to further extend their tenure into this one.
The reason this happens is somewhat complex, but the upside is basically this function in nakamoto_node/relayer.rs:
/// Is the given sortition a valid sortition?/// I.e. whose winning commit's parent tenure ID is on the canonical Stacks history,/// and whose consensus hash corresponds to the ongoing tenure or a confirmed tenure?fnis_valid_sortition(chain_state:&mutStacksChainState,stacks_tip_id:&StacksBlockId,stacks_tip_sn:&BlockSnapshot,burn_tip_ch:&ConsensusHash,sn:&BlockSnapshot,) -> Result<bool,NakamotoNodeError>{if !sn.sortition{// definitely not a valid sortitiondebug!("Relayer: Sortition {} is empty",&sn.consensus_hash);returnOk(false);}// check that this commit's parent tenure ID is on the history tipped at// `stacks_tip_id`letmut ic = chain_state.index_conn();let parent_tenure_id = StacksBlockId(sn.winning_stacks_block_hash.clone().0);let height_opt = ic.get_ancestor_block_height(&parent_tenure_id, stacks_tip_id)?;if height_opt.is_none(){// parent_tenure_id is not an ancestor of stacks_tip_iddebug!("Relayer: Sortition {} has winning commit hash {}, which is not canonical",&sn.consensus_hash,&parent_tenure_id
);returnOk(false);}if sn.consensus_hash == *burn_tip_ch {// sn is the sortition tip, so this sortition must commit to the tenure start block of// the ongoing Stacks tenure.let highest_tenure_start_block_header = NakamotoChainState::get_tenure_start_block_header(&mut ic,
stacks_tip_id,&stacks_tip_sn.consensus_hash)?
.ok_or_else(|| {error!("Relayer: Failed to find tenure-start block header for stacks tip {stacks_tip_id}");NakamotoNodeError::ParentNotFound})?;let highest_tenure_start_block_id =
highest_tenure_start_block_header.index_block_hash();if highest_tenure_start_block_id != parent_tenure_id {debug!("Relayer: Sortition {} is at the tip, but does not commit to {} so cannot be valid",&sn.consensus_hash,&parent_tenure_id;"highest_tenure_start_block_header.block_id()" => %highest_tenure_start_block_id);returnOk(false);}}Ok(true)}
The intent of this function is to return true if the given sn corresponds to a sortition that extends the current stacks tenure. I'd suggest renaming this function to something like extends_canonical_tenure().
The basic issue in this function is the if statement if sn.consensus_hash == *burn_tip_ch { .. }. The checks inside that statement should be applied in all cases, not just at the burn_tip_ch.
Fixing this issue just means removing that "if guard", and just applying the internal checks in all cases. This should be included with a new integration test with the above scenario, though.
The text was updated successfully, but these errors were encountered:
Yesterday, the network experienced a stall in which:
The reason this happens is somewhat complex, but the upside is basically this function in
nakamoto_node/relayer.rs
:The intent of this function is to return
true
if the givensn
corresponds to a sortition that extends the current stacks tenure. I'd suggest renaming this function to something likeextends_canonical_tenure()
.The basic issue in this function is the if statement
if sn.consensus_hash == *burn_tip_ch { .. }
. The checks inside that statement should be applied in all cases, not just at theburn_tip_ch
.Fixing this issue just means removing that "if guard", and just applying the internal checks in all cases. This should be included with a new integration test with the above scenario, though.
The text was updated successfully, but these errors were encountered: