Skip to content

Commit

Permalink
feat(taiko-client): add --epoch.minTip flag (#17726)
Browse files Browse the repository at this point in the history
  • Loading branch information
davidtaikocha authored Jul 3, 2024
1 parent e301451 commit a331e9d
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 4 deletions.
8 changes: 8 additions & 0 deletions packages/taiko-client/cmd/flags/proposer.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,13 @@ var (
Value: 0,
EnvVars: []string{"EPOCH_MIN_TX_LIST_BYTES"},
}
MinTip = &cli.Uint64Flag{
Name: "epoch.minTip",
Usage: "Minimum tip for a transaction to propose",
Category: proposerCategory,
Value: 0,
EnvVars: []string{"EPOCH_MIN_TIP"},
}
MinProposingInternal = &cli.DurationFlag{
Name: "epoch.minProposingInterval",
Usage: "Minimum time interval to force proposing a block, even if there are no transaction in mempool",
Expand Down Expand Up @@ -155,6 +162,7 @@ var ProposerFlags = MergeFlags(CommonFlags, []cli.Flag{
ExtraData,
MinGasUsed,
MinTxListBytes,
MinTip,
MinProposingInternal,
MaxProposedTxListsPerEpoch,
ProverEndpoints,
Expand Down
8 changes: 5 additions & 3 deletions packages/taiko-client/pkg/rpc/engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,15 +99,16 @@ func (c *EngineClient) ExchangeTransitionConfiguration(
return result, nil
}

// TxPoolContent fetches the transaction pool content from the L2 execution engine.
func (c *EngineClient) TxPoolContent(
// TxPoolContentWithMinTip fetches the transaction pool content from the L2 execution engine.
func (c *EngineClient) TxPoolContentWithMinTip(
ctx context.Context,
beneficiary common.Address,
baseFee *big.Int,
blockMaxGasLimit uint64,
maxBytesPerTxList uint64,
locals []string,
maxTransactionsLists uint64,
minTip uint64,
) ([]*miner.PreBuiltTxList, error) {
timeoutCtx, cancel := context.WithTimeout(ctx, defaultTimeout)
defer cancel()
Expand All @@ -116,13 +117,14 @@ func (c *EngineClient) TxPoolContent(
if err := c.CallContext(
timeoutCtx,
&result,
"taikoAuth_txPoolContent",
"taikoAuth_txPoolContentWithMinTip",
beneficiary,
baseFee,
blockMaxGasLimit,
maxBytesPerTxList,
locals,
maxTransactionsLists,
minTip,
); err != nil {
return nil, err
}
Expand Down
4 changes: 3 additions & 1 deletion packages/taiko-client/pkg/rpc/methods.go
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,7 @@ func (c *Client) GetPoolContent(
maxBytesPerTxList uint64,
locals []common.Address,
maxTransactionsLists uint64,
minTip uint64,
) ([]*miner.PreBuiltTxList, error) {
ctxWithTimeout, cancel := CtxWithTimeoutOrDefault(ctx, defaultTimeout)
defer cancel()
Expand Down Expand Up @@ -285,14 +286,15 @@ func (c *Client) GetPoolContent(
localsArg = append(localsArg, local.Hex())
}

return c.L2Engine.TxPoolContent(
return c.L2Engine.TxPoolContentWithMinTip(
ctxWithTimeout,
beneficiary,
baseFeeInfo.Basefee,
uint64(blockMaxGasLimit),
maxBytesPerTxList,
localsArg,
maxTransactionsLists,
minTip,
)
}

Expand Down
2 changes: 2 additions & 0 deletions packages/taiko-client/proposer/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ type Config struct {
LocalAddressesOnly bool
MinGasUsed uint64
MinTxListBytes uint64
MinTip uint64
MinProposingInternal time.Duration
MaxProposedTxListsPerEpoch uint64
ProposeBlockTxGasLimit uint64
Expand Down Expand Up @@ -113,6 +114,7 @@ func NewConfigFromCliContext(c *cli.Context) (*Config, error) {
LocalAddressesOnly: c.Bool(flags.TxPoolLocalsOnly.Name),
MinGasUsed: c.Uint64(flags.MinGasUsed.Name),
MinTxListBytes: c.Uint64(flags.MinTxListBytes.Name),
MinTip: c.Uint64(flags.MinTip.Name),
MinProposingInternal: c.Duration(flags.MinProposingInternal.Name),
MaxProposedTxListsPerEpoch: c.Uint64(flags.MaxProposedTxListsPerEpoch.Name),
ProposeBlockTxGasLimit: c.Uint64(flags.TxGasLimit.Name),
Expand Down
1 change: 1 addition & 0 deletions packages/taiko-client/proposer/proposer.go
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ func (p *Proposer) fetchPoolContent(filterPoolContent bool) ([]types.Transaction
rpc.BlockMaxTxListBytes,
p.LocalAddresses,
p.MaxProposedTxListsPerEpoch,
p.MinTip,
)
if err != nil {
return nil, fmt.Errorf("failed to fetch transaction pool content: %w", err)
Expand Down
1 change: 1 addition & 0 deletions packages/taiko-client/proposer/proposer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ func (s *ProposerTestSuite) TestProposeOpNoEmptyBlock() {
rpc.BlockMaxTxListBytes,
p.LocalAddresses,
p.MaxProposedTxListsPerEpoch,
0,
)
time.Sleep(time.Second)
}
Expand Down

0 comments on commit a331e9d

Please sign in to comment.