feat: add currentVoteEpoch oprf-accountant helper to BillingContract - #864
Closed
fabian1409 wants to merge 1 commit into
Closed
feat: add currentVoteEpoch oprf-accountant helper to BillingContract#864fabian1409 wants to merge 1 commit into
fabian1409 wants to merge 1 commit into
Conversation
fabian1409
force-pushed
the
fg/billing-contract-oprf-accountant-hepler
branch
from
July 14, 2026 07:47
a41870b to
6c754d3
Compare
Collaborator
Author
|
approach to billing will be different, so this is obsolete |
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.
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)onBillingContract/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), andblock.timestamp. Intended so an OPRF billing accountant can decide when/what to vote without extra RPCs.The era walk mirrors
epochWatermarks/_latestClosedEpochlogic but keys off each era’s span start rather than voting-window close, so mid-epoch callers still see the previous elapsed epoch.existsis false only while epoch 0 is still running;alreadyVotedis per-signer and resets afterfinalizeEpochsprunes transient submitter state.Foundry coverage adds a dedicated
currentVoteEpochtest 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.