fix(deploy): treat a failed diamond registration as a network-level deploy failure - #2135
fix(deploy): treat a failed diamond registration as a network-level deploy failure#21350xDEnYO wants to merge 2 commits into
Conversation
deployContractToNetworks.sh reported a network as "OK" (exit 0) when the contract was deployed but never registered in the diamond, so a half-finished production rollout was indistinguishable from a complete one. - diamondUpdatePeriphery now returns non-zero when a registration fails, and its failure flag is sticky across contracts - deployAndAddContractToDiamond requires BOTH the deploy and the registration to succeed (was ||) - deployFacetAndAddToDiamond sources diamondUpdateFacet.sh instead of relying on the caller having sourced script/tasks/*.sh - the worker writes FAILED to its result file, so SUMMARY marks the network FAILED and the script exits 1 - deployAllContracts stage 7 no longer prints "completed" after a failure Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
Warning Review limit reached
Next review available in: 48 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 (6)
✨ Finishing Touches🧪 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 |
🔍 QA Review — EXSC-713 (Post-Approval Re-Review — Run #29)Ticket: EXSC-713 — Fail network deploy when diamond registration fails
Post-Approval Commit Reviewed
Code ReviewThis commit adds exactly one test to it('stays failed when an earlier contract fails and a later one succeeds', () => {
expect(runHarness(batchHarness)).toBe('rc=1')
})The This is precisely the test gap identified in the original review (Run #22):
The harness correctly uses 🛡️ Audit StateNo ✅ Verdict: Pass (Post-Approval Re-Review)Commit QA re-review by lifi-qa-agent[bot] — Run #29 · 2026-07-31 |
There was a problem hiding this comment.
QA Pass — all five fix points correctly implemented and verified. Two low-severity observations noted in the full QA comment (missing batch-path test for sticky LAST_CALL; deployAllContracts stage 7 failure not propagated to function exit code — both intentional by design). No security surface affected.
A later contract's successful registration must not mask an earlier contract's failure when diamondUpdatePeriphery runs with UPDATE_ALL=true. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
@coderabbitai review |
✅ Action performedReview finished.
|
Which Linear task belongs to this PR?
https://linear.app/lifi-linear/issue/EXSC-713/fail-network-deploy-when-diamond-registration-fails
Why did I implement it this way?
Observed 2026-07-28 deploying
OutputValidatorv1.0.0 torobinhood(production): the CREATE3 deploy and Blockscout verification succeeded, butdiamondUpdatePeripheryexhausted all 5 retries because the Safe MongoDB tunnel was down, so no Safe proposal was created. The log said:…yet the run still ended with
robinhood: OK (0x321E…56AB)andDEPLOY_EXIT=0. A production rollout that is on-chain but unregistered was indistinguishable from a complete one for anything driving the script non-interactively (CI, thedeploy-contract/multisig-rolloutskills).Three independent gaps had to close for the failure to reach the exit code:
script/tasks/diamondUpdatePeriphery.shnever returned its failure.LAST_CALLwas tracked but the function fell off the end after anecho, so it always returned 0. It is now returned, and made sticky (LAST_CALLis only ever set to 1) — previously a later contract's success overwrote an earlier contract's failure in the multi-contract loop.register()also got an explicitreturn 0on its success path.deployAndAddContractToDiamond(script/helperFunctions.sh) combined the two step results with||, so a successful deploy alone was enough to report success. Changed to&&. The other||uses ofRETURN_CODE1/2in that file are display-only functions (printDeploymentsStatus*) and were deliberately left alone.deployToNetworkWorker(script/deploy/deployContractToNetworks.sh) was already propagating the return code correctly, so it inherits the fix; it now also writesFAILEDto its result file rather than leaving it absent, so the SUMMARY distinguishes a failed network from a worker killed mid-deploy. The network is markedFAILEDand the script exits 1.Facet path check (as asked):
diamondUpdateFacetpropagates its return code correctly, anddeployFacetAndAddToDiamondchecks it — so the periphery-style masking does not exist there. It did have the related known bug that it sourcesdiamondUpdatePeriphery.shbut notdiamondUpdateFacet.sh, so the cut only worked when the caller happened to sourcescript/tasks/*.sh(whichdeployContractToNetworks.shdoes, and other callers do not). That source is now added.Adjacent one-liner:
deployAllContracts.shstage 7 discarded the (previously meaningless) return code and printedSTAGE 7 completedunconditionally. It now warns instead. Control flow is unchanged — that script has noset -eand the bring-up flow is interactive.Tests:
script/deploy/deployRegistrationPropagation.test.ts(9 cases) sources each real shell function with stubbed dependencies and asserts return-code propagation, plus the result-file contents and thatdiamondUpdateFacet.shis sourced. All four fixed behaviours were confirmed to fail againstorigin/main's versions of these functions before the fix.Checklist before requesting a review
Checklist for reviewer (DO NOT DEPLOY and contracts BEFORE CHECKING THIS!!!)