o1-labs / Archive-Node-API

This is a GraphQL server that is built with the intention of exposing information from Mina's Archive Node
17 stars 4 forks source link

Archive node API does not expose enough information by which to order actions #106

Open 45930 opened 3 days ago

45930 commented 3 days ago

Relates to: https://github.com/o1-labs/o1js/issues/1872

There are four different orderings that we need to consider when fetching transaction data from the archive DB-

  1. Blocks: blocks need to be ordered as per the canonical chain. For the ones pending ones you’ll need to select based on consensus rules which I believe is handled in the archive node API
  2. Transactions within a block have a sequence. There is a sequence_no column in blocks_zkapp_commands table that gives you the ordering
  3. Account updates within a zkapp transaction have a sequence. The ids are stored as an array dictating the order. zkapp_account_updates_ids column in zkapp_commands table
  4. Events/actions within an account update have a sequence. Same as account updates, ids are stored as array in zke.element_ids column in zkapp_events table

It doesn’t seem like the queries in the archive API consider 2, 3, and 4

We need to expose these details in the graphQL response to ensure clients have the information they need to correctly process actions.