Settlement: provider-recourse task escrow, consume replay guard, live mainnet metering loop - #85
Open
mizuki0x wants to merge 3 commits into
Open
Settlement: provider-recourse task escrow, consume replay guard, live mainnet metering loop#85mizuki0x wants to merge 3 commits into
mizuki0x wants to merge 3 commits into
Conversation
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
On-chain settlement of agent work, hardened and taken live.
Program (
agent-os/programs/settlement)FUNDED → SUBMITTED → RELEASED/REFUNDED/DISPUTED.submit_result(provider) starts a challenge window;claim_tasklets the provider claim after the window with no dispute — the provider recourse the old design lacked.dispute_task(client, in-window) locks funds forresolve_task(arbiter =config.authority) — a client can no longer unilaterally claw back a delivered result.release_taskretained as a voluntary client fast-pay;refund_taskrestricted to FUNDED-only after deadline.consume_creditsreplay guard: a[b"receipt", owner, receipt_hash]marker PDA makes credit consumption idempotent on-chain;close_receiptreclaims the rent post-settlement.Configlayout change → no migration. Escrow stays behind thetask-escrowfeature.Tests
--features task-escrow) + default build green. Newtests/escrow.rscovers the full state machine (claim-after-window, dispute→resolve both ways, window/deadline/provider-mismatch failures) and on-chain replay rejection.Live on mainnet (no program upgrade — already-deployed instructions)
open_credit_account → buy_credits → consume_credits → anchor_receipt_batch.4bT7Wm2GGpdjjJRcTpYPdkFKZh2SfTkxfQZ1E1j4CfDd7pHqEUnZeMRJR1ckK69sLeo8oj4yCwG5Xd4EgvWumnb6. Credit accountDrawYGmd…balance 999,000; batchDn6WXFY9…anchored.Not in this PR (blocked)
solana-verifyreproducible build, which requires Docker. No container runtime is available on the build host, so the verified upgrade is staged (devnet-provable) but not broadcast — it must not replace the verified, funds-holding mainnet program with a non-reproducible build.