diff --git a/packages/taiko-client/cmd/flags/proposer.go b/packages/taiko-client/cmd/flags/proposer.go index fccd2267db..eb3fbf0e27 100644 --- a/packages/taiko-client/cmd/flags/proposer.go +++ b/packages/taiko-client/cmd/flags/proposer.go @@ -82,9 +82,9 @@ var ( Value: 0, EnvVars: []string{"EPOCH_MIN_TX_LIST_BYTES"}, } - MinTip = &cli.Uint64Flag{ + MinTip = &cli.Float64Flag{ Name: "epoch.minTip", - Usage: "Minimum tip for a transaction to propose", + Usage: "Minimum tip (in GWei) for a transaction to propose", Category: proposerCategory, Value: 0, EnvVars: []string{"EPOCH_MIN_TIP"}, @@ -96,6 +96,13 @@ var ( Value: 0, EnvVars: []string{"EPOCH_MIN_PROPOSING_INTERNAL"}, } + AllowZeroInterval = &cli.Uint64Flag{ + Name: "epoch.allowZeroInterval", + Usage: "If set, after this many epochs, proposer will allow propose zero tip transactions once", + Category: proposerCategory, + Value: 0, + EnvVars: []string{"EPOCH_ALLOW_ZERO_INTERVAL"}, + } // Proposing metadata related. ExtraData = &cli.StringFlag{ Name: "extraData", @@ -164,6 +171,7 @@ var ProposerFlags = MergeFlags(CommonFlags, []cli.Flag{ MinTxListBytes, MinTip, MinProposingInternal, + AllowZeroInterval, MaxProposedTxListsPerEpoch, ProverEndpoints, OptimisticTierFee, diff --git a/packages/taiko-client/proposer/config.go b/packages/taiko-client/proposer/config.go index 890fa98d79..623af43816 100644 --- a/packages/taiko-client/proposer/config.go +++ b/packages/taiko-client/proposer/config.go @@ -34,6 +34,7 @@ type Config struct { MinTxListBytes uint64 MinTip uint64 MinProposingInternal time.Duration + AllowZeroInterval uint64 MaxProposedTxListsPerEpoch uint64 ProposeBlockTxGasLimit uint64 ProverEndpoints []*url.URL @@ -94,6 +95,11 @@ func NewConfigFromCliContext(c *cli.Context) (*Config, error) { return nil, err } + minTip, err := utils.GWeiToWei(c.Float64(flags.MinTip.Name)) + if err != nil { + return nil, err + } + return &Config{ ClientConfig: &rpc.ClientConfig{ L1Endpoint: c.String(flags.L1WSEndpoint.Name), @@ -114,9 +120,10 @@ 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), + MinTip: minTip.Uint64(), MinProposingInternal: c.Duration(flags.MinProposingInternal.Name), MaxProposedTxListsPerEpoch: c.Uint64(flags.MaxProposedTxListsPerEpoch.Name), + AllowZeroInterval: c.Uint64(flags.AllowZeroInterval.Name), ProposeBlockTxGasLimit: c.Uint64(flags.TxGasLimit.Name), ProverEndpoints: proverEndpoints, OptimisticTierFee: optimisticTierFee, diff --git a/packages/taiko-client/proposer/proposer.go b/packages/taiko-client/proposer/proposer.go index 92ffc17b66..b60aa65679 100644 --- a/packages/taiko-client/proposer/proposer.go +++ b/packages/taiko-client/proposer/proposer.go @@ -53,6 +53,7 @@ type Proposer struct { protocolConfigs *bindings.TaikoDataConfig lastProposedAt time.Time + totalEpochs uint64 txmgr *txmgr.SimpleTxManager @@ -177,6 +178,7 @@ func (p *Proposer) eventLoop() { // proposing interval timer has been reached case <-p.proposingTimer.C: metrics.ProposerProposeEpochCounter.Add(1) + p.totalEpochs++ // Attempt a proposing operation if err := p.ProposeOp(p.ctx); err != nil { @@ -194,6 +196,13 @@ func (p *Proposer) Close(_ context.Context) { // fetchPoolContent fetches the transaction pool content from L2 execution engine. func (p *Proposer) fetchPoolContent(filterPoolContent bool) ([]types.Transactions, error) { + minTip := p.MinTip + // If `--epoch.allowZeroInterval` flag is set, allow proposing zero tip transactions once when + // the total epochs number is divisible by the flag value. + if p.AllowZeroInterval > 0 && p.totalEpochs%p.AllowZeroInterval == 0 { + minTip = 0 + } + // Fetch the pool content. preBuiltTxList, err := p.rpc.GetPoolContent( p.ctx, @@ -202,7 +211,7 @@ func (p *Proposer) fetchPoolContent(filterPoolContent bool) ([]types.Transaction rpc.BlockMaxTxListBytes, p.LocalAddresses, p.MaxProposedTxListsPerEpoch, - p.MinTip, + minTip, ) if err != nil { return nil, fmt.Errorf("failed to fetch transaction pool content: %w", err)