Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

exit node if genesis astria fields are unset #46

Merged
merged 1 commit into from
Apr 2, 2024
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
5 changes: 4 additions & 1 deletion cmd/geth/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down
21 changes: 19 additions & 2 deletions grpc/execution/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ package execution
import (
"context"
"crypto/sha256"
"errors"
"fmt"
"sync"
"time"
Expand Down Expand Up @@ -65,17 +66,33 @@ 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()
}

return &ExecutionServiceServerV1Alpha2{
eth: eth,
bc: bc,
}
}, nil
}

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