-
Notifications
You must be signed in to change notification settings - Fork 12k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use NoncesKeyed
in Governor for Voting by Sig
#5565
Comments
NoncesKeyed
for Voting by SigNoncesKeyed
in Governor for Voting by Sig
I would like to implement this, This is the way I think it should be implemented, based on the information in the issue. In order to maintain backward compatibility, we will leave the We will create two new functions that use Nonces keyed by the proposal id.
we'll create two new constants
we'll use these as prefixes to the signature data for our two new functions. we'll replace Nonces with NoncesKeyed in the contract, and use 0 keys in the legacy functions, and the proposal id as the key in the new functions. please let me know if that sounds good, ill make a PR if it does. thank you!! |
Thanks for your interest here @tushar994! I only saw your comment after creating a PR myself for this issue--feel free to review it (#5574). |
🧐 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
openzeppelin-contracts/contracts/governance/Governor.sol
Line 583 in ca7a4e3
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).
The text was updated successfully, but these errors were encountered: