SCORU: add Tezt tests for timeouts
Context
Answers #3295 (closed).
The added test focuses on adding gas consumption traces for the timeout command.
For functional tests, see lib_protocol/tests/integration/operations/test_sc_rollup.ml.
Manually testing the MR
The goal is to be able to detect changes in gas consumption, so apply this patch on the branch:
diff --git a/src/proto_alpha/lib_protocol/sc_rollup_refutation_storage.ml b/src/proto_alpha/lib_protocol/sc_rollup_refutation_storage.ml
index 33403e15db..c15c99ab4a 100644
--- a/src/proto_alpha/lib_protocol/sc_rollup_refutation_storage.ml
+++ b/src/proto_alpha/lib_protocol/sc_rollup_refutation_storage.ml
@@ -305,6 +305,7 @@ let get_timeout ctxt rollup stakers =
let timeout ctxt rollup stakers =
let open Lwt_tzresult_syntax in
+ let*? ctxt = Raw_context.consume_gas ctxt (Saturation_repr.safe_int 10_000) in
let level = (Raw_context.current_level ctxt).level in
let* game, ctxt = get_game ctxt rollup stakers in
let* ctxt, timeout = Store.Game_timeout.get (ctxt, rollup) stakers in
leads to changes in regression traces when running:
dune exec tezt/tests/main.exe -- --file sc_rollup.ml --title "Alpha: refutation game timeout" --reset-regressions
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 Nicolas Ayache