Repository navigation
Escrow funding event, resumable SDK batches, endpoint health, and worker donation dry-run - #1024
Merged
DevMuhdishaq merged 2 commits intoOct 18, 2026
Conversation
|
@ykargeee-bit Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
…ealth, donation dry-run Additive escrow funding notification, resumable SDK batch submission, actionable endpoint health/error classification, and a worker donation dry-run. One branch for Dfunder#978/Dfunder#979/Dfunder#980/Dfunder#981. Dfunder#978 — Escrow funding event + transition audit - `create_escrow` now also emits the additive topic `escrow`/`funded` carrying `(commission_id, funder, amount, asset, ledger)`. The existing `escrow`/`created` topic and its `(commission_id, amount)` payload are unchanged, so downstream indexers keep working. - `finalize_atomic_commit` now emits `escrow`/`settled`, so a client watching the multi-step atomic-commit flow no longer has to poll `get_atomic_commit` after each of the four steps. - Audited every escrow transition (create/fund, partial, release, auto release, refund, dispute open, dispute resolve, cancel, expire) and documented the events in `docs/EVENTS.md` (with a state-transition audit table) and `docs/event_schemas.md` (`EscrowFunded`, `EscrowSettled`). - New `contracts/escrow/src/funding_event_tests.rs` covers the funded event values, the unchanged `created` payload, and the finalize event. Dfunder#979 — Resumable batch checkpoint - New `sdk::batch_checkpoint`: `BatchCheckpoint` (serde-serialisable calls + per-call `CallState` + cursor), a caller-supplied `BatchCheckpointStore` trait (with in-memory and atomic file implementations), and `ResumableBatch::submit_remaining`, which persists after every call. - Additive `BatchBuilder::checkpoint` / `from_checkpoint`; no existing `BatchBuilder` method changed. - Documented the guarantee explicitly: submission is at-least-once, a crash loses at most the one in-flight call, and callers must make calls idempotent (deterministic per-call marker) to dedupe. Complements `retry_async` rather than replacing it. Dfunder#980 — Endpoint health + actionable error taxonomy - New `StellarAidError` variants `EndpointUnreachable`, `RequestTimeout`, `BadRequest`, `TransactionRejected`, plus `is_retryable()` and `from_reqwest`/`from_http_status` classifiers. (Adding variants is a breaking change for exhaustive matches; acceptable for an unreleased SDK.) - `retry_async_classified` (predicate) and `retry_stellar_async`, so retrying can stop on a non-retryable error instead of retrying it fully. - Typed `SorobanRpcClient::health()` and `HorizonClient::health()`, bounded by a short `HEALTH_PROBE_TIMEOUT`; intentionally not a per-operation precondition. - `Config::validate()` checks the URL shapes and that the passphrase matches the named network — the most common integration mistake now fails immediately with a clear message. Dfunder#981 — Worker donation dry-run - New `POST /api/donations/validate` builds the same XDR as submit and simulates it via the real `SorobanRpcClient::simulate_transaction` RPC (not the placeholder `TransactionSimulator`, which returns success unconditionally). It reports `valid`, `gas_consumed`, the contract's own error, and an extracted `error_code`. - Cheap local validation first (donor, positive amount, non-zero campaign id, memo length) so obvious failures cost no round trip; the route has its own tighter rate-limit budget. `/api/donations/submit` is unchanged. - The success / contract-error / RPC-failure interpretation is a pure function (`interpret_simulation`), so it is covered without a network round trip. - Unit tests for a valid request, an invalid campaign id, a zero amount, an empty donor, an over-long memo, error-code extraction, and the three simulation outcomes. Enabling fixes needed for the SDK/worker to build: - Bump the workspace `stellar-strkey` pin from 0.0.2 to 0.0.8 — the SDK is written against the 0.0.8 API (`stellar_strkey::ed25519::*`, `stellar_strkey::Contract`) and 0.0.2 has neither; 0.0.8 is also what `stellar-xdr` 21 already pulls in. `transaction_builder.rs` updated to the 0.0.8 `Strkey::Contract` variant. - Declare `ed25519-dalek` in `sdk` (already a workspace dep) for key derivation. - Declare `hmac`, `sha2` and `hex` in `worker` for the webhook signature verification already present in `webhooks.rs`. Note: `worker` is still not a workspace member, so its integration cannot be verified in CI; that remains a separate prerequisite (as the issue states). Closes Dfunder#978 Closes Dfunder#979 Closes Dfunder#980 Closes Dfunder#981
ykargeee-bit
force-pushed
the
feature/escrow-funding-event-sdk-batch-health-worker-dryrun
branch
2 times, most recently
from
October 17, 2026 06:49
a4673c9 to
129d874
Compare
7 tasks
Contributor
|
Merged after resolving merge conflicts against Conflict resolutions (merge commit df9bf86):
Everything else (escrow funding events, SDK batch paths, worker dry-run, health worker) merged cleanly. Thanks! |
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
Four open issues, one branch: an additive escrow funding event, a resumable
batch checkpoint for the SDK, actionable endpoint health + error
classification, and a worker donation dry-run. All changes are additive where
they touch existing APIs.
#978 — Emit an escrow funding event (and audit the transitions)
An artist had no way to learn when an escrow was funded short of polling. The
existing
escrow/createdevent only carries(commission_id, amount), and itspayload is indexed downstream, so it is left untouched.
create_escrowalso emits the additive topicescrow/fundedwith(commission_id, funder, amount, asset, ledger)— enough to notify without afollow-up read.
finalize_atomic_commitemitsescrow/settled, so a client watching thefour-step atomic-commit flow is not forced to poll
get_atomic_commit.docs/EVENTS.md(new state-transition audit table) anddocs/event_schemas.md(EscrowFunded,EscrowSettled).contracts/escrow/src/funding_event_tests.rs.#979 — Resumable batch submission
BatchBuilder::take_calls()is one-shot: a process that dies between twosubmissions loses the rest of the batch.
sdk::batch_checkpoint:BatchCheckpoint(serde-ready), acaller-supplied
BatchCheckpointStoretrait (MemoryCheckpointStorefortests,
FileCheckpointStorewith atomic temp-write + rename), andResumableBatch::submit_remaining, which persists after every call.BatchBuilder::checkpoint/from_checkpoint; no existing methodchanged.
loses at most the one in-flight call, and callers must make calls idempotent
(deterministic per-call marker) to dedupe. This is complementary to
retry_async, not a replacement.#980 — Endpoint health + actionable error taxonomy
StellarAidErrorvariants:EndpointUnreachable,RequestTimeout,BadRequest,TransactionRejected, withis_retryable()andfrom_reqwest/from_http_status. Adding variants breaks exhaustive matches;acceptable for an unreleased SDK and called out here.
retry_async_classified(predicate) andretry_stellar_async— the fix thatlets retrying stop on a non-retryable error instead of retrying it fully.
SorobanRpcClient::health()andHorizonClient::health(), bounded by ashort
HEALTH_PROBE_TIMEOUT, for setup/diagnostics only.Config::validate()verifies the URLs and that the passphrase matches thenamed network, so the most common integration mistake fails immediately with
a clear message.
#981 — Worker donation dry-run
POST /api/donations/validatebuilds the same XDR as submit and simulatesit through the real
SorobanRpcClient::simulate_transactionRPC — not theplaceholder
TransactionSimulator, which returns success unconditionally(Fix SDK transaction_simulator.rs returning placeholder results #795). It returns
valid,gas_consumed, the contract's own error, and anextracted
error_code.memo length) so obvious failures cost no round trip. The route has its own
tighter rate-limit budget;
/api/donations/submitis unchanged. A stale-since-simulation note is included in every response.
(
interpret_simulation), so those paths are unit-tested without a networkround trip.
over-long memo, error-code extraction, and the three simulation outcomes.
Enabling fixes (called out deliberately)
These are outside the four issues but required for the SDK/worker to build; the
issue bodies name them as prerequisites.
stellar-strkey0.0.2 → 0.0.8 (workspace). The SDK is written against the0.0.8 API (
stellar_strkey::ed25519::*,stellar_strkey::Contract); 0.0.2exposes neither. 0.0.8 is also what
stellar-xdr21 already pulls in, so theduplicate 0.0.2 copy goes away.
transaction_builder.rsmoves from thenonexistent
Strkey::ContractIdtoStrkey::Contract.ed25519-dalekdeclared insdk(already a workspace dependency) for thekey derivation in
utils/keypair.rsandsetup/token_setup.rs.hmac,sha2,hexdeclared inworker, already used bywebhooks.rs::verify_signature.Notes / limitations
workeris still not a workspace member, so its integration (includingthe new tests) cannot run in CI until that is fixed. That is a separate
prerequisite, as Add a resumable batch submission to the SDK so a large call set survives a crash #979/Add a dry-run submit to the worker that returns the XDR without submitting it #981 state.
Cargo.lockwill be refreshed by the firstcargoinvocation after thestellar-strkeybump.reviewed by inspection against the crate APIs.
Closes #978
Closes #979
Closes #980
Closes #981