Port cmio binding to libcmt v2 codec API#182
Merged
Merged
Conversation
Repoint the machine-guest-tools submodule from the feature-branch squash (9933904) to the upstream landing of libcmt v2 (7ffb2da), which changed the wire formats: - EvmAdvance narrows chainId/blockNumber/blockTimestamp/index to uint64 (new selector 0x233a0ebf) - outputs use plain per-type selectors instead of the Output1..Output4 envelope with 32-byte type tags: Notice(bytes) and CallVoucher(address,uint256,bytes) (encodeVoucher is renamed to encodeCallVoucher to match) - delegate-call vouchers are gone from the codec - new typed asset-transfer outputs: ERC20Transfer, ERC721Transfer, ERC1155SingleTransfer, ERC1155BatchTransfer, exposed as encode* helpers - new encodeAdvance helper (inverse of decodeAdvance) for crafting mock inputs The native addon needed no changes: the rollup.h surface it consumes is unchanged (upstream also fixed the merkle root-hash caching in wait_for_input). All JS encoders are verified byte-for-byte against the C codec. Docs, README and the changeset are updated to the new formats. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FLcy7oTUN1sLhJLG4tHMSB
|
| Name | Type |
|---|---|
| @deroll/cmio | Minor |
| @deroll/docs | Patch |
| @deroll/app | Patch |
| @deroll/examples | Patch |
Click here to learn what changesets are, and how to add one.
Click here if you're a maintainer who wants to add a changeset to this PR
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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.
Port the
@deroll/cmiobinding to libcmt v2's refactored API, which splits the rollup layer (raw I/O) from the codec layer (EVM-ABI encoding/decoding).Summary
This is a breaking change that mirrors libcmt v2's architectural split:
Rollupclass is now a thin, synchronous raw I/O wrapperoxand verified byte-for-byte against libcmt's C encodersKey Changes
Rollup API:
finish()→waitForInput({ accept })returns{ type, payload }with raw, undecoded bytesemitNotice(),emitVoucher()→emitOutput(bytes)(returns output index)emitReport(),emitException(),progress(),close(),run()unchanged in spiritNew codec helpers (mirror libcmt's codec.h):
decodeAdvance(input)— decode rawEvmAdvanceinput to structured fieldsencodeAdvance(args)— encode structured fields toEvmAdvanceinput (inverse of decode)encodeNotice(payload)—Notice(bytes)outputencodeCallVoucher({ destination, value, payload })—CallVoucher(address,uint256,bytes)outputencodeERC20Transfer({ recipient, token, value })—ERC20Transfer(address,address,uint256)outputencodeERC721Transfer({ recipient, token, tokenId, data })—ERC721Transfer(address,address,uint256,bytes)outputencodeERC1155SingleTransfer({ recipient, token, tokenId, value, data })—ERC1155SingleTransfer(address,address,uint256,uint256,bytes)outputencodeERC1155BatchTransfer({ recipient, token, tokenIdsAndValues, data })—ERC1155BatchTransfer(address,address,uint256[2][],bytes)outputRemoved:
encodeDelegateCallVoucher()— no longer part of libcmt v2 codecOutput1,Output2) and type tags — replaced by direct function selectorsType changes:
U64Liketype for 64-bit fields inencodeAdvanceAdvanceArgsinterface forencodeAdvanceparametersVoucher→CallVoucher,DelegateCallVoucherremovedERC20Transfer,ERC721Transfer,ERC1155SingleTransfer,ERC1155BatchTransferinterfacesImplementation details:
EvmAdvancesignature updated:uint256→uint64for chainId, blockNumber, blockTimestamp, indextoU256()totoUint(value, name, bits)supporting arbitrary bit widthstoAddressHex()andencodeData()for cleaner encoder implementationsAbiFunction.encodeData()for battle-tested EVM-ABI word packingDocumentation:
encode-delegate-call-voucher.mdxencode-asset-transfers.mdxfor the new typed transfer outputsencodeAdvanceexampleTests:
rollup.test.mjsto use new helpers and verify against hand-rolled encodersencodeAdvancevs. hand-rolled implementationhttps://claude.ai/code/session_01FLcy7oTUN1sLhJLG4tHMSB