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

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
RogerLamTd committed Sep 26, 2023
1 parent 834c0ea commit 0b759c2
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 11 deletions.
7 changes: 6 additions & 1 deletion driver/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ func (s *DriverTestSuite) TestNewConfigFromCliContext() {
s.Equal(rpcTimeout, *c.RPCTimeout)
s.NotEmpty(c.JwtSecret)
s.Nil(new(Driver).InitFromCli(context.Background(), ctx))
s.True(c.P2PSyncVerifiedBlocks)
s.Equal("http://localhost:8545", c.L2CheckPoint)

return err
}
Expand All @@ -47,6 +49,8 @@ func (s *DriverTestSuite) TestNewConfigFromCliContext() {
"-" + flags.JWTSecret.Name, os.Getenv("JWT_SECRET"),
"-" + flags.P2PSyncTimeout.Name, "120",
"-" + flags.RPCTimeout.Name, "5",
"--" + flags.P2PSyncVerifiedBlocks.Name,
"-" + flags.CheckPointSyncUrl.Name, "http://localhost:8545",
}))
}

Expand All @@ -63,7 +67,7 @@ func (s *DriverTestSuite) TestNewConfigFromCliContextEmptyL2CheckPoint() {
s.ErrorContains(app.Run([]string{
"TestNewConfigFromCliContext",
"-" + flags.JWTSecret.Name, os.Getenv("JWT_SECRET"),
"-" + flags.P2PSyncVerifiedBlocks.Name, "true",
"--" + flags.P2PSyncVerifiedBlocks.Name,
"-" + flags.L2WSEndpoint.Name, "",
}), "empty L2 check point URL")
}
Expand All @@ -80,6 +84,7 @@ func (s *DriverTestSuite) SetupApp() *cli.App {
&cli.BoolFlag{Name: flags.P2PSyncVerifiedBlocks.Name},
&cli.UintFlag{Name: flags.P2PSyncTimeout.Name},
&cli.UintFlag{Name: flags.RPCTimeout.Name},
&cli.StringFlag{Name: flags.CheckPointSyncUrl.Name},
}
app.Action = func(ctx *cli.Context) error {
_, err := NewConfigFromCliContext(ctx)
Expand Down
21 changes: 11 additions & 10 deletions prover/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ func (s *ProverTestSuite) TestNewConfigFromCliContext_OracleProver() {
s.Equal(uint64(8), c.Capacity)
s.Equal(minProofFee, c.MinProofFee.String())
s.Nil(new(Prover).InitFromCli(context.Background(), ctx))
s.True(c.ProveUnassignedBlocks)

return err
}
Expand All @@ -67,15 +68,15 @@ func (s *ProverTestSuite) TestNewConfigFromCliContext_OracleProver() {
"-" + flags.StartingBlockID.Name, "0",
"-" + flags.RPCTimeout.Name, "5",
"-" + flags.ProveBlockTxGasLimit.Name, "100000",
"-" + flags.Dummy.Name,
"--" + flags.Dummy.Name,
"-" + flags.RandomDummyProofDelay.Name, "30m-1h",
"-" + flags.MinProofFee.Name, minProofFee,
"-" + flags.ProverCapacity.Name, "8",
"-" + flags.OracleProver.Name,
"--" + flags.OracleProver.Name,
"-" + flags.OracleProverPrivateKey.Name, os.Getenv("L1_PROVER_PRIVATE_KEY"),
"-" + flags.Graffiti.Name, "",
"-" + flags.CheckProofWindowExpiredInterval.Name, "30",
"-" + flags.ProveUnassignedBlocks.Name, "true",
"--" + flags.ProveUnassignedBlocks.Name,
}))
}

Expand All @@ -91,9 +92,9 @@ func (s *ProverTestSuite) TestNewConfigFromCliContext_OracleProverError() {
"-" + flags.TaikoL1Address.Name, taikoL1,
"-" + flags.TaikoL2Address.Name, taikoL2,
"-" + flags.L1ProverPrivKey.Name, os.Getenv("L1_PROVER_PRIVATE_KEY"),
"-" + flags.Dummy.Name,
"--" + flags.Dummy.Name,
"-" + flags.RandomDummyProofDelay.Name, "30m-1h",
"-" + flags.OracleProver.Name,
"--" + flags.OracleProver.Name,
"-" + flags.Graffiti.Name, "",
"-" + flags.RPCTimeout.Name, "5",
"-" + flags.MinProofFee.Name, minProofFee,
Expand All @@ -115,7 +116,7 @@ func (s *ProverTestSuite) TestNewConfigFromCliContext_OracleProverKeyError() {
s.ErrorContains(app.Run([]string{
"TestNewConfigFromCliContext",
"-" + flags.L1ProverPrivKey.Name, os.Getenv("L1_PROVER_PRIVATE_KEY"),
"-" + flags.OracleProver.Name,
"--" + flags.OracleProver.Name,
"-" + flags.OracleProverPrivateKey.Name, "",
}), "invalid oracle private key")
}
Expand All @@ -127,7 +128,7 @@ func (s *ProverTestSuite) TestNewConfigFromCliContext_RandomDelayError() {
"TestNewConfigFromCliContext",
"-" + flags.L1ProverPrivKey.Name, os.Getenv("L1_PROVER_PRIVATE_KEY"),
"-" + flags.OracleProverPrivateKey.Name, os.Getenv("L1_PROVER_PRIVATE_KEY"),
"-" + flags.OracleProver.Name,
"--" + flags.OracleProver.Name,
"-" + flags.RandomDummyProofDelay.Name, "130m",
"-" + flags.MinProofFee.Name, minProofFee,
}), "invalid random dummy proof delay value")
Expand All @@ -140,7 +141,7 @@ func (s *ProverTestSuite) TestNewConfigFromCliContext_RandomDelayErrorLower() {
"TestNewConfigFromCliContext",
"-" + flags.L1ProverPrivKey.Name, os.Getenv("L1_PROVER_PRIVATE_KEY"),
"-" + flags.OracleProverPrivateKey.Name, os.Getenv("L1_PROVER_PRIVATE_KEY"),
"-" + flags.OracleProver.Name,
"--" + flags.OracleProver.Name,
"-" + flags.RandomDummyProofDelay.Name, "30x-1h",
"-" + flags.MinProofFee.Name, minProofFee,
}), "invalid random dummy proof delay value")
Expand All @@ -153,7 +154,7 @@ func (s *ProverTestSuite) TestNewConfigFromCliContext_RandomDelayErrorUpper() {
"TestNewConfigFromCliContext",
"-" + flags.L1ProverPrivKey.Name, os.Getenv("L1_PROVER_PRIVATE_KEY"),
"-" + flags.OracleProverPrivateKey.Name, os.Getenv("L1_PROVER_PRIVATE_KEY"),
"-" + flags.OracleProver.Name,
"--" + flags.OracleProver.Name,
"-" + flags.RandomDummyProofDelay.Name, "30m-1x",
"-" + flags.MinProofFee.Name, minProofFee,
}), "invalid random dummy proof delay value")
Expand All @@ -166,7 +167,7 @@ func (s *ProverTestSuite) TestNewConfigFromCliContext_RandomDelayErrorOrder() {
"TestNewConfigFromCliContext",
"-" + flags.L1ProverPrivKey.Name, os.Getenv("L1_PROVER_PRIVATE_KEY"),
"-" + flags.OracleProverPrivateKey.Name, os.Getenv("L1_PROVER_PRIVATE_KEY"),
"-" + flags.OracleProver.Name,
"--" + flags.OracleProver.Name,
"-" + flags.RandomDummyProofDelay.Name, "1h-30m",
"-" + flags.MinProofFee.Name, minProofFee,
}), "invalid random dummy proof delay value (lower > upper)")
Expand Down

0 comments on commit 0b759c2

Please sign in to comment.