fix(uexecutor): retain full raw_payload on inbound decode failure - #293
Merged
Conversation
Decode the selector-stripped payload from a local; on failure raw_payload keeps the full observed bytes (selector included) for forensics. Success still clears it.
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.
What
On an inbound payload decode failure, retain the full observed
raw_payload(magic selector included) instead of the selector-stripped remainder. A successful decode still clearsraw_payload(unchanged).Why
NormalizeForTxTypestrips the PC20/PRC20 selector intoraw_payloadbefore decoding, then clears it on success. On a decode failure it previously left only the stripped remainder — losing the selector that determinedis_pc20. That makes post-mortems hard: e.g. a failed PC20 burn storedraw_payload = "gateway-test-direct-pc20-burn"with no visible selector, so you had to dig up the original vote tx to see the0x50433230("PC20") prefix.Now the decode runs on a local, selector-stripped copy and
raw_payloadkeeps the full original until a successful decode clears it — so a failed inbound records the exact observed bytes on-chain.Scope / safety
NormalizeForTxTypeinx/uexecutor/types/inbound.go; the error contract is unchanged (same decode error returned), so the keeper'sVoteInboundrevert path is unaffected.raw_payloadis still cleared to save storage.Tests
Added
TestNormalizeForTxType_PreservesRawPayloadOnDecodeFailure:raw_payloadclearedAll existing
NormalizeForTxTypetests still pass;x/uexecutor/typespackage green.