DAL/Node: add published_level to skip_list_slots table and migrate db
What
Migrate the DAL node's skip-list DB by adding a published_level column in the skip_list_slots table (and replacing attested_level by attestation_lag).
Two additional commits (the last two) are to ensure the right parameters are used around migration. See commit messages for details.
Why
A slot id identifies a slot. Therefore a skip-list cell should rather be identified (and indexed) by a slot_id = (published_level, slot_index) pair, and not by an (attested_level, slot_index) pair.
In particular, in a future planned protocol migration slots from several published levels will be attested at the same level. The current table is not able to distinguish them.
How
Just use the already provided DB migration mechanism.
Manually testing the MR
One could test it for instance on Shadownet (but any other testnet with a running producer is fine), eg slot index 8 on Shadownet:
- Start an operator node running on
masterfollowing a slot index for which there is a producer. - Run
sqlite3 <path_to_dal_node_data_dir>/store/skip_list_store/store.sqlite- Run
.headers onto see the column names. - Then run
SELECT *, hex(skip_list_cell_hash) FROM skip_list_slots ORDER BY attested_level DESC LIMIT 32;
- Run
- Stop the DAL node, and restart it on the current branch (but the same data-dir).
- Run the same
sqlite3command.- Run
SELECT *, hex(skip_list_cell_hash) FROM skip_list_slots WHERE published_level = <attested_level_from_above> - 8. You should now see the same data and with an additional 1st column (published_level).
- Run