refactor: externalize node dependencies to dedicated packages

Major refactoring to reduce EVM's dependency on node:

External packages now used:
- github.com/luxfi/p2p v1.0.2 (network/p2p, gossip, lp118)
- github.com/luxfi/upgrade v1.0.0 (upgrade configs)
- github.com/luxfi/vms v0.1.0 (VM interfaces)
- github.com/luxfi/codec (codec utilities)
- github.com/luxfi/units (unit constants)
- github.com/luxfi/constants (network constants)
- github.com/luxfi/utils (wrappers, json codec)

Remaining node dependencies (minimal, for plugin model):
- node/vms/rpcchainvm (RPC plugin server)
- node/api (API utilities)
- node/utils/rpc (RPC utilities)
- node/version (version info)

This follows the principle: ONE canonical package for each concern.
This commit is contained in:
2025-12-04 08:36:14 -08:00
parent 107ae39d26
commit ff486d672e
63 changed files with 159 additions and 138 deletions
+1 -1
View File
@@ -20,7 +20,7 @@ import (
"github.com/luxfi/geth/consensus/misc/eip4844"
"github.com/luxfi/geth/core/types"
"github.com/luxfi/geth/trie"
"github.com/luxfi/node/utils/timer/mockable"
"github.com/luxfi/timer/mockable"
customheader "github.com/luxfi/evm/plugin/evm/header"
)
+1 -1
View File
@@ -61,7 +61,7 @@ import (
"github.com/luxfi/geth/ethdb"
"github.com/luxfi/geth/event"
"github.com/luxfi/log"
"github.com/luxfi/node/utils/timer/mockable"
"github.com/luxfi/timer/mockable"
)
// Config contains the configuration options of the ETH protocol.
+1 -1
View File
@@ -44,7 +44,7 @@ import (
"github.com/luxfi/geth/core/types"
"github.com/luxfi/geth/event"
"github.com/luxfi/log"
"github.com/luxfi/node/utils/timer/mockable"
"github.com/luxfi/timer/mockable"
"golang.org/x/exp/slices"
)
+1 -1
View File
@@ -47,7 +47,7 @@ import (
"github.com/luxfi/geth/common"
"github.com/luxfi/geth/core/rawdb"
"github.com/luxfi/geth/core/types"
"github.com/luxfi/node/utils/timer/mockable"
"github.com/luxfi/timer/mockable"
)
var _ eth.PushGossiper = (*fakePushGossiper)(nil)
+33 -3
View File
@@ -14,7 +14,10 @@ require (
github.com/holiman/billy v0.0.0-20250707135307-f2f9b9aae7db
github.com/holiman/bloomfilter/v2 v2.0.3
github.com/holiman/uint256 v1.3.2
github.com/luxfi/cache v0.0.0
github.com/luxfi/codec v0.0.0
github.com/luxfi/consensus v1.22.2
github.com/luxfi/constants v0.0.0
github.com/luxfi/crypto v1.17.7
github.com/luxfi/database v1.2.7
github.com/luxfi/geth v1.16.40
@@ -24,7 +27,13 @@ require (
github.com/luxfi/math v0.1.5
github.com/luxfi/metric v1.4.5
github.com/luxfi/node v1.20.7
github.com/luxfi/warp v1.16.19
github.com/luxfi/p2p v0.0.0-00010101000000-000000000000
github.com/luxfi/timer v0.0.0
github.com/luxfi/units v0.0.0
github.com/luxfi/upgrade v0.0.0-00010101000000-000000000000
github.com/luxfi/utils v0.0.0
github.com/luxfi/vms v0.0.0-00010101000000-000000000000
github.com/luxfi/warp v1.16.25
github.com/mattn/go-colorable v0.1.14
github.com/mattn/go-isatty v0.0.20
github.com/prometheus/client_golang v1.23.2
@@ -91,7 +100,6 @@ require (
github.com/golang/snappy v1.0.0 // indirect
github.com/google/flatbuffers v25.2.10+incompatible // indirect
github.com/google/pprof v0.0.0-20250820193118-f64d9cf942d6 // indirect
github.com/google/renameio/v2 v2.0.0 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.1 // indirect
@@ -122,7 +130,6 @@ require (
github.com/sagikazarmark/locafero v0.10.0 // indirect
github.com/shirou/gopsutil v3.21.11+incompatible // indirect
github.com/sourcegraph/conc v0.3.1-0.20240121214520-5f936abd7ae8 // indirect
github.com/spaolacci/murmur3 v1.1.0 // indirect
github.com/spf13/afero v1.14.0 // indirect
github.com/status-im/keycard-go v0.2.0 // indirect
github.com/subosito/gotenv v1.6.0 // indirect
@@ -157,3 +164,26 @@ require (
// Force tablewriter version for compatibility
replace github.com/olekukonko/tablewriter => github.com/olekukonko/tablewriter v0.0.5
// Use local packages instead of node dependencies
replace github.com/luxfi/cache => ../cache
replace github.com/luxfi/codec => ../codec
replace github.com/luxfi/constants => ../constants
replace github.com/luxfi/timer => ../timer
replace github.com/luxfi/units => ../units
replace github.com/luxfi/utils => ../utils
replace github.com/luxfi/math => ../math
replace github.com/luxfi/p2p => ../p2p
replace github.com/luxfi/upgrade => ../upgrade
replace github.com/luxfi/vms => ../vms
replace github.com/luxfi/netrunner-sdk => ../netrunner-sdk
+2 -8
View File
@@ -149,8 +149,6 @@ github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38/go.mod h1:kpwsk12EmLe
github.com/google/pprof v0.0.0-20230207041349-798e818bf904/go.mod h1:uglQLonpP8qtYCYyzA+8c/9qtqgA3qsXGYqCPKARAFg=
github.com/google/pprof v0.0.0-20250820193118-f64d9cf942d6 h1:EEHtgt9IwisQ2AZ4pIsMjahcegHh6rmhqxzIRQIyepY=
github.com/google/pprof v0.0.0-20250820193118-f64d9cf942d6/go.mod h1:I6V7YzU0XDpsHqbsyrghnFZLO1gwK6NPTNvmetQIk9U=
github.com/google/renameio/v2 v2.0.0 h1:UifI23ZTGY8Tt29JbYFiuyIU3eX+RNFtUwefq9qAhxg=
github.com/google/renameio/v2 v2.0.0/go.mod h1:BtmJXm5YlszgC+TD4HOEEUFgkJP3nLxehU6hfe7jRt4=
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/gorilla/rpc v1.2.1 h1:yC+LMV5esttgpVvNORL/xX4jvTTEUE30UZhZ5JF7K9k=
@@ -211,8 +209,6 @@ github.com/luxfi/ids v1.1.2 h1:+qCUzE9Ga4slSHbnYl7T3I6c8y+n4/kKk4rzSEkLv/k=
github.com/luxfi/ids v1.1.2/go.mod h1:cMbto3Q8N3IaBxdz4Lzaq9wYl33coGXUdlr2+YwXeUw=
github.com/luxfi/log v1.1.24 h1:mz73HhY28cyjOHZ94Q6Ah4UbcjAy1/YRz8S/tZDqiSg=
github.com/luxfi/log v1.1.24/go.mod h1:km8erK78Kc9awsK8VBW/fPm4ZZMGTxZInVCHSaFIMOo=
github.com/luxfi/math v0.1.5 h1:36uCSbFPvLtBcm6wPcYGp5TU3AkdCfrIlbIwZGOxMrg=
github.com/luxfi/math v0.1.5/go.mod h1:goRksIi7wPcG4lR1ANBu9qjWHzX175wTKL7lQrOenXQ=
github.com/luxfi/metric v1.4.5 h1:fD6gtpzB5ebGB06/m4K7e5+tOV5RiVHSZCV+Zb8ZDxk=
github.com/luxfi/metric v1.4.5/go.mod h1:AUQ7NSNz9WndAcr/SKnOkP7XSFFnBXOa+ihtJYfDaQY=
github.com/luxfi/mock v0.1.0 h1:IwElfNu+T9sXvzFX6tudPDx1vqPuACRSRdxpD5lxW+o=
@@ -221,8 +217,8 @@ github.com/luxfi/node v1.20.7 h1:l8QejcdvOW9Opbo5uBhWpVjsYDHDEmNO9yubZ6GUBbU=
github.com/luxfi/node v1.20.7/go.mod h1:HtVr6wwlgkLu28Azd43Pk47QmO4b1+xE58qQNKO/ab8=
github.com/luxfi/trace v0.1.2 h1:KhRZbk2lQQmmYZjdTWcZKCYkLfu7/VUiLFIsWFKhkwg=
github.com/luxfi/trace v0.1.2/go.mod h1:4SleFc5NVbQYEfn6rYafdfxvHJ+QSdkGAIfKiICYvQE=
github.com/luxfi/warp v1.16.19 h1:zzaYbJN1H8b/3hjsybvxVaECuCFLCtRNxwFBBTsP0t8=
github.com/luxfi/warp v1.16.19/go.mod h1:xXgLbBlGLE1Q64yGsPUvjSYu+Go192BECGjgm2xq1hM=
github.com/luxfi/warp v1.16.25 h1:E8Qb3qO+5Ej6wL0Ww/AXIaOL76jyANxqQEkn49Khg0Q=
github.com/luxfi/warp v1.16.25/go.mod h1:Ny3H4lBhhJNblQbIsWjvi2Ewg6VRUBvkKsQ+WzAqrck=
github.com/mattn/go-colorable v0.1.14 h1:9A9LHSqF/7dyVVX6g0U9cwm9pG3kP9gSzcuIPHPsaIE=
github.com/mattn/go-colorable v0.1.14/go.mod h1:6LmQG8QLFO4G5z1gPvYEzlUgJ2wF+stgPZH1UqBm1s8=
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
@@ -303,8 +299,6 @@ github.com/shirou/gopsutil v3.21.11+incompatible h1:+1+c1VGhc88SSonWP6foOcLhvnKl
github.com/shirou/gopsutil v3.21.11+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA=
github.com/sourcegraph/conc v0.3.1-0.20240121214520-5f936abd7ae8 h1:+jumHNA0Wrelhe64i8F6HNlS8pkoyMv5sreGx2Ry5Rw=
github.com/sourcegraph/conc v0.3.1-0.20240121214520-5f936abd7ae8/go.mod h1:3n1Cwaq1E1/1lhQhtRK2ts/ZwZEhjcQeJQ1RuC6Q/8U=
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.14.0 h1:9tH6MapGnn/j0eb0yIXiLjERO8RB6xIVZRDCX7PtqWA=
github.com/spf13/afero v1.14.0/go.mod h1:acJQ8t0ohCGuMN3O+Pv0V0hgMxNYDlvdk+VTfyZmbYo=
github.com/spf13/cast v1.10.0 h1:h2x0u2shc1QuLHfxi+cTJvs30+ZAHOGRic8uyGTDWxY=
+1 -1
View File
@@ -37,7 +37,7 @@ import (
"github.com/luxfi/geth/common"
"github.com/luxfi/geth/core/types"
"github.com/luxfi/geth/event"
"github.com/luxfi/node/utils/timer/mockable"
"github.com/luxfi/timer/mockable"
)
// Backend wraps all methods required for mining.
+2 -2
View File
@@ -54,8 +54,8 @@ import (
"github.com/luxfi/geth/event"
ethparams "github.com/luxfi/geth/params"
"github.com/luxfi/log"
"github.com/luxfi/node/utils/timer/mockable"
"github.com/luxfi/node/utils/units"
"github.com/luxfi/timer/mockable"
"github.com/luxfi/units"
)
const (
+3 -3
View File
@@ -19,9 +19,9 @@ import (
nodeCore "github.com/luxfi/consensus/engine/core"
"github.com/luxfi/consensus/validator"
"github.com/luxfi/consensus/version"
"github.com/luxfi/node/codec"
"github.com/luxfi/node/network/p2p"
"github.com/luxfi/node/utils"
"github.com/luxfi/codec"
"github.com/luxfi/p2p"
"github.com/luxfi/utils"
"github.com/luxfi/ids"
"github.com/luxfi/math/set"
+3 -3
View File
@@ -12,7 +12,7 @@ import (
"testing"
"time"
"github.com/luxfi/node/network/p2p"
"github.com/luxfi/p2p"
"github.com/prometheus/client_golang/prometheus"
"github.com/stretchr/testify/assert"
@@ -25,8 +25,8 @@ import (
consensusVersion "github.com/luxfi/consensus/version"
"github.com/luxfi/ids"
"github.com/luxfi/math/set"
"github.com/luxfi/node/codec"
"github.com/luxfi/node/codec/linearcodec"
"github.com/luxfi/codec"
"github.com/luxfi/codec/linearcodec"
"github.com/luxfi/node/version"
)
+9 -9
View File
@@ -10,8 +10,8 @@ import (
"github.com/luxfi/consensus/version"
"github.com/luxfi/ids"
luxmath "github.com/luxfi/math/math"
"github.com/luxfi/math/set"
utils_math "github.com/luxfi/node/utils/math"
"github.com/luxfi/log"
@@ -34,7 +34,7 @@ const (
// information we track on a given peer
type peerInfo struct {
version *version.Application
bandwidth utils_math.Averager
bandwidth luxmath.Averager
}
// peerTracker tracks the bandwidth of responses coming from peers,
@@ -47,9 +47,9 @@ type peerTracker struct {
trackedPeers set.Set[ids.NodeID] // peers that we have sent a request to
numResponsivePeers *metrics.Gauge
responsivePeers set.Set[ids.NodeID] // peers that responded to the last request they were sent
bandwidthHeap utils_math.AveragerHeap // tracks bandwidth peers are responding with
bandwidthHeap luxmath.AveragerHeap // tracks bandwidth peers are responding with
averageBandwidthMetric *metrics.GaugeFloat64
averageBandwidth utils_math.Averager
averageBandwidth luxmath.Averager
}
func NewPeerTracker() *peerTracker {
@@ -59,9 +59,9 @@ func NewPeerTracker() *peerTracker {
trackedPeers: make(set.Set[ids.NodeID]),
numResponsivePeers: metrics.GetOrRegisterGauge("net_responsive_peers", nil),
responsivePeers: make(set.Set[ids.NodeID]),
bandwidthHeap: utils_math.NewMaxAveragerHeap(),
bandwidthHeap: luxmath.NewMaxAveragerHeap(),
averageBandwidthMetric: metrics.GetOrRegisterGaugeFloat64("net_average_bandwidth", nil),
averageBandwidth: utils_math.NewAverager(0, bandwidthHalflife, time.Now()),
averageBandwidth: luxmath.NewAverager(0, bandwidthHalflife, time.Now()),
}
}
@@ -82,7 +82,7 @@ func (p *peerTracker) shouldTrackNewPeer() bool {
// getResponsivePeer returns a random [ids.NodeID] of a peer that has responded
// to a request.
func (p *peerTracker) getResponsivePeer() (ids.NodeID, utils_math.Averager, bool) {
func (p *peerTracker) getResponsivePeer() (ids.NodeID, luxmath.Averager, bool) {
// Get an arbitrary element from the set (without removing it)
var nodeID ids.NodeID
var ok bool
@@ -125,7 +125,7 @@ func (p *peerTracker) GetAnyPeer(minVersion *version.Application) (ids.NodeID, b
nodeID ids.NodeID
ok bool
random bool
averager utils_math.Averager
averager luxmath.Averager
)
if rand.Float64() < randomPeerProbability {
random = true
@@ -163,7 +163,7 @@ func (p *peerTracker) TrackBandwidth(nodeID ids.NodeID, bandwidth float64) {
now := time.Now()
if peer.bandwidth == nil {
peer.bandwidth = utils_math.NewAverager(bandwidth, bandwidthHalflife, now)
peer.bandwidth = luxmath.NewAverager(bandwidth, bandwidthHalflife, now)
} else {
peer.bandwidth.Observe(bandwidth, now)
}
+1 -1
View File
@@ -14,7 +14,7 @@ import (
"github.com/luxfi/evm/precompile/precompileconfig"
"github.com/luxfi/evm/utils"
"github.com/luxfi/geth/common"
"github.com/luxfi/node/upgrade"
"github.com/luxfi/upgrade"
)
const (
+1 -1
View File
@@ -7,7 +7,7 @@ import (
"math/big"
"testing"
"github.com/luxfi/node/upgrade/upgradetest"
"github.com/luxfi/upgrade/upgradetest"
"github.com/luxfi/evm/params/extras"
"github.com/luxfi/evm/utils"
"github.com/stretchr/testify/require"
+1 -1
View File
@@ -14,7 +14,7 @@ import (
"github.com/luxfi/evm/utils"
"github.com/luxfi/geth/common"
ethparams "github.com/luxfi/geth/params"
"github.com/luxfi/node/upgrade"
"github.com/luxfi/upgrade"
)
var (
+1 -1
View File
@@ -10,7 +10,7 @@ import (
"github.com/luxfi/evm/utils"
ethparams "github.com/luxfi/geth/params"
"github.com/luxfi/node/upgrade"
"github.com/luxfi/upgrade"
)
var errCannotBeNil = fmt.Errorf("timestamp cannot be nil")
+2 -2
View File
@@ -7,8 +7,8 @@ import (
"testing"
"github.com/luxfi/evm/utils"
"github.com/luxfi/node/upgrade"
"github.com/luxfi/node/upgrade/upgradetest"
"github.com/luxfi/upgrade"
"github.com/luxfi/upgrade/upgradetest"
"github.com/stretchr/testify/require"
)
+1 -1
View File
@@ -4,7 +4,7 @@
package paramstest
import (
"github.com/luxfi/node/upgrade/upgradetest"
"github.com/luxfi/upgrade/upgradetest"
"github.com/luxfi/evm/params"
)
+1 -1
View File
@@ -10,7 +10,7 @@ import (
"github.com/luxfi/evm/plugin/evm/client"
"github.com/luxfi/log"
"github.com/luxfi/node/api"
"github.com/luxfi/node/utils/profiler"
"github.com/luxfi/utils/profiler"
)
// Admin is the API service for admin API calls
+1 -1
View File
@@ -8,7 +8,7 @@ import (
"math"
"github.com/luxfi/evm/commontype"
safemath "github.com/luxfi/node/utils/math"
safemath "github.com/luxfi/math/math"
)
// BlockGasCost calculates the required block gas cost.
+1 -1
View File
@@ -6,7 +6,7 @@ package config
import (
"time"
"github.com/luxfi/node/utils/units"
"github.com/luxfi/units"
)
const (
@@ -10,7 +10,7 @@ import (
ethrawdb "github.com/luxfi/geth/core/rawdb"
"github.com/luxfi/geth/ethdb"
"github.com/luxfi/log"
"github.com/luxfi/node/utils/wrappers"
"github.com/luxfi/utils/wrappers"
)
// ReadSyncRoot reads the root corresponding to the main trie of an in-progress
+1 -1
View File
@@ -5,7 +5,7 @@ package customrawdb
import (
"github.com/luxfi/geth/common"
"github.com/luxfi/node/utils/wrappers"
"github.com/luxfi/utils/wrappers"
)
var (
+1 -1
View File
@@ -15,7 +15,7 @@ import (
"github.com/luxfi/ids"
"github.com/luxfi/log"
"github.com/luxfi/node/network/p2p/gossip"
"github.com/luxfi/p2p/gossip"
"github.com/luxfi/evm/core"
"github.com/luxfi/evm/core/txpool"
+1 -1
View File
@@ -6,7 +6,7 @@ package evm
import (
"github.com/luxfi/ids"
"github.com/luxfi/log"
"github.com/luxfi/node/vms"
"github.com/luxfi/vms"
)
var (
+3 -2
View File
@@ -10,8 +10,8 @@ import (
"github.com/luxfi/consensus/engine/core"
"github.com/luxfi/ids"
"github.com/luxfi/log"
"github.com/luxfi/node/network/p2p"
"github.com/luxfi/node/network/p2p/gossip"
"github.com/luxfi/p2p"
"github.com/luxfi/p2p/gossip"
"github.com/prometheus/client_golang/prometheus"
)
@@ -36,6 +36,7 @@ func NewTxGossipHandler[T gossip.Gossipable](
mempool,
metrics,
maxMessageSize,
nil, // bloomFilter - not used for tx gossip
)
// Create a sliding window throttler for rate limiting
+1 -1
View File
@@ -20,7 +20,7 @@ import (
"github.com/luxfi/geth/core/rawdb"
"github.com/luxfi/geth/core/types"
"github.com/luxfi/geth/core/vm"
"github.com/luxfi/node/network/p2p/gossip"
"github.com/luxfi/p2p/gossip"
"github.com/prometheus/client_golang/prometheus"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
+5 -5
View File
@@ -9,8 +9,8 @@ import (
"github.com/luxfi/ids"
"github.com/luxfi/log"
"github.com/luxfi/node/network/p2p"
"github.com/luxfi/node/network/p2p/gossip"
"github.com/luxfi/p2p"
"github.com/luxfi/p2p/gossip"
"github.com/prometheus/client_golang/prometheus"
"github.com/stretchr/testify/require"
@@ -126,7 +126,7 @@ func setupGossipInfrastructure(t *testing.T, vm *VM, testNodeID ids.NodeID) {
ethTxGossipMarshaller,
ethTxPool,
ethTxGossipMetrics,
config.TxGossipTargetMessageSize,
int(config.TxGossipTargetMessageSize),
config.TxGossipThrottlingPeriod,
float64(config.TxGossipThrottlingLimit),
mockValidators,
@@ -192,7 +192,7 @@ func setupPushGossiper(t *testing.T, vm *VM, sender *TestSender) {
pushGossipParams,
pushRegossipParams,
config.PushGossipDiscardedElements,
config.TxGossipTargetMessageSize,
int(config.TxGossipTargetMessageSize),
vm.config.RegossipFrequency.Duration,
)
require.NoError(err)
@@ -252,7 +252,7 @@ func setupPushGossiperWithLoop(t *testing.T, vm *VM, sender *TestSender) context
pushGossipParams,
pushRegossipParams,
config.PushGossipDiscardedElements,
config.TxGossipTargetMessageSize,
int(config.TxGossipTargetMessageSize),
vm.config.RegossipFrequency.Duration,
)
require.NoError(err)
+1 -1
View File
@@ -11,7 +11,7 @@ import (
"github.com/luxfi/evm/params/extras"
"github.com/luxfi/geth/core/types"
ethparams "github.com/luxfi/geth/params"
"github.com/luxfi/node/utils/math"
"github.com/luxfi/math/math"
)
var (
+4 -4
View File
@@ -4,10 +4,10 @@
package message
import (
"github.com/luxfi/node/codec"
"github.com/luxfi/node/codec/linearcodec"
"github.com/luxfi/node/utils/units"
"github.com/luxfi/node/utils/wrappers"
"github.com/luxfi/codec"
"github.com/luxfi/codec/linearcodec"
"github.com/luxfi/units"
"github.com/luxfi/utils/wrappers"
)
const (
+1 -1
View File
@@ -8,7 +8,7 @@ import (
"fmt"
"github.com/luxfi/ids"
"github.com/luxfi/node/codec"
"github.com/luxfi/codec"
)
// Request represents a Network request type
+1 -1
View File
@@ -14,7 +14,7 @@ import (
"github.com/luxfi/geth/metrics"
"github.com/luxfi/geth/triedb"
"github.com/luxfi/ids"
"github.com/luxfi/node/codec"
"github.com/luxfi/codec"
)
var _ message.RequestHandler = (*networkHandler)(nil)
+1 -1
View File
@@ -22,7 +22,7 @@ import (
"github.com/luxfi/geth/ethdb"
"github.com/luxfi/ids"
"github.com/luxfi/log"
"github.com/luxfi/node/vms/components/chain"
"github.com/luxfi/vms/components/chain"
)
const (
+2 -2
View File
@@ -16,8 +16,8 @@ import (
"github.com/luxfi/ids"
"github.com/luxfi/log"
"github.com/luxfi/node/network/p2p"
"github.com/luxfi/node/network/p2p/gossip"
"github.com/luxfi/p2p"
"github.com/luxfi/p2p/gossip"
"github.com/luxfi/node/proto/pb/sdk"
"github.com/luxfi/consensus/utils/set"
+1 -1
View File
@@ -11,7 +11,7 @@ import (
"math"
safemath "github.com/luxfi/geth/common/math"
"github.com/luxfi/node/utils/wrappers"
"github.com/luxfi/utils/wrappers"
)
const (
+1 -1
View File
@@ -17,7 +17,7 @@ import (
"github.com/luxfi/evm/plugin/evm/validators/uptime"
uptimeinterfaces "github.com/luxfi/evm/plugin/evm/validators/uptime/interfaces"
"github.com/luxfi/ids"
"github.com/luxfi/node/utils/timer/mockable"
"github.com/luxfi/timer/mockable"
"github.com/luxfi/log"
)
+3 -3
View File
@@ -6,9 +6,9 @@ package state
import (
"math"
"github.com/luxfi/node/codec"
"github.com/luxfi/node/codec/linearcodec"
"github.com/luxfi/node/utils/wrappers"
"github.com/luxfi/codec"
"github.com/luxfi/codec/linearcodec"
"github.com/luxfi/utils/wrappers"
)
const (
+2 -2
View File
@@ -14,8 +14,8 @@ import (
"github.com/luxfi/database/memdb"
"github.com/luxfi/evm/plugin/evm/validators/state/interfaces"
"github.com/luxfi/ids"
"github.com/luxfi/node/codec"
"github.com/luxfi/node/utils/wrappers"
"github.com/luxfi/codec"
"github.com/luxfi/utils/wrappers"
)
func TestState(t *testing.T) {
+1 -1
View File
@@ -10,7 +10,7 @@ import (
"github.com/luxfi/consensus/validator/uptime"
"github.com/luxfi/ids"
"github.com/luxfi/math/set"
"github.com/luxfi/node/utils/timer/mockable"
"github.com/luxfi/timer/mockable"
)
// nodeUptime tracks uptime information for a single node
@@ -10,7 +10,7 @@ import (
"github.com/luxfi/consensus/validator/uptime"
"github.com/luxfi/evm/plugin/evm/validators/uptime/interfaces"
"github.com/luxfi/ids"
"github.com/luxfi/node/utils/timer/mockable"
"github.com/luxfi/timer/mockable"
"github.com/stretchr/testify/require"
)
+22 -26
View File
@@ -16,11 +16,11 @@ import (
"sync"
"time"
"github.com/luxfi/node/cache/lru"
"github.com/luxfi/node/cache/metercacher"
"github.com/luxfi/node/network/p2p"
"github.com/luxfi/node/network/p2p/gossip"
"github.com/luxfi/node/network/p2p/lp118"
"github.com/luxfi/cache/lru"
"github.com/luxfi/cache/metercacher"
"github.com/luxfi/p2p"
"github.com/luxfi/p2p/gossip"
"github.com/luxfi/p2p/lp118"
// "github.com/luxfi/firewood-go-ethhash/ffi"
"github.com/prometheus/client_golang/prometheus"
@@ -89,13 +89,13 @@ import (
"github.com/luxfi/crypto/bls"
"github.com/luxfi/database/versiondb"
"github.com/luxfi/ids"
"github.com/luxfi/node/codec"
"github.com/luxfi/node/upgrade"
"github.com/luxfi/node/utils/perms"
"github.com/luxfi/node/utils/profiler"
nodemockable "github.com/luxfi/node/utils/timer/mockable"
"github.com/luxfi/node/utils/units"
nodeChain "github.com/luxfi/node/vms/components/chain"
"github.com/luxfi/codec"
"github.com/luxfi/upgrade"
"github.com/luxfi/utils/perms"
"github.com/luxfi/utils/profiler"
nodemockable "github.com/luxfi/timer/mockable"
"github.com/luxfi/units"
nodeChain "github.com/luxfi/vms/components/chain"
commonEng "github.com/luxfi/consensus/core"
"github.com/luxfi/consensus/core/appsender"
@@ -103,8 +103,8 @@ import (
"github.com/luxfi/math/set"
"github.com/luxfi/database"
luxUtils "github.com/luxfi/node/utils"
luxJSON "github.com/luxfi/node/utils/json"
luxUtils "github.com/luxfi/utils"
luxJSON "github.com/luxfi/utils/json"
)
var (
@@ -222,21 +222,17 @@ func (w *warpSignerAdapter) NodeID() ids.NodeID {
}
// lp118SignerAdapter adapts a signer.Signer for lp118 handlers
// Uses luxWarp.UnsignedMessage to match what lp118.NewCachedHandler expects
// Uses luxWarp.UnsignedMessage - the ONE canonical warp package
type lp118SignerAdapter struct {
signer signer.Signer
}
// Sign implements the signer interface for lp118
// Receives *luxWarp.UnsignedMessage and signs using the underlying signer
// Sign implements the Signer interface for lp118
func (a *lp118SignerAdapter) Sign(msg *luxWarp.UnsignedMessage) ([]byte, error) {
// Sign using the underlying signer directly - types match
sig, err := a.signer.Sign(msg)
if err != nil {
return nil, err
}
// Return the signature bytes
return bls.SignatureToBytes(sig), nil
}
@@ -1054,10 +1050,10 @@ func (vm *VM) initChainState(lastAcceptedBlock *types.Block) error {
block := vm.newBlock(lastAcceptedBlock)
config := &nodeChain.Config{
DecidedCacheSize: decidedCacheSize,
DecidedCacheSize: int(decidedCacheSize),
MissingCacheSize: missingCacheSize,
UnverifiedCacheSize: unverifiedCacheSize,
BytesToIDCacheSize: bytesToIDCacheSize,
UnverifiedCacheSize: int(unverifiedCacheSize),
BytesToIDCacheSize: int(bytesToIDCacheSize),
// Our vm methods return *Block which needs to implement the node's chain.Block
GetBlock: func(ctx context.Context, id ids.ID) (nodeblock.Block, error) {
// getBlock returns our block
@@ -1221,7 +1217,7 @@ func (vm *VM) onNormalOperationsStarted() error {
pushGossipParams,
pushRegossipParams,
config.PushGossipDiscardedElements,
config.TxGossipTargetMessageSize,
int(config.TxGossipTargetMessageSize),
vm.config.RegossipFrequency.Duration,
)
if err != nil {
@@ -1244,7 +1240,7 @@ func (vm *VM) onNormalOperationsStarted() error {
ethTxGossipMarshaller,
ethTxPool,
ethTxGossipMetrics,
config.TxGossipTargetMessageSize,
int(config.TxGossipTargetMessageSize),
config.TxGossipThrottlingPeriod,
float64(config.TxGossipThrottlingLimit),
p2pValidators,
@@ -1316,7 +1312,7 @@ func (vm *VM) setAppRequestHandlers() {
vm.chaindb,
&triedb.Config{
HashDB: &hashdb.Config{
CleanCacheSize: vm.config.StateSyncServerTrieCache * units.MiB,
CleanCacheSize: vm.config.StateSyncServerTrieCache * int(units.MiB),
},
},
)
+1 -1
View File
@@ -22,7 +22,7 @@ import (
"github.com/luxfi/geth/core/rawdb"
"github.com/luxfi/log"
metrics "github.com/luxfi/metric"
"github.com/luxfi/node/utils/constants"
"github.com/luxfi/constants"
)
const (
+2 -2
View File
@@ -33,7 +33,7 @@ import (
commonEng "github.com/luxfi/consensus/core"
nodeConsensusBlock "github.com/luxfi/consensus/engine/chain/block"
"github.com/luxfi/crypto/secp256k1"
nodeChain "github.com/luxfi/node/vms/components/chain"
nodeChain "github.com/luxfi/vms/components/chain"
"github.com/luxfi/database"
"github.com/luxfi/database/memdb"
"github.com/luxfi/database/prefixdb"
@@ -63,7 +63,7 @@ import (
nodeConsensus "github.com/luxfi/consensus"
"github.com/luxfi/consensus/utils/set"
luxdconstants "github.com/luxfi/node/utils/constants"
luxdconstants "github.com/luxfi/constants"
)
var (
+1 -1
View File
@@ -7,7 +7,7 @@ import (
"context"
"testing"
// "github.com/luxfi/node/upgrade/upgradetest"
// "github.com/luxfi/upgrade/upgradetest"
"github.com/stretchr/testify/require"
)
+3 -3
View File
@@ -44,11 +44,11 @@ import (
"github.com/luxfi/database/prefixdb"
"github.com/luxfi/ids"
"github.com/luxfi/math/set"
"github.com/luxfi/node/network/p2p"
"github.com/luxfi/node/network/p2p/lp118"
"github.com/luxfi/p2p"
"github.com/luxfi/p2p/lp118"
"github.com/luxfi/node/proto/pb/sdk"
luxdUtils "github.com/luxfi/node/utils"
"github.com/luxfi/node/utils/constants"
"github.com/luxfi/constants"
luxWarp "github.com/luxfi/warp"
"github.com/luxfi/warp/payload"
"github.com/stretchr/testify/require"
+1 -1
View File
@@ -9,8 +9,8 @@ import (
"os"
"github.com/luxfi/log"
"github.com/luxfi/node/utils/ulimit"
"github.com/luxfi/node/vms/rpcchainvm"
"github.com/luxfi/utils/ulimit"
"github.com/luxfi/evm/plugin/evm"
)
+1 -1
View File
@@ -19,7 +19,7 @@ import (
"github.com/luxfi/geth/common/math"
"github.com/luxfi/ids"
"github.com/luxfi/log"
"github.com/luxfi/node/utils/constants"
"github.com/luxfi/constants"
luxwarp "github.com/luxfi/warp"
"github.com/luxfi/warp/payload"
)
+1 -1
View File
@@ -23,7 +23,7 @@ import (
"github.com/luxfi/evm/utils/utilstest"
"github.com/luxfi/ids"
agoUtils "github.com/luxfi/node/utils"
"github.com/luxfi/node/utils/constants"
"github.com/luxfi/constants"
luxWarp "github.com/luxfi/warp"
"github.com/luxfi/warp/payload"
"github.com/stretchr/testify/require"
@@ -21,11 +21,11 @@ import (
"github.com/luxfi/crypto/bls"
"github.com/luxfi/ids"
"github.com/luxfi/math/set"
"github.com/luxfi/node/utils/constants"
"github.com/luxfi/constants"
"github.com/stretchr/testify/require"
"go.uber.org/mock/gomock"
avalancheWarp "github.com/luxfi/node/vms/platformvm/warp"
avalancheWarp "github.com/luxfi/warp"
)
type signatureTest struct {
+4 -4
View File
@@ -9,10 +9,10 @@ import (
"github.com/luxfi/evm/plugin/evm/upgrade/subnetevm"
"github.com/luxfi/geth/common"
"github.com/luxfi/node/codec"
"github.com/luxfi/node/codec/linearcodec"
"github.com/luxfi/node/utils/units"
"github.com/luxfi/node/utils/wrappers"
"github.com/luxfi/codec"
"github.com/luxfi/codec/linearcodec"
"github.com/luxfi/units"
"github.com/luxfi/utils/wrappers"
)
const (
+1 -1
View File
@@ -16,7 +16,7 @@ import (
"github.com/luxfi/evm/sync/client/stats"
"github.com/luxfi/consensus/version"
"github.com/luxfi/node/codec"
"github.com/luxfi/codec"
"github.com/luxfi/crypto"
"github.com/luxfi/evm/network"
+1 -1
View File
@@ -14,7 +14,7 @@ import (
"github.com/luxfi/geth/core/types"
"github.com/luxfi/geth/rlp"
"github.com/luxfi/ids"
"github.com/luxfi/node/codec"
"github.com/luxfi/codec"
)
var (
+3 -3
View File
@@ -9,8 +9,8 @@ import (
"time"
"github.com/luxfi/ids"
"github.com/luxfi/node/codec"
"github.com/luxfi/node/utils/units"
"github.com/luxfi/codec"
"github.com/luxfi/units"
"github.com/luxfi/evm/plugin/evm/message"
"github.com/luxfi/evm/sync/handlers/stats"
@@ -91,7 +91,7 @@ func (b *BlockRequestHandler) OnBlockRequest(ctx context.Context, nodeID ids.Nod
return nil, nil
}
if buf.Len()+totalBytes > targetMessageByteSize && len(blocks) > 0 {
if uint64(buf.Len()+totalBytes) > targetMessageByteSize && len(blocks) > 0 {
log.Debug("Skipping block due to max total bytes size", "totalBlockDataSize", totalBytes, "blockSize", buf.Len(), "maxTotalBytesSize", targetMessageByteSize)
break
}
+1 -1
View File
@@ -20,7 +20,7 @@ import (
"github.com/luxfi/geth/rlp"
"github.com/luxfi/geth/triedb"
"github.com/luxfi/ids"
"github.com/luxfi/node/utils/units"
"github.com/luxfi/units"
"github.com/stretchr/testify/assert"
)
+1 -1
View File
@@ -8,7 +8,7 @@ import (
"time"
"github.com/luxfi/ids"
"github.com/luxfi/node/codec"
"github.com/luxfi/codec"
"github.com/luxfi/evm/plugin/evm/message"
"github.com/luxfi/evm/sync/handlers/stats"
+1 -1
View File
@@ -22,7 +22,7 @@ import (
"github.com/luxfi/geth/triedb"
"github.com/luxfi/ids"
"github.com/luxfi/log"
"github.com/luxfi/node/codec"
"github.com/luxfi/codec"
)
const (
+1 -1
View File
@@ -14,7 +14,7 @@ import (
"github.com/luxfi/geth/trie"
"github.com/luxfi/geth/trie/trienode"
"github.com/luxfi/geth/triedb"
"github.com/luxfi/node/utils/wrappers"
"github.com/luxfi/utils/wrappers"
"github.com/luxfi/geth/common"
"github.com/luxfi/geth/ethdb"
+1 -1
View File
@@ -18,7 +18,7 @@ import (
"github.com/luxfi/geth/ethdb"
"github.com/luxfi/geth/trie"
"github.com/luxfi/log"
"github.com/luxfi/node/utils/wrappers"
"github.com/luxfi/utils/wrappers"
)
var (
+4 -4
View File
@@ -11,8 +11,8 @@ import (
"github.com/luxfi/geth/common"
"github.com/luxfi/geth/metrics"
"github.com/luxfi/log"
utils_math "github.com/luxfi/node/utils/math"
"github.com/luxfi/node/utils/timer"
luxmath "github.com/luxfi/math/math"
"github.com/luxfi/timer"
)
const (
@@ -27,7 +27,7 @@ type trieSyncStats struct {
lock sync.Mutex
lastUpdated time.Time
leafsRate utils_math.Averager
leafsRate luxmath.Averager
triesRemaining int
triesSynced int
@@ -118,7 +118,7 @@ func (t *trieSyncStats) trieDone(root common.Hash) {
func (t *trieSyncStats) updateETA(sinceUpdate time.Duration, now time.Time) time.Duration {
leafsRate := float64(t.leafsSinceUpdate) / sinceUpdate.Seconds()
if t.leafsRate == nil {
t.leafsRate = utils_math.NewAverager(leafsRate, leafRateHalfLife, now)
t.leafsRate = luxmath.NewAverager(leafsRate, leafRateHalfLife, now)
} else {
t.leafsRate.Observe(leafsRate, now)
}
+2 -2
View File
@@ -11,8 +11,8 @@ import (
"github.com/luxfi/database"
"github.com/luxfi/ids"
"github.com/luxfi/node/cache"
"github.com/luxfi/node/cache/lru"
"github.com/luxfi/cache"
"github.com/luxfi/cache/lru"
"github.com/luxfi/consensus/protocol/chain"
luxWarp "github.com/luxfi/warp"
+1 -1
View File
@@ -4,7 +4,7 @@
package warp
import (
platformWarp "github.com/luxfi/node/vms/platformvm/warp"
platformWarp "github.com/luxfi/warp"
luxWarp "github.com/luxfi/warp"
)
+3 -3
View File
@@ -6,9 +6,9 @@ package messages
import (
"errors"
"github.com/luxfi/node/codec"
"github.com/luxfi/node/codec/linearcodec"
"github.com/luxfi/node/utils/units"
"github.com/luxfi/codec"
"github.com/luxfi/codec/linearcodec"
"github.com/luxfi/units"
)
const (
+1 -1
View File
@@ -8,7 +8,7 @@ import (
"github.com/luxfi/consensus/validator"
"github.com/luxfi/ids"
"github.com/luxfi/node/utils/constants"
"github.com/luxfi/constants"
)
var _ validators.State = (*State)(nil)
+1 -1
View File
@@ -9,7 +9,7 @@ import (
"github.com/luxfi/consensus/validator"
"github.com/luxfi/ids"
"github.com/luxfi/node/utils/constants"
"github.com/luxfi/constants"
"github.com/stretchr/testify/require"
)