Repository navigation
docs(adr): full receipt-anchoring spec in ADR 027 §4 (#450 §B.3) - #460
Merged
Merged
Conversation
Most of ADR 027 §4 was already detailed (signatures, MMR storage, msg.sender keying, trust-then-challenge model, EpochReceiptSummary fields). This PR fills in the gaps that #450 §B.3 surfaced: ADR 027 §4 additions: - "Timing windows" subsection pinning the four lifecycle deadlines to concrete defaults: epochLength (1w, immutable), summaryWindow (7d, governable), challengeWindow (7d, governable), claimWindow (26 epochs, governable). Single deadline (epochEnd + summaryWindow) seals both commitEpochReceiptRoot and commitEpochSummary; challenge and claim windows open at the same moment so claimers and challengers see consistent state. - "View surface" subsection declaring the FeeRouter views needed for off-chain claim simulation and challenger tooling: epochEnd(epochId), currentEpoch(), epochSummary(operator, epochId), epochReceiptRoot (during accrual), and three window predicates. - "Storage shape" subsection laying out the three-phase state evolution (accrual → finalisation → settled) and noting that struct packing vs parallel mappings is implementation-defined. - "Events" subsection declaring EpochReceiptRootCommitted (per-write, including overwrites), EpochSummaryCommitted (once at finalisation), and EpochSummaryChallenged (once per successful challenge with zeroing flags). ADR 026 §3 cross-reference: clarifies that bytes_i in the gauge formula is sourced from EpochReceiptSummary.claimedBytes after the ADR 027 §4 challenge window closes. Decisions baked in (per planning conversation): - Epoch finalisation: timestamp-based (epochEnd + summaryWindow seals both commit and summary) - ReceiptSummary fields: keep claimedBytes + claimedDistinctClients as the only operator-asserted fields (already specified) - msg.sender-keyed commit (already specified in §4) - Trust-then-challenge anti-griefing (already specified) - Storage shape: implementation-defined; consolidated state exposed via epochSummary view Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
1 of 3 tasks
There was a problem hiding this comment.
Code Review
This pull request updates ADR 026 and ADR 027 to specify the timing windows, storage lifecycle, and Solidity interface for the receipt-anchoring and gauge-boost mechanisms. It defines deadlines for committing receipts and summaries, as well as the challenge and claim windows. Review feedback suggests improving timestamp consistency by explicitly including the genesis base in window definitions and clarifying that MMR operations are appends rather than overwrites to ensure technical accuracy.
- Include genesisTimestamp in the commitEpochReceiptRoot opening-time formula for consistency with epochEnd's formula. Avoids ambiguity about the base reference. - Reframe EpochReceiptRootCommitted event semantics to match the append-only MMR model documented in §"Storage shape": each call APPENDS a leaf; the latest event reflects the current MMR root and leaf count. Drops the misleading "overwrites" framing. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
…indows Cross-PR audit caught a forward reference that doesn't resolve: PR #460 claimed `summaryWindow` and `challengeWindow` are "governable per ADR 026 §11", but ADR 026 §11's safety-bounds table only covers the six FeeRouter shares + `boostFloor` — those receipt-anchoring parameters aren't there. Reframe as: governable through standard governance proposal under the ADR 009 48 h TimelockController delay; concrete bounds will be pinned during the ADR 026 / 027 / 028 surface lock-down (#451) and added to ADR 026 §11 at that time. This is honest about what's not yet specified rather than implying a spec exists that doesn't. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
alpergundogdu
added a commit
that referenced
this pull request
May 7, 2026
…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
…+ §C.1) (#458) * docs(adr): FeeRouter interface block in ADR 016 §1 (#450 §A.2 + §B.4 + §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]> * docs(adr): add depositDelegatorTokens callback to IFeeRouter 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]> * docs(adr): clarify getShares() returns governance-set state (#458 review) 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]> * docs(adr): align epoch type to uint64 in IFeeRouter (audit fix) 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]> * docs(adr): also fix Settled event epoch type (uint256 -> uint64) * docs(adr): align IFeeRouter ReceiptSummary + events to ADR 027 §4 canonical (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]> --------- 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
Fifth slice of #450. Closes §B.3 — the full
commitEpochReceiptRoot/commitEpochSummaryspec in ADR 027 §4.Most of §4 was already detailed: signatures, MMR storage,
msg.sender-keyed commit, trust-then-challenge model,EpochReceiptSummaryfields. This PR fills in the four gaps #450 §B.3 surfaced — concrete timing windows, view surface, storage-shape clarity, and event signatures — plus a one-line cross-reference in ADR 026 §3 pinning wherebytes_icomes from on-chain.What's added
ADR 027 §4 — four new subsections:
commitEpochReceiptRootandcommitEpochSummaryto the singleepochEnd + summaryWindowdeadline; challenge + claim windows open at the same moment so claimers and challengers see consistent stateFeeRouterviews needed for off-chain simulation and challenger tooling:epochEnd(epochId),currentEpoch(),epochSummary(operator, epochId),epochReceiptRoot(during accrual),epochReceiptCount, plus three window predicatesEpochReceiptRootCommitted(per-write, including pre-finalisation overwrites),EpochSummaryCommitted(once at finalisation),EpochSummaryChallenged(once per successful challenge, surfaces both zeroing flags for indexers)ADR 026 §3 — one-line cross-reference:
Clarifies that
bytes_iin the gauge formula is sourced fromEpochReceiptSummary.claimedBytesafter the ADR 027 §4 challenge window closes; a successful challenge zeros that field and gauge share collapses to zero accordingly.Timing summary (the load-bearing addition)
commitEpochReceiptRootepochEnd + summaryWindowcommitEpochSummaryepochEndepochEnd + summaryWindowepochEnd + summaryWindow+ challengeWindowepochEnd + summaryWindow+ claimWindowDefaults:
epochLength = 1w(immutable),summaryWindow = 7d(governable),challengeWindow = 7d(governable),claimWindow = 26 epochs(governable).Decisions baked in (per planning conversation)
epochEnd + summaryWindowseals both commit and summary)ReceiptSummaryfieldsclaimedBytes+claimedDistinctClientsplusaggregateRootmsg.sender-keyedChallengeReceiptSummaryepochEnd/currentEpochviewsepochSummaryviewEpochReceiptRootCommittedfires on every commit (including overwrites); latest event reflects current MMR stateOut of scope
OriginAssignmentedge cases (PR 6, ADR 011)PublisherRegistrycap/timelock setters (PR 6, ADR 002)Test plan
pre-commit run --files adr/027-distinct-client-receipts.md adr/026-gauge-boost-tokenomics.mdcleanRelated
IStakingRegistry), docs(adr): VotingEscrow interface block in ADR 026 §4 (#450 §A.1) #456 (IVotingEscrow), docs(adr): FeeRouter interface block in ADR 016 §1 (#450 §A.2 + §B.4 + §C.1) #458 (IFeeRouter), docs(adr): SafetyReserve + DelegatorBuyer interface blocks (#450 §A.3 + §A.4 + §B.6) #459 (ISafetyReserve+IDelegatorBuyer)OriginAssignmentedge cases +PublisherRegistrycap/timelock setters in ADR 011 + ADR 002🤖 Generated with Claude Code