-
Notifications
You must be signed in to change notification settings - Fork 1k
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
New application payload fields #2295
Conversation
specs/merge/beacon-chain.md
Outdated
|
||
```python | ||
class BeaconState(phase0.BeaconState): | ||
# Application-layer | ||
application_state_root: Bytes32 # [New in Merge] | ||
application_block_hash: Bytes32 # [New in Merge] | ||
application_block_number: uint64 # [New in Merge] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it better to define an ApplicationState
container and bundle these in?
class ApplicationState(Container):
root: Bytes32
block_hash: Bytes32
block_number: uint64
class BeaconState(phase0.BeaconState):
application_state: ApplicationState
Especially if we are going to add eip1559 fields later on
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was thinking about this as well, but this is rather an ApplicationBlockHeader
than ApplicationState
. It would probably make sense to include all fields except for transactions
into beacon state.
class ApplicationBlockHeader(Container):
block_hash: Bytes32
parent_hash: Bytes32
coinbase: Bytes20
state_root: Bytes32
number: uint64
gas_limit: uint64
gas_used: uint64
receipt_root: Bytes32
logs_bloom: ByteVector[BYTES_PER_LOGS_BLOOM]
class BeaconState(phase0.BeaconState)
latest_application_block_header: ApplicationBlockHeader # Akin to `latest_block_header`
@mkalinin are you considering trying the app-block-header in this PR or do you want it reviewed as is? |
Let me try and see how it will look like |
0953a2b
to
79aee86
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! I'd mainly suggest embedding transactions_root
into the header
to allow for sharing htr across the two objects
gas_limit: uint64 | ||
gas_used: uint64 | ||
receipt_root: Bytes32 | ||
logs_bloom: ByteVector[BYTES_PER_LOGS_BLOOM] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest we add transactions_root
so that this merklizes to the same root of ApplicationPayload
We can then rename this to ApplicationPayloadHeader
or rename the payload to ApplicationBlock
.
(side note, we mgiht be renaming these all to use Execution
prefix but thats a separate PR
@djrtwo Implemented |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
great work!
What's done
Adds the following fields to the
ApplicationPayload
:parent_hash: Bytes32
number: uint64
Adds
application_block_number
to theBeaconState
and incorporates following rules that ensures the validity of the application block tree:It would also make sense to add
gas_limit/base_fee
to the state with corresponding validity rules once EIP-1559 is shipped.Rationale
The main reason of doing this is making structures and code forward compatible with stateless execution which implies that there is no application block tree that is maintained by the application-layer. It results in a following requirements on consensus-layer:
A byproduct of adding
parent_hash
is the following simplification in the transition process. Instead of submitting an emptyApplicationPayload
withblock_hash = last_pow_block.hash
to signify the transition block, proposer becomes eligible to propose fullApplicationPayload
withparent_hash
referring to the last PoW block. Aside of simplification it also have a small incentivising effect as proposer of the transition block gets transaction fees now.The cost of this change is additional
40 bytes
inBeaconBlockBody
structure.