state: require block.Time of the fist block to be genesis time#2594
Merged
state: require block.Time of the fist block to be genesis time#2594
Conversation
Refs #2587: ``` We only start validating block.Time when Height > 1, because there is no commit to compute the median timestamp from for the first block. This means a faulty proposer could make the first block with whatever time they want. Instead, we should require the timestamp of block 1 to match the genesis time. I discovered this while refactoring the ValidateBlock tests to be table-driven while working on tests for #2560. ```
Contributor
Author
|
milosevic
reviewed
Oct 10, 2018
Codecov Report
@@ Coverage Diff @@
## develop #2594 +/- ##
===========================================
- Coverage 61.47% 61.42% -0.05%
===========================================
Files 202 202
Lines 16703 16708 +5
===========================================
- Hits 10268 10263 -5
- Misses 5568 5577 +9
- Partials 867 868 +1
|
milosevic
approved these changes
Oct 11, 2018
ebuchman
approved these changes
Oct 12, 2018
| b.mtx.Lock() | ||
| defer b.mtx.Unlock() | ||
|
|
||
| if b.Height < 0 { |
Contributor
There was a problem hiding this comment.
Nice. Though technically we don't accept b.Height == 0 either
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.
Refs #2587