Skip to content

Commit

Permalink
removed --el.enabled (#7187)
Browse files Browse the repository at this point in the history
  • Loading branch information
Giulio2002 authored Mar 27, 2023
1 parent be860e3 commit 540af96
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 45 deletions.
12 changes: 4 additions & 8 deletions cmd/erigon-cl/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,10 @@ func runConsensusLayerNode(cliCtx *cli.Context) error {
}

tmpdir := "/tmp"
var executionClient *execution_client.ExecutionClient
if cfg.ELEnabled {
executionClient, err = execution_client.NewExecutionClient(ctx, "127.0.0.1:8989")
if err != nil {
log.Warn("Could not connect to execution client", "err", err)
return err
}
executionClient, err := execution_client.NewExecutionClient(ctx, "127.0.0.1:8989")
if err != nil {
log.Warn("Could not connect to execution client", "err", err)
return err
}

if cfg.TransitionChain {
Expand All @@ -80,7 +77,6 @@ func runConsensusLayerNode(cliCtx *cli.Context) error {
return stages.SpawnStageBeaconState(stages.StageBeaconState(db, cfg.BeaconCfg, state, executionClient), nil, ctx)
}

fmt.Println(cfg.CheckpointUri)
// Fetch the checkpoint state.
cpState, err := getCheckpointState(ctx, db, cfg.BeaconCfg, cfg.GenesisCfg, cfg.CheckpointUri)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion cmd/erigon-cl/stages/stage_history_reconstruction.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ func SpawnStageHistoryReconstruction(cfg StageHistoryReconstructionCfg, s *stage
return false, err
}
// Collect Execution Payloads
if cfg.executionClient != nil && blk.Version() >= clparams.BellatrixVersion && !foundLatestEth1ValidHash {
if blk.Version() >= clparams.BellatrixVersion && !foundLatestEth1ValidHash {
payload := blk.Block.Body.ExecutionPayload
if foundLatestEth1ValidHash, err = cfg.executionClient.IsCanonical(payload.BlockHash); err != nil {
return false, err
Expand Down
50 changes: 23 additions & 27 deletions cmd/erigon-cl/stages/stages_beacon_state.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,39 +64,35 @@ func SpawnStageBeaconState(cfg StageBeaconStateCfg, tx kv.RwTx, ctx context.Cont
if err != nil {
return err
}
// TODO: Pass this to state transition with the state
if cfg.executionClient != nil {
// Query execution engine only if the payload have an hash.
if eth1Hash != (libcommon.Hash{}) {
if block.Block.Body.ExecutionPayload, err = cfg.executionClient.ReadExecutionPayload(eth1Number, eth1Hash); err != nil {
return err
}
}
// validate fully only in current epoch.
fullValidate := utils.GetCurrentEpoch(cfg.state.GenesisTime(), cfg.beaconCfg.SecondsPerSlot, cfg.beaconCfg.SlotsPerEpoch) == cfg.state.Epoch()
if err := transition.TransitionState(cfg.state, block, fullValidate); err != nil {
log.Info("Found epoch, so stopping now...", "count", slot-(fromSlot+1), "slot", slot)

// Query execution engine only if the payload have an hash.
if eth1Hash != (libcommon.Hash{}) {
if block.Block.Body.ExecutionPayload, err = cfg.executionClient.ReadExecutionPayload(eth1Number, eth1Hash); err != nil {
return err
}
log.Info("Applied state transition", "from", slot, "to", slot+1)
}
}
// If successful update fork choice
if cfg.executionClient != nil {
finalizedRoot, err := rawdb.ReadFinalizedBlockRoot(tx, endSlot)
if err != nil {
return err
}
_, _, eth1Hash, _, err := rawdb.ReadBeaconBlockForStorage(tx, finalizedRoot, endSlot)
if err != nil {
return err
}
receipt, err := cfg.executionClient.ForkChoiceUpdate(eth1Hash)
if err != nil {
// validate fully only in current epoch.
fullValidate := utils.GetCurrentEpoch(cfg.state.GenesisTime(), cfg.beaconCfg.SecondsPerSlot, cfg.beaconCfg.SlotsPerEpoch) == cfg.state.Epoch()
if err := transition.TransitionState(cfg.state, block, fullValidate); err != nil {
log.Info("Found epoch, so stopping now...", "count", slot-(fromSlot+1), "slot", slot)
return err
}
log.Info("Forkchoice Status", "outcome", receipt.Success)
log.Info("Applied state transition", "from", slot, "to", slot+1)
}
// If successful update fork choice
finalizedRoot, err := rawdb.ReadFinalizedBlockRoot(tx, endSlot)
if err != nil {
return err
}
_, _, eth1Hash, _, err := rawdb.ReadBeaconBlockForStorage(tx, finalizedRoot, endSlot)
if err != nil {
return err
}
receipt, err := cfg.executionClient.ForkChoiceUpdate(eth1Hash)
if err != nil {
return err
}
log.Info("Forkchoice Status", "outcome", receipt.Success)

log.Info("[BeaconState] Finished transitioning state", "from", fromSlot, "to", endSlot)
if !useExternalTx {
Expand Down
2 changes: 0 additions & 2 deletions cmd/sentinel/cli/cliSettings.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ type ConsensusClientCliCfg struct {
NoDiscovery bool `json:"noDiscovery"`
CheckpointUri string `json:"checkpointUri"`
Chaindata string `json:"chaindata"`
ELEnabled bool `json:"elEnabled"`
ErigonPrivateApi string `json:"erigonPrivateApi"`
TransitionChain bool `json:"transitionChain"`
NetworkType clparams.NetworkType
Expand Down Expand Up @@ -69,7 +68,6 @@ func SetupConsensusClientCfg(ctx *cli.Context) (*ConsensusClientCliCfg, error) {
fmt.Println(cfg.CheckpointUri)
}
cfg.Chaindata = ctx.String(flags.ChaindataFlag.Name)
cfg.ELEnabled = ctx.Bool(flags.ELEnabledFlag.Name)
cfg.BeaconDataCfg = rawdb.BeaconDataConfigurations[ctx.String(flags.BeaconDBModeFlag.Name)]
// Process bootnodes
if ctx.String(flags.BootnodesFlag.Name) != "" {
Expand Down
2 changes: 0 additions & 2 deletions cmd/sentinel/cli/flags/defaultFlags.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ var CLDefaultFlags = []cli.Flag{
&SentinelTcpPort,
&NoDiscovery,
&ChaindataFlag,
&ELEnabledFlag,
&BeaconDBModeFlag,
&BootnodesFlag,
&BeaconConfigFlag,
Expand All @@ -31,7 +30,6 @@ var LCDefaultFlags = []cli.Flag{
&SentinelTcpPort,
&NoDiscovery,
&ChaindataFlag,
&ELEnabledFlag,
&BeaconDBModeFlag,
&BootnodesFlag,
&BeaconConfigFlag,
Expand Down
5 changes: 0 additions & 5 deletions cmd/sentinel/cli/flags/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,6 @@ var (
Usage: "chaindata of database",
Value: "",
}
ELEnabledFlag = cli.BoolFlag{
Name: "el.enabled",
Usage: "enables EL support",
Value: false,
}
BeaconDBModeFlag = cli.StringFlag{
Name: "beacon-db-mode",
Usage: "level of storing on beacon chain, minimal(only 500k blocks stored), full (all blocks stored), light (no blocks stored)",
Expand Down

0 comments on commit 540af96

Please sign in to comment.