Skip to content

Use NoncesKeyed in Governor for Voting by Sig #5565

@arr00

Description

@arr00

🧐 Motivation

Using a nonce in addition to proposal id in governor makes it hard to have a functional vote by sig service. This is because votes by sig must have a sequential nonce with no gaps or repeats--if a user decides to take one of their votes by sig on-chain, all other pending votes they have are invalidated. This isn't the desired flow and it isn't necessary.

📝 Details

_hashTypedDataV4(keccak256(abi.encode(BALLOT_TYPEHASH, proposalId, support, voter, _useNonce(voter)))),

This line asserts that votes by sig have sequential nonces which isn't actually necessary. The OZ governor introduces voting by nonce as it is possible that a user would vote multiple times for a single proposal id (so the proposal id can't be the only source of entropy).

It is, however, useful to ensure that a sequence binds together votes on a specific proposal. We should use NoncesKeyed with the key being the proposal id and allow for the 0 key to continue working (no breaking changes).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions