Fix wrong protocol table updates
Context
This MR aims to fix an issue that (presumably) occurred on ghostnet during the UAU. It seems that nodes without the uau in their config file, that were on a fork during a few blocks, were not able to switch to the good branch event after updating their config (and rebooting the node).
This could be due by the fact that:
- the activation block was validated but skipped (unexpected protocol level)
- after a restart, the branch switch was not updating the protocone table
Additionally, it fixes:
- potential issue with snapshot exports,
Manually testing the MR
branch switch
The test aims to reproduce the scenario.
protocol table restore
(Note that one should add the encoding in tezos-codec to run this test:
Add this to src/bin_codec/additional_registrations.ml
let () =
Registration.register
(def "protocol_levels" ~description:"protocol levels" Tezos_storage_shared.Protocol_levels.encoding)
In addition to that, octez_store_unix |>_open_; must be added in the manifest, in the tezos-codec section.
)
Here is an example of a broken protocol table from xtz snapshot import (that are currently known as broken): the table is empty.
./tezos-codec decode protocols_table from "$(xxd -plain -c 999999 ./xtz_data-dir_snapshot/store/chain_NetXdQprcVkpa/protocol_levels)"
[]
Running the node will now notice the issue and fix it.2726853
Sep 23 15:51:38.122 - external_block_validator: initialized
Sep 23 15:51:38.483 - external_block_validator: block validator process started with pid 614193
Sep 23 15:51:38.809 - node.store: the store is in an inconsistent state:
Sep 23 15:51:38.809 - node.store: Error:
Sep 23 15:51:38.809 - node.store: The protocol 13 is missing from the store but is required for caboose block 2726853 (BLYBtDfeHQpZvfViZ4LkTMB99o2x2WB4j1AX5cDWGGGTLuvoX9m).
Sep 23 15:51:38.809 - node.store:
Sep 23 15:51:38.809 - node.store: attempting to restore the store's consistency...
Sep 23 15:51:38.974 - node.store: the consistency of the floating stores was restored
Sep 23 15:51:39.001 - node.store: updating head (previously
We now have a valid protocol table
./tezos-codec decode protocols_table from "$(xxd -plain -c 999999 ./xtz_imported_ok_questionmark/store/chain_NetXdQprcVkpa/protocol_levels)"
[ [ 0,
{ "block": [ "BL1XoAW7zuy8gMnwiqwpiQLXfFPrtoEZWQb7b69TyMLLJFkAR1w", 0 ],
"protocol": "Ps9mPmXaRzmzk35gbAYNCAw6UXdE2qoABTHbN2oEEc1qM7CwT9P",
"commit_info":
{ "author": "Tezos", "message": "Genesis",
"test_chain_status": { "status": "not_running" },
"data_merkle_root":
"CoUr3AHPmaXCuYL2ps3bcKXwex2QmngoT9Z8LhhMWdLw8RTWZbGc",
"parents_contexts": [] } } ],
[ 13,
{ "block":
[ "BLoJ8nizeYscvkq5NLfTcUX3i8NTyYV89iG2rVayNYArtzgjxgY", 2726973 ],
"protocol": "PtJakart2xVj7pYXJBXrqHgd82rdkLey5ZeeGwDgPp9rhQUbSqY",
"commit_info":
{ "author": "Tezos",
"message":
"lvl 2726973, fit:(2726973, unlocked, 0, 0), round 0, 265 ops",
"test_chain_status": { "status": "not_running" },
"data_merkle_root":
"CoUxMYmadKPnemzhywx7YYnncvxwc9F3imd6ho5LDAp7f9zGEBdi",
"predecessor_block_metadata_hash":
"bm41rGBgCkr2qFGMDwN1QnnFB6iWKtvaRxKrEbDYNnZVxGvpzGW5",
"predecessor_ops_metadata_hash":
"LLr22hQwFrMhNzAtjfHr2J6t9zPPphoryPqhTwBYttWssoDwf7QQD",
"parents_contexts":
[ "CoWFR55ig5c5jFdV1U3JTYhAxERDCn9XXkUdbpmwgKhj5Yrenfc5" ] } } ] ]
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.rstfor the protocol and the environment,CHANGES.rstat the root of the repository for everything else). -
Select suitable reviewers using the Reviewersfield below. -
Select as Assigneethe next person who should take action on that MR