Fix: AnyTrust: preserve recorded keyset-tree preimages on discarded batches#4636
Open
uprotocore wants to merge 2 commits intoOffchainLabs:masterfrom
Open
Fix: AnyTrust: preserve recorded keyset-tree preimages on discarded batches#4636uprotocore wants to merge 2 commits intoOffchainLabs:masterfrom
uprotocore wants to merge 2 commits intoOffchainLabs:masterfrom
Conversation
|
|
Author
|
FYI, CLA is signed, but hasn't propagated there for some reason. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Problem
When an AnyTrust node is run with the staker block validator enabled, validation can get stuck around a “poison” / invalid-data batch:
dastree) preimages,preimages=nil, dropping the recorded keyset-tree preimages,Because block-by-block validation must be deterministic (no network fetches during validation), missing keyset/tree preimages can stall validation and prevent assertion confirmation and downstream withdrawal flows.
Fix: never drop recorded preimages on discard
Update
daprovider/anytrust/util.recoverPayloadFromBatchInternalto always return the caller-providedpreimagesmap for non-fatal “discard” paths (i.e. cases wherepayload=nilis an expected outcome), instead of returningpreimages=nil.This ensures any keyset-tree preimages recorded before the discard decision are preserved and can be forwarded to the WASM preimage oracle, allowing validation to deterministically reach the discard decision and continue.
Changes in this PR
daprovider/anytrust/util/util.go: return(nil, preimages, nil)on discard branches (too-short message, cert deserialize failure, unsupported cert version, bad signature, and “expires too soon”).daprovider/anytrust/util/util_test.go: add unit tests covering discard-by-bad-signature and discard-by-expires-too-soon, asserting:Why this is safe
Testing / verification plan
go test ./daprovider/anytrust/util -run TestRecoverPayloadFromBatch -count=1(pass)Out of scope