Skip to content

Commit e437a62

Browse files
authored
chore: prep for Amsterdam fork (#3352)
* update reth 2.3 and prep for amsterdam fork * add test * updates * updates * dep updates * dep updates * test with pr-266
1 parent 67b2dbc commit e437a62

13 files changed

Lines changed: 1212 additions & 132 deletions

docs/ev-reth/engine-api.md

Lines changed: 48 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -25,22 +25,22 @@ Configure both sides:
2525
```text
2626
ev-node ev-reth
2727
│ │
28-
│ 1. engine_forkchoiceUpdatedV3
28+
│ 1. engine_forkchoiceUpdatedV3/V4
2929
│ (headBlockHash, payloadAttributes) │
3030
│─────────────────────────────────────────►│
3131
│ │
3232
│ 2. {payloadId} │
3333
│◄─────────────────────────────────────────│
3434
│ │
35-
│ 3. engine_getPayloadV3(payloadId)
35+
│ 3. engine_getPayloadV4/V5/V6(payloadId) │
3636
│─────────────────────────────────────────►│
3737
│ │
3838
│ 4. {executionPayload, blockValue} │
3939
│◄─────────────────────────────────────────│
4040
│ │
4141
│ [ev-node broadcasts to P2P, submits DA] │
4242
│ │
43-
│ 5. engine_newPayloadV3(executionPayload)
43+
│ 5. engine_newPayloadV4/V5(payload)
4444
│─────────────────────────────────────────►│
4545
│ │
4646
│ 6. {status: VALID} │
@@ -54,15 +54,28 @@ ev-node ev-reth
5454

5555
## Methods
5656

57-
### engine_forkchoiceUpdatedV3
57+
| Fork family | Forkchoice | Get payload | New payload |
58+
|-------------|------------|-------------|-------------|
59+
| Prague | `engine_forkchoiceUpdatedV3` | `engine_getPayloadV4` | `engine_newPayloadV4` |
60+
| Osaka/Fusaka | `engine_forkchoiceUpdatedV3` | `engine_getPayloadV5` | `engine_newPayloadV4` |
61+
| Amsterdam | `engine_forkchoiceUpdatedV4` | `engine_getPayloadV6` | `engine_newPayloadV5` |
62+
63+
Amsterdam support is more than a method rename: payload attributes include
64+
`slotNumber`, and built payloads include `executionPayload.blockAccessList`.
65+
ev-node preserves the raw Amsterdam `executionPayload` returned by ev-reth and
66+
submits it unchanged to `engine_newPayloadV5`.
67+
ev-node detects Amsterdam by retrying `engine_forkchoiceUpdatedV4` after an
68+
unsupported-fork response from `engine_forkchoiceUpdatedV3`, then caches V4.
69+
70+
### engine_forkchoiceUpdatedV3 / V4
5871

5972
Update the fork choice and optionally start building a new block.
6073

6174
**Request:**
6275

6376
```json
6477
{
65-
"method": "engine_forkchoiceUpdatedV3",
78+
"method": "engine_forkchoiceUpdatedV4",
6679
"params": [
6780
{
6881
"headBlockHash": "0x...",
@@ -74,7 +87,8 @@ Update the fork choice and optionally start building a new block.
7487
"prevRandao": "0x...",
7588
"suggestedFeeRecipient": "0x...",
7689
"withdrawals": [],
77-
"parentBeaconBlockRoot": "0x..."
90+
"parentBeaconBlockRoot": "0x...",
91+
"slotNumber": "0x..."
7892
}
7993
]
8094
}
@@ -92,15 +106,15 @@ Update the fork choice and optionally start building a new block.
92106
}
93107
```
94108

95-
### engine_getPayloadV3
109+
### engine_getPayloadV4 / V5 / V6
96110

97111
Retrieve a built payload.
98112

99113
**Request:**
100114

101115
```json
102116
{
103-
"method": "engine_getPayloadV3",
117+
"method": "engine_getPayloadV6",
104118
"params": ["0x...payloadId"]
105119
}
106120
```
@@ -123,25 +137,33 @@ Retrieve a built payload.
123137
"extraData": "0x",
124138
"baseFeePerGas": "0x...",
125139
"blockHash": "0x...",
126-
"transactions": ["0x..."]
140+
"transactions": ["0x..."],
141+
"slotNumber": "0x...",
142+
"blockAccessList": []
127143
},
128144
"blockValue": "0x..."
129145
}
130146
```
131147

132-
### engine_newPayloadV3
148+
### engine_newPayloadV4 / V5
133149

134150
Validate and execute a payload.
135151

136152
**Request:**
137153

138154
```json
139155
{
140-
"method": "engine_newPayloadV3",
156+
"method": "engine_newPayloadV5",
141157
"params": [
142-
{ "executionPayload": "..." },
158+
{
159+
"parentHash": "0x...",
160+
"blockHash": "0x...",
161+
"slotNumber": "0x...",
162+
"blockAccessList": []
163+
},
143164
["0x...versionedHashes"],
144-
"0x...parentBeaconBlockRoot"
165+
"0x...parentBeaconBlockRoot",
166+
[]
145167
]
146168
}
147169
```
@@ -155,6 +177,19 @@ Validate and execute a payload.
155177
}
156178
```
157179

180+
## Amsterdam Enablement Checklist
181+
182+
Before setting `amsterdamTime` in an ev-reth chainspec, verify:
183+
184+
- [ ] ev-node can call `engine_forkchoiceUpdatedV4`.
185+
- [ ] ev-node sends `slotNumber` in Amsterdam payload attributes.
186+
- [ ] ev-node can call `engine_getPayloadV6`.
187+
- [ ] ev-node preserves `executionPayload.blockAccessList`.
188+
- [ ] ev-node can call `engine_newPayloadV5`.
189+
- [ ] Tracing and logs report the selected Engine API version.
190+
- [ ] Unit tests cover V4/V5/V6 version selection and `blockAccessList` passthrough.
191+
- [ ] E2E tests pass against an Amsterdam-enabled ev-reth chainspec.
192+
158193
## Status Codes
159194

160195
| Status | Meaning |

docs/reference/api/engine-api.md

Lines changed: 37 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,29 @@ openssl rand -hex 32 > jwt.hex
1818

1919
## Methods
2020

21-
### engine_forkchoiceUpdatedV3
21+
ev-node selects Engine API methods by fork:
22+
23+
| Fork family | Forkchoice | Get payload | New payload |
24+
|-------------|------------|-------------|-------------|
25+
| Prague | `engine_forkchoiceUpdatedV3` | `engine_getPayloadV4` | `engine_newPayloadV4` |
26+
| Osaka/Fusaka | `engine_forkchoiceUpdatedV3` | `engine_getPayloadV5` | `engine_newPayloadV4` |
27+
| Amsterdam | `engine_forkchoiceUpdatedV4` | `engine_getPayloadV6` | `engine_newPayloadV5` |
28+
29+
### engine_forkchoiceUpdatedV3 / V4
2230

2331
Update fork choice and optionally build a new block.
2432

33+
Payload builds start with `engine_forkchoiceUpdatedV3`. If the execution layer
34+
returns unsupported fork, ev-node retries `engine_forkchoiceUpdatedV4` with
35+
`slotNumber` in the payload attributes and caches V4 for future calls.
36+
`slotNumber` is derived deterministically from rollup block height.
37+
2538
**Request:**
2639

2740
```json
2841
{
2942
"jsonrpc": "2.0",
30-
"method": "engine_forkchoiceUpdatedV3",
43+
"method": "engine_forkchoiceUpdatedV4",
3144
"params": [
3245
{
3346
"headBlockHash": "0x...",
@@ -39,7 +52,8 @@ Update fork choice and optionally build a new block.
3952
"prevRandao": "0x...",
4053
"suggestedFeeRecipient": "0x...",
4154
"withdrawals": [],
42-
"parentBeaconBlockRoot": "0x..."
55+
"parentBeaconBlockRoot": "0x...",
56+
"slotNumber": "0x..."
4357
}
4458
],
4559
"id": 1
@@ -62,16 +76,20 @@ Update fork choice and optionally build a new block.
6276
}
6377
```
6478

65-
### engine_getPayloadV3
79+
### engine_getPayloadV4 / V5 / V6
6680

6781
Get a built payload.
6882

83+
ev-node starts with `engine_getPayloadV4`, caches `engine_getPayloadV5` or
84+
`engine_getPayloadV6` after successful unsupported-fork fallback, and switches
85+
directly to V6 after an Amsterdam `forkchoiceUpdatedV4` build request.
86+
6987
**Request:**
7088

7189
```json
7290
{
7391
"jsonrpc": "2.0",
74-
"method": "engine_getPayloadV3",
92+
"method": "engine_getPayloadV6",
7593
"params": ["0x...payloadId"],
7694
"id": 1
7795
}
@@ -100,7 +118,9 @@ Get a built payload.
100118
"transactions": ["0x..."],
101119
"withdrawals": [],
102120
"blobGasUsed": "0x0",
103-
"excessBlobGas": "0x0"
121+
"excessBlobGas": "0x0",
122+
"slotNumber": "0x...",
123+
"blockAccessList": []
104124
},
105125
"blockValue": "0x...",
106126
"blobsBundle": {
@@ -114,16 +134,20 @@ Get a built payload.
114134
}
115135
```
116136

117-
### engine_newPayloadV3
137+
### engine_newPayloadV4 / V5
118138

119139
Validate and execute a payload.
120140

141+
Amsterdam payloads use `engine_newPayloadV5`. ev-node passes through the raw
142+
`executionPayload` object returned by `engine_getPayloadV6` so
143+
`blockAccessList` is preserved.
144+
121145
**Request:**
122146

123147
```json
124148
{
125149
"jsonrpc": "2.0",
126-
"method": "engine_newPayloadV3",
150+
"method": "engine_newPayloadV5",
127151
"params": [
128152
{
129153
"parentHash": "0x...",
@@ -142,10 +166,13 @@ Validate and execute a payload.
142166
"transactions": ["0x..."],
143167
"withdrawals": [],
144168
"blobGasUsed": "0x0",
145-
"excessBlobGas": "0x0"
169+
"excessBlobGas": "0x0",
170+
"slotNumber": "0x...",
171+
"blockAccessList": []
146172
},
147173
["0x...expectedBlobVersionedHashes"],
148-
"0x...parentBeaconBlockRoot"
174+
"0x...parentBeaconBlockRoot",
175+
[]
149176
],
150177
"id": 1
151178
}

execution/evm/README.md

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Since the `PureEngineClient` relies on the Engine API, the genesis configuration
2020
1. The genesis file must include post-merge hardfork configurations
2121
2. `terminalTotalDifficulty` must be set to 0
2222
3. `terminalTotalDifficultyPassed` must be set to true
23-
4. Hardforks like `mergeNetsplitBlock`, `shanghaiTime`, `cancunTime` and `pragueTime` should be properly configured
23+
4. Hardforks like `mergeNetsplitBlock`, `shanghaiTime`, `cancunTime`, `pragueTime`, and optionally `amsterdamTime` should be properly configured
2424

2525
Example of required genesis configuration:
2626

@@ -43,18 +43,31 @@ Example of required genesis configuration:
4343
"terminalTotalDifficultyPassed": true,
4444
"shanghaiTime": 0,
4545
"cancunTime": 0,
46-
"pragueTime": 0
46+
"pragueTime": 0,
47+
"amsterdamTime": 0
4748
}
4849
}
4950
```
5051

5152
Without these settings, the Engine API will not be available, and the `PureEngineClient` will not function correctly.
5253

54+
### Engine API Versions
55+
56+
ev-node uses fork-aware Engine API methods:
57+
58+
- Prague payloads use `engine_forkchoiceUpdatedV3`, `engine_getPayloadV4`, and `engine_newPayloadV4`.
59+
- Osaka/Fusaka payloads fall forward from `engine_getPayloadV4` to `engine_getPayloadV5` on unsupported-fork responses.
60+
- Amsterdam payloads use `engine_forkchoiceUpdatedV4`, `engine_getPayloadV6`, and `engine_newPayloadV5`.
61+
62+
ev-node auto-detects Engine API versions by retrying on unsupported-fork responses. For payload builds, it first tries `engine_forkchoiceUpdatedV3`; if the execution layer rejects that method for Amsterdam, ev-node retries `engine_forkchoiceUpdatedV4` with a deterministic `slotNumber` derived from rollup block height and caches V4 for future calls.
63+
64+
Amsterdam adds `slotNumber` to payload attributes and `executionPayload.blockAccessList` to built payloads. ev-node does not compute the block access list; it preserves the raw `executionPayload` returned by ev-reth and submits that object unchanged to `engine_newPayloadV5`.
65+
5366
### PayloadID Storage
5467

5568
The `PureEngineClient` maintains the `payloadID` between calls:
5669

57-
1. During `InitChain`, a payload ID is obtained from the Engine API via `engine_forkchoiceUpdatedV3`
70+
1. During `InitChain`, the genesis forkchoice is acknowledged through the Engine API
5871
2. This payload ID is stored in the client instance as `c.payloadID`
5972
3. The stored payload ID is used in subsequent calls to `GetTxs` to retrieve the current execution payload
6073
4. After each `ExecuteTxs` call, a new payload ID is obtained and stored for the next block
@@ -66,7 +79,7 @@ The `PureEngineClient` implements a unique approach to transaction execution:
6679
1. In `GetTxs`, the entire execution payload is serialized to JSON and returned as the first transaction
6780
2. In `ExecuteTxs`, this first transaction is deserialized back into an execution payload
6881
3. The remaining transactions are added to the payload's transaction list
69-
4. The complete payload is then submitted to the execution client via `engine_newPayloadV4`
82+
4. The complete payload is then submitted to the execution client via the fork-appropriate `engine_newPayload` method
7083

7184
This approach ensures that:
7285

0 commit comments

Comments
 (0)