test: add tx encoding coverage for TxRlp, EIP-1559, EIP-7702#130
Open
toandepz wants to merge 1 commit into
Open
test: add tx encoding coverage for TxRlp, EIP-1559, EIP-7702#130toandepz wants to merge 1 commit into
toandepz wants to merge 1 commit into
Conversation
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.
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.
Summary
The library ships a full set of RLP transaction encoders (
TxRlp,Eip1559TransactionLib,Eip7702TransactionLib,TempoTransactionLib) but theonly test file so far is
CurrentCommittee.t.sol. This adds coverage for theencoding path.
What's tested
TxRlpprimitives against canonical RLP vectors: minimaluintencoding(incl.
0 -> ""andtype(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.encodeWithSignatureandEip7702TransactionLib.encodeWithSignatureasserted byte-for-byteagainst output from an independent reference encoder
(viem
serializeTransaction). The EIP-7702 case also exercises leading-zerostripping 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
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 --checklocally to confirm everything passes.