Skip to content

l1Inclusion() might retrieve inconsistent L1 block in the case of reorg #75

@lucasmt

Description

@lucasmt

The function l1Inclusion() in algo.go calls OptimisticAt() on the ChainContainer to obtain the L1 block that each L2 head was derived from:

_, l1Block, err := chain.OptimisticAt(i.ctx, ts)
if err != nil {
i.log.Error("failed to get L1 inclusion for L2 block", "chainID", chainID, "timestamp", ts, "err", err)
return eth.BlockID{}, fmt.Errorf("chain %s: failed to get L1 inclusion: %w", chainID, err)
}

However, if there has been a reorg between fetching the L2 blocks and calling this function, this information might be incorrect, as the L2 block at the given timestamp might have changed. Instead, the L1 inclusion should be calculated using the L1 heads already retrieved previously by observeRound().

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions