Skip to content

fix(datum): keep the original bytes of decoded inline datums - #603

Merged
solidsnakedev merged 4 commits into
mainfrom
fix/inline-datum-bytes
Oct 7, 2026
Merged

solidsnakedev merged 4 commits into
mainfrom
fix/inline-datum-bytes

Conversation

@solidsnakedev

Copy link
Copy Markdown
Collaborator

Decoding a transaction dropped each inline datum's original bytes, and encoding rebuilt them with the default data layout. When the layout differed, for example a definite map a10102 that became bf0102ff, re-encoding changed the body. Adding a witness with addVKeyWitnessesBytes then changed the transaction id, and the node rejected the transaction with 3100 (invalid signatures).

Decoding now records the exact bytes inside tag 24 against the InlineDatum it returns, and encoding writes them back when it is given that same object. A new or edited datum is a new object, so it still gets the default encoding. The record lives in a new shared OriginalBytes module, a WeakMap from a decoded object to its bytes, which later steps of #581 will reuse for other parts of the transaction.

Closes the inline-datum part of #576. Step 1 of #581.

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