startup: purge shreds w/ wrong shred version inclusive of WFSM slot#12343
startup: purge shreds w/ wrong shred version inclusive of WFSM slot#12343AshwinSekar wants to merge 1 commit intoanza-xyz:masterfrom
Conversation
|
confirmed this patch that my node was able to make progress |
|
I'm reading through this but can you elaborate on what you mean when you say "artificial snapshot" ? What exactly is artificial about it; taking a snapshot at any root should be allowed. Maybe you're referring to snapshots when we do stuff like feature deactivations where we end up creating the child bank + advancing slot by 1 |
|
|
steviez
left a comment
There was a problem hiding this comment.
(not critical) ensure that bank 0 has the block id set.
This seems like the bug no ? If the snapshot sets the block ID for bank 0 correctly can we avoid the change to blockstore purging altogether ?
(critical) ensure that we do not have shreds for the WFSM slot when restarting from a snapshot
As noted elsewhere, I believe this to be a non-starter. The shreds in the blockstore are valid / correct so there should be no need to purge them
| let maybe_cluster_restart_slot = maybe_cluster_restart_with_hard_fork(config, root_slot); | ||
| if maybe_cluster_restart_slot.is_some() { | ||
| return Ok(Some(root_slot + 1)); | ||
| return Ok(Some(root_slot)); |
There was a problem hiding this comment.
I don't think we want to change this logic for the general case
Suppose the cluster halts with slot S as the latest OC; slot S will be picked as the cluster restart snapshot slot. Changing this logic means this function will return Ok(Some(S)). We will then purge slot S which means nodes will have a hole in their blockstore for slot S` ... this is bad for RPC nodes
There was a problem hiding this comment.
agree. test_hard_fork_invalidates_tower failure is basically catching this
bw-solana
left a comment
There was a problem hiding this comment.
Should the invariant be “purge only wrong-version” or “purge all" shreds for the snapshot restart slot?
I believe these should mostly be the same, but is it possible for some operator to get new version shreds in the WFSM slot and then get the wrong answer for Block ID?
| _ => BlockstoreProcessorError::FailedToReplayBank0, | ||
| })?; | ||
|
|
||
| bank0.set_block_id(blockstore.get_block_id(bank0.slot(), migration_status)?); |
There was a problem hiding this comment.
Do we always expect block ID to be Some here?
This is fair and i've fixed it to set correctly now.
Yeah heard for the general case. I suppose I'm specifically worried for the artificial case (e.g. we deactivate a feature or change an account). The shreds for the snapshot will be present but they're not actually corresponding to the snapshot anymore. I'm thinking this should instead be handled by the operator or ledger-tool to ensure when the artificial snapshot is happening we either use the block id from the shreds or remove the shreds prior to restart. Either way I agree this is the wrong way to solve it, i'll close this for now and PR just the bank 0 fix separately. |
Yep, this bit is on my radar as part of #7287. My last comment mentions a tweak I did to get consistent devnet history, altho I didn't mention that I explicitly purged the slot with
This is my plan. Namely, I'm going to have |
|
Got it, given that plan do you think we can continue on with activation of SIMD-0340? If we need to do a cluster restart on a live cluster where we create an artificial bank, we can tell operators to purge the artificial slot's shreds so that this validation case is not exercised. And on master:
|
Yes
Yup, one extra |
Problem
There is an issue related to how
SIMD-0340 validate chained block idinteracts with a WFSM cluster restart from a snapshot.When performing this on the alpenglow community cluster we ran into the following issue during replay:
As a recap, SIMD-0340 verifies that the chained merkle root specified at the beginning of block
Scorresponds to the block id ofparent(S). This check is currently not enforced for the first block after a snapshot as shreds from the snapshot slot might not be available (or even exist in case of an artificial snapshot), and broadcast will default to using111..11in this caseIn this setup we have the following:
CQ7oqugg4WKFENMCLeSAREEQ7K3F1UiJQq7PJHM1ygh1the merkle root of the final shredblock_idfield set. Thus it defaults to the bank hash.This combination of things lead to the leader (not bootstrap node) building a block that chains to
111..11. Normally this would be fine as we are restarting from a snapshot, however for Tim and I's node this genesis snapshot also had shreds in blockstore, so we were comparing this toCQ7oqugg4WKFENMCLeSAREEQ7K3F1UiJQq7PJHM1ygh1and failing.(not critical) ensure that bank 0 has the block id set.
(critical) ensure that we do not have shreds for the WFSM slot when restarting from a snapshot
We should backport this fix before enabling SIMD-0340 as any cluster restart where we have outstanding shreds for the artificial snapshot slot is at risk.
Note: in the ag community cluster this would have only forked off Tim and I's node, however there was also a participant that panicked out of the gate and caused a WFSM false start.
Summary of Changes
Set the block id for bank 0 correctly
Do the startup purge of shreds inclusive of the hard forks slot, as a ledger-tool created snapshot could have a different block id than the shreds for that slot: