Repository navigation
fix(contracts): give Uniswap genesis-seed mint a deadline buffer - #1099
Conversation
The genesis buyback activation seeds the Uniswap V3 TOKEN/USDC pool with `NonfungiblePositionManager.mint`, whose deadline was `block.timestamp` (zero margin). The NPM enforces `block.timestamp <= deadline`, so under `forge script` the deadline is encoded during the execution phase but the tx mines a later block (on-chain simulation, then the real broadcast) whose timestamp is already past it — reverting `Transaction too old`. On Arbitrum's sub-second blocks this is deterministic, so the #1083 Arbitrum Sepolia deploy fails (and would waste gas on a live broadcast), not just flake. Use `block.timestamp + 1 hours`. The genesis seed has no slippage to guard (`amount0Min`/`amount1Min` are already 0, price is one we set), so a wide window is strictly safe. The fork test can't catch this: it runs in a single Foundry EVM at a fixed `block.timestamp`, so capture time equals execution time and the two-phase `forge script` timing gap never appears. Verified instead by a live dry run against Arbitrum Sepolia, which now simulates cleanly. Co-Authored-By: Claude Opus 4.8 <[email protected]>
|
Warning Review limit reached
Next review available in: 57 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Free Run ID: 📒 Files selected for processing (1)
WalkthroughThe deployment script changes the genesis Uniswap V3 pool mint deadline from ChangesPool Mint Deadline
Estimated code review effort: 1 (Trivial) | ~2 minutes Note 🎁 Summarized by CodeRabbit FreeYour organization is on the Free plan. CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please upgrade your subscription to CodeRabbit Pro by visiting https://app.coderabbit.ai/login. Comment |
There was a problem hiding this comment.
Code Review
This pull request updates the deployment script in BaseProtocolDeploy.s.sol to add a 1-hour buffer to the transaction deadline instead of using block.timestamp. This prevents 'Transaction too old' errors during forge script execution, where the transaction is mined in a later block than when it was simulated. There are no review comments, so we have no additional feedback to provide.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
Gas snapshotNo gas changes vs base. |
Contracts coverageLine coverage: 88.71% (2452/2764 lines) |
There was a problem hiding this comment.
Pull request overview
Fixes a deterministic deployment revert when seeding the Uniswap V3 TOKEN/USDC pool during genesis buyback activation by ensuring the NonfungiblePositionManager.mint transaction has a non-zero deadline margin under forge script broadcast timing.
Changes:
- Update Uniswap V3 position mint
deadlinefromblock.timestamptoblock.timestamp + 1 hours. - Add an inline comment explaining why
forge scriptmakes a zero-margin deadline unsafe and why a wide window is acceptable for this seed.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
The `block.timestamp + 1 hours` deadline arithmetic shifts deterministic gas by ~78 units in three GenesisBuybackActivation tests. Regenerated via `FOUNDRY_PROFILE=ci forge snapshot --snap .gas-snapshot`. Co-Authored-By: Claude Opus 4.8 <[email protected]>
Problem
The genesis buyback activation (#1084) seeds the Uniswap V3 TOKEN/USDC pool via
NonfungiblePositionManager.mint, whosedeadlinewasblock.timestamp— zero margin. The NPM enforcesblock.timestamp <= deadline, so underforge scriptthe deadline is encoded during the execution phase, but the tx mines a later block (on-chain simulation, then the real broadcast) whose timestamp is already past it → revertsTransaction too old.On Arbitrum's sub-second blocks this is deterministic, so the #1083 Arbitrum Sepolia v0.1.0 deploy fails outright (and would waste gas on a live broadcast), not merely flake.
Fix
Use
block.timestamp + 1 hours. The genesis seed has no slippage to guard —amount0Min/amount1Minare already0and the price is one we set — so a wide window is strictly safe.Why tests didn't catch it
GenesisBuybackActivation.fork.t.solruns in a single Foundry EVM at a fixedblock.timestamp, so capture time equals execution time and the two-phaseforge scripttiming gap never appears. This class of bug only surfaces underforge script, notforge test.Verification
FOUNDRY_PROFILE=ci forge build --deny warnings— cleanforge test --match-contract GenesisBuybackActivation(non-fork) — 12/12 passDeployProtocolagainst Arbitrum Sepolia — previously reverted at themint, now simulates to completion🤖 Generated with Claude Code
Summary by CodeRabbit