Skip to content

Commit

Permalink
Deprecate --interop-genesis-state (#12008)
Browse files Browse the repository at this point in the history
* Deprecaste `--interop-genesis-state`

* better pattern

* fix errors

* test fix

---------

Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
  • Loading branch information
rkapka and prylabs-bulldozer[bot] authored Mar 1, 2023
1 parent ac44834 commit 17fe935
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 29 deletions.
3 changes: 1 addition & 2 deletions beacon-chain/node/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,12 +129,11 @@ func configureInteropConfig(cliCtx *cli.Context) error {
if cliCtx.IsSet(cmd.ChainConfigFileFlag.Name) {
return nil
}
genStateIsSet := cliCtx.IsSet(flags.InteropGenesisStateFlag.Name)
genTimeIsSet := cliCtx.IsSet(flags.InteropGenesisTimeFlag.Name)
numValsIsSet := cliCtx.IsSet(flags.InteropNumValidatorsFlag.Name)
votesIsSet := cliCtx.IsSet(flags.InteropMockEth1DataVotesFlag.Name)

if genStateIsSet || genTimeIsSet || numValsIsSet || votesIsSet {
if genTimeIsSet || numValsIsSet || votesIsSet {
if err := params.SetActive(params.InteropConfig().Copy()); err != nil {
return err
}
Expand Down
11 changes: 0 additions & 11 deletions beacon-chain/node/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -219,17 +219,6 @@ func TestConfigureInterop(t *testing.T) {
},
"interop",
},
{
"genesis state set",
func() *cli.Context {
app := cli.App{}
set := flag.NewFlagSet("test", 0)
set.String(flags.InteropGenesisStateFlag.Name, "", "")
assert.NoError(t, set.Set(flags.InteropGenesisStateFlag.Name, "/path/"))
return cli.NewContext(&app, set, nil)
},
"interop",
},
}

for _, tt := range tests {
Expand Down
7 changes: 2 additions & 5 deletions beacon-chain/node/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -762,10 +762,9 @@ func (b *BeaconNode) registerRPCService() error {
}

genesisValidators := b.cliCtx.Uint64(flags.InteropNumValidatorsFlag.Name)
genesisStatePath := b.cliCtx.String(flags.InteropGenesisStateFlag.Name)
var depositFetcher depositcache.DepositFetcher
var chainStartFetcher execution.ChainStartFetcher
if genesisValidators > 0 || genesisStatePath != "" {
if genesisValidators > 0 {
var interopService *interopcoldstart.Service
if err := b.services.FetchService(&interopService); err != nil {
return err
Expand Down Expand Up @@ -917,15 +916,13 @@ func (b *BeaconNode) registerGRPCGateway() error {
func (b *BeaconNode) registerDeterminsticGenesisService() error {
genesisTime := b.cliCtx.Uint64(flags.InteropGenesisTimeFlag.Name)
genesisValidators := b.cliCtx.Uint64(flags.InteropNumValidatorsFlag.Name)
genesisStatePath := b.cliCtx.String(flags.InteropGenesisStateFlag.Name)

if genesisValidators > 0 || genesisStatePath != "" {
if genesisValidators > 0 {
svc := interopcoldstart.NewService(b.ctx, &interopcoldstart.Config{
GenesisTime: genesisTime,
NumValidators: genesisValidators,
BeaconDB: b.db,
DepositCache: b.depositCache,
GenesisPath: genesisStatePath,
})
svc.Start()

Expand Down
2 changes: 1 addition & 1 deletion beacon-chain/node/node_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ func TestNodeStart_Ok_registerDeterministicGenesisService(t *testing.T) {
genesisBytes, err := genesisState.MarshalSSZ()
require.NoError(t, err)
require.NoError(t, os.WriteFile("genesis_ssz.json", genesisBytes, 0666))
set.String(flags.InteropGenesisStateFlag.Name, "genesis_ssz.json", "")
set.String("genesis-state", "genesis_ssz.json", "")
ctx := cli.NewContext(&app, set, nil)
node, err := New(ctx, WithBlockchainFlagOptions([]blockchain.Option{}),
WithBuilderFlagOptions([]builder.Option{}),
Expand Down
7 changes: 0 additions & 7 deletions cmd/beacon-chain/flags/interop.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,6 @@ import (
)

var (
// InteropGenesisStateFlag defines a flag for the beacon node to load genesis state via file.
InteropGenesisStateFlag = &cli.StringFlag{
Name: "interop-genesis-state",
Usage: "The genesis state file (.SSZ) to load from. Note: loading from an interop genesis " +
"state does not use a web3 connection to read any deposits. This interop " +
"functionality should not be used with public testnets.",
}
// InteropMockEth1DataVotesFlag enables mocking the eth1 proof-of-work chain data put into blocks by proposers.
InteropMockEth1DataVotesFlag = &cli.BoolFlag{
Name: "interop-eth1data-votes",
Expand Down
1 change: 0 additions & 1 deletion cmd/beacon-chain/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ var appFlags = []cli.Flag{
flags.BlockBatchLimit,
flags.BlockBatchLimitBurstFactor,
flags.InteropMockEth1DataVotesFlag,
flags.InteropGenesisStateFlag,
flags.InteropNumValidatorsFlag,
flags.InteropGenesisTimeFlag,
flags.SlotsPerArchivedPoint,
Expand Down
3 changes: 1 addition & 2 deletions cmd/beacon-chain/usage.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ var appHelpFlagGroups = []flagGroup{
Name: "beacon-chain",
Flags: []cli.Flag{
flags.InteropMockEth1DataVotesFlag,
flags.InteropGenesisStateFlag,
flags.DepositContractFlag,
flags.ContractDeploymentBlock,
flags.RPCHost,
Expand Down Expand Up @@ -173,7 +172,7 @@ var appHelpFlagGroups = []flagGroup{
{
Name: "interop",
Flags: []cli.Flag{
flags.InteropGenesisStateFlag,
genesis.StatePath,
flags.InteropGenesisTimeFlag,
flags.InteropNumValidatorsFlag,
},
Expand Down
6 changes: 6 additions & 0 deletions config/features/deprecated_flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,11 @@ var (
Usage: deprecatedUsage,
Hidden: true,
}
deprecatedInteropGenesisState = &cli.StringFlag{
Name: "interop-genesis-state",
Usage: deprecatedUsage,
Hidden: true,
}
)

// Deprecated flags for both the beacon node and validator client.
Expand All @@ -111,6 +116,7 @@ var deprecatedFlags = []cli.Flag{
deprecatedEnableDefensivePull,
deprecatedDisableNativeState,
deprecatedRopstenTestnet,
deprecatedInteropGenesisState,
}

// deprecatedBeaconFlags contains flags that are still used by other components
Expand Down

0 comments on commit 17fe935

Please sign in to comment.