@@ -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,51 +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- if (pe .cfg .chainConfig .AmsterdamTime != nil && pe .cfg .chainConfig .IsAmsterdam (applyResult .BlockTime )) || pe .cfg .experimentalBAL {
225- bal := CreateBAL (applyResult .BlockNum , applyResult .TxIO , pe .cfg .dirs .DataDir )
226- if err := bal .Validate (); err != nil {
227- return fmt .Errorf ("block %d: invalid computed block access list: %w" , applyResult .BlockNum , err )
228- }
229- log .Debug ("bal" , "blockNum" , applyResult .BlockNum , "hash" , bal .Hash ())
230- if pe .cfg .chainConfig .IsAmsterdam (applyResult .BlockTime ) {
231- if lastHeader .BlockAccessListHash == nil {
232- if pe .isBlockProduction {
233- hash := bal .Hash ()
234- lastHeader .BlockAccessListHash = & hash
235- } else {
236- return fmt .Errorf ("block %d: missing block access list hash" , applyResult .BlockNum )
237- }
238- }
239- headerBALHash := * lastHeader .BlockAccessListHash
240- if ! pe .isBlockProduction {
241- dbBALBytes , err := rawdb .ReadBlockAccessListBytes (rwTx , applyResult .BlockHash , applyResult .BlockNum )
242- if err != nil {
243- return fmt .Errorf ("block %d: read stored block access list: %w" , applyResult .BlockNum , err )
244- }
245- // BAL data may not be stored for blocks downloaded via backward
246- // block downloader (p2p sync) since it does not carry BAL sidecars.
247- // Remove after eth/71 has been implemented.
248- if dbBALBytes != nil {
249- dbBAL , err := types .DecodeBlockAccessListBytes (dbBALBytes )
250- if err != nil {
251- return fmt .Errorf ("block %d: read stored block access list: %w" , applyResult .BlockNum , err )
252- }
253- if err = dbBAL .Validate (); err != nil {
254- return fmt .Errorf ("block %d: db block access list is invalid: %w" , applyResult .BlockNum , err )
255- }
256-
257- if headerBALHash != dbBAL .Hash () {
258- log .Info (fmt .Sprintf ("bal from block: %s" , dbBAL .DebugString ()))
259- return fmt .Errorf ("block %d: invalid block access list, hash mismatch: got %s expected %s" , applyResult .BlockNum , dbBAL .Hash (), headerBALHash )
260- }
261- }
262- if headerBALHash != bal .Hash () {
263- return fmt .Errorf ("%w, block=%d: block access list mismatch: got %s expected %s" , rules .ErrInvalidBlock , applyResult .BlockNum , bal .Hash (), headerBALHash )
264- }
265- }
266- }
267- }
268-
269223 if err := pe .getPostValidator ().Process (applyResult .BlockGasUsed , applyResult .BlobGasUsed , checkReceipts , applyResult .Receipts ,
270224 lastHeader , pe .isBlockProduction , b .Transactions (), pe .cfg .chainConfig , pe .logger ); err != nil {
271225 dumpTxIODebug (applyResult .BlockNum , applyResult .TxIO )
@@ -392,6 +346,13 @@ func (pe *parallelExecutor) exec(ctx context.Context, execStage *StageState, u U
392346 return err
393347 }
394348
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+
395356 if shouldGenerateChangesets {
396357 pe .domains ().SavePastChangesetAccumulator (applyResult .BlockHash , applyResult .BlockNum , changeSet )
397358 }
0 commit comments