Repository navigation
docs(adr): align ADR 016 contract tables with shipped contracts; correct the Balancer V3 approval target - #1570
Conversation
…hipped contracts Add the deployed Ed25519Verifier to the contract inventory and the deployment order, renumbering the constructor-dependency steps so the sequence is executable. Correct the CapacityBond, FeeRouter, and ContentBlacklist constructor rows against the shipped Solidity, describe the BuybackBurner class hierarchy, and document CapacityBond's operator-terms acceptance mechanism. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
|
Warning Review limit reached
Next review available in: 55 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 (4)
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.
Pull request overview
This PR updates ADR 016 to bring its contract inventory, deployment order, constructor dependency tables, and cross-contract call references back in sync with the shipped Solidity contracts, so the ADR remains a reliable audit reference.
Changes:
- Expands/updates constructor dependency documentation (notably for CapacityBond, FeeRouter, ContentBlacklist) and adds an Ed25519Verifier deployment step.
- Adds an “Operator-terms acceptance” section describing CapacityBond’s
currentTermsHashmechanism and governance control (setCurrentTermsHash). - Updates call graph / call tables and role/parameter tables to reflect the new/updated dependencies and surfaces.
Suppressed comments (1)
adr/016-contract-interactions.md:458
- This call-table note repeats the same incorrect claim about self-approving the Vault. In the shipped
BuybackBurnerBalancerV3, the Router pullstokenInvia Permit2 and the Vault is used for pool/state reads; there is no direct Vault allowance/approval path.
| BuybackBurner | Balancer V3 Router | `swapSingleTokenExactIn(pool, tokenIn, tokenOut, exactAmountIn, minAmountOut, deadline, wethIsEth, userData)` | `BuybackBurner` self-approves the **Balancer V3 Vault** address (NOT the Router) during its initialization — the Vault pulls input tokens from the `msg.sender` of the Router call. This is the V3 footgun; see [ADR 018 § Buyback execution via Balancer V3](018-liquidity-strategy.md#buyback-execution-via-balancer-v3) | Yes |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…Permit2 ADRs 003, 016, and 018 all documented BuybackBurner as self-approving the Balancer V3 Vault, with ADR 018 carrying it as a titled "approvals footgun" that ADR 016 cites as the authority. The shipped BuybackBurnerBalancerV3 does the opposite: the Router pulls tokenIn through permit2.transferFrom, so _swap approves in two scoped legs (usdc.forceApprove(permit2, amountIn), then permit2.approve(usdc, swapRouter, amountIn, block.timestamp)) and resets both to zero afterwards. The Vault is never an approval target — balancerVault is read-only for isPoolRegistered, getStaticSwapFeePercentage, and the scaled-18 leg balances behind the TWAP. Corrected in all eight places, plus two adjacent drifts found while fixing it: the base BuybackBurner stores only USDC and TOKEN (not the Vault and pool), and the ADR 016 constructor row omitted admin, vault_, permit2_, and the GuardParams band. Documentation only — no contract, script, or Rust code is touched. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Response to the Copilot reviewOne finding, and it was correct. Both the inline comment on The finding
usdc.forceApprove(address(permit2), amountIn);
permit2.approve(address(usdc), address(swapRouter), uint160(amountIn), uint48(block.timestamp));
tokenOut = swapRouter.swapSingleTokenExactIn(...);
permit2.approve(address(usdc), address(swapRouter), 0, 0);
usdc.forceApprove(address(permit2), 0);The Router pulls Scope of the fixThe claim was in three ADRs, eight places — and ADR 016 cited the worst instance as its authority. ADR 018 § Buyback execution carried it as a titled "Approvals footgun — the contract approves the Vault" paragraph. Fixing only the two lines flagged would have left a corrected ADR 016 pointing at an uncorrected source, so all three are corrected together:
Two adjacent drifts turned up while fixing it and are in the same commit:
Note on the review summaryThe overview above predates this commit and describes five changes. There are now six: the PR title and body have been updated, and the "Follow-up spotted, not fixed here" section — which flagged exactly this issue and deferred it — is gone, because it is now fixed here. Verification
|
… oversized cells Review of #1570 confirmed every factual claim it adds against contracts/src/, and found no surviving instance of the old Vault-approval error. It also found three defects, fixed here. Correctness: - adr/036:193 said "Deployment Order step 13 (DecdnGovernor)". Inserting Ed25519Verifier as step 4 shifted the Governor to 14. This PR broke it and check-refs cannot catch bare step numbers, so CI stayed green. It was the only external reference to ADR 016's numbering. - Deployment row 7 named BuybackBurner, which is abstract and undeployable, and sat in a slot implying it ships with the mandatory pipeline. It does not: it is deployed only under genesis activation (off by default), after the Governor. ADR 016's own prose already said so. The row now names the concrete venue bindings and marks the slot a dependency position, not a wall-clock one. Deliberately not renumbered — renumbering caused the break above. - The currentTermsHash paragraph stated registration-only enforcement without ADR 019's caveat that this does not freeze an operator's obligations at the version they signed. Added, and the duplicated governance-norm sentence dropped in favour of pointing at ADR 019. Readability: rows 307 (225w) and 308 (173w) had grown past the table's prior maximum and carried bolded pseudo-headings. Extracted to BuybackBurner and FeeRouter construction-notes subsections, following the OriginAssignment precedent already in the file. Inventory rows 27 and 32 trimmed likewise. Consistency: the Permit2 mechanism was written out in full in five places, all of which already cross-linked ADR 018 as the authority. Reduced to one authoritative explanation plus pointers, on a single name ("scoped per-swap Permit2 approval") and a single reset spelling. Also swept, pre-existing: the Mermaid OA --> CB edge was solid for a non-dependency while the analogous FR -.-> BB is dotted; 018:179 pointed its Permit2 reference at a section with no Permit2 text; 018:113 described the executeBuyback precondition without naming PoolNotWired or the Vault leg; two ADR 003 links named a section title that does not exist. Documentation only — no contract, script, or Rust code is touched. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Gas snapshotNo gas changes vs base. |
Contracts coverageLine coverage: 89.80% (2597/2892 lines) |
Coverage reportTotal: 80.16% (was 80.15%, ● 0.00%) — 56271/70202 lines No Rust files changed in this PR. History
|
ADR 016's Contract Inventory and Constructor Dependencies tables are the single reference for security audits, so they have to match the shipped Solidity. Five places had drifted. Review surfaced a sixth — the Balancer V3 approval target, which spans ADR 003 and ADR 018 as well — plus three defects found by a verification pass over the PR itself. Documentation only: no contract, script, or Rust code is touched.
What changed
1. CapacityBond constructor + terms acceptance. The row now lists all nine constructor arguments, including
currentTermsHash, and notes that the zero sentinel revertsZeroTermsHashso a terms-disabled deployment is unreachable. A new§ Operator-terms acceptancesubsection covers the mechanism:registerNoderevertingTermsHashMismatch, the EIP-712 registration signature carryingtermsHash, theTermsAcceptedrecord, theGOVERNANCE_ROLE-gatedsetCurrentTermsHash, and why the parameter carries no numeric safety rail.setCurrentTermsHashis also added to theGOVERNANCE_ROLErole-assignment row, the Governor→CapacityBond call-table row, and the Governance-Controlled Parameters table.2. FeeRouter constructor. The row now lists
capacityBondandwindowEpochs. The constructor readsCapacityBond.epochLength()once, revertsEpochLengthMismatchunless it equals the passedepochLength, then drops the reference — a deploy-time dependency, not a stored one — andwindowEpochsis bounds-checked[4, 26]. The deployment-order graph gains the matchingFeeRouter → CapacityBondedge, previously invisible.3. ContentBlacklist constructor. The pinned signature is now the real one,
ContentBlacklist(ICapacityBondEjector capacityBond, address admin), with both arguments zero-rejected and the admin receivingDEFAULT_ADMIN_ROLE+GOVERNANCE_ROLE.4. Ed25519Verifier. The contract gains an inventory row and a deployment step at 4, immediately before CapacityBond, whose constructor takes its address and rejects zero; steps 4–13 shift to 5–14. It also gains a Cross-Contract Call Graph edge and call-table row for the
verifycall CapacityBond makes inregisterNode/bindNodeId/reclaimNodeId, and the OZAccessControlusage row is corrected to exclude it.5. BuybackBurner inventory row. The row now describes the shipped three-layer hierarchy: the abstract venue-neutral
BuybackBurnerbase onSunsettingPausable, the abstractGuardedBuybackBurnerMEV-defense layer, and the concreteBuybackBurnerBalancerV3/BuybackBurnerUniswapV3venue bindings.6. Balancer V3 approval target — the Vault is not one. All three ADRs documented
BuybackBurneras self-approving the Balancer V3 Vault, and ADR 016 cited the worst instance as its authority: ADR 018 § Buyback execution carried it as a titled "Approvals footgun — the contract approves the Vault" paragraph. The shippedBuybackBurnerBalancerV3._swapdoes the opposite — the Router pullstokenInthroughpermit2.transferFrom, so each swap approves in two scoped legs and resets both to0afterwards.balancerVaultis read-only:isPoolRegistered,getStaticSwapFeePercentage, and the scaled-18 leg balances behind the TWAP. Correcting ADR 016 alone would have pointed a fixed claim at an unfixed source, so all eight occurrences are corrected together.Review fixes
A verification pass over this PR (ADR 016 claims against
contracts/src/, the Permit2 correction plus a corpus-wide sweep, and ASD-STE100 compliance) confirmed every substantive claim the PR adds and found no surviving instance of the old Vault claim. It also found three defects, fixed in 0d866cb:Stale cross-ADR step reference — introduced by this PR.
adr/036-served-bytes-voting-weight.md:193said "Deployment Order step 13 (DecdnGovernor)". Inserting Ed25519Verifier as step 4 shifted the Governor to 14.make -C adr check-refsvalidates anchors, not bare step numbers, so CI stayed green on a wrong reference. It was the only external reference to ADR 016's numbering.Deployment row 7 named an abstract contract in a mandatory-looking slot.
BuybackBurnerisabstract(BuybackBurner.sol:42) and undeployable, while item 5 above now labels it so and the row body describesBuybackBurnerBalancerV3'sConfig. The burner is also not in the main pipeline: it deploys only underif (act.activate)(off by default) after the Governor — which ADR 016's own prose at:388already said. The row now names the concrete bindings and marks position 7 a dependency slot, not a wall-clock one. Deliberately not renumbered, since renumbering caused the finding above.§ Operator-terms acceptanceomitted a caveat ADR 019 makes explicit — that registration-only enforcement does not freeze an operator's obligations at the version they signed. Added, with the duplicated governance-norm sentence dropped in favour of pointing at ADR 019.Also applied: rows
:307(225w) and:308(173w) had grown past the table's prior maximum, so they were extracted to construction-notes subsections following theOriginAssignmentprecedent already in the file (→ 82w and 77w); the Permit2 mechanism was written out in full in five places that all already cross-linked ADR 018, so it is reduced to one authority plus pointers on a single term; and four pre-existing one-liners were swept (a solid Mermaid arrow for a non-dependency, a Permit2 reference pointing at a section with no Permit2 text, an unnamedPoolNotWiredprecondition, and two ADR 003 links naming a section title that does not exist).The rows the issue verified clean — SlashAppeal, SlashJudge, PaymentChannel, PublisherRegistry constructors, the ADR 009/002 bounds, and the SunsettingPausable deadline — are untouched.
Verification
pre-commit run --filespasses on all four ADRs, and full CI is green. Becausecheck-refscannot see bare step numbers, that class is checked separately withgrep -rn "step 1[0-4]\b" adr/*.md. Every claim was read back againstcontracts/src/.Follow-up
#1579 tracks three related pieces of drift outside this PR's scope, all fallout from the venue-neutral burner refactor: ADR 003's flat "canonical
BuybackBurnerinterface" table (which listssetVault, a Balancer-only method), the approvals footgun missing fromadr/appendix-l2-deployment.mddespite ADR 018 requiring it, andIBuybackBurnerbeing referenced in two places without existing.Closes #1557
🤖 Generated with Claude Code