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.