Define a maximum block timestamp drift (#1482)

* Add max timestamp drift EIP draft

* clearer formatting

* Include consensus failure risk in motivation

* Add discussions-to link

* remove some html comments, add abstract

* Update and rename eip-max-timestamp-drift.md to eip-1482.md

* Update eip-1482.md
This commit is contained in:
Maurelian 2018-10-15 07:21:23 -04:00 committed by Nick Johnson
parent bfc76d55a5
commit 2db25cf664
1 changed files with 61 additions and 0 deletions

61
EIPS/eip-1482.md Normal file
View File

@ -0,0 +1,61 @@
---
eip: 1482
title: Define a maximum block timestamp drift
author: Maurelian (@Maurelian)
discussions-to: https://ethereum-magicians.org/t/define-a-maximum-block-timestamp-drift/1556
status: Draft
type: Standards Track
category: Core
created: 2018-10-09
---
## Simple Summary
Include an explicit definition of the acceptable timestamp drift in the protocol specification.
## Abstract
On the basis that both Geth and Parity implement the same timestamp validation requirements, this should be written into the reference specification.
## Motivation
There is a lack of clarity about how accurate timestamps in the block header must be. The yellow paper describes the timestamp as
> A scalar value equal to the reasonable output of Unixs time() at this blocks inception
This causes [confusion](https://ethereum.stackexchange.com/questions/5924/how-do-ethereum-mining-nodes-maintain-a-time-consistent-with-the-network/5926#5926) about the safe use of the `TIMESTAMP` opcode (solidity's `block.timestamp` or `now`) in smart contract development.
Differing interpretations of 'reasonable' may create a risk of consenus failures.
## Specification
The yellow paper should define a timestamp as:
> A scalar value equal to the output of Unixs time() at this blocks inception. For the purpose of block validation, it must be greater than the previous block's timestamp, and no more than 15 seconds greater than system time.
## Rationale
Both [Geth](https://github.com/ethereum/go-ethereum/blob/4e474c74dc2ac1d26b339c32064d0bac98775e77/consensus/ethash/consensus.go#L45) and [Parity](https://github.com/paritytech/parity-ethereum/blob/73db5dda8c0109bb6bc1392624875078f973be14/ethcore/src/verification/verification.rs#L296-L307) reject blocks with timestamp more than 15 seconds in the future. This establishes a defacto standard, which should be made explicit in the reference specification.
## Backwards Compatibility
<!--All EIPs that introduce backwards incompatibilities must include a section describing these incompatibilities and their severity. The EIP must explain how the author proposes to deal with these incompatibilities. EIP submissions without a sufficient backwards compatibility treatise may be rejected outright.-->
It may be necessary to relax this requirement for blocks which were mined early in the main chain's history, if they would be considered invalid.
## Test Cases
<!--Test cases for an implementation are mandatory for EIPs that are affecting consensus changes. Other EIPs can choose to include links to test cases if applicable.-->
These would be important to have.
## Implementation
<!--The implementations must be completed before any EIP is given status "Final", but it need not be completed before the EIP is accepted. While there is merit to the approach of reaching consensus on the specification and rationale before writing code, the principle of "rough consensus and running code" is still useful when it comes to resolving many discussions of API details.-->
_The implementations must be completed before any EIP is given status "Final", but it need not be completed before the EIP is accepted. While there is merit to the approach of reaching consensus on the specification and rationale before writing code, the principle of "rough consensus and running code" is still useful when it comes to resolving many discussions of API details.
_
## Copyright
Copyright and related rights waived via [CC0](https://creativecommons.org/publicdomain/zero/1.0/).