fix : freezer, TestStateProcessorErrors

This commit is contained in:
Shivam Sharma 2023-07-03 17:11:56 +05:30
parent a25bc7794a
commit 6d4e60045a
4 changed files with 17 additions and 5 deletions

View file

@ -42,6 +42,7 @@ var chainFreezerNoSnappy = map[string]bool{
ChainFreezerBodiesTable: false, ChainFreezerBodiesTable: false,
ChainFreezerReceiptTable: false, ChainFreezerReceiptTable: false,
ChainFreezerDifficultyTable: true, ChainFreezerDifficultyTable: true,
freezerBorReceiptTable: false,
} }
// The list of identifiers of ancient stores. // The list of identifiers of ancient stores.

View file

@ -342,6 +342,12 @@ func (f *chainFreezer) freezeRange(nfdb *nofreezedb, number, limit uint64) (hash
return fmt.Errorf("can't write td to Freezer: %v", err) return fmt.Errorf("can't write td to Freezer: %v", err)
} }
// bor block receipt
borBlockReceipt := ReadBorReceiptRLP(nfdb, hash, number)
if err := op.AppendRaw(freezerBorReceiptTable, number, borBlockReceipt); err != nil {
return fmt.Errorf("can't write bor-receipt to freezer: %v", err)
}
hashes = append(hashes, hash) hashes = append(hashes, hash)
} }

View file

@ -45,6 +45,12 @@ func u64(val uint64) *uint64 { return &val }
// contain invalid transactions // contain invalid transactions
func TestStateProcessorErrors(t *testing.T) { func TestStateProcessorErrors(t *testing.T) {
var ( var (
cacheConfig = &CacheConfig{
TrieCleanLimit: 154,
TrieCleanJournal: "triecache",
Preimages: true,
}
config = &params.ChainConfig{ config = &params.ChainConfig{
ChainID: big.NewInt(1), ChainID: big.NewInt(1),
HomesteadBlock: big.NewInt(0), HomesteadBlock: big.NewInt(0),
@ -256,7 +262,7 @@ func TestStateProcessorErrors(t *testing.T) {
}, },
} }
blockchain, _ = NewBlockChain(db, nil, gspec, nil, ethash.NewFaker(), vm.Config{}, nil, nil, nil) blockchain, _ = NewBlockChain(db, nil, gspec, nil, ethash.NewFaker(), vm.Config{}, nil, nil, nil)
parallelBlockchain, _ = NewParallelBlockChain(db, nil, gspec, nil, ethash.NewFaker(), vm.Config{ParallelEnable: true, ParallelSpeculativeProcesses: 8}, nil, nil, nil) parallelBlockchain, _ = NewParallelBlockChain(db, cacheConfig, gspec, nil, ethash.NewFaker(), vm.Config{ParallelEnable: true, ParallelSpeculativeProcesses: 8}, nil, nil, nil)
) )
defer blockchain.Stop() defer blockchain.Stop()
@ -303,7 +309,7 @@ func TestStateProcessorErrors(t *testing.T) {
}, },
} }
blockchain, _ = NewBlockChain(db, nil, gspec, nil, ethash.NewFaker(), vm.Config{}, nil, nil, nil) blockchain, _ = NewBlockChain(db, nil, gspec, nil, ethash.NewFaker(), vm.Config{}, nil, nil, nil)
parallelBlockchain, _ = NewParallelBlockChain(db, nil, gspec, nil, ethash.NewFaker(), vm.Config{ParallelEnable: true, ParallelSpeculativeProcesses: 8}, nil, nil, nil) parallelBlockchain, _ = NewParallelBlockChain(db, cacheConfig, gspec, nil, ethash.NewFaker(), vm.Config{ParallelEnable: true, ParallelSpeculativeProcesses: 8}, nil, nil, nil)
) )
defer blockchain.Stop() defer blockchain.Stop()
@ -360,6 +366,7 @@ func TestStateProcessorErrors(t *testing.T) {
TerminalTotalDifficultyPassed: true, TerminalTotalDifficultyPassed: true,
// TODO marcello double check // TODO marcello double check
ShanghaiTime: u64(0), ShanghaiTime: u64(0),
Bor: &params.BorConfig{BurntContract: map[string]string{"0": "0x000000000000000000000000000000000000dead"}},
}, },
Alloc: GenesisAlloc{ Alloc: GenesisAlloc{
common.HexToAddress("0x71562b71999873DB5b286dF957af199Ec94617F7"): GenesisAccount{ common.HexToAddress("0x71562b71999873DB5b286dF957af199Ec94617F7"): GenesisAccount{
@ -370,7 +377,7 @@ func TestStateProcessorErrors(t *testing.T) {
} }
genesis = gspec.MustCommit(db) genesis = gspec.MustCommit(db)
blockchain, _ = NewBlockChain(db, nil, gspec, nil, beacon.New(ethash.NewFaker()), vm.Config{}, nil, nil, nil) blockchain, _ = NewBlockChain(db, nil, gspec, nil, beacon.New(ethash.NewFaker()), vm.Config{}, nil, nil, nil)
parallelBlockchain, _ = NewParallelBlockChain(db, nil, gspec, nil, ethash.NewFaker(), vm.Config{ParallelEnable: true, ParallelSpeculativeProcesses: 8}, nil, nil, nil) parallelBlockchain, _ = NewParallelBlockChain(db, cacheConfig, gspec, nil, beacon.New(ethash.NewFaker()), vm.Config{ParallelEnable: true, ParallelSpeculativeProcesses: 8}, nil, nil, nil)
tooBigInitCode = [params.MaxInitCodeSize + 1]byte{} tooBigInitCode = [params.MaxInitCodeSize + 1]byte{}
smallInitCode = [320]byte{} smallInitCode = [320]byte{}
) )

View file

@ -41,8 +41,6 @@ func TestSnapSyncDisabling67(t *testing.T) {
// Tests that snap sync gets disabled as soon as a real block is successfully // Tests that snap sync gets disabled as soon as a real block is successfully
// imported into the blockchain. // imported into the blockchain.
func testSnapSyncDisabling(t *testing.T, ethVer uint, snapVer uint) { func testSnapSyncDisabling(t *testing.T, ethVer uint, snapVer uint) {
t.Parallel()
// Create an empty handler and ensure it's in snap sync mode // Create an empty handler and ensure it's in snap sync mode
empty := newTestHandler() empty := newTestHandler()
if atomic.LoadUint32(&empty.handler.snapSync) == 0 { if atomic.LoadUint32(&empty.handler.snapSync) == 0 {