mirror of
https://github.com/luxfi/node.git
synced 2026-07-27 03:39:39 +00:00
feat: clean up dead code, update deps, add xvm genesis/fx and genesis builder
Remove unused bloom filter, test helpers, metrics scaffolding, and linearizable VM wrapper. Trim stale go.sum entries. Add genesis builder helpers and xvm FX/genesis initialization.
This commit is contained in:
Vendored
-9
@@ -1,9 +0,0 @@
|
||||
// Copyright (C) 2019-2025, Lux Industries Inc. All rights reserved.
|
||||
// See the file LICENSE for licensing terms.
|
||||
|
||||
package lru
|
||||
|
||||
func zero[T any]() T {
|
||||
var z T
|
||||
return z
|
||||
}
|
||||
Vendored
-9
@@ -1,9 +0,0 @@
|
||||
// Copyright (C) 2019-2025, Lux Industries Inc. All rights reserved.
|
||||
// See the file LICENSE for licensing terms.
|
||||
|
||||
package cache
|
||||
|
||||
func zero[T any]() T {
|
||||
var z T
|
||||
return z
|
||||
}
|
||||
@@ -86,26 +86,6 @@ func (vm *initializeOnLinearizeVM) Linearize(ctx context.Context, stopVertexID i
|
||||
)
|
||||
}
|
||||
|
||||
// dbManagerWrapper wraps a database.Database to implement chain.DBManager
|
||||
type dbManagerWrapper struct {
|
||||
db database.Database
|
||||
}
|
||||
|
||||
func (d *dbManagerWrapper) Current() database.Database {
|
||||
return d.db
|
||||
}
|
||||
|
||||
func (d *dbManagerWrapper) Database(id ids.ID) database.Database {
|
||||
return d.db
|
||||
}
|
||||
|
||||
func (d *dbManagerWrapper) Close() error {
|
||||
if d.db != nil {
|
||||
return d.db.Close()
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// linearizeOnInitializeVM transforms the proposervm's call to Initialize into a
|
||||
// call to Linearize. This enables the proposervm to provide its toEngine
|
||||
// channel to the VM that is being linearized.
|
||||
|
||||
@@ -93,7 +93,6 @@ var (
|
||||
errCannotReadDirectory = errors.New("cannot read directory")
|
||||
errUnmarshalling = errors.New("unmarshalling failed")
|
||||
errFileDoesNotExist = errors.New("file does not exist")
|
||||
errDevNetworkGenesisMismatch = errors.New("genesis mismatch: automine-network.json exists but produces different genesis hash; delete datadir or use original network config")
|
||||
)
|
||||
|
||||
// AutomineNetworkConfig captures immutable network state for automine mode persistence.
|
||||
@@ -217,32 +216,6 @@ func getConsensusConfig(v *viper.Viper) consensusconfig.Parameters {
|
||||
return p
|
||||
}
|
||||
|
||||
func getLoggingConfig(v *viper.Viper) (log.Config, error) {
|
||||
loggingConfig := log.Config{}
|
||||
loggingConfig.Directory = getExpandedArg(v, LogsDirKey)
|
||||
var err error
|
||||
loggingConfig.LogLevel, err = log.ToLevel(v.GetString(LogLevelKey))
|
||||
if err != nil {
|
||||
return loggingConfig, err
|
||||
}
|
||||
logDisplayLevel := v.GetString(LogLevelKey)
|
||||
if v.IsSet(LogDisplayLevelKey) {
|
||||
logDisplayLevel = v.GetString(LogDisplayLevelKey)
|
||||
}
|
||||
loggingConfig.DisplayLevel, err = log.ToLevel(logDisplayLevel)
|
||||
if err != nil {
|
||||
return loggingConfig, err
|
||||
}
|
||||
loggingConfig.LogFormat, err = log.ToFormat(v.GetString(LogFormatKey), os.Stdout.Fd())
|
||||
loggingConfig.DisableWriterDisplaying = v.GetBool(LogDisableDisplayPluginLogsKey)
|
||||
loggingConfig.MaxSize = int(v.GetUint(LogRotaterMaxSizeKey))
|
||||
loggingConfig.MaxFiles = int(v.GetUint(LogRotaterMaxFilesKey))
|
||||
loggingConfig.MaxAge = int(v.GetUint(LogRotaterMaxAgeKey))
|
||||
loggingConfig.Compress = v.GetBool(LogRotaterCompressEnabledKey)
|
||||
|
||||
return loggingConfig, err
|
||||
}
|
||||
|
||||
func getHTTPConfig(v *viper.Viper) (node.HTTPConfig, error) {
|
||||
var (
|
||||
httpsKey []byte
|
||||
@@ -309,25 +282,6 @@ func getHTTPConfig(v *viper.Viper) (node.HTTPConfig, error) {
|
||||
}, nil
|
||||
}
|
||||
|
||||
func getRouterHealthConfig(v *viper.Viper, halflife time.Duration) (RouterHealthConfig, error) {
|
||||
config := RouterHealthConfig{
|
||||
MaxDropRate: v.GetFloat64(RouterHealthMaxDropRateKey),
|
||||
MaxOutstandingRequests: int(v.GetUint(RouterHealthMaxOutstandingRequestsKey)),
|
||||
MaxOutstandingDuration: v.GetDuration(NetworkHealthMaxOutstandingDurationKey),
|
||||
MaxRunTimeRequests: v.GetDuration(NetworkMaximumTimeoutKey),
|
||||
MaxDropRateHalflife: halflife,
|
||||
}
|
||||
switch {
|
||||
case config.MaxDropRate < 0 || config.MaxDropRate > 1:
|
||||
return RouterHealthConfig{}, fmt.Errorf("%q must be in [0,1]", RouterHealthMaxDropRateKey)
|
||||
case config.MaxOutstandingDuration <= 0:
|
||||
return RouterHealthConfig{}, fmt.Errorf("%q must be positive", NetworkHealthMaxOutstandingDurationKey)
|
||||
case config.MaxRunTimeRequests <= 0:
|
||||
return RouterHealthConfig{}, fmt.Errorf("%q must be positive", NetworkMaximumTimeoutKey)
|
||||
}
|
||||
return config, nil
|
||||
}
|
||||
|
||||
func getAdaptiveTimeoutConfig(v *viper.Viper) (timer.AdaptiveTimeoutConfig, error) {
|
||||
config := timer.AdaptiveTimeoutConfig{
|
||||
InitialTimeout: v.GetDuration(NetworkInitialTimeoutKey),
|
||||
@@ -533,24 +487,6 @@ func getNetworkConfig(
|
||||
return config, nil
|
||||
}
|
||||
|
||||
func getBenchlistConfig(v *viper.Viper, consensusParameters consensusconfig.Parameters) (benchlist.Config, error) {
|
||||
// AlphaConfidence is used here to ensure that benching can't cause a
|
||||
// liveness failure. If AlphaPreference were used, the benchlist may grow to
|
||||
// a point that committing would be extremely unlikely to happen.
|
||||
_ = consensusParameters.AlphaConfidence
|
||||
_ = consensusParameters.K
|
||||
// Validate configuration but return empty benchlist.Config as it's deprecated
|
||||
duration := v.GetDuration(BenchlistDurationKey)
|
||||
minFailingDuration := v.GetDuration(BenchlistMinFailingDurationKey)
|
||||
switch {
|
||||
case duration < 0:
|
||||
return benchlist.Config{}, fmt.Errorf("%q must be >= 0", BenchlistDurationKey)
|
||||
case minFailingDuration < 0:
|
||||
return benchlist.Config{}, fmt.Errorf("%q must be >= 0", BenchlistMinFailingDurationKey)
|
||||
}
|
||||
return benchlist.Config{}, nil
|
||||
}
|
||||
|
||||
func getStateSyncConfig(v *viper.Viper) (node.StateSyncConfig, error) {
|
||||
var (
|
||||
config = node.StateSyncConfig{}
|
||||
@@ -1725,26 +1661,6 @@ func getDefaultNetConfig(v *viper.Viper) nets.Config {
|
||||
return config
|
||||
}
|
||||
|
||||
func getCPUTargeterConfig(v *viper.Viper) (TrackerTargeterConfig, error) {
|
||||
vdrAlloc := v.GetFloat64(CPUVdrAllocKey)
|
||||
maxNonVdrUsage := v.GetFloat64(CPUMaxNonVdrUsageKey)
|
||||
maxNonVdrNodeUsage := v.GetFloat64(CPUMaxNonVdrNodeUsageKey)
|
||||
switch {
|
||||
case vdrAlloc < 0:
|
||||
return TrackerTargeterConfig{}, fmt.Errorf("%q (%f) < 0", CPUVdrAllocKey, vdrAlloc)
|
||||
case maxNonVdrUsage < 0:
|
||||
return TrackerTargeterConfig{}, fmt.Errorf("%q (%f) < 0", CPUMaxNonVdrUsageKey, maxNonVdrUsage)
|
||||
case maxNonVdrNodeUsage < 0:
|
||||
return TrackerTargeterConfig{}, fmt.Errorf("%q (%f) < 0", CPUMaxNonVdrNodeUsageKey, maxNonVdrNodeUsage)
|
||||
default:
|
||||
return TrackerTargeterConfig{
|
||||
VdrAlloc: vdrAlloc,
|
||||
MaxNonVdrUsage: maxNonVdrUsage,
|
||||
MaxNonVdrNodeUsage: maxNonVdrNodeUsage,
|
||||
}, nil
|
||||
}
|
||||
}
|
||||
|
||||
func getDiskSpaceConfig(v *viper.Viper) (requiredAvailableDiskSpace uint64, warningThresholdAvailableDiskSpace uint64, err error) {
|
||||
requiredAvailableDiskSpace = v.GetUint64(SystemTrackerRequiredAvailableDiskSpaceKey)
|
||||
warningThresholdAvailableDiskSpace = v.GetUint64(SystemTrackerWarningThresholdAvailableDiskSpaceKey)
|
||||
@@ -1756,26 +1672,6 @@ func getDiskSpaceConfig(v *viper.Viper) (requiredAvailableDiskSpace uint64, warn
|
||||
}
|
||||
}
|
||||
|
||||
func getDiskTargeterConfig(v *viper.Viper) (TrackerTargeterConfig, error) {
|
||||
vdrAlloc := v.GetFloat64(DiskVdrAllocKey)
|
||||
maxNonVdrUsage := v.GetFloat64(DiskMaxNonVdrUsageKey)
|
||||
maxNonVdrNodeUsage := v.GetFloat64(DiskMaxNonVdrNodeUsageKey)
|
||||
switch {
|
||||
case vdrAlloc < 0:
|
||||
return TrackerTargeterConfig{}, fmt.Errorf("%q (%f) < 0", DiskVdrAllocKey, vdrAlloc)
|
||||
case maxNonVdrUsage < 0:
|
||||
return TrackerTargeterConfig{}, fmt.Errorf("%q (%f) < 0", DiskMaxNonVdrUsageKey, maxNonVdrUsage)
|
||||
case maxNonVdrNodeUsage < 0:
|
||||
return TrackerTargeterConfig{}, fmt.Errorf("%q (%f) < 0", DiskMaxNonVdrNodeUsageKey, maxNonVdrNodeUsage)
|
||||
default:
|
||||
return TrackerTargeterConfig{
|
||||
VdrAlloc: vdrAlloc,
|
||||
MaxNonVdrUsage: maxNonVdrUsage,
|
||||
MaxNonVdrNodeUsage: maxNonVdrNodeUsage,
|
||||
}, nil
|
||||
}
|
||||
}
|
||||
|
||||
func getTraceConfig(v *viper.Viper) (trace.Config, error) {
|
||||
exporterTypeStr := v.GetString(TracingExporterTypeKey)
|
||||
exporterType, err := trace.ExporterTypeFromString(exporterTypeStr)
|
||||
|
||||
@@ -269,7 +269,6 @@ func DefaultConfig() Config {
|
||||
// ConfigBuilder enables fluent Config construction with validation.
|
||||
type ConfigBuilder struct {
|
||||
config Config
|
||||
errs []error
|
||||
}
|
||||
|
||||
// NewConfigBuilder creates a builder starting from defaults.
|
||||
|
||||
@@ -27,8 +27,6 @@ import (
|
||||
//
|
||||
// All execute on GPU in parallel using separate compute streams within one session.
|
||||
type GPUVerifyPipeline struct {
|
||||
mu sync.RWMutex
|
||||
|
||||
// Stats (atomic for lock-free reads)
|
||||
gpuVerifies uint64
|
||||
cpuVerifies uint64
|
||||
|
||||
@@ -106,15 +106,6 @@ func (m *mockQuantumSigner) SignMessage(msg []byte) ([]byte, error) {
|
||||
// Helper functions
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// generateIntegrationValidators creates n validators with random IDs
|
||||
func generateIntegrationValidators(n int) []ids.NodeID {
|
||||
validators := make([]ids.NodeID, n)
|
||||
for i := range validators {
|
||||
validators[i] = ids.GenerateTestNodeID()
|
||||
}
|
||||
return validators
|
||||
}
|
||||
|
||||
// generateValidatorStates creates n ValidatorState entries
|
||||
func generateValidatorStates(n int) []ValidatorState {
|
||||
states := make([]ValidatorState, n)
|
||||
|
||||
@@ -488,15 +488,6 @@ func (q *Quasar) collectCorona(message string) (Signature, error) {
|
||||
return sig, nil
|
||||
}
|
||||
|
||||
// createQuantumStampFallback creates a single-signer quantum stamp (fallback mode)
|
||||
func (q *Quasar) createQuantumStampFallback(msg []byte) ([]byte, error) {
|
||||
if q.quantumFallback == nil {
|
||||
// No fallback configured, return sentinel
|
||||
return []byte("PQ-FALLBACK"), nil
|
||||
}
|
||||
return q.quantumFallback.SignMessage(msg)
|
||||
}
|
||||
|
||||
// totalWeight calculates total validator weight
|
||||
func (q *Quasar) totalWeight(validators []ValidatorState) uint64 {
|
||||
var total uint64
|
||||
|
||||
@@ -30,10 +30,15 @@ import (
|
||||
"github.com/luxfi/node/vms/platformvm/signer"
|
||||
pchaintxs "github.com/luxfi/node/vms/platformvm/txs"
|
||||
"github.com/luxfi/node/vms/platformvm/validators/fee"
|
||||
"github.com/luxfi/utxo/bls12381fx"
|
||||
"github.com/luxfi/utxo/ed25519fx"
|
||||
"github.com/luxfi/utxo/mldsafx"
|
||||
"github.com/luxfi/utxo/nftfx"
|
||||
"github.com/luxfi/utxo/propertyfx"
|
||||
"github.com/luxfi/utxo/schnorrfx"
|
||||
"github.com/luxfi/utxo/secp256k1fx"
|
||||
"github.com/luxfi/utxo/secp256r1fx"
|
||||
"github.com/luxfi/utxo/slhdsafx"
|
||||
|
||||
genesiscfg "github.com/luxfi/genesis/pkg/genesis"
|
||||
genesisconfigs "github.com/luxfi/genesis/configs"
|
||||
@@ -90,6 +95,11 @@ var (
|
||||
nftfx.ID: {"nftfx"},
|
||||
propertyfx.ID: {"propertyfx"},
|
||||
mldsafx.ID: {"mldsafx"},
|
||||
slhdsafx.ID: {"slhdsafx"},
|
||||
ed25519fx.ID: {"ed25519fx"},
|
||||
secp256r1fx.ID: {"secp256r1fx"},
|
||||
schnorrfx.ID: {"schnorrfx"},
|
||||
bls12381fx.ID: {"bls12381fx"},
|
||||
}
|
||||
|
||||
errNoTxs = errors.New("genesis creates no transactions")
|
||||
@@ -595,6 +605,11 @@ func FromConfig(config *genesiscfg.Config) ([]byte, ids.ID, error) {
|
||||
nftfx.ID,
|
||||
propertyfx.ID,
|
||||
mldsafx.ID,
|
||||
slhdsafx.ID,
|
||||
ed25519fx.ID,
|
||||
secp256r1fx.ID,
|
||||
schnorrfx.ID,
|
||||
bls12381fx.ID,
|
||||
},
|
||||
Name: "X-Chain",
|
||||
})
|
||||
|
||||
@@ -28,7 +28,7 @@ require (
|
||||
github.com/jackpal/gateway v1.1.1
|
||||
github.com/jackpal/go-nat-pmp v1.0.2
|
||||
github.com/luxfi/consensus v1.22.84
|
||||
github.com/luxfi/crypto v1.17.55
|
||||
github.com/luxfi/crypto v1.17.56
|
||||
github.com/luxfi/database v1.18.1
|
||||
github.com/luxfi/ids v1.2.9
|
||||
github.com/luxfi/keychain v1.0.2
|
||||
@@ -36,7 +36,6 @@ require (
|
||||
github.com/luxfi/math v1.2.4
|
||||
github.com/luxfi/metric v1.5.1
|
||||
github.com/luxfi/mock v0.1.1
|
||||
github.com/mitchellh/mapstructure v1.5.0 // indirect
|
||||
github.com/mr-tron/base58 v1.2.0
|
||||
github.com/onsi/ginkgo/v2 v2.28.1
|
||||
github.com/pires/go-proxyproto v0.8.1
|
||||
@@ -65,7 +64,6 @@ require (
|
||||
golang.org/x/mod v0.34.0
|
||||
golang.org/x/net v0.52.0
|
||||
golang.org/x/sync v0.20.0
|
||||
golang.org/x/term v0.41.0
|
||||
golang.org/x/time v0.15.0
|
||||
golang.org/x/tools v0.43.0
|
||||
gonum.org/v1/gonum v0.17.0
|
||||
@@ -93,13 +91,11 @@ require (
|
||||
github.com/go-logr/logr v1.4.3 // indirect
|
||||
github.com/go-logr/stdr v1.2.2 // indirect
|
||||
github.com/go-ole/go-ole v1.3.0 // indirect
|
||||
github.com/gofrs/flock v0.13.0 // indirect
|
||||
github.com/gogo/protobuf v1.3.2 // indirect
|
||||
github.com/golang/snappy v1.0.0 // indirect
|
||||
github.com/gorilla/websocket v1.5.4-0.20250319132907-e064f32e3674
|
||||
github.com/grpc-ecosystem/grpc-gateway/v2 v2.28.0 // indirect
|
||||
github.com/hashicorp/golang-lru v1.0.2
|
||||
github.com/holiman/bloomfilter/v2 v2.0.3 // indirect
|
||||
github.com/hashicorp/golang-lru v1.0.2 // indirect
|
||||
github.com/inconshreveable/mousetrap v1.1.0 // indirect
|
||||
github.com/klauspost/compress v1.18.5
|
||||
github.com/kr/pretty v0.3.1 // indirect
|
||||
@@ -122,7 +118,6 @@ require (
|
||||
golang.org/x/sys v0.42.0 // indirect
|
||||
golang.org/x/text v0.35.0 // indirect
|
||||
google.golang.org/genproto/googleapis/api v0.0.0-20260217215200-42d3e9bedb6d // indirect
|
||||
gopkg.in/yaml.v2 v2.4.0 // indirect
|
||||
)
|
||||
|
||||
require (
|
||||
@@ -132,9 +127,19 @@ require (
|
||||
github.com/golang-jwt/jwt/v4 v4.5.2
|
||||
github.com/golang/mock v1.7.0-rc.1
|
||||
github.com/luxfi/accel v1.0.7
|
||||
github.com/luxfi/ai v0.1.0
|
||||
github.com/luxfi/api v1.0.4
|
||||
github.com/luxfi/atomic v1.0.0
|
||||
github.com/luxfi/chains/aivm v0.1.0
|
||||
github.com/luxfi/chains/bridgevm v0.1.0
|
||||
github.com/luxfi/chains/dexvm v0.1.0
|
||||
github.com/luxfi/chains/graphvm v0.1.0
|
||||
github.com/luxfi/chains/identityvm v0.1.0
|
||||
github.com/luxfi/chains/keyvm v0.1.0
|
||||
github.com/luxfi/chains/oraclevm v0.1.0
|
||||
github.com/luxfi/chains/quantumvm v0.1.0
|
||||
github.com/luxfi/chains/relayvm v0.1.0
|
||||
github.com/luxfi/chains/thresholdvm v0.1.0
|
||||
github.com/luxfi/chains/zkvm v0.1.0
|
||||
github.com/luxfi/compress v0.0.5
|
||||
github.com/luxfi/constants v1.4.7
|
||||
github.com/luxfi/container v0.0.4
|
||||
@@ -151,39 +156,31 @@ require (
|
||||
github.com/luxfi/runtime v1.0.1
|
||||
github.com/luxfi/sdk v1.16.52
|
||||
github.com/luxfi/sys v0.0.0-20260110090042-50187ec5ffd8
|
||||
github.com/luxfi/threshold v1.5.5
|
||||
github.com/luxfi/timer v1.0.2
|
||||
github.com/luxfi/units v1.0.0
|
||||
github.com/luxfi/utils v1.1.4
|
||||
github.com/luxfi/utxo v0.2.7
|
||||
github.com/luxfi/utxo v0.2.9
|
||||
github.com/luxfi/validators v1.0.0
|
||||
github.com/luxfi/vm v1.0.40
|
||||
github.com/luxfi/warp v1.18.5
|
||||
github.com/nbutton23/zxcvbn-go v0.0.0-20210217022336-fa2cb2858354
|
||||
github.com/spaolacci/murmur3 v1.1.0
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.39.0
|
||||
go.uber.org/zap v1.27.1
|
||||
)
|
||||
|
||||
require (
|
||||
filippo.io/hpke v0.4.0 // indirect
|
||||
github.com/btcsuite/btcd/btcec/v2 v2.3.6 // indirect
|
||||
github.com/btcsuite/btcd/chaincfg/chainhash v1.1.0 // indirect
|
||||
github.com/decred/dcrd/crypto/blake256 v1.1.0 // indirect
|
||||
github.com/go-ini/ini v1.67.0 // indirect
|
||||
github.com/goccy/go-yaml v1.19.2 // indirect
|
||||
github.com/hashicorp/go-bexpr v0.1.16 // indirect
|
||||
github.com/klauspost/crc32 v1.3.0 // indirect
|
||||
github.com/luxfi/age v1.4.0 // indirect
|
||||
github.com/luxfi/chains/aivm v0.1.0 // indirect
|
||||
github.com/luxfi/chains/bridgevm v0.1.0 // indirect
|
||||
github.com/luxfi/chains/dexvm v0.1.0 // indirect
|
||||
github.com/luxfi/chains/graphvm v0.1.0 // indirect
|
||||
github.com/luxfi/chains/identityvm v0.1.0 // indirect
|
||||
github.com/luxfi/chains/keyvm v0.1.0 // indirect
|
||||
github.com/luxfi/chains/oraclevm v0.1.0 // indirect
|
||||
github.com/luxfi/chains/quantumvm v0.1.0 // indirect
|
||||
github.com/luxfi/chains/relayvm v0.1.0 // indirect
|
||||
github.com/luxfi/chains/thresholdvm v0.1.0 // indirect
|
||||
github.com/luxfi/chains/zkvm v0.1.0 // indirect
|
||||
github.com/luxfi/ai v0.1.0 // indirect
|
||||
github.com/luxfi/staking v1.1.0 // indirect
|
||||
github.com/luxfi/threshold v1.5.5 // indirect
|
||||
github.com/luxfi/trace v0.1.4 // indirect
|
||||
github.com/luxfi/zapdb v1.8.0 // indirect
|
||||
github.com/minio/crc64nvme v1.1.1 // indirect
|
||||
@@ -213,11 +210,8 @@ require (
|
||||
github.com/cronokirby/saferith v0.33.0 // indirect
|
||||
github.com/dgraph-io/ristretto/v2 v2.4.0 // indirect
|
||||
github.com/dustin/go-humanize v1.0.1 // indirect
|
||||
github.com/emicklei/dot v1.11.0 // indirect
|
||||
github.com/ethereum/c-kzg-4844/v2 v2.1.7 // indirect
|
||||
github.com/ethereum/go-bigmodexpfix v0.0.0-20250911101455-f9e208c548ab // indirect
|
||||
github.com/ethereum/go-verkle v0.2.2 // indirect
|
||||
github.com/ferranbt/fastssz v1.0.0 // indirect
|
||||
github.com/fxamacker/cbor/v2 v2.9.0 // indirect
|
||||
github.com/go-task/slim-sprig/v3 v3.0.0 // indirect
|
||||
github.com/go-viper/mapstructure/v2 v2.5.0 // indirect
|
||||
@@ -237,7 +231,6 @@ require (
|
||||
github.com/luxfi/tls v1.0.3 // indirect
|
||||
github.com/mattn/go-colorable v0.1.14 // indirect
|
||||
github.com/mattn/go-isatty v0.0.20 // indirect
|
||||
github.com/minio/sha256-simd v1.0.1 // indirect
|
||||
github.com/montanaflynn/stats v0.8.2 // indirect
|
||||
github.com/sagikazarmark/locafero v0.12.0 // indirect
|
||||
github.com/stretchr/objx v0.5.3 // indirect
|
||||
|
||||
@@ -29,6 +29,8 @@ github.com/btcsuite/btcd v0.23.5-0.20231215221805-96c9fd8078fd/go.mod h1:nm3Bko6
|
||||
github.com/btcsuite/btcd v0.24.2/go.mod h1:5C8ChTkl5ejr3WHj8tkQSCmydiMEPB0ZhQhehpq7Dgg=
|
||||
github.com/btcsuite/btcd/btcec/v2 v2.1.0/go.mod h1:2VzYrv4Gm4apmbVVsSq5bqf1Ec8v56E48Vt0Y/umPgA=
|
||||
github.com/btcsuite/btcd/btcec/v2 v2.1.3/go.mod h1:ctjw4H1kknNJmRN4iP1R7bTQ+v3GJkZBd6mui8ZsAZE=
|
||||
github.com/btcsuite/btcd/btcec/v2 v2.3.6 h1:IzlsEr9olcSRKB/n7c4351F3xHKxS2lma+1UFGCYd4E=
|
||||
github.com/btcsuite/btcd/btcec/v2 v2.3.6/go.mod h1:m22FrOAiuxl/tht9wIqAoGHcbnCCaPWyauO8y2LGGtQ=
|
||||
github.com/btcsuite/btcd/btcutil v1.0.0/go.mod h1:Uoxwv0pqYWhD//tfTiipkxNfdhG9UrLwaeswfjfdF0A=
|
||||
github.com/btcsuite/btcd/btcutil v1.1.0/go.mod h1:5OapHB7A2hBBWLm48mmw4MOHNJCcUBTwmWH/0Jn8VHE=
|
||||
github.com/btcsuite/btcd/btcutil v1.1.5/go.mod h1:PSZZ4UitpLBWzxGd5VGOrLnmOjtPP/a6HaFo12zMs00=
|
||||
@@ -36,6 +38,7 @@ github.com/btcsuite/btcd/btcutil v1.1.6 h1:zFL2+c3Lb9gEgqKNzowKUPQNb8jV7v5Oaodi/
|
||||
github.com/btcsuite/btcd/btcutil v1.1.6/go.mod h1:9dFymx8HpuLqBnsPELrImQeTQfKBQqzqGbbV3jK55aE=
|
||||
github.com/btcsuite/btcd/chaincfg/chainhash v1.0.0/go.mod h1:7SFka0XMvUgj3hfZtydOrQY2mwhPclbT2snogU7SQQc=
|
||||
github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1/go.mod h1:7SFka0XMvUgj3hfZtydOrQY2mwhPclbT2snogU7SQQc=
|
||||
github.com/btcsuite/btcd/chaincfg/chainhash v1.1.0 h1:59Kx4K6lzOW5w6nFlA0v5+lk/6sjybR934QNHSJZPTQ=
|
||||
github.com/btcsuite/btcd/chaincfg/chainhash v1.1.0/go.mod h1:7SFka0XMvUgj3hfZtydOrQY2mwhPclbT2snogU7SQQc=
|
||||
github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA=
|
||||
github.com/btcsuite/btcutil v0.0.0-20190425235716-9e5f4b9a998d/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg=
|
||||
@@ -186,8 +189,6 @@ github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/
|
||||
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
|
||||
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
|
||||
github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0=
|
||||
github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
||||
github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
|
||||
github.com/google/pprof v0.0.0-20260302011040-a15ffb7f9dcc h1:VBbFa1lDYWEeV5FZKUiYKYT0VxCp9twUmmaq9eb8sXw=
|
||||
github.com/google/pprof v0.0.0-20260302011040-a15ffb7f9dcc/go.mod h1:MxpfABSjhmINe3F1It9d+8exIHFvUqtLIRCdOGNXqiI=
|
||||
@@ -299,6 +300,8 @@ github.com/luxfi/container v0.0.4 h1:BXhF82WyfqVP5mjlNcr7tP0Fcnvl0Ap1rkiu+rq5XuM
|
||||
github.com/luxfi/container v0.0.4/go.mod h1:Z3SpmMF5d4t77MM0nHYXURpn+EMVaeu1fhbd/3BGaek=
|
||||
github.com/luxfi/crypto v1.17.55 h1:D3FqoN4a5vAxag8gexR4uEp6NLQk2FyX+XT1FEtBSd4=
|
||||
github.com/luxfi/crypto v1.17.55/go.mod h1:GnAkhQ7HNs3X0Tzx5nOONS3kl0yRmWHbDcRO5ffILsg=
|
||||
github.com/luxfi/crypto v1.17.56 h1:k7eOZtJSpXJRuxzwqjtCoaw2N3i7dYPBFpjmx9vS+Uk=
|
||||
github.com/luxfi/crypto v1.17.56/go.mod h1:trloMo4znuc3gp8IjYx8uIna3e4pDpaWI1y2YDeMbNo=
|
||||
github.com/luxfi/database v1.18.1 h1:Bvovo6MW3XSdUd1DkGNluB2tyvyiT/+N5d3QVwtoNo8=
|
||||
github.com/luxfi/database v1.18.1/go.mod h1:PW0oGujt165mYg7j/lctVbnfsUW6QLfIAgjyQdS66SM=
|
||||
github.com/luxfi/filesystem v0.0.1 h1:VZ6xMFKaAPBW/ddlMsDnI2G0VU1lV5rYaVcW5d+KwEY=
|
||||
@@ -369,10 +372,10 @@ github.com/luxfi/upgrade v1.0.0 h1:mM6YXvU8VzoclA7IdtuE5bmnMuFquYxjKUUW84LJz54=
|
||||
github.com/luxfi/upgrade v1.0.0/go.mod h1:DZF7dO4erhUEKf907B2e65k4/vGkCPkUngpvIEUS3eI=
|
||||
github.com/luxfi/utils v1.1.4 h1:8OY0jXCkpp6OotN1Y++6DATJkvtEwzq2k0p56imJlAk=
|
||||
github.com/luxfi/utils v1.1.4/go.mod h1:c3yz1RjzrB+cs5GZm+q1T3/2cCKElO9vxm9yRRtgSEM=
|
||||
github.com/luxfi/utxo v0.2.6 h1:3iICLel6+v4Q6Bhnyppd6VFw43Kk862SDDfgzOhjJR4=
|
||||
github.com/luxfi/utxo v0.2.6/go.mod h1:lRA7XK1ree1xs8qBZKnSSHxZMBadOEsqhZOqxnOpgcw=
|
||||
github.com/luxfi/utxo v0.2.7 h1:gJn/ojwVJWlmakAS4L61ljhepUSF5I+2nGewOJW2fAI=
|
||||
github.com/luxfi/utxo v0.2.7/go.mod h1:lRA7XK1ree1xs8qBZKnSSHxZMBadOEsqhZOqxnOpgcw=
|
||||
github.com/luxfi/utxo v0.2.8 h1:+uGBHsuqdGW8hq50HfNvAzy/KS32EPWYK9ODjjzXW8Q=
|
||||
github.com/luxfi/utxo v0.2.8/go.mod h1:lRA7XK1ree1xs8qBZKnSSHxZMBadOEsqhZOqxnOpgcw=
|
||||
github.com/luxfi/utxo v0.2.9 h1:oaTE4JoBZFWkbuxAB3Q/wEak27riikN719IMC26NxGI=
|
||||
github.com/luxfi/utxo v0.2.9/go.mod h1:pTd21USbVfCmeudLWoRq5SCqrqkLdC/E8SGf/rHMEg4=
|
||||
github.com/luxfi/validators v1.0.0 h1:zE1HJM1lfvC+v1Lalg+MUgkKBGFWnwTfOOmXraiNnpE=
|
||||
github.com/luxfi/validators v1.0.0/go.mod h1:QGppjtI/gqprbplWc10J+4OIK8UYWpv+53mfH2aKhy4=
|
||||
github.com/luxfi/version v1.0.1 h1:T/1KYWEMmsrNQk7pN7PFPAwh/7XbeX7cFAKLBqI37Sk=
|
||||
@@ -465,8 +468,6 @@ github.com/prometheus/common v0.67.5 h1:pIgK94WWlQt1WLwAC5j2ynLaBRDiinoAb86HZHTU
|
||||
github.com/prometheus/common v0.67.5/go.mod h1:SjE/0MzDEEAyrdr5Gqc6G+sXI67maCxzaT3A2+HqjUw=
|
||||
github.com/prometheus/procfs v0.20.1 h1:XwbrGOIplXW/AU3YhIhLODXMJYyC1isLFfYCsTEycfc=
|
||||
github.com/prometheus/procfs v0.20.1/go.mod h1:o9EMBZGRyvDrSPH1RqdxhojkuXstoe4UlK79eF5TGGo=
|
||||
github.com/prysmaticlabs/gohashtree v0.0.4-beta h1:H/EbCuXPeTV3lpKeXGPpEV9gsUpkqOOVnWapUyeWro4=
|
||||
github.com/prysmaticlabs/gohashtree v0.0.4-beta/go.mod h1:BFdtALS+Ffhg3lGQIHv9HDWuHS8cTvHZzrHWxwOtGOs=
|
||||
github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs=
|
||||
github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ=
|
||||
github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc=
|
||||
@@ -482,8 +483,6 @@ github.com/sanity-io/litter v1.5.5 h1:iE+sBxPBzoK6uaEP5Lt3fHNgpKcHXc/A2HGETy0uJQ
|
||||
github.com/sanity-io/litter v1.5.5/go.mod h1:9gzJgR2i4ZpjZHsKvUXIRQVk7P+yM3e+jAF7bU2UI5U=
|
||||
github.com/shirou/gopsutil v3.21.11+incompatible h1:+1+c1VGhc88SSonWP6foOcLhvnKlUeu/erjjvaPEYiI=
|
||||
github.com/shirou/gopsutil v3.21.11+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA=
|
||||
github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI=
|
||||
github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA=
|
||||
github.com/spf13/afero v1.15.0 h1:b/YBCLWAJdFWJTN9cLhiXXcD7mzKn9Dm86dNnfyQw1I=
|
||||
github.com/spf13/afero v1.15.0/go.mod h1:NC2ByUVxtQs4b3sIUphxK0NioZnmxgyCrfzeuq8lxMg=
|
||||
github.com/spf13/cast v1.10.0 h1:h2x0u2shc1QuLHfxi+cTJvs30+ZAHOGRic8uyGTDWxY=
|
||||
@@ -646,8 +645,6 @@ golang.org/x/sys v0.42.0 h1:omrd2nAlyT5ESRdCLYdm3+fMfNFE/+Rf4bDIQImRJeo=
|
||||
golang.org/x/sys v0.42.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw=
|
||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
|
||||
golang.org/x/term v0.41.0 h1:QCgPso/Q3RTJx2Th4bDLqML4W6iJiaXFq2/ftQF13YU=
|
||||
golang.org/x/term v0.41.0/go.mod h1:3pfBgksrReYfZ5lvYM0kSO0LIkAl4Yl2bXOkKP7Ec2A=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
|
||||
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||
|
||||
@@ -7,7 +7,6 @@ import (
|
||||
"encoding/binary"
|
||||
"errors"
|
||||
"io"
|
||||
"sync"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -43,12 +42,6 @@ var (
|
||||
ErrInvalidMessage = errors.New("invalid wire message")
|
||||
ErrUnknownTag = errors.New("unknown message tag")
|
||||
|
||||
bufPool = sync.Pool{
|
||||
New: func() interface{} {
|
||||
b := make([]byte, 64*1024)
|
||||
return &b
|
||||
},
|
||||
}
|
||||
)
|
||||
|
||||
// Buffer for zero-copy encoding
|
||||
|
||||
@@ -6,13 +6,10 @@
|
||||
package nat
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"net/netip"
|
||||
"time"
|
||||
)
|
||||
|
||||
var errInvalidLifetime = errors.New("invalid mapping duration range")
|
||||
|
||||
// getPMPRouter returns nil in minimal build (no NAT-PMP support).
|
||||
// Build with -tags=nattraversal for NAT-PMP support.
|
||||
func getPMPRouter() *pmpRouter {
|
||||
|
||||
-10
@@ -49,16 +49,6 @@ type Net interface {
|
||||
Allower
|
||||
}
|
||||
|
||||
type net struct {
|
||||
lock sync.RWMutex
|
||||
bootstrapping set.Set[ids.ID]
|
||||
bootstrapped set.Set[ids.ID]
|
||||
once sync.Once
|
||||
bootstrappedSema chan struct{}
|
||||
config Config
|
||||
myNodeID ids.NodeID
|
||||
}
|
||||
|
||||
func New(myNodeID ids.NodeID, config Config) Net {
|
||||
return &chain{
|
||||
bootstrapping: make(set.Set[ids.ID]),
|
||||
|
||||
@@ -1,43 +0,0 @@
|
||||
// Copyright (C) 2019-2025, Lux Industries Inc. All rights reserved.
|
||||
// See the file LICENSE for licensing terms.
|
||||
|
||||
package network
|
||||
|
||||
import (
|
||||
"crypto/tls"
|
||||
"sync"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/luxfi/ids"
|
||||
"github.com/luxfi/node/network/peer"
|
||||
"github.com/luxfi/node/staking"
|
||||
)
|
||||
|
||||
var (
|
||||
certLock sync.Mutex
|
||||
tlsCerts []*tls.Certificate
|
||||
tlsConfigs []*tls.Config
|
||||
)
|
||||
|
||||
func getTLS(t *testing.T, index int) (ids.NodeID, *tls.Certificate, *tls.Config) {
|
||||
certLock.Lock()
|
||||
defer certLock.Unlock()
|
||||
|
||||
for len(tlsCerts) <= index {
|
||||
cert, err := staking.NewTLSCert()
|
||||
require.NoError(t, err)
|
||||
tlsConfig := peer.TLSConfig(*cert, nil)
|
||||
|
||||
tlsCerts = append(tlsCerts, cert)
|
||||
tlsConfigs = append(tlsConfigs, tlsConfig)
|
||||
}
|
||||
|
||||
tlsCert := tlsCerts[index]
|
||||
nodeID := ids.NodeIDFromCert(&ids.Certificate{
|
||||
Raw: tlsCert.Leaf.Raw,
|
||||
PublicKey: tlsCert.Leaf.PublicKey,
|
||||
})
|
||||
return nodeID, tlsCert, tlsConfigs[index]
|
||||
}
|
||||
@@ -631,7 +631,6 @@ type RNSAnnouncer struct {
|
||||
table map[[endpoints.RNSDestinationLen]byte]*AnnounceEntry
|
||||
handlers []func(dest [endpoints.RNSDestinationLen]byte, entry *AnnounceEntry)
|
||||
gatewayAddr string
|
||||
listener net.Listener
|
||||
}
|
||||
|
||||
// RNSAnnouncerConfig configures the RNS announcer.
|
||||
|
||||
@@ -31,8 +31,6 @@ const (
|
||||
mldsaPublicKeySize = mldsa.MLDSA65PublicKeySize // ~1952 bytes
|
||||
mldsaSignatureSize = mldsa.MLDSA65SignatureSize // ~3309 bytes
|
||||
|
||||
// Hybrid signature size: Ed25519 (64) + ML-DSA-65 (~3309)
|
||||
hybridSignatureSize = ed25519SignatureSize + mldsaSignatureSize
|
||||
)
|
||||
|
||||
var (
|
||||
|
||||
@@ -81,8 +81,7 @@ type RNSLink struct {
|
||||
|
||||
// Peer information
|
||||
peerDestination [endpoints.RNSDestinationLen]byte
|
||||
peerSigningKey [32]byte
|
||||
peerExchangeKey [32]byte
|
||||
peerSigningKey [32]byte
|
||||
|
||||
// Hybrid peer information (nil if peer is classical-only)
|
||||
peerHybridIdentity *HybridPublicIdentity
|
||||
|
||||
@@ -172,17 +172,6 @@ func newDefaultResourceTracker() tracker.ResourceTracker {
|
||||
|
||||
// noOpConsensusResourceTracker is defined in test_network.go to avoid duplication
|
||||
|
||||
// noOpTracker implements tracker.CPUTracker and tracker.Tracker for testing
|
||||
type noOpTracker struct{}
|
||||
|
||||
func (n *noOpTracker) Usage(nodeID ids.NodeID, t time.Time) float64 {
|
||||
return 0
|
||||
}
|
||||
|
||||
func (n *noOpTracker) TimeUntilUsage(nodeID ids.NodeID, t time.Time, usage float64) time.Duration {
|
||||
return time.Hour
|
||||
}
|
||||
|
||||
func newTestNetwork(t *testing.T, count int) (*testDialer, []*testListener, []ids.NodeID, []*Config) {
|
||||
var (
|
||||
dialer = newTestDialer()
|
||||
|
||||
@@ -375,7 +375,3 @@ type testRouter struct{}
|
||||
|
||||
func (r *testRouter) HandleInbound(context.Context, message.InboundMessage) {}
|
||||
|
||||
// newTestResourceTracker returns a new test resource tracker
|
||||
func newTestResourceTracker() *testResourceTracker {
|
||||
return &testResourceTracker{}
|
||||
}
|
||||
|
||||
@@ -44,16 +44,6 @@ type rawTestPeer struct {
|
||||
inboundMsgChan <-chan message.InboundMessage
|
||||
}
|
||||
|
||||
// noOpResourceManager implements resource.Manager for testing
|
||||
type noOpResourceManager struct{}
|
||||
|
||||
func (n *noOpResourceManager) CPUUsage() float64 { return 0 }
|
||||
func (n *noOpResourceManager) DiskUsage() float64 { return 0 }
|
||||
func (n *noOpResourceManager) AvailableDiskBytes() uint64 { return 1 << 62 }
|
||||
func (n *noOpResourceManager) TrackProcess(pid int) {}
|
||||
func (n *noOpResourceManager) UntrackProcess(pid int) {}
|
||||
func (n *noOpResourceManager) Shutdown() {}
|
||||
|
||||
// noOpTracker implements tracker.Tracker for testing
|
||||
type noOpTracker struct{}
|
||||
|
||||
|
||||
@@ -153,41 +153,6 @@ func StartTestPeer(
|
||||
return peer, peer.AwaitReady(ctx)
|
||||
}
|
||||
|
||||
// testResourceTracker is a minimal implementation for testing
|
||||
type testResourceTracker struct{}
|
||||
|
||||
func (t *testResourceTracker) CPUTracker() tracker.Tracker {
|
||||
return &testCPUTracker{}
|
||||
}
|
||||
|
||||
func (t *testResourceTracker) DiskTracker() tracker.Tracker {
|
||||
return &testDiskTracker{}
|
||||
}
|
||||
|
||||
func (t *testResourceTracker) StartProcessing(ids.NodeID, time.Time) {}
|
||||
func (t *testResourceTracker) StopProcessing(ids.NodeID, time.Time) {}
|
||||
|
||||
// testCPUTracker is a minimal CPU tracker implementation
|
||||
type testCPUTracker struct{}
|
||||
|
||||
func (t *testCPUTracker) Usage(ids.NodeID, time.Time) float64 { return 0 }
|
||||
func (t *testCPUTracker) TimeUntilUsage(ids.NodeID, time.Time, float64) time.Duration { return 0 }
|
||||
func (t *testCPUTracker) TotalUsage() float64 { return 0 }
|
||||
|
||||
// testTracker is a minimal tracker implementation
|
||||
type testTracker struct{}
|
||||
|
||||
func (t *testTracker) UtilizationTarget() float64 { return 0.8 }
|
||||
func (t *testTracker) CurrentUsage() uint64 { return 0 }
|
||||
func (t *testTracker) TotalUsage() float64 { return 0 }
|
||||
func (t *testTracker) Usage(ids.NodeID, time.Time) float64 { return 0 }
|
||||
func (t *testTracker) TimeUntilUsage(ids.NodeID, time.Time, float64) time.Duration { return 0 }
|
||||
|
||||
// testDiskTracker is a minimal disk tracker implementation
|
||||
type testDiskTracker struct{ testTracker }
|
||||
|
||||
func (t *testDiskTracker) AvailableDiskBytes() uint64 { return 1 << 30 } // 1GB
|
||||
|
||||
// testValidatorManager is a minimal validator manager implementation for testing
|
||||
type testValidatorManager struct{}
|
||||
|
||||
|
||||
@@ -20,12 +20,10 @@ import (
|
||||
validators "github.com/luxfi/validators"
|
||||
"github.com/luxfi/validators/uptime"
|
||||
"github.com/luxfi/constants"
|
||||
"github.com/luxfi/crypto/bls"
|
||||
"github.com/luxfi/crypto/bls/signer/localsigner"
|
||||
"github.com/luxfi/ids"
|
||||
"github.com/luxfi/log"
|
||||
"github.com/luxfi/math/set"
|
||||
consensusset "github.com/luxfi/math/set"
|
||||
"github.com/luxfi/node/message"
|
||||
"github.com/luxfi/node/nets"
|
||||
"github.com/luxfi/node/network/dialer"
|
||||
@@ -231,21 +229,10 @@ type nodeIDConnector struct {
|
||||
nodeID ids.NodeID
|
||||
}
|
||||
|
||||
func newNodeIDConnector(nodeID ids.NodeID) *nodeIDConnector {
|
||||
return &nodeIDConnector{nodeID: nodeID}
|
||||
}
|
||||
|
||||
func (f *nodeIDConnector) IsAllowed(nodeID ids.NodeID, _ bool) bool {
|
||||
return nodeID == f.nodeID
|
||||
}
|
||||
|
||||
// noOpResourceManager is a no-op resource manager for testing
|
||||
type noOpResourceManager struct{}
|
||||
|
||||
func (n *noOpResourceManager) CPUUsage() float64 { return 0 }
|
||||
func (n *noOpResourceManager) DiskUsage() float64 { return 0 }
|
||||
func (n *noOpResourceManager) Shutdown() {}
|
||||
|
||||
// noOpConsensusResourceTracker implements consensus ResourceTracker for testing
|
||||
type noOpConsensusResourceTracker struct{}
|
||||
|
||||
@@ -276,93 +263,3 @@ func (n *noOpConsensusDiskTracker) TimeUntilUsage(nodeID ids.NodeID, now time.Ti
|
||||
}
|
||||
func (n *noOpConsensusDiskTracker) TotalUsage() float64 { return 0 }
|
||||
|
||||
// noOpTargeter is a no-op targeter for testing
|
||||
type noOpTargeter struct {
|
||||
target uint64
|
||||
}
|
||||
|
||||
func (n *noOpTargeter) TargetUsage() uint64 { return n.target }
|
||||
|
||||
// noOpResourceTracker is a no-op resource tracker for testing that implements consensus ResourceTracker
|
||||
type noOpResourceTracker struct{}
|
||||
|
||||
func (n *noOpResourceTracker) StartProcessing(nodeID ids.NodeID, time time.Time) {}
|
||||
func (n *noOpResourceTracker) StopProcessing(nodeID ids.NodeID, time time.Time) {}
|
||||
func (n *noOpResourceTracker) CPUTracker() tracker.Tracker { return &noOpCPUTracker{} }
|
||||
func (n *noOpResourceTracker) DiskTracker() tracker.Tracker { return &noOpDiskTracker{} }
|
||||
|
||||
// noOpCPUTracker is a no-op CPU tracker
|
||||
type noOpCPUTracker struct{}
|
||||
|
||||
func (n *noOpCPUTracker) Usage(nodeID ids.NodeID, now time.Time) float64 { return 0 }
|
||||
func (n *noOpCPUTracker) TimeUntilUsage(nodeID ids.NodeID, now time.Time, value float64) time.Duration {
|
||||
return time.Duration(0)
|
||||
}
|
||||
func (n *noOpCPUTracker) TotalUsage() float64 { return 0 }
|
||||
|
||||
// noOpDiskTracker is a no-op disk tracker
|
||||
type noOpDiskTracker struct{}
|
||||
|
||||
func (n *noOpDiskTracker) Usage(nodeID ids.NodeID, now time.Time) float64 { return 0 }
|
||||
func (n *noOpDiskTracker) TimeUntilUsage(nodeID ids.NodeID, now time.Time, value float64) time.Duration {
|
||||
return time.Duration(0)
|
||||
}
|
||||
func (n *noOpDiskTracker) TotalUsage() float64 { return 0 }
|
||||
|
||||
// noOpValidatorsManager is a no-op validators manager for testing
|
||||
type noOpValidatorsManager struct{}
|
||||
|
||||
func (n *noOpValidatorsManager) GetValidators(netID ids.ID) (validators.Set, error) {
|
||||
return &noOpValidatorSet{}, nil
|
||||
}
|
||||
func (n *noOpValidatorsManager) GetValidator(netID ids.ID, nodeID ids.NodeID) (*validators.GetValidatorOutput, bool) {
|
||||
return nil, false
|
||||
}
|
||||
func (n *noOpValidatorsManager) GetLight(netID ids.ID, nodeID ids.NodeID) uint64 { return 0 }
|
||||
func (n *noOpValidatorsManager) GetWeight(netID ids.ID, nodeID ids.NodeID) uint64 { return 0 }
|
||||
func (n *noOpValidatorsManager) TotalLight(netID ids.ID) (uint64, error) { return 0, nil }
|
||||
func (n *noOpValidatorsManager) TotalWeight(netID ids.ID) (uint64, error) { return 0, nil }
|
||||
func (n *noOpValidatorsManager) AddStaker(netID ids.ID, nodeID ids.NodeID, pk *bls.PublicKey, txID ids.ID, weight uint64) error {
|
||||
return nil
|
||||
}
|
||||
func (n *noOpValidatorsManager) AddWeight(netID ids.ID, nodeID ids.NodeID, weight uint64) error {
|
||||
return nil
|
||||
}
|
||||
func (n *noOpValidatorsManager) RemoveWeight(netID ids.ID, nodeID ids.NodeID, weight uint64) error {
|
||||
return nil
|
||||
}
|
||||
func (n *noOpValidatorsManager) GetMap(netID ids.ID) map[ids.NodeID]*validators.GetValidatorOutput {
|
||||
return nil
|
||||
}
|
||||
func (n *noOpValidatorsManager) GetValidatorIDs(netID ids.ID) []ids.NodeID { return nil }
|
||||
func (n *noOpValidatorsManager) NumValidators(netID ids.ID) int { return 0 }
|
||||
func (n *noOpValidatorsManager) NumNets() int { return 0 }
|
||||
func (n *noOpValidatorsManager) SubsetWeight(netID ids.ID, nodeIDs consensusset.Set[ids.NodeID]) (uint64, error) {
|
||||
return 0, nil
|
||||
}
|
||||
func (n *noOpValidatorsManager) Sample(netID ids.ID, size int) ([]ids.NodeID, error) { return nil, nil }
|
||||
func (n *noOpValidatorsManager) Count(netID ids.ID) int { return 0 }
|
||||
func (n *noOpValidatorsManager) RegisterCallbackListener(listener validators.ManagerCallbackListener) {
|
||||
}
|
||||
func (n *noOpValidatorsManager) RegisterSetCallbackListener(netID ids.ID, listener validators.SetCallbackListener) {
|
||||
}
|
||||
|
||||
// noOpValidatorSet is a no-op validator set for testing
|
||||
type noOpValidatorSet struct{}
|
||||
|
||||
func (n *noOpValidatorSet) Has(ids.NodeID) bool { return false }
|
||||
func (n *noOpValidatorSet) Len() int { return 0 }
|
||||
func (n *noOpValidatorSet) List() []validators.Validator { return nil }
|
||||
func (n *noOpValidatorSet) Light() uint64 { return 0 }
|
||||
func (n *noOpValidatorSet) Sample(size int) ([]ids.NodeID, error) { return nil, nil }
|
||||
|
||||
// noOpMetricsFactory is a no-op metrics factory for testing
|
||||
type noOpMetricsFactory struct{}
|
||||
|
||||
func (n *noOpMetricsFactory) New(string) metric.Metrics {
|
||||
return metric.NewNoOp()
|
||||
}
|
||||
|
||||
func (n *noOpMetricsFactory) NewWithRegistry(string, metric.Registry) metric.Metrics {
|
||||
return metric.NewNoOp()
|
||||
}
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
package tracker
|
||||
|
||||
import (
|
||||
"sync"
|
||||
"sync/atomic"
|
||||
)
|
||||
|
||||
@@ -42,7 +41,6 @@ type TargeterConfig struct {
|
||||
|
||||
type targeterImpl struct {
|
||||
targetUsage uint64
|
||||
mu sync.RWMutex
|
||||
}
|
||||
|
||||
func (t *targeterImpl) TargetUsage() uint64 {
|
||||
|
||||
@@ -12,7 +12,6 @@ import (
|
||||
"github.com/luxfi/ids"
|
||||
"github.com/luxfi/log"
|
||||
"github.com/luxfi/math/set"
|
||||
metric "github.com/luxfi/metric"
|
||||
"github.com/luxfi/node/message"
|
||||
"github.com/luxfi/node/proto/p2p"
|
||||
"github.com/luxfi/node/version"
|
||||
@@ -28,14 +27,9 @@ type chainRouter struct {
|
||||
timeoutManager timer.AdaptiveTimeoutManager
|
||||
nodeID ids.NodeID
|
||||
healthConfig HealthConfig
|
||||
reg metric.Registerer
|
||||
namespace string
|
||||
criticalChains set.Set[ids.ID]
|
||||
lastMsgTime time.Time
|
||||
connectedPeers set.Set[ids.NodeID]
|
||||
requests map[uint32]*requestInfo
|
||||
requestID uint32
|
||||
onFatal func(int)
|
||||
}
|
||||
|
||||
type requestInfo struct {
|
||||
|
||||
@@ -323,9 +323,6 @@ type Node struct {
|
||||
// Storage for this node
|
||||
DB database.Database
|
||||
|
||||
// stopReplicator stops streaming DB replication (set by initDatabase if configured)
|
||||
stopReplicator func()
|
||||
|
||||
router nat.Router
|
||||
portMapper *nat.Mapper
|
||||
ipUpdater dynamicip.Updater
|
||||
|
||||
@@ -7,7 +7,6 @@ import (
|
||||
"encoding/binary"
|
||||
"errors"
|
||||
"io"
|
||||
"sync"
|
||||
)
|
||||
|
||||
// Message tags for ZAP encoding
|
||||
@@ -44,12 +43,6 @@ var (
|
||||
ErrInvalidMessage = errors.New("invalid wire message")
|
||||
ErrUnknownTag = errors.New("unknown message tag")
|
||||
|
||||
bufPool = sync.Pool{
|
||||
New: func() interface{} {
|
||||
b := make([]byte, 64*1024)
|
||||
return &b
|
||||
},
|
||||
}
|
||||
)
|
||||
|
||||
// Buffer for zero-copy encoding
|
||||
|
||||
@@ -4,9 +4,6 @@
|
||||
package server
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/luxfi/metric"
|
||||
)
|
||||
|
||||
@@ -36,21 +33,3 @@ func newMetrics(registerer metric.Registerer) (*serverMetrics, error) {
|
||||
return m, nil
|
||||
}
|
||||
|
||||
func (m *serverMetrics) wrapHandler(chainName string, handler http.Handler) http.Handler {
|
||||
// Instrument handler with metrics
|
||||
// Note: We wrap with basic instrumentation. For more advanced currying,
|
||||
// access the underlying metric types directly.
|
||||
handler = http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
m.requests.WithLabelValues(r.Method, chainName).Inc()
|
||||
m.inflight.Inc()
|
||||
defer m.inflight.Dec()
|
||||
|
||||
start := time.Now()
|
||||
defer func() {
|
||||
m.duration.WithLabelValues(r.Method, chainName).Observe(time.Since(start).Seconds())
|
||||
}()
|
||||
|
||||
handler.ServeHTTP(w, r)
|
||||
})
|
||||
return handler
|
||||
}
|
||||
|
||||
@@ -9,7 +9,6 @@ import (
|
||||
"net"
|
||||
"net/http"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/rs/cors"
|
||||
@@ -89,9 +88,6 @@ type server struct {
|
||||
// Maps endpoints to handlers
|
||||
router *router
|
||||
|
||||
// Mutex for thread-safe operations
|
||||
lock sync.RWMutex
|
||||
|
||||
srv *http.Server
|
||||
|
||||
// Listener used to serve traffic
|
||||
@@ -156,25 +152,6 @@ func (s *server) RegisterChain(chainName string, rt *runtime.Runtime, vm vm.VM)
|
||||
)
|
||||
}
|
||||
|
||||
func (s *server) addChainRoute(chainName string, handler http.Handler, rt *runtime.Runtime, base, endpoint string) error {
|
||||
url := fmt.Sprintf("%s/%s", baseURL, base)
|
||||
s.log.Info("adding route",
|
||||
log.UserString("url", url),
|
||||
log.UserString("endpoint", endpoint),
|
||||
)
|
||||
handler = s.wrapMiddleware(chainName, handler, rt)
|
||||
return s.router.AddRouter(url, endpoint, handler)
|
||||
}
|
||||
|
||||
func (s *server) wrapMiddleware(chainName string, handler http.Handler, rt *runtime.Runtime) http.Handler {
|
||||
if s.tracingEnabled {
|
||||
handler = TraceHandler(handler, chainName, s.tracer)
|
||||
}
|
||||
// Apply middleware to reject calls to the handler before the chain finishes bootstrapping
|
||||
handler = rejectMiddleware(handler, rt)
|
||||
return s.metrics.wrapHandler(chainName, handler)
|
||||
}
|
||||
|
||||
func (s *server) AddRoute(handler http.Handler, base, endpoint string) error {
|
||||
return s.addRoute(handler, base, endpoint)
|
||||
}
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
// Copyright (C) 2019-2025, Lux Industries Inc. All rights reserved.
|
||||
// See the file LICENSE for licensing terms.
|
||||
|
||||
package health
|
||||
|
||||
import "github.com/luxfi/metric"
|
||||
|
||||
type healthMetrics struct {
|
||||
// failingChecks keeps track of the number of check failing
|
||||
failingChecks metric.GaugeVec
|
||||
}
|
||||
|
||||
func newMetrics(namespace string, registry metric.Registry) (*healthMetrics, error) {
|
||||
metricsInstance := metric.NewWithRegistry(namespace, registry)
|
||||
|
||||
m := &healthMetrics{
|
||||
failingChecks: metricsInstance.NewGaugeVec(
|
||||
"checks_failing",
|
||||
"number of currently failing health checks",
|
||||
[]string{"tag"},
|
||||
),
|
||||
}
|
||||
m.failingChecks.WithLabelValues(AllTag).Set(0)
|
||||
m.failingChecks.WithLabelValues(ApplicationTag).Set(0)
|
||||
return m, nil
|
||||
}
|
||||
@@ -45,13 +45,6 @@ var (
|
||||
AddNetworkValidatorFee: apitypes.Uint64(constants.MilliLux),
|
||||
AddNetworkDelegatorFee: apitypes.Uint64(constants.MilliLux),
|
||||
}
|
||||
fujiGetTxFeeResponse = apiinfo.GetTxFeeResponse{
|
||||
CreateNetworkTxFee: apitypes.Uint64(100 * constants.MilliLux),
|
||||
TransformChainTxFee: apitypes.Uint64(1 * constants.Lux),
|
||||
CreateChainTxFee: apitypes.Uint64(100 * constants.MilliLux),
|
||||
AddNetworkValidatorFee: apitypes.Uint64(constants.MilliLux),
|
||||
AddNetworkDelegatorFee: apitypes.Uint64(constants.MilliLux),
|
||||
}
|
||||
defaultGetTxFeeResponse = apiinfo.GetTxFeeResponse{
|
||||
CreateNetworkTxFee: apitypes.Uint64(100 * constants.MilliLux),
|
||||
TransformChainTxFee: apitypes.Uint64(100 * constants.MilliLux),
|
||||
|
||||
@@ -5,11 +5,6 @@ package metrics
|
||||
|
||||
import "github.com/luxfi/metric"
|
||||
|
||||
var counterOpts = metric.CounterOpts{
|
||||
Name: "counter",
|
||||
Help: "help",
|
||||
}
|
||||
|
||||
type testGatherer struct {
|
||||
mfs []*metric.MetricFamily
|
||||
err error
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
// Copyright (C) 2019-2025, Lux Industries Inc. All rights reserved.
|
||||
// See the file LICENSE for licensing terms.
|
||||
|
||||
package metrics
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/luxfi/metric"
|
||||
)
|
||||
|
||||
type testGathererWithContext struct {
|
||||
mfs []*metric.MetricFamily
|
||||
}
|
||||
|
||||
func (g *testGathererWithContext) Gather(context.Context) ([]*metric.MetricFamily, error) {
|
||||
return g.mfs, nil
|
||||
}
|
||||
@@ -123,19 +123,6 @@ func (v *testValidator) toValidatorState() quasar.ValidatorState {
|
||||
}
|
||||
}
|
||||
|
||||
// signRT creates a mock Corona signature (in production, use actual ML-DSA).
|
||||
func (v *testValidator) signRT(msg []byte) []byte {
|
||||
// For testing, create a deterministic signature based on key and message
|
||||
// In production, this would be an actual ML-DSA signature
|
||||
sig := make([]byte, mldsa65SigLen)
|
||||
h := make([]byte, 32)
|
||||
copy(h, msg)
|
||||
for i := 0; i < len(sig); i++ {
|
||||
sig[i] = h[i%32] ^ v.rtPrivKey[i%len(v.rtPrivKey)]
|
||||
}
|
||||
return sig
|
||||
}
|
||||
|
||||
// testValidatorSet creates a set of test validators.
|
||||
func testValidatorSet(n int) ([]*testValidator, error) {
|
||||
validators := make([]*testValidator, n)
|
||||
|
||||
@@ -1,73 +0,0 @@
|
||||
// Copyright (C) 2019-2025, Lux Industries Inc. All rights reserved.
|
||||
// See the file LICENSE for licensing terms.
|
||||
|
||||
|
||||
package bloom
|
||||
|
||||
import (
|
||||
"encoding/binary"
|
||||
|
||||
"github.com/spaolacci/murmur3"
|
||||
)
|
||||
|
||||
// marshalCommon serializes [hashSeeds] and [entries] into a byte slice.
|
||||
func marshalCommon(hashSeeds []uint64, entries []byte) []byte {
|
||||
bytes := make([]byte, 1+len(hashSeeds)*bytesPerUint64+len(entries))
|
||||
bytes[0] = byte(len(hashSeeds))
|
||||
offset := 1
|
||||
for _, seed := range hashSeeds {
|
||||
binary.BigEndian.PutUint64(bytes[offset:], seed)
|
||||
offset += bytesPerUint64
|
||||
}
|
||||
copy(bytes[offset:], entries)
|
||||
return bytes
|
||||
}
|
||||
|
||||
// containsCommon returns true if [hash] is in the filter defined by [hashSeeds] and [entries].
|
||||
func containsCommon(hashSeeds []uint64, entries []byte, hash uint64) bool {
|
||||
for _, seed := range hashSeeds {
|
||||
if !containsWithSeed(entries, hash, seed) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
func containsWithSeed(entries []byte, hash, seed uint64) bool {
|
||||
index := getIndex(entries, hash, seed)
|
||||
byteIndex := index / bitsPerByte
|
||||
bitIndex := index % bitsPerByte
|
||||
return entries[byteIndex]&(1<<bitIndex) != 0
|
||||
}
|
||||
|
||||
func getIndex(entries []byte, hash, seed uint64) uint64 {
|
||||
// If the filter has L entries, we only want to use hashes in the range
|
||||
// [0, L). We achieve this by incrementally shifting the hash to use
|
||||
// bits that we haven't used before. If we run out of bits, we
|
||||
// perform a "hash extension" by rehashing the original hash and the
|
||||
// seed.
|
||||
//
|
||||
// If the size of the bloom filter approaches MaxUint64, the hash may
|
||||
// overflow back to the beginning of the range. This means that the
|
||||
// same index can be used more than once for a single value.
|
||||
// This is OK, it just means the filter isn't as good as it could be
|
||||
// if we had more bits in the hash.
|
||||
numEntries := uint64(len(entries))
|
||||
entriesMask := numEntries*bitsPerByte - 1
|
||||
hash += seed
|
||||
// Note: It may be significantly more performant to use:
|
||||
// https://lemire.me/blog/2016/06/27/a-fast-alternative-to-the-modulo-reduction/
|
||||
// over the modulo operation.
|
||||
index := hash & entriesMask
|
||||
for index >= numEntries*bitsPerByte {
|
||||
hash = hash >> hashRotation
|
||||
// If the hash is zero, we have run out of bits and need to
|
||||
// rehash.
|
||||
if hash == 0 {
|
||||
hash = uint64(murmur3.Sum64(binary.BigEndian.AppendUint64(binary.BigEndian.AppendUint64(nil, hash), seed)))
|
||||
}
|
||||
index = hash & entriesMask
|
||||
}
|
||||
return index
|
||||
}
|
||||
|
||||
@@ -38,8 +38,6 @@ const (
|
||||
// maxPassLen is the maximum allowed password length
|
||||
maxPassLen = 1024
|
||||
|
||||
// minPassLen is the minimum password length for basic strength check
|
||||
minPassLen = 8
|
||||
)
|
||||
|
||||
var (
|
||||
|
||||
@@ -53,8 +53,7 @@ type AppChain struct {
|
||||
computeEngine *ConfidentialComputeEngine
|
||||
|
||||
// Sync tracking
|
||||
lastSyncTime time.Time
|
||||
pendingSync []*Operation
|
||||
lastSyncTime time.Time
|
||||
syncInProgress bool
|
||||
}
|
||||
|
||||
|
||||
@@ -5,8 +5,6 @@ package chainadapter
|
||||
|
||||
import (
|
||||
"context"
|
||||
"crypto/sha256"
|
||||
"encoding/binary"
|
||||
"errors"
|
||||
"fmt"
|
||||
"sync"
|
||||
@@ -22,7 +20,6 @@ type PolkadotAdapter struct {
|
||||
headers map[uint64]*PolkadotHeader
|
||||
authorities []*PolkadotAuthority
|
||||
latestFinalized uint64
|
||||
currentSetID uint64
|
||||
initialized bool
|
||||
}
|
||||
|
||||
@@ -371,7 +368,6 @@ type EVML2Adapter struct {
|
||||
chainName string
|
||||
config *ChainConfig
|
||||
headers map[uint64]*EVMHeader
|
||||
l1Finalized uint64 // L1 block where this L2 state is finalized
|
||||
latestConfirmed uint64
|
||||
initialized bool
|
||||
}
|
||||
@@ -542,9 +538,8 @@ type CardanoAdapter struct {
|
||||
config *ChainConfig
|
||||
blocks map[uint64]*CardanoBlock
|
||||
stakePool map[[28]byte]*CardanoPool // Pool ID -> Pool
|
||||
latestSlot uint64
|
||||
currentEpoch uint64
|
||||
initialized bool
|
||||
latestSlot uint64
|
||||
initialized bool
|
||||
}
|
||||
|
||||
type CardanoBlock struct {
|
||||
@@ -636,7 +631,6 @@ type NEARAdapter struct {
|
||||
blocks map[uint64]*NEARBlock
|
||||
validators map[string]*NEARValidator
|
||||
latestFinalized uint64
|
||||
currentEpoch uint64
|
||||
initialized bool
|
||||
}
|
||||
|
||||
@@ -729,7 +723,6 @@ type AptosAdapter struct {
|
||||
blocks map[uint64]*AptosBlock
|
||||
validators []*AptosValidator
|
||||
latestCommitted uint64
|
||||
currentEpoch uint64
|
||||
initialized bool
|
||||
}
|
||||
|
||||
@@ -815,8 +808,7 @@ type SuiAdapter struct {
|
||||
checkpoints map[uint64]*SuiCheckpoint
|
||||
validators []*SuiValidator
|
||||
latestCheckpoint uint64
|
||||
currentEpoch uint64
|
||||
initialized bool
|
||||
initialized bool
|
||||
}
|
||||
|
||||
type SuiCheckpoint struct {
|
||||
@@ -1063,17 +1055,3 @@ func (a *TRONAdapter) Close() error {
|
||||
|
||||
// ======== Helper Functions ========
|
||||
|
||||
// computeEVMBlockHash computes an EVM block hash
|
||||
func computeEVMBlockHash(header *EVMHeader) [32]byte {
|
||||
h := sha256.New()
|
||||
binary.Write(h, binary.BigEndian, header.BlockNumber)
|
||||
h.Write(header.ParentHash[:])
|
||||
h.Write(header.StateRoot[:])
|
||||
h.Write(header.TxRoot[:])
|
||||
h.Write(header.ReceiptRoot[:])
|
||||
binary.Write(h, binary.BigEndian, header.Timestamp)
|
||||
|
||||
var result [32]byte
|
||||
copy(result[:], h.Sum(nil))
|
||||
return result
|
||||
}
|
||||
|
||||
@@ -273,10 +273,7 @@ type ConfidentialComputeEngine struct {
|
||||
teeAvailable bool
|
||||
|
||||
// Active compute sessions
|
||||
sessions map[ids.ID]*ComputeSession
|
||||
|
||||
// Committee for threshold attestation
|
||||
committee *ComputeCommittee
|
||||
sessions map[ids.ID]*ComputeSession
|
||||
|
||||
// Result cache
|
||||
results map[ids.ID]*ComputeResult
|
||||
|
||||
@@ -134,8 +134,7 @@ type MultiChainMPCWallet struct {
|
||||
mu sync.RWMutex
|
||||
|
||||
// Master key information
|
||||
masterPublicKey []byte
|
||||
threshold int
|
||||
threshold int
|
||||
totalShares int
|
||||
|
||||
// Per-chain key sets
|
||||
|
||||
@@ -5,7 +5,6 @@ package chain
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
|
||||
"github.com/luxfi/runtime"
|
||||
consensuschain "github.com/luxfi/vm/chain"
|
||||
@@ -14,8 +13,6 @@ import (
|
||||
var (
|
||||
_ consensuschain.Block = (*BlockWrapper)(nil)
|
||||
_ consensuschain.WithVerifyRuntime = (*BlockWrapper)(nil)
|
||||
|
||||
errExpectedBlockWithVerifyRuntime = errors.New("expected consensus chain WithVerifyRuntime")
|
||||
)
|
||||
|
||||
// BlockWrapper wraps a linear Block while adding a smart caching layer to improve
|
||||
|
||||
+2
-4
@@ -15,10 +15,8 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
blobPrefix = []byte("blob:")
|
||||
commitmentPrefix = []byte("commit:")
|
||||
certPrefix = []byte("cert:")
|
||||
samplePrefix = []byte("sample:")
|
||||
blobPrefix = []byte("blob:")
|
||||
certPrefix = []byte("cert:")
|
||||
|
||||
// ErrBlobNotFound indicates blob was not found
|
||||
ErrBlobNotFound = errors.New("blob not found")
|
||||
|
||||
@@ -9,58 +9,6 @@ import (
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
const expectedMetrics = `
|
||||
# HELP test_counter
|
||||
# TYPE test_counter counter
|
||||
test_counter 12345
|
||||
# HELP test_counter_float64
|
||||
# TYPE test_counter_float64 counter
|
||||
test_counter_float64 1.1
|
||||
# HELP test_empty_resetting_timer
|
||||
# TYPE test_empty_resetting_timer summary
|
||||
test_empty_resetting_timer{quantile="50"} 0
|
||||
test_empty_resetting_timer{quantile="95"} 0
|
||||
test_empty_resetting_timer{quantile="99"} 0
|
||||
test_empty_resetting_timer_sum 0
|
||||
test_empty_resetting_timer_count 0
|
||||
# HELP test_gauge
|
||||
# TYPE test_gauge gauge
|
||||
test_gauge 23456
|
||||
# HELP test_gauge_float64
|
||||
# TYPE test_gauge_float64 gauge
|
||||
test_gauge_float64 34567.89
|
||||
# HELP test_histogram
|
||||
# TYPE test_histogram summary
|
||||
test_histogram{quantile="0.5"} 0
|
||||
test_histogram{quantile="0.75"} 0
|
||||
test_histogram{quantile="0.95"} 0
|
||||
test_histogram{quantile="0.99"} 0
|
||||
test_histogram{quantile="0.999"} 0
|
||||
test_histogram{quantile="0.9999"} 0
|
||||
test_histogram_sum 0
|
||||
test_histogram_count 0
|
||||
# HELP test_meter
|
||||
# TYPE test_meter gauge
|
||||
test_meter 9.999999e+06
|
||||
# HELP test_resetting_timer
|
||||
# TYPE test_resetting_timer summary
|
||||
test_resetting_timer{quantile="50"} 1e+09
|
||||
test_resetting_timer{quantile="95"} 1e+09
|
||||
test_resetting_timer{quantile="99"} 1e+09
|
||||
test_resetting_timer_sum 1e+09
|
||||
test_resetting_timer_count 1
|
||||
# HELP test_timer
|
||||
# TYPE test_timer summary
|
||||
test_timer{quantile="0.5"} 2.25e+07
|
||||
test_timer{quantile="0.75"} 4.8e+07
|
||||
test_timer{quantile="0.95"} 1.2e+08
|
||||
test_timer{quantile="0.99"} 1.2e+08
|
||||
test_timer{quantile="0.999"} 1.2e+08
|
||||
test_timer{quantile="0.9999"} 1.2e+08
|
||||
test_timer_sum 2.3e+08
|
||||
test_timer_count 6
|
||||
`
|
||||
|
||||
// mockRegistry implements the Registry interface for testing
|
||||
type mockRegistry struct{}
|
||||
|
||||
|
||||
@@ -183,29 +183,3 @@ func (t *Tx) Import(i *tx.Import) error {
|
||||
)
|
||||
}
|
||||
|
||||
// warpValidatorStateAdapter adapts runtime.ValidatorState to warp.ValidatorState
|
||||
type warpValidatorStateAdapter struct {
|
||||
ctx context.Context
|
||||
vs runtime.ValidatorState
|
||||
}
|
||||
|
||||
func (w *warpValidatorStateAdapter) GetValidatorSet(ctx context.Context, height uint64, netID ids.ID) (map[ids.NodeID]*warp.ValidatorData, error) {
|
||||
validatorSet, err := w.vs.GetValidatorSet(ctx, height, netID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
// Convert from GetValidatorOutput map to ValidatorData map
|
||||
result := make(map[ids.NodeID]*warp.ValidatorData, len(validatorSet))
|
||||
for nodeID, validator := range validatorSet {
|
||||
result[nodeID] = &warp.ValidatorData{
|
||||
NodeID: nodeID,
|
||||
PublicKey: validator.PublicKey,
|
||||
Weight: validator.Weight,
|
||||
}
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
|
||||
func (w *warpValidatorStateAdapter) GetNetworkID(ctx context.Context, chainID ids.ID) (ids.ID, error) {
|
||||
return w.vs.GetNetworkID(chainID)
|
||||
}
|
||||
|
||||
@@ -9,8 +9,6 @@ import (
|
||||
"github.com/luxfi/crypto/hash"
|
||||
)
|
||||
|
||||
var secpCache = secp256k1.NewRecoverCache(2048)
|
||||
|
||||
type Tx struct {
|
||||
Unsigned `serialize:"true" json:"unsigned"`
|
||||
Signature [secp256k1.SignatureLen]byte `serialize:"true" json:"signature"`
|
||||
|
||||
@@ -6,7 +6,6 @@ package xsvm
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/luxfi/node/vms/platformvm/warp"
|
||||
luxWarp "github.com/luxfi/warp"
|
||||
)
|
||||
|
||||
@@ -19,20 +18,3 @@ func (xsvmVerifier) Verify(context.Context, *luxWarp.UnsignedMessage, []byte) er
|
||||
return nil
|
||||
}
|
||||
|
||||
// xsvmWarpSignerAdapter adapts internal warp.Signer to luxWarp.Signer (external warp)
|
||||
type xsvmWarpSignerAdapter struct {
|
||||
signer interface {
|
||||
Sign(*warp.UnsignedMessage) ([]byte, error)
|
||||
}
|
||||
}
|
||||
|
||||
// Sign implements luxWarp.Signer interface
|
||||
func (a *xsvmWarpSignerAdapter) Sign(msg *luxWarp.UnsignedMessage) ([]byte, error) {
|
||||
// Convert external warp message (luxWarp) to internal warp message (platformvm/warp)
|
||||
// msg.SourceChainID is already ids.ID type
|
||||
internalMsg, err := warp.NewUnsignedMessage(msg.NetworkID, msg.SourceChainID, msg.Payload)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return a.signer.Sign(internalMsg)
|
||||
}
|
||||
|
||||
@@ -116,9 +116,8 @@ type environment struct {
|
||||
rt *runtime.Runtime
|
||||
msm *mutableSharedMemory
|
||||
fx fx.Fx
|
||||
state state.State
|
||||
uptimes uptime.Calculator
|
||||
utxosVerifier utxo.Verifier
|
||||
state state.State
|
||||
utxosVerifier utxo.Verifier
|
||||
backend txexecutor.Backend
|
||||
}
|
||||
|
||||
|
||||
@@ -17,7 +17,6 @@ import (
|
||||
"github.com/luxfi/ids"
|
||||
|
||||
"github.com/luxfi/constants"
|
||||
"github.com/luxfi/crypto/bls"
|
||||
"github.com/luxfi/crypto/bls/signer/localsigner"
|
||||
"github.com/luxfi/crypto/secp256k1"
|
||||
"github.com/luxfi/node/upgrade/upgradetest"
|
||||
@@ -39,12 +38,6 @@ import (
|
||||
walletcommon "github.com/luxfi/node/wallet/network/primary/common"
|
||||
)
|
||||
|
||||
func mustNewProofOfPossession(t *testing.T, sk *bls.SecretKey) *signer.ProofOfPossession {
|
||||
pop, err := signer.NewProofOfPossession(sk)
|
||||
require.NoError(t, err)
|
||||
return pop
|
||||
}
|
||||
|
||||
func TestApricotProposalBlockTimeVerification(t *testing.T) {
|
||||
require := require.New(t)
|
||||
ctrl := gomock.NewController(t)
|
||||
|
||||
@@ -53,7 +53,6 @@ const (
|
||||
var (
|
||||
_ State = (*state)(nil)
|
||||
|
||||
errValidatorSetAlreadyPopulated = errors.New("validator set already populated")
|
||||
errIsNotNet = errors.New("is not a chain")
|
||||
errMissingPrimaryNetworkValidator = errors.New("missing primary network validator")
|
||||
|
||||
|
||||
@@ -28,16 +28,6 @@ import (
|
||||
|
||||
var errCustom = errors.New("custom error")
|
||||
|
||||
// testRuntime creates a test runtime with the given parameters.
|
||||
func testRuntime(networkID uint32, chainID, xAssetID ids.ID) *runtime.Runtime {
|
||||
return &runtime.Runtime{
|
||||
NetworkID: networkID,
|
||||
|
||||
ChainID: chainID,
|
||||
XAssetID: xAssetID,
|
||||
}
|
||||
}
|
||||
|
||||
func TestAddPermissionlessPrimaryDelegatorSerialization(t *testing.T) {
|
||||
require := require.New(t)
|
||||
|
||||
|
||||
@@ -19,8 +19,7 @@ var (
|
||||
errValidatorNotFound = errors.New("validator not found in current staker set")
|
||||
errValidatorNoBLSKey = errors.New("validator has no BLS public key registered")
|
||||
errInvalidEvidenceSignature = errors.New("evidence signature does not verify against validator BLS key")
|
||||
errSlashPercentMismatch = errors.New("slash percentage does not match expected value for evidence type")
|
||||
errWeightBelowMinimum = errors.New("slashed weight would fall below minimum validator stake")
|
||||
errSlashPercentMismatch = errors.New("slash percentage does not match expected value for evidence type")
|
||||
)
|
||||
|
||||
// Default slash percentages per evidence type.
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
package executor
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"math"
|
||||
"math/rand"
|
||||
@@ -2100,11 +2099,6 @@ type transformNetTxVerifyEnv struct {
|
||||
state *state.MockDiff
|
||||
}
|
||||
|
||||
// testContext creates a context.Context for testing
|
||||
func testContext() context.Context {
|
||||
return context.Background()
|
||||
}
|
||||
|
||||
// Returns mock implementations that can be used in tests
|
||||
// for verifying TransformChainTx.
|
||||
func newValidTransformChainTxVerifyEnv(t *testing.T, ctrl *gomock.Controller) transformNetTxVerifyEnv {
|
||||
|
||||
@@ -16,7 +16,6 @@ import (
|
||||
var (
|
||||
ErrCantIssueAdvanceTimeTx = errors.New("can not issue an advance time tx")
|
||||
ErrCantIssueRewardValidatorTx = errors.New("can not issue a reward validator tx")
|
||||
errMempoolFull = errors.New("mempool is full")
|
||||
)
|
||||
|
||||
type Mempool struct {
|
||||
|
||||
@@ -21,8 +21,7 @@ var (
|
||||
|
||||
errNoEvidence = errors.New("no equivocation evidence provided")
|
||||
errInvalidEvidenceType = errors.New("invalid evidence type")
|
||||
errSameContent = errors.New("evidence messages are identical")
|
||||
errHeightMismatch = errors.New("evidence heights do not match")
|
||||
errSameContent = errors.New("evidence messages are identical")
|
||||
errEmptySignature = errors.New("evidence contains empty signature")
|
||||
errEmptyMessage = errors.New("evidence contains empty message")
|
||||
errSlashPercentTooLarge = errors.New("slash percentage exceeds 100%")
|
||||
|
||||
+2
-152
@@ -4,7 +4,6 @@
|
||||
package platformvm
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
@@ -19,7 +18,7 @@ import (
|
||||
|
||||
"github.com/luxfi/codec"
|
||||
"github.com/luxfi/codec/linearcodec"
|
||||
consensusclock "github.com/luxfi/consensus/utils/timer/mockable"
|
||||
|
||||
"github.com/luxfi/constants"
|
||||
"github.com/luxfi/database"
|
||||
"github.com/luxfi/database/memdb"
|
||||
@@ -89,8 +88,7 @@ type VM struct {
|
||||
metrics platformvmmetrics.Metrics
|
||||
|
||||
// Used to get time. Useful for faking time during tests.
|
||||
consensusClock consensusclock.Clock
|
||||
nodeClock mockable.Clock
|
||||
nodeClock mockable.Clock
|
||||
|
||||
uptimeManager uptime.Calculator
|
||||
tracker *uptimeTracker
|
||||
@@ -105,10 +103,6 @@ type VM struct {
|
||||
lock sync.RWMutex
|
||||
xAssetID ids.ID
|
||||
chainID ids.ID
|
||||
// bcLookup consensus.AliasLookup
|
||||
// sharedMemory consensus.SharedMemory
|
||||
chainDataDir string
|
||||
|
||||
state state.State
|
||||
|
||||
fx fx.Fx
|
||||
@@ -450,150 +444,6 @@ func (vm *VM) pruneMempool() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// checkExistingChains looks for existing blockchain data and registers them
|
||||
func (vm *VM) checkExistingChains() error {
|
||||
// Scan chainData directory for existing chains
|
||||
// We need the parent chainData directory, not the P-Chain specific one
|
||||
chainDataDir := filepath.Dir(vm.chainDataDir)
|
||||
vm.log.Info("checking for existing chains in chainData directory",
|
||||
"chainDataDir", chainDataDir,
|
||||
)
|
||||
|
||||
entries, err := os.ReadDir(chainDataDir)
|
||||
if err != nil {
|
||||
vm.log.Info("chainData directory read error",
|
||||
"error", err,
|
||||
)
|
||||
// Directory might not exist yet, that's ok
|
||||
return nil
|
||||
}
|
||||
|
||||
vm.log.Info("found chainData entries",
|
||||
"count", len(entries),
|
||||
)
|
||||
|
||||
for _, entry := range entries {
|
||||
if !entry.IsDir() {
|
||||
continue
|
||||
}
|
||||
|
||||
vm.log.Info("checking chainData entry",
|
||||
"name", entry.Name(),
|
||||
)
|
||||
|
||||
// Try to parse as chain ID
|
||||
chainID, err := ids.FromString(entry.Name())
|
||||
if err != nil {
|
||||
vm.log.Debug("failed to parse chain ID",
|
||||
"name", entry.Name(),
|
||||
"error", err,
|
||||
)
|
||||
continue
|
||||
}
|
||||
|
||||
// Check if this chain has a config.json indicating it's an EVM chain
|
||||
configPath := filepath.Join(chainDataDir, entry.Name(), "config.json")
|
||||
configData, err := os.ReadFile(configPath)
|
||||
if err != nil {
|
||||
continue
|
||||
}
|
||||
|
||||
// Determine VM type based on directory contents
|
||||
var vmID ids.ID
|
||||
var netID ids.ID = constants.PrimaryNetworkID // Default to primary network
|
||||
|
||||
// Check for EVM chain (C-Chain)
|
||||
if bytes.Contains(configData, []byte("chain-id")) || bytes.Contains(configData, []byte("chainId")) {
|
||||
vmID = constants.EVMID
|
||||
vm.log.Info("detected EVM chain from config",
|
||||
"chainID", chainID.String(),
|
||||
)
|
||||
} else {
|
||||
// Check for other VM types by looking at other files
|
||||
// For now, we'll skip non-EVM chains
|
||||
vm.log.Debug("skipping non-EVM chain",
|
||||
"chainID", chainID.String(),
|
||||
)
|
||||
continue
|
||||
}
|
||||
|
||||
// Check if we need to determine net ID from somewhere
|
||||
// For now, assume primary network for orphaned chains
|
||||
|
||||
// Check if this chain is already known
|
||||
chains, err := vm.state.GetChains(netID)
|
||||
if err != nil {
|
||||
vm.log.Warn("failed to get chains for chain",
|
||||
"netID", netID.String(),
|
||||
"error", err,
|
||||
)
|
||||
continue
|
||||
}
|
||||
|
||||
chainExists := false
|
||||
for _, chain := range chains {
|
||||
if chain.ID() == chainID {
|
||||
chainExists = true
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if !chainExists {
|
||||
// This is an orphaned chain, queue it for creation
|
||||
vm.log.Info("found orphaned chain, queuing for creation",
|
||||
"chainID", chainID.String(),
|
||||
"vmID", vmID.String(),
|
||||
"netID", netID.String(),
|
||||
"path", filepath.Join(chainDataDir, entry.Name()),
|
||||
)
|
||||
|
||||
// For existing chains, we need to provide a minimal but valid genesis
|
||||
// The EVM will match this against the existing chain data
|
||||
// Extract chainId from config if possible
|
||||
// var chainIDNum uint64 = 96369 // default
|
||||
// if bytes.Contains(configData, []byte(`"chainId": 96369`)) || bytes.Contains(configData, []byte(`"chainId":96369`)) {
|
||||
// chainIDNum = 96369
|
||||
// }
|
||||
|
||||
// minimalGenesis := fmt.Sprintf(`{
|
||||
// "config": {
|
||||
// "chainId": %d,
|
||||
// "homesteadBlock": 0,
|
||||
// "eip150Block": 0,
|
||||
// "eip155Block": 0,
|
||||
// "eip158Block": 0,
|
||||
// "byzantiumBlock": 0,
|
||||
// "constantinopleBlock": 0,
|
||||
// "petersburgBlock": 0,
|
||||
// "istanbulBlock": 0,
|
||||
// "muirGlacierBlock": 0,
|
||||
// "evmTimestamp": 0,
|
||||
// "feeConfig": {
|
||||
// "gasLimit": 8000000,
|
||||
// "targetBlockRate": 2,
|
||||
// "minBaseFee": 25000000000,
|
||||
// "targetGas": 15000000,
|
||||
// "baseFeeChangeDenominator": 36,
|
||||
// "minBlockGasCost": 0,
|
||||
// "maxBlockGasCost": 1000000,
|
||||
// "blockGasCostStep": 200000
|
||||
// }
|
||||
// },
|
||||
// "gasLimit": "0x7a1200",
|
||||
// "difficulty": "0x0",
|
||||
// "alloc": {}
|
||||
// }`, chainIDNum)
|
||||
|
||||
// vm.Internal.QueueExistingChainWithGenesis(chainID, netID, vmID, []byte(minimalGenesis))
|
||||
} else {
|
||||
vm.log.Debug("chain already registered",
|
||||
"chainID", chainID.String(),
|
||||
)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Create all chains that exist that this node validates.
|
||||
func (vm *VM) initBlockchains() error {
|
||||
if vm.Internal.PartialSyncPrimaryNetwork {
|
||||
|
||||
@@ -33,7 +33,6 @@ import (
|
||||
"github.com/luxfi/database/prefixdb"
|
||||
"github.com/luxfi/ids"
|
||||
"github.com/luxfi/math/set"
|
||||
"github.com/luxfi/node/benchlist"
|
||||
"github.com/luxfi/node/chains"
|
||||
"github.com/luxfi/vm/chains/atomic"
|
||||
// "github.com/luxfi/node/message" // unused
|
||||
@@ -117,8 +116,6 @@ var (
|
||||
ExcessConversionConstant: 100,
|
||||
}
|
||||
|
||||
// chain that exists at genesis in defaultVM
|
||||
testNet1 *txs.Tx
|
||||
)
|
||||
|
||||
// mockValidatorState implements runtime.ValidatorState for testing
|
||||
@@ -696,29 +693,6 @@ func TestAddNetValidatorReject(t *testing.T) {
|
||||
}
|
||||
|
||||
// Test case where primary network validator rewarded
|
||||
// noOpBenchlist is a mock implementation of benchlist.Manager for testing
|
||||
type noOpBenchlist struct{}
|
||||
|
||||
func (n *noOpBenchlist) IsBenched(nodeID ids.NodeID, chainID ids.ID) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func (n *noOpBenchlist) GetBenched(chainID ids.ID) []ids.NodeID {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (n *noOpBenchlist) RegisterChain(chainID ids.ID, vdrs validators.Manager) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (n *noOpBenchlist) Benchable(chainID ids.ID, nodeID ids.NodeID) benchlist.Benchable {
|
||||
return n
|
||||
}
|
||||
|
||||
func (n *noOpBenchlist) Benched(chainID ids.ID, nodeID ids.NodeID) {}
|
||||
|
||||
func (n *noOpBenchlist) Unbenched(chainID ids.ID, nodeID ids.NodeID) {}
|
||||
|
||||
func TestRewardValidatorAccept(t *testing.T) {
|
||||
require := require.New(t)
|
||||
vmImpl, _, _ := defaultVM(t, upgradetest.Latest)
|
||||
|
||||
@@ -19,10 +19,7 @@ import (
|
||||
"github.com/luxfi/math/set"
|
||||
)
|
||||
|
||||
var (
|
||||
sourceChainID = ids.GenerateTestID()
|
||||
netID = ids.GenerateTestID()
|
||||
)
|
||||
var sourceChainID = ids.GenerateTestID()
|
||||
|
||||
func getTestValidators() map[ids.NodeID]*validators.GetValidatorOutput {
|
||||
return map[ids.NodeID]*validators.GetValidatorOutput{
|
||||
|
||||
@@ -9,7 +9,6 @@ import (
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/luxfi/constants"
|
||||
"github.com/luxfi/crypto/bls"
|
||||
"github.com/luxfi/crypto/bls/signer/localsigner"
|
||||
"github.com/luxfi/ids"
|
||||
"github.com/luxfi/node/vms/platformvm/warp"
|
||||
@@ -30,54 +29,3 @@ func TestSigner(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// Test that using a random SourceChainID results in an error
|
||||
func testWrongChainID(t *testing.T, s warp.Signer, _ *localsigner.LocalSigner, _ uint32, _ ids.ID) {
|
||||
require := require.New(t)
|
||||
|
||||
msg, err := warp.NewUnsignedMessage(
|
||||
constants.UnitTestID,
|
||||
ids.GenerateTestID(),
|
||||
[]byte("payload"),
|
||||
)
|
||||
require.NoError(err)
|
||||
|
||||
_, err = s.Sign(msg)
|
||||
require.Error(err) //nolint:forbidigo // currently returns grpc errors too
|
||||
}
|
||||
|
||||
// Test that using a different networkID results in an error
|
||||
func testWrongNetworkID(t *testing.T, s warp.Signer, _ *localsigner.LocalSigner, networkID uint32, blockchainID ids.ID) {
|
||||
require := require.New(t)
|
||||
|
||||
msg, err := warp.NewUnsignedMessage(
|
||||
networkID+1,
|
||||
blockchainID,
|
||||
[]byte("payload"),
|
||||
)
|
||||
require.NoError(err)
|
||||
|
||||
_, err = s.Sign(msg)
|
||||
require.Error(err) //nolint:forbidigo // currently returns grpc errors too
|
||||
}
|
||||
|
||||
// Test that a signature generated with the signer verifies correctly
|
||||
func testVerifies(t *testing.T, s warp.Signer, sk *localsigner.LocalSigner, networkID uint32, chainID ids.ID) {
|
||||
require := require.New(t)
|
||||
|
||||
msg, err := warp.NewUnsignedMessage(
|
||||
networkID,
|
||||
chainID,
|
||||
[]byte("payload"),
|
||||
)
|
||||
require.NoError(err)
|
||||
|
||||
sigBytes, err := s.Sign(msg)
|
||||
require.NoError(err)
|
||||
|
||||
sig, err := bls.SignatureFromBytes(sigBytes)
|
||||
require.NoError(err)
|
||||
|
||||
pk := sk.PublicKey()
|
||||
msgBytes := msg.Bytes()
|
||||
require.True(bls.Verify(pk, sig, msgBytes))
|
||||
}
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
// Copyright (C) 2019-2025, Lux Industries Inc. All rights reserved.
|
||||
// See the file LICENSE for licensing terms.
|
||||
|
||||
package block
|
||||
|
||||
import "github.com/stretchr/testify/require"
|
||||
|
||||
func equalOption(require *require.Assertions, want, have Block) {
|
||||
require.Equal(want.ID(), have.ID())
|
||||
require.Equal(want.ParentID(), have.ParentID())
|
||||
require.Equal(want.Block(), have.Block())
|
||||
require.Equal(want.Bytes(), have.Bytes())
|
||||
}
|
||||
@@ -25,10 +25,7 @@ import (
|
||||
componentblocktest "github.com/luxfi/vm/chain/blocktest"
|
||||
)
|
||||
|
||||
var (
|
||||
errDuplicateVerify = errors.New("duplicate verify")
|
||||
errUnexpectedBlockRejection = errors.New("unexpected block rejection")
|
||||
)
|
||||
var errDuplicateVerify = errors.New("duplicate verify")
|
||||
|
||||
// ErrNotOracle is returned when trying to get options from a non-oracle block
|
||||
|
||||
|
||||
@@ -64,8 +64,7 @@ var (
|
||||
errUnknownBlock = errors.New("unknown block")
|
||||
errUnverifiedBlock = errors.New("unverified block")
|
||||
errMarshallingFailed = errors.New("marshalling failed")
|
||||
errTooHigh = errors.New("too high")
|
||||
errUnexpectedCall = errors.New("unexpected call")
|
||||
errTooHigh = errors.New("too high")
|
||||
)
|
||||
|
||||
func init() {
|
||||
|
||||
@@ -1,31 +0,0 @@
|
||||
// Copyright (C) 2019-2025, Lux Industries Inc. All rights reserved.
|
||||
// See the file LICENSE for licensing terms.
|
||||
|
||||
package rpcchainvm
|
||||
|
||||
import (
|
||||
"github.com/luxfi/vm/chain"
|
||||
"github.com/luxfi/database"
|
||||
|
||||
vmpb "github.com/luxfi/node/proto/vm"
|
||||
)
|
||||
|
||||
var (
|
||||
errEnumToError = map[vmpb.Error]error{
|
||||
vmpb.Error_ERROR_CLOSED: database.ErrClosed,
|
||||
vmpb.Error_ERROR_NOT_FOUND: database.ErrNotFound,
|
||||
vmpb.Error_ERROR_STATE_SYNC_NOT_IMPLEMENTED: chain.ErrRemoteVMNotImplemented,
|
||||
}
|
||||
errorToErrEnum = map[error]vmpb.Error{
|
||||
database.ErrClosed: vmpb.Error_ERROR_CLOSED,
|
||||
database.ErrNotFound: vmpb.Error_ERROR_NOT_FOUND,
|
||||
chain.ErrRemoteVMNotImplemented: vmpb.Error_ERROR_STATE_SYNC_NOT_IMPLEMENTED,
|
||||
}
|
||||
)
|
||||
|
||||
func errorToRPCError(err error) error {
|
||||
if _, ok := errorToErrEnum[err]; ok {
|
||||
return nil
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -7,10 +7,15 @@ import (
|
||||
"github.com/luxfi/ids"
|
||||
lux "github.com/luxfi/utxo"
|
||||
"github.com/luxfi/node/vms/components/verify"
|
||||
"github.com/luxfi/utxo/bls12381fx"
|
||||
"github.com/luxfi/utxo/ed25519fx"
|
||||
"github.com/luxfi/utxo/mldsafx"
|
||||
"github.com/luxfi/utxo/nftfx"
|
||||
"github.com/luxfi/utxo/propertyfx"
|
||||
"github.com/luxfi/utxo/schnorrfx"
|
||||
"github.com/luxfi/utxo/secp256k1fx"
|
||||
"github.com/luxfi/utxo/secp256r1fx"
|
||||
"github.com/luxfi/utxo/slhdsafx"
|
||||
)
|
||||
|
||||
var (
|
||||
@@ -18,6 +23,11 @@ var (
|
||||
_ Fx = (*nftfx.Fx)(nil)
|
||||
_ Fx = (*propertyfx.Fx)(nil)
|
||||
_ Fx = (*mldsafx.Fx)(nil)
|
||||
_ Fx = (*slhdsafx.Fx)(nil)
|
||||
_ Fx = (*ed25519fx.Fx)(nil)
|
||||
_ Fx = (*secp256r1fx.Fx)(nil)
|
||||
_ Fx = (*schnorrfx.Fx)(nil)
|
||||
_ Fx = (*bls12381fx.Fx)(nil)
|
||||
_ verify.Verifiable = (*FxCredential)(nil)
|
||||
)
|
||||
|
||||
|
||||
@@ -14,8 +14,13 @@ import (
|
||||
"github.com/luxfi/node/vms/xvm/fxs"
|
||||
"github.com/luxfi/node/vms/xvm/txs"
|
||||
"github.com/luxfi/utils"
|
||||
"github.com/luxfi/utxo/bls12381fx"
|
||||
"github.com/luxfi/utxo/ed25519fx"
|
||||
"github.com/luxfi/utxo/mldsafx"
|
||||
"github.com/luxfi/utxo/schnorrfx"
|
||||
"github.com/luxfi/utxo/secp256k1fx"
|
||||
"github.com/luxfi/utxo/secp256r1fx"
|
||||
"github.com/luxfi/utxo/slhdsafx"
|
||||
)
|
||||
|
||||
// Genesis represents the genesis state of the XVM
|
||||
@@ -155,6 +160,11 @@ func newGenesisCodec() (codec.Manager, error) {
|
||||
[]fxs.Fx{
|
||||
&secp256k1fx.Fx{},
|
||||
&mldsafx.Fx{},
|
||||
&slhdsafx.Fx{},
|
||||
&ed25519fx.Fx{},
|
||||
&secp256r1fx.Fx{},
|
||||
&schnorrfx.Fx{},
|
||||
&bls12381fx.Fx{},
|
||||
},
|
||||
)
|
||||
if err != nil {
|
||||
|
||||
@@ -63,7 +63,6 @@ var (
|
||||
errIncompatibleFx = errors.New("incompatible feature extension")
|
||||
errUnknownFx = errors.New("unknown feature extension")
|
||||
errGenesisAssetMustHaveState = errors.New("genesis asset must have non-empty state")
|
||||
errUnknownState = errors.New("unknown state")
|
||||
)
|
||||
|
||||
// BCLookup provides blockchain alias lookup
|
||||
|
||||
Reference in New Issue
Block a user