Skip to content
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

Timestamp of first block is not validated #2587

Closed
ebuchman opened this issue Oct 9, 2018 · 1 comment
Closed

Timestamp of first block is not validated #2587

ebuchman opened this issue Oct 9, 2018 · 1 comment
Assignees
Labels
C:consensus Component: Consensus T:bug Type Bug (Confirmed)
Milestone

Comments

@ebuchman
Copy link
Contributor

ebuchman commented Oct 9, 2018

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.

@ebuchman ebuchman added T:bug Type Bug (Confirmed) C:consensus Component: Consensus labels Oct 9, 2018
@ebuchman ebuchman added this to the launch milestone Oct 9, 2018
@melekes melekes self-assigned this Oct 10, 2018
melekes added a commit that referenced this issue Oct 10, 2018
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.
```
ebuchman pushed a commit that referenced this issue Oct 12, 2018
* require block.Time of the fist block to be genesis time

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.
```

* do not accept blocks with negative height

* update changelog and spec

* nanos precision for test genesis time

* Fix failing test (#2607)
@ebuchman
Copy link
Contributor Author

Merged in #2594

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C:consensus Component: Consensus T:bug Type Bug (Confirmed)
Projects
None yet
Development

No branches or pull requests

2 participants