Skip to content

Commit

Permalink
Fixed E3 <-> Caplin on Gnosis,Holesky and Chiado (#10265)
Browse files Browse the repository at this point in the history
  • Loading branch information
Giulio2002 authored May 10, 2024
1 parent 65d5b80 commit e75d359
Showing 1 changed file with 15 additions and 14 deletions.
29 changes: 15 additions & 14 deletions eth/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -897,23 +897,11 @@ func New(ctx context.Context, stack *node.Node, config *ethconfig.Config, logger
backend.pipelineStagedSync = stagedsync.New(config.Sync, pipelineStages, stagedsync.PipelineUnwindOrder, stagedsync.PipelinePruneOrder, logger)
backend.eth1ExecutionServer = eth1.NewEthereumExecutionModule(blockReader, backend.chainDB, backend.pipelineStagedSync, backend.forkValidator, chainConfig, assembleBlockPOS, hook, backend.notifications.Accumulator, backend.notifications.StateChangesConsumer, logger, backend.engine, config.HistoryV3, config.Sync, ctx)
executionRpc := direct.NewExecutionClientDirect(backend.eth1ExecutionServer)
engineBackendRPC := engineapi.NewEngineServer(
logger,
chainConfig,
executionRpc,
backend.sentriesClient.Hd,
engine_block_downloader.NewEngineBlockDownloader(ctx,
logger, backend.sentriesClient.Hd, executionRpc,
backend.sentriesClient.Bd, backend.sentriesClient.BroadcastNewBlock, backend.sentriesClient.SendBodyRequest, blockReader,
backend.chainDB, chainConfig, tmpdir, config.Sync),
config.InternalCL,
false,
config.Miner.EnabledPOS)
backend.engineBackendRPC = engineBackendRPC

var executionEngine executionclient.ExecutionEngine
caplinUseEngineAPI := config.NetworkID == uint64(clparams.GnosisNetwork) || config.NetworkID == uint64(clparams.HoleskyNetwork) || config.NetworkID == uint64(clparams.GoerliNetwork)
// Gnosis has too few blocks on his network for phase2 to work. Once we have proper snapshot automation, it can go back to normal.
if config.NetworkID == uint64(clparams.GnosisNetwork) || config.NetworkID == uint64(clparams.HoleskyNetwork) || config.NetworkID == uint64(clparams.GoerliNetwork) {
if caplinUseEngineAPI {
// Read the jwt secret
jwtSecret, err := cli.ObtainJWTSecret(&stack.Config().Http, logger)
if err != nil {
Expand All @@ -929,6 +917,19 @@ func New(ctx context.Context, stack *node.Node, config *ethconfig.Config, logger
return nil, err
}
}
engineBackendRPC := engineapi.NewEngineServer(
logger,
chainConfig,
executionRpc,
backend.sentriesClient.Hd,
engine_block_downloader.NewEngineBlockDownloader(ctx,
logger, backend.sentriesClient.Hd, executionRpc,
backend.sentriesClient.Bd, backend.sentriesClient.BroadcastNewBlock, backend.sentriesClient.SendBodyRequest, blockReader,
backend.chainDB, chainConfig, tmpdir, config.Sync),
config.InternalCL && !caplinUseEngineAPI, // If the chain supports the engine API, then we should not make the server fail.
false,
config.Miner.EnabledPOS)
backend.engineBackendRPC = engineBackendRPC

// If we choose not to run a consensus layer, run our embedded.
if config.InternalCL && clparams.EmbeddedSupported(config.NetworkID) {
Expand Down

0 comments on commit e75d359

Please sign in to comment.