[Review] Re-add header fields with values used in Ethereum 2.0 #370
Closed
karlb
started this conversation in
CIP Discussions
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Simple Summary
Add the fields
ommers
,ommersHash
,nonce
,difficulty
andmixHash
to Celo block headers with constant values.Abstract
Since Celo uses proof-of-stake, its block headers do not contain fields related to proof-of-work. When Ethereum switched from proof-of-work to proof-of-stake, it did not drop the related block header fields, but instead set them to constant values to preserve backwards compatibility (see EIP-3675).
Since Celo intends to keep a high level of Ethereum compatibility, these header fields should be added to Celo.
Motivation
Reducing these differences to Ethereum helps in two ways:
Specification
Add the following fields with constant values to the block header:
If GraphQL keys are added for these header fields, they must match the name used by upstream geth for the same field.
One additional field that is missing in Celo is the
baseFee
, but in contrast to the fields above, it will not contain a constant value and deserves a more thorough discussion. Therefore, it will be handled in a separate CIP.Rationale
While the JSON-RPC fields are important for application compatibility, the case is less clear for the actual header fields in the blockchain implementation. Since the values are constant, we could return the values in the JSON-RPC without actually storing them in the block header.
The reason for including the values in the header is to reduce differences between the blockchain implementations between Ethereum and Celo.
Backwards Compatibility
Block header changes impact the consensus and require a hard fork.
Adding fields to the JSON-RPC should not break applications (unless they choke on new fields, which won’t be the case for well written applications).
Test Cases
The header changes can be inspected by querying the latest block header via JSON-RPC.
Implementation
Header
structCopyHeader
UncleHash
field torlpHash([]*Header(nil))
RPCMarshalHeader
Implementation suggestion at https://github.com/celo-org/celo-blockchain/compare/karlb/add-eth-header-fields?expand=1.
Security Considerations
No known security considerations.
License
This work is licensed under the Apache License, Version 2.0.
Beta Was this translation helpful? Give feedback.
All reactions