diff --git a/cmd/flags/proposer.go b/cmd/flags/proposer.go index ff7fdc037..9b2dac781 100644 --- a/cmd/flags/proposer.go +++ b/cmd/flags/proposer.go @@ -55,6 +55,10 @@ var ( Value: 1, Category: proposerCategory, } + ProposeBlockTxGasLimit = &cli.Uint64Flag{ + Name: "proposeBlockTxGasLimit", + Category: proposerCategory, + } ) // All proposer flags. @@ -68,4 +72,5 @@ var ProposerFlags = MergeFlags(CommonFlags, []cli.Flag{ ProposeEmptyBlocksInterval, MinBlockGasLimit, MaxProposedTxListsPerEpoch, + ProposeBlockTxGasLimit, }) diff --git a/pkg/chain_iterator/block_batch_iterator.go b/pkg/chain_iterator/block_batch_iterator.go index 9100d9134..9bebdecbf 100644 --- a/pkg/chain_iterator/block_batch_iterator.go +++ b/pkg/chain_iterator/block_batch_iterator.go @@ -288,7 +288,7 @@ func (i *BlockBatchIterator) end() { // event.Raw.Removed, which will also call `i.rewindOnReorgDetected` to rewind back func (i *BlockBatchIterator) ensureCurrentNotReorged() error { current, err := i.client.HeaderByHash(i.ctx, i.current.Hash()) - if err != nil && !errors.Is(err, ethereum.NotFound) { + if err != nil && !(err.Error() == ethereum.NotFound.Error()) { return err } diff --git a/pkg/rpc/methods.go b/pkg/rpc/methods.go index 72481f64f..075195295 100644 --- a/pkg/rpc/methods.go +++ b/pkg/rpc/methods.go @@ -358,7 +358,7 @@ func (c *Client) CheckL1Reorg(ctx context.Context, blockID *big.Int) (bool, *typ if err != nil { // If the L2 EE is just synced through P2P, there is a chance that the EE do not have // the chain head L1Origin information recorded. - if errors.Is(err, ethereum.NotFound) { + if err.Error() == ethereum.NotFound.Error() { log.Info("L1Origin not found", "blockID", blockID) return false, nil, nil, nil } @@ -367,7 +367,7 @@ func (c *Client) CheckL1Reorg(ctx context.Context, blockID *big.Int) (bool, *typ l1Header, err := c.L1.HeaderByNumber(ctx, l1Origin.L1BlockHeight) if err != nil { - if errors.Is(err, ethereum.NotFound) { + if err.Error() == ethereum.NotFound.Error() { continue } return false, nil, nil, fmt.Errorf("failed to fetch L1 header (%d): %w", l1Origin.L1BlockHeight, err) diff --git a/proposer/config.go b/proposer/config.go index 7e0aac6dc..f75fc0bff 100644 --- a/proposer/config.go +++ b/proposer/config.go @@ -26,6 +26,7 @@ type Config struct { ProposeEmptyBlocksInterval *time.Duration MinBlockGasLimit uint64 MaxProposedTxListsPerEpoch uint64 + ProposeBlockTxGasLimit *uint64 } // NewConfigFromCliContext initializes a Config instance from @@ -72,6 +73,12 @@ func NewConfigFromCliContext(c *cli.Context) (*Config, error) { } } + var proposeBlockTxGasLimit *uint64 + if c.IsSet(flags.ProposeBlockTxGasLimit.Name) { + gasLimit := c.Uint64(flags.ProposeBlockTxGasLimit.Name) + proposeBlockTxGasLimit = &gasLimit + } + return &Config{ L1Endpoint: c.String(flags.L1WSEndpoint.Name), L2Endpoint: c.String(flags.L2HTTPEndpoint.Name), @@ -85,5 +92,6 @@ func NewConfigFromCliContext(c *cli.Context) (*Config, error) { ProposeEmptyBlocksInterval: proposeEmptyBlocksInterval, MinBlockGasLimit: c.Uint64(flags.MinBlockGasLimit.Name), MaxProposedTxListsPerEpoch: c.Uint64(flags.MaxProposedTxListsPerEpoch.Name), + ProposeBlockTxGasLimit: proposeBlockTxGasLimit, }, nil } diff --git a/proposer/proposer.go b/proposer/proposer.go index 5f55507a3..c98af1045 100644 --- a/proposer/proposer.go +++ b/proposer/proposer.go @@ -48,6 +48,7 @@ type Proposer struct { locals []common.Address minBlockGasLimit *uint64 maxProposedTxListsPerEpoch uint64 + proposeBlockTxGasLimit *uint64 // Protocol configurations protocolConfigs *bindings.TaikoDataConfig @@ -77,6 +78,7 @@ func InitFromConfig(ctx context.Context, p *Proposer, cfg *Config) (err error) { p.l2SuggestedFeeRecipient = cfg.L2SuggestedFeeRecipient p.proposingInterval = cfg.ProposeInterval p.proposeEmptyBlocksInterval = cfg.ProposeEmptyBlocksInterval + p.proposeBlockTxGasLimit = cfg.ProposeBlockTxGasLimit p.wg = sync.WaitGroup{} p.locals = cfg.LocalAddresses p.commitSlot = cfg.CommitSlot @@ -292,6 +294,9 @@ func (p *Proposer) ProposeTxList( if nonce != nil { opts.Nonce = new(big.Int).SetUint64(*nonce) } + if p.proposeBlockTxGasLimit != nil { + opts.GasLimit = *p.proposeBlockTxGasLimit + } proposeTx, err := p.rpc.TaikoL1.ProposeBlock(opts, inputs, txListBytes) if err != nil { diff --git a/prover/prover.go b/prover/prover.go index 3b956ffb0..0b2c5c585 100644 --- a/prover/prover.go +++ b/prover/prover.go @@ -8,6 +8,7 @@ import ( "sync" "time" + "github.com/ethereum/go-ethereum" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/event" @@ -502,8 +503,20 @@ func (p *Prover) initL1Current(startingBlockID *big.Int) error { startingBlockID = new(big.Int).SetUint64(stateVars.LastVerifiedBlockId) } + log.Info("Init L1Current cursor", "startingBlockID", startingBlockID) + latestVerifiedHeaderL1Origin, err := p.rpc.L2.L1OriginByID(p.ctx, startingBlockID) if err != nil { + if err.Error() == ethereum.NotFound.Error() { + log.Warn("Failed to find L1Origin for blockID: %d, use latest L1 head instead", startingBlockID) + l1Head, err := p.rpc.L1.BlockNumber(p.ctx) + if err != nil { + return err + } + + p.l1Current = l1Head + return nil + } return err }