Skip to content

feat(deploy): deploy-network skill for staged new-network bring-up#2066

Open
0xDEnYO wants to merge 4 commits into
mainfrom
deploy-network-staged
Open

feat(deploy): deploy-network skill for staged new-network bring-up#2066
0xDEnYO wants to merge 4 commits into
mainfrom
deploy-network-staged

Conversation

@0xDEnYO

@0xDEnYO 0xDEnYO commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

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-network skill so an agent can drive a full new-network production bring-up
(deployAllContracts.sh / scriptMaster use case 3) end to end — the gap between add-network
(config) and multisig-rollout (upgrades to existing chains). Built and hardened during the live
Injective (chainId 1776) production deploy, which is its shakedown.

Two things blocked agent-driven use of deployAllContracts: the agent Bash tool hard-kills any
command at ~10 min, and the script is interactive (gum/read). This PR makes it drivable
one stage per fresh shell, non-interactively, relying on the deploy's existing CREATE3 +
diamondCut idempotency for safe per-stage re-runs.

Script changes (additive, backward-compatible — default interactive behavior unchanged)

  • script/deploy/deployAllContracts.sh
    • Optional START_STAGE/END_STAGE env bounds the stage range and skips the interactive gum
      stage menu when preset. Each stage guard is bounded to [START_STAGE, END_STAGE]; a bounded
      run ending at 11 stops cleanly without the stage-12 ownership-transfer prompt.
    • NON_INTERACTIVE=true accepts the computed defaults at the stage-9 funding prompts.
    • Sources deploySingleContract.sh itself (was relying on scriptMaster to source it → stage 3
      failed deploySingleContract: command not found under direct invocation). Now self-contained.
  • script/tasks/verifyERC20ProxyAuthorization.sh: NON_INTERACTIVE=true auto-confirms owner
    funding with the default (stage 10).

The skill (.agents/commands/deploy-network.md + .cursor/.claude symlinks)

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:

  • Ordered preflight: submodules → node_modules → typechain (TS deploy helpers crash
    without it) → forge clean && forge buildGLOBAL_FILE_PATH sanity (a stale
    ./../config/global.json silently broke stage 2) → verifier-subdomain probe (blockscout
    verify API is often a separate *-api host; 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).
  • Execution mechanics: run under bash -c (agent shell is zsh; scripts use read -a), which
    env overrides survive the script's .env re-source vs. which need a file edit, idempotent
    per-stage re-run with a cap, huge-output handling.
  • Verification: deploy with verification off, then a parallel, rate-limit-aware sweep
    (Blockscout indexes lag inline verification; a post-deploy sweep is faster and more reliable).
    Master log is in MongoDB — bun mongo-logs:sync refreshes the local cache.

Still to land on this branch before marking ready

  • Prepare for next audit #2 verifyNetworkContractsParallel helper (parallel, network-scoped, Blockscout
    rate-limit backoff) — referenced by the skill's Phase 2.
  • fix: links to docs and api #3 short-circuit already-deployed contracts (skip the forge script fork via getDeployed
    • cast code + version check) — biggest win on re-runs.

Checklist before requesting a review

Checklist for reviewer (DO NOT DEPLOY and contracts BEFORE CHECKING THIS!!!)

  • I have checked that any arbitrary calls to external contracts are validated and or restricted
  • I have checked that any privileged calls (i.e. storage modifications) are validated and or restricted
  • I have ensured that any new contracts have had AT A MINIMUM 1 preliminary audit conducted on by <company/auditor>

0xDEnYO and others added 2 commits July 15, 2026 17:07
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>
@coderabbitai

coderabbitai Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

The PR adds a deploy-network runbook, links it into Claude and Cursor commands, enables bounded non-interactive deployment stages, skips already deployed contracts, and adds parallel verification with expanded transient-error retries.

Changes

Network deployment workflow

Layer / File(s) Summary
Deployment runbook and command entrypoints
.agents/commands/deploy-network.md, .claude/skills/deploy-network/SKILL.md, .cursor/commands/deploy-network.md
Defines the new-network deployment phases, preflight checks, stage schedule, resumable execution, verification flow, artifact handling, and ownership hand-offs; Claude and Cursor commands link to the shared runbook.
Bounded staged deployment
script/deploy/deployAllContracts.sh, script/tasks/verifyERC20ProxyAuthorization.sh
Adds validated START_STAGE/END_STAGE execution ranges, non-interactive funding paths, and automatic stopping after Stage 11 when Stage 12 is excluded.
Deployment reuse and parallel verification
script/deploy/deploySingleContract.sh, script/helperFunctions.sh
Skips known version-specific deployments, retries additional verification rate-limit and ABI errors, and verifies unverified network contracts concurrently before updating deployment logs.

Estimated code review effort: 4 (Complex) | ~45 minutes

Suggested labels: AuditNotRequired

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 20.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and accurately describes the staged deploy-network skill for new-network bring-up.
Description check ✅ Passed The description matches the template and includes the Linear task, rationale, and both required checklists.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch deploy-network-staged

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

0xDEnYO and others added 2 commits July 16, 2026 09:28
… 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>
@0xDEnYO 0xDEnYO marked this pull request as ready for review July 16, 2026 03:40

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 5

🧹 Nitpick comments (1)
script/deploy/deploySingleContract.sh (1)

282-282: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Use 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" ]]; do

As 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

📥 Commits

Reviewing files that changed from the base of the PR and between 7206885 and 70097a2.

📒 Files selected for processing (7)
  • .agents/commands/deploy-network.md
  • .claude/skills/deploy-network/SKILL.md
  • .cursor/commands/deploy-network.md
  • script/deploy/deployAllContracts.sh
  • script/deploy/deploySingleContract.sh
  • script/helperFunctions.sh
  • script/tasks/verifyERC20ProxyAuthorization.sh

Comment on lines +108 to +121
Deploy with **verification OFF** for speed (verify in Phase 2 instead). One stage per shell:

```bash
export PATH="$HOME/.foundry/bin:$HOME/.bun/bin:$PATH"
cd <network-worktree>
START_STAGE=<N> END_STAGE=<N> NON_INTERACTIVE=true VERIFY_CONTRACTS=false \
bash -c 'source script/deploy/deployAllContracts.sh; deployAllContracts <network> production' \
2>&1 | sed 's/\x1b\[[0-9;]*m//g' > /tmp/stage<N>.log
grep -c "STAGE <N> completed" /tmp/stage<N>.log # 1 = advance; 0 = inspect/re-run
```

(`VERIFY_CONTRACTS=false` is in `.env`, so to truly disable inline verification either edit `.env`
for the run or rely on the Phase-2 sweep; deploying verification-off avoids inline `--watch`
blocking and Blockscout indexing-lag failures.)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Make the verification-off command actually disable verification.

Line 113 sets VERIFY_CONTRACTS=false, but deployAllContracts subsequently sources .env, overwriting it. If .env contains VERIFY_CONTRACTS=true, stages still run blocking inline verification despite Lines 108-109 promising otherwise. Either require editing/restoring .env before Phase 1 or preserve the caller override in the script.

🤖 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 @.agents/commands/deploy-network.md around lines 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.

Comment on lines +266 to +280
# Reset before the loop so a value leaked from a previous contract can never wrongly trigger the
# short-circuit below (deploySingleContract is called in a loop by deployFacetAndAddToDiamond).
ADDRESS=""

# Short-circuit already-deployed contracts (opt out with SKIP_IF_ALREADY_DEPLOYED=false).
# DEPLOYSALT includes the compiled bytecode, so the predicted CREATE3 address is version-specific:
# if it already has code (NEW_DEPLOYMENT=="true"), this exact contract+version is already deployed
# and running the forge script would only fork the RPC (~dozens of calls) to no-op. Reuse the
# deployed address and skip the loop; the log-matching further below supplies the constructor args.
# A version bump changes the bytecode -> a different salt/address with no code -> deploys normally.
# (Only the non-zkEVM CREATE3 path sets NEW_DEPLOYMENT, so this naturally never fires on zkEVM.)
if [[ "${SKIP_IF_ALREADY_DEPLOYED:-true}" == "true" && "$NEW_DEPLOYMENT" == "true" ]]; then
echo "[info] $CONTRACT already deployed at $CONTRACT_ADDRESS (version-specific CREATE3 salt) - skipping forge deployment"
ADDRESS="$CONTRACT_ADDRESS"
fi

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift

Load deployment metadata before short-circuiting the forge execution.

The skip path sets only ADDRESS; it leaves RAW_RETURN_DATA from a previous deploySingleContract call intact. Lines 434-450 then derive CONSTRUCTOR_ARGS from that stale output, which can verify this contract with another contract’s arguments or persist incorrect metadata when its log entry is missing. On reuse, load constructor arguments from the matching deployment-log entry and clear stale execution output.

🤖 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` around lines 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.

Comment thread script/helperFunctions.sh
Comment on lines +2567 to +2572
# Verification concurrency is intentionally lower than MAX_CONCURRENT_JOBS: block explorers
# rate-limit aggressively. Each verifyContract already retries with backoff on 429/gateway.
local CONCURRENCY=${VERIFICATION_MAX_CONCURRENT_JOBS:-4}
if [[ -n "$MAX_CONCURRENT_JOBS" && "$MAX_CONCURRENT_JOBS" -lt "$CONCURRENCY" ]]; then
CONCURRENCY=$MAX_CONCURRENT_JOBS
fi

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Validate concurrency and tolerate an unset global.

Under the required strict-mode source test, "$MAX_CONCURRENT_JOBS" fails when unset. A zero concurrency value also makes the throttle loop wait forever. Read it with ${MAX_CONCURRENT_JOBS:-} and reject anything except positive integers before dispatch.

Proposed validation
-  local CONCURRENCY=${VERIFICATION_MAX_CONCURRENT_JOBS:-4}
-  if [[ -n "$MAX_CONCURRENT_JOBS" && "$MAX_CONCURRENT_JOBS" -lt "$CONCURRENCY" ]]; then
-    CONCURRENCY=$MAX_CONCURRENT_JOBS
+  local CONCURRENCY="${VERIFICATION_MAX_CONCURRENT_JOBS:-4}"
+  local MAX_JOBS="${MAX_CONCURRENT_JOBS:-}"
+  if ! [[ "$CONCURRENCY" =~ ^[1-9][0-9]*$ ]]; then
+    error "VERIFICATION_MAX_CONCURRENT_JOBS must be a positive integer"
+    return 1
+  fi
+  if [[ -n "$MAX_JOBS" ]]; then
+    if ! [[ "$MAX_JOBS" =~ ^[1-9][0-9]*$ ]]; then
+      error "MAX_CONCURRENT_JOBS must be a positive integer"
+      return 1
+    fi
+    (( MAX_JOBS < CONCURRENCY )) && CONCURRENCY="$MAX_JOBS"
   fi

As per path instructions, validate Bash changes using strict-mode sourcing.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
# Verification concurrency is intentionally lower than MAX_CONCURRENT_JOBS: block explorers
# rate-limit aggressively. Each verifyContract already retries with backoff on 429/gateway.
local CONCURRENCY=${VERIFICATION_MAX_CONCURRENT_JOBS:-4}
if [[ -n "$MAX_CONCURRENT_JOBS" && "$MAX_CONCURRENT_JOBS" -lt "$CONCURRENCY" ]]; then
CONCURRENCY=$MAX_CONCURRENT_JOBS
fi
# Verification concurrency is intentionally lower than MAX_CONCURRENT_JOBS: block explorers
# rate-limit aggressively. Each verifyContract already retries with backoff on 429/gateway.
local CONCURRENCY="${VERIFICATION_MAX_CONCURRENT_JOBS:-4}"
local MAX_JOBS="${MAX_CONCURRENT_JOBS:-}"
if ! [[ "$CONCURRENCY" =~ ^[1-9][0-9]*$ ]]; then
error "VERIFICATION_MAX_CONCURRENT_JOBS must be a positive integer"
return 1
fi
if [[ -n "$MAX_JOBS" ]]; then
if ! [[ "$MAX_JOBS" =~ ^[1-9][0-9]*$ ]]; then
error "MAX_CONCURRENT_JOBS must be a positive integer"
return 1
fi
(( MAX_JOBS < CONCURRENCY )) && CONCURRENCY="$MAX_JOBS"
fi
🤖 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/helperFunctions.sh` around lines 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.

Source: Path instructions

Comment thread script/helperFunctions.sh
Comment on lines +2634 to +2635
logContractDeploymentInfo "$CONTRACT" "$NETWORK" "$TIMESTAMP" "$VERSION" "$OPTIMIZER_RUNS" "$ARGS" "$ENVIRONMENT" "$ADDRESS" "true" "$SALT" "$SOLC_VERSION" "$EVM_VERSION" "$ZK_SOLC_VERSION"
OK=$((OK + 1))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

Do not report success when the deployment-log update fails.

logContractDeploymentInfo can return failure when MongoDB is unavailable, but the function still increments OK and may return success. Check its result and add the contract to FAILED; otherwise verification state remains stale despite a successful summary.

Proposed result handling
-      logContractDeploymentInfo "$CONTRACT" "$NETWORK" "$TIMESTAMP" "$VERSION" "$OPTIMIZER_RUNS" "$ARGS" "$ENVIRONMENT" "$ADDRESS" "true" "$SALT" "$SOLC_VERSION" "$EVM_VERSION" "$ZK_SOLC_VERSION"
-      OK=$((OK + 1))
+      if logContractDeploymentInfo "$CONTRACT" "$NETWORK" "$TIMESTAMP" "$VERSION" "$OPTIMIZER_RUNS" "$ARGS" "$ENVIRONMENT" "$ADDRESS" "true" "$SALT" "$SOLC_VERSION" "$EVM_VERSION" "$ZK_SOLC_VERSION"; then
+        OK=$((OK + 1))
+      else
+        FAILED+=("$CONTRACT ($ADDRESS): verified but log update failed")
+      fi
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
logContractDeploymentInfo "$CONTRACT" "$NETWORK" "$TIMESTAMP" "$VERSION" "$OPTIMIZER_RUNS" "$ARGS" "$ENVIRONMENT" "$ADDRESS" "true" "$SALT" "$SOLC_VERSION" "$EVM_VERSION" "$ZK_SOLC_VERSION"
OK=$((OK + 1))
if logContractDeploymentInfo "$CONTRACT" "$NETWORK" "$TIMESTAMP" "$VERSION" "$OPTIMIZER_RUNS" "$ARGS" "$ENVIRONMENT" "$ADDRESS" "true" "$SALT" "$SOLC_VERSION" "$EVM_VERSION" "$ZK_SOLC_VERSION"; then
OK=$((OK + 1))
else
FAILED+=("$CONTRACT ($ADDRESS): verified but log update failed")
fi
🤖 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/helperFunctions.sh` around lines 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.

Comment on lines +110 to +119
local DEFAULT_FUND_AMOUNT=1000000000000000 # 0.001 native; one cheap state-setting tx
local DO_FUND_OWNER=false
if [[ "${NON_INTERACTIVE:-}" == "true" ]]; then
echo "[info] NON_INTERACTIVE: auto-funding owner with default $DEFAULT_FUND_AMOUNT wei for the setAuthorizedCaller tx"
DO_FUND_OWNER=true
elif gum confirm "Fund owner with gas for the setAuthorizedCaller tx now?"; then
DO_FUND_OWNER=true
fi

if [[ "$DO_FUND_OWNER" == "true" ]]; then

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

Do not fund the owner on every non-interactive rerun.

NON_INTERACTIVE=true sets DO_FUND_OWNER=true regardless of OWNER_BALANCE. Until the manual authorization lands, every stage-10 rerun sends another 0.001 native token. Gate automatic funding on insufficient balance, or require an explicit funding opt-in.

Proposed balance gate
-  if [[ "${NON_INTERACTIVE:-}" == "true" ]]; then
+  if [[ "${NON_INTERACTIVE:-}" == "true" && "$OWNER_BALANCE" == "0" ]]; then
     echo "[info] NON_INTERACTIVE: auto-funding owner with default $DEFAULT_FUND_AMOUNT wei for the setAuthorizedCaller tx"
     DO_FUND_OWNER=true
+  elif [[ "${NON_INTERACTIVE:-}" == "true" ]]; then
+    echo "[info] NON_INTERACTIVE: owner already has native balance; skipping automatic funding"
   elif gum confirm "Fund owner with gas for the setAuthorizedCaller tx now?"; then
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
local DEFAULT_FUND_AMOUNT=1000000000000000 # 0.001 native; one cheap state-setting tx
local DO_FUND_OWNER=false
if [[ "${NON_INTERACTIVE:-}" == "true" ]]; then
echo "[info] NON_INTERACTIVE: auto-funding owner with default $DEFAULT_FUND_AMOUNT wei for the setAuthorizedCaller tx"
DO_FUND_OWNER=true
elif gum confirm "Fund owner with gas for the setAuthorizedCaller tx now?"; then
DO_FUND_OWNER=true
fi
if [[ "$DO_FUND_OWNER" == "true" ]]; then
local DEFAULT_FUND_AMOUNT=1000000000000000 # 0.001 native; one cheap state-setting tx
local DO_FUND_OWNER=false
if [[ "${NON_INTERACTIVE:-}" == "true" && "$OWNER_BALANCE" == "0" ]]; then
echo "[info] NON_INTERACTIVE: auto-funding owner with default $DEFAULT_FUND_AMOUNT wei for the setAuthorizedCaller tx"
DO_FUND_OWNER=true
elif [[ "${NON_INTERACTIVE:-}" == "true" ]]; then
echo "[info] NON_INTERACTIVE: owner already has native balance; skipping automatic funding"
elif gum confirm "Fund owner with gas for the setAuthorizedCaller tx now?"; then
DO_FUND_OWNER=true
fi
if [[ "$DO_FUND_OWNER" == "true" ]]; then
🤖 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/tasks/verifyERC20ProxyAuthorization.sh` around lines 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants