Skip to content

feat(server): escrow relay prepare and submit endpoints for hires (#96) [chain tracker] - #122

Merged
TOMOKI977 merged 28 commits into
mainfrom
feat/96-escrow-relay
Oct 8, 2026
Merged

TOMOKI977 merged 28 commits into
mainfrom
feat/96-escrow-relay

Conversation

@moises-cisneros

@moises-cisneros moises-cisneros commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Closes #96

Draft, do not merge until every PR of the chain is reviewed and integrated.

Replaces #119 (about 20k lines), split after its review into 4 chained PRs. The first targets this branch and each later one targets the previous PR's branch, so review each against its parent. This branch carries no changes of its own.

Chain

  1. feat(server): escrow relay foundations: protocol, config, envelope codec and RPC (#96) #126 escrow relay foundations: protocol, config, envelope codec and RPC: 2329 authored lines
  2. feat(server): persist preparations and prepare unsigned escrow envelopes (#96) #129 persist preparations and prepare unsigned escrow envelopes: 2976 authored lines
  3. feat(server): submit signed escrow calls and expose the relay in the hire endpoint (#96) #132 submit signed escrow calls and expose the relay in the hire endpoint: 3097 authored lines
  4. docs: escrow relay API, ADRs, README, testnet e2e and OpenSpec archive (#96) #134 escrow relay API, ADRs, README, testnet e2e and OpenSpec archive: 2016 authored lines

Authored lines exclude generated code, migrations and recorded fixtures. The ones over 400 are code plus the tests of code that moves funds; they need size:exception.

Narrow rules scoped by file path and line shape for env var name constants, generated class-name lookups and recorded ledger keys. Migrates the existing allowlist to [[allowlists]], which cannot be mixed with the deprecated [allowlist].
Adds PreparedTransaction, CreateHireResult, HireDetail, Hire, Payment and Puls3ApiException, the escrow_preparation table and the requestId, input and jobId columns of hire. Part of #96.
Reads the preparation validity, inclusion fee and platform fee from the environment with no defaults (ADR-0005 D3). Documents the keys in .env.example. Part of #96.
Integration branch for the chained PRs that replace #119. It carries no changes of its own.
Defines how the relay decodes, compares and re-encodes a transaction envelope. Part of #96.
…opes

Adds stellar_dart and crypto. The spike decodes recorded testnet envelopes, re-encodes them byte for byte and checks the network hash and the ed25519 signature. Part of #96.
Decodes a signed envelope, compares it field by field with its preparation (contract, function, arguments, source, time bounds) and verifies the signature. Part of #96.
Adds account sequence lookup and the simulate, send and get-transaction calls that carry an unsigned or signed envelope. Part of #96.
A new preparation supersedes the previous one, and each preparation has at most one submission, proven by a Postgres race test. Part of #96.
Gives the relay its view of a hire: idempotency key, input and escrow job id, with a hire having no status until create_job is confirmed. Part of #96.
prepareCreateJob, prepareFund, prepareComplete and prepareReject build, simulate and store an unsigned envelope. A new preparation supersedes the previous one, and the configuration has no defaults. Part of #96.
submitEscrowCall checks the signed envelope against its preparation, stores a ChainSubmission as submitted and only then sends it. Chain outcomes never throw, and a repeated submit returns the existing record. Part of #96.
HireEscrowEffects.onJobCreated binds the job id once and opens the hire. Part of #96.
createHire returns the hire with an unsigned create_job, and a repeated requestId from the same wallet returns the same hire or IdempotencyKeyReused. Part of #96.
createHire, prepareCreateJob, prepareFund, prepareComplete, prepareReject and submitEscrowCall, each behind requireLogin through an injectable SessionWallet. The production default fails closed with AuthenticationUnavailable until wallet sessions land (#25). Regenerates the endpoint and client. Part of #96.
Lists ChainDataUnavailable for submitEscrowCall, drops the TypeScript sidecar from the ADRs and documents the config keys and the end-to-end run. Part of #96.
Runs the real endpoint, services, codec, RPC client and chain tracker against testnet. The consumer key stays in the process environment. Part of #96.
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

Deploying puls3 with  Cloudflare Pages  Cloudflare Pages

Latest commit: f54fbb5
Status: ✅  Deploy successful!
Preview URL: https://953dbd20.puls3-4lw.pages.dev
Branch Preview URL: https://feat-96-escrow-relay.puls3-4lw.pages.dev

View logs

@TOMOKI977

Copy link
Copy Markdown
Contributor

Thanks for splitting this so cleanly, Moises. Our messages crossed this morning, and the chain works well.

I approved #123 to #134. Each slice is part of the code I reviewed in full on #119 at b0a4adc. I diffed the tip of the chain (919ffb3) against b0a4adc: apart from main's #112, the only differences are .env.example (the three relay variables) and .gitleaks.toml. The gitleaks allowlists are nicely scoped, each one limited to generic-api-key and requiring both a path and a line shape.

The follow-ups from the #119 review still apply. I'll open an issue for them after the demo.

Merge order: to keep each parent's history intact, please merge from the top down with merge commits (not squash), #123 into feat/96-escrow-relay first, then each next slice. Then squash #122 into main once, with a conventional title. Squash-merging a parent would force a rebase of every child. If you prefer another order, tell me and I can help.

…-12-openspec

docs: escrow relay API, ADRs, README, testnet e2e and OpenSpec archive (#96)
…-10-endpoint

feat(server): submit signed escrow calls and expose the relay in the hire endpoint (#96)
…-07-prepare

feat(server): persist preparations and prepare unsigned escrow envelopes (#96)
…-04-rpc-client

feat(server): escrow relay foundations: protocol, config, envelope codec and RPC (#96)
@TOMOKI977
TOMOKI977 marked this pull request as ready for review October 8, 2026 19:36

@TOMOKI977 TOMOKI977 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved. The chain (#126, #129, #132, #134) is merged into this branch. Its tree at cb01469 is identical to 919ffb3, which I reviewed in full on #119 (b0a4adc) plus the CI fix. The follow-ups from the #119 review will go in a separate issue. Updating with main and squash-merging once CI is green.

@TOMOKI977
TOMOKI977 merged commit f799ca5 into main Oct 8, 2026
10 checks passed
@TOMOKI977
TOMOKI977 deleted the feat/96-escrow-relay branch October 8, 2026 19:45
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.

feat(server): escrow relay prepare and submit endpoints for hires

2 participants