feat(validation): reject allowlist addresses that hold no contract code - #61
Merged
Conversation
A typo'd or not-yet-deployed token address used to produce a deployment whose every operation reverts — the compiler's extcodesize guard on the high-level token calls catches the mistake, but only at the first payment attempt. Multi-chain deploys read token addresses from per-chain config, which is exactly where a wrong-chain address slips in; failing in the constructor surfaces it at deploy time. Also documents the token trust boundary explicitly in the README: fee-on-transfer and rebasing tokens are unsupported, since charge and refund forward the exact signed amount. Co-Authored-By: Claude Fable 5 <noreply@anthropic.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.
From the v2.0.0 hardening pass.
The constructor accepted any non-zero, non-duplicate address into the token allowlist. An address with no contract code (a typo, or a token not yet deployed on that chain) produced a deployment whose every operation reverts — caught only at the first payment attempt, by the compiler's extcodesize guard on the high-level token calls (verified:
authorizeagainst a codeless token already reverts, so no funds were ever at risk — this is fail-fast hardening, not a vulnerability fix). Multi-chain deploys read token addresses from per-chain config, which is exactly where a wrong-chain address slips in.Now
t.code.length == 0→TokenHasNoCodeat deploy time. One-time constructor cost, no runtime gas impact.Also documents the token trust boundary in the README's security model: fee-on-transfer / rebasing tokens are unsupported (
chargeandrefundforward the exact signed amount, so a token that delivers less than it debits would settle out of other payments' escrow).Tests:
test_Constructor_RejectsAddressWithNoCode; 121 passed.🤖 Generated with Claude Code