Investigate unused linter report with field-writes-are-uses setting disabled #1111

Merged
fyrchik merged 1 commit from elebedeva/frostfs-node:fix/unused-linter into master 2024-05-06 08:28:32 +00:00
6 changed files with 8 additions and 17 deletions

View file

@ -44,7 +44,6 @@ type LocalClient struct {
transactions []*transaction.Transaction transactions []*transaction.Transaction
dumpPath string dumpPath string
accounts []*wallet.Account accounts []*wallet.Account
maxGasInvoke int64
} }
func NewLocalClient(cmd *cobra.Command, v *viper.Viper, wallets []*wallet.Wallet, dumpPath string) (*LocalClient, error) { func NewLocalClient(cmd *cobra.Command, v *viper.Viper, wallets []*wallet.Wallet, dumpPath string) (*LocalClient, error) {
@ -107,7 +106,6 @@ func NewLocalClient(cmd *cobra.Command, v *viper.Viper, wallets []*wallet.Wallet
bc: bc, bc: bc,
dumpPath: dumpPath, dumpPath: dumpPath,
accounts: accounts[:m], accounts: accounts[:m],
maxGasInvoke: 15_0000_0000,
}, nil }, nil
} }

View file

@ -20,14 +20,12 @@ import (
type policyPlaygroundREPL struct { type policyPlaygroundREPL struct {
cmd *cobra.Command cmd *cobra.Command
args []string
nodes map[string]netmap.NodeInfo nodes map[string]netmap.NodeInfo
} }
func newPolicyPlaygroundREPL(cmd *cobra.Command, args []string) (*policyPlaygroundREPL, error) { func newPolicyPlaygroundREPL(cmd *cobra.Command) (*policyPlaygroundREPL, error) {
return &policyPlaygroundREPL{ return &policyPlaygroundREPL{
cmd: cmd, cmd: cmd,
args: args,
nodes: map[string]netmap.NodeInfo{}, nodes: map[string]netmap.NodeInfo{},
}, nil }, nil
} }
@ -221,8 +219,8 @@ var policyPlaygroundCmd = &cobra.Command{
Short: "A REPL for testing placement policies", Short: "A REPL for testing placement policies",
Long: `A REPL for testing placement policies. Long: `A REPL for testing placement policies.
If a wallet and endpoint is provided, the initial netmap data will be loaded from the snapshot of the node. Otherwise, an empty playground is created.`, If a wallet and endpoint is provided, the initial netmap data will be loaded from the snapshot of the node. Otherwise, an empty playground is created.`,
Run: func(cmd *cobra.Command, args []string) { Run: func(cmd *cobra.Command, _ []string) {
repl, err := newPolicyPlaygroundREPL(cmd, args) repl, err := newPolicyPlaygroundREPL(cmd)
commonCmd.ExitOnErr(cmd, "could not create policy playground: %w", err) commonCmd.ExitOnErr(cmd, "could not create policy playground: %w", err)
commonCmd.ExitOnErr(cmd, "policy playground failed: %w", repl.run()) commonCmd.ExitOnErr(cmd, "policy playground failed: %w", repl.run())
}, },

View file

@ -69,7 +69,6 @@ type (
// internal variables // internal variables
key *keys.PrivateKey key *keys.PrivateKey
pubKey []byte
contracts *contracts contracts *contracts
predefinedValidators keys.PublicKeys predefinedValidators keys.PublicKeys
initialEpochTickDelta uint32 initialEpochTickDelta uint32
@ -391,8 +390,6 @@ func New(ctx context.Context, log *logger.Logger, cfg *viper.Viper, errChan chan
return nil, fmt.Errorf("ir: can't parse predefined validators list: %w", err) return nil, fmt.Errorf("ir: can't parse predefined validators list: %w", err)
} }
server.pubKey = server.key.PublicKey().Bytes()
var morphClients *serverMorphClients var morphClients *serverMorphClients
morphClients, err = server.initClientsFromMorph() morphClients, err = server.initClientsFromMorph()
if err != nil { if err != nil {

View file

@ -29,7 +29,6 @@ func (h *filenameHeap) Pop() any {
// fixedHeap maintains a fixed number of smallest elements started at some point. // fixedHeap maintains a fixed number of smallest elements started at some point.
type fixedHeap struct { type fixedHeap struct {
start string start string
max string
count int count int
h *filenameHeap h *filenameHeap
} }
@ -40,7 +39,6 @@ func newHeap(start string, count int) *fixedHeap {
return &fixedHeap{ return &fixedHeap{
start: start, start: start,
max: "",
count: count, count: count,
h: h, h: h,
} }

View file

@ -133,6 +133,7 @@ type smWrapper struct {
func (s smWrapper) ReadSignedData(data []byte) ([]byte, error) { func (s smWrapper) ReadSignedData(data []byte) ([]byte, error) {
return s.Token.GetBody().StableMarshal(data), nil return s.Token.GetBody().StableMarshal(data), nil
} }
func (s smWrapper) SignedDataSize() int { func (s smWrapper) SignedDataSize() int {
return s.Token.GetBody().StableSize() return s.Token.GetBody().StableSize()
} }

View file

@ -66,7 +66,7 @@ type cfg struct {
batchSize, cacheSize uint32 batchSize, cacheSize uint32
rebalanceFreq, evictDuration, sleepDuration time.Duration evictDuration, sleepDuration time.Duration
metrics MetricsRegister metrics MetricsRegister
} }
@ -76,7 +76,6 @@ func defaultCfg() *cfg {
log: &logger.Logger{Logger: zap.L()}, log: &logger.Logger{Logger: zap.L()},
batchSize: 10, batchSize: 10,
cacheSize: 1024, // 1024 * address size = 1024 * 64 = 64 MiB cacheSize: 1024, // 1024 * address size = 1024 * 64 = 64 MiB
rebalanceFreq: 1 * time.Second,
sleepDuration: 1 * time.Second, sleepDuration: 1 * time.Second,
evictDuration: 30 * time.Second, evictDuration: 30 * time.Second,
metrics: noopMetrics{}, metrics: noopMetrics{},