Skip to content

Commit 7fbbb25

Browse files
committed
rebase on top of deneb
1 parent 5c13f5c commit 7fbbb25

File tree

2 files changed

+34
-26
lines changed

2 files changed

+34
-26
lines changed
Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# The Verge -- The Beacon Chain
1+
# eip6800 -- The Beacon Chain
22

33
## Table of contents
44

@@ -33,7 +33,7 @@
3333

3434
## Introduction
3535

36-
This upgrade adds transaction execution to the beacon chain as part of the Verge upgrade.
36+
This upgrade adds transaction execution to the beacon chain as part of the eip6800 upgrade.
3737

3838
## Custom types
3939

@@ -76,10 +76,11 @@ class ExecutionPayload(Container):
7676
timestamp: uint64
7777
extra_data: ByteList[MAX_EXTRA_DATA_BYTES]
7878
base_fee_per_gas: uint256
79+
# Extra payload fields
7980
block_hash: Hash32 # Hash of execution block
80-
# Extra payload field
8181
transactions: List[Transaction, MAX_TRANSACTIONS_PER_PAYLOAD]
82-
execution_witness: ExecutionWitness # [New in Verge]
82+
withdrawals: List[Withdrawal, MAX_WITHDRAWALS_PER_PAYLOAD]
83+
execution_witness: ExecutionWitness # [New in eip6800]
8384
```
8485

8586
#### `ExecutionPayloadHeader`
@@ -99,10 +100,12 @@ class ExecutionPayloadHeader(Container):
99100
timestamp: uint64
100101
extra_data: ByteList[MAX_EXTRA_DATA_BYTES]
101102
base_fee_per_gas: uint256
103+
# Extra payload fields
102104
block_hash: Hash32 # Hash of execution block
103105
transactions_root: Root
104-
# Extra payload fields
105-
execution_witness_root: Root # [New in Verge]
106+
withdrawals_root: Root
107+
excess_data_gas: uint256
108+
execution_witness_root: Root # [New in eip6800]
106109
```
107110

108111
### New containers
@@ -181,6 +184,7 @@ def process_execution_payload(state: BeaconState, payload: ExecutionPayload, exe
181184
assert payload.timestamp == compute_timestamp_at_slot(state, state.slot)
182185
# Verify the execution payload is valid
183186
assert execution_engine.notify_new_payload(payload)
187+
184188
# Cache execution payload header
185189
state.latest_execution_payload_header = ExecutionPayloadHeader(
186190
parent_hash=payload.parent_hash,
@@ -197,10 +201,12 @@ def process_execution_payload(state: BeaconState, payload: ExecutionPayload, exe
197201
base_fee_per_gas=payload.base_fee_per_gas,
198202
block_hash=payload.block_hash,
199203
transactions_root=hash_tree_root(payload.transactions),
200-
execution_witness=payload.execution_witness,
204+
withdrawals_root=hash_tree_root(payload.withdrawals),
205+
excess_data_gas=payload.excess_data_gas,
206+
execution_witness=payload.execution_witness, # [New in eip6800]
201207
)
202208
```
203209

204210
## Testing
205211

206-
TBD
212+
TBD
Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# The Verge -- Fork Logic
1+
# eip6800 -- Fork Logic
22

33
## Table of contents
44

@@ -10,24 +10,24 @@
1010
- [Helper functions](#helper-functions)
1111
- [Misc](#misc)
1212
- [Modified `compute_fork_version`](#modified-compute_fork_version)
13-
- [Fork to the Verge](#fork-to-capella)
13+
- [Fork to eip6800](#fork-to-eip6800)
1414
- [Fork trigger](#fork-trigger)
1515
- [Upgrading the state](#upgrading-the-state)
1616

1717
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
1818

1919
## Introduction
2020

21-
This document describes the process of the Verge upgrade.
21+
This document describes the process of the eip6800 upgrade.
2222

2323
## Configuration
2424

2525
Warning: this configuration is not definitive.
2626

2727
| Name | Value |
2828
| - | - |
29-
| `VERGE_FORK_VERSION` | `Version('0x05000000')` |
30-
| `VERGE_FORK_EPOCH` | `Epoch(18446744073709551615)` **TBD** |
29+
| `EIP6800_FORK_VERSION` | `Version('0x05000000')` |
30+
| `EIP6800_FORK_EPOCH` | `Epoch(18446744073709551615)` **TBD** |
3131

3232

3333
## Helper functions
@@ -41,8 +41,10 @@ def compute_fork_version(epoch: Epoch) -> Version:
4141
"""
4242
Return the fork version at the given ``epoch``.
4343
"""
44-
if epoch >= VERGE_FORK_EPOCH:
45-
return VERGE_FORK_VERSION
44+
if epoch >= EIP6800_FORK_EPOCH:
45+
return EIP6800_FORK_VERSION
46+
if epoch >= DENEB_FORK_EPOCH:
47+
return DENEB_FORK_VERSION
4648
if epoch >= CAPELLA_FORK_EPOCH:
4749
return CAPELLA_FORK_VERSION
4850
if epoch >= BELLATRIX_FORK_EPOCH:
@@ -52,25 +54,25 @@ def compute_fork_version(epoch: Epoch) -> Version:
5254
return GENESIS_FORK_VERSION
5355
```
5456

55-
## Fork to the Verge
57+
## Fork to eip6800
5658

5759
### Fork trigger
5860

59-
The fork is triggered at epoch `VERGE_FORK_EPOCH`.
61+
The fork is triggered at epoch `EIP6800_FORK_EPOCH`.
6062

61-
Note that for the pure verge networks, we don't apply `upgrade_to_verge` since it starts with the Verge version logic.
63+
Note that for the pure eip6800 networks, we don't apply `upgrade_to_eip6800` since it starts with the eip6800 version logic.
6264

6365
### Upgrading the state
6466

65-
If `state.slot % SLOTS_PER_EPOCH == 0` and `compute_epoch_at_slot(state.slot) == VERGE_FORK_EPOCH`,
66-
an irregular state change is made to upgrade to the Verge.
67+
If `state.slot % SLOTS_PER_EPOCH == 0` and `compute_epoch_at_slot(state.slot) == EIP6800_FORK_EPOCH`,
68+
an irregular state change is made to upgrade to eip6800.
6769

68-
The upgrade occurs after the completion of the inner loop of `process_slots` that sets `state.slot` equal to `VERGE_FORK_EPOCH * SLOTS_PER_EPOCH`.
70+
The upgrade occurs after the completion of the inner loop of `process_slots` that sets `state.slot` equal to `EIP6800_FORK_EPOCH * SLOTS_PER_EPOCH`.
6971
Care must be taken when transitioning through the fork boundary as implementations will need a modified [state transition function](../phase0/beacon-chain.md#beacon-chain-state-transition-function) that deviates from the Phase 0 document.
7072
In particular, the outer `state_transition` function defined in the Phase 0 document will not expose the precise fork slot to execute the upgrade in the presence of skipped slots at the fork boundary. Instead, the logic must be within `process_slots`.
7173

7274
```python
73-
def upgrade_to_verge(pre: capella.BeaconState) -> BeaconState:
75+
def upgrade_to_eip6800(pre: capella.BeaconState) -> BeaconState:
7476
epoch = capella.get_current_epoch(pre)
7577
latest_execution_payload_header = ExecutionPayloadHeader(
7678
parent_hash=pre.latest_execution_payload_header.parent_hash,
@@ -85,10 +87,11 @@ def upgrade_to_verge(pre: capella.BeaconState) -> BeaconState:
8587
timestamp=pre.latest_execution_payload_header.timestamp,
8688
extra_data=pre.latest_execution_payload_header.extra_data,
8789
base_fee_per_gas=pre.latest_execution_payload_header.base_fee_per_gas,
90+
excess_data_gas=uint256(0),
8891
block_hash=pre.latest_execution_payload_header.block_hash,
8992
transactions_root=pre.latest_execution_payload_header.transactions_root,
9093
withdrawals_root=pre.latest_execution_payload_header.withdrawals_root,
91-
execution_witness=ExecutionWitness([], []) # New in the Verge
94+
execution_witness=ExecutionWitness([], []) # New in eip6800
9295
)
9396
post = BeaconState(
9497
# Versioning
@@ -97,7 +100,7 @@ def upgrade_to_verge(pre: capella.BeaconState) -> BeaconState:
97100
slot=pre.slot,
98101
fork=Fork(
99102
previous_version=pre.fork.current_version,
100-
current_version=VERGE_FORK_VERSION,
103+
current_version=EIP6800_FORK_VERSION, # [Modified in eip6800]
101104
epoch=epoch,
102105
),
103106
# History
@@ -135,8 +138,7 @@ def upgrade_to_verge(pre: capella.BeaconState) -> BeaconState:
135138
next_withdrawal_index=pre.next_withdrawal_index,
136139
next_withdrawal_validator_index=pre.next_withdrawal_validator_index,
137140
# Deep history valid from Capella onwards
138-
# FIXME most likely wrong
139-
historical_summaries=List[HistoricalSummary, HISTORICAL_ROOTS_LIMIT]([]),
141+
historical_summaries=pre.historical_summaries,
140142
)
141143

142144
return post

0 commit comments

Comments
 (0)