diff --git a/CHANGES.rst b/CHANGES.rst index 8e06143e321fe90c5765f1f20f369f22c484eb91..ec17def83608f3cdc5168d86f19a3ae5a662801a 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -36,6 +36,16 @@ Node - **Breaking change** Removed the deprecated ``endorsing_rights`` RPC, use ``attestation_rights`` instead. (MR :gl:`!9849`) +- 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:`!9839`) + +- 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:`!9839`) + Client ------ diff --git a/src/lib_shell_services/block_services.ml b/src/lib_shell_services/block_services.ml index 898acde03dabfae6c3a65b2fce83dac493514df3..58d7a673bc63e5aa8158f75d208b556672ab0f30 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 = @@ -1305,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 @@ -1467,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 @@ -1479,12 +1402,11 @@ 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}; ] ~latest:Version_2 - ~default:Version_1 + ~default:Version_2 () let pending_query = @@ -1573,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 @@ -1618,7 +1539,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 +1746,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) () -> diff --git a/tezt/tests/RPC_test.ml b/tezt/tests/RPC_test.ml index 715b6e113a804e81519e6f28d3af21bbd950a820..913252c9be1958b0b92f55587acf16c08404ec13 100644 --- a/tezt/tests/RPC_test.ml +++ b/tezt/tests/RPC_test.ml @@ -828,7 +828,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://localhost:%d/chains/main/mempool/monitor_operations?applied=true&outdated=true&branch_delayed=true&refused=true&branch_refused=true" + "http://localhost:%d/chains/main/mempool/monitor_operations?validated=true&outdated=true&branch_delayed=true&refused=true&branch_refused=true" (get_client_port client) in let proc_monitor = diff --git a/tezt/tests/baking.ml b/tezt/tests/baking.ml index b1dcababf5e9b052916e80eba791c811dfe2b2cc..b3b797412d3e0796cf615fa4abcec58ab9f494b5 100644 --- a/tezt/tests/baking.ml +++ b/tezt/tests/baking.ml @@ -659,7 +659,7 @@ let test_operation_pool_ordering let* mempool = RPC.Client.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 19918220168cbca1758c5b139deb073b27bbc6f9..2691b2f531c4812d4217e9103b9c85a66424022a 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 = RPC.Client.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/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 2f86845d887009a2169e2c72daa12ef49ee28584..99b4b751e744dd6911c0a84d4dd754386b57fb1e 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://localhost:[PORT]/chains/main/mempool/monitor_operations?applied=true&outdated=true&branch_delayed=true&refused=true&branch_refused=true' +curl -s 'http://localhost:[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://localhost:[PORT]/chains/main/mempool/monitor_operations?applied= { "validated": [], "refused": [], "outdated": [], "branch_refused": [], "branch_delayed": [], "unprocessed": [] } -curl -s 'http://localhost:[PORT]/chains/main/mempool/monitor_operations?applied=true&outdated=true&branch_delayed=true&refused=true&branch_refused=true' +curl -s 'http://localhost:[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 1b7ee2293d8ca3a95c047845721703030c6664c8..66a9f072bbd4197121956c9a921d45f162db7efa 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://localhost:[PORT]/chains/main/mempool/monitor_operations?applied=true&outdated=true&branch_delayed=true&refused=true&branch_refused=true' +curl -s 'http://localhost:[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://localhost:[PORT]/chains/main/mempool/monitor_operations?applied= { "validated": [], "refused": [], "outdated": [], "branch_refused": [], "branch_delayed": [], "unprocessed": [] } -curl -s 'http://localhost:[PORT]/chains/main/mempool/monitor_operations?applied=true&outdated=true&branch_delayed=true&refused=true&branch_refused=true' +curl -s 'http://localhost:[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 1c284f7fdfb42dbf2649c1b5dc1f3a1c79d359d6..54995c5546ea844f5a9690af96172c9c2020cbbb 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://localhost:[PORT]/chains/main/mempool/monitor_operations?applied=true&outdated=true&branch_delayed=true&refused=true&branch_refused=true' +curl -s 'http://localhost:[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://localhost:[PORT]/chains/main/mempool/monitor_operations?applied= { "validated": [], "refused": [], "outdated": [], "branch_refused": [], "branch_delayed": [], "unprocessed": [] } -curl -s 'http://localhost:[PORT]/chains/main/mempool/monitor_operations?applied=true&outdated=true&branch_delayed=true&refused=true&branch_refused=true' +curl -s 'http://localhost:[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 404d9388c50ba8f63acc3592199679c3e1596448..f051edd78661591a2ef7eacfc807db5c28bd57b2 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://localhost:[PORT]/chains/main/mempool/monitor_operations?applied=true&outdated=true&branch_delayed=true&refused=true&branch_refused=true' +curl -s 'http://localhost:[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://localhost:[PORT]/chains/main/mempool/monitor_operations?applied= { "validated": [], "refused": [], "outdated": [], "branch_refused": [], "branch_delayed": [], "unprocessed": [] } -curl -s 'http://localhost:[PORT]/chains/main/mempool/monitor_operations?applied=true&outdated=true&branch_delayed=true&refused=true&branch_refused=true' +curl -s 'http://localhost:[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 d2a7e1650d9638e74ff67f9bc652d86ade2c4ac2..d2a757b9563366244cd6b6e74bd2f3fa5852e936 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://localhost:[PORT]/chains/main/mempool/monitor_operations?applied=true&outdated=true&branch_delayed=true&refused=true&branch_refused=true' +curl -s 'http://localhost:[PORT]/chains/main/mempool/monitor_operations?validated=true&outdated=true&branch_delayed=true&refused=true&branch_refused=true' [] [{"hash":"[OPERATION_HASH]","protocol":"ProxfordSW2S7fvchT1Zgj2avb5UES194neRyYVXoaDGvF9egt8","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":"ProxfordSW2S7fvchT1Zgj2avb5UES194neRyYVXoaDGvF9egt8","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://localhost:[PORT]/chains/main/mempool/monitor_operations?applied= { "validated": [], "refused": [], "outdated": [], "branch_refused": [], "branch_delayed": [], "unprocessed": [] } -curl -s 'http://localhost:[PORT]/chains/main/mempool/monitor_operations?applied=true&outdated=true&branch_delayed=true&refused=true&branch_refused=true' +curl -s 'http://localhost:[PORT]/chains/main/mempool/monitor_operations?validated=true&outdated=true&branch_delayed=true&refused=true&branch_refused=true' [{"hash":"[OPERATION_HASH]","protocol":"ProxfordSW2S7fvchT1Zgj2avb5UES194neRyYVXoaDGvF9egt8","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":"ProxfordSW2S7fvchT1Zgj2avb5UES194neRyYVXoaDGvF9egt8","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":"ProxfordSW2S7fvchT1Zgj2avb5UES194neRyYVXoaDGvF9egt8","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":"ProxfordSW2S7fvchT1Zgj2avb5UES194neRyYVXoaDGvF9egt8","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 244ca0559e23a1c93c956af19a45202b9e3d8c40..3b3bf43d637c738c3a7fbcb368461f4e8b6113a6 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://localhost:[PORT]/chains/main/mempool/monitor_operations?applied=true&outdated=true&branch_delayed=true&refused=true&branch_refused=true' +curl -s 'http://localhost:[PORT]/chains/main/mempool/monitor_operations?validated=true&outdated=true&branch_delayed=true&refused=true&branch_refused=true' [] [{"hash":"[OPERATION_HASH]","protocol":"ProxfordSW2S7fvchT1Zgj2avb5UES194neRyYVXoaDGvF9egt8","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":"ProxfordSW2S7fvchT1Zgj2avb5UES194neRyYVXoaDGvF9egt8","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://localhost:[PORT]/chains/main/mempool/monitor_operations?applied= { "validated": [], "refused": [], "outdated": [], "branch_refused": [], "branch_delayed": [], "unprocessed": [] } -curl -s 'http://localhost:[PORT]/chains/main/mempool/monitor_operations?applied=true&outdated=true&branch_delayed=true&refused=true&branch_refused=true' +curl -s 'http://localhost:[PORT]/chains/main/mempool/monitor_operations?validated=true&outdated=true&branch_delayed=true&refused=true&branch_refused=true' [{"hash":"[OPERATION_HASH]","protocol":"ProxfordSW2S7fvchT1Zgj2avb5UES194neRyYVXoaDGvF9egt8","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":"ProxfordSW2S7fvchT1Zgj2avb5UES194neRyYVXoaDGvF9egt8","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":"ProxfordSW2S7fvchT1Zgj2avb5UES194neRyYVXoaDGvF9egt8","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":"ProxfordSW2S7fvchT1Zgj2avb5UES194neRyYVXoaDGvF9egt8","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 diff --git a/tezt/tests/monitor_operations.ml b/tezt/tests/monitor_operations.ml index 1b0b672599edfbc95ba2276b306965939fa1cca1..a2ff41e9fd99e276f0a642e76bf3650ace1825ad 100644 --- a/tezt/tests/monitor_operations.ml +++ b/tezt/tests/monitor_operations.ml @@ -105,7 +105,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 91c85f7b1068db1776c28dc4e714b793672cbccf..1355fc96873c273994591a2a9efe113d19a9424a 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 = RPC.Client.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 = RPC.Client.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 fec268debebd38de9380a98a3d581def68f6f775..0148a1e23f6fe38946ee925f4a402de89b2d77c4 100644 --- a/tezt/tests/prevalidator.ml +++ b/tezt/tests/prevalidator.ml @@ -2601,9 +2601,9 @@ module Revamped = struct unit 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 @@ -2611,7 +2611,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; @@ -2622,17 +2622,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; @@ -2643,7 +2644,7 @@ let count_mempool mempool = let pp_mempool_count fmt { - applied; + validated; branch_delayed; branch_refused; refused; @@ -2653,10 +2654,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 @@ -2942,7 +2943,7 @@ let refetch_failed_operation = let* mempool_node_1 = RPC.Client.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 = @@ -2963,7 +2964,7 @@ let refetch_failed_operation = let* mempool_inject_on_node_2 = RPC.Client.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 = @@ -2971,7 +2972,7 @@ let check_op_removed client op = RPC.Client.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 @@ -2998,7 +2999,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 @@ -3021,11 +3022,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 @@ -3034,34 +3035,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: @@ -3069,16 +3070,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." ; @@ -3139,27 +3140,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* _ = RPC.Client.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 @@ -3188,13 +3190,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 -> @@ -3210,7 +3212,7 @@ let check_mempool_ops ?(log = false) client ~applied ~refused = RPC.Client.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 -> @@ -3219,15 +3221,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 @@ -3235,8 +3237,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 -> @@ -3294,15 +3296,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. @@ -3312,13 +3314,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 @@ -3345,8 +3347,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 @@ -3367,26 +3369,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 @@ -3394,10 +3396,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 \ @@ -3406,12 +3408,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 = @@ -3422,85 +3424,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 = - RPC.Client.call client_1 - @@ RPC.get_chain_mempool_pending_operations ~version:"0" () - in - let* mempool_v1 = - RPC.Client.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 = @@ -3754,17 +3677,17 @@ let check_unordered_int_list_equal expected actual ~error_msg = unordered_int_list_equal) ~error_msg) -(** Checks that in the mempool of [client], [applied] is the list of - respective fees of the applied operations (the order of the list +(** Checks that in the mempool of [client], [validated] is the list of + respective fees of the validated operations (the order of the list is not required to be right), and [refused] is the list of respective fees of the refused operations. Also logs the hash and fee of all these operations. Moreover, check that there is no branch_delayed, branch_refused, or unprocessed operation. *) -let check_mempool_ops_fees ~(applied : int list) ~(refused : int list) client = +let check_mempool_ops_fees ~(validated : int list) ~(refused : int list) client + = let client_name = Client.name client in let* ops = - RPC.Client.call client - @@ RPC.get_chain_mempool_pending_operations ~version:"1" () + RPC.Client.call client @@ RPC.get_chain_mempool_pending_operations () in let check_fees classification expected = let classification_ops = JSON.(ops |-> classification |> as_list) in @@ -3793,7 +3716,7 @@ let check_mempool_ops_fees ~(applied : int list) ~(refused : int list) client = "%L" "%R") in - check_fees "applied" applied ; + check_fees "validated" validated ; check_fees "refused" refused ; (* Check that other classifications are empty *) List.iter @@ -3814,7 +3737,7 @@ let check_mempool_ops_fees ~(applied : int list) ~(refused : int list) client = impacts the classification of the operations that arrive from a peer. *) let test_mempool_filter_operation_arrival = let title = "mempool filter arrival" in - let tags = ["mempool"; "node"; "filter"; "refused"; "applied"] in + let tags = ["mempool"; "node"; "filter"; "refused"; "validated"] in let show_fees fees = String.concat "; " (List.map Int.to_string fees) in let step1 = "Start two nodes, connect them, and activate the protocol." in let step2 = @@ -3823,20 +3746,20 @@ let test_mempool_filter_operation_arrival = in let fee1 = 1000 and fee2 = 101 in let feesA = [fee1; fee2] in - let appliedA2 = feesA in + let validatedA2 = feesA in let step3 = sf "Inject two operations (transfers) in [node2] with respective fees (in \ - mutez): %s. Check that both operations are [applied] in [node2]'s \ + mutez): %s. Check that both operations are [validated] in [node2]'s \ mempool." (show_fees feesA) in - let appliedA1 = [fee1] and refusedA1 = [fee2] in + let validatedA1 = [fee1] and refusedA1 = [fee2] in let step4 = sf "Bake with an empty mempool for [node1] to force synchronization with \ [node2]. Check that in the mempool of [node1], the operation with fee \ - %d is applied and the one with fee %d is refused. Indeed, [node1] has \ + %d is validated and the one with fee %d is refused. Indeed, [node1] has \ the default filter config: (minimal fees (mutez): 100, minimal nanotez \ per gas unit: 100, minimal nanotez per byte: 1000). Moreover, the fee \ must overcome the SUM of minimal fees, minimal nanotez per gas unit \ @@ -3849,13 +3772,13 @@ let test_mempool_filter_operation_arrival = in let fee3 = 100 and fee4 = 99 in let feesB = [fee3; fee4] in - let appliedB1 = fee3 :: appliedA1 and refusedB1 = fee4 :: refusedA1 in + let validatedB1 = fee3 :: validatedA1 and refusedB1 = fee4 :: refusedA1 in let step5 = sf "Set [minimal_nanotez_per_gas_unit] and [minimal_nanotez_per_byte] to 0 \ in [node1]. Inject new operations in [node2] with respective fees: %s. \ Bake again with an empty mempool. Check the operations in the mempool \ - of [node1]: the operation with fee %d should be [applied], while the \ + of [node1]: the operation with fee %d should be [validated], while the \ one with fee %d should be [refused]. Note that the operation with fee \ %d would now be valid, but it has already been [refused] and cannot be \ revalidated." @@ -3864,7 +3787,7 @@ let test_mempool_filter_operation_arrival = fee4 fee2 in - let applied_after_bake_2 = [fee2; fee3; fee4] in + let validated_after_bake_2 = [fee2; fee3; fee4] in let step6 = sf "Bake for [node2] normally (without enforcing a given mempool). Note \ @@ -3872,20 +3795,20 @@ let test_mempool_filter_operation_arrival = block does not share its configuration with the mempool's filter, so \ only the operation with fee %d is included. This will allow us to reuse \ [bootstrap1] (the author of this operation) to issue a new transfer. \ - Check that [node2] has three [applied] operations left with fees: %s." + Check that [node2] has three [validated] operations left with fees: %s." fee1 - (show_fees applied_after_bake_2) + (show_fees validated_after_bake_2) in let fee5 = 10 and fee6 = 0 in let feesC = [fee5; fee6] in - let appliedC2 = applied_after_bake_2 @ feesC in - let appliedC1 = [fee5; fee3] and refusedC1 = fee6 :: refusedB1 in + let validatedC2 = validated_after_bake_2 @ feesC in + let validatedC1 = [fee5; fee3] and refusedC1 = fee6 :: refusedB1 in let step7 = sf "Set [minimal_fees] to 10 in the mempool filter configuration of \ [node1], while keeping [minimal_nanotez_per_gas_unit] and \ [minimal_nanotez_per_byte] at 0. Inject operations with fees: %s in \ - [node2], and check that all operations are [applied] in [node2]. Bake \ + [node2], and check that all operations are [validated] in [node2]. Bake \ again with on empty mempool, and check the operations in [node1]." (show_fees feesC) in @@ -3909,14 +3832,14 @@ let test_mempool_filter_operation_arrival = in let waiter_arrival_node1 = wait_for_arrival node1 in let* () = inject_transfers Constant.[bootstrap1; bootstrap2] feesA in - let* () = check_mempool_ops_fees ~applied:appliedA2 ~refused:[] client2 in + let* () = check_mempool_ops_fees ~validated:validatedA2 ~refused:[] client2 in log_step 4 step4 ; let* () = bake_empty_block_and_wait_for_flush ~protocol ~log:true client1 node1 in let* () = waiter_arrival_node1 in let* () = - check_mempool_ops_fees ~applied:appliedA1 ~refused:refusedA1 client1 + check_mempool_ops_fees ~validated:validatedA1 ~refused:refusedA1 client1 in log_step 5 step5 ; let* _ = @@ -3933,12 +3856,12 @@ let test_mempool_filter_operation_arrival = in let* () = waiterB in let* () = - check_mempool_ops_fees ~applied:appliedB1 ~refused:refusedB1 client1 + check_mempool_ops_fees ~validated:validatedB1 ~refused:refusedB1 client1 in log_step 6 step6 ; let* () = bake_wait_log node2 client2 in let* () = - check_mempool_ops_fees ~applied:applied_after_bake_2 ~refused:[] client2 + check_mempool_ops_fees ~validated:validated_after_bake_2 ~refused:[] client2 in log_step 7 step7 ; let* _ = @@ -3955,12 +3878,12 @@ let test_mempool_filter_operation_arrival = Constant.[bootstrap5; bootstrap1] feesC in - let* () = check_mempool_ops_fees ~applied:appliedC2 ~refused:[] client2 in + let* () = check_mempool_ops_fees ~validated:validatedC2 ~refused:[] client2 in let* () = bake_empty_block_and_wait_for_flush ~protocol ~log:true client1 node1 in let* () = waiterC in - check_mempool_ops_fees ~applied:appliedC1 ~refused:refusedC1 client1 + check_mempool_ops_fees ~validated:validatedC1 ~refused:refusedC1 client1 let test_request_operations_peer = let step1_msg = "Step 1: Connect and initialise two nodes " in @@ -4006,10 +3929,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 @@ -4050,9 +3973,8 @@ let register ~protocols = Revamped.propagation_future_attestation 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 ; injecting_old_operation_fails protocols ; test_mempool_filter_operation_arrival protocols ; diff --git a/tezt/tests/stresstest_command.ml b/tezt/tests/stresstest_command.ml index 753163733ccaeb71d606eb4cd086831259d1f7c0..703caec7f43e766b21ec1b74d2c504f39f2d24ac 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 = RPC.Client.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 f7671f45113d571cea588590e6745fd6899291da..6f23a432436b02c50567b333bbe6f26f7a8bad7b 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)