Skip to content

feat: added the signed int and or support - #4

Merged
vr16x merged 13 commits into
mainfrom
feat/unsigned-int-and-or-support
May 25, 2026
Merged

vr16x merged 13 commits into
mainfrom
feat/unsigned-int-and-or-support

Conversation

@vr16x

@vr16x vr16x commented Apr 28, 2026

Copy link
Copy Markdown
Collaborator

No description provided.

@vr16x vr16x changed the title feat: added the unsigned int support feat: added the unsigned int and or support Apr 30, 2026
@vr16x vr16x changed the title feat: added the unsigned int and or support feat: added the signed int and or support Apr 30, 2026
Base automatically changed from feat/docs to main May 8, 2026 11:33
@vr16x
vr16x requested a review from a team May 8, 2026 11:33

@fichiokaku fichiokaku left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:

  • ConstraintType numeric 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 _checkConstraint enforces c.referenceData.length == 32 for EQ/GTE/LTE/GTE_SIGNED/LTE_SIGNED, and validateAndProcessChildConstraint always produces exactly 32 bytes.
  • Signed encoding uses encodeAbiParameters([{ type: 'int256' }], ...) → two's-complement 32-byte word, which the on-chain side reinterprets correctly via int256(uint256(bytes32(c.referenceData))).
  • OR referenceData is abi.encode(Constraint[]) — verified the resulting layout matches the on-chain abi.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[] → Constraint correctly reflects on-chain semantics: the constraints array is positional across return-data words (constraint i reads word i), not an AND combinator on a single value. BALANCE caps to 1 constraint on-chain, and a STATIC_CALL with a single-word return triggers InsufficientRawValue for 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 (adds getNamespace, getNamespacedSlot, isSlotInitialized, SlotNotInitialized).
  • Capture-slot derivation keccak256(baseSlot, uint256(i)) matches the on-chain _parseReturnDataAndWriteToStorage.

Test coverage

  • encoding.test.ts covers 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.ts exercises the real on-chain decoder end-to-end via MEE simulation + execution on Base Sepolia — lteSigned/gteSigned failure paths, OR(signed, signed), OR(signed, unsigned) with mixed positive/negative bounds. Solid.

LGTM !

Comment thread src/core/encoding/encoding.ts Resolved
Comment thread src/core/encoding/encoding.ts Resolved
@vr16x
vr16x requested a review from fichiokaku May 25, 2026 13:47

@fichiokaku fichiokaku left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 0x prefix at encoding.ts:374 — fixed exactly as suggested.
  • Double-encoding of leaf reference data — both signed and unsigned paths collapsed to a single encodeAbiParameters / toBytes32 call.
  • New regression test in batch-execution.test.ts (static ETH value in composable write: WETH deposit mints correct balance) — funds the SCA, runs a real weth.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 static value.

LGTM. Approving.

@vr16x
vr16x merged commit 9e4d3cc into main May 25, 2026
5 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.

2 participants