Skip to content

fix(uexecutor): retain full raw_payload on inbound decode failure - #293

Merged
0xNilesh merged 1 commit into
developfrom
fix/inbound-preserve-raw-payload
Jul 24, 2026
Merged

fix(uexecutor): retain full raw_payload on inbound decode failure#293
0xNilesh merged 1 commit into
developfrom
fix/inbound-preserve-raw-payload

Conversation

@0xNilesh

Copy link
Copy Markdown
Member

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 clears raw_payload (unchanged).

Why

NormalizeForTxType strips the PC20/PRC20 selector into raw_payload before decoding, then clears it on success. On a decode failure it previously left only the stripped remainder — losing the selector that determined is_pc20. That makes post-mortems hard: e.g. a failed PC20 burn stored raw_payload = "gateway-test-direct-pc20-burn" with no visible selector, so you had to dig up the original vote tx to see the 0x50433230 ("PC20") prefix.

Now the decode runs on a local, selector-stripped copy and raw_payload keeps the full original until a successful decode clears it — so a failed inbound records the exact observed bytes on-chain.

Scope / safety

  • Change is confined to NormalizeForTxType in x/uexecutor/types/inbound.go; the error contract is unchanged (same decode error returned), so the keeper's VoteInbound revert path is unaffected.
  • Consensus is unaffected: the inbound ballot key is hashed before normalization, on the full payload.
  • Success path unchanged — raw_payload is still cleared to save storage.

Tests

Added TestNormalizeForTxType_PreservesRawPayloadOnDecodeFailure:

  • PC20 decode failure → retains full original (selector included)
  • PRC20 decode failure → retains full original
  • un-prefixed decode failure → retains original
  • PC20 success → raw_payload cleared

All existing NormalizeForTxType tests still pass; x/uexecutor/types package green.

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.
@0xNilesh
0xNilesh merged commit e6c011d into develop Jul 24, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant