Skip to content
This repository has been archived by the owner on May 11, 2024. It is now read-only.

Commit

Permalink
feat(prover): introduce three raiko related flags (#711)
Browse files Browse the repository at this point in the history
  • Loading branch information
davidtaikocha committed Apr 11, 2024
1 parent dbcfd07 commit fce4f60
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 3 deletions.
18 changes: 18 additions & 0 deletions cmd/flags/prover.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,21 @@ var (
Usage: "RPC endpoint of a Raiko host service",
Category: proverCategory,
}
RaikoL1Endpoint = &cli.StringFlag{
Name: "raiko.l1Endpoint",
Usage: "L1 RPC endpoint which will be sent to the Raiko service",
Category: proverCategory,
}
RaikoL1BeaconEndpoint = &cli.StringFlag{
Name: "raiko.l1BeaconEndpoint",
Usage: "L1 beacon RPC endpoint which will be sent to the Raiko service",
Category: proverCategory,
}
RaikoL2Endpoint = &cli.StringFlag{
Name: "raiko.l2Endpoint",
Usage: "L2 RPC endpoint which will be sent to the Raiko service",
Category: proverCategory,
}
StartingBlockID = &cli.Uint64Flag{
Name: "prover.startingBlockID",
Usage: "If set, prover will start proving blocks from the block with this ID",
Expand Down Expand Up @@ -177,6 +192,9 @@ var ProverFlags = MergeFlags(CommonFlags, []cli.Flag{
L2WSEndpoint,
L2HTTPEndpoint,
RaikoHostEndpoint,
RaikoL1Endpoint,
RaikoL1BeaconEndpoint,
RaikoL2Endpoint,
L1ProverPrivKey,
MinOptimisticTierFee,
MinSgxTierFee,
Expand Down
21 changes: 21 additions & 0 deletions prover/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ type Config struct {
Allowance *big.Int
GuardianProverHealthCheckServerEndpoint *url.URL
RaikoHostEndpoint string
RaikoL1Endpoint string
RaikoL1BeaconEndpoint string
RaikoL2Endpoint string
L1NodeVersion string
L2NodeVersion string
BlockConfirmations uint64
Expand Down Expand Up @@ -118,6 +121,21 @@ func NewConfigFromCliContext(c *cli.Context) (*Config, error) {
return nil, fmt.Errorf("raiko host not provided")
}

var (
raikoL1Endpoint = c.String(flags.RaikoL1Endpoint.Name)
raikoL1BeaconEndpoint = c.String(flags.RaikoL1BeaconEndpoint.Name)
raikoL2Endpoint = c.String(flags.RaikoL2Endpoint.Name)
)
if raikoL1Endpoint == "" {
raikoL1Endpoint = c.String(flags.L1HTTPEndpoint.Name)
}
if raikoL1BeaconEndpoint == "" {
raikoL1BeaconEndpoint = c.String(flags.L1BeaconEndpoint.Name)
}
if raikoL2Endpoint == "" {
raikoL2Endpoint = c.String(flags.L2HTTPEndpoint.Name)
}

return &Config{
L1WsEndpoint: c.String(flags.L1WSEndpoint.Name),
L1HttpEndpoint: c.String(flags.L1HTTPEndpoint.Name),
Expand All @@ -130,6 +148,9 @@ func NewConfigFromCliContext(c *cli.Context) (*Config, error) {
AssignmentHookAddress: common.HexToAddress(c.String(flags.ProverAssignmentHookAddress.Name)),
L1ProverPrivKey: l1ProverPrivKey,
RaikoHostEndpoint: c.String(flags.RaikoHostEndpoint.Name),
RaikoL1Endpoint: raikoL1Endpoint,
RaikoL1BeaconEndpoint: raikoL1BeaconEndpoint,
RaikoL2Endpoint: raikoL2Endpoint,
StartingBlockID: startingBlockID,
Dummy: c.Bool(flags.Dummy.Name),
GuardianProverAddress: common.HexToAddress(c.String(flags.GuardianProver.Name)),
Expand Down
6 changes: 3 additions & 3 deletions prover/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,9 @@ func (p *Prover) initProofSubmitters(
case encoding.TierSgxID:
producer = &proofProducer.SGXProofProducer{
RaikoHostEndpoint: p.cfg.RaikoHostEndpoint,
L1Endpoint: p.cfg.L1HttpEndpoint,
L1BeaconEndpoint: p.cfg.L1BeaconEndpoint,
L2Endpoint: p.cfg.L2HttpEndpoint,
L1Endpoint: p.cfg.RaikoL1Endpoint,
L1BeaconEndpoint: p.cfg.RaikoL1BeaconEndpoint,
L2Endpoint: p.cfg.RaikoL2Endpoint,
Dummy: p.cfg.Dummy,
}
case encoding.TierGuardianID:
Expand Down

0 comments on commit fce4f60

Please sign in to comment.