From c0270a1bdcf12684737f9f096b7c5cee32285560 Mon Sep 17 00:00:00 2001 From: Michael de Hoog Date: Thu, 3 Oct 2024 11:13:37 -1000 Subject: [PATCH] Fix block number check --- op-proposer/proposer/clients.go | 1 + op-proposer/proposer/driver.go | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/op-proposer/proposer/clients.go b/op-proposer/proposer/clients.go index 893decb..9bbbf4b 100644 --- a/op-proposer/proposer/clients.go +++ b/op-proposer/proposer/clients.go @@ -17,6 +17,7 @@ import ( ) type L1Client interface { + HeaderByNumber(ctx context.Context, number *big.Int) (*types.Header, error) HeaderByHash(ctx context.Context, hash common.Hash) (*types.Header, error) BlockReceipts(ctx context.Context, hash common.Hash) (types.Receipts, error) CodeAt(ctx context.Context, contract common.Address, blockNumber *big.Int) ([]byte, error) diff --git a/op-proposer/proposer/driver.go b/op-proposer/proposer/driver.go index 284782f..414371c 100644 --- a/op-proposer/proposer/driver.go +++ b/op-proposer/proposer/driver.go @@ -263,13 +263,13 @@ func (l *L2OutputSubmitter) generateNextProposal(ctx context.Context, lastPropos } if shouldPropose { - latestBlockHeader, err := l.L2Client.HeaderByNumber(l.ctx, nil) + latestL1BlockHeader, err := l.L1Client.HeaderByNumber(l.ctx, nil) if err != nil { log.Warn("Failed to get latest block header", "err", err) shouldPropose = false - } else if lastProposal.BlockRef.Number <= latestBlockHeader.Number.Uint64()-256 { + } else if lastProposal.BlockRef.L1Origin.Number <= latestL1BlockHeader.Number.Uint64()-256 { // only submit onchain if within the blockhash window - log.Warn("Not submitting proposal, block is too old", "block", lastProposal.BlockRef.Number, "latest", latestBlockHeader.Number.Uint64()) + log.Warn("Not submitting proposal, block is too old", "l1Origin", lastProposal.BlockRef.L1Origin.Number, "l1Latest", latestL1BlockHeader.Number.Uint64()) shouldPropose = false } }