-
Notifications
You must be signed in to change notification settings - Fork 12
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
refactor: use block numbers to track time #210
Conversation
Codecov Report
@@ Coverage Diff @@
## main #210 +/- ##
==========================================
- Coverage 81.66% 80.82% -0.84%
==========================================
Files 29 28 -1
Lines 469 459 -10
Branches 114 111 -3
==========================================
- Hits 383 371 -12
Misses 73 73
- Partials 13 15 +2
|
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.
tACK
// If a proposal exists, then its execution payload hash will be non-zero. | ||
if (proposal.executionPayloadHash == 0) revert InvalidProposal(); |
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.
Is it really impossible to create a proposal with an empty execution payload? Imagine we want to "ratify" something on-chian, then the execution payload could be empty right?
I think proposal.startBlockNumber == 0
would be a better check here
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.
but then the payload hash would be keccak(0)
so non zero. Wheras it would technically be possible to have a start block number of zero (ie the proposal was created in the genesis block and there is no voting delay)
src/interfaces/IVotingStrategy.sol
Outdated
/// @param blockNumber The snapshot block number to get the voting power at. If a particular voting strategy | ||
/// requires a block number instead of a block number, the strategy should resolve the | ||
/// block number to a block number. |
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.
can remove the whole "resolve" part
Question: how does this PR help #193 ? |
there is now no state changes in the voting strategies, so they are view functions and can be queried off chain fairly simply |
didn't notice the |
chore: natspec typo
* refactor: timestamps to numbers in space * refactor: block numbers in proposal status funcs * refactored: removed timestamp resolver * refactor: proposal validation to use block nubmers * refactor: removed snapshot block number * chore: updated tests * refactor: make getVotingPower a view function * refactor: revert active proposal limiter to timestamps * refactor: revert timelocks to timestamps * chore: fixed tests * Update IVotingStrategy.sol chore: natspec typo --------- Co-authored-by: Orlando <[email protected]>
* audit: use uint256 instead of bool in mappings * opti: use uint256 instead of bools in other mappings * chore: define TRUE, FALSE in types * refactor: use TRUE, FALSE consts from types.sol * chore: comment explain pupose of boolean aliases * audit: prevent reentrancy issues in execute function (#207) * audit: prevent reentrancy issues in execute function * comment: add comment for cached proposal * comment: remove comment for finalization status modification * chore: CEI explanation * chore: typo --------- Co-authored-by: Orlando <[email protected]> * refactor: use block numbers to track time (#210) * refactor: timestamps to numbers in space * refactor: block numbers in proposal status funcs * refactored: removed timestamp resolver * refactor: proposal validation to use block nubmers * refactor: removed snapshot block number * chore: updated tests * refactor: make getVotingPower a view function * refactor: revert active proposal limiter to timestamps * refactor: revert timelocks to timestamps * chore: fixed tests * Update IVotingStrategy.sol chore: natspec typo --------- Co-authored-by: Orlando <[email protected]> --------- Co-authored-by: Orlando <[email protected]> Co-authored-by: Orland0x <[email protected]>
closes #193, #174, #168
Migrates the space contract and execution strategy proposal status functions. to use block numbers instead of timestamps. Note that this does not include the ActiveProposalLimiter, and Timelock contracts which still use timestamps.