diff --git a/core/blockchain_test.go b/core/blockchain_test.go index 2f0f3d2fa3..ce7e60f71e 100644 --- a/core/blockchain_test.go +++ b/core/blockchain_test.go @@ -166,7 +166,7 @@ func testBlockChainImport(chain types.Blocks, blockchain *BlockChain) error { blockchain.reportBadBlock(block, res, err) return err } - err = blockchain.validator.ValidateState(block, statedb, res, true, false) + err = blockchain.validator.ValidateState(block, statedb, res, true) if err != nil { blockchain.reportBadBlock(block, res, err) return err diff --git a/core/state/statedb_test.go b/core/state/statedb_test.go index 661d17bb7b..a279395780 100644 --- a/core/state/statedb_test.go +++ b/core/state/statedb_test.go @@ -1296,12 +1296,13 @@ func TestDeleteStorage(t *testing.T) { obj := fastState.getOrNewStateObject(addr) storageRoot := obj.data.Root - _, _, fastNodes, err := fastState.deleteStorage(addr, crypto.Keccak256Hash(addr[:]), storageRoot) + // TODO (jwasinger): verify that the invocation of fast/slowDeleteStorage have correct params here + _, _, fastNodes, err := fastDeleteStorage(storageRoot, fastState.db.Snapshot(), crypto.Keccak256Hash(addr[:]), root) if err != nil { t.Fatal(err) } - _, _, slowNodes, err := slowState.deleteStorage(addr, crypto.Keccak256Hash(addr[:]), storageRoot) + _, _, slowNodes, err := slowDeleteStorage(slowState.db, slowState.trie, storageRoot, addr, crypto.Keccak256Hash(addr[:]), root) if err != nil { t.Fatal(err) } diff --git a/core/types/bal/bal_test.go b/core/types/bal/bal_test.go index a0538c2b95..ebfb1cf295 100644 --- a/core/types/bal/bal_test.go +++ b/core/types/bal/bal_test.go @@ -36,56 +36,48 @@ func equalBALs(a *BlockAccessList, b *BlockAccessList) bool { return true } -func makeTestConstructionBAL() *AccessListBuilder { - return &AccessListBuilder{ - FinalizedAccesses: map[common.Address]*ConstructionAccountAccesses{ - common.BytesToAddress([]byte{0xff, 0xff}): { - StorageWrites: map[common.Hash]map[uint16]common.Hash{ - common.BytesToHash([]byte{0x01}): { - 1: common.BytesToHash([]byte{1, 2, 3, 4}), - 2: common.BytesToHash([]byte{1, 2, 3, 4, 5, 6}), - }, - common.BytesToHash([]byte{0x10}): { - 20: common.BytesToHash([]byte{1, 2, 3, 4}), - }, +func makeTestConstructionBAL() ConstructionBlockAccessList { + return map[common.Address]*ConstructionAccountAccesses{ + common.BytesToAddress([]byte{0xff, 0xff}): { + StorageWrites: map[common.Hash]map[uint16]common.Hash{ + common.BytesToHash([]byte{0x01}): { + 1: common.BytesToHash([]byte{1, 2, 3, 4}), + 2: common.BytesToHash([]byte{1, 2, 3, 4, 5, 6}), }, - StorageReads: map[common.Hash]struct{}{ - common.BytesToHash([]byte{1, 2, 3, 4, 5, 6, 7}): {}, + common.BytesToHash([]byte{0x10}): { + 20: common.BytesToHash([]byte{1, 2, 3, 4}), }, - BalanceChanges: map[uint16]*uint256.Int{ - 1: uint256.NewInt(100), - 2: uint256.NewInt(500), - }, - NonceChanges: map[uint16]uint64{ - 1: 2, - 2: 6, - }, - CodeChanges: map[uint16]CodeChange{0: { - TxIdx: 0, - Code: common.Hex2Bytes("deadbeef"), - }}, }, - common.BytesToAddress([]byte{0xff, 0xff, 0xff}): { - StorageWrites: map[common.Hash]map[uint16]common.Hash{ - common.BytesToHash([]byte{0x01}): { - 2: common.BytesToHash([]byte{1, 2, 3, 4, 5, 6}), - 3: common.BytesToHash([]byte{1, 2, 3, 4, 5, 6, 7, 8}), - }, - common.BytesToHash([]byte{0x10}): { - 21: common.BytesToHash([]byte{1, 2, 3, 4, 5}), - }, - }, - StorageReads: map[common.Hash]struct{}{ - common.BytesToHash([]byte{1, 2, 3, 4, 5, 6, 7, 8}): {}, - }, - BalanceChanges: map[uint16]*uint256.Int{ - 2: uint256.NewInt(100), - 3: uint256.NewInt(500), - }, - NonceChanges: map[uint16]uint64{ - 1: 2, + StorageReads: map[common.Hash]struct{}{ + common.BytesToHash([]byte{1, 2, 3, 4, 5, 6, 7}): {}, + }, + BalanceChanges: map[uint16]*uint256.Int{ + 1: uint256.NewInt(100), + 2: uint256.NewInt(500), + }, + NonceChanges: map[uint16]uint64{ + 1: 2, + 2: 6, + }, + CodeChanges: map[uint16][]byte{0: common.Hex2Bytes("deadbeef")}, + }, + common.BytesToAddress([]byte{0xff, 0xff, 0xff}): { + StorageWrites: map[common.Hash]map[uint16]common.Hash{ + common.BytesToHash([]byte{0x01}): { + 2: common.BytesToHash([]byte{1, 2, 3, 4, 5, 6}), + 3: common.BytesToHash([]byte{1, 2, 3, 4, 5, 6, 7, 8}), }, }, + StorageReads: map[common.Hash]struct{}{ + common.BytesToHash([]byte{1, 2, 3, 4, 5, 6, 7, 8}): {}, + }, + BalanceChanges: map[uint16]*uint256.Int{ + 2: uint256.NewInt(100), + 3: uint256.NewInt(500), + }, + NonceChanges: map[uint16]uint64{ + 1: 2, + }, }, } } @@ -93,8 +85,7 @@ func makeTestConstructionBAL() *AccessListBuilder { // TestBALEncoding tests that a populated access list can be encoded/decoded correctly. func TestBALEncoding(t *testing.T) { var buf bytes.Buffer - balBuilder := makeTestConstructionBAL() - bal := balBuilder.FinalizedAccesses + bal := makeTestConstructionBAL() err := bal.EncodeRLP(&buf) if err != nil { t.Fatalf("encoding failed: %v\n", err) @@ -184,10 +175,10 @@ func makeTestAccountAccess(sort bool) AccountAccess { StorageReads: encodedStorageReads, BalanceChanges: balances, NonceChanges: nonces, - CodeChanges: []CodeChange{ + CodeChanges: []encodingCodeChange{ { - TxIdx: 100, - Code: testrand.Bytes(256), + TxIndex: 100, + Code: testrand.Bytes(256), }, }, } @@ -250,7 +241,7 @@ func TestBlockAccessListValidation(t *testing.T) { } // Validate the derived block access list - cBAL := makeTestConstructionBAL().FinalizedAccesses + cBAL := makeTestConstructionBAL() listB := cBAL.ToEncodingObj() if err := listB.Validate(testBALMaxIndex); err != nil { t.Fatalf("Unexpected validation error: %v", err) diff --git a/eth/tracers/internal/tracetest/selfdestruct_state_test.go b/eth/tracers/internal/tracetest/selfdestruct_state_test.go index bb1a3d9f18..0b6bcb6355 100644 --- a/eth/tracers/internal/tracetest/selfdestruct_state_test.go +++ b/eth/tracers/internal/tracetest/selfdestruct_state_test.go @@ -620,7 +620,7 @@ func TestSelfdestructStateTracer(t *testing.T) { } context := core.NewEVMBlockContext(block.Header(), blockchain, nil) evm := vm.NewEVM(context, hookedState, tt.genesis.Config, vm.Config{Tracer: tracer.Hooks()}) - _, err = core.ApplyTransactionWithEVM(msg, core.NewGasPool(msg.GasLimit), statedb, block.Number(), block.Hash(), block.Time(), tx, evm) + _, _, err = core.ApplyTransactionWithEVM(msg, core.NewGasPool(msg.GasLimit), statedb, block.Number(), block.Hash(), block.Time(), tx, evm) if err != nil { t.Fatalf("failed to execute transaction: %v", err) } diff --git a/internal/ethapi/api_test.go b/internal/ethapi/api_test.go index a82df440e6..c799d76d07 100644 --- a/internal/ethapi/api_test.go +++ b/internal/ethapi/api_test.go @@ -559,6 +559,11 @@ func (b testBackend) BlockByNumberOrHash(ctx context.Context, blockNrOrHash rpc. } panic("unknown type rpc.BlockNumberOrHash") } + +func (b testBackend) BlockAccessListByNumberOrHash(block rpc.BlockNumberOrHash) (interface{}, error) { + panic("not implemented") +} + func (b testBackend) GetBody(ctx context.Context, hash common.Hash, number rpc.BlockNumber) (*types.Body, error) { return b.chain.GetBlock(hash, uint64(number.Int64())).Body(), nil } diff --git a/internal/ethapi/transaction_args_test.go b/internal/ethapi/transaction_args_test.go index 30791f32b5..a118662524 100644 --- a/internal/ethapi/transaction_args_test.go +++ b/internal/ethapi/transaction_args_test.go @@ -356,6 +356,11 @@ func (b *backendMock) BlockByHash(ctx context.Context, hash common.Hash) (*types func (b *backendMock) BlockByNumberOrHash(ctx context.Context, blockNrOrHash rpc.BlockNumberOrHash) (*types.Block, error) { return nil, nil } + +func (b *backendMock) BlockAccessListByNumberOrHash(block rpc.BlockNumberOrHash) (interface{}, error) { + panic("not implemented") +} + func (b *backendMock) GetBody(ctx context.Context, hash common.Hash, number rpc.BlockNumber) (*types.Body, error) { return nil, nil }