Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

devnet: fix ws port clash for state-sync scenario #9125

Merged
merged 3 commits into from
Jan 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions cmd/devnet/args/node_args.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,13 @@ import (
"path/filepath"
"strconv"

"github.com/ledgerwatch/erigon-lib/chain/networkname"
"github.com/ledgerwatch/erigon/cmd/devnet/accounts"
"github.com/ledgerwatch/erigon/cmd/devnet/requests"
"github.com/ledgerwatch/erigon/core"
"github.com/ledgerwatch/erigon/crypto"
"github.com/ledgerwatch/erigon/p2p/enode"
"github.com/ledgerwatch/erigon/params"

"github.com/ledgerwatch/erigon-lib/chain/networkname"
"github.com/ledgerwatch/erigon/cmd/devnet/accounts"
"github.com/ledgerwatch/erigon/cmd/devnet/requests"
)

type NodeArgs struct {
Expand All @@ -42,7 +41,7 @@ type NodeArgs struct {
HttpCorsDomain string `arg:"--http.corsdomain" json:"http.corsdomain"`
AuthRpcPort int `arg:"--authrpc.port" default:"8551" json:"authrpc.port"`
AuthRpcVHosts string `arg:"--authrpc.vhosts" json:"authrpc.vhosts"`
WSPort int `arg:"-" default:"8546" json:"-"` // flag not defined
WSPort int `arg:"--ws.port" default:"8546" json:"ws.port"`
GRPCPort int `arg:"-" default:"8547" json:"-"` // flag not defined
TCPPort int `arg:"-" default:"8548" json:"-"` // flag not defined
Metrics bool `arg:"--metrics" flag:"" default:"false" json:"metrics"`
Expand Down
4 changes: 4 additions & 0 deletions cmd/devnet/args/node_args_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ func producingNodeArgs(dataDir string, nodeNumber int) []string {
p2pProtocol, _ := parameterFromArgument("--p2p.protocol", "68")
downloaderArg, _ := parameterFromArgument("--no-downloader", "true")
httpPortArg, _ := parameterFromArgument("--http.port", "8545")
wsPortArg, _ := parameterFromArgument("--ws.port", "8546")
authrpcPortArg, _ := parameterFromArgument("--authrpc.port", "8551")
natArg, _ := parameterFromArgument("--nat", "none")
accountSlotsArg, _ := parameterFromArgument("--txpool.accountslots", "16")
Expand All @@ -170,6 +171,7 @@ func producingNodeArgs(dataDir string, nodeNumber int) []string {
chainType,
privateApiAddr,
httpPortArg,
wsPortArg,
authrpcPortArg,
mine,
httpApi,
Expand All @@ -196,6 +198,7 @@ func nonProducingNodeArgs(dataDir string, nodeNumber int, enode string) []string
p2pProtocol, _ := parameterFromArgument("--p2p.protocol", "68")
downloaderArg, _ := parameterFromArgument("--no-downloader", "true")
httpPortArg, _ := parameterFromArgument("--http.port", "8545")
wsPortArg, _ := parameterFromArgument("--ws.port", "8546")
httpApi, _ := parameterFromArgument(httpApiArg, "admin,eth,debug,net,trace,web3,erigon,txpool")
authrpcPortArg, _ := parameterFromArgument("--authrpc.port", "8551")
natArg, _ := parameterFromArgument("--nat", "none")
Expand All @@ -208,6 +211,7 @@ func nonProducingNodeArgs(dataDir string, nodeNumber int, enode string) []string
chainType,
privateApiAddr,
httpPortArg,
wsPortArg,
authrpcPortArg,
httpApi,
ws,
Expand Down
10 changes: 5 additions & 5 deletions cmd/devnet/services/accounts/faucet.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func (d *deployer) deploy(ctx context.Context, node devnet.Node) {

d.faucet.deployer = nil
d.faucet.transactOpts = nil
logger.Error("failed to deploy faucet", "chain", d.faucet.chainName, "err", err)
logger.Error("failed while waiting to deploy faucet", "chain", d.faucet.chainName, "err", err)
return
}

Expand Down Expand Up @@ -92,7 +92,7 @@ func (d *deployer) deploy(ctx context.Context, node devnet.Node) {

d.faucet.deployer = nil
d.faucet.transactOpts = nil
logger.Error("failed to deploy faucet", "chain", d.faucet.chainName, "err", err)
logger.Error("failed while waiting to receive faucet funds", "chain", d.faucet.chainName, "err", err)
return
}

Expand All @@ -111,7 +111,7 @@ func NewFaucet(chainName string, source *accounts.Account) *Faucet {
}
}

func (f *Faucet) Start(context context.Context) error {
func (f *Faucet) Start(_ context.Context) error {
return nil
}

Expand Down Expand Up @@ -157,7 +157,7 @@ func (f *Faucet) Send(ctx context.Context, destination *accounts.Account, eth fl
}

if f.transactOpts == nil {
return nil, libcommon.Hash{}, fmt.Errorf("Faucet not initialized")
return nil, libcommon.Hash{}, fmt.Errorf("faucet not initialized")
}

node := devnet.SelectNode(ctx)
Expand Down Expand Up @@ -208,7 +208,7 @@ func (f *Faucet) Receive(ctx context.Context, source *accounts.Account, eth floa
return transactOpts.Value, trn.Hash(), nil
}

func (f *Faucet) NodeCreated(ctx context.Context, node devnet.Node) {
func (f *Faucet) NodeCreated(_ context.Context, _ devnet.Node) {
}

func (f *Faucet) NodeStarted(ctx context.Context, node devnet.Node) {
Expand Down
5 changes: 3 additions & 2 deletions cmd/devnet/services/polygon/heimdall.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import (
"sync"
"time"

"github.com/ledgerwatch/log/v3"

ethereum "github.com/ledgerwatch/erigon"
"github.com/ledgerwatch/erigon-lib/chain"
libcommon "github.com/ledgerwatch/erigon-lib/common"
Expand All @@ -21,7 +23,6 @@ import (
"github.com/ledgerwatch/erigon/consensus/bor/heimdall/span"
"github.com/ledgerwatch/erigon/consensus/bor/heimdallgrpc"
"github.com/ledgerwatch/erigon/consensus/bor/valset"
"github.com/ledgerwatch/log/v3"
)

type BridgeEvent string
Expand Down Expand Up @@ -292,7 +293,7 @@ func (h *Heimdall) NodeStarted(ctx context.Context, node devnet.Node) {
h.Unlock()
h.unsubscribe()
h.Lock()
h.logger.Error("Failed to deploy state sender", "err", err)
h.logger.Error("Failed to create transact opts for deploying state sender", "err", err)
return
}

Expand Down
Loading