mirror of
https://github.com/luxfi/netrunner.git
synced 2026-07-27 00:04:23 +00:00
fix: resolve all golangci-lint issues
- Fix gofmt formatting in 8 files - Remove duplicate luxfi/config imports in local/ package - Add error checking for os.Remove calls in local/snapshot.go
This commit is contained in:
+2
-2
@@ -3,12 +3,12 @@ package api
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/luxfi/sdk/exchangevm"
|
||||
"github.com/luxfi/sdk/platformvm"
|
||||
"github.com/luxfi/sdk/admin"
|
||||
"github.com/luxfi/sdk/exchangevm"
|
||||
"github.com/luxfi/sdk/health"
|
||||
"github.com/luxfi/sdk/indexer"
|
||||
sdkinfo "github.com/luxfi/sdk/info"
|
||||
"github.com/luxfi/sdk/platformvm"
|
||||
// evmclient "github.com/luxfi/evm/plugin/evm/client"
|
||||
)
|
||||
|
||||
|
||||
+3
-3
@@ -4,16 +4,16 @@ import (
|
||||
"context"
|
||||
"math/big"
|
||||
|
||||
apihealth "github.com/luxfi/api/health"
|
||||
ethereum "github.com/luxfi/geth"
|
||||
"github.com/luxfi/geth/common"
|
||||
"github.com/luxfi/geth/core/types"
|
||||
"github.com/luxfi/sdk/exchangevm"
|
||||
"github.com/luxfi/sdk/platformvm"
|
||||
"github.com/luxfi/rpc"
|
||||
"github.com/luxfi/sdk/admin"
|
||||
apihealth "github.com/luxfi/api/health"
|
||||
"github.com/luxfi/sdk/exchangevm"
|
||||
"github.com/luxfi/sdk/indexer"
|
||||
sdkinfo "github.com/luxfi/sdk/info"
|
||||
"github.com/luxfi/sdk/platformvm"
|
||||
// evmclient "github.com/luxfi/evm/plugin/evm/client"
|
||||
)
|
||||
|
||||
|
||||
@@ -11,9 +11,9 @@ import (
|
||||
"path/filepath"
|
||||
"time"
|
||||
|
||||
apiinfo "github.com/luxfi/api/info"
|
||||
"github.com/luxfi/ids"
|
||||
"github.com/luxfi/netrunner/engines"
|
||||
apiinfo "github.com/luxfi/api/info"
|
||||
sdkhealth "github.com/luxfi/sdk/health"
|
||||
sdkinfo "github.com/luxfi/sdk/info"
|
||||
)
|
||||
|
||||
@@ -59,7 +59,7 @@ func createCorethDebugConfig(importPath string) ([]byte, error) {
|
||||
"admin",
|
||||
},
|
||||
"import-chain-data": importPath,
|
||||
"log-level": "debug",
|
||||
"log-level": "debug",
|
||||
}
|
||||
return json.Marshal(cfg)
|
||||
}
|
||||
|
||||
+2
-3
@@ -31,7 +31,6 @@ import (
|
||||
"slices"
|
||||
|
||||
"github.com/luxfi/config"
|
||||
luxconfig "github.com/luxfi/config"
|
||||
"github.com/luxfi/constants"
|
||||
"github.com/luxfi/crypto/bls"
|
||||
"github.com/luxfi/crypto/secp256k1"
|
||||
@@ -41,8 +40,8 @@ import (
|
||||
"github.com/luxfi/netrunner/network"
|
||||
"github.com/luxfi/netrunner/network/node"
|
||||
"github.com/luxfi/netrunner/utils"
|
||||
"github.com/luxfi/protocol/p/txs"
|
||||
"github.com/luxfi/protocol/p/signer"
|
||||
"github.com/luxfi/protocol/p/txs"
|
||||
"github.com/luxfi/sdk/admin"
|
||||
"github.com/luxfi/sdk/platformvm"
|
||||
pwallet "github.com/luxfi/sdk/wallet/chain/p"
|
||||
@@ -2222,7 +2221,7 @@ func (ln *localNetwork) waitChainValidators(
|
||||
// reload VM plugins on all nodes and verify they're available
|
||||
func (ln *localNetwork) reloadVMPlugins(ctx context.Context) error {
|
||||
// Use unified config to resolve plugin directory for diagnostics
|
||||
pluginDir := luxconfig.ResolvePluginDir()
|
||||
pluginDir := config.ResolvePluginDir()
|
||||
ln.logger.Info(log.Green.Wrap("reloading plugin binaries"),
|
||||
"pluginDir", pluginDir,
|
||||
)
|
||||
|
||||
+2
-3
@@ -24,7 +24,6 @@ import (
|
||||
"slices"
|
||||
|
||||
"github.com/luxfi/config"
|
||||
luxconfig "github.com/luxfi/config"
|
||||
"github.com/luxfi/crypto/bls"
|
||||
luxcrypto "github.com/luxfi/crypto/secp256k1"
|
||||
"github.com/luxfi/ids"
|
||||
@@ -37,9 +36,9 @@ import (
|
||||
"github.com/luxfi/netrunner/network/node/status"
|
||||
"github.com/luxfi/netrunner/utils"
|
||||
"github.com/luxfi/netrunner/utils/constants"
|
||||
"github.com/luxfi/node/utils/beacon"
|
||||
"github.com/luxfi/p2p/peer"
|
||||
luxtls "github.com/luxfi/tls"
|
||||
"github.com/luxfi/node/utils/beacon"
|
||||
|
||||
"github.com/luxfi/address"
|
||||
"github.com/luxfi/node/utils/wrappers"
|
||||
@@ -1239,7 +1238,7 @@ func (ln *localNetwork) buildArgs(
|
||||
}
|
||||
|
||||
// pluginDir from config, default from luxconfig
|
||||
pluginDir, err := getConfigEntry(nodeConfig.Flags, configFile, config.PluginDirKey, luxconfig.ResolvePluginDir())
|
||||
pluginDir, err := getConfigEntry(nodeConfig.Flags, configFile, config.PluginDirKey, config.ResolvePluginDir())
|
||||
if err != nil {
|
||||
return buildArgsReturn{}, err
|
||||
}
|
||||
|
||||
+1
-1
@@ -11,7 +11,6 @@ import (
|
||||
|
||||
"github.com/luxfi/atomic"
|
||||
"github.com/luxfi/constants"
|
||||
"github.com/luxfi/node/utils/compression"
|
||||
"github.com/luxfi/crypto/bls"
|
||||
"github.com/luxfi/ids"
|
||||
log "github.com/luxfi/log"
|
||||
@@ -20,6 +19,7 @@ import (
|
||||
"github.com/luxfi/netrunner/api"
|
||||
"github.com/luxfi/netrunner/network/node"
|
||||
"github.com/luxfi/netrunner/network/node/status"
|
||||
"github.com/luxfi/node/utils/compression"
|
||||
"github.com/luxfi/p2p/message"
|
||||
"github.com/luxfi/p2p/peer"
|
||||
"github.com/luxfi/p2p/throttling"
|
||||
|
||||
+2
-2
@@ -19,12 +19,12 @@ import (
|
||||
"github.com/luxfi/geth/metrics"
|
||||
"github.com/luxfi/ids"
|
||||
"github.com/luxfi/netrunner/network/node"
|
||||
"github.com/luxfi/node/utils/ips"
|
||||
"github.com/luxfi/node/utils/wrappers"
|
||||
"github.com/luxfi/p2p/message"
|
||||
"github.com/luxfi/p2p/peer"
|
||||
luxtls "github.com/luxfi/tls"
|
||||
"github.com/luxfi/version"
|
||||
"github.com/luxfi/node/utils/ips"
|
||||
"github.com/luxfi/node/utils/wrappers"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
|
||||
+7
-9
@@ -15,7 +15,7 @@ import (
|
||||
"slices"
|
||||
|
||||
"github.com/klauspost/compress/zstd"
|
||||
luxconfig "github.com/luxfi/config"
|
||||
"github.com/luxfi/config"
|
||||
"github.com/luxfi/constants"
|
||||
"github.com/luxfi/ids"
|
||||
log "github.com/luxfi/log"
|
||||
@@ -23,8 +23,6 @@ import (
|
||||
"github.com/luxfi/netrunner/network"
|
||||
"github.com/luxfi/netrunner/network/node"
|
||||
"github.com/luxfi/netrunner/utils"
|
||||
|
||||
"github.com/luxfi/config"
|
||||
"github.com/luxfi/sdk/admin"
|
||||
)
|
||||
|
||||
@@ -240,7 +238,7 @@ func (ln *localNetwork) SaveSnapshot(ctx context.Context, snapshotName string) (
|
||||
// Request native backup via admin API
|
||||
version, err := requestAdminSnapshot(ctx, adminClient, tmpBackupPath, since)
|
||||
if err != nil {
|
||||
os.Remove(tmpBackupPath)
|
||||
_ = os.Remove(tmpBackupPath)
|
||||
return "", fmt.Errorf("failed to backup node %q: %w", nodeConfig.Name, err)
|
||||
}
|
||||
|
||||
@@ -248,7 +246,7 @@ func (ln *localNetwork) SaveSnapshot(ctx context.Context, snapshotName string) (
|
||||
backupFileName := fmt.Sprintf("%s.backup.zst", nodeConfig.Name)
|
||||
destPath := filepath.Join(snapshotDir, backupFileName)
|
||||
size, err := compressFile(tmpBackupPath, destPath)
|
||||
os.Remove(tmpBackupPath)
|
||||
_ = os.Remove(tmpBackupPath)
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("failed to compress backup for node %q: %w", nodeConfig.Name, err)
|
||||
}
|
||||
@@ -354,7 +352,7 @@ func (ln *localNetwork) loadSnapshot(
|
||||
// Set plugin dir
|
||||
resolvedPluginDir := pluginDir
|
||||
if resolvedPluginDir == "" {
|
||||
resolvedPluginDir = luxconfig.ResolvePluginDir()
|
||||
resolvedPluginDir = config.ResolvePluginDir()
|
||||
}
|
||||
for i := range networkConfig.NodeConfigs {
|
||||
networkConfig.NodeConfigs[i].Flags[config.PluginDirKey] = resolvedPluginDir
|
||||
@@ -493,16 +491,16 @@ func (ln *localNetwork) applyBackups(
|
||||
compressedPath := filepath.Join(snapshotDir, nodeManifest.BackupFile)
|
||||
tmpPath := filepath.Join(os.TempDir(), fmt.Sprintf("lux-restore-%s-%d.tmp", nodeName, time.Now().UnixNano()))
|
||||
if err := decompressFile(compressedPath, tmpPath); err != nil {
|
||||
os.Remove(tmpPath)
|
||||
_ = os.Remove(tmpPath)
|
||||
return fmt.Errorf("failed to decompress backup for node %q: %w", nodeName, err)
|
||||
}
|
||||
|
||||
// Load backup via admin API
|
||||
if err := requestAdminLoad(ctx, adminClient, tmpPath); err != nil {
|
||||
os.Remove(tmpPath)
|
||||
_ = os.Remove(tmpPath)
|
||||
return fmt.Errorf("failed to load backup for node %q: %w", nodeName, err)
|
||||
}
|
||||
os.Remove(tmpPath)
|
||||
_ = os.Remove(tmpPath)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
+14
-14
@@ -77,11 +77,11 @@ var (
|
||||
"node6": `{"api-admin-enabled":false}`,
|
||||
"node7": `{"api-admin-enabled":false}`,
|
||||
}
|
||||
numNodes = uint32(5)
|
||||
networkParticipants = []string{"node1", "node2", "node3"}
|
||||
newParticipantNode = "new_participant_node"
|
||||
networkParticipants2 = []string{"node1", "node2", newParticipantNode}
|
||||
existingNodes = []string{"node1", "node2", "node3", "node4", "node5"}
|
||||
numNodes = uint32(5)
|
||||
networkParticipants = []string{"node1", "node2", "node3"}
|
||||
newParticipantNode = "new_participant_node"
|
||||
networkParticipants2 = []string{"node1", "node2", newParticipantNode}
|
||||
existingNodes = []string{"node1", "node2", "node3", "node4", "node5"}
|
||||
disjointNewNetworkParticipants = [][]string{
|
||||
{"new_node1", "new_node2"},
|
||||
{"new_node3", "new_node4"},
|
||||
@@ -277,8 +277,8 @@ var _ = ginkgo.Describe("[Start/Remove/Restart/Add/Stop]", func() {
|
||||
resp, err := cli.CreateChains(ctx,
|
||||
[]*rpcpb.BlockchainSpec{
|
||||
{
|
||||
VmName: "evm",
|
||||
Genesis: genesisContents,
|
||||
VmName: "evm",
|
||||
Genesis: genesisContents,
|
||||
ChainId: &existingNetworkID,
|
||||
},
|
||||
},
|
||||
@@ -317,8 +317,8 @@ var _ = ginkgo.Describe("[Start/Remove/Restart/Add/Stop]", func() {
|
||||
_, err := cli.CreateChains(ctx,
|
||||
[]*rpcpb.BlockchainSpec{
|
||||
{
|
||||
VmName: "evm",
|
||||
Genesis: genesisContents,
|
||||
VmName: "evm",
|
||||
Genesis: genesisContents,
|
||||
ChainId: &existingNetworkID,
|
||||
},
|
||||
},
|
||||
@@ -397,13 +397,13 @@ var _ = ginkgo.Describe("[Start/Remove/Restart/Add/Stop]", func() {
|
||||
resp, err := cli.CreateChains(ctx,
|
||||
[]*rpcpb.BlockchainSpec{
|
||||
{
|
||||
VmName: "evm",
|
||||
Genesis: genesisContents,
|
||||
VmName: "evm",
|
||||
Genesis: genesisContents,
|
||||
ChainId: &existingNetworkID,
|
||||
},
|
||||
{
|
||||
VmName: "evm",
|
||||
Genesis: genesisContents,
|
||||
VmName: "evm",
|
||||
Genesis: genesisContents,
|
||||
ChainId: &existingNetworkID,
|
||||
},
|
||||
},
|
||||
@@ -917,7 +917,7 @@ var _ = ginkgo.Describe("[Start/Remove/Restart/Add/Stop]", func() {
|
||||
defer cancel()
|
||||
testRemoveNetworkValidatorConfig := rpcpb.RemoveChainValidatorSpec{
|
||||
NodeNames: []string{"node2"},
|
||||
ChainId: newNetworkID,
|
||||
ChainId: newNetworkID,
|
||||
}
|
||||
_, err := cli.RemoveChainValidator(ctx, []*rpcpb.RemoveChainValidatorSpec{&testRemoveNetworkValidatorConfig})
|
||||
gomega.Ω(err).Should(gomega.BeNil())
|
||||
|
||||
Reference in New Issue
Block a user