Files
zeekay 4f5b7033ba purge Avalanche-lineage keywords (one pure modern version)
Rename Etna-named test scenarios and helper functions to Sov / sovL1 /
local equivalents (sovereign-L1 chain creation is a Lux primitive, no
need to keep the Apricot/Banff/.../Etna upgrade-era branding):

- tests/e2e/commands/etna.go -> tests/e2e/commands/sov.go
- Create/CreateLocal/Deploy/Track/Add/RemoveEtna* -> *Sov*
- ginkgo Describe/It labels: [Etna ...] -> [Sov ...]
- tests/e2e/testcases/chain/sov/etna -> tests/e2e/testcases/chain/sov/sovL1
- createEtnaEVMConfig... -> createSovEVMConfig...
- deployEtnaChain*Flag* -> deploySovChain*Flag*
- initValidatorManagerEtnaFlag -> initValidatorManagerLocalFlag

Neutralized comments:
- "Banff.10:" prefix in luxdConfig.go (key-rename note kept, brand removed)
- "testnet durango" version annotation removed from dependencies.go
2026-05-18 21:03:43 -07:00

184 lines
5.3 KiB
Go

// Copyright (C) 2022-2025, Lux Industries Inc. All rights reserved.
// See the file LICENSE for licensing terms.
package chain
import (
"fmt"
"net/url"
"regexp"
"github.com/luxfi/cli/tests/e2e/commands"
"github.com/luxfi/cli/tests/e2e/utils"
ginkgo "github.com/onsi/ginkgo/v2"
"github.com/onsi/gomega"
)
const (
keyName = "treasury"
treasuryEVMAddress = "0x9011E888251AB053B7bD1cdB598Db4f9DEd94714"
treasuryPChainAddress = "P-custom18jma8ppw3nhx5r4ap8clazz0dps7rv5u9xde7p"
)
var (
blockchainID string
localClusterUris []string
luxdVersion string
)
var _ = ginkgo.Describe("[Sov AddRemove Validator SOV PoA]", func() {
ginkgo.It("Create Sov Chain Config", func() {
_, luxdVersion = commands.CreateSovEVMConfig(
utils.BlockchainName,
treasuryEVMAddress,
commands.PoA,
)
})
ginkgo.It("Can create a Sov Local Network", func() {
output := commands.StartNetworkWithVersion(luxdVersion)
fmt.Println(output)
})
ginkgo.It("Can create a local node connected to Sov Local Network", func() {
output, err := commands.CreateLocalSovNode(
luxdVersion,
utils.TestLocalNodeName,
7,
)
gomega.Expect(err).Should(gomega.BeNil())
fmt.Println(output)
localClusterUris, err = utils.GetLocalClusterUris()
gomega.Expect(err).Should(gomega.BeNil())
gomega.Expect(len(localClusterUris)).Should(gomega.Equal(7))
})
ginkgo.It("Deploy Sov Chain", func() {
output, err := commands.DeploySovBlockchain(
utils.BlockchainName,
utils.TestLocalNodeName,
[]string{
localClusterUris[0],
localClusterUris[1],
localClusterUris[2],
localClusterUris[3],
localClusterUris[4],
},
treasuryPChainAddress,
true, // convertOnly
)
gomega.Expect(err).Should(gomega.BeNil())
fmt.Println(output)
})
ginkgo.It("Can make cluster track a chain", func() {
output, err := commands.TrackLocalSovChain(utils.TestLocalNodeName, utils.BlockchainName)
gomega.Expect(err).Should(gomega.BeNil())
fmt.Println(output)
// parse blockchainID from output
re := regexp.MustCompile(`Waiting for blockchain ([A-Za-z0-9]+) to be bootstrapped`)
// Find the first match
match := re.FindStringSubmatch(output)
gomega.Expect(match).ToNot(gomega.BeEmpty())
if len(match) > 1 {
// The first submatch will contain the chain ID
blockchainID = match[1]
}
gomega.Expect(blockchainID).Should(gomega.Not(gomega.BeEmpty()))
ginkgo.GinkgoWriter.Printf("Blockchain ID: %s\n", blockchainID)
})
ginkgo.It("Can initialize a PoA Manager contract", func() {
output, err := commands.InitValidatorManager(utils.BlockchainName,
utils.TestLocalNodeName,
localClusterUris[0],
blockchainID,
)
gomega.Expect(err).Should(gomega.BeNil())
fmt.Println(output)
})
ginkgo.It("Can add validator", func() {
output, err := commands.AddSovChainValidatorToCluster(
utils.TestLocalNodeName,
utils.BlockchainName,
localClusterUris[5],
treasuryPChainAddress,
1,
false, // use existing luxd running
)
gomega.Expect(err).Should(gomega.BeNil())
fmt.Println(output)
})
ginkgo.It("Can add second validator", func() {
output, err := commands.AddSovChainValidatorToCluster(
utils.TestLocalNodeName,
utils.BlockchainName,
localClusterUris[6],
treasuryPChainAddress,
1,
false, // use existing luxd running
)
gomega.Expect(err).Should(gomega.BeNil())
fmt.Println(output)
})
ginkgo.It("Can get status of the cluster", func() {
output, err := commands.GetLocalClusterStatus(utils.TestLocalNodeName, utils.BlockchainName)
gomega.Expect(err).Should(gomega.BeNil())
fmt.Println(output)
// make sure we can find string with "http://127.0.0.1:port" and "L1:Validating" string in the output
parsedURL, err := url.Parse(localClusterUris[1])
gomega.Expect(err).Should(gomega.BeNil())
port := parsedURL.Port()
gomega.Expect(port).Should(gomega.Not(gomega.BeEmpty()))
regexp := fmt.Sprintf(`http://127\.0\.0\.1:%s.*Validating`, port)
gomega.Expect(output).To(gomega.MatchRegexp(regexp), fmt.Sprintf("expect to have L1 validated by port %s", port))
parsedURL, err = url.Parse(localClusterUris[2])
gomega.Expect(err).Should(gomega.BeNil())
port = parsedURL.Port()
gomega.Expect(port).Should(gomega.Not(gomega.BeEmpty()))
regexp = fmt.Sprintf(`http://127\.0\.0\.1:%s.*Validating`, port)
gomega.Expect(output).To(gomega.MatchRegexp(regexp), fmt.Sprintf("expect to have L1 validated by port %s", port))
})
ginkgo.It("Can remove bootstrap validator", func() {
output, err := commands.RemoveSovChainValidatorFromCluster(
utils.TestLocalNodeName,
utils.BlockchainName,
localClusterUris[2],
keyName,
0,
)
gomega.Expect(err).Should(gomega.BeNil())
fmt.Println(output)
})
ginkgo.It("Can remove non-bootstrap validator", func() {
output, err := commands.RemoveSovChainValidatorFromCluster(
utils.TestLocalNodeName,
utils.BlockchainName,
localClusterUris[5],
keyName,
0,
)
gomega.Expect(err).Should(gomega.BeNil())
fmt.Println(output)
})
ginkgo.It("Can destroy local node", func() {
output, err := commands.DestroyLocalNode(utils.TestLocalNodeName)
gomega.Expect(err).Should(gomega.BeNil())
fmt.Println(output)
})
ginkgo.It("Can destroy Sov Local Network", func() {
commands.CleanNetwork()
})
ginkgo.It("Can remove Sov Chain Config", func() {
commands.DeleteChainConfig(utils.BlockchainName)
})
})