Skip to content

STE-49: escrow is locked before the audit, and a slash pays the reporter - #49

Merged
Lin1er merged 2 commits into
mainfrom
feat/49-orchestrator-escrow-order
Sep 17, 2026
Merged

Lin1er merged 2 commits into
mainfrom
feat/49-orchestrator-escrow-order

Conversation

@Lin1er

@Lin1er Lin1er commented Sep 17, 2026

Copy link
Copy Markdown
Owner

Linear: STE-49 · ACC by Axel 2026-09-17 · reviewers @axelmatsama @fable

What changes

  • Lock before audit. open_escrow_job() runs create_audit_request + post_bond before the audit. With escrow_lock="before_audit", orchestrate() closes that same job: it settles on SAFE and slashes otherwise.
  • Slash to reporter. The bond goes to reporter_address. When that is empty it goes to the admin, and the step detail says "explicit fallback". Per Axel, the code comment now states that this fallback is an operational convenience for our own runs, not product behaviour.
  • The default stays after_verdict, so seed and the rehearsal keep their behaviour.

Decisions

  • request_id travels in the journal and is never guessed.
  • Before settle/slash, get_request is read back from chain. It must be a Bonded job for this exact skill_id and version, otherwise nothing is paid and the step names what the chain holds.
  • The flow is resumable: an open job is not re-created, a posted bond is not re-posted, and a closed job is neither closed twice nor reopened.
  • An invalid reporter or an unknown mode is refused before any money moves.

Tests

  • Pipeline: 688 passed, 9 skipped (17 new).

E2E (testnet, Escrow v1 + Registry/Tokens v2, balances read back from chain)

…hes to a reporter

The STE-27 rehearsal had to call onchain.* directly for two things
orchestrate() could not express:

1. Lock before audit. orchestrate() ran register, verdict, mint and only
   then create_audit_request + post_bond, so neither fee nor bond was at
   stake while the audit ran. open_escrow_job() now locks both first; with
   escrow_lock="before_audit", orchestrate() closes that same job.
2. Slash to the reporter. _run_escrow always paid the admin.
   reporter_address now receives the bond; when empty the admin is paid
   and the step says "explicit fallback".

Decisions:
- The request_id travels in the journal (CREATE_REQUEST records it) and
  is never guessed. Before settling or slashing, get_request is read back
  and must be a Bonded job for this exact skill and version, because a
  journal is a local file that can be stale or copied. Otherwise nothing
  moves and the step fails naming what the chain holds.
- Default stays "after_verdict" so existing callers do not change.
- Resumable: an open job is not re-created, a posted bond not re-posted,
  a closed job neither re-closed nor silently re-opened.
- An invalid reporter (not G...) or unknown mode is refused before any
  money moves.

Tests: pipeline 673 passed (17 new: both orders, journal/chain
disagreement x3, crash between create and bond, re-runs, reporter and
fallback, invalid config).

E2E on testnet (Escrow v1 + Registry/Tokens v2), read back from chain:
- SAFE: request #20 Bonded with developer -0.1 / auditor -0.2 / escrow
  +0.3 USDC while the registry had no record of the bytes; after audit and
  orchestrate, Settled, net auditor +0.1, developer -0.1, is_verified true.
- poisoned: request #21 locked the same way; audit DANGEROUS; Slashed,
  reporter +0.2, developer fee refunded, auditor -0.2.
…ce, not product behaviour

Axel's note on the ACC: in a real report-and-slash flow there is always a
reporter; the admin fallback exists for our own seed and rehearsal runs.
@vercel

vercel Bot commented Sep 17, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
sterish Ready Ready Preview Sep 17, 2026 7:29am UTC

@Lin1er
Lin1er merged commit 9ac8ea1 into main Sep 17, 2026
5 checks passed

This branch was successfully deployed

1 active deployment
Preview — 329a58ca Deployed Sep 17, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant