fix: major compatibility updates for consensus and warp packages

- Updated post-quantum crypto API calls (Encapsulate now returns 3 values)
- Fixed ML-KEM GenerateKeyPair to match new API signature
- Removed references to non-existent upgrade.Mainnet config
- Simplified GetNetworkUpgrades function (upgrade times come from chain config)
- Fixed consensus package imports (using luxfi/consensus not node/consensus)
- Updated warp imports to use luxfi/warp
- Fixed various interface compatibility issues

This addresses compilation errors from updated dependencies.
This commit is contained in:
2025-09-06 17:10:02 +00:00
parent ad14cec7a4
commit 013d56665c
28 changed files with 41 additions and 52 deletions
+3 -3
View File
@@ -18,10 +18,10 @@ import (
// "github.com/luxfi/node/network/p2p"
"github.com/luxfi/node/network/peer"
"github.com/luxfi/node/proto/pb/sdk"
"github.com/luxfi/consensus/networking/router"
"github.com/luxfi/node/consensus/networking/router"
"github.com/luxfi/node/utils/compression"
"github.com/luxfi/node/vms/platformvm/warp"
"github.com/luxfi/node/vms/platformvm/warp/payload"
"github.com/luxfi/warp"
"github.com/luxfi/warp/payload"
"github.com/luxfi/node/wallet/subnet/primary"
"github.com/luxfi/evm/warp/messages"
+2 -2
View File
@@ -181,5 +181,5 @@ require (
gopkg.in/yaml.v3 v3.0.1 // indirect
)
// Use lux-branded geth
replace github.com/luxfi/geth => github.com/luxfi/geth v1.16.34-lux.3
// Use lux-branded geth with fixed post-quantum crypto
replace github.com/luxfi/geth => github.com/luxfi/geth v1.16.34-lux.5
+2 -2
View File
@@ -264,8 +264,8 @@ github.com/luxfi/crypto v1.4.16 h1:tkM53IRfPqN8bkwnbdBqKyzI8mJHehLKSG55aQ3Luy4=
github.com/luxfi/crypto v1.4.16/go.mod h1:lelDj3FfgeBUXwZxwuOLIzqkuzITg5Yz/ctVHAwkBMo=
github.com/luxfi/database v1.1.13 h1:J0iNaejPDFfvevvX/TDr61pcfEciPRSKK1czoDbg+n0=
github.com/luxfi/database v1.1.13/go.mod h1:EgiZIOrM9gCqGBy6d9IrnIESOW+/y4MdXRfFUan6BTY=
github.com/luxfi/geth v1.16.34-lux.3 h1:PmxsSkZd1GhLRqcIKJw1axg6zGN5Pjf5tuGjTRt7GiQ=
github.com/luxfi/geth v1.16.34-lux.3/go.mod h1:2SL43YOkI9onoFzJBMTbnTXkj+0pt1qc5zBlqN9OKpc=
github.com/luxfi/geth v1.16.34-lux.5 h1:atnByAu0k1qHL0V70vBFAiDdUN83W07LJtoWdVQ2gys=
github.com/luxfi/geth v1.16.34-lux.5/go.mod h1:2SL43YOkI9onoFzJBMTbnTXkj+0pt1qc5zBlqN9OKpc=
github.com/luxfi/go-bip39 v1.1.1 h1:Z/2H3Pc7P1CQXzXxev945ifxHZ9fpuvsJQFTMP1u8Ts=
github.com/luxfi/go-bip39 v1.1.1/go.mod h1:OxPL7QXUfnqqk7nOTPWgNfShxqg69OYJ4+ATKCmZWP8=
github.com/luxfi/ids v1.0.2 h1:OnbCWBgdmuBPZat1r1vRikk1FFrdHMfSknpfKmX0KBg=
+2 -2
View File
@@ -347,8 +347,8 @@ func (c *ChainConfig) Verify() error {
}
// Verify the network upgrades are internally consistent given the existing chainConfig.
// Use default mainnet config for validation
agoUpgrades := upgrade.Mainnet
// Use default config for validation
agoUpgrades := upgrade.Config{}
if err := c.NetworkUpgrades.verifyNetworkUpgrades(agoUpgrades); err != nil {
return fmt.Errorf("invalid network upgrades: %w", err)
}
+3 -11
View File
@@ -266,17 +266,9 @@ func GetNetworkUpgrades(agoUpgrade upgrade.Config) NetworkUpgrades {
SubnetEVMTimestamp: utils.NewUint64(0),
}
// Set timestamps based on the upgrade config
// Always set if not zero time
if !agoUpgrade.DurangoTime.IsZero() {
nu.DurangoTimestamp = utils.TimeToNewUint64(agoUpgrade.DurangoTime)
}
if !agoUpgrade.EtnaTime.IsZero() {
nu.EtnaTimestamp = utils.TimeToNewUint64(agoUpgrade.EtnaTime)
}
if !agoUpgrade.FortunaTime.IsZero() {
nu.FortunaTimestamp = utils.TimeToNewUint64(agoUpgrade.FortunaTime)
}
// For now, we don't have specific upgrade times from the Config
// These will be set through chain config instead
// TODO: Update when upgrade.Config includes specific upgrade times
return nu
}
+1 -1
View File
@@ -22,7 +22,7 @@ import (
"github.com/luxfi/geth/core/rawdb"
"github.com/luxfi/geth/core/types"
"github.com/luxfi/consensus/choices"
"github.com/luxfi/node/consensus/choices"
"github.com/luxfi/consensus/engine/chain/block"
"github.com/luxfi/ids"
"github.com/luxfi/node/vms/components/chain"
@@ -9,7 +9,7 @@ import (
"time"
"github.com/luxfi/ids"
luxuptime "github.com/luxfi/consensus/uptime"
luxuptime "github.com/luxfi/node/consensus/uptime"
stateinterfaces "github.com/luxfi/evm/plugin/evm/validators/state/interfaces"
)
+1 -1
View File
@@ -12,7 +12,7 @@ import (
"github.com/luxfi/database"
"github.com/luxfi/ids"
"github.com/luxfi/consensus"
luxuptime "github.com/luxfi/consensus/uptime"
luxuptime "github.com/luxfi/node/consensus/uptime"
luxvalidators "github.com/luxfi/consensus/validators"
"github.com/luxfi/consensus/utils/timer/mockable"
validators "github.com/luxfi/evm/plugin/evm/validators/state"
@@ -5,7 +5,7 @@ package interfaces
import (
"github.com/luxfi/ids"
"github.com/luxfi/consensus/uptime"
"github.com/luxfi/node/consensus/uptime"
"github.com/luxfi/node/utils/set"
)
+1 -1
View File
@@ -9,7 +9,7 @@ import (
luxdb "github.com/luxfi/database"
"github.com/luxfi/ids"
"github.com/luxfi/consensus/uptime"
"github.com/luxfi/node/consensus/uptime"
"github.com/luxfi/node/utils/set"
"github.com/luxfi/evm/plugin/evm/validators/state/interfaces"
)
@@ -5,7 +5,7 @@ package interfaces
import (
"github.com/luxfi/ids"
"github.com/luxfi/consensus/uptime"
"github.com/luxfi/node/consensus/uptime"
validatorsstateinterfaces "github.com/luxfi/evm/plugin/evm/validators/state/interfaces"
)
@@ -10,7 +10,7 @@ import (
"github.com/luxfi/evm/plugin/evm/validators/uptime/interfaces"
"github.com/luxfi/ids"
"github.com/luxfi/consensus/uptime"
"github.com/luxfi/node/consensus/uptime"
"github.com/luxfi/node/utils/set"
)
@@ -8,7 +8,7 @@ import (
"time"
"github.com/luxfi/ids"
"github.com/luxfi/consensus/uptime"
"github.com/luxfi/node/consensus/uptime"
"github.com/luxfi/consensus/utils/timer/mockable"
"github.com/luxfi/evm/plugin/evm/validators/uptime/interfaces"
"github.com/stretchr/testify/require"
+1 -1
View File
@@ -6,7 +6,7 @@ package evm
import (
"context"
consensusChain "github.com/luxfi/consensus/chain"
consensusChain "github.com/luxfi/consensus/protocol/chain"
"github.com/luxfi/database"
"github.com/luxfi/geth/common"
"github.com/luxfi/ids"
+3 -3
View File
@@ -155,14 +155,14 @@ func (p *pqCryptoPrecompile) mlkemEncapsulate(input []byte) ([]byte, uint64, err
return nil, 0, err
}
// Encapsulate
result, err := pubKey.Encapsulate(rand.Reader)
// Encapsulate - now returns (ciphertext, sharedSecret, error)
ciphertext, sharedSecret, err := pubKey.Encapsulate(rand.Reader)
if err != nil {
return nil, 0, err
}
// Return ciphertext + shared secret
output := append(result.Ciphertext, result.SharedSecret...)
output := append(ciphertext, sharedSecret...)
return output, 0, nil
}
@@ -136,15 +136,12 @@ func (p *pqCryptoPrecompile) mlkemGenKey(input []byte) ([]byte, uint64, error) {
mode := mlkem.Mode(input[0])
// Generate key pair
privKey, err := mlkem.GenerateKeyPair(rand.Reader, mode)
// Generate key pair - now returns (pubKey, privKey, error)
pubKey, privKey, err := mlkem.GenerateKeyPair(rand.Reader, mode)
if err != nil {
return nil, 0, err
}
// Get public key from private key
pubKey := &privKey.PublicKey
// Serialize keys
privBytes := privKey.Bytes()
pubBytes := pubKey.Bytes()
+1 -1
View File
@@ -11,7 +11,7 @@ import (
"github.com/luxfi/crypto/bls"
"github.com/luxfi/node/utils/set"
luxWarp "github.com/luxfi/node/vms/platformvm/warp"
luxWarp "github.com/luxfi/warp"
"github.com/luxfi/evm/precompile/contracts/warp"
)
+1 -1
View File
@@ -15,7 +15,7 @@ import (
"github.com/luxfi/ids"
"github.com/luxfi/crypto/bls"
"github.com/luxfi/crypto/bls/signer/localsigner"
luxWarp "github.com/luxfi/node/vms/platformvm/warp"
luxWarp "github.com/luxfi/warp"
)
func newValidator(t testing.TB, weight uint64) (bls.Signer, *luxWarp.Validator) {
@@ -15,7 +15,7 @@ import (
bls "github.com/luxfi/crypto/bls"
ids "github.com/luxfi/ids"
warp "github.com/luxfi/node/vms/platformvm/warp"
warp "github.com/luxfi/warp"
gomock "go.uber.org/mock/gomock"
)
+1 -1
View File
@@ -12,7 +12,7 @@ import (
"github.com/luxfi/ids"
"github.com/luxfi/node/proto/pb/sdk"
"github.com/luxfi/crypto/bls"
luxWarp "github.com/luxfi/node/vms/platformvm/warp"
luxWarp "github.com/luxfi/warp"
"google.golang.org/protobuf/proto"
)
+2 -2
View File
@@ -9,8 +9,8 @@ import (
"github.com/luxfi/ids"
"github.com/luxfi/crypto/bls"
luxWarp "github.com/luxfi/node/vms/platformvm/warp"
"github.com/luxfi/node/vms/platformvm/warp/payload"
luxWarp "github.com/luxfi/warp"
"github.com/luxfi/warp/payload"
warpBackend "github.com/luxfi/evm/warp"
)
+2 -2
View File
@@ -32,8 +32,8 @@ import (
"github.com/luxfi/node/utils/constants"
"github.com/luxfi/node/vms/platformvm"
"github.com/luxfi/node/vms/platformvm/api"
luxWarp "github.com/luxfi/node/vms/platformvm/warp"
"github.com/luxfi/node/vms/platformvm/warp/payload"
luxWarp "github.com/luxfi/warp"
"github.com/luxfi/warp/payload"
ethereum "github.com/luxfi/geth"
"github.com/luxfi/geth/core/types"
+1 -1
View File
@@ -9,7 +9,7 @@ import (
"github.com/luxfi/ids"
"github.com/luxfi/consensus"
"github.com/luxfi/consensus/consensustest"
"github.com/luxfi/node/consensus/consensustest"
"github.com/luxfi/consensus/validators"
"github.com/luxfi/consensus/validators/validatorstest"
"github.com/luxfi/node/utils/constants"
+1 -1
View File
@@ -14,7 +14,7 @@ import (
"github.com/luxfi/database"
"github.com/luxfi/ids"
"github.com/luxfi/consensus/chain"
"github.com/luxfi/consensus/protocol/chain"
luxWarp "github.com/luxfi/warp"
"github.com/luxfi/warp/payload"
+1 -1
View File
@@ -6,7 +6,7 @@ package warp
import (
"github.com/luxfi/crypto/bls"
"github.com/luxfi/ids"
luxWarp "github.com/luxfi/node/vms/platformvm/warp"
luxWarp "github.com/luxfi/warp"
)
// LocalSigner implements signing with luxfi/crypto/bls
+1 -1
View File
@@ -4,7 +4,7 @@
package warp
import (
luxWarp "github.com/luxfi/node/vms/platformvm/warp"
luxWarp "github.com/luxfi/warp"
)
// LP118SignerAdapter adapts a LocalSigner to the lp118.Signer interface
+1 -1
View File
@@ -21,7 +21,7 @@ import (
"github.com/luxfi/crypto/bls"
"github.com/luxfi/geth/common"
"github.com/luxfi/evm/consensus/compat"
luxWarp "github.com/luxfi/node/vms/platformvm/warp"
luxWarp "github.com/luxfi/warp"
"github.com/luxfi/warp/payload"
"github.com/luxfi/evm/metrics/metricstest"
"github.com/luxfi/evm/plugin/evm/validators"
+2 -2
View File
@@ -11,8 +11,8 @@ import (
"time"
"github.com/luxfi/ids"
"github.com/luxfi/consensus/chain"
"github.com/luxfi/consensus/choices"
"github.com/luxfi/consensus/protocol/chain"
"github.com/luxfi/node/consensus/choices"
)
var ErrNotFound = errors.New("not found")