Shell: add failsafe for irmin errors
This MR aims to mitigate the so called unknown inode key that is triggered by irmin. To do so, it catches the error thanks to a pattern match and, if found, gracefully shutdown the node.
Manually testing the MR
Apply the following diff that:
- triggers the dummy irmin error when applying a block
- adds a tests that reproduces the issue
Run with dune exec ./tezt/tests/main.exe -- wip_irmin --verbose
diff --git a/src/lib_validation/block_validation.ml b/src/lib_validation/block_validation.ml
index 1e25a60e84..937144d8a3 100644
--- a/src/lib_validation/block_validation.ml
+++ b/src/lib_validation/block_validation.ml
@@ -827,6 +827,10 @@ module Make (Proto : Protocol_plugin.T) = struct
(Validation_errors.Inconsistent_hash
(resulting_context_hash, block_header.shell.context))
in
+ let () =
+ Stdlib.failwith
+ {|{"Direct":["CoWN2vbeRX7UktgiojGVpCYzjP4kse7gwSR1rLJCJryjGpcynkxi",388968996717,360]}: unknown inode key (find_value)|}
+ in
let validation_store =
{
resulting_context_hash;
diff --git a/tezt/tests/baking.ml b/tezt/tests/baking.ml
index 9e8c85bf86..ac14434587 100644
--- a/tezt/tests/baking.ml
+++ b/tezt/tests/baking.ml
@@ -731,12 +731,45 @@ let baking_with_given_minimal_timestamp ~minimal_timestamp =
in
Client.bake_for_and_wait ~minimal_timestamp client
+let wip_irmin =
+ Protocol.register_test
+ ~supports:Protocol.(From_protocol (number Alpha))
+ ~__FILE__
+ ~title:"wip_irmin"
+ ~tags:["wip_irmin"]
+ @@ fun protocol ->
+ let* node1, client1 =
+ Client.init_with_node
+ ~nodes_args:[Synchronisation_threshold 0; Connections 1]
+ `Client
+ ()
+ in
+ let* node2, _client2 =
+ Client.init_with_node
+ ~nodes_args:[Synchronisation_threshold 0; Connections 1]
+ `Client
+ ()
+ in
+ let* () = Client.Admin.connect_address client1 ~peer:node2 in
+ let* () = Client.activate_protocol_and_wait ~protocol client1 in
+ let* _ = Node.wait_for_level node1 1 in
+
+ let* () = Lwt_unix.sleep 2. in
+ let* () = Client.bake_for_and_wait ~node:node1 client1 in
+
+ let* () = Lwt_unix.sleep 2. in
+ let* () = Client.bake_for_and_wait ~node:node2 client1 in
+
+ let* () = Lwt_unix.sleep 2. in
+ unit
+
let register ~protocols =
test_ordering protocols ;
wrong_branch_operation_dismissal protocols ;
baking_operation_exception protocols ;
baking_with_given_minimal_timestamp ~minimal_timestamp:false protocols ;
- baking_with_given_minimal_timestamp ~minimal_timestamp:true protocols
+ baking_with_given_minimal_timestamp ~minimal_timestamp:true protocols ;
+ wip_irmin protocols
let register_operations_pool ~protocols =
List.iter
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
Edited by Victor Allombert