feat: continue implementing oprf-accountant#849
Conversation
|
Warning Review the following alerts detected in dependencies. According to your organization's Security Policy, it is recommended to resolve "Warn" alerts. Learn more about Socket for GitHub.
|
09d1437 to
e1d94b5
Compare
37cf045 to
81bae2b
Compare
81bae2b to
4023a29
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit de5c9fe. Configure here.
| tracing::info!(epoch, ?counts, "submitting billing vote for epoch"); | ||
| self.vote_for_epoch(epoch, counts).await?; | ||
| tracing::info!(epoch, "successfully submitted billing vote for epoch"); | ||
| self.db.set_epoch_cursor(epoch).await?; |
There was a problem hiding this comment.
Cursor advances without on-chain vote
High Severity
After each successful tick vote window, set_epoch_cursor runs even though vote_for_epoch only returns early for empty counts and otherwise hits a TODO without calling submitBillingVotes. The DB then records the epoch as processed while the chain never receives billing votes for non-empty aggregates.
Reviewed by Cursor Bugbot for commit de5c9fe. Configure here.
There was a problem hiding this comment.
this will be added in a followup PR
|
replaced by #858 |


Note
Medium Risk
Changes affect billing epoch assignment and vote timing against a live contract and wallet key, but votes are not yet submitted on-chain while the cursor can still advance after the stub vote path.
Overview
Adds an
OprfAccountantServicebackground worker that buckets incoming billable RP requests by epoch (fromexpires_atand on-chain timing eras), persists them in Postgres, and on each tick refreshes eras from theBillingContract, decides whether the last closed epoch’s voting window is open (including a configurable flush offset), aggregates per-RP counts, and advances anepoch_cursorso restarts do not re-vote the same epoch. On-chainsubmitBillingVotes/ EIP-712 signing is still a TODO invote_for_epoch.The HTTP
POST /reqpath now records batches through the accountant instead of writing Postgres directly. Config gains billing contract address, RPC, wallet key, tick interval, and voting-window offset; startup spawns the worker alongside Axum and adds bounded graceful shutdown. Migrations addepoch_cursor, store epoch onrp_signatures, and make signature optional. Tests cover era/epoch math, vote-window edge cases, and Postgres aggregation (including per-epoch nonce uniqueness).Reviewed by Cursor Bugbot for commit de5c9fe. Bugbot is set up for automated code reviews on this repo. Configure here.