From dbdbc88e408dcfbe916a1ac732d71a9aefb72db0 Mon Sep 17 00:00:00 2001 From: jonastheis <4181434+jonastheis@users.noreply.github.com> Date: Fri, 26 Jul 2024 15:26:47 +0800 Subject: [PATCH] minor cleanup --- core/blockchain.go | 21 --------------------- rollup/da_syncer/da/da.go | 4 ++-- 2 files changed, 2 insertions(+), 23 deletions(-) diff --git a/core/blockchain.go b/core/blockchain.go index e55f6ce24085..e6ec46756dcb 100644 --- a/core/blockchain.go +++ b/core/blockchain.go @@ -1803,27 +1803,6 @@ func (bc *BlockChain) insertChain(chain types.Blocks, verifySeals bool) (int, er return it.index, err } -// PreprocessBlock processes block on top of the chain to calculate receipts, bloom and state root -func (bc *BlockChain) PreprocessBlock(block *types.Block) (common.Hash, types.Bloom, common.Hash, uint64, error) { - // Retrieve the parent block and it's state to execute on top - parent := bc.CurrentBlock().Header() - if parent == nil { - parent = bc.GetHeader(block.ParentHash(), block.NumberU64()-1) - } - statedb, err := state.New(parent.Root, bc.stateCache, bc.snaps) - if err != nil { - return common.Hash{}, types.Bloom{}, common.Hash{}, 0, err - } - receipts, _, usedGas, err := bc.processor.Process(block, statedb, bc.vmConfig) - if err != nil { - return common.Hash{}, types.Bloom{}, common.Hash{}, 0, err - } - receiptSha := types.DeriveSha(receipts, trie.NewStackTrie(nil)) - bloom := types.CreateBloom(receipts) - stateRoot := statedb.GetRootHash() - return receiptSha, bloom, stateRoot, usedGas, nil -} - func (bc *BlockChain) BuildAndWriteBlock(parentBlock *types.Block, header *types.Header, txs types.Transactions) (WriteStatus, error) { if !bc.chainmu.TryLock() { return NonStatTy, errInsertionInterrupted diff --git a/rollup/da_syncer/da/da.go b/rollup/da_syncer/da/da.go index 829f8d4712dd..fbaa60962758 100644 --- a/rollup/da_syncer/da/da.go +++ b/rollup/da_syncer/da/da.go @@ -41,7 +41,7 @@ type PartialHeader struct { Time uint64 BaseFee *big.Int GasLimit uint64 - Difficulty *big.Int + Difficulty uint64 ExtraData []byte } @@ -51,7 +51,7 @@ func (h *PartialHeader) ToHeader() *types.Header { Time: h.Time, BaseFee: h.BaseFee, GasLimit: h.GasLimit, - Difficulty: h.Difficulty, + Difficulty: new(big.Int).SetUint64(h.Difficulty), Extra: h.ExtraData, } }