Skip to content

test: add tx encoding coverage for TxRlp, EIP-1559, EIP-7702#130

Open
toandepz wants to merge 1 commit into
tempoxyz:masterfrom
toandepz:test/tx-encoding-coverage
Open

test: add tx encoding coverage for TxRlp, EIP-1559, EIP-7702#130
toandepz wants to merge 1 commit into
tempoxyz:masterfrom
toandepz:test/tx-encoding-coverage

Conversation

@toandepz

@toandepz toandepz commented Jul 14, 2026

Copy link
Copy Markdown

Summary

The library ships a full set of RLP transaction encoders (TxRlp,
Eip1559TransactionLib, Eip7702TransactionLib, TempoTransactionLib) but the
only test file so far is CurrentCommittee.t.sol. This adds coverage for the
encoding path.

What's tested

  • TxRlp primitives against canonical RLP vectors: minimal uint encoding
    (incl. 0 -> "" and type(uint256).max), single-byte string boundaries
    (0x7f, 0x80, 0x00), empty string (0x80), empty list (0xc0), the
    ["cat","dog"] list, and the 55/56-byte short/long-string header boundary.
  • Eip1559TransactionLib.encodeWithSignature and
    Eip7702TransactionLib.encodeWithSignature asserted byte-for-byte
    against output from an independent reference encoder
    (viem serializeTransaction). The EIP-7702 case also exercises leading-zero
    stripping of an authorization tuple's r/s.

Using an external reference (rather than the library encoding itself) means
these lock the actual wire format, not just self-consistency.

Checks

forge test          # 9 passed (3 existing + 6 new)
forge fmt --check   # clean

No source changes - tests only.

AI assistance disclosure

The test code and the viem reference values in this PR were written primarily
with Claude Code (Claude Fable 5). I directed the work, reviewed the output, and
ran forge test / forge fmt --check locally to confirm everything passes.

The library ships RLP transaction encoders but only had one test file
(CurrentCommittee). This adds coverage for the encoding path: TxRlp
primitives against canonical RLP vectors, and the EIP-1559 / EIP-7702
signed encoders asserted byte-for-byte against an independent reference
encoder (viem serializeTransaction), including leading-zero stripping of
authorization r/s.
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