Skip to content

Commit 3233835

Browse files
committed
style: fix based on feedback
1 parent 651f189 commit 3233835

File tree

27 files changed

+112
-96
lines changed

27 files changed

+112
-96
lines changed

core/blockchain_ext_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -925,7 +925,7 @@ func EmptyBlocksTest(t *testing.T, create createFunc) {
925925
blockchain.DrainAcceptorQueue()
926926

927927
// Nothing to assert about the state
928-
checkState := func(_ *state.StateDB) error {
928+
checkState := func(*state.StateDB) error {
929929
return nil
930930
}
931931

core/extstate/firewood_database.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,12 @@ func (db *firewoodAccessorDb) OpenTrie(root common.Hash) (state.Trie, error) {
2929
}
3030

3131
// OpenStorageTrie opens a wrapped version of the account trie.
32-
func (*firewoodAccessorDb) OpenStorageTrie(_ common.Hash, _ common.Address, root common.Hash, self state.Trie) (state.Trie, error) {
32+
func (*firewoodAccessorDb) OpenStorageTrie(_ common.Hash, _ common.Address, accountRoot common.Hash, self state.Trie) (state.Trie, error) {
3333
accountTrie, ok := self.(*firewood.AccountTrie)
3434
if !ok {
3535
return nil, fmt.Errorf("Invalid account trie type: %T", self)
3636
}
37-
return firewood.NewStorageTrie(accountTrie, root)
37+
return firewood.NewStorageTrie(accountTrie, accountRoot)
3838
}
3939

4040
// CopyTrie returns a deep copy of the given trie.

core/fifo_cache.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ func (f *BufferFIFOCache[K, V]) remove(key K) error {
6565

6666
type NoOpFIFOCache[K comparable, V any] struct{}
6767

68-
func (*NoOpFIFOCache[K, V]) Put(_ K, _ V) {}
69-
func (*NoOpFIFOCache[K, V]) Get(_ K) (V, bool) {
68+
func (*NoOpFIFOCache[K, V]) Put(K, V) {}
69+
func (*NoOpFIFOCache[K, V]) Get(K) (V, bool) {
7070
return *new(V), false
7171
}

core/state_manager_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ func (*MockTrieDB) Size() (common.StorageSize, common.StorageSize, common.Storag
3434
return 0, 0, 0
3535
}
3636

37-
func (*MockTrieDB) Cap(_ common.StorageSize) error {
37+
func (*MockTrieDB) Cap(common.StorageSize) error {
3838
return nil
3939
}
4040

eth/api_debug.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ func (api *DebugAPI) Preimage(ctx context.Context, hash common.Hash) (hexutil.By
102102
// and returns them as a JSON list of block hashes.
103103
func (api *DebugAPI) GetBadBlocks(ctx context.Context) ([]*ethapi.BadBlockArgs, error) {
104104
internalAPI := ethapi.NewBlockChainAPI(api.eth.APIBackend)
105-
return internalAPI.GetBadBlocks()
105+
return internalAPI.GetBadBlocks(ctx)
106106
}
107107

108108
// AccountRangeMaxResults is the maximum number of results to be returned per call

internal/ethapi/api_extra.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import (
1313
"github.com/ava-labs/libevm/rlp"
1414

1515
"github.com/ava-labs/coreth/core"
16+
"github.com/ava-labs/coreth/params"
1617
"github.com/ava-labs/coreth/rpc"
1718
)
1819

@@ -23,6 +24,11 @@ type DetailedExecutionResult struct {
2324
ReturnData hexutil.Bytes `json:"returnData"` // Data from evm(function result or data supplied with revert opcode)
2425
}
2526

27+
// GetChainConfig returns the chain config.
28+
func (api *BlockChainAPI) GetChainConfig(context.Context) *params.ChainConfig {
29+
return api.b.ChainConfig()
30+
}
31+
2632
// CallDetailed performs the same call as Call, but returns the full context
2733
func (s *BlockChainAPI) CallDetailed(ctx context.Context, args TransactionArgs, blockNrOrHash rpc.BlockNumberOrHash, overrides *StateOverride) (*DetailedExecutionResult, error) {
2834
result, err := DoCall(ctx, s.b, args, blockNrOrHash, overrides, nil, s.b.RPCEVMTimeout(), s.b.RPCGasCap())
@@ -63,7 +69,7 @@ type BadBlockArgs struct {
6369

6470
// GetBadBlocks returns a list of the last 'bad blocks' that the client has seen on the network
6571
// and returns them as a JSON list of block hashes.
66-
func (s *BlockChainAPI) GetBadBlocks() ([]*BadBlockArgs, error) {
72+
func (s *BlockChainAPI) GetBadBlocks(context.Context) ([]*BadBlockArgs, error) {
6773
var (
6874
badBlocks, reasons = s.b.BadBlocks()
6975
results = make([]*BadBlockArgs, 0, len(badBlocks))

network/network_test.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -134,10 +134,10 @@ func TestRequestAnyRequestsRoutingAndResponse(t *testing.T) {
134134
func TestAppRequestOnCtxCancellation(t *testing.T) {
135135
codecManager := buildCodec(t, HelloRequest{}, HelloResponse{})
136136
sender := testAppSender{
137-
sendAppRequestFn: func(_ context.Context, _ set.Set[ids.NodeID], _ uint32, _ []byte) error {
137+
sendAppRequestFn: func(context.Context, set.Set[ids.NodeID], uint32, []byte) error {
138138
return nil
139139
},
140-
sendAppResponseFn: func(_ ids.NodeID, _ uint32, _ []byte) error {
140+
sendAppResponseFn: func(ids.NodeID, uint32, []byte) error {
141141
return nil
142142
},
143143
}
@@ -263,7 +263,7 @@ func TestAppRequestOnShutdown(t *testing.T) {
263263
called bool
264264
)
265265
sender := testAppSender{
266-
sendAppRequestFn: func(_ context.Context, _ set.Set[ids.NodeID], _ uint32, _ []byte) error {
266+
sendAppRequestFn: func(context.Context, set.Set[ids.NodeID], uint32, []byte) error {
267267
wg.Add(1)
268268
go func() {
269269
called = true
@@ -319,7 +319,7 @@ func TestSyncedAppRequestAnyOnCtxCancellation(t *testing.T) {
319319
}
320320
return nil
321321
},
322-
sendAppResponseFn: func(_ ids.NodeID, _ uint32, _ []byte) error {
322+
sendAppResponseFn: func(ids.NodeID, uint32, []byte) error {
323323
return nil
324324
},
325325
}
@@ -639,7 +639,7 @@ func (t testAppSender) SendAppGossip(_ context.Context, config common.SendConfig
639639
return t.sendAppGossipFn(config, message)
640640
}
641641

642-
func (testAppSender) SendAppError(_ context.Context, _ ids.NodeID, _ uint32, _ int32, _ string) error {
642+
func (testAppSender) SendAppError(context.Context, ids.NodeID, uint32, int32, string) error {
643643
panic("not implemented")
644644
}
645645

@@ -751,12 +751,12 @@ type testSDKHandler struct {
751751
appRequested bool
752752
}
753753

754-
func (*testSDKHandler) AppGossip(_ context.Context, _ ids.NodeID, _ []byte) {
754+
func (*testSDKHandler) AppGossip(context.Context, ids.NodeID, []byte) {
755755
// TODO implement me
756756
panic("implement me")
757757
}
758758

759-
func (t *testSDKHandler) AppRequest(_ context.Context, _ ids.NodeID, _ time.Time, _ []byte) ([]byte, *common.AppError) {
759+
func (t *testSDKHandler) AppRequest(context.Context, ids.NodeID, time.Time, []byte) ([]byte, *common.AppError) {
760760
t.appRequested = true
761761
return nil, nil
762762
}

params/config_libevm.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@ var payloads ethparams.ExtraPayloads[*extras.ChainConfig, RulesExtra]
3232
// constructRulesExtra acts as an adjunct to the [params.ChainConfig.Rules]
3333
// method. Its primary purpose is to construct the extra payload for the
3434
// [params.Rules] but it MAY also modify the [params.Rules].
35-
func constructRulesExtra(_ *ethparams.ChainConfig, _ *ethparams.Rules, cEx *extras.ChainConfig, _ *big.Int, _ bool, timestamp uint64) RulesExtra {
35+
//
36+
//nolint:revive
37+
func constructRulesExtra(c *ethparams.ChainConfig, r *ethparams.Rules, cEx *extras.ChainConfig, blockNum *big.Int, isMerge bool, timestamp uint64) RulesExtra {
3638
var rules RulesExtra
3739
if cEx == nil {
3840
return rules

params/extras/config.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,8 @@ type ChainConfig struct {
110110
UpgradeConfig `json:"-"` // Config specified in upgradeBytes (avalanche network upgrades or enable/disabling precompiles). Not serialized.
111111
}
112112

113-
func (c *ChainConfig) CheckConfigCompatible(newcfg_ *ethparams.ChainConfig, _ *big.Int, headTimestamp uint64) *ethparams.ConfigCompatError {
113+
//nolint:revive
114+
func (c *ChainConfig) CheckConfigCompatible(newcfg_ *ethparams.ChainConfig, headNumber *big.Int, headTimestamp uint64) *ethparams.ConfigCompatError {
114115
if c == nil {
115116
return nil
116117
}

plugin/evm/admin.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ func NewAdminService(vm *VM, performanceDir string) *Admin {
2828
}
2929

3030
// StartCPUProfiler starts a cpu profile writing to the specified file
31-
func (p *Admin) StartCPUProfiler(_ *http.Request, _ *struct{}, _ *api.EmptyReply) error {
31+
func (p *Admin) StartCPUProfiler(*http.Request, *struct{}, *api.EmptyReply) error {
3232
log.Info("Admin: StartCPUProfiler called")
3333

3434
p.vm.ctx.Lock.Lock()
@@ -38,7 +38,7 @@ func (p *Admin) StartCPUProfiler(_ *http.Request, _ *struct{}, _ *api.EmptyReply
3838
}
3939

4040
// StopCPUProfiler stops the cpu profile
41-
func (p *Admin) StopCPUProfiler(_ *http.Request, _ *struct{}, _ *api.EmptyReply) error {
41+
func (p *Admin) StopCPUProfiler(*http.Request, *struct{}, *api.EmptyReply) error {
4242
log.Info("Admin: StopCPUProfiler called")
4343

4444
p.vm.ctx.Lock.Lock()
@@ -48,7 +48,7 @@ func (p *Admin) StopCPUProfiler(_ *http.Request, _ *struct{}, _ *api.EmptyReply)
4848
}
4949

5050
// MemoryProfile runs a memory profile writing to the specified file
51-
func (p *Admin) MemoryProfile(_ *http.Request, _ *struct{}, _ *api.EmptyReply) error {
51+
func (p *Admin) MemoryProfile(*http.Request, *struct{}, *api.EmptyReply) error {
5252
log.Info("Admin: MemoryProfile called")
5353

5454
p.vm.ctx.Lock.Lock()
@@ -58,7 +58,7 @@ func (p *Admin) MemoryProfile(_ *http.Request, _ *struct{}, _ *api.EmptyReply) e
5858
}
5959

6060
// LockProfile runs a mutex profile writing to the specified file
61-
func (p *Admin) LockProfile(_ *http.Request, _ *struct{}, _ *api.EmptyReply) error {
61+
func (p *Admin) LockProfile(*http.Request, *struct{}, *api.EmptyReply) error {
6262
log.Info("Admin: LockProfile called")
6363

6464
p.vm.ctx.Lock.Lock()

0 commit comments

Comments
 (0)