From 334cbd02643f93737aea8c2e62311540490c7329 Mon Sep 17 00:00:00 2001 From: David Turner Date: Mon, 21 Mar 2022 13:06:35 -0400 Subject: [PATCH] Proto,tx_rollup: test for too-large withdraw position --- .../integration/operations/test_tx_rollup.ml | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/proto_alpha/lib_protocol/test/integration/operations/test_tx_rollup.ml b/src/proto_alpha/lib_protocol/test/integration/operations/test_tx_rollup.ml index b7493e029f2c..10a64ff6bf9d 100644 --- a/src/proto_alpha/lib_protocol/test/integration/operations/test_tx_rollup.ml +++ b/src/proto_alpha/lib_protocol/test/integration/operations/test_tx_rollup.ml @@ -4527,6 +4527,29 @@ module Withdraw = struct incr operation >>=? fun _i -> + (* 5. try with a hilariously-large message_index. If permitted, + this could cause a stack overflow. *) + let wrong_message_index = 1_000_000_000 in + Op.tx_rollup_dispatch_tickets + (I incr) + ~source:account1 + ~message_index:wrong_message_index + ~message_result_path:path2 + tx_rollup + Tx_rollup_level.(succ root) + valid_context_hash + [ticket_info] + >>=? fun operation -> + Incremental.add_operation + ~expect_failure: + (check_proto_error_f @@ function + | Tx_rollup_errors.Wrong_rejection_hash + {provided = _; expected = `Valid_path (_, idx)} -> + Compare.Int.(idx = wrong_message_index) + | _ -> false) + incr + operation + >>=? fun _i -> (* valid reveal *) Op.tx_rollup_dispatch_tickets (I incr) -- GitLab