Repository navigation
Conversation
Enables an agent to drive a full new-network deployment (deployAllContracts / scriptMaster use case 3) without an interactive terminal and under per-command time limits, by running one stage per fresh shell. - deployAllContracts.sh: optional START_STAGE/END_STAGE env bounds the stage range and skips the interactive gum stage menu; NON_INTERACTIVE=true accepts computed defaults at the stage-9 funding prompts. Defaults preserve the original interactive behavior (run chosen stage -> 12). - verifyERC20ProxyAuthorization.sh: NON_INTERACTIVE=true auto-confirms owner funding with the default amount (stage 10). - .agents/commands/deploy-network.md (+ .cursor / .claude symlinks): the skill. New-network bootstrap only (direct-to-diamond); stops after stage 11 and never runs ownership transfer. Relies on CREATE3/diamondCut idempotency for safe per-stage re-runs. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Ordered preflight (submodules, typechain, GLOBAL_FILE_PATH, verifier subdomain, premium RPC, corePeriphery<->target-state reconciliation, version currency), bash-not-zsh + which env overrides survive the .env re-source, idempotent per-stage re-run, deploy-with-verification-off + parallel rate-limit-aware verify sweep, and the MongoDB master-log / mongo-logs:sync reality. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
Warning Review limit reached
Next review available in: 10 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: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (5)
WalkthroughAdds a deploy-network runbook and linked command entrypoints, bounded stage execution through health checks, deployment reuse and verification override handling, non-interactive owner funding, and parallel contract verification with rate-limit retries. ChangesNetwork deployment workflow
Estimated code review effort: 4 (Complex) | ~45 minutes Possibly related PRs
Suggested labels: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
… sourcing - helperFunctions.sh: add verifyNetworkContractsParallel(network, environment) — a network-scoped parallel verification sweep for the deploy-network "verify after deploy" phase. Verifies unverified contracts concurrently (capped low, staggered dispatch), then updates the deployment log SEQUENTIALLY (parallel log writes would corrupt it). Extend verifyContract's retry triggers to include 429/rate-limit/too many requests so parallel verification backs off instead of failing. - deployAllContracts.sh: source deploySingleContract.sh (was relying on scriptMaster to source it; direct invocation hit "deploySingleContract: command not found" at stage 3). Now self-contained. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
deploySingleContract now skips the forge script when the version-specific CREATE3 address already has code (NEW_DEPLOYMENT=="true"): running it would only fork the RPC (~dozens of ~1s calls on a public RPC) to no-op. Reuses the deployed address; existing log-matching supplies constructor args. A version bump changes bytecode -> different salt/address -> deploys normally. Opt out with SKIP_IF_ALREADY_DEPLOYED=false. Validated on injective: a stage-6 re-run dropped from ~8min to ~114s. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
There was a problem hiding this comment.
Actionable comments posted: 5
🧹 Nitpick comments (1)
script/deploy/deploySingleContract.sh (1)
282-282: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winUse the required Bash conditional form.
- while [ $attempts -le "$MAX_ATTEMPTS_PER_CONTRACT_DEPLOYMENT" ] && [[ -z "$ADDRESS" ]]; do + while [[ "$attempts" -le "$MAX_ATTEMPTS_PER_CONTRACT_DEPLOYMENT" && -z "$ADDRESS" ]]; doAs per coding guidelines, “Use
[[ ]]for conditional expressions instead of[ ]” and always quote variable references.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@script/deploy/deploySingleContract.sh` at line 282, Update the while condition around the deployment retry loop to use Bash’s [[ ]] conditional syntax consistently, including the attempts comparison and ADDRESS emptiness check. Quote variable references within the condition while preserving the existing retry behavior.Source: Coding guidelines
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.agents/commands/deploy-network.md:
- Around line 108-121: The Phase 1 deployment instructions do not reliably
disable verification because deployAllContracts sources .env after the inline
environment assignment. Update the command guidance around deployAllContracts so
VERIFY_CONTRACTS=false remains effective, either by explicitly instructing users
to edit and restore .env for the run or by preserving the caller-provided
override in the deployment script; ensure the documented command truly avoids
inline verification.
In `@script/deploy/deploySingleContract.sh`:
- Around line 266-280: Before the short-circuit in deploySingleContract, clear
stale RAW_RETURN_DATA and load the constructor arguments from the deployment-log
entry matching CONTRACT and CONTRACT_ADDRESS. Ensure the reuse path uses these
loaded arguments for CONSTRUCTOR_ARGS, while preserving normal forge execution
and output handling for newly deployed contracts.
In `@script/helperFunctions.sh`:
- Around line 2634-2635: Check the return status of logContractDeploymentInfo
before incrementing OK in the deployment-processing flow. On failure, add the
contract to FAILED and skip the success increment; only increment OK when the
deployment-log update succeeds, preserving the existing summary and verification
behavior.
- Around line 2567-2572: Update the concurrency setup near
VERIFICATION_MAX_CONCURRENT_JOBS to read MAX_CONCURRENT_JOBS with
${MAX_CONCURRENT_JOBS:-}, then validate that any provided value is a positive
integer before dispatch. Reject zero, negative, and non-numeric values so the
throttle cannot wait indefinitely, while preserving the configured verification
concurrency behavior for valid inputs.
In `@script/tasks/verifyERC20ProxyAuthorization.sh`:
- Around line 110-119: Update the funding decision in
verifyERC20ProxyAuthorization around DEFAULT_FUND_AMOUNT and DO_FUND_OWNER so
NON_INTERACTIVE mode automatically funds only when OWNER_BALANCE is below the
required amount. Preserve the existing interactive confirmation behavior, and
avoid sending funds on reruns when the owner already has sufficient balance.
---
Nitpick comments:
In `@script/deploy/deploySingleContract.sh`:
- Line 282: Update the while condition around the deployment retry loop to use
Bash’s [[ ]] conditional syntax consistently, including the attempts comparison
and ADDRESS emptiness check. Quote variable references within the condition
while preserving the existing retry behavior.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: ed3423b0-d433-44c2-839a-035449b56546
📒 Files selected for processing (7)
.agents/commands/deploy-network.md.claude/skills/deploy-network/SKILL.md.cursor/commands/deploy-network.mdscript/deploy/deployAllContracts.shscript/deploy/deploySingleContract.shscript/helperFunctions.shscript/tasks/verifyERC20ProxyAuthorization.sh
- deployAllContracts: preserve caller VERIFY_CONTRACTS override across source .env - deploySingleContract: reset stale RAW_RETURN_DATA + source constructor args from log on the already-deployed short-circuit (avoids wrong/empty verify args) - verifyNetworkContractsParallel: validate concurrency (reject non-positive / tolerate unset MAX_CONCURRENT_JOBS); mark contract FAILED when log update fails - verifyERC20ProxyAuthorization: gate NON_INTERACTIVE owner funding on balance (bc compare) so reruns don't repeatedly send gas
gvladika
left a comment
There was a problem hiding this comment.
Posted two inline findings from a detailed review (VERIFY_CONTRACTS override scope, and constructor-args recovery in the skip path).
…warn on unrecoverable skip args Addresses @gvladika review on #2066. 1. VERIFY_CONTRACTS override didn't survive: deployAllContracts restored it only across its own two `source .env` calls, but deployCoreFacets / deploySingleContract / deployFacetAndAddToDiamond each re-source .env in the same shell and reset it back to the .env value before the verify gate (in deploySingleContract) consumes it — so the skill's inline VERIFY_CONTRACTS=false was silently ignored. Fix: promote the caller value into an exported VERIFY_CONTRACTS_OVERRIDE (never set by .env) before every `source .env`, guarded by `:-` so the outermost value wins, and have the gate consult it. Doc's two contradictory statements aligned to match. 2. Skip path with a missing/incomplete master-log entry silently logged CONSTRUCTOR_ARGS=0x, which makes Phase-2 verification of any contract with real constructor args fail forever with no hint. Fix: emit a loud warning when the skip fires but no args are recoverable. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
There was a problem hiding this comment.
Actionable comments posted: 3
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
script/deploy/deployAllContracts.sh (2)
475-480: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick winDo not return before deployment-log synchronization.
For an
END_STAGE=11run, this return bypassesupdateDiamondLogForNetworkat lines 558-560. Let execution reach the common tail after suppressing the Stage 12 prompt, so the final bounded deployment still synchronizes its logs.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@script/deploy/deployAllContracts.sh` around lines 475 - 480, Replace the early return in the END_STAGE boundary block of deployAllContracts with control flow that suppresses only the Stage 12 ownership-transfer prompt, then continues into the common tail. Ensure updateDiamondLogForNetwork executes for END_STAGE=11 while preserving the bounded-run completion messages.
72-73: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winKeep stage bounds local to this invocation.
END_STAGEis assigned globally, andSTART_STAGEis later assigned globally. A subsequent call in the same shell can inherit the prior range and skip stage selection. Initialize both as locals from the caller environment.As per coding guidelines, “Use local keyword when declaring variables inside functions.”
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@script/deploy/deployAllContracts.sh` around lines 72 - 73, Update the stage-selection logic in the deployment function containing END_STAGE and START_STAGE so both variables are declared local while preserving their caller-provided defaults. Ensure each invocation initializes its own range and does not leak or inherit modified stage bounds from previous calls.Source: Coding guidelines
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@node_modules`:
- Line 1: Remove the machine-local node_modules symbolic link from version
control, leaving the generated dependency directory untracked and managed by the
existing ignore configuration.
In `@script/deploy/deploySingleContract.sh`:
- Around line 292-305: The constructor arguments loaded in the deployment
recovery flow must be accepted only when the matched master-log entry’s ADDRESS
equals CONTRACT_ADDRESS case-insensitively. Update the logic around
findContractInMasterLog and CONSTRUCTOR_ARGS_FROM_LOG to inspect the entry
address before assigning its constructor args; on mismatch, leave
CONSTRUCTOR_ARGS_FROM_LOG empty so the existing warning and placeholder fallback
execute.
In `@script/tasks/verifyERC20ProxyAuthorization.sh`:
- Around line 113-119: Update the balance handling around OWNER_BALANCE and the
funding gate so a failed cast balance lookup returns before any NON_INTERACTIVE
auto-funding occurs. Track the command’s exit status separately from a genuinely
retrieved low balance, and remove the empty OWNER_BALANCE condition from
OWNER_NEEDS_FUNDING so missing data fails closed while valid balances below
DEFAULT_FUND_AMOUNT still trigger funding.
---
Outside diff comments:
In `@script/deploy/deployAllContracts.sh`:
- Around line 475-480: Replace the early return in the END_STAGE boundary block
of deployAllContracts with control flow that suppresses only the Stage 12
ownership-transfer prompt, then continues into the common tail. Ensure
updateDiamondLogForNetwork executes for END_STAGE=11 while preserving the
bounded-run completion messages.
- Around line 72-73: Update the stage-selection logic in the deployment function
containing END_STAGE and START_STAGE so both variables are declared local while
preserving their caller-provided defaults. Ensure each invocation initializes
its own range and does not leak or inherit modified stage bounds from previous
calls.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 46ef0007-a703-4f5d-aa36-5964f5179316
📒 Files selected for processing (8)
.agents/commands/deploy-network.mdnode_modulesscript/deploy/deployAllContracts.shscript/deploy/deployCoreFacets.shscript/deploy/deployFacetAndAddToDiamond.shscript/deploy/deploySingleContract.shscript/helperFunctions.shscript/tasks/verifyERC20ProxyAuthorization.sh
🚧 Files skipped from review as they are similar to previous changes (2)
- script/helperFunctions.sh
- .agents/commands/deploy-network.md
A local node_modules symlink (created for typechecking) was staged by `git add -A` because .gitignore uses `node_modules/` (dir-only) which does not match a symlink. The broken symlink made CI's `bun install` fail with 'ENOENT: could not open the node_modules directory'. Not a code change. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Address two CodeRabbit review findings on #2066: - deploySingleContract: findContractInMasterLog keys only on contract/network/environment/version, so a same-version entry can point at a different address (e.g. after a salt change). Only adopt its CONSTRUCTOR_ARGS when the entry's ADDRESS matches CONTRACT_ADDRESS (case-insensitive); otherwise fall through to the existing warning + placeholder path instead of writing another address's args. - verifyERC20ProxyAuthorization: fail closed on the owner balance lookup. Track `cast balance` exit status separately so a failed/empty RPC result no longer counts as "insufficient funds" and triggers NON_INTERACTIVE auto-funding; only a genuinely retrieved balance below DEFAULT_FUND_AMOUNT funds. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
… re-sources .env helperFunctions.sh sources .env at file level (set -a), so promoting the caller's VERIFY_CONTRACTS after 'source script/helperFunctions.sh' captured the .env value instead of the caller's inline one — an inline VERIFY_CONTRACTS=false was silently ignored and inline verification ran anyway (proven with a controlled .env: OVERRIDE ended up "true"). Move the promotion above the first source in deployAllContracts, deployCoreFacets, and deploySingleContract (deployFacetAndAddToDiamond already promoted first). Also: - verifyNetworkContractsParallel: pass the logged SOLC/EVM/optimizer-runs to verifyContract so the parallel sweep pins the recorded toolchain, matching the sequential sweep after PR #2119 (extra positional args are ignored until that code is present at merge) - deploySingleContract: reset NEW_DEPLOYMENT/CONTRACT_ADDRESS before the CREATE3/zkEVM split so stale globals from a previous same-shell call can never trigger the already-deployed short-circuit with another network's address - deploy-network.md: correct the parallel-verification concurrency cap (VERIFICATION_MAX_CONCURRENT_JOBS, default 4) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Overnight gate-review pass on this PR (commit 1b6a59b). Auto-fixed in that commit:
Escalated (needs a human decision):
Lower-confidence (human judgment): a NON_INTERACTIVE full-stage run could still hit |
|
Closing as stale rather than carrying it into the review queue. This branch was built and hardened during the Injective (chainId 1776) bring-up, which shipped weeks ago — the value it was written to capture has already been banked in that live deploy. Since then the scripts it documents and modifies have been substantially rewritten underneath it:
so the staged-bring-up procedure described here no longer matches the scripts it drives, and validating it would cost more than rewriting it against EXSC-631 stays open. When the next new-network bring-up comes round, that's the moment to re-derive this from the scripts as they actually are, with a live deploy as the shakedown again. |
Pull request was closed
Which Linear task belongs to this PR?
EXSC-631 — https://linear.app/lifi-linear/issue/EXSC-631/deploy-network-skill-agent-driven-staged-new-network-bring-up
Why did I implement it this way?
Adds a
deploy-networkskill so an agent can drive a full new-network production bring-up(
deployAllContracts.sh/ scriptMaster use case 3) end to end — the gap betweenadd-network(config) and
multisig-rollout(upgrades to existing chains). Built and hardened during the liveInjective (chainId 1776) production deploy, which is its shakedown.
Two things blocked agent-driven use of
deployAllContracts: the agent Bash tool hard-kills anycommand at ~10 min, and the script is interactive (
gum/read). This PR makes it drivableone stage per fresh shell, non-interactively, relying on the deploy's existing CREATE3 +
diamondCutidempotency for safe per-stage re-runs.Script changes (additive, backward-compatible — default interactive behavior unchanged)
script/deploy/deployAllContracts.shSTART_STAGE/END_STAGEenv bounds the stage range and skips the interactivegumstage menu when preset. Each stage guard is bounded to
[START_STAGE, END_STAGE]; a boundedrun ending at 11 stops cleanly without the stage-12 ownership-transfer prompt.
NON_INTERACTIVE=trueaccepts the computed defaults at the stage-9 funding prompts.deploySingleContract.shitself (was relying on scriptMaster to source it → stage 3failed
deploySingleContract: command not foundunder direct invocation). Now self-contained.script/tasks/verifyERC20ProxyAuthorization.sh:NON_INTERACTIVE=trueauto-confirms ownerfunding with the default (stage 10).
The skill (
.agents/commands/deploy-network.md+.cursor/.claudesymlinks)New-network bootstrap only (direct-to-diamond, pre-ownership-transfer); stops after stage 11. The
body encodes every rough edge the Injective deploy surfaced so the next one is turnkey:
without it) →
forge clean && forge build→GLOBAL_FILE_PATHsanity (a stale./../config/global.jsonsilently broke stage 2) → verifier-subdomain probe (blockscoutverify API is often a separate
*-apihost; wrong URL → 404s misread as gateway timeouts →retry-throttling) → premium RPC (public Injective RPC ≈1.4s/call → 30-60s forking per
contract; Alchemy ≈2× faster) → corePeriphery ↔ target-state reconciliation (caught
OutputValidator missing from the sheet and deprecated FeeCollector still expected) → version
currency (ERC20Proxy must be ≥1.2.0 or the Executor isn't pre-authorized).
bash -c(agent shell is zsh; scripts useread -a), whichenv overrides survive the script's
.envre-source vs. which need a file edit, idempotentper-stage re-run with a cap, huge-output handling.
(Blockscout indexes lag inline verification; a post-deploy sweep is faster and more reliable).
Master log is in MongoDB —
bun mongo-logs:syncrefreshes the local cache.Still to land on this branch before marking ready
verifyNetworkContractsParallelhelper (parallel, network-scoped, Blockscoutrate-limit backoff) — referenced by the skill's Phase 2.
forge scriptfork viagetDeployedcast code+ version check) — biggest win on re-runs.Checklist before requesting a review
Checklist for reviewer (DO NOT DEPLOY and contracts BEFORE CHECKING THIS!!!)