Repository navigation
feat!: split governance and payment chains (contracts, node, client, CLI, sponsord) - #2904
Merged
alpergundogdu merged 25 commits intoNov 17, 2026
Conversation
…ceive gas A standard-transfer message carries expirationBlock 0, so an attested sweep stays receivable indefinitely and Circle refuses to re-attest it. Verified on Arbitrum Sepolia -> Ethereum Sepolia. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…alance delta Deployed TokenMessengerV2 has no getMinFeeAmount, so the pool reads it when present and uses 0 otherwise. FeeRouter measures U as its USDC balance rise, so a non-USDC burn credits nothing, and drops the sender check that the messenger already enforces. sweep resets pending before the CCTP call. Co-Authored-By: Claude Opus 5.5 <[email protected]>
FeeRouter knows no bridge. CctpSweepReceiver is the CCTP V2 adapter on the governance chain; PaymentPool sweeps to it (sweepRecipient, sweepDomain). A new bridge is a new adapter plus a PaymentPool variant, with no FeeRouter change. Documents the clamp-fill cost that an open deposit implies. Co-Authored-By: Claude Opus 5.5 <[email protected]>
FeeRouter takes sweeps through a permissionless deposit: rebate to an active operator, buyback and treasury legs, a USDC-backed weight credit clamped to declared capacity in the arrival epoch. CctpSweepReceiver receives a CCTP V2 sweep, measures the minted USDC and deposits it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ce-chain deploy split PaymentPoolBase holds the voucher pool with no governance, roles or bond reads: redeemMany pays operatorBps same-tx and accrues the rest in pending; sweep is permissionless and resets pending before the bridge call. The CCTP PaymentPool burns to the governance-chain CctpSweepReceiver with maxFee from getMinFeeAmount when present. disputeWindow is uint32 so the close deadline cannot wrap. DeployProtocol deploys the governance-chain set plus the receiver; DeployPaymentPool deploys a pool per payment chain. LoopbackCctp (testnet/) plays CCTP on one local chain for dev-deploy.sh and the e2e; a CI gate keeps it out of src/ and script/. Co-Authored-By: Claude Opus 5.5 <[email protected]>
vm.setEnv is process-wide and suites run in parallel. Co-Authored-By: Claude Opus 5.5 <[email protected]>
alpergundogdu
force-pushed
the
claude/governance-payment-chain-split-e69718
branch
from
November 16, 2026 11:21
7812c3c to
c7fc121
Compare
Co-Authored-By: Claude Opus 5.5 <[email protected]>
4 tasks
…sync Co-Authored-By: Claude Opus 5.5 <[email protected]>
A reorg that replaces records at the same indices leaves mutationCount unchanged; reads at the safe block never see a record that can still change. Co-Authored-By: Claude Opus 5.5 <[email protected]>
PaymentPool.sweep takes a batch of 1 to MAX_SWEEP_BATCH (32) operators and sends their pending protocol shares in one CCTP transfer. Each entry needs a non-zero pending share, so a duplicate reverts on the same check. minSweep bounds the batch total: a sweep costs one governance-chain receive, so many small operators reach the floor together. The hook data is abi.encode(SweepShare[]), one (operator, servedBytes, amount) entry per operator. The pool emits Swept(operator, servedBytes, amount) per operator and one SweepSent(amount, maxFee) per batch. CctpSweepReceiver deposits each entry into FeeRouter. The minted USDC splits pro rata to the entry amounts, the last entry takes the rounding remainder, and an entry whose share is 0 is skipped. It rejects an empty batch, one above the limit, and one that sums to zero. A full batch's burn body is 3364 bytes, under the 8192-byte maxMessageBodySize of the deployed V2 transmitters. The receive costs about 93k gas per operator against cold storage. ADRs 003, 016, the L2 appendix and the glossary describe the batch, the payload and the pro-rata split. Co-Authored-By: Claude Opus 5.5 <[email protected]>
When no sweep arrives for a whole window, every operator's weight decays to 0 and no proposal can pass. FeeRouter.deposit is permissionless on the governance chain, so active operators restore weight with direct USDC deposits, with no bridge and no traffic. ADR 036 states the bounds, the cost (the non-rebated net) and the need for at least two depositing operators under the share cap. ADR 016 links the recovery path from the FeeRouter wash-trading note. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Weight credit is backed only by the non-rebated net of a deposit. With a zero net no deposit credits weight, the vote window empties, and no one holds the votes to change the split back. setSplit now rejects a rebateBps above 9900, so buyback plus treasury keep at least 1% and a direct deposit can always restore weight. Co-Authored-By: Claude Opus 5.5 <[email protected]>
A batch reverted when any listed operator had nothing pending, so anyone could make it fail by sweeping one listed operator first. The sweep skips such entries and needs only a non-zero total of at least minSweep. The gas snapshot covers both this and the rebate ceiling. Co-Authored-By: Claude Opus 5.5 <[email protected]>
… hints and pool refusal StreamRequest names the PaymentPool contract that holds pool_id as a CAIP-10 PoolAccount (CAIP-2 ChainId plus contract address). ProbeResponseExt and StreamResponseExt carry an optional payment_pools hint of at most 8 accounts; the StreamResponse validator allows it only on a Declined refusal. Frame-ceiling tests and ADR 005/012/013 follow. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ores; new contract bindings Co-Authored-By: Claude Opus 5.5 <[email protected]>
…and probe hint; earnings from redeem receipts The node accepts every configured PaymentPool on every payment chain. Each payment chain gets its own providers, with wallet signers bound to that chain id, and its own chain-event poller for its pools' settlement routes. Governance reads and transactions stay on the governance chain. Each pool gets its own seller store view over the shared redb files, settlement service, redeemer, pool view and operatorBps. The client handler keys lanes and floor accounting by (deployment, pool) and routes each StreamRequest by payment_pool. A pool the node does not accept is refused Declined with the accepted pools listed, before any pool read. The probe extension advertises the accepted pools. Preflight probes each pool on its own chain and names the pool on a chain-id mismatch. The settlement ledger decodes the node's own redeemMany receipt: net is the pool's USDC transfer to the operator, gross scales it by 10000/operatorBps (rounded up), bytes sum the operator's PoolRedeemed lanes. SettlementRecord drops its epoch field. Removes the unused fee_shares_watcher metrics and the stale claim that the pool clamps byte credit; ADR 003 describes the paid side and the ledger from the node's own receipts. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ist ledger sync The node reads no event log. Each chain projection has its own eth_call refresh loop: registry snapshot every 5 min (plus a rate-limited refresh on an unknown NodeId), origin seats every 10 min (plus a rate-limited refresh on a seat miss), operatorSlashCount every 15 min, the ContentBlacklist mutation ledger at the safe block (ADR 011), and getPool + getAuthorizations every 30 s for pools with a live lane. Paid watermarks come from the node's own redeemMany receipts and the pre-redeem getWatermarks read; sent redeemMany hashes persist in settle.redb and their receipts are read again on boot. Deletes the multiplexed poller, the resumable watcher, the cursor and checkpoint machinery (checkpoint.redb, SharedHead), the PoolOpened projection folding, event_poll_interval_ms (receipt_poll_interval_ms replaces it) and the deleted watchers' metrics. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…-node pool selection and Declined retry ChainConfig holds the governance chain (RPC, chain id, SlashJudge, CapacityBond) and a list of payment pools (payment-chain RPC and Deployment). Registry reads, probe and stream signatures and the client identity binding use the governance chain; vouchers, capabilities and pool transactions use each pool's Deployment. Receipts carry both chain ids. pool_route picks each node's pool: the first pool of the buyer's route (held pools first, then config order) that the node's payment_pools probe hint lists; no hint means the first configured pool. A fetch runs one pass per pool that a node is routed to. A Declined refusal that lists the node's pools retries that node once, in the pass of a listed pool; nothing retries it again. decdn get / gateway fetches run the passes; a bundle pull pays through the route's first pool and skips nodes routed elsewhere. The node's buyer leg pays through the first pool of its own route and skips upstreams whose hint routes them elsewhere. resolve_chain reads the governance RPC and chain id from [blockchain] and every pool of every payment chain. ADR 005 and 012 state the pass and retry rules. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The boot snapshot reads getHashEntry(region, hash) once per paged hash for liveness and expiry, and keeps a hash under a region only where it is live. Emergency entries and live emergency origins take addedAt plus the category term. Co-Authored-By: Claude Opus 5.5 <[email protected]>
… lanes, doctor and setup `decdn node sweep` sends each pool's pending protocol share once it reaches minSweep. `decdn node receive-sweeps` reads each sweep's CCTP message and attestation from Iris (`blockchain.cctp_iris_url` or `--iris`), waits while it is pending, skips a used nonce, and calls `CctpSweepReceiver.receiveSweep` on the governance chain. `node earnings --address` scans each pool's USDC transfers to the operator and decodes their receipts with the node's ledger decoder, now in `decdn_incentive::settlement_receipt`; both modes report per-pool settlements and the pending protocol share. `LaneSnapshot` names its pool. `pool`, `setup`, `doctor` and `receipt` act per pool on the pool's own payment chain. Flags: `--governance-rpc-url`/`--governance-chain-id` and `--pool <caip10>`/`--pool-rpc-url` replace `--rpc-url`, `--payment-pool-address` and `--chain-id` on get, gateway, quote, pool and node earnings; the pool-id flag is `--pool-id`. The governance RPC is required. `pool_route` is a hidden engine seam. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…way capability pool resolution Bundle pulls run one pass per payment pool that a holder is routed to (ADR 005 § Payment pool routing). Each pass pays through one pool with its own lanes, funding facts and recovery gate (`PassPool`); the pools of earlier passes stay parked for their replacements and shortfalls. A pass that leaves failed or unrun entries hands them to the next pool's pass, which skips every file an earlier pass completed and resumes partial files. A node that answers Declined with `payment_pools` takes its one retry in that pool's pass. With more than one pool, an entry's probe round settles before the fetch, so an entry whose holders all take another pool waits for that pool's pass. The manifest fetch runs the same passes. `BundlePuller::fetch_manifest` takes `&mut self`. `UnconfirmedEscrows::for_pool` gives a handle keyed by the `PaymentPool` contract: a pending `openPool` or `topUp` blocks only its own contract, while `pending` and `untracked` still list every contract. Single-blob fetch passes and bundle passes report through it. The gateway resolves a registered capability's pool by recovering its owner signature under each configured pool's EIP-712 domain and matching the on-chain owner there. The delegate's pulls pay through that pool only, and `/pools` reads delegate lanes keyed by (contract, pool, signer). The HTTP contract is unchanged. ADR 012 says so. `decdn node earnings` refuses `--pool` without `--address`: the daemon reports every pool it serves. The e2e `ChainFixture` deploys the payment pool through `DeployPaymentPool` with a `LoopbackCctp`, reads `deployments/<chainId>-payment.json`, and can redeploy a second pool. `cli_bundle_pull_two_pools` pulls one bundle from two holders on two contracts. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Bind PaymentPool.sweep(address[]), MAX_SWEEP_BATCH, SweepShare, the per-operator Swept and per-batch SweepSent events, and the BelowMinSweep and BadSweepBatch errors, with selector and signature pins. decdn node sweep sweeps the operator alone by default; --with <ADDRESS> (repeatable) adds other operators to the same batch so they share one CCTP transfer and one governance-chain receive. The CLI reads each listed operator's pending share, leaves out empty and repeated ones, refuses a batch over MAX_SWEEP_BATCH, sends only when the batch total reaches minSweep, and prints each swept share from the Swept events and the batch total and fee from SweepSent. decdn node receive-sweeps receives each batch transaction once (a batch is one CCTP message), decodes the SweepShare[] hook data, and reports the batch size and the operator's entry on each line. The e2e ChainFixture sweeps a batch and receives a sweep by transaction; slash_appeal drives the real decdn node sweep --with path. Co-Authored-By: Claude Opus 5.5 <[email protected]>
A --capability delegation pays through the contract of its capability's pool, found as the gateway finds a registered capability's: the first configured payment pool under whose EIP-712 domain the owner signature recovers to the pool's on-chain getPool owner. A capability that matches no configured pool is refused before any fetch. capability_pool moves out of the gateway into commands::capability_pool with a transport-neutral error; the gateway maps it to 422/502 as before. The blob route, the bundle route, the manifest fetch and the gateway's --capability lanes all carry the resolved Delegation, and the SDK's bundle Funding::Delegated names its pool. ADR 012 states the rule. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The onramp's download profile names both chains. ONRAMP_RPC_URL is replaced by ONRAMP_GOVERNANCE_RPC_URL, ONRAMP_GOVERNANCE_CHAIN_ID and ONRAMP_POOL_RPC_URL (all required); the payment chain id and pool still come from the daemon's GET /v1/info. The installers take GOVERNANCE_CHAIN_ID / GOVERNANCE_RPC_URL / POOL_CHAIN_ID / POOL_RPC_URL and pass --governance-rpc-url and --governance-chain-id from the governance chain and --pool eip155:<pool chain>:<pool> and --pool-rpc-url from the payment chain. The daemon signs for one pool on one payment chain and reads nothing on the governance chain, so its SPONSORD_* settings and both HTTP APIs are unchanged; the docs name its chain as the payment chain. The test fixtures keep the two chain ids apart. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The runbook's "Sweeping the protocol share" covers batches: one sweep carries 1 to 32 operators, decdn node sweep --with shares the receive, and receive-sweeps receives a batch once whoever sent it. A "CCTP outage" subsection under it covers what keeps working, detection, keeping governance weight with direct FeeRouter deposits, receiving the backlog one epoch at a time, and moving a payment chain off CCTP. CONTRIBUTING describes the governance and payment manifests, both scan start blocks, and the empty KNOWN_CHAINS list. README and the CLI README stop pointing at the removed testnet manifest and the --chain target. The capability error names --pool instead of the removed --payment-pool-address, and a buyer-pool doc names payment_pools. Co-Authored-By: Claude Opus 5.5 <[email protected]>
alpergundogdu
merged commit Nov 17, 2026
84f1f58
into
claude/governance-ethereum-chain-agnostic-96be04
alpergundogdu
deleted the
claude/governance-payment-chain-split-e69718
branch
November 17, 2026 16:23
11 tasks
alpergundogdu
added a commit
that referenced
this pull request
Nov 17, 2026
* docs(adr): split governance chain from payment chains Governance, bond, slashing, TOKEN and buyback run on Ethereum L1. PaymentPool runs on any EVM chain with native USDC and CCTP V2, holds only USDC, reads no bond state and has no governance. A permissionless sweep carries the protocol share and the served-bytes record to the governance-chain FeeRouter in one CCTP message. FeeRouter checks the operator is active, prices weight on the USDC that stays with the protocol, clamps credit to declared capacity and stamps the arrival epoch. The split of the swept share is governable without bounds and buyback is a setting. StreamRequest carries chain_id and the probe extension carries an unsigned payment_chains hint. Co-Authored-By: Claude Sonnet 5.5 <[email protected]> * docs(adr): fix operator-share fallback wording and a typo Co-Authored-By: Claude Sonnet 5.5 <[email protected]> * docs(adr): StreamResponse lists accepted payment chains on a chain refusal Co-Authored-By: Claude Sonnet 5.5 <[email protected]> * docs(adr): censorship-window rule and CAIP-2 chain ids The admission rule names a censorship window: forced inclusion on a rollup, the validator set on a layer 1. Rule 2 pins the 6-decimal ERC-20 interface. StreamRequest.chain_id and the payment_chains hint carry CAIP-2 identifiers, so a non-EVM chain needs no message change. Co-Authored-By: Claude Sonnet 5.5 <[email protected]> * feat!: split governance and payment chains (contracts, node, client, CLI, sponsord) (#2904) * docs(adr): standard CCTP sweeps never expire; size minSweep for L1 receive gas A standard-transfer message carries expirationBlock 0, so an attested sweep stays receivable indefinitely and Circle refuses to re-attest it. Verified on Arbitrum Sepolia -> Ethereum Sepolia. Co-Authored-By: Claude Opus 5.5 <[email protected]> * docs(adr): sweep maxFee falls back to 0; FeeRouter credits the USDC balance delta Deployed TokenMessengerV2 has no getMinFeeAmount, so the pool reads it when present and uses 0 otherwise. FeeRouter measures U as its USDC balance rise, so a non-USDC burn credits nothing, and drops the sender check that the messenger already enforces. sweep resets pending before the CCTP call. Co-Authored-By: Claude Opus 5.5 <[email protected]> * docs(adr): bridge adapters feed a permissionless FeeRouter.deposit FeeRouter knows no bridge. CctpSweepReceiver is the CCTP V2 adapter on the governance chain; PaymentPool sweeps to it (sweepRecipient, sweepDomain). A new bridge is a new adapter plus a PaymentPool variant, with no FeeRouter change. Documents the clamp-fill cost that an open deposit implies. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(contracts)!: FeeRouter.deposit and the CCTP sweep receiver FeeRouter takes sweeps through a permissionless deposit: rebate to an active operator, buyback and treasury legs, a USDC-backed weight credit clamped to declared capacity in the arrival epoch. CctpSweepReceiver receives a CCTP V2 sweep, measures the minted USDC and deposits it. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(contracts)!: payment-chain PaymentPool with CCTP sweep; governance-chain deploy split PaymentPoolBase holds the voucher pool with no governance, roles or bond reads: redeemMany pays operatorBps same-tx and accrues the rest in pending; sweep is permissionless and resets pending before the bridge call. The CCTP PaymentPool burns to the governance-chain CctpSweepReceiver with maxFee from getMinFeeAmount when present. disputeWindow is uint32 so the close deadline cannot wrap. DeployProtocol deploys the governance-chain set plus the receiver; DeployPaymentPool deploys a pool per payment chain. LoopbackCctp (testnet/) plays CCTP on one local chain for dev-deploy.sh and the e2e; a CI gate keeps it out of src/ and script/. Co-Authored-By: Claude Opus 5.5 <[email protected]> * test(contracts): share env values with the protocol deploy test vm.setEnv is process-wide and suites run in parallel. Co-Authored-By: Claude Opus 5.5 <[email protected]> * docs(adr): a capability's cap is the whole bound on where it is spent Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(contracts)!: ContentBlacklist mutation ledger for log-free node sync Co-Authored-By: Claude Opus 5.5 <[email protected]> * docs(adr): pin blacklist ledger reads to the safe block A reorg that replaces records at the same indices leaves mutationCount unchanged; reads at the safe block never see a record that can still change. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(contracts)!: batched protocol-share sweeps PaymentPool.sweep takes a batch of 1 to MAX_SWEEP_BATCH (32) operators and sends their pending protocol shares in one CCTP transfer. Each entry needs a non-zero pending share, so a duplicate reverts on the same check. minSweep bounds the batch total: a sweep costs one governance-chain receive, so many small operators reach the floor together. The hook data is abi.encode(SweepShare[]), one (operator, servedBytes, amount) entry per operator. The pool emits Swept(operator, servedBytes, amount) per operator and one SweepSent(amount, maxFee) per batch. CctpSweepReceiver deposits each entry into FeeRouter. The minted USDC splits pro rata to the entry amounts, the last entry takes the rounding remainder, and an entry whose share is 0 is skipped. It rejects an empty batch, one above the limit, and one that sums to zero. A full batch's burn body is 3364 bytes, under the 8192-byte maxMessageBodySize of the deployed V2 transmitters. The receive costs about 93k gas per operator against cold storage. ADRs 003, 016, the L2 appendix and the glossary describe the batch, the payload and the pro-rata split. Co-Authored-By: Claude Opus 5.5 <[email protected]> * docs(adr): governance recovers vote weight by direct FeeRouter deposit When no sweep arrives for a whole window, every operator's weight decays to 0 and no proposal can pass. FeeRouter.deposit is permissionless on the governance chain, so active operators restore weight with direct USDC deposits, with no bridge and no traffic. ADR 036 states the bounds, the cost (the non-rebated net) and the need for at least two depositing operators under the share cap. ADR 016 links the recovery path from the FeeRouter wash-trading note. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(contracts)!: cap the FeeRouter rebate at 99% Weight credit is backed only by the non-rebated net of a deposit. With a zero net no deposit credits weight, the vote window empties, and no one holds the votes to change the split back. setSplit now rejects a rebateBps above 9900, so buyback plus treasury keep at least 1% and a direct deposit can always restore weight. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(contracts)!: a sweep batch skips operators with nothing pending A batch reverted when any listed operator had nothing pending, so anyone could make it fail by sweeping one listed operator first. The sweep skips such entries and needs only a non-zero total of at least minSweep. The gas snapshot covers both this and the rebate ceiling. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(protocol)!: CAIP-10 payment pool on StreamRequest; payment_pools hints and pool refusal StreamRequest names the PaymentPool contract that holds pool_id as a CAIP-10 PoolAccount (CAIP-2 ChainId plus contract address). ProbeResponseExt and StreamResponseExt carry an optional payment_pools hint of at most 8 accounts; the StreamResponse validator allows it only on a Declined refusal. Frame-ceiling tests and ADR 005/012/013 follow. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat!: governance and payment-chain config split; deployment-keyed stores; new contract bindings Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(node)!: per-chain providers and per-pool services; pool refusal and probe hint; earnings from redeem receipts The node accepts every configured PaymentPool on every payment chain. Each payment chain gets its own providers, with wallet signers bound to that chain id, and its own chain-event poller for its pools' settlement routes. Governance reads and transactions stay on the governance chain. Each pool gets its own seller store view over the shared redb files, settlement service, redeemer, pool view and operatorBps. The client handler keys lanes and floor accounting by (deployment, pool) and routes each StreamRequest by payment_pool. A pool the node does not accept is refused Declined with the accepted pools listed, before any pool read. The probe extension advertises the accepted pools. Preflight probes each pool on its own chain and names the pool on a chain-id mismatch. The settlement ledger decodes the node's own redeemMany receipt: net is the pool's USDC transfer to the operator, gross scales it by 10000/operatorBps (rounded up), bytes sum the operator's PoolRedeemed lanes. SettlementRecord drops its epoch field. Removes the unused fee_shares_watcher metrics and the stale claim that the pool clamps byte credit; ADR 003 describes the paid side and the ledger from the node's own receipts. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(node)!: replace chain event watchers with eth_call reads; blacklist ledger sync The node reads no event log. Each chain projection has its own eth_call refresh loop: registry snapshot every 5 min (plus a rate-limited refresh on an unknown NodeId), origin seats every 10 min (plus a rate-limited refresh on a seat miss), operatorSlashCount every 15 min, the ContentBlacklist mutation ledger at the safe block (ADR 011), and getPool + getAuthorizations every 30 s for pools with a live lane. Paid watermarks come from the node's own redeemMany receipts and the pre-redeem getWatermarks read; sent redeemMany hashes persist in settle.redb and their receipts are read again on boot. Deletes the multiplexed poller, the resumable watcher, the cursor and checkpoint machinery (checkpoint.redb, SharedHead), the PoolOpened projection folding, event_poll_interval_ms (receipt_poll_interval_ms replaces it) and the deleted watchers' metrics. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(client)!: governance and payment pools split in ChainConfig; per-node pool selection and Declined retry ChainConfig holds the governance chain (RPC, chain id, SlashJudge, CapacityBond) and a list of payment pools (payment-chain RPC and Deployment). Registry reads, probe and stream signatures and the client identity binding use the governance chain; vouchers, capabilities and pool transactions use each pool's Deployment. Receipts carry both chain ids. pool_route picks each node's pool: the first pool of the buyer's route (held pools first, then config order) that the node's payment_pools probe hint lists; no hint means the first configured pool. A fetch runs one pass per pool that a node is routed to. A Declined refusal that lists the node's pools retries that node once, in the pass of a listed pool; nothing retries it again. decdn get / gateway fetches run the passes; a bundle pull pays through the route's first pool and skips nodes routed elsewhere. The node's buyer leg pays through the first pool of its own route and skips upstreams whose hint routes them elsewhere. resolve_chain reads the governance RPC and chain id from [blockchain] and every pool of every payment chain. ADR 005 and 012 state the pass and retry rules. Co-Authored-By: Claude Opus 5.5 <[email protected]> * docs(adr): blacklist boot snapshot reads getHashEntry per hash The boot snapshot reads getHashEntry(region, hash) once per paged hash for liveness and expiry, and keeps a hash under a region only where it is live. Emergency entries and live emergency origins take addedAt plus the category term. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(cli)!: node sweep and receive-sweeps; multi-pool pool, earnings, lanes, doctor and setup `decdn node sweep` sends each pool's pending protocol share once it reaches minSweep. `decdn node receive-sweeps` reads each sweep's CCTP message and attestation from Iris (`blockchain.cctp_iris_url` or `--iris`), waits while it is pending, skips a used nonce, and calls `CctpSweepReceiver.receiveSweep` on the governance chain. `node earnings --address` scans each pool's USDC transfers to the operator and decodes their receipts with the node's ledger decoder, now in `decdn_incentive::settlement_receipt`; both modes report per-pool settlements and the pending protocol share. `LaneSnapshot` names its pool. `pool`, `setup`, `doctor` and `receipt` act per pool on the pool's own payment chain. Flags: `--governance-rpc-url`/`--governance-chain-id` and `--pool <caip10>`/`--pool-rpc-url` replace `--rpc-url`, `--payment-pool-address` and `--chain-id` on get, gateway, quote, pool and node earnings; the pool-id flag is `--pool-id`. The governance RPC is required. `pool_route` is a hidden engine seam. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(client)!: multi-pool bundle passes, per-deployment escrows, gateway capability pool resolution Bundle pulls run one pass per payment pool that a holder is routed to (ADR 005 § Payment pool routing). Each pass pays through one pool with its own lanes, funding facts and recovery gate (`PassPool`); the pools of earlier passes stay parked for their replacements and shortfalls. A pass that leaves failed or unrun entries hands them to the next pool's pass, which skips every file an earlier pass completed and resumes partial files. A node that answers Declined with `payment_pools` takes its one retry in that pool's pass. With more than one pool, an entry's probe round settles before the fetch, so an entry whose holders all take another pool waits for that pool's pass. The manifest fetch runs the same passes. `BundlePuller::fetch_manifest` takes `&mut self`. `UnconfirmedEscrows::for_pool` gives a handle keyed by the `PaymentPool` contract: a pending `openPool` or `topUp` blocks only its own contract, while `pending` and `untracked` still list every contract. Single-blob fetch passes and bundle passes report through it. The gateway resolves a registered capability's pool by recovering its owner signature under each configured pool's EIP-712 domain and matching the on-chain owner there. The delegate's pulls pay through that pool only, and `/pools` reads delegate lanes keyed by (contract, pool, signer). The HTTP contract is unchanged. ADR 012 says so. `decdn node earnings` refuses `--pool` without `--address`: the daemon reports every pool it serves. The e2e `ChainFixture` deploys the payment pool through `DeployPaymentPool` with a `LoopbackCctp`, reads `deployments/<chainId>-payment.json`, and can redeploy a second pool. `cli_bundle_pull_two_pools` pulls one bundle from two holders on two contracts. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(cli)!: batched sweeps in node sweep and receive-sweeps Bind PaymentPool.sweep(address[]), MAX_SWEEP_BATCH, SweepShare, the per-operator Swept and per-batch SweepSent events, and the BelowMinSweep and BadSweepBatch errors, with selector and signature pins. decdn node sweep sweeps the operator alone by default; --with <ADDRESS> (repeatable) adds other operators to the same batch so they share one CCTP transfer and one governance-chain receive. The CLI reads each listed operator's pending share, leaves out empty and repeated ones, refuses a batch over MAX_SWEEP_BATCH, sends only when the batch total reaches minSweep, and prints each swept share from the Swept events and the batch total and fee from SweepSent. decdn node receive-sweeps receives each batch transaction once (a batch is one CCTP message), decodes the SweepShare[] hook data, and reports the batch size and the operator's entry on each line. The e2e ChainFixture sweeps a batch and receives a sweep by transaction; slash_appeal drives the real decdn node sweep --with path. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(cli)!: decdn get --capability resolves its pool A --capability delegation pays through the contract of its capability's pool, found as the gateway finds a registered capability's: the first configured payment pool under whose EIP-712 domain the owner signature recovers to the pool's on-chain getPool owner. A capability that matches no configured pool is refused before any fetch. capability_pool moves out of the gateway into commands::capability_pool with a transport-neutral error; the gateway maps it to 422/502 as before. The blob route, the bundle route, the manifest fetch and the gateway's --capability lanes all carry the resolved Delegation, and the SDK's bundle Funding::Delegated names its pool. ADR 012 states the rule. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(sponsord)!: separate governance and payment-chain coordinates The onramp's download profile names both chains. ONRAMP_RPC_URL is replaced by ONRAMP_GOVERNANCE_RPC_URL, ONRAMP_GOVERNANCE_CHAIN_ID and ONRAMP_POOL_RPC_URL (all required); the payment chain id and pool still come from the daemon's GET /v1/info. The installers take GOVERNANCE_CHAIN_ID / GOVERNANCE_RPC_URL / POOL_CHAIN_ID / POOL_RPC_URL and pass --governance-rpc-url and --governance-chain-id from the governance chain and --pool eip155:<pool chain>:<pool> and --pool-rpc-url from the payment chain. The daemon signs for one pool on one payment chain and reads nothing on the governance chain, so its SPONSORD_* settings and both HTTP APIs are unchanged; the docs name its chain as the payment chain. The test fixtures keep the two chain ids apart. Co-Authored-By: Claude Opus 5.5 <[email protected]> * docs: config split, sweep and CCTP outage runbook The runbook's "Sweeping the protocol share" covers batches: one sweep carries 1 to 32 operators, decdn node sweep --with shares the receive, and receive-sweeps receives a batch once whoever sent it. A "CCTP outage" subsection under it covers what keeps working, detection, keeping governance weight with direct FeeRouter deposits, receiving the backlog one epoch at a time, and moving a payment chain off CCTP. CONTRIBUTING describes the governance and payment manifests, both scan start blocks, and the empty KNOWN_CHAINS list. README and the CLI README stop pointing at the removed testnet manifest and the --chain target. The capability error names --pool instead of the removed --payment-pool-address, and a buyer-pool doc names payment_pools. Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Claude Opus 5.5 <[email protected]> * fix(ci): dashboard types carry pool fields; LoopbackCctp keeps Circle's revert strings The dashboard contract test and the earnings view test name the per-pool lane and earnings fields. LoopbackCctp reverts with Circle's own strings on purpose, so solhint's custom-errors rule is off for it. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(cli): name the scanned pool `pool` in receive-sweeps The value is the pool's public CAIP-10 contract id. Its old name, `account`, made CodeQL read it as a credential in the progress line. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(cli): log the scanned pool by chain id and address The receive-sweeps progress line names the pool by its public contract address and chain id, read from the deployment fields. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(cli): log the earnings scan's pool by chain id and address Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Claude Sonnet 5.5 <[email protected]>
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.
Implements #2899 (ADR: split the governance chain from payment chains) in one PR: contracts, protocol, node, client, CLI, sponsord, e2e and docs, so
mainnever holds a half-migrated tree. Governance (TOKEN, bond, slashing, FeeRouter, buyback, blacklist) stays on Ethereum.PaymentPoolruns on any EVM chain with native USDC and sweeps the protocol share to Ethereum over CCTP V2. No testnet redeploy is part of this PR; it follows once decdn v4 is built, so the known-chain list is empty for now.Contracts
Governance chain
FeeRouter.deposit(operator, servedBytes, amount): one permissionless entry. Splits intorebateBps(active operators),buybackBpsand the treasury remainder. Credit ismin(bytes, net × 1 MiB / deliveryFloor), clamped by declared capacity, stamped to the arrival epoch.rebateBpsis at most 9900, sonetis always at least 1% and a direct deposit can always restore vote weight. With a zeronetthe window would empty and nobody could vote the split back.routeSettlement,ROUTER_CALLER_ROLE, the share vector.CctpSweepReceiver(new, stateless): checks the CCTP message, measures the USDC it minted, decodes the batch (SweepShare[]) and deposits each entry. A bridge fee would split pro rata; a zero share is skipped.ContentBlacklist: append-only mutation ledger (mutationCount,getMutations) covering every hash, origin, operator, regional-body and compliance-window change.Payment chain
PaymentPoolBase(bridge-neutral) plus the CCTPPaymentPool: no governance, no roles, no bond reads. Immutables:usdc,tokenMessenger,sweepRecipient,sweepDomain,disputeWindow,operatorBps,minSweep,minDeposit,pauser.redeemManypaysoperatorBpsto the operator in the same transaction and accrues the rest per operator.sweep(address[] operators): permissionless batch of up to 32 operators in one CCTP transfer. Skips operators with nothing pending; the batch total must reachminSweep. EventsSwept(operator indexed, servedBytes, amount)andSweepSent(amount, maxFee).pausercan block onlyopenPoolandtopUp.Adding a bridge is a new governance-chain adapter plus a
PaymentPoolBasevariant; FeeRouter does not change.Wire protocol
StreamRequest.payment_poolnames the pool as a CAIP-10 account (eip155:<chain>:<address>).Declinedrefusals carry up to 8 acceptedpayment_pools. A client retries a declining node once on a listed pool.Config
Removed keys:
payment_pool_address,usdc_address,fee_shares_poll_interval_sec,event_poll_interval_ms(nowreceipt_poll_interval_ms).content_blacklist_poll_interval_secis capped at 300.Node
One provider and signer per payment chain; one settlement service, redeemer and store view per pool. Voucher and capability domains use the pool's chain; slash, probe, bind and DHT signatures use the governance chain.
A request for an unaccepted pool gets
Declinedwith the node's pools before any chain read.No
eth_getLogsat all. Every watcher is aneth_callread:safeblockAn idle node drops from about 2,100 RPC calls an hour to about 100.
Earnings come from the node's own
redeemManyreceipts; sent redeem hashes are kept so a crash does not lose a row.Client and CLI
ChainConfig { governance, payment_pools }. A fetch picks, per node, a pool both sides accept (held pools first) and runs one pass per pool; bundle pulls do the same. Pending top-ups are tracked per pool contract.decdn get --capabilityfind a capability's pool by its EIP-712 signature. The gateway HTTP contract is unchanged.decdn node sweep [--with <operator>]...anddecdn node receive-sweeps(Iris attestation, onereceiveSweepper message, used nonces skipped).node earnings(with the pending protocol share),node lanes(POOL column),pool,doctorandsetup.--governance-rpc-url,--governance-chain-id,--pool <caip10>,--pool-rpc-url. The 32-byte pool id flag is--pool-id.--rpc-url,--chain-idand--payment-pool-addressare gone fromget,gatewayandquote.sponsord
ONRAMP_RPC_URLis replaced byONRAMP_GOVERNANCE_RPC_URL,ONRAMP_GOVERNANCE_CHAIN_IDandONRAMP_POOL_RPC_URL. The installers pass both chains separately.sponsord-apiare unchanged.ADRs
003, 005, 009, 011, 012, 013, 016, 019, 026, 036, the appendices and the glossary match the code. Notable: standard CCTP sweeps never expire;
maxFeefalls back to 0; batched sweeps; governance recovers vote weight by directFeeRouter.deposit(at least two operators); the rebate ceiling; a capability's cap is the whole bound on where it is spent; nodes follow the blacklist ledger at thesafeblock.Docs
docs/runbook.mdcovers sweeping and a CCTP outage (what keeps working, keeping governance alive by direct deposit, receiving the backlog one epoch at a time).docs/sponsord/, the READMEs and CONTRIBUTING match the new config and flags.Gates (local)
forge fmt, CI build with sizes, 876 tests passed, slither clean, gas snapshot regenerated.--all-features --all-targetsclean, 6235/6235 workspace tests,cargo docwith warnings denied, crate-edge check.decdn-e2e, 24/24 sponsord, 48/48 sponsord-core. The final rebase is re-running them; CI is the gate. Twodecdn-nodeanvil tests fail on macOS only, becausereserve_port()relies on Linux socket behaviour.Outside this repo
Decdn*WatcherStalled,DecdnChainWatcherFlapping,chain_get_logs_*,settlement_reanchor_*,fee_shares_watcher_*,blacklist_reenumeration_failures_total, nowblacklist_ledger_poll_failures_total); the unattributed stream-failure panels needdecdn_serve_stream_rejected_unaccepted_pool_totalsubtracted; deployed configs need the new[blockchain]shape andreceipt_poll_interval_ms; the onramp needs its three new settings.🤖 Generated with Claude Code