Skip to content

feat: prove accepted trades in the background ping loop - #417

Open
Step7750 wants to merge 4 commits into
masterfrom
feat/background-accepted-proofs
Open

feat: prove accepted trades in the background ping loop#417
Step7750 wants to merge 4 commits into
masterfrom
feat/background-accepted-proofs

Conversation

@Step7750

@Step7750 Step7750 commented Sep 3, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Extends the trade ping alarm to notarize accepted sales the same way it already handles rollbacks and failed trades.
  • Gated on /v1/meta/notary accepted.background; Firefox excluded as before.
  • Per-trade retry throttle so the same sale isn't re-proven every tick.
  • Unit tests.

Closes CSF-1969


Note

Medium Risk
Extends background notary proving for marketplace trades; logic must stay aligned with server matching rules, but changes are gated on meta flags and throttled retries.

Overview
The periodic CSFloat trade ping now notarizes accepted sales in the background, parallel to existing rollback and failed-trade handling.

A new accepted_trade module matches pending seller sales to Steam history (committed/complete, in trade protection, asset sent to buyer, latest attempt wins over rollbacks) and skips trades already marked with notary_accepted_at. Proof runs only when accepted.background is enabled in notary meta (Firefox still excluded), with a 6-hour per-trade retry via NOTARY_ACCEPTED_PROOF_ATTEMPTS so declined proofs are not retried every ~3-minute alarm tick, plus the existing 60-minute backoff after a background proof failure.

notary.ts generalizes the background feature-flag check for both rollback and accepted. SlimTrade gains optional notary_accepted_at for client-side eligibility. Unit tests cover matching edge cases and retry filtering.

Reviewed by Cursor Bugbot for commit eb9809b. Bugbot is set up for automated code reviews on this repo. Configure here.

- alarms/accepted_trade.ts: findAcceptedTrades (seller-side, mirrors nezha/phoenix predicate) + pingAcceptedTrades
- gated on meta/notary accepted.background; per-trade 6h retry throttle since the alarm runs every 3 minutes
- shared isBackgroundNotaryEnabled for rollback/accepted meta lookups
- Trade.accepted_proof_verified_at; unit tests
@Step7750
Step7750 requested a review from GODrums September 3, 2026 16:52
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