fix some lint errors (TODO: merge this commit into the 7928 changes

This commit is contained in:
Jared Wasinger 2026-03-03 18:23:23 -05:00
parent 2135705bd4
commit 6d1df21ef9
6 changed files with 57 additions and 55 deletions

View file

@ -165,7 +165,7 @@ func testBlockChainImport(chain types.Blocks, blockchain *BlockChain) error {
blockchain.reportBadBlock(block, res, err) blockchain.reportBadBlock(block, res, err)
return err return err
} }
err = blockchain.validator.ValidateState(block, statedb, res, true, false) err = blockchain.validator.ValidateState(block, statedb, res, true)
if err != nil { if err != nil {
blockchain.reportBadBlock(block, res, err) blockchain.reportBadBlock(block, res, err)
return err return err

View file

@ -1296,12 +1296,13 @@ func TestDeleteStorage(t *testing.T) {
obj := fastState.getOrNewStateObject(addr) obj := fastState.getOrNewStateObject(addr)
storageRoot := obj.data.Root 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 { if err != nil {
t.Fatal(err) 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 { if err != nil {
t.Fatal(err) t.Fatal(err)
} }

View file

@ -36,9 +36,8 @@ func equalBALs(a *BlockAccessList, b *BlockAccessList) bool {
return true return true
} }
func makeTestConstructionBAL() *AccessListBuilder { func makeTestConstructionBAL() ConstructionBlockAccessList {
return &AccessListBuilder{ return map[common.Address]*ConstructionAccountAccesses{
FinalizedAccesses: map[common.Address]*ConstructionAccountAccesses{
common.BytesToAddress([]byte{0xff, 0xff}): { common.BytesToAddress([]byte{0xff, 0xff}): {
StorageWrites: map[common.Hash]map[uint16]common.Hash{ StorageWrites: map[common.Hash]map[uint16]common.Hash{
common.BytesToHash([]byte{0x01}): { common.BytesToHash([]byte{0x01}): {
@ -60,10 +59,7 @@ func makeTestConstructionBAL() *AccessListBuilder {
1: 2, 1: 2,
2: 6, 2: 6,
}, },
CodeChanges: map[uint16]CodeChange{0: { CodeChanges: map[uint16][]byte{0: common.Hex2Bytes("deadbeef")},
TxIdx: 0,
Code: common.Hex2Bytes("deadbeef"),
}},
}, },
common.BytesToAddress([]byte{0xff, 0xff, 0xff}): { common.BytesToAddress([]byte{0xff, 0xff, 0xff}): {
StorageWrites: map[common.Hash]map[uint16]common.Hash{ StorageWrites: map[common.Hash]map[uint16]common.Hash{
@ -71,9 +67,6 @@ func makeTestConstructionBAL() *AccessListBuilder {
2: common.BytesToHash([]byte{1, 2, 3, 4, 5, 6}), 2: common.BytesToHash([]byte{1, 2, 3, 4, 5, 6}),
3: common.BytesToHash([]byte{1, 2, 3, 4, 5, 6, 7, 8}), 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{}{ StorageReads: map[common.Hash]struct{}{
common.BytesToHash([]byte{1, 2, 3, 4, 5, 6, 7, 8}): {}, common.BytesToHash([]byte{1, 2, 3, 4, 5, 6, 7, 8}): {},
@ -86,15 +79,13 @@ func makeTestConstructionBAL() *AccessListBuilder {
1: 2, 1: 2,
}, },
}, },
},
} }
} }
// TestBALEncoding tests that a populated access list can be encoded/decoded correctly. // TestBALEncoding tests that a populated access list can be encoded/decoded correctly.
func TestBALEncoding(t *testing.T) { func TestBALEncoding(t *testing.T) {
var buf bytes.Buffer var buf bytes.Buffer
balBuilder := makeTestConstructionBAL() bal := makeTestConstructionBAL()
bal := balBuilder.FinalizedAccesses
err := bal.EncodeRLP(&buf) err := bal.EncodeRLP(&buf)
if err != nil { if err != nil {
t.Fatalf("encoding failed: %v\n", err) t.Fatalf("encoding failed: %v\n", err)
@ -184,9 +175,9 @@ func makeTestAccountAccess(sort bool) AccountAccess {
StorageReads: encodedStorageReads, StorageReads: encodedStorageReads,
BalanceChanges: balances, BalanceChanges: balances,
NonceChanges: nonces, NonceChanges: nonces,
CodeChanges: []CodeChange{ CodeChanges: []encodingCodeChange{
{ {
TxIdx: 100, TxIndex: 100,
Code: testrand.Bytes(256), Code: testrand.Bytes(256),
}, },
}, },
@ -250,7 +241,7 @@ func TestBlockAccessListValidation(t *testing.T) {
} }
// Validate the derived block access list // Validate the derived block access list
cBAL := makeTestConstructionBAL().FinalizedAccesses cBAL := makeTestConstructionBAL()
listB := cBAL.ToEncodingObj() listB := cBAL.ToEncodingObj()
if err := listB.Validate(testBALMaxIndex); err != nil { if err := listB.Validate(testBALMaxIndex); err != nil {
t.Fatalf("Unexpected validation error: %v", err) t.Fatalf("Unexpected validation error: %v", err)

View file

@ -620,7 +620,7 @@ func TestSelfdestructStateTracer(t *testing.T) {
} }
context := core.NewEVMBlockContext(block.Header(), blockchain, nil) context := core.NewEVMBlockContext(block.Header(), blockchain, nil)
evm := vm.NewEVM(context, hookedState, tt.genesis.Config, vm.Config{Tracer: tracer.Hooks()}) 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 { if err != nil {
t.Fatalf("failed to execute transaction: %v", err) t.Fatalf("failed to execute transaction: %v", err)
} }

View file

@ -558,6 +558,11 @@ func (b testBackend) BlockByNumberOrHash(ctx context.Context, blockNrOrHash rpc.
} }
panic("unknown type rpc.BlockNumberOrHash") 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) { 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 return b.chain.GetBlock(hash, uint64(number.Int64())).Body(), nil
} }

View file

@ -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) { func (b *backendMock) BlockByNumberOrHash(ctx context.Context, blockNrOrHash rpc.BlockNumberOrHash) (*types.Block, error) {
return nil, nil 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) { func (b *backendMock) GetBody(ctx context.Context, hash common.Hash, number rpc.BlockNumber) (*types.Body, error) {
return nil, nil return nil, nil
} }