erc2612-permit-deadline-review
Use when reviewing or issuing an ERC-2612 permit signature. Sets a short deadline, caps the approved value, verifies spender and nonce, and checks the domain before signing.
- License 许可
- MIT
- 最近更新
- 2026-11-14
- Stars
- ★ 81
- Forks
- 17
01 前言 Front Matter
- name
- erc2612-permit-deadline-review
- description
- Use when reviewing or issuing an ERC-2612 permit signature. Sets a short deadline, caps the approved value, verifies spender and nonce, and checks the domain before signing.
02 资源文件 3
- 许可证LICENSE1.0 KB
- 参考文档SOURCE.md356 B
- 参考文档TRUST.auto.yaml2.2 KB
03 SKILL.md 正文
Review an ERC-2612 permit deadline
A permit is an approval with no transaction and no gas, and it stays valid until its deadline expires. This skill bounds that window to minutes, caps the amount, and verifies the spender and nonce so a leaked or replayed permit cannot move the whole balance.
Procedure
- Read the token's current permit nonce for the owner; a replayed permit with the same nonce reverts, but a fresh one is dangerous:
cast call $TOKEN "nonces(address)(uint256)" $OWNER --rpc-url $RPC - Verify the domain the permit is bound to:
cast call $TOKEN "DOMAIN_SEPARATOR()(bytes32)" --rpc-url $RPCConfirm the token supports EIP-2612 by checking thatpermit,nonces, andDOMAIN_SEPARATORall exist. - Set the deadline tightly. For an interactive flow use
deadline = now + 1200seconds (20 minutes); nevertype(uint256).max, which is a permit that never expires. - Set
valueto the exact amount needed, notMAX_UINT256. A permit toMAXis an unlimited approval that costs the attacker no gas to obtain. - Confirm the
spenderis the contract you intend (a router or vault) and not an arbitrary address. - Confirm the
ownerin the permit is the address you are signing from and not one derived from a different path. - Sign only after re-reading the spender and value in the wallet UI, and confirm the chain id in the domain.
- If you are the verifier, enforce a maximum acceptable deadline on-chain and revert anything longer.
Pitfalls
-
A permit with a far-future deadline is functionally an unlimited, unrevocable approval; revoking it requires either an on-chain
approvereset or waiting out the deadline. -
Permits are front-runnable: anyone who sees a pending permit can submit it first and consume the nonce. Set short deadlines and submit promptly.
-
A permit for one token, signed for the wrong
spender, can be presented to any contract that callspermiton that token. -
EIP-2612 support is not universal; tokens without it silently lack
permit, and calling it reverts or, on some proxies, does nothing. -
The
valuein a permit is the allowance amount, not a transfer amount; setting it toMAXis an approval, not a payment. -
A permit signed over a chain with a forked twin is replayable there if the domain omits the chain id.
-
Reading
noncesfrom a stale block can show an old value; read atlatestright before signing. -
A UI that hides the deadline is hiding the single field that governs how long the risk lasts.
Verification
cast call $TOKEN "nonces(address)(uint256)" $OWNER --rpc-url $RPC && cast call $TOKEN "DOMAIN_SEPARATOR()(bytes32)" --rpc-url $RPC
# expect a monotonically increasing nonce and a domain separator matching the token
Report the permit nonce, the domain separator, the spender, and the chosen deadline in seconds, with the commands behind them.
04 同仓库更多 Skills
recipe-performance
Diagnose a specific MetaMask user flow's real-app performance and Sentry critical-user-flow telemetry with deterministic mm-harness recipes. Use for CUF boundaries, cold/warm/background-resume behavior, latency regressions, lifecycle tags, duplicate or blocking network requests, long tasks, layout/paint cost, screen redraws, React rerenders, or browser trace analysis where tests alone cannot prove the real app.
mexc-spot-websocket
MEXC Spot WebSocket workflows for public streams, protobuf handling, depth maintenance, listen keys, and private streams without exposing API keys.
mexc-spot-rest
MEXC Spot REST workflows for public data, signed account requests, orders, wallet/admin actions, and secure signing without exposing API keys.
mexc-futures-websocket
MEXC Futures WebSocket workflows for public streams, private account/order/position streams, ping/pong, subscriptions, and depth maintenance.
0xklen-version-and-refresh-sanctions-lists
暂无简介
verify-tests-cover-changed-lines
Use when a PR adds code that the existing suite may not exercise. Measures patch coverage — the share of newly changed lines hit by tests — before approving.