You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the Bootstrap.sol contract, the logic for checking spawn times and lock times is repeated multiple times. This logic can be refactored into a private function to reduce redundancy and improve maintainability. This issue tracks the suggested optimization for future implementation.
* 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 #73 and #18
* fix: replace ++i with i++
closes#68
* refactor: DRY time check
Fixes#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
In the Bootstrap.sol contract, the logic for checking spawn times and lock times is repeated multiple times. This logic can be refactored into a private function to reduce redundancy and improve maintainability. This issue tracks the suggested optimization for future implementation.
Related pull request: #17
Comment for context: #17 (comment)
The text was updated successfully, but these errors were encountered: