From c2ccab55821d47110c76cbe434c1b7c5330a792d Mon Sep 17 00:00:00 2001 From: Ganesh Vanahalli Date: Tue, 29 Oct 2024 12:03:53 +0530 Subject: [PATCH] StateBuildingLogFunction shouldn't take targetHeader as an arg --- blocks_reexecutor/blocks_reexecutor.go | 2 +- execution/gethexec/block_recorder.go | 32 ++++++++++++++------------ go-ethereum | 2 +- 3 files changed, 19 insertions(+), 17 deletions(-) diff --git a/blocks_reexecutor/blocks_reexecutor.go b/blocks_reexecutor/blocks_reexecutor.go index 6347975534..5a883e5d42 100644 --- a/blocks_reexecutor/blocks_reexecutor.go +++ b/blocks_reexecutor/blocks_reexecutor.go @@ -261,7 +261,7 @@ func (s *BlocksReExecutor) advanceStateUpToBlock(ctx context.Context, state *sta var block *types.Block var err error for ctx.Err() == nil { - state, block, err = arbitrum.AdvanceStateByBlock(ctx, s.blockchain, state, targetHeader, blockToRecreate, prevHash, nil) + state, block, err = arbitrum.AdvanceStateByBlock(ctx, s.blockchain, state, blockToRecreate, prevHash, nil) if err != nil { return err } diff --git a/execution/gethexec/block_recorder.go b/execution/gethexec/block_recorder.go index a3af7876a8..6f30e16e5c 100644 --- a/execution/gethexec/block_recorder.go +++ b/execution/gethexec/block_recorder.go @@ -75,19 +75,21 @@ func NewBlockRecorder(config *BlockRecorderConfig, execEngine *ExecutionEngine, return recorder } -func stateLogFunc(targetHeader, header *types.Header, hasState bool) { - if targetHeader == nil || header == nil { - return - } - gap := targetHeader.Number.Int64() - header.Number.Int64() - step := int64(500) - stage := "computing state" - if !hasState { - step = 3000 - stage = "looking for full block" - } - if (gap >= step) && (gap%step == 0) { - log.Info("Setting up validation", "stage", stage, "current", header.Number, "target", targetHeader.Number) +func stateLogFunc(targetHeader *types.Header) arbitrum.StateBuildingLogFunction { + return func(header *types.Header, hasState bool) { + if targetHeader == nil || header == nil { + return + } + gap := targetHeader.Number.Int64() - header.Number.Int64() + step := int64(500) + stage := "computing state" + if !hasState { + step = 3000 + stage = "looking for full block" + } + if (gap >= step) && (gap%step == 0) { + log.Info("Setting up validation", "stage", stage, "current", header.Number, "target", targetHeader.Number) + } } } @@ -109,7 +111,7 @@ func (r *BlockRecorder) RecordBlockCreation( } } - recordingdb, chaincontext, recordingKV, err := r.recordingDatabase.PrepareRecording(ctx, prevHeader, stateLogFunc) + recordingdb, chaincontext, recordingKV, err := r.recordingDatabase.PrepareRecording(ctx, prevHeader, stateLogFunc(prevHeader)) if err != nil { return nil, err } @@ -321,7 +323,7 @@ func (r *BlockRecorder) PrepareForRecord(ctx context.Context, start, end arbutil log.Warn("prepareblocks asked for non-found block", "hdrNum", hdrNum) break } - _, err := r.recordingDatabase.GetOrRecreateState(ctx, header, stateLogFunc) + _, err := r.recordingDatabase.GetOrRecreateState(ctx, header, stateLogFunc(header)) if err != nil { log.Warn("prepareblocks failed to get state for block", "hdrNum", hdrNum, "err", err) break diff --git a/go-ethereum b/go-ethereum index 2f247a3182..f9b447d74c 160000 --- a/go-ethereum +++ b/go-ethereum @@ -1 +1 @@ -Subproject commit 2f247a31822ecd06e39d89f7d5332fa16fd2f6b6 +Subproject commit f9b447d74c00e554752ae60eb2200966d68a4f7a