Skip to content

Commit

Permalink
Merge branch 'main' into revert-zk-coverage-docs
Browse files Browse the repository at this point in the history
  • Loading branch information
davidtaikocha authored Jan 1, 2025
2 parents 1911219 + 63f9d26 commit 982e98b
Show file tree
Hide file tree
Showing 12 changed files with 37 additions and 177 deletions.
2 changes: 1 addition & 1 deletion packages/taiko-client/cmd/flags/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ var (
Category: driverCategory,
EnvVars: []string{"P2P_CHECK_POINT_SYNC_URL"},
}
// syncer specific flag
// Chain syncer specific flag
MaxExponent = &cli.Uint64Flag{
Name: "syncer.maxExponent",
Usage: "Maximum exponent of retrieving L1 blocks when there is a mismatch between protocol and L2 EE," +
Expand Down
8 changes: 0 additions & 8 deletions packages/taiko-client/cmd/flags/proposer.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,13 +98,6 @@ var (
Category: proposerCategory,
EnvVars: []string{"TX_POOL_MAX_TX_LISTS_PER_EPOCH"},
}
ProposeBlockIncludeParentMetaHash = &cli.BoolFlag{
Name: "includeParentMetaHash",
Usage: "Include parent meta hash when proposing block",
Value: false,
Category: proposerCategory,
EnvVars: []string{"INCLUDE_PARENT_META_HASH"},
}
// Transaction related.
BlobAllowed = &cli.BoolFlag{
Name: "l1.blobAllowed",
Expand Down Expand Up @@ -139,7 +132,6 @@ var ProposerFlags = MergeFlags(CommonFlags, []cli.Flag{
MinProposingInternal,
AllowZeroInterval,
MaxProposedTxListsPerEpoch,
ProposeBlockIncludeParentMetaHash,
BlobAllowed,
RevertProtectionEnabled,
}, TxmgrFlags)
41 changes: 0 additions & 41 deletions packages/taiko-client/cmd/flags/prover.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,6 @@ var (
Category: proverCategory,
EnvVars: []string{"L1_PROVER_PRIV_KEY"},
}
ProverCapacity = &cli.Uint64Flag{
Name: "prover.capacity",
Usage: "Capacity of prover",
Required: true,
Category: proverCategory,
EnvVars: []string{"PROVER_CAPACITY"},
}
)

// Optional flags used by prover.
Expand Down Expand Up @@ -74,20 +67,6 @@ var (
Value: false,
EnvVars: []string{"PROVER_PROVE_UNASSIGNED_BLOCKS"},
}
MinEthBalance = &cli.Float64Flag{
Name: "prover.minEthBalance",
Usage: "Minimum ETH balance (in Ether) a prover wants to keep",
Category: proverCategory,
Value: 0,
EnvVars: []string{"PROVER_MIN_ETH_BALANCE"},
}
MinTaikoTokenBalance = &cli.Float64Flag{
Name: "prover.minTaikoTokenBalance",
Usage: "Minimum Taiko token balance without decimal a prover wants to keep",
Category: proverCategory,
Value: 0,
EnvVars: []string{"PROVER_MIN_TAIKO_TOKEN_BALANCE"},
}
// Running mode
ContesterMode = &cli.BoolFlag{
Name: "mode.contester",
Expand Down Expand Up @@ -119,22 +98,7 @@ var (
Category: proverCategory,
EnvVars: []string{"PROVER_DUMMY"},
}
// Max slippage allowed
MaxAcceptableBlockSlippage = &cli.Uint64Flag{
Name: "prover.blockSlippage",
Usage: "Maximum accepted slippage difference for blockID for accepting proving a block",
Value: 1024,
Category: proverCategory,
EnvVars: []string{"PROVER_BLOCK_SLIPPAGE"},
}
// Max amount of L1 blocks that can pass before block is invalid
MaxProposedIn = &cli.Uint64Flag{
Name: "prover.maxProposedIn",
Usage: "Maximum amount of L1 blocks that can pass before block can not be proposed. 0 means no limit.",
Value: 0,
Category: proverCategory,
EnvVars: []string{"PROVER_MAX_PROPOSED_IN"},
}
Allowance = &cli.Float64Flag{
Name: "prover.allowance",
Usage: "Amount without decimal to approve TaikoL1 contract for TaikoToken usage",
Expand Down Expand Up @@ -229,8 +193,6 @@ var ProverFlags = MergeFlags(CommonFlags, []cli.Flag{
RaikoHostEndpoint,
RaikoJWTPath,
L1ProverPrivKey,
MinEthBalance,
MinTaikoTokenBalance,
StartingBlockID,
Dummy,
GuardianProverMinority,
Expand All @@ -241,11 +203,8 @@ var ProverFlags = MergeFlags(CommonFlags, []cli.Flag{
ProveUnassignedBlocks,
ContesterMode,
ProverHTTPServerPort,
ProverCapacity,
MaxExpiry,
MaxProposedIn,
TaikoTokenAddress,
MaxAcceptableBlockSlippage,
Allowance,
L1NodeVersion,
L2NodeVersion,
Expand Down
2 changes: 0 additions & 2 deletions packages/taiko-client/proposer/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ type Config struct {
AllowZeroInterval uint64
MaxProposedTxListsPerEpoch uint64
ProposeBlockTxGasLimit uint64
IncludeParentMetaHash bool
BlobAllowed bool
RevertProtectionEnabled bool
TxmgrConfigs *txmgr.CLIConfig
Expand Down Expand Up @@ -104,7 +103,6 @@ func NewConfigFromCliContext(c *cli.Context) (*Config, error) {
MaxProposedTxListsPerEpoch: maxProposedTxListsPerEpoch,
AllowZeroInterval: c.Uint64(flags.AllowZeroInterval.Name),
ProposeBlockTxGasLimit: c.Uint64(flags.TxGasLimit.Name),
IncludeParentMetaHash: c.Bool(flags.ProposeBlockIncludeParentMetaHash.Name),
BlobAllowed: c.Bool(flags.BlobAllowed.Name),
RevertProtectionEnabled: c.Bool(flags.RevertProtectionEnabled.Name),
TxmgrConfigs: pkgFlags.InitTxmgrConfigsFromCli(
Expand Down
3 changes: 0 additions & 3 deletions packages/taiko-client/proposer/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ func (s *ProposerTestSuite) TestNewConfigFromCliContext() {
s.Equal(1, len(c.LocalAddresses))
s.Equal(goldenTouchAddress, c.LocalAddresses[0])
s.Equal(5*time.Second, c.Timeout)
s.Equal(true, c.IncludeParentMetaHash)

s.Nil(new(Proposer).InitFromCli(context.Background(), cliCtx))
return nil
Expand All @@ -62,7 +61,6 @@ func (s *ProposerTestSuite) TestNewConfigFromCliContext() {
"--" + flags.TxPoolLocals.Name, goldenTouchAddress.Hex(),
"--" + flags.RPCTimeout.Name, rpcTimeout,
"--" + flags.TxGasLimit.Name, "100000",
"--" + flags.ProposeBlockIncludeParentMetaHash.Name, "true",
}))
}

Expand Down Expand Up @@ -117,7 +115,6 @@ func (s *ProposerTestSuite) SetupApp() *cli.App {
&cli.DurationFlag{Name: flags.ProposeInterval.Name},
&cli.StringFlag{Name: flags.TxPoolLocals.Name},
&cli.DurationFlag{Name: flags.RPCTimeout.Name},
&cli.BoolFlag{Name: flags.ProposeBlockIncludeParentMetaHash.Name},
}
app.Flags = append(app.Flags, flags.TxmgrFlags...)
app.Action = func(ctx *cli.Context) error {
Expand Down
19 changes: 0 additions & 19 deletions packages/taiko-client/prover/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,8 @@ type Config struct {
RPCTimeout time.Duration
ProveBlockGasLimit uint64
HTTPServerPort uint64
Capacity uint64
MinEthBalance *big.Int
MinTaikoTokenBalance *big.Int
MaxExpiry time.Duration
MaxProposedIn uint64
MaxBlockSlippage uint64
Allowance *big.Int
GuardianProverHealthCheckServerEndpoint *url.URL
RaikoHostEndpoint string
Expand Down Expand Up @@ -117,16 +113,6 @@ func NewConfigFromCliContext(c *cli.Context) (*Config, error) {
}
}

minEthBalance, err := utils.EtherToWei(c.Float64(flags.MinEthBalance.Name))
if err != nil {
return nil, err
}

minTaikoTokenBalance, err := utils.EtherToWei(c.Float64(flags.MinTaikoTokenBalance.Name))
if err != nil {
return nil, err
}

if !c.IsSet(flags.GuardianProverMajority.Name) && !c.IsSet(flags.RaikoHostEndpoint.Name) {
return nil, errors.New("empty raiko host endpoint")
}
Expand Down Expand Up @@ -165,13 +151,8 @@ func NewConfigFromCliContext(c *cli.Context) (*Config, error) {
EnableLivenessBondProof: c.Bool(flags.EnableLivenessBondProof.Name),
RPCTimeout: c.Duration(flags.RPCTimeout.Name),
ProveBlockGasLimit: c.Uint64(flags.TxGasLimit.Name),
Capacity: c.Uint64(flags.ProverCapacity.Name),
HTTPServerPort: c.Uint64(flags.ProverHTTPServerPort.Name),
MinEthBalance: minEthBalance,
MinTaikoTokenBalance: minTaikoTokenBalance,
MaxExpiry: c.Duration(flags.MaxExpiry.Name),
MaxBlockSlippage: c.Uint64(flags.MaxAcceptableBlockSlippage.Name),
MaxProposedIn: c.Uint64(flags.MaxProposedIn.Name),
Allowance: allowance,
L1NodeVersion: c.String(flags.L1NodeVersion.Name),
L2NodeVersion: c.String(flags.L2NodeVersion.Name),
Expand Down
6 changes: 0 additions & 6 deletions packages/taiko-client/prover/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,10 @@ func (s *ProverTestSuite) TestNewConfigFromCliContextGuardianProver() {
s.True(c.ProveUnassignedBlocks)
s.True(c.ContesterMode)
s.Equal(rpcTimeout, c.RPCTimeout)
s.Equal(uint64(8), c.Capacity)
s.Equal(c.L1NodeVersion, l1NodeVersion)
s.Equal(c.L2NodeVersion, l2NodeVersion)
s.Nil(new(Prover).InitFromCli(context.Background(), ctx))
s.True(c.ProveUnassignedBlocks)
s.Equal(uint64(100), c.MaxProposedIn)
allowanceWithDecimal, err := utils.EtherToWei(allowance)
s.Nil(err)
s.Equal(allowanceWithDecimal.Uint64(), c.Allowance.Uint64())
Expand All @@ -69,12 +67,10 @@ func (s *ProverTestSuite) TestNewConfigFromCliContextGuardianProver() {
"--" + flags.RPCTimeout.Name, "5s",
"--" + flags.TxGasLimit.Name, "100000",
"--" + flags.Dummy.Name,
"--" + flags.ProverCapacity.Name, "8",
"--" + flags.GuardianProverMajority.Name, os.Getenv("GUARDIAN_PROVER_CONTRACT"),
"--" + flags.GuardianProverMinority.Name, os.Getenv("GUARDIAN_PROVER_MINORITY"),
"--" + flags.Graffiti.Name, "",
"--" + flags.ProveUnassignedBlocks.Name,
"--" + flags.MaxProposedIn.Name, "100",
"--" + flags.Allowance.Name, fmt.Sprint(allowance),
"--" + flags.L1NodeVersion.Name, l1NodeVersion,
"--" + flags.L2NodeVersion.Name, l2NodeVersion,
Expand Down Expand Up @@ -107,8 +103,6 @@ func (s *ProverTestSuite) SetupApp() *cli.App {
&cli.StringFlag{Name: flags.Graffiti.Name},
&cli.BoolFlag{Name: flags.ProveUnassignedBlocks.Name},
&cli.DurationFlag{Name: flags.RPCTimeout.Name},
&cli.Uint64Flag{Name: flags.ProverCapacity.Name},
&cli.Uint64Flag{Name: flags.MaxProposedIn.Name},
&cli.StringFlag{Name: flags.Allowance.Name},
&cli.StringFlag{Name: flags.ContesterMode.Name},
&cli.StringFlag{Name: flags.L1NodeVersion.Name},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,12 +123,7 @@ func (s *ProofSubmitter) RequestProof(ctx context.Context, meta metadata.TaikoBl
return fmt.Errorf("failed to get the L2 parent block by hash (%s): %w", header.ParentHash, err)
}

if meta.IsOntakeBlock() {
blockInfo, err = s.rpc.GetL2BlockInfoV2(ctx, meta.GetBlockID())
} else {
blockInfo, err = s.rpc.GetL2BlockInfo(ctx, meta.GetBlockID())
}
if err != nil {
if blockInfo, err = s.rpc.GetL2BlockInfoV2(ctx, meta.GetBlockID()); err != nil {
return err
}

Expand Down Expand Up @@ -206,7 +201,7 @@ func (s *ProofSubmitter) RequestProof(ctx context.Context, meta metadata.TaikoBl
}
return fmt.Errorf("failed to request proof (id: %d): %w", meta.GetBlockID(), err)
}
if meta.IsOntakeBlock() && s.proofBuffer.Enabled() {
if s.proofBuffer.Enabled() {
bufferSize, err := s.proofBuffer.Write(result)
if err != nil {
return fmt.Errorf(
Expand Down
73 changes: 24 additions & 49 deletions packages/taiko-client/prover/proof_submitter/transaction/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,40 +80,26 @@ func (a *ProveBlockTxBuilder) Build(
return nil, err
}

if meta.IsOntakeBlock() {
if a.proverSetAddress != ZeroAddress {
if data, err = encoding.ProverSetABI.Pack(
"proveBlocks",
[]uint64{blockID.Uint64()},
[][]byte{input},
[]byte{},
); err != nil {
return nil, err
}
to = a.proverSetAddress
} else {
if data, err = encoding.TaikoL1ABI.Pack(
"proveBlocks",
[]uint64{blockID.Uint64()},
[][]byte{input},
[]byte{},
); err != nil {
return nil, err
}
to = a.taikoL1Address
if a.proverSetAddress != ZeroAddress {
if data, err = encoding.ProverSetABI.Pack(
"proveBlocks",
[]uint64{blockID.Uint64()},
[][]byte{input},
[]byte{},
); err != nil {
return nil, err
}
to = a.proverSetAddress
} else {
if a.proverSetAddress != ZeroAddress {
if data, err = encoding.ProverSetABI.Pack("proveBlock", blockID.Uint64(), input); err != nil {
return nil, err
}
to = a.proverSetAddress
} else {
if data, err = encoding.TaikoL1ABI.Pack("proveBlock", blockID.Uint64(), input); err != nil {
return nil, err
}
to = a.taikoL1Address
if data, err = encoding.TaikoL1ABI.Pack(
"proveBlocks",
[]uint64{blockID.Uint64()},
[][]byte{input},
[]byte{},
); err != nil {
return nil, err
}
to = a.taikoL1Address
}
} else {
if tier > encoding.TierGuardianMinorityID {
Expand All @@ -124,24 +110,13 @@ func (a *ProveBlockTxBuilder) Build(
return nil, fmt.Errorf("tier %d need set guardianProverMinorityAddress", tier)
}

if meta.IsOntakeBlock() {
if data, err = encoding.GuardianProverABI.Pack(
"approveV2",
meta.(*metadata.TaikoDataBlockMetadataOntake).InnerMetadata(),
*transition,
*tierProof,
); err != nil {
return nil, err
}
} else {
if data, err = encoding.GuardianProverABI.Pack(
"approve",
meta.(*metadata.TaikoDataBlockMetadataLegacy).InnerMetadata(),
*transition,
*tierProof,
); err != nil {
return nil, err
}
if data, err = encoding.GuardianProverABI.Pack(
"approveV2",
meta.(*metadata.TaikoDataBlockMetadataOntake).InnerMetadata(),
*transition,
*tierProof,
); err != nil {
return nil, err
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,14 @@ import (
func (s *TransactionTestSuite) TestBuildTxs() {
_, err := s.builder.Build(
common.Big256,
&metadata.TaikoDataBlockMetadataLegacy{},
&metadata.TaikoDataBlockMetadataOntake{TaikoDataBlockMetadataV2: bindings.TaikoDataBlockMetadataV2{
AnchorBlockHash: [32]byte{},
Difficulty: [32]byte{},
BlobHash: [32]byte{},
ExtraData: [32]byte{},
ParentMetaHash: [32]byte{},
LivenessBond: common.Big0,
}},
&bindings.TaikoDataTransition{},
&bindings.TaikoDataTierProof{},
1,
Expand Down
Loading

0 comments on commit 982e98b

Please sign in to comment.