Files
zeekay 8f56009cc7 fix: deep audit - remove stubs, fix imports, clean dead code
Deep audit changes:
- Replace stub signature aggregator with real SDK warp implementation
- Remove dead pkg/lpm package (SDK lpmintegration used instead)
- Fix fs imports: use local utils.FileExists, DirExists, ExpandHome
- Fix secp256k1fx imports: use node/vms/secp256k1fx
- Fix platformvm imports: use node/vms/platformvm
- Fix e2e test TODOs: uncomment BootstrapValidators assertions
- Improve localnet stub implementations with real logic
- Fix node.go fs.FileExists reference

Note: Build requires GOWORK=off due to workspace dependency issues
2026-01-10 11:17:00 -08:00

176 lines
6.0 KiB
Go

// Copyright (C) 2022-2025, Lux Industries Inc. All rights reserved.
// See the file LICENSE for licensing terms.
// Package packageman contains package manager E2E tests.
package packageman
import (
"fmt"
"github.com/luxfi/cli/tests/e2e/commands"
"github.com/luxfi/cli/tests/e2e/utils"
"github.com/onsi/ginkgo/v2"
"github.com/onsi/gomega"
)
const (
chainName = "e2eChainTest"
secondChainName = "e2eSecondChainTest"
)
var (
binaryToVersion map[string]string
err error
)
var _ = ginkgo.Describe("[Package Management]", ginkgo.Ordered, func() {
_ = ginkgo.BeforeAll(func() {
mapper := utils.NewVersionMapper()
binaryToVersion, err = utils.GetVersionMapping(mapper)
gomega.Expect(err).Should(gomega.BeNil())
})
ginkgo.BeforeEach(func() {
commands.CleanNetworkHard()
})
ginkgo.AfterEach(func() {
commands.CleanNetwork()
err := utils.DeleteConfigs(chainName)
gomega.Expect(err).Should(gomega.BeNil())
err = utils.DeleteConfigs(secondChainName)
gomega.Expect(err).Should(gomega.BeNil())
})
ginkgo.It("can deploy a chain with evm version", func() {
// check evm install precondition
gomega.Expect(utils.CheckEVMExists(binaryToVersion[utils.SoloEVMKey1])).Should(gomega.BeFalse())
gomega.Expect(utils.CheckLuxExists(binaryToVersion[utils.SoloLuxKey])).Should(gomega.BeFalse())
commands.CreateEVMConfigWithVersion(chainName, utils.EVMGenesisPath, binaryToVersion[utils.SoloEVMKey1])
deployOutput := commands.DeployChainLocallyWithVersion(chainName, binaryToVersion[utils.SoloLuxKey])
rpcs, err := utils.ParseRPCsFromOutput(deployOutput)
if err != nil {
fmt.Println(deployOutput)
}
gomega.Expect(err).Should(gomega.BeNil())
gomega.Expect(rpcs).Should(gomega.HaveLen(1))
rpc := rpcs[0]
err = utils.SetHardhatRPC(rpc)
gomega.Expect(err).Should(gomega.BeNil())
err = utils.RunHardhatTests(utils.BaseTest)
gomega.Expect(err).Should(gomega.BeNil())
// check evm install
gomega.Expect(utils.CheckEVMExists(binaryToVersion[utils.SoloEVMKey1])).Should(gomega.BeTrue())
gomega.Expect(utils.CheckLuxExists(binaryToVersion[utils.SoloLuxKey])).Should(gomega.BeTrue())
commands.DeleteChainConfig(chainName)
})
ginkgo.It("can deploy multiple evm versions", func() {
// check evm install precondition
gomega.Expect(utils.CheckEVMExists(binaryToVersion[utils.SoloEVMKey1])).Should(gomega.BeFalse())
gomega.Expect(utils.CheckEVMExists(binaryToVersion[utils.SoloEVMKey2])).Should(gomega.BeFalse())
commands.CreateEVMConfigWithVersion(chainName, utils.EVMGenesisPath, binaryToVersion[utils.SoloEVMKey1])
commands.CreateEVMConfigWithVersion(secondChainName, utils.EVMGenesis2Path, binaryToVersion[utils.SoloEVMKey2])
deployOutput := commands.DeployChainLocally(chainName)
rpcs, err := utils.ParseRPCsFromOutput(deployOutput)
if err != nil {
fmt.Println(deployOutput)
}
gomega.Expect(err).Should(gomega.BeNil())
gomega.Expect(rpcs).Should(gomega.HaveLen(1))
deployOutput = commands.DeployChainLocally(secondChainName)
rpcs, err = utils.ParseRPCsFromOutput(deployOutput)
if err != nil {
fmt.Println(deployOutput)
}
gomega.Expect(err).Should(gomega.BeNil())
gomega.Expect(rpcs).Should(gomega.HaveLen(2))
err = utils.SetHardhatRPC(rpcs[0])
gomega.Expect(err).Should(gomega.BeNil())
err = utils.RunHardhatTests(utils.BaseTest)
gomega.Expect(err).Should(gomega.BeNil())
err = utils.SetHardhatRPC(rpcs[1])
gomega.Expect(err).Should(gomega.BeNil())
err = utils.RunHardhatTests(utils.BaseTest)
gomega.Expect(err).Should(gomega.BeNil())
// check evm install
gomega.Expect(utils.CheckEVMExists(binaryToVersion[utils.SoloEVMKey1])).Should(gomega.BeTrue())
gomega.Expect(utils.CheckEVMExists(binaryToVersion[utils.SoloEVMKey2])).Should(gomega.BeTrue())
commands.DeleteChainConfig(chainName)
commands.DeleteChainConfig(secondChainName)
})
ginkgo.It("can deploy with multiple node versions", func() {
// check lux install precondition
gomega.Expect(utils.CheckLuxExists(binaryToVersion[utils.MultiLux1Key])).Should(gomega.BeFalse())
gomega.Expect(utils.CheckLuxExists(binaryToVersion[utils.MultiLux2Key])).Should(gomega.BeFalse())
commands.CreateEVMConfigWithVersion(chainName, utils.EVMGenesisPath, binaryToVersion[utils.MultiLuxEVMKey])
deployOutput := commands.DeployChainLocallyWithVersion(chainName, binaryToVersion[utils.MultiLux1Key])
rpcs, err := utils.ParseRPCsFromOutput(deployOutput)
if err != nil {
fmt.Println(deployOutput)
}
gomega.Expect(err).Should(gomega.BeNil())
gomega.Expect(rpcs).Should(gomega.HaveLen(1))
rpc := rpcs[0]
err = utils.SetHardhatRPC(rpc)
gomega.Expect(err).Should(gomega.BeNil())
// Deploy greeter contract
scriptOutput, scriptErr, err := utils.RunHardhatScript(utils.GreeterScript)
if scriptErr != "" {
fmt.Println(scriptOutput)
fmt.Println(scriptErr)
}
gomega.Expect(err).Should(gomega.BeNil())
err = utils.ParseGreeterAddress(scriptOutput)
gomega.Expect(err).Should(gomega.BeNil())
err = utils.RunHardhatTests(utils.BaseTest)
gomega.Expect(err).Should(gomega.BeNil())
// check lux install
gomega.Expect(utils.CheckLuxExists(binaryToVersion[utils.MultiLux1Key])).Should(gomega.BeTrue())
gomega.Expect(utils.CheckLuxExists(binaryToVersion[utils.MultiLux2Key])).Should(gomega.BeFalse())
commands.CleanNetwork()
deployOutput = commands.DeployChainLocallyWithVersion(chainName, binaryToVersion[utils.MultiLux2Key])
rpcs, err = utils.ParseRPCsFromOutput(deployOutput)
if err != nil {
fmt.Println(deployOutput)
}
gomega.Expect(err).Should(gomega.BeNil())
gomega.Expect(rpcs).Should(gomega.HaveLen(1))
rpc = rpcs[0]
err = utils.SetHardhatRPC(rpc)
gomega.Expect(err).Should(gomega.BeNil())
err = utils.RunHardhatTests(utils.BaseTest)
gomega.Expect(err).Should(gomega.BeNil())
// check lux install
gomega.Expect(utils.CheckLuxExists(binaryToVersion[utils.MultiLux1Key])).Should(gomega.BeTrue())
gomega.Expect(utils.CheckLuxExists(binaryToVersion[utils.MultiLux2Key])).Should(gomega.BeTrue())
commands.DeleteChainConfig(chainName)
})
})