mirror of
https://github.com/luxfi/node.git
synced 2026-07-27 03:39:39 +00:00
fix: gofmt -s across repo (CI format check)
This commit is contained in:
+4
-4
@@ -10,10 +10,10 @@ import (
|
||||
"sync"
|
||||
"syscall"
|
||||
|
||||
"github.com/luxfi/filesystem/perms"
|
||||
"github.com/luxfi/log"
|
||||
"github.com/luxfi/node/node"
|
||||
"github.com/luxfi/node/utils"
|
||||
"github.com/luxfi/filesystem/perms"
|
||||
"github.com/luxfi/sys/ulimit"
|
||||
|
||||
nodeconfig "github.com/luxfi/node/config/node"
|
||||
@@ -58,9 +58,9 @@ func New(config nodeconfig.Config) (App, error) {
|
||||
infoLevel, _ := log.ToLevel("info")
|
||||
logFactory := log.NewFactoryWithConfig(log.Config{
|
||||
RotatingWriterConfig: log.RotatingWriterConfig{
|
||||
MaxSize: 8, // 8MB per log file (reasonable for standard profile)
|
||||
MaxFiles: 5, // Keep 5 rotated files
|
||||
MaxAge: 7, // 7 days retention
|
||||
MaxSize: 8, // 8MB per log file (reasonable for standard profile)
|
||||
MaxFiles: 5, // Keep 5 rotated files
|
||||
MaxAge: 7, // 7 days retention
|
||||
Directory: config.DatabaseConfig.Path,
|
||||
},
|
||||
DisplayLevel: infoLevel,
|
||||
|
||||
@@ -7,10 +7,10 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
validators "github.com/luxfi/validators"
|
||||
"github.com/luxfi/ids"
|
||||
"github.com/luxfi/log"
|
||||
metrics "github.com/luxfi/metric"
|
||||
validators "github.com/luxfi/validators"
|
||||
)
|
||||
|
||||
// NewManager creates a new benchlist manager
|
||||
|
||||
@@ -8,9 +8,9 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/luxfi/crypto/hash"
|
||||
"github.com/luxfi/ids"
|
||||
"github.com/luxfi/log"
|
||||
"github.com/luxfi/crypto/hash"
|
||||
)
|
||||
|
||||
// BenchmarkHashingComputeHash256 benchmarks SHA256 hashing performance
|
||||
|
||||
@@ -7,11 +7,11 @@ import (
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"github.com/luxfi/crypto/hash"
|
||||
"github.com/luxfi/database/memdb"
|
||||
"github.com/luxfi/database/prefixdb"
|
||||
"github.com/luxfi/database/versiondb"
|
||||
"github.com/luxfi/ids"
|
||||
"github.com/luxfi/crypto/hash"
|
||||
)
|
||||
|
||||
// BenchmarkMemoryDatabase benchmarks in-memory database operations
|
||||
|
||||
@@ -9,8 +9,8 @@ import (
|
||||
"encoding/binary"
|
||||
"testing"
|
||||
|
||||
"github.com/luxfi/ids"
|
||||
compression "github.com/luxfi/compress"
|
||||
"github.com/luxfi/ids"
|
||||
)
|
||||
|
||||
// BenchmarkMessageCompression benchmarks message compression
|
||||
|
||||
Vendored
+1
-1
@@ -6,9 +6,9 @@ package lru
|
||||
import (
|
||||
"sync"
|
||||
|
||||
"github.com/luxfi/container/linked"
|
||||
"github.com/luxfi/node/cache"
|
||||
"github.com/luxfi/utils"
|
||||
"github.com/luxfi/container/linked"
|
||||
)
|
||||
|
||||
var _ cache.Cacher[struct{}, struct{}] = (*Cache[struct{}, struct{}])(nil)
|
||||
|
||||
Vendored
+1
-1
@@ -6,9 +6,9 @@ package lru
|
||||
import (
|
||||
"sync"
|
||||
|
||||
"github.com/luxfi/container/linked"
|
||||
"github.com/luxfi/node/cache"
|
||||
"github.com/luxfi/utils"
|
||||
"github.com/luxfi/container/linked"
|
||||
)
|
||||
|
||||
var _ cache.Cacher[struct{}, any] = (*SizedCache[struct{}, any])(nil)
|
||||
|
||||
Vendored
+1
-1
@@ -6,8 +6,8 @@ package cache
|
||||
import (
|
||||
"sync"
|
||||
|
||||
"github.com/luxfi/utils"
|
||||
"github.com/luxfi/container/linked"
|
||||
"github.com/luxfi/utils"
|
||||
)
|
||||
|
||||
var _ Cacher[struct{}, struct{}] = (*LRU[struct{}, struct{}])(nil)
|
||||
|
||||
Vendored
+1
-1
@@ -6,8 +6,8 @@ package cache
|
||||
import (
|
||||
"sync"
|
||||
|
||||
"github.com/luxfi/utils"
|
||||
"github.com/luxfi/container/linked"
|
||||
"github.com/luxfi/utils"
|
||||
)
|
||||
|
||||
var _ Cacher[struct{}, any] = (*sizedLRU[struct{}, any])(nil)
|
||||
|
||||
@@ -8,13 +8,13 @@ import (
|
||||
"errors"
|
||||
"sync"
|
||||
|
||||
"github.com/luxfi/vm/chain"
|
||||
consensusvertex "github.com/luxfi/consensus/engine/vertex"
|
||||
"github.com/luxfi/database"
|
||||
"github.com/luxfi/ids"
|
||||
"github.com/luxfi/node/vms/platformvm/fx"
|
||||
"github.com/luxfi/runtime"
|
||||
vmcore "github.com/luxfi/vm"
|
||||
"github.com/luxfi/vm/chain"
|
||||
"github.com/luxfi/warp"
|
||||
)
|
||||
|
||||
|
||||
+2
-2
@@ -345,7 +345,7 @@ type ManagerConfig struct {
|
||||
PartialSyncPrimaryNetwork bool
|
||||
Server server.Server // Handles HTTP API calls
|
||||
AtomicMemory *atomic.Memory
|
||||
UTXOAssetID ids.ID
|
||||
UTXOAssetID ids.ID
|
||||
SkipBootstrap bool // Skip bootstrapping and start processing immediately
|
||||
EnableAutomining bool // Enable automining in POA mode
|
||||
XChainID ids.ID // ID of the X-Chain,
|
||||
@@ -915,7 +915,7 @@ func (m *manager) buildChain(chainParams ChainParameters, sb nets.Net) (*chainIn
|
||||
|
||||
XChainID: m.XChainID,
|
||||
CChainID: m.CChainID,
|
||||
UTXOAssetID: m.UTXOAssetID,
|
||||
UTXOAssetID: m.UTXOAssetID,
|
||||
ChainDataDir: chainDataDir,
|
||||
|
||||
BCLookup: m,
|
||||
|
||||
@@ -10,13 +10,13 @@ import (
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/luxfi/vm"
|
||||
"github.com/luxfi/constants"
|
||||
"github.com/luxfi/ids"
|
||||
"github.com/luxfi/log"
|
||||
"github.com/luxfi/metric"
|
||||
"github.com/luxfi/node/nets"
|
||||
"github.com/luxfi/node/vms"
|
||||
"github.com/luxfi/vm"
|
||||
)
|
||||
|
||||
// TestNew tests creating a new manager
|
||||
@@ -106,9 +106,9 @@ func TestQueueChainCreation(t *testing.T) {
|
||||
chainID := ids.GenerateTestID()
|
||||
netID := ids.GenerateTestID()
|
||||
chainParams := ChainParameters{
|
||||
ID: chainID,
|
||||
ID: chainID,
|
||||
ChainID: netID,
|
||||
VMID: ids.GenerateTestID(),
|
||||
VMID: ids.GenerateTestID(),
|
||||
}
|
||||
|
||||
// Queue the chain
|
||||
|
||||
@@ -70,7 +70,7 @@ func (s *mockServer) AddAliasesWithReadLock(endpoint string, aliases ...string)
|
||||
func (s *mockServer) Dispatch() error { return nil }
|
||||
func (s *mockServer) RegisterChain(chainName string, rt *runtime.Runtime, vm vm.VM) {
|
||||
}
|
||||
func (s *mockServer) Shutdown() error { return nil }
|
||||
func (s *mockServer) Shutdown() error { return nil }
|
||||
func (s *mockServer) SetRootInfoProvider(_ server.RootInfoProvider) {}
|
||||
|
||||
func TestHandlerManager_RegisterChainHandlers(t *testing.T) {
|
||||
|
||||
+6
-6
@@ -35,12 +35,12 @@ import (
|
||||
|
||||
var (
|
||||
// Flags
|
||||
outputPath string
|
||||
inputPath string
|
||||
sinceVer uint64
|
||||
dataDir string
|
||||
dbType string
|
||||
noCompress bool
|
||||
outputPath string
|
||||
inputPath string
|
||||
sinceVer uint64
|
||||
dataDir string
|
||||
dbType string
|
||||
noCompress bool
|
||||
forceRestore bool
|
||||
)
|
||||
|
||||
|
||||
+10
-10
@@ -12,16 +12,16 @@ import (
|
||||
|
||||
// CeremonyState holds the full state of a powers-of-tau ceremony.
|
||||
type CeremonyState struct {
|
||||
Circuit string `json:"circuit"`
|
||||
NumConstraints int `json:"numConstraints"`
|
||||
PowersNeeded int `json:"powersNeeded"`
|
||||
Participants int `json:"participants"`
|
||||
TauG1 []G1Point `json:"tauG1"`
|
||||
TauG2 []G2Point `json:"tauG2"`
|
||||
AlphaG1 []G1Point `json:"alphaG1"`
|
||||
BetaG1 []G1Point `json:"betaG1"`
|
||||
BetaG2 G2Point `json:"betaG2"`
|
||||
Contributions []Contribution `json:"contributions"`
|
||||
Circuit string `json:"circuit"`
|
||||
NumConstraints int `json:"numConstraints"`
|
||||
PowersNeeded int `json:"powersNeeded"`
|
||||
Participants int `json:"participants"`
|
||||
TauG1 []G1Point `json:"tauG1"`
|
||||
TauG2 []G2Point `json:"tauG2"`
|
||||
AlphaG1 []G1Point `json:"alphaG1"`
|
||||
BetaG1 []G1Point `json:"betaG1"`
|
||||
BetaG2 G2Point `json:"betaG2"`
|
||||
Contributions []Contribution `json:"contributions"`
|
||||
}
|
||||
|
||||
// Contribution records a single participant's contribution.
|
||||
|
||||
@@ -29,7 +29,7 @@ func main() {
|
||||
"allocations": []map[string]interface{}{
|
||||
{
|
||||
"evmAddr": "0x9011E888251AB053B7bD1cdB598Db4f9DEd94714",
|
||||
"utxoAddr": zooAddr,
|
||||
"utxoAddr": zooAddr,
|
||||
"initialAmount": 0,
|
||||
"unlockSchedule": []map[string]interface{}{
|
||||
{
|
||||
|
||||
@@ -3,7 +3,7 @@ package main
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
|
||||
"github.com/luxfi/crypto/hash"
|
||||
"github.com/luxfi/ids"
|
||||
)
|
||||
@@ -13,15 +13,15 @@ func main() {
|
||||
fmt.Println("Usage: go run main.go <genesis_file>")
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
|
||||
data, err := os.ReadFile(os.Args[1])
|
||||
if err != nil {
|
||||
fmt.Printf("Error reading file: %v\n", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
|
||||
fmt.Printf("File size: %d bytes\n", len(data))
|
||||
|
||||
|
||||
// Compute hash the same way luxd does
|
||||
rawHash := hash.ComputeHash256(data)
|
||||
id, err := ids.ToID(rawHash)
|
||||
@@ -29,6 +29,6 @@ func main() {
|
||||
fmt.Printf("Error converting to ID: %v\n", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
|
||||
fmt.Printf("Genesis ID: %s\n", id.String())
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ func (c *ChainDatabaseConfig) GetDatabaseType(chainAlias string) string {
|
||||
func (c *ChainDatabaseConfig) Validate() error {
|
||||
validTypes := map[string]bool{
|
||||
"pebbledb": true,
|
||||
"zapdb": true,
|
||||
"zapdb": true,
|
||||
"memdb": true,
|
||||
}
|
||||
|
||||
|
||||
@@ -1746,7 +1746,6 @@ func GetNodeConfig(v *viper.Viper) (node.Config, error) {
|
||||
}
|
||||
nodeConfig.TrackAllChains = v.GetBool(TrackAllChainsKey)
|
||||
|
||||
|
||||
// HTTP APIs
|
||||
nodeConfig.HTTPConfig, err = getHTTPConfig(v)
|
||||
if err != nil {
|
||||
|
||||
@@ -16,8 +16,8 @@ import (
|
||||
"github.com/spf13/viper"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/luxfi/constants"
|
||||
consensusconfig "github.com/luxfi/consensus/config"
|
||||
"github.com/luxfi/constants"
|
||||
"github.com/luxfi/ids"
|
||||
"github.com/luxfi/node/chains"
|
||||
"github.com/luxfi/node/genesis/builder"
|
||||
|
||||
+13
-13
@@ -13,14 +13,14 @@ import (
|
||||
"github.com/spf13/pflag"
|
||||
"github.com/spf13/viper"
|
||||
|
||||
compression "github.com/luxfi/compress"
|
||||
"github.com/luxfi/constants"
|
||||
"github.com/luxfi/genesis/pkg/genesis"
|
||||
"github.com/luxfi/net/dynamicip"
|
||||
"github.com/luxfi/node/genesis/builder"
|
||||
"github.com/luxfi/node/trace"
|
||||
"github.com/luxfi/node/vms/components/gas"
|
||||
"github.com/luxfi/node/vms/proposervm"
|
||||
compression "github.com/luxfi/compress"
|
||||
"github.com/luxfi/net/dynamicip"
|
||||
"github.com/luxfi/sys/ulimit"
|
||||
|
||||
consensusconfig "github.com/luxfi/consensus/config"
|
||||
@@ -48,19 +48,19 @@ var (
|
||||
defaultStakingSignerKeyPath = filepath.Join(defaultStakingPath, "signer.key")
|
||||
// Strict-PQ default paths — mirror downstream-tenant CLI `<tenantctl> key gen`
|
||||
// layout so the operator init container + lqd see the same files.
|
||||
defaultStakingMLDSAKeyPath = filepath.Join(defaultStakingPath, "mldsa.key")
|
||||
defaultStakingMLDSAPubKeyPath = filepath.Join(defaultStakingPath, "mldsa.pub")
|
||||
defaultStakingMLDSAKeyPath = filepath.Join(defaultStakingPath, "mldsa.key")
|
||||
defaultStakingMLDSAPubKeyPath = filepath.Join(defaultStakingPath, "mldsa.pub")
|
||||
defaultHandshakeMLKEMKeyPath = filepath.Join(defaultStakingPath, "mlkem.key")
|
||||
defaultHandshakeMLKEMPubKeyPath = filepath.Join(defaultStakingPath, "mlkem.pub")
|
||||
defaultConfigDir = filepath.Join(defaultUnexpandedDataDir, "configs")
|
||||
defaultChainConfigDir = filepath.Join(defaultConfigDir, "chains")
|
||||
defaultVMConfigDir = filepath.Join(defaultConfigDir, "vms")
|
||||
defaultVMAliasFilePath = filepath.Join(defaultVMConfigDir, "aliases.json")
|
||||
defaultChainAliasFilePath = filepath.Join(defaultChainConfigDir, "aliases.json")
|
||||
defaultNetConfigDir = filepath.Join(defaultConfigDir, "chains")
|
||||
defaultPluginDir = filepath.Join(defaultUnexpandedDataDir, "plugins", "current")
|
||||
defaultChainDataDir = filepath.Join(defaultUnexpandedDataDir, "chainData")
|
||||
defaultProcessContextPath = filepath.Join(defaultUnexpandedDataDir, DefaultProcessContextFilename)
|
||||
defaultConfigDir = filepath.Join(defaultUnexpandedDataDir, "configs")
|
||||
defaultChainConfigDir = filepath.Join(defaultConfigDir, "chains")
|
||||
defaultVMConfigDir = filepath.Join(defaultConfigDir, "vms")
|
||||
defaultVMAliasFilePath = filepath.Join(defaultVMConfigDir, "aliases.json")
|
||||
defaultChainAliasFilePath = filepath.Join(defaultChainConfigDir, "aliases.json")
|
||||
defaultNetConfigDir = filepath.Join(defaultConfigDir, "chains")
|
||||
defaultPluginDir = filepath.Join(defaultUnexpandedDataDir, "plugins", "current")
|
||||
defaultChainDataDir = filepath.Join(defaultUnexpandedDataDir, "chainData")
|
||||
defaultProcessContextPath = filepath.Join(defaultUnexpandedDataDir, DefaultProcessContextFilename)
|
||||
)
|
||||
|
||||
func deprecateFlags(fs *pflag.FlagSet) error {
|
||||
|
||||
+36
-36
@@ -78,36 +78,36 @@ const (
|
||||
HTTPReadTimeoutKey = "http-read-timeout"
|
||||
HTTPReadHeaderTimeoutKey = "http-read-header-timeout"
|
||||
|
||||
HTTPIdleTimeoutKey = "http-idle-timeout"
|
||||
StateSyncIPsKey = "state-sync-ips"
|
||||
StateSyncIDsKey = "state-sync-ids"
|
||||
BootstrapNodesKey = "bootstrap-nodes"
|
||||
BootstrapIPsKey = "bootstrap-ips"
|
||||
BootstrapIDsKey = "bootstrap-ids"
|
||||
SkipBootstrapKey = "skip-bootstrap"
|
||||
EnableAutominingKey = "enable-automining"
|
||||
StakingHostKey = "staking-host"
|
||||
StakingPortKey = "staking-port"
|
||||
StakingEphemeralCertEnabledKey = "staking-ephemeral-cert-enabled"
|
||||
StakingTLSKeyPathKey = "staking-tls-key-file"
|
||||
StakingTLSKeyContentKey = "staking-tls-key-file-content"
|
||||
StakingCertPathKey = "staking-tls-cert-file"
|
||||
StakingCertContentKey = "staking-tls-cert-file-content"
|
||||
StakingEphemeralSignerEnabledKey = "staking-ephemeral-signer-enabled"
|
||||
StakingSignerKeyPathKey = "staking-signer-key-file"
|
||||
StakingSignerKeyContentKey = "staking-signer-key-file-content"
|
||||
StakingKMSEndpointKey = "staking-kms-endpoint"
|
||||
StakingKMSSecretPathKey = "staking-kms-secret-path"
|
||||
StakingKMSTokenKey = "staking-kms-token"
|
||||
HTTPIdleTimeoutKey = "http-idle-timeout"
|
||||
StateSyncIPsKey = "state-sync-ips"
|
||||
StateSyncIDsKey = "state-sync-ids"
|
||||
BootstrapNodesKey = "bootstrap-nodes"
|
||||
BootstrapIPsKey = "bootstrap-ips"
|
||||
BootstrapIDsKey = "bootstrap-ids"
|
||||
SkipBootstrapKey = "skip-bootstrap"
|
||||
EnableAutominingKey = "enable-automining"
|
||||
StakingHostKey = "staking-host"
|
||||
StakingPortKey = "staking-port"
|
||||
StakingEphemeralCertEnabledKey = "staking-ephemeral-cert-enabled"
|
||||
StakingTLSKeyPathKey = "staking-tls-key-file"
|
||||
StakingTLSKeyContentKey = "staking-tls-key-file-content"
|
||||
StakingCertPathKey = "staking-tls-cert-file"
|
||||
StakingCertContentKey = "staking-tls-cert-file-content"
|
||||
StakingEphemeralSignerEnabledKey = "staking-ephemeral-signer-enabled"
|
||||
StakingSignerKeyPathKey = "staking-signer-key-file"
|
||||
StakingSignerKeyContentKey = "staking-signer-key-file-content"
|
||||
StakingKMSEndpointKey = "staking-kms-endpoint"
|
||||
StakingKMSSecretPathKey = "staking-kms-secret-path"
|
||||
StakingKMSTokenKey = "staking-kms-token"
|
||||
// Strict-PQ staking identity (FIPS 204 ML-DSA-65). When set, the node
|
||||
// uses the ML-DSA-65 public key as the NodeID source via
|
||||
// ids.NodeIDSchemeMLDSA65.DeriveMLDSA(chainID, pubKey), replacing the
|
||||
// classical TLS-cert NodeID derivation. Strict-PQ profiles require
|
||||
// these; classical-compat chains ignore them.
|
||||
StakingMLDSAKeyPathKey = "staking-mldsa-key-file"
|
||||
StakingMLDSAKeyContentKey = "staking-mldsa-key-file-content"
|
||||
StakingMLDSAPubKeyPathKey = "staking-mldsa-pub-key-file"
|
||||
StakingMLDSAPubKeyContentKey = "staking-mldsa-pub-key-file-content"
|
||||
StakingMLDSAKeyPathKey = "staking-mldsa-key-file"
|
||||
StakingMLDSAKeyContentKey = "staking-mldsa-key-file-content"
|
||||
StakingMLDSAPubKeyPathKey = "staking-mldsa-pub-key-file"
|
||||
StakingMLDSAPubKeyContentKey = "staking-mldsa-pub-key-file-content"
|
||||
// Strict-PQ handshake KEM (FIPS 203 ML-KEM-768). Peer-facing public
|
||||
// key is published in the validator-set entry so peers can encapsulate
|
||||
// to it for session-key establishment with no classical fallback.
|
||||
@@ -264,17 +264,17 @@ const (
|
||||
ForceIgnoreChecksumKey = "force-ignore-checksum"
|
||||
|
||||
// Low Memory / Dev Light Mode Keys
|
||||
LowMemoryKey = "low-memory"
|
||||
MemoryProfileKey = "memory-profile"
|
||||
DevLightKey = "dev-light"
|
||||
ConfigProfileKey = "config-profile"
|
||||
DBCacheSizeKey = "db-cache-size"
|
||||
DBMemtableSizeKey = "db-memtable-size"
|
||||
StateCacheSizeKey = "state-cache-size"
|
||||
BlockCacheSizeKey = "block-cache-size"
|
||||
DisableBloomFiltersKey = "disable-bloom-filters"
|
||||
LazyChainLoadingKey = "lazy-chain-loading"
|
||||
SingleValidatorModeKey = "single-validator-mode"
|
||||
LowMemoryKey = "low-memory"
|
||||
MemoryProfileKey = "memory-profile"
|
||||
DevLightKey = "dev-light"
|
||||
ConfigProfileKey = "config-profile"
|
||||
DBCacheSizeKey = "db-cache-size"
|
||||
DBMemtableSizeKey = "db-memtable-size"
|
||||
StateCacheSizeKey = "state-cache-size"
|
||||
BlockCacheSizeKey = "block-cache-size"
|
||||
DisableBloomFiltersKey = "disable-bloom-filters"
|
||||
LazyChainLoadingKey = "lazy-chain-loading"
|
||||
SingleValidatorModeKey = "single-validator-mode"
|
||||
|
||||
// VM Transport Keys
|
||||
VMTransportKey = "vm-transport"
|
||||
|
||||
+10
-10
@@ -10,23 +10,23 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/luxfi/ids"
|
||||
"github.com/luxfi/node/server/http"
|
||||
"github.com/luxfi/node/benchlist"
|
||||
"github.com/luxfi/node/chains"
|
||||
"github.com/luxfi/node/genesis/builder"
|
||||
"github.com/luxfi/node/network"
|
||||
"github.com/luxfi/node/server/http"
|
||||
// "github.com/luxfi/consensus/core/router" // Unused
|
||||
"github.com/luxfi/crypto/bls"
|
||||
"github.com/luxfi/crypto/mldsa"
|
||||
mlkemcrypto "github.com/luxfi/crypto/mlkem"
|
||||
"github.com/luxfi/node/nets"
|
||||
"github.com/luxfi/node/network/tracker"
|
||||
"github.com/luxfi/node/upgrade"
|
||||
"github.com/luxfi/node/trace"
|
||||
"github.com/luxfi/node/upgrade"
|
||||
// "github.com/luxfi/log" // Unused
|
||||
"github.com/luxfi/math/set"
|
||||
"github.com/luxfi/timer"
|
||||
"github.com/luxfi/node/utils/profiler"
|
||||
"github.com/luxfi/timer"
|
||||
)
|
||||
|
||||
type APIIndexerConfig struct {
|
||||
@@ -101,13 +101,13 @@ type StakingConfig struct {
|
||||
// publishes in its validator-set entry so peers can encapsulate to it
|
||||
// for session-key establishment with no classical fallback. The
|
||||
// HandshakeMLKEMPriv stays local to the pod.
|
||||
StakingMLDSA *mldsa.PrivateKey `json:"-"`
|
||||
StakingMLDSAPub []byte `json:"-"`
|
||||
HandshakeMLKEMPriv *mlkemcrypto.PrivateKey `json:"-"`
|
||||
HandshakeMLKEMPub []byte `json:"-"`
|
||||
StakingMLDSA *mldsa.PrivateKey `json:"-"`
|
||||
StakingMLDSAPub []byte `json:"-"`
|
||||
HandshakeMLKEMPriv *mlkemcrypto.PrivateKey `json:"-"`
|
||||
HandshakeMLKEMPub []byte `json:"-"`
|
||||
// File paths kept for log-line context, mirroring StakingKeyPath etc.
|
||||
StakingMLDSAKeyPath string `json:"stakingMLDSAKeyPath,omitempty"`
|
||||
StakingMLDSAPubPath string `json:"stakingMLDSAPubPath,omitempty"`
|
||||
StakingMLDSAKeyPath string `json:"stakingMLDSAKeyPath,omitempty"`
|
||||
StakingMLDSAPubPath string `json:"stakingMLDSAPubPath,omitempty"`
|
||||
HandshakeMLKEMKeyPath string `json:"handshakeMLKEMKeyPath,omitempty"`
|
||||
HandshakeMLKEMPubPath string `json:"handshakeMLKEMPubPath,omitempty"`
|
||||
}
|
||||
@@ -169,7 +169,7 @@ type Config struct {
|
||||
|
||||
// Genesis information
|
||||
GenesisBytes []byte `json:"-"`
|
||||
UTXOAssetID ids.ID `json:"utxoAssetID"`
|
||||
UTXOAssetID ids.ID `json:"utxoAssetID"`
|
||||
|
||||
// ID of the network this node should connect to
|
||||
NetworkID uint32 `json:"networkID"`
|
||||
|
||||
@@ -9,9 +9,9 @@ import (
|
||||
|
||||
"go.uber.org/zap"
|
||||
|
||||
"github.com/luxfi/runtime"
|
||||
"github.com/luxfi/ids"
|
||||
"github.com/luxfi/log"
|
||||
"github.com/luxfi/runtime"
|
||||
)
|
||||
|
||||
var (
|
||||
|
||||
@@ -68,32 +68,32 @@ type MLDSAWork struct {
|
||||
|
||||
// BlockVerifyWork contains all verification batches for a single block.
|
||||
type BlockVerifyWork struct {
|
||||
BLS *BLSWork
|
||||
BLS *BLSWork
|
||||
Corona *CoronaWork
|
||||
ZK *ZKWork
|
||||
MLDSA *MLDSAWork
|
||||
ZK *ZKWork
|
||||
MLDSA *MLDSAWork
|
||||
}
|
||||
|
||||
// BlockVerifyResult contains verification results for all batch types.
|
||||
type BlockVerifyResult struct {
|
||||
BLSValid []bool
|
||||
BLSValid []bool
|
||||
CoronaValid []bool
|
||||
ZKValid bool
|
||||
MLDSAValid []bool
|
||||
ZKValid bool
|
||||
MLDSAValid []bool
|
||||
|
||||
GPUUsed bool
|
||||
BLSTime time.Duration
|
||||
GPUUsed bool
|
||||
BLSTime time.Duration
|
||||
CoronaTime time.Duration
|
||||
ZKTime time.Duration
|
||||
MLDSATime time.Duration
|
||||
TotalTime time.Duration
|
||||
ZKTime time.Duration
|
||||
MLDSATime time.Duration
|
||||
TotalTime time.Duration
|
||||
}
|
||||
|
||||
var (
|
||||
ErrBLSSizeMismatch = errors.New("BLS batch size mismatch: messages, signatures, and pubkeys must have equal length")
|
||||
ErrBLSSizeMismatch = errors.New("BLS batch size mismatch: messages, signatures, and pubkeys must have equal length")
|
||||
ErrCoronaSizeMismatch = errors.New("Corona batch size mismatch: messages, signatures, and pubkeys must have equal length")
|
||||
ErrZKSizeMismatch = errors.New("ZK batch size mismatch: scalars and bases must have equal length")
|
||||
ErrMLDSASizeMismatch = errors.New("ML-DSA batch size mismatch: messages, signatures, and pubkeys must have equal length")
|
||||
ErrZKSizeMismatch = errors.New("ZK batch size mismatch: scalars and bases must have equal length")
|
||||
ErrMLDSASizeMismatch = errors.New("ML-DSA batch size mismatch: messages, signatures, and pubkeys must have equal length")
|
||||
)
|
||||
|
||||
// VerifyBlock dispatches all verification work for a block through the GPU pipeline.
|
||||
|
||||
@@ -79,10 +79,10 @@ func TestGPUPipeline_AllFourTypes(t *testing.T) {
|
||||
pipeline := NewGPUVerifyPipeline()
|
||||
|
||||
work := &BlockVerifyWork{
|
||||
BLS: makeBLSWork(5),
|
||||
BLS: makeBLSWork(5),
|
||||
Corona: makeCoronaWork(3),
|
||||
ZK: makeZKWork(2),
|
||||
MLDSA: makeMLDSAWork(10),
|
||||
ZK: makeZKWork(2),
|
||||
MLDSA: makeMLDSAWork(10),
|
||||
}
|
||||
|
||||
result, err := pipeline.VerifyBlock(work)
|
||||
@@ -276,10 +276,10 @@ func BenchmarkGPUPipeline(b *testing.B) {
|
||||
pipeline := NewGPUVerifyPipeline()
|
||||
|
||||
work := &BlockVerifyWork{
|
||||
BLS: makeBLSWork(100),
|
||||
BLS: makeBLSWork(100),
|
||||
Corona: makeCoronaWork(50),
|
||||
ZK: makeZKWork(10),
|
||||
MLDSA: makeMLDSAWork(200),
|
||||
ZK: makeZKWork(10),
|
||||
MLDSA: makeMLDSAWork(200),
|
||||
}
|
||||
|
||||
b.ResetTimer()
|
||||
|
||||
@@ -116,11 +116,11 @@ func generateValidatorStates(n int) []ValidatorState {
|
||||
_, _ = rand.Read(rtKey)
|
||||
|
||||
states[i] = ValidatorState{
|
||||
NodeID: ids.GenerateTestNodeID(),
|
||||
Weight: 1000,
|
||||
BLSPubKey: blsKey,
|
||||
NodeID: ids.GenerateTestNodeID(),
|
||||
Weight: 1000,
|
||||
BLSPubKey: blsKey,
|
||||
CoronaKey: rtKey,
|
||||
Active: true,
|
||||
Active: true,
|
||||
}
|
||||
}
|
||||
return states
|
||||
@@ -575,13 +575,13 @@ func TestQuasarMemoryPressure(t *testing.T) {
|
||||
_, _ = rand.Read(blockID[:])
|
||||
|
||||
finality := &QuantumFinality{
|
||||
BlockID: blockID,
|
||||
PChainHeight: uint64(i),
|
||||
QChainHeight: uint64(i),
|
||||
BLSProof: make([]byte, 96),
|
||||
CoronaProof: make([]byte, 1024),
|
||||
TotalWeight: 1000,
|
||||
SignerWeight: 700,
|
||||
BlockID: blockID,
|
||||
PChainHeight: uint64(i),
|
||||
QChainHeight: uint64(i),
|
||||
BLSProof: make([]byte, 96),
|
||||
CoronaProof: make([]byte, 1024),
|
||||
TotalWeight: 1000,
|
||||
SignerWeight: 700,
|
||||
}
|
||||
q.SetFinalized(blockID, finality)
|
||||
}
|
||||
@@ -913,10 +913,10 @@ func TestQuasarEdgeCases(t *testing.T) {
|
||||
require.NoError(t, err)
|
||||
|
||||
finality := &QuantumFinality{
|
||||
BLSProof: nil,
|
||||
CoronaProof: nil,
|
||||
TotalWeight: 1000,
|
||||
SignerWeight: 700,
|
||||
BLSProof: nil,
|
||||
CoronaProof: nil,
|
||||
TotalWeight: 1000,
|
||||
SignerWeight: 700,
|
||||
}
|
||||
|
||||
err = q.Verify(finality)
|
||||
@@ -928,10 +928,10 @@ func TestQuasarEdgeCases(t *testing.T) {
|
||||
require.NoError(t, err)
|
||||
|
||||
finality := &QuantumFinality{
|
||||
BLSProof: []byte("proof"),
|
||||
CoronaProof: []byte("proof"),
|
||||
TotalWeight: 1000,
|
||||
SignerWeight: 500, // Only 50%, needs 67%
|
||||
BLSProof: []byte("proof"),
|
||||
CoronaProof: []byte("proof"),
|
||||
TotalWeight: 1000,
|
||||
SignerWeight: 500, // Only 50%, needs 67%
|
||||
}
|
||||
|
||||
err = q.Verify(finality)
|
||||
|
||||
@@ -401,7 +401,7 @@ func TestConcurrentPruningStress(t *testing.T) {
|
||||
require.NoError(t, err)
|
||||
|
||||
const (
|
||||
numWriters = 8
|
||||
numWriters = 8
|
||||
opsPerWriter = 5000
|
||||
)
|
||||
|
||||
|
||||
+45
-45
@@ -61,15 +61,15 @@ import (
|
||||
// 2. t-of-n validators completed Corona threshold (post-quantum secure)
|
||||
|
||||
var (
|
||||
ErrQuasarNotStarted = errors.New("quasar not started")
|
||||
ErrPChainNotConnected = errors.New("P-Chain not connected")
|
||||
ErrQChainNotConnected = errors.New("Q-Chain not connected")
|
||||
ErrCoronaNotConnected = errors.New("Corona coordinator not connected")
|
||||
ErrInsufficientWeight = errors.New("insufficient validator weight")
|
||||
ErrInsufficientSigners = errors.New("insufficient Corona signers")
|
||||
ErrFinalityFailed = errors.New("hybrid finality verification failed")
|
||||
ErrBLSFailed = errors.New("BLS aggregation failed")
|
||||
ErrCoronaFailed = errors.New("Corona threshold signing failed")
|
||||
ErrQuasarNotStarted = errors.New("quasar not started")
|
||||
ErrPChainNotConnected = errors.New("P-Chain not connected")
|
||||
ErrQChainNotConnected = errors.New("Q-Chain not connected")
|
||||
ErrCoronaNotConnected = errors.New("Corona coordinator not connected")
|
||||
ErrInsufficientWeight = errors.New("insufficient validator weight")
|
||||
ErrInsufficientSigners = errors.New("insufficient Corona signers")
|
||||
ErrFinalityFailed = errors.New("hybrid finality verification failed")
|
||||
ErrBLSFailed = errors.New("BLS aggregation failed")
|
||||
ErrCoronaFailed = errors.New("Corona threshold signing failed")
|
||||
)
|
||||
|
||||
// PChainProvider provides P-Chain state and finality events
|
||||
@@ -87,11 +87,11 @@ type QuantumSignerFallback interface {
|
||||
// ValidatorState represents a validator's current state
|
||||
// Each validator has BOTH BLS and Corona keys
|
||||
type ValidatorState struct {
|
||||
NodeID ids.NodeID
|
||||
Weight uint64
|
||||
BLSPubKey []byte // BLS public key for aggregate signatures
|
||||
NodeID ids.NodeID
|
||||
Weight uint64
|
||||
BLSPubKey []byte // BLS public key for aggregate signatures
|
||||
CoronaKey []byte // Corona public key share for threshold sigs
|
||||
Active bool
|
||||
Active bool
|
||||
}
|
||||
|
||||
// FinalityEvent represents a P-Chain finality event
|
||||
@@ -104,18 +104,18 @@ type FinalityEvent struct {
|
||||
|
||||
// QuantumFinality represents a block that achieved hybrid quantum finality
|
||||
type QuantumFinality struct {
|
||||
BlockID ids.ID
|
||||
PChainHeight uint64
|
||||
QChainHeight uint64
|
||||
BLSProof []byte // Aggregated BLS signature (96 bytes)
|
||||
BlockID ids.ID
|
||||
PChainHeight uint64
|
||||
QChainHeight uint64
|
||||
BLSProof []byte // Aggregated BLS signature (96 bytes)
|
||||
CoronaProof []byte // Serialized Corona threshold signature
|
||||
SignerBitset []byte // Which validators signed BLS
|
||||
SignerBitset []byte // Which validators signed BLS
|
||||
CoronaSigners []ids.NodeID // Which validators participated in Corona
|
||||
TotalWeight uint64
|
||||
SignerWeight uint64
|
||||
BLSLatency time.Duration
|
||||
TotalWeight uint64
|
||||
SignerWeight uint64
|
||||
BLSLatency time.Duration
|
||||
CoronaLatency time.Duration
|
||||
Timestamp time.Time
|
||||
Timestamp time.Time
|
||||
}
|
||||
|
||||
// Quasar binds P-Chain and Q-Chain consensus into hybrid quantum finality
|
||||
@@ -369,18 +369,18 @@ func (q *Quasar) processFinality(ctx context.Context, event FinalityEvent) error
|
||||
coronaProof = coronaSig.Bytes()
|
||||
}
|
||||
finality := &QuantumFinality{
|
||||
BlockID: event.BlockID,
|
||||
PChainHeight: event.Height,
|
||||
QChainHeight: q.qHeight,
|
||||
BLSProof: blsProof,
|
||||
BlockID: event.BlockID,
|
||||
PChainHeight: event.Height,
|
||||
QChainHeight: q.qHeight,
|
||||
BLSProof: blsProof,
|
||||
CoronaProof: coronaProof,
|
||||
SignerBitset: signerBitset,
|
||||
SignerBitset: signerBitset,
|
||||
CoronaSigners: coronaSigners,
|
||||
TotalWeight: totalWeight,
|
||||
SignerWeight: signerWeight,
|
||||
BLSLatency: blsLatency,
|
||||
TotalWeight: totalWeight,
|
||||
SignerWeight: signerWeight,
|
||||
BLSLatency: blsLatency,
|
||||
CoronaLatency: coronaLatency,
|
||||
Timestamp: time.Now(),
|
||||
Timestamp: time.Now(),
|
||||
}
|
||||
|
||||
q.finalized[event.BlockID] = finality
|
||||
@@ -590,13 +590,13 @@ func (q *Quasar) Stats() QuasarStats {
|
||||
}
|
||||
|
||||
return QuasarStats{
|
||||
PChainHeight: q.pHeight,
|
||||
QChainHeight: q.qHeight,
|
||||
FinalizedBlocks: len(q.finalized),
|
||||
Threshold: q.threshold,
|
||||
QuorumNum: q.quorumNum,
|
||||
QuorumDen: q.quorumDen,
|
||||
Running: q.running,
|
||||
PChainHeight: q.pHeight,
|
||||
QChainHeight: q.qHeight,
|
||||
FinalizedBlocks: len(q.finalized),
|
||||
Threshold: q.threshold,
|
||||
QuorumNum: q.quorumNum,
|
||||
QuorumDen: q.quorumDen,
|
||||
Running: q.running,
|
||||
CoronaParties: coronaStats.NumParties,
|
||||
CoronaThreshold: coronaStats.Threshold,
|
||||
CoronaReady: coronaStats.Initialized,
|
||||
@@ -605,13 +605,13 @@ func (q *Quasar) Stats() QuasarStats {
|
||||
|
||||
// QuasarStats contains quasar statistics
|
||||
type QuasarStats struct {
|
||||
PChainHeight uint64
|
||||
QChainHeight uint64
|
||||
FinalizedBlocks int
|
||||
Threshold int
|
||||
QuorumNum uint64
|
||||
QuorumDen uint64
|
||||
Running bool
|
||||
PChainHeight uint64
|
||||
QChainHeight uint64
|
||||
FinalizedBlocks int
|
||||
Threshold int
|
||||
QuorumNum uint64
|
||||
QuorumDen uint64
|
||||
Running bool
|
||||
CoronaParties int
|
||||
CoronaThreshold int
|
||||
CoronaReady bool
|
||||
|
||||
@@ -181,7 +181,7 @@ func (s *BLSSignature) Signers() []ids.NodeID { return s.signers }
|
||||
|
||||
// QuasarSignature combines BLS and Corona signatures for P/Q security
|
||||
type QuasarSignature struct {
|
||||
bls *BLSSignature
|
||||
bls *BLSSignature
|
||||
corona *CoronaSignature
|
||||
}
|
||||
|
||||
@@ -211,7 +211,7 @@ func (s *QuasarSignature) Signers() []ids.NodeID {
|
||||
return s.bls.Signers()
|
||||
}
|
||||
|
||||
func (s *QuasarSignature) BLS() *BLSSignature { return s.bls }
|
||||
func (s *QuasarSignature) BLS() *BLSSignature { return s.bls }
|
||||
func (s *QuasarSignature) Corona() *CoronaSignature { return s.corona }
|
||||
|
||||
// QuasarSigner combines classical and post-quantum signers
|
||||
|
||||
+1
-1
@@ -7,9 +7,9 @@ import (
|
||||
"testing"
|
||||
|
||||
"github.com/luxfi/consensus/utils/set"
|
||||
validators "github.com/luxfi/validators"
|
||||
"github.com/luxfi/constants"
|
||||
"github.com/luxfi/ids"
|
||||
validators "github.com/luxfi/validators"
|
||||
)
|
||||
|
||||
func TestFullValidatorFunctionality(t *testing.T) {
|
||||
|
||||
@@ -4,9 +4,9 @@
|
||||
package debug
|
||||
|
||||
import (
|
||||
validators "github.com/luxfi/validators"
|
||||
"github.com/luxfi/constants"
|
||||
"github.com/luxfi/ids"
|
||||
validators "github.com/luxfi/validators"
|
||||
"testing"
|
||||
)
|
||||
|
||||
|
||||
@@ -23,11 +23,11 @@ import (
|
||||
"github.com/luxfi/net/endpoints"
|
||||
"github.com/luxfi/node/vms/components/gas"
|
||||
"github.com/luxfi/node/vms/platformvm/genesis"
|
||||
xvmgenesis "github.com/luxfi/node/vms/xvm/genesis"
|
||||
"github.com/luxfi/node/vms/platformvm/reward"
|
||||
"github.com/luxfi/node/vms/platformvm/signer"
|
||||
pchaintxs "github.com/luxfi/node/vms/platformvm/txs"
|
||||
"github.com/luxfi/node/vms/platformvm/validators/fee"
|
||||
xvmgenesis "github.com/luxfi/node/vms/xvm/genesis"
|
||||
"github.com/luxfi/utxo/bls12381fx"
|
||||
"github.com/luxfi/utxo/ed25519fx"
|
||||
"github.com/luxfi/utxo/mldsafx"
|
||||
@@ -38,8 +38,8 @@ import (
|
||||
"github.com/luxfi/utxo/secp256r1fx"
|
||||
"github.com/luxfi/utxo/slhdsafx"
|
||||
|
||||
genesiscfg "github.com/luxfi/genesis/pkg/genesis"
|
||||
genesisconfigs "github.com/luxfi/genesis/configs"
|
||||
genesiscfg "github.com/luxfi/genesis/pkg/genesis"
|
||||
)
|
||||
|
||||
// Chain alias vars are derived from the single source of truth (Registry
|
||||
|
||||
@@ -160,10 +160,10 @@ func TestGetConfig(t *testing.T) {
|
||||
|
||||
func TestGetConfigAllocations(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
networkID uint32
|
||||
minAllocs int
|
||||
minStakers int
|
||||
name string
|
||||
networkID uint32
|
||||
minAllocs int
|
||||
minStakers int
|
||||
}{
|
||||
{"Mainnet", constants.MainnetID, 50, 1},
|
||||
{"Testnet", constants.TestnetID, 50, 1},
|
||||
|
||||
@@ -126,4 +126,3 @@ func VMAliasesMap() map[ids.ID][]string {
|
||||
}
|
||||
return m
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -9,8 +9,8 @@ import (
|
||||
|
||||
"github.com/luxfi/formatting"
|
||||
"github.com/luxfi/ids"
|
||||
"github.com/luxfi/rpc"
|
||||
"github.com/luxfi/node/utils/json"
|
||||
"github.com/luxfi/rpc"
|
||||
)
|
||||
|
||||
type Client struct {
|
||||
|
||||
@@ -11,9 +11,9 @@ import (
|
||||
|
||||
"github.com/luxfi/formatting"
|
||||
"github.com/luxfi/ids"
|
||||
"github.com/luxfi/node/utils/json"
|
||||
"github.com/luxfi/rpc"
|
||||
"github.com/luxfi/utils"
|
||||
"github.com/luxfi/node/utils/json"
|
||||
)
|
||||
|
||||
type mockClient struct {
|
||||
|
||||
+1
-1
@@ -8,13 +8,13 @@ import (
|
||||
"fmt"
|
||||
"sync"
|
||||
|
||||
"github.com/luxfi/runtime"
|
||||
"github.com/luxfi/database"
|
||||
"github.com/luxfi/database/prefixdb"
|
||||
"github.com/luxfi/database/versiondb"
|
||||
"github.com/luxfi/ids"
|
||||
"github.com/luxfi/log"
|
||||
nodeconsensus "github.com/luxfi/node/consensus"
|
||||
"github.com/luxfi/runtime"
|
||||
"github.com/luxfi/timer/mockable"
|
||||
)
|
||||
|
||||
|
||||
+1
-1
@@ -15,9 +15,9 @@ import (
|
||||
"github.com/luxfi/database/prefixdb"
|
||||
"github.com/luxfi/ids"
|
||||
"github.com/luxfi/log"
|
||||
"github.com/luxfi/node/server/http"
|
||||
"github.com/luxfi/node/chains"
|
||||
nodeconsensus "github.com/luxfi/node/consensus"
|
||||
"github.com/luxfi/node/server/http"
|
||||
"github.com/luxfi/node/utils/json"
|
||||
"github.com/luxfi/runtime"
|
||||
"github.com/luxfi/timer/mockable"
|
||||
|
||||
+1
-1
@@ -6,8 +6,8 @@ package message
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/luxfi/metric"
|
||||
compression "github.com/luxfi/compress"
|
||||
"github.com/luxfi/metric"
|
||||
)
|
||||
|
||||
var _ Creator = (*creator)(nil)
|
||||
|
||||
@@ -10,10 +10,10 @@ import (
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
compression "github.com/luxfi/compress"
|
||||
"github.com/luxfi/ids"
|
||||
"github.com/luxfi/node/proto/p2p"
|
||||
"github.com/luxfi/timer/mockable"
|
||||
compression "github.com/luxfi/compress"
|
||||
)
|
||||
|
||||
func Test_newMsgBuilder(t *testing.T) {
|
||||
|
||||
@@ -15,9 +15,9 @@ import (
|
||||
time "time"
|
||||
|
||||
ids "github.com/luxfi/ids"
|
||||
"github.com/luxfi/net/endpoints"
|
||||
message "github.com/luxfi/node/message"
|
||||
p2p "github.com/luxfi/node/proto/p2p"
|
||||
"github.com/luxfi/net/endpoints"
|
||||
gomock "go.uber.org/mock/gomock"
|
||||
)
|
||||
|
||||
|
||||
+1
-1
@@ -8,12 +8,12 @@ import (
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
compression "github.com/luxfi/compress"
|
||||
"github.com/luxfi/constants"
|
||||
"github.com/luxfi/ids"
|
||||
"github.com/luxfi/metric"
|
||||
"github.com/luxfi/node/proto/p2p"
|
||||
"github.com/luxfi/timer/mockable"
|
||||
compression "github.com/luxfi/compress"
|
||||
)
|
||||
|
||||
const (
|
||||
|
||||
@@ -12,9 +12,9 @@ import (
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
compression "github.com/luxfi/compress"
|
||||
"github.com/luxfi/ids"
|
||||
"github.com/luxfi/node/proto/p2p"
|
||||
compression "github.com/luxfi/compress"
|
||||
)
|
||||
|
||||
var (
|
||||
|
||||
@@ -12,10 +12,10 @@ import (
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
compression "github.com/luxfi/compress"
|
||||
"github.com/luxfi/ids"
|
||||
"github.com/luxfi/node/proto/p2p"
|
||||
"github.com/luxfi/node/staking"
|
||||
compression "github.com/luxfi/compress"
|
||||
)
|
||||
|
||||
func TestMessage(t *testing.T) {
|
||||
|
||||
@@ -17,8 +17,8 @@ import (
|
||||
time "time"
|
||||
|
||||
ids "github.com/luxfi/ids"
|
||||
p2p "github.com/luxfi/node/proto/p2p"
|
||||
"github.com/luxfi/net/endpoints"
|
||||
p2p "github.com/luxfi/node/proto/p2p"
|
||||
)
|
||||
|
||||
// MockOutboundMsgBuilder is a mock of OutboundMsgBuilder interface.
|
||||
|
||||
+55
-55
@@ -17,37 +17,37 @@ const (
|
||||
// Message is the top-level P2P message container
|
||||
type Message struct {
|
||||
// Only one of these should be set
|
||||
CompressedZstd []byte
|
||||
Ping *Ping
|
||||
Pong *Pong
|
||||
Handshake *Handshake
|
||||
GetPeerList *GetPeerList
|
||||
PeerList *PeerList
|
||||
GetStateSummaryFrontier *GetStateSummaryFrontier
|
||||
StateSummaryFrontier *StateSummaryFrontier
|
||||
GetAcceptedStateSummary *GetAcceptedStateSummary
|
||||
AcceptedStateSummary *AcceptedStateSummary
|
||||
GetAcceptedFrontier *GetAcceptedFrontier
|
||||
AcceptedFrontier *AcceptedFrontier
|
||||
GetAccepted *GetAccepted
|
||||
Accepted *Accepted
|
||||
GetAncestors *GetAncestors
|
||||
Ancestors *Ancestors
|
||||
Get *Get
|
||||
Put *Put
|
||||
PushQuery *PushQuery
|
||||
PullQuery *PullQuery
|
||||
Chits *Chits
|
||||
Request *Request
|
||||
Response *Response
|
||||
Gossip *Gossip
|
||||
CompressedZstd []byte
|
||||
Ping *Ping
|
||||
Pong *Pong
|
||||
Handshake *Handshake
|
||||
GetPeerList *GetPeerList
|
||||
PeerList *PeerList
|
||||
GetStateSummaryFrontier *GetStateSummaryFrontier
|
||||
StateSummaryFrontier *StateSummaryFrontier
|
||||
GetAcceptedStateSummary *GetAcceptedStateSummary
|
||||
AcceptedStateSummary *AcceptedStateSummary
|
||||
GetAcceptedFrontier *GetAcceptedFrontier
|
||||
AcceptedFrontier *AcceptedFrontier
|
||||
GetAccepted *GetAccepted
|
||||
Accepted *Accepted
|
||||
GetAncestors *GetAncestors
|
||||
Ancestors *Ancestors
|
||||
Get *Get
|
||||
Put *Put
|
||||
PushQuery *PushQuery
|
||||
PullQuery *PullQuery
|
||||
Chits *Chits
|
||||
Request *Request
|
||||
Response *Response
|
||||
Gossip *Gossip
|
||||
BFT *BFT
|
||||
}
|
||||
|
||||
// Ping message
|
||||
type Ping struct {
|
||||
Uptime uint32
|
||||
ChainIds []*ChainPingEntry
|
||||
Uptime uint32
|
||||
ChainIds []*ChainPingEntry
|
||||
}
|
||||
|
||||
// ChainPingEntry is the per-chain payload in Ping/Pong.
|
||||
@@ -59,24 +59,24 @@ type ChainPingEntry struct {
|
||||
|
||||
// Pong message
|
||||
type Pong struct {
|
||||
Uptime uint32
|
||||
ChainIds []*ChainPingEntry
|
||||
Uptime uint32
|
||||
ChainIds []*ChainPingEntry
|
||||
}
|
||||
|
||||
// Handshake message
|
||||
type Handshake struct {
|
||||
NetworkId uint32
|
||||
MyTime uint64
|
||||
IpAddr []byte
|
||||
IpPort uint32
|
||||
IpSigningTime uint64
|
||||
IpNodeIdSig []byte
|
||||
NetworkId uint32
|
||||
MyTime uint64
|
||||
IpAddr []byte
|
||||
IpPort uint32
|
||||
IpSigningTime uint64
|
||||
IpNodeIdSig []byte
|
||||
TrackedChains [][]byte
|
||||
Client *Client
|
||||
SupportedAcps []uint32
|
||||
ObjectedAcps []uint32
|
||||
KnownPeers *BloomFilter
|
||||
IpBlsSig []byte
|
||||
Client *Client
|
||||
SupportedAcps []uint32
|
||||
ObjectedAcps []uint32
|
||||
KnownPeers *BloomFilter
|
||||
IpBlsSig []byte
|
||||
}
|
||||
|
||||
// Client info in handshake
|
||||
@@ -210,9 +210,9 @@ type GetAncestors struct {
|
||||
EngineType EngineType
|
||||
}
|
||||
|
||||
func (m *GetAncestors) GetChainId() []byte { return m.ChainId }
|
||||
func (m *GetAncestors) GetRequestId() uint32 { return m.RequestId }
|
||||
func (m *GetAncestors) GetDeadline() uint64 { return m.Deadline }
|
||||
func (m *GetAncestors) GetChainId() []byte { return m.ChainId }
|
||||
func (m *GetAncestors) GetRequestId() uint32 { return m.RequestId }
|
||||
func (m *GetAncestors) GetDeadline() uint64 { return m.Deadline }
|
||||
func (m *GetAncestors) GetEngineType() EngineType { return m.EngineType }
|
||||
|
||||
// Ancestors message
|
||||
@@ -240,10 +240,10 @@ func (m *Get) GetDeadline() uint64 { return m.Deadline }
|
||||
|
||||
// Put message
|
||||
type Put struct {
|
||||
ChainId []byte
|
||||
RequestId uint32
|
||||
Container []byte
|
||||
EngineType EngineType
|
||||
ChainId []byte
|
||||
RequestId uint32
|
||||
Container []byte
|
||||
EngineType EngineType
|
||||
}
|
||||
|
||||
func (m *Put) GetChainId() []byte { return m.ChainId }
|
||||
@@ -251,11 +251,11 @@ func (m *Put) GetRequestId() uint32 { return m.RequestId }
|
||||
|
||||
// PushQuery message
|
||||
type PushQuery struct {
|
||||
ChainId []byte
|
||||
RequestId uint32
|
||||
Deadline uint64
|
||||
Container []byte
|
||||
EngineType EngineType
|
||||
ChainId []byte
|
||||
RequestId uint32
|
||||
Deadline uint64
|
||||
Container []byte
|
||||
EngineType EngineType
|
||||
RequestedHeight uint64
|
||||
}
|
||||
|
||||
@@ -279,11 +279,11 @@ func (m *PullQuery) GetDeadline() uint64 { return m.Deadline }
|
||||
|
||||
// Chits message
|
||||
type Chits struct {
|
||||
ChainId []byte
|
||||
RequestId uint32
|
||||
PreferredId []byte
|
||||
ChainId []byte
|
||||
RequestId uint32
|
||||
PreferredId []byte
|
||||
PreferredIdAtHeight []byte
|
||||
AcceptedId []byte
|
||||
AcceptedId []byte
|
||||
}
|
||||
|
||||
func (m *Chits) GetChainId() []byte { return m.ChainId }
|
||||
|
||||
+7
-8
@@ -11,12 +11,12 @@ import (
|
||||
|
||||
const (
|
||||
// Message type tags for ZAP encoding
|
||||
tagCompressedZstd = 1
|
||||
tagPing = 2
|
||||
tagPong = 3
|
||||
tagHandshake = 4
|
||||
tagGetPeerList = 5
|
||||
tagPeerList = 6
|
||||
tagCompressedZstd = 1
|
||||
tagPing = 2
|
||||
tagPong = 3
|
||||
tagHandshake = 4
|
||||
tagGetPeerList = 5
|
||||
tagPeerList = 6
|
||||
tagGetStateSummaryFrontier = 7
|
||||
tagStateSummaryFrontier = 8
|
||||
tagGetAcceptedStateSummary = 9
|
||||
@@ -35,13 +35,12 @@ const (
|
||||
tagRequest = 22
|
||||
tagResponse = 23
|
||||
tagGossip = 24
|
||||
tagBFT = 25
|
||||
tagBFT = 25
|
||||
)
|
||||
|
||||
var (
|
||||
ErrInvalidMessage = errors.New("invalid wire message")
|
||||
ErrUnknownTag = errors.New("unknown message tag")
|
||||
|
||||
)
|
||||
|
||||
// Buffer for zero-copy encoding
|
||||
|
||||
+4
-4
@@ -19,7 +19,7 @@ func getPMPRouter() *pmpRouter {
|
||||
// pmpRouter stub for minimal build
|
||||
type pmpRouter struct{}
|
||||
|
||||
func (*pmpRouter) SupportsNAT() bool { return false }
|
||||
func (*pmpRouter) MapPort(_, _ uint16, _ string, _ time.Duration) error { return nil }
|
||||
func (*pmpRouter) UnmapPort(_, _ uint16) error { return nil }
|
||||
func (*pmpRouter) ExternalIP() (netip.Addr, error) { return netip.Addr{}, nil }
|
||||
func (*pmpRouter) SupportsNAT() bool { return false }
|
||||
func (*pmpRouter) MapPort(_, _ uint16, _ string, _ time.Duration) error { return nil }
|
||||
func (*pmpRouter) UnmapPort(_, _ uint16) error { return nil }
|
||||
func (*pmpRouter) ExternalIP() (netip.Addr, error) { return netip.Addr{}, nil }
|
||||
|
||||
+4
-4
@@ -19,7 +19,7 @@ func getUPnPRouter() *upnpRouter {
|
||||
// upnpRouter stub for minimal build
|
||||
type upnpRouter struct{}
|
||||
|
||||
func (*upnpRouter) SupportsNAT() bool { return false }
|
||||
func (*upnpRouter) MapPort(_, _ uint16, _ string, _ time.Duration) error { return nil }
|
||||
func (*upnpRouter) UnmapPort(_, _ uint16) error { return nil }
|
||||
func (*upnpRouter) ExternalIP() (netip.Addr, error) { return netip.Addr{}, nil }
|
||||
func (*upnpRouter) SupportsNAT() bool { return false }
|
||||
func (*upnpRouter) MapPort(_, _ uint16, _ string, _ time.Duration) error { return nil }
|
||||
func (*upnpRouter) UnmapPort(_, _ uint16) error { return nil }
|
||||
func (*upnpRouter) ExternalIP() (netip.Addr, error) { return netip.Addr{}, nil }
|
||||
|
||||
Reference in New Issue
Block a user