[go: up one dir, main page]

Teztale: Integrate attested slots

What

Parent MR: !20056 (merged)

This MR adds Teztale support for recording and exporting DAL attested slots per consensus operation, without yet wiring any DAL node or new archiver mechanisms.

Concretely, Teztale can now:

  • store DAL attested slot indices in a dedicated DB table, keyed by operation;
  • expose these attested slot indices in the exported JSON (per operation).

Why

The broader goal is to be able to inspect DAL workflow in Teztale (and eventually in OTel), as described in the related milestone.

This MR is the first step on the attested side, complementing the existing work on assigned shards.

How

Changes are local to Teztale:

  • Extend Data.Delegate_operations.operation with attested_slot_indices : int list.
  • Add a new table dal_attested_slots(*id*, operation, slot_index)
  • Extend the /LEVEL/import handler so that, for each operation in Data.Delegate_operations.operations, all attested_slot_indices are inserted into dal_attested_slots using the (level, operation_hash) pair
  • Extend the exporter’s select_ops query to join dal_attested_slots onto operations.

Existing Teztale functionality remains unchanged and backward compatible, if no DAL data is present, the new fields are simply empty lists.

Manually testing the MR

We can manually add (INSERT INTO) an entry in the dal_attested_slots table, or we can do something more "automatic" to see that the mechanism works. This is the steps I followed:

  1. Run the Teztale Server with the following configuration:
{
  "db": "sqlite3:/Users/gabrielmoise/tezos/teztale.db",
  "interfaces": [
    {
      "port": 8080
    }
  ],
  "admins": [
    {
      "login": "gabriel",
      "password": "secret"
    }
  ],
  "users": [
    {
      "login": "gabriel",
      "password": "secret"
    }
  ],
  "max_batch_size": 1000,
  "with_transaction": "FULL",
  "with_metrics": false,
  "verbosity": "DEBUG"
}
./octez-teztale-server ./teztale.json

while I had an Octez node running (and bootstrapped) on ghostnet with:

./octez-node run --data-dir ~/.tezos-node-ghostnet --rpc-addr 127.0.0.1:18733 --net-addr 127.0.0.1:19733
  1. Try to get a proper entry to manually insert in the DB:
mkdir teztale-json

./octez-teztale-archiver --endpoint http://127.0.0.1:18733 run json-archiver in teztale-json # Leave for a few levels
  1. Using the information from the teztale-json directory, I could craft the following json file:
{
  "cycle_info": {
    "cycle": 1907,
    "cycle_position": 2284,
    "cycle_size": 10800
  },
  "blocks": [
    {
      "hash": "BMP2nqEjpai7V21CSVGumqFmQvsfKjE7kho6BhiQjn5unMe7C1v",
      "predecessor": "BLJu5TXAUiC2npsnJnxGszNP65wcdt87yrCD7Bn4G98TgwrjN2D",
      "delegate": "tz1cg5EqC3WdZgRSvGJeW328S4KQNrT4jvyv",
      "reception_times": [
        {
          "source": "archiver",
          "application": "2025-12-04T13:50:04.301-00:00"
        }
      ],
      "timestamp": "2025-12-04T13:50:04Z"
    },
    {
      "hash": "BMP2nqEjpai7V21CSVGumqFmQvsfKjE7kho6BhiQjn5unMe7C1v",
      "predecessor": "BLJu5TXAUiC2npsnJnxGszNP65wcdt87yrCD7Bn4G98TgwrjN2D",
      "delegate": "tz1cg5EqC3WdZgRSvGJeW328S4KQNrT4jvyv",
      "reception_times": [
        {
          "source": "archiver",
          "validation": "2025-12-04T13:50:04.268-00:00"
        }
      ],
      "timestamp": "2025-12-04T13:50:04Z"
    }
  ],
  "endorsements": [
    {
      "delegate": "tz1cg5EqC3WdZgRSvGJeW328S4KQNrT4jvyv",
      "endorsing_power": 642,
      "operations": [
        {
          "hash": "ooxa31QGRfRhnYbYi58pgtULynVDf5PizqpMMUNqgBF9Zu64V15",
          "round": 0,
          "received_in_mempools": [
            {
              "source": "archiver",
              "reception_time": "2025-12-04T13:50:04.606-00:00"
            }
          ],
          "included_in_blocks": [
            "BLBt1f7KqcbX2PBuUSev4p3BZJejuMJJTeatD9wH1Zji3NHHPpf"
          ],
          "attested_slot_indices": [
            0,
            1,
            2
          ]
        },
        {
          "hash": "opPTsC5GgnaDrevbi82bf6QjutAFiKgu3fXwoARQVH5sAJ1rPnY",
          "kind": "Preendorsement",
          "round": 0,
          "received_in_mempools": [
            {
              "source": "archiver",
              "reception_time": "2025-12-04T13:50:04.341-00:00"
            }
          ]
        }
      ]
    }
  ]
}
  1. Include this level in the database manually:
curl -v -u gabriel:secret -H 'Content-Type: application/json' --data-binary "@test.json" "http://127.0.0.1:8080/<level>/import"
  1. Check that the entries were added properly:
sqlite3 teztale.db 'SELECT o.level, HEX(o.hash), das.slot_index           
   FROM dal_attested_slots das
   JOIN operations o ON o.id = das.operation
   ORDER BY o.level, o.hash, das.slot_index;'

<level>|C15064D8AD5A69A4C23B2F1B9BF89EF45AE4BB6D4527AB34F705ABCDFDEC1761|0
<level>|C15064D8AD5A69A4C23B2F1B9BF89EF45AE4BB6D4527AB34F705ABCDFDEC1761|1
<level>|C15064D8AD5A69A4C23B2F1B9BF89EF45AE4BB6D4527AB34F705ABCDFDEC1761|2

As expected, as we added "attested_slot_indices": [0, 1, 2] in the crafter json file.

Checklist

  • Document the interface of any function added or modified (see the coding guidelines)
  • Document any change to the user interface, including configuration parameters (see node configuration)
  • Provide automatic testing (see the testing guide).
  • For new features and bug fixes, add an item in the appropriate changelog (docs/protocols/alpha.rst for the protocol and the environment, CHANGES.rst at the root of the repository for everything else).
  • Select suitable reviewers using the Reviewers field below.
  • Select as Assignee the next person who should take action on that MR
Edited by Gabriel Moise

Merge request reports

Loading