Skip to content

feat: add currentVoteEpoch oprf-accountant helper to BillingContract - #864

Closed
fabian1409 wants to merge 1 commit into
feat/billing-contract-v1from
fg/billing-contract-oprf-accountant-hepler
Closed

feat: add currentVoteEpoch oprf-accountant helper to BillingContract#864
fabian1409 wants to merge 1 commit into
feat/billing-contract-v1from
fg/billing-contract-oprf-accountant-hepler

Conversation

@fabian1409

@fabian1409 fabian1409 commented Jul 14, 2026

Copy link
Copy Markdown
Collaborator

Note

Low Risk
Additive view-only API with no storage or authorization changes; timing/era edge cases are covered by extensive new tests, though incorrect epoch selection would mislead off-chain voters.

Overview
Adds currentVoteEpoch(signer) on BillingContract / IBillingContract: a single read that returns the latest fully elapsed epoch (not the in-flight one), its [epochStart, epochEnd) span, votingWindowEnd, whether that signer has closed a chunked vote (hasVoted), and block.timestamp. Intended so an OPRF billing accountant can decide when/what to vote without extra RPCs.

The era walk mirrors epochWatermarks / _latestClosedEpoch logic but keys off each era’s span start rather than voting-window close, so mid-epoch callers still see the previous elapsed epoch. exists is false only while epoch 0 is still running; alreadyVoted is per-signer and resets after finalizeEpochs prunes transient submitter state.

Foundry coverage adds a dedicated currentVoteEpoch test block (genesis, progression, per-signer votes, incomplete chunks, finalization, timing-era changes, EpochTooLarge, and multi-epoch participation).

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

@fabian1409
fabian1409 requested a review from a team as a code owner July 14, 2026 07:42
@fabian1409
fabian1409 force-pushed the fg/billing-contract-oprf-accountant-hepler branch from a41870b to 6c754d3 Compare July 14, 2026 07:47
@fabian1409

Copy link
Copy Markdown
Collaborator Author

approach to billing will be different, so this is obsolete

@fabian1409 fabian1409 closed this Aug 5, 2026
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