diff --git a/cmd/devnet/args/node.go b/cmd/devnet/args/node.go index 1c8b7497851..932b28efbd5 100644 --- a/cmd/devnet/args/node.go +++ b/cmd/devnet/args/node.go @@ -44,6 +44,7 @@ type Node struct { StaticPeers string `arg:"--staticpeers" json:"staticpeers,omitempty"` WithoutHeimdall bool `arg:"--bor.withoutheimdall" flag:"" default:"false" json:"bor.withoutheimdall,omitempty"` HeimdallGRpc string `arg:"--bor.heimdallgRPC" json:"bor.heimdallgRPC,omitempty"` + WithHeimdallMilestones bool `arg:"--bor.milestone" json:"bor.milestone"` VMDebug bool `arg:"--vmdebug" flag:"" default:"false" json:"dmdebug"` } @@ -86,6 +87,8 @@ func (node *Node) configure(base Node, nodeNumber int) error { node.Port = base.Port + nodeNumber + node.WithHeimdallMilestones = base.WithHeimdallMilestones + return nil } diff --git a/cmd/devnet/args/node_test.go b/cmd/devnet/args/node_test.go index ddd7de4c8c9..6b940c52d39 100644 --- a/cmd/devnet/args/node_test.go +++ b/cmd/devnet/args/node_test.go @@ -162,8 +162,26 @@ func producingNodeArgs(dataDir string, nodeNumber int) []string { authrpcPortArg, _ := parameterFromArgument("--authrpc.port", "8551") natArg, _ := parameterFromArgument("--nat", "none") accountSlotsArg, _ := parameterFromArgument("--txpool.accountslots", "16") - - return []string{buildDirArg, dataDirArg, chainType, privateApiAddr, httpPortArg, authrpcPortArg, mine, httpApi, ws, natArg, devPeriod, consoleVerbosity, p2pProtocol, downloaderArg, accountSlotsArg} + withHeimdallMilestonesArg, _ := parameterFromArgument("--bor.milestone", "false") + + return []string{ + buildDirArg, + dataDirArg, + chainType, + privateApiAddr, + httpPortArg, + authrpcPortArg, + mine, + httpApi, + ws, + natArg, + devPeriod, + consoleVerbosity, + p2pProtocol, + downloaderArg, + accountSlotsArg, + withHeimdallMilestonesArg, + } } // nonMiningNodeArgs returns custom args for starting a non-mining node @@ -182,6 +200,24 @@ func nonProducingNodeArgs(dataDir string, nodeNumber int, enode string) []string authrpcPortArg, _ := parameterFromArgument("--authrpc.port", "8551") natArg, _ := parameterFromArgument("--nat", "none") ws := wsArg - - return []string{buildDirArg, dataDirArg, chainType, privateApiAddr, httpPortArg, authrpcPortArg, httpApi, ws, natArg, staticPeers, noDiscover, consoleVerbosity, torrentPort, p2pProtocol, downloaderArg} + withHeimdallMilestonesArg, _ := parameterFromArgument("--bor.milestone", "false") + + return []string{ + buildDirArg, + dataDirArg, + chainType, + privateApiAddr, + httpPortArg, + authrpcPortArg, + httpApi, + ws, + natArg, + staticPeers, + noDiscover, + consoleVerbosity, + torrentPort, + p2pProtocol, + downloaderArg, + withHeimdallMilestonesArg, + } } diff --git a/cmd/devnet/devnet/network.go b/cmd/devnet/devnet/network.go index 6f6afc548f9..a5584d085ee 100644 --- a/cmd/devnet/devnet/network.go +++ b/cmd/devnet/devnet/network.go @@ -4,6 +4,7 @@ import ( "context" "errors" "fmt" + "github.com/ledgerwatch/erigon/cmd/utils" "math/big" "net" "os" @@ -39,6 +40,7 @@ type Network struct { BorStateSyncDelay time.Duration BorPeriod time.Duration BorMinBlockSize int + BorWithMilestones *bool wg sync.WaitGroup peers []string namedNodes map[string]Node @@ -75,6 +77,12 @@ func (nw *Network) Start(ctx context.Context) error { Snapshots: nw.Snapshots, } + if nw.BorWithMilestones != nil { + baseNode.WithHeimdallMilestones = *nw.BorWithMilestones + } else { + baseNode.WithHeimdallMilestones = utils.WithHeimdallMilestones.Value + } + cliCtx := CliContext(ctx) metricsEnabled := cliCtx.Bool("metrics") diff --git a/cmd/devnet/main.go b/cmd/devnet/main.go index 56f7566d78e..a381b16c4f1 100644 --- a/cmd/devnet/main.go +++ b/cmd/devnet/main.go @@ -3,6 +3,7 @@ package main import ( "context" "fmt" + "github.com/ledgerwatch/erigon/cmd/utils" "os" "os/signal" "path/filepath" @@ -364,11 +365,14 @@ func initDevnet(ctx *cli.Context, logger log.Logger) (devnet.Devnet, error) { } else { var heimdallGrpc string var services []devnet.Service + var withMilestones = utils.WithHeimdallMilestones.Value checkpointOwner := accounts.NewAccount("checkpoint-owner") if ctx.Bool(LocalHeimdallFlag.Name) { config := *params.BorDevnetChainConfig + // milestones are not supported yet on the local heimdall + withMilestones = false if sprintSize := uint64(ctx.Int(BorSprintSizeFlag.Name)); sprintSize > 0 { config.Bor.Sprint = map[string]uint64{"0": sprintSize} @@ -394,6 +398,7 @@ func initDevnet(ctx *cli.Context, logger log.Logger) (devnet.Devnet, error) { BaseRPCHost: baseRpcHost, BaseRPCPort: baseRpcPort, BorStateSyncDelay: 5 * time.Second, + BorWithMilestones: &withMilestones, Services: append(services, account_services.NewFaucet(networkname.BorDevnetChainName, faucetSource)), Alloc: types.GenesisAlloc{ faucetSource.Address: {Balance: accounts.EtherAmount(200_000)},