mirror of
https://github.com/luxfi/netrunner.git
synced 2026-07-27 00:04:23 +00:00
Fix LUXAssetID -> XAssetID and update node to v1.18.11
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
BSD 3-Clause License
|
BSD 3-Clause License
|
||||||
|
|
||||||
Copyright (c) 2023-2024, Lux Partners Limited. All rights reserved.
|
Copyright (c) 2023-2025, Lux Partners Limited. All rights reserved.
|
||||||
Copyright (C) 2019-2023, Lux Industries, Inc.
|
Copyright (C) 2019-2023, Lux Industries, Inc.
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
|||||||
+1
-1
@@ -1,2 +1,2 @@
|
|||||||
Copyright (C) 2021-2024, Lux Partners Limited. All rights reserved.
|
Copyright (C) 2021-2025, Lux Partners Limited. All rights reserved.
|
||||||
See the file LICENSE for licensing terms.
|
See the file LICENSE for licensing terms.
|
||||||
+2
-2
@@ -28,7 +28,7 @@ var (
|
|||||||
var engineCmd = &cobra.Command{
|
var engineCmd = &cobra.Command{
|
||||||
Use: "engine",
|
Use: "engine",
|
||||||
Short: "Manage consensus engines",
|
Short: "Manage consensus engines",
|
||||||
Long: `Start, stop, and manage multiple consensus engines (luxd, avalanchego, etc.)`,
|
Long: `Start, stop, and manage multiple consensus engines (luxd, luxd, etc.)`,
|
||||||
}
|
}
|
||||||
|
|
||||||
// startCmd starts an engine
|
// startCmd starts an engine
|
||||||
@@ -174,7 +174,7 @@ func init() {
|
|||||||
engineCmd.AddCommand(listEnginesCmd)
|
engineCmd.AddCommand(listEnginesCmd)
|
||||||
|
|
||||||
// Engine start flags
|
// Engine start flags
|
||||||
startEngineCmd.Flags().StringVar(&engineType, "type", "lux", "Engine type (lux, avalanche, geth, op)")
|
startEngineCmd.Flags().StringVar(&engineType, "type", "lux", "Engine type (lux, lux, geth, op)")
|
||||||
startEngineCmd.Flags().Uint32Var(&networkID, "network-id", 96369, "Network ID")
|
startEngineCmd.Flags().Uint32Var(&networkID, "network-id", 96369, "Network ID")
|
||||||
startEngineCmd.Flags().Uint16Var(&httpPort, "http-port", 9630, "HTTP RPC port")
|
startEngineCmd.Flags().Uint16Var(&httpPort, "http-port", 9630, "HTTP RPC port")
|
||||||
startEngineCmd.Flags().Uint16Var(&stakingPort, "staking-port", 9631, "P2P staking port")
|
startEngineCmd.Flags().Uint16Var(&stakingPort, "staking-port", 9631, "P2P staking port")
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/luxfi/netrunner/engines"
|
"github.com/luxfi/netrunner/engines"
|
||||||
_ "github.com/luxfi/netrunner/engines/avalanche"
|
_ "github.com/luxfi/netrunner/engines/lux"
|
||||||
_ "github.com/luxfi/netrunner/engines/geth"
|
_ "github.com/luxfi/netrunner/engines/geth"
|
||||||
_ "github.com/luxfi/netrunner/engines/lux"
|
_ "github.com/luxfi/netrunner/engines/lux"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
@@ -139,7 +139,7 @@ func newEngineStartCmd(logger *zap.Logger) *cobra.Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// General flags
|
// General flags
|
||||||
cmd.Flags().StringVarP(&engineType, "type", "t", "lux", "Engine type (lux, avalanche, geth, op, eth2)")
|
cmd.Flags().StringVarP(&engineType, "type", "t", "lux", "Engine type (lux, lux, geth, op, eth2)")
|
||||||
cmd.Flags().Uint32Var(&networkID, "network-id", 1337, "Network ID")
|
cmd.Flags().Uint32Var(&networkID, "network-id", 1337, "Network ID")
|
||||||
cmd.Flags().Uint16Var(&httpPort, "http-port", 8545, "HTTP RPC port")
|
cmd.Flags().Uint16Var(&httpPort, "http-port", 8545, "HTTP RPC port")
|
||||||
cmd.Flags().Uint16Var(&wsPort, "ws-port", 8546, "WebSocket port")
|
cmd.Flags().Uint16Var(&wsPort, "ws-port", 8546, "WebSocket port")
|
||||||
@@ -204,7 +204,7 @@ func newEngineListCmd(logger *zap.Logger) *cobra.Command {
|
|||||||
fmt.Fprintln(w, "TYPE\tDESCRIPTION\tSTATUS")
|
fmt.Fprintln(w, "TYPE\tDESCRIPTION\tSTATUS")
|
||||||
fmt.Fprintln(w, "----\t-----------\t------")
|
fmt.Fprintln(w, "----\t-----------\t------")
|
||||||
fmt.Fprintln(w, "lux\tLux primary network\t✅ Ready")
|
fmt.Fprintln(w, "lux\tLux primary network\t✅ Ready")
|
||||||
fmt.Fprintln(w, "avalanche\tAvalanche network\t✅ Ready")
|
fmt.Fprintln(w, "lux\tLux network\t✅ Ready")
|
||||||
fmt.Fprintln(w, "geth\tEthereum (Geth)\t✅ Ready")
|
fmt.Fprintln(w, "geth\tEthereum (Geth)\t✅ Ready")
|
||||||
fmt.Fprintln(w, "op\tOP Stack L2\t✅ Ready")
|
fmt.Fprintln(w, "op\tOP Stack L2\t✅ Ready")
|
||||||
fmt.Fprintln(w, "eth2\tEthereum 2.0\t✅ Ready")
|
fmt.Fprintln(w, "eth2\tEthereum 2.0\t✅ Ready")
|
||||||
@@ -290,7 +290,7 @@ func newEngineTestCmd(logger *zap.Logger) *cobra.Command {
|
|||||||
|
|
||||||
// Type-specific tests
|
// Type-specific tests
|
||||||
switch engineType {
|
switch engineType {
|
||||||
case "lux", "avalanche":
|
case "lux", "lux":
|
||||||
fmt.Printf(" 🆔 Network ID: %d\n", engine.NetworkID())
|
fmt.Printf(" 🆔 Network ID: %d\n", engine.NetworkID())
|
||||||
fmt.Printf(" ⛓️ Chain ID: %s\n", engine.ChainID())
|
fmt.Printf(" ⛓️ Chain ID: %s\n", engine.ChainID())
|
||||||
case "op":
|
case "op":
|
||||||
@@ -326,8 +326,8 @@ func createEngine(engineType, name, binary string) (engines.Engine, error) {
|
|||||||
switch engineType {
|
switch engineType {
|
||||||
case "lux":
|
case "lux":
|
||||||
binary = "luxd"
|
binary = "luxd"
|
||||||
case "avalanche":
|
case "lux":
|
||||||
binary = "avalanchego"
|
binary = "luxd"
|
||||||
case "geth":
|
case "geth":
|
||||||
binary = "geth"
|
binary = "geth"
|
||||||
case "op":
|
case "op":
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ func newTestAllCmd(logger *zap.Logger) *cobra.Command {
|
|||||||
fmt.Println("🧪 Testing all engine types...")
|
fmt.Println("🧪 Testing all engine types...")
|
||||||
fmt.Println()
|
fmt.Println()
|
||||||
|
|
||||||
engineTypes := []string{"lux", "avalanche", "geth", "op", "eth2"}
|
engineTypes := []string{"lux", "lux", "geth", "op", "eth2"}
|
||||||
results := make(map[string]bool)
|
results := make(map[string]bool)
|
||||||
|
|
||||||
for _, engineType := range engineTypes {
|
for _, engineType := range engineTypes {
|
||||||
@@ -159,8 +159,8 @@ func testEngine(ctx context.Context, logger *zap.Logger, engineType string) erro
|
|||||||
switch engineType {
|
switch engineType {
|
||||||
case "lux":
|
case "lux":
|
||||||
binary = "luxd"
|
binary = "luxd"
|
||||||
case "avalanche":
|
case "lux":
|
||||||
binary = "avalanchego"
|
binary = "luxd"
|
||||||
case "geth":
|
case "geth":
|
||||||
binary = "geth"
|
binary = "geth"
|
||||||
case "op":
|
case "op":
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ func main() {
|
|||||||
Use: "netrunner",
|
Use: "netrunner",
|
||||||
Short: "Multi-consensus blockchain orchestrator",
|
Short: "Multi-consensus blockchain orchestrator",
|
||||||
Long: `Netrunner is a powerful orchestration tool for running multiple blockchain
|
Long: `Netrunner is a powerful orchestration tool for running multiple blockchain
|
||||||
consensus engines simultaneously. It supports Lux, Avalanche, Ethereum 2.0,
|
consensus engines simultaneously. It supports Lux, Lux, Ethereum 2.0,
|
||||||
OP Stack, and more.`,
|
OP Stack, and more.`,
|
||||||
Version: fmt.Sprintf("%s (commit: %s, built: %s)", version, commit, date),
|
Version: fmt.Sprintf("%s (commit: %s, built: %s)", version, commit, date),
|
||||||
}
|
}
|
||||||
|
|||||||
+37
-37
@@ -1,7 +1,7 @@
|
|||||||
// Copyright (C) 2025, Lux Industries Inc. All rights reserved.
|
// Copyright (C) 2025, Lux Industries Inc. All rights reserved.
|
||||||
// See the file LICENSE for licensing terms.
|
// See the file LICENSE for licensing terms.
|
||||||
|
|
||||||
package avalanche
|
package lux
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
@@ -20,11 +20,11 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
engines.Register(engines.EngineAvalanche, NewAvalancheEngine)
|
engines.Register(engines.EngineLux, NewLuxEngine)
|
||||||
}
|
}
|
||||||
|
|
||||||
// AvalancheEngine wraps avalanchego node management
|
// LuxEngine wraps luxd node management
|
||||||
type AvalancheEngine struct {
|
type LuxEngine struct {
|
||||||
name string
|
name string
|
||||||
binary string
|
binary string
|
||||||
dataDir string
|
dataDir string
|
||||||
@@ -39,30 +39,30 @@ type AvalancheEngine struct {
|
|||||||
chainID ids.ID
|
chainID ids.ID
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewAvalancheEngine creates a new Avalanche engine
|
// NewLuxEngine creates a new Lux engine
|
||||||
func NewAvalancheEngine(name string, binary string) (engines.Engine, error) {
|
func NewLuxEngine(name string, binary string) (engines.Engine, error) {
|
||||||
if binary == "" {
|
if binary == "" {
|
||||||
binary = "avalanchego"
|
binary = "luxd"
|
||||||
}
|
}
|
||||||
return &AvalancheEngine{
|
return &LuxEngine{
|
||||||
name: name,
|
name: name,
|
||||||
binary: binary,
|
binary: binary,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (e *AvalancheEngine) Name() string { return e.name }
|
func (e *LuxEngine) Name() string { return e.name }
|
||||||
func (e *AvalancheEngine) Type() engines.EngineType { return engines.EngineAvalanche }
|
func (e *LuxEngine) Type() engines.EngineType { return engines.EngineLux }
|
||||||
func (e *AvalancheEngine) NetworkID() uint32 { return e.networkID }
|
func (e *LuxEngine) NetworkID() uint32 { return e.networkID }
|
||||||
func (e *AvalancheEngine) ChainID() ids.ID { return e.chainID }
|
func (e *LuxEngine) ChainID() ids.ID { return e.chainID }
|
||||||
func (e *AvalancheEngine) ParentChain() *engines.ChainInfo { return nil } // L1
|
func (e *LuxEngine) ParentChain() *engines.ChainInfo { return nil } // L1
|
||||||
|
|
||||||
func (e *AvalancheEngine) Start(ctx context.Context, config *engines.NodeConfig) error {
|
func (e *LuxEngine) Start(ctx context.Context, config *engines.NodeConfig) error {
|
||||||
e.config = config
|
e.config = config
|
||||||
e.networkID = config.NetworkID
|
e.networkID = config.NetworkID
|
||||||
|
|
||||||
// Setup data directory
|
// Setup data directory
|
||||||
if config.DataDir == "" {
|
if config.DataDir == "" {
|
||||||
config.DataDir = filepath.Join(os.TempDir(), "avalanche", e.name)
|
config.DataDir = filepath.Join(os.TempDir(), "lux", e.name)
|
||||||
}
|
}
|
||||||
e.dataDir = config.DataDir
|
e.dataDir = config.DataDir
|
||||||
|
|
||||||
@@ -72,7 +72,7 @@ func (e *AvalancheEngine) Start(ctx context.Context, config *engines.NodeConfig)
|
|||||||
|
|
||||||
// Build command arguments
|
// Build command arguments
|
||||||
args := []string{
|
args := []string{
|
||||||
fmt.Sprintf("--network-id=%s", getAvalancheNetwork(config.NetworkID)),
|
fmt.Sprintf("--network-id=%s", getLuxNetwork(config.NetworkID)),
|
||||||
fmt.Sprintf("--http-port=%d", config.HTTPPort),
|
fmt.Sprintf("--http-port=%d", config.HTTPPort),
|
||||||
fmt.Sprintf("--staking-port=%d", config.StakingPort),
|
fmt.Sprintf("--staking-port=%d", config.StakingPort),
|
||||||
fmt.Sprintf("--data-dir=%s", e.dataDir),
|
fmt.Sprintf("--data-dir=%s", e.dataDir),
|
||||||
@@ -107,7 +107,7 @@ func (e *AvalancheEngine) Start(ctx context.Context, config *engines.NodeConfig)
|
|||||||
e.process.Stderr = logFile
|
e.process.Stderr = logFile
|
||||||
|
|
||||||
if err := e.process.Start(); err != nil {
|
if err := e.process.Start(); err != nil {
|
||||||
return fmt.Errorf("failed to start avalanchego: %w", err)
|
return fmt.Errorf("failed to start luxd: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
e.startTime = time.Now()
|
e.startTime = time.Now()
|
||||||
@@ -118,7 +118,7 @@ func (e *AvalancheEngine) Start(ctx context.Context, config *engines.NodeConfig)
|
|||||||
ticker := time.NewTicker(500 * time.Millisecond)
|
ticker := time.NewTicker(500 * time.Millisecond)
|
||||||
defer ticker.Stop()
|
defer ticker.Stop()
|
||||||
|
|
||||||
timeout := time.After(60 * time.Second) // Avalanche can take longer
|
timeout := time.After(60 * time.Second) // Lux can take longer
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
case <-ticker.C:
|
case <-ticker.C:
|
||||||
@@ -130,14 +130,14 @@ func (e *AvalancheEngine) Start(ctx context.Context, config *engines.NodeConfig)
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
case <-timeout:
|
case <-timeout:
|
||||||
return fmt.Errorf("avalanchego failed to start within 60 seconds")
|
return fmt.Errorf("luxd failed to start within 60 seconds")
|
||||||
case <-ctx.Done():
|
case <-ctx.Done():
|
||||||
return ctx.Err()
|
return ctx.Err()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (e *AvalancheEngine) Stop(ctx context.Context) error {
|
func (e *LuxEngine) Stop(ctx context.Context) error {
|
||||||
if e.process == nil || e.process.Process == nil {
|
if e.process == nil || e.process.Process == nil {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@@ -162,7 +162,7 @@ func (e *AvalancheEngine) Stop(ctx context.Context) error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (e *AvalancheEngine) Restart(ctx context.Context) error {
|
func (e *LuxEngine) Restart(ctx context.Context) error {
|
||||||
if err := e.Stop(ctx); err != nil {
|
if err := e.Stop(ctx); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@@ -170,7 +170,7 @@ func (e *AvalancheEngine) Restart(ctx context.Context) error {
|
|||||||
return e.Start(ctx, e.config)
|
return e.Start(ctx, e.config)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (e *AvalancheEngine) Health(ctx context.Context) (*engines.HealthStatus, error) {
|
func (e *LuxEngine) Health(ctx context.Context) (*engines.HealthStatus, error) {
|
||||||
if e.httpClient == nil {
|
if e.httpClient == nil {
|
||||||
return &engines.HealthStatus{Healthy: false}, nil
|
return &engines.HealthStatus{Healthy: false}, nil
|
||||||
}
|
}
|
||||||
@@ -195,40 +195,40 @@ func (e *AvalancheEngine) Health(ctx context.Context) (*engines.HealthStatus, er
|
|||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (e *AvalancheEngine) IsRunning() bool {
|
func (e *LuxEngine) IsRunning() bool {
|
||||||
return e.process != nil && e.process.Process != nil
|
return e.process != nil && e.process.Process != nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (e *AvalancheEngine) Uptime() time.Duration {
|
func (e *LuxEngine) Uptime() time.Duration {
|
||||||
if !e.IsRunning() {
|
if !e.IsRunning() {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
return time.Since(e.startTime)
|
return time.Since(e.startTime)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (e *AvalancheEngine) RPCEndpoint() string {
|
func (e *LuxEngine) RPCEndpoint() string {
|
||||||
if e.config == nil {
|
if e.config == nil {
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
return fmt.Sprintf("http://localhost:%d", e.config.HTTPPort)
|
return fmt.Sprintf("http://localhost:%d", e.config.HTTPPort)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (e *AvalancheEngine) WSEndpoint() string {
|
func (e *LuxEngine) WSEndpoint() string {
|
||||||
if e.config == nil {
|
if e.config == nil {
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
// Avalanche uses same port for HTTP and WS
|
// Lux uses same port for HTTP and WS
|
||||||
return fmt.Sprintf("ws://localhost:%d/ext/bc/C/ws", e.config.HTTPPort)
|
return fmt.Sprintf("ws://localhost:%d/ext/bc/C/ws", e.config.HTTPPort)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (e *AvalancheEngine) P2PEndpoint() string {
|
func (e *LuxEngine) P2PEndpoint() string {
|
||||||
if e.config == nil {
|
if e.config == nil {
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
return fmt.Sprintf("localhost:%d", e.config.StakingPort)
|
return fmt.Sprintf("localhost:%d", e.config.StakingPort)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (e *AvalancheEngine) Metrics() map[string]interface{} {
|
func (e *LuxEngine) Metrics() map[string]interface{} {
|
||||||
return map[string]interface{}{
|
return map[string]interface{}{
|
||||||
"uptime_seconds": e.Uptime().Seconds(),
|
"uptime_seconds": e.Uptime().Seconds(),
|
||||||
"running": e.IsRunning(),
|
"running": e.IsRunning(),
|
||||||
@@ -237,8 +237,8 @@ func (e *AvalancheEngine) Metrics() map[string]interface{} {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// getAvalancheNetwork converts network ID to avalanche network name
|
// getLuxNetwork converts network ID to lux network name
|
||||||
func getAvalancheNetwork(networkID uint32) string {
|
func getLuxNetwork(networkID uint32) string {
|
||||||
switch networkID {
|
switch networkID {
|
||||||
case 1:
|
case 1:
|
||||||
return "mainnet"
|
return "mainnet"
|
||||||
@@ -255,7 +255,7 @@ func getAvalancheNetwork(networkID uint32) string {
|
|||||||
|
|
||||||
// Helper methods for RPC calls
|
// Helper methods for RPC calls
|
||||||
|
|
||||||
func (e *AvalancheEngine) callRPC(ctx context.Context, endpoint string, method string, params interface{}) (json.RawMessage, error) {
|
func (e *LuxEngine) callRPC(ctx context.Context, endpoint string, method string, params interface{}) (json.RawMessage, error) {
|
||||||
reqBody := map[string]interface{}{
|
reqBody := map[string]interface{}{
|
||||||
"jsonrpc": "2.0",
|
"jsonrpc": "2.0",
|
||||||
"id": 1,
|
"id": 1,
|
||||||
@@ -304,7 +304,7 @@ func (e *AvalancheEngine) callRPC(ctx context.Context, endpoint string, method s
|
|||||||
return result.Result, nil
|
return result.Result, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (e *AvalancheEngine) getNodeID(ctx context.Context) (string, error) {
|
func (e *LuxEngine) getNodeID(ctx context.Context) (string, error) {
|
||||||
result, err := e.callRPC(ctx, "/ext/info", "info.getNodeID", struct{}{})
|
result, err := e.callRPC(ctx, "/ext/info", "info.getNodeID", struct{}{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
@@ -320,7 +320,7 @@ func (e *AvalancheEngine) getNodeID(ctx context.Context) (string, error) {
|
|||||||
return resp.NodeID, nil
|
return resp.NodeID, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (e *AvalancheEngine) getBlockchainID(ctx context.Context, alias string) (ids.ID, error) {
|
func (e *LuxEngine) getBlockchainID(ctx context.Context, alias string) (ids.ID, error) {
|
||||||
result, err := e.callRPC(ctx, "/ext/info", "info.getBlockchainID", map[string]string{"alias": alias})
|
result, err := e.callRPC(ctx, "/ext/info", "info.getBlockchainID", map[string]string{"alias": alias})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return ids.Empty, err
|
return ids.Empty, err
|
||||||
@@ -336,7 +336,7 @@ func (e *AvalancheEngine) getBlockchainID(ctx context.Context, alias string) (id
|
|||||||
return ids.FromString(resp.BlockchainID)
|
return ids.FromString(resp.BlockchainID)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (e *AvalancheEngine) getHealth(ctx context.Context) (bool, error) {
|
func (e *LuxEngine) getHealth(ctx context.Context) (bool, error) {
|
||||||
result, err := e.callRPC(ctx, "/ext/health", "health.health", struct{}{})
|
result, err := e.callRPC(ctx, "/ext/health", "health.health", struct{}{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, err
|
return false, err
|
||||||
@@ -352,7 +352,7 @@ func (e *AvalancheEngine) getHealth(ctx context.Context) (bool, error) {
|
|||||||
return resp.Healthy, nil
|
return resp.Healthy, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (e *AvalancheEngine) getPeerCount(ctx context.Context) (int, error) {
|
func (e *LuxEngine) getPeerCount(ctx context.Context) (int, error) {
|
||||||
result, err := e.callRPC(ctx, "/ext/info", "info.peers", struct{}{})
|
result, err := e.callRPC(ctx, "/ext/info", "info.peers", struct{}{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return 0, err
|
return 0, err
|
||||||
@@ -377,7 +377,7 @@ func (e *AvalancheEngine) getPeerCount(ctx context.Context) (int, error) {
|
|||||||
return len(resp.Peers), nil
|
return len(resp.Peers), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (e *AvalancheEngine) getNodeVersion(ctx context.Context) (string, error) {
|
func (e *LuxEngine) getNodeVersion(ctx context.Context) (string, error) {
|
||||||
result, err := e.callRPC(ctx, "/ext/info", "info.getNodeVersion", struct{}{})
|
result, err := e.callRPC(ctx, "/ext/info", "info.getNodeVersion", struct{}{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ func TestEngineTypes(t *testing.T) {
|
|||||||
// Test that engine types are defined correctly
|
// Test that engine types are defined correctly
|
||||||
engines := []EngineType{
|
engines := []EngineType{
|
||||||
EngineLux,
|
EngineLux,
|
||||||
EngineAvalanche,
|
EngineLux,
|
||||||
EngineGeth,
|
EngineGeth,
|
||||||
EngineOP,
|
EngineOP,
|
||||||
EngineEth2,
|
EngineEth2,
|
||||||
|
|||||||
+1
-1
@@ -16,7 +16,7 @@ type EngineType string
|
|||||||
|
|
||||||
const (
|
const (
|
||||||
EngineLux EngineType = "lux"
|
EngineLux EngineType = "lux"
|
||||||
EngineAvalanche EngineType = "avalanche"
|
EngineLux EngineType = "lux"
|
||||||
EngineGeth EngineType = "geth"
|
EngineGeth EngineType = "geth"
|
||||||
EngineOP EngineType = "op"
|
EngineOP EngineType = "op"
|
||||||
EngineEth2 EngineType = "eth2"
|
EngineEth2 EngineType = "eth2"
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
name: multi-consensus-stack
|
name: multi-consensus-stack
|
||||||
version: 1.0.0
|
version: 1.0.0
|
||||||
description: Multi-consensus architecture with Lux, Avalanche, Ethereum, and OP Stack
|
description: Multi-consensus architecture with Lux, Lux, Ethereum, and OP Stack
|
||||||
|
|
||||||
engines:
|
engines:
|
||||||
# Lux Primary Network
|
# Lux Primary Network
|
||||||
@@ -16,10 +16,10 @@ engines:
|
|||||||
consensus: snowman
|
consensus: snowman
|
||||||
wait_healthy: true
|
wait_healthy: true
|
||||||
|
|
||||||
# Avalanche for compatibility testing
|
# Lux for compatibility testing
|
||||||
- name: avalanche-c-chain
|
- name: lux-c-chain
|
||||||
type: avalanche
|
type: lux
|
||||||
binary: "avalanchego"
|
binary: "luxd"
|
||||||
network_id: 43114
|
network_id: 43114
|
||||||
http_port: 9650
|
http_port: 9650
|
||||||
ws_port: 9651
|
ws_port: 9651
|
||||||
@@ -92,7 +92,7 @@ engines:
|
|||||||
bridge:
|
bridge:
|
||||||
type: awm
|
type: awm
|
||||||
source: lux-mainnet
|
source: lux-mainnet
|
||||||
destination: avalanche-c-chain
|
destination: lux-c-chain
|
||||||
relayer_key: "relayer.key"
|
relayer_key: "relayer.key"
|
||||||
contracts:
|
contracts:
|
||||||
teleporter: "0x253b2784c75e510dD0fF1da844684a1aC0aa5fcf"
|
teleporter: "0x253b2784c75e510dD0fF1da844684a1aC0aa5fcf"
|
||||||
@@ -107,9 +107,9 @@ networks:
|
|||||||
- "http://localhost:9630"
|
- "http://localhost:9630"
|
||||||
- "ws://localhost:9631"
|
- "ws://localhost:9631"
|
||||||
|
|
||||||
- name: avalanche
|
- name: lux
|
||||||
type: l1
|
type: l1
|
||||||
engine: avalanche-c-chain
|
engine: lux-c-chain
|
||||||
chain_id: 43114
|
chain_id: 43114
|
||||||
endpoints:
|
endpoints:
|
||||||
- "http://localhost:9650"
|
- "http://localhost:9650"
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ require (
|
|||||||
github.com/luxfi/log v1.1.22
|
github.com/luxfi/log v1.1.22
|
||||||
github.com/luxfi/math v0.1.1
|
github.com/luxfi/math v0.1.1
|
||||||
github.com/luxfi/metric v1.4.0
|
github.com/luxfi/metric v1.4.0
|
||||||
github.com/luxfi/node v1.18.10
|
github.com/luxfi/node v1.18.11
|
||||||
github.com/onsi/ginkgo/v2 v2.25.1
|
github.com/onsi/ginkgo/v2 v2.25.1
|
||||||
github.com/onsi/gomega v1.37.0
|
github.com/onsi/gomega v1.37.0
|
||||||
github.com/otiai10/copy v1.14.1
|
github.com/otiai10/copy v1.14.1
|
||||||
@@ -39,6 +39,7 @@ require (
|
|||||||
github.com/Masterminds/semver/v3 v3.4.0 // indirect
|
github.com/Masterminds/semver/v3 v3.4.0 // indirect
|
||||||
github.com/Microsoft/go-winio v0.6.2 // indirect
|
github.com/Microsoft/go-winio v0.6.2 // indirect
|
||||||
github.com/NYTimes/gziphandler v1.1.1 // indirect
|
github.com/NYTimes/gziphandler v1.1.1 // indirect
|
||||||
|
github.com/StephenButtolph/canoto v0.17.2 // indirect
|
||||||
github.com/VictoriaMetrics/fastcache v1.13.0 // indirect
|
github.com/VictoriaMetrics/fastcache v1.13.0 // indirect
|
||||||
github.com/beorn7/perks v1.0.1 // indirect
|
github.com/beorn7/perks v1.0.1 // indirect
|
||||||
github.com/bits-and-blooms/bitset v1.24.0 // indirect
|
github.com/bits-and-blooms/bitset v1.24.0 // indirect
|
||||||
@@ -67,6 +68,7 @@ require (
|
|||||||
github.com/ethereum/c-kzg-4844/v2 v2.1.1 // indirect
|
github.com/ethereum/c-kzg-4844/v2 v2.1.1 // indirect
|
||||||
github.com/ethereum/go-bigmodexpfix v0.0.0-20250911101455-f9e208c548ab // indirect
|
github.com/ethereum/go-bigmodexpfix v0.0.0-20250911101455-f9e208c548ab // indirect
|
||||||
github.com/ethereum/go-verkle v0.2.2 // indirect
|
github.com/ethereum/go-verkle v0.2.2 // indirect
|
||||||
|
github.com/fatih/structtag v1.2.0 // indirect
|
||||||
github.com/ferranbt/fastssz v1.0.0 // indirect
|
github.com/ferranbt/fastssz v1.0.0 // indirect
|
||||||
github.com/fsnotify/fsnotify v1.9.0 // indirect
|
github.com/fsnotify/fsnotify v1.9.0 // indirect
|
||||||
github.com/getsentry/sentry-go v0.35.1 // indirect
|
github.com/getsentry/sentry-go v0.35.1 // indirect
|
||||||
|
|||||||
@@ -10,6 +10,8 @@ github.com/NYTimes/gziphandler v1.1.1 h1:ZUDjpQae29j0ryrS0u/B8HZfJBtBQHjqw2rQ2cq
|
|||||||
github.com/NYTimes/gziphandler v1.1.1/go.mod h1:n/CVRwUEOgIxrgPvAQhUUr9oeUtvrhMomdKFjzJNB0c=
|
github.com/NYTimes/gziphandler v1.1.1/go.mod h1:n/CVRwUEOgIxrgPvAQhUUr9oeUtvrhMomdKFjzJNB0c=
|
||||||
github.com/OneOfOne/xxhash v1.2.2 h1:KMrpdQIwFcEqXDklaen+P1axHaj9BSKzvpUUfnHldSE=
|
github.com/OneOfOne/xxhash v1.2.2 h1:KMrpdQIwFcEqXDklaen+P1axHaj9BSKzvpUUfnHldSE=
|
||||||
github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU=
|
github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU=
|
||||||
|
github.com/StephenButtolph/canoto v0.17.2 h1:kRLJwtYk0bzdGEeEvwHaVmmDm0HFHxrS0VlVN5Hyo7U=
|
||||||
|
github.com/StephenButtolph/canoto v0.17.2/go.mod h1:IcnAHC6nJUfQFVR9y60ko2ecUqqHHSB6UwI9NnBFZnE=
|
||||||
github.com/VictoriaMetrics/fastcache v1.13.0 h1:AW4mheMR5Vd9FkAPUv+NH6Nhw+fmbTMGMsNAoA/+4G0=
|
github.com/VictoriaMetrics/fastcache v1.13.0 h1:AW4mheMR5Vd9FkAPUv+NH6Nhw+fmbTMGMsNAoA/+4G0=
|
||||||
github.com/VictoriaMetrics/fastcache v1.13.0/go.mod h1:hHXhl4DA2fTL2HTZDJFXWgW0LNjo6B+4aj2Wmng3TjU=
|
github.com/VictoriaMetrics/fastcache v1.13.0/go.mod h1:hHXhl4DA2fTL2HTZDJFXWgW0LNjo6B+4aj2Wmng3TjU=
|
||||||
github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII=
|
github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII=
|
||||||
@@ -129,6 +131,8 @@ github.com/ethereum/go-bigmodexpfix v0.0.0-20250911101455-f9e208c548ab h1:rvv6MJ
|
|||||||
github.com/ethereum/go-bigmodexpfix v0.0.0-20250911101455-f9e208c548ab/go.mod h1:IuLm4IsPipXKF7CW5Lzf68PIbZ5yl7FFd74l/E0o9A8=
|
github.com/ethereum/go-bigmodexpfix v0.0.0-20250911101455-f9e208c548ab/go.mod h1:IuLm4IsPipXKF7CW5Lzf68PIbZ5yl7FFd74l/E0o9A8=
|
||||||
github.com/ethereum/go-verkle v0.2.2 h1:I2W0WjnrFUIzzVPwm8ykY+7pL2d4VhlsePn4j7cnFk8=
|
github.com/ethereum/go-verkle v0.2.2 h1:I2W0WjnrFUIzzVPwm8ykY+7pL2d4VhlsePn4j7cnFk8=
|
||||||
github.com/ethereum/go-verkle v0.2.2/go.mod h1:M3b90YRnzqKyyzBEWJGqj8Qff4IDeXnzFw0P9bFw3uk=
|
github.com/ethereum/go-verkle v0.2.2/go.mod h1:M3b90YRnzqKyyzBEWJGqj8Qff4IDeXnzFw0P9bFw3uk=
|
||||||
|
github.com/fatih/structtag v1.2.0 h1:/OdNE99OxoI/PqaW/SuSK9uxxT3f/tcSZgon/ssNSx4=
|
||||||
|
github.com/fatih/structtag v1.2.0/go.mod h1:mBJUNpUnHmRKrKlQQlmCrh5PuhftFbNv8Ys4/aAZl94=
|
||||||
github.com/ferranbt/fastssz v1.0.0 h1:9EXXYsracSqQRBQiHeaVsG/KQeYblPf40hsQPb9Dzk8=
|
github.com/ferranbt/fastssz v1.0.0 h1:9EXXYsracSqQRBQiHeaVsG/KQeYblPf40hsQPb9Dzk8=
|
||||||
github.com/ferranbt/fastssz v1.0.0/go.mod h1:Ea3+oeoRGGLGm5shYAeDgu6PGUlcvQhE2fILyD9+tGg=
|
github.com/ferranbt/fastssz v1.0.0/go.mod h1:Ea3+oeoRGGLGm5shYAeDgu6PGUlcvQhE2fILyD9+tGg=
|
||||||
github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8=
|
github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8=
|
||||||
@@ -292,6 +296,8 @@ github.com/luxfi/mock v0.1.0 h1:IwElfNu+T9sXvzFX6tudPDx1vqPuACRSRdxpD5lxW+o=
|
|||||||
github.com/luxfi/mock v0.1.0/go.mod h1:izF+9K0gGzFC9zERn6Po37v46eLdPB+EIsDjL3GLk+U=
|
github.com/luxfi/mock v0.1.0/go.mod h1:izF+9K0gGzFC9zERn6Po37v46eLdPB+EIsDjL3GLk+U=
|
||||||
github.com/luxfi/node v1.18.10 h1:6hrQHbwaHbyqQeUh5HMplg7IAHFOm88Cq/IBrod0UY4=
|
github.com/luxfi/node v1.18.10 h1:6hrQHbwaHbyqQeUh5HMplg7IAHFOm88Cq/IBrod0UY4=
|
||||||
github.com/luxfi/node v1.18.10/go.mod h1:fTB6iMiXTBR7W7xrcXKkHYwVG3ula62CEihEPXr51Bg=
|
github.com/luxfi/node v1.18.10/go.mod h1:fTB6iMiXTBR7W7xrcXKkHYwVG3ula62CEihEPXr51Bg=
|
||||||
|
github.com/luxfi/node v1.18.11 h1:387m+Rd0AMBgYoBWE3Aai/CpnxfCpjNRt3i11SBJK4k=
|
||||||
|
github.com/luxfi/node v1.18.11/go.mod h1:fTB6iMiXTBR7W7xrcXKkHYwVG3ula62CEihEPXr51Bg=
|
||||||
github.com/luxfi/trace v0.1.2 h1:KhRZbk2lQQmmYZjdTWcZKCYkLfu7/VUiLFIsWFKhkwg=
|
github.com/luxfi/trace v0.1.2 h1:KhRZbk2lQQmmYZjdTWcZKCYkLfu7/VUiLFIsWFKhkwg=
|
||||||
github.com/luxfi/trace v0.1.2/go.mod h1:4SleFc5NVbQYEfn6rYafdfxvHJ+QSdkGAIfKiICYvQE=
|
github.com/luxfi/trace v0.1.2/go.mod h1:4SleFc5NVbQYEfn6rYafdfxvHJ+QSdkGAIfKiICYvQE=
|
||||||
github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ=
|
github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ=
|
||||||
|
|||||||
+1
-1
@@ -694,7 +694,7 @@ func newWallet(
|
|||||||
xClient := xvm.NewClient(uri, "X")
|
xClient := xvm.NewClient(uri, "X")
|
||||||
w.xWallet = x.NewWallet(xBuilder, xSigner, xClient, xBackend)
|
w.xWallet = x.NewWallet(xBuilder, xSigner, xClient, xBackend)
|
||||||
w.xChainID = xChainID
|
w.xChainID = xChainID
|
||||||
w.luxAssetID = luxState.PCTX.LUXAssetID
|
w.luxAssetID = luxState.PCTX.XAssetID
|
||||||
return &w, nil
|
return &w, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
// Copyright (C) 2024, Lux Industries Inc. All rights reserved.
|
// Copyright (C) 2025, Lux Industries Inc. All rights reserved.
|
||||||
// See the file LICENSE for licensing terms.
|
// See the file LICENSE for licensing terms.
|
||||||
package main
|
package main
|
||||||
|
|
||||||
|
|||||||
@@ -64,14 +64,14 @@ func TestMultiEngineOrchestration(t *testing.T) {
|
|||||||
err := host.StartEngine(ctx, "lux-1", engines.EngineLux, luxConfig)
|
err := host.StartEngine(ctx, "lux-1", engines.EngineLux, luxConfig)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
// Start Avalanche
|
// Start Lux
|
||||||
avaConfig := &engines.NodeConfig{
|
avaConfig := &engines.NodeConfig{
|
||||||
NetworkID: 43114,
|
NetworkID: 43114,
|
||||||
HTTPPort: 19650,
|
HTTPPort: 19650,
|
||||||
StakingPort: 19651,
|
StakingPort: 19651,
|
||||||
LogLevel: "info",
|
LogLevel: "info",
|
||||||
}
|
}
|
||||||
err = host.StartEngine(ctx, "ava-1", engines.EngineAvalanche, avaConfig)
|
err = host.StartEngine(ctx, "ava-1", engines.EngineLux, avaConfig)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
// Check both are running
|
// Check both are running
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ type StackManifest struct {
|
|||||||
// EngineConfig defines an engine configuration
|
// EngineConfig defines an engine configuration
|
||||||
type EngineConfig struct {
|
type EngineConfig struct {
|
||||||
Name string `yaml:"name" json:"name"`
|
Name string `yaml:"name" json:"name"`
|
||||||
Type string `yaml:"type" json:"type"` // lux, avalanche, geth, op, eth2
|
Type string `yaml:"type" json:"type"` // lux, lux, geth, op, eth2
|
||||||
Binary string `yaml:"binary,omitempty" json:"binary,omitempty"`
|
Binary string `yaml:"binary,omitempty" json:"binary,omitempty"`
|
||||||
NetworkID uint32 `yaml:"network_id" json:"network_id"`
|
NetworkID uint32 `yaml:"network_id" json:"network_id"`
|
||||||
HTTPPort uint16 `yaml:"http_port,omitempty" json:"http_port,omitempty"`
|
HTTPPort uint16 `yaml:"http_port,omitempty" json:"http_port,omitempty"`
|
||||||
@@ -91,7 +91,7 @@ func (m *StackManifest) Validate() error {
|
|||||||
|
|
||||||
// Validate engine type
|
// Validate engine type
|
||||||
switch e.Type {
|
switch e.Type {
|
||||||
case "lux", "avalanche", "geth", "op", "eth2":
|
case "lux", "lux", "geth", "op", "eth2":
|
||||||
// Valid
|
// Valid
|
||||||
default:
|
default:
|
||||||
return fmt.Errorf("invalid engine type: %s", e.Type)
|
return fmt.Errorf("invalid engine type: %s", e.Type)
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
name: lux-avalanche-bridge
|
name: lux-lux-bridge
|
||||||
version: 1.0.0
|
version: 1.0.0
|
||||||
description: Lux L1 + Avalanche C-Chain with AWM bridge
|
description: Lux L1 + Lux C-Chain with AWM bridge
|
||||||
|
|
||||||
engines:
|
engines:
|
||||||
- name: lux-l1
|
- name: lux-l1
|
||||||
@@ -15,8 +15,8 @@ engines:
|
|||||||
sybil-protection-enabled: false
|
sybil-protection-enabled: false
|
||||||
health-check-frequency: 2s
|
health-check-frequency: 2s
|
||||||
|
|
||||||
- name: avalanche-c
|
- name: lux-c
|
||||||
type: avalanche
|
type: lux
|
||||||
network_id: 43114
|
network_id: 43114
|
||||||
http_port: 9650
|
http_port: 9650
|
||||||
staking_port: 9651
|
staking_port: 9651
|
||||||
@@ -27,7 +27,7 @@ engines:
|
|||||||
|
|
||||||
bridge:
|
bridge:
|
||||||
type: awm
|
type: awm
|
||||||
source: avalanche-c
|
source: lux-c
|
||||||
destination: lux-l1
|
destination: lux-l1
|
||||||
contracts:
|
contracts:
|
||||||
messenger: "0x0000000000000000000000000000000000000000"
|
messenger: "0x0000000000000000000000000000000000000000"
|
||||||
@@ -39,7 +39,7 @@ networks:
|
|||||||
engine: lux-l1
|
engine: lux-l1
|
||||||
chain_id: 96369
|
chain_id: 96369
|
||||||
|
|
||||||
- name: avalanche-mainnet
|
- name: lux-mainnet
|
||||||
type: l1
|
type: l1
|
||||||
engine: avalanche-c
|
engine: lux-c
|
||||||
chain_id: 43114
|
chain_id: 43114
|
||||||
Reference in New Issue
Block a user