mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-03-04 02:23:48 +00:00
fix some lint errors (TODO: merge this commit into the 7928 changes
This commit is contained in:
parent
9c834c42f1
commit
c7caff4788
6 changed files with 57 additions and 55 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue