Repository navigation
docs(adr): FeeRouter interface block in ADR 016 §1 (#450 §A.2 + §B.4 + §C.1) - #458
Merged
Merged
Conversation
…+ §C.1)
Adds a formal `interface IFeeRouter { ... }` block as a new "#### Contract:
FeeRouter" subsection in ADR 016 §1, after "#### Tunable Economics" and
before "##### No proxy deployment patterns". Closes three §450 acceptance
bullets:
- §A.2 — formal interface block consolidating signatures previously
scattered across §1 classDiagram, §3 call table, ADR 026 §2 narrative,
and ADR 003 references
- §B.4 — tunability surface: setSharesAndDestinations(...) atomic
setter + per-knob setters (setShares, setVotingEscrow, etc.)
- §C.1 — zero-address dependency pattern documented in the constructor
notes and surfaced via the cross-validation invariant on setShares
Surface highlights:
- routeSettlement(operator, bytesDelivered, amount) — entry point.
- commitEpochReceiptRoot / commitEpochSummary — signature stubs;
full spec lives in ADR 027 §4 (PR 5).
- claimBoost / claimDelegator — return amount transferred for tooling;
reverts on epochs older than the 26-epoch window.
- executeDelegatorSwap(epoch, minOut) — keeper trigger on FeeRouter,
forwards to DelegatorBuyer (single Balancer V3 caller).
- sweepUnclaimed(epochs[]) — permissionless storage cleanup past the
claim window; matches pruneBlacklistedAssignment pattern.
- workingBytes / epochTotalWorkingBytes / gaugeBucket / delegatorBucket
— read views; off-chain bundling via Multicall3.
- setSharesAndDestinations(sharesBps[6], dests) — atomic activation
flip; per-knob setters for routine governance after wiring.
- pause() / unpause() — blocks routeSettlement + claims +
executeDelegatorSwap + sweepUnclaimed; commit functions stay open so
operators don't lose gauge eligibility during pauses.
- Per-knob setter events; SharesUpdated event for setShares.
Notes section pins the design choices: epochLength and claimWindow are
immutable; workingBytes returns per-operator only (caller bundles via
Multicall3); ReceiptSummary signature stubbed pending ADR 027 §4;
no initialize() helper; storage shape is implementation-defined.
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
There was a problem hiding this comment.
Code Review
This pull request adds the IFeeRouter interface to the contract interactions ADR, detailing the core logic for fee routing, receipt anchoring, and governance-controlled parameters. The feedback suggests ensuring that the documentation clearly distinguishes between operator-asserted and on-chain derived values and verifying that share calculations maintain logical consistency across the protocol.
1 of 3 tasks
Missing from the initial IFeeRouter block — `DelegatorBuyer` calls back into FeeRouter via `depositDelegatorTokens(epoch, amount)` after the Balancer V3 swap completes (per the §1 classDiagram and §3 call table already on main from #449, and per the IDelegatorBuyer block landing in PR 4 / #459). `msg.sender == delegatorBuyer` is the sole auth check — same single trust boundary pattern used in IDelegatorBuyer.swapDelegatorBucket (`msg.sender == feeRouter`). Adds matching `DelegatorTokensDeposited` event. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
This was referenced May 7, 2026
…iew) Address Gemini review on PR #458: explicitly note that getShares() returns the configured bucket-share percentages (governance-set, last updated via setShares / setSharesAndDestinations) rather than operator-asserted or per-epoch-derived values. Also pin the return-array ordering to match the setShares parameter order so off-chain consumers can index into the result without ambiguity. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
alpergundogdu
added a commit
that referenced
this pull request
May 7, 2026
- Fix two ADR 028 §6 cross-references to use the correct GFM anchor (#6-contract-surface). - Add MinBatchAmountUpdated and MaxBatchAmountUpdated events to ISafetyReserve, mirroring the per-setter event pattern used in IDelegatorBuyer and across the rest of the unified surface. The `#contract-feerouter` anchor in IDelegatorBuyer's swapDelegatorBucket comment is a forward reference to the heading PR #458 adds — it'll resolve once #458 merges. Keeping the anchor as-is rather than pointing at the existing `#feerouter` heading on main, which is the §6 Reentrancy Analysis subsection (different semantic target). Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Cross-PR audit caught two type/signature inconsistencies between PR #458 (IFeeRouter) and the canonical surface in ADR 027 §4 / the existing prose: 1. epoch type: ADR 027 §4 prose uses `uint64 epochId` consistently (in commitEpochReceiptRoot signature, EpochReceiptSummary.epochId field, MMR addressing). PR #458's IFeeRouter declarations used `uint256 epoch` everywhere — inconsistent with the canonical type and slightly costlier for calldata-array call sites (claimBoost, etc.). Aligned all 11 sites + 7 event declarations to `uint64 epochId`. 2. commitEpochSummary signature: ADR 027 §4 line 144 explicitly allows "the operator (or any third party)" to call commitEpochSummary, with the operator passed as a parameter. PR #458 had a 2-param shape (epoch, summary) implying msg.sender-as-operator only — would have blocked the third-party-relay path. Changed to the 3-param canonical shape: commitEpochSummary(address operator, uint64 epochId, ReceiptSummary calldata summary). (commitEpochReceiptRoot stays msg.sender-keyed per ADR 027 §4 line 118 "the caller is recorded as the credited operator" — the root commit is self-authorising; only the summary submission has the third-party path.) Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
alpergundogdu
added a commit
that referenced
this pull request
May 7, 2026
…R_ROLE (audit fix) Cross-PR audit caught two issues in PR #459's surface: 1. epoch type: IDelegatorBuyer.swapDelegatorBucket and the DelegatorSwapped event used `uint256 epoch`, inconsistent with the canonical `uint64 epochId` used in ADR 027 §4 prose and now in IFeeRouter (#458 audit fix). Aligned both. 2. SLASH_INFLOW_REPORTER_ROLE undeclared in ADR 016 §5: PR #459 introduced this role on ISafetyReserve.recordSlashInflow but didn't add the corresponding row to the access control matrix. Added — mirrors SETTLEMENT_REPORTER_ROLE pattern (grant to StakingRegistry post-deploy). 3. KEEPER_ROLE row updated to remove DelegatorBuyer (the planning decision was msg.sender == feeRouter as the sole auth check on DelegatorBuyer.swapDelegatorBucket — not a KEEPER_ROLE) and add SafetyReserve.swapAccumulatedTokens. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
…onical (audit fix) Cross-PR audit caught struct + event-shape divergence between PR #458 (IFeeRouter) and PR #460 (ADR 027 §4 canonical): 1. struct ReceiptSummary -> EpochReceiptSummary, with the canonical five fields (operator, epochId, claimedBytes, claimedDistinctClients, aggregateRoot). PR #458's two-field stub (distinctClientCount, totalBytes) used the wrong field names AND the wrong types (claimedDistinctClients is uint32 per ADR 027 §4 line 141, not uint256) AND was missing aggregateRoot. 2. EpochReceiptRootCommitted event: added leafCount field (the MMR's current depth). Matches the PR #460 declaration in ADR 027 §4 § Events so indexers don't have to chain prior events to reconstruct MMR state. 3. EpochSummaryCommitted event: renamed fields to claimedBytes / claimedDistinctClients (canonical), changed claimedDistinctClients to uint32 to match the storage type, added aggregateRoot field. The struct is mirrored (not imported) so IFeeRouter is self-contained in ADR 016 — but the canonical layout pointer to ADR 027 §4 is preserved as the source of truth in case the layout changes during the surface lock-down (#451). Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
alpergundogdu
added a commit
that referenced
this pull request
May 7, 2026
… + §A.4 + §B.6) (#459) * docs(adr): SafetyReserve + DelegatorBuyer interface blocks (#450 §A.3 + §A.4 + §B.6) ADR 026 §5: adds "#### Contract: SafetyReserve" subsection with the formal interface block consolidating signatures previously scattered across ADR 016 §1, ADR 026 §5 prose, and ADR 028 §123 stubs. ADR 026 §6: adds "#### Contract: DelegatorBuyer" subsection. Both implementation choices (parallel contract vs BuybackBurner multi-output mode) ship the same interface; the choice stays deferred per ADR 016 §1. Surface highlights: ISafetyReserve: - payout(bytes32 bundle, address recipient, uint256 usdcAmount) — single entry point. usdcAmount is named explicitly to encode the USDC-only payout constraint (TOKEN inflow gets swapped before becoming available). - Incident struct: bundle, recipient, usdcAmount, paidAt, paidBy, reason (enum: OutageRestitution, SlashAppealRatification, ProtocolHack, MisattributionFix, Other). Lets indexers reconstruct without aux state. - recordSlashInflow(operator, amount) — SLASH_INFLOW_REPORTER_ROLE-gated callback from StakingRegistry; new role mirrors SETTLEMENT_REPORTER_ROLE. Resolves §B.6. - swapAccumulatedTokens(amountIn, minOut) — KEEPER_ROLE per-call batch swap of accumulated TOKEN to USDC. Per-call shape lets keepers MEV-sequence; bounded by min/maxBatchAmount. - Appeal extension stubs (openSlashAppeal, fastTrackAppeal, rejectAppeal, ratifyAppeal, reverseAppeal) — signatures only; full state machine and window timing live in ADR 028 §6 and finalize under #451. - Full event set including Paid, SlashInflowRecorded, SwapExecuted, the five appeal-state events, and per-setter Updated events. - Pause blocks payout + swap; recordSlashInflow stays open so slashing accounting is never lost. IDelegatorBuyer: - swapDelegatorBucket(epoch, amountIn, minOut) — msg.sender == feeRouter is the sole auth check (single trust boundary, no KEEPER_ROLE on DelegatorBuyer needed). After Balancer swap, deposits resulting TOKEN back via IFeeRouter.depositDelegatorTokens. - Standard governance setters (setFeeRouter, setPool, slippage, batch bounds), pause/unpause, full event set. - Notes pin the deferred implementation choice and the §97 carve-out application for setFeeRouter. depositDelegatorTokens callback on FeeRouter is referenced in IDelegatorBuyer's prose but not added to IFeeRouter here — that fix lands on PR 3 (#458) directly since IFeeRouter is its scope. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> * docs(adr): address PR #459 review comments - Fix two ADR 028 §6 cross-references to use the correct GFM anchor (#6-contract-surface). - Add MinBatchAmountUpdated and MaxBatchAmountUpdated events to ISafetyReserve, mirroring the per-setter event pattern used in IDelegatorBuyer and across the rest of the unified surface. The `#contract-feerouter` anchor in IDelegatorBuyer's swapDelegatorBucket comment is a forward reference to the heading PR #458 adds — it'll resolve once #458 merges. Keeping the anchor as-is rather than pointing at the existing `#feerouter` heading on main, which is the §6 Reentrancy Analysis subsection (different semantic target). Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> * docs(adr): align epoch type to uint64 + register SLASH_INFLOW_REPORTER_ROLE (audit fix) Cross-PR audit caught two issues in PR #459's surface: 1. epoch type: IDelegatorBuyer.swapDelegatorBucket and the DelegatorSwapped event used `uint256 epoch`, inconsistent with the canonical `uint64 epochId` used in ADR 027 §4 prose and now in IFeeRouter (#458 audit fix). Aligned both. 2. SLASH_INFLOW_REPORTER_ROLE undeclared in ADR 016 §5: PR #459 introduced this role on ISafetyReserve.recordSlashInflow but didn't add the corresponding row to the access control matrix. Added — mirrors SETTLEMENT_REPORTER_ROLE pattern (grant to StakingRegistry post-deploy). 3. KEEPER_ROLE row updated to remove DelegatorBuyer (the planning decision was msg.sender == feeRouter as the sole auth check on DelegatorBuyer.swapDelegatorBucket — not a KEEPER_ROLE) and add SafetyReserve.swapAccumulatedTokens. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> * docs(adr): add SLASH_INFLOW_REPORTER_ROLE grant to post-deploy step 3 Audit follow-up to 331a363. The SLASH_INFLOW_REPORTER_ROLE row was added to ADR 016 §5, but the corresponding grant call was missing from the "Post-Deployment Initialization" sequence — leaving auditors unable to verify when/where this role gets bound. Pairs the SafetyReserve.grantRole(SLASH_INFLOW_REPORTER_ROLE, stakingRegistry) call into post-deploy step 3 (alongside the SLASH_ROLE grant), matching the security-pairing pattern called out in the "Deployment atomicity" note. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> --------- Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
1 of 4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Third slice of #450. Closes three acceptance bullets — §A.2, §B.4, §C.1 — by consolidating the
IFeeRoutersurface into a single canonical interface block.Adds a "#### Contract: FeeRouter" subsection in ADR 016 §1, between "#### Tunable Economics" and "##### No proxy deployment patterns". Signatures previously scattered across the §1
classDiagram, §3 call table, ADR 026 §2 narrative, and ADR 003 references now live in one place.What's in the block
routeSettlement(operator, bytesDelivered, amount)commitEpochReceiptRoot,commitEpochSummaryclaimBoost(epochs[]),claimDelegator(epochs[])executeDelegatorSwap(epoch, minOut),sweepUnclaimed(epochs[])workingBytes,epochTotalWorkingBytes,gaugeBucket,delegatorBucket,getShares,votingEscrow,safetyReserve,delegatorBuyer,buybackBurner,treasury,boostFloorsetSharesAndDestinations(sharesBps[6], ShareDestinations)setShares,setVotingEscrow,setSafetyReserve,setDelegatorBuyer,setBuybackBurner,setTreasury,setBoostFloorpause,unpauseDecisions baked in (per planning conversation)
executeDelegatorSwap(epoch, minOut)on FeeRouter; FeeRouter forwards to DelegatorBuyer internallysetSharesAndDestinations) and per-knob setters; atomic for activation flips, per-knob for routine maintenancerouteSettlement+ claims + swap + sweep;commitEpochReceiptRoot/commitEpochSummarystay open so operators don't lose gauge eligibility;StablePaymentChannel.closeChannel/disputeChannelare unaffected (independent contract)workingBytesshapereturns (uint256); off-chain bundles withepochTotalWorkingBytesvia Multicall3sweepUnclaimed(epochs[]); matchespruneBlacklistedAssignmentpatterninitialize(...)helpersetSharesAndDestinationsis sufficientCross-references resolved
setVotingEscrow/setSafetyReserve/setDelegatorBuyer/setBuybackBurner/setTreasurysetters referenced from ADR: unify contract surface; drop PoC/Production phasing in favor of tunable economics #449's § Tunable Economics and § No proxy deployment patterns carve-out are now formally declared.ReceiptSummarystruct is forward-declared with the known fields; ADR 027 §4 (PR 5) will finalize the layout.boostFloorgetter andsetBoostFloorsetter pin the ADR 026 §11 governable range as[2000, 8000]in 4-decimal fixed-point.Out of scope
commitEpochReceiptRoot/commitEpochSummaryfull spec — signatures only here, full spec in ADR 027 §4 (PR 5)StakingRegistry → SafetyReserveredirect signature (PR 4)Test plan
pre-commit run --files adr/016-contract-interactions.mdclean[§ Tunable Economics]and[§ No proxy deployment patterns]cross-references still resolve after the section was inserted between them[ADR 026 §11]and[ADR 027 §4]cross-references in the block link to the right anchorsRelated
IStakingRegistry), docs(adr): VotingEscrow interface block in ADR 026 §4 (#450 §A.1) #456 (IVotingEscrow)🤖 Generated with Claude Code