forked from ExocoreNetwork/exocore-contracts
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
remove duplicated code and optimize (ExocoreNetwork#74)
* refactor(bootstrap): optimize checks Instead of iterating through the validator set, use a mapping to identify whether the consensus key and the name are unique. Closes ExocoreNetwork#73 and ExocoreNetwork#18 * fix: replace ++i with i++ closes ExocoreNetwork#68 * refactor: DRY time check Fixes ExocoreNetwork#21 * fix: validate cons key non-empty * fix: use `block.timestamp >= lockTime` The `isLocked` function returns true if `block.timestamp >= lockTime`, which is exactly what the `_validateSpawnTimeAndOffsetDuration` function should do. The spawn time must not be in the past, or exactly at the current block. The offset duration must be greater than equal to the spawn time, however, if they are equal, the lock time ends up in the past, and it is rejected. * fix: init i = 0 in for loops * fix: use correct var when emitting event Use storage var instead of function param * fix: don't touch test files in this PR * test: add offset duration > spawn time test Split from >= case since the errors are different * refactor: remove duplicated code
- Loading branch information
1 parent
712cfd5
commit 61ad95f
Showing
12 changed files
with
136 additions
and
101 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.