Skip to content
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
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -157,10 +157,10 @@ How to start Erigon's services as separated processes, see in [docker-compose.ym

### Embedded Consensus Layer

By default, on Ethereum Mainnet, Görli, and Sepolia, the Engine API is disabled in favour of the Erigon native Embedded
On Ethereum Mainnet, Görli, and Sepolia, the Engine API can be disabled in favour of the Erigon native Embedded
Consensus Layer.
If you want to use an external Consensus Layer, run Erigon with flag `--externalcl`.
_Warning:_ Staking (block production) is not possible with the embedded CL – use `--externalcl` instead.
If you want to use the internal Consensus Layer, run Erigon with flag `--internalcl`.
_Warning:_ Staking (block production) is not possible with the embedded CL.

### Testnets

Expand Down
18 changes: 8 additions & 10 deletions cmd/rpcdaemon/commands/engine_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package commands
import (
"context"
"encoding/binary"
"errors"
"fmt"
"math/big"

Expand Down Expand Up @@ -165,10 +166,11 @@ func withdrawalValues(ptrs []*types.Withdrawal) []types.Withdrawal {
return vals
}

var errEmbedeedConsensus = errors.New("engine api should not be used, restart without --internalcl")

func (e *EngineImpl) forkchoiceUpdated(version uint32, ctx context.Context, forkChoiceState *ForkChoiceState, payloadAttributes *PayloadAttributes) (map[string]interface{}, error) {
if e.internalCL {
log.Error("EXTERNAL CONSENSUS LAYER IS NOT ENABLED, PLEASE RESTART WITH FLAG --externalcl")
return nil, fmt.Errorf("engine api should not be used, restart with --externalcl")
return nil, errEmbedeedConsensus
}
if payloadAttributes == nil {
log.Debug("Received ForkchoiceUpdated", "version", version,
Expand Down Expand Up @@ -232,8 +234,7 @@ func (e *EngineImpl) NewPayloadV2(ctx context.Context, payload *ExecutionPayload

func (e *EngineImpl) newPayload(version uint32, ctx context.Context, payload *ExecutionPayload) (map[string]interface{}, error) {
if e.internalCL {
log.Error("EXTERNAL CONSENSUS LAYER IS NOT ENABLED, PLEASE RESTART WITH FLAG --externalcl")
return nil, fmt.Errorf("engine api should not be used, restart with --externalcl")
return nil, errEmbedeedConsensus
}
log.Debug("Received NewPayload", "version", version, "height", uint64(payload.BlockNumber), "hash", payload.BlockHash)

Expand Down Expand Up @@ -327,8 +328,7 @@ func convertPayloadFromRpc(payload *types2.ExecutionPayload) *ExecutionPayload {

func (e *EngineImpl) GetPayloadV1(ctx context.Context, payloadID hexutility.Bytes) (*ExecutionPayload, error) {
if e.internalCL {
log.Error("EXTERNAL CONSENSUS LAYER IS NOT ENABLED, PLEASE RESTART WITH FLAG --externalcl")
return nil, fmt.Errorf("engine api should not be used, restart with --externalcl")
return nil, errEmbedeedConsensus
}

decodedPayloadId := binary.BigEndian.Uint64(payloadID)
Expand All @@ -344,8 +344,7 @@ func (e *EngineImpl) GetPayloadV1(ctx context.Context, payloadID hexutility.Byte

func (e *EngineImpl) GetPayloadV2(ctx context.Context, payloadID hexutility.Bytes) (*GetPayloadV2Response, error) {
if e.internalCL {
log.Error("EXTERNAL CONSENSUS LAYER IS NOT ENABLED, PLEASE RESTART WITH FLAG --externalcl")
return nil, fmt.Errorf("engine api should not be used, restart with --externalcl")
return nil, errEmbedeedConsensus
}

decodedPayloadId := binary.BigEndian.Uint64(payloadID)
Expand All @@ -369,8 +368,7 @@ func (e *EngineImpl) GetPayloadV2(ctx context.Context, payloadID hexutility.Byte
// See https://github.com/ethereum/execution-apis/blob/v1.0.0-beta.1/src/engine/specification.md#engine_exchangetransitionconfigurationv1
func (e *EngineImpl) ExchangeTransitionConfigurationV1(ctx context.Context, beaconConfig *TransitionConfiguration) (*TransitionConfiguration, error) {
if e.internalCL {
log.Error("EXTERNAL CONSENSUS LAYER IS NOT ENABLED, PLEASE RESTART WITH FLAG --externalcl")
return nil, fmt.Errorf("engine api should not be used, restart with --externalcl")
return nil, errEmbedeedConsensus
}

tx, err := e.db.BeginRo(ctx)
Expand Down
13 changes: 5 additions & 8 deletions cmd/utils/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,8 @@ var (
Usage: `Default: use snapshots "true" for Mainnet, Goerli, Gnosis Chain and Chiado. use snapshots "false" in all other cases`,
Value: true,
}
ExternalConsensusFlag = cli.BoolFlag{
Name: "externalcl",
InternalConsensusFlag = cli.BoolFlag{
Name: "internalcl",
Usage: "enables external consensus",
}
// Transaction pool settings
Expand Down Expand Up @@ -1585,13 +1585,10 @@ func SetEthConfig(ctx *cli.Context, nodeConfig *nodecfg.Config, cfg *ethconfig.C
cfg.TxPool.OverrideShanghaiTime = cfg.OverrideShanghaiTime
}

if ctx.IsSet(ExternalConsensusFlag.Name) {
cfg.ExternalCL = ctx.Bool(ExternalConsensusFlag.Name)
} else {
cfg.ExternalCL = !clparams.EmbeddedEnabledByDefault(cfg.NetworkID)
if ctx.IsSet(InternalConsensusFlag.Name) && clparams.EmbeddedEnabledByDefault(cfg.NetworkID) {
cfg.InternalCL = ctx.Bool(InternalConsensusFlag.Name)
}

nodeConfig.Http.InternalCL = !cfg.ExternalCL
nodeConfig.Http.InternalCL = cfg.InternalCL

if ctx.IsSet(SentryDropUselessPeers.Name) {
cfg.DropUselessPeers = ctx.Bool(SentryDropUselessPeers.Name)
Expand Down
2 changes: 1 addition & 1 deletion eth/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,7 @@ func New(stack *node.Node, config *ethconfig.Config) (*Ethereum, error) {
}

// If we choose not to run a consensus layer, run our embedded.
if !config.ExternalCL && clparams.EmbeddedSupported(config.NetworkID) {
if config.InternalCL && clparams.EmbeddedSupported(config.NetworkID) {
genesisCfg, networkCfg, beaconCfg := clparams.GetConfigsByNetwork(clparams.NetworkType(config.NetworkID))
if err != nil {
return nil, err
Expand Down
2 changes: 1 addition & 1 deletion eth/ethconfig/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ type Config struct {
// Ethstats service
Ethstats string
// Consensus layer
ExternalCL bool
InternalCL bool
LightClientDiscoveryAddr string
LightClientDiscoveryPort uint64
LightClientDiscoveryTCPPort uint64
Expand Down
2 changes: 1 addition & 1 deletion turbo/cli/default_flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ var DefaultFlags = []cli.Flag{
&utils.DataDirFlag,
&utils.EthashDatasetDirFlag,
&utils.SnapshotFlag,
&utils.ExternalConsensusFlag,
&utils.InternalConsensusFlag,
&utils.TxPoolDisableFlag,
&utils.TxPoolLocalsFlag,
&utils.TxPoolNoLocalsFlag,
Expand Down