Skip to content

Commit

Permalink
Chain id and netork id flags (#6894)
Browse files Browse the repository at this point in the history
* added network-id and chain-id flags
* updated usage.go to include new flags
* Merge pull request #1 from prysmaticlabs/master

rebase with master
* gofmt
* Merge branch 'ChainID-and-NetorkID-flags' of github.com:ncitron/prysm into ChainID-and-NetorkID-flags
  • Loading branch information
ncitron authored Aug 5, 2020
1 parent 446bfca commit 440d328
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 0 deletions.
10 changes: 10 additions & 0 deletions beacon-chain/flags/base.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,4 +139,14 @@ var (
Name: "historical-slasher-node",
Usage: "Enables required flags for serving historical data to a slasher client. Results in additional storage usage",
}
// ChainID defines a flag to set the chain id. If none is set, it derives this value from NetworkConfig
ChainID = &cli.Uint64Flag{
Name: "chain-id",
Usage: "Sets the chain id of the beacon chain",
}
// NetworkID defines a flag to set the network id. If none is set, it derives this value from NetworkConfig
NetworkID = &cli.Uint64Flag{
Name: "network-id",
Usage: "Sets the network id of the beacon chain.",
}
)
2 changes: 2 additions & 0 deletions beacon-chain/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ var appFlags = []cli.Flag{
flags.SlotsPerArchivedPoint,
flags.EnableDebugRPCEndpoints,
flags.HistoricalSlasherNode,
flags.ChainID,
flags.NetworkID,
cmd.MinimalConfigFlag,
cmd.E2EConfigFlag,
cmd.RPCMaxPageSizeFlag,
Expand Down
10 changes: 10 additions & 0 deletions beacon-chain/node/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,16 @@ func NewBeaconNode(cliCtx *cli.Context) (*BeaconNode, error) {
networkCfg.ContractDeploymentBlock = uint64(cliCtx.Int(flags.ContractDeploymentBlock.Name))
params.OverrideBeaconNetworkConfig(networkCfg)
}
if cliCtx.IsSet(flags.ChainID.Name) {
c := params.BeaconNetworkConfig()
c.ChainID = cliCtx.Uint64(flags.ChainID.Name)
params.OverrideBeaconNetworkConfig(c)
}
if cliCtx.IsSet(flags.NetworkID.Name) {
c := params.BeaconNetworkConfig()
c.NetworkID = cliCtx.Uint64(flags.NetworkID.Name)
params.OverrideBeaconNetworkConfig(c)
}

registry := shared.NewServiceRegistry()

Expand Down
2 changes: 2 additions & 0 deletions beacon-chain/usage.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ var appHelpFlagGroups = []flagGroup{
flags.EnableDebugRPCEndpoints,
flags.SlotsPerArchivedPoint,
flags.HistoricalSlasherNode,
flags.ChainID,
flags.NetworkID,
},
},
{
Expand Down

0 comments on commit 440d328

Please sign in to comment.