Update address types and dependencies

This commit is contained in:
Zach Kelling
2025-08-06 04:56:44 +00:00
parent 6a9125450a
commit 0615791489
4 changed files with 24 additions and 64 deletions
+11 -56
View File
@@ -8,8 +8,7 @@ import (
"github.com/luxfi/geth/core/types"
"github.com/luxfi/evm/ethclient"
"github.com/luxfi/evm/interfaces"
ethereum "github.com/ethereum/go-ethereum"
ethereum "github.com/luxfi/geth"
"github.com/luxfi/geth/common"
)
@@ -148,18 +147,8 @@ func (c *ethClient) CallContract(ctx context.Context, msg ethereum.CallMsg, bloc
if err := c.connect(); err != nil {
return nil, err
}
// Convert ethereum.CallMsg to interfaces.CallMsg
callMsg := interfaces.CallMsg{
From: msg.From,
To: msg.To,
Gas: msg.Gas,
GasPrice: msg.GasPrice,
GasFeeCap: msg.GasFeeCap,
GasTipCap: msg.GasTipCap,
Value: msg.Value,
Data: msg.Data,
}
return c.client.CallContract(ctx, callMsg, blockNumber)
// Use ethereum.CallMsg directly
return c.client.CallContract(ctx, msg, blockNumber)
}
func (c *ethClient) NonceAt(ctx context.Context, account common.Address, blockNumber *big.Int) (uint64, error) {
@@ -218,18 +207,8 @@ func (c *ethClient) EstimateGas(ctx context.Context, msg ethereum.CallMsg) (uint
if err := c.connect(); err != nil {
return 0, err
}
// Convert ethereum.CallMsg to interfaces.CallMsg
callMsg := interfaces.CallMsg{
From: msg.From,
To: msg.To,
Gas: msg.Gas,
GasPrice: msg.GasPrice,
GasFeeCap: msg.GasFeeCap,
GasTipCap: msg.GasTipCap,
Value: msg.Value,
Data: msg.Data,
}
return c.client.EstimateGas(ctx, callMsg)
// Use ethereum.CallMsg directly
return c.client.EstimateGas(ctx, msg)
}
func (c *ethClient) AcceptedCallContract(ctx context.Context, call ethereum.CallMsg) ([]byte, error) {
@@ -240,18 +219,8 @@ func (c *ethClient) AcceptedCallContract(ctx context.Context, call ethereum.Call
}
// TODO: AcceptedCallContract is not in standard ethclient
// For now, use CallContract with latest block
// Convert ethereum.CallMsg to interfaces.CallMsg
callMsg := interfaces.CallMsg{
From: call.From,
To: call.To,
Gas: call.Gas,
GasPrice: call.GasPrice,
GasFeeCap: call.GasFeeCap,
GasTipCap: call.GasTipCap,
Value: call.Value,
Data: call.Data,
}
return c.client.CallContract(ctx, callMsg, nil)
// Use ethereum.CallMsg directly
return c.client.CallContract(ctx, call, nil)
}
func (c *ethClient) HeaderByNumber(ctx context.Context, number *big.Int) (*types.Header, error) {
@@ -278,15 +247,8 @@ func (c *ethClient) FilterLogs(ctx context.Context, query ethereum.FilterQuery)
if err := c.connect(); err != nil {
return nil, err
}
// Convert ethereum.FilterQuery to interfaces.FilterQuery
filterQuery := interfaces.FilterQuery{
BlockHash: query.BlockHash,
FromBlock: query.FromBlock,
ToBlock: query.ToBlock,
Addresses: query.Addresses,
Topics: query.Topics,
}
return c.client.FilterLogs(ctx, filterQuery)
// Use ethereum.FilterQuery directly
return c.client.FilterLogs(ctx, query)
}
func (c *ethClient) SubscribeFilterLogs(ctx context.Context, query ethereum.FilterQuery, ch chan<- types.Log) (ethereum.Subscription, error) {
@@ -295,13 +257,6 @@ func (c *ethClient) SubscribeFilterLogs(ctx context.Context, query ethereum.Filt
if err := c.connect(); err != nil {
return nil, err
}
// Convert ethereum.FilterQuery to interfaces.FilterQuery
filterQuery := interfaces.FilterQuery{
BlockHash: query.BlockHash,
FromBlock: query.FromBlock,
ToBlock: query.ToBlock,
Addresses: query.Addresses,
Topics: query.Topics,
}
return c.client.SubscribeFilterLogs(ctx, filterQuery, ch)
// Use ethereum.FilterQuery directly
return c.client.SubscribeFilterLogs(ctx, query, ch)
}
+10 -6
View File
@@ -23,7 +23,8 @@ import (
"github.com/luxfi/node/utils"
"github.com/luxfi/node/utils/constants"
"github.com/luxfi/crypto/bls"
"github.com/luxfi/node/utils/logging"
luxlog "github.com/luxfi/log"
luxmetrics "github.com/luxfi/metrics"
"github.com/luxfi/node/utils/math/meter"
"github.com/luxfi/node/utils/resource"
"github.com/luxfi/node/utils/set"
@@ -100,8 +101,8 @@ func (node *localNode) AttachPeer(ctx context.Context, router router.InboundHand
return nil, err
}
mc, err := message.NewCreator(
logging.NoLog{},
prometheus.NewRegistry(),
luxlog.NewNoOpLogger(),
luxmetrics.NewPrometheusMetrics("netrunner", prometheus.NewRegistry()),
constants.DefaultNetworkCompressionType,
10*time.Second,
)
@@ -134,7 +135,7 @@ func (node *localNode) AttachPeer(ctx context.Context, router router.InboundHand
config := &peer.Config{
Metrics: metrics,
MessageCreator: mc,
Log: logging.NoLog{},
Log: luxlog.NewNoLog(),
InboundMsgThrottler: throttling.NewNoInboundThrottler(),
Network: peer.TestNetwork,
Router: router,
@@ -158,10 +159,13 @@ func (node *localNode) AttachPeer(ctx context.Context, router router.InboundHand
config,
conn,
cert,
ids.NodeIDFromCert(cert),
ids.NodeIDFromCert(&ids.Certificate{
Raw: cert.Raw,
PublicKey: cert.PublicKey,
}),
peer.NewBlockingMessageQueue(
config.Metrics,
logging.NoLog{},
luxlog.NewNoOpLogger(),
peerMsgQueueBufferSize,
),
)
+2 -1
View File
@@ -25,7 +25,8 @@ func LoadLocalGenesis() (map[string]interface{}, error) {
cChainGenesis := genesisMap["cChainGenesis"]
// set the cchain genesis directly from geth
// the whole of `cChainGenesis` should be set as a string, not a json object...
gethCChainGenesis := geth_params.LuxLocalChainConfig
// Use TestChainConfig as local config
gethCChainGenesis := geth_params.TestChainConfig
// but the part in geth is only the "config" part.
// In order to set it easily, first we get the cChainGenesis item
// convert it to a map
+1 -1
View File
@@ -25,7 +25,7 @@ func ToNodeID(stakingKey, stakingCert []byte) (ids.NodeID, error) {
if err != nil {
return ids.EmptyNodeID, err
}
stakingCertificate := &staking.Certificate{
stakingCertificate := &ids.Certificate{
Raw: cert.Leaf.Raw,
PublicKey: cert.Leaf.PublicKey,
}