Skip to content

State / Tx batch Ordering Inconsistencies #295

@willmeister

Description

@willmeister

Describe the bug
State root ordering within state commitment chain batches may differ from the transaction ordering with which the state roots are associated.

The root cause (no pun intended) appears to be that the SQL queries that assemble and order the batches order by different fields that should produce the same result but may not.

Steps to reproduce
Steps to reproduce the behavior:
This is hard to reproduce, as it appears to be non-deterministic and based upon how Postgres assigns the ID of its records, possibly across multiple atomic transactions.

The best way to reproduce is by:

  1. Submitting a few hundred transactions in a matter of seconds to the L2 Node without the transaction batch creator or state commitment batch creator running but with the L2 Chain Data Persister running
  2. Continue (1) until you run into a situation where there is at least one l2_tx_output record that does not appear in the same index when ordering the table's records by ID vs by block_number
  3. Run the state commitment batch creator & transaction batch creator
  4. See that the transaction in question appears at a different cumulative index when batched

Expected behavior
State commitment batches have state roots which exactly correspond in number and order to the transactions within the transaction batch(es) they are committing to.

Screenshots
N/A

Specifications

Metadata

Metadata

Assignees

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