Fix SigVerifiedOp SSZ implementation #6035
Merged
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.
Issue Addressed
The schema v20 migration was liable to fail and brick the database due to a discrepency in the
Encode
andDecode
implementations forSigVerifiedOp
. This was identified while testing the v21 schema migration: #5897 (comment).Proposed Changes
Rather than trying to tweak the hand-written implementation I've replaced it with a more obviously correct implementation that translates to and from
SigVerifiedOp{Encode,Decode}
types. IMO this is much easier to check the correctness of, because theDecode
andEncode
implementations are just mappings.I've also added some roundtrip tests which pass on the new impl and fail on the old.
Additional Info
Manual testing of the migration didn't catch this because the error only occurs sometimes: when there are
SigVerifiedOp
s in the op pool.