Skip to content

feat: add voteWithData and voteWithDataBatch (#62)#106

Open
Tranquil-Flow wants to merge 3 commits into
mainfrom
fix/62-vote-with-data
Open

feat: add voteWithData and voteWithDataBatch (#62)#106
Tranquil-Flow wants to merge 3 commits into
mainfrom
fix/62-vote-with-data

Conversation

@Tranquil-Flow
Copy link
Copy Markdown

Summary

  • Adds voteWithData(points, data) for direct voting with arbitrary downstream data (no EIP-712 signature required)
  • Adds voteWithDataBatch(voters, points, data) with onlyOwner for keeper/relayer batch flows
  • Adds castVoteWithSignatureAndParams() for signature-based voting with additional parameters
  • Introduces _processVoteWithParams / _handleAdditionalVoteData hook pattern in AbstractVotingModule for downstream extensibility
  • AlreadyVotedInCurrentCycle guard prevents double-counting in both single and batch paths
  • 12 new tests covering all paths: events, vote recording, hook invocation, empty bytes, invalid points, already-voted revert, non-owner batch revert, duplicate voter in batch, signature+params

Closes #62

Test plan

  • testVoteWithDataEmitsEvent — VoteWithData event emitted
  • testVoteWithDataRecordsVote — vote distributions match points
  • testVoteWithDataCallsHandleAdditionalVoteData — hook receives correct voter + data
  • testVoteWithDataBatch — processes multiple voters atomically
  • testVoteWithDataRevertsAlreadyVoted — revert on double vote
  • testVoteWithDataBatchRevertsNonOwner — only owner can batch
  • testVoteWithDataBatchRevertsDuplicateVoter — catches duplicate in same batch
  • testCastVoteWithSignatureAndParams — signature path with additional data
  • Full suite: 191 tests pass

Tranquil-Flow and others added 3 commits April 4, 2026 19:18
Add typed-ballot extensions to voting module interface and
implementations. voteWithData accepts arbitrary bytes payload
alongside vote amount, enabling off-chain reasoning attestation
and structured ballot metadata.
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.

Add voting functions with additional bytes parameter for downstream implementations (e.g., multipliers)

1 participant