Skip to content
This repository has been archived by the owner on Feb 28, 2021. It is now read-only.

Review block timestamps #296

Open
geigerzaehler opened this issue Mar 26, 2020 · 3 comments
Open

Review block timestamps #296

geigerzaehler opened this issue Mar 26, 2020 · 3 comments

Comments

@geigerzaehler
Copy link

To ensure that the network is working properly we want block time stamps close to the time when there are mined. Otherwise other nodes will reject the blocks because they are two far in the past.

We want to verify that block timestamps are set properly or come up with a solution how we can ensure this.

@geigerzaehler geigerzaehler added this to the FFnet milestone Mar 26, 2020
@CodeSandwich CodeSandwich self-assigned this Mar 31, 2020
@CodeSandwich
Copy link
Contributor

The result: it's complicated. On one hand the PoW mining loop doesn't adjust the time after preparing a header. If mining takes an hour, the header will have timestamp from one hour ago. On the other I've cranked up the target mining time to 10 minutes and started a local devnet. After some time the blocks started appearing only once a few minutes, the highest time was 12 minutes. The network had no problem with that, everything just worked. I think that we're pretty safe with our 1 minute target.

@CodeSandwich
Copy link
Contributor

I've tracked the inherents validation down to substrate/frame/timestamp/src/lib.rs:214 (<Module as ProvideInherent>::check_inherent). It looks like we're only protecting ourselves from blocks with timestamps in the future. If you mine a block for a month and keep its original timestamp, Substrate is fine with this.

I'm not entirely sure what this function is supposed to do. It looks like call is taken from the block and data is constructed from the same calls stored in the same block.

@geigerzaehler
Copy link
Author

geigerzaehler commented Apr 3, 2020

Thanks for the insights, @CodeSandwich. Given what we know we should think about whether this can be gamed. For example, would a node that treats timestamp differently gain an advantage over our implementation? We should look at how other PoW chains are doing this.

I don’t think this is critical for the FFnet though. Let’s remove the issue from the milestone.

@CodeSandwich CodeSandwich removed this from the FFnet milestone Apr 3, 2020
@CodeSandwich CodeSandwich removed their assignment Jun 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants