Repository navigation
ads: pay through the shared payments module (one payment path) - #166
Merged
Merged
Conversation
Ads billing no longer shells out to `coinpay wallet send`. Settlement lines become payments::Transfer values keyed `ads:<settlement hash>:<line>` and go through payments::pay_all on the node's one Rail (CoinPay payouts API via $C0MPUTE_COINPAY_PAYOUT_KEY, FakeRail in tests), with the shared idempotent payments ledger (`payments.json` per campaign) and the `[payments] max_usd_per_round` cap. A lost ads-ledger reference is healed from the shared ledger instead of paying twice. - Removed ads' own PaymentRail, DisabledRail, FakeRail and CoinpayCliRail. - `c0mpute ads settle --pay` needs both `[ads] payouts = true` and `[payments] enabled = true`; still a dry run otherwise. - Payout addresses are `<COIN>:<address>` (CoinPay currency code), mapped to payments::Payee by billing::payee_of. - Fee and split logic stay in ads. Docs and manifest notes updated. - Tests: billing unit tests (cap, idempotency, heal), billing e2e on payments::FakeRail still checks payouts equal budget spent. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ThreatCrush Security Scan12 finding(s) HIGH/CRITICAL: 1 | MEDIUM: 8 | LOW: 3
Snippets are redacted; ThreatCrush never prints matched credential material. |
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.
Follow-up to #162 (already squash-merged before #163 landed, so this could not go on the same PR).
Ads payouts now go through
node/crates/c0mpute-core/src/payments.rsfrom #163, so there is exactly one payment path:payments::Transferkeyedads:<settlement hash>:<line>and is paid bypayments::pay_allon the node'sRail(CoinPay payouts API with$C0MPUTE_COINPAY_PAYOUT_KEY;FakeRailin tests). The[payments] max_usd_per_roundcap applies.payments::Ledger(payments.jsonnext to each campaign), and the rail also refuses duplicate keys. If the ads ledger loses a line's reference (crash before save), the shared ledger fills it back in and the line is not paid again.PaymentRail,DisabledRail,FakeRailandCoinpayCliRailare removed, and nothing shells out tocoinpay wallet sendany more.c0mpute ads settle --payneeds both[ads] payouts = trueand[payments] enabled = true; without them it is a dry run. Real transfers have never been exercised.<COIN>:<address>, where COIN is the CoinPay currency code (USDC_POL,SOL), mapped topayments::Payeebybilling::payee_of.docs/ads.md) and the three plugin status notes are updated. No version bump.Tests:
ads_billing_e2eruns onpayments::FakeRailand the shared ledger. Payouts still match the split exactly and equal the budget spent, overspend is refused, and the default config yields no rail.ads_e2estill passes.🤖 Generated with Claude Code