Investigate unused
linter report with field-writes-are-uses
setting disabled #1111
6 changed files with 8 additions and 17 deletions
|
@ -44,7 +44,6 @@ type LocalClient struct {
|
|||
transactions []*transaction.Transaction
|
||||
dumpPath string
|
||||
accounts []*wallet.Account
|
||||
maxGasInvoke int64
|
||||
}
|
||||
|
||||
func NewLocalClient(cmd *cobra.Command, v *viper.Viper, wallets []*wallet.Wallet, dumpPath string) (*LocalClient, error) {
|
||||
|
@ -104,10 +103,9 @@ func NewLocalClient(cmd *cobra.Command, v *viper.Viper, wallets []*wallet.Wallet
|
|||
}
|
||||
|
||||
return &LocalClient{
|
||||
bc: bc,
|
||||
dumpPath: dumpPath,
|
||||
accounts: accounts[:m],
|
||||
maxGasInvoke: 15_0000_0000,
|
||||
bc: bc,
|
||||
dumpPath: dumpPath,
|
||||
accounts: accounts[:m],
|
||||
}, nil
|
||||
}
|
||||
|
||||
|
|
|
@ -20,14 +20,12 @@ import (
|
|||
|
||||
type policyPlaygroundREPL struct {
|
||||
cmd *cobra.Command
|
||||
args []string
|
||||
nodes map[string]netmap.NodeInfo
|
||||
}
|
||||
|
||||
func newPolicyPlaygroundREPL(cmd *cobra.Command, args []string) (*policyPlaygroundREPL, error) {
|
||||
func newPolicyPlaygroundREPL(cmd *cobra.Command) (*policyPlaygroundREPL, error) {
|
||||
return &policyPlaygroundREPL{
|
||||
cmd: cmd,
|
||||
args: args,
|
||||
nodes: map[string]netmap.NodeInfo{},
|
||||
}, nil
|
||||
}
|
||||
|
@ -221,8 +219,8 @@ var policyPlaygroundCmd = &cobra.Command{
|
|||
Short: "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.`,
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
repl, err := newPolicyPlaygroundREPL(cmd, args)
|
||||
Run: func(cmd *cobra.Command, _ []string) {
|
||||
repl, err := newPolicyPlaygroundREPL(cmd)
|
||||
commonCmd.ExitOnErr(cmd, "could not create policy playground: %w", err)
|
||||
commonCmd.ExitOnErr(cmd, "policy playground failed: %w", repl.run())
|
||||
},
|
||||
|
|
|
@ -69,7 +69,6 @@ type (
|
|||
|
||||
// internal variables
|
||||
key *keys.PrivateKey
|
||||
pubKey []byte
|
||||
contracts *contracts
|
||||
|
||||
predefinedValidators keys.PublicKeys
|
||||
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)
|
||||
}
|
||||
|
||||
server.pubKey = server.key.PublicKey().Bytes()
|
||||
|
||||
var morphClients *serverMorphClients
|
||||
morphClients, err = server.initClientsFromMorph()
|
||||
if err != nil {
|
||||
|
|
|
@ -29,7 +29,6 @@ func (h *filenameHeap) Pop() any {
|
|||
// fixedHeap maintains a fixed number of smallest elements started at some point.
|
||||
type fixedHeap struct {
|
||||
start string
|
||||
max string
|
||||
count int
|
||||
h *filenameHeap
|
||||
}
|
||||
|
@ -40,7 +39,6 @@ func newHeap(start string, count int) *fixedHeap {
|
|||
|
||||
return &fixedHeap{
|
||||
start: start,
|
||||
max: "",
|
||||
count: count,
|
||||
h: h,
|
||||
}
|
||||
|
|
|
@ -133,6 +133,7 @@ type smWrapper struct {
|
|||
func (s smWrapper) ReadSignedData(data []byte) ([]byte, error) {
|
||||
return s.Token.GetBody().StableMarshal(data), nil
|
||||
}
|
||||
|
||||
func (s smWrapper) SignedDataSize() int {
|
||||
return s.Token.GetBody().StableSize()
|
||||
}
|
||||
|
|
|
@ -66,7 +66,7 @@ type cfg struct {
|
|||
|
||||
batchSize, cacheSize uint32
|
||||
|
||||
rebalanceFreq, evictDuration, sleepDuration time.Duration
|
||||
evictDuration, sleepDuration time.Duration
|
||||
|
||||
metrics MetricsRegister
|
||||
}
|
||||
|
@ -76,7 +76,6 @@ func defaultCfg() *cfg {
|
|||
log: &logger.Logger{Logger: zap.L()},
|
||||
batchSize: 10,
|
||||
cacheSize: 1024, // 1024 * address size = 1024 * 64 = 64 MiB
|
||||
rebalanceFreq: 1 * time.Second,
|
||||
sleepDuration: 1 * time.Second,
|
||||
evictDuration: 30 * time.Second,
|
||||
metrics: noopMetrics{},
|
||||
|
|
Loading…
Reference in a new issue
Frankly, I would remove it completely, there is no need to cache it, getting public key from the private is free, no calculations required https://pkg.go.dev/crypto/ecdsa#PrivateKey
even more so, we now have 2 different sources for public key, which can diverge in future
raw bytes made sense, when it was marshaled a lot, to reduce allocations