-
Notifications
You must be signed in to change notification settings - Fork 11.8k
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
Sequential Proposal Ids Alt #5290
base: master
Are you sure you want to change the base?
Sequential Proposal Ids Alt #5290
Conversation
Co-authored-by: Hadrien Croubois <[email protected]>
|
uint256 proposalHash = super.hashProposal(targets, values, calldatas, keccak256(bytes(description))); | ||
_proposalIds[proposalHash] = ++_numberOfProposals; | ||
|
||
return super._propose(targets, values, calldatas, description, proposer); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel this is a bit cleaner
uint256 proposalHash = super.hashProposal(targets, values, calldatas, keccak256(bytes(description))); | |
_proposalIds[proposalHash] = ++_numberOfProposals; | |
return super._propose(targets, values, calldatas, description, proposer); | |
uint256 proposalId = super._propose(targets, values, calldatas, description, proposer); | |
_proposalIds[proposalId] = ++_numberOfProposals; | |
return proposalId; |
Otherwise, the super
in hashProposal is not needed:
uint256 proposalHash = super.hashProposal(targets, values, calldatas, keccak256(bytes(description))); | |
_proposalIds[proposalHash] = ++_numberOfProposals; | |
return super._propose(targets, values, calldatas, description, proposer); | |
uint256 proposalHash = hashProposal(targets, values, calldatas, keccak256(bytes(description))); | |
_proposalIds[proposalHash] = ++_numberOfProposals; | |
return super._propose(targets, values, calldatas, description, proposer); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
First: we need to set the mapping first so that the _propose
call fetches the correct proposalId.
Second: I believe we do need the super
as we do not want to be calling the overridden hashProposal
in the extension.
Alternative solution to #5280
PR Checklist
npx changeset add
)