Skip to content

fix: Prague code merge [v1.13.15, v1.14.11] CI fix #55

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 68 commits into from
Nov 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
10b496d
fix compile for statedb_test.go
buddh0 Nov 8, 2024
0571adc
format addresses of core/vm/contracts
buddh0 Nov 11, 2024
c2a1f73
fix compilation of package simulated
buddh0 Nov 11, 2024
e74ae4e
tests: update tests
buddh0 Nov 11, 2024
77daed5
remove rootParent in triePrefetcher
buddh0 Nov 12, 2024
4e3692d
add ClearAccessList for processing system txs before Cancun
buddh0 Nov 12, 2024
a46509c
copy prefetcher when copy statedb
buddh0 Nov 12, 2024
b351c48
always prefetch the account trie once the prefetcher is constructed
buddh0 Nov 12, 2024
21af315
recover TriePrefetchInAdvance
buddh0 Nov 12, 2024
098e933
fix comment for s.StopPrefetcher
buddh0 Nov 12, 2024
3f4f2fa
fix noTrie in statedb.go
buddh0 Nov 12, 2024
548a3a7
improve SnapToDiffLayer
buddh0 Nov 12, 2024
5dda88e
fix test cases in core/state
buddh0 Nov 13, 2024
8e7a52a
fix compilation of test cases in core
buddh0 Nov 13, 2024
25eae93
fix compilation of test cases in cmd, internal and trie
buddh0 Nov 13, 2024
49e1095
remove Requests in BlockBody
buddh0 Nov 13, 2024
7507a62
define RequestsHash in parlia engine
buddh0 Nov 13, 2024
b09d5b5
fix compilation of test cases in eth
buddh0 Nov 13, 2024
b91e2e9
fix compilation of test cases in ethclient and miner
buddh0 Nov 13, 2024
3c0d46d
fix compilation of test cases in triedb/pathdb
buddh0 Nov 13, 2024
764530d
add todo for relation between witness and noTrie
buddh0 Nov 13, 2024
b63093a
fix Nancy CI
buddh0 Nov 13, 2024
ebf566d
fix golangci-lint part I
buddh0 Nov 13, 2024
9e5316d
update golang to 1.23.x from 1.21.x in workflows
buddh0 Nov 13, 2024
f25469d
remove sepoliaAllocData and holeskyAllocData
buddh0 Nov 14, 2024
a5e74b4
modifiy interface FinalizeAndAssemble
buddh0 Nov 14, 2024
89875b1
fix golangci-lint part II
buddh0 Nov 14, 2024
5fe6993
fix golangci-lint part III
buddh0 Nov 14, 2024
5640a7d
fix golangci-lint done
buddh0 Nov 14, 2024
94a0aab
check for multidb
buddh0 Nov 14, 2024
028eadd
improve interface EnableBlockValidator
buddh0 Nov 15, 2024
eb5e3c3
fix getGenesisState
buddh0 Nov 15, 2024
fc58ef7
code review for core/rawdb
buddh0 Nov 15, 2024
bbd2cf5
fix mustCopyTrie
buddh0 Nov 15, 2024
4d6ea17
fix state_processor
buddh0 Nov 15, 2024
6081585
adapt for changes in func NewBlock
buddh0 Nov 15, 2024
fa744e6
improve EncodeSigHeader
buddh0 Nov 15, 2024
61af78f
fix test cases in dir core, part I
buddh0 Nov 15, 2024
e4f96cc
fix TestParliaBlobFeeReward
buddh0 Nov 18, 2024
a07de41
fix repairHistory
buddh0 Nov 18, 2024
d3c4b62
remove diskdb in triedb.Database
buddh0 Nov 18, 2024
fd182e4
fix asyncnodebuffer
buddh0 Nov 18, 2024
94bfaaa
adapt memory freezer for blob table
buddh0 Nov 19, 2024
4a6ba0b
comment verkle related test cases
buddh0 Nov 19, 2024
c0f987d
fix golang lint
buddh0 Nov 19, 2024
7318223
use 1.21.x to run golangci-lint
buddh0 Nov 19, 2024
725fcb1
fix TestBsc1Messages
buddh0 Nov 19, 2024
973baf4
fix TestSnapSyncWithBlobs
buddh0 Nov 19, 2024
4db2b17
fix traceTx
buddh0 Nov 19, 2024
47cfc03
update golang version for docker
buddh0 Nov 19, 2024
fc31929
improve newWorker
buddh0 Nov 20, 2024
70b4177
fix: truncate state history ut
joey0612 Nov 20, 2024
1d9750d
Merge branch 'merge_geth_v1.13.15_v1.14.11_fix' into fix_truncate_sta…
joey0612 Nov 20, 2024
496f0bf
Merge pull request #57 from buddh0/fix_truncate_state_history
buddh0 Nov 20, 2024
42afa00
TestTailTruncateHistory clear up
buddh0 Nov 20, 2024
88f8a43
fix test cases in dir tests
buddh0 Nov 20, 2024
5aebb24
remove deprecated flags in truffle test
buddh0 Nov 20, 2024
c7705e6
comment filterNode
buddh0 Nov 21, 2024
ead8ada
HeaderChain.GenesisHeader
buddh0 Nov 21, 2024
1acffee
fix golangcilint
buddh0 Nov 21, 2024
62deea3
fix truffle-test CI
buddh0 Nov 21, 2024
23c9c97
update .nancy-ignore to avoid conflicts with develop branch
buddh0 Nov 21, 2024
dcd4061
update diff go-ethereum patch
buddh0 Nov 22, 2024
3045096
remove isTTDReached in worker
buddh0 Nov 22, 2024
b13baec
fix mockparlia FinalizeAndAssemble
buddh0 Nov 22, 2024
dff05d5
fix golangci-lint
buddh0 Nov 22, 2024
3d812cf
fix makeEnv
buddh0 Nov 22, 2024
fe06a66
change log level for tri prefetch
buddh0 Nov 22, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
unit-test:
strategy:
matrix:
go-version: [1.21.x]
go-version: [1.23.x]
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/evm-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
evm-test:
strategy:
matrix:
go-version: [1.21.x]
go-version: [1.23.x]
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/nancy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
build:
strategy:
matrix:
go-version: [1.21.x]
go-version: [1.23.x]
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pre-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
name: Build Release
strategy:
matrix:
go-version: [1.21.x]
go-version: [1.23.x]
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
name: Build Release
strategy:
matrix:
go-version: [1.21.x]
go-version: [1.23.x]
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/unit-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
unit-test:
strategy:
matrix:
go-version: [1.21.x]
go-version: [1.23.x]
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
Expand Down
3 changes: 2 additions & 1 deletion .nancy-ignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
CVE-2024-34478 # "CWE-754: Improper Check for Unusual or Exceptional Conditions." This vulnerability is BTC only, BSC does not have the issue.
CVE-2024-6104 # "CWE-532: Information Exposure Through Log Files" This is caused by the vulnerabilities [email protected], it is only used in cmd devp2p, impact is limited. will upgrade to v0.7.7 later
CVE-2024-8421 # "CWE-400: Uncontrolled Resource Consumption (Resource Exhaustion)" This vulnerability is caused by issues in the golang.org/x/net package. Even the latest version(v0.29.0) has not yet addressed it, but we will continue to monitor updates closely.
CVE-2024-8421 # "CWE-400: Uncontrolled Resource Consumption (Resource Exhaustion)" This vulnerability is caused by issues in the golang.org/x/net package. Even the latest version(v0.29.0) has not yet addressed it, but we will continue to monitor updates closely.
CVE-2024-51744 # "CWE-347: Improper Verification of Cryptographic Signature" & "CWE-755: Improper Handling of Exceptional Conditions" This vulnerability is caused mishandling of JWT error code, BSC does not have the issue as it does not check the detail error code.
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,10 @@ all:
test: all
$(GORUN) build/ci.go test -timeout 1h

#? truffle-test: Run the integration test.
truffle-test:
docker build . -f ./docker/Dockerfile --target bsc-genesis -t bsc-genesis
docker build . -f ./docker/Dockerfile --target bsc -t bsc
docker build . -f ./docker/Dockerfile --target bsc-genesis -t bsc-genesis
docker build . -f ./docker/Dockerfile.truffle -t truffle-test
docker compose -f ./tests/truffle/docker-compose.yml up genesis
docker compose -f ./tests/truffle/docker-compose.yml up -d bsc-rpc bsc-validator1
Expand Down
1 change: 0 additions & 1 deletion cmd/geth/testdata/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ NetworkId = 714
SyncMode = "full"
NoPruning = false
NoPrefetch = false
LightPeers = 100
DatabaseCache = 512
DatabaseFreezer = ""
TrieCleanCache = 256
Expand Down
2 changes: 1 addition & 1 deletion cmd/utils/history_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ func TestHistoryImportAndExport(t *testing.T) {
}

// Now import Era.
db2, err := rawdb.NewDatabaseWithFreezer(rawdb.NewMemoryDatabase(), "",, "", false, false, false, false, false)
db2, err := rawdb.NewDatabaseWithFreezer(rawdb.NewMemoryDatabase(), "", "", false, false, false, false, false)
if err != nil {
panic(err)
}
Expand Down
14 changes: 7 additions & 7 deletions consensus/beacon/consensus.go
Original file line number Diff line number Diff line change
Expand Up @@ -378,30 +378,30 @@ func (beacon *Beacon) Finalize(chain consensus.ChainHeaderReader, header *types.

// FinalizeAndAssemble implements consensus.Engine, setting the final state and
// assembling the block.
func (beacon *Beacon) FinalizeAndAssemble(chain consensus.ChainHeaderReader, header *types.Header, state *state.StateDB, txs []*types.Transaction, uncles []*types.Header, receipts []*types.Receipt, withdrawals []*types.Withdrawal) (*types.Block, []*types.Receipt, error) {
func (beacon *Beacon) FinalizeAndAssemble(chain consensus.ChainHeaderReader, header *types.Header, state *state.StateDB, body *types.Body, receipts []*types.Receipt) (*types.Block, []*types.Receipt, error) {
// FinalizeAndAssemble is different with Prepare, it can be used in both block generation.
if !beacon.IsPoSHeader(header) {
return beacon.ethone.FinalizeAndAssemble(chain, header, state, txs, uncles, receipts, withdrawals)
return beacon.ethone.FinalizeAndAssemble(chain, header, state, body, receipts)
}
shanghai := chain.Config().IsShanghai(header.Number, header.Time)
if shanghai {
// All blocks after Shanghai must include a withdrawals root.
if withdrawals == nil {
withdrawals = make([]*types.Withdrawal, 0)
if body.Withdrawals == nil {
body.Withdrawals = make([]*types.Withdrawal, 0)
}
} else {
if len(withdrawals) > 0 {
if len(body.Withdrawals) > 0 {
return nil, nil, errors.New("withdrawals set before Shanghai activation")
}
}
// Finalize and assemble the block.
beacon.Finalize(chain, header, state, &txs, uncles, withdrawals, nil, nil, nil)
beacon.Finalize(chain, header, state, &body.Transactions, body.Uncles, body.Withdrawals, nil, nil, nil)

// Assign the final state root to header.
header.Root = state.IntermediateRoot(true)

// Assemble the final block.
block := types.NewBlock(header, &types.Body{Transactions: txs, Uncles: uncles, Withdrawals: withdrawals}, receipts, trie.NewStackTrie(nil))
block := types.NewBlock(header, body, receipts, trie.NewStackTrie(nil))

// Create the block witness and attach to block.
// This step needs to happen as late as possible to catch all access events.
Expand Down
8 changes: 4 additions & 4 deletions consensus/clique/clique.go
Original file line number Diff line number Diff line change
Expand Up @@ -594,18 +594,18 @@ func (c *Clique) Finalize(chain consensus.ChainHeaderReader, header *types.Heade

// FinalizeAndAssemble implements consensus.Engine, ensuring no uncles are set,
// nor block rewards given, and returns the final block.
func (c *Clique) FinalizeAndAssemble(chain consensus.ChainHeaderReader, header *types.Header, state *state.StateDB, txs []*types.Transaction, uncles []*types.Header, receipts []*types.Receipt, withdrawals []*types.Withdrawal) (*types.Block, []*types.Receipt, error) {
if len(withdrawals) > 0 {
func (c *Clique) FinalizeAndAssemble(chain consensus.ChainHeaderReader, header *types.Header, state *state.StateDB, body *types.Body, receipts []*types.Receipt) (*types.Block, []*types.Receipt, error) {
if len(body.Withdrawals) > 0 {
return nil, nil, errors.New("clique does not support withdrawals")
}
// Finalize block
c.Finalize(chain, header, state, &txs, uncles, nil, nil, nil, nil)
c.Finalize(chain, header, state, &body.Transactions, body.Uncles, nil, nil, nil, nil)

// Assign the final state root to header.
header.Root = state.IntermediateRoot(chain.Config().IsEIP158(header.Number))

// Assemble and return the final block for sealing.
return types.NewBlock(header, &types.Body{Transactions: txs, Uncles: uncles}, receipts, trie.NewStackTrie(nil)), receipts, nil
return types.NewBlock(header, &types.Body{Transactions: body.Transactions}, receipts, trie.NewStackTrie(nil)), receipts, nil
}

// Authorize injects a private key into the consensus engine to mint new blocks
Expand Down
3 changes: 1 addition & 2 deletions consensus/consensus.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,7 @@ type Engine interface {
//
// Note: The block header and state database might be updated to reflect any
// consensus rules that happen at finalization (e.g. block rewards).
FinalizeAndAssemble(chain ChainHeaderReader, header *types.Header, state *state.StateDB, txs []*types.Transaction,
uncles []*types.Header, receipts []*types.Receipt, withdrawals []*types.Withdrawal) (*types.Block, []*types.Receipt, error)
FinalizeAndAssemble(chain ChainHeaderReader, header *types.Header, state *state.StateDB, body *types.Body, receipts []*types.Receipt) (*types.Block, []*types.Receipt, error)

// Seal generates a new sealing request for the given input block and pushes
// the result into the given channel.
Expand Down
8 changes: 4 additions & 4 deletions consensus/ethash/consensus.go
Original file line number Diff line number Diff line change
Expand Up @@ -517,18 +517,18 @@ func (ethash *Ethash) Finalize(chain consensus.ChainHeaderReader, header *types.

// FinalizeAndAssemble implements consensus.Engine, accumulating the block and
// uncle rewards, setting the final state and assembling the block.
func (ethash *Ethash) FinalizeAndAssemble(chain consensus.ChainHeaderReader, header *types.Header, state *state.StateDB, txs []*types.Transaction, uncles []*types.Header, receipts []*types.Receipt, withdrawals []*types.Withdrawal) (*types.Block, []*types.Receipt, error) {
if len(withdrawals) > 0 {
func (ethash *Ethash) FinalizeAndAssemble(chain consensus.ChainHeaderReader, header *types.Header, state *state.StateDB, body *types.Body, receipts []*types.Receipt) (*types.Block, []*types.Receipt, error) {
if len(body.Withdrawals) > 0 {
return nil, nil, errors.New("ethash does not support withdrawals")
}
// Finalize block
ethash.Finalize(chain, header, state, &txs, uncles, nil, nil, nil, nil)
ethash.Finalize(chain, header, state, &body.Transactions, body.Uncles, nil, nil, nil, nil)

// Assign the final state root to header.
header.Root = state.IntermediateRoot(chain.Config().IsEIP158(header.Number))

// Header seems complete, assemble into a block and return
return types.NewBlock(header, &types.Body{Transactions: txs, Uncles: uncles}, receipts, trie.NewStackTrie(nil)), receipts, nil
return types.NewBlock(header, &types.Body{Transactions: body.Transactions, Uncles: body.Uncles}, receipts, trie.NewStackTrie(nil)), receipts, nil
}

func (ethash *Ethash) Delay(_ consensus.ChainReader, _ *types.Header, _ *time.Duration) *time.Duration {
Expand Down
43 changes: 28 additions & 15 deletions consensus/parlia/parlia.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,8 @@ const (
)

var (
uncleHash = types.CalcUncleHash(nil) // Always Keccak256(RLP([])) as uncles are meaningless outside of PoW.
diffInTurn = big.NewInt(2) // Block difficulty for in-turn signatures
diffNoTurn = big.NewInt(1) // Block difficulty for out-of-turn signatures
diffInTurn = big.NewInt(2) // Block difficulty for in-turn signatures
diffNoTurn = big.NewInt(1) // Block difficulty for out-of-turn signatures
// 100 native token
maxSystemBalance = new(uint256.Int).Mul(uint256.NewInt(100), uint256.NewInt(params.Ether))
verifyVoteAttestationErrorCounter = metrics.NewRegisteredCounter("parlia/verifyVoteAttestation/error", nil)
Expand Down Expand Up @@ -590,7 +589,7 @@ func (p *Parlia) verifyHeader(chain consensus.ChainHeaderReader, header *types.H
return errInvalidMixDigest
}
// Ensure that the block doesn't contain any uncles which are meaningless in PoA
if header.UncleHash != uncleHash {
if header.UncleHash != types.EmptyUncleHash {
return errInvalidUncleHash
}
// Ensure that the block's difficulty is meaningful (may not be correct at this point)
Expand Down Expand Up @@ -647,6 +646,18 @@ func (p *Parlia) verifyHeader(chain consensus.ChainHeaderReader, header *types.H
}
}

prague := chain.Config().IsPrague(header.Number, header.Time)
if !prague {
if header.RequestsHash != nil {
return fmt.Errorf("invalid RequestsHash, have %#x, expected nil", header.ParentBeaconRoot)
}
} else {
// TODO(Nathan): need a BEP to define this and `Requests` in struct Body
if !header.EmptyRequestsHash() {
return errors.New("header has wrong RequestsHash")
}
}

// All basic checks passed, verify cascading fields
return p.verifyCascadingFields(chain, header, parents)
}
Expand Down Expand Up @@ -1348,11 +1359,11 @@ func (p *Parlia) Finalize(chain consensus.ChainHeaderReader, header *types.Heade
// FinalizeAndAssemble implements consensus.Engine, ensuring no uncles are set,
// nor block rewards given, and returns the final block.
func (p *Parlia) FinalizeAndAssemble(chain consensus.ChainHeaderReader, header *types.Header, state *state.StateDB,
txs []*types.Transaction, uncles []*types.Header, receipts []*types.Receipt, _ []*types.Withdrawal) (*types.Block, []*types.Receipt, error) {
body *types.Body, receipts []*types.Receipt) (*types.Block, []*types.Receipt, error) {
// No block rewards in PoA, so the state remains as is and uncles are dropped
cx := chainContext{Chain: chain, parlia: p}
if txs == nil {
txs = make([]*types.Transaction, 0)
if body.Transactions == nil {
body.Transactions = make([]*types.Transaction, 0)
}
if receipts == nil {
receipts = make([]*types.Receipt, 0)
Expand All @@ -1368,14 +1379,14 @@ func (p *Parlia) FinalizeAndAssemble(chain consensus.ChainHeaderReader, header *
}

if p.chainConfig.IsOnFeynman(header.Number, parent.Time, header.Time) {
err := p.initializeFeynmanContract(state, header, cx, &txs, &receipts, nil, &header.GasUsed, true)
err := p.initializeFeynmanContract(state, header, cx, &body.Transactions, &receipts, nil, &header.GasUsed, true)
if err != nil {
log.Error("init feynman contract failed", "error", err)
}
}

if header.Number.Cmp(common.Big1) == 0 {
err := p.initContract(state, header, cx, &txs, &receipts, nil, &header.GasUsed, true)
err := p.initContract(state, header, cx, &body.Transactions, &receipts, nil, &header.GasUsed, true)
if err != nil {
log.Error("init contract failed")
}
Expand All @@ -1399,21 +1410,21 @@ func (p *Parlia) FinalizeAndAssemble(chain consensus.ChainHeaderReader, header *
}
}
if !signedRecently {
err = p.slash(spoiledVal, state, header, cx, &txs, &receipts, nil, &header.GasUsed, true)
err = p.slash(spoiledVal, state, header, cx, &body.Transactions, &receipts, nil, &header.GasUsed, true)
if err != nil {
// it is possible that slash validator failed because of the slash channel is disabled.
log.Error("slash validator failed", "block hash", header.Hash(), "address", spoiledVal)
}
}
}

err := p.distributeIncoming(p.val, state, header, cx, &txs, &receipts, nil, &header.GasUsed, true)
err := p.distributeIncoming(p.val, state, header, cx, &body.Transactions, &receipts, nil, &header.GasUsed, true)
if err != nil {
return nil, nil, err
}

if p.chainConfig.IsPlato(header.Number) {
if err := p.distributeFinalityReward(chain, state, header, cx, &txs, &receipts, nil, &header.GasUsed, true); err != nil {
if err := p.distributeFinalityReward(chain, state, header, cx, &body.Transactions, &receipts, nil, &header.GasUsed, true); err != nil {
return nil, nil, err
}
}
Expand All @@ -1422,7 +1433,7 @@ func (p *Parlia) FinalizeAndAssemble(chain consensus.ChainHeaderReader, header *
if p.chainConfig.IsFeynman(header.Number, header.Time) && isBreatheBlock(parent.Time, header.Time) {
// we should avoid update validators in the Feynman upgrade block
if !p.chainConfig.IsOnFeynman(header.Number, parent.Time, header.Time) {
if err := p.updateValidatorSetV2(state, header, cx, &txs, &receipts, nil, &header.GasUsed, true); err != nil {
if err := p.updateValidatorSetV2(state, header, cx, &body.Transactions, &receipts, nil, &header.GasUsed, true); err != nil {
return nil, nil, err
}
}
Expand All @@ -1432,7 +1443,7 @@ func (p *Parlia) FinalizeAndAssemble(chain consensus.ChainHeaderReader, header *
if header.GasLimit < header.GasUsed {
return nil, nil, errors.New("gas consumption of system txs exceed the gas limit")
}
header.UncleHash = types.CalcUncleHash(nil)
header.UncleHash = types.EmptyUncleHash
var blk *types.Block
var rootHash common.Hash
wg := sync.WaitGroup{}
Expand All @@ -1442,7 +1453,7 @@ func (p *Parlia) FinalizeAndAssemble(chain consensus.ChainHeaderReader, header *
wg.Done()
}()
go func() {
blk = types.NewBlock(header, &types.Body{Transactions: txs}, receipts, trie.NewStackTrie(nil))
blk = types.NewBlock(header, body, receipts, trie.NewStackTrie(nil))
wg.Done()
}()
wg.Wait()
Expand Down Expand Up @@ -2161,6 +2172,8 @@ func applyMessage(
if chainConfig.IsCancun(header.Number, header.Time) {
rules := vmenv.ChainConfig().Rules(vmenv.Context.BlockNumber, vmenv.Context.Random != nil, vmenv.Context.Time)
state.Prepare(rules, msg.From(), vmenv.Context.Coinbase, msg.To(), vm.ActivePrecompiles(rules), msg.AccessList)
} else {
state.ClearAccessList()
}
// Increment the nonce for the next transaction
state.SetNonce(msg.From(), state.GetNonce(msg.From())+1)
Expand Down
5 changes: 3 additions & 2 deletions core/blockchain.go
Original file line number Diff line number Diff line change
Expand Up @@ -3161,7 +3161,8 @@ func (bc *BlockChain) InsertHeaderChain(chain []*types.Header) (int, error) {
func (bc *BlockChain) HeadChain() *HeaderChain {
return bc.hc
}
func (bc *BlockChain) TriesInMemory() uint64 { return state.TriesInMemory }

func (bc *BlockChain) TriesInMemory() uint64 { return bc.triesInMemory }

func EnablePersistDiff(limit uint64) BlockChainOption {
return func(chain *BlockChain) (*BlockChain, error) {
Expand All @@ -3170,7 +3171,7 @@ func EnablePersistDiff(limit uint64) BlockChainOption {
}
}

func EnableBlockValidator(chainConfig *params.ChainConfig, _ consensus.Engine, mode VerifyMode, peers verifyPeers) BlockChainOption {
func EnableBlockValidator(chainConfig *params.ChainConfig, mode VerifyMode, peers verifyPeers) BlockChainOption {
return func(bc *BlockChain) (*BlockChain, error) {
if mode.NeedRemoteVerify() {
vm, err := NewVerifyManager(bc, peers, mode == InsecureVerify)
Expand Down
5 changes: 2 additions & 3 deletions core/blockchain_diff_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ func newTwoForkedBlockchains(len1, len2 int) (chain1 *BlockChain, chain2 *BlockC
BaseFee: big.NewInt(params.InitialBaseFee),
}
engine1 := ethash.NewFaker()
chain1, _ = NewBlockChain(db1, nil, gspec, nil, engine1, vm.Config{}, nil, nil, EnablePersistDiff(860000), EnableBlockValidator(params.TestChainConfig, engine1, 0, nil))
chain1, _ = NewBlockChain(db1, nil, gspec, nil, engine1, vm.Config{}, nil, nil, EnablePersistDiff(860000), EnableBlockValidator(params.TestChainConfig, 0, nil))
generator1 := func(i int, block *BlockGen) {
// The chain maker doesn't have access to a chain, so the difficulty will be
// lets unset (nil). Set it here to the correct value.
Expand Down Expand Up @@ -324,8 +324,7 @@ func newTwoForkedBlockchains(len1, len2 int) (chain1 *BlockChain, chain2 *BlockC
Alloc: GenesisAlloc{testAddr: {Balance: big.NewInt(100000000000000000)}},
BaseFee: big.NewInt(params.InitialBaseFee),
}
engine2 := ethash.NewFaker()
chain2, _ = NewBlockChain(db2, nil, gspec2, nil, ethash.NewFaker(), vm.Config{}, nil, nil, EnablePersistDiff(860000), EnableBlockValidator(params.TestChainConfig, engine2, 0, nil))
chain2, _ = NewBlockChain(db2, nil, gspec2, nil, ethash.NewFaker(), vm.Config{}, nil, nil, EnablePersistDiff(860000), EnableBlockValidator(params.TestChainConfig, 0, nil))
generator2 := func(i int, block *BlockGen) {
// The chain maker doesn't have access to a chain, so the difficulty will be
// lets unset (nil). Set it here to the correct value.
Expand Down
4 changes: 2 additions & 2 deletions core/blockchain_notries_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,13 +104,13 @@ func makeTestBackendWithRemoteValidator(blocks int, mode VerifyMode, failed *ver
peers := []VerifyPeer{peer}

verifier, err := NewBlockChain(db, nil, gspec, nil, engine, vm.Config{},
nil, nil, EnablePersistDiff(100000), EnableBlockValidator(params.TestChainConfig, engine2, LocalVerify, nil))
nil, nil, EnablePersistDiff(100000), EnableBlockValidator(params.TestChainConfig, LocalVerify, nil))
if err != nil {
return nil, nil, nil, err
}

fastnode, err := NewBlockChain(db2, nil, gspec2, nil, engine2, vm.Config{},
nil, nil, EnableBlockValidator(params.TestChainConfig, engine2, mode, newMockRemoteVerifyPeer(peers)))
nil, nil, EnableBlockValidator(params.TestChainConfig, mode, newMockRemoteVerifyPeer(peers)))
if err != nil {
return nil, nil, nil, err
}
Expand Down
4 changes: 2 additions & 2 deletions core/blockchain_repair_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1841,14 +1841,14 @@ func testRepairWithScheme(t *testing.T, tt *rewindTest, snapshots bool, scheme s
}
// Force run a freeze cycle
type freezer interface {
Freeze() error
Freeze(threshold uint64) error
Ancients() (uint64, error)
}
if tt.freezeThreshold < uint64(tt.canonicalBlocks) {
final := uint64(tt.canonicalBlocks) - tt.freezeThreshold
chain.SetFinalized(canonblocks[int(final)-1].Header())
}
db.(freezer).Freeze()
db.(freezer).Freeze(tt.freezeThreshold)

// Set the simulated pivot block
if tt.pivotBlock != nil {
Expand Down
Loading
Loading