Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

Decouple timestamp open-block-assignment/verification to Engine #8305

Merged
merged 1 commit into from
Apr 5, 2018

Conversation

sorpaas
Copy link
Collaborator

@sorpaas sorpaas commented Apr 4, 2018

Fixes #7694

The bug happens because when Parity constructs a new open block, the timestamp will be set at least one second ahead of parent timestamp. For most of the time, this works fine, and most Engine rules also require this. However, because dev chain seals a block for every transaction, it becomes a problem if one tries to send more than one transaction per second.

This PR adds two new predefined functions in Engine trait, open_block_header_timestamp and is_timestamp_valid. All other engines are unchanged except InstantSeal, where open_block_header_timestamp would not do "plus one", and is_timestamp_valid would accept it if parent timestamp equals to current one. Those replaces hard coded rules in verification mod and Header::set_timestamp_now.

This also makes the function set_timestamp_now unused. And I read a comment saying this function "kind of sucks"... So I removed it.

@sorpaas sorpaas added A0-pleasereview 🤓 Pull request needs code review. M4-core ⛓ Core client code / Rust. labels Apr 4, 2018
@sorpaas sorpaas added this to the 1.11 milestone Apr 4, 2018
Copy link
Collaborator

@debris debris left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

neat!

@debris debris added A8-looksgood 🦄 Pull request is reviewed well. and removed A0-pleasereview 🤓 Pull request needs code review. labels Apr 4, 2018
Copy link
Contributor

@andresilva andresilva left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@andresilva andresilva merged commit ff0ce70 into openethereum:master Apr 5, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A8-looksgood 🦄 Pull request is reviewed well. M4-core ⛓ Core client code / Rust.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Block timestamp drift on dev chain with --reseal-min-period 0
3 participants