diff --git a/.golangci.yml b/.golangci.yml index 06ec60536ec..93b3dc5f4bb 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -51,11 +51,7 @@ 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 + - commentedOutCode # disabled to avoid false positives on doc examples, EIP spec comments, and JSON templates 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/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/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) 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 } 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("}") diff --git a/node/cli/flags.go b/node/cli/flags.go index 03e62d88777..4156944b999 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()