Repository navigation
Description
PastaClaw flagged this while reviewing #8272, where it was deferred to a follow-up instead of being fixed in that pull request. This issue tracks the follow-up.
A readable but damaged block body can make completion reject a good snapshot (suggestion)
Impact: A node can quarantine an honest snapshot if its local copy of the base block is damaged but still deserializes.
Where: src/validation.cpp:6947-6969 at 1342af90036c:
Lines 6947 to 6969 in 1342af9
| try { | |
| built = evo::BuildEvoSnapshot(GetParams(), *this, special_tx.DeterministicMNManager(), | |
| special_tx.QuorumBlockProcessor(), special_tx.QuorumSnapshotManager(), | |
| *special_tx.m_cpoolman, *special_tx.m_mnhfman, &index_new, rebuilt, evo_error, | |
| &failure); | |
| } catch (const evo::LocalStateError& e) { | |
| evo_error = e.what(); | |
| failure = evo::ClassifyEvoSectionError(e); | |
| } catch (const std::exception& e) { | |
| evo_error = e.what(); | |
| failure = evo::ClassifyEvoSectionError(e); | |
| } | |
| if (built && EvoSnapshotHash{evo::GetEvoSnapshotHash(rebuilt)} != au_data.evo_hash) { | |
| built = false; | |
| failure = evo::EvoSectionFailure::DISAGREEMENT; | |
| evo_error = "the rebuilt section differs"; | |
| } | |
| if (!built) { | |
| switch (failure) { | |
| case evo::EvoSectionFailure::DISAGREEMENT: | |
| LogPrintf("[snapshot] the evo section differs from the validated state: %s\n", evo_error); | |
| handle_invalid_snapshot(); | |
| return SnapshotCompletionResult::EVO_STATE_MISMATCH; |
After the rewrite removed captured inputs,
BuildEvoSnapshot()rereads the base block from disk and constructs a coinbase Merkle branch from its transactions.ReadBlockFromDisk()checks the header hash and proof of work, not the body’s Merkle root, andEvoSnapshot::Validate()does not verify the branch against the indexed header. Damage to a non-coinbase transaction can therefore change the rebuilt section hash while the coins hash and EvoDB best-block markers still match. Completion treats that difference as a proven mismatch and quarantines the snapshot. Verify the body against the indexed Merkle root before using it as rebuild evidence, and classify an integrity failure as local corruption.
Origin
- Pull request: feat: seed the evo snapshot section safely and rebuild it at completion #8272
- Review thread: feat: seed the evo snapshot section safely and rebuild it at completion #8272 (comment)
- Filed by PastaClaw when it accepted the deferral, as nothing else tracked it.
Activity