diff --git a/src/proto_016_PtMumbai/lib_sc_rollup_node/fueled_pvm.ml b/src/proto_016_PtMumbai/lib_sc_rollup_node/fueled_pvm.ml index e294a44c5760561dfb13c975fe8317f74f418560..3f2d28080991f3eaf642c625aa3fd6938b36d65f 100644 --- a/src/proto_016_PtMumbai/lib_sc_rollup_node/fueled_pvm.ml +++ b/src/proto_016_PtMumbai/lib_sc_rollup_node/fueled_pvm.ml @@ -141,14 +141,20 @@ module Make (PVM : Pvm.S) = struct { reveal_preimage = (fun hash -> - let hash = - (* The payload represents the encoded [Sc_rollup_reveal_hash.t]. We must - decode it properly, instead of converting it byte-for-byte. *) - Data_encoding.Binary.of_string_exn - Sc_rollup_reveal_hash.encoding - hash - in let*! data = + let*? hash = + (* The payload represents the encoded [Sc_rollup_reveal_hash.t]. We must + decode it properly, instead of converting it byte-for-byte. *) + Result.bind_error + (Data_encoding.Binary.of_string + Sc_rollup_reveal_hash.encoding + hash) + (error_with + "Bad reveal hash '%a': %a" + Hex.pp + (Hex.of_string hash) + Data_encoding.Binary.pp_read_error) + in get_reveal ~data_dir:node_ctxt.data_dir reveal_map hash in match data with diff --git a/src/proto_017_PtNairob/lib_sc_rollup_node/fueled_pvm.ml b/src/proto_017_PtNairob/lib_sc_rollup_node/fueled_pvm.ml index e7d904662e68cf9560e92a2524faba95f5e831b2..adbb022163136877231d78335890b353dd674d56 100644 --- a/src/proto_017_PtNairob/lib_sc_rollup_node/fueled_pvm.ml +++ b/src/proto_017_PtNairob/lib_sc_rollup_node/fueled_pvm.ml @@ -141,14 +141,20 @@ module Make (PVM : Pvm.S) = struct { reveal_preimage = (fun hash -> - let hash = - (* The payload represents the encoded [Sc_rollup_reveal_hash.t]. We must - decode it properly, instead of converting it byte-for-byte. *) - Data_encoding.Binary.of_string_exn - Sc_rollup_reveal_hash.encoding - hash - in let*! data = + let*? hash = + (* The payload represents the encoded [Sc_rollup_reveal_hash.t]. We must + decode it properly, instead of converting it byte-for-byte. *) + Result.bind_error + (Data_encoding.Binary.of_string + Sc_rollup_reveal_hash.encoding + hash) + (error_with + "Bad reveal hash '%a': %a" + Hex.pp + (Hex.of_string hash) + Data_encoding.Binary.pp_read_error) + in get_reveal ~data_dir:node_ctxt.data_dir reveal_map hash in match data with diff --git a/src/proto_alpha/lib_sc_rollup_node/fueled_pvm.ml b/src/proto_alpha/lib_sc_rollup_node/fueled_pvm.ml index 84ed1c0985731294da5d60f8a58b2c0247b23d8f..325df99539fe4d5e020bb7fd5a4f92668981370c 100644 --- a/src/proto_alpha/lib_sc_rollup_node/fueled_pvm.ml +++ b/src/proto_alpha/lib_sc_rollup_node/fueled_pvm.ml @@ -141,14 +141,20 @@ module Make (PVM : Pvm.S) = struct { reveal_preimage = (fun hash -> - let hash = - (* The payload represents the encoded [Sc_rollup_reveal_hash.t]. We must - decode it properly, instead of converting it byte-for-byte. *) - Data_encoding.Binary.of_string_exn - Sc_rollup_reveal_hash.encoding - hash - in let*! data = + let*? hash = + (* The payload represents the encoded [Sc_rollup_reveal_hash.t]. We must + decode it properly, instead of converting it byte-for-byte. *) + Result.bind_error + (Data_encoding.Binary.of_string + Sc_rollup_reveal_hash.encoding + hash) + (error_with + "Bad reveal hash '%a': %a" + Hex.pp + (Hex.of_string hash) + Data_encoding.Binary.pp_read_error) + in get_reveal ?dac_client:node_ctxt.dac_client ~data_dir:node_ctxt.data_dir