Repository navigation
feat: added the signed int and or support - #4
Merged
Merged
Conversation
fichiokaku
reviewed
May 25, 2026
There was a problem hiding this comment.
Thanks for the careful work integrating the audited constraint additions. The implementation is sound and the wire format lines up with the audited on-chain decoder.
Cross-check vs audited ERC-8211 (bcnmy/erc8211-contracts @ b731c5d)
Verified end-to-end against ComposableExecutionLib.sol:
ConstraintTypenumeric values match the on-chain enum (EQ=0,GTE=1,LTE=2,IN=3,GTE_SIGNED=4,LTE_SIGNED=5,OR=6).- Leaf reference data is exactly 32 bytes — the on-chain
_checkConstraintenforcesc.referenceData.length == 32for EQ/GTE/LTE/GTE_SIGNED/LTE_SIGNED, andvalidateAndProcessChildConstraintalways produces exactly 32 bytes. - Signed encoding uses
encodeAbiParameters([{ type: 'int256' }], ...)→ two's-complement 32-byte word, which the on-chain side reinterprets correctly viaint256(uint256(bytes32(c.referenceData))). - OR
referenceDataisabi.encode(Constraint[])— verified the resulting layout matches the on-chainabi.decode(c.referenceData, (Constraint[])). - Nested OR is rejected client-side and the on-chain library has a structural pre-pass that also rejects it.
- Empty OR sub-list is rejected client-side, matches on-chain
EmptyOrSubConstraints. Constraint[] → Constraintcorrectly reflects on-chain semantics: the constraints array is positional across return-data words (constraintireads wordi), not an AND combinator on a single value. BALANCE caps to 1 constraint on-chain, and a STATIC_CALL with a single-word return triggersInsufficientRawValuefor any constraint beyond the first — so the new single-constraint API is the right shape for the typical case.- Storage ABI is brought into alignment with the audited
Storage.sol(addsgetNamespace,getNamespacedSlot,isSlotInitialized,SlotNotInitialized). - Capture-slot derivation
keccak256(baseSlot, uint256(i))matches the on-chain_parseReturnDataAndWriteToStorage.
Test coverage
encoding.test.tscovers every leaf type, signed/unsigned coercion, OR with mixed signed+unsigned subs, nested-OR rejection, empty-OR rejection, and two's-complement byte-pattern assertions (0xff..for −1,−42).signed-or-constraints.test.tsexercises the real on-chain decoder end-to-end via MEE simulation + execution on Base Sepolia —lteSigned/gteSignedfailure paths,OR(signed, signed),OR(signed, unsigned)with mixed positive/negative bounds. Solid.
LGTM !
fichiokaku
reviewed
May 25, 2026
fichiokaku
approved these changes
May 25, 2026
fichiokaku
left a comment
There was a problem hiding this comment.
Both review findings addressed cleanly in 72c4a61, and CI is green across the board (Integration Tests at 4m7s, exercising the live Base Sepolia path).
- Missing
0xprefix atencoding.ts:374— fixed exactly as suggested. - Double-encoding of leaf reference data — both signed and unsigned paths collapsed to a single
encodeAbiParameters/toBytes32call. - New regression test in
batch-execution.test.ts(static ETH value in composable write: WETH deposit mints correct balance) — funds the SCA, runs a realweth.deposit({ value: parseEther('0.0001') })via the composable batch, and asserts the WETH balance increased by the deposit amount. Closes the test gap on non-zero staticvalue.
LGTM. Approving.
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.
No description provided.