diff --git a/cmd/geth/config.go b/cmd/geth/config.go index 01f976098fc7..15ea893019cd 100644 --- a/cmd/geth/config.go +++ b/cmd/geth/config.go @@ -205,7 +205,10 @@ func makeFullNode(ctx *cli.Context) (*node.Node, ethapi.Backend) { // Configure gRPC if requested. if ctx.IsSet(utils.GRPCEnabledFlag.Name) { - serviceV1a2 := execution.NewExecutionServiceServerV1Alpha2(eth) + serviceV1a2, err := execution.NewExecutionServiceServerV1Alpha2(eth) + if err != nil { + utils.Fatalf("failed to create execution service: %v", err) + } utils.RegisterGRPCExecutionService(stack, serviceV1a2, &cfg.Node) } diff --git a/grpc/execution/server.go b/grpc/execution/server.go index 341e52bfbb66..3cdb9e1bb1b9 100644 --- a/grpc/execution/server.go +++ b/grpc/execution/server.go @@ -7,6 +7,7 @@ package execution import ( "context" "crypto/sha256" + "errors" "fmt" "sync" "time" @@ -65,9 +66,25 @@ var ( commitmentStateUpdateTimer = metrics.GetOrRegisterTimer("astria/execution/commitment", nil) ) -func NewExecutionServiceServerV1Alpha2(eth *eth.Ethereum) *ExecutionServiceServerV1Alpha2 { +func NewExecutionServiceServerV1Alpha2(eth *eth.Ethereum) (*ExecutionServiceServerV1Alpha2, error) { bc := eth.BlockChain() + if bc.Config().AstriaRollupName == "" { + return nil, errors.New("rollup name not set") + } + + if bc.Config().AstriaSequencerInitialHeight == 0 { + return nil, errors.New("sequencer initial height not set") + } + + if bc.Config().AstriaCelestiaInitialHeight == 0 { + return nil, errors.New("celestia initial height not set") + } + + if bc.Config().AstriaCelestiaHeightVariance == 0 { + return nil, errors.New("celestia height variance not set") + } + if merger := eth.Merger(); !merger.PoSFinalized() { merger.FinalizePoS() } @@ -75,7 +92,7 @@ func NewExecutionServiceServerV1Alpha2(eth *eth.Ethereum) *ExecutionServiceServe return &ExecutionServiceServerV1Alpha2{ eth: eth, bc: bc, - } + }, nil } func (s *ExecutionServiceServerV1Alpha2) GetGenesisInfo(ctx context.Context, req *astriaPb.GetGenesisInfoRequest) (*astriaPb.GenesisInfo, error) {