fix(tip-1004): reject zero-address ecrecover in permit, add edge-case tests#2786
Open
howydev wants to merge 5 commits intohowy/add-permitfrom
Open
fix(tip-1004): reject zero-address ecrecover in permit, add edge-case tests#2786howydev wants to merge 5 commits intohowy/add-permitfrom
howydev wants to merge 5 commits intohowy/add-permitfrom
Conversation
📊 Tempo Precompiles CoverageprecompilesCoverage: 20582/21614 lines (95.23%) File details
contractsCoverage: 206/383 lines (53.79%) File details
Total: 20788/21997 lines (94.50%) |
8406ee2 to
43efc1e
Compare
e17d93b to
e13c21e
Compare
Amp-Thread-ID: https://ampcode.com/threads/T-019c76d4-c191-703b-a1da-a66c517ebed4 Co-authored-by: Amp <amp@ampcode.com>
… tests Address Zellic audit finding ZELLIC-53: 1. Explicitly reject recovered == address(0) in permit() before comparing against owner, matching Solidity reference behavior. 2. Add missing test coverage: - Zero-address recovery reverts with InvalidSignature - Domain separator changes when chainId changes Amp-Thread-ID: https://ampcode.com/threads/T-019c76d4-c191-703b-a1da-a66c517ebed4 Co-authored-by: Amp <amp@ampcode.com>
Amp-Thread-ID: https://ampcode.com/threads/T-019c76d4-c191-703b-a1da-a66c517ebed4 Co-authored-by: Amp <amp@ampcode.com>
43efc1e to
898fd70
Compare
Addresses ZELLIC-53 item #2: explicitly documents that permit only accepts v=27/28 and does not normalize v=0/1. Added to both the TIP-1004 spec and as a code comment in the Rust implementation. Amp-Thread-ID: https://ampcode.com/threads/T-019c76d4-c191-703b-a1da-a66c517ebed4 Co-authored-by: Amp <amp@ampcode.com>
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
Addresses ZELLIC-53: audit findings on TIP-1004 permit implementation.
Changes
Bug fix — zero-address recovery rejection
permit()now explicitly rejectsrecovered == address(0)before comparing againstowner, matching the Solidity referenceecrecoverbehavior. Previously, a crafted signature that somehow recovered toaddress(0)could have been accepted ifownerwas alsoaddress(0).New tests
test_permit_zero_address_recovery_reverts— verifiesInvalidSignatureis returned when ecrecover yields the zero addresstest_permit_domain_separator_changes_with_chain_id— verifies the EIP-712 domain separator differs across chain IDs (fork safety)