Add block_proposal_after_pushed_is_rejected to prove signer behaviour #6816
+261
−76
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
As part of GSM testing, I saw quite a few instances where the mock signer was behind in receiving block proposals resulting in them rejecting a block proposal that arrived late that was already globally accepted. This is legacy behaviour and its possible it could be improved, but maybe its better to leave it as is? I have added a test to demonstrate the case at the very least to prove GSM did not introduce this behaviour:
SIgner 1 is behind and is receiving a bunch of block pre-commits, signatures, and eventually
BlockPushedandNewBlockevents for a particular blockNthat the Signer has not yet seen a BlockProposal for. As a result, all of these events are ignored. It only THEN receives blockN'sBlockProposal. However, because it does not have have anyblock_infofor the correspondingsigner_signature_hashin its database, it doesn't hit the "Received a block proposal for a block that is already globally accepted. Ignoring..." path. It instead treats the BlockProposal as one for an entirely new block and checks this "new proposal" against the chain tip which happens to actually already be Block N. It therefore fails when it hits the chain length enforcementtip.height() < block.header.chain_length, resulting inInvalidParentBlock.I think its a bit odd that a signer that in theory knows that this block proposal is simply late, issues a rejection with
InvalidParentBlock. However, its not as simple as adding thesigner_signature_hashto the database and marking it as globally accepted whenNewBlockarrives as we need the entireNakamotoBlockat this time and its not available (plus the chain could have advanced before we received the NewBlock event and it would still be an issue). It would need to query for the tenure_tip earlier which may be worthwhile but at the same time, it could be so late that the chain has advanced TWICE. in which case this tip check would fail anyway and we would still fail incheck_latest_block_in_tenure. This makes me inclined to leave everything as is and just have this test demonstrating what happens when an out of order block is received.