From 23ab5dcf4f9047191a17bae6df4150486e8719c8 Mon Sep 17 00:00:00 2001 From: Sahil Sojitra Date: Thu, 6 Aug 2026 13:50:14 +0530 Subject: [PATCH 01/10] linter: enable nilValReturn check in gocritic and fix violations --- .golangci.yml | 1 - execution/protocol/gaspool.go | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index 5339ea8a47f..ccdf8dd95a8 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -51,7 +51,6 @@ linters: - ruleguard disabled-checks: - commentFormatting # disabled to avoid unnecessary friction on local lints and CI for minor whitespace changes without functional benefit - - nilValReturn - evalOrder - returnAfterHttpError - weakCond diff --git a/execution/protocol/gaspool.go b/execution/protocol/gaspool.go index 02b851bc092..c9ad0524938 100644 --- a/execution/protocol/gaspool.go +++ b/execution/protocol/gaspool.go @@ -122,7 +122,7 @@ func (gp *GasPool) ConsumeState(amount uint64) error { // stateGas is never consumed, so seeding it has no observable effect there. func (gp *GasPool) AddGas(amount uint64) *GasPool { if gp == nil { - return gp + return nil } gp.mu.Lock() defer gp.mu.Unlock() @@ -147,7 +147,7 @@ func (gp *GasPool) Gas() uint64 { // AddBlobGas extends the blob-gas budget. func (gp *GasPool) AddBlobGas(amount uint64) *GasPool { if gp == nil { - return gp + return nil } gp.mu.Lock() defer gp.mu.Unlock() From d32a330dd7f69a6551a2b19252bc8438899f497d Mon Sep 17 00:00:00 2001 From: Sahil Sojitra Date: Thu, 6 Aug 2026 14:17:33 +0530 Subject: [PATCH 02/10] linter: enable evalOrder check in gocritic and fix violations --- .golangci.yml | 1 - cl/persistence/state/state_accessors.go | 6 ++++-- cl/phase1/forkchoice/fork_graph/fork_graph_disk.go | 6 ++++-- cmd/bumper/internal/tui/tui.go | 6 ++++-- execution/abi/bind/backends/simulated.go | 3 ++- rpc/jsonrpc/eth_call.go | 3 ++- 6 files changed, 16 insertions(+), 9 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index ccdf8dd95a8..d3303a0e34a 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -51,7 +51,6 @@ linters: - ruleguard disabled-checks: - commentFormatting # disabled to avoid unnecessary friction on local lints and CI for minor whitespace changes without functional benefit - - evalOrder - returnAfterHttpError - weakCond - builtinShadowDecl diff --git a/cl/persistence/state/state_accessors.go b/cl/persistence/state/state_accessors.go index 0c4d74804b9..a94116e65d3 100644 --- a/cl/persistence/state/state_accessors.go +++ b/cl/persistence/state/state_accessors.go @@ -83,7 +83,8 @@ func ReadSlotData(getFn GetValFn, slot uint64, cfg *clparams.BeaconChainConfig) } buf := bytes.NewBuffer(v) - return sd, sd.ReadFrom(buf, cfg) + err = sd.ReadFrom(buf, cfg) + return sd, err } func ReadEpochData(getFn GetValFn, slot uint64, beaconConfig *clparams.BeaconChainConfig) (*EpochData, error) { @@ -100,7 +101,8 @@ func ReadEpochData(getFn GetValFn, slot uint64, beaconConfig *clparams.BeaconCha } buf := bytes.NewBuffer(v) - return ed, ed.ReadFrom(buf) + err = ed.ReadFrom(buf) + return ed, err } // ReadCheckpoints reads the checkpoints from the database, Current, Previous and Finalized diff --git a/cl/phase1/forkchoice/fork_graph/fork_graph_disk.go b/cl/phase1/forkchoice/fork_graph/fork_graph_disk.go index 6f2e59ec091..065b0e5f944 100644 --- a/cl/phase1/forkchoice/fork_graph/fork_graph_disk.go +++ b/cl/phase1/forkchoice/fork_graph/fork_graph_disk.go @@ -703,7 +703,8 @@ func (f *forkGraphDisk) GetPreviousParticipationIndicies(epoch uint64) (*solid.P return nil, nil } out := solid.NewParticipationBitList(0, int(f.beaconCfg.ValidatorRegistryLimit)) - return out, out.DecodeSSZ(b, 0) + err := out.DecodeSSZ(b, 0) + return out, err } func (f *forkGraphDisk) GetCurrentParticipationIndicies(epoch uint64) (*solid.ParticipationBitList, error) { @@ -721,7 +722,8 @@ func (f *forkGraphDisk) GetCurrentParticipationIndicies(epoch uint64) (*solid.Pa return nil, nil } out := solid.NewParticipationBitList(0, int(f.beaconCfg.ValidatorRegistryLimit)) - return out, out.DecodeSSZ(b, 0) + err := out.DecodeSSZ(b, 0) + return out, err } func (f *forkGraphDisk) GetValidatorSet(blockRoot common.Hash) (*solid.ValidatorSet, error) { diff --git a/cmd/bumper/internal/tui/tui.go b/cmd/bumper/internal/tui/tui.go index effb7549a42..45e319ae976 100644 --- a/cmd/bumper/internal/tui/tui.go +++ b/cmd/bumper/internal/tui/tui.go @@ -413,10 +413,12 @@ func (m *model) Update(msg tea.Msg) (tea.Model, tea.Cmd) { return m, nil case "e": m.edit = cCurrent - return m, m.beginEdit() + cmd := m.beginEdit() + return m, cmd case "m": m.edit = cMin - return m, m.beginEdit() + cmd := m.beginEdit() + return m, cmd case ".": m.bump(minor) return m, nil diff --git a/execution/abi/bind/backends/simulated.go b/execution/abi/bind/backends/simulated.go index 4e03bb1e5a9..5d3f6ba33a7 100644 --- a/execution/abi/bind/backends/simulated.go +++ b/execution/abi/bind/backends/simulated.go @@ -696,7 +696,8 @@ func (b *SimulatedBackend) EstimateGas(ctx context.Context, call bind.CallMsg) ( } return true, nil, err // Bail out } - return res.Failed(), res, nil + failed := res.Failed() + return failed, res, nil } // Execute the binary search and hone in on an executable gas limit for lo+1 < hi { diff --git a/rpc/jsonrpc/eth_call.go b/rpc/jsonrpc/eth_call.go index c52c6d84060..f1cd0e2fb43 100644 --- a/rpc/jsonrpc/eth_call.go +++ b/rpc/jsonrpc/eth_call.go @@ -407,7 +407,8 @@ func doCall(ctx context.Context, caller *transactions.ReusableCaller, gasLimit u } return true, nil, err } - return result.Failed(), result, nil + failed := result.Failed() + return failed, result, nil } type StorageKeysInfo struct { From a88fd48f68a37957c11a198da3a0141ca21c2c04 Mon Sep 17 00:00:00 2001 From: Sahil Sojitra Date: Thu, 6 Aug 2026 14:27:23 +0530 Subject: [PATCH 03/10] linter: enable returnAfterHttpError check in gocritic --- .golangci.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.golangci.yml b/.golangci.yml index d3303a0e34a..9e5c9b4e29b 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -51,7 +51,6 @@ linters: - ruleguard disabled-checks: - commentFormatting # disabled to avoid unnecessary friction on local lints and CI for minor whitespace changes without functional benefit - - returnAfterHttpError - weakCond - builtinShadowDecl - uncheckedInlineErr From 8587ebd3fe0b022c22f826a7e6db03a916681fcc Mon Sep 17 00:00:00 2001 From: Sahil Sojitra Date: Thu, 6 Aug 2026 14:35:49 +0530 Subject: [PATCH 04/10] linter: enable weakCond check in gocritic and fix violations --- .golangci.yml | 1 - db/seg/sais/sais_16.go | 2 +- db/seg/sais/sais_inner.go | 2 +- execution/tests/testutil/state_test_util.go | 2 +- 4 files changed, 3 insertions(+), 4 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index 9e5c9b4e29b..871e01d8b4e 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -51,7 +51,6 @@ linters: - ruleguard disabled-checks: - commentFormatting # disabled to avoid unnecessary friction on local lints and CI for minor whitespace changes without functional benefit - - weakCond - builtinShadowDecl - uncheckedInlineErr - preferStringWriter diff --git a/db/seg/sais/sais_16.go b/db/seg/sais/sais_16.go index 88af48e4f79..daac2eb3602 100644 --- a/db/seg/sais/sais_16.go +++ b/db/seg/sais/sais_16.go @@ -56,7 +56,7 @@ func sais_16_32(text []uint16, textMax int, sa, tmp []int32) { } func freq_16_32(text []uint16, freq, bucket []int32) []int32 { - if freq != nil && freq[0] >= 0 { + if len(freq) > 0 && freq[0] >= 0 { return freq } if freq == nil { diff --git a/db/seg/sais/sais_inner.go b/db/seg/sais/sais_inner.go index bc9aa0df82f..bc9643b9e66 100644 --- a/db/seg/sais/sais_inner.go +++ b/db/seg/sais/sais_inner.go @@ -55,7 +55,7 @@ func sais_32(text []int32, textMax int, sa, tmp []int32) { } func freq_32(text []int32, freq, bucket []int32) []int32 { - if freq != nil && freq[0] >= 0 { + if len(freq) > 0 && freq[0] >= 0 { return freq } if freq == nil { diff --git a/execution/tests/testutil/state_test_util.go b/execution/tests/testutil/state_test_util.go index 0176db79b2a..77ba62c2806 100644 --- a/execution/tests/testutil/state_test_util.go +++ b/execution/tests/testutil/state_test_util.go @@ -554,7 +554,7 @@ func toMessage(tx stTransaction, ps stPostState, baseFee *uint256.Int) (protocol return nil, fmt.Errorf("invalid txn data %q", dataHex) } var accessList types.AccessList - if tx.AccessLists != nil && tx.AccessLists[ps.Indexes.Data] != nil { + if len(tx.AccessLists) > ps.Indexes.Data && tx.AccessLists[ps.Indexes.Data] != nil { accessList = *tx.AccessLists[ps.Indexes.Data] } From 835dc023351005048277f1572ce32bb725c87373 Mon Sep 17 00:00:00 2001 From: Sahil Sojitra Date: Thu, 6 Aug 2026 14:45:43 +0530 Subject: [PATCH 05/10] linter: enable builtinShadowDecl check in gocritic and fix violations --- .golangci.yml | 1 - cmd/rpctest/rpctest/bench1.go | 12 +++---- cmd/rpctest/rpctest/bench3.go | 6 ++-- cmd/rpctest/rpctest/bench4.go | 4 +-- cmd/rpctest/rpctest/bench6.go | 2 +- cmd/rpctest/rpctest/utils.go | 2 +- node/app/workerpool/workerpool_test.go | 46 +++++++++++++------------- 7 files changed, 36 insertions(+), 37 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index 871e01d8b4e..06ec60536ec 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -51,7 +51,6 @@ linters: - ruleguard disabled-checks: - commentFormatting # disabled to avoid unnecessary friction on local lints and CI for minor whitespace changes without functional benefit - - builtinShadowDecl - uncheckedInlineErr - preferStringWriter - commentedOutCode diff --git a/cmd/rpctest/rpctest/bench1.go b/cmd/rpctest/rpctest/bench1.go index 140d66a2521..7c26727f396 100644 --- a/cmd/rpctest/rpctest/bench1.go +++ b/cmd/rpctest/rpctest/bench1.go @@ -160,7 +160,7 @@ func Bench1(erigonURL, gethURL string, needCompare bool, fullTest bool, blockFro resultsCh <- res if res.Err != nil { fmt.Printf("Could not trace transaction (Erigon) %s: %v\n", txn.Hash, res.Err) - print(client, routes[Erigon], reqGen.debugTraceTransaction(txn.Hash, "")) + printRPCRequest(client, routes[Erigon], reqGen.debugTraceTransaction(txn.Hash, "")) } if trace.Error != nil { @@ -172,7 +172,7 @@ func Bench1(erigonURL, gethURL string, needCompare bool, fullTest bool, blockFro res = reqGen.Geth("debug_traceTransaction", reqGen.debugTraceTransaction(txn.Hash, ""), &traceg) resultsCh <- res if res.Err != nil { - print(client, routes[Geth], reqGen.debugTraceTransaction(txn.Hash, "")) + printRPCRequest(client, routes[Geth], reqGen.debugTraceTransaction(txn.Hash, "")) return fmt.Errorf("Could not trace transaction (geth) %s: %v", txn.Hash, res.Err) } if traceg.Error != nil { @@ -189,7 +189,7 @@ func Bench1(erigonURL, gethURL string, needCompare bool, fullTest bool, blockFro res = reqGen.Erigon("eth_getTransactionReceipt", reqGen.getTransactionReceipt(txn.Hash), &receipt) resultsCh <- res if res.Err != nil { - print(client, routes[Erigon], reqGen.getTransactionReceipt(txn.Hash)) + printRPCRequest(client, routes[Erigon], reqGen.getTransactionReceipt(txn.Hash)) return fmt.Errorf("Count not get receipt (Erigon): %s: %v", txn.Hash, res.Err) } if receipt.Error != nil { @@ -200,7 +200,7 @@ func Bench1(erigonURL, gethURL string, needCompare bool, fullTest bool, blockFro res = reqGen.Geth("eth_getTransactionReceipt", reqGen.getTransactionReceipt(txn.Hash), &receiptg) resultsCh <- res if res.Err != nil { - print(client, routes[Geth], reqGen.getTransactionReceipt(txn.Hash)) + printRPCRequest(client, routes[Geth], reqGen.getTransactionReceipt(txn.Hash)) return fmt.Errorf("Count not get receipt (geth): %s: %v", txn.Hash, res.Err) } if receiptg.Error != nil { @@ -208,8 +208,8 @@ func Bench1(erigonURL, gethURL string, needCompare bool, fullTest bool, blockFro } if !compareReceipts(&receipt, &receiptg) { fmt.Printf("Different receipts block %d, txn %s\n", bn, txn.Hash) - print(client, routes[Geth], reqGen.getTransactionReceipt(txn.Hash)) - print(client, routes[Erigon], reqGen.getTransactionReceipt(txn.Hash)) + printRPCRequest(client, routes[Geth], reqGen.getTransactionReceipt(txn.Hash)) + printRPCRequest(client, routes[Erigon], reqGen.getTransactionReceipt(txn.Hash)) return errors.New("Receipts are different") } } diff --git a/cmd/rpctest/rpctest/bench3.go b/cmd/rpctest/rpctest/bench3.go index e86c0ebcd35..b14aa70babf 100644 --- a/cmd/rpctest/rpctest/bench3.go +++ b/cmd/rpctest/rpctest/bench3.go @@ -92,7 +92,7 @@ func Bench3(erigon_url, geth_url string) error { ` var trace EthTxTrace if err := post(client, erigon_url, fmt.Sprintf(template, txhash, req_id), &trace); err != nil { - print(client, erigon_url, fmt.Sprintf(template, txhash, req_id)) + printRPCRequest(client, erigon_url, fmt.Sprintf(template, txhash, req_id)) return fmt.Errorf("Could not trace transaction %s: %v\n", txhash, err) } if trace.Error != nil { @@ -100,13 +100,13 @@ func Bench3(erigon_url, geth_url string) error { } var traceg EthTxTrace if err := post(client, geth_url, fmt.Sprintf(template, txhash, req_id), &traceg); err != nil { - print(client, geth_url, fmt.Sprintf(template, txhash, req_id)) + printRPCRequest(client, geth_url, fmt.Sprintf(template, txhash, req_id)) return fmt.Errorf("Could not trace transaction g %s: %v\n", txhash, err) } if traceg.Error != nil { return fmt.Errorf("Error tracing transaction g: %d %s\n", traceg.Error.Code, traceg.Error.Message) } - //print(client, erigon_url, fmt.Sprintf(template, txhash, req_id)) + //printRPCRequest(client, erigon_url, fmt.Sprintf(template, txhash, req_id)) if !compareTraces(&trace, &traceg) { return fmt.Errorf("Different traces block %d, txn %s\n", 1720000, txhash) } diff --git a/cmd/rpctest/rpctest/bench4.go b/cmd/rpctest/rpctest/bench4.go index 7ee18bc566d..6600861b2b0 100644 --- a/cmd/rpctest/rpctest/bench4.go +++ b/cmd/rpctest/rpctest/bench4.go @@ -41,13 +41,13 @@ func Bench4(erigon_url string) error { template = `{"jsonrpc":"2.0","method":"debug_traceTransaction","params":["%s"],"id":%d}` var trace EthTxTrace if err := post(client, erigon_url, fmt.Sprintf(template, txhash, req_id), &trace); err != nil { - print(client, erigon_url, fmt.Sprintf(template, txhash, req_id)) + printRPCRequest(client, erigon_url, fmt.Sprintf(template, txhash, req_id)) return fmt.Errorf("Could not trace transaction %s: %v\n", txhash, err) } if trace.Error != nil { fmt.Printf("Error tracing transaction: %d %s\n", trace.Error.Code, trace.Error.Message) } - print(client, erigon_url, fmt.Sprintf(template, txhash, req_id)) + printRPCRequest(client, erigon_url, fmt.Sprintf(template, txhash, req_id)) } to := common.HexToAddress("0x8b3b3b624c3c0397d3da8fd861512393d51dcbac") sm := make(map[common.Hash]storageEntry) diff --git a/cmd/rpctest/rpctest/bench6.go b/cmd/rpctest/rpctest/bench6.go index 32b321dc169..e4381c77866 100644 --- a/cmd/rpctest/rpctest/bench6.go +++ b/cmd/rpctest/rpctest/bench6.go @@ -66,7 +66,7 @@ func Bench6(erigon_url string) error { ` var receipt EthReceipt if err := post(client, erigon_url, fmt.Sprintf(template, txn.Hash, req_id), &receipt); err != nil { - print(client, erigon_url, fmt.Sprintf(template, txn.Hash, req_id)) + printRPCRequest(client, erigon_url, fmt.Sprintf(template, txn.Hash, req_id)) return fmt.Errorf("Count not get receipt: %s: %v\n", txn.Hash, err) } if receipt.Error != nil { diff --git a/cmd/rpctest/rpctest/utils.go b/cmd/rpctest/rpctest/utils.go index 374d57bb8e9..b70c6b28474 100644 --- a/cmd/rpctest/rpctest/utils.go +++ b/cmd/rpctest/rpctest/utils.go @@ -755,7 +755,7 @@ func post2(client *http.Client, url, request string) ([]byte, *fastjson.Value, e return response, v, nil } -func print(client *http.Client, url, request string) { +func printRPCRequest(client *http.Client, url, request string) { r, err := client.Post(url, "application/json", strings.NewReader(request)) if err != nil { fmt.Printf("Could not print: %v\n", err) diff --git a/node/app/workerpool/workerpool_test.go b/node/app/workerpool/workerpool_test.go index 1a911d8f3c0..1e3c881e01e 100644 --- a/node/app/workerpool/workerpool_test.go +++ b/node/app/workerpool/workerpool_test.go @@ -25,7 +25,7 @@ import ( "go.uber.org/goleak" ) -const max = 20 +const maxWorkers = 20 func TestExample(t *testing.T) { defer goleak.VerifyNone(t) @@ -66,18 +66,18 @@ func TestMaxWorkers(t *testing.T) { t.Fatal("should have created one worker") } - wp = New(max) + wp = New(maxWorkers) defer wp.Stop() - if wp.Size() != max { + if wp.Size() != maxWorkers { t.Fatal("wrong size returned") } - started := make(chan struct{}, max) + started := make(chan struct{}, maxWorkers) release := make(chan struct{}) // Start workers, and have them all wait on a channel before completing. - for range max { + for range maxWorkers { wp.Submit(func() { started <- struct{}{} <-release @@ -89,7 +89,7 @@ func TestMaxWorkers(t *testing.T) { t.Fatal("Working Queue size returned should not be 0") } timeout := time.After(5 * time.Second) - for startCount := 0; startCount < max; { + for startCount := 0; startCount < maxWorkers; { select { case <-started: startCount++ @@ -128,7 +128,7 @@ func TestReuseWorkers(t *testing.T) { func TestWorkerTimeout(t *testing.T) { defer goleak.VerifyNone(t) - wp := New(max) + wp := New(maxWorkers) defer wp.Stop() // Start workers, and have them all wait on ctx before completing. @@ -146,19 +146,19 @@ func TestWorkerTimeout(t *testing.T) { // Release workers. cancel() - if countReady(wp) != max { - t.Fatal("Expected", max, "ready workers") + if countReady(wp) != maxWorkers { + t.Fatal("Expected", maxWorkers, "ready workers") } // Check that a worker timed out. time.Sleep(idleTimeout*2 + idleTimeout/2) - if countReady(wp) != max-1 { + if countReady(wp) != maxWorkers-1 { t.Fatal("First worker did not timeout") } // Check that another worker timed out. time.Sleep(idleTimeout) - if countReady(wp) != max-2 { + if countReady(wp) != maxWorkers-2 { t.Fatal("Second worker did not timeout") } } @@ -166,7 +166,7 @@ func TestWorkerTimeout(t *testing.T) { func TestStop(t *testing.T) { defer goleak.VerifyNone(t) - wp := New(max) + wp := New(maxWorkers) // Start workers, and have them all wait on ctx before completing. ctx, cancel := context.WithCancel(t.Context()) @@ -192,8 +192,8 @@ func TestStop(t *testing.T) { wp = New(5) release := make(chan struct{}) - finished := make(chan struct{}, max) - for range max { + finished := make(chan struct{}, maxWorkers) + for range maxWorkers { wp.Submit(func() { <-release finished <- struct{}{} @@ -208,7 +208,7 @@ func TestStop(t *testing.T) { wp.Stop() var count int Count: - for count < max { + for count < maxWorkers { select { case <-finished: count++ @@ -230,8 +230,8 @@ func TestStopWait(t *testing.T) { // Start workers, and have them all wait on a channel before completing. wp := New(5) release := make(chan struct{}) - finished := make(chan struct{}, max) - for range max { + finished := make(chan struct{}, maxWorkers) + for range maxWorkers { wp.Submit(func() { <-release finished <- struct{}{} @@ -244,7 +244,7 @@ func TestStopWait(t *testing.T) { close(release) }() wp.StopWait() - for range max { + for range maxWorkers { select { case <-finished: default: @@ -337,16 +337,16 @@ func TestOverflow(t *testing.T) { func TestStopRace(t *testing.T) { defer goleak.VerifyNone(t) - wp := New(max) + wp := New(maxWorkers) defer wp.Stop() workRelChan := make(chan struct{}) var started sync.WaitGroup - started.Add(max) + started.Add(maxWorkers) // Start workers, and have them all wait on a channel before completing. - for range max { + for range maxWorkers { wp.Submit(func() { started.Done() <-workRelChan @@ -641,12 +641,12 @@ func countReady(w *WorkerPool) int { <-release } var readyCount int - for i := 0; i < max; i++ { + for i := 0; i < maxWorkers; i++ { select { case w.workerQueue <- wait: readyCount++ case <-timeout: - i = max + i = maxWorkers } } From 25fc55edeacfb58b794a48f698b7b755ed9a9dd9 Mon Sep 17 00:00:00 2001 From: Sahil Sojitra Date: Thu, 6 Aug 2026 15:01:28 +0530 Subject: [PATCH 06/10] linter: enable uncheckedInlineErr check in gocritic and fix violations --- .golangci.yml | 1 - cmd/erigon/node/node.go | 3 ++- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index 06ec60536ec..28a3a25c92d 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -51,7 +51,6 @@ linters: - ruleguard disabled-checks: - commentFormatting # disabled to avoid unnecessary friction on local lints and CI for minor whitespace changes without functional benefit - - uncheckedInlineErr - preferStringWriter - commentedOutCode - preferFprint diff --git a/cmd/erigon/node/node.go b/cmd/erigon/node/node.go index cadca01edbc..04f819319b0 100644 --- a/cmd/erigon/node/node.go +++ b/cmd/erigon/node/node.go @@ -111,7 +111,8 @@ func NewNodConfigUrfave(ctx *cli.Command, debugMux *http.ServeMux, logger log.Lo } nodeConfig := NewNodeConfig(debugMux) - if err := utils.SetNodeConfig(ctx, nodeConfig, logger); err != nil { + err := utils.SetNodeConfig(ctx, nodeConfig, logger) + if err != nil { return nil, err } erigoncli.ApplyFlagsForNodeConfig(ctx, nodeConfig, logger) From 1a9eb987c7f5492867d358e626082645eee7d9a0 Mon Sep 17 00:00:00 2001 From: Sahil Sojitra Date: Fri, 7 Aug 2026 17:11:44 +0530 Subject: [PATCH 07/10] linter: enable preferStringWriter check in gocritic and fix violations --- .golangci.yml | 2 -- cmd/rpctest/rpctest/utils.go | 4 ++-- db/state/commitment_convert.go | 2 +- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index 06ec60536ec..b5110a731ed 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -51,8 +51,6 @@ linters: - ruleguard disabled-checks: - commentFormatting # disabled to avoid unnecessary friction on local lints and CI for minor whitespace changes without functional benefit - - uncheckedInlineErr - - preferStringWriter - commentedOutCode - preferFprint - deprecatedComment diff --git a/cmd/rpctest/rpctest/utils.go b/cmd/rpctest/rpctest/utils.go index b70c6b28474..79c70ab478d 100644 --- a/cmd/rpctest/rpctest/utils.go +++ b/cmd/rpctest/rpctest/utils.go @@ -340,7 +340,7 @@ func requestAndCompare(request string, methodName string, errCtx string, reqGen // Keep going } else { reqFile, _ := os.Create("request.json") //nolint:errcheck - reqFile.Write([]byte(request)) //nolint:errcheck + reqFile.WriteString(request) //nolint:errcheck reqFile.Close() //nolint:errcheck erigonRespFile, _ := os.Create("erigon-response.json") //nolint:errcheck erigonRespFile.Write(res.Response) //nolint:errcheck @@ -395,7 +395,7 @@ func requestAndCompareErigon(requestA, requestB string, methodNameA, methodNameB // Keep going } else { reqFile, _ := os.Create("request.json") //nolint:errcheck - reqFile.Write([]byte(requestA)) //nolint:errcheck + reqFile.WriteString(requestA) //nolint:errcheck reqFile.Close() //nolint:errcheck erigonRespFile, _ := os.Create("erigon-response.json") //nolint:errcheck erigonRespFile.Write(res.Response) //nolint:errcheck diff --git a/db/state/commitment_convert.go b/db/state/commitment_convert.go index 6aabc31dee1..87d8de2e0cf 100644 --- a/db/state/commitment_convert.go +++ b/db/state/commitment_convert.go @@ -967,7 +967,7 @@ func writeRestoreManifestAtomic(path string, entries []string) error { if err != nil { return err } - if _, err := f.Write([]byte(strings.Join(entries, "\n"))); err != nil { + if _, err := f.WriteString(strings.Join(entries, "\n")); err != nil { _ = f.Close() return err } From 87db98d9762bce5431f24c0f226b06242bfe3b2f Mon Sep 17 00:00:00 2001 From: Sahil Sojitra Date: Fri, 7 Aug 2026 17:47:34 +0530 Subject: [PATCH 08/10] linter: enable preferFprint check in gocritic and fix violations --- .golangci.yml | 1 - cmd/capcli/cli.go | 2 +- execution/commitment/hex_patricia_hashed.go | 22 ++++++++++----------- 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index b5110a731ed..21fa16cba7e 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -52,7 +52,6 @@ linters: disabled-checks: - commentFormatting # disabled to avoid unnecessary friction on local lints and CI for minor whitespace changes without functional benefit - commentedOutCode - - preferFprint - deprecatedComment enabled-tags: - performance diff --git a/cmd/capcli/cli.go b/cmd/capcli/cli.go index d0e4074a1e3..47b55dd035a 100644 --- a/cmd/capcli/cli.go +++ b/cmd/capcli/cli.go @@ -999,7 +999,7 @@ func (b *BenchmarkNode) Run(ctx *Context) error { log.Warn("Failed to benchmark", "error", err, "uri", uri) continue } - _, err = f.WriteString(fmt.Sprintf("%d,%d\n", i, elapsed.Milliseconds())) + _, err = fmt.Fprintf(f, "%d,%d\n", i, elapsed.Milliseconds()) if err != nil { return err } diff --git a/execution/commitment/hex_patricia_hashed.go b/execution/commitment/hex_patricia_hashed.go index 834b212d363..417c71a05dd 100644 --- a/execution/commitment/hex_patricia_hashed.go +++ b/execution/commitment/hex_patricia_hashed.go @@ -389,36 +389,36 @@ func (cell *cell) reset() { func (cell *cell) FullString() string { b := new(strings.Builder) b.WriteString("{") - b.WriteString(fmt.Sprintf("loaded=%v", cell.loaded)) + fmt.Fprintf(b, "loaded=%v", cell.loaded) if cell.Deleted() { b.WriteString(" DELETED ") } if cell.accountAddrLen > 0 { - b.WriteString(fmt.Sprintf(" addr=%x", cell.accountAddr[:cell.accountAddrLen])) - b.WriteString(fmt.Sprintf(" balance=%s", cell.Balance.String())) - b.WriteString(fmt.Sprintf(" nonce=%d", cell.Nonce)) + fmt.Fprintf(b, " addr=%x", cell.accountAddr[:cell.accountAddrLen]) + fmt.Fprintf(b, " balance=%s", cell.Balance.String()) + fmt.Fprintf(b, " nonce=%d", cell.Nonce) if cell.CodeHash != empty.CodeHash { - b.WriteString(fmt.Sprintf(" codeHash=%x", cell.CodeHash[:])) + fmt.Fprintf(b, " codeHash=%x", cell.CodeHash[:]) } else { b.WriteString(" codeHash=EMPTY") } } if cell.storageAddrLen > 0 { - b.WriteString(fmt.Sprintf(" addr[s]=%x", cell.storageAddr[:cell.storageAddrLen])) - b.WriteString(fmt.Sprintf(" storage=%x", cell.Storage[:cell.StorageLen])) + fmt.Fprintf(b, " addr[s]=%x", cell.storageAddr[:cell.storageAddrLen]) + fmt.Fprintf(b, " storage=%x", cell.Storage[:cell.StorageLen]) } if cell.hashLen > 0 { - b.WriteString(fmt.Sprintf(" h=%x", cell.hash[:cell.hashLen])) + fmt.Fprintf(b, " h=%x", cell.hash[:cell.hashLen]) } if cell.stateHashLen > 0 { - b.WriteString(fmt.Sprintf(" memHash=%x", cell.stateHash[:cell.stateHashLen])) + fmt.Fprintf(b, " memHash=%x", cell.stateHash[:cell.stateHashLen]) } if cell.extLen > 0 { - b.WriteString(fmt.Sprintf(" extension=%x", cell.extension[:cell.extLen])) + fmt.Fprintf(b, " extension=%x", cell.extension[:cell.extLen]) } if cell.hashedExtLen > 0 { - b.WriteString(fmt.Sprintf(" hashedExtension=%x", cell.hashedExtension[:cell.hashedExtLen])) + fmt.Fprintf(b, " hashedExtension=%x", cell.hashedExtension[:cell.hashedExtLen]) } b.WriteString("}") From d593093a9c7291c43d96aeb1a8f8ab3a600d54b9 Mon Sep 17 00:00:00 2001 From: Sahil Sojitra Date: Fri, 7 Aug 2026 18:08:10 +0530 Subject: [PATCH 09/10] linter: enable deprecatedComment check in gocritic and fix violations --- .golangci.yml | 1 - cl/cltypes/solid/hashutil.go | 1 + node/cli/flags.go | 1 + p2p/enode/node.go | 1 + rpc/jsonrpc/eth_deprecated.go | 2 ++ rpc/subscription.go | 1 + 6 files changed, 6 insertions(+), 1 deletion(-) diff --git a/.golangci.yml b/.golangci.yml index 21fa16cba7e..2ccc7d6cdbe 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -52,7 +52,6 @@ linters: disabled-checks: - commentFormatting # disabled to avoid unnecessary friction on local lints and CI for minor whitespace changes without functional benefit - commentedOutCode - - deprecatedComment enabled-tags: - performance - diagnostic diff --git a/cl/cltypes/solid/hashutil.go b/cl/cltypes/solid/hashutil.go index 4cdcc71d9c6..4952c1056f1 100644 --- a/cl/cltypes/solid/hashutil.go +++ b/cl/cltypes/solid/hashutil.go @@ -31,5 +31,6 @@ func (arr *hashBuf) makeBuf(size int) { } // GetDepth returns the depth of a merkle tree with a given number of nodes. +// // Deprecated: Use merkle_tree.GetDepth directly. var GetDepth = merkle_tree.GetDepth diff --git a/node/cli/flags.go b/node/cli/flags.go index b20f2b0ed99..dd9a6590ba8 100644 --- a/node/cli/flags.go +++ b/node/cli/flags.go @@ -225,6 +225,7 @@ func BuildEthConfig(nodeCtx context.Context, ctx *cli.Command, nodeCfg *nodecfg. } // ApplyFlagsForEthConfig is kept for backward compatibility. New code should use BuildEthConfig. +// // Deprecated: use BuildEthConfig instead. func ApplyFlagsForEthConfig(ctx *cli.Command, cfg *ethconfig.Config, logger log.Logger) { applyRemainingEthFlags(ctx, cfg, logger) diff --git a/p2p/enode/node.go b/p2p/enode/node.go index 34c49dd1e4d..6e241dae81f 100644 --- a/p2p/enode/node.go +++ b/p2p/enode/node.go @@ -273,6 +273,7 @@ func (n *Node) Record() *enr.Record { } // ValidateComplete checks whether n has a valid IP and UDP port. +// // Deprecated: don't use this method. func (n *Node) ValidateComplete() error { if !n.ip.IsValid() { diff --git a/rpc/jsonrpc/eth_deprecated.go b/rpc/jsonrpc/eth_deprecated.go index 78016132c29..28fca9bf311 100644 --- a/rpc/jsonrpc/eth_deprecated.go +++ b/rpc/jsonrpc/eth_deprecated.go @@ -25,12 +25,14 @@ import ( ) // Accounts implements eth_accounts. Returns a list of addresses owned by the client. +// // Deprecated: This function will be removed in the future. func (api *APIImpl) Accounts(ctx context.Context) ([]common.Address, error) { return []common.Address{}, fmt.Errorf(NotAvailableDeprecated, "eth_accounts") } // Sign implements eth_sign. Calculates an Ethereum specific signature with: sign(keccak256('\\x19Ethereum Signed Message:\\n' + len(message) + message))). +// // Deprecated: This function will be removed in the future. func (api *APIImpl) Sign(ctx context.Context, _ common.Address, _ hexutil.Bytes) (hexutil.Bytes, error) { return hexutil.Bytes(""), fmt.Errorf(NotAvailableDeprecated, "eth_sign") diff --git a/rpc/subscription.go b/rpc/subscription.go index 5ac097c5a99..0792b992156 100644 --- a/rpc/subscription.go +++ b/rpc/subscription.go @@ -194,6 +194,7 @@ func (n *RemoteNotifier) Notify(id ID, data any) error { } // Closed returns a channel that is closed when the RPC connection is closed. +// // Deprecated: use subscription error channel func (n *RemoteNotifier) Closed() <-chan any { return n.h.conn.closed() From 9c34c79df8ea5b8295fcaa8483acdc67e3276c9b Mon Sep 17 00:00:00 2001 From: Sahil Sojitra Date: Fri, 7 Aug 2026 18:09:05 +0530 Subject: [PATCH 10/10] linter: document rationale for keeping commentedOutCode disabled in gocritic --- .golangci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.golangci.yml b/.golangci.yml index 2ccc7d6cdbe..93b3dc5f4bb 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -51,7 +51,7 @@ linters: - ruleguard disabled-checks: - commentFormatting # disabled to avoid unnecessary friction on local lints and CI for minor whitespace changes without functional benefit - - commentedOutCode + - commentedOutCode # disabled to avoid false positives on doc examples, EIP spec comments, and JSON templates enabled-tags: - performance - diagnostic