Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion op-e2e/system_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -566,7 +566,7 @@ func TestSystemMockP2P(t *testing.T) {
require.Nil(t, err, "Sending L2 tx to sequencer")

// Wait for tx to be mined on the L2 sequencer chain
receiptSeq, err := waitForTransaction(tx.Hash(), l2Seq, 3*time.Duration(sys.RollupConfig.BlockTime)*time.Second)
receiptSeq, err := waitForTransaction(tx.Hash(), l2Seq, 6*time.Duration(sys.RollupConfig.BlockTime)*time.Second)
require.Nil(t, err, "Waiting for L2 tx on sequencer")

// Wait until the block it was first included in shows up in the safe chain on the verifier
Expand Down
6 changes: 4 additions & 2 deletions op-node/rollup/driver/conf_depth.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
"github.com/ethereum-optimism/optimism/op-node/eth"
"github.com/ethereum-optimism/optimism/op-node/rollup/derive"
"github.com/ethereum/go-ethereum"
"github.com/ethereum/go-ethereum/common"
)

// confDepth is an util that wraps the L1 input fetcher used in the pipeline,
Expand All @@ -33,7 +32,10 @@ func (c *confDepth) L1BlockRefByNumber(ctx context.Context, num uint64) (eth.L1B

// Don't apply the conf depth is l1Head is empty (as it is during the startup case before the l1State is initialized).
l1Head := c.l1Head()
if num == 0 || c.depth == 0 || num+c.depth <= l1Head.Number || l1Head.Hash == (common.Hash{}) {
if l1Head == (eth.L1BlockRef{}) {
return c.L1Fetcher.L1BlockRefByNumber(ctx, num)
}
if num == 0 || c.depth == 0 || num+c.depth <= l1Head.Number {
return c.L1Fetcher.L1BlockRefByNumber(ctx, num)
}
return eth.L1BlockRef{}, ethereum.NotFound
Expand Down
6 changes: 6 additions & 0 deletions op-node/rollup/driver/l1_state.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,20 @@ func (s *L1State) HandleNewL1FinalizedBlock(finalized eth.L1BlockRef) {
s.l1Finalized = finalized
}

// L1Head returns either the stored L1 head or an empty block reference
// if the L1 Head has not been initialized yet.
func (s *L1State) L1Head() eth.L1BlockRef {
return s.l1Head
}

// L1Safe returns either the stored L1 safe block or an empty block reference
// if the L1 safe block has not been initialized yet.
func (s *L1State) L1Safe() eth.L1BlockRef {
return s.l1Safe
}

// L1Finalized returns either the stored L1 finalized block or an empty block reference
// if the L1 finalized block has not been initialized yet.
func (s *L1State) L1Finalized() eth.L1BlockRef {
return s.l1Finalized
}
10 changes: 7 additions & 3 deletions op-node/rollup/driver/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,13 @@ func (s *Driver) createNewL2Block(ctx context.Context) error {
l2Safe := s.derivation.SafeL2Head()
l2Finalized := s.derivation.Finalized()

l1Head := s.l1State.L1Head()
if l1Head == (eth.L1BlockRef{}) {
return derive.NewTemporaryError(errors.New("L1 Head in L1 State is not initizalited yet"))
}

// Figure out which L1 origin block we're going to be building on top of.
l1Origin, err := s.l1OriginSelector.FindL1Origin(ctx, s.l1State.L1Head(), l2Head)
l1Origin, err := s.l1OriginSelector.FindL1Origin(ctx, l1Head, l2Head)
if err != nil {
s.log.Error("Error finding next L1 Origin", "err", err)
return err
Expand Down Expand Up @@ -261,9 +266,8 @@ func (s *Driver) eventLoop() {

case <-l2BlockCreationReqCh:
s.snapshot("L2 Block Creation Request")
l1Head := s.l1State.L1Head()
if !s.idleDerivation {
s.log.Warn("not creating block, node is deriving new l2 data", "head_l1", l1Head)
s.log.Warn("not creating block, node is deriving new l2 data", "head_l1", s.l1State.L1Head())
break
}
ctx, cancel := context.WithTimeout(ctx, 20*time.Minute)
Expand Down