Skip to content

Commit d05e3b2

Browse files
authored
Merge pull request #46 from astriaorg/noot/startup-checks
exit node if genesis astria fields are unset
2 parents a04a97d + 21e9946 commit d05e3b2

File tree

2 files changed

+23
-3
lines changed

2 files changed

+23
-3
lines changed

cmd/geth/config.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,10 @@ func makeFullNode(ctx *cli.Context) (*node.Node, ethapi.Backend) {
205205

206206
// Configure gRPC if requested.
207207
if ctx.IsSet(utils.GRPCEnabledFlag.Name) {
208-
serviceV1a2 := execution.NewExecutionServiceServerV1Alpha2(eth)
208+
serviceV1a2, err := execution.NewExecutionServiceServerV1Alpha2(eth)
209+
if err != nil {
210+
utils.Fatalf("failed to create execution service: %v", err)
211+
}
209212
utils.RegisterGRPCExecutionService(stack, serviceV1a2, &cfg.Node)
210213
}
211214

grpc/execution/server.go

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ package execution
77
import (
88
"context"
99
"crypto/sha256"
10+
"errors"
1011
"fmt"
1112
"math/big"
1213
"sync"
@@ -67,17 +68,33 @@ var (
6768
commitmentStateUpdateTimer = metrics.GetOrRegisterTimer("astria/execution/commitment", nil)
6869
)
6970

70-
func NewExecutionServiceServerV1Alpha2(eth *eth.Ethereum) *ExecutionServiceServerV1Alpha2 {
71+
func NewExecutionServiceServerV1Alpha2(eth *eth.Ethereum) (*ExecutionServiceServerV1Alpha2, error) {
7172
bc := eth.BlockChain()
7273

74+
if bc.Config().AstriaRollupName == "" {
75+
return nil, errors.New("rollup name not set")
76+
}
77+
78+
if bc.Config().AstriaSequencerInitialHeight == 0 {
79+
return nil, errors.New("sequencer initial height not set")
80+
}
81+
82+
if bc.Config().AstriaCelestiaInitialHeight == 0 {
83+
return nil, errors.New("celestia initial height not set")
84+
}
85+
86+
if bc.Config().AstriaCelestiaHeightVariance == 0 {
87+
return nil, errors.New("celestia height variance not set")
88+
}
89+
7390
if merger := eth.Merger(); !merger.PoSFinalized() {
7491
merger.FinalizePoS()
7592
}
7693

7794
return &ExecutionServiceServerV1Alpha2{
7895
eth: eth,
7996
bc: bc,
80-
}
97+
}, nil
8198
}
8299

83100
func (s *ExecutionServiceServerV1Alpha2) GetGenesisInfo(ctx context.Context, req *astriaPb.GetGenesisInfoRequest) (*astriaPb.GenesisInfo, error) {

0 commit comments

Comments
 (0)