@@ -22,7 +22,6 @@ import (
2222 "github.com/erigontech/erigon/db/kv"
2323 "github.com/erigontech/erigon/db/kv/mdbx"
2424 "github.com/erigontech/erigon/db/kv/temporal"
25- "github.com/erigontech/erigon/db/rawdb"
2625 "github.com/erigontech/erigon/db/state/changeset"
2726 "github.com/erigontech/erigon/diagnostics/metrics"
2827 "github.com/erigontech/erigon/execution/chain"
@@ -221,54 +220,6 @@ func (pe *parallelExecutor) exec(ctx context.Context, execStage *StageState, u U
221220 return fmt .Errorf ("block %d: applyCount mismatch: got: %d expected %d" , applyResult .BlockNum , blockUpdateCount , applyResult .ApplyCount )
222221 }
223222
224- // pe.cfg.chainConfig.AmsterdamTime != nil && pe.cfg.chainConfig.AmsterdamTime.Uint64() > 0 is
225- // temporary to allow for initial non bals amsterdam testing before parallel exec is live by default
226- if (pe .cfg .chainConfig .AmsterdamTime != nil && pe .cfg .chainConfig .AmsterdamTime .Uint64 () > 0 && pe .cfg .chainConfig .IsAmsterdam (applyResult .BlockTime )) || pe .cfg .experimentalBAL {
227- bal := CreateBAL (applyResult .BlockNum , applyResult .TxIO , pe .cfg .dirs .DataDir )
228- if err := bal .Validate (); err != nil {
229- return fmt .Errorf ("block %d: invalid computed block access list: %w" , applyResult .BlockNum , err )
230- }
231- log .Debug ("bal" , "blockNum" , applyResult .BlockNum , "hash" , bal .Hash ())
232- if pe .cfg .chainConfig .IsAmsterdam (applyResult .BlockTime ) {
233- if lastHeader .BlockAccessListHash == nil {
234- if pe .isBlockProduction {
235- hash := bal .Hash ()
236- lastHeader .BlockAccessListHash = & hash
237- } else {
238- return fmt .Errorf ("block %d: missing block access list hash" , applyResult .BlockNum )
239- }
240- }
241- headerBALHash := * lastHeader .BlockAccessListHash
242- if ! pe .isBlockProduction {
243- dbBALBytes , err := rawdb .ReadBlockAccessListBytes (rwTx , applyResult .BlockHash , applyResult .BlockNum )
244- if err != nil {
245- return fmt .Errorf ("block %d: read stored block access list: %w" , applyResult .BlockNum , err )
246- }
247- // BAL data may not be stored for blocks downloaded via backward
248- // block downloader (p2p sync) since it does not carry BAL sidecars.
249- // Remove after eth/71 has been implemented.
250- if dbBALBytes != nil {
251- dbBAL , err := types .DecodeBlockAccessListBytes (dbBALBytes )
252- if err != nil {
253- return fmt .Errorf ("block %d: read stored block access list: %w" , applyResult .BlockNum , err )
254- }
255- if err = dbBAL .Validate (); err != nil {
256- return fmt .Errorf ("block %d: db block access list is invalid: %w" , applyResult .BlockNum , err )
257- }
258-
259- if headerBALHash != dbBAL .Hash () {
260- log .Info (fmt .Sprintf ("bal from block: %s" , dbBAL .DebugString ()))
261- return fmt .Errorf ("block %d: invalid block access list, hash mismatch: got %s expected %s" , applyResult .BlockNum , dbBAL .Hash (), headerBALHash )
262- }
263- }
264- if headerBALHash != bal .Hash () {
265- log .Info (fmt .Sprintf ("computed bal: %s" , bal .DebugString ()))
266- return fmt .Errorf ("%w, block=%d: block access list mismatch: got %s expected %s" , rules .ErrInvalidBlock , applyResult .BlockNum , bal .Hash (), headerBALHash )
267- }
268- }
269- }
270- }
271-
272223 if err := pe .getPostValidator ().Process (applyResult .BlockGasUsed , applyResult .BlobGasUsed , checkReceipts , applyResult .Receipts ,
273224 lastHeader , pe .isBlockProduction , b .Transactions (), pe .cfg .chainConfig , pe .logger ); err != nil {
274225 dumpTxIODebug (applyResult .BlockNum , applyResult .TxIO )
@@ -395,6 +346,13 @@ func (pe *parallelExecutor) exec(ctx context.Context, execStage *StageState, u U
395346 return err
396347 }
397348
349+ if pe .cfg .chainConfig .IsAmsterdam (applyResult .BlockTime ) || pe .cfg .experimentalBAL {
350+ err = ProcessBAL (rwTx , lastHeader , applyResult .TxIO , pe .isBlockProduction , pe .cfg .chainConfig .IsAmsterdam (applyResult .BlockTime ), pe .cfg .experimentalBAL , pe .cfg .dirs .DataDir )
351+ if err != nil {
352+ return err
353+ }
354+ }
355+
398356 if shouldGenerateChangesets {
399357 pe .domains ().SavePastChangesetAccumulator (applyResult .BlockHash , applyResult .BlockNum , changeSet )
400358 }
0 commit comments