Conversation
sblOWPCKCR
reviewed
Sep 21, 2021
Contributor
sblOWPCKCR
left a comment
There was a problem hiding this comment.
looks good to me, only 1 minor comment
| function deny(bytes32 txHash) | ||
| external override auth | ||
| { | ||
| Proposal memory proposal = proposals[txHash]; |
Contributor
There was a problem hiding this comment.
nit: I think you can save a tiny bit of gas with this:
Proposal storage proposal = proposals[txHash];
require(proposal.state == STATE.SCHEDULED);
proposal.state = STATE.DENIED;
^ won't need to copy storage to memory, won't need to look up storage twice
Contributor
Author
There was a problem hiding this comment.
Maybe I'm doing something wrong, but using the pattern proposed in Timelock (for which I have tests) I get these gas costs:
·--------------------------------|---------------------------|---------------|----------------------------·
| Solc version: 0.8.6 · Optimizer enabled: true · Runs: 20000 · Block limit: 9500000 gas │
·································|···························|···············|·····························
| Methods │
·············|···················|·············|·············|···············|··············|··············
| Contract · Method · Min · Max · Avg · # calls · eur (avg) │
·············|···················|·············|·············|···············|··············|··············
| Timelock · approve · 36252 · 36264 · 36263 · 32 · - │
·············|···················|·············|·············|···············|··············|··············
| Timelock · execute · 46473 · 95392 · 56780 · 19 · - │
·············|···················|·············|·············|···············|··············|··············
While copying to memory is cheaper:
·--------------------------------|---------------------------|---------------|----------------------------·
| Solc version: 0.8.6 · Optimizer enabled: true · Runs: 20000 · Block limit: 9500000 gas │
·································|···························|···············|·····························
| Methods │
·············|···················|·············|·············|···············|··············|··············
| Contract · Method · Min · Max · Avg · # calls · eur (avg) │
·············|···················|·············|·············|···············|··············|··············
| Timelock · approve · 34793 · 34805 · 34804 · 32 · - │
·············|···················|·············|·············|···············|··············|··············
| Timelock · execute · 45794 · 94713 · 56101 · 19 · - │
·············|···················|·············|·············|···············|··············|··············
devtooligan
reviewed
Sep 22, 2021
devtooligan
approved these changes
Sep 22, 2021
Contributor
devtooligan
left a comment
There was a problem hiding this comment.
Looks good to me, clean. I looked it over twice and couldn't find anything to improve on
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
With the OptimisticTimelock, all proposals are automatically approved, but an account with
denypermissions can take them off the queue.In the event of a DoS attack, simply take the
schedulepermissions from the atacker.