@@ -33,11 +33,14 @@ func DefaultStages(ctx context.Context,
33
33
{
34
34
ID : stages .Headers ,
35
35
Description : "Download headers" ,
36
- Forward : func (firstCycle bool , s * StageState , u Unwinder , tx kv.RwTx ) error {
36
+ Forward : func (firstCycle bool , badBlockUnwind bool , s * StageState , u Unwinder , tx kv.RwTx ) error {
37
+ if badBlockUnwind {
38
+ return nil
39
+ }
37
40
return HeadersForward (s , u , ctx , tx , headers , firstCycle , test )
38
41
},
39
42
Unwind : func (firstCycle bool , u * UnwindState , s * StageState , tx kv.RwTx ) error {
40
- return HeadersUnwind (u , s , tx , headers )
43
+ return HeadersUnwind (u , s , tx , headers , test )
41
44
},
42
45
Prune : func (firstCycle bool , p * PruneState , tx kv.RwTx ) error {
43
46
return HeadersPrune (p , tx , headers , ctx )
@@ -46,7 +49,7 @@ func DefaultStages(ctx context.Context,
46
49
{
47
50
ID : stages .BlockHashes ,
48
51
Description : "Write block hashes" ,
49
- Forward : func (firstCycle bool , s * StageState , u Unwinder , tx kv.RwTx ) error {
52
+ Forward : func (firstCycle bool , badBlockUnwind bool , s * StageState , u Unwinder , tx kv.RwTx ) error {
50
53
return SpawnBlockHashStage (s , tx , blockHashCfg , ctx )
51
54
},
52
55
Unwind : func (firstCycle bool , u * UnwindState , s * StageState , tx kv.RwTx ) error {
@@ -61,7 +64,7 @@ func DefaultStages(ctx context.Context,
61
64
Description : "Create headers snapshot" ,
62
65
Disabled : true ,
63
66
DisabledDescription : "Enable by --snapshot.layout" ,
64
- Forward : func (firstCycle bool , s * StageState , u Unwinder , tx kv.RwTx ) error {
67
+ Forward : func (firstCycle bool , badBlockUnwind bool , s * StageState , u Unwinder , tx kv.RwTx ) error {
65
68
return SpawnHeadersSnapshotGenerationStage (s , tx , snapshotHeaders , firstCycle , ctx )
66
69
},
67
70
Unwind : func (firstCycle bool , u * UnwindState , s * StageState , tx kv.RwTx ) error {
@@ -74,7 +77,7 @@ func DefaultStages(ctx context.Context,
74
77
{
75
78
ID : stages .Bodies ,
76
79
Description : "Download block bodies" ,
77
- Forward : func (firstCycle bool , s * StageState , u Unwinder , tx kv.RwTx ) error {
80
+ Forward : func (firstCycle bool , badBlockUnwind bool , s * StageState , u Unwinder , tx kv.RwTx ) error {
78
81
return BodiesForward (s , u , ctx , tx , bodies , test )
79
82
},
80
83
Unwind : func (firstCycle bool , u * UnwindState , s * StageState , tx kv.RwTx ) error {
@@ -89,7 +92,7 @@ func DefaultStages(ctx context.Context,
89
92
Description : "Create bodies snapshot" ,
90
93
Disabled : true ,
91
94
DisabledDescription : "Enable by --snapshot.layout" ,
92
- Forward : func (firstCycle bool , s * StageState , u Unwinder , tx kv.RwTx ) error {
95
+ Forward : func (firstCycle bool , badBlockUnwind bool , s * StageState , u Unwinder , tx kv.RwTx ) error {
93
96
return SpawnBodiesSnapshotGenerationStage (s , tx , snapshotBodies , ctx )
94
97
},
95
98
Unwind : func (firstCycle bool , u * UnwindState , s * StageState , tx kv.RwTx ) error {
@@ -102,7 +105,7 @@ func DefaultStages(ctx context.Context,
102
105
{
103
106
ID : stages .Senders ,
104
107
Description : "Recover senders from tx signatures" ,
105
- Forward : func (firstCycle bool , s * StageState , u Unwinder , tx kv.RwTx ) error {
108
+ Forward : func (firstCycle bool , badBlockUnwind bool , s * StageState , u Unwinder , tx kv.RwTx ) error {
106
109
return SpawnRecoverSendersStage (senders , s , u , tx , 0 , ctx )
107
110
},
108
111
Unwind : func (firstCycle bool , u * UnwindState , s * StageState , tx kv.RwTx ) error {
@@ -115,7 +118,7 @@ func DefaultStages(ctx context.Context,
115
118
{
116
119
ID : stages .Execution ,
117
120
Description : "Execute blocks w/o hash checks" ,
118
- Forward : func (firstCycle bool , s * StageState , u Unwinder , tx kv.RwTx ) error {
121
+ Forward : func (firstCycle bool , badBlockUnwind bool , s * StageState , u Unwinder , tx kv.RwTx ) error {
119
122
return SpawnExecuteBlocksStage (s , u , tx , 0 , ctx , exec , firstCycle )
120
123
},
121
124
Unwind : func (firstCycle bool , u * UnwindState , s * StageState , tx kv.RwTx ) error {
@@ -130,7 +133,7 @@ func DefaultStages(ctx context.Context,
130
133
Description : "Transpile marked EVM contracts to TEVM" ,
131
134
Disabled : ! sm .Experiments .TEVM ,
132
135
DisabledDescription : "Enable by adding `tevm` to --experiments" ,
133
- Forward : func (firstCycle bool , s * StageState , u Unwinder , tx kv.RwTx ) error {
136
+ Forward : func (firstCycle bool , badBlockUnwind bool , s * StageState , u Unwinder , tx kv.RwTx ) error {
134
137
return SpawnTranspileStage (s , tx , 0 , trans , ctx )
135
138
},
136
139
Unwind : func (firstCycle bool , u * UnwindState , s * StageState , tx kv.RwTx ) error {
@@ -145,7 +148,7 @@ func DefaultStages(ctx context.Context,
145
148
Description : "Create state snapshot" ,
146
149
Disabled : true ,
147
150
DisabledDescription : "Enable by --snapshot.layout" ,
148
- Forward : func (firstCycle bool , s * StageState , u Unwinder , tx kv.RwTx ) error {
151
+ Forward : func (firstCycle bool , badBlockUnwind bool , s * StageState , u Unwinder , tx kv.RwTx ) error {
149
152
return SpawnStateSnapshotGenerationStage (s , tx , snapshotState , ctx )
150
153
},
151
154
Unwind : func (firstCycle bool , u * UnwindState , s * StageState , tx kv.RwTx ) error {
@@ -158,7 +161,7 @@ func DefaultStages(ctx context.Context,
158
161
{
159
162
ID : stages .HashState ,
160
163
Description : "Hash the key in the state" ,
161
- Forward : func (firstCycle bool , s * StageState , u Unwinder , tx kv.RwTx ) error {
164
+ Forward : func (firstCycle bool , badBlockUnwind bool , s * StageState , u Unwinder , tx kv.RwTx ) error {
162
165
return SpawnHashStateStage (s , tx , hashState , ctx )
163
166
},
164
167
Unwind : func (firstCycle bool , u * UnwindState , s * StageState , tx kv.RwTx ) error {
@@ -171,7 +174,7 @@ func DefaultStages(ctx context.Context,
171
174
{
172
175
ID : stages .IntermediateHashes ,
173
176
Description : "Generate intermediate hashes and computing state root" ,
174
- Forward : func (firstCycle bool , s * StageState , u Unwinder , tx kv.RwTx ) error {
177
+ Forward : func (firstCycle bool , badBlockUnwind bool , s * StageState , u Unwinder , tx kv.RwTx ) error {
175
178
_ , err := SpawnIntermediateHashesStage (s , u , tx , trieCfg , ctx )
176
179
return err
177
180
},
@@ -186,7 +189,7 @@ func DefaultStages(ctx context.Context,
186
189
ID : stages .CallTraces ,
187
190
Description : "Generate call traces index" ,
188
191
DisabledDescription : "Work In Progress" ,
189
- Forward : func (firstCycle bool , s * StageState , u Unwinder , tx kv.RwTx ) error {
192
+ Forward : func (firstCycle bool , badBlockUnwind bool , s * StageState , u Unwinder , tx kv.RwTx ) error {
190
193
return SpawnCallTraces (s , tx , callTraces , ctx )
191
194
},
192
195
Unwind : func (firstCycle bool , u * UnwindState , s * StageState , tx kv.RwTx ) error {
@@ -199,7 +202,7 @@ func DefaultStages(ctx context.Context,
199
202
{
200
203
ID : stages .AccountHistoryIndex ,
201
204
Description : "Generate account history index" ,
202
- Forward : func (firstCycle bool , s * StageState , u Unwinder , tx kv.RwTx ) error {
205
+ Forward : func (firstCycle bool , badBlockUnwind bool , s * StageState , u Unwinder , tx kv.RwTx ) error {
203
206
return SpawnAccountHistoryIndex (s , tx , history , ctx )
204
207
},
205
208
Unwind : func (firstCycle bool , u * UnwindState , s * StageState , tx kv.RwTx ) error {
@@ -212,7 +215,7 @@ func DefaultStages(ctx context.Context,
212
215
{
213
216
ID : stages .StorageHistoryIndex ,
214
217
Description : "Generate storage history index" ,
215
- Forward : func (firstCycle bool , s * StageState , u Unwinder , tx kv.RwTx ) error {
218
+ Forward : func (firstCycle bool , badBlockUnwind bool , s * StageState , u Unwinder , tx kv.RwTx ) error {
216
219
return SpawnStorageHistoryIndex (s , tx , history , ctx )
217
220
},
218
221
Unwind : func (firstCycle bool , u * UnwindState , s * StageState , tx kv.RwTx ) error {
@@ -225,7 +228,7 @@ func DefaultStages(ctx context.Context,
225
228
{
226
229
ID : stages .LogIndex ,
227
230
Description : "Generate receipt logs index" ,
228
- Forward : func (firstCycle bool , s * StageState , u Unwinder , tx kv.RwTx ) error {
231
+ Forward : func (firstCycle bool , badBlockUnwind bool , s * StageState , u Unwinder , tx kv.RwTx ) error {
229
232
return SpawnLogIndex (s , tx , logIndex , ctx )
230
233
},
231
234
Unwind : func (firstCycle bool , u * UnwindState , s * StageState , tx kv.RwTx ) error {
@@ -238,7 +241,7 @@ func DefaultStages(ctx context.Context,
238
241
{
239
242
ID : stages .TxLookup ,
240
243
Description : "Generate tx lookup index" ,
241
- Forward : func (firstCycle bool , s * StageState , u Unwinder , tx kv.RwTx ) error {
244
+ Forward : func (firstCycle bool , badBlockUnwind bool , s * StageState , u Unwinder , tx kv.RwTx ) error {
242
245
return SpawnTxLookup (s , tx , txLookup , ctx )
243
246
},
244
247
Unwind : func (firstCycle bool , u * UnwindState , s * StageState , tx kv.RwTx ) error {
@@ -251,7 +254,7 @@ func DefaultStages(ctx context.Context,
251
254
{
252
255
ID : stages .TxPool ,
253
256
Description : "Update transaction pool" ,
254
- Forward : func (firstCycle bool , s * StageState , _ Unwinder , tx kv.RwTx ) error {
257
+ Forward : func (firstCycle bool , badBlockUnwind bool , s * StageState , _ Unwinder , tx kv.RwTx ) error {
255
258
return SpawnTxPool (s , tx , txPool , ctx )
256
259
},
257
260
Unwind : func (firstCycle bool , u * UnwindState , s * StageState , tx kv.RwTx ) error {
@@ -264,7 +267,7 @@ func DefaultStages(ctx context.Context,
264
267
{
265
268
ID : stages .Finish ,
266
269
Description : "Final: update current block for the RPC API" ,
267
- Forward : func (firstCycle bool , s * StageState , _ Unwinder , tx kv.RwTx ) error {
270
+ Forward : func (firstCycle bool , badBlockUnwind bool , s * StageState , _ Unwinder , tx kv.RwTx ) error {
268
271
return FinishForward (s , tx , finish )
269
272
},
270
273
Unwind : func (firstCycle bool , u * UnwindState , s * StageState , tx kv.RwTx ) error {
0 commit comments