feat: continue implementing oprf-accountant v2#858
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 6 potential issues.
❌ 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 5d6ff03. Configure here.
5d6ff03 to
9c43150
Compare
|
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.
|
9c43150 to
208794b
Compare
… to assign epoch at vote time instead of when we get them
208794b to
23df385
Compare
96f447c to
7e3f534
Compare
| #[instrument(level = "info", skip_all, name = "accountant_service::tick")] | ||
| pub(crate) async fn tick(&self) -> eyre::Result<()> { | ||
| if let MaybeVotes::Votes { epoch, counts } = self.maybe_get_votes().await? { | ||
| tokio::time::timeout(self.vote_timeout, self.vote_for_epoch(epoch, counts)).await??; |
There was a problem hiding this comment.
nit: maybe add some .context() here to the three ?. Helps in case this actually happens

Note
Medium Risk
Touches billing semantics, private-key signing, and a breaking DB shape; votes are not fully submitted on-chain yet, so behavior in production depends on finishing submission and aligning with the pending
currentVoteEpochcontract API.Overview
Adds a background OprfAccountantService that periodically calls
BillingContract.currentVoteEpoch(), waits for the configured post-epoch offset, aggregates per-RP request counts from Postgres for the epoch’s[epochStart, epochEnd)span, and builds EIP-712–signedSignedVoteChunks forsubmitBillingVotes(on-chain submission is still commented out pending wallet/signer split and contract ABI).Storage and ingestion: The
rp_signaturesmigration is reshaped for v2—drops per-rowepochand the(rp_id, nonce, epoch)uniqueness rule, addsactionand optionalwip101_data, and makessignaturenullable. Batch inserts persist the new fields;POST /reqnow returns 500 on DB errors.rp_counts_for_epoch_spansupplies vote data withCOUNT(DISTINCT nonce)perrp_id, ordered for the contract.Wiring: Config gains billing contract address, RPC, wallet key, tick/vote timeouts, voting-window offset, and vote chunk size. Startup spawns the accountant loop alongside Axum and joins it on shutdown. Unit/integration tests cover vote-window logic, chunk signing, and aggregation edge cases.
Cargo.lockpicks upalloy/web3andtaceo-nodes-commontest-deps (e.g.axum-test).Reviewed by Cursor Bugbot for commit 90766b9. Bugbot is set up for automated code reviews on this repo. Configure here.