Verify the abbreviated anchors in an OP span batch

A span batch replaces repeated per-block fields with compact encodings. Matching it to the wrong parent shifts the interpretation of the entire span.

Compare the first twenty bytes

For a non-overlapping span, identify the L2 parent immediately before its first block and the L1 origin for its last block. Compare the leading twenty bytes of their hashes to the corresponding fields. Decode raw bytes before slicing a hex representation.

parent_check    = parent_l2_hash[0:20]
l1_origin_check = last_origin_hash[0:20]

If a hash starts with 0xabcd, its first two bytes are ab and cd; the text prefix 0x is outside the bytes. Taking the trailing twenty bytes as if deriving an Ethereum address will produce the wrong comparison.

Continue with the full batch validation

These short checks anchor the prefix and endpoint. The verifier must still reconstruct timestamps, origin changes and transaction lists, and handle overlaps with already derived blocks according to the span-batch rules. A matching prefix alone cannot validate the span. specs.optimism.io OP Stack specification