From 040f4dab7d97825d48eecaff174c680c7c5c47a7 Mon Sep 17 00:00:00 2001 From: Albin Coquereau Date: Fri, 18 Aug 2023 08:52:37 +0200 Subject: [PATCH 1/6] shell: increase RPC default value --- src/lib_shell_services/block_services.ml | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/lib_shell_services/block_services.ml b/src/lib_shell_services/block_services.ml index 898acde03dab..d9e144525fff 100644 --- a/src/lib_shell_services/block_services.ml +++ b/src/lib_shell_services/block_services.ml @@ -797,7 +797,7 @@ module Make (Proto : PROTO) (Next_proto : PROTO) = struct mk_version_informations ~supported:[version_0; version_1] ~latest:Version_1 - ~default:Version_0 + ~default:Version_1 () let metadata_query = @@ -806,8 +806,11 @@ module Make (Proto : PROTO) (Next_proto : PROTO) = struct object method version = version end) - |+ field "version" (version_arg metadata_versions) Version_0 (fun t -> - t#version) + |+ field + "version" + (version_arg metadata_versions) + metadata_versions.default + (fun t -> t#version) |> seal let metadata = @@ -876,7 +879,7 @@ module Make (Proto : PROTO) (Next_proto : PROTO) = struct mk_version_informations ~supported:[version_0; version_1] ~latest:Version_1 - ~default:Version_0 + ~default:Version_1 () let force_operation_metadata_query = @@ -1151,7 +1154,7 @@ module Make (Proto : PROTO) (Next_proto : PROTO) = struct mk_version_informations ~supported:[version_0; version_1] ~latest:Version_1 - ~default:Version_0 + ~default:Version_1 () let operations_query = @@ -1484,7 +1487,7 @@ module Make (Proto : PROTO) (Next_proto : PROTO) = struct {version = Version_2; use_legacy_attestation_name = false}; ] ~latest:Version_2 - ~default:Version_1 + ~default:Version_2 () let pending_query = @@ -1618,7 +1621,7 @@ module Make (Proto : PROTO) (Next_proto : PROTO) = struct mk_version_informations ~supported:[version_0; version_1] ~latest:Version_1 - ~default:Version_0 + ~default:Version_1 () let mempool_query = @@ -1825,7 +1828,7 @@ module Make (Proto : PROTO) (Next_proto : PROTO) = struct let f = make_call0 S.raw_header ctxt in fun ?(chain = `Main) ?(block = `Head 0) () -> f chain block () () - let metadata ctxt ?(version = Version_0) = + let metadata ctxt ?(version = S.metadata_versions.default) = let open Lwt_result_syntax in let f = make_call0 S.metadata ctxt in fun ?(chain = `Main) ?(block = `Head 0) () -> -- GitLab From ee679dc10ae330f8c86533ba7ba8d4078a5b5354 Mon Sep 17 00:00:00 2001 From: Albin Coquereau Date: Mon, 4 Sep 2023 09:38:31 +0200 Subject: [PATCH 2/6] tezt/tests: update tests that use pending_operations --- tezt/tests/baking.ml | 2 +- tezt/tests/double_bake.ml | 8 +- tezt/tests/monitor_operations.ml | 2 +- tezt/tests/node_event_level.ml | 24 ++--- tezt/tests/prevalidator.ml | 160 ++++++++++++++++--------------- tezt/tests/stresstest_command.ml | 28 +++--- tezt/tests/tenderbake.ml | 2 +- 7 files changed, 114 insertions(+), 112 deletions(-) diff --git a/tezt/tests/baking.ml b/tezt/tests/baking.ml index 9e8c85bf860e..be96a39a6170 100644 --- a/tezt/tests/baking.ml +++ b/tezt/tests/baking.ml @@ -659,7 +659,7 @@ let test_operation_pool_ordering let* mempool = Client.RPC.call client @@ RPC.get_chain_mempool_pending_operations () in - let mgmt_ops = JSON.get "applied" mempool in + let mgmt_ops = JSON.get "validated" mempool in let filename = Filename.temp_file "opool_" ".json" in let json = JSON.as_list mgmt_ops in diff --git a/tezt/tests/double_bake.ml b/tezt/tests/double_bake.ml index d5245a751d60..5fafa7e330ee 100644 --- a/tezt/tests/double_bake.ml +++ b/tezt/tests/double_bake.ml @@ -38,10 +38,10 @@ let is_operation_in_operations ops oph = let ops_list = ops |=> 2 |> as_list in List.exists (fun e -> e |-> "hash" |> as_string = oph) ops_list -let is_operation_in_applied_mempool mempool oph = +let is_operation_in_validated_mempool mempool oph = let open JSON in - let applied_list = as_list (mempool |-> "applied") in - List.exists (fun e -> e |-> "hash" |> as_string = oph) applied_list + let validated_list = as_list (mempool |-> "validated") in + List.exists (fun e -> e |-> "hash" |> as_string = oph) validated_list (* Matches events where the message is of the form: "double baking evidence injected ". @@ -96,7 +96,7 @@ let wait_for_denunciation_injection node client accuser = let* mempool = Client.RPC.call client @@ RPC.get_chain_mempool_pending_operations () in - if is_operation_in_applied_mempool mempool oph then return oph + if is_operation_in_validated_mempool mempool oph then return oph else Test.fail "the denunciation operation was rejected by the mempool" (* This tests aims to detect a double baking evidence with an diff --git a/tezt/tests/monitor_operations.ml b/tezt/tests/monitor_operations.ml index 2b06afeada40..9e14dcfb4577 100644 --- a/tezt/tests/monitor_operations.ml +++ b/tezt/tests/monitor_operations.ml @@ -107,7 +107,7 @@ let monitor_operations = Constant.bootstrap2 Constant.bootstrap3 in - let* ophs = Node_event_level.get_applied_operation_hash_list client in + let* ophs = Node_event_level.get_validated_operation_hash_list client in (* Step 4 *) (* Bake a block *) let* () = Node_event_level.bake_wait_log node client in diff --git a/tezt/tests/node_event_level.ml b/tezt/tests/node_event_level.ml index 751dcd6e0764..8feb467b48be 100644 --- a/tezt/tests/node_event_level.ml +++ b/tezt/tests/node_event_level.ml @@ -119,14 +119,14 @@ let bake_wait_log ?level ?protocol ?mempool ?ignore_node_mempool node client = (* Get the hash of an operation from the json representing the operation. *) let get_hash op = JSON.(op |-> "hash" |> as_string) -(* Get the list of hashes of the mempool's applied operations (using +(* Get the list of hashes of the mempool's validated operations (using RPC get /chains/main/mempool/pending_operations that provides all the operations in the mempool). *) -let get_applied_operation_hash_list client = +let get_validated_operation_hash_list client = let* pending_ops = Client.RPC.call client @@ RPC.get_chain_mempool_pending_operations () in - return (List.map get_hash JSON.(pending_ops |-> "applied" |> as_list)) + return (List.map get_hash JSON.(pending_ops |-> "validated" |> as_list)) (* Assert that [json] represents an empty list. *) let check_json_is_empty_list ?(fail_msg = "") json = @@ -152,7 +152,7 @@ let check_json_is_empty_list ?(fail_msg = "") json = Scenario: - Step 1: Start a node with event_level:debug, activate the protocol. - Step 2: Inject a transfer operation, test RPCs. - 2a) pending_operations should contain one applied operation. + 2a) pending_operations should contain one validated operation. 2b) operations in block should be empty. - Step 3: Bake, test RPCs. 3a) pending_operations should be empty. @@ -181,13 +181,13 @@ let test_debug_level_misc = Constant.bootstrap2 in Log.info "Injection done." ; - Log.info "2a) pending_operations should contain one applied operation." ; - let* applied_ophs = get_applied_operation_hash_list client_1 in + Log.info "2a) pending_operations should contain one validated operation." ; + let* validated_ophs = get_validated_operation_hash_list client_1 in Log.info "RPC.get_mempool_pending_operations done." ; let oph1 = - match applied_ophs with + match validated_ophs with | [x] -> x - | _ -> Test.fail "Expected exactly one applied operation in mempool." + | _ -> Test.fail "Expected exactly one validated operation in mempool." in Log.info "Hash of injected operation: %s" oph1 ; Log.info "2b) operations in block should be empty." ; @@ -203,11 +203,11 @@ let test_debug_level_misc = let level = level + 1 in let* () = bake_wait_log ?level:(Some level) node_1 client_1 in Log.info "3a) pending_operations should be empty." ; - let* applied_ophs = get_applied_operation_hash_list client_1 in + let* validated_ophs = get_validated_operation_hash_list client_1 in Log.info "RPC.get_mempool_pending_operations done." ; - (match applied_ophs with + (match validated_ophs with | [] -> () - | _ -> Test.fail "List of applied operations in mempool should be empty.") ; + | _ -> Test.fail "List of validated operations in mempool should be empty.") ; Log.info "3b) operations in block should contain the previously pending operation." ; let* ops = Client.RPC.call client_1 @@ RPC.get_chain_block_operations () in @@ -222,7 +222,7 @@ let test_debug_level_misc = | _ -> Test.fail "Fourth list returned by RPC.operations should contain only \ - the previously applied operation.") + the previously validated operation.") | _ -> Test.fail "Fourth list returned by RPC.operations should contain exactly one \ diff --git a/tezt/tests/prevalidator.ml b/tezt/tests/prevalidator.ml index f9e3ea6c79b4..7dc36fbbaa80 100644 --- a/tezt/tests/prevalidator.ml +++ b/tezt/tests/prevalidator.ml @@ -2747,9 +2747,9 @@ module Revamped = struct check_mempool ~validated:[oph3; oph5] ~refused:[oph2; oph4; oph6] client1 end -let check_operation_is_in_applied_mempool ops oph = +let check_operation_is_in_validated_mempool ops oph = let open JSON in - let ops_list = as_list (ops |-> "applied") in + let ops_list = as_list (ops |-> "validated") in let res = List.exists (fun e -> e |-> "hash" |> as_string = as_string oph) ops_list in @@ -2757,7 +2757,7 @@ let check_operation_is_in_applied_mempool ops oph = Test.fail "Operation %s was not found in the mempool" (JSON.encode oph) type mempool_count = { - applied : int; + validated : int; branch_delayed : int; branch_refused : int; refused : int; @@ -2768,17 +2768,18 @@ type mempool_count = { let count_mempool mempool = let open JSON in - let applied = as_list (mempool |-> "applied") |> List.length in + let validated = as_list (mempool |-> "validated") |> List.length in let branch_delayed = as_list (mempool |-> "branch_delayed") |> List.length in let branch_refused = as_list (mempool |-> "branch_refused") |> List.length in let refused = as_list (mempool |-> "refused") |> List.length in let outdated = as_list (mempool |-> "outdated") |> List.length in let unprocessed = as_list (mempool |-> "unprocessed") |> List.length in let total = - applied + branch_delayed + branch_refused + refused + outdated + unprocessed + validated + branch_delayed + branch_refused + refused + outdated + + unprocessed in { - applied; + validated; branch_delayed; branch_refused; refused; @@ -2789,7 +2790,7 @@ let count_mempool mempool = let pp_mempool_count fmt { - applied; + validated; branch_delayed; branch_refused; refused; @@ -2799,10 +2800,10 @@ let pp_mempool_count fmt } = Format.fprintf fmt - "total: %d - applied: %d, branch_delayed: %d, branch_refused: %d, refused: \ - %d, outdated: %d, unprocessed: %d" + "total: %d - validated: %d, branch_delayed: %d, branch_refused: %d, \ + refused: %d, outdated: %d, unprocessed: %d" total - applied + validated branch_delayed branch_refused refused @@ -3088,7 +3089,7 @@ let refetch_failed_operation = let* mempool_node_1 = Client.RPC.call client_1 @@ RPC.get_chain_mempool_pending_operations () in - check_operation_is_in_applied_mempool mempool_node_1 oph ; + check_operation_is_in_validated_mempool mempool_node_1 oph ; (* Step 5 *) (* Ensure that the mempool of node_2 is empty *) let* mempool_count_after_failed_fetch = @@ -3109,7 +3110,7 @@ let refetch_failed_operation = let* mempool_inject_on_node_2 = Client.RPC.call client_2 @@ RPC.get_chain_mempool_pending_operations () in - check_operation_is_in_applied_mempool mempool_inject_on_node_2 oph ; + check_operation_is_in_validated_mempool mempool_inject_on_node_2 oph ; unit let check_op_removed client op = @@ -3117,7 +3118,7 @@ let check_op_removed client op = Client.RPC.call client @@ RPC.get_chain_mempool_pending_operations () in let open JSON in - let ops_list = pending_ops |-> "applied" |> as_list in + let ops_list = pending_ops |-> "validated" |> as_list in let res = List.exists (fun e -> e |-> "hash" |> as_string = op) ops_list in if res then Test.fail "%s found after removal" op ; unit @@ -3144,7 +3145,7 @@ let bake_empty_block_and_wait_for_flush ~protocol ?(log = false) client node = waiter (* for functions [transfer_and_wait_for_injection], [wait_for_arrival], - and [get_applied_operation_hash_list] *) + and [get_validated_operation_hash_list] *) open Node_event_level (** Injects a transfer operation from [client] and waits for an operation @@ -3167,11 +3168,11 @@ let transfer_and_wait_for_arrival node client amount_int giver_key receiver_key let* () = wait_for in unit -(** Gets the list of hashes of the mempool's applied operations, +(** Gets the list of hashes of the mempool's validated operations, displays it, and returns it. *) -let get_and_log_applied client = - let* ophs = get_applied_operation_hash_list client in - Log.info "Applied operations in mempool:" ; +let get_and_log_validated client = + let* ophs = get_validated_operation_hash_list client in + Log.info "Validated operations in mempool:" ; List.iter (Log.info "- %s") ophs ; return ophs @@ -3180,34 +3181,34 @@ let get_and_log_applied client = of raising [invalid_arg] as using [List.for_all2] directly would do). We use a naive way to check both lists are equal because 1. performances for small lists does not matter and 2. the mempool - does not specify how operations previously applied will be applied + does not specify how operations previously validated will be validated again after banning one operation. *) let oph_list_equal l1 l2 = Int.equal (List.compare_lengths l1 l2) 0 && List.for_all (fun x -> List.mem x l2) l1 && List.for_all (fun x -> List.mem x l1) l2 -(** Gets the list of hashes of the mempool's applied operations, +(** Gets the list of hashes of the mempool's validated operations, and asserts that it is equal to the given list [expected_ophs]. *) -let check_applied_ophs_is client expected_ophs = - let* ophs = get_applied_operation_hash_list client in +let check_validated_ophs_is client expected_ophs = + let* ophs = get_validated_operation_hash_list client in if oph_list_equal ophs expected_ophs then ( - Log.info "Checking applied operations in mempool:" ; + Log.info "Checking validated operations in mempool:" ; List.iter (Log.info "- %s") ophs ; unit) else ( - Log.info "Expected applied operations:" ; + Log.info "Expected validated operations:" ; List.iter (Log.info "- %s") expected_ophs ; - Log.info "Actual applied operations:" ; + Log.info "Actual validated operations:" ; List.iter (Log.info "- %s") ophs ; Test.fail - "Wrong list of applied operations in mempool (use --info to see expected \ - and actual lists).") + "Wrong list of validated operations in mempool (use --info to see \ + expected and actual lists).") (** Test. - Aim: check that, when banning an operation that was applied in the - mempool, the other applied operations are correctly reapplied (in + Aim: check that, when banning an operation that was validated in the + mempool, the other validated operations are correctly revalidated (in the same order). Scenario: @@ -3215,16 +3216,16 @@ let check_applied_ophs_is client expected_ophs = - Step 2: Inject five operations (transfers from five different sources, injected by both nodes in alternance). - Step 3: Ban one of these operations from node_1 (arbitrarily, the third - in the list of applied operations in the mempool of node_1). - - Step 4: Check that applied operations in node_1 are still applied + in the list of validated operations in the mempool of node_1). + - Step 4: Check that validated operations in node_1 are still validated Note: the chosen operations are commutative, so that none of them - becomes branch_delayed instead of applied when one of them is banned. + becomes branch_delayed instead of validated when one of them is banned. *) -let ban_operation_and_check_applied = +let ban_operation_and_check_validated = Protocol.register_test ~__FILE__ - ~title:"mempool ban operation and check applied" + ~title:"mempool ban operation and check validated" ~tags:["mempool"; "node"] @@ fun protocol -> Log.info "Step 1: Start two nodes, connect them, activate the protocol." ; @@ -3285,27 +3286,28 @@ let ban_operation_and_check_applied = in Log.info "Step 3: Ban one of these operations from node_1 (arbitrarily, the third \ - in the list of applied operations in the mempool of node_1)." ; - let* applied_ophs = get_and_log_applied client_1 in - if not (Int.equal (List.compare_length_with applied_ophs 5) 0) then + in the list of validated operations in the mempool of node_1)." ; + let* validated_ophs = get_and_log_validated client_1 in + if not (Int.equal (List.compare_length_with validated_ophs 5) 0) then (* This could theoretically happen: we wait for each transfer to be present in the mempool as "pending", but not to be classified - as "applied". In practice, this does not seem to be a problem. *) + as "validated". In practice, this does not seem to be a problem. *) Test.fail - "Found only %d applied operations in node_1, expected 5." - (List.length applied_ophs) ; - let oph_to_ban = List.nth applied_ophs 2 in + "Found only %d validated operations in node_1, expected 5." + (List.length validated_ophs) ; + let oph_to_ban = List.nth validated_ophs 2 in Log.info "Operation to ban: %s" oph_to_ban ; let* _ = Client.RPC.call client_1 @@ RPC.post_chain_mempool_ban_operation ~data:(Data (`String oph_to_ban)) () in Log.info "Operation %s is now banned." oph_to_ban ; - Log.info "Step 4: Check that applied operations in node_1 are still applied." ; - let expected_reapplied_ophs = - List.filter (fun oph -> not (String.equal oph_to_ban oph)) applied_ophs + Log.info + "Step 4: Check that validated operations in node_1 are still validated." ; + let expected_revalidated_ophs = + List.filter (fun oph -> not (String.equal oph_to_ban oph)) validated_ophs in - let* () = check_applied_ophs_is client_1 expected_reapplied_ophs in + let* () = check_validated_ophs_is client_1 expected_revalidated_ophs in unit (** Waits for an event in [node] signaling the arrival in the mempool @@ -3334,13 +3336,13 @@ let set_filter_no_fee_requirement = ~minimal_nanotez_per_gas_unit:(0, 1) ~minimal_nanotez_per_byte:(0, 1) -(** Checks that arguments [applied] and [refused] are the number of operations +(** Checks that arguments [validated] and [refused] are the number of operations in the mempool of [client] with the corresponding classification, that both sets of operations are disjoint, and that there is no [branch_delayed], [branch_refused], or [unprocessed] operation. - If [log] is [true], also logs the hash and fee of all applied + If [log] is [true], also logs the hash and fee of all validated and refused operations. *) -let check_mempool_ops ?(log = false) client ~applied ~refused = +let check_mempool_ops ?(log = false) client ~validated ~refused = let name = Client.name client in let log_op = if log then fun classification hash fee -> @@ -3356,7 +3358,7 @@ let check_mempool_ops ?(log = false) client ~applied ~refused = Client.RPC.call client @@ RPC.get_chain_mempool_pending_operations () in let open JSON in - (* get (and log) applied and refused operations *) + (* get (and log) validated and refused operations *) let get_ophs_and_log_fees classification = List.map (fun op -> @@ -3365,15 +3367,15 @@ let check_mempool_ops ?(log = false) client ~applied ~refused = oph) (ops |-> classification |> as_list) in - let applied_ophs = get_ophs_and_log_fees "applied" in + let validated_ophs = get_ophs_and_log_fees "validated" in let refused_ophs = get_ophs_and_log_fees "refused" in - (* various checks about applied and refused operations *) + (* various checks about validated and refused operations *) Check.( (* Not using [List.compare_length_with] allows for a more informative error message. The lists are expected to be short anyway. *) - (List.length applied_ophs = applied) + (List.length validated_ophs = validated) int - ~error_msg:(name ^ ": found %L applied operation(s), expected %R.")) ; + ~error_msg:(name ^ ": found %L validated operation(s), expected %R.")) ; Check.( (List.length refused_ophs = refused) int @@ -3381,8 +3383,8 @@ let check_mempool_ops ?(log = false) client ~applied ~refused = List.iter (fun oph -> if List.mem oph refused_ophs then - Test.fail "%s: operation %s is both applied and refused" name oph) - applied_ophs ; + Test.fail "%s: operation %s is both validated and refused" name oph) + validated_ophs ; (* check that other classifications are empty *) List.iter (fun classification -> @@ -3440,15 +3442,15 @@ let iter2_p f l1 l2 = Lwt.join (List.map2 f l1 l2) - Step 2: In [node2]'s mempool filter configuration, set all fields [minimal_*] to 0, so that [node2] accepts operations with any fee. - Step 3: Inject two operations (transfers) in [node2] with respective - fees 1000 and 10 mutez. Check that both operations are [applied] in + fees 1000 and 10 mutez. Check that both operations are [validated] in [node2]'s mempool. - Step 4: Bake with an empty mempool for [node1] to force synchronization - with [node2]. Check that the mempool of [node1] has one applied and one + with [node2]. Check that the mempool of [node1] has one validated and one refused operation. Indeed, [node1] has the default filter config with [minimal_fees] at 100 mutez. - Step 5: In [node1]'s mempool filter configuration, set all fields [minimal_*] to 0. Inject a new operation with fee 5 in [node2], then - bake with an empty mempool. Check that [node1] contains two applied + bake with an empty mempool. Check that [node1] contains two validated operations (the ones with fee 1000 and 5) and one refused operation. Indeed, the operation with fee 10 would now be valid, but it has already been refused so it must not be revalidated. @@ -3458,13 +3460,13 @@ let iter2_p f l1 l2 = Lwt.join (List.map2 f l1 l2) filter used to determine which operations are included in the block does not share its configuration with the mempool's filter, so only the operation of fee 1000 is included. Check that [node1] contains one - applied operation (fee 5) and one refused operation (fee 10), and that - [node2] contains two applied operations. *) + validated operation (fee 5) and one refused operation (fee 10), and that + [node2] contains two validated operations. *) let test_do_not_reclassify = Protocol.register_test ~__FILE__ ~title:"mempool do not reclassify" - ~tags:["mempool"; "node"; "filter"; "refused"; "applied"] + ~tags:["mempool"; "node"; "filter"; "refused"; "validated"] @@ fun protocol -> let step_color = Log.Color.BG.blue in Log.info @@ -3491,8 +3493,8 @@ let test_do_not_reclassify = Log.info ~color:step_color "Step 3: Inject two operations (transfers) in [node2] with respective fees \ - 1000 and 10 mutez. Check that both operations are [applied] in [node2]'s \ - mempool." ; + 1000 and 10 mutez. Check that both operations are [validated] in \ + [node2]'s mempool." ; let waiter_arrival_node1 = wait_for_arrival node1 in let inject_transfer from_key ~fee = let waiter = wait_for_injection node2 in @@ -3513,26 +3515,26 @@ let test_do_not_reclassify = Log.info "Injected transfers in node2 with fees: %s." (String.concat "; " (List.map Int.to_string fees)) ; - let* () = check_mempool_ops ~log:true client2 ~applied:2 ~refused:0 in + let* () = check_mempool_ops ~log:true client2 ~validated:2 ~refused:0 in Log.info ~color:step_color "Step 4: Bake with an empty mempool for [node1] to force synchronization \ - with [node2]. Check that the mempool of [node1] has one applied and one \ + with [node2]. Check that the mempool of [node1] has one validated and one \ refused operation. Indeed, [node1] has the default filter config with \ [minimal_fees] at 100 mutez." ; let* () = bake_empty_block_and_wait_for_flush ~protocol ~log:true client1 node1 in let* () = waiter_arrival_node1 in - let* () = check_mempool_ops ~log:true client1 ~applied:1 ~refused:1 in + let* () = check_mempool_ops ~log:true client1 ~validated:1 ~refused:1 in Log.info ~color:step_color "Step 5: In [node1]'s mempool filter configuration, set all fields \ [minimal_*] to 0. Inject a new operation with fee 5 in [node2], then bake \ - with an empty mempool. Check that [node1] contains two applied operations \ - (the ones with fee 1000 and 5) and one refused operation. Indeed, the \ - operation with fee 10 would now be valid, but it has already been refused \ - so it must not be revalidated." ; + with an empty mempool. Check that [node1] contains two validated \ + operations (the ones with fee 1000 and 5) and one refused operation. \ + Indeed, the operation with fee 10 would now be valid, but it has already \ + been refused so it must not be revalidated." ; let* _ = set_filter_no_fee_requirement client1 in let* () = inject_transfer Constant.bootstrap3 ~fee:5 in let waiter_notify_3_valid_ops = wait_for_notify_n_valid_ops node1 3 in @@ -3540,10 +3542,10 @@ let test_do_not_reclassify = bake_empty_block_and_wait_for_flush ~protocol ~log:true client1 node1 in (* Wait for [node1] to receive a mempool containing 3 operations (the - number of [applied] operations in [node2]), among which will figure + number of [validated] operations in [node2]), among which will figure the operation with fee 10 that has already been [refused] in [node1]. *) let* () = waiter_notify_3_valid_ops in - let* () = check_mempool_ops ~log:true client1 ~applied:2 ~refused:1 in + let* () = check_mempool_ops ~log:true client1 ~validated:2 ~refused:1 in Log.info ~color:step_color "Step 6: Bake for [node1] (normally, i.e. without enforcing a given \ @@ -3552,12 +3554,12 @@ let test_do_not_reclassify = filter used to determine which operations are included in the block does \ not share its configuration with the mempool's filter, so only the \ operation of fee 1000 is included. Check that [node1] contains one \ - applied operation (fee 5) and one refused operation (fee 10), and that \ - [node2] contains 2 applied operations." ; + validated operation (fee 5) and one refused operation (fee 10), and that \ + [node2] contains 2 validated operations." ; let* () = bake_wait_log ~protocol node1 client1 in let* () = check_n_manager_ops_in_block ~log:true client1 1 in - let* () = check_mempool_ops ~log:true client1 ~applied:1 ~refused:1 in - let* () = check_mempool_ops ~log:true client2 ~applied:2 ~refused:0 in + let* () = check_mempool_ops ~log:true client1 ~validated:1 ~refused:1 in + let* () = check_mempool_ops ~log:true client2 ~validated:2 ~refused:0 in unit let get_refused_operation_hash_list_v0 mempool = @@ -3892,10 +3894,10 @@ let test_request_operations_peer = in let* _ = transfer_1 in let* oph = - let* ophs = get_applied_operation_hash_list client_1 in + let* ophs = get_validated_operation_hash_list client_1 in match ophs with | [oph] -> return oph - | _ -> Test.fail "Applied mempool should contain exactly one operation" + | _ -> Test.fail "Validated mempool should contain exactly one operation" in Log.info "%s" step4_msg ; let wait_mempool = wait_for_arrival_of_ophash oph node_2 in @@ -3937,7 +3939,7 @@ let register ~protocols = Revamped.test_mempool_config_operation_filtering protocols ; forge_pre_filtered_operation protocols ; refetch_failed_operation protocols ; - ban_operation_and_check_applied protocols ; + ban_operation_and_check_validated protocols ; test_do_not_reclassify protocols ; test_pending_operation_version protocols ; force_operation_injection protocols ; diff --git a/tezt/tests/stresstest_command.ml b/tezt/tests/stresstest_command.ml index da1866e26802..d935fe0e4f31 100644 --- a/tezt/tests/stresstest_command.ml +++ b/tezt/tests/stresstest_command.ml @@ -49,19 +49,19 @@ let wait_for_n_injections n node = do not expect to terminate. *) let non_terminating_process (_process : Process.t) = () -(** Check that the mempool contains [n] applied operations. Also - return these applied operations (which will usually be transactions +(** Check that the mempool contains [n] validated operations. Also + return these validated operations (which will usually be transactions injected by the transfer command). *) -let check_n_applied_operations_in_mempool n client = +let check_n_validated_operations_in_mempool n client = let* mempool_ops = Client.RPC.call client @@ RPC.get_chain_mempool_pending_operations () in - let applied_ops = JSON.(mempool_ops |-> "applied" |> as_list) in + let validated_ops = JSON.(mempool_ops |-> "validated" |> as_list) in Check.( - (List.length applied_ops = n) + (List.length validated_ops = n) int - ~error_msg:"Found %L applied operations in the mempool; expected %R.") ; - return applied_ops + ~error_msg:"Found %L validated operations in the mempool; expected %R.") ; + return validated_ops (** Check that the head block contains [n] manager operations. Also return these manager operations (which will usually be transactions @@ -82,7 +82,7 @@ let check_n_manager_operations_in_head n client = More precisely, this test checks that: - After letting the [stresstest] command run for a while on a - given head, the mempool contains exactly one applied operation by + given head, the mempool contains exactly one validated operation by each source account provided to the command. The same goes for manager operations included in the next baked block. (Note that this is true in a minimalist context where no operation injection @@ -211,7 +211,7 @@ let test_stresstest_sources_format = operations (check that they number [n_bootstraps_to_use] and the set of their sources is [expected_pkhs]). - Wait for [n_bootstraps_to_use] injections. - - Inspect the mempool's applied operations (check that they + - Inspect the mempool's validated operations (check that they number [n_bootstraps_to_use] and the set of their sources is [expected_pkhs]). *) let rec loop ~first_iteration ~repeat = @@ -254,7 +254,7 @@ let test_stresstest_sources_format = it [repeat] times. *) let* () = Lwt_unix.sleep 5. in let* ops = - check_n_applied_operations_in_mempool n_bootstraps_to_use client + check_n_validated_operations_in_mempool n_bootstraps_to_use client in check_pkhs ops ; if repeat <= 1 then unit @@ -265,7 +265,7 @@ let test_stresstest_sources_format = (** Run the [stresstest] command in an isolated node with an explicit parameter [transfers], that makes it stop after injecting this number of transfers. Then check that the mempool contains this many - applied operations, and bake a block and check that it also + validated operations, and bake a block and check that it also contains the same number of manager operations. *) let test_stresstest_n_transfers = Protocol.register_test @@ -293,7 +293,7 @@ let test_stresstest_n_transfers = (* Bake some blocks to reach required level for stresstest command. *) let* () = repeat 2 (fun () -> Client.bake_for_and_wait client) in let* () = Client.stresstest ~transfers:n_transfers ~source_aliases client in - let* _ = check_n_applied_operations_in_mempool n_transfers client in + let* _ = check_n_validated_operations_in_mempool n_transfers client in let* () = Client.bake_for_and_wait client in let* _ = check_n_manager_operations_in_head n_transfers client in unit @@ -323,7 +323,7 @@ let wait_for_n_arrivals n node = We check that after the initial command calls and after each subsequent baking, the mempool of the central node eventually - contains [n_nodes * n_bootstraps_per_node] applied operations. We + contains [n_nodes * n_bootstraps_per_node] validated operations. We also check that the baked blocks contain the same number of manager operations. *) let test_stresstest_multiple_nodes = @@ -439,7 +439,7 @@ let test_stresstest_multiple_nodes = for it [repeat] times. *) let* () = Lwt_unix.sleep 5. in let* _ = - check_n_applied_operations_in_mempool n_bootstraps_total central_client + check_n_validated_operations_in_mempool n_bootstraps_total central_client in if repeat <= 1 then unit else loop ~first_iteration:false ~repeat:(repeat - 1) diff --git a/tezt/tests/tenderbake.ml b/tezt/tests/tenderbake.ml index a7975710e009..f173400cf704 100644 --- a/tezt/tests/tenderbake.ml +++ b/tezt/tests/tenderbake.ml @@ -283,7 +283,7 @@ let test_manual_bake = in let op_hashes = JSON.( - pending_ops |-> "applied" |> as_list + pending_ops |-> "validated" |> as_list |> List.map (fun op -> op |-> "hash" |> as_string)) in Check.(list_mem string) -- GitLab From f486af2182a47f6c3a759384e3fd56adfd10739e Mon Sep 17 00:00:00 2001 From: Albin Coquereau Date: Mon, 4 Sep 2023 10:27:41 +0200 Subject: [PATCH 3/6] tezt/tests: adapt rpc regression tests --- tezt/tests/RPC_test.ml | 2 +- .../Alpha- (mode client) RPC regression tests- mempool.out | 4 ++-- .../Alpha- (mode proxy) RPC regression tests- mempool.out | 4 ++-- .../Nairobi- (mode client) RPC regression tests- mempool.out | 4 ++-- .../Nairobi- (mode proxy) RPC regression tests- mempool.out | 4 ++-- .../Oxford- (mode client) RPC regression tests- mempool.out | 4 ++-- .../Oxford- (mode proxy) RPC regression tests- mempool.out | 4 ++-- 7 files changed, 13 insertions(+), 13 deletions(-) diff --git a/tezt/tests/RPC_test.ml b/tezt/tests/RPC_test.ml index 6bbf2c44d8be..9a80b2ce6907 100644 --- a/tezt/tests/RPC_test.ml +++ b/tezt/tests/RPC_test.ml @@ -867,7 +867,7 @@ let test_mempool _test_mode_tag protocol ?endpoint client = (* To test the monitor_operations rpc we use curl since the client does not support streaming RPCs yet. *) sf - "http://%s:%d/chains/main/mempool/monitor_operations?applied=true&outdated=true&branch_delayed=true&refused=true&branch_refused=true" + "http://%s:%d/chains/main/mempool/monitor_operations?validated=true&outdated=true&branch_delayed=true&refused=true&branch_refused=true" Constant.default_host (get_client_port client) in diff --git a/tezt/tests/expected/RPC_test.ml/Alpha- (mode client) RPC regression tests- mempool.out b/tezt/tests/expected/RPC_test.ml/Alpha- (mode client) RPC regression tests- mempool.out index 405f1d617917..b2caa8cd97fe 100644 --- a/tezt/tests/expected/RPC_test.ml/Alpha- (mode client) RPC regression tests- mempool.out +++ b/tezt/tests/expected/RPC_test.ml/Alpha- (mode client) RPC regression tests- mempool.out @@ -1,5 +1,5 @@ -curl -s 'http://[HOST]:[PORT]/chains/main/mempool/monitor_operations?applied=true&outdated=true&branch_delayed=true&refused=true&branch_refused=true' +curl -s 'http://[HOST]:[PORT]/chains/main/mempool/monitor_operations?validated=true&outdated=true&branch_delayed=true&refused=true&branch_refused=true' [] [{"hash":"[OPERATION_HASH]","protocol":"ProtoALphaALphaALphaALphaALphaALphaALphaALphaDdp3zK","branch":"[BRANCH_HASH]","contents":[{"kind":"transaction","source":"[PUBLIC_KEY_HASH]","fee":"1000","counter":"1","gas_limit":"1040","storage_limit":"257","amount":"1000000","destination":"[PUBLIC_KEY_HASH]"}],"signature":"[SIGNATURE]","error":[{"kind":"branch","id":"proto.alpha.contract.counter_in_the_past","contract":"[PUBLIC_KEY_HASH]","expected":"2","found":"1"}]}] [{"hash":"[OPERATION_HASH]","protocol":"ProtoALphaALphaALphaALphaALphaALphaALphaALphaDdp3zK","branch":"[BRANCH_HASH]","contents":[{"kind":"transaction","source":"[PUBLIC_KEY_HASH]","fee":"1000","counter":"5","gas_limit":"1040","storage_limit":"257","amount":"1000000","destination":"[PUBLIC_KEY_HASH]"}],"signature":"[SIGNATURE]","error":[{"kind":"temporary","id":"proto.alpha.contract.counter_in_the_future","contract":"[PUBLIC_KEY_HASH]","expected":"1","found":"5"}]}] @@ -283,7 +283,7 @@ curl -s 'http://[HOST]:[PORT]/chains/main/mempool/monitor_operations?applied=tru { "validated": [], "refused": [], "outdated": [], "branch_refused": [], "branch_delayed": [], "unprocessed": [] } -curl -s 'http://[HOST]:[PORT]/chains/main/mempool/monitor_operations?applied=true&outdated=true&branch_delayed=true&refused=true&branch_refused=true' +curl -s 'http://[HOST]:[PORT]/chains/main/mempool/monitor_operations?validated=true&outdated=true&branch_delayed=true&refused=true&branch_refused=true' [{"hash":"[OPERATION_HASH]","protocol":"ProtoALphaALphaALphaALphaALphaALphaALphaALphaDdp3zK","branch":"[BRANCH_HASH]","contents":[{"kind":"transaction","source":"[PUBLIC_KEY_HASH]","fee":"1000","counter":"1","gas_limit":"1040","storage_limit":"257","amount":"1000000","destination":"[PUBLIC_KEY_HASH]"}],"signature":"[SIGNATURE]"},{"hash":"[OPERATION_HASH]","protocol":"ProtoALphaALphaALphaALphaALphaALphaALphaALphaDdp3zK","branch":"[BRANCH_HASH]","contents":[{"kind":"transaction","source":"[PUBLIC_KEY_HASH]","fee":"0","counter":"1","gas_limit":"1040","storage_limit":"257","amount":"1000000","destination":"[PUBLIC_KEY_HASH]"}],"signature":"[SIGNATURE]","error":[{"kind":"permanent","id":"proto.alpha.prefilter.fees_too_low"}]},{"hash":"[OPERATION_HASH]","protocol":"ProtoALphaALphaALphaALphaALphaALphaALphaALphaDdp3zK","branch":"[BRANCH_HASH]","contents":[{"kind":"transaction","source":"[PUBLIC_KEY_HASH]","fee":"1000","counter":"1","gas_limit":"1040","storage_limit":"257","amount":"1000000","destination":"[PUBLIC_KEY_HASH]"}],"signature":"[SIGNATURE]","error":[{"kind":"branch","id":"proto.alpha.contract.counter_in_the_past","contract":"[PUBLIC_KEY_HASH]","expected":"2","found":"1"}]},{"hash":"[OPERATION_HASH]","protocol":"ProtoALphaALphaALphaALphaALphaALphaALphaALphaDdp3zK","branch":"[BRANCH_HASH]","contents":[{"kind":"transaction","source":"[PUBLIC_KEY_HASH]","fee":"1000","counter":"5","gas_limit":"1040","storage_limit":"257","amount":"1000000","destination":"[PUBLIC_KEY_HASH]"}],"signature":"[SIGNATURE]","error":[{"kind":"temporary","id":"proto.alpha.contract.counter_in_the_future","contract":"[PUBLIC_KEY_HASH]","expected":"1","found":"5"}]}] ./octez-client rpc get /chains/main/mempool/filter diff --git a/tezt/tests/expected/RPC_test.ml/Alpha- (mode proxy) RPC regression tests- mempool.out b/tezt/tests/expected/RPC_test.ml/Alpha- (mode proxy) RPC regression tests- mempool.out index 07b0328af266..2ff9604eff07 100644 --- a/tezt/tests/expected/RPC_test.ml/Alpha- (mode proxy) RPC regression tests- mempool.out +++ b/tezt/tests/expected/RPC_test.ml/Alpha- (mode proxy) RPC regression tests- mempool.out @@ -1,5 +1,5 @@ -curl -s 'http://[HOST]:[PORT]/chains/main/mempool/monitor_operations?applied=true&outdated=true&branch_delayed=true&refused=true&branch_refused=true' +curl -s 'http://[HOST]:[PORT]/chains/main/mempool/monitor_operations?validated=true&outdated=true&branch_delayed=true&refused=true&branch_refused=true' [] [{"hash":"[OPERATION_HASH]","protocol":"ProtoALphaALphaALphaALphaALphaALphaALphaALphaDdp3zK","branch":"[BRANCH_HASH]","contents":[{"kind":"transaction","source":"[PUBLIC_KEY_HASH]","fee":"1000","counter":"1","gas_limit":"1040","storage_limit":"257","amount":"1000000","destination":"[PUBLIC_KEY_HASH]"}],"signature":"[SIGNATURE]","error":[{"kind":"branch","id":"proto.alpha.contract.counter_in_the_past","contract":"[PUBLIC_KEY_HASH]","expected":"2","found":"1"}]}] [{"hash":"[OPERATION_HASH]","protocol":"ProtoALphaALphaALphaALphaALphaALphaALphaALphaDdp3zK","branch":"[BRANCH_HASH]","contents":[{"kind":"transaction","source":"[PUBLIC_KEY_HASH]","fee":"1000","counter":"5","gas_limit":"1040","storage_limit":"257","amount":"1000000","destination":"[PUBLIC_KEY_HASH]"}],"signature":"[SIGNATURE]","error":[{"kind":"temporary","id":"proto.alpha.contract.counter_in_the_future","contract":"[PUBLIC_KEY_HASH]","expected":"1","found":"5"}]}] @@ -283,7 +283,7 @@ curl -s 'http://[HOST]:[PORT]/chains/main/mempool/monitor_operations?applied=tru { "validated": [], "refused": [], "outdated": [], "branch_refused": [], "branch_delayed": [], "unprocessed": [] } -curl -s 'http://[HOST]:[PORT]/chains/main/mempool/monitor_operations?applied=true&outdated=true&branch_delayed=true&refused=true&branch_refused=true' +curl -s 'http://[HOST]:[PORT]/chains/main/mempool/monitor_operations?validated=true&outdated=true&branch_delayed=true&refused=true&branch_refused=true' [{"hash":"[OPERATION_HASH]","protocol":"ProtoALphaALphaALphaALphaALphaALphaALphaALphaDdp3zK","branch":"[BRANCH_HASH]","contents":[{"kind":"transaction","source":"[PUBLIC_KEY_HASH]","fee":"1000","counter":"1","gas_limit":"1040","storage_limit":"257","amount":"1000000","destination":"[PUBLIC_KEY_HASH]"}],"signature":"[SIGNATURE]"},{"hash":"[OPERATION_HASH]","protocol":"ProtoALphaALphaALphaALphaALphaALphaALphaALphaDdp3zK","branch":"[BRANCH_HASH]","contents":[{"kind":"transaction","source":"[PUBLIC_KEY_HASH]","fee":"0","counter":"1","gas_limit":"1040","storage_limit":"257","amount":"1000000","destination":"[PUBLIC_KEY_HASH]"}],"signature":"[SIGNATURE]","error":[{"kind":"permanent","id":"proto.alpha.prefilter.fees_too_low"}]},{"hash":"[OPERATION_HASH]","protocol":"ProtoALphaALphaALphaALphaALphaALphaALphaALphaDdp3zK","branch":"[BRANCH_HASH]","contents":[{"kind":"transaction","source":"[PUBLIC_KEY_HASH]","fee":"1000","counter":"1","gas_limit":"1040","storage_limit":"257","amount":"1000000","destination":"[PUBLIC_KEY_HASH]"}],"signature":"[SIGNATURE]","error":[{"kind":"branch","id":"proto.alpha.contract.counter_in_the_past","contract":"[PUBLIC_KEY_HASH]","expected":"2","found":"1"}]},{"hash":"[OPERATION_HASH]","protocol":"ProtoALphaALphaALphaALphaALphaALphaALphaALphaDdp3zK","branch":"[BRANCH_HASH]","contents":[{"kind":"transaction","source":"[PUBLIC_KEY_HASH]","fee":"1000","counter":"5","gas_limit":"1040","storage_limit":"257","amount":"1000000","destination":"[PUBLIC_KEY_HASH]"}],"signature":"[SIGNATURE]","error":[{"kind":"temporary","id":"proto.alpha.contract.counter_in_the_future","contract":"[PUBLIC_KEY_HASH]","expected":"1","found":"5"}]}] ./octez-client --mode proxy rpc get /chains/main/mempool/filter diff --git a/tezt/tests/expected/RPC_test.ml/Nairobi- (mode client) RPC regression tests- mempool.out b/tezt/tests/expected/RPC_test.ml/Nairobi- (mode client) RPC regression tests- mempool.out index dcc1ed708baf..cba290552cde 100644 --- a/tezt/tests/expected/RPC_test.ml/Nairobi- (mode client) RPC regression tests- mempool.out +++ b/tezt/tests/expected/RPC_test.ml/Nairobi- (mode client) RPC regression tests- mempool.out @@ -1,5 +1,5 @@ -curl -s 'http://[HOST]:[PORT]/chains/main/mempool/monitor_operations?applied=true&outdated=true&branch_delayed=true&refused=true&branch_refused=true' +curl -s 'http://[HOST]:[PORT]/chains/main/mempool/monitor_operations?validated=true&outdated=true&branch_delayed=true&refused=true&branch_refused=true' [] [{"hash":"[OPERATION_HASH]","protocol":"PtNairobiyssHuh87hEhfVBGCVrK3WnS8Z2FT4ymB5tAa4r1nQf","branch":"[BRANCH_HASH]","contents":[{"kind":"transaction","source":"[PUBLIC_KEY_HASH]","fee":"1000","counter":"1","gas_limit":"1040","storage_limit":"257","amount":"1000000","destination":"[PUBLIC_KEY_HASH]"}],"signature":"[SIGNATURE]","error":[{"kind":"branch","id":"proto.017-PtNairob.contract.counter_in_the_past","contract":"[PUBLIC_KEY_HASH]","expected":"2","found":"1"}]}] [{"hash":"[OPERATION_HASH]","protocol":"PtNairobiyssHuh87hEhfVBGCVrK3WnS8Z2FT4ymB5tAa4r1nQf","branch":"[BRANCH_HASH]","contents":[{"kind":"transaction","source":"[PUBLIC_KEY_HASH]","fee":"1000","counter":"5","gas_limit":"1040","storage_limit":"257","amount":"1000000","destination":"[PUBLIC_KEY_HASH]"}],"signature":"[SIGNATURE]","error":[{"kind":"temporary","id":"proto.017-PtNairob.contract.counter_in_the_future","contract":"[PUBLIC_KEY_HASH]","expected":"1","found":"5"}]}] @@ -283,7 +283,7 @@ curl -s 'http://[HOST]:[PORT]/chains/main/mempool/monitor_operations?applied=tru { "validated": [], "refused": [], "outdated": [], "branch_refused": [], "branch_delayed": [], "unprocessed": [] } -curl -s 'http://[HOST]:[PORT]/chains/main/mempool/monitor_operations?applied=true&outdated=true&branch_delayed=true&refused=true&branch_refused=true' +curl -s 'http://[HOST]:[PORT]/chains/main/mempool/monitor_operations?validated=true&outdated=true&branch_delayed=true&refused=true&branch_refused=true' [{"hash":"[OPERATION_HASH]","protocol":"PtNairobiyssHuh87hEhfVBGCVrK3WnS8Z2FT4ymB5tAa4r1nQf","branch":"[BRANCH_HASH]","contents":[{"kind":"transaction","source":"[PUBLIC_KEY_HASH]","fee":"1000","counter":"1","gas_limit":"1040","storage_limit":"257","amount":"1000000","destination":"[PUBLIC_KEY_HASH]"}],"signature":"[SIGNATURE]"},{"hash":"[OPERATION_HASH]","protocol":"PtNairobiyssHuh87hEhfVBGCVrK3WnS8Z2FT4ymB5tAa4r1nQf","branch":"[BRANCH_HASH]","contents":[{"kind":"transaction","source":"[PUBLIC_KEY_HASH]","fee":"0","counter":"1","gas_limit":"1040","storage_limit":"257","amount":"1000000","destination":"[PUBLIC_KEY_HASH]"}],"signature":"[SIGNATURE]","error":[{"kind":"permanent","id":"proto.017-PtNairob.prefilter.fees_too_low"}]},{"hash":"[OPERATION_HASH]","protocol":"PtNairobiyssHuh87hEhfVBGCVrK3WnS8Z2FT4ymB5tAa4r1nQf","branch":"[BRANCH_HASH]","contents":[{"kind":"transaction","source":"[PUBLIC_KEY_HASH]","fee":"1000","counter":"1","gas_limit":"1040","storage_limit":"257","amount":"1000000","destination":"[PUBLIC_KEY_HASH]"}],"signature":"[SIGNATURE]","error":[{"kind":"branch","id":"proto.017-PtNairob.contract.counter_in_the_past","contract":"[PUBLIC_KEY_HASH]","expected":"2","found":"1"}]},{"hash":"[OPERATION_HASH]","protocol":"PtNairobiyssHuh87hEhfVBGCVrK3WnS8Z2FT4ymB5tAa4r1nQf","branch":"[BRANCH_HASH]","contents":[{"kind":"transaction","source":"[PUBLIC_KEY_HASH]","fee":"1000","counter":"5","gas_limit":"1040","storage_limit":"257","amount":"1000000","destination":"[PUBLIC_KEY_HASH]"}],"signature":"[SIGNATURE]","error":[{"kind":"temporary","id":"proto.017-PtNairob.contract.counter_in_the_future","contract":"[PUBLIC_KEY_HASH]","expected":"1","found":"5"}]}] ./octez-client rpc get /chains/main/mempool/filter diff --git a/tezt/tests/expected/RPC_test.ml/Nairobi- (mode proxy) RPC regression tests- mempool.out b/tezt/tests/expected/RPC_test.ml/Nairobi- (mode proxy) RPC regression tests- mempool.out index 727a5f78f6ef..f38919dc4c94 100644 --- a/tezt/tests/expected/RPC_test.ml/Nairobi- (mode proxy) RPC regression tests- mempool.out +++ b/tezt/tests/expected/RPC_test.ml/Nairobi- (mode proxy) RPC regression tests- mempool.out @@ -1,5 +1,5 @@ -curl -s 'http://[HOST]:[PORT]/chains/main/mempool/monitor_operations?applied=true&outdated=true&branch_delayed=true&refused=true&branch_refused=true' +curl -s 'http://[HOST]:[PORT]/chains/main/mempool/monitor_operations?validated=true&outdated=true&branch_delayed=true&refused=true&branch_refused=true' [] [{"hash":"[OPERATION_HASH]","protocol":"PtNairobiyssHuh87hEhfVBGCVrK3WnS8Z2FT4ymB5tAa4r1nQf","branch":"[BRANCH_HASH]","contents":[{"kind":"transaction","source":"[PUBLIC_KEY_HASH]","fee":"1000","counter":"1","gas_limit":"1040","storage_limit":"257","amount":"1000000","destination":"[PUBLIC_KEY_HASH]"}],"signature":"[SIGNATURE]","error":[{"kind":"branch","id":"proto.017-PtNairob.contract.counter_in_the_past","contract":"[PUBLIC_KEY_HASH]","expected":"2","found":"1"}]}] [{"hash":"[OPERATION_HASH]","protocol":"PtNairobiyssHuh87hEhfVBGCVrK3WnS8Z2FT4ymB5tAa4r1nQf","branch":"[BRANCH_HASH]","contents":[{"kind":"transaction","source":"[PUBLIC_KEY_HASH]","fee":"1000","counter":"5","gas_limit":"1040","storage_limit":"257","amount":"1000000","destination":"[PUBLIC_KEY_HASH]"}],"signature":"[SIGNATURE]","error":[{"kind":"temporary","id":"proto.017-PtNairob.contract.counter_in_the_future","contract":"[PUBLIC_KEY_HASH]","expected":"1","found":"5"}]}] @@ -283,7 +283,7 @@ curl -s 'http://[HOST]:[PORT]/chains/main/mempool/monitor_operations?applied=tru { "validated": [], "refused": [], "outdated": [], "branch_refused": [], "branch_delayed": [], "unprocessed": [] } -curl -s 'http://[HOST]:[PORT]/chains/main/mempool/monitor_operations?applied=true&outdated=true&branch_delayed=true&refused=true&branch_refused=true' +curl -s 'http://[HOST]:[PORT]/chains/main/mempool/monitor_operations?validated=true&outdated=true&branch_delayed=true&refused=true&branch_refused=true' [{"hash":"[OPERATION_HASH]","protocol":"PtNairobiyssHuh87hEhfVBGCVrK3WnS8Z2FT4ymB5tAa4r1nQf","branch":"[BRANCH_HASH]","contents":[{"kind":"transaction","source":"[PUBLIC_KEY_HASH]","fee":"1000","counter":"1","gas_limit":"1040","storage_limit":"257","amount":"1000000","destination":"[PUBLIC_KEY_HASH]"}],"signature":"[SIGNATURE]"},{"hash":"[OPERATION_HASH]","protocol":"PtNairobiyssHuh87hEhfVBGCVrK3WnS8Z2FT4ymB5tAa4r1nQf","branch":"[BRANCH_HASH]","contents":[{"kind":"transaction","source":"[PUBLIC_KEY_HASH]","fee":"0","counter":"1","gas_limit":"1040","storage_limit":"257","amount":"1000000","destination":"[PUBLIC_KEY_HASH]"}],"signature":"[SIGNATURE]","error":[{"kind":"permanent","id":"proto.017-PtNairob.prefilter.fees_too_low"}]},{"hash":"[OPERATION_HASH]","protocol":"PtNairobiyssHuh87hEhfVBGCVrK3WnS8Z2FT4ymB5tAa4r1nQf","branch":"[BRANCH_HASH]","contents":[{"kind":"transaction","source":"[PUBLIC_KEY_HASH]","fee":"1000","counter":"1","gas_limit":"1040","storage_limit":"257","amount":"1000000","destination":"[PUBLIC_KEY_HASH]"}],"signature":"[SIGNATURE]","error":[{"kind":"branch","id":"proto.017-PtNairob.contract.counter_in_the_past","contract":"[PUBLIC_KEY_HASH]","expected":"2","found":"1"}]},{"hash":"[OPERATION_HASH]","protocol":"PtNairobiyssHuh87hEhfVBGCVrK3WnS8Z2FT4ymB5tAa4r1nQf","branch":"[BRANCH_HASH]","contents":[{"kind":"transaction","source":"[PUBLIC_KEY_HASH]","fee":"1000","counter":"5","gas_limit":"1040","storage_limit":"257","amount":"1000000","destination":"[PUBLIC_KEY_HASH]"}],"signature":"[SIGNATURE]","error":[{"kind":"temporary","id":"proto.017-PtNairob.contract.counter_in_the_future","contract":"[PUBLIC_KEY_HASH]","expected":"1","found":"5"}]}] ./octez-client --mode proxy rpc get /chains/main/mempool/filter diff --git a/tezt/tests/expected/RPC_test.ml/Oxford- (mode client) RPC regression tests- mempool.out b/tezt/tests/expected/RPC_test.ml/Oxford- (mode client) RPC regression tests- mempool.out index 27a56fed8b7a..e6b255309a35 100644 --- a/tezt/tests/expected/RPC_test.ml/Oxford- (mode client) RPC regression tests- mempool.out +++ b/tezt/tests/expected/RPC_test.ml/Oxford- (mode client) RPC regression tests- mempool.out @@ -1,5 +1,5 @@ -curl -s 'http://[HOST]:[PORT]/chains/main/mempool/monitor_operations?applied=true&outdated=true&branch_delayed=true&refused=true&branch_refused=true' +curl -s 'http://[HOST]:[PORT]/chains/main/mempool/monitor_operations?validated=true&outdated=true&branch_delayed=true&refused=true&branch_refused=true' [] [{"hash":"[OPERATION_HASH]","protocol":"ProxfordYmVfjWnRcgjWH36fW6PArwqykTFzotUxRs6gmTcZDuH","branch":"[BRANCH_HASH]","contents":[{"kind":"transaction","source":"[PUBLIC_KEY_HASH]","fee":"1000","counter":"1","gas_limit":"1040","storage_limit":"257","amount":"1000000","destination":"[PUBLIC_KEY_HASH]"}],"signature":"[SIGNATURE]","error":[{"kind":"branch","id":"proto.018-Proxford.contract.counter_in_the_past","contract":"[PUBLIC_KEY_HASH]","expected":"2","found":"1"}]}] [{"hash":"[OPERATION_HASH]","protocol":"ProxfordYmVfjWnRcgjWH36fW6PArwqykTFzotUxRs6gmTcZDuH","branch":"[BRANCH_HASH]","contents":[{"kind":"transaction","source":"[PUBLIC_KEY_HASH]","fee":"1000","counter":"5","gas_limit":"1040","storage_limit":"257","amount":"1000000","destination":"[PUBLIC_KEY_HASH]"}],"signature":"[SIGNATURE]","error":[{"kind":"temporary","id":"proto.018-Proxford.contract.counter_in_the_future","contract":"[PUBLIC_KEY_HASH]","expected":"1","found":"5"}]}] @@ -283,7 +283,7 @@ curl -s 'http://[HOST]:[PORT]/chains/main/mempool/monitor_operations?applied=tru { "validated": [], "refused": [], "outdated": [], "branch_refused": [], "branch_delayed": [], "unprocessed": [] } -curl -s 'http://[HOST]:[PORT]/chains/main/mempool/monitor_operations?applied=true&outdated=true&branch_delayed=true&refused=true&branch_refused=true' +curl -s 'http://[HOST]:[PORT]/chains/main/mempool/monitor_operations?validated=true&outdated=true&branch_delayed=true&refused=true&branch_refused=true' [{"hash":"[OPERATION_HASH]","protocol":"ProxfordYmVfjWnRcgjWH36fW6PArwqykTFzotUxRs6gmTcZDuH","branch":"[BRANCH_HASH]","contents":[{"kind":"transaction","source":"[PUBLIC_KEY_HASH]","fee":"1000","counter":"1","gas_limit":"1040","storage_limit":"257","amount":"1000000","destination":"[PUBLIC_KEY_HASH]"}],"signature":"[SIGNATURE]"},{"hash":"[OPERATION_HASH]","protocol":"ProxfordYmVfjWnRcgjWH36fW6PArwqykTFzotUxRs6gmTcZDuH","branch":"[BRANCH_HASH]","contents":[{"kind":"transaction","source":"[PUBLIC_KEY_HASH]","fee":"0","counter":"1","gas_limit":"1040","storage_limit":"257","amount":"1000000","destination":"[PUBLIC_KEY_HASH]"}],"signature":"[SIGNATURE]","error":[{"kind":"permanent","id":"proto.018-Proxford.prefilter.fees_too_low"}]},{"hash":"[OPERATION_HASH]","protocol":"ProxfordYmVfjWnRcgjWH36fW6PArwqykTFzotUxRs6gmTcZDuH","branch":"[BRANCH_HASH]","contents":[{"kind":"transaction","source":"[PUBLIC_KEY_HASH]","fee":"1000","counter":"1","gas_limit":"1040","storage_limit":"257","amount":"1000000","destination":"[PUBLIC_KEY_HASH]"}],"signature":"[SIGNATURE]","error":[{"kind":"branch","id":"proto.018-Proxford.contract.counter_in_the_past","contract":"[PUBLIC_KEY_HASH]","expected":"2","found":"1"}]},{"hash":"[OPERATION_HASH]","protocol":"ProxfordYmVfjWnRcgjWH36fW6PArwqykTFzotUxRs6gmTcZDuH","branch":"[BRANCH_HASH]","contents":[{"kind":"transaction","source":"[PUBLIC_KEY_HASH]","fee":"1000","counter":"5","gas_limit":"1040","storage_limit":"257","amount":"1000000","destination":"[PUBLIC_KEY_HASH]"}],"signature":"[SIGNATURE]","error":[{"kind":"temporary","id":"proto.018-Proxford.contract.counter_in_the_future","contract":"[PUBLIC_KEY_HASH]","expected":"1","found":"5"}]}] ./octez-client rpc get /chains/main/mempool/filter diff --git a/tezt/tests/expected/RPC_test.ml/Oxford- (mode proxy) RPC regression tests- mempool.out b/tezt/tests/expected/RPC_test.ml/Oxford- (mode proxy) RPC regression tests- mempool.out index b93113d9c90a..1554b51f41d2 100644 --- a/tezt/tests/expected/RPC_test.ml/Oxford- (mode proxy) RPC regression tests- mempool.out +++ b/tezt/tests/expected/RPC_test.ml/Oxford- (mode proxy) RPC regression tests- mempool.out @@ -1,5 +1,5 @@ -curl -s 'http://[HOST]:[PORT]/chains/main/mempool/monitor_operations?applied=true&outdated=true&branch_delayed=true&refused=true&branch_refused=true' +curl -s 'http://[HOST]:[PORT]/chains/main/mempool/monitor_operations?validated=true&outdated=true&branch_delayed=true&refused=true&branch_refused=true' [] [{"hash":"[OPERATION_HASH]","protocol":"ProxfordYmVfjWnRcgjWH36fW6PArwqykTFzotUxRs6gmTcZDuH","branch":"[BRANCH_HASH]","contents":[{"kind":"transaction","source":"[PUBLIC_KEY_HASH]","fee":"1000","counter":"1","gas_limit":"1040","storage_limit":"257","amount":"1000000","destination":"[PUBLIC_KEY_HASH]"}],"signature":"[SIGNATURE]","error":[{"kind":"branch","id":"proto.018-Proxford.contract.counter_in_the_past","contract":"[PUBLIC_KEY_HASH]","expected":"2","found":"1"}]}] [{"hash":"[OPERATION_HASH]","protocol":"ProxfordYmVfjWnRcgjWH36fW6PArwqykTFzotUxRs6gmTcZDuH","branch":"[BRANCH_HASH]","contents":[{"kind":"transaction","source":"[PUBLIC_KEY_HASH]","fee":"1000","counter":"5","gas_limit":"1040","storage_limit":"257","amount":"1000000","destination":"[PUBLIC_KEY_HASH]"}],"signature":"[SIGNATURE]","error":[{"kind":"temporary","id":"proto.018-Proxford.contract.counter_in_the_future","contract":"[PUBLIC_KEY_HASH]","expected":"1","found":"5"}]}] @@ -283,7 +283,7 @@ curl -s 'http://[HOST]:[PORT]/chains/main/mempool/monitor_operations?applied=tru { "validated": [], "refused": [], "outdated": [], "branch_refused": [], "branch_delayed": [], "unprocessed": [] } -curl -s 'http://[HOST]:[PORT]/chains/main/mempool/monitor_operations?applied=true&outdated=true&branch_delayed=true&refused=true&branch_refused=true' +curl -s 'http://[HOST]:[PORT]/chains/main/mempool/monitor_operations?validated=true&outdated=true&branch_delayed=true&refused=true&branch_refused=true' [{"hash":"[OPERATION_HASH]","protocol":"ProxfordYmVfjWnRcgjWH36fW6PArwqykTFzotUxRs6gmTcZDuH","branch":"[BRANCH_HASH]","contents":[{"kind":"transaction","source":"[PUBLIC_KEY_HASH]","fee":"1000","counter":"1","gas_limit":"1040","storage_limit":"257","amount":"1000000","destination":"[PUBLIC_KEY_HASH]"}],"signature":"[SIGNATURE]"},{"hash":"[OPERATION_HASH]","protocol":"ProxfordYmVfjWnRcgjWH36fW6PArwqykTFzotUxRs6gmTcZDuH","branch":"[BRANCH_HASH]","contents":[{"kind":"transaction","source":"[PUBLIC_KEY_HASH]","fee":"0","counter":"1","gas_limit":"1040","storage_limit":"257","amount":"1000000","destination":"[PUBLIC_KEY_HASH]"}],"signature":"[SIGNATURE]","error":[{"kind":"permanent","id":"proto.018-Proxford.prefilter.fees_too_low"}]},{"hash":"[OPERATION_HASH]","protocol":"ProxfordYmVfjWnRcgjWH36fW6PArwqykTFzotUxRs6gmTcZDuH","branch":"[BRANCH_HASH]","contents":[{"kind":"transaction","source":"[PUBLIC_KEY_HASH]","fee":"1000","counter":"1","gas_limit":"1040","storage_limit":"257","amount":"1000000","destination":"[PUBLIC_KEY_HASH]"}],"signature":"[SIGNATURE]","error":[{"kind":"branch","id":"proto.018-Proxford.contract.counter_in_the_past","contract":"[PUBLIC_KEY_HASH]","expected":"2","found":"1"}]},{"hash":"[OPERATION_HASH]","protocol":"ProxfordYmVfjWnRcgjWH36fW6PArwqykTFzotUxRs6gmTcZDuH","branch":"[BRANCH_HASH]","contents":[{"kind":"transaction","source":"[PUBLIC_KEY_HASH]","fee":"1000","counter":"5","gas_limit":"1040","storage_limit":"257","amount":"1000000","destination":"[PUBLIC_KEY_HASH]"}],"signature":"[SIGNATURE]","error":[{"kind":"temporary","id":"proto.018-Proxford.contract.counter_in_the_future","contract":"[PUBLIC_KEY_HASH]","expected":"1","found":"5"}]}] ./octez-client --mode proxy rpc get /chains/main/mempool/filter -- GitLab From 49246470b9c52dcf6c06bf35956331d1acbf5e03 Mon Sep 17 00:00:00 2001 From: Albin Coquereau Date: Mon, 4 Sep 2023 14:08:34 +0200 Subject: [PATCH 4/6] lib_shell_services: remove old pending_operations version 0 --- src/lib_shell_services/block_services.ml | 90 ++---------------------- 1 file changed, 4 insertions(+), 86 deletions(-) diff --git a/src/lib_shell_services/block_services.ml b/src/lib_shell_services/block_services.ml index d9e144525fff..58d7a673bc63 100644 --- a/src/lib_shell_services/block_services.ml +++ b/src/lib_shell_services/block_services.ml @@ -1308,87 +1308,7 @@ module Make (Proto : PROTO) (Next_proto : PROTO) = struct unprocessed : Next_proto.operation Operation_hash.Map.t; } - let version_0_encoding = - conv - (fun { - validated; - refused; - outdated; - branch_refused; - branch_delayed; - unprocessed; - } -> - ( validated, - refused, - outdated, - branch_refused, - branch_delayed, - unprocessed )) - (fun ( validated, - refused, - outdated, - branch_refused, - branch_delayed, - unprocessed ) -> - { - validated; - refused; - outdated; - branch_refused; - branch_delayed; - unprocessed; - }) - (obj6 - (req - "applied" - (list - (conv - (fun (hash, (op : Next_proto.operation)) -> - ((hash, op.shell), op.protocol_data)) - (fun ((hash, shell), protocol_data) -> - (hash, {shell; protocol_data})) - (merge_objs - (merge_objs - (obj1 (req "hash" Operation_hash.encoding)) - (dynamic_size Operation.shell_header_encoding)) - (dynamic_size - Next_proto - .operation_data_encoding_with_legacy_attestation_name))))) - (req - "refused" - (Operation_hash.Map.encoding - (merge_objs - (dynamic_size - next_operation_encoding_with_legacy_attestation_name) - (obj1 (req "error" Tezos_rpc.Error.encoding))))) - (req - "outdated" - (Operation_hash.Map.encoding - (merge_objs - (dynamic_size - next_operation_encoding_with_legacy_attestation_name) - (obj1 (req "error" Tezos_rpc.Error.encoding))))) - (req - "branch_refused" - (Operation_hash.Map.encoding - (merge_objs - (dynamic_size - next_operation_encoding_with_legacy_attestation_name) - (obj1 (req "error" Tezos_rpc.Error.encoding))))) - (req - "branch_delayed" - (Operation_hash.Map.encoding - (merge_objs - (dynamic_size - next_operation_encoding_with_legacy_attestation_name) - (obj1 (req "error" Tezos_rpc.Error.encoding))))) - (req - "unprocessed" - (Operation_hash.Map.encoding - (dynamic_size - next_operation_encoding_with_legacy_attestation_name)))) - - let version_1_encoding ~use_legacy_name ~use_validated = + let pending_operations_encoding ~use_legacy_name ~use_validated = let next_operation_encoding = if use_legacy_name then next_operation_encoding_with_legacy_attestation_name @@ -1470,10 +1390,10 @@ module Make (Proto : PROTO) (Next_proto : PROTO) = struct next_operation_encoding))))) let version_2_encoding = - version_1_encoding ~use_legacy_name:false ~use_validated:true + pending_operations_encoding ~use_legacy_name:false ~use_validated:true let version_1_encoding = - version_1_encoding ~use_legacy_name:true ~use_validated:false + pending_operations_encoding ~use_legacy_name:true ~use_validated:false (* This encoding should be always the one by default. *) let encoding = version_1_encoding @@ -1482,7 +1402,6 @@ module Make (Proto : PROTO) (Next_proto : PROTO) = struct mk_version_informations ~supported: [ - version_0; {version = Version_1; use_legacy_attestation_name = true}; {version = Version_2; use_legacy_attestation_name = false}; ] @@ -1576,8 +1495,7 @@ module Make (Proto : PROTO) (Next_proto : PROTO) = struct encoding_versioning ~encoding_name:"pending_operations" ~latest_encoding:(Version_2, version_2_encoding) - ~old_encodings: - [(Version_0, version_0_encoding); (Version_1, version_1_encoding)] + ~old_encodings:[(Version_1, version_1_encoding)] let pending_operations path = Tezos_rpc.Service.get_service -- GitLab From 1c119573826d4f8c69151130ff5ce30a9017503d Mon Sep 17 00:00:00 2001 From: Albin Coquereau Date: Mon, 4 Sep 2023 14:11:32 +0200 Subject: [PATCH 5/6] tezt/tests: remove test for the RPC pending_operations version 0 --- tezt/tests/prevalidator.ml | 80 -------------------------------------- 1 file changed, 80 deletions(-) diff --git a/tezt/tests/prevalidator.ml b/tezt/tests/prevalidator.ml index 7dc36fbbaa80..095bb0c4b0fe 100644 --- a/tezt/tests/prevalidator.ml +++ b/tezt/tests/prevalidator.ml @@ -3570,85 +3570,6 @@ let get_refused_operation_hash_list_v0 mempool = let get_refused_operation_hash_list_v1 mempool = List.map get_hash JSON.(mempool |-> "refused" |> as_list) -(** This test tries to check the format of different versions of - pending_operations RPC. - - Scenario: - - + Node 1 activates a protocol - - + Inject operation on node_1 with low fees - - + Bake empty block to classify operation as refused - - + Get the hash of the operation using different versions of pending_operation RPC - and check that they are the same *) -let test_pending_operation_version = - Protocol.register_test - ~__FILE__ - ~title:"pending operation version" - ~tags:["mempool"; "pending_operations"; "version"] - @@ fun protocol -> - (* Step 1 *) - (* Initialise one node *) - let* node_1 = - Node.init - ~event_sections_levels:[("prevalidator", `Debug)] - [Synchronisation_threshold 0; Private_mode] - in - let* client_1 = Client.init ~endpoint:(Node node_1) () in - let* () = Client.activate_protocol_and_wait ~protocol client_1 in - Log.info "Activated protocol." ; - (* Step 2 *) - (* Inject refused operation *) - let* branch = Operation.Manager.get_branch client_1 in - - let* _ = - forge_and_inject_operation - ~branch - ~fee:10 - ~gas_limit:1040 - ~source:Constant.bootstrap1.public_key_hash - ~destination:Constant.bootstrap2.public_key_hash - ~counter:1 - ~signer:Constant.bootstrap1 - ~client:client_1 - in - (* Step 3 *) - (* Bake empty block to force operation to be classify as refused *) - let dummy_baking = wait_for_flush node_1 in - let* () = bake_empty_block ~protocol client_1 in - let* () = dummy_baking in - (* Step 4 *) - (* Get pending operations using different version of the RPC and check *) - let* mempool_v0 = - Client.RPC.call client_1 - @@ RPC.get_chain_mempool_pending_operations ~version:"0" () - in - let* mempool_v1 = - Client.RPC.call client_1 @@ RPC.get_chain_mempool_pending_operations () - in - let ophs_refused_v0 = get_refused_operation_hash_list_v0 mempool_v0 in - let ophs_refused_v1 = get_refused_operation_hash_list_v1 mempool_v1 in - try - if not (List.for_all2 String.equal ophs_refused_v0 ophs_refused_v1) then - Format.kasprintf - (Test.fail "%s") - "Refused operation hash list should have the same elements. Got : %a \ - (version 1) and %a (version 2)" - (Format.pp_print_list (fun ppf oph -> Format.fprintf ppf "%s" oph)) - ophs_refused_v0 - (Format.pp_print_list (fun ppf oph -> Format.fprintf ppf "%s" oph)) - ophs_refused_v1 ; - unit - with Invalid_argument _ -> - Format.kasprintf - (Test.fail "%s") - "Refused operation hash list should have the same number of elements. \ - Got : %d (version 1) and %d (version 2)" - (List.length ophs_refused_v0) - (List.length ophs_refused_v1) - (** This test tries to check that invalid operation can be injected on a local node with private/injection/operation RPC *) let force_operation_injection = @@ -3941,7 +3862,6 @@ let register ~protocols = refetch_failed_operation protocols ; ban_operation_and_check_validated protocols ; test_do_not_reclassify protocols ; - test_pending_operation_version protocols ; force_operation_injection protocols ; injecting_old_operation_fails protocols ; test_request_operations_peer protocols -- GitLab From 1f0a0397d18642bd60291d7a4db951e934e3ebcd Mon Sep 17 00:00:00 2001 From: Albin Coquereau Date: Fri, 18 Aug 2023 09:26:19 +0200 Subject: [PATCH 6/6] changes: add entry for RPC version bumping --- CHANGES.rst | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/CHANGES.rst b/CHANGES.rst index 8a39565e405e..a9b29e3cb125 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -35,6 +35,16 @@ Node - Introduced a new ``--local-rpc-addr`` that starts the RPC server locally, not using the dedicated RPC-process. +- Bump RPCs ``GET ../mempool/monitor_operations``, ``POST + ../helpers/preapply/operations``, ``GET ../blocks/``, ``GET + ../blocks//metadata``. and ``GET ../blocks//operations`` + default version to version ``1``. Version ``0`` can still be used with + ``?version=0`` argument. (MR :gl:`!11872`) + +- Bump RPC ``GET ../mempool/pending_operations`` default version to version + ``2``. Version ``0`` has been removed and version ``1`` can still be used + with ``?version=1`` argument. (MR :gl:`!11872`) + Client ------ -- GitLab