-
Notifications
You must be signed in to change notification settings - Fork 18
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
Fix/gas refund on set vote #185
Fix/gas refund on set vote #185
Conversation
…iguration of voteGas and maxGasPrice
…ed test related to voteGas config
So we are going with the assumption that gas will be around that cost regardless of chain? |
That's the assumption, yes. If that's not correct, then gas consumption must be calculated every time the function is called. |
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.
Set the limit to 117 000, not 100 000
@AugustoL done! |
@@ -179,7 +179,7 @@ contract BaseERC20Guild { | |||
require(_proposalTime > 0, "ERC20Guild: proposal time has to be more than 0"); | |||
require(_lockTime >= _proposalTime, "ERC20Guild: lockTime has to be higher or equal to proposalTime"); | |||
require(_votingPowerForProposalExecution > 0, "ERC20Guild: voting power for execution has to be more than 0"); | |||
require(_voteGas <= 100000, "ERC20Guild: vote gas has to be equal or lower than 100.000"); // 100.000 is 85% of the gas amount to execute setVote | |||
require(_voteGas <= 117000, "ERC20Guild: vote gas has to be equal or lower than 117.000"); |
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.
Remove the . in 117.000 please, use the plain amount 117000, we never used . for numbers and it might be confussing. Also americans use that for decimals, and , for units.
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.
Done!
Relates to issue #159, and DXD-11 in the audit.
Fixes
setVote
exploit whenvoteGas
amount is set above the actual gas spent for the function call, enabling voters to get refunded more than what they spent to call the function.It sets a hard limit of 100.000 gas (~85% of the actual 117.000 gas needed to execute
setVote()
).