mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2024-12-22 11:41:19 +00:00
added --internalcl flag to Erigon (#7349)
This commit is contained in:
parent
c39cc6a441
commit
2ce5e761bb
@ -157,10 +157,10 @@ How to start Erigon's services as separated processes, see in [docker-compose.ym
|
|||||||
|
|
||||||
### Embedded Consensus Layer
|
### 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.
|
Consensus Layer.
|
||||||
If you want to use an external Consensus Layer, run Erigon with flag `--externalcl`.
|
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 – use `--externalcl` instead.
|
_Warning:_ Staking (block production) is not possible with the embedded CL.
|
||||||
|
|
||||||
### Testnets
|
### Testnets
|
||||||
|
|
||||||
|
@ -3,6 +3,7 @@ package commands
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/binary"
|
"encoding/binary"
|
||||||
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"math/big"
|
"math/big"
|
||||||
|
|
||||||
@ -165,10 +166,11 @@ func withdrawalValues(ptrs []*types.Withdrawal) []types.Withdrawal {
|
|||||||
return vals
|
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) {
|
func (e *EngineImpl) forkchoiceUpdated(version uint32, ctx context.Context, forkChoiceState *ForkChoiceState, payloadAttributes *PayloadAttributes) (map[string]interface{}, error) {
|
||||||
if e.internalCL {
|
if e.internalCL {
|
||||||
log.Error("EXTERNAL CONSENSUS LAYER IS NOT ENABLED, PLEASE RESTART WITH FLAG --externalcl")
|
return nil, errEmbedeedConsensus
|
||||||
return nil, fmt.Errorf("engine api should not be used, restart with --externalcl")
|
|
||||||
}
|
}
|
||||||
if payloadAttributes == nil {
|
if payloadAttributes == nil {
|
||||||
log.Debug("Received ForkchoiceUpdated", "version", version,
|
log.Debug("Received ForkchoiceUpdated", "version", version,
|
||||||
@ -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) {
|
func (e *EngineImpl) newPayload(version uint32, ctx context.Context, payload *ExecutionPayload) (map[string]interface{}, error) {
|
||||||
if e.internalCL {
|
if e.internalCL {
|
||||||
log.Error("EXTERNAL CONSENSUS LAYER IS NOT ENABLED, PLEASE RESTART WITH FLAG --externalcl")
|
return nil, errEmbedeedConsensus
|
||||||
return nil, fmt.Errorf("engine api should not be used, restart with --externalcl")
|
|
||||||
}
|
}
|
||||||
log.Debug("Received NewPayload", "version", version, "height", uint64(payload.BlockNumber), "hash", payload.BlockHash)
|
log.Debug("Received NewPayload", "version", version, "height", uint64(payload.BlockNumber), "hash", payload.BlockHash)
|
||||||
|
|
||||||
@ -327,8 +328,7 @@ func convertPayloadFromRpc(payload *types2.ExecutionPayload) *ExecutionPayload {
|
|||||||
|
|
||||||
func (e *EngineImpl) GetPayloadV1(ctx context.Context, payloadID hexutility.Bytes) (*ExecutionPayload, error) {
|
func (e *EngineImpl) GetPayloadV1(ctx context.Context, payloadID hexutility.Bytes) (*ExecutionPayload, error) {
|
||||||
if e.internalCL {
|
if e.internalCL {
|
||||||
log.Error("EXTERNAL CONSENSUS LAYER IS NOT ENABLED, PLEASE RESTART WITH FLAG --externalcl")
|
return nil, errEmbedeedConsensus
|
||||||
return nil, fmt.Errorf("engine api should not be used, restart with --externalcl")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
decodedPayloadId := binary.BigEndian.Uint64(payloadID)
|
decodedPayloadId := binary.BigEndian.Uint64(payloadID)
|
||||||
@ -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) {
|
func (e *EngineImpl) GetPayloadV2(ctx context.Context, payloadID hexutility.Bytes) (*GetPayloadV2Response, error) {
|
||||||
if e.internalCL {
|
if e.internalCL {
|
||||||
log.Error("EXTERNAL CONSENSUS LAYER IS NOT ENABLED, PLEASE RESTART WITH FLAG --externalcl")
|
return nil, errEmbedeedConsensus
|
||||||
return nil, fmt.Errorf("engine api should not be used, restart with --externalcl")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
decodedPayloadId := binary.BigEndian.Uint64(payloadID)
|
decodedPayloadId := binary.BigEndian.Uint64(payloadID)
|
||||||
@ -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
|
// 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) {
|
func (e *EngineImpl) ExchangeTransitionConfigurationV1(ctx context.Context, beaconConfig *TransitionConfiguration) (*TransitionConfiguration, error) {
|
||||||
if e.internalCL {
|
if e.internalCL {
|
||||||
log.Error("EXTERNAL CONSENSUS LAYER IS NOT ENABLED, PLEASE RESTART WITH FLAG --externalcl")
|
return nil, errEmbedeedConsensus
|
||||||
return nil, fmt.Errorf("engine api should not be used, restart with --externalcl")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
tx, err := e.db.BeginRo(ctx)
|
tx, err := e.db.BeginRo(ctx)
|
||||||
|
@ -131,8 +131,8 @@ var (
|
|||||||
Usage: `Default: use snapshots "true" for Mainnet, Goerli, Gnosis Chain and Chiado. use snapshots "false" in all other cases`,
|
Usage: `Default: use snapshots "true" for Mainnet, Goerli, Gnosis Chain and Chiado. use snapshots "false" in all other cases`,
|
||||||
Value: true,
|
Value: true,
|
||||||
}
|
}
|
||||||
ExternalConsensusFlag = cli.BoolFlag{
|
InternalConsensusFlag = cli.BoolFlag{
|
||||||
Name: "externalcl",
|
Name: "internalcl",
|
||||||
Usage: "enables external consensus",
|
Usage: "enables external consensus",
|
||||||
}
|
}
|
||||||
// Transaction pool settings
|
// Transaction pool settings
|
||||||
@ -1585,13 +1585,10 @@ func SetEthConfig(ctx *cli.Context, nodeConfig *nodecfg.Config, cfg *ethconfig.C
|
|||||||
cfg.TxPool.OverrideShanghaiTime = cfg.OverrideShanghaiTime
|
cfg.TxPool.OverrideShanghaiTime = cfg.OverrideShanghaiTime
|
||||||
}
|
}
|
||||||
|
|
||||||
if ctx.IsSet(ExternalConsensusFlag.Name) {
|
if ctx.IsSet(InternalConsensusFlag.Name) && clparams.EmbeddedEnabledByDefault(cfg.NetworkID) {
|
||||||
cfg.ExternalCL = ctx.Bool(ExternalConsensusFlag.Name)
|
cfg.InternalCL = ctx.Bool(InternalConsensusFlag.Name)
|
||||||
} else {
|
|
||||||
cfg.ExternalCL = !clparams.EmbeddedEnabledByDefault(cfg.NetworkID)
|
|
||||||
}
|
}
|
||||||
|
nodeConfig.Http.InternalCL = cfg.InternalCL
|
||||||
nodeConfig.Http.InternalCL = !cfg.ExternalCL
|
|
||||||
|
|
||||||
if ctx.IsSet(SentryDropUselessPeers.Name) {
|
if ctx.IsSet(SentryDropUselessPeers.Name) {
|
||||||
cfg.DropUselessPeers = ctx.Bool(SentryDropUselessPeers.Name)
|
cfg.DropUselessPeers = ctx.Bool(SentryDropUselessPeers.Name)
|
||||||
|
@ -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 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))
|
genesisCfg, networkCfg, beaconCfg := clparams.GetConfigsByNetwork(clparams.NetworkType(config.NetworkID))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
@ -241,7 +241,7 @@ type Config struct {
|
|||||||
// Ethstats service
|
// Ethstats service
|
||||||
Ethstats string
|
Ethstats string
|
||||||
// Consensus layer
|
// Consensus layer
|
||||||
ExternalCL bool
|
InternalCL bool
|
||||||
LightClientDiscoveryAddr string
|
LightClientDiscoveryAddr string
|
||||||
LightClientDiscoveryPort uint64
|
LightClientDiscoveryPort uint64
|
||||||
LightClientDiscoveryTCPPort uint64
|
LightClientDiscoveryTCPPort uint64
|
||||||
|
@ -12,7 +12,7 @@ var DefaultFlags = []cli.Flag{
|
|||||||
&utils.DataDirFlag,
|
&utils.DataDirFlag,
|
||||||
&utils.EthashDatasetDirFlag,
|
&utils.EthashDatasetDirFlag,
|
||||||
&utils.SnapshotFlag,
|
&utils.SnapshotFlag,
|
||||||
&utils.ExternalConsensusFlag,
|
&utils.InternalConsensusFlag,
|
||||||
&utils.TxPoolDisableFlag,
|
&utils.TxPoolDisableFlag,
|
||||||
&utils.TxPoolLocalsFlag,
|
&utils.TxPoolLocalsFlag,
|
||||||
&utils.TxPoolNoLocalsFlag,
|
&utils.TxPoolNoLocalsFlag,
|
||||||
|
Loading…
Reference in New Issue
Block a user