From 5593d99345e5c193af58cd2e66e58eb179ac44bc Mon Sep 17 00:00:00 2001 From: Valery Antopol Date: Wed, 20 Dec 2023 23:28:24 +0400 Subject: [PATCH 01/14] bench results for sync marine --- benches/PERFORMANCE.json | 1393 ++++++++++++++++++++++++++++++++------ benches/PERFORMANCE.txt | 421 +++++++++--- 2 files changed, 1543 insertions(+), 271 deletions(-) diff --git a/benches/PERFORMANCE.json b/benches/PERFORMANCE.json index fd3f0b245c..5b52cb623f 100644 --- a/benches/PERFORMANCE.json +++ b/benches/PERFORMANCE.json @@ -599,302 +599,1313 @@ }, "5fce753d17dde8b439ef04cdbce135789eb44646c753548ad79a37b88cf17f0a": { "benches": { - "big_values_data": { + "big-values-data": { "comment": "Loading a trace with huge values", + "memory_sizes": [ + "59.000 MiB", + "59.000 MiB" + ], "stats": { "air::runner::execute_air": { "common_prefix": "air", - "duration": "31.97ms", + "duration": "13.30ms", "nested": { - "farewell_step::outcome::from_success_result": { + "preparation_step::preparation::parse_data": { + "common_prefix": "air_interpreter_data::interpreter_data::InterpreterData", + "duration": "5.41ms", + "nested": { + "try_from_slice": "5.36ms" + } + }, + "preparation_step::preparation::prepare": { + "common_prefix": "", + "duration": "205.00µs", + "nested": { + "air::preparation_step::preparation::make_exec_ctx": { + "common_prefix": "air::preparation_step::preparation", + "duration": "45.00µs", + "nested": { + "CallResultsRepr.deserialize": "13.00µs" + } + }, + "air_parser::parser::air_parser::parse": "40.00µs" + } + }, + "runner::execute": "8.00µs", + "runner::farewell": { + "common_prefix": "air::farewell_step::outcome", + "duration": "3.36ms", + "nested": { + "from_success_result": { + "common_prefix": "air::farewell_step::outcome", + "duration": "3.34ms", + "nested": { + "populate_outcome_from_contexts": { + "common_prefix": "air::farewell_step::outcome", + "duration": "3.30ms", + "nested": { + "CallRequestsRepr.serialize": "12.00µs", + "InterpreterData::serialize": "2.36ms" + } + } + } + } + } + }, + "signing_step::sign_produced_cids": "101.00µs", + "verification_step::verify": { + "common_prefix": "air_interpreter_data::cid_info", + "duration": "4.05ms", + "nested": { + "verify": "3.68ms" + } + } + } + } + }, + "total_time": "13.30ms" + }, + "call-requests500": { + "comment": "multiple call requests", + "memory_sizes": [ + "70.562 MiB", + "70.562 MiB" + ], + "stats": { + "air::runner::execute_air": { + "common_prefix": "air", + "duration": "34.70ms", + "nested": { + "preparation_step::preparation::parse_data": { + "common_prefix": "air_interpreter_data::interpreter_data::InterpreterData", + "duration": "164.00µs", + "nested": { + "try_from_slice": "125.00µs" + } + }, + "preparation_step::preparation::prepare": { + "common_prefix": "", + "duration": "277.00µs", + "nested": { + "air::preparation_step::preparation::make_exec_ctx": { + "common_prefix": "air::preparation_step::preparation", + "duration": "73.00µs", + "nested": { + "CallResultsRepr.deserialize": "44.00µs" + } + }, + "air_parser::parser::air_parser::parse": "75.00µs" + } + }, + "runner::execute": "18.60ms", + "runner::farewell": { + "common_prefix": "air::farewell_step::outcome", + "duration": "15.30ms", + "nested": { + "from_success_result": { + "common_prefix": "air::farewell_step::outcome", + "duration": "15.20ms", + "nested": { + "populate_outcome_from_contexts": { + "common_prefix": "air::farewell_step::outcome", + "duration": "15.10ms", + "nested": { + "CallRequestsRepr.serialize": "14.70ms", + "InterpreterData::serialize": "227.00µs" + } + } + } + } + } + }, + "signing_step::sign_produced_cids": "116.00µs", + "verification_step::verify": { + "common_prefix": "air_interpreter_data::cid_info", + "duration": "77.00µs", + "nested": { + "verify": "10.00µs" + } + } + } + } + }, + "total_time": "34.70ms" + }, + "call-results500": { + "comment": "multiple call results", + "memory_sizes": [ + "54.438 MiB", + "54.438 MiB" + ], + "stats": { + "air::runner::execute_air": { + "common_prefix": "air", + "duration": "15.90ms", + "nested": { + "preparation_step::preparation::parse_data": { + "common_prefix": "air_interpreter_data::interpreter_data::InterpreterData", + "duration": "621.00µs", + "nested": { + "try_from_slice": "584.00µs" + } + }, + "preparation_step::preparation::prepare": { + "common_prefix": "", + "duration": "1.04ms", + "nested": { + "air::preparation_step::preparation::make_exec_ctx": { + "common_prefix": "air::preparation_step::preparation", + "duration": "830.00µs", + "nested": { + "CallResultsRepr.deserialize": "800.00µs" + } + }, + "air_parser::parser::air_parser::parse": "85.00µs" + } + }, + "runner::execute": "11.70ms", + "runner::farewell": { + "common_prefix": "air::farewell_step::outcome", + "duration": "1.89ms", + "nested": { + "from_success_result": { + "common_prefix": "air::farewell_step::outcome", + "duration": "1.87ms", + "nested": { + "populate_outcome_from_contexts": { + "common_prefix": "air::farewell_step::outcome", + "duration": "1.40ms", + "nested": { + "CallRequestsRepr.serialize": "12.00µs", + "InterpreterData::serialize": "945.00µs" + } + } + } + } + } + }, + "signing_step::sign_produced_cids": "297.00µs", + "verification_step::verify": { + "common_prefix": "air_interpreter_data::cid_info", + "duration": "101.00µs", + "nested": { + "verify": "10.00µs" + } + } + } + } + }, + "total_time": "15.90ms" + }, + "canon-map-key-by-lens": { + "comment": "benchmarking a map insert operation", + "memory_sizes": [ + "56.625 MiB", + "56.625 MiB" + ], + "stats": { + "air::runner::execute_air": { + "common_prefix": "air", + "duration": "11.00ms", + "nested": { + "preparation_step::preparation::parse_data": { + "common_prefix": "air_interpreter_data::interpreter_data::InterpreterData", + "duration": "3.17ms", + "nested": { + "try_from_slice": "3.12ms" + } + }, + "preparation_step::preparation::prepare": { + "common_prefix": "", + "duration": "424.00µs", + "nested": { + "air::preparation_step::preparation::make_exec_ctx": { + "common_prefix": "air::preparation_step::preparation", + "duration": "213.00µs", + "nested": { + "CallResultsRepr.deserialize": "13.00µs" + } + }, + "air_parser::parser::air_parser::parse": "89.00µs" + } + }, + "runner::execute": "2.02ms", + "runner::farewell": { + "common_prefix": "air::farewell_step::outcome", + "duration": "1.93ms", + "nested": { + "from_success_result": { + "common_prefix": "air::farewell_step::outcome", + "duration": "1.91ms", + "nested": { + "populate_outcome_from_contexts": { + "common_prefix": "air::farewell_step::outcome", + "duration": "1.55ms", + "nested": { + "CallRequestsRepr.serialize": "12.00µs", + "InterpreterData::serialize": "1.25ms" + } + } + } + } + } + }, + "signing_step::sign_produced_cids": "102.00µs", + "verification_step::verify": { + "common_prefix": "air_interpreter_data::cid_info", + "duration": "3.18ms", + "nested": { + "verify": "2.81ms" + } + } + } + } + }, + "total_time": "11.00ms" + }, + "canon-map-key-element-by-lens": { + "comment": "benchmarking a map insert operation", + "memory_sizes": [ + "56.625 MiB", + "56.625 MiB" + ], + "stats": { + "air::runner::execute_air": { + "common_prefix": "air", + "duration": "10.90ms", + "nested": { + "preparation_step::preparation::parse_data": { + "common_prefix": "air_interpreter_data::interpreter_data::InterpreterData", + "duration": "3.17ms", + "nested": { + "try_from_slice": "3.13ms" + } + }, + "preparation_step::preparation::prepare": { + "common_prefix": "", + "duration": "416.00µs", + "nested": { + "air::preparation_step::preparation::make_exec_ctx": { + "common_prefix": "air::preparation_step::preparation", + "duration": "213.00µs", + "nested": { + "CallResultsRepr.deserialize": "12.00µs" + } + }, + "air_parser::parser::air_parser::parse": "84.00µs" + } + }, + "runner::execute": "1.96ms", + "runner::farewell": { + "common_prefix": "air::farewell_step::outcome", + "duration": "1.92ms", + "nested": { + "from_success_result": { + "common_prefix": "air::farewell_step::outcome", + "duration": "1.90ms", + "nested": { + "populate_outcome_from_contexts": { + "common_prefix": "air::farewell_step::outcome", + "duration": "1.57ms", + "nested": { + "CallRequestsRepr.serialize": "11.00µs", + "InterpreterData::serialize": "1.26ms" + } + } + } + } + } + }, + "signing_step::sign_produced_cids": "103.00µs", + "verification_step::verify": { + "common_prefix": "air_interpreter_data::cid_info", + "duration": "3.16ms", + "nested": { + "verify": "2.79ms" + } + } + } + } + }, + "total_time": "10.90ms" + }, + "canon-map-multiple-keys": { + "comment": "benchmarking a map insert operation", + "memory_sizes": [ + "54.500 MiB", + "54.500 MiB" + ], + "stats": { + "air::runner::execute_air": { + "common_prefix": "air", + "duration": "9.04ms", + "nested": { + "preparation_step::preparation::parse_data": { + "common_prefix": "air_interpreter_data::interpreter_data::InterpreterData", + "duration": "437.00µs", + "nested": { + "try_from_slice": "388.00µs" + } + }, + "preparation_step::preparation::prepare": { + "common_prefix": "", + "duration": "247.00µs", + "nested": { + "air::preparation_step::preparation::make_exec_ctx": { + "common_prefix": "air::preparation_step::preparation", + "duration": "45.00µs", + "nested": { + "CallResultsRepr.deserialize": "14.00µs" + } + }, + "air_parser::parser::air_parser::parse": "86.00µs" + } + }, + "runner::execute": "5.98ms", + "runner::farewell": { + "common_prefix": "air::farewell_step::outcome", + "duration": "1.69ms", + "nested": { + "from_success_result": { + "common_prefix": "air::farewell_step::outcome", + "duration": "1.67ms", + "nested": { + "populate_outcome_from_contexts": { + "common_prefix": "air::farewell_step::outcome", + "duration": "1.38ms", + "nested": { + "CallRequestsRepr.serialize": "12.00µs", + "InterpreterData::serialize": "1.08ms" + } + } + } + } + } + }, + "signing_step::sign_produced_cids": "104.00µs", + "verification_step::verify": { + "common_prefix": "air_interpreter_data::cid_info", + "duration": "420.00µs", + "nested": { + "verify": "38.00µs" + } + } + } + } + }, + "total_time": "9.04ms" + }, + "canon-map-scalar-multiple-keys": { + "comment": "benchmarking a map insert operation", + "memory_sizes": [ + "53.125 MiB", + "53.125 MiB" + ], + "stats": { + "air::runner::execute_air": { + "common_prefix": "air", + "duration": "4.28ms", + "nested": { + "preparation_step::preparation::parse_data": { + "common_prefix": "air_interpreter_data::interpreter_data::InterpreterData", + "duration": "421.00µs", + "nested": { + "try_from_slice": "373.00µs" + } + }, + "preparation_step::preparation::prepare": { + "common_prefix": "", + "duration": "226.00µs", + "nested": { + "air::preparation_step::preparation::make_exec_ctx": { + "common_prefix": "air::preparation_step::preparation", + "duration": "42.00µs", + "nested": { + "CallResultsRepr.deserialize": "12.00µs" + } + }, + "air_parser::parser::air_parser::parse": "68.00µs" + } + }, + "runner::execute": "2.48ms", + "runner::farewell": { + "common_prefix": "air::farewell_step::outcome", + "duration": "460.00µs", + "nested": { + "from_success_result": { + "common_prefix": "air::farewell_step::outcome", + "duration": "440.00µs", + "nested": { + "populate_outcome_from_contexts": { + "common_prefix": "air::farewell_step::outcome", + "duration": "382.00µs", + "nested": { + "CallRequestsRepr.serialize": "12.00µs", + "InterpreterData::serialize": "110.00µs" + } + } + } + } + } + }, + "signing_step::sign_produced_cids": "100.00µs", + "verification_step::verify": { + "common_prefix": "air_interpreter_data::cid_info", + "duration": "411.00µs", + "nested": { + "verify": "37.00µs" + } + } + } + } + }, + "total_time": "4.28ms" + }, + "canon-map-scalar-single-key": { + "comment": "benchmarking a map insert operation", + "memory_sizes": [ + "53.000 MiB", + "53.000 MiB" + ], + "stats": { + "air::runner::execute_air": { + "common_prefix": "air", + "duration": "3.36ms", + "nested": { + "preparation_step::preparation::parse_data": { + "common_prefix": "air_interpreter_data::interpreter_data::InterpreterData", + "duration": "421.00µs", + "nested": { + "try_from_slice": "379.00µs" + } + }, + "preparation_step::preparation::prepare": { + "common_prefix": "", + "duration": "228.00µs", + "nested": { + "air::preparation_step::preparation::make_exec_ctx": { + "common_prefix": "air::preparation_step::preparation", + "duration": "42.00µs", + "nested": { + "CallResultsRepr.deserialize": "13.00µs" + } + }, + "air_parser::parser::air_parser::parse": "70.00µs" + } + }, + "runner::execute": "1.59ms", + "runner::farewell": { + "common_prefix": "air::farewell_step::outcome", + "duration": "408.00µs", + "nested": { + "from_success_result": { + "common_prefix": "air::farewell_step::outcome", + "duration": "388.00µs", + "nested": { + "populate_outcome_from_contexts": { + "common_prefix": "air::farewell_step::outcome", + "duration": "335.00µs", + "nested": { + "CallRequestsRepr.serialize": "11.00µs", + "InterpreterData::serialize": "119.00µs" + } + } + } + } + } + }, + "signing_step::sign_produced_cids": "101.00µs", + "verification_step::verify": { + "common_prefix": "air_interpreter_data::cid_info", + "duration": "441.00µs", + "nested": { + "verify": "71.00µs" + } + } + } + } + }, + "total_time": "3.36ms" + }, + "canon-map-single-key": { + "comment": "benchmarking a map insert operation", + "memory_sizes": [ + "55.312 MiB", + "55.312 MiB" + ], + "stats": { + "air::runner::execute_air": { + "common_prefix": "air", + "duration": "7.52ms", + "nested": { + "preparation_step::preparation::parse_data": { + "common_prefix": "air_interpreter_data::interpreter_data::InterpreterData", + "duration": "432.00µs", + "nested": { + "try_from_slice": "389.00µs" + } + }, + "preparation_step::preparation::prepare": { + "common_prefix": "", + "duration": "224.00µs", + "nested": { + "air::preparation_step::preparation::make_exec_ctx": { + "common_prefix": "air::preparation_step::preparation", + "duration": "42.00µs", + "nested": { + "CallResultsRepr.deserialize": "12.00µs" + } + }, + "air_parser::parser::air_parser::parse": "66.00µs" + } + }, + "runner::execute": "4.37ms", + "runner::farewell": { + "common_prefix": "air::farewell_step::outcome", + "duration": "1.78ms", + "nested": { + "from_success_result": { + "common_prefix": "air::farewell_step::outcome", + "duration": "1.76ms", + "nested": { + "populate_outcome_from_contexts": { + "common_prefix": "air::farewell_step::outcome", + "duration": "1.52ms", + "nested": { + "CallRequestsRepr.serialize": "11.00µs", + "InterpreterData::serialize": "1.25ms" + } + } + } + } + } + }, + "signing_step::sign_produced_cids": "99.00µs", + "verification_step::verify": { + "common_prefix": "air_interpreter_data::cid_info", + "duration": "443.00µs", + "nested": { + "verify": "68.00µs" + } + } + } + } + }, + "total_time": "7.52ms" + }, + "dashboard": { + "comment": "big dashboard test", + "memory_sizes": [ + "52.625 MiB", + "52.625 MiB" + ], + "stats": { + "air::runner::execute_air": { + "common_prefix": "air", + "duration": "5.65ms", + "nested": { + "preparation_step::preparation::parse_data": { + "common_prefix": "air_interpreter_data::interpreter_data::InterpreterData", + "duration": "996.00µs", + "nested": { + "try_from_slice": "943.00µs" + } + }, + "preparation_step::preparation::prepare": { + "common_prefix": "", + "duration": "361.00µs", + "nested": { + "air::preparation_step::preparation::make_exec_ctx": { + "common_prefix": "air::preparation_step::preparation", + "duration": "61.00µs", + "nested": { + "CallResultsRepr.deserialize": "13.00µs" + } + }, + "air_parser::parser::air_parser::parse": "183.00µs" + } + }, + "runner::execute": "762.00µs", + "runner::farewell": { + "common_prefix": "air::farewell_step::outcome", + "duration": "514.00µs", + "nested": { + "from_success_result": { + "common_prefix": "air::farewell_step::outcome", + "duration": "494.00µs", + "nested": { + "populate_outcome_from_contexts": { + "common_prefix": "air::farewell_step::outcome", + "duration": "452.00µs", + "nested": { + "CallRequestsRepr.serialize": "21.00µs", + "InterpreterData::serialize": "227.00µs" + } + } + } + } + } + }, + "signing_step::sign_produced_cids": "101.00µs", + "verification_step::verify": { + "common_prefix": "air_interpreter_data::cid_info", + "duration": "2.75ms", + "nested": { + "verify": "158.00µs" + } + } + } + } + }, + "total_time": "5.65ms" + }, + "long-data": { + "comment": "Long data trace", + "memory_sizes": [ + "53.812 MiB", + "53.812 MiB" + ], + "stats": { + "air::runner::execute_air": { + "common_prefix": "air", + "duration": "5.12ms", + "nested": { + "preparation_step::preparation::parse_data": { + "common_prefix": "air_interpreter_data::interpreter_data::InterpreterData", + "duration": "1.89ms", + "nested": { + "try_from_slice": "1.85ms" + } + }, + "preparation_step::preparation::prepare": { + "common_prefix": "", + "duration": "224.00µs", + "nested": { + "air::preparation_step::preparation::make_exec_ctx": { + "common_prefix": "air::preparation_step::preparation", + "duration": "66.00µs", + "nested": { + "CallResultsRepr.deserialize": "15.00µs" + } + }, + "air_parser::parser::air_parser::parse": "35.00µs" + } + }, + "runner::execute": "8.00µs", + "runner::farewell": { + "common_prefix": "air::farewell_step::outcome", + "duration": "964.00µs", + "nested": { + "from_success_result": { + "common_prefix": "air::farewell_step::outcome", + "duration": "944.00µs", + "nested": { + "populate_outcome_from_contexts": { + "common_prefix": "air::farewell_step::outcome", + "duration": "907.00µs", + "nested": { + "CallRequestsRepr.serialize": "12.00µs", + "InterpreterData::serialize": "412.00µs" + } + } + } + } + } + }, + "signing_step::sign_produced_cids": "102.00µs", + "verification_step::verify": { + "common_prefix": "air_interpreter_data::cid_info", + "duration": "1.75ms", + "nested": { + "verify": "668.00µs" + } + } + } + } + }, + "total_time": "5.12ms" + }, + "multiple-cids10": { + "comment": "verifying multiple CIDs for single peer", + "memory_sizes": [ + "52.500 MiB", + "52.500 MiB" + ], + "stats": { + "air::runner::execute_air": { + "common_prefix": "air", + "duration": "2.62ms", + "nested": { + "preparation_step::preparation::parse_data": { + "common_prefix": "air_interpreter_data::interpreter_data::InterpreterData", + "duration": "432.00µs", + "nested": { + "try_from_slice": "381.00µs" + } + }, + "preparation_step::preparation::prepare": { + "common_prefix": "", + "duration": "237.00µs", + "nested": { + "air::preparation_step::preparation::make_exec_ctx": { + "common_prefix": "air::preparation_step::preparation", + "duration": "52.00µs", + "nested": { + "CallResultsRepr.deserialize": "12.00µs" + } + }, + "air_parser::parser::air_parser::parse": "70.00µs" + } + }, + "runner::execute": "417.00µs", + "runner::farewell": { + "common_prefix": "air::farewell_step::outcome", + "duration": "388.00µs", + "nested": { + "from_success_result": { + "common_prefix": "air::farewell_step::outcome", + "duration": "368.00µs", + "nested": { + "populate_outcome_from_contexts": { + "common_prefix": "air::farewell_step::outcome", + "duration": "319.00µs", + "nested": { + "CallRequestsRepr.serialize": "12.00µs", + "InterpreterData::serialize": "140.00µs" + } + } + } + } + } + }, + "signing_step::sign_produced_cids": "101.00µs", + "verification_step::verify": { + "common_prefix": "air_interpreter_data::cid_info", + "duration": "878.00µs", + "nested": { + "verify": "179.00µs" + } + } + } + } + }, + "total_time": "2.62ms" + }, + "multiple-peers8": { + "comment": "verifying many CIDs for many peers", + "memory_sizes": [ + "53.438 MiB", + "53.438 MiB" + ], + "stats": { + "air::runner::execute_air": { + "common_prefix": "air", + "duration": "9.45ms", + "nested": { + "preparation_step::preparation::parse_data": { + "common_prefix": "air_interpreter_data::interpreter_data::InterpreterData", + "duration": "1.37ms", + "nested": { + "try_from_slice": "1.31ms" + } + }, + "preparation_step::preparation::prepare": { + "common_prefix": "", + "duration": "290.00µs", + "nested": { + "air::preparation_step::preparation::make_exec_ctx": { + "common_prefix": "air::preparation_step::preparation", + "duration": "97.00µs", + "nested": { + "CallResultsRepr.deserialize": "13.00µs" + } + }, + "air_parser::parser::air_parser::parse": "78.00µs" + } + }, + "runner::execute": "2.68ms", + "runner::farewell": { + "common_prefix": "air::farewell_step::outcome", + "duration": "960.00µs", + "nested": { + "from_success_result": { + "common_prefix": "air::farewell_step::outcome", + "duration": "941.00µs", + "nested": { + "populate_outcome_from_contexts": { + "common_prefix": "air::farewell_step::outcome", + "duration": "842.00µs", + "nested": { + "CallRequestsRepr.serialize": "12.00µs", + "InterpreterData::serialize": "572.00µs" + } + } + } + } + } + }, + "signing_step::sign_produced_cids": "99.00µs", + "verification_step::verify": { + "common_prefix": "air_interpreter_data::cid_info", + "duration": "3.88ms", + "nested": { + "verify": "730.00µs" + } + } + } + } + }, + "total_time": "9.45ms" + }, + "multiple-sigs30": { + "comment": "signing multiple CIDs", + "memory_sizes": [ + "56.188 MiB", + "56.188 MiB" + ], + "stats": { + "air::runner::execute_air": { + "common_prefix": "air", + "duration": "17.50ms", + "nested": { + "preparation_step::preparation::parse_data": { + "common_prefix": "air_interpreter_data::interpreter_data::InterpreterData", + "duration": "3.92ms", + "nested": { + "try_from_slice": "3.88ms" + } + }, + "preparation_step::preparation::prepare": { + "common_prefix": "", + "duration": "368.00µs", + "nested": { + "air::preparation_step::preparation::make_exec_ctx": { + "common_prefix": "air::preparation_step::preparation", + "duration": "175.00µs", + "nested": { + "CallResultsRepr.deserialize": "13.00µs" + } + }, + "air_parser::parser::air_parser::parse": "76.00µs" + } + }, + "runner::execute": "6.95ms", + "runner::farewell": { + "common_prefix": "air::farewell_step::outcome", + "duration": "2.62ms", + "nested": { + "from_success_result": { + "common_prefix": "air::farewell_step::outcome", + "duration": "2.60ms", + "nested": { + "populate_outcome_from_contexts": { + "common_prefix": "air::farewell_step::outcome", + "duration": "2.42ms", + "nested": { + "CallRequestsRepr.serialize": "12.00µs", + "InterpreterData::serialize": "1.56ms" + } + } + } + } + } + }, + "signing_step::sign_produced_cids": "443.00µs", + "verification_step::verify": { + "common_prefix": "air_interpreter_data::cid_info", + "duration": "2.99ms", + "nested": { + "verify": "1.27ms" + } + } + } + } + }, + "total_time": "17.50ms" + }, + "network-explore": { + "comment": "5 peers of network are discovered", + "memory_sizes": [ + "52.375 MiB", + "52.375 MiB" + ], + "stats": { + "air::runner::execute_air": { + "common_prefix": "air", + "duration": "3.07ms", + "nested": { + "preparation_step::preparation::parse_data": { + "common_prefix": "air_interpreter_data::interpreter_data::InterpreterData", + "duration": "494.00µs", + "nested": { + "try_from_slice": "444.00µs" + } + }, + "preparation_step::preparation::prepare": { + "common_prefix": "", + "duration": "251.00µs", + "nested": { + "air::preparation_step::preparation::make_exec_ctx": { + "common_prefix": "air::preparation_step::preparation", + "duration": "46.00µs", + "nested": { + "CallResultsRepr.deserialize": "12.00µs" + } + }, + "air_parser::parser::air_parser::parse": "90.00µs" + } + }, + "runner::execute": "142.00µs", + "runner::farewell": { + "common_prefix": "air::farewell_step::outcome", + "duration": "314.00µs", + "nested": { + "from_success_result": { + "common_prefix": "air::farewell_step::outcome", + "duration": "295.00µs", + "nested": { + "populate_outcome_from_contexts": { + "common_prefix": "air::farewell_step::outcome", + "duration": "255.00µs", + "nested": { + "CallRequestsRepr.serialize": "12.00µs", + "InterpreterData::serialize": "90.00µs" + } + } + } + } + } + }, + "signing_step::sign_produced_cids": "101.00µs", + "verification_step::verify": { + "common_prefix": "air_interpreter_data::cid_info", + "duration": "1.60ms", + "nested": { + "verify": "60.00µs" + } + } + } + } + }, + "total_time": "3.07ms" + }, + "null": { + "comment": "Empty data and null script", + "memory_sizes": [ + "52.375 MiB", + "52.375 MiB" + ], + "stats": { + "air::runner::execute_air": { + "common_prefix": "air", + "duration": "832.00µs", + "nested": { + "preparation_step::preparation::parse_data": "25.00µs", + "preparation_step::preparation::prepare": { + "common_prefix": "", + "duration": "228.00µs", + "nested": { + "air::preparation_step::preparation::make_exec_ctx": { + "common_prefix": "air::preparation_step::preparation", + "duration": "46.00µs", + "nested": { + "CallResultsRepr.deserialize": "14.00µs" + } + }, + "air_parser::parser::air_parser::parse": "46.00µs" + } + }, + "runner::execute": "8.00µs", + "runner::farewell": { "common_prefix": "air::farewell_step::outcome", - "duration": "10.56ms", + "duration": "240.00µs", "nested": { - "populate_outcome_from_contexts": { - "common_prefix": "air::farewell_step::outcome::serde_json", - "duration": "8.69ms", + "from_success_result": { + "common_prefix": "air::farewell_step::outcome", + "duration": "221.00µs", "nested": { - "to_vec(call_results)": "108.00µs", - "to_vec(data)": "5.66ms" + "populate_outcome_from_contexts": { + "common_prefix": "air::farewell_step::outcome", + "duration": "183.00µs", + "nested": { + "CallRequestsRepr.serialize": "14.00µs", + "InterpreterData::serialize": "31.00µs" + } + } } } } }, - "preparation_step::preparation::prepare": { - "common_prefix": "", - "duration": "17.47ms", + "signing_step::sign_produced_cids": "109.00µs", + "verification_step::verify": { + "common_prefix": "air_interpreter_data::cid_info", + "duration": "40.00µs", "nested": { - "air::preparation_step::preparation::make_exec_ctx": "1.40ms", - "air_interpreter_data::interpreter_data::serde_json::from_slice": "10.68ms", - "air_parser::parser::air_parser::parse": "1.86ms" + "verify": "10.00µs" } - }, - "runner::execute": "126.00µs" + } } } }, - "total_time": "31.97ms" + "total_time": "832.00µs" }, - "dashboard": { - "comment": "big dashboard test", + "parser-10000-100": { + "comment": "long air script with lot of variable assignments", + "memory_sizes": [ + "54.625 MiB", + "54.625 MiB" + ], "stats": { "air::runner::execute_air": { "common_prefix": "air", - "duration": "103.60ms", + "duration": "24.20ms", "nested": { - "farewell_step::outcome::from_success_result": { - "common_prefix": "air::farewell_step::outcome", - "duration": "4.71ms", - "nested": { - "populate_outcome_from_contexts": { - "common_prefix": "air::farewell_step::outcome::serde_json", - "duration": "3.70ms", - "nested": { - "to_vec(call_results)": "162.00µs", - "to_vec(data)": "1.87ms" - } - } - } - }, + "preparation_step::preparation::parse_data": "26.00µs", "preparation_step::preparation::prepare": { "common_prefix": "", - "duration": "16.17ms", + "duration": "22.70ms", "nested": { - "air::preparation_step::preparation::make_exec_ctx": "1.61ms", - "air_interpreter_data::interpreter_data::serde_json::from_slice": "5.50ms", - "air_parser::parser::air_parser::parse": "6.11ms" + "air::preparation_step::preparation::make_exec_ctx": { + "common_prefix": "air::preparation_step::preparation", + "duration": "52.00µs", + "nested": { + "CallResultsRepr.deserialize": "17.00µs" + } + }, + "air_parser::parser::air_parser::parse": "22.50ms" } }, - "runner::execute": { - "common_prefix": "air::execution_step::instructions::call", - "duration": "78.68ms", + "runner::execute": "44.00µs", + "runner::farewell": { + "common_prefix": "air::farewell_step::outcome", + "duration": "243.00µs", "nested": { - "execute": { - "common_prefix": "air::execution_step::instructions::call::resolved_call", - "duration": "66.40ms", + "from_success_result": { + "common_prefix": "air::farewell_step::outcome", + "duration": "222.00µs", "nested": { - "execute": { - "common_prefix": "air::execution_step", - "duration": "9.37ms", - "nested": { - "instructions::call::resolved_call::prepare_request_params": { - "common_prefix": "air::execution_step", - "duration": "1.43ms", - "nested": { - "instructions::call::resolved_call::serde_json::to_string(tetraplets)": "398.00µs", - "resolver::resolve::resolve_ast_variable": { - "common_prefix": "air::execution_step::resolver::resolve", - "duration": "335.00µs", - "nested": { - "resolve_variable": "105.00µs" - } - } - } - }, - "resolver::resolve::resolve_ast_variable": { - "common_prefix": "air::execution_step::resolver::resolve", - "duration": "946.00µs", - "nested": { - "resolve_variable": "277.00µs" - } - } - } - }, - "new": { - "common_prefix": "air::execution_step::resolver::resolve", - "duration": "40.53ms", + "populate_outcome_from_contexts": { + "common_prefix": "air::farewell_step::outcome", + "duration": "186.00µs", "nested": { - "resolve_ast_scalar": { - "common_prefix": "air::execution_step::resolver::resolve", - "duration": "29.73ms", - "nested": { - "resolve_ast_variable": { - "common_prefix": "air::execution_step::resolver::resolve", - "duration": "18.24ms", - "nested": { - "resolve_variable": "5.84ms" - } - } - } - } + "CallRequestsRepr.serialize": "12.00µs", + "InterpreterData::serialize": "33.00µs" } } } } } + }, + "signing_step::sign_produced_cids": "108.00µs", + "verification_step::verify": { + "common_prefix": "air_interpreter_data::cid_info", + "duration": "44.00µs", + "nested": { + "verify": "9.00µs" + } } } } }, - "total_time": "103.60ms" + "total_time": "24.20ms" }, - "long_data": { - "comment": "Long data trace", + "parser-calls-10000-100": { + "comment": "multiple calls parser benchmark", + "memory_sizes": [ + "54.375 MiB", + "54.375 MiB" + ], "stats": { "air::runner::execute_air": { "common_prefix": "air", - "duration": "24.35ms", + "duration": "23.10ms", "nested": { - "farewell_step::outcome::from_success_result": { + "preparation_step::preparation::parse_data": "26.00µs", + "preparation_step::preparation::prepare": { + "common_prefix": "", + "duration": "21.40ms", + "nested": { + "air::preparation_step::preparation::make_exec_ctx": { + "common_prefix": "air::preparation_step::preparation", + "duration": "53.00µs", + "nested": { + "CallResultsRepr.deserialize": "16.00µs" + } + }, + "air_parser::parser::air_parser::parse": "21.20ms" + } + }, + "runner::execute": "43.00µs", + "runner::farewell": { "common_prefix": "air::farewell_step::outcome", - "duration": "6.79ms", + "duration": "244.00µs", "nested": { - "populate_outcome_from_contexts": { - "common_prefix": "air::farewell_step::outcome::serde_json", - "duration": "5.07ms", + "from_success_result": { + "common_prefix": "air::farewell_step::outcome", + "duration": "224.00µs", "nested": { - "to_vec(call_results)": "108.00µs", - "to_vec(data)": "2.23ms" + "populate_outcome_from_contexts": { + "common_prefix": "air::farewell_step::outcome", + "duration": "187.00µs", + "nested": { + "CallRequestsRepr.serialize": "15.00µs", + "InterpreterData::serialize": "32.00µs" + } + } } } } }, - "preparation_step::preparation::prepare": { - "common_prefix": "", - "duration": "13.54ms", + "signing_step::sign_produced_cids": "112.00µs", + "verification_step::verify": { + "common_prefix": "air_interpreter_data::cid_info", + "duration": "58.00µs", "nested": { - "air::preparation_step::preparation::make_exec_ctx": "1.75ms", - "air_interpreter_data::interpreter_data::serde_json::from_slice": "6.77ms", - "air_parser::parser::air_parser::parse": "1.84ms" + "verify": "17.00µs" } - }, - "runner::execute": "130.00µs" + } } } }, - "total_time": "24.35ms" + "total_time": "23.10ms" }, - "network_explore": { - "comment": "5 peers of network are discovered", + "populate-map-multiple-keys": { + "comment": "benchmarking a map insert operation", + "memory_sizes": [ + "53.000 MiB", + "53.000 MiB" + ], "stats": { "air::runner::execute_air": { "common_prefix": "air", - "duration": "46.01ms", + "duration": "3.60ms", "nested": { - "farewell_step::outcome::from_success_result": { - "common_prefix": "air::farewell_step::outcome", - "duration": "5.48ms", + "preparation_step::preparation::parse_data": { + "common_prefix": "air_interpreter_data::interpreter_data::InterpreterData", + "duration": "180.00µs", "nested": { - "populate_outcome_from_contexts": { - "common_prefix": "air::farewell_step::outcome::serde_json", - "duration": "4.50ms", - "nested": { - "to_vec(call_results)": "105.00µs", - "to_vec(data)": "2.25ms" - } - } + "try_from_slice": "127.00µs" } }, "preparation_step::preparation::prepare": { "common_prefix": "", - "duration": "18.74ms", + "duration": "254.00µs", "nested": { - "air::preparation_step::preparation::make_exec_ctx": "1.98ms", - "air_interpreter_data::interpreter_data::serde_json::from_slice": "7.05ms", - "air_parser::parser::air_parser::parse": "6.74ms" + "air::preparation_step::preparation::make_exec_ctx": { + "common_prefix": "air::preparation_step::preparation", + "duration": "46.00µs", + "nested": { + "CallResultsRepr.deserialize": "14.00µs" + } + }, + "air_parser::parser::air_parser::parse": "87.00µs" } }, - "runner::execute": { - "common_prefix": "air::execution_step::instructions::call", - "duration": "17.86ms", + "runner::execute": "2.14ms", + "runner::farewell": { + "common_prefix": "air::farewell_step::outcome", + "duration": "344.00µs", "nested": { - "execute": { - "common_prefix": "air::execution_step::instructions::call::resolved_call", - "duration": "9.97ms", + "from_success_result": { + "common_prefix": "air::farewell_step::outcome", + "duration": "324.00µs", "nested": { - "execute": { - "common_prefix": "air::execution_step::resolver::resolve", - "duration": "3.17ms", - "nested": { - "resolve_ast_variable": { - "common_prefix": "air::execution_step::resolver::resolve", - "duration": "339.00µs", - "nested": { - "resolve_variable": "94.00µs" - } - } - } - }, - "new": { - "common_prefix": "air::execution_step::resolver::resolve", - "duration": "4.10ms", + "populate_outcome_from_contexts": { + "common_prefix": "air::farewell_step::outcome", + "duration": "289.00µs", "nested": { - "resolve_ast_scalar": { - "common_prefix": "air::execution_step::resolver::resolve", - "duration": "2.65ms", - "nested": { - "resolve_ast_variable": { - "common_prefix": "air::execution_step::resolver::resolve", - "duration": "1.67ms", - "nested": { - "resolve_variable": "547.00µs" - } - } - } - } + "CallRequestsRepr.serialize": "11.00µs", + "InterpreterData::serialize": "103.00µs" } } } } } + }, + "signing_step::sign_produced_cids": "99.00µs", + "verification_step::verify": { + "common_prefix": "air_interpreter_data::cid_info", + "duration": "407.00µs", + "nested": { + "verify": "40.00µs" + } } } } }, - "total_time": "46.01ms" + "total_time": "3.60ms" }, - "parser_10000_100": { - "comment": "Running very long AIR script with lot of variables and assignments", + "populate-map-single-key": { + "comment": "benchmarking a map insert operation", + "memory_sizes": [ + "52.938 MiB", + "52.938 MiB" + ], "stats": { "air::runner::execute_air": { "common_prefix": "air", - "duration": "48.47ms", + "duration": "2.82ms", "nested": { - "farewell_step::outcome::from_success_result": { - "common_prefix": "air::farewell_step::outcome", - "duration": "4.70ms", + "preparation_step::preparation::parse_data": { + "common_prefix": "air_interpreter_data::interpreter_data::InterpreterData", + "duration": "216.00µs", "nested": { - "populate_outcome_from_contexts": { - "common_prefix": "air::farewell_step::outcome::serde_json", - "duration": "3.48ms", - "nested": { - "to_vec(call_results)": "105.00µs", - "to_vec(data)": "1.60ms" - } - } + "try_from_slice": "175.00µs" } }, "preparation_step::preparation::prepare": { "common_prefix": "", - "duration": "34.34ms", + "duration": "233.00µs", "nested": { - "air::preparation_step::preparation::make_exec_ctx": "1.41ms", - "air_parser::parser::air_parser::parse": "29.66ms" + "air::preparation_step::preparation::make_exec_ctx": { + "common_prefix": "air::preparation_step::preparation", + "duration": "43.00µs", + "nested": { + "CallResultsRepr.deserialize": "13.00µs" + } + }, + "air_parser::parser::air_parser::parse": "74.00µs" } }, - "runner::execute": { - "common_prefix": "air::execution_step::instructions::call", - "duration": "4.39ms", + "runner::execute": "1.30ms", + "runner::farewell": { + "common_prefix": "air::farewell_step::outcome", + "duration": "368.00µs", "nested": { - "execute": { - "common_prefix": "air::execution_step::instructions::call::resolved_call", - "duration": "2.00ms", + "from_success_result": { + "common_prefix": "air::farewell_step::outcome", + "duration": "347.00µs", "nested": { - "execute": "483.00µs", - "new": "471.00µs" + "populate_outcome_from_contexts": { + "common_prefix": "air::farewell_step::outcome", + "duration": "292.00µs", + "nested": { + "CallRequestsRepr.serialize": "12.00µs", + "InterpreterData::serialize": "118.00µs" + } + } } } } + }, + "signing_step::sign_produced_cids": "99.00µs", + "verification_step::verify": { + "common_prefix": "air_interpreter_data::cid_info", + "duration": "432.00µs", + "nested": { + "verify": "71.00µs" + } } } } }, - "total_time": "48.47ms" + "total_time": "2.82ms" } }, - "datetime": "2023-02-13 16:59:20.507375+00:00", - "platform": "macOS-12.3.1-arm64-arm-64bit", - "version": "0.35.1" + "datetime": "2023-12-20 19:27:38.810315+00:00", + "features": "", + "platform": "macOS-13.5.1-arm64-arm-64bit", + "version": "0.55.0" }, "62dabcde478dc58760ebbe71ef6047299144a5f63990c6c3d826ebf30175adfc": { "benches": { diff --git a/benches/PERFORMANCE.txt b/benches/PERFORMANCE.txt index e26cd82b22..88bbfbe285 100644 --- a/benches/PERFORMANCE.txt +++ b/benches/PERFORMANCE.txt @@ -163,87 +163,348 @@ Machine 0dfa4f098d7a6ef0d77a7bbc028ccf65fd6dc8d37be8a466ab3933a1a4a8e113: execute: 29.00µs new: 40.00µs Machine 5fce753d17dde8b439ef04cdbce135789eb44646c753548ad79a37b88cf17f0a: - Platform: macOS-12.3.1-arm64-arm-64bit - Timestamp: 2023-02-13 16:59:20.507375+00:00 - AquaVM version: 0.35.1 + Platform: macOS-13.5.1-arm64-arm-64bit + Timestamp: 2023-12-20 19:27:38.810315+00:00 + AquaVM version: 0.55.0 Benches: - big_values_data (31.97ms): Loading a trace with huge values - air::runner::execute_air: 31.97ms - farewell_step::outcome::from_success_result: 10.56ms - populate_outcome_from_contexts: 8.69ms - to_vec(call_results): 108.00µs - to_vec(data): 5.66ms - preparation_step::preparation::prepare: 17.47ms - air::preparation_step::preparation::make_exec_ctx: 1.40ms - air_interpreter_data::interpreter_data::serde_json::from_slice: 10.68ms - air_parser::parser::air_parser::parse: 1.86ms - runner::execute: 126.00µs - dashboard (103.60ms): big dashboard test - air::runner::execute_air: 103.60ms - farewell_step::outcome::from_success_result: 4.71ms - populate_outcome_from_contexts: 3.70ms - to_vec(call_results): 162.00µs - to_vec(data): 1.87ms - preparation_step::preparation::prepare: 16.17ms - air::preparation_step::preparation::make_exec_ctx: 1.61ms - air_interpreter_data::interpreter_data::serde_json::from_slice: 5.50ms - air_parser::parser::air_parser::parse: 6.11ms - runner::execute: 78.68ms - execute: 66.40ms - execute: 9.37ms - instructions::call::resolved_call::prepare_request_params: 1.43ms - instructions::call::resolved_call::serde_json::to_string(tetraplets): 398.00µs - resolver::resolve::resolve_ast_variable: 335.00µs - resolve_variable: 105.00µs - resolver::resolve::resolve_ast_variable: 946.00µs - resolve_variable: 277.00µs - new: 40.53ms - resolve_ast_scalar: 29.73ms - resolve_ast_variable: 18.24ms - resolve_variable: 5.84ms - long_data (24.35ms): Long data trace - air::runner::execute_air: 24.35ms - farewell_step::outcome::from_success_result: 6.79ms - populate_outcome_from_contexts: 5.07ms - to_vec(call_results): 108.00µs - to_vec(data): 2.23ms - preparation_step::preparation::prepare: 13.54ms - air::preparation_step::preparation::make_exec_ctx: 1.75ms - air_interpreter_data::interpreter_data::serde_json::from_slice: 6.77ms - air_parser::parser::air_parser::parse: 1.84ms - runner::execute: 130.00µs - network_explore (46.01ms): 5 peers of network are discovered - air::runner::execute_air: 46.01ms - farewell_step::outcome::from_success_result: 5.48ms - populate_outcome_from_contexts: 4.50ms - to_vec(call_results): 105.00µs - to_vec(data): 2.25ms - preparation_step::preparation::prepare: 18.74ms - air::preparation_step::preparation::make_exec_ctx: 1.98ms - air_interpreter_data::interpreter_data::serde_json::from_slice: 7.05ms - air_parser::parser::air_parser::parse: 6.74ms - runner::execute: 17.86ms - execute: 9.97ms - execute: 3.17ms - resolve_ast_variable: 339.00µs - resolve_variable: 94.00µs - new: 4.10ms - resolve_ast_scalar: 2.65ms - resolve_ast_variable: 1.67ms - resolve_variable: 547.00µs - parser_10000_100 (48.47ms): Running very long AIR script with lot of variables and assignments - air::runner::execute_air: 48.47ms - farewell_step::outcome::from_success_result: 4.70ms - populate_outcome_from_contexts: 3.48ms - to_vec(call_results): 105.00µs - to_vec(data): 1.60ms - preparation_step::preparation::prepare: 34.34ms - air::preparation_step::preparation::make_exec_ctx: 1.41ms - air_parser::parser::air_parser::parse: 29.66ms - runner::execute: 4.39ms - execute: 2.00ms - execute: 483.00µs - new: 471.00µs + Features: + big-values-data (13.30ms; 59.000 MiB, 59.000 MiB): Loading a trace with huge values + air::runner::execute_air: 13.30ms + preparation_step::preparation::parse_data: 5.41ms + try_from_slice: 5.36ms + preparation_step::preparation::prepare: 205.00µs + air::preparation_step::preparation::make_exec_ctx: 45.00µs + CallResultsRepr.deserialize: 13.00µs + air_parser::parser::air_parser::parse: 40.00µs + runner::execute: 8.00µs + runner::farewell: 3.36ms + from_success_result: 3.34ms + populate_outcome_from_contexts: 3.30ms + CallRequestsRepr.serialize: 12.00µs + InterpreterData::serialize: 2.36ms + signing_step::sign_produced_cids: 101.00µs + verification_step::verify: 4.05ms + verify: 3.68ms + call-requests500 (34.70ms; 70.562 MiB, 70.562 MiB): multiple call requests + air::runner::execute_air: 34.70ms + preparation_step::preparation::parse_data: 164.00µs + try_from_slice: 125.00µs + preparation_step::preparation::prepare: 277.00µs + air::preparation_step::preparation::make_exec_ctx: 73.00µs + CallResultsRepr.deserialize: 44.00µs + air_parser::parser::air_parser::parse: 75.00µs + runner::execute: 18.60ms + runner::farewell: 15.30ms + from_success_result: 15.20ms + populate_outcome_from_contexts: 15.10ms + CallRequestsRepr.serialize: 14.70ms + InterpreterData::serialize: 227.00µs + signing_step::sign_produced_cids: 116.00µs + verification_step::verify: 77.00µs + verify: 10.00µs + call-results500 (15.90ms; 54.438 MiB, 54.438 MiB): multiple call results + air::runner::execute_air: 15.90ms + preparation_step::preparation::parse_data: 621.00µs + try_from_slice: 584.00µs + preparation_step::preparation::prepare: 1.04ms + air::preparation_step::preparation::make_exec_ctx: 830.00µs + CallResultsRepr.deserialize: 800.00µs + air_parser::parser::air_parser::parse: 85.00µs + runner::execute: 11.70ms + runner::farewell: 1.89ms + from_success_result: 1.87ms + populate_outcome_from_contexts: 1.40ms + CallRequestsRepr.serialize: 12.00µs + InterpreterData::serialize: 945.00µs + signing_step::sign_produced_cids: 297.00µs + verification_step::verify: 101.00µs + verify: 10.00µs + canon-map-key-by-lens (11.00ms; 56.625 MiB, 56.625 MiB): benchmarking a map insert operation + air::runner::execute_air: 11.00ms + preparation_step::preparation::parse_data: 3.17ms + try_from_slice: 3.12ms + preparation_step::preparation::prepare: 424.00µs + air::preparation_step::preparation::make_exec_ctx: 213.00µs + CallResultsRepr.deserialize: 13.00µs + air_parser::parser::air_parser::parse: 89.00µs + runner::execute: 2.02ms + runner::farewell: 1.93ms + from_success_result: 1.91ms + populate_outcome_from_contexts: 1.55ms + CallRequestsRepr.serialize: 12.00µs + InterpreterData::serialize: 1.25ms + signing_step::sign_produced_cids: 102.00µs + verification_step::verify: 3.18ms + verify: 2.81ms + canon-map-key-element-by-lens (10.90ms; 56.625 MiB, 56.625 MiB): benchmarking a map insert operation + air::runner::execute_air: 10.90ms + preparation_step::preparation::parse_data: 3.17ms + try_from_slice: 3.13ms + preparation_step::preparation::prepare: 416.00µs + air::preparation_step::preparation::make_exec_ctx: 213.00µs + CallResultsRepr.deserialize: 12.00µs + air_parser::parser::air_parser::parse: 84.00µs + runner::execute: 1.96ms + runner::farewell: 1.92ms + from_success_result: 1.90ms + populate_outcome_from_contexts: 1.57ms + CallRequestsRepr.serialize: 11.00µs + InterpreterData::serialize: 1.26ms + signing_step::sign_produced_cids: 103.00µs + verification_step::verify: 3.16ms + verify: 2.79ms + canon-map-multiple-keys (9.04ms; 54.500 MiB, 54.500 MiB): benchmarking a map insert operation + air::runner::execute_air: 9.04ms + preparation_step::preparation::parse_data: 437.00µs + try_from_slice: 388.00µs + preparation_step::preparation::prepare: 247.00µs + air::preparation_step::preparation::make_exec_ctx: 45.00µs + CallResultsRepr.deserialize: 14.00µs + air_parser::parser::air_parser::parse: 86.00µs + runner::execute: 5.98ms + runner::farewell: 1.69ms + from_success_result: 1.67ms + populate_outcome_from_contexts: 1.38ms + CallRequestsRepr.serialize: 12.00µs + InterpreterData::serialize: 1.08ms + signing_step::sign_produced_cids: 104.00µs + verification_step::verify: 420.00µs + verify: 38.00µs + canon-map-scalar-multiple-keys (4.28ms; 53.125 MiB, 53.125 MiB): benchmarking a map insert operation + air::runner::execute_air: 4.28ms + preparation_step::preparation::parse_data: 421.00µs + try_from_slice: 373.00µs + preparation_step::preparation::prepare: 226.00µs + air::preparation_step::preparation::make_exec_ctx: 42.00µs + CallResultsRepr.deserialize: 12.00µs + air_parser::parser::air_parser::parse: 68.00µs + runner::execute: 2.48ms + runner::farewell: 460.00µs + from_success_result: 440.00µs + populate_outcome_from_contexts: 382.00µs + CallRequestsRepr.serialize: 12.00µs + InterpreterData::serialize: 110.00µs + signing_step::sign_produced_cids: 100.00µs + verification_step::verify: 411.00µs + verify: 37.00µs + canon-map-scalar-single-key (3.36ms; 53.000 MiB, 53.000 MiB): benchmarking a map insert operation + air::runner::execute_air: 3.36ms + preparation_step::preparation::parse_data: 421.00µs + try_from_slice: 379.00µs + preparation_step::preparation::prepare: 228.00µs + air::preparation_step::preparation::make_exec_ctx: 42.00µs + CallResultsRepr.deserialize: 13.00µs + air_parser::parser::air_parser::parse: 70.00µs + runner::execute: 1.59ms + runner::farewell: 408.00µs + from_success_result: 388.00µs + populate_outcome_from_contexts: 335.00µs + CallRequestsRepr.serialize: 11.00µs + InterpreterData::serialize: 119.00µs + signing_step::sign_produced_cids: 101.00µs + verification_step::verify: 441.00µs + verify: 71.00µs + canon-map-single-key (7.52ms; 55.312 MiB, 55.312 MiB): benchmarking a map insert operation + air::runner::execute_air: 7.52ms + preparation_step::preparation::parse_data: 432.00µs + try_from_slice: 389.00µs + preparation_step::preparation::prepare: 224.00µs + air::preparation_step::preparation::make_exec_ctx: 42.00µs + CallResultsRepr.deserialize: 12.00µs + air_parser::parser::air_parser::parse: 66.00µs + runner::execute: 4.37ms + runner::farewell: 1.78ms + from_success_result: 1.76ms + populate_outcome_from_contexts: 1.52ms + CallRequestsRepr.serialize: 11.00µs + InterpreterData::serialize: 1.25ms + signing_step::sign_produced_cids: 99.00µs + verification_step::verify: 443.00µs + verify: 68.00µs + dashboard (5.65ms; 52.625 MiB, 52.625 MiB): big dashboard test + air::runner::execute_air: 5.65ms + preparation_step::preparation::parse_data: 996.00µs + try_from_slice: 943.00µs + preparation_step::preparation::prepare: 361.00µs + air::preparation_step::preparation::make_exec_ctx: 61.00µs + CallResultsRepr.deserialize: 13.00µs + air_parser::parser::air_parser::parse: 183.00µs + runner::execute: 762.00µs + runner::farewell: 514.00µs + from_success_result: 494.00µs + populate_outcome_from_contexts: 452.00µs + CallRequestsRepr.serialize: 21.00µs + InterpreterData::serialize: 227.00µs + signing_step::sign_produced_cids: 101.00µs + verification_step::verify: 2.75ms + verify: 158.00µs + long-data (5.12ms; 53.812 MiB, 53.812 MiB): Long data trace + air::runner::execute_air: 5.12ms + preparation_step::preparation::parse_data: 1.89ms + try_from_slice: 1.85ms + preparation_step::preparation::prepare: 224.00µs + air::preparation_step::preparation::make_exec_ctx: 66.00µs + CallResultsRepr.deserialize: 15.00µs + air_parser::parser::air_parser::parse: 35.00µs + runner::execute: 8.00µs + runner::farewell: 964.00µs + from_success_result: 944.00µs + populate_outcome_from_contexts: 907.00µs + CallRequestsRepr.serialize: 12.00µs + InterpreterData::serialize: 412.00µs + signing_step::sign_produced_cids: 102.00µs + verification_step::verify: 1.75ms + verify: 668.00µs + multiple-cids10 (2.62ms; 52.500 MiB, 52.500 MiB): verifying multiple CIDs for single peer + air::runner::execute_air: 2.62ms + preparation_step::preparation::parse_data: 432.00µs + try_from_slice: 381.00µs + preparation_step::preparation::prepare: 237.00µs + air::preparation_step::preparation::make_exec_ctx: 52.00µs + CallResultsRepr.deserialize: 12.00µs + air_parser::parser::air_parser::parse: 70.00µs + runner::execute: 417.00µs + runner::farewell: 388.00µs + from_success_result: 368.00µs + populate_outcome_from_contexts: 319.00µs + CallRequestsRepr.serialize: 12.00µs + InterpreterData::serialize: 140.00µs + signing_step::sign_produced_cids: 101.00µs + verification_step::verify: 878.00µs + verify: 179.00µs + multiple-peers8 (9.45ms; 53.438 MiB, 53.438 MiB): verifying many CIDs for many peers + air::runner::execute_air: 9.45ms + preparation_step::preparation::parse_data: 1.37ms + try_from_slice: 1.31ms + preparation_step::preparation::prepare: 290.00µs + air::preparation_step::preparation::make_exec_ctx: 97.00µs + CallResultsRepr.deserialize: 13.00µs + air_parser::parser::air_parser::parse: 78.00µs + runner::execute: 2.68ms + runner::farewell: 960.00µs + from_success_result: 941.00µs + populate_outcome_from_contexts: 842.00µs + CallRequestsRepr.serialize: 12.00µs + InterpreterData::serialize: 572.00µs + signing_step::sign_produced_cids: 99.00µs + verification_step::verify: 3.88ms + verify: 730.00µs + multiple-sigs30 (17.50ms; 56.188 MiB, 56.188 MiB): signing multiple CIDs + air::runner::execute_air: 17.50ms + preparation_step::preparation::parse_data: 3.92ms + try_from_slice: 3.88ms + preparation_step::preparation::prepare: 368.00µs + air::preparation_step::preparation::make_exec_ctx: 175.00µs + CallResultsRepr.deserialize: 13.00µs + air_parser::parser::air_parser::parse: 76.00µs + runner::execute: 6.95ms + runner::farewell: 2.62ms + from_success_result: 2.60ms + populate_outcome_from_contexts: 2.42ms + CallRequestsRepr.serialize: 12.00µs + InterpreterData::serialize: 1.56ms + signing_step::sign_produced_cids: 443.00µs + verification_step::verify: 2.99ms + verify: 1.27ms + network-explore (3.07ms; 52.375 MiB, 52.375 MiB): 5 peers of network are discovered + air::runner::execute_air: 3.07ms + preparation_step::preparation::parse_data: 494.00µs + try_from_slice: 444.00µs + preparation_step::preparation::prepare: 251.00µs + air::preparation_step::preparation::make_exec_ctx: 46.00µs + CallResultsRepr.deserialize: 12.00µs + air_parser::parser::air_parser::parse: 90.00µs + runner::execute: 142.00µs + runner::farewell: 314.00µs + from_success_result: 295.00µs + populate_outcome_from_contexts: 255.00µs + CallRequestsRepr.serialize: 12.00µs + InterpreterData::serialize: 90.00µs + signing_step::sign_produced_cids: 101.00µs + verification_step::verify: 1.60ms + verify: 60.00µs + null (832.00µs; 52.375 MiB, 52.375 MiB): Empty data and null script + air::runner::execute_air: 832.00µs + preparation_step::preparation::parse_data: 25.00µs + preparation_step::preparation::prepare: 228.00µs + air::preparation_step::preparation::make_exec_ctx: 46.00µs + CallResultsRepr.deserialize: 14.00µs + air_parser::parser::air_parser::parse: 46.00µs + runner::execute: 8.00µs + runner::farewell: 240.00µs + from_success_result: 221.00µs + populate_outcome_from_contexts: 183.00µs + CallRequestsRepr.serialize: 14.00µs + InterpreterData::serialize: 31.00µs + signing_step::sign_produced_cids: 109.00µs + verification_step::verify: 40.00µs + verify: 10.00µs + parser-10000-100 (24.20ms; 54.625 MiB, 54.625 MiB): long air script with lot of variable assignments + air::runner::execute_air: 24.20ms + preparation_step::preparation::parse_data: 26.00µs + preparation_step::preparation::prepare: 22.70ms + air::preparation_step::preparation::make_exec_ctx: 52.00µs + CallResultsRepr.deserialize: 17.00µs + air_parser::parser::air_parser::parse: 22.50ms + runner::execute: 44.00µs + runner::farewell: 243.00µs + from_success_result: 222.00µs + populate_outcome_from_contexts: 186.00µs + CallRequestsRepr.serialize: 12.00µs + InterpreterData::serialize: 33.00µs + signing_step::sign_produced_cids: 108.00µs + verification_step::verify: 44.00µs + verify: 9.00µs + parser-calls-10000-100 (23.10ms; 54.375 MiB, 54.375 MiB): multiple calls parser benchmark + air::runner::execute_air: 23.10ms + preparation_step::preparation::parse_data: 26.00µs + preparation_step::preparation::prepare: 21.40ms + air::preparation_step::preparation::make_exec_ctx: 53.00µs + CallResultsRepr.deserialize: 16.00µs + air_parser::parser::air_parser::parse: 21.20ms + runner::execute: 43.00µs + runner::farewell: 244.00µs + from_success_result: 224.00µs + populate_outcome_from_contexts: 187.00µs + CallRequestsRepr.serialize: 15.00µs + InterpreterData::serialize: 32.00µs + signing_step::sign_produced_cids: 112.00µs + verification_step::verify: 58.00µs + verify: 17.00µs + populate-map-multiple-keys (3.60ms; 53.000 MiB, 53.000 MiB): benchmarking a map insert operation + air::runner::execute_air: 3.60ms + preparation_step::preparation::parse_data: 180.00µs + try_from_slice: 127.00µs + preparation_step::preparation::prepare: 254.00µs + air::preparation_step::preparation::make_exec_ctx: 46.00µs + CallResultsRepr.deserialize: 14.00µs + air_parser::parser::air_parser::parse: 87.00µs + runner::execute: 2.14ms + runner::farewell: 344.00µs + from_success_result: 324.00µs + populate_outcome_from_contexts: 289.00µs + CallRequestsRepr.serialize: 11.00µs + InterpreterData::serialize: 103.00µs + signing_step::sign_produced_cids: 99.00µs + verification_step::verify: 407.00µs + verify: 40.00µs + populate-map-single-key (2.82ms; 52.938 MiB, 52.938 MiB): benchmarking a map insert operation + air::runner::execute_air: 2.82ms + preparation_step::preparation::parse_data: 216.00µs + try_from_slice: 175.00µs + preparation_step::preparation::prepare: 233.00µs + air::preparation_step::preparation::make_exec_ctx: 43.00µs + CallResultsRepr.deserialize: 13.00µs + air_parser::parser::air_parser::parse: 74.00µs + runner::execute: 1.30ms + runner::farewell: 368.00µs + from_success_result: 347.00µs + populate_outcome_from_contexts: 292.00µs + CallRequestsRepr.serialize: 12.00µs + InterpreterData::serialize: 118.00µs + signing_step::sign_produced_cids: 99.00µs + verification_step::verify: 432.00µs + verify: 71.00µs Machine 62dabcde478dc58760ebbe71ef6047299144a5f63990c6c3d826ebf30175adfc: Platform: Linux-5.15.0-60-generic-x86_64-with-glibc2.35 Timestamp: 2023-02-14 10:33:54.321822+00:00 From 39b7019a965387f9613ef8102a36d21f3a507ce6 Mon Sep 17 00:00:00 2001 From: Valery Antopol Date: Tue, 16 Jan 2024 14:33:20 +0400 Subject: [PATCH 02/14] WIP --- Cargo.lock | 888 ++++++++++-------- Cargo.toml | 6 + air/Cargo.toml | 2 +- avm/server/Cargo.toml | 5 +- avm/server/src/avm.rs | 6 +- avm/server/src/runner.rs | 27 +- benches/PERFORMANCE.json | 668 ++++++------- benches/PERFORMANCE.txt | 654 ++++++------- crates/air-lib/test-utils/Cargo.toml | 2 + .../test-utils/src/wasm_test_runner.rs | 30 +- tools/cli/air/Cargo.toml | 2 +- tools/cli/air/src/trace/run/wasm.rs | 10 +- 12 files changed, 1216 insertions(+), 1084 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 3e83b3b5f8..bc4d6c0237 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -64,15 +64,6 @@ dependencies = [ "syn 2.0.41", ] -[[package]] -name = "addr2line" -version = "0.17.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9ecd88a8c8378ca913a680cd98f0f13ac67383d35993f86c90a70e3f137816b" -dependencies = [ - "gimli 0.26.2", -] - [[package]] name = "addr2line" version = "0.21.0" @@ -284,6 +275,7 @@ dependencies = [ "serde", "serde_json", "sha2 0.10.8", + "tokio", ] [[package]] @@ -439,7 +431,7 @@ dependencies = [ "criterion 0.3.6", "csv", "ed25519-dalek 1.0.1", - "env_logger 0.7.1", + "env_logger", "fluence-app-service", "fluence-keypair", "log", @@ -658,6 +650,17 @@ dependencies = [ "windows-sys 0.48.0", ] +[[package]] +name = "async-recursion" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5fd55a5ba1179988837d24ab4c7cc8ed6efdeff578ede0416b4225a5fca35bd0" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.41", +] + [[package]] name = "async-signal" version = "0.2.5" @@ -778,11 +781,13 @@ dependencies = [ "log", "maplit", "marine-runtime", + "marine-wasmtime-backend", "parking_lot 0.12.1", "polyplets", "serde", "serde_json", "thiserror", + "tokio", "tracing", ] @@ -792,12 +797,12 @@ version = "0.3.69" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2089b7e3f35b9dd2d0ed921ead4f6d318c27680d4a5bd167b3ee120edb105837" dependencies = [ - "addr2line 0.21.0", + "addr2line", "cc", "cfg-if 1.0.0", "libc", "miniz_oxide", - "object 0.32.1", + "object", "rustc-demangle", ] @@ -1171,38 +1176,50 @@ dependencies = [ [[package]] name = "cap-fs-ext" -version = "1.0.15" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58bc48200a1a0fa6fba138b1802ad7def18ec1cdd92f7b2a04e21f1bd887f7b9" +checksum = "b779b2d0a001c125b4584ad586268fb4b92d957bff8d26d7fe0dd78283faa814" dependencies = [ "cap-primitives", "cap-std", - "io-lifetimes 1.0.11", + "io-lifetimes 2.0.3", "windows-sys 0.48.0", ] +[[package]] +name = "cap-net-ext" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ffc30dee200c20b4dcb80572226f42658e1d9c4b668656d7cc59c33d50e396e" +dependencies = [ + "cap-primitives", + "cap-std", + "rustix 0.38.28", + "smallvec", +] + [[package]] name = "cap-primitives" -version = "1.0.15" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4b6df5b295dca8d56f35560be8c391d59f0420f72e546997154e24e765e6451" +checksum = "2bf30c373a3bee22c292b1b6a7a26736a38376840f1af3d2d806455edf8c3899" dependencies = [ "ambient-authority", - "fs-set-times 0.19.2", + "fs-set-times", "io-extras", - "io-lifetimes 1.0.11", + "io-lifetimes 2.0.3", "ipnet", "maybe-owned", - "rustix 0.37.27", + "rustix 0.38.28", "windows-sys 0.48.0", - "winx 0.35.1", + "winx", ] [[package]] name = "cap-rand" -version = "1.0.15" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d25555efacb0b5244cf1d35833d55d21abc916fff0eaad254b8e2453ea9b8ab" +checksum = "577de6cff7c2a47d6b13efe5dd28bf116bd7f8f7db164ea95b7cc2640711f522" dependencies = [ "ambient-authority", "rand 0.8.5", @@ -1210,26 +1227,26 @@ dependencies = [ [[package]] name = "cap-std" -version = "1.0.15" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3373a62accd150b4fcba056d4c5f3b552127f0ec86d3c8c102d60b978174a012" +checksum = "84bade423fa6403efeebeafe568fdb230e8c590a275fba2ba978dd112efcf6e9" dependencies = [ "cap-primitives", "io-extras", - "io-lifetimes 1.0.11", - "rustix 0.37.27", + "io-lifetimes 2.0.3", + "rustix 0.38.28", ] [[package]] name = "cap-time-ext" -version = "1.0.15" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e95002993b7baee6b66c8950470e59e5226a23b3af39fc59c47fe416dd39821a" +checksum = "f8f52b3c8f4abfe3252fd0a071f3004aaa3b18936ec97bdbd8763ce03aff6247" dependencies = [ "cap-primitives", "once_cell", - "rustix 0.37.27", - "winx 0.35.1", + "rustix 0.38.28", + "winx", ] [[package]] @@ -1514,28 +1531,28 @@ dependencies = [ [[package]] name = "cranelift-bforest" -version = "0.93.2" +version = "0.100.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2bc42ba2e232e5b20ff7dc299a812d53337dadce9a7e39a238e6a5cb82d2e57b" +checksum = "751cbf89e513f283c0641eb7f95dc72fda5051dd95ca203d1dc45e26bc89dba8" dependencies = [ "cranelift-entity", ] [[package]] name = "cranelift-codegen" -version = "0.93.2" +version = "0.100.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "253531aca9b6f56103c9420369db3263e784df39aa1c90685a1f69cfbba0623e" +checksum = "210730edc05121e915201cc36595e1f00062094669fa07ac362340e3627b3dc5" dependencies = [ - "arrayvec 0.7.4", "bumpalo", "cranelift-bforest", "cranelift-codegen-meta", "cranelift-codegen-shared", + "cranelift-control", "cranelift-entity", "cranelift-isle", - "gimli 0.26.2", - "hashbrown 0.12.3", + "gimli 0.28.1", + "hashbrown 0.14.3", "log", "regalloc2", "smallvec", @@ -1544,33 +1561,43 @@ dependencies = [ [[package]] name = "cranelift-codegen-meta" -version = "0.93.2" +version = "0.100.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72f2154365e2bff1b1b8537a7181591fdff50d8e27fa6e40d5c69c3bad0ca7c8" +checksum = "b5dc7fdf210c53db047f3eaf49b3a89efee0cc3d9a2ce0c0f0236933273d0c53" dependencies = [ "cranelift-codegen-shared", ] [[package]] name = "cranelift-codegen-shared" -version = "0.93.2" +version = "0.100.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "687e14e3f5775248930e0d5a84195abef8b829958e9794bf8d525104993612b4" +checksum = "f46875cc87d963119d78fe5c19852757dc6eea3cb9622c0df69c26b242cd44b4" + +[[package]] +name = "cranelift-control" +version = "0.100.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "375dca8f58d8a801a85e11730c1529c5c4a9c3593dfb12118391ac437b037155" +dependencies = [ + "arbitrary", +] [[package]] name = "cranelift-entity" -version = "0.93.2" +version = "0.100.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f42ea692c7b450ad18b8c9889661505d51c09ec4380cf1c2d278dbb2da22cae1" +checksum = "cc619b86fe3c72f43fc417c9fd67a04ec0c98296e5940922d9fd9e6eedf72521" dependencies = [ "serde", + "serde_derive", ] [[package]] name = "cranelift-frontend" -version = "0.93.2" +version = "0.100.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8483c2db6f45fe9ace984e5adc5d058102227e4c62e5aa2054e16b0275fd3a6e" +checksum = "7eb607fd19ae264da18f9f2532e7302b826f7fbf77bf88365fc075f2e3419436" dependencies = [ "cranelift-codegen", "log", @@ -1580,15 +1607,15 @@ dependencies = [ [[package]] name = "cranelift-isle" -version = "0.93.2" +version = "0.100.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e9793158837678902446c411741d87b43f57dadfb944f2440db4287cda8cbd59" +checksum = "9fe806a6470dddfdf79e878af6a96afb1235a09fe3e21f9e0c2f18d402820432" [[package]] name = "cranelift-native" -version = "0.93.2" +version = "0.100.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72668c7755f2b880665cb422c8ad2d56db58a88b9bebfef0b73edc2277c13c49" +checksum = "fac7f1722660b10af1f7229c0048f716bfd8bd344549b0e06e3eb6417ec3fe5b" dependencies = [ "cranelift-codegen", "libc", @@ -1597,9 +1624,9 @@ dependencies = [ [[package]] name = "cranelift-wasm" -version = "0.93.2" +version = "0.100.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3852ce4b088b44ac4e29459573943009a70d1b192c8d77ef949b4e814f656fc1" +checksum = "b1b65810be56b619c3c55debade92798d999f34bf0670370c578afab5d905f06" dependencies = [ "cranelift-codegen", "cranelift-entity", @@ -1607,7 +1634,7 @@ dependencies = [ "itertools", "log", "smallvec", - "wasmparser 0.100.0", + "wasmparser 0.112.0", "wasmtime-types", ] @@ -1722,7 +1749,7 @@ dependencies = [ "autocfg", "cfg-if 1.0.0", "crossbeam-utils", - "memoffset 0.9.0", + "memoffset", ] [[package]] @@ -1923,6 +1950,15 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "debugid" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef552e6f588e446098f6ba40d89ac146c8c7b64aade83c051ee00bb5d2bc18d" +dependencies = [ + "uuid", +] + [[package]] name = "der" version = "0.7.8" @@ -2193,20 +2229,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "44533bbbb3bb3c1fa17d9f2e4e38bbbaf8396ba82193c4cb1b6445d711445d36" dependencies = [ "atty", - "humantime 1.3.0", - "log", - "regex", - "termcolor", -] - -[[package]] -name = "env_logger" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95b3f3e67048839cb0d0781f445682a35113da7121f7c949db0e2be96a4fbece" -dependencies = [ - "humantime 2.1.0", - "is-terminal", + "humantime", "log", "regex", "termcolor", @@ -2304,6 +2327,12 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4443176a9f2c162692bd3d352d745ef9413eec5782a80d8fd6f8a1ac692a07f7" +[[package]] +name = "fallible-iterator" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2acce4a10f12dc2fb14a218589d4f1f62ef011b2d0cc4b3cb1bba8e94da14649" + [[package]] name = "fastrand" version = "1.9.0" @@ -2336,16 +2365,6 @@ version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "27573eac26f4dd11e2b1916c3fe1baa56407c83c71a773a8ba17ec0bca03b6b7" -[[package]] -name = "file-per-thread-logger" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84f2e425d9790201ba4af4630191feac6dcc98765b118d4d18e91d23c2353866" -dependencies = [ - "env_logger 0.10.1", - "log", -] - [[package]] name = "filetime" version = "0.2.23" @@ -2385,9 +2404,7 @@ dependencies = [ [[package]] name = "fluence-app-service" -version = "0.29.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b0916285affb8d7c59c80a38f97563ea6fe1082f14778d22e5c8bec7f8537ec" +version = "0.31.0" dependencies = [ "log", "maplit", @@ -2404,8 +2421,6 @@ dependencies = [ [[package]] name = "fluence-it-types" version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45e8d8d5ed4d1f5d21ee5fcd0f6a7b0feea113d918e7ece4f3dd0f8a0b99caa6" dependencies = [ "it-to-bytes", "nom", @@ -2469,24 +2484,13 @@ dependencies = [ [[package]] name = "fs-set-times" -version = "0.18.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "857cf27edcb26c2a36d84b2954019573d335bb289876113aceacacdca47a4fd4" -dependencies = [ - "io-lifetimes 1.0.11", - "rustix 0.36.17", - "windows-sys 0.45.0", -] - -[[package]] -name = "fs-set-times" -version = "0.19.2" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d167b646a876ba8fda6b50ac645cfd96242553cbaf0ca4fccaa39afcbf0801f" +checksum = "033b337d725b97690d86893f9de22b67b80dcc4e9ad815f348254c38119db8fb" dependencies = [ - "io-lifetimes 1.0.11", + "io-lifetimes 2.0.3", "rustix 0.38.28", - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] @@ -2507,6 +2511,7 @@ checksum = "da0290714b38af9b4a7b094b8a37086d1b4e61f2df9122c3cad2577669145335" dependencies = [ "futures-channel", "futures-core", + "futures-executor", "futures-io", "futures-sink", "futures-task", @@ -2571,6 +2576,17 @@ dependencies = [ "pin-project-lite", ] +[[package]] +name = "futures-macro" +version = "0.3.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53b153fd91e4b0147f4aced87be237c98248656bb01050b96bf3ee89220a8ddb" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.41", +] + [[package]] name = "futures-sink" version = "0.3.29" @@ -2592,6 +2608,7 @@ dependencies = [ "futures-channel", "futures-core", "futures-io", + "futures-macro", "futures-sink", "futures-task", "memchr", @@ -2609,6 +2626,19 @@ dependencies = [ "byteorder", ] +[[package]] +name = "fxprof-processed-profile" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "27d12c0aed7f1e24276a241aadc4cb8ea9f83000f34bc062b7cc2d51e3b0fabd" +dependencies = [ + "bitflags 2.4.1", + "debugid", + "fxhash", + "serde", + "serde_json", +] + [[package]] name = "generic-array" version = "0.14.7" @@ -2647,7 +2677,7 @@ version = "0.26.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "22030e2c5a68ec659fde1e949a745124b48e6fa8b045b7ed5bd1fe4ccc5c4e5d" dependencies = [ - "fallible-iterator", + "fallible-iterator 0.2.0", "indexmap 1.9.3", "stable_deref_trait", ] @@ -2657,6 +2687,11 @@ name = "gimli" version = "0.28.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" +dependencies = [ + "fallible-iterator 0.3.0", + "indexmap 2.1.0", + "stable_deref_trait", +] [[package]] name = "h2" @@ -2697,9 +2732,6 @@ name = "hashbrown" version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" -dependencies = [ - "ahash 0.7.7", -] [[package]] name = "hashbrown" @@ -2715,6 +2747,9 @@ name = "hashbrown" version = "0.14.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" +dependencies = [ + "ahash 0.8.6", +] [[package]] name = "heck" @@ -2852,12 +2887,6 @@ dependencies = [ "quick-error", ] -[[package]] -name = "humantime" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" - [[package]] name = "hyper" version = "0.14.27" @@ -2991,12 +3020,12 @@ dependencies = [ [[package]] name = "io-extras" -version = "0.17.4" +version = "0.18.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fde93d48f0d9277f977a333eca8313695ddd5301dc96f7e02aeddcb0dd99096f" +checksum = "c301e73fb90e8a29e600a9f402d095765f74310d582916a952f618836a1bd1ed" dependencies = [ - "io-lifetimes 1.0.11", - "windows-sys 0.48.0", + "io-lifetimes 2.0.3", + "windows-sys 0.52.0", ] [[package]] @@ -3044,9 +3073,7 @@ dependencies = [ [[package]] name = "it-json-serde" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "145ec580d7bd2edbe7177841fa6f48bf820c5bbaa0fc51d4ecef48a8f91889e5" +version = "0.5.0" dependencies = [ "serde", "serde_derive", @@ -3057,11 +3084,12 @@ dependencies = [ [[package]] name = "it-lilo" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f14693c2c3696b46349b0bc54f8b39de8eb67951b6623f42ff6b6b2d129ff00e" +version = "0.6.0" dependencies = [ + "anyhow", + "async-recursion", "fluence-it-types", + "futures", "it-memory-traits", "log", "paste", @@ -3071,8 +3099,6 @@ dependencies = [ [[package]] name = "it-memory-traits" version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d563f2a6baee17cf471b7951dfb96ab17fecc5e8947de39f1057cf3fb4cc906d" dependencies = [ "thiserror", ] @@ -3080,8 +3106,6 @@ dependencies = [ [[package]] name = "it-to-bytes" version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "729c74bb4236418898a219c6d96f14cba77456dd7c04a2e99e65e9c643709b56" [[package]] name = "itertools" @@ -3296,12 +3320,6 @@ dependencies = [ "vcpkg", ] -[[package]] -name = "linux-raw-sys" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f051f77a7c8e6957c0696eac88f26b0117e54f52d3fc682ab19397a8812846a4" - [[package]] name = "linux-raw-sys" version = "0.3.8" @@ -3358,12 +3376,11 @@ dependencies = [ [[package]] name = "marine-core" -version = "0.24.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4f2db990567b2677d4b03d3f5b019c9f03e4365eaa8303cef083e388d960e47" +version = "0.26.0" dependencies = [ "anyhow", "bytesize", + "futures", "it-lilo", "it-memory-traits", "log", @@ -3387,9 +3404,7 @@ dependencies = [ [[package]] name = "marine-it-generator" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b0cc0ce2ee4ee0986abf71327b84ef3fb26dcb33b866226f9e659d1cce922fd" +version = "0.13.0" dependencies = [ "it-lilo", "marine-it-parser", @@ -3398,15 +3413,13 @@ dependencies = [ "serde", "serde_json", "thiserror", - "walrus 0.20.3", + "walrus", "wasmer-interface-types-fl", ] [[package]] name = "marine-it-interfaces" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3bdc1a0d26f38f8d0375c7f8aa0621de90b5966e38b407c7505ead9649bbd92" +version = "0.9.0" dependencies = [ "multimap 0.8.3", "wasmer-interface-types-fl", @@ -3414,9 +3427,7 @@ dependencies = [ [[package]] name = "marine-it-parser" -version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52907d7e7b9487a029dd3d99e647307c8808d7fba327e27113b0807d4868b315" +version = "0.15.0" dependencies = [ "anyhow", "itertools", @@ -3427,7 +3438,7 @@ dependencies = [ "semver 1.0.20", "serde", "thiserror", - "walrus 0.20.3", + "walrus", "wasmer-interface-types-fl", ] @@ -3470,8 +3481,6 @@ dependencies = [ [[package]] name = "marine-min-it-version" version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a84be3c30abaa13df50cdaceb6b62ca806ac8a10fd5bacfeb4371ec1bd0f5101" dependencies = [ "once_cell", "semver 1.0.20", @@ -3479,9 +3488,7 @@ dependencies = [ [[package]] name = "marine-module-info-parser" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab5aa7160fa89a493ce5367aa4b09f7001e054dd4c6373aa5dd0d1ff22b2466e" +version = "0.11.0" dependencies = [ "anyhow", "chrono", @@ -3491,14 +3498,12 @@ dependencies = [ "semver 1.0.20", "serde", "thiserror", - "walrus 0.20.3", + "walrus", ] [[package]] name = "marine-module-interface" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49d8f21255b94f1c8b2731a2b49c2ed34f955ed2e11dae3fb6c580a346d10bdd" +version = "0.8.0" dependencies = [ "anyhow", "itertools", @@ -3507,7 +3512,7 @@ dependencies = [ "semver 1.0.20", "serde", "thiserror", - "walrus 0.19.0", + "walrus", "wasmer-interface-types-fl", ] @@ -3536,9 +3541,7 @@ dependencies = [ [[package]] name = "marine-runtime" -version = "0.30.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe2f5584266fe595f06fa83fd4cc0de4c2cff513906869a4e37f112354ca08b8" +version = "0.32.0" dependencies = [ "bytesize", "it-json-serde", @@ -3576,16 +3579,13 @@ dependencies = [ [[package]] name = "marine-utils" version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e86cb57ff0e2fdc8e188a52d388287d38e5cc781eddd09a82d20f8ee1f48b80" [[package]] name = "marine-wasm-backend-traits" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8094cd7d1bf6c14ded993fd2d6e6999f7e25c07b2f770277ea28ee64fe433ecc" +version = "0.5.0" dependencies = [ "anyhow", + "futures", "it-memory-traits", "multimap 0.8.3", "paste", @@ -3596,11 +3596,10 @@ dependencies = [ [[package]] name = "marine-wasmtime-backend" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "edb895ec13df3b2241b848b3b138569afd3aadd21719af99a2b8aafa5595edec" +version = "0.5.0" dependencies = [ "anyhow", + "futures", "it-memory-traits", "log", "marine-wasm-backend-traits", @@ -3641,15 +3640,6 @@ dependencies = [ "rustix 0.38.28", ] -[[package]] -name = "memoffset" -version = "0.6.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5aa361d4faea93603064a027415f07bd8e1d5c88c9fbf68bf56a285428fd79ce" -dependencies = [ - "autocfg", -] - [[package]] name = "memoffset" version = "0.9.0" @@ -4427,24 +4417,15 @@ dependencies = [ "libc", ] -[[package]] -name = "object" -version = "0.29.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21158b2c33aa6d4561f1c0a6ea283ca92bc54802a93b263e910746d679a7eb53" -dependencies = [ - "crc32fast", - "hashbrown 0.12.3", - "indexmap 1.9.3", - "memchr", -] - [[package]] name = "object" version = "0.32.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9cf5f9dd3933bd50a9e1f149ec995f39ae2c496d31fd772c1fd45ebc27e902b0" dependencies = [ + "crc32fast", + "hashbrown 0.14.3", + "indexmap 2.1.0", "memchr", ] @@ -5014,6 +4995,17 @@ dependencies = [ "cc", ] +[[package]] +name = "pulldown-cmark" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77a1a2f1f0a7ecff9c31abbe177637be0e97a0aef46cf8738ece09327985d998" +dependencies = [ + "bitflags 1.3.2", + "memchr", + "unicase", +] + [[package]] name = "quick-error" version = "1.2.3" @@ -5186,12 +5178,13 @@ dependencies = [ [[package]] name = "regalloc2" -version = "0.5.1" +version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "300d4fbfb40c1c66a78ba3ddd41c1110247cf52f97b87d0f2fc9209bd49b030c" +checksum = "ad156d539c879b7a24a363a2016d77961786e71f48f2e2fc8302a92abd2429a6" dependencies = [ - "fxhash", + "hashbrown 0.13.2", "log", + "rustc-hash", "slice-group-by", "smallvec", ] @@ -5362,6 +5355,12 @@ version = "0.1.23" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" +[[package]] +name = "rustc-hash" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" + [[package]] name = "rustc-hex" version = "2.1.0" @@ -5386,20 +5385,6 @@ dependencies = [ "semver 1.0.20", ] -[[package]] -name = "rustix" -version = "0.36.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "305efbd14fde4139eb501df5f136994bb520b033fa9fbdce287507dc23b8c7ed" -dependencies = [ - "bitflags 1.3.2", - "errno", - "io-lifetimes 1.0.11", - "libc", - "linux-raw-sys 0.1.4", - "windows-sys 0.45.0", -] - [[package]] name = "rustix" version = "0.37.27" @@ -5409,10 +5394,8 @@ dependencies = [ "bitflags 1.3.2", "errno", "io-lifetimes 1.0.11", - "itoa", "libc", "linux-raw-sys 0.3.8", - "once_cell", "windows-sys 0.48.0", ] @@ -5424,8 +5407,10 @@ checksum = "72e572a5e8ca657d7366229cdde4bd14c4eb5499a9573d4d366fe1b599daa316" dependencies = [ "bitflags 2.4.1", "errno", + "itoa", "libc", "linux-raw-sys 0.4.12", + "once_cell", "windows-sys 0.52.0", ] @@ -5888,6 +5873,12 @@ dependencies = [ "der", ] +[[package]] +name = "sptr" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b9b39299b249ad65f3b7e96443bad61c02ca5cd3589f46cb6d610a0fd6c0d6a" + [[package]] name = "stable_deref_trait" version = "1.2.0" @@ -6029,9 +6020,9 @@ dependencies = [ [[package]] name = "system-interface" -version = "0.25.9" +version = "0.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10081a99cbecbc363d381b9503563785f0b02735fccbb0d4c1a2cb3d39f7e7fe" +checksum = "27ce32341b2c0b70c144bbf35627fdc1ef18c76ced5e5e7b3ee8b5ba6b2ab6a0" dependencies = [ "bitflags 2.4.1", "cap-fs-ext", @@ -6040,7 +6031,7 @@ dependencies = [ "io-lifetimes 2.0.3", "rustix 0.38.28", "windows-sys 0.48.0", - "winx 0.36.3", + "winx", ] [[package]] @@ -6577,6 +6568,15 @@ dependencies = [ "static_assertions", ] +[[package]] +name = "unicase" +version = "2.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7d2d4dafb69621809a81864c9c1b864479e1235c0dd4e199924b9742439ed89" +dependencies = [ + "version_check", +] + [[package]] name = "unicode-bidi" version = "0.3.14" @@ -6717,20 +6717,6 @@ dependencies = [ "winapi-util", ] -[[package]] -name = "walrus" -version = "0.19.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4eb08e48cde54c05f363d984bb54ce374f49e242def9468d2e1b6c2372d291f8" -dependencies = [ - "anyhow", - "id-arena", - "leb128", - "log", - "walrus-macro", - "wasmparser 0.77.1", -] - [[package]] name = "walrus" version = "0.20.3" @@ -6788,9 +6774,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasi-cap-std-sync" -version = "6.0.2" +version = "13.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c22ba2ca9076574dc9de38f3141c63677ce5577ed204d57740691b12d35ec8b3" +checksum = "77c4db6155e71cfae4ed732d87c2583faf4bbdcb77372697eb77d636f46108ba" dependencies = [ "anyhow", "async-trait", @@ -6798,35 +6784,36 @@ dependencies = [ "cap-rand", "cap-std", "cap-time-ext", - "fs-set-times 0.18.1", + "fs-set-times", "io-extras", - "io-lifetimes 1.0.11", + "io-lifetimes 2.0.3", "is-terminal", "once_cell", - "rustix 0.36.17", + "rustix 0.38.28", "system-interface", "tracing", "wasi-common", - "windows-sys 0.42.0", + "windows-sys 0.48.0", ] [[package]] name = "wasi-common" -version = "6.0.2" +version = "13.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13183cd7fed5d94b482f4e30e7a0bbf9b52426d51a647019906a1ecff7e84143" +checksum = "bf3f291b2a567f266ac488715f1742f62b2ca633524708c62ead9c0f71b7d72c" dependencies = [ "anyhow", - "bitflags 1.3.2", + "bitflags 2.4.1", "cap-rand", "cap-std", "io-extras", - "rustix 0.36.17", + "log", + "rustix 0.38.28", "thiserror", "tracing", "wasmtime", "wiggle", - "windows-sys 0.42.0", + "windows-sys 0.48.0", ] [[package]] @@ -6906,6 +6893,15 @@ dependencies = [ "leb128", ] +[[package]] +name = "wasm-encoder" +version = "0.32.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ba64e81215916eaeb48fee292f29401d69235d62d8b8fd92a7b2844ec5ae5f7" +dependencies = [ + "leb128", +] + [[package]] name = "wasm-encoder" version = "0.38.1" @@ -6917,17 +6913,18 @@ dependencies = [ [[package]] name = "wasmer-interface-types-fl" -version = "0.26.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6cd52371bfc227c904a0ab1ff478c287d2f74fa371fcff1d2e157444faf8fda2" +version = "0.27.0" dependencies = [ + "anyhow", "fluence-it-types", + "futures", "it-lilo", "it-memory-traits", "it-to-bytes", "itertools", "log", "nom", + "paste", "safe-transmute", "semver 1.0.20", "serde", @@ -6936,12 +6933,6 @@ dependencies = [ "wast 8.0.0", ] -[[package]] -name = "wasmparser" -version = "0.77.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5fe3d5405e9ea6c1317a656d6e0820912d8b7b3607823a7596117c8f666daf6f" - [[package]] name = "wasmparser" version = "0.80.2" @@ -6950,9 +6941,9 @@ checksum = "449167e2832691a1bff24cde28d2804e90e09586a448c8e76984792c44334a6b" [[package]] name = "wasmparser" -version = "0.100.0" +version = "0.101.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64b20236ab624147dfbb62cf12a19aaf66af0e41b8398838b66e997d07d269d4" +checksum = "bf2f22ef84ac5666544afa52f326f13e16f3d019d2e61e704fd8091c9358b130" dependencies = [ "indexmap 1.9.3", "url", @@ -6960,208 +6951,375 @@ dependencies = [ [[package]] name = "wasmparser" -version = "0.101.1" +version = "0.112.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf2f22ef84ac5666544afa52f326f13e16f3d019d2e61e704fd8091c9358b130" +checksum = "e986b010f47fcce49cf8ea5d5f9e5d2737832f12b53ae8ae785bbe895d0877bf" dependencies = [ - "indexmap 1.9.3", - "url", + "indexmap 2.1.0", + "semver 1.0.20", +] + +[[package]] +name = "wasmparser" +version = "0.118.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95ee9723b928e735d53000dec9eae7b07a60e490c85ab54abb66659fc61bfcd9" +dependencies = [ + "indexmap 2.1.0", + "semver 1.0.20", +] + +[[package]] +name = "wasmprinter" +version = "0.2.75" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d027eb8294904fc715ac0870cebe6b0271e96b90605ee21511e7565c4ce568c" +dependencies = [ + "anyhow", + "wasmparser 0.118.1", ] [[package]] name = "wasmtime" -version = "6.0.2" +version = "13.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76a222f5fa1e14b2cefc286f1b68494d7a965f4bf57ec04c59bb62673d639af6" +checksum = "b0263693caa1486bd4d26a5f18511948a706c9290689386b81b851ce088063ce" dependencies = [ "anyhow", + "async-trait", "bincode", + "bumpalo", "cfg-if 1.0.0", - "indexmap 1.9.3", + "encoding_rs", + "fxprof-processed-profile", + "indexmap 2.1.0", "libc", "log", - "object 0.29.0", + "object", "once_cell", "paste", "psm", "rayon", "serde", + "serde_derive", + "serde_json", "target-lexicon", - "wasmparser 0.100.0", + "wasm-encoder 0.32.0", + "wasmparser 0.112.0", "wasmtime-cache", + "wasmtime-component-macro", + "wasmtime-component-util", "wasmtime-cranelift", "wasmtime-environ", + "wasmtime-fiber", "wasmtime-jit", "wasmtime-runtime", + "wasmtime-winch", "wat", - "windows-sys 0.42.0", + "windows-sys 0.48.0", ] [[package]] name = "wasmtime-asm-macros" -version = "6.0.2" +version = "13.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4407a7246e7d2f3d8fb1cf0c72fda8dbafdb6dd34d555ae8bea0e5ae031089cc" +checksum = "4711e5969236ecfbe70c807804ff9ffb5206c1dbb5c55c5e8200d9f7e8e76adf" dependencies = [ "cfg-if 1.0.0", ] [[package]] name = "wasmtime-cache" -version = "6.0.2" +version = "13.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ceb3adf61d654be0be67fffdce42447b0880481348785be5fe40b5dd7663a4c" +checksum = "5b79f9f79188e5a26b6911b79d3171c06699d9a17ae07f6a265c51635b8d80c2" dependencies = [ "anyhow", - "base64 0.13.1", + "base64 0.21.5", "bincode", "directories-next", - "file-per-thread-logger", "log", - "rustix 0.36.17", + "rustix 0.38.28", "serde", + "serde_derive", "sha2 0.10.8", "toml", - "windows-sys 0.42.0", + "windows-sys 0.48.0", "zstd", ] +[[package]] +name = "wasmtime-component-macro" +version = "13.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed724d0f41c21bcf8754651a59d0423c530069ddca4cf3822768489ad313a812" +dependencies = [ + "anyhow", + "proc-macro2", + "quote", + "syn 2.0.41", + "wasmtime-component-util", + "wasmtime-wit-bindgen", + "wit-parser", +] + +[[package]] +name = "wasmtime-component-util" +version = "13.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e7d69464b94bd312a27d93d0b482cd74bedf01f030199ef0740d6300ebca1d3" + [[package]] name = "wasmtime-cranelift" -version = "6.0.2" +version = "13.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c366bb8647e01fd08cb5589976284b00abfded5529b33d7e7f3f086c68304a4" +checksum = "4e63f53c61ba05eb815f905c1738ad82c95333dd42ef5a8cc2aa3d7dfb2b08d7" dependencies = [ "anyhow", + "cfg-if 1.0.0", "cranelift-codegen", + "cranelift-control", "cranelift-entity", "cranelift-frontend", "cranelift-native", "cranelift-wasm", - "gimli 0.26.2", + "gimli 0.28.1", "log", - "object 0.29.0", + "object", "target-lexicon", "thiserror", - "wasmparser 0.100.0", + "wasmparser 0.112.0", + "wasmtime-cranelift-shared", + "wasmtime-environ", + "wasmtime-versioned-export-macros", +] + +[[package]] +name = "wasmtime-cranelift-shared" +version = "13.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4f6b197d68612f7dc3a17aa9f9587533715ecb8b4755609ce9baf7fb92b74ddc" +dependencies = [ + "anyhow", + "cranelift-codegen", + "cranelift-control", + "cranelift-native", + "gimli 0.28.1", + "object", + "target-lexicon", "wasmtime-environ", ] [[package]] name = "wasmtime-environ" -version = "6.0.2" +version = "13.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "47b8b50962eae38ee319f7b24900b7cf371f03eebdc17400c1dc8575fc10c9a7" +checksum = "18e2558c8b04fd27764d8601d46b8dc39555b79720a41e626bce210a80758932" dependencies = [ "anyhow", "cranelift-entity", - "gimli 0.26.2", - "indexmap 1.9.3", + "gimli 0.28.1", + "indexmap 2.1.0", "log", - "object 0.29.0", + "object", "serde", + "serde_derive", "target-lexicon", "thiserror", - "wasmparser 0.100.0", + "wasm-encoder 0.32.0", + "wasmparser 0.112.0", + "wasmprinter", + "wasmtime-component-util", "wasmtime-types", ] +[[package]] +name = "wasmtime-fiber" +version = "13.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a615a2cf64a49c0dc659c7d850c6cd377b975e0abfdcf0888b282d274a82e730" +dependencies = [ + "cc", + "cfg-if 1.0.0", + "rustix 0.38.28", + "wasmtime-asm-macros", + "wasmtime-versioned-export-macros", + "windows-sys 0.48.0", +] + [[package]] name = "wasmtime-jit" -version = "6.0.2" +version = "13.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffaed4f9a234ba5225d8e64eac7b4a5d13b994aeb37353cde2cbeb3febda9eaa" +checksum = "cd775514b8034b85b0323bfdc60abb1c28d27dbf6e22aad083ed57dac95cf72e" dependencies = [ - "addr2line 0.17.0", + "addr2line", "anyhow", "bincode", "cfg-if 1.0.0", "cpp_demangle", - "gimli 0.26.2", + "gimli 0.28.1", "ittapi", "log", - "object 0.29.0", + "object", "rustc-demangle", + "rustix 0.38.28", "serde", + "serde_derive", "target-lexicon", "wasmtime-environ", "wasmtime-jit-debug", "wasmtime-jit-icache-coherence", "wasmtime-runtime", - "windows-sys 0.42.0", + "windows-sys 0.48.0", ] [[package]] name = "wasmtime-jit-debug" -version = "6.0.2" +version = "13.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eed41cbcbf74ce3ff6f1d07d1b707888166dc408d1a880f651268f4f7c9194b2" +checksum = "c054e27c6ce2a6191edabe89e646da013044dd5369e1d203c89f977f9bd32937" dependencies = [ - "object 0.29.0", + "object", "once_cell", - "rustix 0.36.17", + "rustix 0.38.28", + "wasmtime-versioned-export-macros", ] [[package]] name = "wasmtime-jit-icache-coherence" -version = "6.0.2" +version = "13.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43a28ae1e648461bfdbb79db3efdaee1bca5b940872e4175390f465593a2e54c" +checksum = "7f323977cddf4a262d1b856366b665c5b4d01793c57b79fb42505b9fd9e61e5b" dependencies = [ "cfg-if 1.0.0", "libc", - "windows-sys 0.42.0", + "windows-sys 0.48.0", ] [[package]] name = "wasmtime-runtime" -version = "6.0.2" +version = "13.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e704b126e4252788ccfc3526d4d4511d4b23c521bf123e447ac726c14545217b" +checksum = "29e26461bba043f73cb4183f4ce0d606c0eaac112475867b11e5ea36fe1cac8e" dependencies = [ "anyhow", "cc", "cfg-if 1.0.0", - "indexmap 1.9.3", + "encoding_rs", + "indexmap 2.1.0", "libc", "log", "mach", "memfd", - "memoffset 0.6.5", + "memoffset", "paste", "rand 0.8.5", - "rustix 0.36.17", + "rustix 0.38.28", + "sptr", + "wasm-encoder 0.32.0", "wasmtime-asm-macros", "wasmtime-environ", + "wasmtime-fiber", "wasmtime-jit-debug", - "windows-sys 0.42.0", + "wasmtime-versioned-export-macros", + "wasmtime-wmemcheck", + "windows-sys 0.48.0", ] [[package]] name = "wasmtime-types" -version = "6.0.2" +version = "13.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83e5572c5727c1ee7e8f28717aaa8400e4d22dcbd714ea5457d85b5005206568" +checksum = "6fd7e9b29fee64eea5058cb5e7cb3480b52c2f1312d431d16ea8617ceebeb421" dependencies = [ "cranelift-entity", "serde", + "serde_derive", "thiserror", - "wasmparser 0.100.0", + "wasmparser 0.112.0", +] + +[[package]] +name = "wasmtime-versioned-export-macros" +version = "13.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6362c557c36d8ad4aaab735f14ed9e4f78d6b40ec85a02a88fd859af87682e52" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.41", ] [[package]] name = "wasmtime-wasi" -version = "6.0.2" +version = "13.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01fe90b8643ef9742e2d9e1c76186b53e0d3c3e81aef1ead89c7a538d48947c9" +checksum = "52c9e79f73320d96cd7644b021502dffee09dd92300b073f3541ae44e9ae377c" dependencies = [ "anyhow", + "async-trait", + "bitflags 2.4.1", + "bytes", + "cap-fs-ext", + "cap-net-ext", + "cap-rand", + "cap-std", + "cap-time-ext", + "fs-set-times", + "futures", + "io-extras", + "io-lifetimes 2.0.3", + "is-terminal", + "libc", + "once_cell", + "rustix 0.38.28", + "system-interface", + "thiserror", + "tokio", + "tracing", "wasi-cap-std-sync", "wasi-common", "wasmtime", "wiggle", + "windows-sys 0.48.0", +] + +[[package]] +name = "wasmtime-winch" +version = "13.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa5fc7212424c04c01a20bfa66c4c518e8749dde6546f5e05815dcacbec80723" +dependencies = [ + "anyhow", + "cranelift-codegen", + "gimli 0.28.1", + "object", + "target-lexicon", + "wasmparser 0.112.0", + "wasmtime-cranelift-shared", + "wasmtime-environ", + "winch-codegen", ] +[[package]] +name = "wasmtime-wit-bindgen" +version = "13.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dcc03bd58f77a68dc6a0b2ba2f8e64b1f902b50389d21bbcc690ef2f3bb87198" +dependencies = [ + "anyhow", + "heck 0.4.1", + "indexmap 2.1.0", + "wit-parser", +] + +[[package]] +name = "wasmtime-wmemcheck" +version = "13.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e485bf54eba675ca615f8f55788d3a8cd44e7bd09b8b4011edc22c2c41d859e" + [[package]] name = "wast" version = "8.0.0" @@ -7237,13 +7395,13 @@ dependencies = [ [[package]] name = "wiggle" -version = "6.0.2" +version = "13.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4dd02c6a8098bc5fce898313df9ed13e3a98afcdb579a393070ee013505ca7ac" +checksum = "e81ddbdc400b38d04241d740d0406ef343bd242c460f252fe59f29ad964ad24c" dependencies = [ "anyhow", "async-trait", - "bitflags 1.3.2", + "bitflags 2.4.1", "thiserror", "tracing", "wasmtime", @@ -7252,28 +7410,28 @@ dependencies = [ [[package]] name = "wiggle-generate" -version = "6.0.2" +version = "13.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b657cf901cbffedfd90ececa74ed835864704562052202514d598930cf80bbaa" +checksum = "7c993123d6db1a1908ef8352aabdf2e681a3dcdedc3656beb747e4db16d3cf08" dependencies = [ "anyhow", "heck 0.4.1", "proc-macro2", "quote", "shellexpand", - "syn 1.0.109", + "syn 2.0.41", "witx", ] [[package]] name = "wiggle-macro" -version = "6.0.2" +version = "13.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7dd1d09a625f96effa501cdff06192eb6a89eeadd4fd4e2489e0c6907f604307" +checksum = "476e3e09bc68e82624b70a322265515523754cb9e05fcacceabd216e276bc2ed" dependencies = [ "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.41", "wiggle-generate", ] @@ -7309,36 +7467,28 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] -name = "windows-core" -version = "0.51.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1f8cf84f35d2db49a46868f947758c7a1138116f7fac3bc844f43ade1292e64" -dependencies = [ - "windows-targets 0.48.5", -] - -[[package]] -name = "windows-sys" -version = "0.42.0" +name = "winch-codegen" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7" +checksum = "b9b01ca6722f7421c9cdbe4c9b62342ce864d0a9e8736d56dac717a86b1a65ae" dependencies = [ - "windows_aarch64_gnullvm 0.42.2", - "windows_aarch64_msvc 0.42.2", - "windows_i686_gnu 0.42.2", - "windows_i686_msvc 0.42.2", - "windows_x86_64_gnu 0.42.2", - "windows_x86_64_gnullvm 0.42.2", - "windows_x86_64_msvc 0.42.2", + "anyhow", + "cranelift-codegen", + "gimli 0.28.1", + "regalloc2", + "smallvec", + "target-lexicon", + "wasmparser 0.112.0", + "wasmtime-environ", ] [[package]] -name = "windows-sys" -version = "0.45.0" +name = "windows-core" +version = "0.51.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" +checksum = "f1f8cf84f35d2db49a46868f947758c7a1138116f7fac3bc844f43ade1292e64" dependencies = [ - "windows-targets 0.42.2", + "windows-targets 0.48.5", ] [[package]] @@ -7359,21 +7509,6 @@ dependencies = [ "windows-targets 0.52.0", ] -[[package]] -name = "windows-targets" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071" -dependencies = [ - "windows_aarch64_gnullvm 0.42.2", - "windows_aarch64_msvc 0.42.2", - "windows_i686_gnu 0.42.2", - "windows_i686_msvc 0.42.2", - "windows_x86_64_gnu 0.42.2", - "windows_x86_64_gnullvm 0.42.2", - "windows_x86_64_msvc 0.42.2", -] - [[package]] name = "windows-targets" version = "0.48.5" @@ -7404,12 +7539,6 @@ dependencies = [ "windows_x86_64_msvc 0.52.0", ] -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" - [[package]] name = "windows_aarch64_gnullvm" version = "0.48.5" @@ -7422,12 +7551,6 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cb7764e35d4db8a7921e09562a0304bf2f93e0a51bfccee0bd0bb0b666b015ea" -[[package]] -name = "windows_aarch64_msvc" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" - [[package]] name = "windows_aarch64_msvc" version = "0.48.5" @@ -7440,12 +7563,6 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bbaa0368d4f1d2aaefc55b6fcfee13f41544ddf36801e793edbbfd7d7df075ef" -[[package]] -name = "windows_i686_gnu" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" - [[package]] name = "windows_i686_gnu" version = "0.48.5" @@ -7458,12 +7575,6 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a28637cb1fa3560a16915793afb20081aba2c92ee8af57b4d5f28e4b3e7df313" -[[package]] -name = "windows_i686_msvc" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" - [[package]] name = "windows_i686_msvc" version = "0.48.5" @@ -7476,12 +7587,6 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ffe5e8e31046ce6230cc7215707b816e339ff4d4d67c65dffa206fd0f7aa7b9a" -[[package]] -name = "windows_x86_64_gnu" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" - [[package]] name = "windows_x86_64_gnu" version = "0.48.5" @@ -7494,12 +7599,6 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3d6fa32db2bc4a2f5abeacf2b69f7992cd09dca97498da74a151a3132c26befd" -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" - [[package]] name = "windows_x86_64_gnullvm" version = "0.48.5" @@ -7512,12 +7611,6 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1a657e1e9d3f514745a572a6846d3c7aa7dbe1658c056ed9c3344c4109a6949e" -[[package]] -name = "windows_x86_64_msvc" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" - [[package]] name = "windows_x86_64_msvc" version = "0.48.5" @@ -7551,23 +7644,30 @@ dependencies = [ [[package]] name = "winx" -version = "0.35.1" +version = "0.36.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c52a121f0fbf9320d5f2a9a5d82f6cb7557eda5e8b47fc3e7f359ec866ae960" +checksum = "f9643b83820c0cd246ecabe5fa454dd04ba4fa67996369466d0747472d337346" dependencies = [ - "bitflags 1.3.2", - "io-lifetimes 1.0.11", - "windows-sys 0.48.0", + "bitflags 2.4.1", + "windows-sys 0.52.0", ] [[package]] -name = "winx" -version = "0.36.3" +name = "wit-parser" +version = "0.11.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9643b83820c0cd246ecabe5fa454dd04ba4fa67996369466d0747472d337346" +checksum = "a39edca9abb16309def3843af73b58d47d243fe33a9ceee572446bcc57556b9a" dependencies = [ - "bitflags 2.4.1", - "windows-sys 0.52.0", + "anyhow", + "id-arena", + "indexmap 2.1.0", + "log", + "pulldown-cmark", + "semver 1.0.20", + "serde", + "serde_json", + "unicode-xid", + "url", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 36123a4d91..f37f71a547 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -40,3 +40,9 @@ debug = true overflow-checks = true debug-assertions = false panic = "unwind" + +[patch.crates-io] +wasmer-interface-types-fl = {version = "0.27.0", path = "../interface-types/wasmer-it"} +it-memory-traits= {version = "0.4.0", path = "../interface-types/crates/it-memory-traits"} +it-lilo = {version = "0.6.0", path = "../interface-types/crates/it-lilo"} +fluence-it-types = {version = "0.4.1", path = "../interface-types/crates/it-types"} \ No newline at end of file diff --git a/air/Cargo.toml b/air/Cargo.toml index c82e7b0626..58174b45e9 100644 --- a/air/Cargo.toml +++ b/air/Cargo.toml @@ -49,7 +49,7 @@ tracing = "0.1.40" [dev_dependencies] air-test-utils = { path = "../crates/air-lib/test-utils" } air-testing-framework = { path = "../crates/testing-framework" } -fluence-app-service = "0.29.0" +fluence-app-service = {version = "0.31.0", path = "../../marine/crates/fluence-app-service"} marine-rs-sdk = { version = "0.10.0", features = ["logger"] } borsh = "0.10.3" diff --git a/avm/server/Cargo.toml b/avm/server/Cargo.toml index e4447c0086..88bc250db4 100644 --- a/avm/server/Cargo.toml +++ b/avm/server/Cargo.toml @@ -19,7 +19,9 @@ air-interpreter-interface = { version = "0.15.2", path = "../../crates/air-lib/i air-interpreter-sede = { version = "0.1.0", path = "../../crates/air-lib/interpreter-sede" } air-utils = { version = "0.2.0", path = "../../crates/air-lib/utils" } avm-data-store = { version = "0.7.3", path = "../../crates/data-store" } -marine-runtime = "0.30.0" +#marine-runtime = "0.30.0" +marine-runtime = {version = "0.32.0", path = "../../../marine/marine"} +marine-wasmtime-backend = {version = "0.5.0", path = "../../../marine/crates/wasmtime-backend"} polyplets = { version = "0.5.1", path = "../../crates/air-lib/polyplets" } avm-interface = { version = "0.29.3", path = "../../avm/interface" } @@ -32,3 +34,4 @@ log = "0.4.20" parking_lot = "0.12.1" tracing = "0.1.40" fluence-keypair = { version = "0.10.3", default-features = false } +tokio = { version = "1", features = ["full"] } diff --git a/avm/server/src/avm.rs b/avm/server/src/avm.rs index a26b7bb3ca..fa4ad06ca5 100644 --- a/avm/server/src/avm.rs +++ b/avm/server/src/avm.rs @@ -60,7 +60,7 @@ pub struct AVM { impl AVM { /// Create AVM with provided config. #[allow(clippy::result_large_err)] - pub fn new(config: AVMConfig) -> AVMResult { + pub async fn new(config: AVMConfig) -> AVMResult { let AVMConfig { air_wasm_path, max_heap_size, @@ -71,6 +71,7 @@ impl AVM { data_store.initialize()?; let runner = AVMRunner::new(air_wasm_path, max_heap_size, logging_mask) + .await .map_err(AVMError::RunnerError)?; let runner = SendSafeRunner(runner); let avm = Self { runner, data_store }; @@ -79,7 +80,7 @@ impl AVM { } #[allow(clippy::result_large_err)] - pub fn call( + pub async fn call( &mut self, air: impl Into, data: impl Into>, @@ -110,6 +111,7 @@ impl AVM { keypair, particle_parameters.particle_id.to_string(), ) + .await .map_err(AVMError::RunnerError)?; let execution_time = execution_start_time.elapsed(); diff --git a/avm/server/src/runner.rs b/avm/server/src/runner.rs index 1f1f28e31d..1cd8df1fb2 100644 --- a/avm/server/src/runner.rs +++ b/avm/server/src/runner.rs @@ -28,6 +28,7 @@ use marine::IValue; use marine::Marine; use marine::MarineConfig; use marine::ModuleDescriptor; +use marine_wasmtime_backend::WasmtimeWasmBackend; use std::path::PathBuf; @@ -35,6 +36,7 @@ pub struct AVMRunner { marine: Marine, /// file name of the AIR interpreter .wasm wasm_filename: String, + pub wasm_backend: WasmtimeWasmBackend, } /// Return statistic of AVM server Wasm module heap footprint. @@ -48,20 +50,22 @@ pub struct AVMMemoryStats { impl AVMRunner { /// Create AVM with the provided config. - pub fn new( + pub async fn new( air_wasm_path: PathBuf, max_heap_size: Option, logging_mask: i32, ) -> RunnerResult { let (wasm_dir, wasm_filename) = split_dirname(air_wasm_path)?; + let wasm_backend = WasmtimeWasmBackend::default(); let marine_config = make_marine_config(wasm_dir, &wasm_filename, max_heap_size, logging_mask); - let marine = Marine::with_raw_config(marine_config)?; + let marine = Marine::with_raw_config(wasm_backend.clone(), marine_config).await?; let avm = Self { marine, wasm_filename, + wasm_backend, }; Ok(avm) @@ -69,7 +73,7 @@ impl AVMRunner { #[allow(clippy::too_many_arguments)] #[tracing::instrument(skip_all)] - pub fn call( + pub async fn call( &mut self, air: impl Into, prev_data: impl Into>, @@ -103,7 +107,7 @@ impl AVMRunner { let result = measure!( self.marine - .call_with_ivalues(&self.wasm_filename, "invoke", &args, <_>::default())?, + .call_with_ivalues(&self.wasm_filename, "invoke", &args, <_>::default()).await?, tracing::Level::INFO, "marine.call_with_ivalues", method = "invoke", @@ -119,7 +123,7 @@ impl AVMRunner { #[allow(clippy::too_many_arguments)] #[tracing::instrument(skip_all)] - pub fn call_tracing( + pub async fn call_tracing( &mut self, air: impl Into, prev_data: impl Into>, @@ -157,7 +161,7 @@ impl AVMRunner { "invoke_tracing", &args, <_>::default(), - )?, + ).await?, tracing::Level::INFO, "marine.call_with_ivalues", method = "invoke_tracing", @@ -175,11 +179,11 @@ impl AVMRunner { let stats = self.marine.module_memory_stats(); // only the interpreters must be loaded in Marine - debug_assert!(stats.len() == 1); + debug_assert!(stats.modules.len() == 1); AVMMemoryStats { - memory_size: stats[0].memory_size, - max_memory_size: stats[0].max_memory_size, + memory_size: stats.modules[0].memory_size, + max_memory_size: None } } } @@ -264,12 +268,10 @@ fn split_dirname(path: PathBuf) -> RunnerResult<(PathBuf, String)> { fn make_marine_config( air_wasm_dir: PathBuf, air_wasm_file: &str, - max_heap_size: Option, + _max_heap_size: Option, logging_mask: i32, ) -> MarineConfig { let air_module_config = marine::MarineModuleConfig { - mem_pages_count: None, - max_heap_size, logger_enabled: true, host_imports: <_>::default(), wasi: None, @@ -277,6 +279,7 @@ fn make_marine_config( }; MarineConfig { + total_memory_limit: None, modules_dir: Some(air_wasm_dir), modules_config: vec![ModuleDescriptor { load_from: None, diff --git a/benches/PERFORMANCE.json b/benches/PERFORMANCE.json index 5b52cb623f..041314ad85 100644 --- a/benches/PERFORMANCE.json +++ b/benches/PERFORMANCE.json @@ -608,62 +608,62 @@ "stats": { "air::runner::execute_air": { "common_prefix": "air", - "duration": "13.30ms", + "duration": "19.30ms", "nested": { "preparation_step::preparation::parse_data": { "common_prefix": "air_interpreter_data::interpreter_data::InterpreterData", - "duration": "5.41ms", + "duration": "7.86ms", "nested": { - "try_from_slice": "5.36ms" + "try_from_slice": "7.75ms" } }, "preparation_step::preparation::prepare": { "common_prefix": "", - "duration": "205.00µs", + "duration": "251.00µs", "nested": { "air::preparation_step::preparation::make_exec_ctx": { "common_prefix": "air::preparation_step::preparation", - "duration": "45.00µs", + "duration": "57.00µs", "nested": { - "CallResultsRepr.deserialize": "13.00µs" + "CallResultsRepr.deserialize": "15.00µs" } }, - "air_parser::parser::air_parser::parse": "40.00µs" + "air_parser::parser::air_parser::parse": "38.00µs" } }, - "runner::execute": "8.00µs", + "runner::execute": "10.00µs", "runner::farewell": { "common_prefix": "air::farewell_step::outcome", - "duration": "3.36ms", + "duration": "5.85ms", "nested": { "from_success_result": { "common_prefix": "air::farewell_step::outcome", - "duration": "3.34ms", + "duration": "5.83ms", "nested": { "populate_outcome_from_contexts": { "common_prefix": "air::farewell_step::outcome", - "duration": "3.30ms", + "duration": "5.72ms", "nested": { - "CallRequestsRepr.serialize": "12.00µs", - "InterpreterData::serialize": "2.36ms" + "CallRequestsRepr.serialize": "19.00µs", + "InterpreterData::serialize": "3.66ms" } } } } } }, - "signing_step::sign_produced_cids": "101.00µs", + "signing_step::sign_produced_cids": "135.00µs", "verification_step::verify": { "common_prefix": "air_interpreter_data::cid_info", - "duration": "4.05ms", + "duration": "4.92ms", "nested": { - "verify": "3.68ms" + "verify": "4.44ms" } } } } }, - "total_time": "13.30ms" + "total_time": "19.30ms" }, "call-requests500": { "comment": "multiple call requests", @@ -674,62 +674,62 @@ "stats": { "air::runner::execute_air": { "common_prefix": "air", - "duration": "34.70ms", + "duration": "47.90ms", "nested": { "preparation_step::preparation::parse_data": { "common_prefix": "air_interpreter_data::interpreter_data::InterpreterData", - "duration": "164.00µs", + "duration": "163.00µs", "nested": { - "try_from_slice": "125.00µs" + "try_from_slice": "120.00µs" } }, "preparation_step::preparation::prepare": { "common_prefix": "", - "duration": "277.00µs", + "duration": "309.00µs", "nested": { "air::preparation_step::preparation::make_exec_ctx": { "common_prefix": "air::preparation_step::preparation", - "duration": "73.00µs", + "duration": "83.00µs", "nested": { - "CallResultsRepr.deserialize": "44.00µs" + "CallResultsRepr.deserialize": "50.00µs" } }, - "air_parser::parser::air_parser::parse": "75.00µs" + "air_parser::parser::air_parser::parse": "76.00µs" } }, - "runner::execute": "18.60ms", + "runner::execute": "26.50ms", "runner::farewell": { "common_prefix": "air::farewell_step::outcome", - "duration": "15.30ms", + "duration": "20.50ms", "nested": { "from_success_result": { "common_prefix": "air::farewell_step::outcome", - "duration": "15.20ms", + "duration": "20.50ms", "nested": { "populate_outcome_from_contexts": { "common_prefix": "air::farewell_step::outcome", - "duration": "15.10ms", + "duration": "20.30ms", "nested": { - "CallRequestsRepr.serialize": "14.70ms", - "InterpreterData::serialize": "227.00µs" + "CallRequestsRepr.serialize": "19.90ms", + "InterpreterData::serialize": "249.00µs" } } } } } }, - "signing_step::sign_produced_cids": "116.00µs", + "signing_step::sign_produced_cids": "143.00µs", "verification_step::verify": { "common_prefix": "air_interpreter_data::cid_info", - "duration": "77.00µs", + "duration": "75.00µs", "nested": { - "verify": "10.00µs" + "verify": "12.00µs" } } } } }, - "total_time": "34.70ms" + "total_time": "47.90ms" }, "call-results500": { "comment": "multiple call results", @@ -740,62 +740,62 @@ "stats": { "air::runner::execute_air": { "common_prefix": "air", - "duration": "15.90ms", + "duration": "20.70ms", "nested": { "preparation_step::preparation::parse_data": { "common_prefix": "air_interpreter_data::interpreter_data::InterpreterData", - "duration": "621.00µs", + "duration": "789.00µs", "nested": { - "try_from_slice": "584.00µs" + "try_from_slice": "744.00µs" } }, "preparation_step::preparation::prepare": { "common_prefix": "", - "duration": "1.04ms", + "duration": "1.24ms", "nested": { "air::preparation_step::preparation::make_exec_ctx": { "common_prefix": "air::preparation_step::preparation", - "duration": "830.00µs", + "duration": "982.00µs", "nested": { - "CallResultsRepr.deserialize": "800.00µs" + "CallResultsRepr.deserialize": "947.00µs" } }, - "air_parser::parser::air_parser::parse": "85.00µs" + "air_parser::parser::air_parser::parse": "102.00µs" } }, - "runner::execute": "11.70ms", + "runner::execute": "15.80ms", "runner::farewell": { "common_prefix": "air::farewell_step::outcome", - "duration": "1.89ms", + "duration": "2.24ms", "nested": { "from_success_result": { "common_prefix": "air::farewell_step::outcome", - "duration": "1.87ms", + "duration": "2.21ms", "nested": { "populate_outcome_from_contexts": { "common_prefix": "air::farewell_step::outcome", - "duration": "1.40ms", + "duration": "1.63ms", "nested": { - "CallRequestsRepr.serialize": "12.00µs", - "InterpreterData::serialize": "945.00µs" + "CallRequestsRepr.serialize": "14.00µs", + "InterpreterData::serialize": "1.09ms" } } } } } }, - "signing_step::sign_produced_cids": "297.00µs", + "signing_step::sign_produced_cids": "350.00µs", "verification_step::verify": { "common_prefix": "air_interpreter_data::cid_info", - "duration": "101.00µs", + "duration": "96.00µs", "nested": { - "verify": "10.00µs" + "verify": "11.00µs" } } } } }, - "total_time": "15.90ms" + "total_time": "20.70ms" }, "canon-map-key-by-lens": { "comment": "benchmarking a map insert operation", @@ -806,62 +806,62 @@ "stats": { "air::runner::execute_air": { "common_prefix": "air", - "duration": "11.00ms", + "duration": "13.90ms", "nested": { "preparation_step::preparation::parse_data": { "common_prefix": "air_interpreter_data::interpreter_data::InterpreterData", - "duration": "3.17ms", + "duration": "4.39ms", "nested": { - "try_from_slice": "3.12ms" + "try_from_slice": "4.34ms" } }, "preparation_step::preparation::prepare": { "common_prefix": "", - "duration": "424.00µs", + "duration": "515.00µs", "nested": { "air::preparation_step::preparation::make_exec_ctx": { "common_prefix": "air::preparation_step::preparation", - "duration": "213.00µs", + "duration": "277.00µs", "nested": { - "CallResultsRepr.deserialize": "13.00µs" + "CallResultsRepr.deserialize": "15.00µs" } }, - "air_parser::parser::air_parser::parse": "89.00µs" + "air_parser::parser::air_parser::parse": "87.00µs" } }, - "runner::execute": "2.02ms", + "runner::execute": "2.68ms", "runner::farewell": { "common_prefix": "air::farewell_step::outcome", - "duration": "1.93ms", + "duration": "2.19ms", "nested": { "from_success_result": { "common_prefix": "air::farewell_step::outcome", - "duration": "1.91ms", + "duration": "2.16ms", "nested": { "populate_outcome_from_contexts": { "common_prefix": "air::farewell_step::outcome", - "duration": "1.55ms", + "duration": "1.74ms", "nested": { - "CallRequestsRepr.serialize": "12.00µs", - "InterpreterData::serialize": "1.25ms" + "CallRequestsRepr.serialize": "14.00µs", + "InterpreterData::serialize": "1.36ms" } } } } } }, - "signing_step::sign_produced_cids": "102.00µs", + "signing_step::sign_produced_cids": "122.00µs", "verification_step::verify": { "common_prefix": "air_interpreter_data::cid_info", - "duration": "3.18ms", + "duration": "3.82ms", "nested": { - "verify": "2.81ms" + "verify": "3.36ms" } } } } }, - "total_time": "11.00ms" + "total_time": "13.90ms" }, "canon-map-key-element-by-lens": { "comment": "benchmarking a map insert operation", @@ -872,62 +872,62 @@ "stats": { "air::runner::execute_air": { "common_prefix": "air", - "duration": "10.90ms", + "duration": "13.90ms", "nested": { "preparation_step::preparation::parse_data": { "common_prefix": "air_interpreter_data::interpreter_data::InterpreterData", - "duration": "3.17ms", + "duration": "4.42ms", "nested": { - "try_from_slice": "3.13ms" + "try_from_slice": "4.36ms" } }, "preparation_step::preparation::prepare": { "common_prefix": "", - "duration": "416.00µs", + "duration": "501.00µs", "nested": { "air::preparation_step::preparation::make_exec_ctx": { "common_prefix": "air::preparation_step::preparation", - "duration": "213.00µs", + "duration": "271.00µs", "nested": { - "CallResultsRepr.deserialize": "12.00µs" + "CallResultsRepr.deserialize": "14.00µs" } }, - "air_parser::parser::air_parser::parse": "84.00µs" + "air_parser::parser::air_parser::parse": "85.00µs" } }, - "runner::execute": "1.96ms", + "runner::execute": "2.70ms", "runner::farewell": { "common_prefix": "air::farewell_step::outcome", - "duration": "1.92ms", + "duration": "2.18ms", "nested": { "from_success_result": { "common_prefix": "air::farewell_step::outcome", - "duration": "1.90ms", + "duration": "2.15ms", "nested": { "populate_outcome_from_contexts": { "common_prefix": "air::farewell_step::outcome", - "duration": "1.57ms", + "duration": "1.75ms", "nested": { - "CallRequestsRepr.serialize": "11.00µs", - "InterpreterData::serialize": "1.26ms" + "CallRequestsRepr.serialize": "13.00µs", + "InterpreterData::serialize": "1.37ms" } } } } } }, - "signing_step::sign_produced_cids": "103.00µs", + "signing_step::sign_produced_cids": "127.00µs", "verification_step::verify": { "common_prefix": "air_interpreter_data::cid_info", - "duration": "3.16ms", + "duration": "3.80ms", "nested": { - "verify": "2.79ms" + "verify": "3.37ms" } } } } }, - "total_time": "10.90ms" + "total_time": "13.90ms" }, "canon-map-multiple-keys": { "comment": "benchmarking a map insert operation", @@ -938,62 +938,62 @@ "stats": { "air::runner::execute_air": { "common_prefix": "air", - "duration": "9.04ms", + "duration": "11.50ms", "nested": { "preparation_step::preparation::parse_data": { "common_prefix": "air_interpreter_data::interpreter_data::InterpreterData", - "duration": "437.00µs", + "duration": "504.00µs", "nested": { - "try_from_slice": "388.00µs" + "try_from_slice": "448.00µs" } }, "preparation_step::preparation::prepare": { "common_prefix": "", - "duration": "247.00µs", + "duration": "265.00µs", "nested": { "air::preparation_step::preparation::make_exec_ctx": { "common_prefix": "air::preparation_step::preparation", - "duration": "45.00µs", + "duration": "50.00µs", "nested": { "CallResultsRepr.deserialize": "14.00µs" } }, - "air_parser::parser::air_parser::parse": "86.00µs" + "air_parser::parser::air_parser::parse": "70.00µs" } }, - "runner::execute": "5.98ms", + "runner::execute": "7.96ms", "runner::farewell": { "common_prefix": "air::farewell_step::outcome", - "duration": "1.69ms", + "duration": "1.95ms", "nested": { "from_success_result": { "common_prefix": "air::farewell_step::outcome", - "duration": "1.67ms", + "duration": "1.93ms", "nested": { "populate_outcome_from_contexts": { "common_prefix": "air::farewell_step::outcome", - "duration": "1.38ms", + "duration": "1.55ms", "nested": { - "CallRequestsRepr.serialize": "12.00µs", - "InterpreterData::serialize": "1.08ms" + "CallRequestsRepr.serialize": "13.00µs", + "InterpreterData::serialize": "1.17ms" } } } } } }, - "signing_step::sign_produced_cids": "104.00µs", + "signing_step::sign_produced_cids": "128.00µs", "verification_step::verify": { "common_prefix": "air_interpreter_data::cid_info", - "duration": "420.00µs", + "duration": "479.00µs", "nested": { - "verify": "38.00µs" + "verify": "44.00µs" } } } } }, - "total_time": "9.04ms" + "total_time": "11.50ms" }, "canon-map-scalar-multiple-keys": { "comment": "benchmarking a map insert operation", @@ -1004,62 +1004,62 @@ "stats": { "air::runner::execute_air": { "common_prefix": "air", - "duration": "4.28ms", + "duration": "5.54ms", "nested": { "preparation_step::preparation::parse_data": { "common_prefix": "air_interpreter_data::interpreter_data::InterpreterData", - "duration": "421.00µs", + "duration": "485.00µs", "nested": { - "try_from_slice": "373.00µs" + "try_from_slice": "431.00µs" } }, "preparation_step::preparation::prepare": { "common_prefix": "", - "duration": "226.00µs", + "duration": "274.00µs", "nested": { "air::preparation_step::preparation::make_exec_ctx": { "common_prefix": "air::preparation_step::preparation", - "duration": "42.00µs", + "duration": "52.00µs", "nested": { - "CallResultsRepr.deserialize": "12.00µs" + "CallResultsRepr.deserialize": "14.00µs" } }, - "air_parser::parser::air_parser::parse": "68.00µs" + "air_parser::parser::air_parser::parse": "73.00µs" } }, - "runner::execute": "2.48ms", + "runner::execute": "3.50ms", "runner::farewell": { "common_prefix": "air::farewell_step::outcome", - "duration": "460.00µs", + "duration": "474.00µs", "nested": { "from_success_result": { "common_prefix": "air::farewell_step::outcome", - "duration": "440.00µs", + "duration": "452.00µs", "nested": { "populate_outcome_from_contexts": { "common_prefix": "air::farewell_step::outcome", - "duration": "382.00µs", + "duration": "410.00µs", "nested": { - "CallRequestsRepr.serialize": "12.00µs", - "InterpreterData::serialize": "110.00µs" + "CallRequestsRepr.serialize": "13.00µs", + "InterpreterData::serialize": "118.00µs" } } } } } }, - "signing_step::sign_produced_cids": "100.00µs", + "signing_step::sign_produced_cids": "123.00µs", "verification_step::verify": { "common_prefix": "air_interpreter_data::cid_info", - "duration": "411.00µs", + "duration": "497.00µs", "nested": { - "verify": "37.00µs" + "verify": "50.00µs" } } } } }, - "total_time": "4.28ms" + "total_time": "5.54ms" }, "canon-map-scalar-single-key": { "comment": "benchmarking a map insert operation", @@ -1070,62 +1070,62 @@ "stats": { "air::runner::execute_air": { "common_prefix": "air", - "duration": "3.36ms", + "duration": "4.27ms", "nested": { "preparation_step::preparation::parse_data": { "common_prefix": "air_interpreter_data::interpreter_data::InterpreterData", - "duration": "421.00µs", + "duration": "518.00µs", "nested": { - "try_from_slice": "379.00µs" + "try_from_slice": "461.00µs" } }, "preparation_step::preparation::prepare": { "common_prefix": "", - "duration": "228.00µs", + "duration": "261.00µs", "nested": { "air::preparation_step::preparation::make_exec_ctx": { "common_prefix": "air::preparation_step::preparation", - "duration": "42.00µs", + "duration": "50.00µs", "nested": { - "CallResultsRepr.deserialize": "13.00µs" + "CallResultsRepr.deserialize": "14.00µs" } }, - "air_parser::parser::air_parser::parse": "70.00µs" + "air_parser::parser::air_parser::parse": "66.00µs" } }, - "runner::execute": "1.59ms", + "runner::execute": "2.18ms", "runner::farewell": { "common_prefix": "air::farewell_step::outcome", - "duration": "408.00µs", + "duration": "484.00µs", "nested": { "from_success_result": { "common_prefix": "air::farewell_step::outcome", - "duration": "388.00µs", + "duration": "462.00µs", "nested": { "populate_outcome_from_contexts": { "common_prefix": "air::farewell_step::outcome", - "duration": "335.00µs", + "duration": "395.00µs", "nested": { - "CallRequestsRepr.serialize": "11.00µs", - "InterpreterData::serialize": "119.00µs" + "CallRequestsRepr.serialize": "13.00µs", + "InterpreterData::serialize": "131.00µs" } } } } } }, - "signing_step::sign_produced_cids": "101.00µs", + "signing_step::sign_produced_cids": "126.00µs", "verification_step::verify": { "common_prefix": "air_interpreter_data::cid_info", - "duration": "441.00µs", + "duration": "509.00µs", "nested": { - "verify": "71.00µs" + "verify": "80.00µs" } } } } }, - "total_time": "3.36ms" + "total_time": "4.27ms" }, "canon-map-single-key": { "comment": "benchmarking a map insert operation", @@ -1136,62 +1136,62 @@ "stats": { "air::runner::execute_air": { "common_prefix": "air", - "duration": "7.52ms", + "duration": "9.34ms", "nested": { "preparation_step::preparation::parse_data": { "common_prefix": "air_interpreter_data::interpreter_data::InterpreterData", - "duration": "432.00µs", + "duration": "527.00µs", "nested": { - "try_from_slice": "389.00µs" + "try_from_slice": "472.00µs" } }, "preparation_step::preparation::prepare": { "common_prefix": "", - "duration": "224.00µs", + "duration": "289.00µs", "nested": { "air::preparation_step::preparation::make_exec_ctx": { "common_prefix": "air::preparation_step::preparation", - "duration": "42.00µs", + "duration": "56.00µs", "nested": { - "CallResultsRepr.deserialize": "12.00µs" + "CallResultsRepr.deserialize": "17.00µs" } }, - "air_parser::parser::air_parser::parse": "66.00µs" + "air_parser::parser::air_parser::parse": "83.00µs" } }, - "runner::execute": "4.37ms", + "runner::execute": "5.64ms", "runner::farewell": { "common_prefix": "air::farewell_step::outcome", - "duration": "1.78ms", + "duration": "2.05ms", "nested": { "from_success_result": { "common_prefix": "air::farewell_step::outcome", - "duration": "1.76ms", + "duration": "2.02ms", "nested": { "populate_outcome_from_contexts": { "common_prefix": "air::farewell_step::outcome", - "duration": "1.52ms", + "duration": "1.72ms", "nested": { - "CallRequestsRepr.serialize": "11.00µs", - "InterpreterData::serialize": "1.25ms" + "CallRequestsRepr.serialize": "13.00µs", + "InterpreterData::serialize": "1.37ms" } } } } } }, - "signing_step::sign_produced_cids": "99.00µs", + "signing_step::sign_produced_cids": "124.00µs", "verification_step::verify": { "common_prefix": "air_interpreter_data::cid_info", - "duration": "443.00µs", + "duration": "525.00µs", "nested": { - "verify": "68.00µs" + "verify": "85.00µs" } } } } }, - "total_time": "7.52ms" + "total_time": "9.34ms" }, "dashboard": { "comment": "big dashboard test", @@ -1202,62 +1202,62 @@ "stats": { "air::runner::execute_air": { "common_prefix": "air", - "duration": "5.65ms", + "duration": "6.91ms", "nested": { "preparation_step::preparation::parse_data": { "common_prefix": "air_interpreter_data::interpreter_data::InterpreterData", - "duration": "996.00µs", + "duration": "1.33ms", "nested": { - "try_from_slice": "943.00µs" + "try_from_slice": "1.27ms" } }, "preparation_step::preparation::prepare": { "common_prefix": "", - "duration": "361.00µs", + "duration": "400.00µs", "nested": { "air::preparation_step::preparation::make_exec_ctx": { "common_prefix": "air::preparation_step::preparation", - "duration": "61.00µs", + "duration": "73.00µs", "nested": { - "CallResultsRepr.deserialize": "13.00µs" + "CallResultsRepr.deserialize": "15.00µs" } }, - "air_parser::parser::air_parser::parse": "183.00µs" + "air_parser::parser::air_parser::parse": "179.00µs" } }, - "runner::execute": "762.00µs", + "runner::execute": "966.00µs", "runner::farewell": { "common_prefix": "air::farewell_step::outcome", - "duration": "514.00µs", + "duration": "578.00µs", "nested": { "from_success_result": { "common_prefix": "air::farewell_step::outcome", - "duration": "494.00µs", + "duration": "556.00µs", "nested": { "populate_outcome_from_contexts": { "common_prefix": "air::farewell_step::outcome", - "duration": "452.00µs", + "duration": "507.00µs", "nested": { - "CallRequestsRepr.serialize": "21.00µs", - "InterpreterData::serialize": "227.00µs" + "CallRequestsRepr.serialize": "24.00µs", + "InterpreterData::serialize": "243.00µs" } } } } } }, - "signing_step::sign_produced_cids": "101.00µs", + "signing_step::sign_produced_cids": "125.00µs", "verification_step::verify": { "common_prefix": "air_interpreter_data::cid_info", - "duration": "2.75ms", + "duration": "3.32ms", "nested": { - "verify": "158.00µs" + "verify": "184.00µs" } } } } }, - "total_time": "5.65ms" + "total_time": "6.91ms" }, "long-data": { "comment": "Long data trace", @@ -1268,62 +1268,62 @@ "stats": { "air::runner::execute_air": { "common_prefix": "air", - "duration": "5.12ms", + "duration": "6.31ms", "nested": { "preparation_step::preparation::parse_data": { "common_prefix": "air_interpreter_data::interpreter_data::InterpreterData", - "duration": "1.89ms", + "duration": "2.51ms", "nested": { - "try_from_slice": "1.85ms" + "try_from_slice": "2.46ms" } }, "preparation_step::preparation::prepare": { "common_prefix": "", - "duration": "224.00µs", + "duration": "248.00µs", "nested": { "air::preparation_step::preparation::make_exec_ctx": { "common_prefix": "air::preparation_step::preparation", - "duration": "66.00µs", + "duration": "71.00µs", "nested": { - "CallResultsRepr.deserialize": "15.00µs" + "CallResultsRepr.deserialize": "14.00µs" } }, - "air_parser::parser::air_parser::parse": "35.00µs" + "air_parser::parser::air_parser::parse": "32.00µs" } }, - "runner::execute": "8.00µs", + "runner::execute": "9.00µs", "runner::farewell": { "common_prefix": "air::farewell_step::outcome", - "duration": "964.00µs", + "duration": "1.16ms", "nested": { "from_success_result": { "common_prefix": "air::farewell_step::outcome", - "duration": "944.00µs", + "duration": "1.14ms", "nested": { "populate_outcome_from_contexts": { "common_prefix": "air::farewell_step::outcome", - "duration": "907.00µs", + "duration": "1.10ms", "nested": { - "CallRequestsRepr.serialize": "12.00µs", - "InterpreterData::serialize": "412.00µs" + "CallRequestsRepr.serialize": "13.00µs", + "InterpreterData::serialize": "487.00µs" } } } } } }, - "signing_step::sign_produced_cids": "102.00µs", + "signing_step::sign_produced_cids": "127.00µs", "verification_step::verify": { "common_prefix": "air_interpreter_data::cid_info", - "duration": "1.75ms", + "duration": "2.08ms", "nested": { - "verify": "668.00µs" + "verify": "790.00µs" } } } } }, - "total_time": "5.12ms" + "total_time": "6.31ms" }, "multiple-cids10": { "comment": "verifying multiple CIDs for single peer", @@ -1334,62 +1334,62 @@ "stats": { "air::runner::execute_air": { "common_prefix": "air", - "duration": "2.62ms", + "duration": "3.26ms", "nested": { "preparation_step::preparation::parse_data": { "common_prefix": "air_interpreter_data::interpreter_data::InterpreterData", - "duration": "432.00µs", + "duration": "586.00µs", "nested": { - "try_from_slice": "381.00µs" + "try_from_slice": "513.00µs" } }, "preparation_step::preparation::prepare": { "common_prefix": "", - "duration": "237.00µs", + "duration": "290.00µs", "nested": { "air::preparation_step::preparation::make_exec_ctx": { "common_prefix": "air::preparation_step::preparation", - "duration": "52.00µs", + "duration": "66.00µs", "nested": { - "CallResultsRepr.deserialize": "12.00µs" + "CallResultsRepr.deserialize": "17.00µs" } }, - "air_parser::parser::air_parser::parse": "70.00µs" + "air_parser::parser::air_parser::parse": "79.00µs" } }, - "runner::execute": "417.00µs", + "runner::execute": "544.00µs", "runner::farewell": { "common_prefix": "air::farewell_step::outcome", - "duration": "388.00µs", + "duration": "440.00µs", "nested": { "from_success_result": { "common_prefix": "air::farewell_step::outcome", - "duration": "368.00µs", + "duration": "418.00µs", "nested": { "populate_outcome_from_contexts": { "common_prefix": "air::farewell_step::outcome", - "duration": "319.00µs", + "duration": "361.00µs", "nested": { - "CallRequestsRepr.serialize": "12.00µs", - "InterpreterData::serialize": "140.00µs" + "CallRequestsRepr.serialize": "14.00µs", + "InterpreterData::serialize": "150.00µs" } } } } } }, - "signing_step::sign_produced_cids": "101.00µs", + "signing_step::sign_produced_cids": "127.00µs", "verification_step::verify": { "common_prefix": "air_interpreter_data::cid_info", - "duration": "878.00µs", + "duration": "1.07ms", "nested": { - "verify": "179.00µs" + "verify": "217.00µs" } } } } }, - "total_time": "2.62ms" + "total_time": "3.26ms" }, "multiple-peers8": { "comment": "verifying many CIDs for many peers", @@ -1400,62 +1400,62 @@ "stats": { "air::runner::execute_air": { "common_prefix": "air", - "duration": "9.45ms", + "duration": "11.90ms", "nested": { "preparation_step::preparation::parse_data": { "common_prefix": "air_interpreter_data::interpreter_data::InterpreterData", - "duration": "1.37ms", + "duration": "1.88ms", "nested": { - "try_from_slice": "1.31ms" + "try_from_slice": "1.81ms" } }, "preparation_step::preparation::prepare": { "common_prefix": "", - "duration": "290.00µs", + "duration": "350.00µs", "nested": { "air::preparation_step::preparation::make_exec_ctx": { "common_prefix": "air::preparation_step::preparation", - "duration": "97.00µs", + "duration": "127.00µs", "nested": { - "CallResultsRepr.deserialize": "13.00µs" + "CallResultsRepr.deserialize": "16.00µs" } }, - "air_parser::parser::air_parser::parse": "78.00µs" + "air_parser::parser::air_parser::parse": "76.00µs" } }, - "runner::execute": "2.68ms", + "runner::execute": "3.52ms", "runner::farewell": { "common_prefix": "air::farewell_step::outcome", - "duration": "960.00µs", + "duration": "1.16ms", "nested": { "from_success_result": { "common_prefix": "air::farewell_step::outcome", - "duration": "941.00µs", + "duration": "1.12ms", "nested": { "populate_outcome_from_contexts": { "common_prefix": "air::farewell_step::outcome", - "duration": "842.00µs", + "duration": "988.00µs", "nested": { - "CallRequestsRepr.serialize": "12.00µs", - "InterpreterData::serialize": "572.00µs" + "CallRequestsRepr.serialize": "15.00µs", + "InterpreterData::serialize": "653.00µs" } } } } } }, - "signing_step::sign_produced_cids": "99.00µs", + "signing_step::sign_produced_cids": "124.00µs", "verification_step::verify": { "common_prefix": "air_interpreter_data::cid_info", - "duration": "3.88ms", + "duration": "4.67ms", "nested": { - "verify": "730.00µs" + "verify": "880.00µs" } } } } }, - "total_time": "9.45ms" + "total_time": "11.90ms" }, "multiple-sigs30": { "comment": "signing multiple CIDs", @@ -1466,62 +1466,62 @@ "stats": { "air::runner::execute_air": { "common_prefix": "air", - "duration": "17.50ms", + "duration": "22.40ms", "nested": { "preparation_step::preparation::parse_data": { "common_prefix": "air_interpreter_data::interpreter_data::InterpreterData", - "duration": "3.92ms", + "duration": "5.54ms", "nested": { - "try_from_slice": "3.88ms" + "try_from_slice": "5.47ms" } }, "preparation_step::preparation::prepare": { "common_prefix": "", - "duration": "368.00µs", + "duration": "462.00µs", "nested": { "air::preparation_step::preparation::make_exec_ctx": { "common_prefix": "air::preparation_step::preparation", - "duration": "175.00µs", + "duration": "233.00µs", "nested": { - "CallResultsRepr.deserialize": "13.00µs" + "CallResultsRepr.deserialize": "14.00µs" } }, - "air_parser::parser::air_parser::parse": "76.00µs" + "air_parser::parser::air_parser::parse": "77.00µs" } }, - "runner::execute": "6.95ms", + "runner::execute": "9.00ms", "runner::farewell": { "common_prefix": "air::farewell_step::outcome", - "duration": "2.62ms", + "duration": "2.98ms", "nested": { "from_success_result": { "common_prefix": "air::farewell_step::outcome", - "duration": "2.60ms", + "duration": "2.95ms", "nested": { "populate_outcome_from_contexts": { "common_prefix": "air::farewell_step::outcome", - "duration": "2.42ms", + "duration": "2.75ms", "nested": { - "CallRequestsRepr.serialize": "12.00µs", - "InterpreterData::serialize": "1.56ms" + "CallRequestsRepr.serialize": "13.00µs", + "InterpreterData::serialize": "1.73ms" } } } } } }, - "signing_step::sign_produced_cids": "443.00µs", + "signing_step::sign_produced_cids": "530.00µs", "verification_step::verify": { "common_prefix": "air_interpreter_data::cid_info", - "duration": "2.99ms", + "duration": "3.67ms", "nested": { - "verify": "1.27ms" + "verify": "1.55ms" } } } } }, - "total_time": "17.50ms" + "total_time": "22.40ms" }, "network-explore": { "comment": "5 peers of network are discovered", @@ -1532,62 +1532,62 @@ "stats": { "air::runner::execute_air": { "common_prefix": "air", - "duration": "3.07ms", + "duration": "3.70ms", "nested": { "preparation_step::preparation::parse_data": { "common_prefix": "air_interpreter_data::interpreter_data::InterpreterData", - "duration": "494.00µs", + "duration": "600.00µs", "nested": { - "try_from_slice": "444.00µs" + "try_from_slice": "544.00µs" } }, "preparation_step::preparation::prepare": { "common_prefix": "", - "duration": "251.00µs", + "duration": "289.00µs", "nested": { "air::preparation_step::preparation::make_exec_ctx": { "common_prefix": "air::preparation_step::preparation", - "duration": "46.00µs", + "duration": "55.00µs", "nested": { - "CallResultsRepr.deserialize": "12.00µs" + "CallResultsRepr.deserialize": "14.00µs" } }, "air_parser::parser::air_parser::parse": "90.00µs" } }, - "runner::execute": "142.00µs", + "runner::execute": "170.00µs", "runner::farewell": { "common_prefix": "air::farewell_step::outcome", - "duration": "314.00µs", + "duration": "370.00µs", "nested": { "from_success_result": { "common_prefix": "air::farewell_step::outcome", - "duration": "295.00µs", + "duration": "346.00µs", "nested": { "populate_outcome_from_contexts": { "common_prefix": "air::farewell_step::outcome", - "duration": "255.00µs", + "duration": "301.00µs", "nested": { - "CallRequestsRepr.serialize": "12.00µs", - "InterpreterData::serialize": "90.00µs" + "CallRequestsRepr.serialize": "15.00µs", + "InterpreterData::serialize": "100.00µs" } } } } } }, - "signing_step::sign_produced_cids": "101.00µs", + "signing_step::sign_produced_cids": "129.00µs", "verification_step::verify": { "common_prefix": "air_interpreter_data::cid_info", - "duration": "1.60ms", + "duration": "1.95ms", "nested": { - "verify": "60.00µs" + "verify": "73.00µs" } } } } }, - "total_time": "3.07ms" + "total_time": "3.70ms" }, "null": { "comment": "Empty data and null script", @@ -1598,56 +1598,56 @@ "stats": { "air::runner::execute_air": { "common_prefix": "air", - "duration": "832.00µs", + "duration": "965.00µs", "nested": { - "preparation_step::preparation::parse_data": "25.00µs", + "preparation_step::preparation::parse_data": "38.00µs", "preparation_step::preparation::prepare": { "common_prefix": "", - "duration": "228.00µs", + "duration": "260.00µs", "nested": { "air::preparation_step::preparation::make_exec_ctx": { "common_prefix": "air::preparation_step::preparation", - "duration": "46.00µs", + "duration": "53.00µs", "nested": { - "CallResultsRepr.deserialize": "14.00µs" + "CallResultsRepr.deserialize": "16.00µs" } }, - "air_parser::parser::air_parser::parse": "46.00µs" + "air_parser::parser::air_parser::parse": "40.00µs" } }, - "runner::execute": "8.00µs", + "runner::execute": "10.00µs", "runner::farewell": { "common_prefix": "air::farewell_step::outcome", - "duration": "240.00µs", + "duration": "280.00µs", "nested": { "from_success_result": { "common_prefix": "air::farewell_step::outcome", - "duration": "221.00µs", + "duration": "258.00µs", "nested": { "populate_outcome_from_contexts": { "common_prefix": "air::farewell_step::outcome", - "duration": "183.00µs", + "duration": "216.00µs", "nested": { - "CallRequestsRepr.serialize": "14.00µs", - "InterpreterData::serialize": "31.00µs" + "CallRequestsRepr.serialize": "16.00µs", + "InterpreterData::serialize": "34.00µs" } } } } } }, - "signing_step::sign_produced_cids": "109.00µs", + "signing_step::sign_produced_cids": "136.00µs", "verification_step::verify": { "common_prefix": "air_interpreter_data::cid_info", "duration": "40.00µs", "nested": { - "verify": "10.00µs" + "verify": "11.00µs" } } } } }, - "total_time": "832.00µs" + "total_time": "965.00µs" }, "parser-10000-100": { "comment": "long air script with lot of variable assignments", @@ -1658,56 +1658,56 @@ "stats": { "air::runner::execute_air": { "common_prefix": "air", - "duration": "24.20ms", + "duration": "27.30ms", "nested": { - "preparation_step::preparation::parse_data": "26.00µs", + "preparation_step::preparation::parse_data": "39.00µs", "preparation_step::preparation::prepare": { "common_prefix": "", - "duration": "22.70ms", + "duration": "25.40ms", "nested": { "air::preparation_step::preparation::make_exec_ctx": { "common_prefix": "air::preparation_step::preparation", - "duration": "52.00µs", + "duration": "55.00µs", "nested": { - "CallResultsRepr.deserialize": "17.00µs" + "CallResultsRepr.deserialize": "18.00µs" } }, - "air_parser::parser::air_parser::parse": "22.50ms" + "air_parser::parser::air_parser::parse": "25.20ms" } }, - "runner::execute": "44.00µs", + "runner::execute": "51.00µs", "runner::farewell": { "common_prefix": "air::farewell_step::outcome", - "duration": "243.00µs", + "duration": "277.00µs", "nested": { "from_success_result": { "common_prefix": "air::farewell_step::outcome", - "duration": "222.00µs", + "duration": "255.00µs", "nested": { "populate_outcome_from_contexts": { "common_prefix": "air::farewell_step::outcome", - "duration": "186.00µs", + "duration": "215.00µs", "nested": { - "CallRequestsRepr.serialize": "12.00µs", - "InterpreterData::serialize": "33.00µs" + "CallRequestsRepr.serialize": "13.00µs", + "InterpreterData::serialize": "34.00µs" } } } } } }, - "signing_step::sign_produced_cids": "108.00µs", + "signing_step::sign_produced_cids": "132.00µs", "verification_step::verify": { "common_prefix": "air_interpreter_data::cid_info", - "duration": "44.00µs", + "duration": "45.00µs", "nested": { - "verify": "9.00µs" + "verify": "11.00µs" } } } } }, - "total_time": "24.20ms" + "total_time": "27.30ms" }, "parser-calls-10000-100": { "comment": "multiple calls parser benchmark", @@ -1718,56 +1718,56 @@ "stats": { "air::runner::execute_air": { "common_prefix": "air", - "duration": "23.10ms", + "duration": "25.60ms", "nested": { - "preparation_step::preparation::parse_data": "26.00µs", + "preparation_step::preparation::parse_data": "40.00µs", "preparation_step::preparation::prepare": { "common_prefix": "", - "duration": "21.40ms", + "duration": "23.60ms", "nested": { "air::preparation_step::preparation::make_exec_ctx": { "common_prefix": "air::preparation_step::preparation", - "duration": "53.00µs", + "duration": "58.00µs", "nested": { - "CallResultsRepr.deserialize": "16.00µs" + "CallResultsRepr.deserialize": "18.00µs" } }, - "air_parser::parser::air_parser::parse": "21.20ms" + "air_parser::parser::air_parser::parse": "23.40ms" } }, - "runner::execute": "43.00µs", + "runner::execute": "49.00µs", "runner::farewell": { "common_prefix": "air::farewell_step::outcome", - "duration": "244.00µs", + "duration": "282.00µs", "nested": { "from_success_result": { "common_prefix": "air::farewell_step::outcome", - "duration": "224.00µs", + "duration": "260.00µs", "nested": { "populate_outcome_from_contexts": { "common_prefix": "air::farewell_step::outcome", - "duration": "187.00µs", + "duration": "218.00µs", "nested": { - "CallRequestsRepr.serialize": "15.00µs", - "InterpreterData::serialize": "32.00µs" + "CallRequestsRepr.serialize": "19.00µs", + "InterpreterData::serialize": "34.00µs" } } } } } }, - "signing_step::sign_produced_cids": "112.00µs", + "signing_step::sign_produced_cids": "135.00µs", "verification_step::verify": { "common_prefix": "air_interpreter_data::cid_info", - "duration": "58.00µs", + "duration": "47.00µs", "nested": { - "verify": "17.00µs" + "verify": "12.00µs" } } } } }, - "total_time": "23.10ms" + "total_time": "25.60ms" }, "populate-map-multiple-keys": { "comment": "benchmarking a map insert operation", @@ -1778,62 +1778,62 @@ "stats": { "air::runner::execute_air": { "common_prefix": "air", - "duration": "3.60ms", + "duration": "4.67ms", "nested": { "preparation_step::preparation::parse_data": { "common_prefix": "air_interpreter_data::interpreter_data::InterpreterData", - "duration": "180.00µs", + "duration": "189.00µs", "nested": { - "try_from_slice": "127.00µs" + "try_from_slice": "136.00µs" } }, "preparation_step::preparation::prepare": { "common_prefix": "", - "duration": "254.00µs", + "duration": "279.00µs", "nested": { "air::preparation_step::preparation::make_exec_ctx": { "common_prefix": "air::preparation_step::preparation", - "duration": "46.00µs", + "duration": "50.00µs", "nested": { "CallResultsRepr.deserialize": "14.00µs" } }, - "air_parser::parser::air_parser::parse": "87.00µs" + "air_parser::parser::air_parser::parse": "71.00µs" } }, - "runner::execute": "2.14ms", + "runner::execute": "3.01ms", "runner::farewell": { "common_prefix": "air::farewell_step::outcome", - "duration": "344.00µs", + "duration": "399.00µs", "nested": { "from_success_result": { "common_prefix": "air::farewell_step::outcome", - "duration": "324.00µs", + "duration": "376.00µs", "nested": { "populate_outcome_from_contexts": { "common_prefix": "air::farewell_step::outcome", - "duration": "289.00µs", + "duration": "335.00µs", "nested": { - "CallRequestsRepr.serialize": "11.00µs", - "InterpreterData::serialize": "103.00µs" + "CallRequestsRepr.serialize": "13.00µs", + "InterpreterData::serialize": "113.00µs" } } } } } }, - "signing_step::sign_produced_cids": "99.00µs", + "signing_step::sign_produced_cids": "127.00µs", "verification_step::verify": { "common_prefix": "air_interpreter_data::cid_info", - "duration": "407.00µs", + "duration": "470.00µs", "nested": { - "verify": "40.00µs" + "verify": "44.00µs" } } } } }, - "total_time": "3.60ms" + "total_time": "4.67ms" }, "populate-map-single-key": { "comment": "benchmarking a map insert operation", @@ -1844,65 +1844,65 @@ "stats": { "air::runner::execute_air": { "common_prefix": "air", - "duration": "2.82ms", + "duration": "3.63ms", "nested": { "preparation_step::preparation::parse_data": { "common_prefix": "air_interpreter_data::interpreter_data::InterpreterData", - "duration": "216.00µs", + "duration": "261.00µs", "nested": { - "try_from_slice": "175.00µs" + "try_from_slice": "209.00µs" } }, "preparation_step::preparation::prepare": { "common_prefix": "", - "duration": "233.00µs", + "duration": "269.00µs", "nested": { "air::preparation_step::preparation::make_exec_ctx": { "common_prefix": "air::preparation_step::preparation", - "duration": "43.00µs", + "duration": "50.00µs", "nested": { - "CallResultsRepr.deserialize": "13.00µs" + "CallResultsRepr.deserialize": "14.00µs" } }, - "air_parser::parser::air_parser::parse": "74.00µs" + "air_parser::parser::air_parser::parse": "68.00µs" } }, - "runner::execute": "1.30ms", + "runner::execute": "1.85ms", "runner::farewell": { "common_prefix": "air::farewell_step::outcome", - "duration": "368.00µs", + "duration": "437.00µs", "nested": { "from_success_result": { "common_prefix": "air::farewell_step::outcome", - "duration": "347.00µs", + "duration": "414.00µs", "nested": { "populate_outcome_from_contexts": { "common_prefix": "air::farewell_step::outcome", - "duration": "292.00µs", + "duration": "349.00µs", "nested": { - "CallRequestsRepr.serialize": "12.00µs", - "InterpreterData::serialize": "118.00µs" + "CallRequestsRepr.serialize": "14.00µs", + "InterpreterData::serialize": "135.00µs" } } } } } }, - "signing_step::sign_produced_cids": "99.00µs", + "signing_step::sign_produced_cids": "126.00µs", "verification_step::verify": { "common_prefix": "air_interpreter_data::cid_info", - "duration": "432.00µs", + "duration": "507.00µs", "nested": { - "verify": "71.00µs" + "verify": "82.00µs" } } } } }, - "total_time": "2.82ms" + "total_time": "3.63ms" } }, - "datetime": "2023-12-20 19:27:38.810315+00:00", + "datetime": "2023-12-20 20:43:14.154949+00:00", "features": "", "platform": "macOS-13.5.1-arm64-arm-64bit", "version": "0.55.0" diff --git a/benches/PERFORMANCE.txt b/benches/PERFORMANCE.txt index 88bbfbe285..34cb65784f 100644 --- a/benches/PERFORMANCE.txt +++ b/benches/PERFORMANCE.txt @@ -164,347 +164,347 @@ Machine 0dfa4f098d7a6ef0d77a7bbc028ccf65fd6dc8d37be8a466ab3933a1a4a8e113: new: 40.00µs Machine 5fce753d17dde8b439ef04cdbce135789eb44646c753548ad79a37b88cf17f0a: Platform: macOS-13.5.1-arm64-arm-64bit - Timestamp: 2023-12-20 19:27:38.810315+00:00 + Timestamp: 2023-12-20 20:43:14.154949+00:00 AquaVM version: 0.55.0 Benches: Features: - big-values-data (13.30ms; 59.000 MiB, 59.000 MiB): Loading a trace with huge values - air::runner::execute_air: 13.30ms - preparation_step::preparation::parse_data: 5.41ms - try_from_slice: 5.36ms - preparation_step::preparation::prepare: 205.00µs - air::preparation_step::preparation::make_exec_ctx: 45.00µs - CallResultsRepr.deserialize: 13.00µs - air_parser::parser::air_parser::parse: 40.00µs - runner::execute: 8.00µs - runner::farewell: 3.36ms - from_success_result: 3.34ms - populate_outcome_from_contexts: 3.30ms - CallRequestsRepr.serialize: 12.00µs - InterpreterData::serialize: 2.36ms - signing_step::sign_produced_cids: 101.00µs - verification_step::verify: 4.05ms - verify: 3.68ms - call-requests500 (34.70ms; 70.562 MiB, 70.562 MiB): multiple call requests - air::runner::execute_air: 34.70ms - preparation_step::preparation::parse_data: 164.00µs - try_from_slice: 125.00µs - preparation_step::preparation::prepare: 277.00µs - air::preparation_step::preparation::make_exec_ctx: 73.00µs - CallResultsRepr.deserialize: 44.00µs - air_parser::parser::air_parser::parse: 75.00µs - runner::execute: 18.60ms - runner::farewell: 15.30ms - from_success_result: 15.20ms - populate_outcome_from_contexts: 15.10ms - CallRequestsRepr.serialize: 14.70ms - InterpreterData::serialize: 227.00µs - signing_step::sign_produced_cids: 116.00µs - verification_step::verify: 77.00µs - verify: 10.00µs - call-results500 (15.90ms; 54.438 MiB, 54.438 MiB): multiple call results - air::runner::execute_air: 15.90ms - preparation_step::preparation::parse_data: 621.00µs - try_from_slice: 584.00µs - preparation_step::preparation::prepare: 1.04ms - air::preparation_step::preparation::make_exec_ctx: 830.00µs - CallResultsRepr.deserialize: 800.00µs + big-values-data (19.30ms; 59.000 MiB, 59.000 MiB): Loading a trace with huge values + air::runner::execute_air: 19.30ms + preparation_step::preparation::parse_data: 7.86ms + try_from_slice: 7.75ms + preparation_step::preparation::prepare: 251.00µs + air::preparation_step::preparation::make_exec_ctx: 57.00µs + CallResultsRepr.deserialize: 15.00µs + air_parser::parser::air_parser::parse: 38.00µs + runner::execute: 10.00µs + runner::farewell: 5.85ms + from_success_result: 5.83ms + populate_outcome_from_contexts: 5.72ms + CallRequestsRepr.serialize: 19.00µs + InterpreterData::serialize: 3.66ms + signing_step::sign_produced_cids: 135.00µs + verification_step::verify: 4.92ms + verify: 4.44ms + call-requests500 (47.90ms; 70.562 MiB, 70.562 MiB): multiple call requests + air::runner::execute_air: 47.90ms + preparation_step::preparation::parse_data: 163.00µs + try_from_slice: 120.00µs + preparation_step::preparation::prepare: 309.00µs + air::preparation_step::preparation::make_exec_ctx: 83.00µs + CallResultsRepr.deserialize: 50.00µs + air_parser::parser::air_parser::parse: 76.00µs + runner::execute: 26.50ms + runner::farewell: 20.50ms + from_success_result: 20.50ms + populate_outcome_from_contexts: 20.30ms + CallRequestsRepr.serialize: 19.90ms + InterpreterData::serialize: 249.00µs + signing_step::sign_produced_cids: 143.00µs + verification_step::verify: 75.00µs + verify: 12.00µs + call-results500 (20.70ms; 54.438 MiB, 54.438 MiB): multiple call results + air::runner::execute_air: 20.70ms + preparation_step::preparation::parse_data: 789.00µs + try_from_slice: 744.00µs + preparation_step::preparation::prepare: 1.24ms + air::preparation_step::preparation::make_exec_ctx: 982.00µs + CallResultsRepr.deserialize: 947.00µs + air_parser::parser::air_parser::parse: 102.00µs + runner::execute: 15.80ms + runner::farewell: 2.24ms + from_success_result: 2.21ms + populate_outcome_from_contexts: 1.63ms + CallRequestsRepr.serialize: 14.00µs + InterpreterData::serialize: 1.09ms + signing_step::sign_produced_cids: 350.00µs + verification_step::verify: 96.00µs + verify: 11.00µs + canon-map-key-by-lens (13.90ms; 56.625 MiB, 56.625 MiB): benchmarking a map insert operation + air::runner::execute_air: 13.90ms + preparation_step::preparation::parse_data: 4.39ms + try_from_slice: 4.34ms + preparation_step::preparation::prepare: 515.00µs + air::preparation_step::preparation::make_exec_ctx: 277.00µs + CallResultsRepr.deserialize: 15.00µs + air_parser::parser::air_parser::parse: 87.00µs + runner::execute: 2.68ms + runner::farewell: 2.19ms + from_success_result: 2.16ms + populate_outcome_from_contexts: 1.74ms + CallRequestsRepr.serialize: 14.00µs + InterpreterData::serialize: 1.36ms + signing_step::sign_produced_cids: 122.00µs + verification_step::verify: 3.82ms + verify: 3.36ms + canon-map-key-element-by-lens (13.90ms; 56.625 MiB, 56.625 MiB): benchmarking a map insert operation + air::runner::execute_air: 13.90ms + preparation_step::preparation::parse_data: 4.42ms + try_from_slice: 4.36ms + preparation_step::preparation::prepare: 501.00µs + air::preparation_step::preparation::make_exec_ctx: 271.00µs + CallResultsRepr.deserialize: 14.00µs air_parser::parser::air_parser::parse: 85.00µs - runner::execute: 11.70ms - runner::farewell: 1.89ms - from_success_result: 1.87ms - populate_outcome_from_contexts: 1.40ms - CallRequestsRepr.serialize: 12.00µs - InterpreterData::serialize: 945.00µs - signing_step::sign_produced_cids: 297.00µs - verification_step::verify: 101.00µs - verify: 10.00µs - canon-map-key-by-lens (11.00ms; 56.625 MiB, 56.625 MiB): benchmarking a map insert operation - air::runner::execute_air: 11.00ms - preparation_step::preparation::parse_data: 3.17ms - try_from_slice: 3.12ms - preparation_step::preparation::prepare: 424.00µs - air::preparation_step::preparation::make_exec_ctx: 213.00µs - CallResultsRepr.deserialize: 13.00µs - air_parser::parser::air_parser::parse: 89.00µs - runner::execute: 2.02ms - runner::farewell: 1.93ms - from_success_result: 1.91ms - populate_outcome_from_contexts: 1.55ms - CallRequestsRepr.serialize: 12.00µs - InterpreterData::serialize: 1.25ms - signing_step::sign_produced_cids: 102.00µs - verification_step::verify: 3.18ms - verify: 2.81ms - canon-map-key-element-by-lens (10.90ms; 56.625 MiB, 56.625 MiB): benchmarking a map insert operation - air::runner::execute_air: 10.90ms - preparation_step::preparation::parse_data: 3.17ms - try_from_slice: 3.13ms - preparation_step::preparation::prepare: 416.00µs - air::preparation_step::preparation::make_exec_ctx: 213.00µs - CallResultsRepr.deserialize: 12.00µs - air_parser::parser::air_parser::parse: 84.00µs - runner::execute: 1.96ms - runner::farewell: 1.92ms - from_success_result: 1.90ms - populate_outcome_from_contexts: 1.57ms - CallRequestsRepr.serialize: 11.00µs - InterpreterData::serialize: 1.26ms - signing_step::sign_produced_cids: 103.00µs - verification_step::verify: 3.16ms - verify: 2.79ms - canon-map-multiple-keys (9.04ms; 54.500 MiB, 54.500 MiB): benchmarking a map insert operation - air::runner::execute_air: 9.04ms - preparation_step::preparation::parse_data: 437.00µs - try_from_slice: 388.00µs - preparation_step::preparation::prepare: 247.00µs - air::preparation_step::preparation::make_exec_ctx: 45.00µs + runner::execute: 2.70ms + runner::farewell: 2.18ms + from_success_result: 2.15ms + populate_outcome_from_contexts: 1.75ms + CallRequestsRepr.serialize: 13.00µs + InterpreterData::serialize: 1.37ms + signing_step::sign_produced_cids: 127.00µs + verification_step::verify: 3.80ms + verify: 3.37ms + canon-map-multiple-keys (11.50ms; 54.500 MiB, 54.500 MiB): benchmarking a map insert operation + air::runner::execute_air: 11.50ms + preparation_step::preparation::parse_data: 504.00µs + try_from_slice: 448.00µs + preparation_step::preparation::prepare: 265.00µs + air::preparation_step::preparation::make_exec_ctx: 50.00µs CallResultsRepr.deserialize: 14.00µs - air_parser::parser::air_parser::parse: 86.00µs - runner::execute: 5.98ms - runner::farewell: 1.69ms - from_success_result: 1.67ms - populate_outcome_from_contexts: 1.38ms - CallRequestsRepr.serialize: 12.00µs - InterpreterData::serialize: 1.08ms - signing_step::sign_produced_cids: 104.00µs - verification_step::verify: 420.00µs - verify: 38.00µs - canon-map-scalar-multiple-keys (4.28ms; 53.125 MiB, 53.125 MiB): benchmarking a map insert operation - air::runner::execute_air: 4.28ms - preparation_step::preparation::parse_data: 421.00µs - try_from_slice: 373.00µs - preparation_step::preparation::prepare: 226.00µs - air::preparation_step::preparation::make_exec_ctx: 42.00µs - CallResultsRepr.deserialize: 12.00µs - air_parser::parser::air_parser::parse: 68.00µs - runner::execute: 2.48ms - runner::farewell: 460.00µs - from_success_result: 440.00µs - populate_outcome_from_contexts: 382.00µs - CallRequestsRepr.serialize: 12.00µs - InterpreterData::serialize: 110.00µs - signing_step::sign_produced_cids: 100.00µs - verification_step::verify: 411.00µs - verify: 37.00µs - canon-map-scalar-single-key (3.36ms; 53.000 MiB, 53.000 MiB): benchmarking a map insert operation - air::runner::execute_air: 3.36ms - preparation_step::preparation::parse_data: 421.00µs - try_from_slice: 379.00µs - preparation_step::preparation::prepare: 228.00µs - air::preparation_step::preparation::make_exec_ctx: 42.00µs - CallResultsRepr.deserialize: 13.00µs air_parser::parser::air_parser::parse: 70.00µs - runner::execute: 1.59ms - runner::farewell: 408.00µs - from_success_result: 388.00µs - populate_outcome_from_contexts: 335.00µs - CallRequestsRepr.serialize: 11.00µs - InterpreterData::serialize: 119.00µs - signing_step::sign_produced_cids: 101.00µs - verification_step::verify: 441.00µs - verify: 71.00µs - canon-map-single-key (7.52ms; 55.312 MiB, 55.312 MiB): benchmarking a map insert operation - air::runner::execute_air: 7.52ms - preparation_step::preparation::parse_data: 432.00µs - try_from_slice: 389.00µs - preparation_step::preparation::prepare: 224.00µs - air::preparation_step::preparation::make_exec_ctx: 42.00µs - CallResultsRepr.deserialize: 12.00µs + runner::execute: 7.96ms + runner::farewell: 1.95ms + from_success_result: 1.93ms + populate_outcome_from_contexts: 1.55ms + CallRequestsRepr.serialize: 13.00µs + InterpreterData::serialize: 1.17ms + signing_step::sign_produced_cids: 128.00µs + verification_step::verify: 479.00µs + verify: 44.00µs + canon-map-scalar-multiple-keys (5.54ms; 53.125 MiB, 53.125 MiB): benchmarking a map insert operation + air::runner::execute_air: 5.54ms + preparation_step::preparation::parse_data: 485.00µs + try_from_slice: 431.00µs + preparation_step::preparation::prepare: 274.00µs + air::preparation_step::preparation::make_exec_ctx: 52.00µs + CallResultsRepr.deserialize: 14.00µs + air_parser::parser::air_parser::parse: 73.00µs + runner::execute: 3.50ms + runner::farewell: 474.00µs + from_success_result: 452.00µs + populate_outcome_from_contexts: 410.00µs + CallRequestsRepr.serialize: 13.00µs + InterpreterData::serialize: 118.00µs + signing_step::sign_produced_cids: 123.00µs + verification_step::verify: 497.00µs + verify: 50.00µs + canon-map-scalar-single-key (4.27ms; 53.000 MiB, 53.000 MiB): benchmarking a map insert operation + air::runner::execute_air: 4.27ms + preparation_step::preparation::parse_data: 518.00µs + try_from_slice: 461.00µs + preparation_step::preparation::prepare: 261.00µs + air::preparation_step::preparation::make_exec_ctx: 50.00µs + CallResultsRepr.deserialize: 14.00µs air_parser::parser::air_parser::parse: 66.00µs - runner::execute: 4.37ms - runner::farewell: 1.78ms - from_success_result: 1.76ms - populate_outcome_from_contexts: 1.52ms - CallRequestsRepr.serialize: 11.00µs - InterpreterData::serialize: 1.25ms - signing_step::sign_produced_cids: 99.00µs - verification_step::verify: 443.00µs - verify: 68.00µs - dashboard (5.65ms; 52.625 MiB, 52.625 MiB): big dashboard test - air::runner::execute_air: 5.65ms - preparation_step::preparation::parse_data: 996.00µs - try_from_slice: 943.00µs - preparation_step::preparation::prepare: 361.00µs - air::preparation_step::preparation::make_exec_ctx: 61.00µs - CallResultsRepr.deserialize: 13.00µs - air_parser::parser::air_parser::parse: 183.00µs - runner::execute: 762.00µs - runner::farewell: 514.00µs - from_success_result: 494.00µs - populate_outcome_from_contexts: 452.00µs - CallRequestsRepr.serialize: 21.00µs - InterpreterData::serialize: 227.00µs - signing_step::sign_produced_cids: 101.00µs - verification_step::verify: 2.75ms - verify: 158.00µs - long-data (5.12ms; 53.812 MiB, 53.812 MiB): Long data trace - air::runner::execute_air: 5.12ms - preparation_step::preparation::parse_data: 1.89ms - try_from_slice: 1.85ms - preparation_step::preparation::prepare: 224.00µs - air::preparation_step::preparation::make_exec_ctx: 66.00µs + runner::execute: 2.18ms + runner::farewell: 484.00µs + from_success_result: 462.00µs + populate_outcome_from_contexts: 395.00µs + CallRequestsRepr.serialize: 13.00µs + InterpreterData::serialize: 131.00µs + signing_step::sign_produced_cids: 126.00µs + verification_step::verify: 509.00µs + verify: 80.00µs + canon-map-single-key (9.34ms; 55.312 MiB, 55.312 MiB): benchmarking a map insert operation + air::runner::execute_air: 9.34ms + preparation_step::preparation::parse_data: 527.00µs + try_from_slice: 472.00µs + preparation_step::preparation::prepare: 289.00µs + air::preparation_step::preparation::make_exec_ctx: 56.00µs + CallResultsRepr.deserialize: 17.00µs + air_parser::parser::air_parser::parse: 83.00µs + runner::execute: 5.64ms + runner::farewell: 2.05ms + from_success_result: 2.02ms + populate_outcome_from_contexts: 1.72ms + CallRequestsRepr.serialize: 13.00µs + InterpreterData::serialize: 1.37ms + signing_step::sign_produced_cids: 124.00µs + verification_step::verify: 525.00µs + verify: 85.00µs + dashboard (6.91ms; 52.625 MiB, 52.625 MiB): big dashboard test + air::runner::execute_air: 6.91ms + preparation_step::preparation::parse_data: 1.33ms + try_from_slice: 1.27ms + preparation_step::preparation::prepare: 400.00µs + air::preparation_step::preparation::make_exec_ctx: 73.00µs CallResultsRepr.deserialize: 15.00µs - air_parser::parser::air_parser::parse: 35.00µs - runner::execute: 8.00µs - runner::farewell: 964.00µs - from_success_result: 944.00µs - populate_outcome_from_contexts: 907.00µs - CallRequestsRepr.serialize: 12.00µs - InterpreterData::serialize: 412.00µs - signing_step::sign_produced_cids: 102.00µs - verification_step::verify: 1.75ms - verify: 668.00µs - multiple-cids10 (2.62ms; 52.500 MiB, 52.500 MiB): verifying multiple CIDs for single peer - air::runner::execute_air: 2.62ms - preparation_step::preparation::parse_data: 432.00µs - try_from_slice: 381.00µs - preparation_step::preparation::prepare: 237.00µs - air::preparation_step::preparation::make_exec_ctx: 52.00µs - CallResultsRepr.deserialize: 12.00µs - air_parser::parser::air_parser::parse: 70.00µs - runner::execute: 417.00µs - runner::farewell: 388.00µs - from_success_result: 368.00µs - populate_outcome_from_contexts: 319.00µs - CallRequestsRepr.serialize: 12.00µs - InterpreterData::serialize: 140.00µs - signing_step::sign_produced_cids: 101.00µs - verification_step::verify: 878.00µs - verify: 179.00µs - multiple-peers8 (9.45ms; 53.438 MiB, 53.438 MiB): verifying many CIDs for many peers - air::runner::execute_air: 9.45ms - preparation_step::preparation::parse_data: 1.37ms - try_from_slice: 1.31ms + air_parser::parser::air_parser::parse: 179.00µs + runner::execute: 966.00µs + runner::farewell: 578.00µs + from_success_result: 556.00µs + populate_outcome_from_contexts: 507.00µs + CallRequestsRepr.serialize: 24.00µs + InterpreterData::serialize: 243.00µs + signing_step::sign_produced_cids: 125.00µs + verification_step::verify: 3.32ms + verify: 184.00µs + long-data (6.31ms; 53.812 MiB, 53.812 MiB): Long data trace + air::runner::execute_air: 6.31ms + preparation_step::preparation::parse_data: 2.51ms + try_from_slice: 2.46ms + preparation_step::preparation::prepare: 248.00µs + air::preparation_step::preparation::make_exec_ctx: 71.00µs + CallResultsRepr.deserialize: 14.00µs + air_parser::parser::air_parser::parse: 32.00µs + runner::execute: 9.00µs + runner::farewell: 1.16ms + from_success_result: 1.14ms + populate_outcome_from_contexts: 1.10ms + CallRequestsRepr.serialize: 13.00µs + InterpreterData::serialize: 487.00µs + signing_step::sign_produced_cids: 127.00µs + verification_step::verify: 2.08ms + verify: 790.00µs + multiple-cids10 (3.26ms; 52.500 MiB, 52.500 MiB): verifying multiple CIDs for single peer + air::runner::execute_air: 3.26ms + preparation_step::preparation::parse_data: 586.00µs + try_from_slice: 513.00µs preparation_step::preparation::prepare: 290.00µs - air::preparation_step::preparation::make_exec_ctx: 97.00µs - CallResultsRepr.deserialize: 13.00µs - air_parser::parser::air_parser::parse: 78.00µs - runner::execute: 2.68ms - runner::farewell: 960.00µs - from_success_result: 941.00µs - populate_outcome_from_contexts: 842.00µs - CallRequestsRepr.serialize: 12.00µs - InterpreterData::serialize: 572.00µs - signing_step::sign_produced_cids: 99.00µs - verification_step::verify: 3.88ms - verify: 730.00µs - multiple-sigs30 (17.50ms; 56.188 MiB, 56.188 MiB): signing multiple CIDs - air::runner::execute_air: 17.50ms - preparation_step::preparation::parse_data: 3.92ms - try_from_slice: 3.88ms - preparation_step::preparation::prepare: 368.00µs - air::preparation_step::preparation::make_exec_ctx: 175.00µs - CallResultsRepr.deserialize: 13.00µs + air::preparation_step::preparation::make_exec_ctx: 66.00µs + CallResultsRepr.deserialize: 17.00µs + air_parser::parser::air_parser::parse: 79.00µs + runner::execute: 544.00µs + runner::farewell: 440.00µs + from_success_result: 418.00µs + populate_outcome_from_contexts: 361.00µs + CallRequestsRepr.serialize: 14.00µs + InterpreterData::serialize: 150.00µs + signing_step::sign_produced_cids: 127.00µs + verification_step::verify: 1.07ms + verify: 217.00µs + multiple-peers8 (11.90ms; 53.438 MiB, 53.438 MiB): verifying many CIDs for many peers + air::runner::execute_air: 11.90ms + preparation_step::preparation::parse_data: 1.88ms + try_from_slice: 1.81ms + preparation_step::preparation::prepare: 350.00µs + air::preparation_step::preparation::make_exec_ctx: 127.00µs + CallResultsRepr.deserialize: 16.00µs air_parser::parser::air_parser::parse: 76.00µs - runner::execute: 6.95ms - runner::farewell: 2.62ms - from_success_result: 2.60ms - populate_outcome_from_contexts: 2.42ms - CallRequestsRepr.serialize: 12.00µs - InterpreterData::serialize: 1.56ms - signing_step::sign_produced_cids: 443.00µs - verification_step::verify: 2.99ms - verify: 1.27ms - network-explore (3.07ms; 52.375 MiB, 52.375 MiB): 5 peers of network are discovered - air::runner::execute_air: 3.07ms - preparation_step::preparation::parse_data: 494.00µs - try_from_slice: 444.00µs - preparation_step::preparation::prepare: 251.00µs - air::preparation_step::preparation::make_exec_ctx: 46.00µs - CallResultsRepr.deserialize: 12.00µs - air_parser::parser::air_parser::parse: 90.00µs - runner::execute: 142.00µs - runner::farewell: 314.00µs - from_success_result: 295.00µs - populate_outcome_from_contexts: 255.00µs - CallRequestsRepr.serialize: 12.00µs - InterpreterData::serialize: 90.00µs - signing_step::sign_produced_cids: 101.00µs - verification_step::verify: 1.60ms - verify: 60.00µs - null (832.00µs; 52.375 MiB, 52.375 MiB): Empty data and null script - air::runner::execute_air: 832.00µs - preparation_step::preparation::parse_data: 25.00µs - preparation_step::preparation::prepare: 228.00µs - air::preparation_step::preparation::make_exec_ctx: 46.00µs + runner::execute: 3.52ms + runner::farewell: 1.16ms + from_success_result: 1.12ms + populate_outcome_from_contexts: 988.00µs + CallRequestsRepr.serialize: 15.00µs + InterpreterData::serialize: 653.00µs + signing_step::sign_produced_cids: 124.00µs + verification_step::verify: 4.67ms + verify: 880.00µs + multiple-sigs30 (22.40ms; 56.188 MiB, 56.188 MiB): signing multiple CIDs + air::runner::execute_air: 22.40ms + preparation_step::preparation::parse_data: 5.54ms + try_from_slice: 5.47ms + preparation_step::preparation::prepare: 462.00µs + air::preparation_step::preparation::make_exec_ctx: 233.00µs CallResultsRepr.deserialize: 14.00µs - air_parser::parser::air_parser::parse: 46.00µs - runner::execute: 8.00µs - runner::farewell: 240.00µs - from_success_result: 221.00µs - populate_outcome_from_contexts: 183.00µs - CallRequestsRepr.serialize: 14.00µs - InterpreterData::serialize: 31.00µs - signing_step::sign_produced_cids: 109.00µs - verification_step::verify: 40.00µs - verify: 10.00µs - parser-10000-100 (24.20ms; 54.625 MiB, 54.625 MiB): long air script with lot of variable assignments - air::runner::execute_air: 24.20ms - preparation_step::preparation::parse_data: 26.00µs - preparation_step::preparation::prepare: 22.70ms - air::preparation_step::preparation::make_exec_ctx: 52.00µs - CallResultsRepr.deserialize: 17.00µs - air_parser::parser::air_parser::parse: 22.50ms - runner::execute: 44.00µs - runner::farewell: 243.00µs - from_success_result: 222.00µs - populate_outcome_from_contexts: 186.00µs - CallRequestsRepr.serialize: 12.00µs - InterpreterData::serialize: 33.00µs - signing_step::sign_produced_cids: 108.00µs - verification_step::verify: 44.00µs - verify: 9.00µs - parser-calls-10000-100 (23.10ms; 54.375 MiB, 54.375 MiB): multiple calls parser benchmark - air::runner::execute_air: 23.10ms - preparation_step::preparation::parse_data: 26.00µs - preparation_step::preparation::prepare: 21.40ms + air_parser::parser::air_parser::parse: 77.00µs + runner::execute: 9.00ms + runner::farewell: 2.98ms + from_success_result: 2.95ms + populate_outcome_from_contexts: 2.75ms + CallRequestsRepr.serialize: 13.00µs + InterpreterData::serialize: 1.73ms + signing_step::sign_produced_cids: 530.00µs + verification_step::verify: 3.67ms + verify: 1.55ms + network-explore (3.70ms; 52.375 MiB, 52.375 MiB): 5 peers of network are discovered + air::runner::execute_air: 3.70ms + preparation_step::preparation::parse_data: 600.00µs + try_from_slice: 544.00µs + preparation_step::preparation::prepare: 289.00µs + air::preparation_step::preparation::make_exec_ctx: 55.00µs + CallResultsRepr.deserialize: 14.00µs + air_parser::parser::air_parser::parse: 90.00µs + runner::execute: 170.00µs + runner::farewell: 370.00µs + from_success_result: 346.00µs + populate_outcome_from_contexts: 301.00µs + CallRequestsRepr.serialize: 15.00µs + InterpreterData::serialize: 100.00µs + signing_step::sign_produced_cids: 129.00µs + verification_step::verify: 1.95ms + verify: 73.00µs + null (965.00µs; 52.375 MiB, 52.375 MiB): Empty data and null script + air::runner::execute_air: 965.00µs + preparation_step::preparation::parse_data: 38.00µs + preparation_step::preparation::prepare: 260.00µs air::preparation_step::preparation::make_exec_ctx: 53.00µs CallResultsRepr.deserialize: 16.00µs - air_parser::parser::air_parser::parse: 21.20ms - runner::execute: 43.00µs - runner::farewell: 244.00µs - from_success_result: 224.00µs - populate_outcome_from_contexts: 187.00µs - CallRequestsRepr.serialize: 15.00µs - InterpreterData::serialize: 32.00µs - signing_step::sign_produced_cids: 112.00µs - verification_step::verify: 58.00µs - verify: 17.00µs - populate-map-multiple-keys (3.60ms; 53.000 MiB, 53.000 MiB): benchmarking a map insert operation - air::runner::execute_air: 3.60ms - preparation_step::preparation::parse_data: 180.00µs - try_from_slice: 127.00µs - preparation_step::preparation::prepare: 254.00µs - air::preparation_step::preparation::make_exec_ctx: 46.00µs + air_parser::parser::air_parser::parse: 40.00µs + runner::execute: 10.00µs + runner::farewell: 280.00µs + from_success_result: 258.00µs + populate_outcome_from_contexts: 216.00µs + CallRequestsRepr.serialize: 16.00µs + InterpreterData::serialize: 34.00µs + signing_step::sign_produced_cids: 136.00µs + verification_step::verify: 40.00µs + verify: 11.00µs + parser-10000-100 (27.30ms; 54.625 MiB, 54.625 MiB): long air script with lot of variable assignments + air::runner::execute_air: 27.30ms + preparation_step::preparation::parse_data: 39.00µs + preparation_step::preparation::prepare: 25.40ms + air::preparation_step::preparation::make_exec_ctx: 55.00µs + CallResultsRepr.deserialize: 18.00µs + air_parser::parser::air_parser::parse: 25.20ms + runner::execute: 51.00µs + runner::farewell: 277.00µs + from_success_result: 255.00µs + populate_outcome_from_contexts: 215.00µs + CallRequestsRepr.serialize: 13.00µs + InterpreterData::serialize: 34.00µs + signing_step::sign_produced_cids: 132.00µs + verification_step::verify: 45.00µs + verify: 11.00µs + parser-calls-10000-100 (25.60ms; 54.375 MiB, 54.375 MiB): multiple calls parser benchmark + air::runner::execute_air: 25.60ms + preparation_step::preparation::parse_data: 40.00µs + preparation_step::preparation::prepare: 23.60ms + air::preparation_step::preparation::make_exec_ctx: 58.00µs + CallResultsRepr.deserialize: 18.00µs + air_parser::parser::air_parser::parse: 23.40ms + runner::execute: 49.00µs + runner::farewell: 282.00µs + from_success_result: 260.00µs + populate_outcome_from_contexts: 218.00µs + CallRequestsRepr.serialize: 19.00µs + InterpreterData::serialize: 34.00µs + signing_step::sign_produced_cids: 135.00µs + verification_step::verify: 47.00µs + verify: 12.00µs + populate-map-multiple-keys (4.67ms; 53.000 MiB, 53.000 MiB): benchmarking a map insert operation + air::runner::execute_air: 4.67ms + preparation_step::preparation::parse_data: 189.00µs + try_from_slice: 136.00µs + preparation_step::preparation::prepare: 279.00µs + air::preparation_step::preparation::make_exec_ctx: 50.00µs CallResultsRepr.deserialize: 14.00µs - air_parser::parser::air_parser::parse: 87.00µs - runner::execute: 2.14ms - runner::farewell: 344.00µs - from_success_result: 324.00µs - populate_outcome_from_contexts: 289.00µs - CallRequestsRepr.serialize: 11.00µs - InterpreterData::serialize: 103.00µs - signing_step::sign_produced_cids: 99.00µs - verification_step::verify: 407.00µs - verify: 40.00µs - populate-map-single-key (2.82ms; 52.938 MiB, 52.938 MiB): benchmarking a map insert operation - air::runner::execute_air: 2.82ms - preparation_step::preparation::parse_data: 216.00µs - try_from_slice: 175.00µs - preparation_step::preparation::prepare: 233.00µs - air::preparation_step::preparation::make_exec_ctx: 43.00µs - CallResultsRepr.deserialize: 13.00µs - air_parser::parser::air_parser::parse: 74.00µs - runner::execute: 1.30ms - runner::farewell: 368.00µs - from_success_result: 347.00µs - populate_outcome_from_contexts: 292.00µs - CallRequestsRepr.serialize: 12.00µs - InterpreterData::serialize: 118.00µs - signing_step::sign_produced_cids: 99.00µs - verification_step::verify: 432.00µs - verify: 71.00µs + air_parser::parser::air_parser::parse: 71.00µs + runner::execute: 3.01ms + runner::farewell: 399.00µs + from_success_result: 376.00µs + populate_outcome_from_contexts: 335.00µs + CallRequestsRepr.serialize: 13.00µs + InterpreterData::serialize: 113.00µs + signing_step::sign_produced_cids: 127.00µs + verification_step::verify: 470.00µs + verify: 44.00µs + populate-map-single-key (3.63ms; 52.938 MiB, 52.938 MiB): benchmarking a map insert operation + air::runner::execute_air: 3.63ms + preparation_step::preparation::parse_data: 261.00µs + try_from_slice: 209.00µs + preparation_step::preparation::prepare: 269.00µs + air::preparation_step::preparation::make_exec_ctx: 50.00µs + CallResultsRepr.deserialize: 14.00µs + air_parser::parser::air_parser::parse: 68.00µs + runner::execute: 1.85ms + runner::farewell: 437.00µs + from_success_result: 414.00µs + populate_outcome_from_contexts: 349.00µs + CallRequestsRepr.serialize: 14.00µs + InterpreterData::serialize: 135.00µs + signing_step::sign_produced_cids: 126.00µs + verification_step::verify: 507.00µs + verify: 82.00µs Machine 62dabcde478dc58760ebbe71ef6047299144a5f63990c6c3d826ebf30175adfc: Platform: Linux-5.15.0-60-generic-x86_64-with-glibc2.35 Timestamp: 2023-02-14 10:33:54.321822+00:00 diff --git a/crates/air-lib/test-utils/Cargo.toml b/crates/air-lib/test-utils/Cargo.toml index ff296b0ade..ad5fbaf4bc 100644 --- a/crates/air-lib/test-utils/Cargo.toml +++ b/crates/air-lib/test-utils/Cargo.toml @@ -36,6 +36,8 @@ ed25519-dalek = "1.0.1" rand_chacha = "0.2.2" sha2 = "0.10.6" +tokio = {version = "1.28.2", features = ["rt"]} + [dev-dependencies] maplit = "1.0.2" diff --git a/crates/air-lib/test-utils/src/wasm_test_runner.rs b/crates/air-lib/test-utils/src/wasm_test_runner.rs index 227ccd0d41..01bb67e491 100644 --- a/crates/air-lib/test-utils/src/wasm_test_runner.rs +++ b/crates/air-lib/test-utils/src/wasm_test_runner.rs @@ -21,6 +21,7 @@ use fluence_keypair::KeyPair; use once_cell::sync::OnceCell; use std::path::PathBuf; +//use object_pool::Reusable; // 10 Mb const AVM_MAX_HEAP_SIZE: u64 = 10 * 1024 * 1024; @@ -32,7 +33,7 @@ pub struct WasmAirRunner { runner: object_pool::Reusable<'static, AVMRunner>, } -fn make_pooled_avm_runner() -> AVMRunner { +async fn make_pooled_avm_runner() -> AVMRunner { let logging_mask = i32::MAX; AVMRunner::new( @@ -40,6 +41,7 @@ fn make_pooled_avm_runner() -> AVMRunner { Some(AVM_MAX_HEAP_SIZE), logging_mask, ) + .await .expect("vm should be created") } @@ -55,7 +57,16 @@ impl AirRunner for WasmAirRunner { ) }); - let runner = pool.pull(make_pooled_avm_runner); + + let runner = match pool.try_pull() { + Some(runner) => runner, + None => { + let rt = tokio::runtime::Runtime::new().unwrap(); + let runner = rt.block_on(make_pooled_avm_runner()); + pool.attach(runner); + pool.try_pull().unwrap() + } + }; Self { current_peer_id: current_peer_id.into(), @@ -79,7 +90,8 @@ impl AirRunner for WasmAirRunner { let current_peer_id = override_current_peer_id.unwrap_or_else(|| self.current_peer_id.clone()); - Ok(self.runner.call( + let rt = tokio::runtime::Runtime::new().unwrap(); + Ok(rt.block_on(self.runner.call( air, prev_data, data, @@ -90,7 +102,7 @@ impl AirRunner for WasmAirRunner { call_results, keypair, particle_id, - )?) + ))?) } fn get_current_peer_id(&self) -> &str { @@ -108,12 +120,13 @@ pub struct ReleaseWasmAirRunner { impl AirRunner for ReleaseWasmAirRunner { fn new(current_peer_id: impl Into) -> Self { let logging_mask = i32::MAX; + let rt = tokio::runtime::Runtime::new().unwrap(); - let runner = AVMRunner::new( + let runner = rt.block_on(AVMRunner::new( PathBuf::from(RELEASE_AIR_WASM_PATH), Some(AVM_MAX_HEAP_SIZE), logging_mask, - ) + )) .expect("vm should be created"); Self { @@ -138,7 +151,8 @@ impl AirRunner for ReleaseWasmAirRunner { let current_peer_id = override_current_peer_id.unwrap_or_else(|| self.current_peer_id.clone()); - Ok(self.runner.call( + let rt = tokio::runtime::Runtime::new().unwrap(); + Ok(rt.block_on(self.runner.call( air, prev_data, data, @@ -149,7 +163,7 @@ impl AirRunner for ReleaseWasmAirRunner { call_results, keypair, particle_id, - )?) + ))?) } fn get_current_peer_id(&self) -> &str { diff --git a/tools/cli/air/Cargo.toml b/tools/cli/air/Cargo.toml index fed5203335..32e9787745 100644 --- a/tools/cli/air/Cargo.toml +++ b/tools/cli/air/Cargo.toml @@ -39,7 +39,7 @@ tokio = { version = "1", features = ["rt"], optional = true } workspaces = { version = "0.7.0", optional = true } [features] -default = ["wasm"] +default = ["wasm", "dep:tokio"] wasm = ["air-test-utils"] gen_signatures = ["aquavm-air/gen_signatures"] check_signatures = ["aquavm-air/check_signatures"] diff --git a/tools/cli/air/src/trace/run/wasm.rs b/tools/cli/air/src/trace/run/wasm.rs index 15c1af9619..710c61ebc8 100644 --- a/tools/cli/air/src/trace/run/wasm.rs +++ b/tools/cli/air/src/trace/run/wasm.rs @@ -36,7 +36,8 @@ impl AirRunner for WasmAvmRunner { keypair: &KeyPair, particle_id: String, ) -> anyhow::Result { - let call_tracing = self.0.call_tracing( + let rt = tokio::runtime::Runtime::new().unwrap(); + let call_tracing = rt.block_on(self.0.call_tracing( air, prev_data, data, @@ -50,7 +51,7 @@ impl AirRunner for WasmAvmRunner { keypair.key_format().into(), keypair.secret().expect("Failed to get secret"), particle_id, - ); + )); let memory_stats = self.0.memory_stats(); tracing::warn!(memory_size = memory_stats.memory_size); @@ -62,9 +63,10 @@ pub(crate) fn create_wasm_avm_runner( air_interpreter_wasm_path: &Path, max_heap_size: Option, ) -> anyhow::Result> { - Ok(Box::new(WasmAvmRunner(AVMRunner::new( + let rt = tokio::runtime::Runtime::new().unwrap(); + Ok(Box::new(WasmAvmRunner(rt.block_on(AVMRunner::new( air_interpreter_wasm_path.to_owned(), max_heap_size, 0, - )?))) + ))?))) } From 5398662bdd44b709b5a85dea63c6e710645f113d Mon Sep 17 00:00:00 2001 From: Valery Antopol Date: Thu, 8 Feb 2024 18:44:00 +0400 Subject: [PATCH 03/14] start updating tests --- Cargo.lock | 190 ++++++++++------- Cargo.toml | 5 - air-interpreter/Cargo.toml | 2 +- air/Cargo.toml | 4 +- .../scalar_variables/values_sparse_matrix.rs | 2 +- .../value_types/canon_stream_map.rs | 4 +- .../value_types/stream/recursive_stream.rs | 10 +- .../value_types/stream/stream_definition.rs | 32 +-- .../execution_step/value_types/stream_map.rs | 12 +- air/tests/test_module/features/cid/canon.rs | 12 +- air/tests/test_module/features/cid/mod.rs | 10 +- .../features/data_merging/air_basic.rs | 4 +- .../features/data_merging/data_merge.rs | 20 +- .../data_merging/executed_trace_basic.rs | 14 +- .../test_module/features/errors/error.rs | 4 +- .../features/errors/invalid_air.rs | 2 +- .../test_module/features/errors/last_error.rs | 34 ++-- .../features/join_behaviour/join_behaviour.rs | 16 +- .../test_module/features/lambda/flattening.rs | 6 +- .../test_module/features/lambda/functors.rs | 14 +- .../test_module/features/lambda/lambda.rs | 14 +- .../test_module/features/misc/empty_array.rs | 2 +- .../features/misc/version_check.rs | 6 +- .../features/scopes/scalars_scope.rs | 10 +- .../scopes/scopes_behaviour_with_errors.rs | 4 +- .../features/signatures/algorithms.rs | 4 +- .../features/signatures/attacks.rs | 14 +- .../features/signatures/corruption.rs | 12 +- .../features/signatures/runtime.rs | 10 +- .../features/signatures/signing.rs | 18 +- .../features/streams/ap_with_fold.rs | 2 +- .../features/streams/compactification.rs | 8 +- .../test_module/features/streams/merging.rs | 4 +- .../features/streams/recursive_streams.rs | 14 +- .../test_module/features/streams/streams.rs | 8 +- .../features/streams/streams_early_exit.rs | 6 +- .../features/tetraplets/provenance.rs | 10 +- .../tetraplets/security_tetraplets.rs | 12 +- .../auth_module/Cargo.toml | 2 +- .../log_storage/Cargo.toml | 2 +- .../topology_hops/call_guided_topology.rs | 4 +- .../topology_hops/canon_guided_topology.rs | 4 +- air/tests/test_module/instructions/ap.rs | 34 ++-- air/tests/test_module/instructions/call.rs | 20 +- air/tests/test_module/instructions/canon.rs | 52 ++--- air/tests/test_module/instructions/fail.rs | 22 +- air/tests/test_module/instructions/fold.rs | 44 ++-- air/tests/test_module/instructions/match_.rs | 26 +-- .../test_module/instructions/mismatch.rs | 12 +- air/tests/test_module/instructions/never.rs | 2 +- air/tests/test_module/instructions/new.rs | 20 +- air/tests/test_module/instructions/par.rs | 4 +- air/tests/test_module/instructions/seq.rs | 4 +- air/tests/test_module/instructions/xor.rs | 12 +- .../test_module/integration/chat_join.rs | 6 +- .../test_module/integration/create_service.rs | 2 +- .../test_module/integration/dashboard.rs | 2 +- .../integration/network_explore.rs | 2 +- air/tests/test_module/issues/issue_137.rs | 2 +- air/tests/test_module/issues/issue_173.rs | 2 +- air/tests/test_module/issues/issue_177.rs | 2 +- air/tests/test_module/issues/issue_178.rs | 2 +- air/tests/test_module/issues/issue_180.rs | 2 +- air/tests/test_module/issues/issue_206.rs | 2 +- air/tests/test_module/issues/issue_211.rs | 2 +- air/tests/test_module/issues/issue_214.rs | 2 +- air/tests/test_module/issues/issue_216.rs | 2 +- air/tests/test_module/issues/issue_221.rs | 2 +- air/tests/test_module/issues/issue_222.rs | 2 +- air/tests/test_module/issues/issue_241.rs | 2 +- air/tests/test_module/issues/issue_295.rs | 2 +- air/tests/test_module/issues/issue_300.rs | 2 +- air/tests/test_module/issues/issue_302.rs | 2 +- air/tests/test_module/issues/issue_304.rs | 2 +- air/tests/test_module/issues/issue_306.rs | 2 +- air/tests/test_module/issues/issue_331.rs | 2 +- air/tests/test_module/issues/issue_346.rs | 2 +- air/tests/test_module/issues/issue_348.rs | 2 +- air/tests/test_module/issues/issue_356.rs | 2 +- air/tests/test_module/issues/issue_363.rs | 2 +- air/tests/test_module/issues/issue_632.rs | 2 +- air/tests/test_module/issues/issue_642.rs | 2 +- air/tests/test_module/issues/issue_644.rs | 2 +- .../negative_tests/execution_step.rs | 44 ++-- .../negative_tests/farewell_step.rs | 2 +- .../negative_tests/preparation_step.rs | 6 +- .../uncatchable_trace_related.rs | 32 +-- .../uncatchable_trace_unrelated.rs | 14 +- avm/server/Cargo.toml | 7 +- avm/server/src/avm.rs | 22 +- avm/server/src/runner.rs | 41 ++-- .../air-lib/interpreter-data/src/cid_store.rs | 4 +- .../air-lib/interpreter-interface/Cargo.toml | 4 +- crates/air-lib/interpreter-sede/Cargo.toml | 2 +- crates/air-lib/polyplets/Cargo.toml | 2 +- crates/air-lib/test-utils/Cargo.toml | 8 +- .../air-lib/test-utils/src/executed_state.rs | 4 +- .../test-utils/src/native_test_runner.rs | 73 ++++--- crates/air-lib/test-utils/src/test_runner.rs | 34 ++-- .../test-utils/src/wasm_test_runner.rs | 192 ++++++++++-------- crates/beautifier/src/tests/beautifier.rs | 60 +++--- crates/beautifier/src/tests/mod.rs | 8 +- .../testing-framework/src/asserts/behavior.rs | 12 +- .../testing-framework/src/asserts/parser.rs | 34 ++-- .../src/ephemeral/neighborhood.rs | 24 +-- crates/testing-framework/src/execution/mod.rs | 38 ++-- crates/testing-framework/src/transform/mod.rs | 12 +- .../testing-framework/src/transform/parser.rs | 100 ++++----- .../testing-framework/src/transform/walker.rs | 14 +- tools/cli/air/Cargo.toml | 9 +- tools/cli/air/src/data.rs | 12 +- tools/cli/air/src/main.rs | 7 +- tools/cli/air/src/trace/run.rs | 8 +- tools/cli/air/src/trace/run/native.rs | 65 +++--- tools/cli/air/src/trace/run/runner.rs | 9 +- tools/cli/air/src/trace/run/wasm.rs | 70 ++++--- 116 files changed, 995 insertions(+), 859 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e0fcfb65e8..08fba2c47d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -197,7 +197,7 @@ version = "0.17.2" dependencies = [ "air-interpreter-sede", "fluence-it-types", - "marine-call-parameters", + "marine-call-parameters 0.12.0", "marine-rs-sdk", "serde", "serde_bytes", @@ -271,8 +271,11 @@ dependencies = [ "avm-server", "ed25519-dalek 2.1.0", "fluence-keypair", + "futures", "maplit", "marine-rs-sdk", + "marine-wasm-backend-traits", + "marine-wasmtime-backend", "object-pool", "once_cell", "rand_chacha 0.3.1", @@ -280,6 +283,7 @@ dependencies = [ "serde", "serde_json", "sha2 0.10.8", + "tokio", ] [[package]] @@ -473,7 +477,9 @@ dependencies = [ "bs58 0.5.0", "clap 4.4.11", "fluence-keypair", + "futures", "itertools", + "marine-wasmtime-backend", "near-sdk", "semver 1.0.21", "serde", @@ -657,6 +663,17 @@ dependencies = [ "windows-sys 0.48.0", ] +[[package]] +name = "async-recursion" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5fd55a5ba1179988837d24ab4c7cc8ed6efdeff578ede0416b4225a5fca35bd0" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.48", +] + [[package]] name = "async-signal" version = "0.2.5" @@ -777,11 +794,14 @@ dependencies = [ "log", "maplit", "marine-runtime", + "marine-wasm-backend-traits", + "marine-wasmtime-backend", "parking_lot 0.12.1", "polyplets", "serde", "serde_json", "thiserror", + "tokio", "tracing", ] @@ -2413,9 +2433,7 @@ dependencies = [ [[package]] name = "fluence-app-service" -version = "0.31.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b01d8308282e3ab2e46e722d3004fbf9ac4f345a9de4e2a2d1afdc74fda64a8b" +version = "0.32.0" dependencies = [ "log", "maplit", @@ -2524,12 +2542,13 @@ checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" [[package]] name = "futures" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da0290714b38af9b4a7b094b8a37086d1b4e61f2df9122c3cad2577669145335" +checksum = "645c6916888f6cb6350d2550b80fb63e734897a8498abe35cfb732b6487804b0" dependencies = [ "futures-channel", "futures-core", + "futures-executor", "futures-io", "futures-sink", "futures-task", @@ -2538,9 +2557,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff4dd66668b557604244583e3e1e1eada8c5c2e96a6d0d6653ede395b78bbacb" +checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78" dependencies = [ "futures-core", "futures-sink", @@ -2548,15 +2567,15 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb1d22c66e66d9d72e1758f0bd7d4fd0bee04cad842ee34587d68c07e45d088c" +checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" [[package]] name = "futures-executor" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f4fb8693db0cf099eadcca0efe2a5a22e4550f98ed16aba6c48700da29597bc" +checksum = "a576fc72ae164fca6b9db127eaa9a9dda0d61316034f33a0a0d4eda41f02b01d" dependencies = [ "futures-core", "futures-task", @@ -2565,9 +2584,9 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8bf34a163b5c4c52d0478a4d757da8fb65cabef42ba90515efee0f6f9fa45aaa" +checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1" [[package]] name = "futures-lite" @@ -2594,27 +2613,39 @@ dependencies = [ "pin-project-lite", ] +[[package]] +name = "futures-macro" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.48", +] + [[package]] name = "futures-sink" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e36d3378ee38c2a36ad710c5d30c2911d752cb941c00c72dbabfb786a7970817" +checksum = "9fb8e00e87438d937621c1c6269e53f536c14d3fbd6a042bb24879e57d474fb5" [[package]] name = "futures-task" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "efd193069b0ddadc69c46389b740bbccdd97203899b48d09c5f7969591d6bae2" +checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004" [[package]] name = "futures-util" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a19526d624e703a3179b3d322efec918b6246ea0fa51d41124525f00f1cc8104" +checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48" dependencies = [ "futures-channel", "futures-core", "futures-io", + "futures-macro", "futures-sink", "futures-task", "memchr", @@ -3083,8 +3114,6 @@ dependencies = [ [[package]] name = "it-json-serde" version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a74b6ed688d9de56b4e4cb5aca2bd7a883909f1be8d8d6ba40e3a2d25b9feba5" dependencies = [ "serde", "serde_derive", @@ -3095,12 +3124,14 @@ dependencies = [ [[package]] name = "it-lilo" -version = "0.6.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20108e77e11eeb1ef019f54c3868e0f2e9227295502f0702fa2e7e730ea748f8" +checksum = "1fa7310e6ce8b8b6f11c3d0b5dd5824675fab3cfd335f70bcf9a51198de39cfe" dependencies = [ "anyhow", + "async-recursion", "fluence-it-types", + "futures", "it-memory-traits", "log", "paste", @@ -3109,9 +3140,9 @@ dependencies = [ [[package]] name = "it-memory-traits" -version = "0.4.0" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d563f2a6baee17cf471b7951dfb96ab17fecc5e8947de39f1057cf3fb4cc906d" +checksum = "e83089981169d53e2b13df7c8d132b471bf2fc4c85afe427c4a74115695c4612" dependencies = [ "thiserror", ] @@ -3384,20 +3415,30 @@ version = "0.10.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ef9a7c6ed5fa9052474c1cd76d3b3e67dbc4c455c76263c2c043214e12cce6bd" dependencies = [ - "marine-macro", - "marine-rs-sdk-main", + "marine-macro 0.10.3", + "marine-rs-sdk-main 0.10.3", + "serde", +] + +[[package]] +name = "marine-call-parameters" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f47b1186bad0b2a5e9218e3f6fbe0612ef6b17c58c58537d77bd08044596ea95" +dependencies = [ + "marine-macro 0.12.0", + "marine-rs-sdk-main 0.12.0", "rkyv", "serde", ] [[package]] name = "marine-core" -version = "0.26.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e0e21dd5918c69eefcc06acea338bf444f9137fca6e193b52bfd8e0f069ab4d" +version = "0.27.0" dependencies = [ "anyhow", "bytesize", + "futures", "it-lilo", "it-memory-traits", "log", @@ -3421,13 +3462,11 @@ dependencies = [ [[package]] name = "marine-it-generator" -version = "0.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d03328e174951faf739e7e12be3d9ffb044cfc308508dc89260d63a1a43a0df" +version = "0.14.0" dependencies = [ "it-lilo", "marine-it-parser", - "marine-macro-impl 0.7.1", + "marine-macro-impl 0.12.0", "once_cell", "serde", "serde_json", @@ -3439,8 +3478,6 @@ dependencies = [ [[package]] name = "marine-it-interfaces" version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c610d90a031911c17b2babc32c9fad7261bae6ab0bf118051cd665b5d9bcfbe" dependencies = [ "multimap 0.8.3", "wasmer-interface-types-fl", @@ -3449,8 +3486,6 @@ dependencies = [ [[package]] name = "marine-it-parser" version = "0.15.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "921afa7f139791b24c4cb91c918d1ef7411ef40c3b801309ec43f6b2c89b107b" dependencies = [ "anyhow", "itertools", @@ -3472,14 +3507,24 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "acdaa50f8239afa104ef8a99d4219288f68169e29c913485bbd094a35fe79113" dependencies = [ "marine-macro-impl 0.10.3", - "marine-rs-sdk-main", + "marine-rs-sdk-main 0.10.3", +] + +[[package]] +name = "marine-macro" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "727b1a5449eb1676837c5fc22a8c31dc9980dcef4de938f26f2eaf7c2c54331b" +dependencies = [ + "marine-macro-impl 0.12.0", + "marine-rs-sdk-main 0.12.0", ] [[package]] name = "marine-macro-impl" -version = "0.7.1" +version = "0.10.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca474b63cabaf8d7d9b38de87d630023cbc91ddc77e92f9c7bb745462a131b44" +checksum = "460ef42c1bf6dbb88976a00514f8e1b97a7ccb60e3e6009cbb563b0d163166c7" dependencies = [ "proc-macro2", "quote", @@ -3490,9 +3535,9 @@ dependencies = [ [[package]] name = "marine-macro-impl" -version = "0.10.3" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "460ef42c1bf6dbb88976a00514f8e1b97a7ccb60e3e6009cbb563b0d163166c7" +checksum = "57c8cd8a228856db057bd4a32c6e2708848b2b1db7552be0a6063d534cafb4e2" dependencies = [ "proc-macro2", "quote", @@ -3504,8 +3549,6 @@ dependencies = [ [[package]] name = "marine-min-it-version" version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "147e6e4c9d3dc9afbb06b2e3bc069b63c749733f698d0c364c320a72b133f1d5" dependencies = [ "once_cell", "semver 1.0.21", @@ -3513,14 +3556,12 @@ dependencies = [ [[package]] name = "marine-module-info-parser" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d578b9c5b1a95e9f76301a347d0fbaef5e5e22a0c370e43fc575253e69fa23e6" +version = "0.12.0" dependencies = [ "anyhow", "chrono", "derivative", - "marine-rs-sdk-main", + "marine-rs-sdk-main 0.12.0", "marine-wasm-backend-traits", "semver 1.0.21", "serde", @@ -3531,8 +3572,6 @@ dependencies = [ [[package]] name = "marine-module-interface" version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d92d2243bf0d3aea6401d9e57a1ee17677b624337981322e0153cc2d54744080" dependencies = [ "anyhow", "itertools", @@ -3547,13 +3586,13 @@ dependencies = [ [[package]] name = "marine-rs-sdk" -version = "0.10.3" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "034cab8adf708e87db08f093e0c7b8ea49359cc875ed2a778c1bf245b5d9d9f8" +checksum = "7662e4c6c08f7cd1b63cd6ff8e473e3239a9d3dd10fb46bec357cb8331423268" dependencies = [ - "marine-call-parameters", - "marine-macro", - "marine-rs-sdk-main", + "marine-call-parameters 0.12.0", + "marine-macro 0.12.0", + "marine-rs-sdk-main 0.12.0", "marine-timestamp-macro", "serde", ] @@ -3569,20 +3608,29 @@ dependencies = [ ] [[package]] -name = "marine-runtime" -version = "0.32.1" +name = "marine-rs-sdk-main" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c9a539b0b1586839f133f768db670f0b3f6cd5ffd977dc247cbf8acf8a3dc1a" +checksum = "6cba9000500575b4965ec44e44bbbfd056d121be1195969ce1a5cc146646c37b" +dependencies = [ + "log", + "serde", +] + +[[package]] +name = "marine-runtime" +version = "0.33.0" dependencies = [ "bytesize", "it-json-serde", "it-memory-traits", "itertools", "log", + "marine-call-parameters 0.10.3", "marine-core", "marine-module-interface", "marine-rs-sdk", - "marine-rs-sdk-main", + "marine-rs-sdk-main 0.12.0", "marine-utils", "marine-wasm-backend-traits", "marine-wasmtime-backend", @@ -3599,9 +3647,9 @@ dependencies = [ [[package]] name = "marine-timestamp-macro" -version = "0.10.3" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f812a03cb13b79ab75e38053a77ecc4b4738a1b485b650d971dec3dbbcb2561" +checksum = "47ec0d664570661ecba1feba2dda610ab63f23733edf189dcde7b5ed23966144" dependencies = [ "chrono", "quote", @@ -3610,16 +3658,13 @@ dependencies = [ [[package]] name = "marine-utils" version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fce56bfabfd0af5326ff81c32c8d2261aa03b10e00ea6c165de4ebf8a3f998e4" [[package]] name = "marine-wasm-backend-traits" version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "220bc47cfabb8b4ab97bf2bd7bbab9738857b69beeda0a1ac5776c600b64bb46" dependencies = [ "anyhow", + "futures", "it-memory-traits", "multimap 0.8.3", "paste", @@ -3631,10 +3676,9 @@ dependencies = [ [[package]] name = "marine-wasmtime-backend" version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aaa0dc5a7da0e3334f3ce5b341ba4354341af9a1f9efae24884a1b931efdf23e" dependencies = [ "anyhow", + "futures", "it-memory-traits", "log", "marine-wasm-backend-traits", @@ -4816,7 +4860,7 @@ dependencies = [ name = "polyplets" version = "0.6.0" dependencies = [ - "marine-call-parameters", + "marine-call-parameters 0.12.0", "serde", ] @@ -7028,18 +7072,20 @@ dependencies = [ [[package]] name = "wasmer-interface-types-fl" -version = "0.27.0" +version = "0.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62958478f282fbf2b05c12f9630972bd8194937de1ab22d6a59d43093be32886" +checksum = "7a753426d5a76076aa16a435b5a5f316e3803461f551975d196928bc92e42916" dependencies = [ "anyhow", "fluence-it-types", + "futures", "it-lilo", "it-memory-traits", "it-to-bytes", "itertools", "log", "nom", + "paste", "safe-transmute", "semver 1.0.21", "serde", diff --git a/Cargo.toml b/Cargo.toml index f37f71a547..e8a41fa762 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -41,8 +41,3 @@ overflow-checks = true debug-assertions = false panic = "unwind" -[patch.crates-io] -wasmer-interface-types-fl = {version = "0.27.0", path = "../interface-types/wasmer-it"} -it-memory-traits= {version = "0.4.0", path = "../interface-types/crates/it-memory-traits"} -it-lilo = {version = "0.6.0", path = "../interface-types/crates/it-lilo"} -fluence-it-types = {version = "0.4.1", path = "../interface-types/crates/it-types"} \ No newline at end of file diff --git a/air-interpreter/Cargo.toml b/air-interpreter/Cargo.toml index 9868256755..2ec802d12d 100644 --- a/air-interpreter/Cargo.toml +++ b/air-interpreter/Cargo.toml @@ -22,7 +22,7 @@ aquavm-air = { version = "0.59.0", path = "../air" } air-interpreter-interface = { version = "0.17.2", path = "../crates/air-lib/interpreter-interface" } air-log-targets = { version = "0.1.0", path = "../crates/air-lib/log-targets" } -marine-rs-sdk = {version = "0.10.3", features = ["logger"] } +marine-rs-sdk = {version = "0.12.0", features = ["logger"] } wasm-bindgen = "=0.2.83" diff --git a/air/Cargo.toml b/air/Cargo.toml index 46b7b47be3..1a8f93a76b 100644 --- a/air/Cargo.toml +++ b/air/Cargo.toml @@ -52,8 +52,8 @@ rkyv = { version = "0.7.43", features = ["strict", "validation", "size_32", "arc [dev_dependencies] air-test-utils = { path = "../crates/air-lib/test-utils" } air-testing-framework = { path = "../crates/testing-framework" } -fluence-app-service = {version = "0.31.0", path = "../../marine/crates/fluence-app-service"} -marine-rs-sdk = { version = "0.10.0", features = ["logger"] } +fluence-app-service = {version = "0.32.0", path = "../../marine/crates/fluence-app-service"} +marine-rs-sdk = { version = "0.12.0", features = ["logger"] } borsh = "0.10.3" bs58 = "0.5.0" diff --git a/air/src/execution_step/execution_context/scalar_variables/values_sparse_matrix.rs b/air/src/execution_step/execution_context/scalar_variables/values_sparse_matrix.rs index bf0f1d3ee4..33d2c2e9b4 100644 --- a/air/src/execution_step/execution_context/scalar_variables/values_sparse_matrix.rs +++ b/air/src/execution_step/execution_context/scalar_variables/values_sparse_matrix.rs @@ -288,7 +288,7 @@ mod test { use std::num::NonZeroUsize; use std::rc::Rc; - #[test] + #[tokio::test] fn test_local_cleanup() { let mut scalars = ValuesSparseMatrix::new(); diff --git a/air/src/execution_step/value_types/canon_stream_map.rs b/air/src/execution_step/value_types/canon_stream_map.rs index fcefcfed75..41f62f6f67 100644 --- a/air/src/execution_step/value_types/canon_stream_map.rs +++ b/air/src/execution_step/value_types/canon_stream_map.rs @@ -206,7 +206,7 @@ mod test { (va_vec, vec![canon_stream_one, canon_stream_two], keys) } - #[test] + #[tokio::test] fn from_canon_stream() { let peer_pk = "some_tetraplet"; let (va_vec, canon_streams, keys) = create_va_canon_and_keys_vecs(peer_pk); @@ -225,7 +225,7 @@ mod test { assert!(canon_stream_map_key_two.clone().into_values() == canon_stream_two.clone().into_values()); } - #[test] + #[tokio::test] fn test_index_ok() { let peer_pk = "some_tetraplet"; let (va_vec, canon_streams, _) = create_va_canon_and_keys_vecs(peer_pk); diff --git a/air/src/execution_step/value_types/stream/recursive_stream.rs b/air/src/execution_step/value_types/stream/recursive_stream.rs index ad730909fb..eb0ec8edd6 100644 --- a/air/src/execution_step/value_types/stream/recursive_stream.rs +++ b/air/src/execution_step/value_types/stream/recursive_stream.rs @@ -170,7 +170,7 @@ mod test { } } - #[test] + #[tokio::test] fn fold_started_empty_if_no_values() { let mut stream = Stream::new(); let mut recursive_stream = RecursiveStreamCursor::new(); @@ -179,7 +179,7 @@ mod test { assert!(!cursor_state.should_continue()) } - #[test] + #[tokio::test] fn next_iteration_empty_if_no_values() { let mut stream = Stream::new(); let mut recursive_stream = RecursiveStreamCursor::new(); @@ -188,7 +188,7 @@ mod test { assert!(!cursor_state.should_continue()) } - #[test] + #[tokio::test] fn next_iteration_empty_if_no_values_added() { let mut stream = Stream::new(); let mut recursive_stream = RecursiveStreamCursor::new(); @@ -204,7 +204,7 @@ mod test { assert!(!cursor_state.should_continue()); } - #[test] + #[tokio::test] fn one_recursive_iteration() { let mut stream = Stream::new(); let mut recursive_stream = RecursiveStreamCursor::new(); @@ -227,7 +227,7 @@ mod test { assert!(!cursor_state.should_continue()); } - #[test] + #[tokio::test] fn add_value_into_prev_and_current() { let mut stream = Stream::new(); let mut recursive_stream = RecursiveStreamCursor::new(); diff --git a/air/src/execution_step/value_types/stream/stream_definition.rs b/air/src/execution_step/value_types/stream/stream_definition.rs index 94e15f8165..8bb4c43f9c 100644 --- a/air/src/execution_step/value_types/stream/stream_definition.rs +++ b/air/src/execution_step/value_types/stream/stream_definition.rs @@ -257,7 +257,7 @@ mod test { ) } - #[test] + #[tokio::test] fn test_iter() { let value_1 = create_value(json!("value_1")); let value_2 = create_value(json!("value_2")); @@ -273,7 +273,7 @@ mod test { assert_eq!(iter.next(), None); } - #[test] + #[tokio::test] fn test_slice_iter_prev() { let value_1 = create_value(json!("value_1")); let value_2 = create_value(json!("value_2")); @@ -294,7 +294,7 @@ mod test { assert_eq!(slice_iter.next(), None); } - #[test] + #[tokio::test] fn test_slice_iter_current() { let value_1 = create_value(json!("value_1")); let value_2 = create_value(json!("value_2")); @@ -315,7 +315,7 @@ mod test { assert_eq!(slice_iter.next(), None); } - #[test] + #[tokio::test] fn test_slice_iter_new() { let value_1 = create_value(json!("value_1")); let value_2 = create_value(json!("value_2")); @@ -336,7 +336,7 @@ mod test { assert_eq!(slice_iter.next(), None); } - #[test] + #[tokio::test] fn test_iter_on_empty_stream() { let stream = Stream::new(); @@ -344,7 +344,7 @@ mod test { assert_eq!(slice.next(), None); } - #[test] + #[tokio::test] fn test_slice_on_empty_stream() { let stream = Stream::new(); @@ -352,7 +352,7 @@ mod test { assert_eq!(slice.next(), None); } - #[test] + #[tokio::test] fn generation_from_current_data_after_previous() { let value_1 = create_value(json!("value_1")); let value_2 = create_value(json!("value_2")); @@ -367,7 +367,7 @@ mod test { assert_eq!(iter.next(), None); } - #[test] + #[tokio::test] fn generation_from_new_data_after_current_and_previous() { let value_1 = create_value(json!("value_1")); let value_2 = create_value(json!("value_2")); @@ -385,7 +385,7 @@ mod test { assert_eq!(iter.next(), None); } - #[test] + #[tokio::test] fn empty_generations_skipped_in_slice_iter_prev() { let value_1 = create_value(json!("value_1")); let value_2 = create_value(json!("value_2")); @@ -403,7 +403,7 @@ mod test { assert_eq!(slice_iter.next(), None); } - #[test] + #[tokio::test] fn empty_generations_skipped_in_slice_iter_current() { let value_1 = create_value(json!("value_1")); let value_2 = create_value(json!("value_2")); @@ -421,7 +421,7 @@ mod test { assert_eq!(slice_iter.next(), None); } - #[test] + #[tokio::test] fn compactification_with_previous_new_generation() { let value_1 = create_value_with_pos(json!("value_1"), 0.into()); let value_2 = create_value_with_pos(json!("value_2"), 1.into()); @@ -449,7 +449,7 @@ mod test { assert_eq!(actual_trace, expected_trace); } - #[test] + #[tokio::test] fn compactification_with_current_generation() { let value_1 = create_value_with_pos(json!("value_1"), 0.into()); let value_2 = create_value_with_pos(json!("value_2"), 1.into()); @@ -481,7 +481,7 @@ mod test { assert_eq!(actual_trace, expected_trace); } - #[test] + #[tokio::test] fn compactification_works_with_mixed_generations() { let value_1 = create_value_with_pos(json!("value_1"), 0.into()); let value_2 = create_value_with_pos(json!("value_2"), 1.into()); @@ -525,7 +525,7 @@ mod test { assert_eq!(actual_trace, expected_trace); } - #[test] + #[tokio::test] fn compactification_invalid_state_error() { let value_1 = create_value(json!("value_1")); let mut stream = Stream::new(); @@ -550,7 +550,7 @@ mod test { )); } - #[test] + #[tokio::test] fn compactification_points_to_nowhere_error() { let value_1 = create_value(json!("value_1")); let mut stream = Stream::new(); @@ -571,7 +571,7 @@ mod test { )); } - #[test] + #[tokio::test] fn stream_size_limit() { use super::STREAM_MAX_SIZE; use crate::UncatchableError; diff --git a/air/src/execution_step/value_types/stream_map.rs b/air/src/execution_step/value_types/stream_map.rs index f3ca13126e..292517e77e 100644 --- a/air/src/execution_step/value_types/stream_map.rs +++ b/air/src/execution_step/value_types/stream_map.rs @@ -152,7 +152,7 @@ mod test { actual_value == &expected_value } - #[test] + #[tokio::test] fn test_from_value_key_str() { let key = StreamMapKey::Str(Cow::Borrowed("some_key")); let value = Rc::new(json!("1")); @@ -168,7 +168,7 @@ mod test { assert_eq!(iter.next(), None); } - #[test] + #[tokio::test] fn test_from_value_key_int() { let key = StreamMapKey::I64(42.into()); let value = Rc::new(json!("1")); @@ -184,7 +184,7 @@ mod test { assert_eq!(iter.next(), None); } - #[test] + #[tokio::test] fn test_insert() { let key_1_2 = StreamMapKey::Str(Cow::Borrowed("some_key")); let value_1 = Rc::new(json!("1")); @@ -224,7 +224,7 @@ mod test { assert_eq!(iter.next(), None); } - #[test] + #[tokio::test] fn compactification_invalid_state_error() { use air_interpreter_data::CanonResult; @@ -255,7 +255,7 @@ mod test { )); } - #[test] + #[tokio::test] fn compactification_points_to_nowhere_error() { let key = StreamMapKey::Str(Cow::Borrowed("some_key")); let value = Rc::new(json!("1")); @@ -317,7 +317,7 @@ mod test { }); } - #[test] + #[tokio::test] fn test_iter_unique_key_object() { const TEST_DATA_SIZE: usize = 5; let key_values = generate_key_values(TEST_DATA_SIZE); diff --git a/air/tests/test_module/features/cid/canon.rs b/air/tests/test_module/features/cid/canon.rs index df6c3da8cb..ee83109731 100644 --- a/air/tests/test_module/features/cid/canon.rs +++ b/air/tests/test_module/features/cid/canon.rs @@ -23,7 +23,7 @@ use air_test_utils::key_utils::at; use air_test_utils::prelude::*; use pretty_assertions::assert_eq; -#[test] +#[tokio::test] fn test_canon_ok() { let init_peer_name = "init_peer_id"; @@ -99,7 +99,7 @@ fn test_canon_ok() { ); } -#[test] +#[tokio::test] fn test_canon_ok_multi() { let init_peer_name = "init_peer_id"; let other_peer_name = "other_peer_id"; @@ -190,7 +190,7 @@ fn test_canon_ok_multi() { ); } -#[test] +#[tokio::test] fn test_canon_value_not_found() { let init_peer_id = "vm_peer_id"; let mut vm = create_avm(echo_call_service(), init_peer_id); @@ -238,7 +238,7 @@ fn test_canon_value_not_found() { assert!(check_error(&result, expected_error)); } -#[test] +#[tokio::test] fn test_canon_root_tetraplet_not_found() { let init_peer_id = "vm_peer_id"; let other_peer_id = "other_peer_id"; @@ -293,7 +293,7 @@ fn test_canon_root_tetraplet_not_found() { assert_error_eq!(&result, expected_error); } -#[test] +#[tokio::test] fn test_canon_tetraplet_not_found() { let init_peer_id = "vm_peer_id"; let mut vm = create_avm(echo_call_service(), init_peer_id); @@ -352,7 +352,7 @@ fn test_canon_tetraplet_not_found() { assert_error_eq!(&result, expected_error); } -#[test] +#[tokio::test] fn test_canon_agg_not_found() { let init_peer_id = "vm_peer_id"; let mut vm = create_avm(echo_call_service(), init_peer_id); diff --git a/air/tests/test_module/features/cid/mod.rs b/air/tests/test_module/features/cid/mod.rs index e5a846d58c..3a02f83edb 100644 --- a/air/tests/test_module/features/cid/mod.rs +++ b/air/tests/test_module/features/cid/mod.rs @@ -24,7 +24,7 @@ use air_test_utils::prelude::*; use pretty_assertions::assert_eq; -#[test] +#[tokio::test] fn test_missing_cid() { let peer_id = "peer_id"; let mut vm = create_avm(echo_call_service(), peer_id); @@ -48,7 +48,7 @@ fn test_missing_cid() { assert!(check_error(&result, expected_error), "{:?}", result); } -#[test] +#[tokio::test] fn test_correct_cid() { let peer_id = "peer_id"; let mut vm = create_avm(echo_call_service(), peer_id); @@ -68,7 +68,7 @@ fn test_correct_cid() { assert_eq!(result.ret_code, 0, "{:?}", result); } -#[test] +#[tokio::test] fn test_scalar_cid() { let vm_peer_name = "vm_peer_id"; @@ -115,7 +115,7 @@ fn test_scalar_cid() { ); } -#[test] +#[tokio::test] fn test_stream_cid() { let vm_peer_name = "vm_peer_id"; @@ -164,7 +164,7 @@ fn test_stream_cid() { ); } -#[test] +#[tokio::test] fn test_unused_cid() { let vm_peer_id = "vm_peer_id"; diff --git a/air/tests/test_module/features/data_merging/air_basic.rs b/air/tests/test_module/features/data_merging/air_basic.rs index 86161bb152..ea5e80fdb0 100644 --- a/air/tests/test_module/features/data_merging/air_basic.rs +++ b/air/tests/test_module/features/data_merging/air_basic.rs @@ -20,7 +20,7 @@ use air_test_utils::prelude::*; use pretty_assertions::assert_eq; -#[test] +#[tokio::test] fn seq_par_call() { let vm_peer_id = "some_peer_id"; let mut vm = create_avm(unit_call_service(), vm_peer_id); @@ -61,7 +61,7 @@ fn seq_par_call() { assert_eq!(result.next_peer_pks, vec![String::from("remote_peer_id")]); } -#[test] +#[tokio::test] fn par_par_call() { let vm_peer_id = "some_peer_id"; let remote_peer_id = "remote_peer_id"; diff --git a/air/tests/test_module/features/data_merging/data_merge.rs b/air/tests/test_module/features/data_merging/data_merge.rs index 67a43f2456..ad1fd2c7ff 100644 --- a/air/tests/test_module/features/data_merging/data_merge.rs +++ b/air/tests/test_module/features/data_merging/data_merge.rs @@ -23,7 +23,7 @@ use pretty_assertions::assert_eq; use std::collections::HashMap; use std::ops::Deref; -#[test] +#[tokio::test] fn merge_streams_in_two_fold() { use executed_state::*; @@ -176,7 +176,7 @@ fn merge_streams_in_two_fold() { assert!(result_4.next_peer_pks.is_empty()); } -#[test] +#[tokio::test] fn stream_merge() { let neighborhood_call_service: CallServiceClosure = Box::new(|params| -> CallServiceResult { let args_count = (params.function_name.as_bytes()[0] - b'0') as usize; @@ -218,7 +218,7 @@ fn stream_merge() { checked_call_vm!(vm2, <_>::default(), script, "", result.data); } -#[test] +#[tokio::test] fn fold_merge() { let set_variable_vm_id = "set_variable"; let local_vm_id = "local_vm"; @@ -359,7 +359,7 @@ fn fold_merge() { } } -#[test] +#[tokio::test] fn test_merge_scalar_match() { let air = r#"(call "peer" ("" "") [] var)"#; @@ -371,7 +371,7 @@ fn test_merge_scalar_match() { checked_call_vm!(avm, <_>::default(), air, data.clone(), data); } -#[test] +#[tokio::test] fn test_merge_scalar_mismatch() { let air = r#"(call "peer" ("" "") [] var)"#; let mut avm = create_avm(echo_call_service(), "peer"); @@ -401,7 +401,7 @@ fn test_merge_scalar_mismatch() { ); } -#[test] +#[tokio::test] fn test_merge_stream_match() { let air = r#"(call "peer" ("" "") [] $var)"#; @@ -413,7 +413,7 @@ fn test_merge_stream_match() { checked_call_vm!(avm, <_>::default(), air, data.clone(), data); } -#[test] +#[tokio::test] fn test_merge_stream_match_gen() { let air = r#"(call "peer" ("" "") [] $var)"#; let mut avm = create_avm(echo_call_service(), "peer"); @@ -427,7 +427,7 @@ fn test_merge_stream_match_gen() { checked_call_vm!(avm, <_>::default(), air, data1, data2); } -#[test] +#[tokio::test] fn test_merge_stream_mismatch() { let air = r#"(call "peer" ("" "") [] $var)"#; let mut avm = create_avm(echo_call_service(), "peer"); @@ -457,7 +457,7 @@ fn test_merge_stream_mismatch() { ); } -#[test] +#[tokio::test] fn test_merge_unused_match() { let air = r#"(call "peer" ("" "") [])"#; @@ -469,7 +469,7 @@ fn test_merge_unused_match() { checked_call_vm!(avm, <_>::default(), air, data.clone(), data); } -#[test] +#[tokio::test] fn test_merge_unused_mismatch() { let air = r#"(call "peer" ("" "") [])"#; let mut avm = create_avm(echo_call_service(), "peer"); diff --git a/air/tests/test_module/features/data_merging/executed_trace_basic.rs b/air/tests/test_module/features/data_merging/executed_trace_basic.rs index 1732f73f48..c4187a7ed0 100644 --- a/air/tests/test_module/features/data_merging/executed_trace_basic.rs +++ b/air/tests/test_module/features/data_merging/executed_trace_basic.rs @@ -20,7 +20,7 @@ use air_test_utils::prelude::*; use pretty_assertions::assert_eq; -#[test] +#[tokio::test] fn executed_trace_seq_par_call() { let local_peer_id = "local_peer_id"; let remote_peer_id = "remote_peer_id"; @@ -87,7 +87,7 @@ fn executed_trace_seq_par_call() { assert!(result.next_peer_pks.is_empty()); } -#[test] +#[tokio::test] fn executed_trace_par_par_call() { let local_peer_id = "local_peer_id"; let remote_peer_id = "remote_peer_id"; @@ -160,7 +160,7 @@ fn executed_trace_par_par_call() { assert_eq!(actual_trace, expected_trace); } -#[test] +#[tokio::test] fn executed_trace_seq_seq() { let peer_id_1 = "12D3KooWHk9BjDQBUqnavciRPhAYFvqKBe4ZiPPvde7vDaqgn5er"; let peer_id_2 = "12D3KooWAzJcYitiZrerycVB4Wryrx22CFKdDGx7c4u31PFdfTbR"; @@ -203,7 +203,7 @@ fn executed_trace_seq_seq() { assert_eq!(actual_trace, expected_trace); } -#[test] +#[tokio::test] fn executed_trace_create_service() { let module = "greeting"; let module_config = json!( @@ -302,7 +302,7 @@ fn executed_trace_create_service() { assert!(result.next_peer_pks.is_empty()); } -#[test] +#[tokio::test] fn executed_trace_par_seq_fold_call() { let return_numbers_call_service: CallServiceClosure = Box::new(|_| -> CallServiceResult { CallServiceResult::ok(json!(["1", "2", "3", "4", "5", "6", "7", "8", "9", "10"])) @@ -449,7 +449,7 @@ fn executed_trace_par_seq_fold_call() { assert!(result.next_peer_pks.is_empty()); } -#[test] +#[tokio::test] fn executed_trace_par_seq_fold_in_cycle_call() { let return_numbers_call_service: CallServiceClosure = Box::new(|_| -> CallServiceResult { CallServiceResult::ok(json!(["1", "2", "3", "4", "5", "6", "7", "8", "9", "10"])) @@ -595,7 +595,7 @@ fn executed_trace_par_seq_fold_in_cycle_call() { } } -#[test] +#[tokio::test] fn executed_trace_seq_par_seq_seq() { let peer_id_1 = "12D3KooWHk9BjDQBUqnavciRPhAYFvqKBe4ZiPPvde7vDaqgn5er"; let peer_id_2 = "12D3KooWAzJcYitiZrerycVB4Wryrx22CFKdDGx7c4u31PFdfTbR"; diff --git a/air/tests/test_module/features/errors/error.rs b/air/tests/test_module/features/errors/error.rs index c360f6ae09..f3689d4ce1 100644 --- a/air/tests/test_module/features/errors/error.rs +++ b/air/tests/test_module/features/errors/error.rs @@ -19,7 +19,7 @@ use air::ExecutionCidState; use air_test_framework::AirScriptExecutor; use air_test_utils::prelude::*; -#[test] +#[tokio::test] fn fail_with_rebubble_error() { let peer_id = "peer_id"; let script = r#" @@ -72,7 +72,7 @@ fn fail_with_rebubble_error() { assert_eq!(actual_trace, expected_trace,); } -#[test] +#[tokio::test] fn rebubble_error_from_xor_right_branch() { let peer_id = "peer_id"; let script = r#" diff --git a/air/tests/test_module/features/errors/invalid_air.rs b/air/tests/test_module/features/errors/invalid_air.rs index 9babb549ca..eb50f4469d 100644 --- a/air/tests/test_module/features/errors/invalid_air.rs +++ b/air/tests/test_module/features/errors/invalid_air.rs @@ -17,7 +17,7 @@ use air::PreparationError; use air_test_utils::prelude::*; -#[test] +#[tokio::test] fn invalid_air() { let vm_peer_id = "some_peer_id"; let mut vm = create_avm(unit_call_service(), vm_peer_id); diff --git a/air/tests/test_module/features/errors/last_error.rs b/air/tests/test_module/features/errors/last_error.rs index f4b27ed331..2dc055bc99 100644 --- a/air/tests/test_module/features/errors/last_error.rs +++ b/air/tests/test_module/features/errors/last_error.rs @@ -47,7 +47,7 @@ fn create_check_service_closure( }) } -#[test] +#[tokio::test] fn last_error_tetraplets() { let set_variable_peer_id = "set_variable"; let mut set_variable_vm = create_avm(unit_call_service(), set_variable_peer_id); @@ -92,7 +92,7 @@ fn last_error_tetraplets() { assert_eq!(&(*tetraplets.borrow()).as_ref().unwrap()[0][0].json_path, ""); } -#[test] +#[tokio::test] fn not_clear_last_error_in_match() { let set_variable_peer_id = "set_variable"; let mut set_variable_vm = create_avm(unit_call_service(), set_variable_peer_id); @@ -127,7 +127,7 @@ fn not_clear_last_error_in_match() { assert_eq!(actual_value, no_error_object(),); } -#[test] +#[tokio::test] fn not_clear_last_error_in_mismatch() { let set_variable_peer_id = "set_variable"; let mut set_variable_vm = create_avm(unit_call_service(), set_variable_peer_id); @@ -162,7 +162,7 @@ fn not_clear_last_error_in_mismatch() { assert_eq!(actual_value, no_error_object(),); } -#[test] +#[tokio::test] fn track_current_peer_id() { let fallible_peer_id = "fallible_peer_id"; let mut fallible_vm = create_avm(fallible_call_service("fallible_call_service"), fallible_peer_id); @@ -190,7 +190,7 @@ fn track_current_peer_id() { assert_eq!(last_error.get("peer_id").unwrap(), fallible_peer_id); } -#[test] +#[tokio::test] fn variable_names_shown_in_error() { let set_variable_vm_peer_id = "set_variable_vm_peer_id"; let mut set_variable_vm = create_avm(set_variable_call_service(json!(1u32)), set_variable_vm_peer_id); @@ -218,7 +218,7 @@ fn variable_names_shown_in_error() { assert_eq!(trace[1.into()], unused!(msg, peer = echo_vm_peer_id, args = vec![msg])); } -#[test] +#[tokio::test] fn non_initialized_last_error() { let vm_peer_id = "vm_peer_id"; let args = Rc::new(RefCell::new(None)); @@ -250,7 +250,7 @@ fn non_initialized_last_error() { ); } -#[test] +#[tokio::test] fn access_last_error_by_not_exists_field() { let fallible_peer_id = "fallible_peer_id"; let mut fallible_vm = create_avm(fallible_call_service("fallible_call_service"), fallible_peer_id); @@ -283,7 +283,7 @@ fn access_last_error_by_not_exists_field() { assert!(check_error(&result, expected_error)); } -#[test] +#[tokio::test] fn last_error_with_par_one_subgraph_failed() { let fallible_peer_id = "fallible_peer_id"; let fallible_call_service_name = "fallible_call_service"; @@ -318,7 +318,7 @@ fn last_error_with_par_one_subgraph_failed() { assert_eq!(actual_value, expected_value); } -#[test] +#[tokio::test] fn fail_with_scalar_rebubble_error() { let fallible_peer_id = "fallible_peer_id"; let mut fallible_vm = create_avm(fallible_call_service("fallible_call_service"), fallible_peer_id); @@ -348,7 +348,7 @@ fn fail_with_scalar_rebubble_error() { assert!(check_error(&result, expected_error)); } -#[test] +#[tokio::test] fn fail_with_scalar_from_call() { let vm_peer_id = "vm_peer_id"; let error_code = 1337; @@ -376,7 +376,7 @@ fn fail_with_scalar_from_call() { assert!(check_error(&result, expected_error)); } -#[test] +#[tokio::test] fn fail_with_scalar_with_lambda_from_call() { let vm_peer_id = "vm_peer_id"; let error_code = 1337; @@ -404,7 +404,7 @@ fn fail_with_scalar_with_lambda_from_call() { assert!(check_error(&result, expected_error)); } -#[test] +#[tokio::test] fn fail_with_scalar_from_call_not_enough_fields() { let vm_peer_id = "vm_peer_id"; let error_code = 1337; @@ -429,7 +429,7 @@ fn fail_with_scalar_from_call_not_enough_fields() { assert!(check_error(&result, expected_error)); } -#[test] +#[tokio::test] fn fail_with_scalar_from_call_not_right_type() { let vm_peer_id = "vm_peer_id"; let service_result = json!([]); @@ -450,7 +450,7 @@ fn fail_with_scalar_from_call_not_right_type() { assert!(check_error(&result, expected_error)); } -#[test] +#[tokio::test] fn fail_with_scalar_from_call_field_not_right_type() { let vm_peer_id = "vm_peer_id"; let service_result = json!({"error_code": "error_code", "message": "error message"}); @@ -475,7 +475,7 @@ fn fail_with_scalar_from_call_field_not_right_type() { assert!(check_error(&result, expected_error)); } -#[test] +#[tokio::test] fn last_error_with_match() { let vm_peer_id = "vm_peer_id"; let mut vm = create_avm(fallible_call_service("fallible_call_service"), vm_peer_id); @@ -497,7 +497,7 @@ fn last_error_with_match() { assert_eq!(trace.len(), 2); // if match works there will be 2 calls in a resulted trace } -#[test] +#[tokio::test] fn undefined_last_error_errcode() { let local_peer_id = "local_peer_id"; let script = format!( @@ -525,7 +525,7 @@ fn undefined_last_error_errcode() { assert_eq!(actual_trace, expected_trace); } -#[test] +#[tokio::test] fn undefined_last_error_msg_errcode() { let local_peer_id = "local_peer_id"; let script = format!( diff --git a/air/tests/test_module/features/join_behaviour/join_behaviour.rs b/air/tests/test_module/features/join_behaviour/join_behaviour.rs index 78fd7191ae..ea62fdab30 100644 --- a/air/tests/test_module/features/join_behaviour/join_behaviour.rs +++ b/air/tests/test_module/features/join_behaviour/join_behaviour.rs @@ -18,7 +18,7 @@ use air::CatchableError; use air::LambdaError; use air_test_utils::prelude::*; -#[test] +#[tokio::test] fn dont_wait_on_json_path() { let status = json!({ "err_msg": "", @@ -66,7 +66,7 @@ fn dont_wait_on_json_path() { assert_eq!(result.next_peer_pks, vec![test_params.init_peer_id]); } -#[test] +#[tokio::test] fn dont_wait_on_json_path_on_scalars() { let array = json!([1u32, 2u32, 3u32, 4u32, 5u32]); @@ -128,7 +128,7 @@ fn dont_wait_on_json_path_on_scalars() { assert!(check_error(&object_result, expected_error)); } -#[test] +#[tokio::test] fn ap_scalar_with_join_behaviour() { let peer_1_id = "peer_1_id"; let peer_2_id = "peer_2_id"; @@ -152,7 +152,7 @@ fn ap_scalar_with_join_behaviour() { assert_eq!(trace.len(), 2); } -#[test] +#[tokio::test] fn ap_stream_with_join_behaviour() { let peer_1_id = "peer_1_id"; let peer_2_id = "peer_2_id"; @@ -176,7 +176,7 @@ fn ap_stream_with_join_behaviour() { assert_eq!(trace.len(), 2); } -#[test] +#[tokio::test] fn match_with_join_behaviour() { let peer_1_id = "peer_1_id"; let peer_2_id = "peer_2_id"; @@ -202,7 +202,7 @@ fn match_with_join_behaviour() { assert_eq!(trace.len(), 2); } -#[test] +#[tokio::test] fn mismatch_with_join_behaviour() { let peer_1_id = "peer_1_id"; let peer_2_id = "peer_2_id"; @@ -228,7 +228,7 @@ fn mismatch_with_join_behaviour() { assert_eq!(trace.len(), 2); } -#[test] +#[tokio::test] fn fold_with_join_behaviour() { let peer_1_id = "peer_1_id"; let peer_2_id = "peer_2_id"; @@ -254,7 +254,7 @@ fn fold_with_join_behaviour() { assert_eq!(trace.len(), 2); } -#[test] +#[tokio::test] fn canon_with_empty_behaviour() { let peer_id = "peer_id"; diff --git a/air/tests/test_module/features/lambda/flattening.rs b/air/tests/test_module/features/lambda/flattening.rs index 2521a2d51a..d12c729ea5 100644 --- a/air/tests/test_module/features/lambda/flattening.rs +++ b/air/tests/test_module/features/lambda/flattening.rs @@ -44,7 +44,7 @@ fn create_check_service_closure(closure_call_args: ClosureCallArgs) -> CallServi }) } -#[test] +#[tokio::test] fn flattening_scalar_arrays() { let scalar_array = json!({"iterable": [ {"peer_id" : "local_peer_id", "service_id": "local_service_id", "function_name": "local_function_name", "args": [0, 1]}, @@ -87,7 +87,7 @@ fn flattening_scalar_arrays() { assert_eq!(closure_call_args.args_var, Rc::new(RefCell::new(vec![2, 3]))); } -#[test] +#[tokio::test] #[ignore] fn flattening_streams() { let stream_value = json!( @@ -136,7 +136,7 @@ fn flattening_streams() { assert_eq!(closure_call_args.args_var, Rc::new(RefCell::new(vec![0, 1]))); } -#[test] +#[tokio::test] #[ignore] fn test_handling_non_flattening_values() { let stream_value = json!( diff --git a/air/tests/test_module/features/lambda/functors.rs b/air/tests/test_module/features/lambda/functors.rs index 2026eaa9fa..6d0bf7548b 100644 --- a/air/tests/test_module/features/lambda/functors.rs +++ b/air/tests/test_module/features/lambda/functors.rs @@ -21,7 +21,7 @@ use air_test_utils::prelude::*; use pretty_assertions::assert_eq; use std::cell::RefCell; -#[test] +#[tokio::test] fn length_functor_for_array_scalar() { let script = r#" (seq @@ -44,7 +44,7 @@ fn length_functor_for_array_scalar() { assert_eq!(actual_trace, expected_trace); } -#[test] +#[tokio::test] fn length_functor_for_non_array_scalar() { let result_jvalue = "string_jvalue"; let script = format!( @@ -67,7 +67,7 @@ fn length_functor_for_non_array_scalar() { ); } -#[test] +#[tokio::test] fn length_functor_for_stream() { let script = r#" (seq @@ -113,7 +113,7 @@ fn length_functor_for_stream() { assert_eq!(actual_trace, expected_trace); } -#[test] +#[tokio::test] fn length_functor_for_empty_stream() { let script = r#" (new $stream @@ -143,7 +143,7 @@ fn length_functor_for_empty_stream() { assert_eq!(actual_trace, expected_trace); } -#[test] +#[tokio::test] fn length_functor_for_canon_stream() { let script = r#" (seq @@ -180,7 +180,7 @@ fn length_functor_for_canon_stream() { assert_eq!(actual_trace, expected_trace); } -#[test] +#[tokio::test] fn length_functor_for_empty_canon_stream() { let script = r#" (new $stream @@ -209,7 +209,7 @@ fn length_functor_for_empty_canon_stream() { assert_eq!(actual_trace, expected_trace); } -#[test] +#[tokio::test] fn functor_dont_influence_tetraplet() { let set_variable_peer_id = "set_variable_peer_id"; let set_variable_peer_result = json!({"field": [1,2,3]}); diff --git a/air/tests/test_module/features/lambda/lambda.rs b/air/tests/test_module/features/lambda/lambda.rs index 43f46397e2..ae310b32a4 100644 --- a/air/tests/test_module/features/lambda/lambda.rs +++ b/air/tests/test_module/features/lambda/lambda.rs @@ -18,7 +18,7 @@ use air::CatchableError; use air::LambdaError; use air_test_utils::prelude::*; -#[test] +#[tokio::test] fn lambda_not_allowed_for_non_objects_and_arrays() { let set_variable_peer_id = "set_variable"; let mut set_variable_vm = create_avm(echo_call_service(), set_variable_peer_id); @@ -44,7 +44,7 @@ fn lambda_not_allowed_for_non_objects_and_arrays() { assert!(check_error(&result, expected_error)); } -#[test] +#[tokio::test] fn lambda_with_string_scalar() { let set_variable_peer_id = "set_variable"; let variables = maplit::hashmap! { @@ -78,7 +78,7 @@ fn lambda_with_string_scalar() { assert_eq!(&trace[2.into()], &unused!(1u32, peer = local_peer_id, args = vec![1])); } -#[test] +#[tokio::test] fn lambda_with_number_scalar() { let set_variable_peer_id = "set_variable"; let variables = maplit::hashmap! { @@ -112,7 +112,7 @@ fn lambda_with_number_scalar() { assert_eq!(&trace[2.into()], &unused!(1u32, peer = local_peer_id, args = vec![1])); } -#[test] +#[tokio::test] fn lambda_with_number_stream() { let set_variable_peer_id = "set_variable"; let variables = maplit::hashmap! { @@ -160,7 +160,7 @@ fn lambda_with_number_stream() { ); } -#[test] +#[tokio::test] fn lambda_with_number_stream_and_followed_scalar() { let set_variable_peer_id = "set_variable"; let checkable_value = 1337; @@ -213,7 +213,7 @@ fn lambda_with_number_stream_and_followed_scalar() { ); } -#[test] +#[tokio::test] fn lambda_with_scalar_join() { let set_variable_peer_id = "set_variable"; let variables = maplit::hashmap! { @@ -250,7 +250,7 @@ fn lambda_with_scalar_join() { #[ignore] // after 0.32 version AIR is no longer supports lambdas over stream, // although this test could be useful in the future for functors -#[test] +#[tokio::test] fn lambda_with_canon_stream_join() { let set_variable_peer_id = "set_variable"; let variables = maplit::hashmap! { diff --git a/air/tests/test_module/features/misc/empty_array.rs b/air/tests/test_module/features/misc/empty_array.rs index 4f0903d879..53e764f7c2 100644 --- a/air/tests/test_module/features/misc/empty_array.rs +++ b/air/tests/test_module/features/misc/empty_array.rs @@ -16,7 +16,7 @@ use air_test_utils::prelude::*; -#[test] +#[tokio::test] fn empty_array() { let vm_peer_id = "some_peer_id"; let mut vm = create_avm(echo_call_service(), vm_peer_id); diff --git a/air/tests/test_module/features/misc/version_check.rs b/air/tests/test_module/features/misc/version_check.rs index 6d43aec956..7dfbaca5d8 100644 --- a/air/tests/test_module/features/misc/version_check.rs +++ b/air/tests/test_module/features/misc/version_check.rs @@ -19,7 +19,7 @@ use air::PreparationError; use air_interpreter_interface::INTERPRETER_SUCCESS; use air_test_utils::prelude::*; -#[test] +#[tokio::test] fn minimal_version_check() { let mut vm = create_avm(echo_call_service(), ""); let script = "(null)"; @@ -37,7 +37,7 @@ fn minimal_version_check() { assert!(check_error(&result, expected_error)); } -#[test] +#[tokio::test] fn publish_version_check() { let mut vm = create_avm(echo_call_service(), ""); let script = "(null)"; @@ -51,7 +51,7 @@ fn publish_version_check() { assert_eq!(result.ret_code, INTERPRETER_SUCCESS, "{:?}", result.error_message); } -#[test] +#[tokio::test] fn publish_unsupported_version_check() { let mut vm = create_avm(echo_call_service(), ""); diff --git a/air/tests/test_module/features/scopes/scalars_scope.rs b/air/tests/test_module/features/scopes/scalars_scope.rs index d7b2a36e9b..48da3ca5ff 100644 --- a/air/tests/test_module/features/scopes/scalars_scope.rs +++ b/air/tests/test_module/features/scopes/scalars_scope.rs @@ -18,7 +18,7 @@ use air::CatchableError; use air::ExecutionError; use air_test_utils::prelude::*; -#[test] +#[tokio::test] fn scalars_scope() { let peer_1_id = "peer_1_id"; let array_1_content = json!(["1", "2"]); @@ -73,7 +73,7 @@ fn scalars_scope() { assert_eq!(actual_trace, expected_trace); } -#[test] +#[tokio::test] fn before_after_of_next() { let set_array_0_peer_id = "set_array_0_peer_id"; let array_0_content = json!([1, 2, 3]); @@ -124,7 +124,7 @@ fn before_after_of_next() { assert_eq!(actual_trace, expected_trace); } -#[test] +#[tokio::test] fn local_and_global_scalars() { let set_variable_peer_id = "set_variable_peer_id"; let iterable_content = json!([1i64, 2]); @@ -213,7 +213,7 @@ fn local_and_global_scalars() { assert_eq!(actual_trace, expected_trace); } -#[test] +#[tokio::test] fn new_with_randomly_set_scalars_in_fold_1() { let test_peer_id_1 = "test_peer_id_1"; let mut test_vm_1 = create_avm(set_variable_call_service(json!([1, 2, 3])), test_peer_id_1); @@ -253,7 +253,7 @@ fn new_with_randomly_set_scalars_in_fold_1() { assert_eq!(result.ret_code, 0) } -#[test] +#[tokio::test] fn new_with_randomly_set_scalars_in_fold_2() { let test_peer_id_1 = "test_peer_id_1"; let mut test_vm_1 = create_avm(set_variable_call_service(json!([1, 2, 3])), test_peer_id_1); diff --git a/air/tests/test_module/features/scopes/scopes_behaviour_with_errors.rs b/air/tests/test_module/features/scopes/scopes_behaviour_with_errors.rs index 3065fe9daf..db4d9210ef 100644 --- a/air/tests/test_module/features/scopes/scopes_behaviour_with_errors.rs +++ b/air/tests/test_module/features/scopes/scopes_behaviour_with_errors.rs @@ -19,7 +19,7 @@ use air_test_utils::prelude::*; use pretty_assertions::assert_eq; -#[test] +#[tokio::test] fn check_that_scalar_is_visible_only_inside_fold_block() { let variable_setter_peer_id = "variable_setter_peer_id"; let mut variable_setter_vm = create_avm(set_variable_call_service(json!([1, 2, 3])), variable_setter_peer_id); @@ -76,7 +76,7 @@ fn check_that_scalar_is_visible_only_inside_fold_block() { assert_eq!(actual_trace, expected_trace); } -#[test] +#[tokio::test] fn scopes_check_that_scalar_not_overwritten_by_fold_end() { let variable_setter_peer_id = "variable_setter_peer_id"; let mut variable_setter_vm = create_avm(set_variable_call_service(json!([1, 2, 3])), variable_setter_peer_id); diff --git a/air/tests/test_module/features/signatures/algorithms.rs b/air/tests/test_module/features/signatures/algorithms.rs index 5a471c68e2..cdf67e1f7a 100644 --- a/air/tests/test_module/features/signatures/algorithms.rs +++ b/air/tests/test_module/features/signatures/algorithms.rs @@ -24,7 +24,7 @@ use air_test_utils::{ use fluence_keypair::KeyFormat; /// Checking that other peers' key algorithms are valid. -#[test] +#[tokio::test] // ignored for a while until we find an easy way to create "incorrect" rkyv data; // // n.b.: cfg(any()) disables compilation @@ -94,7 +94,7 @@ fn test_banned_signature() { } /// Checking that local key is valid. -#[test] +#[tokio::test] fn test_banned_signing_key() { let air_script = "(null)"; let bad_algo_keypair = fluence_keypair::KeyPair::generate_secp256k1(); diff --git a/air/tests/test_module/features/signatures/attacks.rs b/air/tests/test_module/features/signatures/attacks.rs index cc15200e05..eb593c5342 100644 --- a/air/tests/test_module/features/signatures/attacks.rs +++ b/air/tests/test_module/features/signatures/attacks.rs @@ -27,7 +27,7 @@ use std::rc::Rc; /// /// CID store manipulations are checked in the `corruption` module. -#[test] +#[tokio::test] fn test_attack_injection_current_peer_scalar() { // injecting a value that arrives to peer who does the next step let (alice_keypair, alice_peer_id) = derive_dummy_keypair("alice_peer"); @@ -90,7 +90,7 @@ fn test_attack_injection_current_peer_scalar() { assert_ne!(res.ret_code, 0); } -#[test] +#[tokio::test] fn test_attack_injection_current_peer_stream() { // injecting a value that arrives to peer who does the next step let alice_peer_id = "alice_peer"; @@ -161,7 +161,7 @@ fn test_attack_injection_current_peer_stream() { assert_ne!(res.ret_code, 0, "{}", res.error_message); } -#[test] +#[tokio::test] fn test_attack_injection_current_injection_unused() { // injecting a value that arrives to peer who does the next step let alice_peer_id = "alice_peer"; @@ -231,7 +231,7 @@ fn test_attack_injection_current_injection_unused() { assert_ne!(res.ret_code, 0, "{}", res.error_message); } -#[test] +#[tokio::test] fn test_attack_injection_other_peer_scalar() { // injecting a value that arrives to peer who does the next step let alice_peer_id = "alice_peer"; @@ -289,7 +289,7 @@ fn test_attack_injection_other_peer_scalar() { assert_ne!(res.ret_code, 0); } -#[test] +#[tokio::test] fn test_attack_injection_other_peer_stream() { // injecting a value that arrives to peer who does the next step let alice_peer_id = "alice_peer"; @@ -347,7 +347,7 @@ fn test_attack_injection_other_peer_stream() { assert_ne!(res.ret_code, 0, "{}", res.error_message); } -#[test] +#[tokio::test] fn test_attack_injection_other_peer_unused() { // injecting a value that arrives to peer who does the next step let alice_peer_id = "alice_peer"; @@ -407,7 +407,7 @@ fn test_attack_injection_other_peer_unused() { assert_eq!(res.ret_code, 0, "{}", res.error_message); } -#[test] +#[tokio::test] fn test_attack_replay() { let alice_name = "alice_peer_id"; let bob_name = "bob_peer_id"; diff --git a/air/tests/test_module/features/signatures/corruption.rs b/air/tests/test_module/features/signatures/corruption.rs index 1f232cc731..ed86733484 100644 --- a/air/tests/test_module/features/signatures/corruption.rs +++ b/air/tests/test_module/features/signatures/corruption.rs @@ -27,7 +27,7 @@ use air_test_utils::prelude::*; use pretty_assertions::assert_eq; use semver::Version; -#[test] +#[tokio::test] fn test_attack_replace_value() { // Bob gets a trace where call result value is edited by Mallory. let alice_peer_id = "alice"; @@ -104,7 +104,7 @@ fn test_attack_replace_value() { ); } -#[test] +#[tokio::test] fn test_attack_replace_tetraplet() { // Bob gets a trace where call result tetraplet is edited by Mallory. let alice_peer_id = "alice"; @@ -180,7 +180,7 @@ fn test_attack_replace_tetraplet() { ); } -#[test] +#[tokio::test] fn test_attack_replace_call_result() { // Bob gets a trace where call result is edited by Mallory. let alice_peer_id = "alice"; @@ -263,7 +263,7 @@ fn test_attack_replace_call_result() { ); } -#[test] +#[tokio::test] fn test_attack_replace_canon_value() { // Bob gets a trace where canon value is edited by Mallory. let alice_peer_id = "alice"; @@ -353,7 +353,7 @@ fn test_attack_replace_canon_value() { ); } -#[test] +#[tokio::test] fn test_attack_replace_canon_result_values() { // Bob gets a trace where canon result is edited by Mallory. let alice_peer_id = "alice"; @@ -452,7 +452,7 @@ fn test_attack_replace_canon_result_values() { ); } -#[test] +#[tokio::test] fn test_attack_replace_canon_result_tetraplet() { // Bob gets a trace where canon result is edited by Mallory. let alice_peer_id = "alice"; diff --git a/air/tests/test_module/features/signatures/runtime.rs b/air/tests/test_module/features/signatures/runtime.rs index 8f1d4ff13d..efca81fe83 100644 --- a/air/tests/test_module/features/signatures/runtime.rs +++ b/air/tests/test_module/features/signatures/runtime.rs @@ -21,7 +21,7 @@ use air_test_utils::prelude::*; /// This test module asserts various runtime safety checks, for example, /// that actual calls' tetraplets are compared to stored one. -#[test] +#[tokio::test] fn test_runtime_executed_call_argument_hash() { // Mallory gets a trace where there are two calls that differ only by argument_hash. // Can it swap them successfully? @@ -77,7 +77,7 @@ fn test_runtime_executed_call_argument_hash() { ); } -#[test] +#[tokio::test] fn test_runtime_executed_call_tetraplet() { // Mallory gets a trace where there are two calls that differ only by argument_hash. // Can it swap them successfully? @@ -149,7 +149,7 @@ fn test_runtime_executed_call_tetraplet() { ); } -#[test] +#[tokio::test] fn test_runtime_executed_failed_argument_hash() { // Mallory gets a trace where there are two calls that differ only by argument_hash. // Can it swap them successfully? @@ -209,7 +209,7 @@ fn test_runtime_executed_failed_argument_hash() { ); } -#[test] +#[tokio::test] fn test_runtime_failed_call_tetraplet() { // Mallory gets a trace where there are two calls that differ only by argument_hash. // Can it swap them successfully? @@ -283,7 +283,7 @@ fn test_runtime_failed_call_tetraplet() { ); } -#[test] +#[tokio::test] fn test_runtime_canon_tetraplet() { let alice_name = "alice"; let bob_name = "bob"; diff --git a/air/tests/test_module/features/signatures/signing.rs b/air/tests/test_module/features/signatures/signing.rs index 1aa6035ce8..1a2b5cc971 100644 --- a/air/tests/test_module/features/signatures/signing.rs +++ b/air/tests/test_module/features/signatures/signing.rs @@ -20,7 +20,7 @@ use air_test_utils::key_utils::derive_dummy_keypair; use air_test_utils::prelude::*; use air_test_utils::test_runner::TestRunParameters; -#[test] +#[tokio::test] fn test_signature_empty() { let script = "(null)"; let init_peer_name = "init_peer_id"; @@ -44,7 +44,7 @@ fn test_signature_empty() { assert_eq!(signature, Some(&expected_signature), "{:?}", data.signatures); } -#[test] +#[tokio::test] fn test_signature_call_var() { let init_peer_name = "init_peer_id"; let (keypair, init_peer_id) = derive_dummy_keypair(init_peer_name); @@ -72,7 +72,7 @@ fn test_signature_call_var() { assert_eq!(signature, Some(&expected_signature), "{:?}", data.signatures); } -#[test] +#[tokio::test] fn test_signature_call_stream() { let init_peer_name = "init_peer_id"; let air_script = format!( @@ -100,7 +100,7 @@ fn test_signature_call_stream() { assert_eq!(signature, Some(&expected_signature), "{:?}", data.signatures); } -#[test] +#[tokio::test] fn test_signature_call_unused() { let init_peer_name = "init_peer_id"; let air_script = format!( @@ -124,7 +124,7 @@ fn test_signature_call_unused() { assert_eq!(signature, Some(&expected_signature), "{:?}", data.signatures); } -#[test] +#[tokio::test] fn test_signature_call_merged() { let init_peer_name = "init_peer_id"; let other_peer_name = "other_peer_id"; @@ -163,7 +163,7 @@ fn test_signature_call_merged() { assert_eq!(signature, Some(&expected_signature), "{:?}", data2.signatures); } -#[test] +#[tokio::test] fn test_signature_call_twice() { // Test that if some CID appears twice in the call result, it is accounted twice. let init_peer_name = "init_peer_id"; @@ -205,7 +205,7 @@ fn test_signature_call_twice() { assert_eq!(signature, Some(&expected_signature), "{:?}", data.signatures); } -#[test] +#[tokio::test] fn test_signature_canon_basic() { let init_peer_name = "init_peer_id"; let (keypair, init_peer_id) = derive_dummy_keypair(init_peer_name); @@ -278,7 +278,7 @@ fn test_signature_canon_basic() { assert_eq!(signature, Some(&expected_signature), "{:?}", last_data); } -#[test] +#[tokio::test] fn test_signature_canon_merge() { let init_peer_name = "init_peer_id"; let other_peer_name = "other_peer_id"; @@ -359,7 +359,7 @@ fn test_signature_canon_merge() { assert_eq!(signature, Some(&expected_signature), "{:?}", last_data); } -#[test] +#[tokio::test] fn test_signature_canon_result() { // this test checks that call result in canon doesn't lead to repeadted accounting of the call result let init_peer_name = "init_peer_id"; diff --git a/air/tests/test_module/features/streams/ap_with_fold.rs b/air/tests/test_module/features/streams/ap_with_fold.rs index 837395198d..788aef7acb 100644 --- a/air/tests/test_module/features/streams/ap_with_fold.rs +++ b/air/tests/test_module/features/streams/ap_with_fold.rs @@ -16,7 +16,7 @@ use air_test_utils::prelude::*; -#[test] +#[tokio::test] fn ap_with_fold() { let nums: Vec = (1..10).map(|i| i.to_string()).collect(); let vec = vec![nums.clone(), nums.clone(), nums]; diff --git a/air/tests/test_module/features/streams/compactification.rs b/air/tests/test_module/features/streams/compactification.rs index 2f1875f75c..7d21922f14 100644 --- a/air/tests/test_module/features/streams/compactification.rs +++ b/air/tests/test_module/features/streams/compactification.rs @@ -19,7 +19,7 @@ use air_test_framework::AirScriptExecutor; use air_test_utils::prelude::TestRunParameters; use air_test_utils::*; -#[test] +#[tokio::test] fn global_streams_are_compactified() { let peer_name = "peer_id"; let service_result = "service_result"; @@ -52,7 +52,7 @@ fn global_streams_are_compactified() { assert_eq!(&actual_trace, &expected_trace); } -#[test] +#[tokio::test] fn global_stream_maps_are_compactified() { let peer_name = "peer_id"; let service_result = "service_result"; @@ -89,7 +89,7 @@ fn global_stream_maps_are_compactified() { assert_eq!(&actual_trace, &expected_trace); } -#[test] +#[tokio::test] fn local_streams_are_compactified() { let peer_name = "peer_id"; let service_result = "service_result"; @@ -124,7 +124,7 @@ fn local_streams_are_compactified() { assert_eq!(actual_trace, expected_trace); } -#[test] +#[tokio::test] fn local_stream_maps_are_compactified() { let peer_name = "peer_id"; let service_result = "service_result"; diff --git a/air/tests/test_module/features/streams/merging.rs b/air/tests/test_module/features/streams/merging.rs index 4cc5dab329..4859931b49 100644 --- a/air/tests/test_module/features/streams/merging.rs +++ b/air/tests/test_module/features/streams/merging.rs @@ -17,7 +17,7 @@ use air_test_framework::AirScriptExecutor; use air_test_utils::{key_utils::at, prelude::*}; -#[test] +#[tokio::test] fn merging_fold_iterations_extensively() { let script = r#" (seq @@ -126,7 +126,7 @@ fn merging_fold_iterations_extensively() { assert_eq!(last_fold.lore.len(), 18); } -#[test] +#[tokio::test] fn merging_fold_iterations_extensively_2() { let script = r#" (seq diff --git a/air/tests/test_module/features/streams/recursive_streams.rs b/air/tests/test_module/features/streams/recursive_streams.rs index c814d55e26..c2fb968a18 100644 --- a/air/tests/test_module/features/streams/recursive_streams.rs +++ b/air/tests/test_module/features/streams/recursive_streams.rs @@ -21,7 +21,7 @@ use air_test_utils::prelude::*; use pretty_assertions::assert_eq; -#[test] +#[tokio::test] fn recursive_stream_with_early_exit() { let vm_peer_id = "vm_peer_id"; let variable_mappings = maplit::hashmap! { @@ -73,7 +73,7 @@ fn recursive_stream_with_early_exit() { assert_eq!(actual_trace, expected_state); } -#[test] +#[tokio::test] fn recursive_stream_many_iterations() { let vm_peer_id_1 = "vm_peer_id_1"; @@ -171,7 +171,7 @@ fn recursive_stream_many_iterations() { assert_eq!(actual_last_state, &expected_last_state); } -#[test] +#[tokio::test] fn recursive_stream_join() { let vm_peer_id_1 = "vm_peer_id_1"; @@ -255,7 +255,7 @@ fn recursive_stream_join() { assert_eq!(actual_trace, expected_trace); } -#[test] +#[tokio::test] fn recursive_stream_error_handling() { let vm_peer_id_1 = "vm_peer_id_1"; @@ -329,7 +329,7 @@ fn recursive_stream_error_handling() { assert_eq!(actual_trace, expected_trace); } -#[test] +#[tokio::test] fn recursive_stream_inner_fold() { let vm_peer_id_1 = "vm_peer_id_1"; @@ -393,7 +393,7 @@ fn recursive_stream_inner_fold() { assert_eq!(actual_last_state, &expected_last_state); } -#[test] +#[tokio::test] fn recursive_stream_fold_with_n_service_call() { let vm_peer_id = "vm_peer_id_1"; @@ -473,7 +473,7 @@ fn recursive_stream_fold_with_n_service_call() { assert_eq!(actual_fold_state.lore.len(), expected_fold_lores); } -#[test] +#[tokio::test] fn recursive_stream_size_limit() { let vm_peer_id_1 = "vm_peer_id_1"; diff --git a/air/tests/test_module/features/streams/streams.rs b/air/tests/test_module/features/streams/streams.rs index efca761941..e49751bbc6 100644 --- a/air/tests/test_module/features/streams/streams.rs +++ b/air/tests/test_module/features/streams/streams.rs @@ -21,7 +21,7 @@ use pretty_assertions::assert_eq; use std::ops::Deref; -#[test] +#[tokio::test] fn empty_stream() { fn arg_type_check_closure() -> CallServiceClosure { Box::new(move |params| -> CallServiceResult { @@ -55,7 +55,7 @@ fn empty_stream() { let _ = checked_call_vm!(vm, <_>::default(), script, "", ""); } -#[test] +#[tokio::test] fn stream_merging_v0() { let initiator_id = "initiator_id"; let setter_1_id = "setter_1"; @@ -207,7 +207,7 @@ fn stream_merging_v0() { assert_eq!(actual_trace_3, expected_trace_3); } -#[test] +#[tokio::test] fn stream_merging_v1() { let initiator_id = "initiator_id"; let setter_1_id = "setter_1"; @@ -374,7 +374,7 @@ fn stream_merging_v1() { assert_eq!(actual_trace_3, expected_trace_3); } -#[test] +#[tokio::test] #[ignore] fn stream_merging_v2() { let initiator_id = "initiator_id"; diff --git a/air/tests/test_module/features/streams/streams_early_exit.rs b/air/tests/test_module/features/streams/streams_early_exit.rs index 05958aa42c..b95ff1139f 100644 --- a/air/tests/test_module/features/streams/streams_early_exit.rs +++ b/air/tests/test_module/features/streams/streams_early_exit.rs @@ -27,7 +27,7 @@ use pretty_assertions::assert_eq; use std::convert::TryInto; -#[test] +#[tokio::test] fn par_early_exit() { let init_peer_id = "init_peer_id"; let setter_1_id = "setter_1"; @@ -248,7 +248,7 @@ fn par_early_exit() { assert_eq!(actual_trace, expected_trace); } -#[test] +#[tokio::test] fn fold_early_exit() { let fold_executor_id = "fold_executor_id"; let error_trigger_id = "error_trigger_id"; @@ -301,7 +301,7 @@ fn fold_early_exit() { ); } -#[test] +#[tokio::test] fn fold_par_early_exit() { let variables_setter_id = "set_variable_id"; let stream_setter_id = "stream_setter_id"; diff --git a/air/tests/test_module/features/tetraplets/provenance.rs b/air/tests/test_module/features/tetraplets/provenance.rs index d0aebb7261..408244c428 100644 --- a/air/tests/test_module/features/tetraplets/provenance.rs +++ b/air/tests/test_module/features/tetraplets/provenance.rs @@ -17,7 +17,7 @@ use air_test_framework::AirScriptExecutor; use air_test_utils::{key_utils::at, prelude::*}; -#[test] +#[tokio::test] fn call_result() { let init_peer_name = "B"; @@ -67,7 +67,7 @@ fn call_result() { assert_eq!(last_state, &expected_state); } -#[test] +#[tokio::test] fn call_result_iteration() { let init_peer_name = "A"; @@ -140,7 +140,7 @@ fn call_result_iteration() { assert_eq!(last_state, &expected_state); } -#[test] +#[tokio::test] fn literal() { let init_peer_name = "B"; @@ -182,7 +182,7 @@ fn literal() { assert_eq!(last_state, &expected_state); } -#[test] +#[tokio::test] fn canon_in_canon() { let init_peer_name = "B"; @@ -256,7 +256,7 @@ fn canon_in_canon() { assert_eq!(last_state, &expected_state,); } -#[test] +#[tokio::test] fn lambda_result_iteration() { let init_peer_name = "A"; diff --git a/air/tests/test_module/features/tetraplets/security_tetraplets.rs b/air/tests/test_module/features/tetraplets/security_tetraplets.rs index d8fd01fe01..514b27d47c 100644 --- a/air/tests/test_module/features/tetraplets/security_tetraplets.rs +++ b/air/tests/test_module/features/tetraplets/security_tetraplets.rs @@ -38,7 +38,7 @@ fn arg_host_function() -> (CallServiceClosure, Rc>) { (host_function, arg_tetraplets) } -#[test] +#[tokio::test] fn fold_with_inner_call() { let return_numbers_call_service: CallServiceClosure = Box::new(|_| -> CallServiceResult { CallServiceResult::ok(json!(["1", "2", "3", "4", "5", "6", "7", "8", "9", "10"])) @@ -97,7 +97,7 @@ fn fold_with_inner_call() { } } -#[test] +#[tokio::test] fn fold_stream_with_inner_call() { let init_peer_name = "init_peer_id"; let air_script = r#" @@ -143,7 +143,7 @@ fn fold_stream_with_inner_call() { assert_eq!(&(*data.trace)[4..], &expected_trace, "{:?}", data.cid_info); } -#[test] +#[tokio::test] fn fold_canon_with_inner_call() { let init_peer_name = "init_peer_id"; let air_script = r#" @@ -191,7 +191,7 @@ fn fold_canon_with_inner_call() { assert_eq!(&(*data.trace)[4..], &expected_trace, "{:?}", data.cid_info); } -#[test] +#[tokio::test] fn fold_json_path() { let variable_numbers = json!({"args": ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10"]}); @@ -249,7 +249,7 @@ fn fold_json_path() { assert_eq!(arg_tetraplets, expected_tetraplets); } -#[test] +#[tokio::test] fn check_tetraplet_works_correctly() { let return_numbers_call_service: CallServiceClosure = Box::new(|_| -> CallServiceResult { CallServiceResult::ok(json!({"args": ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10"]})) @@ -331,7 +331,7 @@ fn construct_service_config(module_name: impl Into) -> AppServiceConfig } } -#[test] +#[tokio::test] #[ignore] fn tetraplet_with_wasm_modules() { use marine_rs_sdk::CallParameters; diff --git a/air/tests/test_module/features/tetraplets/security_tetraplets/auth_module/Cargo.toml b/air/tests/test_module/features/tetraplets/security_tetraplets/auth_module/Cargo.toml index 53ea66d974..aba7e30822 100644 --- a/air/tests/test_module/features/tetraplets/security_tetraplets/auth_module/Cargo.toml +++ b/air/tests/test_module/features/tetraplets/security_tetraplets/auth_module/Cargo.toml @@ -10,6 +10,6 @@ path = "src/main.rs" [dependencies] aquavm-air = { path = "../../../../../../../air" } -marine-rs-sdk = "0.10.3" +marine-rs-sdk = "0.12.0" [workspace] diff --git a/air/tests/test_module/features/tetraplets/security_tetraplets/log_storage/Cargo.toml b/air/tests/test_module/features/tetraplets/security_tetraplets/log_storage/Cargo.toml index 0ebf015391..dcf0f9f75f 100644 --- a/air/tests/test_module/features/tetraplets/security_tetraplets/log_storage/Cargo.toml +++ b/air/tests/test_module/features/tetraplets/security_tetraplets/log_storage/Cargo.toml @@ -10,6 +10,6 @@ path = "src/main.rs" [dependencies] aquavm-air = { path = "../../../../../../../air" } -marine-rs-sdk = "0.10.3" +marine-rs-sdk = "0.12.0" [workspace] diff --git a/air/tests/test_module/features/topology_hops/call_guided_topology.rs b/air/tests/test_module/features/topology_hops/call_guided_topology.rs index 167ffd4e80..0da7c8b6dd 100644 --- a/air/tests/test_module/features/topology_hops/call_guided_topology.rs +++ b/air/tests/test_module/features/topology_hops/call_guided_topology.rs @@ -18,7 +18,7 @@ use air_test_utils::prelude::*; use fluence_keypair::KeyFormat; use fluence_keypair::KeyPair; -#[test] +#[tokio::test] fn call_generates_hop() { let client_peer_id = "client"; let mut client_vm = create_avm(unit_call_service(), client_peer_id); @@ -35,7 +35,7 @@ fn call_generates_hop() { assert_next_pks!(&client_result.next_peer_pks, &[test_peer_id]); } -#[test] +#[tokio::test] fn call_with_join_behaviour() { let relay_peer_id = "relay"; let mut relay_vm = create_avm(unit_call_service(), relay_peer_id); diff --git a/air/tests/test_module/features/topology_hops/canon_guided_topology.rs b/air/tests/test_module/features/topology_hops/canon_guided_topology.rs index f0f060b816..c57f014720 100644 --- a/air/tests/test_module/features/topology_hops/canon_guided_topology.rs +++ b/air/tests/test_module/features/topology_hops/canon_guided_topology.rs @@ -18,7 +18,7 @@ use air_test_utils::prelude::*; use fluence_keypair::KeyFormat; use fluence_keypair::KeyPair; -#[test] +#[tokio::test] fn canon_generates_hop() { let client_peer_id = "client"; let mut client_vm = create_avm(unit_call_service(), client_peer_id); @@ -35,7 +35,7 @@ fn canon_generates_hop() { assert_next_pks!(&client_result.next_peer_pks, &[test_peer_id]); } -#[test] +#[tokio::test] fn canon_with_join_behaviour() { let relay_peer_id = "relay"; let mut relay_vm = create_avm(unit_call_service(), relay_peer_id); diff --git a/air/tests/test_module/instructions/ap.rs b/air/tests/test_module/instructions/ap.rs index ed30337e99..55a854573f 100644 --- a/air/tests/test_module/instructions/ap.rs +++ b/air/tests/test_module/instructions/ap.rs @@ -24,7 +24,7 @@ use pretty_assertions::assert_eq; use std::cell::RefCell; use std::rc::Rc; -#[test] +#[tokio::test] fn ap_with_scalars() { let vm_1_peer_id = "vm_1_peer_id"; let test_value = "scalar_2"; @@ -62,7 +62,7 @@ fn ap_with_scalars() { assert!(result.next_peer_pks.is_empty()); } -#[test] +#[tokio::test] fn ap_with_string_literal() { let vm_1_peer_id = "vm_1_peer_id"; let mut vm_1 = create_avm(echo_call_service(), vm_1_peer_id); @@ -102,7 +102,7 @@ fn ap_with_string_literal() { assert!(result.next_peer_pks.is_empty()); } -#[test] +#[tokio::test] fn ap_with_bool_literal() { let vm_1_peer_id = "vm_1_peer_id"; let mut vm_1 = create_avm(echo_call_service(), vm_1_peer_id); @@ -139,7 +139,7 @@ fn ap_with_bool_literal() { assert!(result.next_peer_pks.is_empty()); } -#[test] +#[tokio::test] fn ap_with_number_literal() { let vm_1_peer_id = "vm_1_peer_id"; let mut vm_1 = create_avm(echo_call_service(), vm_1_peer_id); @@ -176,7 +176,7 @@ fn ap_with_number_literal() { assert!(result.next_peer_pks.is_empty()); } -#[test] +#[tokio::test] fn ap_with_last_error() { let vm_1_peer_id = "vm_1_peer_id"; let mut vm_1 = create_avm(echo_call_service(), vm_1_peer_id); @@ -217,7 +217,7 @@ fn ap_with_last_error() { assert!(result.next_peer_pks.is_empty()); } -#[test] +#[tokio::test] fn ap_with_error() { let vm_1_peer_id = "vm_1_peer_id"; let mut vm_1 = create_avm(echo_call_service(), vm_1_peer_id); @@ -258,7 +258,7 @@ fn ap_with_error() { assert!(result.next_peer_pks.is_empty()); } -#[test] +#[tokio::test] fn ap_with_timestamp() { let vm_1_peer_id = "vm_1_peer_id"; let mut vm_1 = create_avm(echo_call_service(), vm_1_peer_id); @@ -285,7 +285,7 @@ fn ap_with_timestamp() { assert_eq!(actual_trace, expected_state); } -#[test] +#[tokio::test] fn ap_with_ttl() { let vm_1_peer_id = "vm_1_peer_id"; let mut vm_1 = create_avm(echo_call_service(), vm_1_peer_id); @@ -308,7 +308,7 @@ fn ap_with_ttl() { assert_eq!(actual_trace, expected_state); } -#[test] +#[tokio::test] fn ap_with_dst_stream() { let vm_1_peer_id = "vm_1_peer_id"; let test_value = "scalar_2"; @@ -362,7 +362,7 @@ fn ap_with_dst_stream() { assert!(result.next_peer_pks.is_empty()); } -#[test] +#[tokio::test] fn ap_canon_stream_with_lambda() { let vm_1_peer_id = "vm_1_peer_id"; let (echo_call_service, tetraplet_checker) = tetraplet_host_function(echo_call_service()); @@ -449,7 +449,7 @@ fn ap_canon_stream_with_lambda() { assert_eq!(tetraplet_checker.as_ref(), &expected_tetraplet); } -#[test] +#[tokio::test] fn ap_canon_stream() { let vm_1_peer_id = "vm_1_peer_id"; let arg_tetraplets = Rc::new(RefCell::new(vec![])); @@ -536,7 +536,7 @@ fn ap_canon_stream() { assert_eq!(tetraplet_checker.as_ref(), &expected_tetraplet); } -#[test] +#[tokio::test] fn ap_stream_map() { let vm_1_peer_id = "vm_1_peer_id"; let mut vm_1 = create_avm(echo_call_service(), vm_1_peer_id); @@ -602,7 +602,7 @@ fn ap_stream_map() { assert_eq!(actual_trace, expected_state); } -#[test] +#[tokio::test] fn ap_stream_map_with_undefined_last_error() { let vm_1_peer_id = "vm_1_peer_id"; let script = format!( @@ -643,7 +643,7 @@ fn ap_stream_map_with_undefined_last_error() { assert_eq!(actual_trace, expected_state,); } -#[test] +#[tokio::test] fn ap_canon_stream_map_with_string_key_accessor_lambda() { let vm_1_peer_name = "vm_1_peer_id"; let vm_1_peer_id = at(vm_1_peer_name); @@ -699,7 +699,7 @@ fn ap_canon_stream_map_with_string_key_accessor_lambda() { assert_eq!(&*actual_trace, expected_trace,); } -#[test] +#[tokio::test] fn ap_canon_stream_map_with_numeric_key_accessor_lambda() { let vm_1_peer_name = "vm_1_peer_id"; let vm_1_peer_id = at(vm_1_peer_name); @@ -754,7 +754,7 @@ fn ap_canon_stream_map_with_numeric_key_accessor_lambda() { assert_eq!(&*actual_trace, expected_trace,); } -#[test] +#[tokio::test] fn ap_map_key_join_behavior() { let vm_1_peer_id = "vm_1_peer_id"; let script = r#" @@ -780,7 +780,7 @@ fn ap_map_key_join_behavior() { assert_eq!(result.ret_code, 0, "{:?}", result.error_message); } -#[test] +#[tokio::test] fn ap_map_value_join_behavior() { let vm_1_peer_id = "vm_1_peer_id"; let script = r#" diff --git a/air/tests/test_module/instructions/call.rs b/air/tests/test_module/instructions/call.rs index 059c7180e9..cee48d1882 100644 --- a/air/tests/test_module/instructions/call.rs +++ b/air/tests/test_module/instructions/call.rs @@ -23,7 +23,7 @@ use pretty_assertions::assert_eq; // Check that %init_peer_id% alias works correctly (by comparing result with it and explicit peer id). // Additionally, check that empty string for data does the same as empty call path. -#[test] +#[tokio::test] fn current_peer_id_call() { let vm_peer_id = "test_peer_id"; let mut vm = create_avm(unit_call_service(), vm_peer_id); @@ -63,7 +63,7 @@ fn current_peer_id_call() { assert_eq!(result_with_empty_string, result); } -#[test] +#[tokio::test] fn call_with_timestamp() { let vm_peer_id = "test_peer_id"; let mut vm = create_avm(echo_call_service(), vm_peer_id); @@ -83,7 +83,7 @@ fn call_with_timestamp() { assert_eq!(actual_trace, expected_trace); } -#[test] +#[tokio::test] fn call_with_ttl() { let vm_peer_id = "test_peer_id"; let mut vm = create_avm(echo_call_service(), vm_peer_id); @@ -100,7 +100,7 @@ fn call_with_ttl() { } // Check that specifying remote peer id in call will result its appearing in next_peer_pks. -#[test] +#[tokio::test] fn remote_peer_id_call() { let some_local_peer_id = String::from("some_local_peer_id"); let mut vm = create_avm(echo_call_service(), &some_local_peer_id); @@ -119,7 +119,7 @@ fn remote_peer_id_call() { } // Check that setting variables works as expected. -#[test] +#[tokio::test] fn variables() { let mut vm = create_avm(unit_call_service(), "remote_peer_id"); let mut set_variable_vm = create_avm(set_variable_call_service(json!("remote_peer_id")), "set_variable"); @@ -138,7 +138,7 @@ fn variables() { } // Check that duplicate variables are impossible. -#[test] +#[tokio::test] fn duplicate_variables() { let peer_id = "peer_id"; let mut vm = create_avm(unit_call_service(), peer_id); @@ -161,7 +161,7 @@ fn duplicate_variables() { } // Check that string literals can be used as call parameters. -#[test] +#[tokio::test] fn string_parameters() { let call_service: CallServiceClosure = Box::new(|mut params| -> CallServiceResult { CallServiceResult::ok(params.arguments.remove(0)) }); @@ -199,7 +199,7 @@ fn string_parameters() { assert_eq!(actual_trace[1.into()], expected_state); } -#[test] +#[tokio::test] fn call_canon_stream_map_arg() { let vm_1_peer_name = "vm_1_peer_id"; let vm_1_peer_id = at(vm_1_peer_name); @@ -268,7 +268,7 @@ fn call_canon_stream_map_arg() { } // WIP add negative -#[test] +#[tokio::test] fn call_peer_id_from_canon_stream_map() { let vm_1_peer_name = "vm_1_peer_id"; let vm_1_peer_id = at(vm_1_peer_name); @@ -334,7 +334,7 @@ fn call_peer_id_from_canon_stream_map() { assert_eq!(&*actual_trace, expected_trace,); } -#[test] +#[tokio::test] fn call_module_func_from_canon_stream_map() { let vm_1_peer_id = "vm_1_peer_id"; // There is a bug in testing framework that disallows lenses to be a source of a module name in diff --git a/air/tests/test_module/instructions/canon.rs b/air/tests/test_module/instructions/canon.rs index f216754cb9..81c20345ab 100644 --- a/air/tests/test_module/instructions/canon.rs +++ b/air/tests/test_module/instructions/canon.rs @@ -24,7 +24,7 @@ use std::cell::RefCell; use std::ops::Deref; use std::rc::Rc; -#[test] +#[tokio::test] fn canon_moves_execution_flow() { let peer_id_1 = "peer_id_1"; let peer_id_2 = "peer_id_2"; @@ -53,7 +53,7 @@ fn canon_moves_execution_flow() { ) } -#[test] +#[tokio::test] fn basic_canon() { let mut vm = create_avm(echo_call_service(), "A"); let data = json!(["1", "2", "3", "4", "5"]); @@ -108,7 +108,7 @@ fn basic_canon() { assert_eq!(actual_state, &expected_state); } -#[test] +#[tokio::test] fn canon_fixes_stream_correct() { let peer_id_1 = "peer_id_1"; let mut vm_1 = create_avm(echo_call_service(), peer_id_1); @@ -201,7 +201,7 @@ fn canon_fixes_stream_correct() { assert_eq!(vm_1_result_2_trace.deref(), expected_vm_1_result_2_trace); } -#[test] +#[tokio::test] fn canon_stream_can_be_created_from_aps() { let vm_1_peer_id = "vm_1_peer_id"; let mut vm_1 = create_avm(echo_call_service(), vm_1_peer_id); @@ -231,7 +231,7 @@ fn canon_stream_can_be_created_from_aps() { let _ = checked_call_vm!(vm_2, <_>::default(), &script, result_1.data, result_2.data); } -#[test] +#[tokio::test] fn canon_gates() { let peer_id_1 = "peer_id_1"; let mut vm_1 = create_avm(set_variable_call_service(json!([1, 2, 3, 4, 5])), peer_id_1); @@ -289,7 +289,7 @@ fn canon_gates() { assert_eq!(fold.lore.len(), stop_len_count); } -#[test] +#[tokio::test] fn canon_empty_stream() { let peer_id_1 = "peer_id_1"; let mut vm_1 = create_avm(echo_call_service(), peer_id_1); @@ -326,7 +326,7 @@ fn canon_empty_stream() { assert_eq!(actual_trace, expected_trace); } -#[test] +#[tokio::test] fn canon_empty_not_writable_stream() { let peer_id = "peer_id"; let mut vm = create_avm(echo_call_service(), peer_id); @@ -352,7 +352,7 @@ fn canon_empty_not_writable_stream() { assert_eq!(actual_trace, expected_trace); } -#[test] +#[tokio::test] fn canon_over_later_defined_stream() { let vm_peer_id_1 = "vm_peer_id_1"; let mut peer_vm_1 = create_avm(echo_call_service(), vm_peer_id_1); @@ -391,7 +391,7 @@ fn canon_over_later_defined_stream() { assert_eq!(actual_trace, expected_trace); } -#[test] +#[tokio::test] fn canon_map_scalar() { let vm_peer_id_1 = "vm_peer_id_1"; let mut peer_vm_1 = create_avm(echo_call_service(), vm_peer_id_1); @@ -461,7 +461,7 @@ fn canon_map_scalar() { assert_eq!(actual_trace, expected_trace); } -#[test] +#[tokio::test] fn canon_map_scalar_with_par() { let vm_peer_id_1 = "vm_peer_id_1"; let vm_peer_id_2 = "vm_peer_id_2"; @@ -570,7 +570,7 @@ fn canon_map_scalar_with_par() { assert_eq!(actual_trace, expected_trace); } -#[test] +#[tokio::test] fn test_extend_by_request_sent_by() { let peer_id_1 = "peer_1"; let peer_id_2 = "peer_2"; @@ -604,7 +604,7 @@ fn test_extend_by_request_sent_by() { ) } -#[test] +#[tokio::test] fn test_merge_request_sent_by() { let peer_id_1 = "peer_1"; let peer_id_2 = "peer_2"; @@ -639,7 +639,7 @@ fn test_merge_request_sent_by() { ) } -#[test] +#[tokio::test] fn test_merge_executed() { let peer_id_1 = "peer_1"; let peer_id_2 = "peer_2"; @@ -694,7 +694,7 @@ fn test_merge_executed() { ); } -#[test] +#[tokio::test] fn canon_stream_map() { let vm_peer_id_1_name = "vm_peer_id_1"; let vm_peer_id_1_id = at(vm_peer_id_1_name); @@ -747,7 +747,7 @@ fn canon_stream_map() { assert_eq!(actual_data.trace, expected_trace, "{:#?}", actual_data.cid_info,); } -#[test] +#[tokio::test] fn canon_map_single_index_tetraplet_check() { let vm_peer_id_1 = "vm_peer_id_1"; let arg_tetraplets = Rc::new(RefCell::new(vec![])); @@ -838,7 +838,7 @@ fn canon_map_single_index_tetraplet_check() { assert_eq!(tetraplet_checker.as_ref(), &expected_tetraplet); } -#[test] +#[tokio::test] fn canon_map_index_with_element_access_tetraplet_check() { let vm_peer_id_1 = "vm_peer_id_1"; let arg_tetraplets = Rc::new(RefCell::new(vec![])); @@ -936,7 +936,7 @@ fn canon_map_index_with_element_access_tetraplet_check() { assert_eq!(tetraplet_checker.as_ref(), &expected_tetraplet); } -#[test] +#[tokio::test] fn canon_map_index_with_element_and_attribute_tetraplet_check() { let vm_peer_id_1 = "vm_peer_id_1"; let arg_tetraplets = Rc::new(RefCell::new(vec![])); @@ -1062,7 +1062,7 @@ fn canon_map_index_with_element_and_attribute_tetraplet_check() { assert_eq!(tetraplet_checker.as_ref(), &expected_tetraplet); } -#[test] +#[tokio::test] fn canon_map_non_existing_index_tetraplet_check() { let vm_peer_id_1 = "vm_peer_id_1"; let arg_tetraplets = Rc::new(RefCell::new(vec![])); @@ -1129,7 +1129,7 @@ fn canon_map_non_existing_index_tetraplet_check() { assert_eq!(tetraplet_checker.as_ref(), &expected_tetraplet); } -#[test] +#[tokio::test] fn canon_map_non_existing_index_and_element_tetraplet_check() { let vm_peer_id_1 = "vm_peer_id_1"; let arg_tetraplets = Rc::new(RefCell::new(vec![])); @@ -1220,7 +1220,7 @@ fn canon_map_non_existing_index_and_element_tetraplet_check() { assert_eq!(tetraplet_checker.as_ref(), &expected_tetraplet); } -#[test] +#[tokio::test] fn canon_map_2_scalar_tetraplet_check() { let vm_peer_id_1 = "vm_peer_id_1"; @@ -1296,7 +1296,7 @@ fn canon_map_2_scalar_tetraplet_check() { assert_eq!(actual_data.trace, expected_trace, "{:#?}", actual_data.cid_info,); } -#[test] +#[tokio::test] fn canon_map_2_scalar_with_lens_tetraplet_check() { let vm_peer_id_1 = "vm_peer_id_1"; @@ -1371,7 +1371,7 @@ fn canon_map_2_scalar_with_lens_tetraplet_check() { assert_eq!(actual_data.trace, expected_trace, "{:#?}", actual_data.cid_info,); } -#[test] +#[tokio::test] fn canon_map_with_lens_by_key_number_tetraplet_check() { let vm_peer_id_1 = "vm_peer_id_1"; @@ -1451,7 +1451,7 @@ fn canon_map_with_lens_by_key_number_tetraplet_check() { ); } -#[test] +#[tokio::test] fn canon_map_with_lens_by_key_number_key_tetraplet_check() { let vm_peer_id_1 = "vm_peer_id_1"; @@ -1531,7 +1531,7 @@ fn canon_map_with_lens_by_key_number_key_tetraplet_check() { ); } -#[test] +#[tokio::test] fn canon_join_behavoir() { let init_peer_name = "init_peer_id"; @@ -1554,7 +1554,7 @@ fn canon_join_behavoir() { assert_eq!(result.ret_code, 0, "{:?}", result.error_message); } -#[test] +#[tokio::test] fn canon_map_join_behavoir() { let init_peer_name = "init_peer_id"; @@ -1577,7 +1577,7 @@ fn canon_map_join_behavoir() { assert_eq!(result.ret_code, 0, "{:?}", result.error_message); } -#[test] +#[tokio::test] fn canon_map_var_join_behavoir() { let init_peer_name = "init_peer_id"; diff --git a/air/tests/test_module/instructions/fail.rs b/air/tests/test_module/instructions/fail.rs index 6eeb6bbd27..5ba174b990 100644 --- a/air/tests/test_module/instructions/fail.rs +++ b/air/tests/test_module/instructions/fail.rs @@ -20,7 +20,7 @@ use air::ExecutionError; use air_test_framework::AirScriptExecutor; use air_test_utils::prelude::*; -#[test] +#[tokio::test] fn fail_with_last_error() { let local_peer_id = "local_peer_id"; let fallible_service_id = "service_id_1"; @@ -47,7 +47,7 @@ fn fail_with_last_error() { assert!(check_error(&result, expected_error)); } -#[test] +#[tokio::test] fn fail_with_error() { let local_peer_id = "local_peer_id"; let fallible_service_id = "service_id_1"; @@ -68,7 +68,7 @@ fn fail_with_error() { assert!(check_error(&result, expected_error)); } -#[test] +#[tokio::test] fn fail_with_literals() { let local_peer_id = "local_peer_id"; let mut vm = create_avm(echo_call_service(), local_peer_id); @@ -93,7 +93,7 @@ fn fail_with_literals() { assert!(check_error(&result, expected_error)); } -#[test] +#[tokio::test] fn fail_with_last_error_tetraplets() { let local_peer_id = "local_peer_id"; let fallible_service_id = "service_id_1"; @@ -121,7 +121,7 @@ fn fail_with_last_error_tetraplets() { ); } -#[test] +#[tokio::test] fn fail_with_error_tetraplets() { let local_peer_id = "local_peer_id"; let fallible_service_id = "service_id_1"; @@ -149,7 +149,7 @@ fn fail_with_error_tetraplets() { ); } -#[test] +#[tokio::test] fn fail_with_literals_tetraplets() { let local_peer_id = "local_peer_id"; let (host_closure, tetraplet_anchor) = tetraplet_host_function(echo_call_service()); @@ -174,7 +174,7 @@ fn fail_with_literals_tetraplets() { ); } -#[test] +#[tokio::test] fn fail_with_canon_stream() { let vm_peer_id = "local_peer_id"; let error_code = 1337i64; @@ -221,7 +221,7 @@ fn fail_to_fail_with_unsupported_errorcode(script: &str) { assert!(check_error(&results.last().unwrap(), expected_error)); } -#[test] +#[tokio::test] fn fail_to_fail_with_unsupported_errorcode_in_scalar() { let script = r#" (seq @@ -232,7 +232,7 @@ fn fail_to_fail_with_unsupported_errorcode_in_scalar() { fail_to_fail_with_unsupported_errorcode(script); } -#[test] +#[tokio::test] fn fail_to_fail_with_unsupported_errorcode_in_scalar_wl() { let script = r#" (seq @@ -243,7 +243,7 @@ fn fail_to_fail_with_unsupported_errorcode_in_scalar_wl() { fail_to_fail_with_unsupported_errorcode(script); } -#[test] +#[tokio::test] fn fail_to_fail_with_unsupported_errorcode_in_canon() { let script = r#" (seq @@ -254,7 +254,7 @@ fn fail_to_fail_with_unsupported_errorcode_in_canon() { fail_to_fail_with_unsupported_errorcode(script); } -#[test] +#[tokio::test] fn fail_to_fail_with_unsupported_errorcode_in_error() { let script = r#" (fail :error:) diff --git a/air/tests/test_module/instructions/fold.rs b/air/tests/test_module/instructions/fold.rs index 39f47a600d..5d5116704c 100644 --- a/air/tests/test_module/instructions/fold.rs +++ b/air/tests/test_module/instructions/fold.rs @@ -26,7 +26,7 @@ use pretty_assertions::assert_eq; use std::cell::RefCell; use std::rc::Rc; -#[test] +#[tokio::test] fn lfold() { let mut vm = create_avm(echo_call_service(), "A"); let mut set_variable_vm = create_avm( @@ -61,7 +61,7 @@ fn lfold() { } } -#[test] +#[tokio::test] fn rfold() { let mut vm = create_avm(echo_call_service(), "A"); let mut set_variable_vm = create_avm( @@ -96,7 +96,7 @@ fn rfold() { } } -#[test] +#[tokio::test] fn inner_fold() { let mut vm = create_avm(echo_call_service(), "A"); let mut set_variable_vm = create_avm( @@ -143,7 +143,7 @@ fn inner_fold() { } } -#[test] +#[tokio::test] fn inner_fold_with_same_iterator() { let mut vm = create_avm( set_variable_call_service(json!(["1", "2", "3", "4", "5"])), @@ -175,7 +175,7 @@ fn inner_fold_with_same_iterator() { assert_eq!(result.ret_code, expected_error.to_error_code()); } -#[test] +#[tokio::test] fn empty_iterable_fold() { let mut vm = create_avm(echo_call_service(), "A"); let mut set_variable_vm = create_avm(set_variable_call_service(json!([])), "set_variable"); @@ -201,7 +201,7 @@ fn empty_iterable_fold() { assert_eq!(actual_trace[0.into()], expected_state); } -#[test] +#[tokio::test] fn empty_literal_array_fold() { let mut vm = create_avm(echo_call_service(), "A"); @@ -219,7 +219,7 @@ fn empty_literal_array_fold() { assert!(actual_trace.is_empty()); } -#[test] +#[tokio::test] fn empty_fold_json_path() { let mut vm = create_avm(echo_call_service(), "A"); let mut set_variable_vm = create_avm(set_variable_call_service(json!({ "messages": [] })), "set_variable"); @@ -245,7 +245,7 @@ fn empty_fold_json_path() { } // Check that fold works with the join behaviour without hanging up. -#[test] +#[tokio::test] fn fold_with_join() { let mut vm = create_avm(echo_call_service(), "A"); let mut set_variable_vm = create_avm(set_variable_call_service(json!(["1", "2"])), "set_variable"); @@ -271,7 +271,7 @@ fn fold_with_join() { assert_eq!(actual_trace.len(), 4); } -#[test] +#[tokio::test] fn lambda() { let mut vm = create_avm(echo_call_service(), "A"); let mut set_variable_vm = create_avm( @@ -306,7 +306,7 @@ fn lambda() { } } -#[test] +#[tokio::test] fn shadowing() { use executed_state::*; @@ -369,7 +369,7 @@ fn shadowing() { assert_eq!(actual_trace, expected_trace); } -#[test] +#[tokio::test] fn shadowing_scope() { use executed_state::*; @@ -435,7 +435,7 @@ fn shadowing_scope() { assert_eq!(actual_trace, expected_trace); } -#[test] +#[tokio::test] fn fold_waits_on_empty_stream() { let vm_peer_id = "vm_peer_id"; let mut vm = create_avm(echo_call_service(), vm_peer_id); @@ -458,7 +458,7 @@ fn fold_waits_on_empty_stream() { assert_eq!(actual_trace, expected_trace); } -#[test] +#[tokio::test] fn fold_stream_seq_next_never_completes() { let vm_peer_id = "vm_peer_id"; let mut vm = create_avm(set_variable_call_service(json!(1)), vm_peer_id); @@ -491,7 +491,7 @@ fn fold_stream_seq_next_never_completes() { assert_eq!(actual_trace, expected_trace); } -#[test] +#[tokio::test] fn fold_stream_seq_next_never_completes_with_never() { let vm_peer_id = "vm_peer_id"; let mut vm = create_avm(set_variable_call_service(json!(1)), vm_peer_id); @@ -529,7 +529,7 @@ fn fold_stream_seq_next_never_completes_with_never() { assert_eq!(actual_trace, expected_trace); } -#[test] +#[tokio::test] fn fold_stream_seq_next_completes_with_null() { let vm_peer_id = "vm_peer_id"; let mut vm = create_avm(set_variable_call_service(json!(1)), vm_peer_id); @@ -568,7 +568,7 @@ fn fold_stream_seq_next_completes_with_null() { assert_eq!(actual_trace, expected_trace); } -#[test] +#[tokio::test] fn fold_scalar_seq_next_completes_with_null() { let vm_peer_id = "vm_peer_id"; let service_result = json!([1, 2]); @@ -612,7 +612,7 @@ fn fold_scalar_seq_next_completes_with_null() { assert_eq!(actual_trace, expected_trace); } -#[test] +#[tokio::test] fn fold_scalar_seq_next_not_completes_with_never() { let vm_peer_id = "vm_peer_id"; let service_result = json!([1, 2]); @@ -652,7 +652,7 @@ fn fold_scalar_seq_next_not_completes_with_never() { assert_eq!(actual_trace, expected_trace); } -#[test] +#[tokio::test] fn fold_stream_seq_next_saves_call_result() { let vm_peer_id = "vm_peer_id"; let mut vm = create_avm(echo_call_service(), vm_peer_id); @@ -696,7 +696,7 @@ fn fold_stream_seq_next_saves_call_result() { assert_eq!(actual_trace, expected_trace); } -#[test] +#[tokio::test] fn fold_par_next_completes() { let vm_1_peer_id = "vm_1_peer_id"; let mut vm_1 = create_avm(set_variable_call_service(json!(1)), vm_1_peer_id); @@ -795,7 +795,7 @@ fn fold_par_next_completes() { assert_eq!(actual_trace, expected_trace); } -#[test] +#[tokio::test] fn fold_stream_map() { let vm_1_peer_id = "vm_1_peer_id"; let k1 = 42; @@ -935,7 +935,7 @@ fn fold_stream_map() { assert_eq!(&arg_tetraplets.borrow()[tetraplates_len - 4..], &expected_tetraplets); } -#[test] +#[tokio::test] fn fold_canon_stream_map() { let vm_1_peer_name = "vm_1_peer_id"; let vm_1_peer_id = at(vm_1_peer_name); @@ -1016,7 +1016,7 @@ fn fold_canon_stream_map() { /// the same kvpairs sequences. Please note that call results produced by /// the folds mentioned differ in their tetraplets b/c testing framework /// increments service name index for each call used. -#[test] +#[tokio::test] fn fold_map_and_canon_map_orders_are_same() { let vm_1_peer_name = "vm_1_peer_id"; let vm_1_peer_id = at(vm_1_peer_name); diff --git a/air/tests/test_module/instructions/match_.rs b/air/tests/test_module/instructions/match_.rs index d3d692e07b..42d1dfe7fb 100644 --- a/air/tests/test_module/instructions/match_.rs +++ b/air/tests/test_module/instructions/match_.rs @@ -22,7 +22,7 @@ use air::NO_ERROR_MESSAGE; use air_test_framework::AirScriptExecutor; use air_test_utils::prelude::*; -#[test] +#[tokio::test] fn match_equal() { let set_variable_peer_id = "set_variable_peer_id"; let mut set_variable_vm = create_avm(echo_call_service(), set_variable_peer_id); @@ -62,7 +62,7 @@ fn match_equal() { assert_eq!(actual_trace[2.into()], expected_state); } -#[test] +#[tokio::test] fn match_not_equal() { let set_variable_peer_id = "set_variable_peer_id"; let mut set_variable_vm = create_avm(echo_call_service(), set_variable_peer_id); @@ -102,7 +102,7 @@ fn match_not_equal() { assert_eq!(actual_trace[2.into()], expected_state); } -#[test] +#[tokio::test] fn match_with_string() { let set_variable_peer_id = "set_variable_peer_id"; let mut set_variable_vm = create_avm(echo_call_service(), set_variable_peer_id); @@ -139,7 +139,7 @@ fn match_with_string() { assert_eq!(actual_trace[1.into()], expected_state); } -#[test] +#[tokio::test] fn match_with_init_peer_id() { let set_variable_peer_id = "set_variable_peer_id"; let mut set_variable_vm = create_avm(echo_call_service(), set_variable_peer_id); @@ -177,7 +177,7 @@ fn match_with_init_peer_id() { assert_eq!(actual_trace[1.into()], expected_executed_call_result); } -#[test] +#[tokio::test] fn match_with_timestamp() { let set_variable_peer_id = "set_variable_peer_id"; let mut set_variable_vm = create_avm(echo_call_service(), set_variable_peer_id); @@ -216,7 +216,7 @@ fn match_with_timestamp() { assert_eq!(actual_trace[1.into()], expected_executed_call_result); } -#[test] +#[tokio::test] fn match_with_ttl() { let set_variable_peer_id = "set_variable_peer_id"; let mut set_variable_vm = create_avm(echo_call_service(), set_variable_peer_id); @@ -255,7 +255,7 @@ fn match_with_ttl() { assert_eq!(actual_trace[1.into()], expected_executed_call_result); } -#[test] +#[tokio::test] fn match_with_equal_numbers() { let local_peer_id = "local_peer_id"; let mut vm = create_avm(echo_call_service(), local_peer_id); @@ -273,7 +273,7 @@ fn match_with_equal_numbers() { assert!(is_interpreter_succeded(&result)); } -#[test] +#[tokio::test] fn match_without_xor() { let set_variable_peer_id = "set_variable_peer_id"; let mut set_variable_vm = create_avm(echo_call_service(), set_variable_peer_id); @@ -307,7 +307,7 @@ fn match_without_xor() { assert!(check_error(&result, expected_error)); } -#[test] +#[tokio::test] fn match_with_two_xors() { let local_peer_id = "local_peer_id"; let mut vm = create_avm(set_variable_call_service(serde_json::json!(false)), local_peer_id); @@ -343,7 +343,7 @@ fn match_with_two_xors() { } // https://github.com/fluencelabs/aquavm/issues/165 -#[test] +#[tokio::test] fn issue_165() { let result_setter_peer_id = "result_setter_peer_id"; let mut result_setter = create_avm( @@ -390,7 +390,7 @@ fn issue_165() { ); } -#[test] +#[tokio::test] fn match_with_undefined_last_error_errcode() { let local_peer_id = "local_peer_id"; let script = format!( @@ -421,7 +421,7 @@ fn match_with_undefined_last_error_errcode() { assert_eq!(actual_trace, expected_trace); } -#[test] +#[tokio::test] fn match_with_undefined_last_error_message() { let local_peer_id = "local_peer_id"; let script = format!( @@ -452,7 +452,7 @@ fn match_with_undefined_last_error_message() { assert_eq!(actual_trace, expected_trace); } -#[test] +#[tokio::test] fn match_with_error() { let local_peer_id = "local_peer_id"; let mut vm = create_avm(echo_call_service(), local_peer_id); diff --git a/air/tests/test_module/instructions/mismatch.rs b/air/tests/test_module/instructions/mismatch.rs index b85ef5e6a8..90ff826d47 100644 --- a/air/tests/test_module/instructions/mismatch.rs +++ b/air/tests/test_module/instructions/mismatch.rs @@ -18,7 +18,7 @@ use air::CatchableError; use air::ToErrorCode; use air_test_utils::prelude::*; -#[test] +#[tokio::test] fn mismatch_equal() { let set_variable_peer_id = "set_variable_peer_id"; let mut set_variable_vm = create_avm(echo_call_service(), set_variable_peer_id); @@ -58,7 +58,7 @@ fn mismatch_equal() { assert_eq!(actual_trace[2.into()], expected_state); } -#[test] +#[tokio::test] fn mismatch_not_equal() { let set_variable_peer_id = "set_variable_peer_id"; let mut set_variable_vm = create_avm(echo_call_service(), set_variable_peer_id); @@ -98,7 +98,7 @@ fn mismatch_not_equal() { assert_eq!(actual_trace[2.into()], expected_state); } -#[test] +#[tokio::test] fn mismatch_with_string() { let set_variable_peer_id = "set_variable_peer_id"; let mut set_variable_vm = create_avm(echo_call_service(), set_variable_peer_id); @@ -135,7 +135,7 @@ fn mismatch_with_string() { assert_eq!(actual_trace[1.into()], expected_state); } -#[test] +#[tokio::test] fn mismatch_without_xor() { let set_variable_peer_id = "set_variable_peer_id"; let mut set_variable_vm = create_avm(echo_call_service(), set_variable_peer_id); @@ -169,7 +169,7 @@ fn mismatch_without_xor() { assert!(check_error(&result, expected_error)); } -#[test] +#[tokio::test] fn mismatch_with_two_xors() { let local_peer_id = "local_peer_id"; let mut vm = create_avm(set_variable_call_service(serde_json::json!(false)), local_peer_id); @@ -204,7 +204,7 @@ fn mismatch_with_two_xors() { assert_eq!(actual_trace.pop().unwrap(), expected_executed_call_result); } -#[test] +#[tokio::test] fn mismatch_with_error() { use air::ExecutionCidState; diff --git a/air/tests/test_module/instructions/never.rs b/air/tests/test_module/instructions/never.rs index 17cf1efdf0..9819f73e1d 100644 --- a/air/tests/test_module/instructions/never.rs +++ b/air/tests/test_module/instructions/never.rs @@ -16,7 +16,7 @@ use air_test_utils::prelude::*; -#[test] +#[tokio::test] fn never_not_complete_subgraph() { let vm_peer_id = "test_peer_id"; let mut vm = create_avm(unit_call_service(), vm_peer_id); diff --git a/air/tests/test_module/instructions/new.rs b/air/tests/test_module/instructions/new.rs index bf72e468e6..b4f225a083 100644 --- a/air/tests/test_module/instructions/new.rs +++ b/air/tests/test_module/instructions/new.rs @@ -19,7 +19,7 @@ use air_test_utils::prelude::*; use pretty_assertions::assert_eq; -#[test] +#[tokio::test] #[ignore] fn new_with_global_streams_seq() { let set_variable_peer_id = "set_variable_peer_id"; @@ -93,7 +93,7 @@ fn new_with_global_streams_seq() { assert_eq!(actual_trace, expected_trace); } -#[test] +#[tokio::test] fn several_restrictions() { let vm_peer_id = "vm_peer_id"; let mut vm = create_avm(echo_call_service(), vm_peer_id); @@ -129,7 +129,7 @@ fn several_restrictions() { assert_eq!(actual_trace, expected_trace); } -#[test] +#[tokio::test] fn check_influence_to_not_restricted() { let vm_peer_id = "vm_peer_id"; let mut vm = create_avm(echo_call_service(), vm_peer_id); @@ -260,7 +260,7 @@ fn check_influence_to_not_restricted() { assert_eq!(actual_trace, expected_trace); } -#[test] +#[tokio::test] fn new_in_fold_with_ap() { let set_variable_peer_id = "set_variable_peer_id"; let vm_peer_id = "vm_peer_id"; @@ -360,7 +360,7 @@ fn new_in_fold_with_ap() { assert_eq!(actual_trace, expected_trace); } -#[test] +#[tokio::test] fn new_with_streams_with_errors() { let fallible_peer_id = "fallible_peer_id"; let mut fallible_vm = create_avm(fallible_call_service("service_id_1"), fallible_peer_id); @@ -404,7 +404,7 @@ fn new_with_streams_with_errors() { assert_eq!(actual_trace, expected_trace); } -#[test] +#[tokio::test] fn new_with_scalars_with_errors() { let set_variable_peer_id = "set_variable_peer_id"; let variables_mapping = maplit::hashmap! { @@ -463,7 +463,7 @@ fn new_with_scalars_with_errors() { assert_eq!(actual_trace, expected_trace); } -#[test] +#[tokio::test] fn new_with_global_scalars() { let set_variable_peer_id = "set_variable_peer_id"; let variables_mapping = maplit::hashmap! { @@ -543,7 +543,7 @@ fn prepare_new_test_call_service() -> CallServiceClosure { }) } -#[test] +#[tokio::test] fn new_with_scalars_in_lfold_with_outside_next() { let test_peer_id = "test_peer_id"; @@ -602,7 +602,7 @@ fn new_with_scalars_in_lfold_with_outside_next() { assert_eq!(actual_trace, expected_trace); } -#[test] +#[tokio::test] fn new_with_scalars_in_rfold_with_outside_next() { let test_peer_id = "test_peer_id"; @@ -661,7 +661,7 @@ fn new_with_scalars_in_rfold_with_outside_next() { assert_eq!(actual_trace, expected_trace); } -#[test] +#[tokio::test] fn new_with_scalars_in_fold_with_inside_next() { let test_peer_id = "test_peer_id"; diff --git a/air/tests/test_module/instructions/par.rs b/air/tests/test_module/instructions/par.rs index feaf33a620..a1175b50fc 100644 --- a/air/tests/test_module/instructions/par.rs +++ b/air/tests/test_module/instructions/par.rs @@ -16,7 +16,7 @@ use air_test_utils::prelude::*; -#[test] +#[tokio::test] fn par_remote_remote() { use std::collections::HashSet; @@ -37,7 +37,7 @@ fn par_remote_remote() { assert_eq!(actual_peers, expected_peers); } -#[test] +#[tokio::test] fn par_local_remote() { let local_peer_id = "local_peer_id"; let mut vm = create_avm(unit_call_service(), local_peer_id); diff --git a/air/tests/test_module/instructions/seq.rs b/air/tests/test_module/instructions/seq.rs index 5de63a549a..e07c668a86 100644 --- a/air/tests/test_module/instructions/seq.rs +++ b/air/tests/test_module/instructions/seq.rs @@ -17,7 +17,7 @@ use air::ExecutionCidState; use air_test_utils::prelude::*; -#[test] +#[tokio::test] fn seq_remote_remote() { let mut vm = create_avm(unit_call_service(), ""); let mut cid_state = ExecutionCidState::new(); @@ -45,7 +45,7 @@ fn seq_remote_remote() { assert_eq!(result.next_peer_pks, vec![String::from("remote_peer_id_2")]); } -#[test] +#[tokio::test] fn seq_local_remote() { let local_peer_id = "local_peer_id"; let remote_peer_id = String::from("remote_peer_id"); diff --git a/air/tests/test_module/instructions/xor.rs b/air/tests/test_module/instructions/xor.rs index 9e1d48a8a0..c9f84beae6 100644 --- a/air/tests/test_module/instructions/xor.rs +++ b/air/tests/test_module/instructions/xor.rs @@ -17,7 +17,7 @@ use air::UncatchableError; use air_test_utils::prelude::*; -#[test] +#[tokio::test] fn xor() { let local_peer_id = "local_peer_id"; let fallible_service_id = "service_id_1"; @@ -69,7 +69,7 @@ fn xor() { assert_eq!(actual_trace[0.into()], expected_call_result); } -#[test] +#[tokio::test] fn xor_var_not_found() { let local_peer_id = "local_peer_id"; let mut vm = create_avm(echo_call_service(), local_peer_id); @@ -92,7 +92,7 @@ fn xor_var_not_found() { assert_eq!(actual_trace[1.into()], executed_state::request_sent_by(local_peer_id)); } -#[test] +#[tokio::test] fn xor_multiple_variables_found() { let set_variables_peer_id = "set_variables_peer_id"; let mut set_variables_vm = create_avm(echo_call_service(), set_variables_peer_id); @@ -118,7 +118,7 @@ fn xor_multiple_variables_found() { assert!(check_error(&result, expected_error)); } -#[test] +#[tokio::test] fn xor_par() { use executed_state::*; @@ -205,7 +205,7 @@ fn xor_par() { assert_eq!(actual_trace, expected_trace); } -#[test] +#[tokio::test] fn last_error_with_xor() { let faillible_peer_id = "failible_peer_id"; let mut faillible_vm = create_avm(fallible_call_service("service_id_1"), faillible_peer_id); @@ -236,7 +236,7 @@ fn last_error_with_xor() { assert_eq!(actual_trace[1.into()], expected_state); } -#[test] +#[tokio::test] fn error_with_xor() { let faillible_peer_id = "failible_peer_id"; let mut faillible_vm = create_avm(fallible_call_service("service_id_1"), faillible_peer_id); diff --git a/air/tests/test_module/integration/chat_join.rs b/air/tests/test_module/integration/chat_join.rs index 417ffe4a68..185e48cc54 100644 --- a/air/tests/test_module/integration/chat_join.rs +++ b/air/tests/test_module/integration/chat_join.rs @@ -19,7 +19,7 @@ use air_test_utils::prelude::*; use pretty_assertions::assert_eq; -#[test] +#[tokio::test] fn join_chat_1() { use std::collections::HashSet; @@ -295,7 +295,7 @@ fn join_chat_1() { assert!(client_2_result.next_peer_pks.is_empty()); } -#[test] +#[tokio::test] fn join_chat_2() { let members_call_service1: CallServiceClosure = Box::new(|_| -> CallServiceResult { CallServiceResult::ok(json!([["A"], ["B"]])) }); @@ -386,7 +386,7 @@ fn join_chat_2() { assert!(client_1_result.next_peer_pks.is_empty()); } -#[test] +#[tokio::test] fn init_peer_id() { let relay_1_peer_id = "relay_1_peer_id"; let mut relay_1 = create_avm(unit_call_service(), relay_1_peer_id); diff --git a/air/tests/test_module/integration/create_service.rs b/air/tests/test_module/integration/create_service.rs index 4ee137500b..32a0a056f7 100644 --- a/air/tests/test_module/integration/create_service.rs +++ b/air/tests/test_module/integration/create_service.rs @@ -16,7 +16,7 @@ use air_test_utils::prelude::*; -#[test] +#[tokio::test] fn create_service() { let module = "greeting"; let module_config = json!( diff --git a/air/tests/test_module/integration/dashboard.rs b/air/tests/test_module/integration/dashboard.rs index 149f9e7481..c6b7c420b2 100644 --- a/air/tests/test_module/integration/dashboard.rs +++ b/air/tests/test_module/integration/dashboard.rs @@ -144,7 +144,7 @@ struct AVMState { prev_result: Vec, } -#[test] +#[tokio::test] fn dashboard() { let script = include_str!("./scripts/dashboard.air"); diff --git a/air/tests/test_module/integration/network_explore.rs b/air/tests/test_module/integration/network_explore.rs index 2cd8709920..2243901276 100644 --- a/air/tests/test_module/integration/network_explore.rs +++ b/air/tests/test_module/integration/network_explore.rs @@ -16,7 +16,7 @@ use air_test_utils::prelude::*; -#[test] +#[tokio::test] // TODO: adjust test #[ignore] fn network_explore() { diff --git a/air/tests/test_module/issues/issue_137.rs b/air/tests/test_module/issues/issue_137.rs index 2ae9850759..1def8a55bf 100644 --- a/air/tests/test_module/issues/issue_137.rs +++ b/air/tests/test_module/issues/issue_137.rs @@ -16,7 +16,7 @@ use air_test_utils::prelude::*; -#[test] +#[tokio::test] // https://github.com/fluencelabs/aquavm/issues/137 fn issue_137() { let initiator_id = "initiator_id"; diff --git a/air/tests/test_module/issues/issue_173.rs b/air/tests/test_module/issues/issue_173.rs index def19dfd4f..863aaab431 100644 --- a/air/tests/test_module/issues/issue_173.rs +++ b/air/tests/test_module/issues/issue_173.rs @@ -16,7 +16,7 @@ use air_test_utils::prelude::*; -#[test] +#[tokio::test] #[ignore] // test for github.com/fluencelabs/aquavm/issues/173 fn issue_173() { diff --git a/air/tests/test_module/issues/issue_177.rs b/air/tests/test_module/issues/issue_177.rs index 76b3a05f7f..78505cc25c 100644 --- a/air/tests/test_module/issues/issue_177.rs +++ b/air/tests/test_module/issues/issue_177.rs @@ -19,7 +19,7 @@ use std::collections::HashMap; use serde_json::json; -#[test] +#[tokio::test] // https://github.com/fluencelabs/aquavm/issues/177 fn issue_177() { let client_peer_id = "12D3KooWMMcNVt5AsiisAHbkfyZWKHufB2dkHCY5pUqZ6AQgEVK6"; diff --git a/air/tests/test_module/issues/issue_178.rs b/air/tests/test_module/issues/issue_178.rs index 8939d22445..5e8f48d609 100644 --- a/air/tests/test_module/issues/issue_178.rs +++ b/air/tests/test_module/issues/issue_178.rs @@ -16,7 +16,7 @@ use air_test_utils::prelude::*; -#[test] +#[tokio::test] // https://github.com/fluencelabs/aquavm/issues/178 fn par_ap_behaviour() { let client_name = "client_id"; diff --git a/air/tests/test_module/issues/issue_180.rs b/air/tests/test_module/issues/issue_180.rs index 350487c068..83f5a52b44 100644 --- a/air/tests/test_module/issues/issue_180.rs +++ b/air/tests/test_module/issues/issue_180.rs @@ -16,7 +16,7 @@ use air_test_utils::prelude::*; -#[test] +#[tokio::test] // test for github.com/fluencelabs/aquavm/issues/180 fn issue_180() { let peer_1_id = "peer_1_id"; diff --git a/air/tests/test_module/issues/issue_206.rs b/air/tests/test_module/issues/issue_206.rs index a8ad1bbe33..660b879509 100644 --- a/air/tests/test_module/issues/issue_206.rs +++ b/air/tests/test_module/issues/issue_206.rs @@ -16,7 +16,7 @@ use air_test_utils::prelude::*; -#[test] +#[tokio::test] #[ignore] // this test is not actual because streams are prohibited to be used as match operands // test for github.com/fluencelabs/aquavm/issues/206 fn issue_206() { diff --git a/air/tests/test_module/issues/issue_211.rs b/air/tests/test_module/issues/issue_211.rs index 1859b2b480..76868a973a 100644 --- a/air/tests/test_module/issues/issue_211.rs +++ b/air/tests/test_module/issues/issue_211.rs @@ -19,7 +19,7 @@ use air_test_utils::prelude::*; use pretty_assertions::assert_eq; -#[test] +#[tokio::test] // test for github.com/fluencelabs/aquavm/issues/211 // On the versions < 0.20.1 it just crashes fn issue_211() { diff --git a/air/tests/test_module/issues/issue_214.rs b/air/tests/test_module/issues/issue_214.rs index a081c94171..80cc8e41b1 100644 --- a/air/tests/test_module/issues/issue_214.rs +++ b/air/tests/test_module/issues/issue_214.rs @@ -19,7 +19,7 @@ use air_test_utils::prelude::*; use pretty_assertions::assert_eq; -#[test] +#[tokio::test] // test for github.com/fluencelabs/aquavm/issues/214 fn issue_214() { let client_id = "client_peer_id"; diff --git a/air/tests/test_module/issues/issue_216.rs b/air/tests/test_module/issues/issue_216.rs index ed0ce01399..46ceda4580 100644 --- a/air/tests/test_module/issues/issue_216.rs +++ b/air/tests/test_module/issues/issue_216.rs @@ -16,7 +16,7 @@ use air_test_utils::prelude::*; -#[test] +#[tokio::test] // test for github.com/fluencelabs/aquavm/issues/216 fn issue_216() { let some_peer_id = "relay_peer_id"; diff --git a/air/tests/test_module/issues/issue_221.rs b/air/tests/test_module/issues/issue_221.rs index 33b67d704b..f015e5309a 100644 --- a/air/tests/test_module/issues/issue_221.rs +++ b/air/tests/test_module/issues/issue_221.rs @@ -20,7 +20,7 @@ use air_test_utils::key_utils::at; use air_test_utils::prelude::*; use pretty_assertions::assert_eq; -#[test] +#[tokio::test] // test for github.com/fluencelabs/aquavm/issues/221 fn issue_221() { let peer_1_name = "peer_1_id"; diff --git a/air/tests/test_module/issues/issue_222.rs b/air/tests/test_module/issues/issue_222.rs index 04ca708230..ce36dc490f 100644 --- a/air/tests/test_module/issues/issue_222.rs +++ b/air/tests/test_module/issues/issue_222.rs @@ -17,7 +17,7 @@ use air_test_utils::prelude::*; use pretty_assertions::assert_eq; -#[test] +#[tokio::test] // test for github.com/fluencelabs/aquavm/issues/222 fn issue_222() { let other_id = "other_id"; diff --git a/air/tests/test_module/issues/issue_241.rs b/air/tests/test_module/issues/issue_241.rs index 485863bab7..2466abac55 100644 --- a/air/tests/test_module/issues/issue_241.rs +++ b/air/tests/test_module/issues/issue_241.rs @@ -19,7 +19,7 @@ use air_test_utils::prelude::*; use pretty_assertions::assert_eq; -#[test] +#[tokio::test] // test for github.com/fluencelabs/aquavm/issues/241 fn issue_241() { let peer_1_id = "peer_1_id"; diff --git a/air/tests/test_module/issues/issue_295.rs b/air/tests/test_module/issues/issue_295.rs index b968512ced..7fccd6298b 100644 --- a/air/tests/test_module/issues/issue_295.rs +++ b/air/tests/test_module/issues/issue_295.rs @@ -19,7 +19,7 @@ use air_test_utils::prelude::*; use air_trace_handler::merger::MergeError; use air_trace_handler::TraceHandlerError; -#[test] +#[tokio::test] // test for github.com/fluencelabs/aquavm/issues/295 fn issue_295() { let vm_peer_id = "vm_peer_id"; diff --git a/air/tests/test_module/issues/issue_300.rs b/air/tests/test_module/issues/issue_300.rs index ad69b4fd13..26ab36f556 100644 --- a/air/tests/test_module/issues/issue_300.rs +++ b/air/tests/test_module/issues/issue_300.rs @@ -16,7 +16,7 @@ use air_test_utils::prelude::*; -#[test] +#[tokio::test] // test for github.com/fluencelabs/aquavm/issues/300 fn issue_300() { let peer_id_1 = "peer_id_1"; diff --git a/air/tests/test_module/issues/issue_302.rs b/air/tests/test_module/issues/issue_302.rs index 18f7e480dd..f952cbf72c 100644 --- a/air/tests/test_module/issues/issue_302.rs +++ b/air/tests/test_module/issues/issue_302.rs @@ -20,7 +20,7 @@ use pretty_assertions::assert_eq; use std::ops::Deref; -#[test] +#[tokio::test] // test for github.com/fluencelabs/aquavm/issues/302 fn issue_302() { let peer_id_1 = "peer_id_1"; diff --git a/air/tests/test_module/issues/issue_304.rs b/air/tests/test_module/issues/issue_304.rs index bb9d2767b0..647049251c 100644 --- a/air/tests/test_module/issues/issue_304.rs +++ b/air/tests/test_module/issues/issue_304.rs @@ -17,7 +17,7 @@ use air_test_framework::AirScriptExecutor; use air_test_utils::prelude::*; -#[test] +#[tokio::test] // test for github.com/fluencelabs/aquavm/issues/304 fn issue_304() { let script = r#" diff --git a/air/tests/test_module/issues/issue_306.rs b/air/tests/test_module/issues/issue_306.rs index d3ccee00e4..75a8a9a694 100644 --- a/air/tests/test_module/issues/issue_306.rs +++ b/air/tests/test_module/issues/issue_306.rs @@ -17,7 +17,7 @@ use air_interpreter_interface::INTERPRETER_SUCCESS; use air_test_utils::prelude::*; -#[test] +#[tokio::test] // test for github.com/fluencelabs/aquavm/issues/306 fn issue_306() { let peer_id_1 = "peer_id_1"; diff --git a/air/tests/test_module/issues/issue_331.rs b/air/tests/test_module/issues/issue_331.rs index 3aef248708..435aa604be 100644 --- a/air/tests/test_module/issues/issue_331.rs +++ b/air/tests/test_module/issues/issue_331.rs @@ -17,7 +17,7 @@ use air_interpreter_interface::INTERPRETER_SUCCESS; use air_test_utils::prelude::*; -#[test] +#[tokio::test] // test for github.com/fluencelabs/aquavm/issues/331 fn issue_331() { let peer_id_1 = "peer_id_1"; diff --git a/air/tests/test_module/issues/issue_346.rs b/air/tests/test_module/issues/issue_346.rs index 8ead1a2fa6..1404287520 100644 --- a/air/tests/test_module/issues/issue_346.rs +++ b/air/tests/test_module/issues/issue_346.rs @@ -17,7 +17,7 @@ use air_interpreter_interface::INTERPRETER_SUCCESS; use air_test_utils::prelude::*; -#[test] +#[tokio::test] // test for github.com/fluencelabs/aquavm/issues/346 fn issue_346() { let vm_peer_id = "peer_id_1"; diff --git a/air/tests/test_module/issues/issue_348.rs b/air/tests/test_module/issues/issue_348.rs index ca48903906..251a59f48d 100644 --- a/air/tests/test_module/issues/issue_348.rs +++ b/air/tests/test_module/issues/issue_348.rs @@ -16,7 +16,7 @@ use air_test_utils::prelude::*; -#[test] +#[tokio::test] // test for github.com/fluencelabs/aquavm/issues/348 fn issue_348() { let vm_peer_id_1 = "vm_peer_id_1"; diff --git a/air/tests/test_module/issues/issue_356.rs b/air/tests/test_module/issues/issue_356.rs index 30510c2b90..48f82b3d18 100644 --- a/air/tests/test_module/issues/issue_356.rs +++ b/air/tests/test_module/issues/issue_356.rs @@ -17,7 +17,7 @@ use air_test_framework::AirScriptExecutor; use air_test_utils::prelude::*; -#[test] +#[tokio::test] fn issue_356() { let script = r#" (seq diff --git a/air/tests/test_module/issues/issue_363.rs b/air/tests/test_module/issues/issue_363.rs index 9874a8ea15..bc520ff9d7 100644 --- a/air/tests/test_module/issues/issue_363.rs +++ b/air/tests/test_module/issues/issue_363.rs @@ -17,7 +17,7 @@ use air_test_utils::prelude::*; //https://github.com/fluencelabs/aquavm/issues/363 -#[test] +#[tokio::test] fn issue_363() { let client_peer_id = "client"; let mut client_vm = create_avm( diff --git a/air/tests/test_module/issues/issue_632.rs b/air/tests/test_module/issues/issue_632.rs index aec91f98cc..2c83de756b 100644 --- a/air/tests/test_module/issues/issue_632.rs +++ b/air/tests/test_module/issues/issue_632.rs @@ -16,7 +16,7 @@ use air_test_utils::{key_utils::derive_dummy_keypair, prelude::*}; -#[test] +#[tokio::test] fn issue_310() { let (key_pair, peer_id) = derive_dummy_keypair("init_peer_id"); let particle_id = "particle_id"; diff --git a/air/tests/test_module/issues/issue_642.rs b/air/tests/test_module/issues/issue_642.rs index 19ec1e1b3e..aba5316997 100644 --- a/air/tests/test_module/issues/issue_642.rs +++ b/air/tests/test_module/issues/issue_642.rs @@ -16,7 +16,7 @@ use air_test_utils::prelude::*; -#[test] +#[tokio::test] fn issue_642() { let peer_id_1 = "peer_id_1"; let peer_id_2 = "peer_id_2"; diff --git a/air/tests/test_module/issues/issue_644.rs b/air/tests/test_module/issues/issue_644.rs index 384a8fa292..a7d658fe1e 100644 --- a/air/tests/test_module/issues/issue_644.rs +++ b/air/tests/test_module/issues/issue_644.rs @@ -16,7 +16,7 @@ use air_test_utils::prelude::*; -#[test] +#[tokio::test] fn issue_644() { let peer_id_1 = "peer_id_1"; let peer_id_2 = "peer_id_2"; diff --git a/air/tests/test_module/negative_tests/execution_step.rs b/air/tests/test_module/negative_tests/execution_step.rs index 0143b1c015..e9d1b62d53 100644 --- a/air/tests/test_module/negative_tests/execution_step.rs +++ b/air/tests/test_module/negative_tests/execution_step.rs @@ -22,7 +22,7 @@ use air::LambdaError; use air_test_framework::AirScriptExecutor; use air_test_utils::prelude::*; -#[test] +#[tokio::test] fn local_service_error() { let client_peer_id = "some_peer_id"; let script = format!( @@ -60,7 +60,7 @@ fn local_service_error() { assert!(check_error(&result, expected_error)); } -#[test] +#[tokio::test] fn fold_iterates_over_non_array_scalar_iterable() { let vm_2_peer_id = "vm_2_peer_id"; let var_name = "outcome".to_string(); @@ -84,7 +84,7 @@ fn fold_iterates_over_non_array_scalar_iterable() { assert!(check_error(&result, expected_error)); } -#[test] +#[tokio::test] fn fold_iterates_over_non_array_scalar_lambda_iterable() { let vm_2_peer_id = "vm_2_peer_id"; let var_name = "outcome".to_string(); @@ -109,7 +109,7 @@ fn fold_iterates_over_non_array_scalar_lambda_iterable() { assert!(check_error(&result, expected_error)); } -#[test] +#[tokio::test] fn non_string_value_in_triplet_resolution() { let vm_2_peer_id = "vm_2_peer_id"; let scalar_int = 42; @@ -170,7 +170,7 @@ fn non_string_value_in_triplet_resolution() { assert!(check_error(&result, expected_error)); } -#[test] +#[tokio::test] fn non_string_value_in_triplet_resolution_module_name() { let vm_2_peer_id = "vm_2_peer_id"; let scalar_int = 42; @@ -231,7 +231,7 @@ fn non_string_value_in_triplet_resolution_module_name() { assert!(check_error(&result, expected_error)); } -#[test] +#[tokio::test] fn non_string_value_in_triplet_resolution_function_name() { let vm_2_peer_id = "vm_2_peer_id"; let scalar_int = 42; @@ -292,7 +292,7 @@ fn non_string_value_in_triplet_resolution_function_name() { assert!(check_error(&result, expected_error)); } -#[test] +#[tokio::test] fn value_not_contain_such_array_idx_ap() { let vm_1_peer_id = "vm_1_peer_id"; let idx = 42; @@ -315,7 +315,7 @@ fn value_not_contain_such_array_idx_ap() { assert!(check_error(&result, expected_error)); } -#[test] +#[tokio::test] fn field_accessor_applied_to_stream() { let vm_peer_id_1 = "vm_peer_id_1"; @@ -337,7 +337,7 @@ fn field_accessor_applied_to_stream() { assert!(check_error(&result, expected_error)); } -#[test] +#[tokio::test] fn array_accessor_not_match_value() { let vm_peer_id_1 = "vm_peer_id_1"; @@ -359,7 +359,7 @@ fn array_accessor_not_match_value() { assert!(check_error(&result, expected_error)); } -#[test] +#[tokio::test] fn value_not_contain_such_array_idx_call_arg_lambda() { let vm_peer_id_1 = "vm_peer_id_1"; let arg = json!([0, 1]); @@ -380,7 +380,7 @@ fn value_not_contain_such_array_idx_call_arg_lambda() { assert!(check_error(&result, expected_error)); } -#[test] +#[tokio::test] fn value_not_contain_such_field_call_arg_lambda() { let vm_peer_id_1 = "vm_peer_id_1"; let arg = json!({"a": 1,}); @@ -401,7 +401,7 @@ fn value_not_contain_such_field_call_arg_lambda() { assert!(check_error(&result, expected_error)); } -#[test] +#[tokio::test] fn field_accesssor_not_match_value_call_arg_lambda() { let vm_peer_id_1 = "vm_peer_id_1"; let arg = json!([0, 1]); @@ -423,7 +423,7 @@ fn field_accesssor_not_match_value_call_arg_lambda() { assert!(check_error(&result, expected_error)); } -#[test] +#[tokio::test] fn index_access_not_u32_i64() { let vm_peer_id_1 = "vm_peer_id_1"; let vm_peer_id_2 = "vm_peer_id_2"; @@ -452,7 +452,7 @@ fn index_access_not_u32_i64() { assert!(check_error(&result, expected_error)); } -#[test] +#[tokio::test] fn scalar_accessor_has_invalid_type_ap() { let vm_peer_id_1 = "vm_peer_id_1"; let obj_arg = json!({"a": 1,}); @@ -485,7 +485,7 @@ fn scalar_accessor_has_invalid_type_ap() { assert!(check_error(&result, expected_error)); } -#[test] +#[tokio::test] fn stream_accessor_has_invalid_type() { let vm_peer_id_1 = "vm_peer_id_1"; let obj_arg = json!({"a": 1,}); @@ -521,7 +521,7 @@ fn stream_accessor_has_invalid_type() { assert!(check_error(&result, expected_error)); } -#[test] +#[tokio::test] fn canon_stream_not_have_enough_values_call_arg() { let local_peer_id = "local_peer_id"; let mut local_vm = create_avm(echo_call_service(), local_peer_id); @@ -553,7 +553,7 @@ fn canon_stream_not_have_enough_values_call_arg() { assert!(check_error(&result, expected_error)); } -#[test] +#[tokio::test] fn unsupported_map_keytype() { let local_peer_id = "local_peer_id"; let obj_arg = json!({"a": {"b": 1},}); @@ -574,7 +574,7 @@ fn unsupported_map_keytype() { assert!(check_error(&result, expected_error)); } -#[test] +#[tokio::test] fn undefined_last_error_functor() { let local_peer_id = "local_peer_id"; let script = format!( @@ -596,7 +596,7 @@ fn undefined_last_error_functor() { assert!(check_error(&result.last().unwrap(), expected_error)); } -#[test] +#[tokio::test] fn undefined_error_functor() { let local_peer_id = "local_peer_id"; let script = format!( @@ -619,7 +619,7 @@ fn undefined_error_functor() { assert!(check_error(&result.last().unwrap(), expected_error)); } -#[test] +#[tokio::test] fn undefined_error_peerid() { let local_peer_id = "local_peer_id"; let script = format!( @@ -644,7 +644,7 @@ fn undefined_error_peerid() { assert!(check_error(&result.last().unwrap(), expected_error)); } -#[test] +#[tokio::test] fn undefined_last_error_instruction() { let local_peer_id = "local_peer_id"; let script = format!( @@ -669,7 +669,7 @@ fn undefined_last_error_instruction() { assert!(check_error(&&result.last().unwrap(), expected_error)); } -#[test] +#[tokio::test] fn undefined_last_error_peer_id() { let local_peer_id = "local_peer_id"; let script = format!( diff --git a/air/tests/test_module/negative_tests/farewell_step.rs b/air/tests/test_module/negative_tests/farewell_step.rs index 7eac3fcd59..c6f49e1301 100644 --- a/air/tests/test_module/negative_tests/farewell_step.rs +++ b/air/tests/test_module/negative_tests/farewell_step.rs @@ -17,7 +17,7 @@ use air::FarewellError; use air_test_utils::prelude::*; -#[test] +#[tokio::test] fn unprocessed_call_result() { let air = r#"(null)"#; let client_peer_id = "some_peer_id"; diff --git a/air/tests/test_module/negative_tests/preparation_step.rs b/air/tests/test_module/negative_tests/preparation_step.rs index ba3ead8e79..f2a14eb116 100644 --- a/air/tests/test_module/negative_tests/preparation_step.rs +++ b/air/tests/test_module/negative_tests/preparation_step.rs @@ -24,7 +24,7 @@ use air_test_utils::prelude::*; use serde::Deserialize; use serde::Serialize; -#[test] +#[tokio::test] fn invalid_data_without_versions() { use air_interpreter_sede::Format; use air_interpreter_sede::Representation; @@ -51,7 +51,7 @@ fn invalid_data_without_versions() { assert!(check_error(&result, expected_error)); } -#[test] +#[tokio::test] fn invalid_data_with_versions() { use air_interpreter_sede::Format; use air_interpreter_sede::Representation; @@ -84,7 +84,7 @@ fn invalid_data_with_versions() { assert!(check_error(&result, expected_error)); } -#[test] +#[tokio::test] fn invalid_callresults() { use air_interpreter_sede::Format; diff --git a/air/tests/test_module/negative_tests/uncatchable_trace_related.rs b/air/tests/test_module/negative_tests/uncatchable_trace_related.rs index 246fef45b3..14658fa707 100644 --- a/air/tests/test_module/negative_tests/uncatchable_trace_related.rs +++ b/air/tests/test_module/negative_tests/uncatchable_trace_related.rs @@ -35,7 +35,7 @@ use air_trace_handler::TraceHandlerError::MergeError; use air_trace_handler::TraceHandlerError::StateFSMError; use maplit::hashmap; -#[test] +#[tokio::test] fn par_len_overflow() { let vm_peer_id_1 = "vm_peer_id_1"; let mut peer_vm_1 = create_avm(unit_call_service(), vm_peer_id_1); @@ -67,7 +67,7 @@ fn par_len_overflow() { assert!(check_error(&result, expected_error)); } -#[test] +#[tokio::test] fn par_pos_overflow() { let vm_peer_id_1 = "vm_peer_id_1"; let mut peer_vm_1 = create_avm(unit_call_service(), vm_peer_id_1); @@ -99,7 +99,7 @@ fn par_pos_overflow() { assert!(check_error(&result, expected_error)); } -#[test] +#[tokio::test] fn par_len_underflow() { let vm_peer_id_1 = "vm_peer_id_1"; let mut peer_vm_1 = create_avm(unit_call_service(), vm_peer_id_1); @@ -126,7 +126,7 @@ fn par_len_underflow() { assert!(check_error(&result, expected_error)); } -#[test] +#[tokio::test] fn set_subtrace_len_and_pos_failed() { let vm_peer_id_1 = "vm_peer_id_1"; let arg = json!([42, 43]); @@ -166,7 +166,7 @@ fn set_subtrace_len_and_pos_failed() { assert!(check_error(&result, expected_error)); } -#[test] +#[tokio::test] fn no_element_at_position() { let vm_peer_id_1 = "vm_peer_id_1"; let mut peer_vm_1 = create_avm(unit_call_service(), vm_peer_id_1); @@ -204,7 +204,7 @@ fn no_element_at_position() { assert!(check_error(&result, expected_error)); } -#[test] +#[tokio::test] fn no_stream_state() { let vm_peer_id_1 = "vm_peer_id_1"; let arg = json!([42, 43]); @@ -241,7 +241,7 @@ fn no_stream_state() { assert!(check_error(&result, expected_error)); } -#[test] +#[tokio::test] fn incompatible_executed_states() { let vm_peer_id = "vm_peer_id"; let mut peer_vm_1 = create_avm(echo_call_service(), vm_peer_id); @@ -273,7 +273,7 @@ fn incompatible_executed_states() { assert!(check_error(&result, expected_error)); } -#[test] +#[tokio::test] fn different_executed_state_expected() { let vm_peer_id_1 = "vm_peer_id_1"; let arg = json!([42, 43]); @@ -301,7 +301,7 @@ fn different_executed_state_expected() { assert!(check_error(&result, expected_error)); } -#[test] +#[tokio::test] fn invalid_dst_generations() { let vm_peer_id_1 = "vm_peer_id_1"; let mut peer_vm_1 = create_avm(unit_call_service(), vm_peer_id_1); @@ -335,7 +335,7 @@ fn invalid_dst_generations() { assert!(check_error(&result, expected_error)); } -#[test] +#[tokio::test] fn incorrect_call_result() { let vm_peer_id_1 = "vm_peer_id_1"; let mut peer_vm_1 = create_avm(unit_call_service(), vm_peer_id_1); @@ -376,7 +376,7 @@ fn incorrect_call_result() { assert!(check_error(&result, expected_error)); } -#[test] +#[tokio::test] fn canon_result_error() { let vm_peer_id_1 = "vm_peer_id_1"; let arg = json!([42, 43]); @@ -425,7 +425,7 @@ fn canon_result_error() { assert!(check_error(&result, expected_error), "{:?}", result); } -#[test] +#[tokio::test] fn several_records_with_same_pos() { let vm_peer_id_1 = "vm_peer_id_1"; let mut peer_vm_1 = create_avm(unit_call_service(), vm_peer_id_1); @@ -478,7 +478,7 @@ fn several_records_with_same_pos() { assert!(check_error(&result, expected_error)); } -#[test] +#[tokio::test] fn values_not_equal() { let vm_peer_id_1 = "vm_peer_id_1"; let arg = json!([42, 43]); @@ -521,7 +521,7 @@ fn values_not_equal() { assert!(check_error(&result, expected_error)); } -#[test] +#[tokio::test] fn fold_pos_overflow() { let vm_peer_id_1 = "vm_peer_id_1"; let mut peer_vm_1 = create_avm(unit_call_service(), vm_peer_id_1); @@ -571,7 +571,7 @@ fn fold_pos_overflow() { assert!(check_error(&result, expected_error)); } -#[test] +#[tokio::test] fn subtrace_len_overflow() { let vm_peer_id_1 = "vm_peer_id_1"; let mut peer_vm_1 = create_avm(unit_call_service(), vm_peer_id_1); @@ -625,7 +625,7 @@ fn subtrace_len_overflow() { assert!(check_error(&result, expected_error)); } -#[test] +#[tokio::test] fn fold_incorrect_subtraces_count() { let vm_peer_id_1 = "vm_peer_id_1"; let mut peer_vm_1 = create_avm(unit_call_service(), vm_peer_id_1); diff --git a/air/tests/test_module/negative_tests/uncatchable_trace_unrelated.rs b/air/tests/test_module/negative_tests/uncatchable_trace_unrelated.rs index c09b2585ae..46354d0458 100644 --- a/air/tests/test_module/negative_tests/uncatchable_trace_unrelated.rs +++ b/air/tests/test_module/negative_tests/uncatchable_trace_unrelated.rs @@ -22,7 +22,7 @@ use air_interpreter_data::ValueRef; use air_test_framework::AirScriptExecutor; use air_test_utils::prelude::*; -#[test] +#[tokio::test] fn fold_state_not_found() { let vm_peer_id_1 = "vm_peer_id_1"; let arg = json!([1, 2,]); @@ -47,7 +47,7 @@ fn fold_state_not_found() { assert!(check_error(&result, expected_error)); } -#[test] +#[tokio::test] fn iterable_shadowing() { let vm_peer_id_1 = "vm_peer_id_1"; let arg = json!([1, 2,]); @@ -69,7 +69,7 @@ fn iterable_shadowing() { assert!(check_error(&result, expected_error)); } -#[test] +#[tokio::test] fn call_result_not_correspond_to_instr() { let vm_peer_id_1 = "vm_peer_id_1"; let arg = json!([1, 2,]); @@ -92,7 +92,7 @@ fn call_result_not_correspond_to_instr() { assert!(check_error(&result, expected_error), "{:?}", result); } -#[test] +#[tokio::test] fn shadowing_is_not_allowed() { let vm_peer_id_1 = "vm_peer_id_1"; let mut peer_vm_1 = create_avm(unit_call_service(), vm_peer_id_1); @@ -111,7 +111,7 @@ fn shadowing_is_not_allowed() { assert!(check_error(&result, expected_error)); } -#[test] +#[tokio::test] fn value_for_cid_not_found() { let vm_peer_id_1 = "vm_peer_id_1"; let arg = json!([1, 2,]); @@ -133,7 +133,7 @@ fn value_for_cid_not_found() { assert!(check_error(&result, expected_error)); } -#[test] +#[tokio::test] fn malformed_call_service_failed() { let peer_id = "init_peer_id"; let mut cid_state = ExecutionCidState::new(); @@ -166,7 +166,7 @@ fn malformed_call_service_failed() { assert_error_eq!(&result, expected_error); } -#[test] +#[tokio::test] fn recursive_stream_size_limit() { let vm_peer_id_1 = "vm_peer_id_1"; diff --git a/avm/server/Cargo.toml b/avm/server/Cargo.toml index cd3fbc0c5c..e58cc8bb3b 100644 --- a/avm/server/Cargo.toml +++ b/avm/server/Cargo.toml @@ -19,8 +19,9 @@ air-interpreter-interface = { version = "0.17.2", path = "../../crates/air-lib/i air-interpreter-sede = { version = "0.1.0", path = "../../crates/air-lib/interpreter-sede" } air-utils = { version = "0.2.0", path = "../../crates/air-lib/utils" } avm-data-store = { version = "0.7.7", path = "../../crates/data-store" } -marine-runtime = {version = "0.32.0", path = "../../../marine/marine"} -marine-wasmtime-backend = {version = "0.5.0", path = "../../../marine/crates/wasmtime-backend"} +marine-runtime = {version = "0.33.0", path = "../../../marine/marine"} +marine-wasmtime-backend = {version = "0.5.1", path = "../../../marine/crates/wasmtime-backend"} +marine-wasm-backend-traits = {version = "0.5.1", path = "../../../marine/crates/wasm-backend-traits"} polyplets = { version = "0.6.0", path = "../../crates/air-lib/polyplets" } avm-interface = { version = "0.31.2", path = "../../avm/interface" } @@ -33,4 +34,4 @@ log = "0.4.20" parking_lot = "0.12.1" tracing = "0.1.40" fluence-keypair = { version = "0.10.4", default-features = false } -tokio = { version = "1", features = ["rt"] } +tokio = { version = "1", features = ["rt", "macros"] } diff --git a/avm/server/src/avm.rs b/avm/server/src/avm.rs index fa4ad06ca5..a959b75906 100644 --- a/avm/server/src/avm.rs +++ b/avm/server/src/avm.rs @@ -28,39 +28,41 @@ use avm_interface::CallResults; use avm_interface::ParticleParameters; use fluence_keypair::KeyPair; +use marine_wasm_backend_traits::WasmBackend; + use std::ops::Deref; use std::ops::DerefMut; use std::time::Duration; use std::time::Instant; /// A newtype needed to mark it as `unsafe impl Send` -struct SendSafeRunner(AVMRunner); +struct SendSafeRunner(AVMRunner); /// Mark runtime as Send, so libp2p on the node (use-site) is happy -unsafe impl Send for SendSafeRunner {} +unsafe impl Send for SendSafeRunner {} -impl Deref for SendSafeRunner { - type Target = AVMRunner; +impl Deref for SendSafeRunner { + type Target = AVMRunner; fn deref(&self) -> &Self::Target { &self.0 } } -impl DerefMut for SendSafeRunner { +impl DerefMut for SendSafeRunner { fn deref_mut(&mut self) -> &mut Self::Target { &mut self.0 } } -pub struct AVM { - runner: SendSafeRunner, +pub struct AVM { + runner: SendSafeRunner, data_store: AVMDataStore, } -impl AVM { +impl AVM { /// Create AVM with provided config. #[allow(clippy::result_large_err)] - pub async fn new(config: AVMConfig) -> AVMResult { + pub async fn new(config: AVMConfig, wasm_backend: WB) -> AVMResult { let AVMConfig { air_wasm_path, max_heap_size, @@ -70,7 +72,7 @@ impl AVM { data_store.initialize()?; - let runner = AVMRunner::new(air_wasm_path, max_heap_size, logging_mask) + let runner = AVMRunner::new(air_wasm_path, max_heap_size, logging_mask, wasm_backend) .await .map_err(AVMError::RunnerError)?; let runner = SendSafeRunner(runner); diff --git a/avm/server/src/runner.rs b/avm/server/src/runner.rs index c60407ef5a..4f68a0b647 100644 --- a/avm/server/src/runner.rs +++ b/avm/server/src/runner.rs @@ -26,14 +26,15 @@ use avm_interface::raw_outcome::RawAVMOutcome; use avm_interface::CallResults; use fluence_keypair::KeyPair; use marine::IValue; -use marine::Marine; -use marine::MarineConfig; -use marine::ModuleDescriptor; +use marine::generic::Marine; +use marine::generic::MarineConfig; +use marine::generic::ModuleDescriptor; +use marine_wasm_backend_traits::WasmBackend; use std::path::PathBuf; -pub struct AVMRunner { - marine: Marine, +pub struct AVMRunner { + marine: Marine, /// file name of the AIR interpreter .wasm wasm_filename: String, /// The memory limit provided by constructor @@ -52,18 +53,19 @@ pub struct AVMMemoryStats { pub allocation_rejects: Option, } -impl AVMRunner { +impl AVMRunner { /// Create AVM with the provided config. - pub fn new( + pub async fn new( air_wasm_path: PathBuf, total_memory_limit: Option, logging_mask: i32, + wasm_backend: WB ) -> RunnerResult { let (wasm_dir, wasm_filename) = split_dirname(air_wasm_path)?; let marine_config = make_marine_config(wasm_dir, &wasm_filename, total_memory_limit, logging_mask); - let marine = Marine::with_raw_config(marine_config)?; + let marine = Marine::with_raw_config(wasm_backend, marine_config).await?; let avm = Self { marine, @@ -76,7 +78,7 @@ impl AVMRunner { #[allow(clippy::too_many_arguments)] #[tracing::instrument(skip_all)] - pub fn call( + pub async fn call( &mut self, air: impl Into, prev_data: impl Into>, @@ -110,7 +112,8 @@ impl AVMRunner { let result = measure!( self.marine - .call_with_ivalues(&self.wasm_filename, "invoke", &args, <_>::default())?, + .call_with_ivalues_async(&self.wasm_filename, "invoke", &args, <_>::default()) + .await?, tracing::Level::INFO, "marine.call_with_ivalues", method = "invoke", @@ -126,7 +129,7 @@ impl AVMRunner { #[allow(clippy::too_many_arguments)] #[tracing::instrument(skip_all)] - pub fn call_tracing( + pub async fn call_tracing( &mut self, air: impl Into, prev_data: impl Into>, @@ -159,12 +162,12 @@ impl AVMRunner { args.push(IValue::U8(tracing_output_mode)); let result = measure!( - self.marine.call_with_ivalues( + self.marine.call_with_ivalues_async( &self.wasm_filename, "invoke_tracing", &args, <_>::default(), - )?, + ).await?, tracing::Level::INFO, "marine.call_with_ivalues", method = "invoke_tracing", @@ -178,15 +181,15 @@ impl AVMRunner { Ok(outcome) } - pub fn to_human_readable_data(&mut self, data: Vec) -> RunnerResult { + pub async fn to_human_readable_data<'this>(&'this mut self, data: Vec) -> RunnerResult { let args = vec![IValue::ByteArray(data)]; - let result = self.marine.call_with_ivalues( + let result = self.marine.call_with_ivalues_async( &self.wasm_filename, "to_human_readable_data", &args, <_>::default(), - )?; + ).await?; let result = try_as_one_value_vec(result)?; let outcome = try_as_string(result, "result").map_err(RunnerError::Aux)?; Ok(outcome) @@ -283,13 +286,13 @@ fn split_dirname(path: PathBuf) -> RunnerResult<(PathBuf, String)> { Ok((path, file_name)) } -fn make_marine_config( +fn make_marine_config( air_wasm_dir: PathBuf, air_wasm_file: &str, total_memory_limit: Option, logging_mask: i32, -) -> MarineConfig { - let air_module_config = marine::MarineModuleConfig { +) -> MarineConfig { + let air_module_config = marine::generic::MarineModuleConfig:: { logger_enabled: true, host_imports: <_>::default(), wasi: None, diff --git a/crates/air-lib/interpreter-data/src/cid_store.rs b/crates/air-lib/interpreter-data/src/cid_store.rs index f5dab3b98f..128a6989df 100644 --- a/crates/air-lib/interpreter-data/src/cid_store.rs +++ b/crates/air-lib/interpreter-data/src/cid_store.rs @@ -188,7 +188,7 @@ mod tests { use super::*; use serde_json::json; - #[test] + #[tokio::test] fn test_iter() { let mut tracker = CidTracker::new(); tracker.track_value(json!("test")).unwrap(); @@ -230,7 +230,7 @@ mod tests { ); } - #[test] + #[tokio::test] fn test_store() { let mut tracker = CidTracker::new(); tracker.track_value(json!("test")).unwrap(); diff --git a/crates/air-lib/interpreter-interface/Cargo.toml b/crates/air-lib/interpreter-interface/Cargo.toml index 159efcc9d8..688e5e67a3 100644 --- a/crates/air-lib/interpreter-interface/Cargo.toml +++ b/crates/air-lib/interpreter-interface/Cargo.toml @@ -15,11 +15,11 @@ name = "air_interpreter_interface" path = "src/lib.rs" [dependencies] -marine-rs-sdk = {version = "0.10.3", optional = true } +marine-rs-sdk = {version = "0.12.0", optional = true } fluence-it-types = { version = "0.4.1", optional = true } air-interpreter-sede = { version = "0.1.0", path = "../interpreter-sede", features = ["msgpack"] } -marine-call-parameters = { version = "0.10.3", default-features = false } +marine-call-parameters = { version = "0.12.0", default-features = false } serde = "1.0.190" serde_json = "1.0.108" serde_bytes = "0.11.12" diff --git a/crates/air-lib/interpreter-sede/Cargo.toml b/crates/air-lib/interpreter-sede/Cargo.toml index db3f0bbf28..d6bb998a16 100644 --- a/crates/air-lib/interpreter-sede/Cargo.toml +++ b/crates/air-lib/interpreter-sede/Cargo.toml @@ -14,7 +14,7 @@ categories = ["wasm"] rmp-serde = { version = "1.1.2", optional = true } serde = { version = "1.0.190" } serde_json = { version = "1.0.108" } -marine-rs-sdk = { version = "0.10.3", optional = true } +marine-rs-sdk = { version = "0.12.0", optional = true } unsigned-varint = { version = "0.8.0", default-features = false, features = ["std"] } thiserror = "1.0.50" serde_bytes = "0.11.12" diff --git a/crates/air-lib/polyplets/Cargo.toml b/crates/air-lib/polyplets/Cargo.toml index e2badfb71d..0b3e6ee0e9 100644 --- a/crates/air-lib/polyplets/Cargo.toml +++ b/crates/air-lib/polyplets/Cargo.toml @@ -15,7 +15,7 @@ name = "polyplets" path = "src/lib.rs" [dependencies] -marine-call-parameters = { version = "0.10.3", default-features = false } +marine-call-parameters = { version = "0.12.0", default-features = false } serde = { version = "1.0.190", features = ["rc", "derive"] } diff --git a/crates/air-lib/test-utils/Cargo.toml b/crates/air-lib/test-utils/Cargo.toml index 81fe519c42..246185c178 100644 --- a/crates/air-lib/test-utils/Cargo.toml +++ b/crates/air-lib/test-utils/Cargo.toml @@ -23,7 +23,7 @@ air-interpreter-sede = { version = "0.1.0", path = "../interpreter-sede" } air-interpreter-signatures = { version = "0.1.7", path = "../interpreter-signatures" } avm-interface = { version = "0.31.2", path = "../../../avm/interface" } avm-server = { version = "0.35.0", path = "../../../avm/server" } -marine-rs-sdk = "0.10.3" +marine-rs-sdk = "0.12.0" object-pool = "0.5.4" once_cell = "1.17.1" @@ -34,8 +34,12 @@ fluence-keypair = "0.10.4" ed25519-dalek = "2.1.0" rand_chacha = "0.3.1" sha2 = "0.10.6" +marine-wasm-backend-traits = {version = "0.5.1", path = "../../../../marine/crates/wasm-backend-traits"} +marine-wasmtime-backend = {version = "0.5.1", path = "../../../../marine/crates/wasmtime-backend"} +futures = "0.3.30" -tokio = {version = "1.28.2", features = ["rt"]} + +tokio = {version = "1.28.2", features = ["rt", "macros"]} [dev-dependencies] maplit = "1.0.2" diff --git a/crates/air-lib/test-utils/src/executed_state.rs b/crates/air-lib/test-utils/src/executed_state.rs index a0b684b4f6..3bbf213da1 100644 --- a/crates/air-lib/test-utils/src/executed_state.rs +++ b/crates/air-lib/test-utils/src/executed_state.rs @@ -405,7 +405,7 @@ mod tests { use air::ExecutionCidState; use serde_json::json; - #[test] + #[tokio::test] fn test_scalar() { assert_eq!(scalar!(42), scalar!(42)); assert_eq!(scalar!("test"), scalar!("test")); @@ -416,7 +416,7 @@ mod tests { ); } - #[test] + #[tokio::test] fn test_scalar_tracked() { let mut store = ExecutionCidState::new(); assert_eq!(scalar_tracked!(42, store), scalar_tracked!(42, store)); diff --git a/crates/air-lib/test-utils/src/native_test_runner.rs b/crates/air-lib/test-utils/src/native_test_runner.rs index 9c10c41db3..6867f0e4ca 100644 --- a/crates/air-lib/test-utils/src/native_test_runner.rs +++ b/crates/air-lib/test-utils/src/native_test_runner.rs @@ -21,20 +21,30 @@ use air_interpreter_sede::ToSerialized; use avm_server::avm_runner::*; use avm_server::into_raw_result; use fluence_keypair::KeyPair; +use futures::future::LocalBoxFuture; +use futures::FutureExt; pub struct NativeAirRunner { current_peer_id: String, } -impl AirRunner for NativeAirRunner { +impl NativeAirRunner { fn new(current_peer_id: impl Into) -> Self { Self { current_peer_id: current_peer_id.into(), } } +} +impl AirRunner for NativeAirRunner { + fn new(current_peer_id: impl Into) -> LocalBoxFuture<'static, Self> { + let current_peer_id = current_peer_id.into(); + async move { + Self::new(current_peer_id) + }.boxed_local() + } - fn call( - &mut self, + fn call<'this>( + &'this mut self, air: impl Into, prev_data: impl Into>, data: impl Into>, @@ -45,35 +55,42 @@ impl AirRunner for NativeAirRunner { call_results: avm_server::CallResults, keypair: &KeyPair, particle_id: String, - ) -> Result> { - // some inner parts transformations - let raw_call_results = into_raw_result(call_results); - let raw_call_results = CallResultsRepr.serialize(&raw_call_results).unwrap(); + ) -> LocalBoxFuture<'this, Result>> { + let air = air.into(); + let prev_data = prev_data.into(); + let data = data.into(); + let init_peer_id = init_peer_id.into(); + let keypair = keypair.clone(); + async move { + // some inner parts transformations + let raw_call_results = into_raw_result(call_results); + let raw_call_results = CallResultsRepr.serialize(&raw_call_results).unwrap(); - let current_peer_id = - override_current_peer_id.unwrap_or_else(|| self.current_peer_id.clone()); + let current_peer_id = + override_current_peer_id.unwrap_or_else(|| self.current_peer_id.clone()); - let key_format = keypair.key_format().into(); - let secret_key_bytes = keypair.secret().unwrap(); + let key_format = keypair.key_format().into(); + let secret_key_bytes = keypair.secret().unwrap(); - let outcome = air::execute_air( - air.into(), - prev_data.into(), - data.into(), - RunParameters { - init_peer_id: init_peer_id.into(), - current_peer_id, - timestamp, - ttl, - key_format, - secret_key_bytes, - particle_id, - }, - raw_call_results, - ); - let outcome = RawAVMOutcome::from_interpreter_outcome(outcome)?; + let outcome = air::execute_air( + air.into(), + prev_data.into(), + data.into(), + RunParameters { + init_peer_id: init_peer_id.into(), + current_peer_id, + timestamp, + ttl, + key_format, + secret_key_bytes, + particle_id, + }, + raw_call_results, + ); + let outcome = RawAVMOutcome::from_interpreter_outcome(outcome)?; - Ok(outcome) + Ok(outcome) + }.boxed_local() } fn get_current_peer_id(&self) -> &str { diff --git a/crates/air-lib/test-utils/src/test_runner.rs b/crates/air-lib/test-utils/src/test_runner.rs index 50ccaa4f8d..b70f4bccd3 100644 --- a/crates/air-lib/test-utils/src/test_runner.rs +++ b/crates/air-lib/test-utils/src/test_runner.rs @@ -28,16 +28,17 @@ use super::CallServiceClosure; use avm_server::avm_runner::*; use fluence_keypair::KeyPair; +use futures::future::LocalBoxFuture; use std::collections::HashMap; use std::collections::HashSet; pub trait AirRunner { - fn new(current_call_id: impl Into) -> Self; + fn new(current_call_id: impl Into) -> LocalBoxFuture<'static, Self>; #[allow(clippy::too_many_arguments)] - fn call( - &mut self, + fn call<'this>( + &'this mut self, air: impl Into, prev_data: impl Into>, data: impl Into>, @@ -48,7 +49,7 @@ pub trait AirRunner { call_results: avm_server::CallResults, key_pair: &KeyPair, particle_id: String, - ) -> Result>; + ) -> LocalBoxFuture<'this, Result>>; fn get_current_peer_id(&self) -> &str; } @@ -69,7 +70,7 @@ pub struct TestRunParameters { } impl TestRunner { - pub fn call( + pub async fn call( &mut self, air: impl Into, prev_data: impl Into>, @@ -106,6 +107,7 @@ impl TestRunner { &self.keypair, particle_id.clone(), ) + .await .map_err(|e| e.to_string())?; next_peer_pks.extend(outcome.next_peer_pks); @@ -130,8 +132,8 @@ impl TestRunner { } #[allow(clippy::too_many_arguments)] - pub fn call_single( - &mut self, + pub async fn call_single<'this>( + &'this mut self, air: impl Into, prev_data: impl Into>, data: impl Into>, @@ -141,7 +143,7 @@ impl TestRunner { override_current_peer_id: Option, call_results: avm_server::CallResults, particle_id: impl Into, - ) -> Result> { + ) -> Result> { self.runner.call( air, prev_data, @@ -153,18 +155,18 @@ impl TestRunner { call_results, &self.keypair, particle_id.into(), - ) + ).await } } -pub fn create_avm( +pub async fn create_avm( call_service: CallServiceClosure, current_peer_id: impl Into, ) -> TestRunner { - create_custom_avm(call_service, current_peer_id) + create_custom_avm(call_service, current_peer_id).await } -pub fn create_custom_avm( +pub async fn create_custom_avm( call_service: CallServiceClosure, current_peer_id: impl Into, ) -> TestRunner { @@ -172,7 +174,7 @@ pub fn create_custom_avm( let (keypair, _) = derive_dummy_keypair(¤t_peer_id); - let runner = R::new(current_peer_id); + let runner = R::new(current_peer_id).await; TestRunner { runner, @@ -181,13 +183,13 @@ pub fn create_custom_avm( } } -pub fn create_avm_with_key( +pub async fn create_avm_with_key( keypair: impl Into, call_service: CallServiceClosure, ) -> TestRunner { let keypair = keypair.into(); let current_peer_id = keypair.public().to_peer_id().to_string(); - let runner = R::new(current_peer_id); + let runner = R::new(current_peer_id).await; TestRunner { runner, @@ -247,7 +249,7 @@ mod tests { use avm_interface::CallRequestParams; use serde_json::json; - #[test] + #[tokio::test] fn test_override_current_peer_id() { let spell_id = "spell_id"; let host_peer_id = "host_peer_id"; diff --git a/crates/air-lib/test-utils/src/wasm_test_runner.rs b/crates/air-lib/test-utils/src/wasm_test_runner.rs index 01bb67e491..8769555c0c 100644 --- a/crates/air-lib/test-utils/src/wasm_test_runner.rs +++ b/crates/air-lib/test-utils/src/wasm_test_runner.rs @@ -17,11 +17,17 @@ use crate::test_runner::AirRunner; use avm_server::avm_runner::*; + use fluence_keypair::KeyPair; use once_cell::sync::OnceCell; +use object_pool::Reusable; +use futures::future::LocalBoxFuture; +use futures::FutureExt; +use marine_wasmtime_backend::WasmtimeWasmBackend; +use marine_wasmtime_backend::WasmtimeConfig; use std::path::PathBuf; -//use object_pool::Reusable; + // 10 Mb const AVM_MAX_HEAP_SIZE: u64 = 10 * 1024 * 1024; @@ -30,52 +36,60 @@ const RELEASE_AIR_WASM_PATH: &str = "../target/wasm32-wasi/release/air_interpret pub struct WasmAirRunner { current_peer_id: String, - runner: object_pool::Reusable<'static, AVMRunner>, + runner: Reusable<'static, AVMRunner>, } -async fn make_pooled_avm_runner() -> AVMRunner { - let logging_mask = i32::MAX; +fn create_wasm_backend() -> WasmtimeWasmBackend { + let mut config = WasmtimeConfig::new(); + config + .debug_info(true) + .epoch_interruption(false) + .wasm_backtrace(true); + + WasmtimeWasmBackend::new(config).unwrap() +} + +async fn make_pooled_avm_runner() -> AVMRunner { + let logging_mask = i32::MAX; + let wasm_backend = create_wasm_backend(); AVMRunner::new( PathBuf::from(AIR_WASM_PATH), Some(AVM_MAX_HEAP_SIZE), logging_mask, + wasm_backend ) .await .expect("vm should be created") } impl AirRunner for WasmAirRunner { - fn new(current_peer_id: impl Into) -> Self { - static POOL_CELL: OnceCell> = OnceCell::new(); - - let pool = POOL_CELL.get_or_init(|| { - object_pool::Pool::new( - // we create an empty pool and let it fill on demand - 0, - || unreachable!(), - ) - }); - - - let runner = match pool.try_pull() { - Some(runner) => runner, - None => { - let rt = tokio::runtime::Runtime::new().unwrap(); - let runner = rt.block_on(make_pooled_avm_runner()); - pool.attach(runner); - pool.try_pull().unwrap() + fn new(current_peer_id: impl Into) -> LocalBoxFuture<'static, Self> { + let current_peer_id = current_peer_id.into(); + async move { + static POOL_CELL: OnceCell>> = OnceCell::new(); + let pool = POOL_CELL.get_or_init(|| { + object_pool::Pool::new( + // we create an empty pool and let it fill on demand + 0, + || unreachable!(), + ) + }); + + let runner = match pool.try_pull() { + Some(runner) => runner, + None => Reusable::new(pool, make_pooled_avm_runner().await) + }; + + Self { + current_peer_id: current_peer_id.into(), + runner, } - }; - - Self { - current_peer_id: current_peer_id.into(), - runner, - } + }.boxed_local() } - fn call( - &mut self, + fn call<'this>( + &'this mut self, air: impl Into, prev_data: impl Into>, data: impl Into>, @@ -86,23 +100,29 @@ impl AirRunner for WasmAirRunner { call_results: avm_server::CallResults, keypair: &KeyPair, particle_id: String, - ) -> Result> { - let current_peer_id = - override_current_peer_id.unwrap_or_else(|| self.current_peer_id.clone()); - - let rt = tokio::runtime::Runtime::new().unwrap(); - Ok(rt.block_on(self.runner.call( - air, - prev_data, - data, - init_peer_id, - timestamp, - ttl, - current_peer_id, - call_results, - keypair, - particle_id, - ))?) + ) -> LocalBoxFuture<'this, Result>> { + let air = air.into(); + let prev_data = prev_data.into(); + let data = data.into(); + let init_peer_id = init_peer_id.into(); + let keypair = keypair.clone(); + async move { + let current_peer_id = + override_current_peer_id.unwrap_or_else(|| self.current_peer_id.clone()); + + Ok(self.runner.call( + air, + prev_data, + data, + init_peer_id, + timestamp, + ttl, + current_peer_id, + call_results, + &keypair, + particle_id, + ).await?) + }.boxed_local() } fn get_current_peer_id(&self) -> &str { @@ -114,29 +134,33 @@ impl AirRunner for WasmAirRunner { pub struct ReleaseWasmAirRunner { current_peer_id: String, // these instances are not cached, as benches create relatively small number of instances - runner: AVMRunner, + runner: AVMRunner, } impl AirRunner for ReleaseWasmAirRunner { - fn new(current_peer_id: impl Into) -> Self { - let logging_mask = i32::MAX; - let rt = tokio::runtime::Runtime::new().unwrap(); - - let runner = rt.block_on(AVMRunner::new( - PathBuf::from(RELEASE_AIR_WASM_PATH), - Some(AVM_MAX_HEAP_SIZE), - logging_mask, - )) - .expect("vm should be created"); - - Self { - current_peer_id: current_peer_id.into(), - runner, - } + fn new(current_peer_id: impl Into) -> LocalBoxFuture<'static, Self> { + let current_peer_id = current_peer_id.into(); + async { + let logging_mask = i32::MAX; + + let wasm_backend = create_wasm_backend(); + let runner = AVMRunner::new( + PathBuf::from(RELEASE_AIR_WASM_PATH), + Some(AVM_MAX_HEAP_SIZE), + logging_mask, + wasm_backend) + .await + .expect("vm should be created"); + + Self { + current_peer_id: current_peer_id.into(), + runner, + } + }.boxed_local() } - fn call( - &mut self, + fn call<'this>( + &'this mut self, air: impl Into, prev_data: impl Into>, data: impl Into>, @@ -147,23 +171,29 @@ impl AirRunner for ReleaseWasmAirRunner { call_results: avm_server::CallResults, keypair: &KeyPair, particle_id: String, - ) -> Result> { - let current_peer_id = + ) -> LocalBoxFuture<'this, Result>> { + let air = air.into(); + let prev_data = prev_data.into(); + let data = data.into(); + let init_peer_id = init_peer_id.into(); + let keypair = keypair.clone(); + async move { + let current_peer_id = override_current_peer_id.unwrap_or_else(|| self.current_peer_id.clone()); - let rt = tokio::runtime::Runtime::new().unwrap(); - Ok(rt.block_on(self.runner.call( - air, - prev_data, - data, - init_peer_id, - timestamp, - ttl, - current_peer_id, - call_results, - keypair, - particle_id, - ))?) + Ok(self.runner.call( + air, + prev_data, + data, + init_peer_id, + timestamp, + ttl, + current_peer_id, + call_results, + &keypair, + particle_id, + ).await?) + }.boxed_local() } fn get_current_peer_id(&self) -> &str { diff --git a/crates/beautifier/src/tests/beautifier.rs b/crates/beautifier/src/tests/beautifier.rs index 920595ca7a..05f3af94d9 100644 --- a/crates/beautifier/src/tests/beautifier.rs +++ b/crates/beautifier/src/tests/beautifier.rs @@ -26,7 +26,7 @@ use crate::{beautify_to_string, Beautifier}; -#[test] +#[tokio::test] fn ap_with_literal() { let script = r#"(ap "some_string" $stream)"#; let output = beautify_to_string(script).unwrap(); @@ -38,7 +38,7 @@ fn ap_with_literal() { ); } -#[test] +#[tokio::test] fn ap_with_number() { let script = "(ap -100 $stream)"; let output = beautify_to_string(script).unwrap(); @@ -50,7 +50,7 @@ fn ap_with_number() { ); } -#[test] +#[tokio::test] fn ap_with_bool() { let script = "(ap true $stream)"; let output = beautify_to_string(script).unwrap(); @@ -62,7 +62,7 @@ fn ap_with_bool() { ); } -#[test] +#[tokio::test] fn ap_with_last_error() { let script = "(ap %last_error%.$.message! $stream)"; let output = beautify_to_string(script).unwrap(); @@ -70,7 +70,7 @@ fn ap_with_last_error() { assert_eq!(output, "ap %last_error%.$.message $stream\n"); } -#[test] +#[tokio::test] fn ap_with_empty_array() { let script = "(ap [] $stream)"; let output = beautify_to_string(script).unwrap(); @@ -78,7 +78,7 @@ fn ap_with_empty_array() { assert_eq!(output, "ap [] $stream\n"); } -#[test] +#[tokio::test] fn ap_with_init_peer_id() { let script = "(ap %init_peer_id% $stream)"; let output = beautify_to_string(script).unwrap(); @@ -86,7 +86,7 @@ fn ap_with_init_peer_id() { assert_eq!(output, "ap %init_peer_id% $stream\n"); } -#[test] +#[tokio::test] fn ap_with_timestamp() { let script = "(ap %timestamp% $stream)"; let output = beautify_to_string(script).unwrap(); @@ -94,7 +94,7 @@ fn ap_with_timestamp() { assert_eq!(output, "ap %timestamp% $stream\n"); } -#[test] +#[tokio::test] fn ap_with_ttl() { let script = r#" (ap %ttl% $stream) @@ -104,7 +104,7 @@ fn ap_with_ttl() { assert_eq!(output, "ap %ttl% $stream\n"); } -#[test] +#[tokio::test] fn seq() { let script = "(seq (null) (null))"; let output = beautify_to_string(script).unwrap(); @@ -117,7 +117,7 @@ null ) } -#[test] +#[tokio::test] fn seq_nested_pre() { let script = "(seq (seq (null) (null)) (null))"; let output = beautify_to_string(script).unwrap(); @@ -131,7 +131,7 @@ null ); } -#[test] +#[tokio::test] fn seq_nested_post() { let script = "(seq (null) (seq (null) (null)))"; let output = beautify_to_string(script).unwrap(); @@ -145,7 +145,7 @@ null ); } -#[test] +#[tokio::test] fn par() { let script = "(par (null) (null))"; let output = beautify_to_string(script).unwrap(); @@ -160,7 +160,7 @@ fn par() { ); } -#[test] +#[tokio::test] fn match_() { let script = r#"(seq (seq @@ -179,7 +179,7 @@ match a b: ); } -#[test] +#[tokio::test] fn mismatch() { let script = r#"(seq (seq @@ -198,7 +198,7 @@ mismatch a b: ); } -#[test] +#[tokio::test] fn fail_last_error() { let script = "(fail %last_error%)"; let output = beautify_to_string(script).unwrap(); @@ -206,7 +206,7 @@ fn fail_last_error() { assert_eq!(output, "fail %last_error%\n"); } -#[test] +#[tokio::test] fn fail_expr() { let script = "(fail var)"; let output = beautify_to_string(script).unwrap(); @@ -214,7 +214,7 @@ fn fail_expr() { assert_eq!(output, "fail var\n"); } -#[test] +#[tokio::test] fn fail_common() { let script = r#"(fail 123 "Message")"#; let output = beautify_to_string(script).unwrap(); @@ -226,7 +226,7 @@ fn fail_common() { ); } -#[test] +#[tokio::test] fn fold_scalar() { let script = r#"(seq (call "it" ("" "") [] var) (fold var i (null)))"#; let output = beautify_to_string(script).unwrap(); @@ -240,7 +240,7 @@ fold var i: ); } -#[test] +#[tokio::test] fn fold_scalar_with_last_instruction() { let script = r#"(seq (call "it" ("" "") [] var) (fold var i (null) (never)))"#; let output = beautify_to_string(script).unwrap(); @@ -256,7 +256,7 @@ last: ); } -#[test] +#[tokio::test] fn fold_stream() { let script = r#"(seq (call "it" ("" "") [] $var) (fold $var i (null)))"#; let output = beautify_to_string(script).unwrap(); @@ -270,7 +270,7 @@ fold $var i: ); } -#[test] +#[tokio::test] fn fold_stream_with_last_instruction() { let script = r#"(seq (call "it" ("" "") [] $var) (fold $var i (never) (null)))"#; let output = beautify_to_string(script).unwrap(); @@ -286,7 +286,7 @@ last: ); } -#[test] +#[tokio::test] fn call_var() { let script = "(call \"{0}\" (\"a\" \"b\") [\"stream_1\" \"stream_2\"] streamvar)"; let output = beautify_to_string(script).unwrap(); @@ -297,7 +297,7 @@ fn call_var() { ); } -#[test] +#[tokio::test] fn call_novar() { let script = r#"(call "{0}" ("a" "b") ["stream_1" "stream_2"])"#; let output = beautify_to_string(script).unwrap(); @@ -309,7 +309,7 @@ fn call_novar() { ); } -#[test] +#[tokio::test] fn call_noargs() { let script = r#"(call "{0}" ("a" "b") [])"#; let output = beautify_to_string(script).unwrap(); @@ -321,7 +321,7 @@ fn call_noargs() { ); } -#[test] +#[tokio::test] fn next() { let script = r#"(seq (call "{0}" ("a" "b") ["stream_1"] j) (fold j i (next i)))"#; let output = beautify_to_string(script).unwrap(); @@ -335,7 +335,7 @@ fold j i: ); } -#[test] +#[tokio::test] fn new() { let script = "(new var (seq (null) (null)))"; let output = beautify_to_string(script).unwrap(); @@ -349,7 +349,7 @@ fn new() { ); } -#[test] +#[tokio::test] fn null() { let script = "(null)"; let output = beautify_to_string(script).unwrap(); @@ -357,7 +357,7 @@ fn null() { assert_eq!(output, "null\n"); } -#[test] +#[tokio::test] fn custom_indent_step() { let mut output = vec![]; let mut beautifier = Beautifier::new_with_indent(&mut output, 2); @@ -374,7 +374,7 @@ fn custom_indent_step() { ); } -#[test] +#[tokio::test] fn deeply_nested() { let script = include_str!("deeply_nested.air"); let output = beautify_to_string(script).unwrap(); @@ -382,7 +382,7 @@ fn deeply_nested() { assert_eq!(output, expected); } -#[test] +#[tokio::test] fn fail_error() { let script = r#"(fail :error:)"#; let output = beautify_to_string(script).unwrap(); diff --git a/crates/beautifier/src/tests/mod.rs b/crates/beautifier/src/tests/mod.rs index ddf145c23b..9d59e6001c 100644 --- a/crates/beautifier/src/tests/mod.rs +++ b/crates/beautifier/src/tests/mod.rs @@ -28,7 +28,7 @@ mod beautifier; use crate::{beautify, beautify_to_string, BeautifyError}; -#[test] +#[tokio::test] fn beautify_valid() { let air_script = "(seq (null) (null))"; let mut buffer = vec![]; @@ -37,7 +37,7 @@ fn beautify_valid() { assert_eq!(std::str::from_utf8(&buffer).unwrap(), "null\nnull\n"); } -#[test] +#[tokio::test] fn beautify_invalid() { let air_script = "(seq (null))"; let mut buffer = vec![]; @@ -45,14 +45,14 @@ fn beautify_invalid() { assert!(matches!(res, Err(BeautifyError::Parse(_)))); } -#[test] +#[tokio::test] fn beautify_to_string_valid() { let air_script = "(seq (null) (null))"; let res = beautify_to_string(air_script).unwrap(); assert_eq!(res, "null\nnull\n"); } -#[test] +#[tokio::test] fn beautify_to_string_invalid() { let air_script = "(seq (null))"; let res = beautify_to_string(air_script); diff --git a/crates/testing-framework/src/asserts/behavior.rs b/crates/testing-framework/src/asserts/behavior.rs index bf104dcc8e..fb90837e49 100644 --- a/crates/testing-framework/src/asserts/behavior.rs +++ b/crates/testing-framework/src/asserts/behavior.rs @@ -86,7 +86,7 @@ impl Behavior { mod tests { use super::*; - #[test] + #[tokio::test] fn test_parse_behavior_echo() { let res = parse_behaviour("echo"); assert_eq!( @@ -97,31 +97,31 @@ mod tests { ); } - #[test] + #[tokio::test] fn test_parse_behavior_unit() { let res = parse_behaviour("unit"); assert_eq!(res, Ok(("", Behavior::Unit))); } - #[test] + #[tokio::test] fn test_parse_behavior_service() { let res = parse_behaviour("service"); assert_eq!(res, Ok(("", Behavior::Service))); } - #[test] + #[tokio::test] fn test_parse_behavior_function() { let res = parse_behaviour("function"); assert_eq!(res, Ok(("", Behavior::Function))); } - #[test] + #[tokio::test] fn test_parse_behavior_arg() { let res = parse_behaviour("arg.42"); assert_eq!(res, Ok(("", Behavior::Arg(42)))); } - #[test] + #[tokio::test] fn test_parse_behavior_tetraplet() { let res = parse_behaviour("tetraplet"); assert_eq!(res, Ok(("", Behavior::Tetraplet))); diff --git a/crates/testing-framework/src/asserts/parser.rs b/crates/testing-framework/src/asserts/parser.rs index 6b170db14b..08d7a6bbb3 100644 --- a/crates/testing-framework/src/asserts/parser.rs +++ b/crates/testing-framework/src/asserts/parser.rs @@ -119,19 +119,19 @@ mod tests { use pretty_assertions::assert_eq; use serde_json::json; - #[test] + #[tokio::test] fn test_parse_empty() { let res = ServiceDefinition::from_str(""); assert!(res.is_err()); } - #[test] + #[tokio::test] fn test_parse_garbage0() { let res = ServiceDefinition::from_str("garbage"); assert!(res.is_err(), "{}", "{res:?}"); } - #[test] + #[tokio::test] fn test_result_service() { use serde_json::json; @@ -142,13 +142,13 @@ mod tests { ); } - #[test] + #[tokio::test] fn test_result_service_malformed() { let res = ServiceDefinition::from_str(r#"ok={"this":["is","value"]"#); assert!(res.is_err()); } - #[test] + #[tokio::test] fn test_call_result() { use serde_json::json; @@ -161,19 +161,19 @@ mod tests { ); } - #[test] + #[tokio::test] fn test_call_result_malformed() { let res = ServiceDefinition::from_str(r#"err={"retcode": 0, "result": [1, 2, 3]}"#); assert!(res.is_err()); } - #[test] + #[tokio::test] fn test_call_result_invalid() { let res = ServiceDefinition::from_str(r#"err={"ret_code": 0, "result": 1, 2, 3]}"#); assert!(res.is_err()); } - #[test] + #[tokio::test] fn test_seq_ok() { use serde_json::json; @@ -188,20 +188,20 @@ mod tests { ); } - #[test] + #[tokio::test] fn test_seq_ok_malformed() { let res = ServiceDefinition::from_str(r#"seq_ok={"default": 42, "1": true, "3": ]}"#); assert!(res.is_err()); } - #[test] + #[tokio::test] fn test_seq_ok_invalid() { // TODO perhaps, we should support both arrays and maps let res = ServiceDefinition::from_str(r#"seq_ok=[42, 43]"#); assert!(res.is_err()); } - #[test] + #[tokio::test] fn test_seq_error() { use serde_json::json; @@ -218,32 +218,32 @@ mod tests { ); } - #[test] + #[tokio::test] fn test_seq_error_malformed() { let res = ServiceDefinition::from_str(r#"seq_error={"default": 42, "1": true]}"#); assert!(res.is_err()); } - #[test] + #[tokio::test] fn test_seq_error_invalid() { // TODO perhaps, we should support both arrays and maps let res = ServiceDefinition::from_str(r#"seq_error=[42, 43]"#); assert!(res.is_err()); } - #[test] + #[tokio::test] fn test_behaviour() { let res = ServiceDefinition::from_str(r#"behaviour=echo"#); assert_eq!(res, Ok(ServiceDefinition::Behaviour(Behavior::Echo)),); } - #[test] + #[tokio::test] fn test_dbg_behaviour() { let res = ServiceDefinition::from_str(r#"dbg_behaviour=echo"#); assert_eq!(res, Ok(ServiceDefinition::DbgBehaviour(Behavior::Echo)),); } - #[test] + #[tokio::test] fn test_map() { let res = ServiceDefinition::from_str(r#"map = {"42": [], "a": 2}"#); assert_eq!( @@ -255,7 +255,7 @@ mod tests { ); } - #[test] + #[tokio::test] fn test_composable() { use nom::bytes::complete::tag; use nom::multi::separated_list1; diff --git a/crates/testing-framework/src/ephemeral/neighborhood.rs b/crates/testing-framework/src/ephemeral/neighborhood.rs index ec2a8d3ef9..9ca3ff94b6 100644 --- a/crates/testing-framework/src/ephemeral/neighborhood.rs +++ b/crates/testing-framework/src/ephemeral/neighborhood.rs @@ -235,7 +235,7 @@ mod tests { use std::{iter::FromIterator, rc::Rc}; - #[test] + #[tokio::test] fn test_empty_neighborhood() { let peer_name = "someone"; let other_name = "other1"; @@ -250,7 +250,7 @@ mod tests { assert!(!penv.is_reachable(&other_id)); } - #[test] + #[tokio::test] fn test_no_self_disconnect() { let peer_name = "someone"; let other_name = "other1"; @@ -276,7 +276,7 @@ mod tests { assert!(!penv.is_reachable(&other_id)); } - #[test] + #[tokio::test] fn test_set_neighborhood() { let peer_name = "someone"; let other_name1 = "other1"; @@ -299,7 +299,7 @@ mod tests { assert_eq!(penv.iter().collect::(), expected_neighborhood); } - #[test] + #[tokio::test] fn test_insert() { let peer_name = "someone"; let other_name1 = "other1"; @@ -322,7 +322,7 @@ mod tests { assert_eq!(PeerSet::from_iter(penv.iter()), expected_neighborhood); } - #[test] + #[tokio::test] fn test_ensure() { let peer_name = "someone"; let other_name1 = "other1"; @@ -346,7 +346,7 @@ mod tests { assert_eq!(PeerSet::from_iter(penv.iter()), expected_neighborhood); } - #[test] + #[tokio::test] fn test_insert_insert() { let peer_name = "someone"; let other_name1 = "other1"; @@ -368,7 +368,7 @@ mod tests { assert_eq!(penv.iter().collect::>(), expected_neighborhood); } - #[test] + #[tokio::test] fn test_extend_neighborhood() { let peer_name = "peer"; let (peer_pk, _peer_id) = derive_dummy_keypair(peer_name); @@ -386,7 +386,7 @@ mod tests { ); } - #[test] + #[tokio::test] fn test_remove_from_neiborhood() { let network = Network::::new(std::iter::empty::(), vec![]); let (peer_pk, _peer_id) = derive_dummy_keypair("someone"); @@ -404,7 +404,7 @@ mod tests { }, ); } - #[test] + #[tokio::test] fn test_fail() { let peer_name = "someone"; let other_name1 = "other1"; @@ -423,7 +423,7 @@ mod tests { assert!(!penv.is_reachable(&other_id)); } - #[test] + #[tokio::test] fn test_fail_remove() { let peer_name = "someone"; let other_name1 = "other1"; @@ -448,7 +448,7 @@ mod tests { assert!(!penv.is_reachable(&other_id)); } - #[test] + #[tokio::test] fn test_fail_unfail() { let peer_name = "someone"; let other_name1 = "other1"; @@ -468,7 +468,7 @@ mod tests { assert!(penv.is_reachable(&other_id)); } - #[test] + #[tokio::test] fn test_failed() { let peer_name = "someone"; let other_name = "other1"; diff --git a/crates/testing-framework/src/execution/mod.rs b/crates/testing-framework/src/execution/mod.rs index 18293ca351..2c9bbf1802 100644 --- a/crates/testing-framework/src/execution/mod.rs +++ b/crates/testing-framework/src/execution/mod.rs @@ -172,7 +172,7 @@ mod tests { use std::cell::RefCell; - #[test] + #[tokio::test] fn test_execution() { let peer1_name = "peer1"; let peer2_name = "peer2"; @@ -211,7 +211,7 @@ mod tests { assert_eq!(outcome2.ret_code, 0); } - #[test] + #[tokio::test] fn test_call_result_success() { let exec = AirScriptExecutor::::new( TestRunParameters::from_init_peer_id("init_peer_id"), @@ -240,7 +240,7 @@ mod tests { assert!(exec.execution_iter("peer1").unwrap().next().is_none()); } - #[test] + #[tokio::test] fn test_call_result_error() { let script = r#" (seq @@ -280,7 +280,7 @@ mod tests { assert_eq!(results2.len(), 0); } - #[test] + #[tokio::test] fn test_seq_ok() { let init_peer_name = "init_peer_id"; let peer1_name = "peer1"; @@ -384,7 +384,7 @@ mod tests { } } - #[test] + #[tokio::test] fn test_map() { let peer1_name = "peer1"; let peer2_name = "peer2"; @@ -461,7 +461,7 @@ mod tests { } } - #[test] + #[tokio::test] #[should_panic] fn test_map_no_arg() { let peer1_name = "peer1"; @@ -480,7 +480,7 @@ mod tests { let _result_init: Vec<_> = exec.execution_iter(peer1_name).unwrap().collect(); } - #[test] + #[tokio::test] fn test_seq_error() { let init_peer_name = "init_peer_id"; let peer1_name = "peer1"; @@ -587,7 +587,7 @@ mod tests { } } - #[test] + #[tokio::test] fn test_echo() { let init_peer_name = "init_peer_id"; let peer1_name = "peer1"; @@ -637,7 +637,7 @@ mod tests { ) } - #[test] + #[tokio::test] fn test_transformed_distinct() { let peer_name = "peer1"; let network = Network::::new(std::iter::empty::(), vec![]); @@ -687,7 +687,7 @@ mod tests { ); } - #[test] + #[tokio::test] fn test_transformed_shared() { struct Service { state: RefCell>, @@ -746,7 +746,7 @@ mod tests { ); } - #[test] + #[tokio::test] fn test_invalid_air() { let res = AirScriptExecutor::::new( TestRunParameters::from_init_peer_id("init_peer_id"), @@ -799,7 +799,7 @@ mod tests { ) } - #[test] + #[tokio::test] fn test_behaviour_service() { let peer_name = "peer1"; let air_script = @@ -807,7 +807,7 @@ mod tests { run_behaviour_service(peer_name, air_script) } - #[test] + #[tokio::test] fn test_dbg_behaviour_service() { let peer_name = "peer1"; let air_script = &format!( @@ -844,7 +844,7 @@ mod tests { ) } - #[test] + #[tokio::test] fn test_behaviour_function() { let peer_name = "peer1"; let air_script = @@ -852,7 +852,7 @@ mod tests { run_behaviour_function(peer_name, air_script) } - #[test] + #[tokio::test] fn test_dbg_behaviour_function() { let peer_name = "peer1"; let air_script = &format!( @@ -889,7 +889,7 @@ mod tests { ) } - #[test] + #[tokio::test] fn test_behaviour_arg() { let peer_name = "peer1"; let air_script = @@ -898,7 +898,7 @@ mod tests { run_behaviour_arg(peer_name, air_script) } - #[test] + #[tokio::test] fn test_dbg_behaviour_arg() { let peer_name = "peer1"; let air_script = @@ -947,7 +947,7 @@ mod tests { ) } - #[test] + #[tokio::test] fn test_behaviour_tetraplet() { let peer_name = "peer1"; let air_script = @@ -955,7 +955,7 @@ mod tests { run_behaviour_tetraplet(peer_name, air_script) } - #[test] + #[tokio::test] fn test_dbg_behaviour_tetraplet() { let peer_name = "peer1"; let air_script = &format!( diff --git a/crates/testing-framework/src/transform/mod.rs b/crates/testing-framework/src/transform/mod.rs index 8417e27aaa..25fcdba9ca 100644 --- a/crates/testing-framework/src/transform/mod.rs +++ b/crates/testing-framework/src/transform/mod.rs @@ -130,21 +130,21 @@ mod tests { use std::str::FromStr; - #[test] + #[tokio::test] fn test_parse_fmt_call() { let sexp_str = r#"(call "my_id" ("serv" "function") [other_peer_id "other_arg"])"#; let sexp = Sexp::from_str(sexp_str).unwrap(); assert_eq!(format!("{sexp}"), sexp_str); } - #[test] + #[tokio::test] fn test_parse_fmt_call_var() { let sexp_str = r#"(call "my_id" ("serv" "function") [other_peer_id "other_arg"] var)"#; let sexp = Sexp::from_str(sexp_str).unwrap(); assert_eq!(format!("{sexp}"), sexp_str); } - #[test] + #[tokio::test] fn test_parse_canon() { let sexp_str = r#"(canon "my_id" $stream #canon)"#; let sexp = Sexp::from_str(sexp_str).unwrap(); @@ -158,21 +158,21 @@ mod tests { ); } - #[test] + #[tokio::test] fn test_parse_fmt_symbol() { let sexp_str = "symbol"; let sexp = Sexp::from_str(sexp_str).unwrap(); assert_eq!(format!("{sexp}"), sexp_str); } - #[test] + #[tokio::test] fn test_parse_fmt_string() { let sexp_str = r#""my_id""#; let sexp = Sexp::from_str(sexp_str).unwrap(); assert_eq!(format!("{sexp}"), sexp_str); } - #[test] + #[tokio::test] fn test_parse_fmt_sexp() { let sexp_str = r#"(par (ap x y) (fold x y (next)))"#; let sexp = Sexp::from_str(sexp_str).unwrap(); diff --git a/crates/testing-framework/src/transform/parser.rs b/crates/testing-framework/src/transform/parser.rs index 11991e6112..c406877ea8 100644 --- a/crates/testing-framework/src/transform/parser.rs +++ b/crates/testing-framework/src/transform/parser.rs @@ -358,121 +358,121 @@ mod tests { use pretty_assertions::assert_eq; use serde_json::json; - #[test] + #[tokio::test] fn test_multispace0_empty() { let res = sexp_multispace0::<_, ()>(""); assert!(res.is_ok(), "{}", res.unwrap_err()); } - #[test] + #[tokio::test] fn test_multispace0_spaces() { let res = sexp_multispace0::<_, ()>(" "); assert!(res.is_ok(), "{}", res.unwrap_err()); } - #[test] + #[tokio::test] fn test_multispace0_comment() { let res = sexp_multispace0::<_, ()>(";; this is comment"); assert!(res.is_ok(), "{}", res.unwrap_err()); } - #[test] + #[tokio::test] fn test_multispace0_comment_with_space() { let res = sexp_multispace0::<_, ()>(" ;; "); assert!(res.is_ok(), "{}", res.unwrap_err()); } - #[test] + #[tokio::test] fn test_multispace0_multiline() { let res = sexp_multispace0::<_, ()>(" ;; \n ;;;; \n "); assert!(res.is_ok(), "{}", res.unwrap_err()); } - #[test] + #[tokio::test] fn test_multispace1_empty() { let res = sexp_multispace1("".into()); assert!(res.is_err()); } - #[test] + #[tokio::test] fn test_multispace1_space() { let res = sexp_multispace1(" ".into()); assert!(res.is_ok(), "{}", res.unwrap_err()); } - #[test] + #[tokio::test] fn test_multispace1_comment() { let res = sexp_multispace1(" ;; ".into()); assert!(res.is_ok(), "{}", res.unwrap_err()); } - #[test] + #[tokio::test] fn test_multispace1_multiline() { let res = sexp_multispace1(" ;; \n ;;;; \n ".into()); assert!(res.is_ok(), "{}", res.unwrap_err()); } - #[test] + #[tokio::test] fn test_symbol() { let res = Sexp::from_str("symbol"); assert_eq!(res, Ok(Sexp::symbol("symbol"))); } - #[test] + #[tokio::test] fn test_symbol_lambda() { let res = Sexp::from_str("sym_bol.$.blabla"); assert_eq!(res, Ok(Sexp::symbol("sym_bol.$.blabla"))); } - #[test] + #[tokio::test] fn test_symbol_lambda_exclamation() { let res = Sexp::from_str("pid-num.$.[0]!"); assert_eq!(res, Ok(Sexp::symbol("pid-num.$.[0]!"))); } - #[test] + #[tokio::test] fn test_symbol_stream() { let res = Sexp::from_str("$stream"); assert_eq!(res, Ok(Sexp::symbol("$stream"))); } - #[test] + #[tokio::test] fn test_symbol_canon() { let res = Sexp::from_str("#canon"); assert_eq!(res, Ok(Sexp::symbol("#canon"))); } - #[test] + #[tokio::test] fn test_symbol_lambda2() { let res = Sexp::from_str(r#"$result.$[0]"#); assert_eq!(res, Ok(Sexp::symbol(r#"$result.$[0]"#))); } - #[test] + #[tokio::test] fn test_string_empty() { let res = Sexp::from_str(r#""""#); assert_eq!(res, Ok(Sexp::string(""))); } - #[test] + #[tokio::test] fn test_string() { let res = Sexp::from_str(r#""str ing""#); assert_eq!(res, Ok(Sexp::string("str ing"))); } - #[test] + #[tokio::test] fn test_empty_list() { let res = Sexp::from_str("()"); assert_eq!(res, Ok(Sexp::List(vec![]))); } - #[test] + #[tokio::test] fn test_small_list() { let res = Sexp::from_str("(null)"); assert_eq!(res, Ok(Sexp::list(vec![Sexp::symbol("null")]))); } - #[test] + #[tokio::test] fn test_call_no_args() { let res = Sexp::from_str(r#"(call peer_id ("serv" "func") [])"#); assert_eq!( @@ -493,7 +493,7 @@ mod tests { ); } - #[test] + #[tokio::test] fn test_call_after_call() { let res = Sexp::from_str( r#"(seq @@ -535,7 +535,7 @@ mod tests { ); } - #[test] + #[tokio::test] fn test_call_annotation_newline() { let res = Sexp::from_str( r#"(seq (call peer_id ("serv" "func") []) @@ -548,7 +548,7 @@ mod tests { ); } - #[test] + #[tokio::test] fn test_call_args1() { let res = Sexp::from_str(r#"(call peer_id ("serv" "func") [a])"#); assert_eq!( @@ -569,7 +569,7 @@ mod tests { ); } - #[test] + #[tokio::test] fn test_call_args2() { let res = Sexp::from_str(r#"(call peer_id ("serv" "func") [a b])"#); assert_eq!( @@ -590,7 +590,7 @@ mod tests { ); } - #[test] + #[tokio::test] fn test_call_var() { let res = Sexp::from_str(r#"(call peer_id ("serv" "func") [a b] var)"#); assert_eq!( @@ -611,7 +611,7 @@ mod tests { ); } - #[test] + #[tokio::test] fn test_call_with_annotation() { let res = Sexp::from_str(r#"(call peer_id ("serv" "func") [a b] var) ; ok=42 "#); let expected_annotation = ServiceDefinition::Ok(json!(42)); @@ -633,7 +633,7 @@ mod tests { ); } - #[test] + #[tokio::test] fn test_call_with_annotation2() { let res = Sexp::from_str( r#"(par @@ -643,7 +643,7 @@ mod tests { assert!(res.is_ok(), "{}", "{res:?}"); } - #[test] + #[tokio::test] fn test_generic_sexp() { let res = Sexp::from_str(" (fold i n ( par (null) (match y \"asdf\" (fail ))) )"); assert_eq!( @@ -666,13 +666,13 @@ mod tests { ); } - #[test] + #[tokio::test] fn test_trailing_error() { let res = Sexp::from_str("(null))"); assert!(res.is_err(), "{}", "{res:?}"); } - #[test] + #[tokio::test] fn test_incomplete_string() { let err = Sexp::from_str( r#"(seq @@ -688,7 +688,7 @@ mod tests { ); } - #[test] + #[tokio::test] fn test_incomplete_list() { let err = Sexp::from_str( r#"(seq @@ -704,49 +704,49 @@ mod tests { ); } - #[test] + #[tokio::test] fn test_parse_fmt_call() { let sexp_str = r#"(call "my_id" ("serv" "function") [other_peer_id "other_arg"])"#; let sexp = Sexp::from_str(sexp_str).unwrap(); assert_eq!(format!("{sexp}"), sexp_str); } - #[test] + #[tokio::test] fn test_parse_fmt_call_var() { let sexp_str = r#"(call "my_id" ("serv" "function") [other_peer_id "other_arg"] var)"#; let sexp = Sexp::from_str(sexp_str).unwrap(); assert_eq!(format!("{sexp}"), sexp_str); } - #[test] + #[tokio::test] fn test_parse_fmt_symbol() { let sexp_str = "symbol"; let sexp = Sexp::from_str(sexp_str).unwrap(); assert_eq!(format!("{sexp}"), sexp_str); } - #[test] + #[tokio::test] fn test_parse_fmt_string() { let sexp_str = r#""my_id""#; let sexp = Sexp::from_str(sexp_str).unwrap(); assert_eq!(format!("{sexp}"), sexp_str); } - #[test] + #[tokio::test] fn test_parse_fmt_sexp() { let sexp_str = r#"(par (ap x y) (fold x y (next)))"#; let sexp = Sexp::from_str(sexp_str).unwrap(); assert_eq!(format!("{sexp}"), sexp_str); } - #[test] + #[tokio::test] fn test_canon_syntax() { let sexp_str = r#"(seq (canon peer_id $stream #canon) (fold #canon i (next)))"#; let res = Sexp::from_str(sexp_str); assert!(res.is_ok(), "{}", "{res:?}"); } - #[test] + #[tokio::test] fn test_comments() { let sexp_str = r#" ;; One comment ( ;;; Second comment @@ -779,7 +779,7 @@ mod tests { ); } - #[test] + #[tokio::test] fn test_annotation_multiline() { let multiline_annotation = r#" #| map = { @@ -789,7 +789,7 @@ mod tests { assert!(res.is_ok(), "{}", "{res:?}"); } - #[test] + #[tokio::test] fn test_annotation_multiline_with_call() { let sexp_str = r#"(call "peer_id" ("serv" "func") [a b] var) #| map = { @@ -819,7 +819,7 @@ mod tests { ); } - #[test] + #[tokio::test] fn test_annotation_multiline_with_many_calls() { let sexp_str = r#"(seq (call "peer_id" ("serv" "func") [a b] var) #| @@ -868,7 +868,7 @@ mod tests { ); } - #[test] + #[tokio::test] fn test_call_with_annotation_last_form() { let res = Sexp::from_str( r#"(par @@ -909,7 +909,7 @@ mod tests { ])) ); } - #[test] + #[tokio::test] fn test_call_with_annotation_last_form_multiline() { let res = Sexp::from_str( r#"(par @@ -954,7 +954,7 @@ mod tests { ); } - #[test] + #[tokio::test] fn test_canon_var_peer() { let res = Sexp::from_str(r#"(canon peer $stream #canon)"#); @@ -971,7 +971,7 @@ mod tests { ) } - #[test] + #[tokio::test] fn test_canon_string_peer() { let res = Sexp::from_str(r#"(canon "peer" $stream #canon)"#); @@ -988,7 +988,7 @@ mod tests { ) } - #[test] + #[tokio::test] fn test_canon_error_no_peer() { let res = Sexp::from_str(r#"(canon )"#); assert_eq!( @@ -1000,7 +1000,7 @@ mod tests { ); } - #[test] + #[tokio::test] fn test_canon_error_no_stream() { let res = Sexp::from_str(r#"(canon peer )"#); assert_eq!( @@ -1012,7 +1012,7 @@ mod tests { ); } - #[test] + #[tokio::test] fn test_canon_error_no_target() { let res = Sexp::from_str(r#"(canon peer $stream )"#); assert_eq!( @@ -1024,7 +1024,7 @@ mod tests { ); } - #[test] + #[tokio::test] fn test_canon_error_wrong_stream() { let res = Sexp::from_str(r#"(canon peer "$stream" #canon)"#); assert_eq!( @@ -1036,7 +1036,7 @@ mod tests { ); } - #[test] + #[tokio::test] fn test_canon_error_wrong_target() { let res = Sexp::from_str(r##"(canon peer $stream "#canon" )"##); assert_eq!( diff --git a/crates/testing-framework/src/transform/walker.rs b/crates/testing-framework/src/transform/walker.rs index 96cc227d29..19143efdf5 100644 --- a/crates/testing-framework/src/transform/walker.rs +++ b/crates/testing-framework/src/transform/walker.rs @@ -154,14 +154,14 @@ mod tests { } } - #[test] + #[tokio::test] fn test_translate_null() { let network = Network::::new(std::iter::empty::(), vec![]); let transformed = TransformedAirScript::new("(null)", network).unwrap(); assert_eq!(&*transformed, "(null)"); } - #[test] + #[tokio::test] fn test_translate_call_no_result() { let network = Network::::new(std::iter::empty::(), vec![]); let script = r#"(call peer_id ("service_id" func) [])"#; @@ -169,7 +169,7 @@ mod tests { assert_eq!(&*transformed, script); } - #[test] + #[tokio::test] #[should_panic] fn test_translate_call_no_string() { let network = Network::::new(std::iter::empty::(), vec![]); @@ -178,7 +178,7 @@ mod tests { assert_eq!(transformed.as_deref(), Ok(script)); } - #[test] + #[tokio::test] fn test_translate_call_result() { let network = Network::::new(std::iter::empty::(), vec![]); let script = r#"(call "peer_id" ("service_id" func) []) ; ok = 42"#; @@ -206,7 +206,7 @@ mod tests { ); } - #[test] + #[tokio::test] fn test_translate_multiple_calls() { let script = r#"(seq (call peer_id ("service_id" func) [a 11]) ; ok={"test":"me"} @@ -243,7 +243,7 @@ mod tests { assert!(network.get_peers().collect::>().is_empty()); } - #[test] + #[tokio::test] fn test_peers() { // this script is not correct AIR, but our parser handles it let script = r#"(seq @@ -288,7 +288,7 @@ mod tests { assert_eq!(*t, expected); } - #[test] + #[tokio::test] fn test_at_transform() { let script = r#"(call "peer_id1" ("service_id" "func") [1 @"peer_id3"] x) ; ok={"test":@"peer_id2"}"#; diff --git a/tools/cli/air/Cargo.toml b/tools/cli/air/Cargo.toml index 082430cb46..07a6751a3b 100644 --- a/tools/cli/air/Cargo.toml +++ b/tools/cli/air/Cargo.toml @@ -32,12 +32,15 @@ termcolor = "1.2.0" fluence-keypair = "0.10.4" bs58 = "0.5.0" zeroize = "1.6.0" +marine-wasmtime-backend = {version = "0.5.1", path = "../../../../marine/crates/wasmtime-backend"} +tokio = { version = "1", features = ["rt", "macros"] } +futures = "0.3.30" + # near # alpha version is used because older versions depend on # the parity-secp256k1 crate which is yanked near-sdk = { version = "5.0.0-alpha.1", optional = true } -tokio = { version = "1", features = ["rt"], optional = true } workspaces = { version = "0.7.0", optional = true } # risc-0 @@ -46,11 +49,11 @@ workspaces = { version = "0.7.0", optional = true } # zk-aquavm-interface = { path = "../../../crates/risc-0/core", version = "0.1.0", optional = true } [features] -default = ["wasm", "dep:tokio"] +default = ["wasm"] wasm = ["air-test-utils"] gen_signatures = ["aquavm-air/gen_signatures"] check_signatures = ["aquavm-air/check_signatures"] -near = [ "dep:near-sdk", "dep:tokio", "dep:workspaces" ] +near = [ "dep:near-sdk", "dep:workspaces" ] # risc0 = [ "dep:risc0-zkvm", "dep:zk-aquavm-methods", "dep:zk-aquavm-interface" ] [[bin]] diff --git a/tools/cli/air/src/data.rs b/tools/cli/air/src/data.rs index 557b29b6c7..31a5755088 100644 --- a/tools/cli/air/src/data.rs +++ b/tools/cli/air/src/data.rs @@ -72,7 +72,7 @@ pub(crate) struct Args { input: PathBuf, } -pub(crate) fn to_human_readable_data(args: Args) -> Result<(), Box> { +pub(crate) async fn to_human_readable_data(args: Args) -> Result<(), Box> { init_tracing("warn"); let data: Vec = load_data(&args.input)?; @@ -81,8 +81,11 @@ pub(crate) fn to_human_readable_data(args: Args) -> Result<(), Box, _air_interpreter_wasm_path: &Path, ) -> anyhow::Result> { @@ -111,6 +114,7 @@ fn create_runner( #[cfg(feature = "wasm")] Mode::Wasm => { crate::trace::run::wasm::create_wasm_avm_runner(_air_interpreter_wasm_path, None) + .await .context("Failed to instantiate WASM AVM")? as _ } }; diff --git a/tools/cli/air/src/main.rs b/tools/cli/air/src/main.rs index be696fe029..ee47660b1f 100644 --- a/tools/cli/air/src/main.rs +++ b/tools/cli/air/src/main.rs @@ -51,12 +51,13 @@ enum Subcommand { Stats(self::trace::stats::Args), } -fn main() -> Result<(), Box> { +#[tokio::main] +async fn main() -> Result<(), Box> { let args = Cli::parse(); match args.subcommand { Subcommand::Beautify(args) => self::beautify::beautify(args)?, - Subcommand::Data(args) => self::data::to_human_readable_data(args)?, - Subcommand::Run(args) => self::trace::run::run(args)?, + Subcommand::Data(args) => self::data::to_human_readable_data(args).await?, + Subcommand::Run(args) => self::trace::run::run(args).await?, Subcommand::Stats(args) => self::trace::stats::stats(args)?, } Ok(()) diff --git a/tools/cli/air/src/trace/run.rs b/tools/cli/air/src/trace/run.rs index cd01002a13..4a194f5da0 100644 --- a/tools/cli/air/src/trace/run.rs +++ b/tools/cli/air/src/trace/run.rs @@ -168,7 +168,7 @@ enum Mode { Risc0, } -pub(crate) fn run(args: Args) -> anyhow::Result<()> { +pub(crate) async fn run(args: Args) -> anyhow::Result<()> { let tracing_json = (!args.json) as u8; #[cfg(feature = "wasm")] let global_tracing_params = if args.mode.wasm { @@ -186,7 +186,7 @@ pub(crate) fn run(args: Args) -> anyhow::Result<()> { &args.air_interpreter_path, &args.air_near_contract_path, args.max_heap_size, - )?; + ).await?; let execution_data = match &args.source { Source::Anomaly(anomaly) => data::anomaly::load(anomaly)?, @@ -218,6 +218,7 @@ pub(crate) fn run(args: Args) -> anyhow::Result<()> { &key_pair, particle.particle_id.clone().into_owned(), ) + .await .context("Failed to execute the script")?; if args.repeat.is_none() { println!("{result:?}"); @@ -230,7 +231,7 @@ pub(crate) fn run(args: Args) -> anyhow::Result<()> { Ok(()) } -fn create_runner( +async fn create_runner( mode: Option, _air_interpreter_wasm_path: &Path, _air_contract_wasm_path: &Path, @@ -248,6 +249,7 @@ fn create_runner( #[cfg(feature = "wasm")] Mode::Wasm => { self::wasm::create_wasm_avm_runner(_air_interpreter_wasm_path, _max_heap_size) + .await .context("Failed to instantiate WASM AVM")? as _ } #[cfg(feature = "near")] diff --git a/tools/cli/air/src/trace/run/native.rs b/tools/cli/air/src/trace/run/native.rs index 92c84e36ee..49b0195ea1 100644 --- a/tools/cli/air/src/trace/run/native.rs +++ b/tools/cli/air/src/trace/run/native.rs @@ -20,14 +20,16 @@ use air_interpreter_interface::CallResultsRepr; use air_interpreter_interface::RunParameters; use avm_interface::raw_outcome::RawAVMOutcome; use fluence_keypair::KeyPair; +use futures::future::LocalBoxFuture; +use futures::FutureExt; use std::error::Error as StdError; pub(crate) struct NativeAvmRunner {} impl AirRunner for NativeAvmRunner { - fn call_tracing( - &mut self, + fn call_tracing<'this>( + &'this mut self, air: String, prev_data: Vec, data: Vec, @@ -41,41 +43,46 @@ impl AirRunner for NativeAvmRunner { _tracing_output_mode: u8, keypair: &KeyPair, particle_id: String, - ) -> anyhow::Result { - use air_interpreter_sede::ToSerialized; - use avm_interface::into_raw_result; + ) -> LocalBoxFuture<'this, anyhow::Result> { + let keypair = keypair.clone(); + async move { + use air_interpreter_sede::ToSerialized; + use avm_interface::into_raw_result; - // some inner parts transformations - let raw_call_results = into_raw_result(call_results); - let raw_call_results = CallResultsRepr.serialize(&raw_call_results).unwrap(); + // some inner parts transformations + let raw_call_results = into_raw_result(call_results); + let raw_call_results = CallResultsRepr.serialize(&raw_call_results).unwrap(); - let key_format = keypair.key_format().into(); - let secret_key_bytes = keypair.secret().expect("Failed to get secret key"); + let key_format = keypair.key_format().into(); + let secret_key_bytes = keypair.secret().expect("Failed to get secret key"); - let outcome = air::execute_air( - air, - prev_data, - data, - RunParameters { - init_peer_id, - current_peer_id, - timestamp, - ttl, - key_format, - secret_key_bytes, - particle_id, - }, - raw_call_results, - ); - let outcome = RawAVMOutcome::from_interpreter_outcome(outcome)?; + let outcome = air::execute_air( + air, + prev_data, + data, + RunParameters { + init_peer_id, + current_peer_id, + timestamp, + ttl, + key_format, + secret_key_bytes, + particle_id, + }, + raw_call_results, + ); + let outcome = RawAVMOutcome::from_interpreter_outcome(outcome)?; - Ok(outcome) + Ok(outcome) + }.boxed_local() } } impl DataToHumanReadable for NativeAvmRunner { - fn to_human_readable(&mut self, data: Vec) -> Result> { - air::to_human_readable_data(data) + fn to_human_readable<'this>(&'this mut self, data: Vec) -> LocalBoxFuture<'this, Result>> { + async move { + air::to_human_readable_data(data) + }.boxed_local() } } diff --git a/tools/cli/air/src/trace/run/runner.rs b/tools/cli/air/src/trace/run/runner.rs index 575af424a3..5b91fa7f03 100644 --- a/tools/cli/air/src/trace/run/runner.rs +++ b/tools/cli/air/src/trace/run/runner.rs @@ -17,13 +17,14 @@ use avm_interface::raw_outcome::RawAVMOutcome; use avm_interface::CallResults; use fluence_keypair::KeyPair; +use futures::future::LocalBoxFuture; use std::error::Error as StdError; pub(crate) trait AirRunner { #[allow(clippy::too_many_arguments)] - fn call_tracing( - &mut self, + fn call_tracing<'this>( + &'this mut self, air: String, prev_data: Vec, data: Vec, @@ -36,9 +37,9 @@ pub(crate) trait AirRunner { tracing_output_mode: u8, key_pair: &KeyPair, particle_id: String, - ) -> anyhow::Result; + ) -> LocalBoxFuture<'this, anyhow::Result>; } pub(crate) trait DataToHumanReadable { - fn to_human_readable(&mut self, data: Vec) -> Result>; + fn to_human_readable<'this>(&'this mut self, data: Vec) -> LocalBoxFuture<'this, Result>>; } diff --git a/tools/cli/air/src/trace/run/wasm.rs b/tools/cli/air/src/trace/run/wasm.rs index fff62d1436..cf3d8bce24 100644 --- a/tools/cli/air/src/trace/run/wasm.rs +++ b/tools/cli/air/src/trace/run/wasm.rs @@ -18,15 +18,20 @@ use super::runner::AirRunner; use super::runner::DataToHumanReadable; use air_test_utils::avm_runner::AVMRunner; use fluence_keypair::KeyPair; +use marine_wasmtime_backend::WasmtimeWasmBackend; +use marine_wasmtime_backend::WasmtimeConfig; +use futures::future::LocalBoxFuture; +use futures::FutureExt; use std::error::Error as StdError; use std::path::Path; +use anyhow::anyhow; -pub(crate) struct WasmAvmRunner(AVMRunner); +pub(crate) struct WasmAvmRunner(AVMRunner); impl AirRunner for WasmAvmRunner { - fn call_tracing( - &mut self, + fn call_tracing<'this>( + &'this mut self, air: String, prev_data: Vec, data: Vec, @@ -39,42 +44,55 @@ impl AirRunner for WasmAvmRunner { tracing_output_mode: u8, keypair: &KeyPair, particle_id: String, - ) -> anyhow::Result { - let call_tracing = self.0.call_tracing( - air, - prev_data, - data, - init_peer_id, - timestamp, - ttl, - current_peer_id, - call_results, - tracing_params, - tracing_output_mode, - keypair.key_format().into(), - keypair.secret().expect("Failed to get secret"), - particle_id, - ); - let memory_stats = self.0.memory_stats(); - tracing::warn!(memory_size = memory_stats.memory_size); + ) -> LocalBoxFuture<'this, anyhow::Result> { + let keypair = keypair.clone(); + async move { + let call_tracing = self.0.call_tracing( + air, + prev_data, + data, + init_peer_id, + timestamp, + ttl, + current_peer_id, + call_results, + tracing_params, + tracing_output_mode, + keypair.key_format().into(), + keypair.secret().expect("Failed to get secret"), + particle_id, + ).await; + let memory_stats = self.0.memory_stats(); + tracing::warn!(memory_size = memory_stats.memory_size); - Ok(call_tracing?) + Ok(call_tracing?) + }.boxed_local() } } impl DataToHumanReadable for WasmAvmRunner { - fn to_human_readable(&mut self, data: Vec) -> Result> { - Ok(self.0.to_human_readable_data(data)?) + fn to_human_readable<'this>(&'this mut self, data: Vec) -> LocalBoxFuture<'this, Result>> { + async { + self.0.to_human_readable_data(data).await + .map_err(|e| Box::new(e) as Box) + }.boxed_local() } } -pub(crate) fn create_wasm_avm_runner( +pub(crate) async fn create_wasm_avm_runner( air_interpreter_wasm_path: &Path, max_heap_size: Option, ) -> anyhow::Result> { + let mut config = WasmtimeConfig::new(); + config + .debug_info(true) + .wasm_backtrace(true) + .epoch_interruption(false); + let wasm_backend = WasmtimeWasmBackend::new(config).map_err(|e| anyhow!(e))?; Ok(Box::new(WasmAvmRunner(AVMRunner::new( air_interpreter_wasm_path.to_owned(), max_heap_size, 0, - )?))) + wasm_backend + ).await?))) } From 4c53d8f219ff1b207619e1d30b5aa51b5e28ea65 Mon Sep 17 00:00:00 2001 From: Valery Antopol Date: Fri, 9 Feb 2024 21:04:47 +0400 Subject: [PATCH 04/14] most of initial issues fixed --- Cargo.lock | 218 ++++++++++-------- air/Cargo.toml | 2 + .../scalar_variables/values_sparse_matrix.rs | 2 +- .../value_types/canon_stream_map.rs | 4 +- .../value_types/stream/recursive_stream.rs | 10 +- .../value_types/stream/stream_definition.rs | 32 +-- .../execution_step/value_types/stream_map.rs | 12 +- air/tests/test_module/features/cid/canon.rs | 32 +-- air/tests/test_module/features/cid/mod.rs | 23 +- .../features/data_merging/air_basic.rs | 8 +- .../features/data_merging/data_merge.rs | 56 ++--- .../data_merging/executed_trace_basic.rs | 40 ++-- .../test_module/features/errors/error.rs | 10 +- .../features/errors/invalid_air.rs | 4 +- .../test_module/features/errors/last_error.rs | 84 +++---- .../features/join_behaviour/join_behaviour.rs | 38 +-- .../test_module/features/lambda/flattening.rs | 18 +- .../test_module/features/lambda/functors.rs | 36 +-- .../test_module/features/lambda/lambda.rs | 40 ++-- .../test_module/features/misc/empty_array.rs | 4 +- .../features/misc/version_check.rs | 12 +- .../features/scopes/scalars_scope.rs | 32 +-- .../scopes/scopes_behaviour_with_errors.rs | 16 +- .../features/signatures/algorithms.rs | 9 +- .../features/signatures/attacks.rs | 49 ++-- .../features/signatures/corruption.rs | 36 +-- .../features/signatures/runtime.rs | 65 +++--- .../features/signatures/signing.rs | 59 ++--- .../features/streams/ap_with_fold.rs | 6 +- .../features/streams/compactification.rs | 24 +- .../test_module/features/streams/merging.rs | 12 +- .../features/streams/recursive_streams.rs | 37 +-- .../test_module/features/streams/streams.rs | 40 ++-- .../features/streams/streams_early_exit.rs | 32 +-- .../features/tetraplets/provenance.rs | 32 +-- .../tetraplets/security_tetraplets.rs | 51 ++-- .../topology_hops/call_guided_topology.rs | 15 +- .../topology_hops/canon_guided_topology.rs | 15 +- air/tests/test_module/instructions/ap.rs | 77 ++++--- air/tests/test_module/instructions/call.rs | 46 ++-- air/tests/test_module/instructions/canon.rs | 138 +++++------ air/tests/test_module/instructions/fail.rs | 41 ++-- air/tests/test_module/instructions/fold.rs | 124 +++++----- air/tests/test_module/instructions/match_.rs | 70 +++--- .../test_module/instructions/mismatch.rs | 32 +-- air/tests/test_module/instructions/never.rs | 4 +- air/tests/test_module/instructions/new.rs | 54 ++--- air/tests/test_module/instructions/par.rs | 8 +- air/tests/test_module/instructions/seq.rs | 8 +- air/tests/test_module/instructions/xor.rs | 28 +-- .../test_module/integration/chat_join.rs | 30 +-- .../test_module/integration/create_service.rs | 6 +- .../test_module/integration/dashboard.rs | 20 +- .../integration/network_explore.rs | 12 +- air/tests/test_module/issues/issue_137.rs | 10 +- air/tests/test_module/issues/issue_173.rs | 8 +- air/tests/test_module/issues/issue_177.rs | 16 +- air/tests/test_module/issues/issue_178.rs | 9 +- air/tests/test_module/issues/issue_180.rs | 4 +- air/tests/test_module/issues/issue_206.rs | 4 +- air/tests/test_module/issues/issue_211.rs | 5 +- air/tests/test_module/issues/issue_214.rs | 4 +- air/tests/test_module/issues/issue_216.rs | 6 +- air/tests/test_module/issues/issue_221.rs | 13 +- air/tests/test_module/issues/issue_222.rs | 8 +- air/tests/test_module/issues/issue_241.rs | 8 +- air/tests/test_module/issues/issue_295.rs | 4 +- air/tests/test_module/issues/issue_300.rs | 6 +- air/tests/test_module/issues/issue_302.rs | 8 +- air/tests/test_module/issues/issue_304.rs | 5 +- air/tests/test_module/issues/issue_306.rs | 4 +- air/tests/test_module/issues/issue_331.rs | 4 +- air/tests/test_module/issues/issue_346.rs | 4 +- air/tests/test_module/issues/issue_348.rs | 8 +- air/tests/test_module/issues/issue_356.rs | 7 +- air/tests/test_module/issues/issue_363.rs | 8 +- air/tests/test_module/issues/issue_632.rs | 13 +- air/tests/test_module/issues/issue_642.rs | 8 +- air/tests/test_module/issues/issue_644.rs | 8 +- .../negative_tests/execution_step.rs | 163 ++++++------- .../negative_tests/farewell_step.rs | 5 +- .../negative_tests/preparation_step.rs | 10 +- .../uncatchable_trace_related.rs | 66 +++--- .../uncatchable_trace_unrelated.rs | 41 ++-- .../air-lib/interpreter-data/src/cid_store.rs | 4 +- .../air-lib/test-utils/src/call_services.rs | 12 +- .../air-lib/test-utils/src/executed_state.rs | 4 +- crates/air-lib/test-utils/src/lib.rs | 9 +- crates/air-lib/test-utils/src/test_runner.rs | 6 +- crates/beautifier/src/tests/beautifier.rs | 60 ++--- crates/beautifier/src/tests/mod.rs | 8 +- crates/testing-framework/Cargo.toml | 3 + .../testing-framework/src/asserts/behavior.rs | 12 +- .../testing-framework/src/asserts/parser.rs | 34 +-- crates/testing-framework/src/ephemeral/mod.rs | 12 +- .../src/ephemeral/neighborhood.rs | 59 ++--- crates/testing-framework/src/execution/mod.rs | 209 +++++++++-------- crates/testing-framework/src/queue.rs | 19 +- crates/testing-framework/src/transform/mod.rs | 12 +- .../testing-framework/src/transform/parser.rs | 100 ++++---- .../testing-framework/src/transform/walker.rs | 33 +-- 101 files changed, 1573 insertions(+), 1403 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 08fba2c47d..5801fd5c77 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -293,7 +293,9 @@ dependencies = [ "air-interpreter-signatures", "air-test-utils", "aquavm-air-parser", + "async-recursion", "fluence-keypair", + "futures", "itertools", "maplit", "nom", @@ -302,6 +304,7 @@ dependencies = [ "regex", "serde_json", "strum", + "tokio", ] [[package]] @@ -442,6 +445,7 @@ dependencies = [ "env_logger", "fluence-app-service", "fluence-keypair", + "futures", "log", "maplit", "marine-rs-sdk", @@ -456,6 +460,7 @@ dependencies = [ "strum", "strum_macros", "thiserror", + "tokio", "tracing", "typed-index-collections", ] @@ -574,6 +579,12 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "assert_matches" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b34d609dfbaf33d6889b2b7106d3ca345eacad44200913df5ba02bfd31d2ba9" + [[package]] name = "async-channel" version = "2.1.1" @@ -1778,7 +1789,7 @@ dependencies = [ "autocfg", "cfg-if 1.0.0", "crossbeam-utils", - "memoffset", + "memoffset 0.9.0", ] [[package]] @@ -1902,6 +1913,7 @@ dependencies = [ "digest 0.10.7", "fiat-crypto", "platforms", + "rand_core 0.6.4", "rustc_version 0.4.0", "subtle", "zeroize", @@ -3719,6 +3731,15 @@ dependencies = [ "rustix 0.38.28", ] +[[package]] +name = "memoffset" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d61c719bcfbcf5d62b3a09efa6088de8c54bc0bfcd3ea7ae39fcc186108b8de1" +dependencies = [ + "autocfg", +] + [[package]] name = "memoffset" version = "0.9.0" @@ -3922,19 +3943,9 @@ dependencies = [ [[package]] name = "near-account-id" -version = "0.17.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc0cb40869cab7f5232f934f45db35bffe0f2d2a7cb0cd0346202fbe4ebf2dd7" -dependencies = [ - "borsh 0.10.3", - "serde", -] - -[[package]] -name = "near-account-id" -version = "1.0.0-alpha.4" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d10d45a9c49c3e975c362cf4d1dc1d7b72a716b30394bea56ee2a8fb225f50b7" +checksum = "35cbb989542587b47205e608324ddd391f0cee1c22b4b64ae49f458334b95907" dependencies = [ "borsh 1.1.2", "schemars", @@ -3962,9 +3973,9 @@ dependencies = [ [[package]] name = "near-config-utils" -version = "0.17.0" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5523e7dce493c45bc3241eb3100d943ec471852f9b1f84b46a34789eadf17031" +checksum = "2ae1eaab1d545a9be7a55b6ef09f365c2017f93a03063547591d12c0c6d27e58" dependencies = [ "anyhow", "json_comments", @@ -3999,19 +4010,19 @@ dependencies = [ [[package]] name = "near-crypto" -version = "0.17.0" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff6b382b626e7e0cd372d027c6672ac97b4b6ee6114288c9e58d8180b935d315" +checksum = "2991d2912218a80ec0733ac87f84fa803accea105611eea209d4419271957667" dependencies = [ "blake2", - "borsh 0.10.3", + "borsh 1.1.2", "bs58 0.4.0", "c2-chacha", - "curve25519-dalek 3.2.0", + "curve25519-dalek 4.1.1", "derive_more", - "ed25519-dalek 1.0.1", + "ed25519-dalek 2.1.0", "hex 0.4.3", - "near-account-id 0.17.0", + "near-account-id 1.0.0", "near-config-utils", "near-stdx", "once_cell", @@ -4026,11 +4037,11 @@ dependencies = [ [[package]] name = "near-fmt" -version = "0.17.0" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c44c842c6cfcd9b8c387cccd4cd0619a5f21920cde5d5c292af3cc5d40510672" +checksum = "b7d998dfc1e04001608899b2498ad5a782c7d036b73769d510de21964db99286" dependencies = [ - "near-primitives-core 0.17.0", + "near-primitives-core 0.20.1", ] [[package]] @@ -4081,21 +4092,23 @@ dependencies = [ [[package]] name = "near-o11y" -version = "0.17.0" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af7d35397b02b131c188c72f3885e97daeccab134ec2fc8cc0073a94cf1cfe19" +checksum = "d20762631bc8253030013bbae9b5f0542691edc1aa6722f1e8141cc9b928ae5b" dependencies = [ "actix", - "atty", + "base64 0.21.5", "clap 4.4.11", - "near-crypto 0.17.0", - "near-primitives-core 0.17.0", + "near-crypto 0.20.1", + "near-fmt", + "near-primitives-core 0.20.1", "once_cell", "opentelemetry", "opentelemetry-otlp", "opentelemetry-semantic-conventions", "prometheus", "serde", + "serde_json", "strum", "thiserror", "tokio", @@ -4105,6 +4118,25 @@ dependencies = [ "tracing-subscriber", ] +[[package]] +name = "near-parameters" +version = "0.20.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e9f16a59b6c3e69b0585be951af6fe42a0ba86c0e207cb8c63badd19efd16680" +dependencies = [ + "assert_matches", + "borsh 1.1.2", + "enum-map", + "near-account-id 1.0.0", + "near-primitives-core 0.20.1", + "num-rational", + "serde", + "serde_repr", + "serde_yaml", + "strum", + "thiserror", +] + [[package]] name = "near-primitives" version = "0.15.0" @@ -4122,7 +4154,7 @@ dependencies = [ "near-crypto 0.15.0", "near-primitives-core 0.15.0", "near-rpc-error-macro 0.15.0", - "near-vm-errors 0.15.0", + "near-vm-errors", "num-rational", "once_cell", "primitive-types", @@ -4137,12 +4169,13 @@ dependencies = [ [[package]] name = "near-primitives" -version = "0.17.0" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05f7051aaf199adc4d068620fca6d5f70f906a1540d03a8bb3701271f8881835" +checksum = "0462b067732132babcc89d5577db3bfcb0a1bcfbaaed3f2db4c11cd033666314" dependencies = [ "arbitrary", - "borsh 0.10.3", + "base64 0.21.5", + "borsh 1.1.2", "bytesize", "cfg-if 1.0.0", "chrono", @@ -4150,21 +4183,25 @@ dependencies = [ "easy-ext", "enum-map", "hex 0.4.3", - "near-crypto 0.17.0", + "near-crypto 0.20.1", "near-fmt", - "near-primitives-core 0.17.0", - "near-rpc-error-macro 0.17.0", + "near-o11y", + "near-parameters", + "near-primitives-core 0.20.1", + "near-rpc-error-macro 0.20.1", "near-stdx", - "near-vm-errors 0.17.0", + "near-vm-runner", "num-rational", "once_cell", "primitive-types", "rand 0.8.5", + "rand_chacha 0.3.1", "reed-solomon-erasure", "serde", "serde_json", "serde_with 3.4.0", "serde_yaml", + "sha3", "smart-default", "strum", "thiserror", @@ -4192,17 +4229,17 @@ dependencies = [ [[package]] name = "near-primitives-core" -version = "0.17.0" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "775fec19ef51a341abdbf792a9dda5b4cb89f488f681b2fd689b9321d24db47b" +checksum = "8443eb718606f572c438be6321a097a8ebd69f8e48d953885b4f16601af88225" dependencies = [ "arbitrary", "base64 0.21.5", - "borsh 0.10.3", + "borsh 1.1.2", "bs58 0.4.0", "derive_more", "enum-map", - "near-account-id 0.17.0", + "near-account-id 1.0.0", "num-rational", "serde", "serde_repr", @@ -4225,9 +4262,9 @@ dependencies = [ [[package]] name = "near-rpc-error-core" -version = "0.17.0" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84c1eda300e2e78f4f945ae58117d49e806899f4a51ee2faa09eda5ebc2e6571" +checksum = "80fca203c51edd9595ec14db1d13359fb9ede32314990bf296b6c5c4502f6ab7" dependencies = [ "quote", "serde", @@ -4247,12 +4284,12 @@ dependencies = [ [[package]] name = "near-rpc-error-macro" -version = "0.17.0" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31d2dadd765101c77e664029dd6fbec090e696877d4ae903c620d02ceda4969a" +checksum = "897a445de2102f6732c8a185d922f5e3bf7fd0a41243ce40854df2197237f799" dependencies = [ "fs2", - "near-rpc-error-core 0.17.0", + "near-rpc-error-core 0.20.1", "serde", "syn 2.0.48", ] @@ -4274,23 +4311,24 @@ dependencies = [ [[package]] name = "near-sdk" -version = "5.0.0-alpha.1" +version = "5.0.0-alpha.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62385d178cbf20d7b62277e0ffe5d65b133989994240b2789d5510fa7de332da" +checksum = "8869ab54cd71a1a4239002f8c00b9e6742725c386e23084be98dd4bb69336266" dependencies = [ "base64 0.13.1", "borsh 1.1.2", "bs58 0.4.0", "near-abi", - "near-account-id 1.0.0-alpha.4", - "near-crypto 0.17.0", + "near-account-id 1.0.0", + "near-crypto 0.20.1", "near-gas", - "near-primitives 0.17.0", - "near-primitives-core 0.17.0", + "near-parameters", + "near-primitives 0.20.1", + "near-primitives-core 0.20.1", "near-sdk-macros", "near-sys", "near-token", - "near-vm-logic", + "near-vm-runner", "once_cell", "schemars", "serde", @@ -4300,9 +4338,9 @@ dependencies = [ [[package]] name = "near-sdk-macros" -version = "5.0.0-alpha.1" +version = "5.0.0-alpha.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d00f960e5f28e8b5a223de7ba35f494c094c213c7b50f94927713a93736013dd" +checksum = "0efa94eb99a64491323b71ba2c0591ce4649817f26339de56f110f00649ea908" dependencies = [ "Inflector", "darling", @@ -4317,9 +4355,9 @@ dependencies = [ [[package]] name = "near-stdx" -version = "0.17.0" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6540152fba5e96fe5d575b79e8cd244cf2add747bb01362426bdc069bc3a23bc" +checksum = "855fd5540e3b4ff6fedf12aba2db1ee4b371b36f465da1363a6d022b27cb43b8" [[package]] name = "near-sys" @@ -4352,39 +4390,32 @@ dependencies = [ ] [[package]] -name = "near-vm-errors" -version = "0.17.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec545d1bede0579e7c15dd2dce9b998dc975c52f2165702ff40bec7ff69728bb" -dependencies = [ - "borsh 0.10.3", - "near-account-id 0.17.0", - "near-rpc-error-macro 0.17.0", - "serde", - "strum", - "thiserror", -] - -[[package]] -name = "near-vm-logic" -version = "0.17.0" +name = "near-vm-runner" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30d7487c678ed1963a0ecd5033f72bb41caa58debd6fe8025a9bef6e1a6a519a" +checksum = "c56c80bdb1954808f59bd36a9112377197b38d424991383bf05f52d0fe2e0da5" dependencies = [ - "borsh 0.10.3", - "ed25519-dalek 1.0.1", - "near-account-id 0.17.0", - "near-crypto 0.17.0", - "near-fmt", - "near-o11y", - "near-primitives 0.17.0", - "near-primitives-core 0.17.0", + "base64 0.21.5", + "borsh 1.1.2", + "ed25519-dalek 2.1.0", + "enum-map", + "memoffset 0.8.0", + "near-crypto 0.20.1", + "near-parameters", + "near-primitives-core 0.20.1", "near-stdx", - "near-vm-errors 0.17.0", + "num-rational", + "once_cell", + "prefix-sum-vec", "ripemd", "serde", + "serde_repr", + "serde_with 3.4.0", "sha2 0.10.8", "sha3", + "strum", + "thiserror", + "tracing", "zeropool-bn", ] @@ -4891,6 +4922,12 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c" +[[package]] +name = "prefix-sum-vec" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa06bd51638b6e76ac9ba9b6afb4164fa647bd2916d722f2623fbb6d1ed8bdba" + [[package]] name = "pretty_assertions" version = "0.6.1" @@ -6364,11 +6401,11 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.28.2" +version = "1.36.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94d7b1cfd2aa4011f2de74c2c4c63665e27a71006b0a192dcd2710272e73dfa2" +checksum = "61285f6515fa018fb2d1e46eb21223fff441ee8db5d0f1435e8ab4f5cdb80931" dependencies = [ - "autocfg", + "backtrace", "bytes", "libc", "mio", @@ -6376,7 +6413,7 @@ dependencies = [ "parking_lot 0.12.1", "pin-project-lite", "signal-hook-registry", - "socket2 0.4.10", + "socket2 0.5.5", "tokio-macros", "windows-sys 0.48.0", ] @@ -6393,9 +6430,9 @@ dependencies = [ [[package]] name = "tokio-macros" -version = "2.1.0" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" +checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" dependencies = [ "proc-macro2", "quote", @@ -7374,7 +7411,7 @@ dependencies = [ "log", "mach", "memfd", - "memoffset", + "memoffset 0.9.0", "paste", "rand 0.8.5", "rustix 0.38.28", @@ -7949,7 +7986,6 @@ version = "0.5.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "71e61de68ede9ffdd69c01664f65a178c5188b73f78faa21f0936016a888ff7c" dependencies = [ - "borsh 0.9.3", "byteorder", "crunchy", "lazy_static", diff --git a/air/Cargo.toml b/air/Cargo.toml index 1a8f93a76b..ab14de7364 100644 --- a/air/Cargo.toml +++ b/air/Cargo.toml @@ -65,6 +65,8 @@ env_logger = "0.7.1" once_cell = "1.4.1" pretty_assertions = "0.6.1" serde_json = "1.0.61" +tokio = {version = "1.35", features = ["rt", "macros"]} +futures = "0.3.30" [features] check_signatures = [] diff --git a/air/src/execution_step/execution_context/scalar_variables/values_sparse_matrix.rs b/air/src/execution_step/execution_context/scalar_variables/values_sparse_matrix.rs index 33d2c2e9b4..bf0f1d3ee4 100644 --- a/air/src/execution_step/execution_context/scalar_variables/values_sparse_matrix.rs +++ b/air/src/execution_step/execution_context/scalar_variables/values_sparse_matrix.rs @@ -288,7 +288,7 @@ mod test { use std::num::NonZeroUsize; use std::rc::Rc; - #[tokio::test] + #[test] fn test_local_cleanup() { let mut scalars = ValuesSparseMatrix::new(); diff --git a/air/src/execution_step/value_types/canon_stream_map.rs b/air/src/execution_step/value_types/canon_stream_map.rs index 41f62f6f67..fcefcfed75 100644 --- a/air/src/execution_step/value_types/canon_stream_map.rs +++ b/air/src/execution_step/value_types/canon_stream_map.rs @@ -206,7 +206,7 @@ mod test { (va_vec, vec![canon_stream_one, canon_stream_two], keys) } - #[tokio::test] + #[test] fn from_canon_stream() { let peer_pk = "some_tetraplet"; let (va_vec, canon_streams, keys) = create_va_canon_and_keys_vecs(peer_pk); @@ -225,7 +225,7 @@ mod test { assert!(canon_stream_map_key_two.clone().into_values() == canon_stream_two.clone().into_values()); } - #[tokio::test] + #[test] fn test_index_ok() { let peer_pk = "some_tetraplet"; let (va_vec, canon_streams, _) = create_va_canon_and_keys_vecs(peer_pk); diff --git a/air/src/execution_step/value_types/stream/recursive_stream.rs b/air/src/execution_step/value_types/stream/recursive_stream.rs index eb0ec8edd6..ad730909fb 100644 --- a/air/src/execution_step/value_types/stream/recursive_stream.rs +++ b/air/src/execution_step/value_types/stream/recursive_stream.rs @@ -170,7 +170,7 @@ mod test { } } - #[tokio::test] + #[test] fn fold_started_empty_if_no_values() { let mut stream = Stream::new(); let mut recursive_stream = RecursiveStreamCursor::new(); @@ -179,7 +179,7 @@ mod test { assert!(!cursor_state.should_continue()) } - #[tokio::test] + #[test] fn next_iteration_empty_if_no_values() { let mut stream = Stream::new(); let mut recursive_stream = RecursiveStreamCursor::new(); @@ -188,7 +188,7 @@ mod test { assert!(!cursor_state.should_continue()) } - #[tokio::test] + #[test] fn next_iteration_empty_if_no_values_added() { let mut stream = Stream::new(); let mut recursive_stream = RecursiveStreamCursor::new(); @@ -204,7 +204,7 @@ mod test { assert!(!cursor_state.should_continue()); } - #[tokio::test] + #[test] fn one_recursive_iteration() { let mut stream = Stream::new(); let mut recursive_stream = RecursiveStreamCursor::new(); @@ -227,7 +227,7 @@ mod test { assert!(!cursor_state.should_continue()); } - #[tokio::test] + #[test] fn add_value_into_prev_and_current() { let mut stream = Stream::new(); let mut recursive_stream = RecursiveStreamCursor::new(); diff --git a/air/src/execution_step/value_types/stream/stream_definition.rs b/air/src/execution_step/value_types/stream/stream_definition.rs index 8bb4c43f9c..94e15f8165 100644 --- a/air/src/execution_step/value_types/stream/stream_definition.rs +++ b/air/src/execution_step/value_types/stream/stream_definition.rs @@ -257,7 +257,7 @@ mod test { ) } - #[tokio::test] + #[test] fn test_iter() { let value_1 = create_value(json!("value_1")); let value_2 = create_value(json!("value_2")); @@ -273,7 +273,7 @@ mod test { assert_eq!(iter.next(), None); } - #[tokio::test] + #[test] fn test_slice_iter_prev() { let value_1 = create_value(json!("value_1")); let value_2 = create_value(json!("value_2")); @@ -294,7 +294,7 @@ mod test { assert_eq!(slice_iter.next(), None); } - #[tokio::test] + #[test] fn test_slice_iter_current() { let value_1 = create_value(json!("value_1")); let value_2 = create_value(json!("value_2")); @@ -315,7 +315,7 @@ mod test { assert_eq!(slice_iter.next(), None); } - #[tokio::test] + #[test] fn test_slice_iter_new() { let value_1 = create_value(json!("value_1")); let value_2 = create_value(json!("value_2")); @@ -336,7 +336,7 @@ mod test { assert_eq!(slice_iter.next(), None); } - #[tokio::test] + #[test] fn test_iter_on_empty_stream() { let stream = Stream::new(); @@ -344,7 +344,7 @@ mod test { assert_eq!(slice.next(), None); } - #[tokio::test] + #[test] fn test_slice_on_empty_stream() { let stream = Stream::new(); @@ -352,7 +352,7 @@ mod test { assert_eq!(slice.next(), None); } - #[tokio::test] + #[test] fn generation_from_current_data_after_previous() { let value_1 = create_value(json!("value_1")); let value_2 = create_value(json!("value_2")); @@ -367,7 +367,7 @@ mod test { assert_eq!(iter.next(), None); } - #[tokio::test] + #[test] fn generation_from_new_data_after_current_and_previous() { let value_1 = create_value(json!("value_1")); let value_2 = create_value(json!("value_2")); @@ -385,7 +385,7 @@ mod test { assert_eq!(iter.next(), None); } - #[tokio::test] + #[test] fn empty_generations_skipped_in_slice_iter_prev() { let value_1 = create_value(json!("value_1")); let value_2 = create_value(json!("value_2")); @@ -403,7 +403,7 @@ mod test { assert_eq!(slice_iter.next(), None); } - #[tokio::test] + #[test] fn empty_generations_skipped_in_slice_iter_current() { let value_1 = create_value(json!("value_1")); let value_2 = create_value(json!("value_2")); @@ -421,7 +421,7 @@ mod test { assert_eq!(slice_iter.next(), None); } - #[tokio::test] + #[test] fn compactification_with_previous_new_generation() { let value_1 = create_value_with_pos(json!("value_1"), 0.into()); let value_2 = create_value_with_pos(json!("value_2"), 1.into()); @@ -449,7 +449,7 @@ mod test { assert_eq!(actual_trace, expected_trace); } - #[tokio::test] + #[test] fn compactification_with_current_generation() { let value_1 = create_value_with_pos(json!("value_1"), 0.into()); let value_2 = create_value_with_pos(json!("value_2"), 1.into()); @@ -481,7 +481,7 @@ mod test { assert_eq!(actual_trace, expected_trace); } - #[tokio::test] + #[test] fn compactification_works_with_mixed_generations() { let value_1 = create_value_with_pos(json!("value_1"), 0.into()); let value_2 = create_value_with_pos(json!("value_2"), 1.into()); @@ -525,7 +525,7 @@ mod test { assert_eq!(actual_trace, expected_trace); } - #[tokio::test] + #[test] fn compactification_invalid_state_error() { let value_1 = create_value(json!("value_1")); let mut stream = Stream::new(); @@ -550,7 +550,7 @@ mod test { )); } - #[tokio::test] + #[test] fn compactification_points_to_nowhere_error() { let value_1 = create_value(json!("value_1")); let mut stream = Stream::new(); @@ -571,7 +571,7 @@ mod test { )); } - #[tokio::test] + #[test] fn stream_size_limit() { use super::STREAM_MAX_SIZE; use crate::UncatchableError; diff --git a/air/src/execution_step/value_types/stream_map.rs b/air/src/execution_step/value_types/stream_map.rs index 292517e77e..f3ca13126e 100644 --- a/air/src/execution_step/value_types/stream_map.rs +++ b/air/src/execution_step/value_types/stream_map.rs @@ -152,7 +152,7 @@ mod test { actual_value == &expected_value } - #[tokio::test] + #[test] fn test_from_value_key_str() { let key = StreamMapKey::Str(Cow::Borrowed("some_key")); let value = Rc::new(json!("1")); @@ -168,7 +168,7 @@ mod test { assert_eq!(iter.next(), None); } - #[tokio::test] + #[test] fn test_from_value_key_int() { let key = StreamMapKey::I64(42.into()); let value = Rc::new(json!("1")); @@ -184,7 +184,7 @@ mod test { assert_eq!(iter.next(), None); } - #[tokio::test] + #[test] fn test_insert() { let key_1_2 = StreamMapKey::Str(Cow::Borrowed("some_key")); let value_1 = Rc::new(json!("1")); @@ -224,7 +224,7 @@ mod test { assert_eq!(iter.next(), None); } - #[tokio::test] + #[test] fn compactification_invalid_state_error() { use air_interpreter_data::CanonResult; @@ -255,7 +255,7 @@ mod test { )); } - #[tokio::test] + #[test] fn compactification_points_to_nowhere_error() { let key = StreamMapKey::Str(Cow::Borrowed("some_key")); let value = Rc::new(json!("1")); @@ -317,7 +317,7 @@ mod test { }); } - #[tokio::test] + #[test] fn test_iter_unique_key_object() { const TEST_DATA_SIZE: usize = 5; let key_values = generate_key_values(TEST_DATA_SIZE); diff --git a/air/tests/test_module/features/cid/canon.rs b/air/tests/test_module/features/cid/canon.rs index ee83109731..f7a6bede7a 100644 --- a/air/tests/test_module/features/cid/canon.rs +++ b/air/tests/test_module/features/cid/canon.rs @@ -24,7 +24,7 @@ use air_test_utils::prelude::*; use pretty_assertions::assert_eq; #[tokio::test] -fn test_canon_ok() { +async fn test_canon_ok() { let init_peer_name = "init_peer_id"; let script = format!( @@ -37,8 +37,8 @@ fn test_canon_ok() { ); let executor = - AirScriptExecutor::from_annotated(TestRunParameters::from_init_peer_id(init_peer_name), &script).unwrap(); - let result = executor.execute_one(init_peer_name).unwrap(); + AirScriptExecutor::from_annotated(TestRunParameters::from_init_peer_id(init_peer_name), &script).await.unwrap(); + let result = executor.execute_one(init_peer_name).await.unwrap(); let data = data_from_result(&result); let mut cid_state = ExecutionCidState::new(); @@ -100,7 +100,7 @@ fn test_canon_ok() { } #[tokio::test] -fn test_canon_ok_multi() { +async fn test_canon_ok_multi() { let init_peer_name = "init_peer_id"; let other_peer_name = "other_peer_id"; @@ -115,10 +115,10 @@ fn test_canon_ok_multi() { ); let executor = - AirScriptExecutor::from_annotated(TestRunParameters::from_init_peer_id(init_peer_name), &script).unwrap(); - let _result1 = executor.execute_one(init_peer_name).unwrap(); - let _result2 = executor.execute_one(other_peer_name).unwrap(); - let result3 = executor.execute_one(init_peer_name).unwrap(); + AirScriptExecutor::from_annotated(TestRunParameters::from_init_peer_id(init_peer_name), &script).await.unwrap(); + let _result1 = executor.execute_one(init_peer_name).await.unwrap(); + let _result2 = executor.execute_one(other_peer_name).await.unwrap(); + let result3 = executor.execute_one(init_peer_name).await.unwrap(); let data = data_from_result(&result3); let init_peer_id = at(init_peer_name); @@ -191,9 +191,9 @@ fn test_canon_ok_multi() { } #[tokio::test] -fn test_canon_value_not_found() { +async fn test_canon_value_not_found() { let init_peer_id = "vm_peer_id"; - let mut vm = create_avm(echo_call_service(), init_peer_id); + let mut vm = create_avm(echo_call_service(), init_peer_id).await; let mut cid_state = ExecutionCidState::new(); @@ -239,10 +239,10 @@ fn test_canon_value_not_found() { } #[tokio::test] -fn test_canon_root_tetraplet_not_found() { +async fn test_canon_root_tetraplet_not_found() { let init_peer_id = "vm_peer_id"; let other_peer_id = "other_peer_id"; - let mut vm = create_avm(echo_call_service(), init_peer_id); + let mut vm = create_avm(echo_call_service(), init_peer_id).await; let mut cid_state = ExecutionCidState::new(); @@ -294,9 +294,9 @@ fn test_canon_root_tetraplet_not_found() { } #[tokio::test] -fn test_canon_tetraplet_not_found() { +async fn test_canon_tetraplet_not_found() { let init_peer_id = "vm_peer_id"; - let mut vm = create_avm(echo_call_service(), init_peer_id); + let mut vm = create_avm(echo_call_service(), init_peer_id).await; let mut cid_state = ExecutionCidState::new(); @@ -353,9 +353,9 @@ fn test_canon_tetraplet_not_found() { } #[tokio::test] -fn test_canon_agg_not_found() { +async fn test_canon_agg_not_found() { let init_peer_id = "vm_peer_id"; - let mut vm = create_avm(echo_call_service(), init_peer_id); + let mut vm = create_avm(echo_call_service(), init_peer_id).await; let mut cid_state = ExecutionCidState::new(); diff --git a/air/tests/test_module/features/cid/mod.rs b/air/tests/test_module/features/cid/mod.rs index 3a02f83edb..7982131b7c 100644 --- a/air/tests/test_module/features/cid/mod.rs +++ b/air/tests/test_module/features/cid/mod.rs @@ -25,9 +25,9 @@ use air_test_utils::prelude::*; use pretty_assertions::assert_eq; #[tokio::test] -fn test_missing_cid() { +async fn test_missing_cid() { let peer_id = "peer_id"; - let mut vm = create_avm(echo_call_service(), peer_id); + let mut vm = create_avm(echo_call_service(), peer_id).await; let air_script = r#" (seq @@ -49,9 +49,9 @@ fn test_missing_cid() { } #[tokio::test] -fn test_correct_cid() { +async fn test_correct_cid() { let peer_id = "peer_id"; - let mut vm = create_avm(echo_call_service(), peer_id); + let mut vm = create_avm(echo_call_service(), peer_id).await; let air_script = r#" (seq @@ -69,7 +69,7 @@ fn test_correct_cid() { } #[tokio::test] -fn test_scalar_cid() { +async fn test_scalar_cid() { let vm_peer_name = "vm_peer_id"; let annotated_air_script = format!( @@ -83,9 +83,10 @@ fn test_scalar_cid() { TestRunParameters::from_init_peer_id(vm_peer_name), &annotated_air_script, ) + .await .unwrap(); - let result = executor.execute_one(vm_peer_name).unwrap(); + let result = executor.execute_one(vm_peer_name).await.unwrap(); let data = data_from_result(&result); let mut cid_state = ExecutionCidState::new(); let expected_trace = vec![ @@ -116,7 +117,7 @@ fn test_scalar_cid() { } #[tokio::test] -fn test_stream_cid() { +async fn test_stream_cid() { let vm_peer_name = "vm_peer_id"; let annotated_air_script = format!( @@ -130,9 +131,10 @@ fn test_stream_cid() { TestRunParameters::from_init_peer_id(vm_peer_name), &annotated_air_script, ) + .await .unwrap(); - let result = executor.execute_one(vm_peer_name).unwrap(); + let result = executor.execute_one(vm_peer_name).await.unwrap(); let data = data_from_result(&result); let mut cid_state = ExecutionCidState::new(); let expected_trace = vec![ @@ -165,7 +167,7 @@ fn test_stream_cid() { } #[tokio::test] -fn test_unused_cid() { +async fn test_unused_cid() { let vm_peer_id = "vm_peer_id"; let annotated_air_script = format!( @@ -177,9 +179,10 @@ fn test_unused_cid() { ); let executor = AirScriptExecutor::from_annotated(TestRunParameters::from_init_peer_id(vm_peer_id), &annotated_air_script) + .await .unwrap(); - let result = executor.execute_one(vm_peer_id).unwrap(); + let result = executor.execute_one(vm_peer_id).await.unwrap(); let data = data_from_result(&result); let expected_trace = vec![ diff --git a/air/tests/test_module/features/data_merging/air_basic.rs b/air/tests/test_module/features/data_merging/air_basic.rs index ea5e80fdb0..5748ebef86 100644 --- a/air/tests/test_module/features/data_merging/air_basic.rs +++ b/air/tests/test_module/features/data_merging/air_basic.rs @@ -21,9 +21,9 @@ use air_test_utils::prelude::*; use pretty_assertions::assert_eq; #[tokio::test] -fn seq_par_call() { +async fn seq_par_call() { let vm_peer_id = "some_peer_id"; - let mut vm = create_avm(unit_call_service(), vm_peer_id); + let mut vm = create_avm(unit_call_service(), vm_peer_id).await; let script = format!( r#" @@ -62,10 +62,10 @@ fn seq_par_call() { } #[tokio::test] -fn par_par_call() { +async fn par_par_call() { let vm_peer_id = "some_peer_id"; let remote_peer_id = "remote_peer_id"; - let mut vm = create_avm(unit_call_service(), vm_peer_id); + let mut vm = create_avm(unit_call_service(), vm_peer_id).await; let script = format!( r#" diff --git a/air/tests/test_module/features/data_merging/data_merge.rs b/air/tests/test_module/features/data_merging/data_merge.rs index ad1fd2c7ff..23d38ff1d5 100644 --- a/air/tests/test_module/features/data_merging/data_merge.rs +++ b/air/tests/test_module/features/data_merging/data_merge.rs @@ -24,7 +24,7 @@ use std::collections::HashMap; use std::ops::Deref; #[tokio::test] -fn merge_streams_in_two_fold() { +async fn merge_streams_in_two_fold() { use executed_state::*; let set_variable_peer_id = "set_variable_peer_id"; @@ -34,9 +34,9 @@ fn merge_streams_in_two_fold() { let mut set_variable = create_avm( set_variable_call_service(json!([vm_1_peer_id, vm_2_peer_id])), set_variable_peer_id, - ); - let mut vm1 = create_avm(return_string_call_service(vm_1_peer_id), vm_1_peer_id); - let mut vm2 = create_avm(return_string_call_service(vm_2_peer_id), vm_2_peer_id); + ).await; + let mut vm1 = create_avm(return_string_call_service(vm_1_peer_id), vm_1_peer_id).await; + let mut vm2 = create_avm(return_string_call_service(vm_2_peer_id), vm_2_peer_id).await; let script = format!( r#" @@ -177,7 +177,7 @@ fn merge_streams_in_two_fold() { } #[tokio::test] -fn stream_merge() { +async fn stream_merge() { let neighborhood_call_service: CallServiceClosure = Box::new(|params| -> CallServiceResult { let args_count = (params.function_name.as_bytes()[0] - b'0') as usize; let args: Vec> = serde_json::from_value(JValue::Array(params.arguments)).expect("valid json"); @@ -186,8 +186,8 @@ fn stream_merge() { CallServiceResult::ok(json!(args)) }); - let mut vm1 = create_avm(set_variable_call_service(json!("peer_id")), "A"); - let mut vm2 = create_avm(neighborhood_call_service, "B"); + let mut vm1 = create_avm(set_variable_call_service(json!("peer_id")), "A").await; + let mut vm2 = create_avm(neighborhood_call_service, "B").await; let script = r#" (seq @@ -219,7 +219,7 @@ fn stream_merge() { } #[tokio::test] -fn fold_merge() { +async fn fold_merge() { let set_variable_vm_id = "set_variable"; let local_vm_id = "local_vm"; @@ -230,7 +230,7 @@ fn fold_merge() { let mut set_variable_vm = create_avm( set_variables_call_service(variables, VariableOptionSource::Argument(0)), set_variable_vm_id, - ); + ).await; let script = format!( include_str!("./scripts/inner_folds_v1.air"), @@ -243,7 +243,7 @@ fn fold_merge() { let mut local_vms_results = Vec::with_capacity(7); for vm_id in 0..7 { let peer_id = format!("peer_{vm_id}"); - let mut vm = create_avm(echo_call_service(), peer_id); + let mut vm = create_avm(echo_call_service(), peer_id).await; let result = checked_call_vm!( vm, <_>::default(), @@ -256,7 +256,7 @@ fn fold_merge() { local_vms_results.push(result); } - let mut local_vm = create_avm(echo_call_service(), local_vm_id); + let mut local_vm = create_avm(echo_call_service(), local_vm_id).await; let result_1 = checked_call_vm!(local_vm, <_>::default(), &script, "", local_vms_results[0].data.clone()); let result_2 = checked_call_vm!( local_vm, @@ -360,10 +360,10 @@ fn fold_merge() { } #[tokio::test] -fn test_merge_scalar_match() { +async fn test_merge_scalar_match() { let air = r#"(call "peer" ("" "") [] var)"#; - let mut avm = create_avm(echo_call_service(), "peer"); + let mut avm = create_avm(echo_call_service(), "peer").await; let mut cid_store = ExecutionCidState::new(); let trace = ExecutionTrace::from(vec![scalar_tracked!(42, cid_store, peer = "peer")]); @@ -372,9 +372,9 @@ fn test_merge_scalar_match() { } #[tokio::test] -fn test_merge_scalar_mismatch() { +async fn test_merge_scalar_mismatch() { let air = r#"(call "peer" ("" "") [] var)"#; - let mut avm = create_avm(echo_call_service(), "peer"); + let mut avm = create_avm(echo_call_service(), "peer").await; let mut cid_state1 = ExecutionCidState::default(); let mut cid_state2 = ExecutionCidState::default(); @@ -385,7 +385,7 @@ fn test_merge_scalar_mismatch() { let data1 = raw_data_from_trace(trace1, cid_state1); let data2 = raw_data_from_trace(trace2, cid_state2); - let result = avm.call(air, data1, data2, <_>::default()).unwrap(); + let result = avm.call(air, data1, data2, <_>::default()).await.unwrap(); assert_eq!(result.ret_code, 20000); assert_eq!( result.error_message, @@ -402,10 +402,10 @@ fn test_merge_scalar_mismatch() { } #[tokio::test] -fn test_merge_stream_match() { +async fn test_merge_stream_match() { let air = r#"(call "peer" ("" "") [] $var)"#; - let mut avm = create_avm(echo_call_service(), "peer"); + let mut avm = create_avm(echo_call_service(), "peer").await; let mut cid_store = ExecutionCidState::new(); let trace = ExecutionTrace::from(vec![stream_tracked!(42, 0, cid_store, peer = "peer")]); @@ -414,9 +414,9 @@ fn test_merge_stream_match() { } #[tokio::test] -fn test_merge_stream_match_gen() { +async fn test_merge_stream_match_gen() { let air = r#"(call "peer" ("" "") [] $var)"#; - let mut avm = create_avm(echo_call_service(), "peer"); + let mut avm = create_avm(echo_call_service(), "peer").await; let mut cid_state1 = ExecutionCidState::default(); let mut cid_state2 = ExecutionCidState::default(); @@ -428,9 +428,9 @@ fn test_merge_stream_match_gen() { } #[tokio::test] -fn test_merge_stream_mismatch() { +async fn test_merge_stream_mismatch() { let air = r#"(call "peer" ("" "") [] $var)"#; - let mut avm = create_avm(echo_call_service(), "peer"); + let mut avm = create_avm(echo_call_service(), "peer").await; let mut cid_state1 = ExecutionCidState::default(); let mut cid_state2 = ExecutionCidState::default(); @@ -441,7 +441,7 @@ fn test_merge_stream_mismatch() { let data1 = raw_data_from_trace(trace1, cid_state1); let data2 = raw_data_from_trace(trace2, cid_state2); - let result = avm.call(air, data1, data2, <_>::default()).unwrap(); + let result = avm.call(air, data1, data2, <_>::default()).await.unwrap(); assert_eq!(result.ret_code, 20000); assert_eq!( result.error_message, @@ -458,10 +458,10 @@ fn test_merge_stream_mismatch() { } #[tokio::test] -fn test_merge_unused_match() { +async fn test_merge_unused_match() { let air = r#"(call "peer" ("" "") [])"#; - let mut avm = create_avm(echo_call_service(), "peer"); + let mut avm = create_avm(echo_call_service(), "peer").await; let trace = ExecutionTrace::from(vec![unused!(42, peer = "peer")]); let data = raw_data_from_trace(trace, <_>::default()); @@ -470,16 +470,16 @@ fn test_merge_unused_match() { } #[tokio::test] -fn test_merge_unused_mismatch() { +async fn test_merge_unused_mismatch() { let air = r#"(call "peer" ("" "") [])"#; - let mut avm = create_avm(echo_call_service(), "peer"); + let mut avm = create_avm(echo_call_service(), "peer").await; let trace1 = ExecutionTrace::from(vec![unused!(42, peer = "peer")]); let trace2 = ExecutionTrace::from(vec![unused!(43, peer = "peer")]); let data1 = raw_data_from_trace(trace1, <_>::default()); let data2 = raw_data_from_trace(trace2, <_>::default()); - let result = avm.call(air, data1, data2, <_>::default()).unwrap(); + let result = avm.call(air, data1, data2, <_>::default()).await.unwrap(); // TODO rewrite here and above with assert_error_eq assert_eq!(result.ret_code, 20000); assert_eq!( diff --git a/air/tests/test_module/features/data_merging/executed_trace_basic.rs b/air/tests/test_module/features/data_merging/executed_trace_basic.rs index c4187a7ed0..dc1c1260a1 100644 --- a/air/tests/test_module/features/data_merging/executed_trace_basic.rs +++ b/air/tests/test_module/features/data_merging/executed_trace_basic.rs @@ -21,10 +21,10 @@ use air_test_utils::prelude::*; use pretty_assertions::assert_eq; #[tokio::test] -fn executed_trace_seq_par_call() { +async fn executed_trace_seq_par_call() { let local_peer_id = "local_peer_id"; let remote_peer_id = "remote_peer_id"; - let mut vm = create_avm(unit_call_service(), local_peer_id); + let mut vm = create_avm(unit_call_service(), local_peer_id).await; let script = format!( r#" @@ -88,10 +88,10 @@ fn executed_trace_seq_par_call() { } #[tokio::test] -fn executed_trace_par_par_call() { +async fn executed_trace_par_par_call() { let local_peer_id = "local_peer_id"; let remote_peer_id = "remote_peer_id"; - let mut vm = create_avm(unit_call_service(), local_peer_id); + let mut vm = create_avm(unit_call_service(), local_peer_id).await; let script = format!( r#" @@ -161,11 +161,11 @@ fn executed_trace_par_par_call() { } #[tokio::test] -fn executed_trace_seq_seq() { +async fn executed_trace_seq_seq() { let peer_id_1 = "12D3KooWHk9BjDQBUqnavciRPhAYFvqKBe4ZiPPvde7vDaqgn5er"; let peer_id_2 = "12D3KooWAzJcYitiZrerycVB4Wryrx22CFKdDGx7c4u31PFdfTbR"; - let mut vm1 = create_avm(unit_call_service(), peer_id_1); - let mut vm2 = create_avm(unit_call_service(), peer_id_2); + let mut vm1 = create_avm(unit_call_service(), peer_id_1).await; + let mut vm2 = create_avm(unit_call_service(), peer_id_2).await; let script = format!( r#" @@ -204,7 +204,7 @@ fn executed_trace_seq_seq() { } #[tokio::test] -fn executed_trace_create_service() { +async fn executed_trace_create_service() { let module = "greeting"; let module_config = json!( { @@ -238,7 +238,7 @@ fn executed_trace_create_service() { let init_peer_id = "A"; let set_variables_id = "set_variables"; - let mut vm = create_avm(call_service, init_peer_id); + let mut vm = create_avm(call_service, init_peer_id).await; let script = include_str!("./scripts/create_service.air"); @@ -303,14 +303,14 @@ fn executed_trace_create_service() { } #[tokio::test] -fn executed_trace_par_seq_fold_call() { +async fn executed_trace_par_seq_fold_call() { let return_numbers_call_service: CallServiceClosure = Box::new(|_| -> CallServiceResult { CallServiceResult::ok(json!(["1", "2", "3", "4", "5", "6", "7", "8", "9", "10"])) }); - let mut vm1 = create_avm(return_numbers_call_service, "some_peer_id_1"); - let mut vm2 = create_avm(echo_call_service(), "some_peer_id_2"); - let mut vm3 = create_avm(unit_call_service(), "some_peer_id_3"); + let mut vm1 = create_avm(return_numbers_call_service, "some_peer_id_1").await; + let mut vm2 = create_avm(echo_call_service(), "some_peer_id_2").await; + let mut vm3 = create_avm(unit_call_service(), "some_peer_id_3").await; let script = r#" (par @@ -450,14 +450,14 @@ fn executed_trace_par_seq_fold_call() { } #[tokio::test] -fn executed_trace_par_seq_fold_in_cycle_call() { +async fn executed_trace_par_seq_fold_in_cycle_call() { let return_numbers_call_service: CallServiceClosure = Box::new(|_| -> CallServiceResult { CallServiceResult::ok(json!(["1", "2", "3", "4", "5", "6", "7", "8", "9", "10"])) }); - let mut vm1 = create_avm(return_numbers_call_service, "some_peer_id_1"); - let mut vm2 = create_avm(echo_call_service(), "some_peer_id_2"); - let mut vm3 = create_avm(unit_call_service(), "some_peer_id_3"); + let mut vm1 = create_avm(return_numbers_call_service, "some_peer_id_1").await; + let mut vm2 = create_avm(echo_call_service(), "some_peer_id_2").await; + let mut vm3 = create_avm(unit_call_service(), "some_peer_id_3").await; let script = r#" (par @@ -596,11 +596,11 @@ fn executed_trace_par_seq_fold_in_cycle_call() { } #[tokio::test] -fn executed_trace_seq_par_seq_seq() { +async fn executed_trace_seq_par_seq_seq() { let peer_id_1 = "12D3KooWHk9BjDQBUqnavciRPhAYFvqKBe4ZiPPvde7vDaqgn5er"; let peer_id_2 = "12D3KooWAzJcYitiZrerycVB4Wryrx22CFKdDGx7c4u31PFdfTbR"; - let mut vm1 = create_avm(unit_call_service(), peer_id_1); - let mut vm2 = create_avm(unit_call_service(), peer_id_2); + let mut vm1 = create_avm(unit_call_service(), peer_id_1).await; + let mut vm2 = create_avm(unit_call_service(), peer_id_2).await; let script = format!( r#" (seq diff --git a/air/tests/test_module/features/errors/error.rs b/air/tests/test_module/features/errors/error.rs index f3689d4ce1..71f7a9b3be 100644 --- a/air/tests/test_module/features/errors/error.rs +++ b/air/tests/test_module/features/errors/error.rs @@ -20,7 +20,7 @@ use air_test_framework::AirScriptExecutor; use air_test_utils::prelude::*; #[tokio::test] -fn fail_with_rebubble_error() { +async fn fail_with_rebubble_error() { let peer_id = "peer_id"; let script = r#" (seq @@ -37,8 +37,9 @@ fn fail_with_rebubble_error() { .to_string(); let executor = AirScriptExecutor::from_annotated(TestRunParameters::from_init_peer_id(peer_id), &script) + .await .expect("invalid test AIR script"); - let result = executor.execute_all(peer_id).unwrap(); + let result = executor.execute_all(peer_id).await.unwrap(); let actual_trace = trace_from_result(&result.last().unwrap()); let mut cid_tracker: ExecutionCidState = ExecutionCidState::new(); @@ -73,7 +74,7 @@ fn fail_with_rebubble_error() { } #[tokio::test] -fn rebubble_error_from_xor_right_branch() { +async fn rebubble_error_from_xor_right_branch() { let peer_id = "peer_id"; let script = r#" (seq @@ -96,8 +97,9 @@ fn rebubble_error_from_xor_right_branch() { .to_string(); let executor = AirScriptExecutor::from_annotated(TestRunParameters::from_init_peer_id(peer_id), &script) + .await .expect("invalid test AIR script"); - let result = executor.execute_all(peer_id).unwrap(); + let result = executor.execute_all(peer_id).await.unwrap(); let actual_trace = trace_from_result(&result.last().unwrap()); let mut cid_tracker: ExecutionCidState = ExecutionCidState::new(); diff --git a/air/tests/test_module/features/errors/invalid_air.rs b/air/tests/test_module/features/errors/invalid_air.rs index eb50f4469d..78d3964517 100644 --- a/air/tests/test_module/features/errors/invalid_air.rs +++ b/air/tests/test_module/features/errors/invalid_air.rs @@ -18,9 +18,9 @@ use air::PreparationError; use air_test_utils::prelude::*; #[tokio::test] -fn invalid_air() { +async fn invalid_air() { let vm_peer_id = "some_peer_id"; - let mut vm = create_avm(unit_call_service(), vm_peer_id); + let mut vm = create_avm(unit_call_service(), vm_peer_id).await; let script = r#"(seq )"#; diff --git a/air/tests/test_module/features/errors/last_error.rs b/air/tests/test_module/features/errors/last_error.rs index 2dc055bc99..c9382d02fe 100644 --- a/air/tests/test_module/features/errors/last_error.rs +++ b/air/tests/test_module/features/errors/last_error.rs @@ -48,12 +48,12 @@ fn create_check_service_closure( } #[tokio::test] -fn last_error_tetraplets() { +async fn last_error_tetraplets() { let set_variable_peer_id = "set_variable"; - let mut set_variable_vm = create_avm(unit_call_service(), set_variable_peer_id); + let mut set_variable_vm = create_avm(unit_call_service(), set_variable_peer_id).await; let fallible_peer_id = "fallible_peer_id"; - let mut fallible_vm = create_avm(fallible_call_service("fallible_call_service"), fallible_peer_id); + let mut fallible_vm = create_avm(fallible_call_service("fallible_call_service"), fallible_peer_id).await; let local_peer_id = "local_peer_id"; @@ -62,7 +62,7 @@ fn last_error_tetraplets() { let mut local_vm = create_avm( create_check_service_closure(args.clone(), tetraplets.clone()), local_peer_id, - ); + ).await; let script = format!( include_str!("scripts/create_service_with_xor.air"), @@ -93,15 +93,15 @@ fn last_error_tetraplets() { } #[tokio::test] -fn not_clear_last_error_in_match() { +async fn not_clear_last_error_in_match() { let set_variable_peer_id = "set_variable"; - let mut set_variable_vm = create_avm(unit_call_service(), set_variable_peer_id); + let mut set_variable_vm = create_avm(unit_call_service(), set_variable_peer_id).await; let local_peer_id = "local_peer_id"; let args = Rc::new(RefCell::new(None)); let tetraplets = Rc::new(RefCell::new(None)); - let mut local_vm = create_avm(create_check_service_closure(args.clone(), tetraplets), local_peer_id); + let mut local_vm = create_avm(create_check_service_closure(args.clone(), tetraplets), local_peer_id).await; let script = format!( r#" @@ -128,15 +128,15 @@ fn not_clear_last_error_in_match() { } #[tokio::test] -fn not_clear_last_error_in_mismatch() { +async fn not_clear_last_error_in_mismatch() { let set_variable_peer_id = "set_variable"; - let mut set_variable_vm = create_avm(unit_call_service(), set_variable_peer_id); + let mut set_variable_vm = create_avm(unit_call_service(), set_variable_peer_id).await; let local_peer_id = "local_peer_id"; let args = Rc::new(RefCell::new(None)); let tetraplets = Rc::new(RefCell::new(None)); - let mut local_vm = create_avm(create_check_service_closure(args.clone(), tetraplets), local_peer_id); + let mut local_vm = create_avm(create_check_service_closure(args.clone(), tetraplets), local_peer_id).await; let script = format!( r#" @@ -163,15 +163,15 @@ fn not_clear_last_error_in_mismatch() { } #[tokio::test] -fn track_current_peer_id() { +async fn track_current_peer_id() { let fallible_peer_id = "fallible_peer_id"; - let mut fallible_vm = create_avm(fallible_call_service("fallible_call_service"), fallible_peer_id); + let mut fallible_vm = create_avm(fallible_call_service("fallible_call_service"), fallible_peer_id).await; let local_peer_id = "local_peer_id"; let args = Rc::new(RefCell::new(None)); let tetraplets = Rc::new(RefCell::new(None)); - let mut local_vm = create_avm(create_check_service_closure(args.clone(), tetraplets), local_peer_id); + let mut local_vm = create_avm(create_check_service_closure(args.clone(), tetraplets), local_peer_id).await; let script = format!( r#" @@ -191,12 +191,12 @@ fn track_current_peer_id() { } #[tokio::test] -fn variable_names_shown_in_error() { +async fn variable_names_shown_in_error() { let set_variable_vm_peer_id = "set_variable_vm_peer_id"; - let mut set_variable_vm = create_avm(set_variable_call_service(json!(1u32)), set_variable_vm_peer_id); + let mut set_variable_vm = create_avm(set_variable_call_service(json!(1u32)), set_variable_vm_peer_id).await; let echo_vm_peer_id = "echo_vm_peer_id"; - let mut echo_vm = create_avm(echo_call_service(), echo_vm_peer_id); + let mut echo_vm = create_avm(echo_call_service(), echo_vm_peer_id).await; let script = format!( r#" @@ -219,14 +219,14 @@ fn variable_names_shown_in_error() { } #[tokio::test] -fn non_initialized_last_error() { +async fn non_initialized_last_error() { let vm_peer_id = "vm_peer_id"; let args = Rc::new(RefCell::new(None)); let tetraplets = Rc::new(RefCell::new(None)); let mut vm = create_avm( create_check_service_closure(args.clone(), tetraplets.clone()), vm_peer_id, - ); + ).await; let script = format!( r#" @@ -251,9 +251,9 @@ fn non_initialized_last_error() { } #[tokio::test] -fn access_last_error_by_not_exists_field() { +async fn access_last_error_by_not_exists_field() { let fallible_peer_id = "fallible_peer_id"; - let mut fallible_vm = create_avm(fallible_call_service("fallible_call_service"), fallible_peer_id); + let mut fallible_vm = create_avm(fallible_call_service("fallible_call_service"), fallible_peer_id).await; let local_peer_id = "local_peer_id"; @@ -284,15 +284,15 @@ fn access_last_error_by_not_exists_field() { } #[tokio::test] -fn last_error_with_par_one_subgraph_failed() { +async fn last_error_with_par_one_subgraph_failed() { let fallible_peer_id = "fallible_peer_id"; let fallible_call_service_name = "fallible_call_service"; - let mut fallible_vm = create_avm(fallible_call_service(fallible_call_service_name), fallible_peer_id); + let mut fallible_vm = create_avm(fallible_call_service(fallible_call_service_name), fallible_peer_id).await; let vm_peer_id = "local_peer_id"; let args = Rc::new(RefCell::new(None)); let tetraplets = Rc::new(RefCell::new(None)); - let mut vm = create_avm(create_check_service_closure(args.clone(), tetraplets), vm_peer_id); + let mut vm = create_avm(create_check_service_closure(args.clone(), tetraplets), vm_peer_id).await; let script = format!( r#" (seq @@ -319,9 +319,9 @@ fn last_error_with_par_one_subgraph_failed() { } #[tokio::test] -fn fail_with_scalar_rebubble_error() { +async fn fail_with_scalar_rebubble_error() { let fallible_peer_id = "fallible_peer_id"; - let mut fallible_vm = create_avm(fallible_call_service("fallible_call_service"), fallible_peer_id); + let mut fallible_vm = create_avm(fallible_call_service("fallible_call_service"), fallible_peer_id).await; let script = format!( r#" @@ -349,12 +349,12 @@ fn fail_with_scalar_rebubble_error() { } #[tokio::test] -fn fail_with_scalar_from_call() { +async fn fail_with_scalar_from_call() { let vm_peer_id = "vm_peer_id"; let error_code = 1337; let error_message = "error message"; let service_result = json!({"error_code": error_code, "message": error_message}); - let mut vm = create_avm(set_variable_call_service(service_result), vm_peer_id); + let mut vm = create_avm(set_variable_call_service(service_result), vm_peer_id).await; let script = format!( r#" @@ -377,12 +377,12 @@ fn fail_with_scalar_from_call() { } #[tokio::test] -fn fail_with_scalar_with_lambda_from_call() { +async fn fail_with_scalar_with_lambda_from_call() { let vm_peer_id = "vm_peer_id"; let error_code = 1337; let error_message = "error message"; let service_result = json!({"error": {"error_code": error_code, "message": error_message}}); - let mut vm = create_avm(set_variable_call_service(service_result), vm_peer_id); + let mut vm = create_avm(set_variable_call_service(service_result), vm_peer_id).await; let script = format!( r#" @@ -405,11 +405,11 @@ fn fail_with_scalar_with_lambda_from_call() { } #[tokio::test] -fn fail_with_scalar_from_call_not_enough_fields() { +async fn fail_with_scalar_from_call_not_enough_fields() { let vm_peer_id = "vm_peer_id"; let error_code = 1337; let service_result = json!({ "error_code": error_code }); - let mut vm = create_avm(set_variable_call_service(service_result.clone()), vm_peer_id); + let mut vm = create_avm(set_variable_call_service(service_result.clone()), vm_peer_id).await; let script = format!( r#" @@ -430,10 +430,10 @@ fn fail_with_scalar_from_call_not_enough_fields() { } #[tokio::test] -fn fail_with_scalar_from_call_not_right_type() { +async fn fail_with_scalar_from_call_not_right_type() { let vm_peer_id = "vm_peer_id"; let service_result = json!([]); - let mut vm = create_avm(set_variable_call_service(service_result.clone()), vm_peer_id); + let mut vm = create_avm(set_variable_call_service(service_result.clone()), vm_peer_id).await; let script = format!( r#" @@ -451,10 +451,10 @@ fn fail_with_scalar_from_call_not_right_type() { } #[tokio::test] -fn fail_with_scalar_from_call_field_not_right_type() { +async fn fail_with_scalar_from_call_field_not_right_type() { let vm_peer_id = "vm_peer_id"; let service_result = json!({"error_code": "error_code", "message": "error message"}); - let mut vm = create_avm(set_variable_call_service(service_result.clone()), vm_peer_id); + let mut vm = create_avm(set_variable_call_service(service_result.clone()), vm_peer_id).await; let script = format!( r#" @@ -476,9 +476,9 @@ fn fail_with_scalar_from_call_field_not_right_type() { } #[tokio::test] -fn last_error_with_match() { +async fn last_error_with_match() { let vm_peer_id = "vm_peer_id"; - let mut vm = create_avm(fallible_call_service("fallible_call_service"), vm_peer_id); + let mut vm = create_avm(fallible_call_service("fallible_call_service"), vm_peer_id).await; let script = format!( r#" @@ -498,7 +498,7 @@ fn last_error_with_match() { } #[tokio::test] -fn undefined_last_error_errcode() { +async fn undefined_last_error_errcode() { let local_peer_id = "local_peer_id"; let script = format!( r#" @@ -507,8 +507,9 @@ fn undefined_last_error_errcode() { ); let executor = AirScriptExecutor::from_annotated(TestRunParameters::from_init_peer_id(local_peer_id), &script) + .await .expect("invalid test AIR script"); - let result = executor.execute_all(local_peer_id).unwrap(); + let result = executor.execute_all(local_peer_id).await.unwrap(); let actual_trace = trace_from_result(&result.last().unwrap()); let mut cid_state = ExecutionCidState::new(); @@ -526,7 +527,7 @@ fn undefined_last_error_errcode() { } #[tokio::test] -fn undefined_last_error_msg_errcode() { +async fn undefined_last_error_msg_errcode() { let local_peer_id = "local_peer_id"; let script = format!( r#" @@ -535,8 +536,9 @@ fn undefined_last_error_msg_errcode() { ); let executor = AirScriptExecutor::from_annotated(TestRunParameters::from_init_peer_id(local_peer_id), &script) + .await .expect("invalid test AIR script"); - let result = executor.execute_all(local_peer_id).unwrap(); + let result = executor.execute_all(local_peer_id).await.unwrap(); let actual_trace = trace_from_result(&result.last().unwrap()); let mut cid_state = ExecutionCidState::new(); diff --git a/air/tests/test_module/features/join_behaviour/join_behaviour.rs b/air/tests/test_module/features/join_behaviour/join_behaviour.rs index ea62fdab30..f4b1f0398b 100644 --- a/air/tests/test_module/features/join_behaviour/join_behaviour.rs +++ b/air/tests/test_module/features/join_behaviour/join_behaviour.rs @@ -19,7 +19,7 @@ use air::LambdaError; use air_test_utils::prelude::*; #[tokio::test] -fn dont_wait_on_json_path() { +async fn dont_wait_on_json_path() { let status = json!({ "err_msg": "", "is_authenticated": 1, @@ -36,10 +36,10 @@ fn dont_wait_on_json_path() { let set_variables_call_service = set_variables_call_service(variables, VariableOptionSource::Argument(0)); let set_variable_peer_id = "set_variable"; - let mut set_variable_vm = create_avm(set_variables_call_service, set_variable_peer_id); + let mut set_variable_vm = create_avm(set_variables_call_service, set_variable_peer_id).await; let local_peer_id = "local_peer_id"; - let mut local_vm = create_avm(unit_call_service(), local_peer_id); + let mut local_vm = create_avm(unit_call_service(), local_peer_id).await; let script = format!( r#" @@ -67,7 +67,7 @@ fn dont_wait_on_json_path() { } #[tokio::test] -fn dont_wait_on_json_path_on_scalars() { +async fn dont_wait_on_json_path_on_scalars() { let array = json!([1u32, 2u32, 3u32, 4u32, 5u32]); let object = json!({ @@ -84,13 +84,13 @@ fn dont_wait_on_json_path_on_scalars() { let set_variables_call_service = set_variables_call_service(variables, VariableOptionSource::Argument(0)); let set_variable_peer_id = "set_variable"; - let mut set_variable_vm = create_avm(set_variables_call_service, set_variable_peer_id); + let mut set_variable_vm = create_avm(set_variables_call_service, set_variable_peer_id).await; let array_consumer_peer_id = "array_consumer_peer_id"; - let mut array_consumer = create_avm(unit_call_service(), array_consumer_peer_id); + let mut array_consumer = create_avm(unit_call_service(), array_consumer_peer_id).await; let object_consumer_peer_id = "object_consumer_peer_id"; - let mut object_consumer = create_avm(unit_call_service(), object_consumer_peer_id); + let mut object_consumer = create_avm(unit_call_service(), object_consumer_peer_id).await; let script = format!( r#" @@ -129,11 +129,11 @@ fn dont_wait_on_json_path_on_scalars() { } #[tokio::test] -fn ap_scalar_with_join_behaviour() { +async fn ap_scalar_with_join_behaviour() { let peer_1_id = "peer_1_id"; let peer_2_id = "peer_2_id"; - let mut peer_1 = create_avm(unit_call_service(), peer_1_id); + let mut peer_1 = create_avm(unit_call_service(), peer_1_id).await; let script = format!( r#" @@ -153,11 +153,11 @@ fn ap_scalar_with_join_behaviour() { } #[tokio::test] -fn ap_stream_with_join_behaviour() { +async fn ap_stream_with_join_behaviour() { let peer_1_id = "peer_1_id"; let peer_2_id = "peer_2_id"; - let mut peer_1 = create_avm(unit_call_service(), peer_1_id); + let mut peer_1 = create_avm(unit_call_service(), peer_1_id).await; let script = format!( r#" @@ -177,11 +177,11 @@ fn ap_stream_with_join_behaviour() { } #[tokio::test] -fn match_with_join_behaviour() { +async fn match_with_join_behaviour() { let peer_1_id = "peer_1_id"; let peer_2_id = "peer_2_id"; - let mut peer_1 = create_avm(unit_call_service(), peer_1_id); + let mut peer_1 = create_avm(unit_call_service(), peer_1_id).await; let script = format!( r#" @@ -203,11 +203,11 @@ fn match_with_join_behaviour() { } #[tokio::test] -fn mismatch_with_join_behaviour() { +async fn mismatch_with_join_behaviour() { let peer_1_id = "peer_1_id"; let peer_2_id = "peer_2_id"; - let mut peer_1 = create_avm(unit_call_service(), peer_1_id); + let mut peer_1 = create_avm(unit_call_service(), peer_1_id).await; let script = format!( r#" @@ -229,11 +229,11 @@ fn mismatch_with_join_behaviour() { } #[tokio::test] -fn fold_with_join_behaviour() { +async fn fold_with_join_behaviour() { let peer_1_id = "peer_1_id"; let peer_2_id = "peer_2_id"; - let mut peer_1 = create_avm(unit_call_service(), peer_1_id); + let mut peer_1 = create_avm(unit_call_service(), peer_1_id).await; let script = format!( r#" @@ -255,10 +255,10 @@ fn fold_with_join_behaviour() { } #[tokio::test] -fn canon_with_empty_behaviour() { +async fn canon_with_empty_behaviour() { let peer_id = "peer_id"; - let mut peer_2 = create_avm(unit_call_service(), peer_id); + let mut peer_2 = create_avm(unit_call_service(), peer_id).await; let script = format!( r#" diff --git a/air/tests/test_module/features/lambda/flattening.rs b/air/tests/test_module/features/lambda/flattening.rs index d12c729ea5..535d2e03b6 100644 --- a/air/tests/test_module/features/lambda/flattening.rs +++ b/air/tests/test_module/features/lambda/flattening.rs @@ -45,18 +45,18 @@ fn create_check_service_closure(closure_call_args: ClosureCallArgs) -> CallServi } #[tokio::test] -fn flattening_scalar_arrays() { +async fn flattening_scalar_arrays() { let scalar_array = json!({"iterable": [ {"peer_id" : "local_peer_id", "service_id": "local_service_id", "function_name": "local_function_name", "args": [0, 1]}, {"peer_id" : "local_peer_id", "service_id": "local_service_id", "function_name": "local_function_name", "args": [2, 3]}, ]}); let set_variable_peer_id = "set_variable"; - let mut set_variable_vm = create_avm(set_variable_call_service(scalar_array), set_variable_peer_id); + let mut set_variable_vm = create_avm(set_variable_call_service(scalar_array), set_variable_peer_id).await; let closure_call_args = ClosureCallArgs::default(); let local_peer_id = "local_peer_id"; - let mut local_vm = create_avm(create_check_service_closure(closure_call_args.clone()), local_peer_id); + let mut local_vm = create_avm(create_check_service_closure(closure_call_args.clone()), local_peer_id).await; let script = format!( r#" @@ -89,17 +89,17 @@ fn flattening_scalar_arrays() { #[tokio::test] #[ignore] -fn flattening_streams() { +async fn flattening_streams() { let stream_value = json!( {"peer_id" : "local_peer_id", "service_id": "local_service_id", "function_name": "local_function_name", "args": [0, 1]} ); let set_variable_peer_id = "set_variable"; - let mut set_variable_vm = create_avm(set_variable_call_service(stream_value), set_variable_peer_id); + let mut set_variable_vm = create_avm(set_variable_call_service(stream_value), set_variable_peer_id).await; let closure_call_args = ClosureCallArgs::default(); let local_peer_id = "local_peer_id"; - let mut local_vm = create_avm(create_check_service_closure(closure_call_args.clone()), local_peer_id); + let mut local_vm = create_avm(create_check_service_closure(closure_call_args.clone()), local_peer_id).await; let script = format!( r#" @@ -138,17 +138,17 @@ fn flattening_streams() { #[tokio::test] #[ignore] -fn test_handling_non_flattening_values() { +async fn test_handling_non_flattening_values() { let stream_value = json!( {"peer_id" : "local_peer_id", "service_id": "local_service_id", "function_name": "local_function_name", "args": [0, 1]} ); let set_variable_peer_id = "set_variable"; - let mut set_variable_vm = create_avm(set_variable_call_service(stream_value), set_variable_peer_id); + let mut set_variable_vm = create_avm(set_variable_call_service(stream_value), set_variable_peer_id).await; let closure_call_args = ClosureCallArgs::default(); let local_peer_id = "local_peer_id"; - let mut local_vm = create_avm(create_check_service_closure(closure_call_args), local_peer_id); + let mut local_vm = create_avm(create_check_service_closure(closure_call_args), local_peer_id).await; let script = format!( r#" diff --git a/air/tests/test_module/features/lambda/functors.rs b/air/tests/test_module/features/lambda/functors.rs index 6d0bf7548b..04b42c45f3 100644 --- a/air/tests/test_module/features/lambda/functors.rs +++ b/air/tests/test_module/features/lambda/functors.rs @@ -22,7 +22,7 @@ use pretty_assertions::assert_eq; use std::cell::RefCell; #[tokio::test] -fn length_functor_for_array_scalar() { +async fn length_functor_for_array_scalar() { let script = r#" (seq (call %init_peer_id% ("" "") [] variable) ; ok = [1,1,1] @@ -32,9 +32,10 @@ fn length_functor_for_array_scalar() { let init_peer_name = "init_peer_id"; let executor = AirScriptExecutor::from_annotated(TestRunParameters::from_init_peer_id(init_peer_name), script) + .await .expect("invalid test AIR script"); - let result = executor.execute_one(init_peer_name).unwrap(); + let result = executor.execute_one(init_peer_name).await.unwrap(); let actual_trace = trace_from_result(&result); let expected_trace = vec![ @@ -45,7 +46,7 @@ fn length_functor_for_array_scalar() { } #[tokio::test] -fn length_functor_for_non_array_scalar() { +async fn length_functor_for_non_array_scalar() { let result_jvalue = "string_jvalue"; let script = format!( r#" @@ -58,9 +59,10 @@ fn length_functor_for_non_array_scalar() { let init_peer_name = "init_peer_id"; let executor = AirScriptExecutor::from_annotated(TestRunParameters::from_init_peer_id(init_peer_name), &script) + .await .expect("invalid test AIR script"); - let result = executor.execute_one(init_peer_name).unwrap(); + let result = executor.execute_one(init_peer_name).await.unwrap(); check_error( &result, CatchableError::LengthFunctorAppliedToNotArray(json!(result_jvalue)), @@ -68,7 +70,7 @@ fn length_functor_for_non_array_scalar() { } #[tokio::test] -fn length_functor_for_stream() { +async fn length_functor_for_stream() { let script = r#" (seq (seq @@ -83,9 +85,10 @@ fn length_functor_for_stream() { let init_peer_name = "init_peer_id"; let executor = AirScriptExecutor::from_annotated(TestRunParameters::from_init_peer_id(init_peer_name), script) + .await .expect("invalid test AIR script"); - let result = executor.execute_one(init_peer_name).unwrap(); + let result = executor.execute_one(init_peer_name).await.unwrap(); let actual_trace = trace_from_result(&result); let init_peer_id = executor.resolve_name(init_peer_name).to_string(); @@ -114,7 +117,7 @@ fn length_functor_for_stream() { } #[tokio::test] -fn length_functor_for_empty_stream() { +async fn length_functor_for_empty_stream() { let script = r#" (new $stream (seq @@ -126,9 +129,10 @@ fn length_functor_for_empty_stream() { let init_peer_name = "init_peer_id"; let executor = AirScriptExecutor::from_annotated(TestRunParameters::from_init_peer_id(init_peer_name), script) + .await .expect("invalid test AIR script"); - let result = executor.execute_one(init_peer_name).unwrap(); + let result = executor.execute_one(init_peer_name).await.unwrap(); let actual_trace = trace_from_result(&result); let init_peer_id = executor.resolve_name(init_peer_name).to_string(); @@ -144,7 +148,7 @@ fn length_functor_for_empty_stream() { } #[tokio::test] -fn length_functor_for_canon_stream() { +async fn length_functor_for_canon_stream() { let script = r#" (seq (seq @@ -159,9 +163,10 @@ fn length_functor_for_canon_stream() { let init_peer_name = "init_peer_id"; let executor = AirScriptExecutor::from_annotated(TestRunParameters::from_init_peer_id(init_peer_name), script) + .await .expect("invalid test AIR script"); - let result = executor.execute_one(init_peer_name).unwrap(); + let result = executor.execute_one(init_peer_name).await.unwrap(); let actual_trace = trace_from_result(&result); let init_peer_id = executor.resolve_name(init_peer_name).to_string(); @@ -181,7 +186,7 @@ fn length_functor_for_canon_stream() { } #[tokio::test] -fn length_functor_for_empty_canon_stream() { +async fn length_functor_for_empty_canon_stream() { let script = r#" (new $stream (seq @@ -193,9 +198,10 @@ fn length_functor_for_empty_canon_stream() { let init_peer_name = "init_peer_id"; let executor = AirScriptExecutor::from_annotated(TestRunParameters::from_init_peer_id(init_peer_name), script) + .await .expect("invalid test AIR script"); - let result = executor.execute_one(init_peer_name).unwrap(); + let result = executor.execute_one(init_peer_name).await.unwrap(); let actual_trace = trace_from_result(&result); let init_peer_id = executor.resolve_name(init_peer_name).to_string(); @@ -210,17 +216,17 @@ fn length_functor_for_empty_canon_stream() { } #[tokio::test] -fn functor_dont_influence_tetraplet() { +async fn functor_dont_influence_tetraplet() { let set_variable_peer_id = "set_variable_peer_id"; let set_variable_peer_result = json!({"field": [1,2,3]}); let mut set_variable_vm = create_avm( set_variable_call_service(set_variable_peer_result.clone()), set_variable_peer_id, - ); + ).await; let tetraplet_catcher_peer_id = "tetraplet_catcher_peer_id"; let (call_service, actual_tetraplet) = tetraplet_host_function(echo_call_service()); - let mut tetraplet_catcher_vm = create_avm(call_service, tetraplet_catcher_peer_id); + let mut tetraplet_catcher_vm = create_avm(call_service, tetraplet_catcher_peer_id).await; let script = format!( r#" diff --git a/air/tests/test_module/features/lambda/lambda.rs b/air/tests/test_module/features/lambda/lambda.rs index ae310b32a4..c61faf7dcb 100644 --- a/air/tests/test_module/features/lambda/lambda.rs +++ b/air/tests/test_module/features/lambda/lambda.rs @@ -19,9 +19,9 @@ use air::LambdaError; use air_test_utils::prelude::*; #[tokio::test] -fn lambda_not_allowed_for_non_objects_and_arrays() { +async fn lambda_not_allowed_for_non_objects_and_arrays() { let set_variable_peer_id = "set_variable"; - let mut set_variable_vm = create_avm(echo_call_service(), set_variable_peer_id); + let mut set_variable_vm = create_avm(echo_call_service(), set_variable_peer_id).await; let local_peer_id = "local_peer_id"; @@ -45,7 +45,7 @@ fn lambda_not_allowed_for_non_objects_and_arrays() { } #[tokio::test] -fn lambda_with_string_scalar() { +async fn lambda_with_string_scalar() { let set_variable_peer_id = "set_variable"; let variables = maplit::hashmap! { "string_accessor".to_string() => json!("some_field_name"), @@ -54,10 +54,10 @@ fn lambda_with_string_scalar() { let mut set_variable_vm = create_avm( set_variables_call_service(variables, VariableOptionSource::FunctionName), set_variable_peer_id, - ); + ).await; let local_peer_id = "local_peer_id"; - let mut local_vm = create_avm(echo_call_service(), local_peer_id); + let mut local_vm = create_avm(echo_call_service(), local_peer_id).await; let script = format!( r#" @@ -79,7 +79,7 @@ fn lambda_with_string_scalar() { } #[tokio::test] -fn lambda_with_number_scalar() { +async fn lambda_with_number_scalar() { let set_variable_peer_id = "set_variable"; let variables = maplit::hashmap! { "number_accessor".to_string() => json!(1u32), @@ -88,10 +88,10 @@ fn lambda_with_number_scalar() { let mut set_variable_vm = create_avm( set_variables_call_service(variables, VariableOptionSource::FunctionName), set_variable_peer_id, - ); + ).await; let local_peer_id = "local_peer_id"; - let mut local_vm = create_avm(echo_call_service(), local_peer_id); + let mut local_vm = create_avm(echo_call_service(), local_peer_id).await; let script = format!( r#" @@ -113,7 +113,7 @@ fn lambda_with_number_scalar() { } #[tokio::test] -fn lambda_with_number_stream() { +async fn lambda_with_number_stream() { let set_variable_peer_id = "set_variable"; let variables = maplit::hashmap! { "number_accessor".to_string() => json!(1), @@ -122,10 +122,10 @@ fn lambda_with_number_stream() { let mut set_variable_vm = create_avm( set_variables_call_service(variables, VariableOptionSource::FunctionName), set_variable_peer_id, - ); + ).await; let local_peer_id = "local_peer_id"; - let mut local_vm = create_avm(echo_call_service(), local_peer_id); + let mut local_vm = create_avm(echo_call_service(), local_peer_id).await; let script = format!( r#" @@ -161,7 +161,7 @@ fn lambda_with_number_stream() { } #[tokio::test] -fn lambda_with_number_stream_and_followed_scalar() { +async fn lambda_with_number_stream_and_followed_scalar() { let set_variable_peer_id = "set_variable"; let checkable_value = 1337; let variables = maplit::hashmap! { @@ -172,10 +172,10 @@ fn lambda_with_number_stream_and_followed_scalar() { let mut set_variable_vm = create_avm( set_variables_call_service(variables, VariableOptionSource::FunctionName), set_variable_peer_id, - ); + ).await; let local_peer_id = "local_peer_id"; - let mut local_vm = create_avm(echo_call_service(), local_peer_id); + let mut local_vm = create_avm(echo_call_service(), local_peer_id).await; let script = format!( r#" @@ -214,7 +214,7 @@ fn lambda_with_number_stream_and_followed_scalar() { } #[tokio::test] -fn lambda_with_scalar_join() { +async fn lambda_with_scalar_join() { let set_variable_peer_id = "set_variable"; let variables = maplit::hashmap! { "string_accessor".to_string() => json!("some_field_name"), @@ -223,10 +223,10 @@ fn lambda_with_scalar_join() { let mut set_variable_vm = create_avm( set_variables_call_service(variables, VariableOptionSource::FunctionName), set_variable_peer_id, - ); + ).await; let local_peer_id = "local_peer_id"; - let mut local_vm = create_avm(echo_call_service(), local_peer_id); + let mut local_vm = create_avm(echo_call_service(), local_peer_id).await; let script = format!( r#" @@ -251,7 +251,7 @@ fn lambda_with_scalar_join() { // after 0.32 version AIR is no longer supports lambdas over stream, // although this test could be useful in the future for functors #[tokio::test] -fn lambda_with_canon_stream_join() { +async fn lambda_with_canon_stream_join() { let set_variable_peer_id = "set_variable"; let variables = maplit::hashmap! { "number_accessor".to_string() => json!(1), @@ -260,10 +260,10 @@ fn lambda_with_canon_stream_join() { let mut set_variable_vm = create_avm( set_variables_call_service(variables, VariableOptionSource::FunctionName), set_variable_peer_id, - ); + ).await; let local_peer_id = "local_peer_id"; - let mut local_vm = create_avm(echo_call_service(), local_peer_id); + let mut local_vm = create_avm(echo_call_service(), local_peer_id).await; let script = format!( r#" diff --git a/air/tests/test_module/features/misc/empty_array.rs b/air/tests/test_module/features/misc/empty_array.rs index 53e764f7c2..f52c2b518c 100644 --- a/air/tests/test_module/features/misc/empty_array.rs +++ b/air/tests/test_module/features/misc/empty_array.rs @@ -17,9 +17,9 @@ use air_test_utils::prelude::*; #[tokio::test] -fn empty_array() { +async fn empty_array() { let vm_peer_id = "some_peer_id"; - let mut vm = create_avm(echo_call_service(), vm_peer_id); + let mut vm = create_avm(echo_call_service(), vm_peer_id).await; let script = format!( r#" diff --git a/air/tests/test_module/features/misc/version_check.rs b/air/tests/test_module/features/misc/version_check.rs index 7dfbaca5d8..551b461c91 100644 --- a/air/tests/test_module/features/misc/version_check.rs +++ b/air/tests/test_module/features/misc/version_check.rs @@ -20,8 +20,8 @@ use air_interpreter_interface::INTERPRETER_SUCCESS; use air_test_utils::prelude::*; #[tokio::test] -fn minimal_version_check() { - let mut vm = create_avm(echo_call_service(), ""); +async fn minimal_version_check() { + let mut vm = create_avm(echo_call_service(), "").await; let script = "(null)"; let actual_version = semver::Version::new(0, 31, 1); @@ -38,8 +38,8 @@ fn minimal_version_check() { } #[tokio::test] -fn publish_version_check() { - let mut vm = create_avm(echo_call_service(), ""); +async fn publish_version_check() { + let mut vm = create_avm(echo_call_service(), "").await; let script = "(null)"; let actual_version = @@ -52,8 +52,8 @@ fn publish_version_check() { } #[tokio::test] -fn publish_unsupported_version_check() { - let mut vm = create_avm(echo_call_service(), ""); +async fn publish_unsupported_version_check() { + let mut vm = create_avm(echo_call_service(), "").await; let actual_version = semver::Version::parse("0.31.1-feat-VM-173-add-interpreter-version-in-data-a2d575b-205-1.0").unwrap(); diff --git a/air/tests/test_module/features/scopes/scalars_scope.rs b/air/tests/test_module/features/scopes/scalars_scope.rs index 48da3ca5ff..5f9846e347 100644 --- a/air/tests/test_module/features/scopes/scalars_scope.rs +++ b/air/tests/test_module/features/scopes/scalars_scope.rs @@ -19,18 +19,18 @@ use air::ExecutionError; use air_test_utils::prelude::*; #[tokio::test] -fn scalars_scope() { +async fn scalars_scope() { let peer_1_id = "peer_1_id"; let array_1_content = json!(["1", "2"]); - let mut peer_1_vm = create_avm(set_variable_call_service(array_1_content.clone()), peer_1_id); + let mut peer_1_vm = create_avm(set_variable_call_service(array_1_content.clone()), peer_1_id).await; let some_peer_id = "some_peer_id"; - let mut some_peer_vm = create_avm(unit_call_service(), some_peer_id); + let mut some_peer_vm = create_avm(unit_call_service(), some_peer_id).await; let set_array_0_peer_id = "set_array_0_peer_id"; let peer_2_id = "peer_2_id"; let peers = json!([peer_1_id, peer_2_id]); - let mut set_array_0_vm = create_avm(set_variable_call_service(peers.clone()), set_array_0_peer_id); + let mut set_array_0_vm = create_avm(set_variable_call_service(peers.clone()), set_array_0_peer_id).await; let script = format!( r#" @@ -74,10 +74,10 @@ fn scalars_scope() { } #[tokio::test] -fn before_after_of_next() { +async fn before_after_of_next() { let set_array_0_peer_id = "set_array_0_peer_id"; let array_0_content = json!([1, 2, 3]); - let mut set_array_0_vm = create_avm(set_variable_call_service(array_0_content.clone()), set_array_0_peer_id); + let mut set_array_0_vm = create_avm(set_variable_call_service(array_0_content.clone()), set_array_0_peer_id).await; let vm_peer_0_id = "vm_peer_0_id"; let counter = std::cell::Cell::new(0); @@ -86,10 +86,10 @@ fn before_after_of_next() { counter.set(uncelled_request_id + 1); CallServiceResult::ok(json!(uncelled_request_id)) }); - let mut peer_0_vm = create_avm(vm_peer_0_call_service, vm_peer_0_id); + let mut peer_0_vm = create_avm(vm_peer_0_call_service, vm_peer_0_id).await; let vm_peer_1_id = "vm_peer_1_id"; - let mut peer_1_vm = create_avm(echo_call_service(), vm_peer_1_id); + let mut peer_1_vm = create_avm(echo_call_service(), vm_peer_1_id).await; let script = format!( r#" @@ -125,13 +125,13 @@ fn before_after_of_next() { } #[tokio::test] -fn local_and_global_scalars() { +async fn local_and_global_scalars() { let set_variable_peer_id = "set_variable_peer_id"; let iterable_content = json!([1i64, 2]); let mut set_variable_vm = create_avm( set_variable_call_service(iterable_content.clone()), set_variable_peer_id, - ); + ).await; let local_setter_peer_id = "local_setter_peer_id"; let counter = std::cell::Cell::new(0); @@ -140,10 +140,10 @@ fn local_and_global_scalars() { counter.set(uncelled_request_id + 1); CallServiceResult::ok(json!(uncelled_request_id)) }); - let mut local_setter_vm = create_avm(local_setter_call_service, local_setter_peer_id); + let mut local_setter_vm = create_avm(local_setter_call_service, local_setter_peer_id).await; let local_consumer_peer_id = "local_consumer_peer_id"; - let mut local_consumer_vm = create_avm(echo_call_service(), local_consumer_peer_id); + let mut local_consumer_vm = create_avm(echo_call_service(), local_consumer_peer_id).await; let script = format!( r#" @@ -214,9 +214,9 @@ fn local_and_global_scalars() { } #[tokio::test] -fn new_with_randomly_set_scalars_in_fold_1() { +async fn new_with_randomly_set_scalars_in_fold_1() { let test_peer_id_1 = "test_peer_id_1"; - let mut test_vm_1 = create_avm(set_variable_call_service(json!([1, 2, 3])), test_peer_id_1); + let mut test_vm_1 = create_avm(set_variable_call_service(json!([1, 2, 3])), test_peer_id_1).await; let test_peer_id_2 = "test_peer_id_2"; let script = format!( @@ -254,9 +254,9 @@ fn new_with_randomly_set_scalars_in_fold_1() { } #[tokio::test] -fn new_with_randomly_set_scalars_in_fold_2() { +async fn new_with_randomly_set_scalars_in_fold_2() { let test_peer_id_1 = "test_peer_id_1"; - let mut test_vm_1 = create_avm(set_variable_call_service(json!([1, 2, 3])), test_peer_id_1); + let mut test_vm_1 = create_avm(set_variable_call_service(json!([1, 2, 3])), test_peer_id_1).await; let test_peer_id_2 = "test_peer_id_2"; let variable_name = "scalar"; diff --git a/air/tests/test_module/features/scopes/scopes_behaviour_with_errors.rs b/air/tests/test_module/features/scopes/scopes_behaviour_with_errors.rs index db4d9210ef..b3403f8f50 100644 --- a/air/tests/test_module/features/scopes/scopes_behaviour_with_errors.rs +++ b/air/tests/test_module/features/scopes/scopes_behaviour_with_errors.rs @@ -20,15 +20,15 @@ use air_test_utils::prelude::*; use pretty_assertions::assert_eq; #[tokio::test] -fn check_that_scalar_is_visible_only_inside_fold_block() { +async fn check_that_scalar_is_visible_only_inside_fold_block() { let variable_setter_peer_id = "variable_setter_peer_id"; - let mut variable_setter_vm = create_avm(set_variable_call_service(json!([1, 2, 3])), variable_setter_peer_id); + let mut variable_setter_vm = create_avm(set_variable_call_service(json!([1, 2, 3])), variable_setter_peer_id).await; let fallible_peer_id = "fallible_peer_id"; - let mut fallible_peer_vm = create_avm(fallible_call_service("fail"), fallible_peer_id); + let mut fallible_peer_vm = create_avm(fallible_call_service("fail"), fallible_peer_id).await; let variable_receiver_peer_id = "variable_receiver_peer_id"; - let mut variable_receiver_peer_vm = create_avm(echo_call_service(), variable_receiver_peer_id); + let mut variable_receiver_peer_vm = create_avm(echo_call_service(), variable_receiver_peer_id).await; let script = format!( r#" @@ -77,15 +77,15 @@ fn check_that_scalar_is_visible_only_inside_fold_block() { } #[tokio::test] -fn scopes_check_that_scalar_not_overwritten_by_fold_end() { +async fn scopes_check_that_scalar_not_overwritten_by_fold_end() { let variable_setter_peer_id = "variable_setter_peer_id"; - let mut variable_setter_vm = create_avm(set_variable_call_service(json!([1, 2, 3])), variable_setter_peer_id); + let mut variable_setter_vm = create_avm(set_variable_call_service(json!([1, 2, 3])), variable_setter_peer_id).await; let fallible_peer_id = "fallible_peer_id"; - let mut fallible_peer_vm = create_avm(fallible_call_service("fail"), fallible_peer_id); + let mut fallible_peer_vm = create_avm(fallible_call_service("fail"), fallible_peer_id).await; let variable_receiver_peer_id = "variable_receiver_peer_id"; - let mut variable_receiver_peer_vm = create_avm(echo_call_service(), variable_receiver_peer_id); + let mut variable_receiver_peer_vm = create_avm(echo_call_service(), variable_receiver_peer_id).await; let script = format!( r#" diff --git a/air/tests/test_module/features/signatures/algorithms.rs b/air/tests/test_module/features/signatures/algorithms.rs index cdf67e1f7a..7d6dd94b1e 100644 --- a/air/tests/test_module/features/signatures/algorithms.rs +++ b/air/tests/test_module/features/signatures/algorithms.rs @@ -74,7 +74,7 @@ fn test_banned_signature() { let current_data = data_env.serialize().unwrap(); - let mut avm = create_avm(unit_call_service(), "other_peer_id"); + let mut avm = create_avm(unit_call_service(), "other_peer_id").await; let res = avm .call( air_script, @@ -82,7 +82,7 @@ fn test_banned_signature() { current_data, TestRunParameters::from_init_peer_id("init_peer_fake_id"), ) - .unwrap(); + .await.unwrap(); assert_error_eq!( &res, @@ -95,13 +95,14 @@ fn test_banned_signature() { /// Checking that local key is valid. #[tokio::test] -fn test_banned_signing_key() { +async fn test_banned_signing_key() { let air_script = "(null)"; let bad_algo_keypair = fluence_keypair::KeyPair::generate_secp256k1(); - let mut avm = create_avm_with_key::(bad_algo_keypair, unit_call_service()); + let mut avm = create_avm_with_key::(bad_algo_keypair, unit_call_service()).await; let res = avm .call(air_script, "", "", TestRunParameters::from_init_peer_id("init_peer_id")) + .await .unwrap(); assert_error_eq!( diff --git a/air/tests/test_module/features/signatures/attacks.rs b/air/tests/test_module/features/signatures/attacks.rs index eb593c5342..62f0d081ac 100644 --- a/air/tests/test_module/features/signatures/attacks.rs +++ b/air/tests/test_module/features/signatures/attacks.rs @@ -28,7 +28,7 @@ use std::rc::Rc; /// CID store manipulations are checked in the `corruption` module. #[tokio::test] -fn test_attack_injection_current_peer_scalar() { +async fn test_attack_injection_current_peer_scalar() { // injecting a value that arrives to peer who does the next step let (alice_keypair, alice_peer_id) = derive_dummy_keypair("alice_peer"); let (mallory_keypair, mallory_peer_id) = derive_dummy_keypair("mallory_peer"); @@ -80,18 +80,18 @@ fn test_attack_injection_current_peer_scalar() { Version::new(1, 1, 1), ); - let mut alice_avm = create_avm_with_key::(alice_keypair, unit_call_service()); + let mut alice_avm = create_avm_with_key::(alice_keypair, unit_call_service()).await; let test_run_params = TestRunParameters::from_init_peer_id(alice_peer_id); let prev_data = alice_data.serialize().unwrap(); let cur_data = mallory_data.serialize().unwrap(); let res = alice_avm .call(&air_script, prev_data, cur_data, test_run_params) - .unwrap(); + .await.unwrap(); assert_ne!(res.ret_code, 0); } #[tokio::test] -fn test_attack_injection_current_peer_stream() { +async fn test_attack_injection_current_peer_stream() { // injecting a value that arrives to peer who does the next step let alice_peer_id = "alice_peer"; let mallory_peer_id = "mallory_peer"; @@ -151,18 +151,19 @@ fn test_attack_injection_current_peer_stream() { Version::new(1, 1, 1), ); - let mut alice_avm = create_avm_with_key::(alice_keypair, unit_call_service()); + let mut alice_avm = create_avm_with_key::(alice_keypair, unit_call_service()).await; let test_run_params = TestRunParameters::from_init_peer_id(alice_peer_id); let prev_data = alice_data.serialize().unwrap(); let cur_data = mallory_data.serialize().unwrap(); let res = alice_avm .call(&air_script, prev_data, cur_data, test_run_params) + .await .unwrap(); assert_ne!(res.ret_code, 0, "{}", res.error_message); } #[tokio::test] -fn test_attack_injection_current_injection_unused() { +async fn test_attack_injection_current_injection_unused() { // injecting a value that arrives to peer who does the next step let alice_peer_id = "alice_peer"; let mallory_peer_id = "mallory_peer"; @@ -220,19 +221,19 @@ fn test_attack_injection_current_injection_unused() { Version::new(1, 1, 1), ); - let mut alice_avm = create_avm_with_key::(alice_keypair, unit_call_service()); + let mut alice_avm = create_avm_with_key::(alice_keypair, unit_call_service()).await; let test_run_params = TestRunParameters::from_init_peer_id(alice_peer_id); let prev_data = alice_data.serialize().unwrap(); let cur_data = mallory_data.serialize().unwrap(); let res = alice_avm .call(&air_script, prev_data, cur_data, test_run_params) - .unwrap(); + .await.unwrap(); assert_ne!(res.ret_code, 0, "{}", res.error_message); } #[tokio::test] -fn test_attack_injection_other_peer_scalar() { +async fn test_attack_injection_other_peer_scalar() { // injecting a value that arrives to peer who does the next step let alice_peer_id = "alice_peer"; let bob_peer_id = "bob_peer"; @@ -281,16 +282,16 @@ fn test_attack_injection_other_peer_scalar() { Version::new(1, 1, 1), ); - let mut bob_avm = create_avm_with_key::(bob_keypair, unit_call_service()); + let mut bob_avm = create_avm_with_key::(bob_keypair, unit_call_service()).await; let test_run_params = TestRunParameters::from_init_peer_id(alice_peer_id); let prev_data = ""; let cur_data = mallory_data.serialize().unwrap(); - let res = bob_avm.call(&air_script, prev_data, cur_data, test_run_params).unwrap(); + let res = bob_avm.call(&air_script, prev_data, cur_data, test_run_params).await.unwrap(); assert_ne!(res.ret_code, 0); } #[tokio::test] -fn test_attack_injection_other_peer_stream() { +async fn test_attack_injection_other_peer_stream() { // injecting a value that arrives to peer who does the next step let alice_peer_id = "alice_peer"; let bob_peer_id = "bob_peer"; @@ -339,16 +340,16 @@ fn test_attack_injection_other_peer_stream() { Version::new(1, 1, 1), ); - let mut bob_avm = create_avm_with_key::(bob_keypair, unit_call_service()); + let mut bob_avm = create_avm_with_key::(bob_keypair, unit_call_service()).await; let test_run_params = TestRunParameters::from_init_peer_id(alice_peer_id); let prev_data = ""; let cur_data = mallory_data.serialize().unwrap(); - let res = bob_avm.call(&air_script, prev_data, cur_data, test_run_params).unwrap(); + let res = bob_avm.call(&air_script, prev_data, cur_data, test_run_params).await.unwrap(); assert_ne!(res.ret_code, 0, "{}", res.error_message); } #[tokio::test] -fn test_attack_injection_other_peer_unused() { +async fn test_attack_injection_other_peer_unused() { // injecting a value that arrives to peer who does the next step let alice_peer_id = "alice_peer"; let bob_peer_id = "bob_peer"; @@ -397,18 +398,18 @@ fn test_attack_injection_other_peer_unused() { Version::new(1, 1, 1), ); - let mut bob_avm = create_avm_with_key::(bob_keypair, unit_call_service()); + let mut bob_avm = create_avm_with_key::(bob_keypair, unit_call_service()).await; let test_run_params = TestRunParameters::from_init_peer_id(alice_peer_id); let prev_data = ""; let cur_data = mallory_data.serialize().unwrap(); - let res = bob_avm.call(&air_script, prev_data, cur_data, test_run_params).unwrap(); + let res = bob_avm.call(&air_script, prev_data, cur_data, test_run_params).await.unwrap(); // please not that such injection is not caught assert_eq!(res.ret_code, 0, "{}", res.error_message); } #[tokio::test] -fn test_attack_replay() { +async fn test_attack_replay() { let alice_name = "alice_peer_id"; let bob_name = "bob_peer_id"; let (alice_keypair, alice_peer_id) = derive_dummy_keypair(alice_name); @@ -420,19 +421,19 @@ fn test_attack_replay() { (call "bob" ("" "") [] z))"# ); - let mut alice_avm = create_avm_with_key::(alice_keypair.clone(), unit_call_service()); - let mut bob_avm = create_avm_with_key::(bob_keypair.clone(), unit_call_service()); + let mut alice_avm = create_avm_with_key::(alice_keypair.clone(), unit_call_service()).await; + let mut bob_avm = create_avm_with_key::(bob_keypair.clone(), unit_call_service()).await; let run_params1 = TestRunParameters::from_init_peer_id(&alice_peer_id).with_particle_id("first_particle"); let run_params2 = run_params1.clone(); - let res1 = alice_avm.call(&air_script, "", "", run_params1.clone()).unwrap(); - let res2 = alice_avm.call(&air_script, "", "", run_params2).unwrap(); + let res1 = alice_avm.call(&air_script, "", "", run_params1.clone()).await.unwrap(); + let res2 = alice_avm.call(&air_script, "", "", run_params2).await.unwrap(); assert_eq!(res1.ret_code, 0, "test validity check failed: {}", res1.error_message); assert_eq!(res1, res2, "test validity check failed"); - let res_bob = bob_avm.call(&air_script, "", res1.data.clone(), run_params1).unwrap(); + let res_bob = bob_avm.call(&air_script, "", res1.data.clone(), run_params1).await.unwrap(); assert_eq!( res_bob.ret_code, 0, "test validity check failed: {}", @@ -441,7 +442,7 @@ fn test_attack_replay() { let mallory_run_params = TestRunParameters::from_init_peer_id(&alice_peer_id).with_particle_id("second_particle"); - let res_replay = bob_avm.call(&air_script, "", res1.data, mallory_run_params).unwrap(); + let res_replay = bob_avm.call(&air_script, "", res1.data, mallory_run_params).await.unwrap(); let dalek_error = ed25519_dalek::ed25519::Error::from_source("Verification equation was not satisfied"); let nested_error = fluence_keypair::error::VerificationError::Ed25519( diff --git a/air/tests/test_module/features/signatures/corruption.rs b/air/tests/test_module/features/signatures/corruption.rs index ed86733484..e9195de2e5 100644 --- a/air/tests/test_module/features/signatures/corruption.rs +++ b/air/tests/test_module/features/signatures/corruption.rs @@ -28,7 +28,7 @@ use pretty_assertions::assert_eq; use semver::Version; #[tokio::test] -fn test_attack_replace_value() { +async fn test_attack_replace_value() { // Bob gets a trace where call result value is edited by Mallory. let alice_peer_id = "alice"; let bob_peer_id = "bob"; @@ -85,11 +85,11 @@ fn test_attack_replace_value() { Version::new(1, 1, 1), ); - let mut bob_avm = create_avm(unit_call_service(), bob_peer_id); + let mut bob_avm = create_avm(unit_call_service(), bob_peer_id).await; let test_run_params = TestRunParameters::from_init_peer_id(alice_peer_id); let prev_data = ""; let cur_data = mallory_data.serialize().unwrap(); - let res = bob_avm.call(&air_script, prev_data, cur_data, test_run_params).unwrap(); + let res = bob_avm.call(&air_script, prev_data, cur_data, test_run_params).await.unwrap(); assert_error_eq!( &res, @@ -105,7 +105,7 @@ fn test_attack_replace_value() { } #[tokio::test] -fn test_attack_replace_tetraplet() { +async fn test_attack_replace_tetraplet() { // Bob gets a trace where call result tetraplet is edited by Mallory. let alice_peer_id = "alice"; let bob_peer_id = "bob"; @@ -162,11 +162,11 @@ fn test_attack_replace_tetraplet() { Version::new(1, 1, 1), ); - let mut bob_avm = create_avm(unit_call_service(), bob_peer_id); + let mut bob_avm = create_avm(unit_call_service(), bob_peer_id).await; let test_run_params = TestRunParameters::from_init_peer_id(alice_peer_id); let prev_data = ""; let cur_data = mallory_data.serialize().unwrap(); - let res = bob_avm.call(&air_script, prev_data, cur_data, test_run_params).unwrap(); + let res = bob_avm.call(&air_script, prev_data, cur_data, test_run_params).await.unwrap(); assert_error_eq!( &res, @@ -181,7 +181,7 @@ fn test_attack_replace_tetraplet() { } #[tokio::test] -fn test_attack_replace_call_result() { +async fn test_attack_replace_call_result() { // Bob gets a trace where call result is edited by Mallory. let alice_peer_id = "alice"; let bob_peer_id = "bob"; @@ -245,11 +245,11 @@ fn test_attack_replace_call_result() { Version::new(1, 1, 1), ); - let mut bob_avm = create_avm(unit_call_service(), bob_peer_id); + let mut bob_avm = create_avm(unit_call_service(), bob_peer_id).await; let test_run_params = TestRunParameters::from_init_peer_id(alice_peer_id); let prev_data = ""; let cur_data = mallory_data.serialize().unwrap(); - let res = bob_avm.call(&air_script, prev_data, cur_data, test_run_params).unwrap(); + let res = bob_avm.call(&air_script, prev_data, cur_data, test_run_params).await.unwrap(); assert_error_eq!( &res, @@ -264,7 +264,7 @@ fn test_attack_replace_call_result() { } #[tokio::test] -fn test_attack_replace_canon_value() { +async fn test_attack_replace_canon_value() { // Bob gets a trace where canon value is edited by Mallory. let alice_peer_id = "alice"; let bob_peer_id = "bob"; @@ -335,11 +335,11 @@ fn test_attack_replace_canon_value() { Version::new(1, 1, 1), ); - let mut bob_avm = create_avm(unit_call_service(), bob_peer_id); + let mut bob_avm = create_avm(unit_call_service(), bob_peer_id).await; let test_run_params = TestRunParameters::from_init_peer_id(alice_peer_id); let prev_data = ""; let cur_data = mallory_data.serialize().unwrap(); - let res = bob_avm.call(&air_script, prev_data, cur_data, test_run_params).unwrap(); + let res = bob_avm.call(&air_script, prev_data, cur_data, test_run_params).await.unwrap(); assert_error_eq!( &res, @@ -354,7 +354,7 @@ fn test_attack_replace_canon_value() { } #[tokio::test] -fn test_attack_replace_canon_result_values() { +async fn test_attack_replace_canon_result_values() { // Bob gets a trace where canon result is edited by Mallory. let alice_peer_id = "alice"; let bob_peer_id = "bob"; @@ -434,11 +434,11 @@ fn test_attack_replace_canon_result_values() { Version::new(1, 1, 1), ); - let mut bob_avm = create_avm(unit_call_service(), bob_peer_id); + let mut bob_avm = create_avm(unit_call_service(), bob_peer_id).await; let test_run_params = TestRunParameters::from_init_peer_id(alice_peer_id); let prev_data = ""; let cur_data = mallory_data.serialize().unwrap(); - let res = bob_avm.call(&air_script, prev_data, cur_data, test_run_params).unwrap(); + let res = bob_avm.call(&air_script, prev_data, cur_data, test_run_params).await.unwrap(); assert_error_eq!( &res, @@ -453,7 +453,7 @@ fn test_attack_replace_canon_result_values() { } #[tokio::test] -fn test_attack_replace_canon_result_tetraplet() { +async fn test_attack_replace_canon_result_tetraplet() { // Bob gets a trace where canon result is edited by Mallory. let alice_peer_id = "alice"; let bob_peer_id = "bob"; @@ -537,11 +537,11 @@ fn test_attack_replace_canon_result_tetraplet() { Version::new(1, 1, 1), ); - let mut bob_avm = create_avm(unit_call_service(), bob_peer_id); + let mut bob_avm = create_avm(unit_call_service(), bob_peer_id).await; let test_run_params = TestRunParameters::from_init_peer_id(alice_peer_id); let prev_data = ""; let cur_data = mallory_data.serialize().unwrap(); - let res = bob_avm.call(&air_script, prev_data, cur_data, test_run_params).unwrap(); + let res = bob_avm.call(&air_script, prev_data, cur_data, test_run_params).await.unwrap(); assert_error_eq!( &res, diff --git a/air/tests/test_module/features/signatures/runtime.rs b/air/tests/test_module/features/signatures/runtime.rs index efca81fe83..4f9855e485 100644 --- a/air/tests/test_module/features/signatures/runtime.rs +++ b/air/tests/test_module/features/signatures/runtime.rs @@ -22,7 +22,7 @@ use air_test_utils::prelude::*; /// that actual calls' tetraplets are compared to stored one. #[tokio::test] -fn test_runtime_executed_call_argument_hash() { +async fn test_runtime_executed_call_argument_hash() { // Mallory gets a trace where there are two calls that differ only by argument_hash. // Can it swap them successfully? let alice_name = "alice"; @@ -47,13 +47,14 @@ fn test_runtime_executed_call_argument_hash() { "# ); - let mut alice_avm = create_avm_with_key::(alice_keypair, echo_call_service()); - let mut bob_avm = create_avm_with_key::(bob_keypair, echo_call_service()); - let mut mallory_avm = create_avm_with_key::(mallory_keypair, echo_call_service()); + let mut alice_avm = create_avm_with_key::(alice_keypair, echo_call_service()).await; + let mut bob_avm = create_avm_with_key::(bob_keypair, echo_call_service()).await; + let mut mallory_avm = create_avm_with_key::(mallory_keypair, echo_call_service()).await; - let alice_res = alice_avm.call(&air_script, "", "", test_run_params.clone()).unwrap(); + let alice_res = alice_avm.call(&air_script, "", "", test_run_params.clone()).await.unwrap(); let mallory_res = mallory_avm .call(&air_script, "", alice_res.data, test_run_params.clone()) + .await .unwrap(); let mut mallory_env = env_from_result(&mallory_res); @@ -66,7 +67,7 @@ fn test_runtime_executed_call_argument_hash() { let mallory_data = mallory_env.serialize().unwrap(); - let bob_res = bob_avm.call(air_script, "", mallory_data, test_run_params).unwrap(); + let bob_res = bob_avm.call(air_script, "", mallory_data, test_run_params).await.unwrap(); assert_error_eq!( &bob_res, UncatchableError::InstructionParametersMismatch { @@ -78,7 +79,7 @@ fn test_runtime_executed_call_argument_hash() { } #[tokio::test] -fn test_runtime_executed_call_tetraplet() { +async fn test_runtime_executed_call_tetraplet() { // Mallory gets a trace where there are two calls that differ only by argument_hash. // Can it swap them successfully? let alice_name = "alice"; @@ -103,13 +104,14 @@ fn test_runtime_executed_call_tetraplet() { "# ); - let mut alice_avm = create_avm_with_key::(alice_keypair, echo_call_service()); - let mut bob_avm = create_avm_with_key::(bob_keypair, echo_call_service()); - let mut mallory_avm = create_avm_with_key::(mallory_keypair, echo_call_service()); + let mut alice_avm = create_avm_with_key::(alice_keypair, echo_call_service()).await; + let mut bob_avm = create_avm_with_key::(bob_keypair, echo_call_service()).await; + let mut mallory_avm = create_avm_with_key::(mallory_keypair, echo_call_service()).await; - let alice_res = alice_avm.call(&air_script, "", "", test_run_params.clone()).unwrap(); + let alice_res = alice_avm.call(&air_script, "", "", test_run_params.clone()).await.unwrap(); let mallory_res = mallory_avm .call(&air_script, "", alice_res.data, test_run_params.clone()) + .await .unwrap(); let mut mallory_env = env_from_result(&mallory_res); @@ -122,7 +124,7 @@ fn test_runtime_executed_call_tetraplet() { let mallory_data = mallory_env.serialize().unwrap(); - let bob_res = bob_avm.call(air_script, "", mallory_data, test_run_params).unwrap(); + let bob_res = bob_avm.call(air_script, "", mallory_data, test_run_params).await.unwrap(); let expected_value = format!( concat!( r#"SecurityTetraplet {{ peer_pk: "{alice_peer_id}","#, @@ -150,7 +152,7 @@ fn test_runtime_executed_call_tetraplet() { } #[tokio::test] -fn test_runtime_executed_failed_argument_hash() { +async fn test_runtime_executed_failed_argument_hash() { // Mallory gets a trace where there are two calls that differ only by argument_hash. // Can it swap them successfully? let alice_name = "alice"; @@ -177,13 +179,14 @@ fn test_runtime_executed_failed_argument_hash() { "# ); - let mut alice_avm = create_avm_with_key::(alice_keypair, fallible_call_service_by_arg(43)); - let mut bob_avm = create_avm_with_key::(bob_keypair, echo_call_service()); - let mut mallory_avm = create_avm_with_key::(mallory_keypair, echo_call_service()); + let mut alice_avm = create_avm_with_key::(alice_keypair, fallible_call_service_by_arg(43)).await; + let mut bob_avm = create_avm_with_key::(bob_keypair, echo_call_service()).await; + let mut mallory_avm = create_avm_with_key::(mallory_keypair, echo_call_service()).await; - let alice_res = alice_avm.call(&air_script, "", "", test_run_params.clone()).unwrap(); + let alice_res = alice_avm.call(&air_script, "", "", test_run_params.clone()).await.unwrap(); let mallory_res = mallory_avm .call(&air_script, "", alice_res.data, test_run_params.clone()) + .await .unwrap(); let mut mallory_env = env_from_result(&mallory_res); @@ -196,7 +199,7 @@ fn test_runtime_executed_failed_argument_hash() { let mallory_data = mallory_env.serialize().unwrap(); - let bob_res = bob_avm.call(air_script, "", mallory_data, test_run_params).unwrap(); + let bob_res = bob_avm.call(air_script, "", mallory_data, test_run_params).await.unwrap(); assert_error_eq!( &bob_res, UncatchableError::InstructionParametersMismatch { @@ -210,7 +213,7 @@ fn test_runtime_executed_failed_argument_hash() { } #[tokio::test] -fn test_runtime_failed_call_tetraplet() { +async fn test_runtime_failed_call_tetraplet() { // Mallory gets a trace where there are two calls that differ only by argument_hash. // Can it swap them successfully? let alice_name = "alice"; @@ -237,13 +240,14 @@ fn test_runtime_failed_call_tetraplet() { "# ); - let mut alice_avm = create_avm_with_key::(alice_keypair, fallible_call_service("service1")); - let mut bob_avm = create_avm_with_key::(bob_keypair, echo_call_service()); - let mut mallory_avm = create_avm_with_key::(mallory_keypair, echo_call_service()); + let mut alice_avm = create_avm_with_key::(alice_keypair, fallible_call_service("service1")).await; + let mut bob_avm = create_avm_with_key::(bob_keypair, echo_call_service()).await; + let mut mallory_avm = create_avm_with_key::(mallory_keypair, echo_call_service()).await; - let alice_res = alice_avm.call(&air_script, "", "", test_run_params.clone()).unwrap(); + let alice_res = alice_avm.call(&air_script, "", "", test_run_params.clone()).await.unwrap(); let mallory_res = mallory_avm .call(&air_script, "", alice_res.data, test_run_params.clone()) + .await .unwrap(); let mut mallory_env = env_from_result(&mallory_res); @@ -256,7 +260,7 @@ fn test_runtime_failed_call_tetraplet() { let mallory_data = mallory_env.serialize().unwrap(); - let bob_res = bob_avm.call(air_script, "", mallory_data, test_run_params).unwrap(); + let bob_res = bob_avm.call(air_script, "", mallory_data, test_run_params).await.unwrap(); let expected_value = format!( concat!( r#"SecurityTetraplet {{ peer_pk: "{alice_peer_id}","#, @@ -284,7 +288,7 @@ fn test_runtime_failed_call_tetraplet() { } #[tokio::test] -fn test_runtime_canon_tetraplet() { +async fn test_runtime_canon_tetraplet() { let alice_name = "alice"; let bob_name = "bob"; let mallory_name = "mallory"; @@ -309,13 +313,14 @@ fn test_runtime_canon_tetraplet() { "# ); - let mut alice_avm = create_avm_with_key::(alice_keypair, fallible_call_service("service1")); - let mut bob_avm = create_avm_with_key::(bob_keypair, echo_call_service()); - let mut mallory_avm = create_avm_with_key::(mallory_keypair, echo_call_service()); + let mut alice_avm = create_avm_with_key::(alice_keypair, fallible_call_service("service1")).await; + let mut bob_avm = create_avm_with_key::(bob_keypair, echo_call_service()).await; + let mut mallory_avm = create_avm_with_key::(mallory_keypair, echo_call_service()).await; - let alice_res = alice_avm.call(&air_script, "", "", test_run_params.clone()).unwrap(); + let alice_res = alice_avm.call(&air_script, "", "", test_run_params.clone()).await.unwrap(); let mallory_res = mallory_avm .call(&air_script, "", alice_res.data, test_run_params.clone()) + .await .unwrap(); let mut mallory_env = env_from_result(&mallory_res); @@ -328,7 +333,7 @@ fn test_runtime_canon_tetraplet() { let mallory_data = mallory_env.serialize().unwrap(); - let bob_res = bob_avm.call(air_script, "", mallory_data, test_run_params).unwrap(); + let bob_res = bob_avm.call(air_script, "", mallory_data, test_run_params).await.unwrap(); let expected_value = format!( concat!( r#"SecurityTetraplet {{ peer_pk: "{alice_peer_id}","#, diff --git a/air/tests/test_module/features/signatures/signing.rs b/air/tests/test_module/features/signatures/signing.rs index 1a2b5cc971..38d3c42341 100644 --- a/air/tests/test_module/features/signatures/signing.rs +++ b/air/tests/test_module/features/signatures/signing.rs @@ -20,8 +20,10 @@ use air_test_utils::key_utils::derive_dummy_keypair; use air_test_utils::prelude::*; use air_test_utils::test_runner::TestRunParameters; +use futures::stream::StreamExt; + #[tokio::test] -fn test_signature_empty() { +async fn test_signature_empty() { let script = "(null)"; let init_peer_name = "init_peer_id"; let (keypair, _) = derive_dummy_keypair(init_peer_name); @@ -32,8 +34,9 @@ fn test_signature_empty() { vec![PeerId::from(init_peer_name)].into_iter(), script, ) + .await .unwrap(); - let res = exec.execute_one(init_peer_name).unwrap(); + let res = exec.execute_one(init_peer_name).await.unwrap(); assert_eq!(res.ret_code, 0, "{:?}", res); let data = borsh::to_vec(&(vec![""; 0], "")).unwrap(); @@ -45,7 +48,7 @@ fn test_signature_empty() { } #[tokio::test] -fn test_signature_call_var() { +async fn test_signature_call_var() { let init_peer_name = "init_peer_id"; let (keypair, init_peer_id) = derive_dummy_keypair(init_peer_name); @@ -55,9 +58,9 @@ fn test_signature_call_var() { "# ); let exec = - AirScriptExecutor::from_annotated(TestRunParameters::from_init_peer_id(init_peer_name), &air_script).unwrap(); + AirScriptExecutor::from_annotated(TestRunParameters::from_init_peer_id(init_peer_name), &air_script).await.unwrap(); - let res = exec.execution_iter(init_peer_id.as_str()).unwrap().last().unwrap(); + let res = exec.execution_iter(init_peer_id.as_str()).unwrap().collect::>().await.last().unwrap(); assert_eq!(res.ret_code, 0, "{:?}", res); let data = data_from_result(&res); @@ -73,7 +76,7 @@ fn test_signature_call_var() { } #[tokio::test] -fn test_signature_call_stream() { +async fn test_signature_call_stream() { let init_peer_name = "init_peer_id"; let air_script = format!( r#" @@ -81,9 +84,9 @@ fn test_signature_call_stream() { "# ); let exec = - AirScriptExecutor::from_annotated(TestRunParameters::from_init_peer_id(init_peer_name), &air_script).unwrap(); + AirScriptExecutor::from_annotated(TestRunParameters::from_init_peer_id(init_peer_name), &air_script).await.unwrap(); - let res = exec.execution_iter(init_peer_name).unwrap().last().unwrap(); + let res = exec.execution_iter(init_peer_name).unwrap().collect::>().await.last().unwrap(); assert_eq!(res.ret_code, 0, "{:?}", res); let data = data_from_result(&res); @@ -101,7 +104,7 @@ fn test_signature_call_stream() { } #[tokio::test] -fn test_signature_call_unused() { +async fn test_signature_call_unused() { let init_peer_name = "init_peer_id"; let air_script = format!( r#" @@ -109,9 +112,9 @@ fn test_signature_call_unused() { "# ); let exec = - AirScriptExecutor::from_annotated(TestRunParameters::from_init_peer_id(init_peer_name), &air_script).unwrap(); + AirScriptExecutor::from_annotated(TestRunParameters::from_init_peer_id(init_peer_name), &air_script).await.unwrap(); - let res = exec.execution_iter(init_peer_name).unwrap().last().unwrap(); + let res = exec.execution_iter(init_peer_name).unwrap().collect::>().await.last().unwrap(); assert_eq!(res.ret_code, 0, "{:?}", res); let data = data_from_result(&res); @@ -125,7 +128,7 @@ fn test_signature_call_unused() { } #[tokio::test] -fn test_signature_call_merged() { +async fn test_signature_call_merged() { let init_peer_name = "init_peer_id"; let other_peer_name = "other_peer_id"; @@ -141,10 +144,10 @@ fn test_signature_call_merged() { ); let exec = - AirScriptExecutor::from_annotated(TestRunParameters::from_init_peer_id(init_peer_name), &air_script).unwrap(); - let _ = exec.execute_one(init_peer_name).unwrap(); - let _ = exec.execute_one(other_peer_name).unwrap(); - let res2 = exec.execute_one(init_peer_name).unwrap(); + AirScriptExecutor::from_annotated(TestRunParameters::from_init_peer_id(init_peer_name), &air_script).await.unwrap(); + let _ = exec.execute_one(init_peer_name).await.unwrap(); + let _ = exec.execute_one(other_peer_name).await.unwrap(); + let res2 = exec.execute_one(init_peer_name).await.unwrap(); let data2 = data_from_result(&res2); let expected_call_state0 = scalar!("res0", peer_name = init_peer_name, service = "..0"); @@ -164,7 +167,7 @@ fn test_signature_call_merged() { } #[tokio::test] -fn test_signature_call_twice() { +async fn test_signature_call_twice() { // Test that if some CID appears twice in the call result, it is accounted twice. let init_peer_name = "init_peer_id"; @@ -181,9 +184,9 @@ fn test_signature_call_twice() { "# ); let exec = - AirScriptExecutor::from_annotated(TestRunParameters::from_init_peer_id(init_peer_name), &air_script).unwrap(); + AirScriptExecutor::from_annotated(TestRunParameters::from_init_peer_id(init_peer_name), &air_script).await.unwrap(); - let res = exec.execution_iter(init_peer_id.as_str()).unwrap().last().unwrap(); + let res = exec.execution_iter(init_peer_id.as_str()).unwrap().collect::>().await.last().unwrap(); assert_eq!(res.ret_code, 0, "{:?}", res); let data = data_from_result(&res); @@ -206,7 +209,7 @@ fn test_signature_call_twice() { } #[tokio::test] -fn test_signature_canon_basic() { +async fn test_signature_canon_basic() { let init_peer_name = "init_peer_id"; let (keypair, init_peer_id) = derive_dummy_keypair(init_peer_name); @@ -223,9 +226,9 @@ fn test_signature_canon_basic() { "# ); let exec = - AirScriptExecutor::from_annotated(TestRunParameters::from_init_peer_id(init_peer_name), &air_script).unwrap(); + AirScriptExecutor::from_annotated(TestRunParameters::from_init_peer_id(init_peer_name), &air_script).await.unwrap(); - let last_result = exec.execution_iter(init_peer_name).unwrap().last().unwrap(); + let last_result = exec.execution_iter(init_peer_name).unwrap().collect::>().await.last().unwrap(); let last_data = data_from_result(&last_result); let expected_call_result = scalar!( @@ -279,7 +282,7 @@ fn test_signature_canon_basic() { } #[tokio::test] -fn test_signature_canon_merge() { +async fn test_signature_canon_merge() { let init_peer_name = "init_peer_id"; let other_peer_name = "other_peer_id"; let (keypair, init_peer_id) = derive_dummy_keypair(init_peer_name); @@ -301,12 +304,12 @@ fn test_signature_canon_merge() { "# ); let exec = - AirScriptExecutor::from_annotated(TestRunParameters::from_init_peer_id(init_peer_name), &air_script).unwrap(); + AirScriptExecutor::from_annotated(TestRunParameters::from_init_peer_id(init_peer_name), &air_script).await.unwrap(); exec.execute_all(init_peer_name); exec.execute_one(other_peer_name); - let last_result = exec.execution_iter(init_peer_name).unwrap().last().unwrap(); + let last_result = exec.execution_iter(init_peer_name).unwrap().collect::>().await.last().unwrap(); let last_data = data_from_result(&last_result); let expected_call_result = scalar!( @@ -360,7 +363,7 @@ fn test_signature_canon_merge() { } #[tokio::test] -fn test_signature_canon_result() { +async fn test_signature_canon_result() { // this test checks that call result in canon doesn't lead to repeadted accounting of the call result let init_peer_name = "init_peer_id"; let (keypair, init_peer_id) = derive_dummy_keypair(init_peer_name); @@ -380,9 +383,9 @@ fn test_signature_canon_result() { "# ); let exec = - AirScriptExecutor::from_annotated(TestRunParameters::from_init_peer_id(init_peer_name), &air_script).unwrap(); + AirScriptExecutor::from_annotated(TestRunParameters::from_init_peer_id(init_peer_name), &air_script).await.unwrap(); - let last_result = exec.execution_iter(init_peer_name).unwrap().last().unwrap(); + let last_result = exec.execution_iter(init_peer_name).unwrap().collect::>().await.last().unwrap(); let last_data = data_from_result(&last_result); let expected_call_result1 = scalar!( diff --git a/air/tests/test_module/features/streams/ap_with_fold.rs b/air/tests/test_module/features/streams/ap_with_fold.rs index 788aef7acb..8d41377450 100644 --- a/air/tests/test_module/features/streams/ap_with_fold.rs +++ b/air/tests/test_module/features/streams/ap_with_fold.rs @@ -17,7 +17,7 @@ use air_test_utils::prelude::*; #[tokio::test] -fn ap_with_fold() { +async fn ap_with_fold() { let nums: Vec = (1..10).map(|i| i.to_string()).collect(); let vec = vec![nums.clone(), nums.clone(), nums]; let elems: Vec<(String, Vec>)> = vec![ @@ -28,10 +28,10 @@ fn ap_with_fold() { ("a".into(), vec), ]; let set_variable_id = "set_variable_peer_id"; - let mut set_variable_vm = create_avm(set_variable_call_service(json!(elems)), set_variable_id); + let mut set_variable_vm = create_avm(set_variable_call_service(json!(elems)), set_variable_id).await; let local_vm_peer_id = "local_peer_id"; - let mut local_vm = create_avm(unit_call_service(), local_vm_peer_id); + let mut local_vm = create_avm(unit_call_service(), local_vm_peer_id).await; let script = format!( r#" diff --git a/air/tests/test_module/features/streams/compactification.rs b/air/tests/test_module/features/streams/compactification.rs index 7d21922f14..f1b6d0a997 100644 --- a/air/tests/test_module/features/streams/compactification.rs +++ b/air/tests/test_module/features/streams/compactification.rs @@ -20,7 +20,7 @@ use air_test_utils::prelude::TestRunParameters; use air_test_utils::*; #[tokio::test] -fn global_streams_are_compactified() { +async fn global_streams_are_compactified() { let peer_name = "peer_id"; let service_result = "service_result"; let script = format!( @@ -32,8 +32,8 @@ fn global_streams_are_compactified() { "# ); - let executor = AirScriptExecutor::from_annotated(TestRunParameters::from_init_peer_id(peer_name), &script).unwrap(); - let result = executor.execute_all(peer_name).unwrap(); + let executor = AirScriptExecutor::from_annotated(TestRunParameters::from_init_peer_id(peer_name), &script).await.unwrap(); + let result = executor.execute_all(peer_name).await.unwrap(); let actual_trace = trace_from_result(result.last().unwrap()); let mut cid_state = ExecutionCidState::new(); @@ -53,7 +53,7 @@ fn global_streams_are_compactified() { } #[tokio::test] -fn global_stream_maps_are_compactified() { +async fn global_stream_maps_are_compactified() { let peer_name = "peer_id"; let service_result = "service_result"; let script = format!( @@ -68,8 +68,8 @@ fn global_stream_maps_are_compactified() { "# ); - let executor = AirScriptExecutor::from_annotated(TestRunParameters::from_init_peer_id(peer_name), &script).unwrap(); - let result = executor.execute_all(peer_name).unwrap(); + let executor = AirScriptExecutor::from_annotated(TestRunParameters::from_init_peer_id(peer_name), &script).await.unwrap(); + let result = executor.execute_all(peer_name).await.unwrap(); let actual_trace = trace_from_result(result.last().unwrap()); let mut cid_state = ExecutionCidState::new(); @@ -90,7 +90,7 @@ fn global_stream_maps_are_compactified() { } #[tokio::test] -fn local_streams_are_compactified() { +async fn local_streams_are_compactified() { let peer_name = "peer_id"; let service_result = "service_result"; let script = format!( @@ -104,8 +104,8 @@ fn local_streams_are_compactified() { "# ); - let executor = AirScriptExecutor::from_annotated(TestRunParameters::from_init_peer_id(peer_name), &script).unwrap(); - let result = executor.execute_all(peer_name).unwrap(); + let executor = AirScriptExecutor::from_annotated(TestRunParameters::from_init_peer_id(peer_name), &script).await.unwrap(); + let result = executor.execute_all(peer_name).await.unwrap(); let actual_trace = trace_from_result(result.last().unwrap()); let mut cid_state = ExecutionCidState::new(); @@ -125,7 +125,7 @@ fn local_streams_are_compactified() { } #[tokio::test] -fn local_stream_maps_are_compactified() { +async fn local_stream_maps_are_compactified() { let peer_name = "peer_id"; let service_result = "service_result"; let script = format!( @@ -142,8 +142,8 @@ fn local_stream_maps_are_compactified() { "# ); - let executor = AirScriptExecutor::from_annotated(TestRunParameters::from_init_peer_id(peer_name), &script).unwrap(); - let result = executor.execute_all(peer_name).unwrap(); + let executor = AirScriptExecutor::from_annotated(TestRunParameters::from_init_peer_id(peer_name), &script).await.unwrap(); + let result = executor.execute_all(peer_name).await.unwrap(); let actual_trace = trace_from_result(result.last().unwrap()); let mut cid_state = ExecutionCidState::new(); diff --git a/air/tests/test_module/features/streams/merging.rs b/air/tests/test_module/features/streams/merging.rs index 4859931b49..023830d453 100644 --- a/air/tests/test_module/features/streams/merging.rs +++ b/air/tests/test_module/features/streams/merging.rs @@ -17,8 +17,10 @@ use air_test_framework::AirScriptExecutor; use air_test_utils::{key_utils::at, prelude::*}; +use futures::stream::StreamExt; + #[tokio::test] -fn merging_fold_iterations_extensively() { +async fn merging_fold_iterations_extensively() { let script = r#" (seq (seq @@ -88,6 +90,7 @@ fn merging_fold_iterations_extensively() { vec!["relay", "p1", "p2", "p3"].into_iter().map(Into::into), script, ) + .await .unwrap(); let mut queue = std::collections::vec_deque::VecDeque::new(); @@ -96,7 +99,7 @@ fn merging_fold_iterations_extensively() { while !queue.is_empty() { let peer = queue.pop_front().unwrap(); if let Some(outcomes) = engine.execution_iter(peer.as_str()) { - for outcome in outcomes { + for outcome in outcomes.collect::>().await { assert_eq!(outcome.ret_code, 0, "{outcome:?}"); for peer in &outcome.next_peer_pks { @@ -127,7 +130,7 @@ fn merging_fold_iterations_extensively() { } #[tokio::test] -fn merging_fold_iterations_extensively_2() { +async fn merging_fold_iterations_extensively_2() { let script = r#" (seq (seq @@ -225,6 +228,7 @@ fn merging_fold_iterations_extensively_2() { vec!["relay", "p1", "p2", "p3"].into_iter().map(Into::into), script, ) + .await .unwrap(); let mut queue = std::collections::vec_deque::VecDeque::new(); @@ -234,7 +238,7 @@ fn merging_fold_iterations_extensively_2() { while !queue.is_empty() { let peer = queue.pop_front().unwrap(); if let Some(outcomes) = engine.execution_iter(peer.as_str()) { - for outcome in outcomes { + for outcome in outcomes.collect::>().await { assert_eq!(outcome.ret_code, 0, "{outcome:?}"); for peer in &outcome.next_peer_pks { diff --git a/air/tests/test_module/features/streams/recursive_streams.rs b/air/tests/test_module/features/streams/recursive_streams.rs index c2fb968a18..46e02800f2 100644 --- a/air/tests/test_module/features/streams/recursive_streams.rs +++ b/air/tests/test_module/features/streams/recursive_streams.rs @@ -22,7 +22,7 @@ use air_test_utils::prelude::*; use pretty_assertions::assert_eq; #[tokio::test] -fn recursive_stream_with_early_exit() { +async fn recursive_stream_with_early_exit() { let vm_peer_id = "vm_peer_id"; let variable_mappings = maplit::hashmap! { "stream_value".to_string() => json!(1), @@ -31,7 +31,7 @@ fn recursive_stream_with_early_exit() { let mut vm = create_avm( set_variables_call_service(variable_mappings, VariableOptionSource::FunctionName), vm_peer_id, - ); + ).await; let script = format!( r#" @@ -74,7 +74,7 @@ fn recursive_stream_with_early_exit() { } #[tokio::test] -fn recursive_stream_many_iterations() { +async fn recursive_stream_many_iterations() { let vm_peer_id_1 = "vm_peer_id_1"; let request_id = std::cell::Cell::new(0); @@ -92,10 +92,10 @@ fn recursive_stream_many_iterations() { result }); - let mut vm_1 = create_avm(give_n_results_and_then_stop, vm_peer_id_1); + let mut vm_1 = create_avm(give_n_results_and_then_stop, vm_peer_id_1).await; let vm_peer_id_2 = "vm_peer_id_2"; - let mut vm_2 = create_avm(echo_call_service(), vm_peer_id_2); + let mut vm_2 = create_avm(echo_call_service(), vm_peer_id_2).await; let result_value = "result_value"; let script = format!( @@ -172,7 +172,7 @@ fn recursive_stream_many_iterations() { } #[tokio::test] -fn recursive_stream_join() { +async fn recursive_stream_join() { let vm_peer_id_1 = "vm_peer_id_1"; let request_id = std::cell::Cell::new(0); @@ -190,12 +190,12 @@ fn recursive_stream_join() { result }); - let mut vm_1 = create_avm(give_n_results_and_then_stop, vm_peer_id_1); + let mut vm_1 = create_avm(give_n_results_and_then_stop, vm_peer_id_1).await; let vm_peer_id_2 = "vm_peer_id_2"; - let mut vm_2 = create_avm(echo_call_service(), vm_peer_id_2); + let mut vm_2 = create_avm(echo_call_service(), vm_peer_id_2).await; let vm_peer_id_3 = "vm_peer_id_3"; - let mut vm_3 = create_avm(echo_call_service(), vm_peer_id_3); + let mut vm_3 = create_avm(echo_call_service(), vm_peer_id_3).await; let result_value = "result_value"; let script = format!( @@ -256,7 +256,7 @@ fn recursive_stream_join() { } #[tokio::test] -fn recursive_stream_error_handling() { +async fn recursive_stream_error_handling() { let vm_peer_id_1 = "vm_peer_id_1"; let request_id = std::cell::Cell::new(0); @@ -274,7 +274,7 @@ fn recursive_stream_error_handling() { result }); - let mut vm_1 = create_avm(give_n_results_and_then_stop, vm_peer_id_1); + let mut vm_1 = create_avm(give_n_results_and_then_stop, vm_peer_id_1).await; let result_value = "result_value"; let vm_peer_id_2 = "vm_peer_id_2"; @@ -330,7 +330,7 @@ fn recursive_stream_error_handling() { } #[tokio::test] -fn recursive_stream_inner_fold() { +async fn recursive_stream_inner_fold() { let vm_peer_id_1 = "vm_peer_id_1"; let request_id = std::cell::Cell::new(0); @@ -348,10 +348,10 @@ fn recursive_stream_inner_fold() { result }); - let mut vm_1 = create_avm(give_n_results_and_then_stop, vm_peer_id_1); + let mut vm_1 = create_avm(give_n_results_and_then_stop, vm_peer_id_1).await; let vm_peer_id_2 = "vm_peer_id_2"; - let mut vm_2 = create_avm(echo_call_service(), vm_peer_id_2); + let mut vm_2 = create_avm(echo_call_service(), vm_peer_id_2).await; let result_value = "result_value"; let script = format!( @@ -394,7 +394,7 @@ fn recursive_stream_inner_fold() { } #[tokio::test] -fn recursive_stream_fold_with_n_service_call() { +async fn recursive_stream_fold_with_n_service_call() { let vm_peer_id = "vm_peer_id_1"; let request_id = std::cell::Cell::new(0); @@ -412,7 +412,7 @@ fn recursive_stream_fold_with_n_service_call() { result }); - let mut vm = create_avm(give_n_results_and_then_stop, vm_peer_id); + let mut vm = create_avm(give_n_results_and_then_stop, vm_peer_id).await; let script = format!( r#" @@ -474,7 +474,7 @@ fn recursive_stream_fold_with_n_service_call() { } #[tokio::test] -fn recursive_stream_size_limit() { +async fn recursive_stream_size_limit() { let vm_peer_id_1 = "vm_peer_id_1"; let script = format!( @@ -491,8 +491,9 @@ fn recursive_stream_size_limit() { ); let executor = AirScriptExecutor::from_annotated(TestRunParameters::from_init_peer_id(vm_peer_id_1), &script) + .await .expect("invalid test AIR script"); - let result = executor.execute_all(vm_peer_id_1).unwrap(); + let result = executor.execute_all(vm_peer_id_1).await.unwrap(); let result = result.last().unwrap(); let expected_error = StreamSizeLimitExceeded; diff --git a/air/tests/test_module/features/streams/streams.rs b/air/tests/test_module/features/streams/streams.rs index e49751bbc6..69d4b170ae 100644 --- a/air/tests/test_module/features/streams/streams.rs +++ b/air/tests/test_module/features/streams/streams.rs @@ -22,7 +22,7 @@ use pretty_assertions::assert_eq; use std::ops::Deref; #[tokio::test] -fn empty_stream() { +async fn empty_stream() { fn arg_type_check_closure() -> CallServiceClosure { Box::new(move |params| -> CallServiceResult { let actual_call_args: Vec> = @@ -36,7 +36,7 @@ fn empty_stream() { } let vm_peer_id = "vm_peer_id"; - let mut vm = create_avm(arg_type_check_closure(), vm_peer_id); + let mut vm = create_avm(arg_type_check_closure(), vm_peer_id).await; let script = format!( r#" @@ -56,18 +56,18 @@ fn empty_stream() { } #[tokio::test] -fn stream_merging_v0() { +async fn stream_merging_v0() { let initiator_id = "initiator_id"; let setter_1_id = "setter_1"; let setter_2_id = "setter_2"; let setter_3_id = "setter_3"; let executor_id = "stream_executor"; - let mut initiator = create_avm(unit_call_service(), initiator_id); - let mut setter_1 = create_avm(set_variable_call_service(json!("1")), setter_1_id); - let mut setter_2 = create_avm(set_variable_call_service(json!("2")), setter_2_id); - let mut setter_3 = create_avm(set_variable_call_service(json!("3")), setter_3_id); - let mut executor = create_avm(unit_call_service(), executor_id); + let mut initiator = create_avm(unit_call_service(), initiator_id).await; + let mut setter_1 = create_avm(set_variable_call_service(json!("1")), setter_1_id).await; + let mut setter_2 = create_avm(set_variable_call_service(json!("2")), setter_2_id).await; + let mut setter_3 = create_avm(set_variable_call_service(json!("3")), setter_3_id).await; + let mut executor = create_avm(unit_call_service(), executor_id).await; let script = format!( include_str!("scripts/stream_fold_merging_v0.air"), @@ -208,18 +208,18 @@ fn stream_merging_v0() { } #[tokio::test] -fn stream_merging_v1() { +async fn stream_merging_v1() { let initiator_id = "initiator_id"; let setter_1_id = "setter_1"; let setter_2_id = "setter_2"; let setter_3_id = "setter_3"; let executor_id = "stream_executor"; - let mut initiator = create_avm(unit_call_service(), initiator_id); - let mut setter_1 = create_avm(set_variable_call_service(json!("1")), setter_1_id); - let mut setter_2 = create_avm(set_variable_call_service(json!("2")), setter_2_id); - let mut setter_3 = create_avm(set_variable_call_service(json!("3")), setter_3_id); - let mut executor = create_avm(unit_call_service(), executor_id); + let mut initiator = create_avm(unit_call_service(), initiator_id).await; + let mut setter_1 = create_avm(set_variable_call_service(json!("1")), setter_1_id).await; + let mut setter_2 = create_avm(set_variable_call_service(json!("2")), setter_2_id).await; + let mut setter_3 = create_avm(set_variable_call_service(json!("3")), setter_3_id).await; + let mut executor = create_avm(unit_call_service(), executor_id).await; let script = format!( include_str!("scripts/stream_fold_merging_v1.air"), @@ -376,18 +376,18 @@ fn stream_merging_v1() { #[tokio::test] #[ignore] -fn stream_merging_v2() { +async fn stream_merging_v2() { let initiator_id = "initiator_id"; let setter_1_id = "setter_1"; let setter_2_id = "setter_2"; let setter_3_id = "setter_3"; let executor_id = "stream_executor"; - let mut initiator = create_avm(unit_call_service(), initiator_id); - let mut setter_1 = create_avm(set_variable_call_service(json!("1")), setter_1_id); - let mut setter_2 = create_avm(set_variable_call_service(json!("2")), setter_2_id); - let mut setter_3 = create_avm(set_variable_call_service(json!("3")), setter_3_id); - let mut executor = create_avm(unit_call_service(), executor_id); + let mut initiator = create_avm(unit_call_service(), initiator_id).await; + let mut setter_1 = create_avm(set_variable_call_service(json!("1")), setter_1_id).await; + let mut setter_2 = create_avm(set_variable_call_service(json!("2")), setter_2_id).await; + let mut setter_3 = create_avm(set_variable_call_service(json!("3")), setter_3_id).await; + let mut executor = create_avm(unit_call_service(), executor_id).await; let script = format!( include_str!("scripts/stream_fold_merging_v2.air"), diff --git a/air/tests/test_module/features/streams/streams_early_exit.rs b/air/tests/test_module/features/streams/streams_early_exit.rs index b95ff1139f..b5e8426c86 100644 --- a/air/tests/test_module/features/streams/streams_early_exit.rs +++ b/air/tests/test_module/features/streams/streams_early_exit.rs @@ -28,16 +28,16 @@ use pretty_assertions::assert_eq; use std::convert::TryInto; #[tokio::test] -fn par_early_exit() { +async fn par_early_exit() { let init_peer_id = "init_peer_id"; let setter_1_id = "setter_1"; let setter_2_id = "setter_2"; let setter_3_id = "setter_3"; - let mut init = create_avm(unit_call_service(), init_peer_id); - let mut setter_1 = create_avm(set_variable_call_service(json!("1")), setter_1_id); - let mut setter_2 = create_avm(set_variable_call_service(json!("2")), setter_2_id); - let mut setter_3 = create_avm(fallible_call_service("error"), setter_3_id); + let mut init = create_avm(unit_call_service(), init_peer_id).await; + let mut setter_1 = create_avm(set_variable_call_service(json!("1")), setter_1_id).await; + let mut setter_2 = create_avm(set_variable_call_service(json!("2")), setter_2_id).await; + let mut setter_3 = create_avm(fallible_call_service("error"), setter_3_id).await; let script = format!( include_str!("scripts/par_early_exit.air"), @@ -249,15 +249,15 @@ fn par_early_exit() { } #[tokio::test] -fn fold_early_exit() { +async fn fold_early_exit() { let fold_executor_id = "fold_executor_id"; let error_trigger_id = "error_trigger_id"; let last_error_receiver_id = "last_error_receiver_id"; let last_peer_checker_id = "last_peer_checker_id"; - let mut fold_executor = create_avm(unit_call_service(), fold_executor_id); - let mut error_trigger = create_avm(fallible_call_service("error"), error_trigger_id); - let mut last_peer_checker = create_avm(echo_call_service(), last_peer_checker_id); + let mut fold_executor = create_avm(unit_call_service(), fold_executor_id).await; + let mut error_trigger = create_avm(fallible_call_service("error"), error_trigger_id).await; + let mut last_peer_checker = create_avm(echo_call_service(), last_peer_checker_id).await; let script = format!( include_str!("scripts/fold_early_exit.air"), @@ -302,7 +302,7 @@ fn fold_early_exit() { } #[tokio::test] -fn fold_par_early_exit() { +async fn fold_par_early_exit() { let variables_setter_id = "set_variable_id"; let stream_setter_id = "stream_setter_id"; let fold_executor_id = "fold_executor_id"; @@ -320,12 +320,12 @@ fn fold_par_early_exit() { let mut variables_setter = create_avm( set_variables_call_service(variables, VariableOptionSource::Argument(0)), variables_setter_id, - ); - let mut stream_setter = create_avm(echo_call_service(), stream_setter_id); - let mut fold_executor = create_avm(unit_call_service(), fold_executor_id); - let mut error_trigger = create_avm(fallible_call_service("error"), error_trigger_id); - let mut last_error_receiver = create_avm(unit_call_service(), last_error_receiver_id); - let mut last_peer_checker = create_avm(unit_call_service(), last_peer_checker_id); + ).await; + let mut stream_setter = create_avm(echo_call_service(), stream_setter_id).await; + let mut fold_executor = create_avm(unit_call_service(), fold_executor_id).await; + let mut error_trigger = create_avm(fallible_call_service("error"), error_trigger_id).await; + let mut last_error_receiver = create_avm(unit_call_service(), last_error_receiver_id).await; + let mut last_peer_checker = create_avm(unit_call_service(), last_peer_checker_id).await; let script = format!( include_str!("scripts/fold_par_early_exit.air"), diff --git a/air/tests/test_module/features/tetraplets/provenance.rs b/air/tests/test_module/features/tetraplets/provenance.rs index 408244c428..6f1c4dedd7 100644 --- a/air/tests/test_module/features/tetraplets/provenance.rs +++ b/air/tests/test_module/features/tetraplets/provenance.rs @@ -18,7 +18,7 @@ use air_test_framework::AirScriptExecutor; use air_test_utils::{key_utils::at, prelude::*}; #[tokio::test] -fn call_result() { +async fn call_result() { let init_peer_name = "B"; let air_script = r#" @@ -27,9 +27,11 @@ fn call_result() { (canon "B" $s #c)) "#; let runner = - AirScriptExecutor::from_annotated(TestRunParameters::from_init_peer_id(init_peer_name), air_script).unwrap(); + AirScriptExecutor::from_annotated(TestRunParameters::from_init_peer_id(init_peer_name), air_script) + .await + .unwrap(); - let result = runner.execute_one(init_peer_name).unwrap(); + let result = runner.execute_one(init_peer_name).await.unwrap(); assert_eq!(result.ret_code, 0, "{:?}", result.error_message); let data = data_from_result(&result); @@ -68,7 +70,7 @@ fn call_result() { } #[tokio::test] -fn call_result_iteration() { +async fn call_result_iteration() { let init_peer_name = "A"; let air_script = r#" @@ -82,9 +84,9 @@ fn call_result_iteration() { (canon "A" $s #c)) "#; let runner = - AirScriptExecutor::from_annotated(TestRunParameters::from_init_peer_id(init_peer_name), air_script).unwrap(); + AirScriptExecutor::from_annotated(TestRunParameters::from_init_peer_id(init_peer_name), air_script).await.unwrap(); - let result = runner.execute_one(init_peer_name).unwrap(); + let result = runner.execute_one(init_peer_name).await.unwrap(); assert_eq!(result.ret_code, 0, "{:?}", result.error_message); let data = data_from_result(&result); @@ -141,7 +143,7 @@ fn call_result_iteration() { } #[tokio::test] -fn literal() { +async fn literal() { let init_peer_name = "B"; let air_script = r#" @@ -150,9 +152,9 @@ fn literal() { (canon "B" $s #c)) "#; let runner = - AirScriptExecutor::from_annotated(TestRunParameters::from_init_peer_id(init_peer_name), air_script).unwrap(); + AirScriptExecutor::from_annotated(TestRunParameters::from_init_peer_id(init_peer_name), air_script).await.unwrap(); - let result = runner.execute_one(init_peer_name).unwrap(); + let result = runner.execute_one(init_peer_name).await.unwrap(); assert_eq!(result.ret_code, 0, "{:?}", result.error_message); let data = data_from_result(&result); @@ -183,7 +185,7 @@ fn literal() { } #[tokio::test] -fn canon_in_canon() { +async fn canon_in_canon() { let init_peer_name = "B"; let air_script = r#" @@ -196,9 +198,9 @@ fn canon_in_canon() { (canon "B" $s #d))) "#; let runner = - AirScriptExecutor::from_annotated(TestRunParameters::from_init_peer_id(init_peer_name), air_script).unwrap(); + AirScriptExecutor::from_annotated(TestRunParameters::from_init_peer_id(init_peer_name), air_script).await.unwrap(); - let result = runner.execute_one(init_peer_name).unwrap(); + let result = runner.execute_one(init_peer_name).await.unwrap(); assert_eq!(result.ret_code, 0, "{:?}", result.error_message); let trace = trace_from_result(&result); @@ -257,7 +259,7 @@ fn canon_in_canon() { } #[tokio::test] -fn lambda_result_iteration() { +async fn lambda_result_iteration() { let init_peer_name = "A"; let air_script = r#" @@ -274,9 +276,9 @@ fn lambda_result_iteration() { (canon "A" $s #c)) "#; let runner = - AirScriptExecutor::from_annotated(TestRunParameters::from_init_peer_id(init_peer_name), air_script).unwrap(); + AirScriptExecutor::from_annotated(TestRunParameters::from_init_peer_id(init_peer_name), air_script).await.unwrap(); - let result = runner.execute_one(init_peer_name).unwrap(); + let result = runner.execute_one(init_peer_name).await.unwrap(); assert_eq!(result.ret_code, 0, "{:?}", result.error_message); let data = data_from_result(&result); diff --git a/air/tests/test_module/features/tetraplets/security_tetraplets.rs b/air/tests/test_module/features/tetraplets/security_tetraplets.rs index 514b27d47c..89f61b69e8 100644 --- a/air/tests/test_module/features/tetraplets/security_tetraplets.rs +++ b/air/tests/test_module/features/tetraplets/security_tetraplets.rs @@ -39,18 +39,18 @@ fn arg_host_function() -> (CallServiceClosure, Rc>) { } #[tokio::test] -fn fold_with_inner_call() { +async fn fold_with_inner_call() { let return_numbers_call_service: CallServiceClosure = Box::new(|_| -> CallServiceResult { CallServiceResult::ok(json!(["1", "2", "3", "4", "5", "6", "7", "8", "9", "10"])) }); let set_variable_vm_peer_id = String::from("some_peer_id_1"); - let mut set_variable_vm = create_avm(return_numbers_call_service, set_variable_vm_peer_id.clone()); + let mut set_variable_vm = create_avm(return_numbers_call_service, set_variable_vm_peer_id.clone()).await; let mut client_vms = Vec::new(); for i in 1..=10 { let (arg_host_func, arg_tetraplets) = arg_host_function(); - let vm = create_avm(arg_host_func, i.to_string()); + let vm = create_avm(arg_host_func, i.to_string()).await; client_vms.push((vm, arg_tetraplets)) } @@ -98,7 +98,7 @@ fn fold_with_inner_call() { } #[tokio::test] -fn fold_stream_with_inner_call() { +async fn fold_stream_with_inner_call() { let init_peer_name = "init_peer_id"; let air_script = r#" (seq @@ -116,9 +116,10 @@ fn fold_stream_with_inner_call() { TestRunParameters::from_init_peer_id(init_peer_name), &air_script, ) + .await .unwrap(); - let result = executor.execute_one(init_peer_name).unwrap(); + let result = executor.execute_one(init_peer_name).await.unwrap(); assert_eq!(result.ret_code, 0, "{}", result.error_message); let data = data_from_result(&result); @@ -144,7 +145,7 @@ fn fold_stream_with_inner_call() { } #[tokio::test] -fn fold_canon_with_inner_call() { +async fn fold_canon_with_inner_call() { let init_peer_name = "init_peer_id"; let air_script = r#" (seq @@ -164,9 +165,10 @@ fn fold_canon_with_inner_call() { TestRunParameters::from_init_peer_id(init_peer_name), &air_script, ) + .await .unwrap(); - let result = executor.execute_one(init_peer_name).unwrap(); + let result = executor.execute_one(init_peer_name).await.unwrap(); assert_eq!(result.ret_code, 0, "{}", result.error_message); let data = data_from_result(&result); @@ -192,18 +194,18 @@ fn fold_canon_with_inner_call() { } #[tokio::test] -fn fold_json_path() { +async fn fold_json_path() { let variable_numbers = json!({"args": ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10"]}); let set_variable_vm_peer_id = String::from("some_peer_id_1"); let mut set_variable_vm = create_avm( set_variable_call_service(variable_numbers), set_variable_vm_peer_id.clone(), - ); + ).await; let (arg_host_func, arg_tetraplets) = arg_host_function(); let client_peer_id = String::from("client_id"); - let mut client_vm = create_avm(arg_host_func, client_peer_id.clone()); + let mut client_vm = create_avm(arg_host_func, client_peer_id.clone()).await; let service_id = String::from("some_service_id"); let function_name = String::from("some_function_name"); @@ -250,17 +252,17 @@ fn fold_json_path() { } #[tokio::test] -fn check_tetraplet_works_correctly() { +async fn check_tetraplet_works_correctly() { let return_numbers_call_service: CallServiceClosure = Box::new(|_| -> CallServiceResult { CallServiceResult::ok(json!({"args": ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10"]})) }); let set_variable_vm_peer_id = String::from("some_peer_id_1"); - let mut set_variable_vm = create_avm(return_numbers_call_service, set_variable_vm_peer_id.clone()); + let mut set_variable_vm = create_avm(return_numbers_call_service, set_variable_vm_peer_id.clone()).await; let (arg_host_func, arg_tetraplets) = arg_host_function(); let client_peer_id = String::from("client_id"); - let mut client_vm = create_avm(arg_host_func, client_peer_id.clone()); + let mut client_vm = create_avm(arg_host_func, client_peer_id.clone()).await; let service_id = String::from("some_service_id"); let function_name = String::from("some_function_name"); @@ -297,22 +299,29 @@ fn check_tetraplet_works_correctly() { assert_eq!(arg_tetraplets, expected_tetraplets); } -use fluence_app_service::AppService; +use fluence_app_service::{AppService, MarineModuleConfig}; use fluence_app_service::AppServiceConfig; use fluence_app_service::MarineConfig; use fluence_app_service::ModuleDescriptor; use air_test_utils::trace_from_result; use std::path::PathBuf; +use tracing::instrument::WithSubscriber; fn construct_service_config(module_name: impl Into) -> AppServiceConfig { let module_name = module_name.into(); let module_path = format!("./tests/security_tetraplets/{module_name}/target/wasm32-wasi/debug/"); let module_descriptor = ModuleDescriptor { + load_from: None, file_name: module_name.clone() + ".wasm", import_name: module_name, - ..<_>::default() + config: MarineModuleConfig { + logger_enabled: Default::default(), + host_imports: Default::default(), + wasi: Default::default(), + logging_mask: Default::default(), + }, }; let marine_config = MarineConfig { @@ -333,17 +342,17 @@ fn construct_service_config(module_name: impl Into) -> AppServiceConfig #[tokio::test] #[ignore] -fn tetraplet_with_wasm_modules() { +async fn tetraplet_with_wasm_modules() { use marine_rs_sdk::CallParameters; use marine_rs_sdk::SecurityTetraplet as SDKTetraplet; let auth_module_name = String::from("auth_module"); let auth_service_config = construct_service_config(auth_module_name.clone()); - let auth_service = AppService::new(auth_service_config, auth_module_name, <_>::default()).unwrap(); + let auth_service = AppService::new(auth_service_config, auth_module_name, <_>::default()).await.unwrap(); let log_module_name = String::from("log_storage"); let log_service_config = construct_service_config(log_module_name.clone()); - let log_service = AppService::new(log_service_config, log_module_name, <_>::default()).unwrap(); + let log_service = AppService::new(log_service_config, log_module_name, <_>::default()).await.unwrap(); let services = maplit::hashmap!( "auth" => auth_service, @@ -366,11 +375,12 @@ fn tetraplet_with_wasm_modules() { let service = service.get_mut(params.service_id.as_str()).unwrap(); let result = service - .call( + .call_async( params.function_name, JValue::Array(params.arguments), to_app_service_call_parameters(call_parameters), ) + .await .unwrap(); CallServiceResult::ok(result) @@ -386,7 +396,7 @@ fn tetraplet_with_wasm_modules() { "# ); - let mut vm = create_avm(host_func, local_peer_id); + let mut vm = create_avm(host_func, local_peer_id).await; let test_params = TestRunParameters::from_init_peer_id(ADMIN_PEER_PK); let result = checked_call_vm!(vm, test_params, script, "", ""); @@ -404,6 +414,7 @@ fn to_app_service_call_parameters( service_id: call_parameters.service_id, service_creator_peer_id: call_parameters.service_creator_peer_id, host_id: call_parameters.host_id, + worker_id: call_parameters.worker_id, particle_id: call_parameters.particle_id, tetraplets: call_parameters .tetraplets diff --git a/air/tests/test_module/features/topology_hops/call_guided_topology.rs b/air/tests/test_module/features/topology_hops/call_guided_topology.rs index 0da7c8b6dd..450d5d129d 100644 --- a/air/tests/test_module/features/topology_hops/call_guided_topology.rs +++ b/air/tests/test_module/features/topology_hops/call_guided_topology.rs @@ -19,9 +19,9 @@ use fluence_keypair::KeyFormat; use fluence_keypair::KeyPair; #[tokio::test] -fn call_generates_hop() { +async fn call_generates_hop() { let client_peer_id = "client"; - let mut client_vm = create_avm(unit_call_service(), client_peer_id); + let mut client_vm = create_avm(unit_call_service(), client_peer_id).await; let test_peer_id = "test_peer_id"; @@ -36,16 +36,16 @@ fn call_generates_hop() { } #[tokio::test] -fn call_with_join_behaviour() { +async fn call_with_join_behaviour() { let relay_peer_id = "relay"; - let mut relay_vm = create_avm(unit_call_service(), relay_peer_id); + let mut relay_vm = create_avm(unit_call_service(), relay_peer_id).await; let client_peer_id = "client"; - let mut client_vm = create_avm(unit_call_service(), client_peer_id); + let mut client_vm = create_avm(unit_call_service(), client_peer_id).await; let friend_peer_id = "friend"; - let mut friend_vm = create_avm(unit_call_service(), friend_peer_id); + let mut friend_vm = create_avm(unit_call_service(), friend_peer_id).await; let friend_relay_peer_id = "friend_relay"; - let mut friend_relay_vm = create_avm(unit_call_service(), friend_relay_peer_id); + let mut friend_relay_vm = create_avm(unit_call_service(), friend_relay_peer_id).await; let script = format!( r#" @@ -121,6 +121,7 @@ fn call_with_join_behaviour() { &keypair, "".to_string(), ) + .await .unwrap(); assert_next_pks!(&client_result.next_peer_pks, &[relay_peer_id]); diff --git a/air/tests/test_module/features/topology_hops/canon_guided_topology.rs b/air/tests/test_module/features/topology_hops/canon_guided_topology.rs index c57f014720..8b8a6c3598 100644 --- a/air/tests/test_module/features/topology_hops/canon_guided_topology.rs +++ b/air/tests/test_module/features/topology_hops/canon_guided_topology.rs @@ -19,9 +19,9 @@ use fluence_keypair::KeyFormat; use fluence_keypair::KeyPair; #[tokio::test] -fn canon_generates_hop() { +async fn canon_generates_hop() { let client_peer_id = "client"; - let mut client_vm = create_avm(unit_call_service(), client_peer_id); + let mut client_vm = create_avm(unit_call_service(), client_peer_id).await; let test_peer_id = "test_peer_id"; @@ -36,16 +36,16 @@ fn canon_generates_hop() { } #[tokio::test] -fn canon_with_join_behaviour() { +async fn canon_with_join_behaviour() { let relay_peer_id = "relay"; - let mut relay_vm = create_avm(unit_call_service(), relay_peer_id); + let mut relay_vm = create_avm(unit_call_service(), relay_peer_id).await; let client_peer_id = "client"; - let mut client_vm = create_avm(unit_call_service(), client_peer_id); + let mut client_vm = create_avm(unit_call_service(), client_peer_id).await; let friend_peer_id = "friend"; - let mut friend_vm = create_avm(unit_call_service(), friend_peer_id); + let mut friend_vm = create_avm(unit_call_service(), friend_peer_id).await; let friend_relay_peer_id = "friend_relay"; - let mut friend_relay_vm = create_avm(unit_call_service(), friend_relay_peer_id); + let mut friend_relay_vm = create_avm(unit_call_service(), friend_relay_peer_id).await; let script = format!( r#" @@ -145,6 +145,7 @@ fn canon_with_join_behaviour() { &keypair, "".to_string(), ) + .await .unwrap(); assert_next_pks!(&client_result.next_peer_pks, &[relay_peer_id]); diff --git a/air/tests/test_module/instructions/ap.rs b/air/tests/test_module/instructions/ap.rs index 55a854573f..14f3b65f8e 100644 --- a/air/tests/test_module/instructions/ap.rs +++ b/air/tests/test_module/instructions/ap.rs @@ -25,13 +25,13 @@ use std::cell::RefCell; use std::rc::Rc; #[tokio::test] -fn ap_with_scalars() { +async fn ap_with_scalars() { let vm_1_peer_id = "vm_1_peer_id"; let test_value = "scalar_2"; - let mut vm_1 = create_avm(set_variable_call_service(json!({ "field": test_value })), vm_1_peer_id); + let mut vm_1 = create_avm(set_variable_call_service(json!({ "field": test_value })), vm_1_peer_id).await; let vm_2_peer_id = "vm_2_peer_id"; - let mut vm_2 = create_avm(echo_call_service(), vm_2_peer_id); + let mut vm_2 = create_avm(echo_call_service(), vm_2_peer_id).await; let script = format!( r#" @@ -63,9 +63,9 @@ fn ap_with_scalars() { } #[tokio::test] -fn ap_with_string_literal() { +async fn ap_with_string_literal() { let vm_1_peer_id = "vm_1_peer_id"; - let mut vm_1 = create_avm(echo_call_service(), vm_1_peer_id); + let mut vm_1 = create_avm(echo_call_service(), vm_1_peer_id).await; let some_string = "some_string"; let script = format!( @@ -103,9 +103,9 @@ fn ap_with_string_literal() { } #[tokio::test] -fn ap_with_bool_literal() { +async fn ap_with_bool_literal() { let vm_1_peer_id = "vm_1_peer_id"; - let mut vm_1 = create_avm(echo_call_service(), vm_1_peer_id); + let mut vm_1 = create_avm(echo_call_service(), vm_1_peer_id).await; let script = format!( r#" @@ -140,9 +140,9 @@ fn ap_with_bool_literal() { } #[tokio::test] -fn ap_with_number_literal() { +async fn ap_with_number_literal() { let vm_1_peer_id = "vm_1_peer_id"; - let mut vm_1 = create_avm(echo_call_service(), vm_1_peer_id); + let mut vm_1 = create_avm(echo_call_service(), vm_1_peer_id).await; let script = format!( r#" @@ -177,9 +177,9 @@ fn ap_with_number_literal() { } #[tokio::test] -fn ap_with_last_error() { +async fn ap_with_last_error() { let vm_1_peer_id = "vm_1_peer_id"; - let mut vm_1 = create_avm(echo_call_service(), vm_1_peer_id); + let mut vm_1 = create_avm(echo_call_service(), vm_1_peer_id).await; let script = format!( r#" @@ -218,9 +218,9 @@ fn ap_with_last_error() { } #[tokio::test] -fn ap_with_error() { +async fn ap_with_error() { let vm_1_peer_id = "vm_1_peer_id"; - let mut vm_1 = create_avm(echo_call_service(), vm_1_peer_id); + let mut vm_1 = create_avm(echo_call_service(), vm_1_peer_id).await; let script = format!( r#" @@ -259,9 +259,9 @@ fn ap_with_error() { } #[tokio::test] -fn ap_with_timestamp() { +async fn ap_with_timestamp() { let vm_1_peer_id = "vm_1_peer_id"; - let mut vm_1 = create_avm(echo_call_service(), vm_1_peer_id); + let mut vm_1 = create_avm(echo_call_service(), vm_1_peer_id).await; let script = format!( r#" @@ -286,9 +286,9 @@ fn ap_with_timestamp() { } #[tokio::test] -fn ap_with_ttl() { +async fn ap_with_ttl() { let vm_1_peer_id = "vm_1_peer_id"; - let mut vm_1 = create_avm(echo_call_service(), vm_1_peer_id); + let mut vm_1 = create_avm(echo_call_service(), vm_1_peer_id).await; let script = format!( r#" @@ -309,13 +309,13 @@ fn ap_with_ttl() { } #[tokio::test] -fn ap_with_dst_stream() { +async fn ap_with_dst_stream() { let vm_1_peer_id = "vm_1_peer_id"; let test_value = "scalar_2"; - let mut vm_1 = create_avm(set_variable_call_service(json!({ "field": test_value })), vm_1_peer_id); + let mut vm_1 = create_avm(set_variable_call_service(json!({ "field": test_value })), vm_1_peer_id).await; let vm_2_peer_id = "vm_2_peer_id"; - let mut vm_2 = create_avm(echo_call_service(), vm_2_peer_id); + let mut vm_2 = create_avm(echo_call_service(), vm_2_peer_id).await; let script = format!( r#" @@ -363,10 +363,10 @@ fn ap_with_dst_stream() { } #[tokio::test] -fn ap_canon_stream_with_lambda() { +async fn ap_canon_stream_with_lambda() { let vm_1_peer_id = "vm_1_peer_id"; let (echo_call_service, tetraplet_checker) = tetraplet_host_function(echo_call_service()); - let mut vm_1 = create_avm(echo_call_service, vm_1_peer_id); + let mut vm_1 = create_avm(echo_call_service, vm_1_peer_id).await; let service_name = "some_service_name"; let function_name = "some_function_name"; @@ -450,7 +450,7 @@ fn ap_canon_stream_with_lambda() { } #[tokio::test] -fn ap_canon_stream() { +async fn ap_canon_stream() { let vm_1_peer_id = "vm_1_peer_id"; let arg_tetraplets = Rc::new(RefCell::new(vec![])); @@ -461,7 +461,7 @@ fn ap_canon_stream() { }); let (echo_call_service, tetraplet_checker) = tetraplet_host_function(echo_call_service); - let mut vm_1 = create_avm(echo_call_service, vm_1_peer_id); + let mut vm_1 = create_avm(echo_call_service, vm_1_peer_id).await; let service_name = "some_service_name"; let function_name = "some_function_name"; @@ -537,9 +537,9 @@ fn ap_canon_stream() { } #[tokio::test] -fn ap_stream_map() { +async fn ap_stream_map() { let vm_1_peer_id = "vm_1_peer_id"; - let mut vm_1 = create_avm(echo_call_service(), vm_1_peer_id); + let mut vm_1 = create_avm(echo_call_service(), vm_1_peer_id).await; let service_name1 = "serv1"; let service_name2 = "serv2"; @@ -603,7 +603,7 @@ fn ap_stream_map() { } #[tokio::test] -fn ap_stream_map_with_undefined_last_error() { +async fn ap_stream_map_with_undefined_last_error() { let vm_1_peer_id = "vm_1_peer_id"; let script = format!( r#" @@ -620,8 +620,9 @@ fn ap_stream_map_with_undefined_last_error() { ); let executor = AirScriptExecutor::from_annotated(TestRunParameters::from_init_peer_id(vm_1_peer_id), &script) + .await .expect("invalid test AIR script"); - let result = executor.execute_all(vm_1_peer_id).unwrap(); + let result = executor.execute_all(vm_1_peer_id).await.unwrap(); let actual_trace = trace_from_result(&result.last().unwrap()); let expected_state = vec![ @@ -644,7 +645,7 @@ fn ap_stream_map_with_undefined_last_error() { } #[tokio::test] -fn ap_canon_stream_map_with_string_key_accessor_lambda() { +async fn ap_canon_stream_map_with_string_key_accessor_lambda() { let vm_1_peer_name = "vm_1_peer_id"; let vm_1_peer_id = at(vm_1_peer_name); @@ -664,8 +665,9 @@ fn ap_canon_stream_map_with_string_key_accessor_lambda() { ); let executor = AirScriptExecutor::from_annotated(TestRunParameters::from_init_peer_id(vm_1_peer_name), &script) + .await .expect("invalid test AIR script"); - let result = executor.execute_all(vm_1_peer_name).unwrap(); + let result = executor.execute_all(vm_1_peer_name).await.unwrap(); let actual_trace = trace_from_result(&result.last().unwrap()); let mut cid_tracker: ExecutionCidState = ExecutionCidState::new(); @@ -700,7 +702,7 @@ fn ap_canon_stream_map_with_string_key_accessor_lambda() { } #[tokio::test] -fn ap_canon_stream_map_with_numeric_key_accessor_lambda() { +async fn ap_canon_stream_map_with_numeric_key_accessor_lambda() { let vm_1_peer_name = "vm_1_peer_id"; let vm_1_peer_id = at(vm_1_peer_name); @@ -720,8 +722,9 @@ fn ap_canon_stream_map_with_numeric_key_accessor_lambda() { ); let executor = AirScriptExecutor::from_annotated(TestRunParameters::from_init_peer_id(vm_1_peer_name), &script) + .await .expect("invalid test AIR script"); - let result = executor.execute_all(vm_1_peer_name).unwrap(); + let result = executor.execute_all(vm_1_peer_name).await.unwrap(); let actual_trace = trace_from_result(&result.last().unwrap()); let mut cid_tracker: ExecutionCidState = ExecutionCidState::new(); @@ -755,7 +758,7 @@ fn ap_canon_stream_map_with_numeric_key_accessor_lambda() { } #[tokio::test] -fn ap_map_key_join_behavior() { +async fn ap_map_key_join_behavior() { let vm_1_peer_id = "vm_1_peer_id"; let script = r#" (seq @@ -774,14 +777,15 @@ fn ap_map_key_join_behavior() { "#; let executor = AirScriptExecutor::from_annotated(TestRunParameters::from_init_peer_id(vm_1_peer_id), &script) + .await .expect("invalid test AIR script"); - let result = executor.execute_one(vm_1_peer_id).unwrap(); + let result = executor.execute_one(vm_1_peer_id).await.unwrap(); assert_eq!(result.ret_code, 0, "{:?}", result.error_message); } #[tokio::test] -fn ap_map_value_join_behavior() { +async fn ap_map_value_join_behavior() { let vm_1_peer_id = "vm_1_peer_id"; let script = r#" (seq @@ -797,8 +801,9 @@ fn ap_map_value_join_behavior() { "#; let executor = AirScriptExecutor::from_annotated(TestRunParameters::from_init_peer_id(vm_1_peer_id), &script) + .await .expect("invalid test AIR script"); - let result = executor.execute_one(vm_1_peer_id).unwrap(); + let result = executor.execute_one(vm_1_peer_id).await.unwrap(); assert_eq!(result.ret_code, 0, "{:?}", result.error_message); } diff --git a/air/tests/test_module/instructions/call.rs b/air/tests/test_module/instructions/call.rs index cee48d1882..c626e34037 100644 --- a/air/tests/test_module/instructions/call.rs +++ b/air/tests/test_module/instructions/call.rs @@ -24,9 +24,9 @@ use pretty_assertions::assert_eq; // Check that %init_peer_id% alias works correctly (by comparing result with it and explicit peer id). // Additionally, check that empty string for data does the same as empty call path. #[tokio::test] -fn current_peer_id_call() { +async fn current_peer_id_call() { let vm_peer_id = "test_peer_id"; - let mut vm = create_avm(unit_call_service(), vm_peer_id); + let mut vm = create_avm(unit_call_service(), vm_peer_id).await; let service_id = "local_service_id"; let function_name = "local_fn_name"; @@ -64,9 +64,9 @@ fn current_peer_id_call() { } #[tokio::test] -fn call_with_timestamp() { +async fn call_with_timestamp() { let vm_peer_id = "test_peer_id"; - let mut vm = create_avm(echo_call_service(), vm_peer_id); + let mut vm = create_avm(echo_call_service(), vm_peer_id).await; let script = r#"(call %init_peer_id% ("" "") [%timestamp%] result_name)"#; @@ -84,9 +84,9 @@ fn call_with_timestamp() { } #[tokio::test] -fn call_with_ttl() { +async fn call_with_ttl() { let vm_peer_id = "test_peer_id"; - let mut vm = create_avm(echo_call_service(), vm_peer_id); + let mut vm = create_avm(echo_call_service(), vm_peer_id).await; let script = format!(r#"(call "{vm_peer_id}" ("" "") [%ttl%] result_name)"#); @@ -101,9 +101,9 @@ fn call_with_ttl() { // Check that specifying remote peer id in call will result its appearing in next_peer_pks. #[tokio::test] -fn remote_peer_id_call() { +async fn remote_peer_id_call() { let some_local_peer_id = String::from("some_local_peer_id"); - let mut vm = create_avm(echo_call_service(), &some_local_peer_id); + let mut vm = create_avm(echo_call_service(), &some_local_peer_id).await; let remote_peer_id = String::from("some_remote_peer_id"); let script = format!(r#"(call "{remote_peer_id}" ("local_service_id" "local_fn_name") ["arg"] result_name)"#); @@ -120,9 +120,9 @@ fn remote_peer_id_call() { // Check that setting variables works as expected. #[tokio::test] -fn variables() { - let mut vm = create_avm(unit_call_service(), "remote_peer_id"); - let mut set_variable_vm = create_avm(set_variable_call_service(json!("remote_peer_id")), "set_variable"); +async fn variables() { + let mut vm = create_avm(unit_call_service(), "remote_peer_id").await; + let mut set_variable_vm = create_avm(set_variable_call_service(json!("remote_peer_id")), "set_variable").await; let script = r#" (seq @@ -139,9 +139,9 @@ fn variables() { // Check that duplicate variables are impossible. #[tokio::test] -fn duplicate_variables() { +async fn duplicate_variables() { let peer_id = "peer_id"; - let mut vm = create_avm(unit_call_service(), peer_id); + let mut vm = create_avm(unit_call_service(), peer_id).await; let variable_name = "modules"; let script = format!( @@ -162,15 +162,15 @@ fn duplicate_variables() { // Check that string literals can be used as call parameters. #[tokio::test] -fn string_parameters() { +async fn string_parameters() { let call_service: CallServiceClosure = Box::new(|mut params| -> CallServiceResult { CallServiceResult::ok(params.arguments.remove(0)) }); let vm_peer_id = "A"; - let mut vm = create_avm(call_service, vm_peer_id); + let mut vm = create_avm(call_service, vm_peer_id).await; let set_variable_vm_peer_id = "set_variable"; - let mut set_variable_vm = create_avm(set_variable_call_service(json!("arg3_value")), set_variable_vm_peer_id); + let mut set_variable_vm = create_avm(set_variable_call_service(json!("arg3_value")), set_variable_vm_peer_id).await; let service_id = "some_service_id"; let function_name = "local_fn_name"; @@ -200,7 +200,7 @@ fn string_parameters() { } #[tokio::test] -fn call_canon_stream_map_arg() { +async fn call_canon_stream_map_arg() { let vm_1_peer_name = "vm_1_peer_id"; let vm_1_peer_id = at(vm_1_peer_name); @@ -220,8 +220,9 @@ fn call_canon_stream_map_arg() { ); let executor = AirScriptExecutor::from_annotated(TestRunParameters::from_init_peer_id(vm_1_peer_name), &script) + .await .expect("invalid test AIR script"); - let result = executor.execute_all(vm_1_peer_name).unwrap(); + let result = executor.execute_all(vm_1_peer_name).await.unwrap(); let actual_trace = trace_from_result(&result.last().unwrap()); let mut cid_tracker: ExecutionCidState = ExecutionCidState::new(); @@ -269,7 +270,7 @@ fn call_canon_stream_map_arg() { // WIP add negative #[tokio::test] -fn call_peer_id_from_canon_stream_map() { +async fn call_peer_id_from_canon_stream_map() { let vm_1_peer_name = "vm_1_peer_id"; let vm_1_peer_id = at(vm_1_peer_name); let script = format!( @@ -288,8 +289,9 @@ fn call_peer_id_from_canon_stream_map() { ); let executor = AirScriptExecutor::from_annotated(TestRunParameters::from_init_peer_id(vm_1_peer_name), &script) + .await .expect("invalid test AIR script"); - let result = executor.execute_all(vm_1_peer_name).unwrap(); + let result = executor.execute_all(vm_1_peer_name).await.unwrap(); let actual_trace = trace_from_result(&result.last().unwrap()); let mut cid_tracker: ExecutionCidState = ExecutionCidState::new(); @@ -335,11 +337,11 @@ fn call_peer_id_from_canon_stream_map() { } #[tokio::test] -fn call_module_func_from_canon_stream_map() { +async fn call_module_func_from_canon_stream_map() { let vm_1_peer_id = "vm_1_peer_id"; // There is a bug in testing framework that disallows lenses to be a source of a module name in // a call triplet. - let mut vm = create_avm(echo_call_service(), vm_1_peer_id); + let mut vm = create_avm(echo_call_service(), vm_1_peer_id).await; let script = format!( r#" diff --git a/air/tests/test_module/instructions/canon.rs b/air/tests/test_module/instructions/canon.rs index 81c20345ab..ede8efd540 100644 --- a/air/tests/test_module/instructions/canon.rs +++ b/air/tests/test_module/instructions/canon.rs @@ -25,11 +25,11 @@ use std::ops::Deref; use std::rc::Rc; #[tokio::test] -fn canon_moves_execution_flow() { +async fn canon_moves_execution_flow() { let peer_id_1 = "peer_id_1"; let peer_id_2 = "peer_id_2"; let init_peer_id = "A"; - let mut vm = create_avm(echo_call_service(), init_peer_id); + let mut vm = create_avm(echo_call_service(), init_peer_id).await; let script = format!( r#" @@ -54,10 +54,10 @@ fn canon_moves_execution_flow() { } #[tokio::test] -fn basic_canon() { - let mut vm = create_avm(echo_call_service(), "A"); +async fn basic_canon() { + let mut vm = create_avm(echo_call_service(), "A").await; let data = json!(["1", "2", "3", "4", "5"]); - let mut set_variable_vm = create_avm(set_variable_call_service(data.clone()), "set_variable"); + let mut set_variable_vm = create_avm(set_variable_call_service(data.clone()), "set_variable").await; let script = r#" (seq @@ -109,15 +109,15 @@ fn basic_canon() { } #[tokio::test] -fn canon_fixes_stream_correct() { +async fn canon_fixes_stream_correct() { let peer_id_1 = "peer_id_1"; - let mut vm_1 = create_avm(echo_call_service(), peer_id_1); + let mut vm_1 = create_avm(echo_call_service(), peer_id_1).await; let peer_id_2 = "peer_id_2"; - let mut vm_2 = create_avm(echo_call_service(), peer_id_2); + let mut vm_2 = create_avm(echo_call_service(), peer_id_2).await; let peer_id_3 = "peer_id_3"; - let mut vm_3 = create_avm(echo_call_service(), peer_id_3); + let mut vm_3 = create_avm(echo_call_service(), peer_id_3).await; let peer_id_4 = "peer_id_4"; - let mut vm_4 = create_avm(echo_call_service(), peer_id_4); + let mut vm_4 = create_avm(echo_call_service(), peer_id_4).await; let script = format!( r#" @@ -202,12 +202,12 @@ fn canon_fixes_stream_correct() { } #[tokio::test] -fn canon_stream_can_be_created_from_aps() { +async fn canon_stream_can_be_created_from_aps() { let vm_1_peer_id = "vm_1_peer_id"; - let mut vm_1 = create_avm(echo_call_service(), vm_1_peer_id); + let mut vm_1 = create_avm(echo_call_service(), vm_1_peer_id).await; let vm_2_peer_id = "vm_2_peer_id"; - let mut vm_2 = create_avm(echo_call_service(), vm_2_peer_id); + let mut vm_2 = create_avm(echo_call_service(), vm_2_peer_id).await; let script = format!( r#" @@ -232,12 +232,12 @@ fn canon_stream_can_be_created_from_aps() { } #[tokio::test] -fn canon_gates() { +async fn canon_gates() { let peer_id_1 = "peer_id_1"; - let mut vm_1 = create_avm(set_variable_call_service(json!([1, 2, 3, 4, 5])), peer_id_1); + let mut vm_1 = create_avm(set_variable_call_service(json!([1, 2, 3, 4, 5])), peer_id_1).await; let peer_id_2 = "peer_id_2"; - let mut vm_2 = create_avm(echo_call_service(), peer_id_2); + let mut vm_2 = create_avm(echo_call_service(), peer_id_2).await; let peer_id_3 = "peer_id_3"; let stop_len_count = 2; @@ -249,7 +249,7 @@ fn canon_gates() { CallServiceResult::ok(json!(false)) } }); - let mut vm_3 = create_avm(vm_3_call_service, peer_id_3); + let mut vm_3 = create_avm(vm_3_call_service, peer_id_3).await; let script = format!( r#" @@ -290,11 +290,11 @@ fn canon_gates() { } #[tokio::test] -fn canon_empty_stream() { +async fn canon_empty_stream() { let peer_id_1 = "peer_id_1"; - let mut vm_1 = create_avm(echo_call_service(), peer_id_1); + let mut vm_1 = create_avm(echo_call_service(), peer_id_1).await; let peer_id_2 = "peer_id_2"; - let mut vm_2 = create_avm(echo_call_service(), peer_id_2); + let mut vm_2 = create_avm(echo_call_service(), peer_id_2).await; let script = format!( r#" @@ -327,9 +327,9 @@ fn canon_empty_stream() { } #[tokio::test] -fn canon_empty_not_writable_stream() { +async fn canon_empty_not_writable_stream() { let peer_id = "peer_id"; - let mut vm = create_avm(echo_call_service(), peer_id); + let mut vm = create_avm(echo_call_service(), peer_id).await; let script = format!( r#" @@ -353,15 +353,15 @@ fn canon_empty_not_writable_stream() { } #[tokio::test] -fn canon_over_later_defined_stream() { +async fn canon_over_later_defined_stream() { let vm_peer_id_1 = "vm_peer_id_1"; - let mut peer_vm_1 = create_avm(echo_call_service(), vm_peer_id_1); + let mut peer_vm_1 = create_avm(echo_call_service(), vm_peer_id_1).await; let vm_peer_id_2 = "vm_peer_id_2"; - let mut peer_vm_2 = create_avm(echo_call_service(), vm_peer_id_2); + let mut peer_vm_2 = create_avm(echo_call_service(), vm_peer_id_2).await; let vm_peer_id_3 = "vm_peer_id_3"; - let mut peer_vm_3 = create_avm(echo_call_service(), vm_peer_id_3); + let mut peer_vm_3 = create_avm(echo_call_service(), vm_peer_id_3).await; let script = format!( r#" @@ -392,9 +392,9 @@ fn canon_over_later_defined_stream() { } #[tokio::test] -fn canon_map_scalar() { +async fn canon_map_scalar() { let vm_peer_id_1 = "vm_peer_id_1"; - let mut peer_vm_1 = create_avm(echo_call_service(), vm_peer_id_1); + let mut peer_vm_1 = create_avm(echo_call_service(), vm_peer_id_1).await; let script = format!( r#" @@ -462,12 +462,12 @@ fn canon_map_scalar() { } #[tokio::test] -fn canon_map_scalar_with_par() { +async fn canon_map_scalar_with_par() { let vm_peer_id_1 = "vm_peer_id_1"; let vm_peer_id_2 = "vm_peer_id_2"; - let mut peer_vm_1 = create_avm(echo_call_service(), vm_peer_id_1); - let mut peer_vm_2 = create_avm(echo_call_service(), vm_peer_id_2); + let mut peer_vm_1 = create_avm(echo_call_service(), vm_peer_id_1).await; + let mut peer_vm_2 = create_avm(echo_call_service(), vm_peer_id_2).await; let script = format!( r#" @@ -571,13 +571,13 @@ fn canon_map_scalar_with_par() { } #[tokio::test] -fn test_extend_by_request_sent_by() { +async fn test_extend_by_request_sent_by() { let peer_id_1 = "peer_1"; let peer_id_2 = "peer_2"; let other_peer_id = "A"; - let mut peer_vm_1 = create_avm(echo_call_service(), peer_id_1); - let mut peer_vm_2 = create_avm(echo_call_service(), peer_id_2); + let mut peer_vm_1 = create_avm(echo_call_service(), peer_id_1).await; + let mut peer_vm_2 = create_avm(echo_call_service(), peer_id_2).await; let script = format!( r#" @@ -605,13 +605,13 @@ fn test_extend_by_request_sent_by() { } #[tokio::test] -fn test_merge_request_sent_by() { +async fn test_merge_request_sent_by() { let peer_id_1 = "peer_1"; let peer_id_2 = "peer_2"; let other_peer_id = "A"; - let mut peer_vm_1 = create_avm(echo_call_service(), peer_id_1); - let mut peer_vm_2 = create_avm(echo_call_service(), peer_id_2); + let mut peer_vm_1 = create_avm(echo_call_service(), peer_id_1).await; + let mut peer_vm_2 = create_avm(echo_call_service(), peer_id_2).await; let script = format!( r#" @@ -640,14 +640,14 @@ fn test_merge_request_sent_by() { } #[tokio::test] -fn test_merge_executed() { +async fn test_merge_executed() { let peer_id_1 = "peer_1"; let peer_id_2 = "peer_2"; let other_peer_id = "A"; - let mut peer_vm_1 = create_avm(echo_call_service(), peer_id_1); - let mut peer_vm_2 = create_avm(echo_call_service(), peer_id_2); - let mut peer_other_id = create_avm(echo_call_service(), other_peer_id); + let mut peer_vm_1 = create_avm(echo_call_service(), peer_id_1).await; + let mut peer_vm_2 = create_avm(echo_call_service(), peer_id_2).await; + let mut peer_other_id = create_avm(echo_call_service(), other_peer_id).await; let script = format!( r#" @@ -695,7 +695,7 @@ fn test_merge_executed() { } #[tokio::test] -fn canon_stream_map() { +async fn canon_stream_map() { let vm_peer_id_1_name = "vm_peer_id_1"; let vm_peer_id_1_id = at(vm_peer_id_1_name); @@ -712,8 +712,9 @@ fn canon_stream_map() { ); let executor = AirScriptExecutor::from_annotated(TestRunParameters::from_init_peer_id(vm_peer_id_1_name), &script) + .await .expect("invalid test AIR script"); - let result = executor.execute_all(vm_peer_id_1_name).unwrap(); + let result = executor.execute_all(vm_peer_id_1_name).await.unwrap(); let actual_data = data_from_result(&result.last().unwrap()); @@ -748,7 +749,7 @@ fn canon_stream_map() { } #[tokio::test] -fn canon_map_single_index_tetraplet_check() { +async fn canon_map_single_index_tetraplet_check() { let vm_peer_id_1 = "vm_peer_id_1"; let arg_tetraplets = Rc::new(RefCell::new(vec![])); @@ -759,7 +760,7 @@ fn canon_map_single_index_tetraplet_check() { }); let (echo_call_service, tetraplet_checker) = tetraplet_host_function(echo_call_service); - let mut vm_1 = create_avm(echo_call_service, vm_peer_id_1); + let mut vm_1 = create_avm(echo_call_service, vm_peer_id_1).await; let script = format!( r#" @@ -839,7 +840,7 @@ fn canon_map_single_index_tetraplet_check() { } #[tokio::test] -fn canon_map_index_with_element_access_tetraplet_check() { +async fn canon_map_index_with_element_access_tetraplet_check() { let vm_peer_id_1 = "vm_peer_id_1"; let arg_tetraplets = Rc::new(RefCell::new(vec![])); @@ -850,7 +851,7 @@ fn canon_map_index_with_element_access_tetraplet_check() { }); let (echo_call_service, tetraplet_checker) = tetraplet_host_function(echo_call_service); - let mut vm_1 = create_avm(echo_call_service, vm_peer_id_1); + let mut vm_1 = create_avm(echo_call_service, vm_peer_id_1).await; let m1 = "m1"; let f1 = "f1"; @@ -937,7 +938,7 @@ fn canon_map_index_with_element_access_tetraplet_check() { } #[tokio::test] -fn canon_map_index_with_element_and_attribute_tetraplet_check() { +async fn canon_map_index_with_element_and_attribute_tetraplet_check() { let vm_peer_id_1 = "vm_peer_id_1"; let arg_tetraplets = Rc::new(RefCell::new(vec![])); @@ -948,7 +949,7 @@ fn canon_map_index_with_element_and_attribute_tetraplet_check() { }); let (echo_call_service, tetraplet_checker) = tetraplet_host_function(echo_call_service); - let mut vm_1 = create_avm(echo_call_service, vm_peer_id_1); + let mut vm_1 = create_avm(echo_call_service, vm_peer_id_1).await; let m1 = "m1"; let f1 = "f1"; @@ -1063,7 +1064,7 @@ fn canon_map_index_with_element_and_attribute_tetraplet_check() { } #[tokio::test] -fn canon_map_non_existing_index_tetraplet_check() { +async fn canon_map_non_existing_index_tetraplet_check() { let vm_peer_id_1 = "vm_peer_id_1"; let arg_tetraplets = Rc::new(RefCell::new(vec![])); @@ -1074,7 +1075,7 @@ fn canon_map_non_existing_index_tetraplet_check() { }); let (echo_call_service, tetraplet_checker) = tetraplet_host_function(echo_call_service); - let mut vm_1 = create_avm(echo_call_service, vm_peer_id_1); + let mut vm_1 = create_avm(echo_call_service, vm_peer_id_1).await; let script = format!( r#" @@ -1130,7 +1131,7 @@ fn canon_map_non_existing_index_tetraplet_check() { assert_eq!(tetraplet_checker.as_ref(), &expected_tetraplet); } #[tokio::test] -fn canon_map_non_existing_index_and_element_tetraplet_check() { +async fn canon_map_non_existing_index_and_element_tetraplet_check() { let vm_peer_id_1 = "vm_peer_id_1"; let arg_tetraplets = Rc::new(RefCell::new(vec![])); @@ -1141,7 +1142,7 @@ fn canon_map_non_existing_index_and_element_tetraplet_check() { }); let (echo_call_service, tetraplet_checker) = tetraplet_host_function(echo_call_service); - let mut vm_1 = create_avm(echo_call_service, vm_peer_id_1); + let mut vm_1 = create_avm(echo_call_service, vm_peer_id_1).await; let script = format!( r#" @@ -1221,7 +1222,7 @@ fn canon_map_non_existing_index_and_element_tetraplet_check() { assert_eq!(tetraplet_checker.as_ref(), &expected_tetraplet); } #[tokio::test] -fn canon_map_2_scalar_tetraplet_check() { +async fn canon_map_2_scalar_tetraplet_check() { let vm_peer_id_1 = "vm_peer_id_1"; let arg_tetraplets = Rc::new(RefCell::new(vec![])); @@ -1233,7 +1234,7 @@ fn canon_map_2_scalar_tetraplet_check() { }); let (call_service, tetraplet_checker) = tetraplet_host_function(call_service); - let mut vm_1 = create_avm(call_service, vm_peer_id_1); + let mut vm_1 = create_avm(call_service, vm_peer_id_1).await; let script = format!( r#" @@ -1297,7 +1298,7 @@ fn canon_map_2_scalar_tetraplet_check() { } #[tokio::test] -fn canon_map_2_scalar_with_lens_tetraplet_check() { +async fn canon_map_2_scalar_with_lens_tetraplet_check() { let vm_peer_id_1 = "vm_peer_id_1"; let arg_tetraplets = Rc::new(RefCell::new(vec![])); @@ -1309,7 +1310,7 @@ fn canon_map_2_scalar_with_lens_tetraplet_check() { }); let (call_service, tetraplet_checker) = tetraplet_host_function(call_service); - let mut vm_1 = create_avm(call_service, vm_peer_id_1); + let mut vm_1 = create_avm(call_service, vm_peer_id_1).await; let script = format!( r#" @@ -1372,7 +1373,7 @@ fn canon_map_2_scalar_with_lens_tetraplet_check() { } #[tokio::test] -fn canon_map_with_lens_by_key_number_tetraplet_check() { +async fn canon_map_with_lens_by_key_number_tetraplet_check() { let vm_peer_id_1 = "vm_peer_id_1"; let arg_tetraplets = Rc::new(RefCell::new(vec![])); @@ -1384,7 +1385,7 @@ fn canon_map_with_lens_by_key_number_tetraplet_check() { }); let (call_service, tetraplet_checker) = tetraplet_host_function(call_service); - let mut vm_1 = create_avm(call_service, vm_peer_id_1); + let mut vm_1 = create_avm(call_service, vm_peer_id_1).await; let script = format!( r#" @@ -1452,7 +1453,7 @@ fn canon_map_with_lens_by_key_number_tetraplet_check() { } #[tokio::test] -fn canon_map_with_lens_by_key_number_key_tetraplet_check() { +async fn canon_map_with_lens_by_key_number_key_tetraplet_check() { let vm_peer_id_1 = "vm_peer_id_1"; let arg_tetraplets = Rc::new(RefCell::new(vec![])); @@ -1464,7 +1465,7 @@ fn canon_map_with_lens_by_key_number_key_tetraplet_check() { }); let (call_service, tetraplet_checker) = tetraplet_host_function(call_service); - let mut vm_1 = create_avm(call_service, vm_peer_id_1); + let mut vm_1 = create_avm(call_service, vm_peer_id_1).await; let script = format!( r#" @@ -1532,7 +1533,7 @@ fn canon_map_with_lens_by_key_number_key_tetraplet_check() { } #[tokio::test] -fn canon_join_behavoir() { +async fn canon_join_behavoir() { let init_peer_name = "init_peer_id"; let script = r#" @@ -1548,14 +1549,15 @@ fn canon_join_behavoir() { "#; let executor = AirScriptExecutor::from_annotated(TestRunParameters::from_init_peer_id(init_peer_name), &script) + .await .expect("invalid test AIR script"); - let result = executor.execute_one(init_peer_name).unwrap(); + let result = executor.execute_one(init_peer_name).await.unwrap(); assert_eq!(result.ret_code, 0, "{:?}", result.error_message); } #[tokio::test] -fn canon_map_join_behavoir() { +async fn canon_map_join_behavoir() { let init_peer_name = "init_peer_id"; let script = r#" @@ -1571,14 +1573,15 @@ fn canon_map_join_behavoir() { "#; let executor = AirScriptExecutor::from_annotated(TestRunParameters::from_init_peer_id(init_peer_name), &script) + .await .expect("invalid test AIR script"); - let result = executor.execute_one(init_peer_name).unwrap(); + let result = executor.execute_one(init_peer_name).await.unwrap(); assert_eq!(result.ret_code, 0, "{:?}", result.error_message); } #[tokio::test] -fn canon_map_var_join_behavoir() { +async fn canon_map_var_join_behavoir() { let init_peer_name = "init_peer_id"; let script = r#" @@ -1594,8 +1597,9 @@ fn canon_map_var_join_behavoir() { "#; let executor = AirScriptExecutor::from_annotated(TestRunParameters::from_init_peer_id(init_peer_name), &script) + .await .expect("invalid test AIR script"); - let result = executor.execute_one(init_peer_name).unwrap(); + let result = executor.execute_one(init_peer_name).await.unwrap(); assert_eq!(result.ret_code, 0, "{:?}", result.error_message); } diff --git a/air/tests/test_module/instructions/fail.rs b/air/tests/test_module/instructions/fail.rs index 5ba174b990..e9a32ee38c 100644 --- a/air/tests/test_module/instructions/fail.rs +++ b/air/tests/test_module/instructions/fail.rs @@ -21,10 +21,10 @@ use air_test_framework::AirScriptExecutor; use air_test_utils::prelude::*; #[tokio::test] -fn fail_with_last_error() { +async fn fail_with_last_error() { let local_peer_id = "local_peer_id"; let fallible_service_id = "service_id_1"; - let mut vm = create_avm(fallible_call_service(fallible_service_id), local_peer_id); + let mut vm = create_avm(fallible_call_service(fallible_service_id), local_peer_id).await; let script = format!( r#" @@ -48,10 +48,10 @@ fn fail_with_last_error() { } #[tokio::test] -fn fail_with_error() { +async fn fail_with_error() { let local_peer_id = "local_peer_id"; let fallible_service_id = "service_id_1"; - let mut vm = create_avm(fallible_call_service(fallible_service_id), local_peer_id); + let mut vm = create_avm(fallible_call_service(fallible_service_id), local_peer_id).await; let script = format!( r#" @@ -69,9 +69,9 @@ fn fail_with_error() { } #[tokio::test] -fn fail_with_literals() { +async fn fail_with_literals() { let local_peer_id = "local_peer_id"; - let mut vm = create_avm(echo_call_service(), local_peer_id); + let mut vm = create_avm(echo_call_service(), local_peer_id).await; let script = r#" (xor @@ -94,11 +94,11 @@ fn fail_with_literals() { } #[tokio::test] -fn fail_with_last_error_tetraplets() { +async fn fail_with_last_error_tetraplets() { let local_peer_id = "local_peer_id"; let fallible_service_id = "service_id_1"; let (host_closure, tetraplet_anchor) = tetraplet_host_function(fallible_call_service(fallible_service_id)); - let mut vm = create_avm(host_closure, local_peer_id); + let mut vm = create_avm(host_closure, local_peer_id).await; let local_fn_name = "local_fn_name"; let script = format!( @@ -122,11 +122,11 @@ fn fail_with_last_error_tetraplets() { } #[tokio::test] -fn fail_with_error_tetraplets() { +async fn fail_with_error_tetraplets() { let local_peer_id = "local_peer_id"; let fallible_service_id = "service_id_1"; let (host_closure, tetraplet_anchor) = tetraplet_host_function(fallible_call_service(fallible_service_id)); - let mut vm = create_avm(host_closure, local_peer_id); + let mut vm = create_avm(host_closure, local_peer_id).await; let local_fn_name = "local_fn_name"; let script = format!( @@ -150,10 +150,10 @@ fn fail_with_error_tetraplets() { } #[tokio::test] -fn fail_with_literals_tetraplets() { +async fn fail_with_literals_tetraplets() { let local_peer_id = "local_peer_id"; let (host_closure, tetraplet_anchor) = tetraplet_host_function(echo_call_service()); - let mut vm = create_avm(host_closure, local_peer_id); + let mut vm = create_avm(host_closure, local_peer_id).await; let script = format!( r#" @@ -175,14 +175,14 @@ fn fail_with_literals_tetraplets() { } #[tokio::test] -fn fail_with_canon_stream() { +async fn fail_with_canon_stream() { let vm_peer_id = "local_peer_id"; let error_code = 1337i64; let error_message = "error message"; let mut vm = create_avm( set_variable_call_service(json!({"error_code": error_code, "message": error_message})), vm_peer_id, - ); + ).await; let script = format!( r#" @@ -207,13 +207,14 @@ fn fail_with_canon_stream() { assert!(check_error(&result, expected_error)); } -fn fail_to_fail_with_unsupported_errorcode(script: &str) { +async fn fail_to_fail_with_unsupported_errorcode(script: &str) { let local_peer_id = "local_peer_id"; let script = script.to_string(); let executor = AirScriptExecutor::from_annotated(TestRunParameters::from_init_peer_id(local_peer_id), &script) + .await .expect("invalid test AIR script"); - let results = executor.execute_all(local_peer_id).unwrap(); + let results = executor.execute_all(local_peer_id).await.unwrap(); let expected_error = ExecutionError::Catchable(rc!(CatchableError::InvalidErrorObjectError( ErrorObjectError::ErrorCodeMustBeNonZero @@ -222,7 +223,7 @@ fn fail_to_fail_with_unsupported_errorcode(script: &str) { } #[tokio::test] -fn fail_to_fail_with_unsupported_errorcode_in_scalar() { +async fn fail_to_fail_with_unsupported_errorcode_in_scalar() { let script = r#" (seq (call "local_peer_id" ("m" "f1") [] scalar) ; ok = {"error_code": 0, "message": "some message"} @@ -233,7 +234,7 @@ fn fail_to_fail_with_unsupported_errorcode_in_scalar() { } #[tokio::test] -fn fail_to_fail_with_unsupported_errorcode_in_scalar_wl() { +async fn fail_to_fail_with_unsupported_errorcode_in_scalar_wl() { let script = r#" (seq (call "local_peer_id" ("m" "f1") [] scalar) ; ok = {"key": {"error_code": 0, "message": "some message"} } @@ -244,7 +245,7 @@ fn fail_to_fail_with_unsupported_errorcode_in_scalar_wl() { } #[tokio::test] -fn fail_to_fail_with_unsupported_errorcode_in_canon() { +async fn fail_to_fail_with_unsupported_errorcode_in_canon() { let script = r#" (seq (call "local_peer_id" ("m" "f1") [] scalar) ; ok = [{"error_code": 0, "message": "some message"}] @@ -255,7 +256,7 @@ fn fail_to_fail_with_unsupported_errorcode_in_canon() { } #[tokio::test] -fn fail_to_fail_with_unsupported_errorcode_in_error() { +async fn fail_to_fail_with_unsupported_errorcode_in_error() { let script = r#" (fail :error:) "#; diff --git a/air/tests/test_module/instructions/fold.rs b/air/tests/test_module/instructions/fold.rs index 5d5116704c..29a1f970cc 100644 --- a/air/tests/test_module/instructions/fold.rs +++ b/air/tests/test_module/instructions/fold.rs @@ -27,12 +27,12 @@ use std::cell::RefCell; use std::rc::Rc; #[tokio::test] -fn lfold() { - let mut vm = create_avm(echo_call_service(), "A"); +async fn lfold() { + let mut vm = create_avm(echo_call_service(), "A").await; let mut set_variable_vm = create_avm( set_variable_call_service(json!(["1", "2", "3", "4", "5"])), "set_variable", - ); + ).await; let lfold = r#" (seq @@ -62,12 +62,12 @@ fn lfold() { } #[tokio::test] -fn rfold() { - let mut vm = create_avm(echo_call_service(), "A"); +async fn rfold() { + let mut vm = create_avm(echo_call_service(), "A").await; let mut set_variable_vm = create_avm( set_variable_call_service(json!(["1", "2", "3", "4", "5"])), "set_variable", - ); + ).await; let rfold = r#" (seq @@ -97,12 +97,12 @@ fn rfold() { } #[tokio::test] -fn inner_fold() { - let mut vm = create_avm(echo_call_service(), "A"); +async fn inner_fold() { + let mut vm = create_avm(echo_call_service(), "A").await; let mut set_variable_vm = create_avm( set_variable_call_service(json!(["1", "2", "3", "4", "5"])), "set_variable", - ); + ).await; let script = r#" (seq @@ -144,11 +144,11 @@ fn inner_fold() { } #[tokio::test] -fn inner_fold_with_same_iterator() { +async fn inner_fold_with_same_iterator() { let mut vm = create_avm( set_variable_call_service(json!(["1", "2", "3", "4", "5"])), "set_variable", - ); + ).await; let script = r#" (seq @@ -176,9 +176,9 @@ fn inner_fold_with_same_iterator() { } #[tokio::test] -fn empty_iterable_fold() { - let mut vm = create_avm(echo_call_service(), "A"); - let mut set_variable_vm = create_avm(set_variable_call_service(json!([])), "set_variable"); +async fn empty_iterable_fold() { + let mut vm = create_avm(echo_call_service(), "A").await; + let mut set_variable_vm = create_avm(set_variable_call_service(json!([])), "set_variable").await; let empty_fold = r#" (seq @@ -202,8 +202,8 @@ fn empty_iterable_fold() { } #[tokio::test] -fn empty_literal_array_fold() { - let mut vm = create_avm(echo_call_service(), "A"); +async fn empty_literal_array_fold() { + let mut vm = create_avm(echo_call_service(), "A").await; let empty_fold = r#" (fold [] i @@ -220,9 +220,9 @@ fn empty_literal_array_fold() { } #[tokio::test] -fn empty_fold_json_path() { - let mut vm = create_avm(echo_call_service(), "A"); - let mut set_variable_vm = create_avm(set_variable_call_service(json!({ "messages": [] })), "set_variable"); +async fn empty_fold_json_path() { + let mut vm = create_avm(echo_call_service(), "A").await; + let mut set_variable_vm = create_avm(set_variable_call_service(json!({ "messages": [] })), "set_variable").await; let empty_fold = r#" (seq @@ -246,9 +246,9 @@ fn empty_fold_json_path() { // Check that fold works with the join behaviour without hanging up. #[tokio::test] -fn fold_with_join() { - let mut vm = create_avm(echo_call_service(), "A"); - let mut set_variable_vm = create_avm(set_variable_call_service(json!(["1", "2"])), "set_variable"); +async fn fold_with_join() { + let mut vm = create_avm(echo_call_service(), "A").await; + let mut set_variable_vm = create_avm(set_variable_call_service(json!(["1", "2"])), "set_variable").await; let fold_with_join = r#" (seq @@ -272,12 +272,12 @@ fn fold_with_join() { } #[tokio::test] -fn lambda() { - let mut vm = create_avm(echo_call_service(), "A"); +async fn lambda() { + let mut vm = create_avm(echo_call_service(), "A").await; let mut set_variable_vm = create_avm( set_variable_call_service(json!({ "array": ["1","2","3","4","5"] })), "set_variable", - ); + ).await; let script = r#" (seq @@ -307,12 +307,12 @@ fn lambda() { } #[tokio::test] -fn shadowing() { +async fn shadowing() { use executed_state::*; - let mut set_variables_vm = create_avm(set_variable_call_service(json!(["1", "2"])), "set_variable"); - let mut vm_a = create_avm(echo_call_service(), "A"); - let mut vm_b = create_avm(echo_call_service(), "B"); + let mut set_variables_vm = create_avm(set_variable_call_service(json!(["1", "2"])), "set_variable").await; + let mut vm_a = create_avm(echo_call_service(), "A").await; + let mut vm_b = create_avm(echo_call_service(), "B").await; let script = r#" (seq @@ -370,13 +370,13 @@ fn shadowing() { } #[tokio::test] -fn shadowing_scope() { +async fn shadowing_scope() { use executed_state::*; - fn execute_script(script: String) -> Result { - let mut set_variables_vm = create_avm(set_variable_call_service(json!(["1", "2"])), "set_variable"); - let mut vm_a = create_avm(echo_call_service(), "A"); - let mut vm_b = create_avm(echo_call_service(), "B"); + async fn execute_script(script: String) -> Result { + let mut set_variables_vm = create_avm(set_variable_call_service(json!(["1", "2"])), "set_variable").await; + let mut vm_a = create_avm(echo_call_service(), "A").await; + let mut vm_b = create_avm(echo_call_service(), "B").await; let result = checked_call_vm!(set_variables_vm, <_>::default(), script.clone(), "", ""); let result = checked_call_vm!(vm_a, <_>::default(), script.clone(), "", result.data); @@ -384,7 +384,7 @@ fn shadowing_scope() { let result = checked_call_vm!(vm_a, <_>::default(), script.clone(), "", result.data); let result = checked_call_vm!(vm_b, <_>::default(), script.clone(), "", result.data); - vm_a.call(script, "", result.data, <_>::default()) + vm_a.call(script, "", result.data, <_>::default()).await } let variable_shadowing_script = r#" @@ -415,7 +415,7 @@ fn shadowing_scope() { ) )"#; - let result = execute_script(String::from(variable_shadowing_script)).unwrap(); + let result = execute_script(String::from(variable_shadowing_script)).await.unwrap(); let actual_trace = trace_from_result(&result); let expected_trace = ExecutionTrace::from(vec![ @@ -436,9 +436,9 @@ fn shadowing_scope() { } #[tokio::test] -fn fold_waits_on_empty_stream() { +async fn fold_waits_on_empty_stream() { let vm_peer_id = "vm_peer_id"; - let mut vm = create_avm(echo_call_service(), vm_peer_id); + let mut vm = create_avm(echo_call_service(), vm_peer_id).await; let script = format!( r#" @@ -459,9 +459,9 @@ fn fold_waits_on_empty_stream() { } #[tokio::test] -fn fold_stream_seq_next_never_completes() { +async fn fold_stream_seq_next_never_completes() { let vm_peer_id = "vm_peer_id"; - let mut vm = create_avm(set_variable_call_service(json!(1)), vm_peer_id); + let mut vm = create_avm(set_variable_call_service(json!(1)), vm_peer_id).await; let script = format!( r#" @@ -492,9 +492,9 @@ fn fold_stream_seq_next_never_completes() { } #[tokio::test] -fn fold_stream_seq_next_never_completes_with_never() { +async fn fold_stream_seq_next_never_completes_with_never() { let vm_peer_id = "vm_peer_id"; - let mut vm = create_avm(set_variable_call_service(json!(1)), vm_peer_id); + let mut vm = create_avm(set_variable_call_service(json!(1)), vm_peer_id).await; let script = format!( r#" @@ -530,9 +530,9 @@ fn fold_stream_seq_next_never_completes_with_never() { } #[tokio::test] -fn fold_stream_seq_next_completes_with_null() { +async fn fold_stream_seq_next_completes_with_null() { let vm_peer_id = "vm_peer_id"; - let mut vm = create_avm(set_variable_call_service(json!(1)), vm_peer_id); + let mut vm = create_avm(set_variable_call_service(json!(1)), vm_peer_id).await; let script = format!( r#" @@ -569,10 +569,10 @@ fn fold_stream_seq_next_completes_with_null() { } #[tokio::test] -fn fold_scalar_seq_next_completes_with_null() { +async fn fold_scalar_seq_next_completes_with_null() { let vm_peer_id = "vm_peer_id"; let service_result = json!([1, 2]); - let mut vm = create_avm(set_variable_call_service(service_result.clone()), vm_peer_id); + let mut vm = create_avm(set_variable_call_service(service_result.clone()), vm_peer_id).await; let script = format!( r#" @@ -613,10 +613,10 @@ fn fold_scalar_seq_next_completes_with_null() { } #[tokio::test] -fn fold_scalar_seq_next_not_completes_with_never() { +async fn fold_scalar_seq_next_not_completes_with_never() { let vm_peer_id = "vm_peer_id"; let service_result = json!([1, 2]); - let mut vm = create_avm(set_variable_call_service(service_result.clone()), vm_peer_id); + let mut vm = create_avm(set_variable_call_service(service_result.clone()), vm_peer_id).await; let script = format!( r#" @@ -653,9 +653,9 @@ fn fold_scalar_seq_next_not_completes_with_never() { } #[tokio::test] -fn fold_stream_seq_next_saves_call_result() { +async fn fold_stream_seq_next_saves_call_result() { let vm_peer_id = "vm_peer_id"; - let mut vm = create_avm(echo_call_service(), vm_peer_id); + let mut vm = create_avm(echo_call_service(), vm_peer_id).await; let script = format!( r#" @@ -697,18 +697,18 @@ fn fold_stream_seq_next_saves_call_result() { } #[tokio::test] -fn fold_par_next_completes() { +async fn fold_par_next_completes() { let vm_1_peer_id = "vm_1_peer_id"; - let mut vm_1 = create_avm(set_variable_call_service(json!(1)), vm_1_peer_id); + let mut vm_1 = create_avm(set_variable_call_service(json!(1)), vm_1_peer_id).await; let vm_2_peer_id = "vm_2_peer_id"; - let mut vm_2 = create_avm(set_variable_call_service(json!(1)), vm_2_peer_id); + let mut vm_2 = create_avm(set_variable_call_service(json!(1)), vm_2_peer_id).await; let vm_3_peer_id = "vm_3_peer_id"; - let mut vm_3 = create_avm(set_variable_call_service(json!(1)), vm_3_peer_id); + let mut vm_3 = create_avm(set_variable_call_service(json!(1)), vm_3_peer_id).await; let vm_4_peer_id = "vm_4_peer_id"; - let mut vm_4 = create_avm(set_variable_call_service(json!(1)), vm_4_peer_id); + let mut vm_4 = create_avm(set_variable_call_service(json!(1)), vm_4_peer_id).await; let script = format!( r#" @@ -796,7 +796,7 @@ fn fold_par_next_completes() { } #[tokio::test] -fn fold_stream_map() { +async fn fold_stream_map() { let vm_1_peer_id = "vm_1_peer_id"; let k1 = 42; let k2 = "some"; @@ -808,7 +808,7 @@ fn fold_stream_map() { CallServiceResult::ok(json!({"keyo": k1, "keyu": k2})) }); - let mut vm_1 = create_avm(set_variable_call_service, vm_1_peer_id); + let mut vm_1 = create_avm(set_variable_call_service, vm_1_peer_id).await; let script = format!( r#" @@ -936,7 +936,7 @@ fn fold_stream_map() { } #[tokio::test] -fn fold_canon_stream_map() { +async fn fold_canon_stream_map() { let vm_1_peer_name = "vm_1_peer_id"; let vm_1_peer_id = at(vm_1_peer_name); @@ -961,8 +961,9 @@ fn fold_canon_stream_map() { ); let executor = AirScriptExecutor::from_annotated(TestRunParameters::from_init_peer_id(vm_1_peer_name), &script) + .await .expect("invalid test AIR script"); - let result = executor.execute_all(vm_1_peer_name).unwrap(); + let result = executor.execute_all(vm_1_peer_name).await.unwrap(); let actual_trace = trace_from_result(&result.last().unwrap()); @@ -1017,7 +1018,7 @@ fn fold_canon_stream_map() { /// the folds mentioned differ in their tetraplets b/c testing framework /// increments service name index for each call used. #[tokio::test] -fn fold_map_and_canon_map_orders_are_same() { +async fn fold_map_and_canon_map_orders_are_same() { let vm_1_peer_name = "vm_1_peer_id"; let vm_1_peer_id = at(vm_1_peer_name); @@ -1056,8 +1057,9 @@ fn fold_map_and_canon_map_orders_are_same() { ); let executor = AirScriptExecutor::from_annotated(TestRunParameters::from_init_peer_id(vm_1_peer_name), &script) + .await .expect("invalid test AIR script"); - let result = executor.execute_all(vm_1_peer_name).unwrap(); + let result = executor.execute_all(vm_1_peer_name).await.unwrap(); let actual_trace = trace_from_result(&result.last().unwrap()); diff --git a/air/tests/test_module/instructions/match_.rs b/air/tests/test_module/instructions/match_.rs index 42d1dfe7fb..a0b4b1c61d 100644 --- a/air/tests/test_module/instructions/match_.rs +++ b/air/tests/test_module/instructions/match_.rs @@ -23,12 +23,12 @@ use air_test_framework::AirScriptExecutor; use air_test_utils::prelude::*; #[tokio::test] -fn match_equal() { +async fn match_equal() { let set_variable_peer_id = "set_variable_peer_id"; - let mut set_variable_vm = create_avm(echo_call_service(), set_variable_peer_id); + let mut set_variable_vm = create_avm(echo_call_service(), set_variable_peer_id).await; let local_peer_id = "local_peer_id"; - let mut vm = create_avm(echo_call_service(), local_peer_id); + let mut vm = create_avm(echo_call_service(), local_peer_id).await; let script = format!( r#" @@ -63,12 +63,12 @@ fn match_equal() { } #[tokio::test] -fn match_not_equal() { +async fn match_not_equal() { let set_variable_peer_id = "set_variable_peer_id"; - let mut set_variable_vm = create_avm(echo_call_service(), set_variable_peer_id); + let mut set_variable_vm = create_avm(echo_call_service(), set_variable_peer_id).await; let local_peer_id = "local_peer_id"; - let mut vm = create_avm(echo_call_service(), local_peer_id); + let mut vm = create_avm(echo_call_service(), local_peer_id).await; let script = format!( r#" @@ -103,12 +103,12 @@ fn match_not_equal() { } #[tokio::test] -fn match_with_string() { +async fn match_with_string() { let set_variable_peer_id = "set_variable_peer_id"; - let mut set_variable_vm = create_avm(echo_call_service(), set_variable_peer_id); + let mut set_variable_vm = create_avm(echo_call_service(), set_variable_peer_id).await; let local_peer_id = "local_peer_id"; - let mut vm = create_avm(echo_call_service(), local_peer_id); + let mut vm = create_avm(echo_call_service(), local_peer_id).await; let script = format!( r#" @@ -140,12 +140,12 @@ fn match_with_string() { } #[tokio::test] -fn match_with_init_peer_id() { +async fn match_with_init_peer_id() { let set_variable_peer_id = "set_variable_peer_id"; - let mut set_variable_vm = create_avm(echo_call_service(), set_variable_peer_id); + let mut set_variable_vm = create_avm(echo_call_service(), set_variable_peer_id).await; let local_peer_id = "local_peer_id"; - let mut vm = create_avm(echo_call_service(), local_peer_id); + let mut vm = create_avm(echo_call_service(), local_peer_id).await; let script = format!( r#" @@ -178,12 +178,12 @@ fn match_with_init_peer_id() { } #[tokio::test] -fn match_with_timestamp() { +async fn match_with_timestamp() { let set_variable_peer_id = "set_variable_peer_id"; - let mut set_variable_vm = create_avm(echo_call_service(), set_variable_peer_id); + let mut set_variable_vm = create_avm(echo_call_service(), set_variable_peer_id).await; let local_peer_id = "local_peer_id"; - let mut vm = create_avm(echo_call_service(), local_peer_id); + let mut vm = create_avm(echo_call_service(), local_peer_id).await; let timestamp = 1337; let script = format!( @@ -217,12 +217,12 @@ fn match_with_timestamp() { } #[tokio::test] -fn match_with_ttl() { +async fn match_with_ttl() { let set_variable_peer_id = "set_variable_peer_id"; - let mut set_variable_vm = create_avm(echo_call_service(), set_variable_peer_id); + let mut set_variable_vm = create_avm(echo_call_service(), set_variable_peer_id).await; let local_peer_id = "local_peer_id"; - let mut vm = create_avm(echo_call_service(), local_peer_id); + let mut vm = create_avm(echo_call_service(), local_peer_id).await; let ttl = 1337; let script = format!( @@ -256,9 +256,9 @@ fn match_with_ttl() { } #[tokio::test] -fn match_with_equal_numbers() { +async fn match_with_equal_numbers() { let local_peer_id = "local_peer_id"; - let mut vm = create_avm(echo_call_service(), local_peer_id); + let mut vm = create_avm(echo_call_service(), local_peer_id).await; let script = " (xor @@ -274,12 +274,12 @@ fn match_with_equal_numbers() { } #[tokio::test] -fn match_without_xor() { +async fn match_without_xor() { let set_variable_peer_id = "set_variable_peer_id"; - let mut set_variable_vm = create_avm(echo_call_service(), set_variable_peer_id); + let mut set_variable_vm = create_avm(echo_call_service(), set_variable_peer_id).await; let local_peer_id = "local_peer_id"; - let mut vm = create_avm(echo_call_service(), local_peer_id); + let mut vm = create_avm(echo_call_service(), local_peer_id).await; let script = format!( r#" @@ -308,9 +308,9 @@ fn match_without_xor() { } #[tokio::test] -fn match_with_two_xors() { +async fn match_with_two_xors() { let local_peer_id = "local_peer_id"; - let mut vm = create_avm(set_variable_call_service(serde_json::json!(false)), local_peer_id); + let mut vm = create_avm(set_variable_call_service(serde_json::json!(false)), local_peer_id).await; let local_peer_id_2 = "local_peer_id_2"; @@ -344,15 +344,15 @@ fn match_with_two_xors() { // https://github.com/fluencelabs/aquavm/issues/165 #[tokio::test] -fn issue_165() { +async fn issue_165() { let result_setter_peer_id = "result_setter_peer_id"; let mut result_setter = create_avm( set_variable_call_service(serde_json::json!({"success": true})), result_setter_peer_id, - ); + ).await; let echo_peer_id = "echo_peer_id"; - let mut echo_peer = create_avm(echo_call_service(), echo_peer_id); + let mut echo_peer = create_avm(echo_call_service(), echo_peer_id).await; let script = format!( r#" @@ -391,7 +391,7 @@ fn issue_165() { } #[tokio::test] -fn match_with_undefined_last_error_errcode() { +async fn match_with_undefined_last_error_errcode() { let local_peer_id = "local_peer_id"; let script = format!( r#" @@ -403,8 +403,9 @@ fn match_with_undefined_last_error_errcode() { ); let executor = AirScriptExecutor::from_annotated(TestRunParameters::from_init_peer_id(local_peer_id), &script) + .await .expect("invalid test AIR script"); - let result = executor.execute_all(local_peer_id).unwrap(); + let result = executor.execute_all(local_peer_id).await.unwrap(); let actual_trace = trace_from_result(&result.last().unwrap()); let mut cid_state = ExecutionCidState::new(); @@ -422,7 +423,7 @@ fn match_with_undefined_last_error_errcode() { } #[tokio::test] -fn match_with_undefined_last_error_message() { +async fn match_with_undefined_last_error_message() { let local_peer_id = "local_peer_id"; let script = format!( r#" @@ -434,8 +435,9 @@ fn match_with_undefined_last_error_message() { ); let executor = AirScriptExecutor::from_annotated(TestRunParameters::from_init_peer_id(local_peer_id), &script) + .await .expect("invalid test AIR script"); - let result = executor.execute_all(local_peer_id).unwrap(); + let result = executor.execute_all(local_peer_id).await.unwrap(); let actual_trace = trace_from_result(&result.last().unwrap()); let mut cid_state = ExecutionCidState::new(); @@ -453,9 +455,9 @@ fn match_with_undefined_last_error_message() { } #[tokio::test] -fn match_with_error() { +async fn match_with_error() { let local_peer_id = "local_peer_id"; - let mut vm = create_avm(echo_call_service(), local_peer_id); + let mut vm = create_avm(echo_call_service(), local_peer_id).await; let script = format!( r#" diff --git a/air/tests/test_module/instructions/mismatch.rs b/air/tests/test_module/instructions/mismatch.rs index 90ff826d47..dc314eea5f 100644 --- a/air/tests/test_module/instructions/mismatch.rs +++ b/air/tests/test_module/instructions/mismatch.rs @@ -19,12 +19,12 @@ use air::ToErrorCode; use air_test_utils::prelude::*; #[tokio::test] -fn mismatch_equal() { +async fn mismatch_equal() { let set_variable_peer_id = "set_variable_peer_id"; - let mut set_variable_vm = create_avm(echo_call_service(), set_variable_peer_id); + let mut set_variable_vm = create_avm(echo_call_service(), set_variable_peer_id).await; let local_peer_id = "local_peer_id"; - let mut vm = create_avm(echo_call_service(), local_peer_id); + let mut vm = create_avm(echo_call_service(), local_peer_id).await; let script = format!( r#" @@ -59,12 +59,12 @@ fn mismatch_equal() { } #[tokio::test] -fn mismatch_not_equal() { +async fn mismatch_not_equal() { let set_variable_peer_id = "set_variable_peer_id"; - let mut set_variable_vm = create_avm(echo_call_service(), set_variable_peer_id); + let mut set_variable_vm = create_avm(echo_call_service(), set_variable_peer_id).await; let local_peer_id = "local_peer_id"; - let mut vm = create_avm(echo_call_service(), local_peer_id); + let mut vm = create_avm(echo_call_service(), local_peer_id).await; let script = format!( r#" @@ -99,12 +99,12 @@ fn mismatch_not_equal() { } #[tokio::test] -fn mismatch_with_string() { +async fn mismatch_with_string() { let set_variable_peer_id = "set_variable_peer_id"; - let mut set_variable_vm = create_avm(echo_call_service(), set_variable_peer_id); + let mut set_variable_vm = create_avm(echo_call_service(), set_variable_peer_id).await; let local_peer_id = "local_peer_id"; - let mut vm = create_avm(echo_call_service(), local_peer_id); + let mut vm = create_avm(echo_call_service(), local_peer_id).await; let script = format!( r#" @@ -136,12 +136,12 @@ fn mismatch_with_string() { } #[tokio::test] -fn mismatch_without_xor() { +async fn mismatch_without_xor() { let set_variable_peer_id = "set_variable_peer_id"; - let mut set_variable_vm = create_avm(echo_call_service(), set_variable_peer_id); + let mut set_variable_vm = create_avm(echo_call_service(), set_variable_peer_id).await; let local_peer_id = "local_peer_id"; - let mut vm = create_avm(echo_call_service(), local_peer_id); + let mut vm = create_avm(echo_call_service(), local_peer_id).await; let script = format!( r#" @@ -170,9 +170,9 @@ fn mismatch_without_xor() { } #[tokio::test] -fn mismatch_with_two_xors() { +async fn mismatch_with_two_xors() { let local_peer_id = "local_peer_id"; - let mut vm = create_avm(set_variable_call_service(serde_json::json!(false)), local_peer_id); + let mut vm = create_avm(set_variable_call_service(serde_json::json!(false)), local_peer_id).await; let local_peer_id_2 = "local_peer_id_2"; @@ -205,11 +205,11 @@ fn mismatch_with_two_xors() { } #[tokio::test] -fn mismatch_with_error() { +async fn mismatch_with_error() { use air::ExecutionCidState; let local_peer_id = "local_peer_id"; - let mut vm = create_avm(echo_call_service(), local_peer_id); + let mut vm = create_avm(echo_call_service(), local_peer_id).await; let script = format!( r#" diff --git a/air/tests/test_module/instructions/never.rs b/air/tests/test_module/instructions/never.rs index 9819f73e1d..ec75e8516d 100644 --- a/air/tests/test_module/instructions/never.rs +++ b/air/tests/test_module/instructions/never.rs @@ -17,9 +17,9 @@ use air_test_utils::prelude::*; #[tokio::test] -fn never_not_complete_subgraph() { +async fn never_not_complete_subgraph() { let vm_peer_id = "test_peer_id"; - let mut vm = create_avm(unit_call_service(), vm_peer_id); + let mut vm = create_avm(unit_call_service(), vm_peer_id).await; let script = format!( r#" diff --git a/air/tests/test_module/instructions/new.rs b/air/tests/test_module/instructions/new.rs index b4f225a083..0e6543b2bc 100644 --- a/air/tests/test_module/instructions/new.rs +++ b/air/tests/test_module/instructions/new.rs @@ -21,13 +21,13 @@ use pretty_assertions::assert_eq; #[tokio::test] #[ignore] -fn new_with_global_streams_seq() { +async fn new_with_global_streams_seq() { let set_variable_peer_id = "set_variable_peer_id"; let local_vm_peer_id_1 = "local_vm_peer_id_1"; let local_vm_peer_id_2 = "local_vm_peer_id_2"; - let mut local_vm_1 = create_avm(echo_call_service(), local_vm_peer_id_1); - let mut local_vm_2 = create_avm(echo_call_service(), local_vm_peer_id_2); + let mut local_vm_1 = create_avm(echo_call_service(), local_vm_peer_id_1).await; + let mut local_vm_2 = create_avm(echo_call_service(), local_vm_peer_id_2).await; let variables_mapping = maplit::hashmap! { "1".to_string() => json!(1), @@ -36,7 +36,7 @@ fn new_with_global_streams_seq() { let mut set_variable_vm = create_avm( set_variables_call_service(variables_mapping, VariableOptionSource::Argument(0)), set_variable_peer_id, - ); + ).await; let script = format!( r#" @@ -94,9 +94,9 @@ fn new_with_global_streams_seq() { } #[tokio::test] -fn several_restrictions() { +async fn several_restrictions() { let vm_peer_id = "vm_peer_id"; - let mut vm = create_avm(echo_call_service(), vm_peer_id); + let mut vm = create_avm(echo_call_service(), vm_peer_id).await; let script = format!( r#" @@ -130,9 +130,9 @@ fn several_restrictions() { } #[tokio::test] -fn check_influence_to_not_restricted() { +async fn check_influence_to_not_restricted() { let vm_peer_id = "vm_peer_id"; - let mut vm = create_avm(echo_call_service(), vm_peer_id); + let mut vm = create_avm(echo_call_service(), vm_peer_id).await; let script = format!( r#" @@ -261,12 +261,12 @@ fn check_influence_to_not_restricted() { } #[tokio::test] -fn new_in_fold_with_ap() { +async fn new_in_fold_with_ap() { let set_variable_peer_id = "set_variable_peer_id"; let vm_peer_id = "vm_peer_id"; - let mut set_variable_vm = create_avm(set_variable_call_service(json!([1, 2, 3, 4, 5])), set_variable_peer_id); - let mut vm = create_avm(echo_call_service(), vm_peer_id); + let mut set_variable_vm = create_avm(set_variable_call_service(json!([1, 2, 3, 4, 5])), set_variable_peer_id).await; + let mut vm = create_avm(echo_call_service(), vm_peer_id).await; let script = format!( r#" @@ -361,12 +361,12 @@ fn new_in_fold_with_ap() { } #[tokio::test] -fn new_with_streams_with_errors() { +async fn new_with_streams_with_errors() { let fallible_peer_id = "fallible_peer_id"; - let mut fallible_vm = create_avm(fallible_call_service("service_id_1"), fallible_peer_id); + let mut fallible_vm = create_avm(fallible_call_service("service_id_1"), fallible_peer_id).await; let local_peer_id = "local_peer_id"; - let mut vm = create_avm(echo_call_service(), local_peer_id); + let mut vm = create_avm(echo_call_service(), local_peer_id).await; let script = format!( r#" @@ -405,7 +405,7 @@ fn new_with_streams_with_errors() { } #[tokio::test] -fn new_with_scalars_with_errors() { +async fn new_with_scalars_with_errors() { let set_variable_peer_id = "set_variable_peer_id"; let variables_mapping = maplit::hashmap! { "global".to_string() => json!(1), @@ -414,14 +414,14 @@ fn new_with_scalars_with_errors() { let mut set_variable_vm = create_avm( set_variables_call_service(variables_mapping, VariableOptionSource::Argument(0)), set_variable_peer_id, - ); + ).await; let variable_receiver_peer_id = "variable_receiver_peer_id"; - let mut variable_receiver_vm = create_avm(echo_call_service(), variable_receiver_peer_id); + let mut variable_receiver_vm = create_avm(echo_call_service(), variable_receiver_peer_id).await; let fallible_peer_id = "fallible_peer_id"; let fallible_service_id = "fallible_service_id"; - let mut fallible_peer_vm = create_avm(fallible_call_service(fallible_service_id), fallible_peer_id); + let mut fallible_peer_vm = create_avm(fallible_call_service(fallible_service_id), fallible_peer_id).await; let script = format!( r#" @@ -464,7 +464,7 @@ fn new_with_scalars_with_errors() { } #[tokio::test] -fn new_with_global_scalars() { +async fn new_with_global_scalars() { let set_variable_peer_id = "set_variable_peer_id"; let variables_mapping = maplit::hashmap! { "global".to_string() => json!(1), @@ -473,10 +473,10 @@ fn new_with_global_scalars() { let mut set_variable_vm = create_avm( set_variables_call_service(variables_mapping, VariableOptionSource::Argument(0)), set_variable_peer_id, - ); + ).await; let variable_receiver_peer_id = "variable_receiver_peer_id"; - let mut variable_receiver = create_avm(echo_call_service(), variable_receiver_peer_id); + let mut variable_receiver = create_avm(echo_call_service(), variable_receiver_peer_id).await; let script = format!( r#" @@ -544,11 +544,11 @@ fn prepare_new_test_call_service() -> CallServiceClosure { } #[tokio::test] -fn new_with_scalars_in_lfold_with_outside_next() { +async fn new_with_scalars_in_lfold_with_outside_next() { let test_peer_id = "test_peer_id"; let test_call_service = prepare_new_test_call_service(); - let mut test_vm = create_avm(test_call_service, test_peer_id); + let mut test_vm = create_avm(test_call_service, test_peer_id).await; let script = format!( r#" @@ -603,11 +603,11 @@ fn new_with_scalars_in_lfold_with_outside_next() { } #[tokio::test] -fn new_with_scalars_in_rfold_with_outside_next() { +async fn new_with_scalars_in_rfold_with_outside_next() { let test_peer_id = "test_peer_id"; let test_call_service = prepare_new_test_call_service(); - let mut test_vm = create_avm(test_call_service, test_peer_id); + let mut test_vm = create_avm(test_call_service, test_peer_id).await; let script = format!( r#" @@ -662,11 +662,11 @@ fn new_with_scalars_in_rfold_with_outside_next() { } #[tokio::test] -fn new_with_scalars_in_fold_with_inside_next() { +async fn new_with_scalars_in_fold_with_inside_next() { let test_peer_id = "test_peer_id"; let test_call_service = prepare_new_test_call_service(); - let mut test_vm = create_avm(test_call_service, test_peer_id); + let mut test_vm = create_avm(test_call_service, test_peer_id).await; let script = format!( r#" diff --git a/air/tests/test_module/instructions/par.rs b/air/tests/test_module/instructions/par.rs index a1175b50fc..d856de7fef 100644 --- a/air/tests/test_module/instructions/par.rs +++ b/air/tests/test_module/instructions/par.rs @@ -17,10 +17,10 @@ use air_test_utils::prelude::*; #[tokio::test] -fn par_remote_remote() { +async fn par_remote_remote() { use std::collections::HashSet; - let mut vm = create_avm(unit_call_service(), ""); + let mut vm = create_avm(unit_call_service(), "").await; let script = r#" (par @@ -38,9 +38,9 @@ fn par_remote_remote() { } #[tokio::test] -fn par_local_remote() { +async fn par_local_remote() { let local_peer_id = "local_peer_id"; - let mut vm = create_avm(unit_call_service(), local_peer_id); + let mut vm = create_avm(unit_call_service(), local_peer_id).await; let script = format!( r#" diff --git a/air/tests/test_module/instructions/seq.rs b/air/tests/test_module/instructions/seq.rs index e07c668a86..c99f9bbcc6 100644 --- a/air/tests/test_module/instructions/seq.rs +++ b/air/tests/test_module/instructions/seq.rs @@ -18,8 +18,8 @@ use air::ExecutionCidState; use air_test_utils::prelude::*; #[tokio::test] -fn seq_remote_remote() { - let mut vm = create_avm(unit_call_service(), ""); +async fn seq_remote_remote() { + let mut vm = create_avm(unit_call_service(), "").await; let mut cid_state = ExecutionCidState::new(); let script = r#" @@ -46,10 +46,10 @@ fn seq_remote_remote() { } #[tokio::test] -fn seq_local_remote() { +async fn seq_local_remote() { let local_peer_id = "local_peer_id"; let remote_peer_id = String::from("remote_peer_id"); - let mut vm = create_avm(unit_call_service(), local_peer_id); + let mut vm = create_avm(unit_call_service(), local_peer_id).await; let script = format!( r#" diff --git a/air/tests/test_module/instructions/xor.rs b/air/tests/test_module/instructions/xor.rs index c9f84beae6..27da30b4a8 100644 --- a/air/tests/test_module/instructions/xor.rs +++ b/air/tests/test_module/instructions/xor.rs @@ -18,10 +18,10 @@ use air::UncatchableError; use air_test_utils::prelude::*; #[tokio::test] -fn xor() { +async fn xor() { let local_peer_id = "local_peer_id"; let fallible_service_id = "service_id_1"; - let mut vm = create_avm(fallible_call_service(fallible_service_id), local_peer_id); + let mut vm = create_avm(fallible_call_service(fallible_service_id), local_peer_id).await; let script = format!( r#" @@ -70,9 +70,9 @@ fn xor() { } #[tokio::test] -fn xor_var_not_found() { +async fn xor_var_not_found() { let local_peer_id = "local_peer_id"; - let mut vm = create_avm(echo_call_service(), local_peer_id); + let mut vm = create_avm(echo_call_service(), local_peer_id).await; let script = format!( r#" @@ -93,9 +93,9 @@ fn xor_var_not_found() { } #[tokio::test] -fn xor_multiple_variables_found() { +async fn xor_multiple_variables_found() { let set_variables_peer_id = "set_variables_peer_id"; - let mut set_variables_vm = create_avm(echo_call_service(), set_variables_peer_id); + let mut set_variables_vm = create_avm(echo_call_service(), set_variables_peer_id).await; let local_peer_id = "local_peer_id"; let some_string = "some_string"; @@ -119,12 +119,12 @@ fn xor_multiple_variables_found() { } #[tokio::test] -fn xor_par() { +async fn xor_par() { use executed_state::*; let fallible_service_id = String::from("service_id_1"); let local_peer_id = "local_peer_id"; - let mut vm = create_avm(fallible_call_service(fallible_service_id), local_peer_id); + let mut vm = create_avm(fallible_call_service(fallible_service_id), local_peer_id).await; let script = format!( r#" @@ -206,11 +206,11 @@ fn xor_par() { } #[tokio::test] -fn last_error_with_xor() { +async fn last_error_with_xor() { let faillible_peer_id = "failible_peer_id"; - let mut faillible_vm = create_avm(fallible_call_service("service_id_1"), faillible_peer_id); + let mut faillible_vm = create_avm(fallible_call_service("service_id_1"), faillible_peer_id).await; let local_peer_id = "local_peer_id"; - let mut vm = create_avm(echo_call_service(), local_peer_id); + let mut vm = create_avm(echo_call_service(), local_peer_id).await; let script = format!( r#" @@ -237,11 +237,11 @@ fn last_error_with_xor() { } #[tokio::test] -fn error_with_xor() { +async fn error_with_xor() { let faillible_peer_id = "failible_peer_id"; - let mut faillible_vm = create_avm(fallible_call_service("service_id_1"), faillible_peer_id); + let mut faillible_vm = create_avm(fallible_call_service("service_id_1"), faillible_peer_id).await; let local_peer_id = "local_peer_id"; - let mut vm = create_avm(echo_call_service(), local_peer_id); + let mut vm = create_avm(echo_call_service(), local_peer_id).await; let script = format!( r#" diff --git a/air/tests/test_module/integration/chat_join.rs b/air/tests/test_module/integration/chat_join.rs index 185e48cc54..1987500db6 100644 --- a/air/tests/test_module/integration/chat_join.rs +++ b/air/tests/test_module/integration/chat_join.rs @@ -20,26 +20,26 @@ use air_test_utils::prelude::*; use pretty_assertions::assert_eq; #[tokio::test] -fn join_chat_1() { +async fn join_chat_1() { use std::collections::HashSet; let relay_1_peer_id = "relay_1_peer_id"; - let mut relay_1 = create_avm(unit_call_service(), relay_1_peer_id); + let mut relay_1 = create_avm(unit_call_service(), relay_1_peer_id).await; let relay_2_peer_id = "relay_2_peer_id"; - let mut relay_2 = create_avm(unit_call_service(), relay_2_peer_id); + let mut relay_2 = create_avm(unit_call_service(), relay_2_peer_id).await; let client_1_peer_id = "client_1_peer_id"; - let mut client_1 = create_avm(unit_call_service(), client_1_peer_id); + let mut client_1 = create_avm(unit_call_service(), client_1_peer_id).await; let client_2_peer_id = "client_2_peer_id"; - let mut client_2 = create_avm(unit_call_service(), client_2_peer_id); + let mut client_2 = create_avm(unit_call_service(), client_2_peer_id).await; let remote_peer_id = "remote_peer_id"; let members = json!([[client_1_peer_id, relay_1_peer_id], [client_2_peer_id, relay_2_peer_id]]); let members_call_service: CallServiceClosure = Box::new(move |_| -> CallServiceResult { CallServiceResult::ok(members.clone()) }); - let mut remote = create_avm(members_call_service, remote_peer_id); + let mut remote = create_avm(members_call_service, remote_peer_id).await; let script = format!( r#" @@ -296,18 +296,18 @@ fn join_chat_1() { } #[tokio::test] -fn join_chat_2() { +async fn join_chat_2() { let members_call_service1: CallServiceClosure = Box::new(|_| -> CallServiceResult { CallServiceResult::ok(json!([["A"], ["B"]])) }); let relay_1_peer_id = "relay_1_peer_id"; - let mut relay_1 = create_avm(unit_call_service(), relay_1_peer_id); + let mut relay_1 = create_avm(unit_call_service(), relay_1_peer_id).await; let remote_peer_id = "remove_peer_id"; - let mut remote = create_avm(members_call_service1, remote_peer_id); + let mut remote = create_avm(members_call_service1, remote_peer_id).await; let client_peer_id = "client_peer_id"; - let mut client_1 = create_avm(unit_call_service(), client_peer_id); + let mut client_1 = create_avm(unit_call_service(), client_peer_id).await; let script = format!( r#" @@ -387,21 +387,21 @@ fn join_chat_2() { } #[tokio::test] -fn init_peer_id() { +async fn init_peer_id() { let relay_1_peer_id = "relay_1_peer_id"; - let mut relay_1 = create_avm(unit_call_service(), relay_1_peer_id); + let mut relay_1 = create_avm(unit_call_service(), relay_1_peer_id).await; let client_1_peer_id = "client_1_peer_id"; - let mut client_1 = create_avm(unit_call_service(), client_1_peer_id); + let mut client_1 = create_avm(unit_call_service(), client_1_peer_id).await; let initiator_peer_id = "initiator_peer_id"; - let mut initiator = create_avm(unit_call_service(), initiator_peer_id); + let mut initiator = create_avm(unit_call_service(), initiator_peer_id).await; let remote_peer_id = "remote_peer_id"; let members = json!([[client_1_peer_id], ["B"]]); let members_call_service: CallServiceClosure = Box::new(move |_| -> CallServiceResult { CallServiceResult::ok(members.clone()) }); - let mut remote = create_avm(members_call_service, remote_peer_id); + let mut remote = create_avm(members_call_service, remote_peer_id).await; let script = format!( r#"(seq diff --git a/air/tests/test_module/integration/create_service.rs b/air/tests/test_module/integration/create_service.rs index 32a0a056f7..c6a7b1485e 100644 --- a/air/tests/test_module/integration/create_service.rs +++ b/air/tests/test_module/integration/create_service.rs @@ -17,7 +17,7 @@ use air_test_utils::prelude::*; #[tokio::test] -fn create_service() { +async fn create_service() { let module = "greeting"; let module_config = json!( { @@ -44,7 +44,7 @@ fn create_service() { let mut set_variables_vm = create_avm( set_variables_call_service(variables_mapping, VariableOptionSource::Argument(0)), "set_variables", - ); + ).await; let add_module_response = "add_module response"; let add_blueprint_response = "add_blueprint response"; @@ -61,7 +61,7 @@ fn create_service() { CallServiceResult::ok(json!(response)) }); - let mut vm = create_avm(call_service, "A"); + let mut vm = create_avm(call_service, "A").await; let script = include_str!("./scripts/create_service.air"); diff --git a/air/tests/test_module/integration/dashboard.rs b/air/tests/test_module/integration/dashboard.rs index c6b7c420b2..fb60dd92a9 100644 --- a/air/tests/test_module/integration/dashboard.rs +++ b/air/tests/test_module/integration/dashboard.rs @@ -16,6 +16,8 @@ use air_test_utils::prelude::*; +use futures::StreamExt; + use std::cell::RefCell; use std::collections::HashSet; use std::rc::Rc; @@ -145,7 +147,7 @@ struct AVMState { } #[tokio::test] -fn dashboard() { +async fn dashboard() { let script = include_str!("./scripts/dashboard.air"); let known_peer_ids = parse_peers(); @@ -154,27 +156,27 @@ fn dashboard() { let (host_function, all_info) = client_host_function(known_peer_ids.clone(), client_id.clone(), relay_id.clone()); - let mut client = create_avm(host_function, client_id.clone()); + let mut client = create_avm(host_function, client_id.clone()).await; let mut relay = create_avm( create_peer_host_function(relay_id.clone(), known_peer_ids.clone()), relay_id.clone(), - ); + ).await; - let mut known_peers = known_peer_ids - .iter() - .cloned() - .map(|peer_id| { + let mut known_peers = + futures::stream::iter(known_peer_ids.iter().cloned()) + .then(|peer_id| async { let vm = create_avm( create_peer_host_function(peer_id.clone(), known_peer_ids.clone()), peer_id.clone(), - ); + ).await; AVMState { vm, peer_id, prev_result: vec![], } }) - .collect::>(); + .collect::>() + .await; let test_params = TestRunParameters::from_init_peer_id(client_id.clone()); diff --git a/air/tests/test_module/integration/network_explore.rs b/air/tests/test_module/integration/network_explore.rs index 2243901276..ba4c2126c7 100644 --- a/air/tests/test_module/integration/network_explore.rs +++ b/air/tests/test_module/integration/network_explore.rs @@ -19,7 +19,7 @@ use air_test_utils::prelude::*; #[tokio::test] // TODO: adjust test #[ignore] -fn network_explore() { +async fn network_explore() { let relay_id = "relay_id"; let client_id = "client_id"; let set_variables_state = maplit::hashmap!( @@ -28,23 +28,23 @@ fn network_explore() { ); let client_call_service = set_variables_call_service(set_variables_state, VariableOptionSource::Argument(0)); - let mut client = create_avm(client_call_service, client_id); + let mut client = create_avm(client_call_service, client_id).await; let client_1_id = "client_1_id"; let client_2_id = "client_2_id"; let client_3_id = "client_3_id"; let relay_call_service = set_variable_call_service(json!([client_1_id, client_2_id, client_3_id, relay_id])); - let mut relay = create_avm(relay_call_service, relay_id); + let mut relay = create_avm(relay_call_service, relay_id).await; let client_1_call_service = set_variable_call_service(json!([client_1_id, client_3_id, relay_id, client_2_id])); - let mut client_1 = create_avm(client_1_call_service, client_1_id); + let mut client_1 = create_avm(client_1_call_service, client_1_id).await; let client_2_call_service = set_variable_call_service(json!([relay_id, client_3_id, client_1_id, client_2_id])); - let mut client_2 = create_avm(client_2_call_service, client_2_id); + let mut client_2 = create_avm(client_2_call_service, client_2_id).await; let client_3_call_service = set_variable_call_service(json!([relay_id, client_3_id, client_1_id, client_2_id])); - let mut client_3 = create_avm(client_3_call_service, client_3_id); + let mut client_3 = create_avm(client_3_call_service, client_3_id).await; let script = include_str!("./scripts/network_explore.air"); diff --git a/air/tests/test_module/issues/issue_137.rs b/air/tests/test_module/issues/issue_137.rs index 1def8a55bf..00eef33d42 100644 --- a/air/tests/test_module/issues/issue_137.rs +++ b/air/tests/test_module/issues/issue_137.rs @@ -18,16 +18,16 @@ use air_test_utils::prelude::*; #[tokio::test] // https://github.com/fluencelabs/aquavm/issues/137 -fn issue_137() { +async fn issue_137() { let initiator_id = "initiator_id"; - let mut initiator = create_avm(unit_call_service(), initiator_id); + let mut initiator = create_avm(unit_call_service(), initiator_id).await; let node_1_id = "node_1_id"; - let mut node_1 = create_avm(unit_call_service(), node_1_id); + let mut node_1 = create_avm(unit_call_service(), node_1_id).await; let node_2_id = "node_2_id"; - let mut node_2 = create_avm(unit_call_service(), node_2_id); + let mut node_2 = create_avm(unit_call_service(), node_2_id).await; let node_3_id = "node_3_id"; let node_4_id = "node_4_id"; - let mut node_4 = create_avm(unit_call_service(), node_4_id); + let mut node_4 = create_avm(unit_call_service(), node_4_id).await; let script = format!( r#" diff --git a/air/tests/test_module/issues/issue_173.rs b/air/tests/test_module/issues/issue_173.rs index 863aaab431..06ee333cf9 100644 --- a/air/tests/test_module/issues/issue_173.rs +++ b/air/tests/test_module/issues/issue_173.rs @@ -19,13 +19,13 @@ use air_test_utils::prelude::*; #[tokio::test] #[ignore] // test for github.com/fluencelabs/aquavm/issues/173 -fn issue_173() { +async fn issue_173() { let set_variable_peer_id = "set_variable_peer_id"; let local_vm_peer_id_1 = "local_vm_peer_id_1"; let local_vm_peer_id_2 = "local_vm_peer_id_2"; - let mut local_vm_1 = create_avm(echo_call_service(), local_vm_peer_id_1); - let mut local_vm_2 = create_avm(echo_call_service(), local_vm_peer_id_2); + let mut local_vm_1 = create_avm(echo_call_service(), local_vm_peer_id_1).await; + let mut local_vm_2 = create_avm(echo_call_service(), local_vm_peer_id_2).await; let variables_mapping = maplit::hashmap! { "1".to_string() => json!(1), @@ -34,7 +34,7 @@ fn issue_173() { let mut set_variable_vm = create_avm( set_variables_call_service(variables_mapping, VariableOptionSource::Argument(0)), set_variable_peer_id, - ); + ).await; let script = format!( r#" diff --git a/air/tests/test_module/issues/issue_177.rs b/air/tests/test_module/issues/issue_177.rs index 78505cc25c..6c87ab91ff 100644 --- a/air/tests/test_module/issues/issue_177.rs +++ b/air/tests/test_module/issues/issue_177.rs @@ -21,7 +21,7 @@ use serde_json::json; #[tokio::test] // https://github.com/fluencelabs/aquavm/issues/177 -fn issue_177() { +async fn issue_177() { let client_peer_id = "12D3KooWMMcNVt5AsiisAHbkfyZWKHufB2dkHCY5pUqZ6AQgEVK6"; let relay_peer_id = "12D3KooWSD5PToNiLQwKDXsu8JSysCwUt8BVUJEqCHcDe7P5h45e"; let variables = maplit::hashmap! { @@ -57,17 +57,18 @@ fn issue_177() { let mut client = create_avm( set_variables_call_service(variables.clone(), VariableOptionSource::FunctionName), client_peer_id, - ); + ).await; let mut relay = create_avm( set_variables_call_service(variables, VariableOptionSource::FunctionName), relay_peer_id, - ); + ).await; let script = include_str!("scripts/issue_177.air"); // client 1: demand result for (call %init_peer_id% ("getDataSrv" "-relay-") [] -relay-) let client_result_1 = client .call_single(script, "", "", client_peer_id, 0, 0, None, HashMap::new(), "") + .await .expect("call should be success"); let expected_call_requests = maplit::hashmap! { 1 => CallRequestParams::new("getDataSrv", "-relay-", vec![], vec![]), @@ -91,6 +92,7 @@ fn issue_177() { call_results, "", ) + .await .expect("call should be success"); assert!(client_result_2.call_requests.is_empty()); assert_eq!(client_result_2.next_peer_pks, vec![relay_peer_id.to_string()]); @@ -108,6 +110,7 @@ fn issue_177() { HashMap::new(), "", ) + .await .expect("call should be success"); let expected_call_requests = maplit::hashmap! { 1 => CallRequestParams::new("op", "noop", vec![], vec![]), @@ -131,6 +134,7 @@ fn issue_177() { call_results, "", ) + .await .expect("call should be success"); assert!(relay_result_2.next_peer_pks.is_empty()); @@ -150,6 +154,7 @@ fn issue_177() { call_results, "", ) + .await .expect("call should be success"); assert!(relay_result_3.next_peer_pks.is_empty()); @@ -169,6 +174,7 @@ fn issue_177() { call_results, "", ) + .await .expect("call should be success"); // client 4: receive result from the relay @@ -185,6 +191,7 @@ fn issue_177() { HashMap::new(), "", ) + .await .expect("call should be success"); let expected_call_requests = maplit::hashmap! { 2 => CallRequestParams::new("op", "noop", vec![], vec![]) @@ -209,6 +216,7 @@ fn issue_177() { call_results, "", ) + .await .expect("call should be success"); let expected_call_requests = maplit::hashmap! { 3 => CallRequestParams::new("peer", "timeout", vec![json!(1000u64), json!("timeout")], vec![ @@ -233,7 +241,7 @@ fn issue_177() { None, call_results, "", - ); + ).await; // before patch the interpreter crashed here assert!(client_result_5.is_ok()); } diff --git a/air/tests/test_module/issues/issue_178.rs b/air/tests/test_module/issues/issue_178.rs index 5e8f48d609..4b1cf34152 100644 --- a/air/tests/test_module/issues/issue_178.rs +++ b/air/tests/test_module/issues/issue_178.rs @@ -18,7 +18,7 @@ use air_test_utils::prelude::*; #[tokio::test] // https://github.com/fluencelabs/aquavm/issues/178 -fn par_ap_behaviour() { +async fn par_ap_behaviour() { let client_name = "client_id"; let relay_name = "relay_id"; let variable_setter_name = "variable_setter_id"; @@ -44,20 +44,21 @@ fn par_ap_behaviour() { let engine = air_test_framework::AirScriptExecutor::from_annotated(TestRunParameters::new(client_name, 0, 1, ""), &script) + .await .expect("invalid test executor config"); let relay_id = engine.resolve_name(relay_name).to_string(); let variable_setter_id = engine.resolve_name(variable_setter_name).to_string(); - let client_result_1 = engine.execute_one(client_name).unwrap(); + let client_result_1 = engine.execute_one(client_name).await.unwrap(); assert_next_pks!( &client_result_1.next_peer_pks, &[relay_id.as_str(), variable_setter_id.as_str()] ); - let setter_result = engine.execute_one(variable_setter_name).unwrap(); + let setter_result = engine.execute_one(variable_setter_name).await.unwrap(); assert!(setter_result.next_peer_pks.is_empty()); - let relay_result = engine.execute_one(relay_name).unwrap(); + let relay_result = engine.execute_one(relay_name).await.unwrap(); assert!(relay_result.next_peer_pks.is_empty()); } diff --git a/air/tests/test_module/issues/issue_180.rs b/air/tests/test_module/issues/issue_180.rs index 83f5a52b44..2fb3c8c139 100644 --- a/air/tests/test_module/issues/issue_180.rs +++ b/air/tests/test_module/issues/issue_180.rs @@ -18,10 +18,10 @@ use air_test_utils::prelude::*; #[tokio::test] // test for github.com/fluencelabs/aquavm/issues/180 -fn issue_180() { +async fn issue_180() { let peer_1_id = "peer_1_id"; let peer_2_id = "peer_2_id"; - let mut peer_1 = create_avm(unit_call_service(), peer_1_id); + let mut peer_1 = create_avm(unit_call_service(), peer_1_id).await; let script = format!( r#" diff --git a/air/tests/test_module/issues/issue_206.rs b/air/tests/test_module/issues/issue_206.rs index 660b879509..90224e229d 100644 --- a/air/tests/test_module/issues/issue_206.rs +++ b/air/tests/test_module/issues/issue_206.rs @@ -19,9 +19,9 @@ use air_test_utils::prelude::*; #[tokio::test] #[ignore] // this test is not actual because streams are prohibited to be used as match operands // test for github.com/fluencelabs/aquavm/issues/206 -fn issue_206() { +async fn issue_206() { let peer_1_id = "peer_1_id"; - let mut peer_1 = create_avm(echo_call_service(), peer_1_id); + let mut peer_1 = create_avm(echo_call_service(), peer_1_id).await; let script = format!( r#" diff --git a/air/tests/test_module/issues/issue_211.rs b/air/tests/test_module/issues/issue_211.rs index 76868a973a..22c846911f 100644 --- a/air/tests/test_module/issues/issue_211.rs +++ b/air/tests/test_module/issues/issue_211.rs @@ -22,7 +22,7 @@ use pretty_assertions::assert_eq; #[tokio::test] // test for github.com/fluencelabs/aquavm/issues/211 // On the versions < 0.20.1 it just crashes -fn issue_211() { +async fn issue_211() { let peer_1_name = "peer_1_id"; let script = format!( @@ -71,11 +71,12 @@ fn issue_211() { let run_params = TestRunParameters::from_init_peer_id(peer_1_name); let engine = air_test_framework::AirScriptExecutor::from_annotated(run_params, &script) + .await .expect("invalid test executor config"); let peer_1_id = engine.resolve_name(peer_1_name).to_string(); let peer_1_id = peer_1_id.as_str(); - let result = engine.execute_one(peer_1_name).unwrap(); + let result = engine.execute_one(peer_1_name).await.unwrap(); let scalar_2 = scalar!( json!([1, 2, 3]), diff --git a/air/tests/test_module/issues/issue_214.rs b/air/tests/test_module/issues/issue_214.rs index 80cc8e41b1..288c6589b0 100644 --- a/air/tests/test_module/issues/issue_214.rs +++ b/air/tests/test_module/issues/issue_214.rs @@ -21,7 +21,7 @@ use pretty_assertions::assert_eq; #[tokio::test] // test for github.com/fluencelabs/aquavm/issues/214 -fn issue_214() { +async fn issue_214() { let client_id = "client_peer_id"; let relay_id = "relay_peer_id"; let scalar = json!([]); @@ -35,7 +35,7 @@ fn issue_214() { let mut client = create_avm( set_variables_call_service(variables_mapping, VariableOptionSource::FunctionName), client_id, - ); + ).await; let script = format!( r#" diff --git a/air/tests/test_module/issues/issue_216.rs b/air/tests/test_module/issues/issue_216.rs index 46ceda4580..dc02c6b364 100644 --- a/air/tests/test_module/issues/issue_216.rs +++ b/air/tests/test_module/issues/issue_216.rs @@ -18,7 +18,7 @@ use air_test_utils::prelude::*; #[tokio::test] // test for github.com/fluencelabs/aquavm/issues/216 -fn issue_216() { +async fn issue_216() { let some_peer_id = "relay_peer_id"; let variables_mapping = maplit::hashmap! { "value".to_string() => json!([]), @@ -27,10 +27,10 @@ fn issue_216() { let mut some_peer = create_avm( set_variables_call_service(variables_mapping, VariableOptionSource::FunctionName), some_peer_id, - ); + ).await; let client_id = "client_peer_id"; - let mut client = create_avm(echo_call_service(), client_id); + let mut client = create_avm(echo_call_service(), client_id).await; let error_message = "error message"; let script = format!( diff --git a/air/tests/test_module/issues/issue_221.rs b/air/tests/test_module/issues/issue_221.rs index f015e5309a..9d1ac20241 100644 --- a/air/tests/test_module/issues/issue_221.rs +++ b/air/tests/test_module/issues/issue_221.rs @@ -22,7 +22,7 @@ use pretty_assertions::assert_eq; #[tokio::test] // test for github.com/fluencelabs/aquavm/issues/221 -fn issue_221() { +async fn issue_221() { let peer_1_name = "peer_1_id"; let peer_2_name = "peer_2_id"; let join_1_name = "join_1_id"; @@ -77,18 +77,19 @@ fn issue_221() { vec![peer_1_name, peer_2_name].into_iter().map(Into::into), &script, ) + .await .expect("Invalid annotated AIR script"); let peer_1_id = at(peer_1_name); let peer_2_id = at(peer_2_name); let join_1_id = at(join_1_name); - let _result = executor.execute_one(set_variable_name).unwrap(); - let _peer_1_result = executor.execute_one(peer_1_name).unwrap(); - let _peer_2_result = executor.execute_one(peer_2_name).unwrap(); + let _result = executor.execute_one(set_variable_name).await.unwrap(); + let _peer_1_result = executor.execute_one(peer_1_name).await.unwrap(); + let _peer_2_result = executor.execute_one(peer_2_name).await.unwrap(); - let _join_1_result = executor.execute_one(join_1_name).unwrap(); - let join_1_result = executor.execute_one(join_1_name).unwrap(); // before 0.20.9 it fails here + let _join_1_result = executor.execute_one(join_1_name).await.unwrap(); + let join_1_result = executor.execute_one(join_1_name).await.unwrap(); // before 0.20.9 it fails here let actual_trace = trace_from_result(&join_1_result); let expected_trace = ExecutionTrace::from(vec![ scalar!( diff --git a/air/tests/test_module/issues/issue_222.rs b/air/tests/test_module/issues/issue_222.rs index ce36dc490f..87cd6ffd14 100644 --- a/air/tests/test_module/issues/issue_222.rs +++ b/air/tests/test_module/issues/issue_222.rs @@ -19,7 +19,7 @@ use pretty_assertions::assert_eq; #[tokio::test] // test for github.com/fluencelabs/aquavm/issues/222 -fn issue_222() { +async fn issue_222() { let other_id = "other_id"; let other_1_id = "other_1"; let other_2_id = "other_2"; @@ -38,9 +38,9 @@ fn issue_222() { "# ); - let mut other_id_vm = create_avm(echo_call_service(), "other_id"); - let mut other_1_vm = create_avm(set_variable_call_service(json!([1])), "other_1"); - let mut other_2_vm = create_avm(set_variable_call_service(json!([2])), "other_2"); + let mut other_id_vm = create_avm(echo_call_service(), "other_id").await; + let mut other_1_vm = create_avm(set_variable_call_service(json!([1])), "other_1").await; + let mut other_2_vm = create_avm(set_variable_call_service(json!([2])), "other_2").await; let result = checked_call_vm!(other_id_vm, <_>::default(), &air_script, "", ""); let other_1_result = checked_call_vm!(other_1_vm, <_>::default(), &air_script, "", result.data.clone()); diff --git a/air/tests/test_module/issues/issue_241.rs b/air/tests/test_module/issues/issue_241.rs index 2466abac55..5b154bd1d2 100644 --- a/air/tests/test_module/issues/issue_241.rs +++ b/air/tests/test_module/issues/issue_241.rs @@ -21,18 +21,18 @@ use pretty_assertions::assert_eq; #[tokio::test] // test for github.com/fluencelabs/aquavm/issues/241 -fn issue_241() { +async fn issue_241() { let peer_1_id = "peer_1_id"; let array_1_content = json!(["1", "2"]); - let mut peer_1_vm = create_avm(set_variable_call_service(array_1_content.clone()), peer_1_id); + let mut peer_1_vm = create_avm(set_variable_call_service(array_1_content.clone()), peer_1_id).await; let some_peer_id = "some_peer_id"; - let mut some_peer_vm = create_avm(unit_call_service(), some_peer_id); + let mut some_peer_vm = create_avm(unit_call_service(), some_peer_id).await; let set_array_0_peer_id = "set_array_0_peer_id"; let peer_2_id = "peer_2_id"; let peers = json!([peer_1_id, peer_2_id]); - let mut set_array_0_vm = create_avm(set_variable_call_service(peers.clone()), set_array_0_peer_id); + let mut set_array_0_vm = create_avm(set_variable_call_service(peers.clone()), set_array_0_peer_id).await; let script = format!( r#" diff --git a/air/tests/test_module/issues/issue_295.rs b/air/tests/test_module/issues/issue_295.rs index 7fccd6298b..52494173fc 100644 --- a/air/tests/test_module/issues/issue_295.rs +++ b/air/tests/test_module/issues/issue_295.rs @@ -21,9 +21,9 @@ use air_trace_handler::TraceHandlerError; #[tokio::test] // test for github.com/fluencelabs/aquavm/issues/295 -fn issue_295() { +async fn issue_295() { let vm_peer_id = "vm_peer_id"; - let mut vm = create_avm(echo_call_service(), vm_peer_id); + let mut vm = create_avm(echo_call_service(), vm_peer_id).await; let script = format!( r#" diff --git a/air/tests/test_module/issues/issue_300.rs b/air/tests/test_module/issues/issue_300.rs index 26ab36f556..96b851db77 100644 --- a/air/tests/test_module/issues/issue_300.rs +++ b/air/tests/test_module/issues/issue_300.rs @@ -18,11 +18,11 @@ use air_test_utils::prelude::*; #[tokio::test] // test for github.com/fluencelabs/aquavm/issues/300 -fn issue_300() { +async fn issue_300() { let peer_id_1 = "peer_id_1"; - let mut peer_vm_1 = create_avm(echo_call_service(), peer_id_1); + let mut peer_vm_1 = create_avm(echo_call_service(), peer_id_1).await; let peer_id_2 = "peer_id_2"; - let mut peer_vm_2 = create_avm(echo_call_service(), peer_id_2); + let mut peer_vm_2 = create_avm(echo_call_service(), peer_id_2).await; let script = format!( r#" diff --git a/air/tests/test_module/issues/issue_302.rs b/air/tests/test_module/issues/issue_302.rs index f952cbf72c..9df0fa7454 100644 --- a/air/tests/test_module/issues/issue_302.rs +++ b/air/tests/test_module/issues/issue_302.rs @@ -22,13 +22,13 @@ use std::ops::Deref; #[tokio::test] // test for github.com/fluencelabs/aquavm/issues/302 -fn issue_302() { +async fn issue_302() { let peer_id_1 = "peer_id_1"; - let mut peer_vm_1 = create_avm(echo_call_service(), peer_id_1); + let mut peer_vm_1 = create_avm(echo_call_service(), peer_id_1).await; let peer_id_2 = "peer_id_2"; - let mut peer_vm_2 = create_avm(echo_call_service(), peer_id_2); + let mut peer_vm_2 = create_avm(echo_call_service(), peer_id_2).await; let peer_id_3 = "peer_id_3"; - let mut peer_vm_3 = create_avm(echo_call_service(), peer_id_3); + let mut peer_vm_3 = create_avm(echo_call_service(), peer_id_3).await; let script = format!( r#" diff --git a/air/tests/test_module/issues/issue_304.rs b/air/tests/test_module/issues/issue_304.rs index 647049251c..7aaa8f5262 100644 --- a/air/tests/test_module/issues/issue_304.rs +++ b/air/tests/test_module/issues/issue_304.rs @@ -19,7 +19,7 @@ use air_test_utils::prelude::*; #[tokio::test] // test for github.com/fluencelabs/aquavm/issues/304 -fn issue_304() { +async fn issue_304() { let script = r#" (par (seq @@ -34,8 +34,9 @@ fn issue_304() { let init_peer_id = "init_peer_id"; let executor = AirScriptExecutor::from_annotated(TestRunParameters::from_init_peer_id(init_peer_id), script) + .await .expect("invalid test AIR script"); - let res = executor.execute_one(init_peer_id).unwrap(); + let res = executor.execute_one(init_peer_id).await.unwrap(); assert_eq!(res.ret_code, air_interpreter_interface::INTERPRETER_SUCCESS); } diff --git a/air/tests/test_module/issues/issue_306.rs b/air/tests/test_module/issues/issue_306.rs index 75a8a9a694..5660cf5a10 100644 --- a/air/tests/test_module/issues/issue_306.rs +++ b/air/tests/test_module/issues/issue_306.rs @@ -19,9 +19,9 @@ use air_test_utils::prelude::*; #[tokio::test] // test for github.com/fluencelabs/aquavm/issues/306 -fn issue_306() { +async fn issue_306() { let peer_id_1 = "peer_id_1"; - let mut peer_vm_1 = create_avm(echo_call_service(), peer_id_1); + let mut peer_vm_1 = create_avm(echo_call_service(), peer_id_1).await; let script = format!( r#" diff --git a/air/tests/test_module/issues/issue_331.rs b/air/tests/test_module/issues/issue_331.rs index 435aa604be..79f5f72826 100644 --- a/air/tests/test_module/issues/issue_331.rs +++ b/air/tests/test_module/issues/issue_331.rs @@ -19,9 +19,9 @@ use air_test_utils::prelude::*; #[tokio::test] // test for github.com/fluencelabs/aquavm/issues/331 -fn issue_331() { +async fn issue_331() { let peer_id_1 = "peer_id_1"; - let mut peer_vm_1 = create_avm(set_variable_call_service(json!("")), peer_id_1); + let mut peer_vm_1 = create_avm(set_variable_call_service(json!("")), peer_id_1).await; let script = format!( r#" diff --git a/air/tests/test_module/issues/issue_346.rs b/air/tests/test_module/issues/issue_346.rs index 1404287520..1498af0861 100644 --- a/air/tests/test_module/issues/issue_346.rs +++ b/air/tests/test_module/issues/issue_346.rs @@ -19,9 +19,9 @@ use air_test_utils::prelude::*; #[tokio::test] // test for github.com/fluencelabs/aquavm/issues/346 -fn issue_346() { +async fn issue_346() { let vm_peer_id = "peer_id_1"; - let mut peer_vm = create_avm(echo_call_service(), vm_peer_id); + let mut peer_vm = create_avm(echo_call_service(), vm_peer_id).await; let script = format!( r#" diff --git a/air/tests/test_module/issues/issue_348.rs b/air/tests/test_module/issues/issue_348.rs index 251a59f48d..1e4c81e5c9 100644 --- a/air/tests/test_module/issues/issue_348.rs +++ b/air/tests/test_module/issues/issue_348.rs @@ -18,13 +18,13 @@ use air_test_utils::prelude::*; #[tokio::test] // test for github.com/fluencelabs/aquavm/issues/348 -fn issue_348() { +async fn issue_348() { let vm_peer_id_1 = "vm_peer_id_1"; - let mut peer_vm_1 = create_avm(echo_call_service(), vm_peer_id_1); + let mut peer_vm_1 = create_avm(echo_call_service(), vm_peer_id_1).await; let vm_peer_id_2 = "vm_peer_id_2"; - let mut peer_vm_2 = create_avm(echo_call_service(), vm_peer_id_2); + let mut peer_vm_2 = create_avm(echo_call_service(), vm_peer_id_2).await; let vm_peer_id_3 = "vm_peer_id_3"; - let mut peer_vm_3 = create_avm(echo_call_service(), vm_peer_id_3); + let mut peer_vm_3 = create_avm(echo_call_service(), vm_peer_id_3).await; let script = format!( r#" diff --git a/air/tests/test_module/issues/issue_356.rs b/air/tests/test_module/issues/issue_356.rs index 48f82b3d18..99b7613167 100644 --- a/air/tests/test_module/issues/issue_356.rs +++ b/air/tests/test_module/issues/issue_356.rs @@ -17,8 +17,10 @@ use air_test_framework::AirScriptExecutor; use air_test_utils::prelude::*; +use futures::StreamExt; + #[tokio::test] -fn issue_356() { +async fn issue_356() { let script = r#" (seq (seq @@ -57,11 +59,12 @@ fn issue_356() { vec!["p1", "p2", "p3"].into_iter().map(Into::into), script, ) + .await .unwrap(); for _ in 0..7 { for peer in ["client", "relay", "p1", "p2"] { - for outcome in engine.execution_iter(peer).unwrap() { + for outcome in engine.execution_iter(peer).unwrap().collect::>().await { assert_eq!(outcome.ret_code, 0, "{outcome:?}"); } } diff --git a/air/tests/test_module/issues/issue_363.rs b/air/tests/test_module/issues/issue_363.rs index bc520ff9d7..f70672084a 100644 --- a/air/tests/test_module/issues/issue_363.rs +++ b/air/tests/test_module/issues/issue_363.rs @@ -18,7 +18,7 @@ use air_test_utils::prelude::*; //https://github.com/fluencelabs/aquavm/issues/363 #[tokio::test] -fn issue_363() { +async fn issue_363() { let client_peer_id = "client"; let mut client_vm = create_avm( set_variable_call_service(json!([ @@ -26,12 +26,12 @@ fn issue_363() { ["p2", [[["p2", 13], ["p1", 14]], [["p2", 16], ["p1", 18]]]] ])), client_peer_id, - ); + ).await; let p1_peer_id = "p1"; - let mut p1_vm = create_avm(set_variable_call_service(json!("p1")), p1_peer_id); + let mut p1_vm = create_avm(set_variable_call_service(json!("p1")), p1_peer_id).await; let p2_peer_id = "p2"; - let mut p2_vm = create_avm(set_variable_call_service(json!("p2")), p2_peer_id); + let mut p2_vm = create_avm(set_variable_call_service(json!("p2")), p2_peer_id).await; let script = r#" (seq diff --git a/air/tests/test_module/issues/issue_632.rs b/air/tests/test_module/issues/issue_632.rs index 2c83de756b..f67bf6aa36 100644 --- a/air/tests/test_module/issues/issue_632.rs +++ b/air/tests/test_module/issues/issue_632.rs @@ -17,7 +17,7 @@ use air_test_utils::{key_utils::derive_dummy_keypair, prelude::*}; #[tokio::test] -fn issue_310() { +async fn issue_310() { let (key_pair, peer_id) = derive_dummy_keypair("init_peer_id"); let particle_id = "particle_id"; @@ -34,8 +34,8 @@ fn issue_310() { ) "#; - let mut runner = DefaultAirRunner::new(&peer_id); - let mut call = |prev_data, call_results| { + let mut runner = DefaultAirRunner::new(&peer_id).await; + let mut call = |prev_data, call_results| async { runner .call( air_script, @@ -49,10 +49,11 @@ fn issue_310() { key_pair.as_inner(), particle_id.to_owned(), ) + .await .unwrap() }; - let res1 = call(&b""[..], <_>::default()); + let res1 = call(&b""[..], <_>::default()).await; assert_eq!(res1.ret_code, 0); assert_eq!(res1.call_requests.len(), 2, "test invalid"); @@ -61,7 +62,7 @@ fn issue_310() { maplit::hashmap! { 1u32 => CallServiceResult::ok(json!(0)), }, - ); + ).await; assert_eq!(res2.ret_code, 0); // in the version without ap join behavior, it was 1. assert_eq!(res2.call_requests.len(), 0); @@ -71,7 +72,7 @@ fn issue_310() { maplit::hashmap! { 2u32 => CallServiceResult::ok(json!(0)), }, - ); + ).await; // previously was an error: // on instruction 'ap x $y' trace handler encountered an error: state from previous `Call(..)` diff --git a/air/tests/test_module/issues/issue_642.rs b/air/tests/test_module/issues/issue_642.rs index aba5316997..dd5eded2ce 100644 --- a/air/tests/test_module/issues/issue_642.rs +++ b/air/tests/test_module/issues/issue_642.rs @@ -17,14 +17,14 @@ use air_test_utils::prelude::*; #[tokio::test] -fn issue_642() { +async fn issue_642() { let peer_id_1 = "peer_id_1"; let peer_id_2 = "peer_id_2"; let peer_id_3 = "peer_id_3"; - let mut vm_1 = create_avm(unit_call_service(), peer_id_1); - let mut vm_2 = create_avm(unit_call_service(), peer_id_2); - let mut vm_3 = create_avm(unit_call_service(), peer_id_3); + let mut vm_1 = create_avm(unit_call_service(), peer_id_1).await; + let mut vm_2 = create_avm(unit_call_service(), peer_id_2).await; + let mut vm_3 = create_avm(unit_call_service(), peer_id_3).await; let script = format!( r#" diff --git a/air/tests/test_module/issues/issue_644.rs b/air/tests/test_module/issues/issue_644.rs index a7d658fe1e..73fbce7a73 100644 --- a/air/tests/test_module/issues/issue_644.rs +++ b/air/tests/test_module/issues/issue_644.rs @@ -17,14 +17,14 @@ use air_test_utils::prelude::*; #[tokio::test] -fn issue_644() { +async fn issue_644() { let peer_id_1 = "peer_id_1"; let peer_id_2 = "peer_id_2"; let peer_id_3 = "peer_id_3"; - let mut vm_1 = create_avm(echo_call_service(), peer_id_1); - let mut vm_2 = create_avm(echo_call_service(), peer_id_2); - let mut vm_3 = create_avm(echo_call_service(), peer_id_3); + let mut vm_1 = create_avm(echo_call_service(), peer_id_1).await; + let mut vm_2 = create_avm(echo_call_service(), peer_id_2).await; + let mut vm_3 = create_avm(echo_call_service(), peer_id_3).await; let script = format!( r#" diff --git a/air/tests/test_module/negative_tests/execution_step.rs b/air/tests/test_module/negative_tests/execution_step.rs index e9d1b62d53..36269f5764 100644 --- a/air/tests/test_module/negative_tests/execution_step.rs +++ b/air/tests/test_module/negative_tests/execution_step.rs @@ -23,7 +23,7 @@ use air_test_framework::AirScriptExecutor; use air_test_utils::prelude::*; #[tokio::test] -fn local_service_error() { +async fn local_service_error() { let client_peer_id = "some_peer_id"; let script = format!( r#" @@ -31,9 +31,10 @@ fn local_service_error() { "# ); - let mut client_vm = create_avm(echo_call_service(), client_peer_id); + let mut client_vm = create_avm(echo_call_service(), client_peer_id).await; let result = client_vm .call_single(&script, "", "", client_peer_id, 0, 0, None, <_>::default(), "") + .await .unwrap(); let err_msg = "some error".to_string(); @@ -53,6 +54,7 @@ fn local_service_error() { call_results_4_call, "", ) + .await .unwrap(); let err_msg = std::rc::Rc::new(format!("\"{err_msg}\"")); @@ -61,7 +63,7 @@ fn local_service_error() { } #[tokio::test] -fn fold_iterates_over_non_array_scalar_iterable() { +async fn fold_iterates_over_non_array_scalar_iterable() { let vm_2_peer_id = "vm_2_peer_id"; let var_name = "outcome".to_string(); let script = format!( @@ -78,14 +80,14 @@ fn fold_iterates_over_non_array_scalar_iterable() { "# ); let unsupported_jvalue = json!({"attr": 42, }); - let mut vm_2 = create_avm(set_variable_call_service(unsupported_jvalue.clone()), vm_2_peer_id); - let result = vm_2.call(&script, "", "", <_>::default()).unwrap(); + let mut vm_2 = create_avm(set_variable_call_service(unsupported_jvalue.clone()), vm_2_peer_id).await; + let result = vm_2.call(&script, "", "", <_>::default()).await.unwrap(); let expected_error = CatchableError::FoldIteratesOverNonArray(unsupported_jvalue, var_name); assert!(check_error(&result, expected_error)); } #[tokio::test] -fn fold_iterates_over_non_array_scalar_lambda_iterable() { +async fn fold_iterates_over_non_array_scalar_lambda_iterable() { let vm_2_peer_id = "vm_2_peer_id"; let var_name = "outcome".to_string(); let scalar_int = 42; @@ -103,14 +105,14 @@ fn fold_iterates_over_non_array_scalar_lambda_iterable() { "# ); let unsupported_jvalue = json!({"int": scalar_int, }); - let mut vm_2 = create_avm(set_variable_call_service(unsupported_jvalue.clone()), vm_2_peer_id); - let result = vm_2.call(&script, "", "", <_>::default()).unwrap(); + let mut vm_2 = create_avm(set_variable_call_service(unsupported_jvalue.clone()), vm_2_peer_id).await; + let result = vm_2.call(&script, "", "", <_>::default()).await.unwrap(); let expected_error = CatchableError::FoldIteratesOverNonArray(json!(scalar_int), ".$.int".to_string()); assert!(check_error(&result, expected_error)); } #[tokio::test] -fn non_string_value_in_triplet_resolution() { +async fn non_string_value_in_triplet_resolution() { let vm_2_peer_id = "vm_2_peer_id"; let scalar_int = 42; let var_name = "var_name".to_string(); @@ -122,8 +124,8 @@ fn non_string_value_in_triplet_resolution() { ) "# ); - let mut vm_2 = create_avm(unit_call_service(), vm_2_peer_id); - let result = vm_2.call(&script, "", "", <_>::default()).unwrap(); + let mut vm_2 = create_avm(unit_call_service(), vm_2_peer_id).await; + let result = vm_2.call(&script, "", "", <_>::default()).await.unwrap(); let expected_error = CatchableError::NonStringValueInTripletResolution { variable_name: var_name.clone(), actual_value: json!(scalar_int), @@ -141,8 +143,8 @@ fn non_string_value_in_triplet_resolution() { ) "# ); - let mut vm_2 = create_avm(set_variable_call_service(json!({"int": scalar_int, })), vm_2_peer_id); - let result = vm_2.call(&script, "", "", <_>::default()).unwrap(); + let mut vm_2 = create_avm(set_variable_call_service(json!({"int": scalar_int, })), vm_2_peer_id).await; + let result = vm_2.call(&script, "", "", <_>::default()).await.unwrap(); let expected_error = CatchableError::NonStringValueInTripletResolution { variable_name: var_name, actual_value: json!(scalar_int), @@ -161,8 +163,8 @@ fn non_string_value_in_triplet_resolution() { ) "# ); - let mut vm_2 = create_avm(echo_call_service(), vm_2_peer_id); - let result = vm_2.call(&script, "", "", <_>::default()).unwrap(); + let mut vm_2 = create_avm(echo_call_service(), vm_2_peer_id).await; + let result = vm_2.call(&script, "", "", <_>::default()).await.unwrap(); let expected_error = CatchableError::NonStringValueInTripletResolution { variable_name: var_name.clone(), actual_value: json!(scalar_int), @@ -171,7 +173,7 @@ fn non_string_value_in_triplet_resolution() { } #[tokio::test] -fn non_string_value_in_triplet_resolution_module_name() { +async fn non_string_value_in_triplet_resolution_module_name() { let vm_2_peer_id = "vm_2_peer_id"; let scalar_int = 42; let var_name = "var_name".to_string(); @@ -183,8 +185,8 @@ fn non_string_value_in_triplet_resolution_module_name() { ) "# ); - let mut vm_2 = create_avm(unit_call_service(), vm_2_peer_id); - let result = vm_2.call(&script, "", "", <_>::default()).unwrap(); + let mut vm_2 = create_avm(unit_call_service(), vm_2_peer_id).await; + let result = vm_2.call(&script, "", "", <_>::default()).await.unwrap(); let expected_error = CatchableError::NonStringValueInTripletResolution { variable_name: var_name.clone(), actual_value: json!(scalar_int), @@ -202,8 +204,8 @@ fn non_string_value_in_triplet_resolution_module_name() { ) "# ); - let mut vm_2 = create_avm(set_variable_call_service(json!({"int": scalar_int, })), vm_2_peer_id); - let result = vm_2.call(&script, "", "", <_>::default()).unwrap(); + let mut vm_2 = create_avm(set_variable_call_service(json!({"int": scalar_int, })), vm_2_peer_id).await; + let result = vm_2.call(&script, "", "", <_>::default()).await.unwrap(); let expected_error = CatchableError::NonStringValueInTripletResolution { variable_name: var_name, actual_value: json!(scalar_int), @@ -222,8 +224,8 @@ fn non_string_value_in_triplet_resolution_module_name() { ) "# ); - let mut vm_2 = create_avm(echo_call_service(), vm_2_peer_id); - let result = vm_2.call(&script, "", "", <_>::default()).unwrap(); + let mut vm_2 = create_avm(echo_call_service(), vm_2_peer_id).await; + let result = vm_2.call(&script, "", "", <_>::default()).await.unwrap(); let expected_error = CatchableError::NonStringValueInTripletResolution { variable_name: var_name.clone(), actual_value: json!(scalar_int), @@ -232,7 +234,7 @@ fn non_string_value_in_triplet_resolution_module_name() { } #[tokio::test] -fn non_string_value_in_triplet_resolution_function_name() { +async fn non_string_value_in_triplet_resolution_function_name() { let vm_2_peer_id = "vm_2_peer_id"; let scalar_int = 42; let var_name = "var_name".to_string(); @@ -244,8 +246,8 @@ fn non_string_value_in_triplet_resolution_function_name() { ) "# ); - let mut vm_2 = create_avm(unit_call_service(), vm_2_peer_id); - let result = vm_2.call(&script, "", "", <_>::default()).unwrap(); + let mut vm_2 = create_avm(unit_call_service(), vm_2_peer_id).await; + let result = vm_2.call(&script, "", "", <_>::default()).await.unwrap(); let expected_error = CatchableError::NonStringValueInTripletResolution { variable_name: var_name.clone(), actual_value: json!(scalar_int), @@ -263,8 +265,8 @@ fn non_string_value_in_triplet_resolution_function_name() { ) "# ); - let mut vm_2 = create_avm(set_variable_call_service(json!({"int": scalar_int, })), vm_2_peer_id); - let result = vm_2.call(&script, "", "", <_>::default()).unwrap(); + let mut vm_2 = create_avm(set_variable_call_service(json!({"int": scalar_int, })), vm_2_peer_id).await; + let result = vm_2.call(&script, "", "", <_>::default()).await.unwrap(); let expected_error = CatchableError::NonStringValueInTripletResolution { variable_name: var_name, actual_value: json!(scalar_int), @@ -283,8 +285,8 @@ fn non_string_value_in_triplet_resolution_function_name() { ) "# ); - let mut vm_2 = create_avm(echo_call_service(), vm_2_peer_id); - let result = vm_2.call(&script, "", "", <_>::default()).unwrap(); + let mut vm_2 = create_avm(echo_call_service(), vm_2_peer_id).await; + let result = vm_2.call(&script, "", "", <_>::default()).await.unwrap(); let expected_error = CatchableError::NonStringValueInTripletResolution { variable_name: var_name.clone(), actual_value: json!(scalar_int), @@ -293,7 +295,7 @@ fn non_string_value_in_triplet_resolution_function_name() { } #[tokio::test] -fn value_not_contain_such_array_idx_ap() { +async fn value_not_contain_such_array_idx_ap() { let vm_1_peer_id = "vm_1_peer_id"; let idx = 42; let script = format!( @@ -305,8 +307,8 @@ fn value_not_contain_such_array_idx_ap() { "# ); let wrong_jvalue = json!(["a", "b"]); - let mut vm_2 = create_avm(set_variable_call_service(wrong_jvalue.clone()), vm_1_peer_id); - let result = vm_2.call(&script, "", "", <_>::default()).unwrap(); + let mut vm_2 = create_avm(set_variable_call_service(wrong_jvalue.clone()), vm_1_peer_id).await; + let result = vm_2.call(&script, "", "", <_>::default()).await.unwrap(); let expected_error = CatchableError::LambdaApplierError(LambdaError::ValueNotContainSuchArrayIdx { value: wrong_jvalue, @@ -316,11 +318,11 @@ fn value_not_contain_such_array_idx_ap() { } #[tokio::test] -fn field_accessor_applied_to_stream() { +async fn field_accessor_applied_to_stream() { let vm_peer_id_1 = "vm_peer_id_1"; let arg = json!({"a": 1,}); - let mut peer_vm_1 = create_avm(set_variable_call_service(arg), vm_peer_id_1); + let mut peer_vm_1 = create_avm(set_variable_call_service(arg), vm_peer_id_1).await; let field_name = "int".to_string(); let script = format!( r#" @@ -331,18 +333,18 @@ fn field_accessor_applied_to_stream() { "# ); - let result = peer_vm_1.call(script.clone(), "", "", <_>::default()).unwrap(); + let result = peer_vm_1.call(script.clone(), "", "", <_>::default()).await.unwrap(); let expected_error = air::CatchableError::LambdaApplierError(air::LambdaError::FieldAccessorAppliedToStream { field_name }); assert!(check_error(&result, expected_error)); } #[tokio::test] -fn array_accessor_not_match_value() { +async fn array_accessor_not_match_value() { let vm_peer_id_1 = "vm_peer_id_1"; let arg = json!({"a": 1,}); - let mut peer_vm_1 = create_avm(set_variable_call_service(arg.clone()), vm_peer_id_1); + let mut peer_vm_1 = create_avm(set_variable_call_service(arg.clone()), vm_peer_id_1).await; let idx = 42; let script = format!( r#" @@ -353,17 +355,17 @@ fn array_accessor_not_match_value() { "# ); - let result = peer_vm_1.call(script.clone(), "", "", <_>::default()).unwrap(); + let result = peer_vm_1.call(script.clone(), "", "", <_>::default()).await.unwrap(); let expected_error = air::CatchableError::LambdaApplierError(air::LambdaError::ArrayAccessorNotMatchValue { value: arg, idx }); assert!(check_error(&result, expected_error)); } #[tokio::test] -fn value_not_contain_such_array_idx_call_arg_lambda() { +async fn value_not_contain_such_array_idx_call_arg_lambda() { let vm_peer_id_1 = "vm_peer_id_1"; let arg = json!([0, 1]); - let mut peer_vm_1 = create_avm(set_variable_call_service(arg.clone()), vm_peer_id_1); + let mut peer_vm_1 = create_avm(set_variable_call_service(arg.clone()), vm_peer_id_1).await; let idx = 42; let script = format!( r#" @@ -374,17 +376,17 @@ fn value_not_contain_such_array_idx_call_arg_lambda() { "# ); - let result = peer_vm_1.call(script.clone(), "", "", <_>::default()).unwrap(); + let result = peer_vm_1.call(script.clone(), "", "", <_>::default()).await.unwrap(); let expected_error = air::CatchableError::LambdaApplierError(air::LambdaError::ValueNotContainSuchArrayIdx { value: arg, idx }); assert!(check_error(&result, expected_error)); } #[tokio::test] -fn value_not_contain_such_field_call_arg_lambda() { +async fn value_not_contain_such_field_call_arg_lambda() { let vm_peer_id_1 = "vm_peer_id_1"; let arg = json!({"a": 1,}); - let mut peer_vm_1 = create_avm(set_variable_call_service(arg.clone()), vm_peer_id_1); + let mut peer_vm_1 = create_avm(set_variable_call_service(arg.clone()), vm_peer_id_1).await; let field_name = "b".to_string(); let script = format!( r#" @@ -395,17 +397,17 @@ fn value_not_contain_such_field_call_arg_lambda() { "# ); - let result = peer_vm_1.call(script.clone(), "", "", <_>::default()).unwrap(); + let result = peer_vm_1.call(script.clone(), "", "", <_>::default()).await.unwrap(); let expected_error = air::CatchableError::LambdaApplierError(air::LambdaError::ValueNotContainSuchField { value: arg, field_name }); assert!(check_error(&result, expected_error)); } #[tokio::test] -fn field_accesssor_not_match_value_call_arg_lambda() { +async fn field_accesssor_not_match_value_call_arg_lambda() { let vm_peer_id_1 = "vm_peer_id_1"; let arg = json!([0, 1]); - let mut peer_vm_1 = create_avm(set_variable_call_service(arg.clone()), vm_peer_id_1); + let mut peer_vm_1 = create_avm(set_variable_call_service(arg.clone()), vm_peer_id_1).await; let script = format!( r#" @@ -415,7 +417,7 @@ fn field_accesssor_not_match_value_call_arg_lambda() { ) "# ); - let result = peer_vm_1.call(script.clone(), "", "", <_>::default()).unwrap(); + let result = peer_vm_1.call(script.clone(), "", "", <_>::default()).await.unwrap(); let expected_error = air::CatchableError::LambdaApplierError(air::LambdaError::FieldAccessorNotMatchValue { value: arg, field_name: "b".to_string(), @@ -424,14 +426,14 @@ fn field_accesssor_not_match_value_call_arg_lambda() { } #[tokio::test] -fn index_access_not_u32_i64() { +async fn index_access_not_u32_i64() { let vm_peer_id_1 = "vm_peer_id_1"; let vm_peer_id_2 = "vm_peer_id_2"; let number = serde_json::Number::from(8589934592 as i64); let arg = json!(number); - let mut peer_vm_1 = create_avm(set_variable_call_service(arg.clone()), vm_peer_id_1); + let mut peer_vm_1 = create_avm(set_variable_call_service(arg.clone()), vm_peer_id_1).await; let arg = json!([0, 1]); - let mut peer_vm_2 = create_avm(set_variable_call_service(arg.clone()), vm_peer_id_2); + let mut peer_vm_2 = create_avm(set_variable_call_service(arg.clone()), vm_peer_id_2).await; let script = format!( r#" @@ -445,18 +447,18 @@ fn index_access_not_u32_i64() { "# ); - let result = peer_vm_1.call(script.clone(), "", "", <_>::default()).unwrap(); - let result = peer_vm_2.call(script.clone(), "", result.data, <_>::default()).unwrap(); + let result = peer_vm_1.call(script.clone(), "", "", <_>::default()).await.unwrap(); + let result = peer_vm_2.call(script.clone(), "", result.data, <_>::default()).await.unwrap(); let expected_error = air::CatchableError::LambdaApplierError(air::LambdaError::IndexAccessNotU32 { accessor: number }); assert!(check_error(&result, expected_error)); } #[tokio::test] -fn scalar_accessor_has_invalid_type_ap() { +async fn scalar_accessor_has_invalid_type_ap() { let vm_peer_id_1 = "vm_peer_id_1"; let obj_arg = json!({"a": 1,}); - let mut peer_vm_1 = create_avm(set_variable_call_service(obj_arg.clone()), vm_peer_id_1); + let mut peer_vm_1 = create_avm(set_variable_call_service(obj_arg.clone()), vm_peer_id_1).await; let script = format!( r#" @@ -470,15 +472,15 @@ fn scalar_accessor_has_invalid_type_ap() { "# ); - let result = peer_vm_1.call(script.clone(), "", "", <_>::default()).unwrap(); + let result = peer_vm_1.call(script.clone(), "", "", <_>::default()).await.unwrap(); let expected_error = air::CatchableError::LambdaApplierError(air::LambdaError::ScalarAccessorHasInvalidType { scalar_accessor: obj_arg, }); assert!(check_error(&result, expected_error)); let obj_arg = json!([{"a": 1,}]); - let mut peer_vm_1 = create_avm(set_variable_call_service(obj_arg.clone()), vm_peer_id_1); - let result = peer_vm_1.call(script.clone(), "", "", <_>::default()).unwrap(); + let mut peer_vm_1 = create_avm(set_variable_call_service(obj_arg.clone()), vm_peer_id_1).await; + let result = peer_vm_1.call(script.clone(), "", "", <_>::default()).await.unwrap(); let expected_error = air::CatchableError::LambdaApplierError(air::LambdaError::ScalarAccessorHasInvalidType { scalar_accessor: obj_arg, }); @@ -486,10 +488,10 @@ fn scalar_accessor_has_invalid_type_ap() { } #[tokio::test] -fn stream_accessor_has_invalid_type() { +async fn stream_accessor_has_invalid_type() { let vm_peer_id_1 = "vm_peer_id_1"; let obj_arg = json!({"a": 1,}); - let mut peer_vm_1 = create_avm(set_variable_call_service(obj_arg.clone()), vm_peer_id_1); + let mut peer_vm_1 = create_avm(set_variable_call_service(obj_arg.clone()), vm_peer_id_1).await; let script = format!( r#" @@ -506,15 +508,15 @@ fn stream_accessor_has_invalid_type() { "# ); - let result = peer_vm_1.call(script.clone(), "", "", <_>::default()).unwrap(); + let result = peer_vm_1.call(script.clone(), "", "", <_>::default()).await.unwrap(); let expected_error = air::CatchableError::LambdaApplierError(air::LambdaError::StreamAccessorHasInvalidType { scalar_accessor: obj_arg, }); assert!(check_error(&result, expected_error)); let obj_arg = json!([{"a": 1,}]); - let mut peer_vm_1 = create_avm(set_variable_call_service(obj_arg.clone()), vm_peer_id_1); - let result = peer_vm_1.call(script.clone(), "", "", <_>::default()).unwrap(); + let mut peer_vm_1 = create_avm(set_variable_call_service(obj_arg.clone()), vm_peer_id_1).await; + let result = peer_vm_1.call(script.clone(), "", "", <_>::default()).await.unwrap(); let expected_error = air::CatchableError::LambdaApplierError(air::LambdaError::StreamAccessorHasInvalidType { scalar_accessor: obj_arg, }); @@ -522,9 +524,9 @@ fn stream_accessor_has_invalid_type() { } #[tokio::test] -fn canon_stream_not_have_enough_values_call_arg() { +async fn canon_stream_not_have_enough_values_call_arg() { let local_peer_id = "local_peer_id"; - let mut local_vm = create_avm(echo_call_service(), local_peer_id); + let mut local_vm = create_avm(echo_call_service(), local_peer_id).await; let join_stream_script = format!( r#" @@ -545,7 +547,7 @@ fn canon_stream_not_have_enough_values_call_arg() { )"# ); - let result = local_vm.call(&join_stream_script, "", "", <_>::default()).unwrap(); + let result = local_vm.call(&join_stream_script, "", "", <_>::default()).await.unwrap(); let actual_trace = trace_from_result(&result); assert_eq!(actual_trace.len(), 2); // only the first call and canon should produce a trace let expected_error = @@ -554,10 +556,10 @@ fn canon_stream_not_have_enough_values_call_arg() { } #[tokio::test] -fn unsupported_map_keytype() { +async fn unsupported_map_keytype() { let local_peer_id = "local_peer_id"; let obj_arg = json!({"a": {"b": 1},}); - let mut local_vm = create_avm(set_variable_call_service(obj_arg), local_peer_id); + let mut local_vm = create_avm(set_variable_call_service(obj_arg), local_peer_id).await; let map_name = "%map"; let join_stream_script = format!( @@ -569,13 +571,13 @@ fn unsupported_map_keytype() { "# ); - let result = local_vm.call(&join_stream_script, "", "", <_>::default()).unwrap(); + let result = local_vm.call(&join_stream_script, "", "", <_>::default()).await.unwrap(); let expected_error = CatchableError::StreamMapError(unsupported_map_key_type(map_name)); assert!(check_error(&result, expected_error)); } #[tokio::test] -fn undefined_last_error_functor() { +async fn undefined_last_error_functor() { let local_peer_id = "local_peer_id"; let script = format!( r#" @@ -589,15 +591,16 @@ fn undefined_last_error_functor() { ); let executor = AirScriptExecutor::from_annotated(TestRunParameters::from_init_peer_id(local_peer_id), &script) + .await .expect("invalid test AIR script"); - let result = executor.execute_all(local_peer_id).unwrap(); + let result = executor.execute_all(local_peer_id).await.unwrap(); let expected_error = CatchableError::LengthFunctorAppliedToNotArray(no_error_object()); assert!(check_error(&result.last().unwrap(), expected_error)); } #[tokio::test] -fn undefined_error_functor() { +async fn undefined_error_functor() { let local_peer_id = "local_peer_id"; let script = format!( r#" @@ -611,8 +614,9 @@ fn undefined_error_functor() { ); let executor = AirScriptExecutor::from_annotated(TestRunParameters::from_init_peer_id(local_peer_id), &script) + .await .expect("invalid test AIR script"); - let result = executor.execute_all(local_peer_id).unwrap(); + let result = executor.execute_all(local_peer_id).await.unwrap(); let error_object = json!({"error_code":10001, "instruction":"match 1 2","message":"compared values do not match"}); let expected_error = CatchableError::LengthFunctorAppliedToNotArray(error_object); @@ -620,7 +624,7 @@ fn undefined_error_functor() { } #[tokio::test] -fn undefined_error_peerid() { +async fn undefined_error_peerid() { let local_peer_id = "local_peer_id"; let script = format!( r#" @@ -634,8 +638,9 @@ fn undefined_error_peerid() { ); let executor = AirScriptExecutor::from_annotated(TestRunParameters::from_init_peer_id(local_peer_id), &script) + .await .expect("invalid test AIR script"); - let result = executor.execute_all(local_peer_id).unwrap(); + let result = executor.execute_all(local_peer_id).await.unwrap(); let value = json!({"error_code":10001, "instruction":"match 1 2", "message":"compared values do not match"}); let field_name = "peerid".into(); @@ -645,7 +650,7 @@ fn undefined_error_peerid() { } #[tokio::test] -fn undefined_last_error_instruction() { +async fn undefined_last_error_instruction() { let local_peer_id = "local_peer_id"; let script = format!( r#" @@ -659,8 +664,9 @@ fn undefined_last_error_instruction() { ); let executor = AirScriptExecutor::from_annotated(TestRunParameters::from_init_peer_id(local_peer_id), &script) + .await .expect("invalid test AIR script"); - let result = executor.execute_all(local_peer_id).unwrap(); + let result = executor.execute_all(local_peer_id).await.unwrap(); let expected_error = CatchableError::LambdaApplierError(LambdaError::ValueNotContainSuchField { value: no_error_object(), @@ -670,7 +676,7 @@ fn undefined_last_error_instruction() { } #[tokio::test] -fn undefined_last_error_peer_id() { +async fn undefined_last_error_peer_id() { let local_peer_id = "local_peer_id"; let script = format!( r#" @@ -683,8 +689,9 @@ fn undefined_last_error_peer_id() { "# ); let executor = AirScriptExecutor::from_annotated(TestRunParameters::from_init_peer_id(local_peer_id), &script) + .await .expect("invalid test AIR script"); - let result = executor.execute_all(local_peer_id).unwrap(); + let result = executor.execute_all(local_peer_id).await.unwrap(); let expected_error = CatchableError::LambdaApplierError(LambdaError::ValueNotContainSuchField { value: no_error_object(), diff --git a/air/tests/test_module/negative_tests/farewell_step.rs b/air/tests/test_module/negative_tests/farewell_step.rs index c6f49e1301..44c6cba64e 100644 --- a/air/tests/test_module/negative_tests/farewell_step.rs +++ b/air/tests/test_module/negative_tests/farewell_step.rs @@ -18,10 +18,10 @@ use air::FarewellError; use air_test_utils::prelude::*; #[tokio::test] -fn unprocessed_call_result() { +async fn unprocessed_call_result() { let air = r#"(null)"#; let client_peer_id = "some_peer_id"; - let mut client_vm = create_avm(unit_call_service(), client_peer_id); + let mut client_vm = create_avm(unit_call_service(), client_peer_id).await; let prev_data = InterpreterDataEnvelope::new(semver::Version::new(1, 1, 1)); let prev_data: Vec = prev_data.serialize().unwrap(); let call_service_result = air_test_utils::CallServiceResult::ok(json!("null")); @@ -31,6 +31,7 @@ fn unprocessed_call_result() { let result = client_vm .call_single(air, prev_data, "", client_peer_id, 0, 0, None, call_results_4_call, "") + .await .unwrap(); let expected_call_service_result = air_interpreter_interface::CallServiceResult::ok(&json!("null")); diff --git a/air/tests/test_module/negative_tests/preparation_step.rs b/air/tests/test_module/negative_tests/preparation_step.rs index f2a14eb116..f7efc37457 100644 --- a/air/tests/test_module/negative_tests/preparation_step.rs +++ b/air/tests/test_module/negative_tests/preparation_step.rs @@ -25,7 +25,7 @@ use serde::Deserialize; use serde::Serialize; #[tokio::test] -fn invalid_data_without_versions() { +async fn invalid_data_without_versions() { use air_interpreter_sede::Format; use air_interpreter_sede::Representation; @@ -35,7 +35,7 @@ fn invalid_data_without_versions() { } let vm_peer_id = "some_peer_id"; - let mut vm = create_avm(unit_call_service(), vm_peer_id); + let mut vm = create_avm(unit_call_service(), vm_peer_id).await; let script = r#"(null)"#; let invalid_data = InvalidDataStruct { trace: vec![1, 2, 3] }; @@ -52,7 +52,7 @@ fn invalid_data_without_versions() { } #[tokio::test] -fn invalid_data_with_versions() { +async fn invalid_data_with_versions() { use air_interpreter_sede::Format; use air_interpreter_sede::Representation; @@ -64,7 +64,7 @@ fn invalid_data_with_versions() { } let vm_peer_id = "some_peer_id"; - let mut vm = create_avm(unit_call_service(), vm_peer_id); + let mut vm = create_avm(unit_call_service(), vm_peer_id).await; let script = r#"(null)"#; let versions = Versions::new(semver::Version::new(1, 1, 1)); @@ -85,7 +85,7 @@ fn invalid_data_with_versions() { } #[tokio::test] -fn invalid_callresults() { +async fn invalid_callresults() { use air_interpreter_sede::Format; let air = r#"(null)"#.to_string(); diff --git a/air/tests/test_module/negative_tests/uncatchable_trace_related.rs b/air/tests/test_module/negative_tests/uncatchable_trace_related.rs index 14658fa707..c4bf54a273 100644 --- a/air/tests/test_module/negative_tests/uncatchable_trace_related.rs +++ b/air/tests/test_module/negative_tests/uncatchable_trace_related.rs @@ -36,9 +36,9 @@ use air_trace_handler::TraceHandlerError::StateFSMError; use maplit::hashmap; #[tokio::test] -fn par_len_overflow() { +async fn par_len_overflow() { let vm_peer_id_1 = "vm_peer_id_1"; - let mut peer_vm_1 = create_avm(unit_call_service(), vm_peer_id_1); + let mut peer_vm_1 = create_avm(unit_call_service(), vm_peer_id_1).await; let script = format!( r#" @@ -68,9 +68,9 @@ fn par_len_overflow() { } #[tokio::test] -fn par_pos_overflow() { +async fn par_pos_overflow() { let vm_peer_id_1 = "vm_peer_id_1"; - let mut peer_vm_1 = create_avm(unit_call_service(), vm_peer_id_1); + let mut peer_vm_1 = create_avm(unit_call_service(), vm_peer_id_1).await; let script = format!( r#" @@ -100,9 +100,9 @@ fn par_pos_overflow() { } #[tokio::test] -fn par_len_underflow() { +async fn par_len_underflow() { let vm_peer_id_1 = "vm_peer_id_1"; - let mut peer_vm_1 = create_avm(unit_call_service(), vm_peer_id_1); + let mut peer_vm_1 = create_avm(unit_call_service(), vm_peer_id_1).await; let script = format!( r#" @@ -127,10 +127,10 @@ fn par_len_underflow() { } #[tokio::test] -fn set_subtrace_len_and_pos_failed() { +async fn set_subtrace_len_and_pos_failed() { let vm_peer_id_1 = "vm_peer_id_1"; let arg = json!([42, 43]); - let mut peer_vm_1 = create_avm(set_variable_call_service(arg), vm_peer_id_1); + let mut peer_vm_1 = create_avm(set_variable_call_service(arg), vm_peer_id_1).await; let script = format!( r#" (par @@ -167,9 +167,9 @@ fn set_subtrace_len_and_pos_failed() { } #[tokio::test] -fn no_element_at_position() { +async fn no_element_at_position() { let vm_peer_id_1 = "vm_peer_id_1"; - let mut peer_vm_1 = create_avm(unit_call_service(), vm_peer_id_1); + let mut peer_vm_1 = create_avm(unit_call_service(), vm_peer_id_1).await; let script = format!( r#" (par @@ -205,10 +205,10 @@ fn no_element_at_position() { } #[tokio::test] -fn no_stream_state() { +async fn no_stream_state() { let vm_peer_id_1 = "vm_peer_id_1"; let arg = json!([42, 43]); - let mut peer_vm_1 = create_avm(set_variable_call_service(arg), vm_peer_id_1); + let mut peer_vm_1 = create_avm(set_variable_call_service(arg), vm_peer_id_1).await; let script = format!( r#" (par @@ -242,9 +242,9 @@ fn no_stream_state() { } #[tokio::test] -fn incompatible_executed_states() { +async fn incompatible_executed_states() { let vm_peer_id = "vm_peer_id"; - let mut peer_vm_1 = create_avm(echo_call_service(), vm_peer_id); + let mut peer_vm_1 = create_avm(echo_call_service(), vm_peer_id).await; let script = format!( r#" (seq @@ -274,10 +274,10 @@ fn incompatible_executed_states() { } #[tokio::test] -fn different_executed_state_expected() { +async fn different_executed_state_expected() { let vm_peer_id_1 = "vm_peer_id_1"; let arg = json!([42, 43]); - let mut peer_vm_1 = create_avm(set_variable_call_service(arg), vm_peer_id_1); + let mut peer_vm_1 = create_avm(set_variable_call_service(arg), vm_peer_id_1).await; let script = format!( r#" (seq @@ -302,9 +302,9 @@ fn different_executed_state_expected() { } #[tokio::test] -fn invalid_dst_generations() { +async fn invalid_dst_generations() { let vm_peer_id_1 = "vm_peer_id_1"; - let mut peer_vm_1 = create_avm(unit_call_service(), vm_peer_id_1); + let mut peer_vm_1 = create_avm(unit_call_service(), vm_peer_id_1).await; let script = format!( r#" (ap "a" $s) @@ -322,7 +322,7 @@ fn invalid_dst_generations() { ); let data = data_env.serialize().unwrap(); - // let result = peer_vm_1.call(script, "", data, <_>::default()).unwrap(); + // let result = peer_vm_1.call(script, "", data, <_>::default()).await.unwrap(); let result = call_vm!(peer_vm_1, <_>::default(), &script, "", data); let expected_error = UncatchableError::TraceError { trace_error: MergeError(air_trace_handler::MergeError::IncorrectApResult( @@ -336,9 +336,9 @@ fn invalid_dst_generations() { } #[tokio::test] -fn incorrect_call_result() { +async fn incorrect_call_result() { let vm_peer_id_1 = "vm_peer_id_1"; - let mut peer_vm_1 = create_avm(unit_call_service(), vm_peer_id_1); + let mut peer_vm_1 = create_avm(unit_call_service(), vm_peer_id_1).await; let script = format!( r#" (call "vm_peer_id_1" ("" "") [] v) @@ -377,10 +377,10 @@ fn incorrect_call_result() { } #[tokio::test] -fn canon_result_error() { +async fn canon_result_error() { let vm_peer_id_1 = "vm_peer_id_1"; let arg = json!([42, 43]); - let mut peer_vm_1 = create_avm(set_variable_call_service(arg.clone()), vm_peer_id_1); + let mut peer_vm_1 = create_avm(set_variable_call_service(arg.clone()), vm_peer_id_1).await; let script = format!( r#" (canon "vm_peer_id_1" $stream #canon) @@ -426,9 +426,9 @@ fn canon_result_error() { } #[tokio::test] -fn several_records_with_same_pos() { +async fn several_records_with_same_pos() { let vm_peer_id_1 = "vm_peer_id_1"; - let mut peer_vm_1 = create_avm(unit_call_service(), vm_peer_id_1); + let mut peer_vm_1 = create_avm(unit_call_service(), vm_peer_id_1).await; let script = format!( r#" (par @@ -479,10 +479,10 @@ fn several_records_with_same_pos() { } #[tokio::test] -fn values_not_equal() { +async fn values_not_equal() { let vm_peer_id_1 = "vm_peer_id_1"; let arg = json!([42, 43]); - let mut peer_vm_1 = create_avm(set_variable_call_service(arg), vm_peer_id_1); + let mut peer_vm_1 = create_avm(set_variable_call_service(arg), vm_peer_id_1).await; let script = format!( r#" (call "vm_peer_id_1" ("" "") [] $s) @@ -522,9 +522,9 @@ fn values_not_equal() { } #[tokio::test] -fn fold_pos_overflow() { +async fn fold_pos_overflow() { let vm_peer_id_1 = "vm_peer_id_1"; - let mut peer_vm_1 = create_avm(unit_call_service(), vm_peer_id_1); + let mut peer_vm_1 = create_avm(unit_call_service(), vm_peer_id_1).await; let script = format!( r#" (par @@ -572,9 +572,9 @@ fn fold_pos_overflow() { } #[tokio::test] -fn subtrace_len_overflow() { +async fn subtrace_len_overflow() { let vm_peer_id_1 = "vm_peer_id_1"; - let mut peer_vm_1 = create_avm(unit_call_service(), vm_peer_id_1); + let mut peer_vm_1 = create_avm(unit_call_service(), vm_peer_id_1).await; let script = format!( r#" (par @@ -626,9 +626,9 @@ fn subtrace_len_overflow() { } #[tokio::test] -fn fold_incorrect_subtraces_count() { +async fn fold_incorrect_subtraces_count() { let vm_peer_id_1 = "vm_peer_id_1"; - let mut peer_vm_1 = create_avm(unit_call_service(), vm_peer_id_1); + let mut peer_vm_1 = create_avm(unit_call_service(), vm_peer_id_1).await; let script = format!( r#" (par diff --git a/air/tests/test_module/negative_tests/uncatchable_trace_unrelated.rs b/air/tests/test_module/negative_tests/uncatchable_trace_unrelated.rs index 46354d0458..a4508f1f07 100644 --- a/air/tests/test_module/negative_tests/uncatchable_trace_unrelated.rs +++ b/air/tests/test_module/negative_tests/uncatchable_trace_unrelated.rs @@ -23,10 +23,10 @@ use air_test_framework::AirScriptExecutor; use air_test_utils::prelude::*; #[tokio::test] -fn fold_state_not_found() { +async fn fold_state_not_found() { let vm_peer_id_1 = "vm_peer_id_1"; let arg = json!([1, 2,]); - let mut peer_vm_1 = create_avm(set_variable_call_service(arg), vm_peer_id_1); + let mut peer_vm_1 = create_avm(set_variable_call_service(arg), vm_peer_id_1).await; let script = format!( r#" @@ -42,16 +42,16 @@ fn fold_state_not_found() { "# ); - let result = peer_vm_1.call(script, "", "", <_>::default()).unwrap(); + let result = peer_vm_1.call(script, "", "", <_>::default()).await.unwrap(); let expected_error = FoldStateNotFound(String::from("i")); assert!(check_error(&result, expected_error)); } #[tokio::test] -fn iterable_shadowing() { +async fn iterable_shadowing() { let vm_peer_id_1 = "vm_peer_id_1"; let arg = json!([1, 2,]); - let mut peer_vm_1 = create_avm(set_variable_call_service(arg), vm_peer_id_1); + let mut peer_vm_1 = create_avm(set_variable_call_service(arg), vm_peer_id_1).await; let script = format!( r#" @@ -64,16 +64,16 @@ fn iterable_shadowing() { "# ); - let result = peer_vm_1.call(script, "", "", <_>::default()).unwrap(); + let result = peer_vm_1.call(script, "", "", <_>::default()).await.unwrap(); let expected_error = IterableShadowing(String::from("i")); assert!(check_error(&result, expected_error)); } #[tokio::test] -fn call_result_not_correspond_to_instr() { +async fn call_result_not_correspond_to_instr() { let vm_peer_id_1 = "vm_peer_id_1"; let arg = json!([1, 2,]); - let mut peer_vm_1 = create_avm(set_variable_call_service(arg.clone()), vm_peer_id_1); + let mut peer_vm_1 = create_avm(set_variable_call_service(arg.clone()), vm_peer_id_1).await; let script = format!( r#" @@ -86,16 +86,16 @@ fn call_result_not_correspond_to_instr() { let cid = extract_service_result_cid(&wrong_trace[0]); let data = raw_data_from_trace(wrong_trace, <_>::default()); - let result = peer_vm_1.call(script, "", data, <_>::default()).unwrap(); + let result = peer_vm_1.call(script, "", data, <_>::default()).await.unwrap(); let value_ref = ValueRef::Scalar(cid); let expected_error = CallResultNotCorrespondToInstr(value_ref); assert!(check_error(&result, expected_error), "{:?}", result); } #[tokio::test] -fn shadowing_is_not_allowed() { +async fn shadowing_is_not_allowed() { let vm_peer_id_1 = "vm_peer_id_1"; - let mut peer_vm_1 = create_avm(unit_call_service(), vm_peer_id_1); + let mut peer_vm_1 = create_avm(unit_call_service(), vm_peer_id_1).await; let var_name = String::from("some"); let script = format!( r#" @@ -106,16 +106,16 @@ fn shadowing_is_not_allowed() { "# ); - let result = peer_vm_1.call(script, "", "", <_>::default()).unwrap(); + let result = peer_vm_1.call(script, "", "", <_>::default()).await.unwrap(); let expected_error = ShadowingIsNotAllowed(var_name); assert!(check_error(&result, expected_error)); } #[tokio::test] -fn value_for_cid_not_found() { +async fn value_for_cid_not_found() { let vm_peer_id_1 = "vm_peer_id_1"; let arg = json!([1, 2,]); - let mut peer_vm_1 = create_avm(set_variable_call_service(arg), vm_peer_id_1); + let mut peer_vm_1 = create_avm(set_variable_call_service(arg), vm_peer_id_1).await; let script = format!( r#" @@ -126,7 +126,7 @@ fn value_for_cid_not_found() { let wrong_trace = vec![scalar!(42)]; let cid = extract_service_result_cid(&wrong_trace[0]); let data = raw_data_from_trace(wrong_trace, <_>::default()); - let result = peer_vm_1.call(script, "", data, <_>::default()).unwrap(); + let result = peer_vm_1.call(script, "", data, <_>::default()).await.unwrap(); let missing_cid = cid.get_inner(); let expected_error = ValueForCidNotFound("service result aggregate", missing_cid); @@ -134,7 +134,7 @@ fn value_for_cid_not_found() { } #[tokio::test] -fn malformed_call_service_failed() { +async fn malformed_call_service_failed() { let peer_id = "init_peer_id"; let mut cid_state = ExecutionCidState::new(); @@ -158,16 +158,16 @@ fn malformed_call_service_failed() { let trace = ExecutionTrace::from(vec![ExecutedState::Call(CallResult::Failed(service_result_agg_cid))]); let data = raw_data_from_trace(trace, cid_state); - let mut vm = create_avm(unit_call_service(), peer_id); + let mut vm = create_avm(unit_call_service(), peer_id).await; let air = format!(r#"(call "{peer_id}" ("" "") [] var)"#); - let result = vm.call(&air, vec![], data, TestRunParameters::default()).unwrap(); + let result = vm.call(&air, vec![], data, TestRunParameters::default()).await.unwrap(); let expected_serde_error = serde_json::from_value::(value).unwrap_err(); let expected_error = MalformedCallServiceFailed(expected_serde_error); assert_error_eq!(&result, expected_error); } #[tokio::test] -fn recursive_stream_size_limit() { +async fn recursive_stream_size_limit() { let vm_peer_id_1 = "vm_peer_id_1"; let script = format!( @@ -184,8 +184,9 @@ fn recursive_stream_size_limit() { ); let executor = AirScriptExecutor::from_annotated(TestRunParameters::from_init_peer_id(vm_peer_id_1), &script) + .await .expect("invalid test AIR script"); - let result = executor.execute_all(vm_peer_id_1).unwrap(); + let result = executor.execute_all(vm_peer_id_1).await.unwrap(); let result = result.last().unwrap(); let expected_error = StreamSizeLimitExceeded; diff --git a/crates/air-lib/interpreter-data/src/cid_store.rs b/crates/air-lib/interpreter-data/src/cid_store.rs index 128a6989df..f5dab3b98f 100644 --- a/crates/air-lib/interpreter-data/src/cid_store.rs +++ b/crates/air-lib/interpreter-data/src/cid_store.rs @@ -188,7 +188,7 @@ mod tests { use super::*; use serde_json::json; - #[tokio::test] + #[test] fn test_iter() { let mut tracker = CidTracker::new(); tracker.track_value(json!("test")).unwrap(); @@ -230,7 +230,7 @@ mod tests { ); } - #[tokio::test] + #[test] fn test_store() { let mut tracker = CidTracker::new(); tracker.track_value(json!("test")).unwrap(); diff --git a/crates/air-lib/test-utils/src/call_services.rs b/crates/air-lib/test-utils/src/call_services.rs index 911596a0a6..1f5eec682c 100644 --- a/crates/air-lib/test-utils/src/call_services.rs +++ b/crates/air-lib/test-utils/src/call_services.rs @@ -22,16 +22,16 @@ use std::cell::RefCell; use std::collections::HashMap; use std::rc::Rc; -pub fn unit_call_service() -> CallServiceClosure { - Box::new(|_| -> CallServiceResult { +pub fn unit_call_service() -> CallServiceClosure<'_> { + Box::new(|_| async { CallServiceResult::ok(json!("result from unit_call_service")) - }) + }.boxed_local()) } -pub fn echo_call_service() -> CallServiceClosure { - Box::new(|mut params| -> CallServiceResult { +pub fn echo_call_service() -> CallServiceClosure<'_> { + Box::new(|mut params| async { CallServiceResult::ok(params.arguments.remove(0)) - }) + }.boxed_local()) } pub fn set_variable_call_service(json: JValue) -> CallServiceClosure { diff --git a/crates/air-lib/test-utils/src/executed_state.rs b/crates/air-lib/test-utils/src/executed_state.rs index 3bbf213da1..a0b684b4f6 100644 --- a/crates/air-lib/test-utils/src/executed_state.rs +++ b/crates/air-lib/test-utils/src/executed_state.rs @@ -405,7 +405,7 @@ mod tests { use air::ExecutionCidState; use serde_json::json; - #[tokio::test] + #[test] fn test_scalar() { assert_eq!(scalar!(42), scalar!(42)); assert_eq!(scalar!("test"), scalar!("test")); @@ -416,7 +416,7 @@ mod tests { ); } - #[tokio::test] + #[test] fn test_scalar_tracked() { let mut store = ExecutionCidState::new(); assert_eq!(scalar_tracked!(42, store), scalar_tracked!(42, store)); diff --git a/crates/air-lib/test-utils/src/lib.rs b/crates/air-lib/test-utils/src/lib.rs index fd47d8c7ab..99792caac4 100644 --- a/crates/air-lib/test-utils/src/lib.rs +++ b/crates/air-lib/test-utils/src/lib.rs @@ -34,12 +34,15 @@ pub mod test_runner; pub mod native_test_runner; pub mod wasm_test_runner; +use std::future::Future; pub use air::interpreter_data::*; use air::ExecutionCidState; pub use avm_interface::raw_outcome::*; pub use avm_server::*; +use futures::future::LocalBoxFuture; + pub mod prelude { pub use super::*; pub use call_services::*; @@ -49,14 +52,14 @@ pub mod prelude { pub use serde_json::json; } -pub type CallServiceClosure = Box CallServiceResult + 'static>; +pub type CallServiceClosure<'x> = Box LocalBoxFuture<'x, CallServiceResult> + 'static>; pub type JValue = serde_json::Value; #[macro_export] macro_rules! checked_call_vm { ($vm:expr, $test_run_parameters:expr, $script:expr, $prev_data:expr, $data:expr) => {{ - match $vm.call($script, $prev_data, $data, $test_run_parameters) { + match $vm.call($script, $prev_data, $data, $test_run_parameters).await { Ok(v) if v.ret_code != 0 => { panic!("VM returns a error: {} {}", v.ret_code, v.error_message) } @@ -69,7 +72,7 @@ macro_rules! checked_call_vm { #[macro_export] macro_rules! call_vm { ($vm:expr, $test_run_parameters:expr, $script:expr, $prev_data:expr, $data:expr) => { - match $vm.call($script, $prev_data, $data, $test_run_parameters) { + match $vm.call($script, $prev_data, $data, $test_run_parameters) .await{ Ok(v) => v, Err(err) => panic!("VM call failed: {}", err), } diff --git a/crates/air-lib/test-utils/src/test_runner.rs b/crates/air-lib/test-utils/src/test_runner.rs index b70f4bccd3..2e92c1fbc6 100644 --- a/crates/air-lib/test-utils/src/test_runner.rs +++ b/crates/air-lib/test-utils/src/test_runner.rs @@ -250,7 +250,7 @@ mod tests { use serde_json::json; #[tokio::test] - fn test_override_current_peer_id() { + async fn test_override_current_peer_id() { let spell_id = "spell_id"; let host_peer_id = "host_peer_id"; let script = format!(r#"(call "{spell_id}" ("service" "func") [])"#); @@ -266,7 +266,7 @@ mod tests { let mut client = create_custom_avm::( set_variables_call_service(variables, VariableOptionSource::FunctionName), host_peer_id, - ); + ).await; let current_result_1 = client .runner @@ -282,6 +282,7 @@ mod tests { &keypair, "".to_owned(), ) + .await .expect("call should be success"); assert_eq!( @@ -316,6 +317,7 @@ mod tests { &keypair2, "".to_owned(), ) + .await .expect("call should be success"); let expected_spell_call_requests = maplit::hashmap! { diff --git a/crates/beautifier/src/tests/beautifier.rs b/crates/beautifier/src/tests/beautifier.rs index 05f3af94d9..920595ca7a 100644 --- a/crates/beautifier/src/tests/beautifier.rs +++ b/crates/beautifier/src/tests/beautifier.rs @@ -26,7 +26,7 @@ use crate::{beautify_to_string, Beautifier}; -#[tokio::test] +#[test] fn ap_with_literal() { let script = r#"(ap "some_string" $stream)"#; let output = beautify_to_string(script).unwrap(); @@ -38,7 +38,7 @@ fn ap_with_literal() { ); } -#[tokio::test] +#[test] fn ap_with_number() { let script = "(ap -100 $stream)"; let output = beautify_to_string(script).unwrap(); @@ -50,7 +50,7 @@ fn ap_with_number() { ); } -#[tokio::test] +#[test] fn ap_with_bool() { let script = "(ap true $stream)"; let output = beautify_to_string(script).unwrap(); @@ -62,7 +62,7 @@ fn ap_with_bool() { ); } -#[tokio::test] +#[test] fn ap_with_last_error() { let script = "(ap %last_error%.$.message! $stream)"; let output = beautify_to_string(script).unwrap(); @@ -70,7 +70,7 @@ fn ap_with_last_error() { assert_eq!(output, "ap %last_error%.$.message $stream\n"); } -#[tokio::test] +#[test] fn ap_with_empty_array() { let script = "(ap [] $stream)"; let output = beautify_to_string(script).unwrap(); @@ -78,7 +78,7 @@ fn ap_with_empty_array() { assert_eq!(output, "ap [] $stream\n"); } -#[tokio::test] +#[test] fn ap_with_init_peer_id() { let script = "(ap %init_peer_id% $stream)"; let output = beautify_to_string(script).unwrap(); @@ -86,7 +86,7 @@ fn ap_with_init_peer_id() { assert_eq!(output, "ap %init_peer_id% $stream\n"); } -#[tokio::test] +#[test] fn ap_with_timestamp() { let script = "(ap %timestamp% $stream)"; let output = beautify_to_string(script).unwrap(); @@ -94,7 +94,7 @@ fn ap_with_timestamp() { assert_eq!(output, "ap %timestamp% $stream\n"); } -#[tokio::test] +#[test] fn ap_with_ttl() { let script = r#" (ap %ttl% $stream) @@ -104,7 +104,7 @@ fn ap_with_ttl() { assert_eq!(output, "ap %ttl% $stream\n"); } -#[tokio::test] +#[test] fn seq() { let script = "(seq (null) (null))"; let output = beautify_to_string(script).unwrap(); @@ -117,7 +117,7 @@ null ) } -#[tokio::test] +#[test] fn seq_nested_pre() { let script = "(seq (seq (null) (null)) (null))"; let output = beautify_to_string(script).unwrap(); @@ -131,7 +131,7 @@ null ); } -#[tokio::test] +#[test] fn seq_nested_post() { let script = "(seq (null) (seq (null) (null)))"; let output = beautify_to_string(script).unwrap(); @@ -145,7 +145,7 @@ null ); } -#[tokio::test] +#[test] fn par() { let script = "(par (null) (null))"; let output = beautify_to_string(script).unwrap(); @@ -160,7 +160,7 @@ fn par() { ); } -#[tokio::test] +#[test] fn match_() { let script = r#"(seq (seq @@ -179,7 +179,7 @@ match a b: ); } -#[tokio::test] +#[test] fn mismatch() { let script = r#"(seq (seq @@ -198,7 +198,7 @@ mismatch a b: ); } -#[tokio::test] +#[test] fn fail_last_error() { let script = "(fail %last_error%)"; let output = beautify_to_string(script).unwrap(); @@ -206,7 +206,7 @@ fn fail_last_error() { assert_eq!(output, "fail %last_error%\n"); } -#[tokio::test] +#[test] fn fail_expr() { let script = "(fail var)"; let output = beautify_to_string(script).unwrap(); @@ -214,7 +214,7 @@ fn fail_expr() { assert_eq!(output, "fail var\n"); } -#[tokio::test] +#[test] fn fail_common() { let script = r#"(fail 123 "Message")"#; let output = beautify_to_string(script).unwrap(); @@ -226,7 +226,7 @@ fn fail_common() { ); } -#[tokio::test] +#[test] fn fold_scalar() { let script = r#"(seq (call "it" ("" "") [] var) (fold var i (null)))"#; let output = beautify_to_string(script).unwrap(); @@ -240,7 +240,7 @@ fold var i: ); } -#[tokio::test] +#[test] fn fold_scalar_with_last_instruction() { let script = r#"(seq (call "it" ("" "") [] var) (fold var i (null) (never)))"#; let output = beautify_to_string(script).unwrap(); @@ -256,7 +256,7 @@ last: ); } -#[tokio::test] +#[test] fn fold_stream() { let script = r#"(seq (call "it" ("" "") [] $var) (fold $var i (null)))"#; let output = beautify_to_string(script).unwrap(); @@ -270,7 +270,7 @@ fold $var i: ); } -#[tokio::test] +#[test] fn fold_stream_with_last_instruction() { let script = r#"(seq (call "it" ("" "") [] $var) (fold $var i (never) (null)))"#; let output = beautify_to_string(script).unwrap(); @@ -286,7 +286,7 @@ last: ); } -#[tokio::test] +#[test] fn call_var() { let script = "(call \"{0}\" (\"a\" \"b\") [\"stream_1\" \"stream_2\"] streamvar)"; let output = beautify_to_string(script).unwrap(); @@ -297,7 +297,7 @@ fn call_var() { ); } -#[tokio::test] +#[test] fn call_novar() { let script = r#"(call "{0}" ("a" "b") ["stream_1" "stream_2"])"#; let output = beautify_to_string(script).unwrap(); @@ -309,7 +309,7 @@ fn call_novar() { ); } -#[tokio::test] +#[test] fn call_noargs() { let script = r#"(call "{0}" ("a" "b") [])"#; let output = beautify_to_string(script).unwrap(); @@ -321,7 +321,7 @@ fn call_noargs() { ); } -#[tokio::test] +#[test] fn next() { let script = r#"(seq (call "{0}" ("a" "b") ["stream_1"] j) (fold j i (next i)))"#; let output = beautify_to_string(script).unwrap(); @@ -335,7 +335,7 @@ fold j i: ); } -#[tokio::test] +#[test] fn new() { let script = "(new var (seq (null) (null)))"; let output = beautify_to_string(script).unwrap(); @@ -349,7 +349,7 @@ fn new() { ); } -#[tokio::test] +#[test] fn null() { let script = "(null)"; let output = beautify_to_string(script).unwrap(); @@ -357,7 +357,7 @@ fn null() { assert_eq!(output, "null\n"); } -#[tokio::test] +#[test] fn custom_indent_step() { let mut output = vec![]; let mut beautifier = Beautifier::new_with_indent(&mut output, 2); @@ -374,7 +374,7 @@ fn custom_indent_step() { ); } -#[tokio::test] +#[test] fn deeply_nested() { let script = include_str!("deeply_nested.air"); let output = beautify_to_string(script).unwrap(); @@ -382,7 +382,7 @@ fn deeply_nested() { assert_eq!(output, expected); } -#[tokio::test] +#[test] fn fail_error() { let script = r#"(fail :error:)"#; let output = beautify_to_string(script).unwrap(); diff --git a/crates/beautifier/src/tests/mod.rs b/crates/beautifier/src/tests/mod.rs index 9d59e6001c..ddf145c23b 100644 --- a/crates/beautifier/src/tests/mod.rs +++ b/crates/beautifier/src/tests/mod.rs @@ -28,7 +28,7 @@ mod beautifier; use crate::{beautify, beautify_to_string, BeautifyError}; -#[tokio::test] +#[test] fn beautify_valid() { let air_script = "(seq (null) (null))"; let mut buffer = vec![]; @@ -37,7 +37,7 @@ fn beautify_valid() { assert_eq!(std::str::from_utf8(&buffer).unwrap(), "null\nnull\n"); } -#[tokio::test] +#[test] fn beautify_invalid() { let air_script = "(seq (null))"; let mut buffer = vec![]; @@ -45,14 +45,14 @@ fn beautify_invalid() { assert!(matches!(res, Err(BeautifyError::Parse(_)))); } -#[tokio::test] +#[test] fn beautify_to_string_valid() { let air_script = "(seq (null) (null))"; let res = beautify_to_string(air_script).unwrap(); assert_eq!(res, "null\nnull\n"); } -#[tokio::test] +#[test] fn beautify_to_string_invalid() { let air_script = "(seq (null))"; let res = beautify_to_string(air_script); diff --git a/crates/testing-framework/Cargo.toml b/crates/testing-framework/Cargo.toml index fbc8259a36..da597b4ca1 100644 --- a/crates/testing-framework/Cargo.toml +++ b/crates/testing-framework/Cargo.toml @@ -25,6 +25,9 @@ nom_locate = "4.1.0" serde_json = "1.0.108" regex = "1.10.2" air-interpreter-signatures = { version = "0.1.7", path = "../air-lib/interpreter-signatures" } +tokio = {version = "1.35.1", features = ["rt", "macros"]} +futures = "0.3.30" +async-recursion = "1.0.5" [dev-dependencies] maplit = "1.0.2" diff --git a/crates/testing-framework/src/asserts/behavior.rs b/crates/testing-framework/src/asserts/behavior.rs index fb90837e49..bf104dcc8e 100644 --- a/crates/testing-framework/src/asserts/behavior.rs +++ b/crates/testing-framework/src/asserts/behavior.rs @@ -86,7 +86,7 @@ impl Behavior { mod tests { use super::*; - #[tokio::test] + #[test] fn test_parse_behavior_echo() { let res = parse_behaviour("echo"); assert_eq!( @@ -97,31 +97,31 @@ mod tests { ); } - #[tokio::test] + #[test] fn test_parse_behavior_unit() { let res = parse_behaviour("unit"); assert_eq!(res, Ok(("", Behavior::Unit))); } - #[tokio::test] + #[test] fn test_parse_behavior_service() { let res = parse_behaviour("service"); assert_eq!(res, Ok(("", Behavior::Service))); } - #[tokio::test] + #[test] fn test_parse_behavior_function() { let res = parse_behaviour("function"); assert_eq!(res, Ok(("", Behavior::Function))); } - #[tokio::test] + #[test] fn test_parse_behavior_arg() { let res = parse_behaviour("arg.42"); assert_eq!(res, Ok(("", Behavior::Arg(42)))); } - #[tokio::test] + #[test] fn test_parse_behavior_tetraplet() { let res = parse_behaviour("tetraplet"); assert_eq!(res, Ok(("", Behavior::Tetraplet))); diff --git a/crates/testing-framework/src/asserts/parser.rs b/crates/testing-framework/src/asserts/parser.rs index 08d7a6bbb3..6b170db14b 100644 --- a/crates/testing-framework/src/asserts/parser.rs +++ b/crates/testing-framework/src/asserts/parser.rs @@ -119,19 +119,19 @@ mod tests { use pretty_assertions::assert_eq; use serde_json::json; - #[tokio::test] + #[test] fn test_parse_empty() { let res = ServiceDefinition::from_str(""); assert!(res.is_err()); } - #[tokio::test] + #[test] fn test_parse_garbage0() { let res = ServiceDefinition::from_str("garbage"); assert!(res.is_err(), "{}", "{res:?}"); } - #[tokio::test] + #[test] fn test_result_service() { use serde_json::json; @@ -142,13 +142,13 @@ mod tests { ); } - #[tokio::test] + #[test] fn test_result_service_malformed() { let res = ServiceDefinition::from_str(r#"ok={"this":["is","value"]"#); assert!(res.is_err()); } - #[tokio::test] + #[test] fn test_call_result() { use serde_json::json; @@ -161,19 +161,19 @@ mod tests { ); } - #[tokio::test] + #[test] fn test_call_result_malformed() { let res = ServiceDefinition::from_str(r#"err={"retcode": 0, "result": [1, 2, 3]}"#); assert!(res.is_err()); } - #[tokio::test] + #[test] fn test_call_result_invalid() { let res = ServiceDefinition::from_str(r#"err={"ret_code": 0, "result": 1, 2, 3]}"#); assert!(res.is_err()); } - #[tokio::test] + #[test] fn test_seq_ok() { use serde_json::json; @@ -188,20 +188,20 @@ mod tests { ); } - #[tokio::test] + #[test] fn test_seq_ok_malformed() { let res = ServiceDefinition::from_str(r#"seq_ok={"default": 42, "1": true, "3": ]}"#); assert!(res.is_err()); } - #[tokio::test] + #[test] fn test_seq_ok_invalid() { // TODO perhaps, we should support both arrays and maps let res = ServiceDefinition::from_str(r#"seq_ok=[42, 43]"#); assert!(res.is_err()); } - #[tokio::test] + #[test] fn test_seq_error() { use serde_json::json; @@ -218,32 +218,32 @@ mod tests { ); } - #[tokio::test] + #[test] fn test_seq_error_malformed() { let res = ServiceDefinition::from_str(r#"seq_error={"default": 42, "1": true]}"#); assert!(res.is_err()); } - #[tokio::test] + #[test] fn test_seq_error_invalid() { // TODO perhaps, we should support both arrays and maps let res = ServiceDefinition::from_str(r#"seq_error=[42, 43]"#); assert!(res.is_err()); } - #[tokio::test] + #[test] fn test_behaviour() { let res = ServiceDefinition::from_str(r#"behaviour=echo"#); assert_eq!(res, Ok(ServiceDefinition::Behaviour(Behavior::Echo)),); } - #[tokio::test] + #[test] fn test_dbg_behaviour() { let res = ServiceDefinition::from_str(r#"dbg_behaviour=echo"#); assert_eq!(res, Ok(ServiceDefinition::DbgBehaviour(Behavior::Echo)),); } - #[tokio::test] + #[test] fn test_map() { let res = ServiceDefinition::from_str(r#"map = {"42": [], "a": 2}"#); assert_eq!( @@ -255,7 +255,7 @@ mod tests { ); } - #[tokio::test] + #[test] fn test_composable() { use nom::bytes::complete::tag; use nom::multi::separated_list1; diff --git a/crates/testing-framework/src/ephemeral/mod.rs b/crates/testing-framework/src/ephemeral/mod.rs index 9b06ed5c5d..2bc377cac3 100644 --- a/crates/testing-framework/src/ephemeral/mod.rs +++ b/crates/testing-framework/src/ephemeral/mod.rs @@ -86,10 +86,10 @@ pub struct Peer { } impl Peer { - pub fn new(keypair: impl Into, services: Rc<[MarineServiceHandle]>) -> Self { + pub async fn new(keypair: impl Into, services: Rc<[MarineServiceHandle]>) -> Self { let call_service = services_to_call_service_closure(services); - let runner = create_avm_with_key::(keypair, call_service); + let runner = create_avm_with_key::(keypair, call_service).await; let peer_id = runner.runner.get_current_peer_id().into(); Self { peer_id, runner } @@ -99,7 +99,7 @@ impl Peer { &self.peer_id } - pub(crate) fn invoke( + pub(crate) async fn invoke( &mut self, air: impl Into, data: Data, @@ -107,7 +107,7 @@ impl Peer { queue_cell: &PeerQueueCell, ) -> Result { let prev_data = queue_cell.take_prev_data(); - let res = self.runner.call(air, prev_data, data, test_run_params); + let res = self.runner.call(air, prev_data, data, test_run_params).await; if let Ok(outcome) = &res { queue_cell.set_prev_data(outcome.data.clone()); } @@ -183,7 +183,7 @@ impl Network { self.insert_peer_env_entry(peer_id, peer_env); } - pub fn ensure_named_peer(self: &Rc, name: impl Into) -> PeerId { + pub async fn ensure_named_peer(self: &Rc, name: impl Into) -> PeerId { use std::collections::hash_map::Entry; let name = name.into(); @@ -192,7 +192,7 @@ impl Network { Entry::Occupied(entry) => entry.get().clone(), Entry::Vacant(empty) => { let (keypair, _) = derive_dummy_keypair(&name); - let peer = Peer::new(keypair, self.services.get_services()); + let peer = Peer::new(keypair, self.services.get_services()).await; let peer_id = peer.get_peer_id().clone(); self.add_peer(peer); diff --git a/crates/testing-framework/src/ephemeral/neighborhood.rs b/crates/testing-framework/src/ephemeral/neighborhood.rs index 9ca3ff94b6..8261a5db40 100644 --- a/crates/testing-framework/src/ephemeral/neighborhood.rs +++ b/crates/testing-framework/src/ephemeral/neighborhood.rs @@ -188,7 +188,7 @@ impl PeerEnv { self.neighborhood.iter() } - pub(crate) fn execute_once( + pub(crate) async fn execute_once( &mut self, air: impl Into, network: &Network, @@ -199,17 +199,20 @@ impl PeerEnv { let queue_cell = queue.get_peer_queue_cell(self.peer.peer_id.clone()); let maybe_data = queue_cell.pop_data(); - maybe_data.map(|data| { + let maybe_data: futures::future::OptionFuture<_> = maybe_data.map(|data| async { let res = self .peer - .invoke(air, data, test_parameters.clone(), &queue_cell); + .invoke(air, data, test_parameters.clone(), &queue_cell) + .await; if let Ok(outcome) = &res { queue.distribute_to_peers(network, &outcome.next_peer_pks, &outcome.data) } res - }) + }).into(); + + maybe_data.await } pub fn get_peer(&self) -> &Peer { @@ -236,7 +239,7 @@ mod tests { use std::{iter::FromIterator, rc::Rc}; #[tokio::test] - fn test_empty_neighborhood() { + async fn test_empty_neighborhood() { let peer_name = "someone"; let other_name = "other1"; let (peer_pk, peer_id) = derive_dummy_keypair(peer_name); @@ -245,13 +248,13 @@ mod tests { let other_id = PeerId::from(other_id); let network = Network::::new(std::iter::empty::(), vec![]); - let penv = PeerEnv::new(Peer::new(peer_pk, Rc::from(vec![])), &network); + let penv = PeerEnv::new(Peer::new(peer_pk, Rc::from(vec![])).await, &network); assert!(penv.is_reachable(&peer_id)); assert!(!penv.is_reachable(&other_id)); } #[tokio::test] - fn test_no_self_disconnect() { + async fn test_no_self_disconnect() { let peer_name = "someone"; let other_name = "other1"; let (peer_pk, peer_id) = derive_dummy_keypair(peer_name); @@ -260,7 +263,7 @@ mod tests { let other_id = PeerId::from(other_id); let network = Network::::new(std::iter::empty::(), vec![]); - let mut penv = PeerEnv::new(Peer::new(peer_pk, Rc::from(vec![])), &network); + let mut penv = PeerEnv::new(Peer::new(peer_pk, Rc::from(vec![])).await, &network); { let nei = penv.get_neighborhood_mut(); @@ -277,7 +280,7 @@ mod tests { } #[tokio::test] - fn test_set_neighborhood() { + async fn test_set_neighborhood() { let peer_name = "someone"; let other_name1 = "other1"; let other_name2 = "other2"; @@ -288,7 +291,7 @@ mod tests { let other_id2 = PeerId::from(other_id2); let network = Network::::new(std::iter::empty::(), vec![]); - let penv = PeerEnv::new(Peer::new(peer_pk, Rc::from(vec![])), &network); + let penv = PeerEnv::new(Peer::new(peer_pk, Rc::from(vec![])).await, &network); // iter is empty assert!(penv.iter().next().is_none()); @@ -300,7 +303,7 @@ mod tests { } #[tokio::test] - fn test_insert() { + async fn test_insert() { let peer_name = "someone"; let other_name1 = "other1"; let other_name2 = "other2"; @@ -311,7 +314,7 @@ mod tests { let other_id2 = PeerId::from(other_id2); let network = Network::::new(std::iter::empty::(), vec![]); - let penv = PeerEnv::new(Peer::new(peer_pk, Rc::from(vec![])), &network); + let penv = PeerEnv::new(Peer::new(peer_pk, Rc::from(vec![])).await, &network); // iter is empty assert!(penv.iter().next().is_none()); @@ -323,7 +326,7 @@ mod tests { } #[tokio::test] - fn test_ensure() { + async fn test_ensure() { let peer_name = "someone"; let other_name1 = "other1"; let other_name2 = "other2"; @@ -334,7 +337,7 @@ mod tests { let other_id2 = PeerId::from(other_id2); let network = Network::::new(std::iter::empty::(), vec![]); - let mut penv = PeerEnv::new(Peer::new(peer_pk, Rc::from(vec![])), &network); + let mut penv = PeerEnv::new(Peer::new(peer_pk, Rc::from(vec![])).await, &network); // iter is empty assert!(penv.iter().next().is_none()); @@ -347,7 +350,7 @@ mod tests { } #[tokio::test] - fn test_insert_insert() { + async fn test_insert_insert() { let peer_name = "someone"; let other_name1 = "other1"; let (peer_pk, _peer_id) = derive_dummy_keypair(peer_name); @@ -355,7 +358,7 @@ mod tests { let other_id1 = PeerId::from(other_id1); let network = Network::::new(std::iter::empty::(), vec![]); - let mut penv = PeerEnv::new(Peer::new(peer_pk, Rc::from(vec![])), &network); + let mut penv = PeerEnv::new(Peer::new(peer_pk, Rc::from(vec![])).await, &network); // iter is empty assert!(penv.iter().next().is_none()); @@ -369,13 +372,13 @@ mod tests { } #[tokio::test] - fn test_extend_neighborhood() { + async fn test_extend_neighborhood() { let peer_name = "peer"; let (peer_pk, _peer_id) = derive_dummy_keypair(peer_name); let network = Network::::new(std::iter::empty::(), vec![]); - let mut penv = PeerEnv::new(Peer::new(peer_pk, Rc::from(vec![])), &network); + let mut penv = PeerEnv::new(Peer::new(peer_pk, Rc::from(vec![])).await, &network); penv.get_neighborhood_mut() .alter(PeerId::from("zero"), AlterState::Added); penv.extend_neighborhood(IntoIterator::into_iter(["one", "two"])); @@ -387,11 +390,11 @@ mod tests { } #[tokio::test] - fn test_remove_from_neiborhood() { + async fn test_remove_from_neiborhood() { let network = Network::::new(std::iter::empty::(), vec![]); let (peer_pk, _peer_id) = derive_dummy_keypair("someone"); - let mut penv = PeerEnv::new(Peer::new(peer_pk, Rc::from(vec![])), &network); + let mut penv = PeerEnv::new(Peer::new(peer_pk, Rc::from(vec![])).await, &network); penv.get_neighborhood_mut() .alter(PeerId::from("zero"), AlterState::Added); penv.extend_neighborhood(IntoIterator::into_iter(["one", "two"])); @@ -405,14 +408,14 @@ mod tests { ); } #[tokio::test] - fn test_fail() { + async fn test_fail() { let peer_name = "someone"; let other_name1 = "other1"; let (peer_pk, _peer_id) = derive_dummy_keypair(peer_name); let (_other_pk, other_id) = derive_dummy_keypair(other_name1); let other_id = PeerId::from(other_id); let network = Network::::new(std::iter::empty::(), vec![]); - let mut penv = PeerEnv::new(Peer::new(peer_pk, Rc::from(vec![])), &network); + let mut penv = PeerEnv::new(Peer::new(peer_pk, Rc::from(vec![])).await, &network); let nei = penv.get_neighborhood_mut(); nei.alter(other_id.clone(), AlterState::Added); @@ -424,7 +427,7 @@ mod tests { } #[tokio::test] - fn test_fail_remove() { + async fn test_fail_remove() { let peer_name = "someone"; let other_name1 = "other1"; let (peer_pk, _peer_id) = derive_dummy_keypair(peer_name); @@ -432,7 +435,7 @@ mod tests { let other_id = PeerId::from(other_id); let network = Network::::new(std::iter::empty::(), vec![]); - let mut penv = PeerEnv::new(Peer::new(peer_pk, Rc::from(vec![])), &network); + let mut penv = PeerEnv::new(Peer::new(peer_pk, Rc::from(vec![])).await, &network); let nei = penv.get_neighborhood_mut(); nei.alter(other_id.clone(), AlterState::Added); @@ -449,14 +452,14 @@ mod tests { } #[tokio::test] - fn test_fail_unfail() { + async fn test_fail_unfail() { let peer_name = "someone"; let other_name1 = "other1"; let (peer_pk, _peer_id) = derive_dummy_keypair(peer_name); let (_other_pk, other_id) = derive_dummy_keypair(other_name1); let other_id = PeerId::from(other_id); let network = Network::::new(std::iter::empty::(), vec![]); - let mut penv = PeerEnv::new(Peer::new(peer_pk, Rc::from(vec![])), &network); + let mut penv = PeerEnv::new(Peer::new(peer_pk, Rc::from(vec![])).await, &network); let nei = penv.get_neighborhood_mut(); nei.alter(other_id.clone(), AlterState::Added); @@ -469,7 +472,7 @@ mod tests { } #[tokio::test] - fn test_failed() { + async fn test_failed() { let peer_name = "someone"; let other_name = "other1"; let remote_name = "remote"; @@ -481,7 +484,7 @@ mod tests { let remote_id = PeerId::from(remote_id); let network = Network::::new(std::iter::empty::(), vec![]); - let mut penv = PeerEnv::new(Peer::new(peer_pk, Rc::from(vec![])), &network); + let mut penv = PeerEnv::new(Peer::new(peer_pk, Rc::from(vec![])).await, &network); penv.get_neighborhood_mut() .alter(other_id.clone(), AlterState::Added); diff --git a/crates/testing-framework/src/execution/mod.rs b/crates/testing-framework/src/execution/mod.rs index 2c9bbf1802..55d32efa0f 100644 --- a/crates/testing-framework/src/execution/mod.rs +++ b/crates/testing-framework/src/execution/mod.rs @@ -26,6 +26,9 @@ use air_test_utils::{ RawAVMOutcome, }; +use futures::stream::StreamExt; +use futures::future::OptionFuture; + use std::{borrow::Borrow, hash::Hash, rc::Rc}; /// A executor for an AIR script. Several executors may share same TransformedAirScript @@ -41,7 +44,7 @@ pub struct AirScriptExecutor { // extencive test code changes impl AirScriptExecutor { /// Simple constructor where everything is generated from the annotated_air_script. - pub fn from_annotated( + pub async fn from_annotated( test_parameters: TestRunParameters, annotated_air_script: &str, ) -> Result { @@ -50,18 +53,18 @@ impl AirScriptExecutor { vec![], std::iter::empty(), annotated_air_script, - ) + ).await } } impl AirScriptExecutor { - pub fn from_transformed_air_script( + pub async fn from_transformed_air_script( mut test_parameters: TestRunParameters, transformed_air_script: TransformedAirScript, ) -> Result { let network = transformed_air_script.get_network(); let init_peer_id = test_parameters.init_peer_id.clone(); - let real_init_peer_id = network.ensure_named_peer(init_peer_id.as_str()); + let real_init_peer_id = network.ensure_named_peer(init_peer_id.as_str()).await; test_parameters.init_peer_id = real_init_peer_id.to_string(); let queue = ExecutionQueue::new(); @@ -79,7 +82,7 @@ impl AirScriptExecutor { /// /// `extra_peers` allows you to define peers that are not mentioned in the annotated script /// explicitly, but are used, e.g. if their names are returned from a call. - pub fn new( + pub async fn new( test_parameters: TestRunParameters, common_services: Vec, extra_peers: impl IntoIterator, @@ -88,17 +91,17 @@ impl AirScriptExecutor { let network = Network::new(extra_peers.into_iter(), common_services); let transformed = TransformedAirScript::new(annotated_air_script, network)?; - Self::from_transformed_air_script(test_parameters, transformed) + Self::from_transformed_air_script(test_parameters, transformed).await } - pub fn from_network( + pub async fn from_network( test_parameters: TestRunParameters, network: Rc>, annotated_air_script: &str, ) -> Result { let transformed = TransformedAirScript::new(annotated_air_script, network)?; - Self::from_transformed_air_script(test_parameters, transformed) + Self::from_transformed_air_script(test_parameters, transformed).await } /// Return Iterator for handling all the queued datas @@ -106,7 +109,7 @@ impl AirScriptExecutor { pub fn execution_iter<'s, Id>( &'s self, peer_id: &Id, - ) -> Option + 's> + ) -> Option + 's> where PeerId: Borrow + for<'a> From<&'a Id>, Id: Eq + Hash + ?Sized, @@ -120,22 +123,26 @@ impl AirScriptExecutor { } /// Process all queued datas, panicing on error. - pub fn execute_all(&self, peer_id: &Id) -> Option> + pub async fn execute_all(&self, peer_id: &Id) -> Option> where PeerId: Borrow + for<'a> From<&'a Id>, Id: Eq + Hash + ?Sized, { - self.execution_iter(peer_id).map(|it| it.collect()) + let exec_iter: OptionFuture<_> = self + .execution_iter(peer_id) + .map(|it| it.collect()) + .into(); + exec_iter.await } /// Process one queued data, panicing if it is unavalable or on error. - pub fn execute_one(&self, peer_id: &Id) -> Option + pub async fn execute_one(&self, peer_id: &Id) -> Option where PeerId: Borrow + for<'a> From<&'a Id>, Id: Eq + Hash + ?Sized, { - self.execution_iter(peer_id) - .map(|mut it| it.next().expect("Nothing to execute")) + let mut it = self.execution_iter(peer_id)?; + it.next().await } /// Push data into peer's queue. @@ -173,7 +180,7 @@ mod tests { use std::cell::RefCell; #[tokio::test] - fn test_execution() { + async fn test_execution() { let peer1_name = "peer1"; let peer2_name = "peer2"; let init_peer_name = "init_peer_id"; @@ -190,29 +197,30 @@ mod tests { "# ), ) + .await .unwrap(); let peer1_id = exec.resolve_name(peer1_name).to_string(); - let result_init: Vec<_> = exec.execution_iter(init_peer_name).unwrap().collect(); + let result_init: Vec<_> = exec.execution_iter(init_peer_name).unwrap().collect().await; assert_eq!(result_init.len(), 1); let outcome = &result_init[0]; assert_eq!(outcome.next_peer_pks, vec![peer1_id.clone()]); - assert!(exec.execution_iter(peer2_name).unwrap().next().is_none()); - let results1: Vec<_> = exec.execution_iter(peer1_name).unwrap().collect(); + assert!(exec.execution_iter(peer2_name).unwrap().next().await.is_none()); + let results1: Vec<_> = exec.execution_iter(peer1_name).unwrap().collect().await; assert_eq!(results1.len(), 1); let outcome1 = &results1[0]; assert_eq!(outcome1.ret_code, 0); - assert!(exec.execution_iter(peer1_name).unwrap().next().is_none()); + assert!(exec.execution_iter(peer1_name).unwrap().next().await.is_none()); - let outcome2 = exec.execute_one(peer2_name).unwrap(); + let outcome2 = exec.execute_one(peer2_name).await.unwrap(); assert_eq!(outcome2.ret_code, 0); } #[tokio::test] - fn test_call_result_success() { + async fn test_call_result_success() { let exec = AirScriptExecutor::::new( TestRunParameters::from_init_peer_id("init_peer_id"), vec![], @@ -223,25 +231,26 @@ mod tests { ) "#, ) + .await .unwrap(); - let result_init: Vec<_> = exec.execution_iter("init_peer_id").unwrap().collect(); + let result_init: Vec<_> = exec.execution_iter("init_peer_id").unwrap().collect().await; assert_eq!(result_init.len(), 1); let outcome1 = &result_init[0]; assert_eq!(outcome1.ret_code, 0); assert_eq!(outcome1.error_message, ""); - assert!(exec.execution_iter("peer2").unwrap().next().is_none()); - let results1: Vec<_> = exec.execution_iter("peer1").unwrap().collect(); + assert!(exec.execution_iter("peer2").unwrap().next().await.is_none()); + let results1: Vec<_> = exec.execution_iter("peer1").unwrap().collect().await; assert_eq!(results1.len(), 1); let outcome1 = &results1[0]; assert_eq!(outcome1.ret_code, 0, "{:?}", outcome1); - assert!(exec.execution_iter("peer1").unwrap().next().is_none()); + assert!(exec.execution_iter("peer1").unwrap().next().await.is_none()); } #[tokio::test] - fn test_call_result_error() { + async fn test_call_result_error() { let script = r#" (seq (call "peer1" ("service" "func") [] arg) ; err = {"ret_code":12,"result":"ERROR MESSAGE"} @@ -254,17 +263,18 @@ mod tests { std::iter::empty(), script, ) + .await .unwrap(); - let result_init: Vec<_> = exec.execution_iter("init_peer_id").unwrap().collect(); + let result_init: Vec<_> = exec.execution_iter("init_peer_id").unwrap().collect().await; assert_eq!(result_init.len(), 1); let outcome1 = &result_init[0]; assert_eq!(outcome1.ret_code, 0); assert_eq!(outcome1.error_message, ""); - assert!(exec.execution_iter("peer2").unwrap().next().is_none()); - let results1: Vec<_> = exec.execution_iter("peer1").unwrap().collect(); + assert!(exec.execution_iter("peer2").unwrap().next().await.is_none()); + let results1: Vec<_> = exec.execution_iter("peer1").unwrap().collect().await; assert_eq!(results1.len(), 1); let outcome1 = &results1[0]; assert_eq!(outcome1.ret_code, 10000, "{:?}", outcome1); @@ -274,14 +284,14 @@ mod tests { "{:?}", outcome1 ); - assert!(exec.execution_iter("peer1").unwrap().next().is_none()); + assert!(exec.execution_iter("peer1").unwrap().next().await.is_none()); - let results2: Vec<_> = exec.execution_iter("peer2").unwrap().collect(); + let results2: Vec<_> = exec.execution_iter("peer2").unwrap().collect().await; assert_eq!(results2.len(), 0); } #[tokio::test] - fn test_seq_ok() { + async fn test_seq_ok() { let init_peer_name = "init_peer_id"; let peer1_name = "peer1"; let peer2_name = "peer2"; @@ -305,31 +315,32 @@ mod tests { (call "init_peer_id" ("a" "b") []) ; ok = 0 )"#), ) + .await .unwrap(); - let result_init: Vec<_> = exec.execution_iter(init_peer_name).unwrap().collect(); + let result_init: Vec<_> = exec.execution_iter(init_peer_name).unwrap().collect().await; assert_eq!(result_init.len(), 1); let outcome1 = &result_init[0]; assert_eq!(outcome1.ret_code, 0); assert_eq!(outcome1.error_message, ""); - assert!(exec.execution_iter(peer2_name).unwrap().next().is_none()); + assert!(exec.execution_iter(peer2_name).unwrap().next().await.is_none()); { - let results1 = exec.execute_all(peer1_name).unwrap(); + let results1 = exec.execute_all(peer1_name).await.unwrap(); assert_eq!(results1.len(), 1); let outcome1 = &results1[0]; assert_eq!(outcome1.ret_code, 0, "{:?}", outcome1); - assert!(exec.execution_iter(peer1_name).unwrap().next().is_none()); + assert!(exec.execution_iter(peer1_name).unwrap().next().await.is_none()); assert_next_pks!(&outcome1.next_peer_pks, [peer2_id.as_str()]); } { - let results2: Vec<_> = exec.execute_all(peer2_name).unwrap(); + let results2: Vec<_> = exec.execute_all(peer2_name).await.unwrap(); assert_eq!(results2.len(), 1); let outcome2 = &results2[0]; assert_eq!(outcome2.ret_code, 0, "{:?}", outcome2); - assert!(exec.execution_iter(peer2_name).unwrap().next().is_none()); + assert!(exec.execution_iter(peer2_name).unwrap().next().await.is_none()); assert_next_pks!(&outcome2.next_peer_pks, [peer3_id.as_str()]); let trace = trace_from_result(outcome2); @@ -355,11 +366,11 @@ mod tests { } { - let results3: Vec<_> = exec.execute_all(peer3_name).unwrap(); + let results3: Vec<_> = exec.execute_all(peer3_name).await.unwrap(); assert_eq!(results3.len(), 1); let outcome3 = &results3[0]; assert_eq!(outcome3.ret_code, 0, "{:?}", outcome3); - assert!(exec.execution_iter(peer3_name).unwrap().next().is_none()); + assert!(exec.execution_iter(peer3_name).unwrap().next().await.is_none()); let trace = trace_from_result(outcome3); assert_eq!( @@ -385,7 +396,7 @@ mod tests { } #[tokio::test] - fn test_map() { + async fn test_map() { let peer1_name = "peer1"; let peer2_name = "peer2"; let peer3_name = "peer3"; @@ -408,9 +419,10 @@ mod tests { "# ), ) + .await .unwrap(); - let result_init: Vec<_> = exec.execution_iter("peer1").unwrap().collect(); + let result_init: Vec<_> = exec.execution_iter("peer1").unwrap().collect().await; assert_eq!(result_init.len(), 1); let outcome1 = &result_init[0]; @@ -419,16 +431,16 @@ mod tests { assert_next_pks!(&outcome1.next_peer_pks, [peer2_id.as_str()]); { - let results2 = exec.execute_all("peer2").unwrap(); + let results2 = exec.execute_all("peer2").await.unwrap(); assert_eq!(results2.len(), 1); let outcome2 = &results2[0]; assert_eq!(outcome2.ret_code, 0, "{:?}", outcome2); - assert!(exec.execution_iter("peer2").unwrap().next().is_none()); + assert!(exec.execution_iter("peer2").unwrap().next().await.is_none()); assert_next_pks!(&outcome2.next_peer_pks, [peer3_id.as_str()]); } { - let results3 = exec.execute_all("peer3").unwrap(); + let results3 = exec.execute_all("peer3").await.unwrap(); assert_eq!(results3.len(), 1); let outcome3 = &results3[0]; assert_eq!(outcome3.ret_code, 0, "{:?}", outcome3); @@ -463,7 +475,7 @@ mod tests { #[tokio::test] #[should_panic] - fn test_map_no_arg() { + async fn test_map_no_arg() { let peer1_name = "peer1"; let exec = AirScriptExecutor::::new( @@ -476,12 +488,13 @@ mod tests { "# ), ) + .await .unwrap(); - let _result_init: Vec<_> = exec.execution_iter(peer1_name).unwrap().collect(); + let _result_init: Vec<_> = exec.execution_iter(peer1_name).unwrap().collect().await; } #[tokio::test] - fn test_seq_error() { + async fn test_seq_error() { let init_peer_name = "init_peer_id"; let peer1_name = "peer1"; let peer2_name = "peer2"; @@ -507,31 +520,32 @@ mod tests { (call "init_peer_id" ("a" "b") []) ; ok = 0 )"#), ) + .await .unwrap(); - let result_init: Vec<_> = exec.execution_iter(init_peer_name).unwrap().collect(); + let result_init: Vec<_> = exec.execution_iter(init_peer_name).unwrap().collect().await; assert_eq!(result_init.len(), 1); let outcome1 = &result_init[0]; assert_eq!(outcome1.ret_code, 0); assert_eq!(outcome1.error_message, ""); - assert!(exec.execution_iter(peer2_name).unwrap().next().is_none()); + assert!(exec.execution_iter(peer2_name).unwrap().next().await.is_none()); { - let results1 = exec.execute_all(peer1_name).unwrap(); + let results1 = exec.execute_all(peer1_name).await.unwrap(); assert_eq!(results1.len(), 1); let outcome1 = &results1[0]; assert_eq!(outcome1.ret_code, 0, "{:?}", outcome1); - assert!(exec.execution_iter(peer1_name).unwrap().next().is_none()); + assert!(exec.execution_iter(peer1_name).unwrap().next().await.is_none()); assert_next_pks!(&outcome1.next_peer_pks, [peer2_id.as_str()]); } { - let results2: Vec<_> = exec.execute_all(peer2_name).unwrap(); + let results2: Vec<_> = exec.execute_all(peer2_name).await.unwrap(); assert_eq!(results2.len(), 1); let outcome2 = &results2[0]; assert_eq!(outcome2.ret_code, 0, "{:?}", outcome2); - assert!(exec.execution_iter(peer2_name).unwrap().next().is_none()); + assert!(exec.execution_iter(peer2_name).unwrap().next().await.is_none()); assert_next_pks!(&outcome2.next_peer_pks, [peer3_id.as_str()]); let trace = trace_from_result(outcome2); @@ -557,12 +571,12 @@ mod tests { } { - let results3: Vec<_> = exec.execute_all("peer3").unwrap(); + let results3: Vec<_> = exec.execute_all("peer3").await.unwrap(); assert_eq!(results3.len(), 1); // TODO why doesn't it fail? let outcome3 = &results3[0]; assert_eq!(outcome3.ret_code, 0, "{:?}", outcome3); - assert!(exec.execution_iter("peer3").unwrap().next().is_none()); + assert!(exec.execution_iter("peer3").unwrap().next().await.is_none()); let trace = trace_from_result(outcome3); assert_eq!( @@ -588,7 +602,7 @@ mod tests { } #[tokio::test] - fn test_echo() { + async fn test_echo() { let init_peer_name = "init_peer_id"; let peer1_name = "peer1"; let peer2_name = "peer2"; @@ -605,21 +619,22 @@ mod tests { "# ), ) + .await .unwrap(); - let result_init: Vec<_> = exec.execution_iter("init_peer_id").unwrap().collect(); + let result_init: Vec<_> = exec.execution_iter("init_peer_id").unwrap().collect().await; assert_eq!(result_init.len(), 1); let outcome0 = &result_init[0]; assert_eq!(outcome0.ret_code, 0); assert_eq!(outcome0.error_message, ""); - assert!(exec.execution_iter("peer2").unwrap().next().is_none()); - let results1: Vec<_> = exec.execution_iter("peer1").unwrap().collect(); + assert!(exec.execution_iter("peer2").unwrap().next().await.is_none()); + let results1: Vec<_> = exec.execution_iter("peer1").unwrap().collect().await; assert_eq!(results1.len(), 1); let outcome1 = &results1[0]; assert_eq!(outcome1.ret_code, 0, "{:?}", outcome1); - assert!(exec.execution_iter("peer1").unwrap().next().is_none()); + assert!(exec.execution_iter("peer1").unwrap().next().await.is_none()); let peer1_id = exec.resolve_name(peer1_name).to_string(); assert_eq!( @@ -638,7 +653,7 @@ mod tests { } #[tokio::test] - fn test_transformed_distinct() { + async fn test_transformed_distinct() { let peer_name = "peer1"; let network = Network::::new(std::iter::empty::(), vec![]); @@ -651,6 +666,7 @@ mod tests { TestRunParameters::from_init_peer_id(peer_name), transformed1, ) + .await .unwrap(); let transformed2 = TransformedAirScript::new( @@ -662,10 +678,11 @@ mod tests { TestRunParameters::from_init_peer_id(peer_name), transformed2, ) + .await .unwrap(); - let trace1 = exectution1.execute_one(peer_name).unwrap(); - let trace2 = exectution2.execute_one(peer_name).unwrap(); + let trace1 = exectution1.execute_one(peer_name).await.unwrap(); + let trace2 = exectution2.execute_one(peer_name).await.unwrap(); assert_eq!( trace_from_result(&trace1), @@ -688,7 +705,7 @@ mod tests { } #[tokio::test] - fn test_transformed_shared() { + async fn test_transformed_shared() { struct Service { state: RefCell>, } @@ -714,6 +731,7 @@ mod tests { TestRunParameters::from_init_peer_id(peer_name), transformed1, ) + .await .unwrap(); let transformed2 = TransformedAirScript::new(&air_script, network).unwrap(); @@ -721,10 +739,11 @@ mod tests { TestRunParameters::from_init_peer_id(peer_name), transformed2, ) + .await .unwrap(); - let trace1 = exectution1.execute_one(peer_name).unwrap(); - let trace2 = exectution2.execute_one(peer_name).unwrap(); + let trace1 = exectution1.execute_one(peer_name).await.unwrap(); + let trace2 = exectution2.execute_one(peer_name).await.unwrap(); assert_eq!( trace_from_result(&trace1), @@ -747,7 +766,7 @@ mod tests { } #[tokio::test] - fn test_invalid_air() { + async fn test_invalid_air() { let res = AirScriptExecutor::::new( TestRunParameters::from_init_peer_id("init_peer_id"), vec![], @@ -756,7 +775,7 @@ mod tests { (call "peer1" ("service" "func") [1 22] arg) ; behaviour=echo ) "#, - ); + ).await; match &res { Ok(_) => { @@ -771,16 +790,17 @@ mod tests { } } - fn run_behaviour_service(peer_name: &str, air_script: &str) { + async fn run_behaviour_service(peer_name: &str, air_script: &str) { let exec = AirScriptExecutor::::new( TestRunParameters::from_init_peer_id(peer_name), vec![], std::iter::empty(), air_script, ) + .await .unwrap(); - let result_init: Vec<_> = exec.execution_iter(peer_name).unwrap().collect(); + let result_init: Vec<_> = exec.execution_iter(peer_name).unwrap().collect().await; assert_eq!(result_init.len(), 1); let outcome = &result_init[0]; @@ -800,32 +820,33 @@ mod tests { } #[tokio::test] - fn test_behaviour_service() { + async fn test_behaviour_service() { let peer_name = "peer1"; let air_script = &format!(r#"(call "{peer_name}" ("service" "func") [1 22] arg) ; behaviour=service"#); - run_behaviour_service(peer_name, air_script) + run_behaviour_service(peer_name, air_script).await } #[tokio::test] - fn test_dbg_behaviour_service() { + async fn test_dbg_behaviour_service() { let peer_name = "peer1"; let air_script = &format!( r#"(call "{peer_name}" ("service" "func") [1 22] arg) ; dbg_behaviour=service"# ); - run_behaviour_service(peer_name, air_script) + run_behaviour_service(peer_name, air_script).await } - fn run_behaviour_function(peer_name: &str, air_script: &str) { + async fn run_behaviour_function(peer_name: &str, air_script: &str) { let exec = AirScriptExecutor::::new( TestRunParameters::from_init_peer_id(peer_name), vec![], std::iter::empty(), air_script, ) + .await .unwrap(); - let result_init: Vec<_> = exec.execution_iter(peer_name).unwrap().collect(); + let result_init: Vec<_> = exec.execution_iter(peer_name).unwrap().collect().await; assert_eq!(result_init.len(), 1); let outcome = &result_init[0]; @@ -845,32 +866,33 @@ mod tests { } #[tokio::test] - fn test_behaviour_function() { + async fn test_behaviour_function() { let peer_name = "peer1"; let air_script = &format!(r#"(call "{peer_name}" ("service" "func") [1 22] arg) ; behaviour=function"#); - run_behaviour_function(peer_name, air_script) + run_behaviour_function(peer_name, air_script).await } #[tokio::test] - fn test_dbg_behaviour_function() { + async fn test_dbg_behaviour_function() { let peer_name = "peer1"; let air_script = &format!( r#"(call "{peer_name}" ("service" "func") [1 22] arg) ; dbg_behaviour=function"# ); - run_behaviour_function(peer_name, air_script) + run_behaviour_function(peer_name, air_script).await } - fn run_behaviour_arg(peer_name: &str, air_script: &str) { + async fn run_behaviour_arg(peer_name: &str, air_script: &str) { let exec = AirScriptExecutor::::new( TestRunParameters::from_init_peer_id(peer_name), vec![], std::iter::empty(), air_script, ) + .await .unwrap(); - let result_init: Vec<_> = exec.execution_iter(peer_name).unwrap().collect(); + let result_init: Vec<_> = exec.execution_iter(peer_name).unwrap().collect().await; assert_eq!(result_init.len(), 1); let outcome = &result_init[0]; @@ -890,24 +912,24 @@ mod tests { } #[tokio::test] - fn test_behaviour_arg() { + async fn test_behaviour_arg() { let peer_name = "peer1"; let air_script = &format!(r#"(call "{peer_name}" ("service" "func") [1 22] arg) ; behaviour=arg.1"#); - run_behaviour_arg(peer_name, air_script) + run_behaviour_arg(peer_name, air_script).await } #[tokio::test] - fn test_dbg_behaviour_arg() { + async fn test_dbg_behaviour_arg() { let peer_name = "peer1"; let air_script = &format!(r#"(call "{peer_name}" ("service" "func") [1 22] arg) ; dbg_behaviour=arg.1"#); - run_behaviour_arg(peer_name, air_script) + run_behaviour_arg(peer_name, air_script).await } - fn run_behaviour_tetraplet(peer_name: &str, air_script: &str) { + async fn run_behaviour_tetraplet(peer_name: &str, air_script: &str) { let (_peer_pk, peer_id) = derive_dummy_keypair(peer_name); let exec = AirScriptExecutor::::new( @@ -916,9 +938,10 @@ mod tests { std::iter::empty(), air_script, ) + .await .unwrap(); - let result_init: Vec<_> = exec.execution_iter(peer_name).unwrap().collect(); + let result_init: Vec<_> = exec.execution_iter(peer_name).unwrap().collect().await; assert_eq!(result_init.len(), 1); let outcome = &result_init[0]; @@ -948,19 +971,19 @@ mod tests { } #[tokio::test] - fn test_behaviour_tetraplet() { + async fn test_behaviour_tetraplet() { let peer_name = "peer1"; let air_script = &format!(r#"(call "{peer_name}" ("service" "func") [1 22] arg) ; behaviour=tetraplet"#); - run_behaviour_tetraplet(peer_name, air_script) + run_behaviour_tetraplet(peer_name, air_script).await } #[tokio::test] - fn test_dbg_behaviour_tetraplet() { + async fn test_dbg_behaviour_tetraplet() { let peer_name = "peer1"; let air_script = &format!( r#"(call "{peer_name}" ("service" "func") [1 22] arg) ; dbg_behaviour=tetraplet"# ); - run_behaviour_tetraplet(peer_name, air_script) + run_behaviour_tetraplet(peer_name, air_script).await } } diff --git a/crates/testing-framework/src/queue.rs b/crates/testing-framework/src/queue.rs index 0f751459be..a9fac6639b 100644 --- a/crates/testing-framework/src/queue.rs +++ b/crates/testing-framework/src/queue.rs @@ -21,14 +21,20 @@ use air_test_utils::{ RawAVMOutcome, }; +use futures::{ + stream::StreamExt +}; + use std::{ borrow::Borrow, cell::RefCell, collections::{HashMap, VecDeque}, + future::Future, hash::Hash, ops::Deref, rc::Rc, }; +use std::pin::pin; #[derive(Debug, Default)] pub(crate) struct PeerQueueCell { @@ -83,7 +89,7 @@ impl ExecutionQueue { network: Rc>, test_parameters: &'ctx TestRunParameters, peer_id: &Id, - ) -> Option + 'ctx> + ) -> Option + 'ctx> where PeerId: Borrow + for<'a> From<&'a Id>, Id: Eq + Hash + ?Sized, @@ -91,12 +97,13 @@ impl ExecutionQueue { let peer_env = network.get_named_peer_env(peer_id); peer_env.map(|peer_env_cell| { - std::iter::from_fn(move || { + futures::stream::poll_fn(move |ctx| { let mut peer_env = peer_env_cell.borrow_mut(); - peer_env - .execute_once(air, &network, self, test_parameters) - .map(|r| r.unwrap_or_else(|err| panic!("VM call failed: {}", err))) - }) + let x = pin!(peer_env + .execute_once(air, &network, self, test_parameters)) + .poll(ctx); + x + }).map(|r| r.unwrap_or_else(|err| panic!("VM call failed: {}", err))) }) } diff --git a/crates/testing-framework/src/transform/mod.rs b/crates/testing-framework/src/transform/mod.rs index 25fcdba9ca..8417e27aaa 100644 --- a/crates/testing-framework/src/transform/mod.rs +++ b/crates/testing-framework/src/transform/mod.rs @@ -130,21 +130,21 @@ mod tests { use std::str::FromStr; - #[tokio::test] + #[test] fn test_parse_fmt_call() { let sexp_str = r#"(call "my_id" ("serv" "function") [other_peer_id "other_arg"])"#; let sexp = Sexp::from_str(sexp_str).unwrap(); assert_eq!(format!("{sexp}"), sexp_str); } - #[tokio::test] + #[test] fn test_parse_fmt_call_var() { let sexp_str = r#"(call "my_id" ("serv" "function") [other_peer_id "other_arg"] var)"#; let sexp = Sexp::from_str(sexp_str).unwrap(); assert_eq!(format!("{sexp}"), sexp_str); } - #[tokio::test] + #[test] fn test_parse_canon() { let sexp_str = r#"(canon "my_id" $stream #canon)"#; let sexp = Sexp::from_str(sexp_str).unwrap(); @@ -158,21 +158,21 @@ mod tests { ); } - #[tokio::test] + #[test] fn test_parse_fmt_symbol() { let sexp_str = "symbol"; let sexp = Sexp::from_str(sexp_str).unwrap(); assert_eq!(format!("{sexp}"), sexp_str); } - #[tokio::test] + #[test] fn test_parse_fmt_string() { let sexp_str = r#""my_id""#; let sexp = Sexp::from_str(sexp_str).unwrap(); assert_eq!(format!("{sexp}"), sexp_str); } - #[tokio::test] + #[test] fn test_parse_fmt_sexp() { let sexp_str = r#"(par (ap x y) (fold x y (next)))"#; let sexp = Sexp::from_str(sexp_str).unwrap(); diff --git a/crates/testing-framework/src/transform/parser.rs b/crates/testing-framework/src/transform/parser.rs index c406877ea8..3659a08c60 100644 --- a/crates/testing-framework/src/transform/parser.rs +++ b/crates/testing-framework/src/transform/parser.rs @@ -359,121 +359,121 @@ mod tests { use serde_json::json; #[tokio::test] - fn test_multispace0_empty() { + async fn test_multispace0_empty() { let res = sexp_multispace0::<_, ()>(""); assert!(res.is_ok(), "{}", res.unwrap_err()); } #[tokio::test] - fn test_multispace0_spaces() { + async fn test_multispace0_spaces() { let res = sexp_multispace0::<_, ()>(" "); assert!(res.is_ok(), "{}", res.unwrap_err()); } #[tokio::test] - fn test_multispace0_comment() { + async fn test_multispace0_comment() { let res = sexp_multispace0::<_, ()>(";; this is comment"); assert!(res.is_ok(), "{}", res.unwrap_err()); } #[tokio::test] - fn test_multispace0_comment_with_space() { + async fn test_multispace0_comment_with_space() { let res = sexp_multispace0::<_, ()>(" ;; "); assert!(res.is_ok(), "{}", res.unwrap_err()); } #[tokio::test] - fn test_multispace0_multiline() { + async fn test_multispace0_multiline() { let res = sexp_multispace0::<_, ()>(" ;; \n ;;;; \n "); assert!(res.is_ok(), "{}", res.unwrap_err()); } #[tokio::test] - fn test_multispace1_empty() { + async fn test_multispace1_empty() { let res = sexp_multispace1("".into()); assert!(res.is_err()); } #[tokio::test] - fn test_multispace1_space() { + async fn test_multispace1_space() { let res = sexp_multispace1(" ".into()); assert!(res.is_ok(), "{}", res.unwrap_err()); } #[tokio::test] - fn test_multispace1_comment() { + async fn test_multispace1_comment() { let res = sexp_multispace1(" ;; ".into()); assert!(res.is_ok(), "{}", res.unwrap_err()); } #[tokio::test] - fn test_multispace1_multiline() { + async fn test_multispace1_multiline() { let res = sexp_multispace1(" ;; \n ;;;; \n ".into()); assert!(res.is_ok(), "{}", res.unwrap_err()); } #[tokio::test] - fn test_symbol() { + async fn test_symbol() { let res = Sexp::from_str("symbol"); assert_eq!(res, Ok(Sexp::symbol("symbol"))); } #[tokio::test] - fn test_symbol_lambda() { + async fn test_symbol_lambda() { let res = Sexp::from_str("sym_bol.$.blabla"); assert_eq!(res, Ok(Sexp::symbol("sym_bol.$.blabla"))); } #[tokio::test] - fn test_symbol_lambda_exclamation() { + async fn test_symbol_lambda_exclamation() { let res = Sexp::from_str("pid-num.$.[0]!"); assert_eq!(res, Ok(Sexp::symbol("pid-num.$.[0]!"))); } #[tokio::test] - fn test_symbol_stream() { + async fn test_symbol_stream() { let res = Sexp::from_str("$stream"); assert_eq!(res, Ok(Sexp::symbol("$stream"))); } #[tokio::test] - fn test_symbol_canon() { + async fn test_symbol_canon() { let res = Sexp::from_str("#canon"); assert_eq!(res, Ok(Sexp::symbol("#canon"))); } #[tokio::test] - fn test_symbol_lambda2() { + async fn test_symbol_lambda2() { let res = Sexp::from_str(r#"$result.$[0]"#); assert_eq!(res, Ok(Sexp::symbol(r#"$result.$[0]"#))); } #[tokio::test] - fn test_string_empty() { + async fn test_string_empty() { let res = Sexp::from_str(r#""""#); assert_eq!(res, Ok(Sexp::string(""))); } #[tokio::test] - fn test_string() { + async fn test_string() { let res = Sexp::from_str(r#""str ing""#); assert_eq!(res, Ok(Sexp::string("str ing"))); } #[tokio::test] - fn test_empty_list() { + async fn test_empty_list() { let res = Sexp::from_str("()"); assert_eq!(res, Ok(Sexp::List(vec![]))); } #[tokio::test] - fn test_small_list() { + async fn test_small_list() { let res = Sexp::from_str("(null)"); assert_eq!(res, Ok(Sexp::list(vec![Sexp::symbol("null")]))); } #[tokio::test] - fn test_call_no_args() { + async fn test_call_no_args() { let res = Sexp::from_str(r#"(call peer_id ("serv" "func") [])"#); assert_eq!( res, @@ -494,7 +494,7 @@ mod tests { } #[tokio::test] - fn test_call_after_call() { + async fn test_call_after_call() { let res = Sexp::from_str( r#"(seq (call peer_id ("serv" "func") []) @@ -536,7 +536,7 @@ mod tests { } #[tokio::test] - fn test_call_annotation_newline() { + async fn test_call_annotation_newline() { let res = Sexp::from_str( r#"(seq (call peer_id ("serv" "func") []) ; result=42 @@ -549,7 +549,7 @@ mod tests { } #[tokio::test] - fn test_call_args1() { + async fn test_call_args1() { let res = Sexp::from_str(r#"(call peer_id ("serv" "func") [a])"#); assert_eq!( res, @@ -570,7 +570,7 @@ mod tests { } #[tokio::test] - fn test_call_args2() { + async fn test_call_args2() { let res = Sexp::from_str(r#"(call peer_id ("serv" "func") [a b])"#); assert_eq!( res, @@ -591,7 +591,7 @@ mod tests { } #[tokio::test] - fn test_call_var() { + async fn test_call_var() { let res = Sexp::from_str(r#"(call peer_id ("serv" "func") [a b] var)"#); assert_eq!( res, @@ -612,7 +612,7 @@ mod tests { } #[tokio::test] - fn test_call_with_annotation() { + async fn test_call_with_annotation() { let res = Sexp::from_str(r#"(call peer_id ("serv" "func") [a b] var) ; ok=42 "#); let expected_annotation = ServiceDefinition::Ok(json!(42)); assert_eq!( @@ -634,7 +634,7 @@ mod tests { } #[tokio::test] - fn test_call_with_annotation2() { + async fn test_call_with_annotation2() { let res = Sexp::from_str( r#"(par (call peerid ("serv" "func") [a b] var) ; ok=42 @@ -644,7 +644,7 @@ mod tests { } #[tokio::test] - fn test_generic_sexp() { + async fn test_generic_sexp() { let res = Sexp::from_str(" (fold i n ( par (null) (match y \"asdf\" (fail ))) )"); assert_eq!( res, @@ -667,13 +667,13 @@ mod tests { } #[tokio::test] - fn test_trailing_error() { + async fn test_trailing_error() { let res = Sexp::from_str("(null))"); assert!(res.is_err(), "{}", "{res:?}"); } #[tokio::test] - fn test_incomplete_string() { + async fn test_incomplete_string() { let err = Sexp::from_str( r#"(seq "string"#, @@ -689,7 +689,7 @@ mod tests { } #[tokio::test] - fn test_incomplete_list() { + async fn test_incomplete_list() { let err = Sexp::from_str( r#"(seq "string" @@ -705,49 +705,49 @@ mod tests { } #[tokio::test] - fn test_parse_fmt_call() { + async fn test_parse_fmt_call() { let sexp_str = r#"(call "my_id" ("serv" "function") [other_peer_id "other_arg"])"#; let sexp = Sexp::from_str(sexp_str).unwrap(); assert_eq!(format!("{sexp}"), sexp_str); } #[tokio::test] - fn test_parse_fmt_call_var() { + async fn test_parse_fmt_call_var() { let sexp_str = r#"(call "my_id" ("serv" "function") [other_peer_id "other_arg"] var)"#; let sexp = Sexp::from_str(sexp_str).unwrap(); assert_eq!(format!("{sexp}"), sexp_str); } #[tokio::test] - fn test_parse_fmt_symbol() { + async fn test_parse_fmt_symbol() { let sexp_str = "symbol"; let sexp = Sexp::from_str(sexp_str).unwrap(); assert_eq!(format!("{sexp}"), sexp_str); } #[tokio::test] - fn test_parse_fmt_string() { + async fn test_parse_fmt_string() { let sexp_str = r#""my_id""#; let sexp = Sexp::from_str(sexp_str).unwrap(); assert_eq!(format!("{sexp}"), sexp_str); } #[tokio::test] - fn test_parse_fmt_sexp() { + async fn test_parse_fmt_sexp() { let sexp_str = r#"(par (ap x y) (fold x y (next)))"#; let sexp = Sexp::from_str(sexp_str).unwrap(); assert_eq!(format!("{sexp}"), sexp_str); } #[tokio::test] - fn test_canon_syntax() { + async fn test_canon_syntax() { let sexp_str = r#"(seq (canon peer_id $stream #canon) (fold #canon i (next)))"#; let res = Sexp::from_str(sexp_str); assert!(res.is_ok(), "{}", "{res:?}"); } #[tokio::test] - fn test_comments() { + async fn test_comments() { let sexp_str = r#" ;; One comment ( ;;; Second comment ;; The third one @@ -780,7 +780,7 @@ mod tests { } #[tokio::test] - fn test_annotation_multiline() { + async fn test_annotation_multiline() { let multiline_annotation = r#" #| map = { "0": null @@ -790,7 +790,7 @@ mod tests { } #[tokio::test] - fn test_annotation_multiline_with_call() { + async fn test_annotation_multiline_with_call() { let sexp_str = r#"(call "peer_id" ("serv" "func") [a b] var) #| map = { "0": null @@ -820,7 +820,7 @@ mod tests { } #[tokio::test] - fn test_annotation_multiline_with_many_calls() { + async fn test_annotation_multiline_with_many_calls() { let sexp_str = r#"(seq (call "peer_id" ("serv" "func") [a b] var) #| map = { @@ -869,7 +869,7 @@ mod tests { } #[tokio::test] - fn test_call_with_annotation_last_form() { + async fn test_call_with_annotation_last_form() { let res = Sexp::from_str( r#"(par (call peerid ("serv" "func") [a b] var) @@ -910,7 +910,7 @@ mod tests { ); } #[tokio::test] - fn test_call_with_annotation_last_form_multiline() { + async fn test_call_with_annotation_last_form_multiline() { let res = Sexp::from_str( r#"(par (call peerid ("serv" "func") [a b] var) @@ -955,7 +955,7 @@ mod tests { } #[tokio::test] - fn test_canon_var_peer() { + async fn test_canon_var_peer() { let res = Sexp::from_str(r#"(canon peer $stream #canon)"#); assert_eq!( @@ -972,7 +972,7 @@ mod tests { } #[tokio::test] - fn test_canon_string_peer() { + async fn test_canon_string_peer() { let res = Sexp::from_str(r#"(canon "peer" $stream #canon)"#); assert_eq!( @@ -989,7 +989,7 @@ mod tests { } #[tokio::test] - fn test_canon_error_no_peer() { + async fn test_canon_error_no_peer() { let res = Sexp::from_str(r#"(canon )"#); assert_eq!( res, @@ -1001,7 +1001,7 @@ mod tests { } #[tokio::test] - fn test_canon_error_no_stream() { + async fn test_canon_error_no_stream() { let res = Sexp::from_str(r#"(canon peer )"#); assert_eq!( res, @@ -1013,7 +1013,7 @@ mod tests { } #[tokio::test] - fn test_canon_error_no_target() { + async fn test_canon_error_no_target() { let res = Sexp::from_str(r#"(canon peer $stream )"#); assert_eq!( res, @@ -1025,7 +1025,7 @@ mod tests { } #[tokio::test] - fn test_canon_error_wrong_stream() { + async fn test_canon_error_wrong_stream() { let res = Sexp::from_str(r#"(canon peer "$stream" #canon)"#); assert_eq!( res, @@ -1037,7 +1037,7 @@ mod tests { } #[tokio::test] - fn test_canon_error_wrong_target() { + async fn test_canon_error_wrong_target() { let res = Sexp::from_str(r##"(canon peer $stream "#canon" )"##); assert_eq!( res, diff --git a/crates/testing-framework/src/transform/walker.rs b/crates/testing-framework/src/transform/walker.rs index 19143efdf5..055e231c06 100644 --- a/crates/testing-framework/src/transform/walker.rs +++ b/crates/testing-framework/src/transform/walker.rs @@ -21,6 +21,7 @@ use air_test_utils::key_utils::at; use air_test_utils::test_runner::{AirRunner, DefaultAirRunner}; use std::{borrow::Cow, fmt::Write, ops::Deref, rc::Rc, str::FromStr}; +use std::future::Future; /// Transformed script represents transformed script's services' state within the network. /// Executions that use the same transformed script share same generated services' state. @@ -74,25 +75,27 @@ struct Transformer<'net, R> { } impl Transformer<'_, R> { - pub(crate) fn transform(&self, sexp: &mut Sexp) { + #[async_recursion::async_recursion(?Send)] + pub(crate) async fn transform(&self, sexp: &mut Sexp) { match sexp { - Sexp::Call(call) => self.handle_call(call), - Sexp::Canon(canon) => self.handle_canon(canon), + Sexp::Call(call) => self.handle_call(call).await, + Sexp::Canon(canon) => self.handle_canon(canon).await, Sexp::List(children) => { for child in children.iter_mut().skip(1) { - self.transform(child); + self.transform(child).await; } } Sexp::Symbol(_) | Sexp::String(_) => {} } } - fn handle_call(&self, call: &mut Call) { + async fn handle_call(&self, call: &mut Call) { // collect peers... if let Sexp::String(ref mut peer_name) = &mut call.triplet.0 { *peer_name = self .network .ensure_named_peer(peer_name.as_str()) + .await .to_string(); } @@ -111,11 +114,12 @@ impl Transformer<'_, R> { } } - fn handle_canon(&self, canon: &mut Canon) { + async fn handle_canon(&self, canon: &mut Canon) { if let Sexp::String(ref mut peer_name) = &mut canon.peer { *peer_name = self .network .ensure_named_peer(peer_name.as_str()) + .await .to_string(); } } @@ -155,14 +159,14 @@ mod tests { } #[tokio::test] - fn test_translate_null() { + async fn test_translate_null() { let network = Network::::new(std::iter::empty::(), vec![]); let transformed = TransformedAirScript::new("(null)", network).unwrap(); assert_eq!(&*transformed, "(null)"); } #[tokio::test] - fn test_translate_call_no_result() { + async fn test_translate_call_no_result() { let network = Network::::new(std::iter::empty::(), vec![]); let script = r#"(call peer_id ("service_id" func) [])"#; let transformed = TransformedAirScript::new_unvalidated(script, network).unwrap(); @@ -171,7 +175,7 @@ mod tests { #[tokio::test] #[should_panic] - fn test_translate_call_no_string() { + async fn test_translate_call_no_string() { let network = Network::::new(std::iter::empty::(), vec![]); let script = r#"(call "peer_id" (service_id func) [])"#; let transformed = TransformedAirScript::new(script, network); @@ -179,7 +183,7 @@ mod tests { } #[tokio::test] - fn test_translate_call_result() { + async fn test_translate_call_result() { let network = Network::::new(std::iter::empty::(), vec![]); let script = r#"(call "peer_id" ("service_id" func) []) ; ok = 42"#; let transformer = TransformedAirScript::new_unvalidated(script, network.clone()).unwrap(); @@ -207,7 +211,7 @@ mod tests { } #[tokio::test] - fn test_translate_multiple_calls() { + async fn test_translate_multiple_calls() { let script = r#"(seq (call peer_id ("service_id" func) [a 11]) ; ok={"test":"me"} (seq @@ -244,7 +248,7 @@ mod tests { } #[tokio::test] - fn test_peers() { + async fn test_peers() { // this script is not correct AIR, but our parser handles it let script = r#"(seq (call "peer_id1" ("service_id" func) [a 11]) ; ok={"test":"me"} @@ -289,7 +293,7 @@ mod tests { } #[tokio::test] - fn test_at_transform() { + async fn test_at_transform() { let script = r#"(call "peer_id1" ("service_id" "func") [1 @"peer_id3"] x) ; ok={"test":@"peer_id2"}"#; let network = Network::::new(std::iter::empty::(), vec![]); @@ -311,8 +315,9 @@ mod tests { TestRunParameters::from_init_peer_id(peer_name1), t, ) + .await .unwrap(); - let res = exec.execute_one(peer_name1).unwrap(); + let res = exec.execute_one(peer_name1).await.unwrap(); assert_eq!( trace_from_result(&res), ExecutionTrace::from(vec![scalar!( From a9dc66ebc81c32348035d9d62bdfeebf41f45998 Mon Sep 17 00:00:00 2001 From: Valery Antopol Date: Mon, 12 Feb 2024 18:02:54 +0400 Subject: [PATCH 05/14] tests compile without warnings --- .../features/data_merging/data_merge.rs | 5 +- .../data_merging/executed_trace_basic.rs | 13 +- .../test_module/features/errors/last_error.rs | 26 ++-- .../test_module/features/lambda/flattening.rs | 9 +- .../features/scopes/scalars_scope.rs | 10 +- .../features/signatures/signing.rs | 32 +++-- .../features/streams/recursive_streams.rs | 11 +- .../test_module/features/streams/streams.rs | 7 +- .../tetraplets/security_tetraplets.rs | 45 +++--- air/tests/test_module/instructions/ap.rs | 6 +- air/tests/test_module/instructions/call.rs | 6 +- air/tests/test_module/instructions/canon.rs | 54 +++++--- air/tests/test_module/instructions/fail.rs | 8 +- air/tests/test_module/instructions/fold.rs | 6 +- air/tests/test_module/instructions/new.rs | 8 +- .../test_module/integration/chat_join.rs | 16 ++- .../test_module/integration/create_service.rs | 6 +- .../test_module/integration/dashboard.rs | 17 ++- air/tests/test_module/issues/issue_632.rs | 44 +++--- .../air-lib/test-utils/src/call_services.rs | 131 +++++++++++------- crates/air-lib/test-utils/src/lib.rs | 1 - crates/air-lib/test-utils/src/test_runner.rs | 22 +-- .../testing-framework/src/asserts/behavior.rs | 6 +- crates/testing-framework/src/asserts/mod.rs | 6 +- crates/testing-framework/src/ephemeral/mod.rs | 12 +- .../src/ephemeral/neighborhood.rs | 34 ++--- crates/testing-framework/src/execution/mod.rs | 31 +++-- crates/testing-framework/src/services/mod.rs | 36 +++-- .../testing-framework/src/services/results.rs | 42 +++--- .../testing-framework/src/transform/walker.rs | 37 +++-- 30 files changed, 407 insertions(+), 280 deletions(-) diff --git a/air/tests/test_module/features/data_merging/data_merge.rs b/air/tests/test_module/features/data_merging/data_merge.rs index 23d38ff1d5..041b747db8 100644 --- a/air/tests/test_module/features/data_merging/data_merge.rs +++ b/air/tests/test_module/features/data_merging/data_merge.rs @@ -19,6 +19,7 @@ use air_interpreter_data::ExecutionTrace; use air_test_utils::prelude::*; use pretty_assertions::assert_eq; +use futures::FutureExt; use std::collections::HashMap; use std::ops::Deref; @@ -178,13 +179,13 @@ async fn merge_streams_in_two_fold() { #[tokio::test] async fn stream_merge() { - let neighborhood_call_service: CallServiceClosure = Box::new(|params| -> CallServiceResult { + let neighborhood_call_service: CallServiceClosure = Box::new(|params| async move { let args_count = (params.function_name.as_bytes()[0] - b'0') as usize; let args: Vec> = serde_json::from_value(JValue::Array(params.arguments)).expect("valid json"); assert_eq!(args[0].len(), args_count); CallServiceResult::ok(json!(args)) - }); + }.boxed_local()); let mut vm1 = create_avm(set_variable_call_service(json!("peer_id")), "A").await; let mut vm2 = create_avm(neighborhood_call_service, "B").await; diff --git a/air/tests/test_module/features/data_merging/executed_trace_basic.rs b/air/tests/test_module/features/data_merging/executed_trace_basic.rs index dc1c1260a1..17787bc31b 100644 --- a/air/tests/test_module/features/data_merging/executed_trace_basic.rs +++ b/air/tests/test_module/features/data_merging/executed_trace_basic.rs @@ -19,6 +19,7 @@ use air_interpreter_data::ExecutionTrace; use air_test_utils::prelude::*; use pretty_assertions::assert_eq; +use futures::FutureExt; #[tokio::test] async fn executed_trace_seq_par_call() { @@ -226,7 +227,7 @@ async fn executed_trace_create_service() { let add_blueprint_response = "add_blueprint response"; let create_response = "create response"; - let call_service: CallServiceClosure = Box::new(move |params| -> CallServiceResult { + let call_service: CallServiceClosure = Box::new(move |params| async move { let response = match params.service_id.as_str() { "add_module" => add_module_response, "add_blueprint" => add_blueprint_response, @@ -234,7 +235,7 @@ async fn executed_trace_create_service() { _ => "unknown response", }; CallServiceResult::ok(json!(response)) - }); + }.boxed_local()); let init_peer_id = "A"; let set_variables_id = "set_variables"; @@ -304,9 +305,9 @@ async fn executed_trace_create_service() { #[tokio::test] async fn executed_trace_par_seq_fold_call() { - let return_numbers_call_service: CallServiceClosure = Box::new(|_| -> CallServiceResult { + let return_numbers_call_service: CallServiceClosure = Box::new(|_| async move { CallServiceResult::ok(json!(["1", "2", "3", "4", "5", "6", "7", "8", "9", "10"])) - }); + }.boxed_local()); let mut vm1 = create_avm(return_numbers_call_service, "some_peer_id_1").await; let mut vm2 = create_avm(echo_call_service(), "some_peer_id_2").await; @@ -451,9 +452,9 @@ async fn executed_trace_par_seq_fold_call() { #[tokio::test] async fn executed_trace_par_seq_fold_in_cycle_call() { - let return_numbers_call_service: CallServiceClosure = Box::new(|_| -> CallServiceResult { + let return_numbers_call_service: CallServiceClosure = Box::new(|_| async move { CallServiceResult::ok(json!(["1", "2", "3", "4", "5", "6", "7", "8", "9", "10"])) - }); + }.boxed_local()); let mut vm1 = create_avm(return_numbers_call_service, "some_peer_id_1").await; let mut vm2 = create_avm(echo_call_service(), "some_peer_id_2").await; diff --git a/air/tests/test_module/features/errors/last_error.rs b/air/tests/test_module/features/errors/last_error.rs index c9382d02fe..250ec67516 100644 --- a/air/tests/test_module/features/errors/last_error.rs +++ b/air/tests/test_module/features/errors/last_error.rs @@ -26,6 +26,8 @@ use air::NO_ERROR_MESSAGE; use air_test_framework::AirScriptExecutor; use air_test_utils::prelude::*; +use futures::FutureExt; + use std::cell::RefCell; use std::rc::Rc; @@ -34,16 +36,20 @@ type ArgToCheck = Rc>>; fn create_check_service_closure( args_to_check: ArgToCheck, tetraplets_to_check: ArgToCheck>>, -) -> CallServiceClosure { - Box::new(move |params| -> CallServiceResult { - let mut call_args: Vec = - serde_json::from_value(JValue::Array(params.arguments)).expect("json deserialization shouldn't fail"); - - let result = json!(params.tetraplets); - *args_to_check.borrow_mut() = Some(call_args.remove(0)); - *tetraplets_to_check.borrow_mut() = Some(params.tetraplets); - - CallServiceResult::ok(result) +) -> CallServiceClosure<'static> { + Box::new(move |params| { + let args_to_check = args_to_check.clone(); + let tetraplets_to_check = tetraplets_to_check.clone(); + async move { + let mut call_args: Vec = + serde_json::from_value(JValue::Array(params.arguments)).expect("json deserialization shouldn't fail"); + + let result = json!(params.tetraplets); + *args_to_check.borrow_mut() = Some(call_args.remove(0)); + *tetraplets_to_check.borrow_mut() = Some(params.tetraplets); + + CallServiceResult::ok(result) + }.boxed_local() }) } diff --git a/air/tests/test_module/features/lambda/flattening.rs b/air/tests/test_module/features/lambda/flattening.rs index 535d2e03b6..8b74935e4b 100644 --- a/air/tests/test_module/features/lambda/flattening.rs +++ b/air/tests/test_module/features/lambda/flattening.rs @@ -16,6 +16,8 @@ use air_test_utils::prelude::*; +use futures::FutureExt; + use std::cell::RefCell; use std::rc::Rc; @@ -29,8 +31,8 @@ struct ClosureCallArgs { tetraplets: ClosureSettableVar>>, } -fn create_check_service_closure(closure_call_args: ClosureCallArgs) -> CallServiceClosure { - Box::new(move |params| -> CallServiceResult { +fn create_check_service_closure(closure_call_args: ClosureCallArgs) -> CallServiceClosure<'static> { + Box::new(move |params| { use std::ops::Deref; *closure_call_args.service_id_var.deref().borrow_mut() = params.service_id.clone(); @@ -40,7 +42,8 @@ fn create_check_service_closure(closure_call_args: ClosureCallArgs) -> CallServi serde_json::from_value(JValue::Array(params.arguments)).expect("json deserialization shouldn't fail"); *closure_call_args.args_var.deref().borrow_mut() = call_args; - CallServiceResult::ok(json!("")) + let result = CallServiceResult::ok(json!("")); + async move { result }.boxed_local() }) } diff --git a/air/tests/test_module/features/scopes/scalars_scope.rs b/air/tests/test_module/features/scopes/scalars_scope.rs index 5f9846e347..8493d789d0 100644 --- a/air/tests/test_module/features/scopes/scalars_scope.rs +++ b/air/tests/test_module/features/scopes/scalars_scope.rs @@ -18,6 +18,8 @@ use air::CatchableError; use air::ExecutionError; use air_test_utils::prelude::*; +use futures::FutureExt; + #[tokio::test] async fn scalars_scope() { let peer_1_id = "peer_1_id"; @@ -81,11 +83,11 @@ async fn before_after_of_next() { let vm_peer_0_id = "vm_peer_0_id"; let counter = std::cell::Cell::new(0); - let vm_peer_0_call_service: CallServiceClosure = Box::new(move |_params| { + let vm_peer_0_call_service: CallServiceClosure = Box::new(move |_params| { let uncelled_request_id = counter.get(); counter.set(uncelled_request_id + 1); - CallServiceResult::ok(json!(uncelled_request_id)) - }); + async move { CallServiceResult::ok(json!(uncelled_request_id))} + }.boxed_local()); let mut peer_0_vm = create_avm(vm_peer_0_call_service, vm_peer_0_id).await; let vm_peer_1_id = "vm_peer_1_id"; @@ -138,7 +140,7 @@ async fn local_and_global_scalars() { let local_setter_call_service: CallServiceClosure = Box::new(move |_params| { let uncelled_request_id = counter.get(); counter.set(uncelled_request_id + 1); - CallServiceResult::ok(json!(uncelled_request_id)) + async move { CallServiceResult::ok(json!(uncelled_request_id)) }.boxed_local() }); let mut local_setter_vm = create_avm(local_setter_call_service, local_setter_peer_id).await; diff --git a/air/tests/test_module/features/signatures/signing.rs b/air/tests/test_module/features/signatures/signing.rs index 38d3c42341..00885a5c14 100644 --- a/air/tests/test_module/features/signatures/signing.rs +++ b/air/tests/test_module/features/signatures/signing.rs @@ -60,7 +60,9 @@ async fn test_signature_call_var() { let exec = AirScriptExecutor::from_annotated(TestRunParameters::from_init_peer_id(init_peer_name), &air_script).await.unwrap(); - let res = exec.execution_iter(init_peer_id.as_str()).unwrap().collect::>().await.last().unwrap(); + + let exec_results = exec.execution_iter(init_peer_id.as_str()).unwrap().collect::>().await; + let res = exec_results.last().unwrap(); assert_eq!(res.ret_code, 0, "{:?}", res); let data = data_from_result(&res); @@ -86,7 +88,8 @@ async fn test_signature_call_stream() { let exec = AirScriptExecutor::from_annotated(TestRunParameters::from_init_peer_id(init_peer_name), &air_script).await.unwrap(); - let res = exec.execution_iter(init_peer_name).unwrap().collect::>().await.last().unwrap(); + let exec_results = exec.execution_iter(init_peer_name).unwrap().collect::>().await; + let res = exec_results.last().unwrap(); assert_eq!(res.ret_code, 0, "{:?}", res); let data = data_from_result(&res); @@ -114,7 +117,8 @@ async fn test_signature_call_unused() { let exec = AirScriptExecutor::from_annotated(TestRunParameters::from_init_peer_id(init_peer_name), &air_script).await.unwrap(); - let res = exec.execution_iter(init_peer_name).unwrap().collect::>().await.last().unwrap(); + let exec_results = exec.execution_iter(init_peer_name).unwrap().collect::>().await; + let res = exec_results.last().unwrap(); assert_eq!(res.ret_code, 0, "{:?}", res); let data = data_from_result(&res); @@ -186,7 +190,8 @@ async fn test_signature_call_twice() { let exec = AirScriptExecutor::from_annotated(TestRunParameters::from_init_peer_id(init_peer_name), &air_script).await.unwrap(); - let res = exec.execution_iter(init_peer_id.as_str()).unwrap().collect::>().await.last().unwrap(); + let exec_results = exec.execution_iter(init_peer_id.as_str()).unwrap().collect::>().await; + let res = exec_results.last().unwrap(); assert_eq!(res.ret_code, 0, "{:?}", res); let data = data_from_result(&res); @@ -228,8 +233,9 @@ async fn test_signature_canon_basic() { let exec = AirScriptExecutor::from_annotated(TestRunParameters::from_init_peer_id(init_peer_name), &air_script).await.unwrap(); - let last_result = exec.execution_iter(init_peer_name).unwrap().collect::>().await.last().unwrap(); - let last_data = data_from_result(&last_result); + let exec_results = exec.execution_iter(init_peer_name).unwrap().collect::>().await; + let res = exec_results.last().unwrap(); + let last_data = data_from_result(&res); let expected_call_result = scalar!( json!([1, 2, 3]), @@ -306,11 +312,12 @@ async fn test_signature_canon_merge() { let exec = AirScriptExecutor::from_annotated(TestRunParameters::from_init_peer_id(init_peer_name), &air_script).await.unwrap(); - exec.execute_all(init_peer_name); - exec.execute_one(other_peer_name); + exec.execute_all(init_peer_name).await; + exec.execute_one(other_peer_name).await; - let last_result = exec.execution_iter(init_peer_name).unwrap().collect::>().await.last().unwrap(); - let last_data = data_from_result(&last_result); + let exec_results = exec.execution_iter(init_peer_name).unwrap().collect::>().await; + let res = exec_results.last().unwrap(); + let last_data = data_from_result(&res); let expected_call_result = scalar!( json!([1, 2, 3]), @@ -385,8 +392,9 @@ async fn test_signature_canon_result() { let exec = AirScriptExecutor::from_annotated(TestRunParameters::from_init_peer_id(init_peer_name), &air_script).await.unwrap(); - let last_result = exec.execution_iter(init_peer_name).unwrap().collect::>().await.last().unwrap(); - let last_data = data_from_result(&last_result); + let exec_results = exec.execution_iter(init_peer_name).unwrap().collect::>().await; + let res = exec_results.last().unwrap(); + let last_data = data_from_result(&res); let expected_call_result1 = scalar!( json!([1, 2, 3]), diff --git a/air/tests/test_module/features/streams/recursive_streams.rs b/air/tests/test_module/features/streams/recursive_streams.rs index 46e02800f2..82f2437c38 100644 --- a/air/tests/test_module/features/streams/recursive_streams.rs +++ b/air/tests/test_module/features/streams/recursive_streams.rs @@ -20,6 +20,7 @@ use air_test_framework::AirScriptExecutor; use air_test_utils::prelude::*; use pretty_assertions::assert_eq; +use futures::FutureExt; #[tokio::test] async fn recursive_stream_with_early_exit() { @@ -89,7 +90,7 @@ async fn recursive_stream_many_iterations() { }; request_id.set(uncelled_request_id + 1); - result + async move { result }.boxed_local() }); let mut vm_1 = create_avm(give_n_results_and_then_stop, vm_peer_id_1).await; @@ -187,7 +188,7 @@ async fn recursive_stream_join() { }; request_id.set(uncelled_request_id + 1); - result + async move { result }.boxed_local() }); let mut vm_1 = create_avm(give_n_results_and_then_stop, vm_peer_id_1).await; @@ -271,7 +272,7 @@ async fn recursive_stream_error_handling() { }; request_id.set(uncelled_request_id + 1); - result + async move { result }.boxed_local() }); let mut vm_1 = create_avm(give_n_results_and_then_stop, vm_peer_id_1).await; @@ -345,7 +346,7 @@ async fn recursive_stream_inner_fold() { }; request_id.set(uncelled_request_id + 1); - result + async move { result }.boxed_local() }); let mut vm_1 = create_avm(give_n_results_and_then_stop, vm_peer_id_1).await; @@ -409,7 +410,7 @@ async fn recursive_stream_fold_with_n_service_call() { }; request_id.set(uncelled_request_id + 1); - result + async move { result }.boxed_local() }); let mut vm = create_avm(give_n_results_and_then_stop, vm_peer_id).await; diff --git a/air/tests/test_module/features/streams/streams.rs b/air/tests/test_module/features/streams/streams.rs index 69d4b170ae..1a1507d5bc 100644 --- a/air/tests/test_module/features/streams/streams.rs +++ b/air/tests/test_module/features/streams/streams.rs @@ -18,13 +18,14 @@ use air_interpreter_data::ExecutionTrace; use air_test_utils::prelude::*; use pretty_assertions::assert_eq; +use futures::FutureExt; use std::ops::Deref; #[tokio::test] async fn empty_stream() { - fn arg_type_check_closure() -> CallServiceClosure { - Box::new(move |params| -> CallServiceResult { + fn arg_type_check_closure() -> CallServiceClosure<'static> { + Box::new(move |params| async move { let actual_call_args: Vec> = serde_json::from_value(JValue::Array(params.arguments)).expect("json deserialization shouldn't fail"); let expected_call_args: Vec> = vec![vec![]]; @@ -32,7 +33,7 @@ async fn empty_stream() { assert_eq!(actual_call_args, expected_call_args); CallServiceResult::ok(json!("")) - }) + }.boxed_local()) } let vm_peer_id = "vm_peer_id"; diff --git a/air/tests/test_module/features/tetraplets/security_tetraplets.rs b/air/tests/test_module/features/tetraplets/security_tetraplets.rs index 89f61b69e8..b4f19c4467 100644 --- a/air/tests/test_module/features/tetraplets/security_tetraplets.rs +++ b/air/tests/test_module/features/tetraplets/security_tetraplets.rs @@ -18,21 +18,23 @@ use air_test_utils::key_utils::at; use air_test_utils::prelude::*; use polyplets::SecurityTetraplet; use pretty_assertions::assert_eq; +use futures::FutureExt; use std::cell::RefCell; use std::rc::Rc; type ArgTetraplets = Vec>; -fn arg_host_function() -> (CallServiceClosure, Rc>) { +fn arg_host_function() -> (CallServiceClosure<'static>, Rc>) { let arg_tetraplets = Rc::new(RefCell::new(ArgTetraplets::new())); let arg_tetraplets_inner = arg_tetraplets.clone(); - let host_function: CallServiceClosure = Box::new(move |params| -> CallServiceResult { + let host_function: CallServiceClosure = Box::new(move |params| { let result = json!(params.tetraplets); *arg_tetraplets_inner.borrow_mut() = params.tetraplets; - CallServiceResult::ok(result) + let result = CallServiceResult::ok(result); + async move { result }.boxed_local() }); (host_function, arg_tetraplets) @@ -40,9 +42,9 @@ fn arg_host_function() -> (CallServiceClosure, Rc>) { #[tokio::test] async fn fold_with_inner_call() { - let return_numbers_call_service: CallServiceClosure = Box::new(|_| -> CallServiceResult { + let return_numbers_call_service: CallServiceClosure = Box::new(|_| async move { CallServiceResult::ok(json!(["1", "2", "3", "4", "5", "6", "7", "8", "9", "10"])) - }); + }.boxed_local()); let set_variable_vm_peer_id = String::from("some_peer_id_1"); let mut set_variable_vm = create_avm(return_numbers_call_service, set_variable_vm_peer_id.clone()).await; @@ -253,9 +255,9 @@ async fn fold_json_path() { #[tokio::test] async fn check_tetraplet_works_correctly() { - let return_numbers_call_service: CallServiceClosure = Box::new(|_| -> CallServiceResult { + let return_numbers_call_service: CallServiceClosure = Box::new(|_| async move { CallServiceResult::ok(json!({"args": ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10"]})) - }); + }.boxed_local()); let set_variable_vm_peer_id = String::from("some_peer_id_1"); let mut set_variable_vm = create_avm(return_numbers_call_service, set_variable_vm_peer_id.clone()).await; @@ -306,7 +308,6 @@ use fluence_app_service::ModuleDescriptor; use air_test_utils::trace_from_result; use std::path::PathBuf; -use tracing::instrument::WithSubscriber; fn construct_service_config(module_name: impl Into) -> AppServiceConfig { let module_name = module_name.into(); @@ -360,9 +361,9 @@ async fn tetraplet_with_wasm_modules() { ); let services = Rc::new(RefCell::new(services)); - let services_inner = services.clone(); const ADMIN_PEER_PK: &str = "12D3KooWEXNUbCXooUwHrHBbrmjsrpHXoEphPwbjQXEGyzbqKnE1"; - let host_func: CallServiceClosure = Box::new(move |params| -> CallServiceResult { + let host_func: CallServiceClosure = Box::new(move |params| { + let services_inner = services.clone(); let tetraplets = serde_json::to_vec(¶ms.tetraplets).expect("default serializer shouldn't fail"); let tetraplets: Vec> = serde_json::from_slice(&tetraplets).expect("default deserializer shouldn't fail"); @@ -371,19 +372,21 @@ async fn tetraplet_with_wasm_modules() { call_parameters.init_peer_id = ADMIN_PEER_PK.to_string(); call_parameters.tetraplets = tetraplets; - let mut service = services_inner.borrow_mut(); - let service = service.get_mut(params.service_id.as_str()).unwrap(); + async move { + let mut service = services_inner.borrow_mut(); + let service = service.get_mut(params.service_id.as_str()).unwrap(); - let result = service - .call_async( - params.function_name, - JValue::Array(params.arguments), - to_app_service_call_parameters(call_parameters), - ) - .await - .unwrap(); + let result = service + .call_async( + params.function_name, + JValue::Array(params.arguments), + to_app_service_call_parameters(call_parameters), + ) + .await + .unwrap(); - CallServiceResult::ok(result) + CallServiceResult::ok(result) + }.boxed_local() }); let local_peer_id = "local_peer_id"; diff --git a/air/tests/test_module/instructions/ap.rs b/air/tests/test_module/instructions/ap.rs index 14f3b65f8e..6221b058d1 100644 --- a/air/tests/test_module/instructions/ap.rs +++ b/air/tests/test_module/instructions/ap.rs @@ -20,6 +20,7 @@ use air_test_framework::AirScriptExecutor; use air_test_utils::key_utils::at; use air_test_utils::prelude::*; use pretty_assertions::assert_eq; +use futures::FutureExt; use std::cell::RefCell; use std::rc::Rc; @@ -454,10 +455,11 @@ async fn ap_canon_stream() { let vm_1_peer_id = "vm_1_peer_id"; let arg_tetraplets = Rc::new(RefCell::new(vec![])); - let echo_call_service: CallServiceClosure = Box::new(move |mut params| -> CallServiceResult { + let echo_call_service: CallServiceClosure = Box::new(move |mut params| { let arg_tetraplets_inner = arg_tetraplets.clone(); arg_tetraplets_inner.borrow_mut().push(params.tetraplets.clone()); - CallServiceResult::ok(params.arguments.remove(0)) + let result = CallServiceResult::ok(params.arguments.remove(0)); + async move { result }.boxed_local() }); let (echo_call_service, tetraplet_checker) = tetraplet_host_function(echo_call_service); diff --git a/air/tests/test_module/instructions/call.rs b/air/tests/test_module/instructions/call.rs index c626e34037..3d257bfb17 100644 --- a/air/tests/test_module/instructions/call.rs +++ b/air/tests/test_module/instructions/call.rs @@ -20,6 +20,7 @@ use air_test_framework::AirScriptExecutor; use air_test_utils::key_utils::at; use air_test_utils::prelude::*; use pretty_assertions::assert_eq; +use futures::FutureExt; // Check that %init_peer_id% alias works correctly (by comparing result with it and explicit peer id). // Additionally, check that empty string for data does the same as empty call path. @@ -164,7 +165,10 @@ async fn duplicate_variables() { #[tokio::test] async fn string_parameters() { let call_service: CallServiceClosure = - Box::new(|mut params| -> CallServiceResult { CallServiceResult::ok(params.arguments.remove(0)) }); + Box::new(|mut params| { + let result = CallServiceResult::ok(params.arguments.remove(0)); + async move { result }.boxed_local() + }); let vm_peer_id = "A"; let mut vm = create_avm(call_service, vm_peer_id).await; diff --git a/air/tests/test_module/instructions/canon.rs b/air/tests/test_module/instructions/canon.rs index ede8efd540..b2ff2b8d2b 100644 --- a/air/tests/test_module/instructions/canon.rs +++ b/air/tests/test_module/instructions/canon.rs @@ -19,6 +19,7 @@ use air_test_framework::AirScriptExecutor; use air_test_utils::key_utils::at; use air_test_utils::prelude::*; use pretty_assertions::assert_eq; +use futures::FutureExt; use std::cell::RefCell; use std::ops::Deref; @@ -241,13 +242,15 @@ async fn canon_gates() { let peer_id_3 = "peer_id_3"; let stop_len_count = 2; - let vm_3_call_service: CallServiceClosure = Box::new(move |params: CallRequestParams| -> CallServiceResult { + let vm_3_call_service: CallServiceClosure = Box::new(move |params: CallRequestParams| { let value = params.arguments[0].as_array().unwrap().len(); - if value >= stop_len_count { + let result = if value >= stop_len_count { CallServiceResult::ok(json!(true)) } else { CallServiceResult::ok(json!(false)) - } + }; + + async move { result }.boxed_local() }); let mut vm_3 = create_avm(vm_3_call_service, peer_id_3).await; @@ -753,10 +756,11 @@ async fn canon_map_single_index_tetraplet_check() { let vm_peer_id_1 = "vm_peer_id_1"; let arg_tetraplets = Rc::new(RefCell::new(vec![])); - let echo_call_service: CallServiceClosure = Box::new(move |mut params| -> CallServiceResult { + let echo_call_service: CallServiceClosure = Box::new(move |mut params| { let arg_tetraplets_inner = arg_tetraplets.clone(); arg_tetraplets_inner.borrow_mut().push(params.tetraplets.clone()); - CallServiceResult::ok(params.arguments.remove(0)) + let result = CallServiceResult::ok(params.arguments.remove(0)); + async move { result }.boxed_local() }); let (echo_call_service, tetraplet_checker) = tetraplet_host_function(echo_call_service); @@ -844,10 +848,11 @@ async fn canon_map_index_with_element_access_tetraplet_check() { let vm_peer_id_1 = "vm_peer_id_1"; let arg_tetraplets = Rc::new(RefCell::new(vec![])); - let echo_call_service: CallServiceClosure = Box::new(move |mut params| -> CallServiceResult { + let echo_call_service: CallServiceClosure = Box::new(move |mut params| { let arg_tetraplets_inner = arg_tetraplets.clone(); arg_tetraplets_inner.borrow_mut().push(params.tetraplets.clone()); - CallServiceResult::ok(params.arguments.remove(0)) + let result = CallServiceResult::ok(params.arguments.remove(0)); + async move { result }.boxed_local() }); let (echo_call_service, tetraplet_checker) = tetraplet_host_function(echo_call_service); @@ -942,10 +947,11 @@ async fn canon_map_index_with_element_and_attribute_tetraplet_check() { let vm_peer_id_1 = "vm_peer_id_1"; let arg_tetraplets = Rc::new(RefCell::new(vec![])); - let echo_call_service: CallServiceClosure = Box::new(move |mut params| -> CallServiceResult { + let echo_call_service: CallServiceClosure = Box::new(move |mut params| { let arg_tetraplets_inner = arg_tetraplets.clone(); arg_tetraplets_inner.borrow_mut().push(params.tetraplets.clone()); - CallServiceResult::ok(params.arguments.remove(0)) + let result = CallServiceResult::ok(params.arguments.remove(0)); + async move { result }.boxed_local() }); let (echo_call_service, tetraplet_checker) = tetraplet_host_function(echo_call_service); @@ -1068,10 +1074,11 @@ async fn canon_map_non_existing_index_tetraplet_check() { let vm_peer_id_1 = "vm_peer_id_1"; let arg_tetraplets = Rc::new(RefCell::new(vec![])); - let echo_call_service: CallServiceClosure = Box::new(move |mut params| -> CallServiceResult { + let echo_call_service: CallServiceClosure = Box::new(move |mut params| { let arg_tetraplets_inner = arg_tetraplets.clone(); arg_tetraplets_inner.borrow_mut().push(params.tetraplets.clone()); - CallServiceResult::ok(params.arguments.remove(0)) + let result = CallServiceResult::ok(params.arguments.remove(0)); + async move { result }.boxed_local() }); let (echo_call_service, tetraplet_checker) = tetraplet_host_function(echo_call_service); @@ -1135,10 +1142,11 @@ async fn canon_map_non_existing_index_and_element_tetraplet_check() { let vm_peer_id_1 = "vm_peer_id_1"; let arg_tetraplets = Rc::new(RefCell::new(vec![])); - let echo_call_service: CallServiceClosure = Box::new(move |mut params| -> CallServiceResult { + let echo_call_service: CallServiceClosure = Box::new(move |mut params| { let arg_tetraplets_inner = arg_tetraplets.clone(); arg_tetraplets_inner.borrow_mut().push(params.tetraplets.clone()); - CallServiceResult::ok(params.arguments.remove(0)) + let result = CallServiceResult::ok(params.arguments.remove(0)); + async move { result }.boxed_local() }); let (echo_call_service, tetraplet_checker) = tetraplet_host_function(echo_call_service); @@ -1227,10 +1235,11 @@ async fn canon_map_2_scalar_tetraplet_check() { let arg_tetraplets = Rc::new(RefCell::new(vec![])); - let call_service: CallServiceClosure = Box::new(move |mut params| -> CallServiceResult { + let call_service: CallServiceClosure = Box::new(move |mut params| { let arg_tetraplets_inner = arg_tetraplets.clone(); arg_tetraplets_inner.borrow_mut().push(params.tetraplets.clone()); - CallServiceResult::ok(params.arguments.remove(0)) + let result = CallServiceResult::ok(params.arguments.remove(0)); + async move { result }.boxed_local() }); let (call_service, tetraplet_checker) = tetraplet_host_function(call_service); @@ -1303,10 +1312,11 @@ async fn canon_map_2_scalar_with_lens_tetraplet_check() { let arg_tetraplets = Rc::new(RefCell::new(vec![])); - let call_service: CallServiceClosure = Box::new(move |mut params| -> CallServiceResult { + let call_service: CallServiceClosure = Box::new(move |mut params| { let arg_tetraplets_inner = arg_tetraplets.clone(); arg_tetraplets_inner.borrow_mut().push(params.tetraplets.clone()); - CallServiceResult::ok(params.arguments.remove(0)) + let result = CallServiceResult::ok(params.arguments.remove(0)); + async move { result }.boxed_local() }); let (call_service, tetraplet_checker) = tetraplet_host_function(call_service); @@ -1378,10 +1388,11 @@ async fn canon_map_with_lens_by_key_number_tetraplet_check() { let arg_tetraplets = Rc::new(RefCell::new(vec![])); - let call_service: CallServiceClosure = Box::new(move |mut params| -> CallServiceResult { + let call_service: CallServiceClosure = Box::new(move |mut params| { let arg_tetraplets_inner = arg_tetraplets.clone(); arg_tetraplets_inner.borrow_mut().push(params.tetraplets.clone()); - CallServiceResult::ok(params.arguments.remove(0)) + let result = CallServiceResult::ok(params.arguments.remove(0)); + async move { result }.boxed_local() }); let (call_service, tetraplet_checker) = tetraplet_host_function(call_service); @@ -1458,10 +1469,11 @@ async fn canon_map_with_lens_by_key_number_key_tetraplet_check() { let arg_tetraplets = Rc::new(RefCell::new(vec![])); - let call_service: CallServiceClosure = Box::new(move |mut params| -> CallServiceResult { + let call_service: CallServiceClosure = Box::new(move |mut params| { let arg_tetraplets_inner = arg_tetraplets.clone(); arg_tetraplets_inner.borrow_mut().push(params.tetraplets.clone()); - CallServiceResult::ok(params.arguments.remove(0)) + let result = CallServiceResult::ok(params.arguments.remove(0)); + async move { result }.boxed_local() }); let (call_service, tetraplet_checker) = tetraplet_host_function(call_service); diff --git a/air/tests/test_module/instructions/fail.rs b/air/tests/test_module/instructions/fail.rs index e9a32ee38c..b983178000 100644 --- a/air/tests/test_module/instructions/fail.rs +++ b/air/tests/test_module/instructions/fail.rs @@ -230,7 +230,7 @@ async fn fail_to_fail_with_unsupported_errorcode_in_scalar() { (fail scalar) ) "#; - fail_to_fail_with_unsupported_errorcode(script); + fail_to_fail_with_unsupported_errorcode(script).await; } #[tokio::test] @@ -241,7 +241,7 @@ async fn fail_to_fail_with_unsupported_errorcode_in_scalar_wl() { (fail scalar.$.key) ) "#; - fail_to_fail_with_unsupported_errorcode(script); + fail_to_fail_with_unsupported_errorcode(script).await; } #[tokio::test] @@ -252,7 +252,7 @@ async fn fail_to_fail_with_unsupported_errorcode_in_canon() { (fail scalar.$.[0]) ) "#; - fail_to_fail_with_unsupported_errorcode(script); + fail_to_fail_with_unsupported_errorcode(script).await; } #[tokio::test] @@ -260,5 +260,5 @@ async fn fail_to_fail_with_unsupported_errorcode_in_error() { let script = r#" (fail :error:) "#; - fail_to_fail_with_unsupported_errorcode(script); + fail_to_fail_with_unsupported_errorcode(script).await; } diff --git a/air/tests/test_module/instructions/fold.rs b/air/tests/test_module/instructions/fold.rs index 29a1f970cc..4c6bc9cb6a 100644 --- a/air/tests/test_module/instructions/fold.rs +++ b/air/tests/test_module/instructions/fold.rs @@ -23,6 +23,7 @@ use air_test_utils::key_utils::at; use air_test_utils::prelude::*; use pretty_assertions::assert_eq; +use futures::FutureExt; use std::cell::RefCell; use std::rc::Rc; @@ -803,9 +804,10 @@ async fn fold_stream_map() { let arg_tetraplets = Rc::new(RefCell::new(vec![])); let arg_tetraplets_inner = arg_tetraplets.clone(); - let set_variable_call_service: CallServiceClosure = Box::new(move |params| -> CallServiceResult { + let set_variable_call_service: CallServiceClosure = Box::new(move |params| { arg_tetraplets_inner.borrow_mut().push(params.tetraplets.clone()); - CallServiceResult::ok(json!({"keyo": k1, "keyu": k2})) + let result = CallServiceResult::ok(json!({"keyo": k1, "keyu": k2})); + async move { result }.boxed_local() }); let mut vm_1 = create_avm(set_variable_call_service, vm_1_peer_id).await; diff --git a/air/tests/test_module/instructions/new.rs b/air/tests/test_module/instructions/new.rs index 0e6543b2bc..687b79b15e 100644 --- a/air/tests/test_module/instructions/new.rs +++ b/air/tests/test_module/instructions/new.rs @@ -18,6 +18,7 @@ use air_interpreter_data::ExecutionTrace; use air_test_utils::prelude::*; use pretty_assertions::assert_eq; +use futures::FutureExt; #[tokio::test] #[ignore] @@ -512,14 +513,14 @@ const OUTSIDE_ACTION_NAME: &str = "outside_new"; const INSIDE_ACTION_NAME: &str = "inside_new"; const OUTPUT_ACTION_NAME: &str = "output"; -fn prepare_new_test_call_service() -> CallServiceClosure { +fn prepare_new_test_call_service() -> CallServiceClosure<'static> { let outside_new_id = std::cell::Cell::new(0u32); let inside_new_id = std::cell::Cell::new(10u32); Box::new(move |mut params| { let action = params.arguments.remove(0); let action = action.as_str().unwrap(); - match action { + let result = match action { GET_ITERABLE_ACTION_NAME => CallServiceResult::ok(json!([1, 2, 3])), OUTSIDE_ACTION_NAME => { let outside_result = outside_new_id.get(); @@ -539,7 +540,8 @@ fn prepare_new_test_call_service() -> CallServiceClosure { println!("unknown action: {action_name:?}"); CallServiceResult::err(1, json!("no such action")) } - } + }; + async move { result }.boxed_local() }) } diff --git a/air/tests/test_module/integration/chat_join.rs b/air/tests/test_module/integration/chat_join.rs index 1987500db6..93d617627a 100644 --- a/air/tests/test_module/integration/chat_join.rs +++ b/air/tests/test_module/integration/chat_join.rs @@ -18,6 +18,7 @@ use air_interpreter_data::ExecutionTrace; use air_test_utils::prelude::*; use pretty_assertions::assert_eq; +use futures::FutureExt; #[tokio::test] async fn join_chat_1() { @@ -38,7 +39,10 @@ async fn join_chat_1() { let remote_peer_id = "remote_peer_id"; let members = json!([[client_1_peer_id, relay_1_peer_id], [client_2_peer_id, relay_2_peer_id]]); let members_call_service: CallServiceClosure = - Box::new(move |_| -> CallServiceResult { CallServiceResult::ok(members.clone()) }); + Box::new(move |_| { + let result = CallServiceResult::ok(members.clone()); + async move { result }.boxed_local() + }); let mut remote = create_avm(members_call_service, remote_peer_id).await; let script = format!( @@ -298,7 +302,10 @@ async fn join_chat_1() { #[tokio::test] async fn join_chat_2() { let members_call_service1: CallServiceClosure = - Box::new(|_| -> CallServiceResult { CallServiceResult::ok(json!([["A"], ["B"]])) }); + Box::new(|_| { + let result = CallServiceResult::ok(json!([["A"], ["B"]])); + async move { result }.boxed_local() + }); let relay_1_peer_id = "relay_1_peer_id"; let mut relay_1 = create_avm(unit_call_service(), relay_1_peer_id).await; @@ -400,7 +407,10 @@ async fn init_peer_id() { let remote_peer_id = "remote_peer_id"; let members = json!([[client_1_peer_id], ["B"]]); let members_call_service: CallServiceClosure = - Box::new(move |_| -> CallServiceResult { CallServiceResult::ok(members.clone()) }); + Box::new(move |_| { + let result = CallServiceResult::ok(members.clone()); + async move { result }.boxed_local() + }); let mut remote = create_avm(members_call_service, remote_peer_id).await; let script = format!( diff --git a/air/tests/test_module/integration/create_service.rs b/air/tests/test_module/integration/create_service.rs index c6a7b1485e..bc33fbdec8 100644 --- a/air/tests/test_module/integration/create_service.rs +++ b/air/tests/test_module/integration/create_service.rs @@ -15,6 +15,7 @@ */ use air_test_utils::prelude::*; +use futures::FutureExt; #[tokio::test] async fn create_service() { @@ -50,7 +51,7 @@ async fn create_service() { let add_blueprint_response = "add_blueprint response"; let create_response = "create response"; - let call_service: CallServiceClosure = Box::new(move |params| -> CallServiceResult { + let call_service: CallServiceClosure = Box::new(move |params| { let response = match params.service_id.as_str() { "add_module" => add_module_response, "add_blueprint" => add_blueprint_response, @@ -58,7 +59,8 @@ async fn create_service() { _ => "unknown response", }; - CallServiceResult::ok(json!(response)) + let result = CallServiceResult::ok(json!(response)); + async move { result }.boxed_local() }); let mut vm = create_avm(call_service, "A").await; diff --git a/air/tests/test_module/integration/dashboard.rs b/air/tests/test_module/integration/dashboard.rs index fb60dd92a9..088e3726a9 100644 --- a/air/tests/test_module/integration/dashboard.rs +++ b/air/tests/test_module/integration/dashboard.rs @@ -17,6 +17,7 @@ use air_test_utils::prelude::*; use futures::StreamExt; +use futures::FutureExt; use std::cell::RefCell; use std::collections::HashSet; @@ -50,7 +51,7 @@ fn client_host_function( known_peers: Vec, client_id: String, relay_id: String, -) -> (CallServiceClosure, Rc>) { +) -> (CallServiceClosure<'static>, Rc>) { let all_info = Rc::new(RefCell::new(String::new())); let known_peers = JValue::Array(known_peers.iter().cloned().map(JValue::String).collect::>()); let client_id = JValue::String(client_id); @@ -72,7 +73,7 @@ fn client_host_function( ); let all_info_inner = all_info.clone(); - let host_function: CallServiceClosure = Box::new(move |params| -> CallServiceResult { + let host_function: CallServiceClosure = Box::new(move |params| { let ret_value = match serde_json::from_value(JValue::Array(params.arguments.clone())) { Ok(args) => to_ret_value(params.service_id.as_str(), params.function_name.as_str(), args), Err(_) => { @@ -81,7 +82,8 @@ fn client_host_function( } }; - CallServiceResult::ok(ret_value) + let result = CallServiceResult::ok(ret_value); + async move { result }.boxed_local() }); (host_function, all_info) @@ -93,7 +95,7 @@ fn peer_host_function( modules: Vec, interfaces: Vec, ident: String, -) -> CallServiceClosure { +) -> CallServiceClosure<'static> { let known_peers = JValue::Array(known_peers.into_iter().map(JValue::String).collect()); let blueprints = JValue::Array(blueprints.into_iter().map(JValue::String).collect()); let modules = JValue::Array(modules.into_iter().map(JValue::String).collect()); @@ -115,17 +117,18 @@ fn peer_host_function( }, ); - Box::new(move |params| -> CallServiceResult { + Box::new(move |params| { let args: Vec = serde_json::from_value(JValue::Array(params.arguments)).unwrap(); let t_args = args.iter().map(|s| s.as_str()).collect::>(); let ret_value = to_ret_value(params.service_id.as_str(), params.function_name.as_str(), t_args); - CallServiceResult::ok(ret_value) + let result = CallServiceResult::ok(ret_value); + async move { result }.boxed_local() }) } #[rustfmt::skip] -fn create_peer_host_function(peer_id: String, known_peer_ids: Vec) -> CallServiceClosure { +fn create_peer_host_function(peer_id: String, known_peer_ids: Vec) -> CallServiceClosure<'static> { let relay_blueprints = (0..=2).map(|id| format!("{peer_id}_blueprint_{id}")).collect::>(); let relay_modules = (0..=2).map(|id| format!("{peer_id}_module_{id}")).collect::>(); let relay_interfaces = (0..=2).map(|id| format!("{peer_id}_interface_{id}")).collect::>(); diff --git a/air/tests/test_module/issues/issue_632.rs b/air/tests/test_module/issues/issue_632.rs index f67bf6aa36..2797fea86d 100644 --- a/air/tests/test_module/issues/issue_632.rs +++ b/air/tests/test_module/issues/issue_632.rs @@ -14,8 +14,11 @@ * limitations under the License. */ +use std::cell::RefCell; use air_test_utils::{key_utils::derive_dummy_keypair, prelude::*}; +use std::rc::Rc; + #[tokio::test] async fn issue_310() { let (key_pair, peer_id) = derive_dummy_keypair("init_peer_id"); @@ -34,23 +37,30 @@ async fn issue_310() { ) "#; - let mut runner = DefaultAirRunner::new(&peer_id).await; - let mut call = |prev_data, call_results| async { - runner - .call( - air_script, - prev_data, - "", - peer_id.clone(), - 0, - 0, - None, - call_results, - key_pair.as_inner(), - particle_id.to_owned(), - ) - .await - .unwrap() + let runner = Rc::new(RefCell::new(DefaultAirRunner::new(&peer_id).await)); + let call = |prev_data, call_results| { + let runner = runner.clone(); + let peer_id = peer_id.clone(); + let key_pair = key_pair.as_inner(); + let particle_id = particle_id.to_owned(); + async move { + runner + .borrow_mut() + .call( + air_script, + prev_data, + "", + peer_id, + 0, + 0, + None, + call_results, + key_pair, + particle_id, + ) + .await + .unwrap() + } }; let res1 = call(&b""[..], <_>::default()).await; diff --git a/crates/air-lib/test-utils/src/call_services.rs b/crates/air-lib/test-utils/src/call_services.rs index 1f5eec682c..e6b1ce36ab 100644 --- a/crates/air-lib/test-utils/src/call_services.rs +++ b/crates/air-lib/test-utils/src/call_services.rs @@ -18,24 +18,31 @@ use super::*; use serde_json::json; +use futures::FutureExt; + use std::cell::RefCell; use std::collections::HashMap; use std::rc::Rc; -pub fn unit_call_service() -> CallServiceClosure<'_> { +pub fn unit_call_service() -> CallServiceClosure<'static> { Box::new(|_| async { CallServiceResult::ok(json!("result from unit_call_service")) }.boxed_local()) } -pub fn echo_call_service() -> CallServiceClosure<'_> { - Box::new(|mut params| async { +pub fn echo_call_service() -> CallServiceClosure<'static> { + Box::new(|mut params| async move { CallServiceResult::ok(params.arguments.remove(0)) }.boxed_local()) } -pub fn set_variable_call_service(json: JValue) -> CallServiceClosure { - Box::new(move |_| -> CallServiceResult { CallServiceResult::ok(json.clone()) }) +pub fn set_variable_call_service(json: JValue) -> CallServiceClosure<'static> { + Box::new(move |_| { + let json = json.clone(); + async move { + CallServiceResult::ok(json) + } + }.boxed_local()) } /// Manages which source will be used to choose a variable. @@ -49,71 +56,95 @@ pub enum VariableOptionSource { pub fn set_variables_call_service( variables_mapping: HashMap, variable_source: VariableOptionSource, -) -> CallServiceClosure { +) -> CallServiceClosure<'static> { use VariableOptionSource::*; - Box::new(move |params| -> CallServiceResult { - let var_name = match variable_source { - Argument(id) => match params.arguments.get(id) { - Some(JValue::String(name)) => name.to_string(), - _ => "default".to_string(), - }, - FunctionName => params.function_name, - ServiceName => params.service_id, - }; - - variables_mapping.get(&var_name).map_or_else( - || CallServiceResult::ok(json!("default result from set_variables_call_service")), - |var| CallServiceResult::ok(var.clone()), - ) + let variable_source = Rc::new(variable_source); + let variables_mapping = Rc::new(variables_mapping); + + Box::new(move |params| { + let variable_source = variable_source.clone(); + let variables_mapping = variables_mapping.clone(); + async move { + let var_name = match variable_source.as_ref() { + Argument(id) => match params.arguments.get(*id) { + Some(JValue::String(name)) => name.to_string(), + _ => "default".to_string(), + }, + FunctionName => params.function_name, + ServiceName => params.service_id, + }; + + variables_mapping.get(&var_name).map_or_else( + || CallServiceResult::ok(json!("default result from set_variables_call_service")), + |var| CallServiceResult::ok(var.clone()), + ) + }.boxed_local() }) } -pub fn return_string_call_service(ret_str: impl Into) -> CallServiceClosure { - let ret_str = ret_str.into(); +pub fn return_string_call_service(ret_str: impl Into) -> CallServiceClosure<'static> { + let ret_str = Rc::new(ret_str.into()); - Box::new(move |_| -> CallServiceResult { CallServiceResult::ok(json!(ret_str)) }) + Box::new(move |_| { + let ret_str = ret_str.clone(); + async move { + CallServiceResult::ok(json!(ret_str.to_string())) + }.boxed_local() + }) } -pub fn fallible_call_service(fallible_service_id: impl Into) -> CallServiceClosure { - let fallible_service_id = fallible_service_id.into(); - - Box::new(move |params| -> CallServiceResult { - // return a error for service with such id - if params.service_id == fallible_service_id { - CallServiceResult::err(1, json!("failed result from fallible_call_service")) - } else { - // return success for services with other service id - CallServiceResult::ok(json!("success result from fallible_call_service")) - } +pub fn fallible_call_service(fallible_service_id: impl Into) -> CallServiceClosure<'static> { + let fallible_service_id = Rc::new(fallible_service_id.into()); + + Box::new(move |params| { + let fallible_service_id = fallible_service_id.clone(); + async move { + // return a error for service with such id + if params.service_id == fallible_service_id.as_str() { + CallServiceResult::err(1, json!("failed result from fallible_call_service")) + } else { + // return success for services with other service id + CallServiceResult::ok(json!("success result from fallible_call_service")) + } + }.boxed_local() }) } -pub fn fallible_call_service_by_arg(arg: impl Into) -> CallServiceClosure { - let arg = arg.into(); - - Box::new(move |params| -> CallServiceResult { - // return a error for service with specific arg - if params.arguments.get(0) == Some(&arg) { - CallServiceResult::err(1, json!("failed result from fallible_call_service_by_arg")) - } else { - // return success for services with other arg - CallServiceResult::ok(json!("success result from fallible_call_service_by_arg")) - } +pub fn fallible_call_service_by_arg(arg: impl Into) -> CallServiceClosure<'static> { + let arg = Rc::new(arg.into()); + + Box::new(move |params| { + let arg = arg.clone(); + async move { + // return a error for service with specific arg + if params.arguments.get(0) == Some(arg.as_ref()) { + CallServiceResult::err(1, json!("failed result from fallible_call_service_by_arg")) + } else { + // return success for services with other arg + CallServiceResult::ok(json!("success result from fallible_call_service_by_arg")) + } + }.boxed_local() }) } pub type ArgTetraplets = Vec>; pub fn tetraplet_host_function( - closure: impl Fn(CallRequestParams) -> CallServiceResult + 'static, -) -> (CallServiceClosure, Rc>) { + closure: CallServiceClosure<'static>, +) -> (CallServiceClosure<'static>, Rc>) { let arg_tetraplets = Rc::new(RefCell::new(ArgTetraplets::new())); + let closure = Rc::new(closure); let arg_tetraplets_inner = arg_tetraplets.clone(); - let host_function: CallServiceClosure = Box::new(move |params| -> CallServiceResult { - *arg_tetraplets_inner.borrow_mut() = params.tetraplets.clone(); - closure(params) + + let host_function: CallServiceClosure<'_> = Box::new(move |params| { + let arg_tetraplets_inner= arg_tetraplets_inner.clone(); + let closure = closure.clone(); + async move { + *arg_tetraplets_inner.borrow_mut() = params.tetraplets.clone(); + closure(params).await + }.boxed_local() }); (host_function, arg_tetraplets) diff --git a/crates/air-lib/test-utils/src/lib.rs b/crates/air-lib/test-utils/src/lib.rs index 99792caac4..bec615e73d 100644 --- a/crates/air-lib/test-utils/src/lib.rs +++ b/crates/air-lib/test-utils/src/lib.rs @@ -34,7 +34,6 @@ pub mod test_runner; pub mod native_test_runner; pub mod wasm_test_runner; -use std::future::Future; pub use air::interpreter_data::*; use air::ExecutionCidState; diff --git a/crates/air-lib/test-utils/src/test_runner.rs b/crates/air-lib/test-utils/src/test_runner.rs index 2e92c1fbc6..267264fd19 100644 --- a/crates/air-lib/test-utils/src/test_runner.rs +++ b/crates/air-lib/test-utils/src/test_runner.rs @@ -29,6 +29,7 @@ use super::CallServiceClosure; use avm_server::avm_runner::*; use fluence_keypair::KeyPair; use futures::future::LocalBoxFuture; +use futures::StreamExt; use std::collections::HashMap; use std::collections::HashSet; @@ -56,7 +57,7 @@ pub trait AirRunner { pub struct TestRunner { pub runner: R, - call_service: CallServiceClosure, + call_service: CallServiceClosure<'static>, pub keypair: KeyPair, } @@ -117,14 +118,17 @@ impl TestRunner { return Ok(outcome); } - call_results = outcome + call_results = + futures::stream::iter(outcome .call_requests .into_iter() - .map(|(id, call_parameters)| { + ) + .then(|(id, call_parameters)| { let service_result = (self.call_service)(call_parameters); - (id, service_result) - }) - .collect::>(); + async move { + (id, service_result.await) + }}) + .collect::>().await; prev_data = outcome.data; data = vec![]; @@ -160,14 +164,14 @@ impl TestRunner { } pub async fn create_avm( - call_service: CallServiceClosure, + call_service: CallServiceClosure<'static>, current_peer_id: impl Into, ) -> TestRunner { create_custom_avm(call_service, current_peer_id).await } pub async fn create_custom_avm( - call_service: CallServiceClosure, + call_service: CallServiceClosure<'static>, current_peer_id: impl Into, ) -> TestRunner { let current_peer_id = current_peer_id.into(); @@ -185,7 +189,7 @@ pub async fn create_custom_avm( pub async fn create_avm_with_key( keypair: impl Into, - call_service: CallServiceClosure, + call_service: CallServiceClosure<'static>, ) -> TestRunner { let keypair = keypair.into(); let current_peer_id = keypair.public().to_peer_id().to_string(); diff --git a/crates/testing-framework/src/asserts/behavior.rs b/crates/testing-framework/src/asserts/behavior.rs index bf104dcc8e..24d43f9894 100644 --- a/crates/testing-framework/src/asserts/behavior.rs +++ b/crates/testing-framework/src/asserts/behavior.rs @@ -62,12 +62,12 @@ pub(crate) fn parse_behaviour(inp: &str) -> IResult<&str, Behavior, super::parse } impl Behavior { - pub(crate) fn call(&self, params: air_test_utils::CallRequestParams) -> CallServiceResult { + pub(crate) async fn call(&self, params: air_test_utils::CallRequestParams) -> CallServiceResult { use Behavior::*; match self { - Echo => echo_call_service()(params), - Unit => unit_call_service()(params), + Echo => echo_call_service()(params).await, + Unit => unit_call_service()(params).await, Function => CallServiceResult::ok(params.function_name.into()), Service => CallServiceResult::ok(params.service_id.into()), Arg(n) => match params.arguments.get(*n) { diff --git a/crates/testing-framework/src/asserts/mod.rs b/crates/testing-framework/src/asserts/mod.rs index c1729d6991..983571776a 100644 --- a/crates/testing-framework/src/asserts/mod.rs +++ b/crates/testing-framework/src/asserts/mod.rs @@ -93,7 +93,7 @@ impl ServiceDefinition { Self::Map(map) } - pub fn call(&self, params: CallRequestParams) -> CallServiceResult { + pub async fn call(&self, params: CallRequestParams) -> CallServiceResult { match self { ServiceDefinition::Ok(ok) => CallServiceResult::ok(ok.clone()), ServiceDefinition::Error(call_result) => call_result.clone(), @@ -105,8 +105,8 @@ impl ServiceDefinition { ref call_number_seq, call_map, } => call_seq_error(call_number_seq, call_map), - ServiceDefinition::Behaviour(name) => name.call(params), - ServiceDefinition::DbgBehaviour(name) => dbg!(name.call(dbg!(params))), + ServiceDefinition::Behaviour(name) => name.call(params).await, + ServiceDefinition::DbgBehaviour(name) => dbg!(name.call(dbg!(params)).await), ServiceDefinition::Map(map) => call_map_service(map, params), } } diff --git a/crates/testing-framework/src/ephemeral/mod.rs b/crates/testing-framework/src/ephemeral/mod.rs index 2bc377cac3..96ca22bbdf 100644 --- a/crates/testing-framework/src/ephemeral/mod.rs +++ b/crates/testing-framework/src/ephemeral/mod.rs @@ -142,13 +142,13 @@ pub struct Network { // Rust fails to deduce type for `Network::empty()` without // extencive test code changes impl Network { - pub fn empty() -> Rc { - Self::new(std::iter::empty::(), vec![]) + pub async fn empty() -> Rc { + Self::new(std::iter::empty::(), vec![]).await } } impl Network { - pub fn new( + pub async fn new( named_peers: impl Iterator>, common_services: Vec, ) -> Rc { @@ -158,13 +158,13 @@ impl Network { resolver: Default::default(), }); for peer_name in named_peers { - network.ensure_named_peer(peer_name); + network.ensure_named_peer(peer_name).await; } network } - pub fn from_peers(nodes: Vec>) -> Rc { - let network = Self::new(std::iter::empty::(), vec![]); + pub async fn from_peers(nodes: Vec>) -> Rc { + let network = Self::new(std::iter::empty::(), vec![]).await; let neighborhood: PeerSet = nodes.iter().map(|peer| peer.peer_id.clone()).collect(); for peer in nodes { network.add_peer_env(peer, neighborhood.iter().cloned()); diff --git a/crates/testing-framework/src/ephemeral/neighborhood.rs b/crates/testing-framework/src/ephemeral/neighborhood.rs index 8261a5db40..a295ef2c67 100644 --- a/crates/testing-framework/src/ephemeral/neighborhood.rs +++ b/crates/testing-framework/src/ephemeral/neighborhood.rs @@ -246,7 +246,7 @@ mod tests { let (_other_pk1, other_id) = derive_dummy_keypair(other_name); let peer_id = PeerId::from(peer_id); let other_id = PeerId::from(other_id); - let network = Network::::new(std::iter::empty::(), vec![]); + let network = Network::::new(std::iter::empty::(), vec![]).await; let penv = PeerEnv::new(Peer::new(peer_pk, Rc::from(vec![])).await, &network); assert!(penv.is_reachable(&peer_id)); @@ -261,7 +261,7 @@ mod tests { let (_other_pk, other_id) = derive_dummy_keypair(other_name); let peer_id = PeerId::from(peer_id); let other_id = PeerId::from(other_id); - let network = Network::::new(std::iter::empty::(), vec![]); + let network = Network::::new(std::iter::empty::(), vec![]).await; let mut penv = PeerEnv::new(Peer::new(peer_pk, Rc::from(vec![])).await, &network); { @@ -289,15 +289,15 @@ mod tests { let (_other_pk2, other_id2) = derive_dummy_keypair(other_name2); let other_id1 = PeerId::from(other_id1); let other_id2 = PeerId::from(other_id2); - let network = Network::::new(std::iter::empty::(), vec![]); + let network = Network::::new(std::iter::empty::(), vec![]).await; let penv = PeerEnv::new(Peer::new(peer_pk, Rc::from(vec![])).await, &network); // iter is empty assert!(penv.iter().next().is_none()); - network.ensure_named_peer(other_name1); - network.ensure_named_peer(other_name1); - network.ensure_named_peer(other_name2); + network.ensure_named_peer(other_name1).await; + network.ensure_named_peer(other_name1).await; + network.ensure_named_peer(other_name2).await; let expected_neighborhood = PeerSet::from([other_id1, other_id2]); assert_eq!(penv.iter().collect::(), expected_neighborhood); } @@ -312,15 +312,15 @@ mod tests { let (_other_pk2, other_id2) = derive_dummy_keypair(other_name2); let other_id1 = PeerId::from(other_id1); let other_id2 = PeerId::from(other_id2); - let network = Network::::new(std::iter::empty::(), vec![]); + let network = Network::::new(std::iter::empty::(), vec![]).await; let penv = PeerEnv::new(Peer::new(peer_pk, Rc::from(vec![])).await, &network); // iter is empty assert!(penv.iter().next().is_none()); - network.ensure_named_peer(other_name1); - network.ensure_named_peer(other_name2); + network.ensure_named_peer(other_name1).await; + network.ensure_named_peer(other_name2).await; let expected_neighborhood = PeerSet::from([other_id1, other_id2]); assert_eq!(PeerSet::from_iter(penv.iter()), expected_neighborhood); } @@ -335,7 +335,7 @@ mod tests { let (_other_pk2, other_id2) = derive_dummy_keypair(other_name2); let other_id1 = PeerId::from(other_id1); let other_id2 = PeerId::from(other_id2); - let network = Network::::new(std::iter::empty::(), vec![]); + let network = Network::::new(std::iter::empty::(), vec![]).await; let mut penv = PeerEnv::new(Peer::new(peer_pk, Rc::from(vec![])).await, &network); @@ -356,7 +356,7 @@ mod tests { let (peer_pk, _peer_id) = derive_dummy_keypair(peer_name); let (_other_pk1, other_id1) = derive_dummy_keypair(other_name1); let other_id1 = PeerId::from(other_id1); - let network = Network::::new(std::iter::empty::(), vec![]); + let network = Network::::new(std::iter::empty::(), vec![]).await; let mut penv = PeerEnv::new(Peer::new(peer_pk, Rc::from(vec![])).await, &network); @@ -376,7 +376,7 @@ mod tests { let peer_name = "peer"; let (peer_pk, _peer_id) = derive_dummy_keypair(peer_name); - let network = Network::::new(std::iter::empty::(), vec![]); + let network = Network::::new(std::iter::empty::(), vec![]).await; let mut penv = PeerEnv::new(Peer::new(peer_pk, Rc::from(vec![])).await, &network); penv.get_neighborhood_mut() @@ -391,7 +391,7 @@ mod tests { #[tokio::test] async fn test_remove_from_neiborhood() { - let network = Network::::new(std::iter::empty::(), vec![]); + let network = Network::::new(std::iter::empty::(), vec![]).await; let (peer_pk, _peer_id) = derive_dummy_keypair("someone"); let mut penv = PeerEnv::new(Peer::new(peer_pk, Rc::from(vec![])).await, &network); @@ -414,7 +414,7 @@ mod tests { let (peer_pk, _peer_id) = derive_dummy_keypair(peer_name); let (_other_pk, other_id) = derive_dummy_keypair(other_name1); let other_id = PeerId::from(other_id); - let network = Network::::new(std::iter::empty::(), vec![]); + let network = Network::::new(std::iter::empty::(), vec![]).await; let mut penv = PeerEnv::new(Peer::new(peer_pk, Rc::from(vec![])).await, &network); let nei = penv.get_neighborhood_mut(); @@ -433,7 +433,7 @@ mod tests { let (peer_pk, _peer_id) = derive_dummy_keypair(peer_name); let (_other_pk, other_id) = derive_dummy_keypair(other_name1); let other_id = PeerId::from(other_id); - let network = Network::::new(std::iter::empty::(), vec![]); + let network = Network::::new(std::iter::empty::(), vec![]).await; let mut penv = PeerEnv::new(Peer::new(peer_pk, Rc::from(vec![])).await, &network); @@ -458,7 +458,7 @@ mod tests { let (peer_pk, _peer_id) = derive_dummy_keypair(peer_name); let (_other_pk, other_id) = derive_dummy_keypair(other_name1); let other_id = PeerId::from(other_id); - let network = Network::::new(std::iter::empty::(), vec![]); + let network = Network::::new(std::iter::empty::(), vec![]).await; let mut penv = PeerEnv::new(Peer::new(peer_pk, Rc::from(vec![])).await, &network); let nei = penv.get_neighborhood_mut(); @@ -482,7 +482,7 @@ mod tests { let peer_id = PeerId::from(peer_id); let other_id = PeerId::from(other_id); let remote_id = PeerId::from(remote_id); - let network = Network::::new(std::iter::empty::(), vec![]); + let network = Network::::new(std::iter::empty::(), vec![]).await; let mut penv = PeerEnv::new(Peer::new(peer_pk, Rc::from(vec![])).await, &network); penv.get_neighborhood_mut() diff --git a/crates/testing-framework/src/execution/mod.rs b/crates/testing-framework/src/execution/mod.rs index 55d32efa0f..57862f9535 100644 --- a/crates/testing-framework/src/execution/mod.rs +++ b/crates/testing-framework/src/execution/mod.rs @@ -26,9 +26,14 @@ use air_test_utils::{ RawAVMOutcome, }; -use futures::stream::StreamExt; +use futures::StreamExt; use futures::future::OptionFuture; +#[allow(unused)] // compiler gives warning, but it is used +use futures::future::LocalBoxFuture; +#[allow(unused)] // compiler gives warning, but it is used +use futures::FutureExt; + use std::{borrow::Borrow, hash::Hash, rc::Rc}; /// A executor for an AIR script. Several executors may share same TransformedAirScript @@ -88,8 +93,8 @@ impl AirScriptExecutor { extra_peers: impl IntoIterator, annotated_air_script: &str, ) -> Result { - let network = Network::new(extra_peers.into_iter(), common_services); - let transformed = TransformedAirScript::new(annotated_air_script, network)?; + let network = Network::new(extra_peers.into_iter(), common_services).await; + let transformed = TransformedAirScript::new(annotated_air_script, network).await?; Self::from_transformed_air_script(test_parameters, transformed).await } @@ -99,7 +104,7 @@ impl AirScriptExecutor { network: Rc>, annotated_air_script: &str, ) -> Result { - let transformed = TransformedAirScript::new(annotated_air_script, network)?; + let transformed = TransformedAirScript::new(annotated_air_script, network).await?; Self::from_transformed_air_script(test_parameters, transformed).await } @@ -655,12 +660,13 @@ mod tests { #[tokio::test] async fn test_transformed_distinct() { let peer_name = "peer1"; - let network = Network::::new(std::iter::empty::(), vec![]); + let network = Network::::new(std::iter::empty::(), vec![]).await; let transformed1 = TransformedAirScript::new( &format!(r#"(call "{peer_name}" ("service" "function") []) ; ok = 42"#), network.clone(), ) + .await .unwrap(); let exectution1 = AirScriptExecutor::from_transformed_air_script( TestRunParameters::from_init_peer_id(peer_name), @@ -673,6 +679,7 @@ mod tests { &format!(r#"(call "{peer_name}" ("service" "function") []) ; ok = 24"#,), network, ) + .await .unwrap(); let exectution2 = AirScriptExecutor::from_transformed_air_script( TestRunParameters::from_init_peer_id(peer_name), @@ -711,9 +718,11 @@ mod tests { } impl MarineService for Service { - fn call(&self, _params: CallRequestParams) -> crate::services::FunctionOutcome { - let mut cell = self.state.borrow_mut(); - crate::services::FunctionOutcome::from_value(cell.next().unwrap()) + fn call<'this>(&'this self, _params: CallRequestParams) -> LocalBoxFuture<'this, crate::services::FunctionOutcome> { + async { + let mut cell = self.state.borrow_mut(); + crate::services::FunctionOutcome::from_value(cell.next().unwrap()) + }.boxed_local() } } let service = Service { @@ -722,11 +731,11 @@ mod tests { let network = Network::::new( std::iter::empty::(), vec![service.to_handle()], - ); + ).await; let peer_name = "peer1"; let air_script = format!(r#"(call "{peer_name}" ("service" "function") [])"#); - let transformed1 = TransformedAirScript::new(&air_script, network.clone()).unwrap(); + let transformed1 = TransformedAirScript::new(&air_script, network.clone()).await.unwrap(); let exectution1 = AirScriptExecutor::from_transformed_air_script( TestRunParameters::from_init_peer_id(peer_name), transformed1, @@ -734,7 +743,7 @@ mod tests { .await .unwrap(); - let transformed2 = TransformedAirScript::new(&air_script, network).unwrap(); + let transformed2 = TransformedAirScript::new(&air_script, network).await.unwrap(); let exectution2 = AirScriptExecutor::from_transformed_air_script( TestRunParameters::from_init_peer_id(peer_name), transformed2, diff --git a/crates/testing-framework/src/services/mod.rs b/crates/testing-framework/src/services/mod.rs index 2824da3565..265f43c324 100644 --- a/crates/testing-framework/src/services/mod.rs +++ b/crates/testing-framework/src/services/mod.rs @@ -18,6 +18,9 @@ pub(crate) mod results; use self::results::{MarineServiceWrapper, ResultStore}; +use futures::future::LocalBoxFuture; +use futures::FutureExt; + use air_test_utils::{CallRequestParams, CallServiceClosure, CallServiceResult}; use std::{cell::RefCell, rc::Rc, time::Duration}; @@ -45,7 +48,7 @@ impl FunctionOutcome { /// A mocked Marine service. pub trait MarineService { - fn call(&self, params: CallRequestParams) -> FunctionOutcome; + fn call<'this>(&'this self, params: CallRequestParams) -> LocalBoxFuture<'this, FunctionOutcome>; fn to_handle(self) -> MarineServiceHandle where @@ -59,25 +62,30 @@ pub trait MarineService { pub struct MarineServiceHandle(Rc>>); impl MarineService for MarineServiceHandle { - fn call(&self, params: CallRequestParams) -> FunctionOutcome { - let mut guard = self.0.borrow_mut(); - MarineService::call(guard.as_mut(), params) + fn call<'this>(&'this self, params: CallRequestParams) -> LocalBoxFuture<'this, FunctionOutcome> { + async { + let mut guard = self.0.borrow_mut(); + MarineService::call(guard.as_mut(), params).await + }.boxed_local() } } pub(crate) fn services_to_call_service_closure( services: Rc<[MarineServiceHandle]>, -) -> CallServiceClosure { - Box::new(move |params: CallRequestParams| -> CallServiceResult { - for service_handler in services.as_ref() { - let outcome = service_handler.call(params.clone()); - match outcome { - FunctionOutcome::ServiceResult(result, _) => return result, - FunctionOutcome::NotDefined => continue, - FunctionOutcome::Empty => return CallServiceResult::ok(serde_json::Value::Null), +) -> CallServiceClosure<'static> { + Box::new(move |params: CallRequestParams| { + let services = services.clone(); + async move { + for service_handler in services.as_ref() { + let outcome = service_handler.call(params.clone()).await; + match outcome { + FunctionOutcome::ServiceResult(result, _) => return result, + FunctionOutcome::NotDefined => continue, + FunctionOutcome::Empty => return CallServiceResult::ok(serde_json::Value::Null), + } } - } - panic!("No function found for params {:?}", params) + panic!("No function found for params {:?}", params) + }.boxed_local() }) } diff --git a/crates/testing-framework/src/services/results.rs b/crates/testing-framework/src/services/results.rs index e834361158..bf974c0f84 100644 --- a/crates/testing-framework/src/services/results.rs +++ b/crates/testing-framework/src/services/results.rs @@ -17,6 +17,9 @@ use super::{FunctionOutcome, MarineService}; use crate::asserts::ServiceDefinition; +use futures::FutureExt; +use futures::future::LocalBoxFuture; + use air_test_utils::CallRequestParams; use std::{cell::RefCell, collections::HashMap, rc::Rc}; @@ -36,25 +39,26 @@ impl ResultStore { } impl MarineService for ResultStore { - fn call(&self, mut params: CallRequestParams) -> FunctionOutcome { - let results = self.results.borrow(); - - let (real_service_id, suffix) = match params.service_id.rsplit_once("..") { - Some(split) => split, - None => return FunctionOutcome::NotDefined, - }; + fn call<'this>(&'this self, mut params: CallRequestParams) -> LocalBoxFuture<'this, FunctionOutcome> { + async { + let results = self.results.borrow(); + let (real_service_id, suffix) = match params.service_id.rsplit_once("..") { + Some(split) => split, + None => return FunctionOutcome::NotDefined, + }; - if let Ok(result_id) = suffix.parse::() { - let service_desc = results - .get(&result_id) - .unwrap_or_else(|| panic!("failed to parse service name {:?}", params.service_id)); - // hide the artificial service_id - params.service_id = real_service_id.to_owned(); - FunctionOutcome::from_service_result(service_desc.call(params)) - } else { - // Pass malformed service names further in a chain - FunctionOutcome::NotDefined - } + if let Ok(result_id) = suffix.parse::() { + let service_desc = results + .get(&result_id) + .unwrap_or_else(|| panic!("failed to parse service name {:?}", params.service_id)); + // hide the artificial service_id + params.service_id = real_service_id.to_owned(); + FunctionOutcome::from_service_result(service_desc.call(params).await) + } else { + // Pass malformed service names further in a chain + FunctionOutcome::NotDefined + } + }.boxed_local() } } @@ -69,7 +73,7 @@ impl MarineServiceWrapper { } impl MarineService for MarineServiceWrapper { - fn call(&self, params: CallRequestParams) -> FunctionOutcome { + fn call<'this>(&'this self, params: CallRequestParams) -> LocalBoxFuture<'this, FunctionOutcome> { self.wrapped.call(params) } } diff --git a/crates/testing-framework/src/transform/walker.rs b/crates/testing-framework/src/transform/walker.rs index 055e231c06..0f3b0a588b 100644 --- a/crates/testing-framework/src/transform/walker.rs +++ b/crates/testing-framework/src/transform/walker.rs @@ -21,7 +21,6 @@ use air_test_utils::key_utils::at; use air_test_utils::test_runner::{AirRunner, DefaultAirRunner}; use std::{borrow::Cow, fmt::Write, ops::Deref, rc::Rc, str::FromStr}; -use std::future::Future; /// Transformed script represents transformed script's services' state within the network. /// Executions that use the same transformed script share same generated services' state. @@ -34,22 +33,22 @@ pub struct TransformedAirScript { impl TransformedAirScript { // TODO peer transformation mode - pub fn new(annotated_air_script: &str, network: Rc>) -> Result { + pub async fn new(annotated_air_script: &str, network: Rc>) -> Result { let at_transformed_air_script = at_transform(annotated_air_script); // validate the AIR script with the standard parser first air_parser::parse(&at_transformed_air_script)?; - Self::new_unvalidated(&at_transformed_air_script, network) + Self::new_unvalidated(&at_transformed_air_script, network).await } - pub(crate) fn new_unvalidated( + pub(crate) async fn new_unvalidated( at_transformed_air_script: &str, network: Rc>, ) -> Result { let transformer = Transformer { network: &network }; let mut sexp = Sexp::from_str(at_transformed_air_script)?; - transformer.transform(&mut sexp); + transformer.transform(&mut sexp).await; Ok(Self { network, @@ -160,33 +159,33 @@ mod tests { #[tokio::test] async fn test_translate_null() { - let network = Network::::new(std::iter::empty::(), vec![]); - let transformed = TransformedAirScript::new("(null)", network).unwrap(); + let network = Network::::new(std::iter::empty::(), vec![]).await; + let transformed = TransformedAirScript::new("(null)", network).await.unwrap(); assert_eq!(&*transformed, "(null)"); } #[tokio::test] async fn test_translate_call_no_result() { - let network = Network::::new(std::iter::empty::(), vec![]); + let network = Network::::new(std::iter::empty::(), vec![]).await; let script = r#"(call peer_id ("service_id" func) [])"#; - let transformed = TransformedAirScript::new_unvalidated(script, network).unwrap(); + let transformed = TransformedAirScript::new_unvalidated(script, network).await.unwrap(); assert_eq!(&*transformed, script); } #[tokio::test] #[should_panic] async fn test_translate_call_no_string() { - let network = Network::::new(std::iter::empty::(), vec![]); + let network = Network::::new(std::iter::empty::(), vec![]).await; let script = r#"(call "peer_id" (service_id func) [])"#; - let transformed = TransformedAirScript::new(script, network); + let transformed = TransformedAirScript::new(script, network).await; assert_eq!(transformed.as_deref(), Ok(script)); } #[tokio::test] async fn test_translate_call_result() { - let network = Network::::new(std::iter::empty::(), vec![]); + let network = Network::::new(std::iter::empty::(), vec![]).await; let script = r#"(call "peer_id" ("service_id" func) []) ; ok = 42"#; - let transformer = TransformedAirScript::new_unvalidated(script, network.clone()).unwrap(); + let transformer = TransformedAirScript::new_unvalidated(script, network.clone()).await.unwrap(); let peer_id = at("peer_id"); @@ -219,8 +218,8 @@ mod tests { (call peer_id ("service_id" func) [1]) ; ok=true ))"#; - let network = Network::::new(std::iter::empty::(), vec![]); - let transformed = TransformedAirScript::new_unvalidated(script, network.clone()).unwrap(); + let network = Network::::new(std::iter::empty::(), vec![]).await; + let transformed = TransformedAirScript::new_unvalidated(script, network.clone()).await.unwrap(); assert_eq!( &*transformed, concat!( @@ -259,8 +258,8 @@ mod tests { (canon "peer_id4" $stream #canon) ))"#; - let network = Network::::new(std::iter::empty::(), vec![]); - let t = TransformedAirScript::new_unvalidated(script, network.clone()).unwrap(); + let network = Network::::new(std::iter::empty::(), vec![]).await; + let t = TransformedAirScript::new_unvalidated(script, network.clone()).await.unwrap(); let peer_id1 = at("peer_id1"); let peer_id2 = at("peer_id2"); @@ -296,8 +295,8 @@ mod tests { async fn test_at_transform() { let script = r#"(call "peer_id1" ("service_id" "func") [1 @"peer_id3"] x) ; ok={"test":@"peer_id2"}"#; - let network = Network::::new(std::iter::empty::(), vec![]); - let t = TransformedAirScript::new(script, network.clone()).unwrap(); + let network = Network::::new(std::iter::empty::(), vec![]).await; + let t = TransformedAirScript::new(script, network.clone()).await.unwrap(); let peer_id1 = at("peer_id1"); let peer_id2 = at("peer_id2"); From c87013f850f725e6cc3eee08ae92b6b9e9f55a38 Mon Sep 17 00:00:00 2001 From: Valery Antopol Date: Mon, 12 Feb 2024 18:03:47 +0400 Subject: [PATCH 06/14] rustfmt --- air/tests/test_module/features/cid/canon.rs | 10 +- .../features/data_merging/data_merge.rs | 23 +++-- .../data_merging/executed_trace_basic.rs | 35 ++++--- .../test_module/features/errors/last_error.rs | 9 +- .../test_module/features/lambda/functors.rs | 3 +- .../test_module/features/lambda/lambda.rs | 18 ++-- .../features/scopes/scalars_scope.rs | 16 +-- .../features/signatures/algorithms.rs | 3 +- .../features/signatures/attacks.rs | 31 ++++-- .../features/signatures/corruption.rs | 30 ++++-- .../features/signatures/runtime.rs | 50 ++++++++-- .../features/signatures/signing.rs | 55 +++++++---- .../features/streams/compactification.rs | 16 ++- .../test_module/features/streams/merging.rs | 4 +- .../features/streams/recursive_streams.rs | 5 +- .../test_module/features/streams/streams.rs | 23 +++-- .../features/streams/streams_early_exit.rs | 3 +- .../features/tetraplets/provenance.rs | 27 ++--- .../tetraplets/security_tetraplets.rs | 35 ++++--- air/tests/test_module/instructions/ap.rs | 2 +- air/tests/test_module/instructions/call.rs | 11 +-- air/tests/test_module/instructions/canon.rs | 4 +- air/tests/test_module/instructions/fail.rs | 3 +- air/tests/test_module/instructions/fold.rs | 17 ++-- air/tests/test_module/instructions/match_.rs | 3 +- air/tests/test_module/instructions/new.rs | 11 ++- .../test_module/integration/chat_join.rs | 29 +++--- .../test_module/integration/create_service.rs | 3 +- .../test_module/integration/dashboard.rs | 11 ++- air/tests/test_module/issues/issue_173.rs | 3 +- air/tests/test_module/issues/issue_177.rs | 30 +++--- air/tests/test_module/issues/issue_214.rs | 3 +- air/tests/test_module/issues/issue_216.rs | 3 +- air/tests/test_module/issues/issue_221.rs | 2 +- air/tests/test_module/issues/issue_363.rs | 3 +- air/tests/test_module/issues/issue_632.rs | 8 +- .../negative_tests/execution_step.rs | 15 ++- avm/server/src/runner.rs | 38 ++++--- .../air-lib/test-utils/src/call_services.rs | 43 ++++---- crates/air-lib/test-utils/src/lib.rs | 13 ++- .../test-utils/src/native_test_runner.rs | 7 +- crates/air-lib/test-utils/src/test_runner.rs | 43 ++++---- .../test-utils/src/wasm_test_runner.rs | 92 +++++++++-------- .../testing-framework/src/asserts/behavior.rs | 5 +- crates/testing-framework/src/ephemeral/mod.rs | 5 +- .../src/ephemeral/neighborhood.rs | 26 ++--- crates/testing-framework/src/execution/mod.rs | 99 ++++++++++++++----- crates/testing-framework/src/queue.rs | 13 +-- crates/testing-framework/src/services/mod.rs | 20 +++- .../testing-framework/src/services/results.rs | 21 ++-- .../testing-framework/src/transform/walker.rs | 20 +++- tools/cli/air/src/data.rs | 7 +- tools/cli/air/src/trace/run.rs | 3 +- tools/cli/air/src/trace/run/native.rs | 12 ++- tools/cli/air/src/trace/run/runner.rs | 5 +- tools/cli/air/src/trace/run/wasm.rs | 69 +++++++------ 56 files changed, 691 insertions(+), 407 deletions(-) diff --git a/air/tests/test_module/features/cid/canon.rs b/air/tests/test_module/features/cid/canon.rs index f7a6bede7a..45aa414bfe 100644 --- a/air/tests/test_module/features/cid/canon.rs +++ b/air/tests/test_module/features/cid/canon.rs @@ -36,8 +36,9 @@ async fn test_canon_ok() { )"# ); - let executor = - AirScriptExecutor::from_annotated(TestRunParameters::from_init_peer_id(init_peer_name), &script).await.unwrap(); + let executor = AirScriptExecutor::from_annotated(TestRunParameters::from_init_peer_id(init_peer_name), &script) + .await + .unwrap(); let result = executor.execute_one(init_peer_name).await.unwrap(); let data = data_from_result(&result); @@ -114,8 +115,9 @@ async fn test_canon_ok_multi() { )"# ); - let executor = - AirScriptExecutor::from_annotated(TestRunParameters::from_init_peer_id(init_peer_name), &script).await.unwrap(); + let executor = AirScriptExecutor::from_annotated(TestRunParameters::from_init_peer_id(init_peer_name), &script) + .await + .unwrap(); let _result1 = executor.execute_one(init_peer_name).await.unwrap(); let _result2 = executor.execute_one(other_peer_name).await.unwrap(); let result3 = executor.execute_one(init_peer_name).await.unwrap(); diff --git a/air/tests/test_module/features/data_merging/data_merge.rs b/air/tests/test_module/features/data_merging/data_merge.rs index 041b747db8..6cac635b20 100644 --- a/air/tests/test_module/features/data_merging/data_merge.rs +++ b/air/tests/test_module/features/data_merging/data_merge.rs @@ -18,8 +18,8 @@ use air::ExecutionCidState; use air_interpreter_data::ExecutionTrace; use air_test_utils::prelude::*; -use pretty_assertions::assert_eq; use futures::FutureExt; +use pretty_assertions::assert_eq; use std::collections::HashMap; use std::ops::Deref; @@ -35,7 +35,8 @@ async fn merge_streams_in_two_fold() { let mut set_variable = create_avm( set_variable_call_service(json!([vm_1_peer_id, vm_2_peer_id])), set_variable_peer_id, - ).await; + ) + .await; let mut vm1 = create_avm(return_string_call_service(vm_1_peer_id), vm_1_peer_id).await; let mut vm2 = create_avm(return_string_call_service(vm_2_peer_id), vm_2_peer_id).await; @@ -179,13 +180,16 @@ async fn merge_streams_in_two_fold() { #[tokio::test] async fn stream_merge() { - let neighborhood_call_service: CallServiceClosure = Box::new(|params| async move { - let args_count = (params.function_name.as_bytes()[0] - b'0') as usize; - let args: Vec> = serde_json::from_value(JValue::Array(params.arguments)).expect("valid json"); - assert_eq!(args[0].len(), args_count); + let neighborhood_call_service: CallServiceClosure = Box::new(|params| { + async move { + let args_count = (params.function_name.as_bytes()[0] - b'0') as usize; + let args: Vec> = serde_json::from_value(JValue::Array(params.arguments)).expect("valid json"); + assert_eq!(args[0].len(), args_count); - CallServiceResult::ok(json!(args)) - }.boxed_local()); + CallServiceResult::ok(json!(args)) + } + .boxed_local() + }); let mut vm1 = create_avm(set_variable_call_service(json!("peer_id")), "A").await; let mut vm2 = create_avm(neighborhood_call_service, "B").await; @@ -231,7 +235,8 @@ async fn fold_merge() { let mut set_variable_vm = create_avm( set_variables_call_service(variables, VariableOptionSource::Argument(0)), set_variable_vm_id, - ).await; + ) + .await; let script = format!( include_str!("./scripts/inner_folds_v1.air"), diff --git a/air/tests/test_module/features/data_merging/executed_trace_basic.rs b/air/tests/test_module/features/data_merging/executed_trace_basic.rs index 17787bc31b..39d43c061f 100644 --- a/air/tests/test_module/features/data_merging/executed_trace_basic.rs +++ b/air/tests/test_module/features/data_merging/executed_trace_basic.rs @@ -18,8 +18,8 @@ use air::ExecutionCidState; use air_interpreter_data::ExecutionTrace; use air_test_utils::prelude::*; -use pretty_assertions::assert_eq; use futures::FutureExt; +use pretty_assertions::assert_eq; #[tokio::test] async fn executed_trace_seq_par_call() { @@ -227,15 +227,18 @@ async fn executed_trace_create_service() { let add_blueprint_response = "add_blueprint response"; let create_response = "create response"; - let call_service: CallServiceClosure = Box::new(move |params| async move { - let response = match params.service_id.as_str() { - "add_module" => add_module_response, - "add_blueprint" => add_blueprint_response, - "create" => create_response, - _ => "unknown response", - }; - CallServiceResult::ok(json!(response)) - }.boxed_local()); + let call_service: CallServiceClosure = Box::new(move |params| { + async move { + let response = match params.service_id.as_str() { + "add_module" => add_module_response, + "add_blueprint" => add_blueprint_response, + "create" => create_response, + _ => "unknown response", + }; + CallServiceResult::ok(json!(response)) + } + .boxed_local() + }); let init_peer_id = "A"; let set_variables_id = "set_variables"; @@ -305,9 +308,9 @@ async fn executed_trace_create_service() { #[tokio::test] async fn executed_trace_par_seq_fold_call() { - let return_numbers_call_service: CallServiceClosure = Box::new(|_| async move { - CallServiceResult::ok(json!(["1", "2", "3", "4", "5", "6", "7", "8", "9", "10"])) - }.boxed_local()); + let return_numbers_call_service: CallServiceClosure = Box::new(|_| { + async move { CallServiceResult::ok(json!(["1", "2", "3", "4", "5", "6", "7", "8", "9", "10"])) }.boxed_local() + }); let mut vm1 = create_avm(return_numbers_call_service, "some_peer_id_1").await; let mut vm2 = create_avm(echo_call_service(), "some_peer_id_2").await; @@ -452,9 +455,9 @@ async fn executed_trace_par_seq_fold_call() { #[tokio::test] async fn executed_trace_par_seq_fold_in_cycle_call() { - let return_numbers_call_service: CallServiceClosure = Box::new(|_| async move { - CallServiceResult::ok(json!(["1", "2", "3", "4", "5", "6", "7", "8", "9", "10"])) - }.boxed_local()); + let return_numbers_call_service: CallServiceClosure = Box::new(|_| { + async move { CallServiceResult::ok(json!(["1", "2", "3", "4", "5", "6", "7", "8", "9", "10"])) }.boxed_local() + }); let mut vm1 = create_avm(return_numbers_call_service, "some_peer_id_1").await; let mut vm2 = create_avm(echo_call_service(), "some_peer_id_2").await; diff --git a/air/tests/test_module/features/errors/last_error.rs b/air/tests/test_module/features/errors/last_error.rs index 250ec67516..bf9064a791 100644 --- a/air/tests/test_module/features/errors/last_error.rs +++ b/air/tests/test_module/features/errors/last_error.rs @@ -49,7 +49,8 @@ fn create_check_service_closure( *tetraplets_to_check.borrow_mut() = Some(params.tetraplets); CallServiceResult::ok(result) - }.boxed_local() + } + .boxed_local() }) } @@ -68,7 +69,8 @@ async fn last_error_tetraplets() { let mut local_vm = create_avm( create_check_service_closure(args.clone(), tetraplets.clone()), local_peer_id, - ).await; + ) + .await; let script = format!( include_str!("scripts/create_service_with_xor.air"), @@ -232,7 +234,8 @@ async fn non_initialized_last_error() { let mut vm = create_avm( create_check_service_closure(args.clone(), tetraplets.clone()), vm_peer_id, - ).await; + ) + .await; let script = format!( r#" diff --git a/air/tests/test_module/features/lambda/functors.rs b/air/tests/test_module/features/lambda/functors.rs index 04b42c45f3..a90e67a732 100644 --- a/air/tests/test_module/features/lambda/functors.rs +++ b/air/tests/test_module/features/lambda/functors.rs @@ -222,7 +222,8 @@ async fn functor_dont_influence_tetraplet() { let mut set_variable_vm = create_avm( set_variable_call_service(set_variable_peer_result.clone()), set_variable_peer_id, - ).await; + ) + .await; let tetraplet_catcher_peer_id = "tetraplet_catcher_peer_id"; let (call_service, actual_tetraplet) = tetraplet_host_function(echo_call_service()); diff --git a/air/tests/test_module/features/lambda/lambda.rs b/air/tests/test_module/features/lambda/lambda.rs index c61faf7dcb..6c7c8f5aaa 100644 --- a/air/tests/test_module/features/lambda/lambda.rs +++ b/air/tests/test_module/features/lambda/lambda.rs @@ -54,7 +54,8 @@ async fn lambda_with_string_scalar() { let mut set_variable_vm = create_avm( set_variables_call_service(variables, VariableOptionSource::FunctionName), set_variable_peer_id, - ).await; + ) + .await; let local_peer_id = "local_peer_id"; let mut local_vm = create_avm(echo_call_service(), local_peer_id).await; @@ -88,7 +89,8 @@ async fn lambda_with_number_scalar() { let mut set_variable_vm = create_avm( set_variables_call_service(variables, VariableOptionSource::FunctionName), set_variable_peer_id, - ).await; + ) + .await; let local_peer_id = "local_peer_id"; let mut local_vm = create_avm(echo_call_service(), local_peer_id).await; @@ -122,7 +124,8 @@ async fn lambda_with_number_stream() { let mut set_variable_vm = create_avm( set_variables_call_service(variables, VariableOptionSource::FunctionName), set_variable_peer_id, - ).await; + ) + .await; let local_peer_id = "local_peer_id"; let mut local_vm = create_avm(echo_call_service(), local_peer_id).await; @@ -172,7 +175,8 @@ async fn lambda_with_number_stream_and_followed_scalar() { let mut set_variable_vm = create_avm( set_variables_call_service(variables, VariableOptionSource::FunctionName), set_variable_peer_id, - ).await; + ) + .await; let local_peer_id = "local_peer_id"; let mut local_vm = create_avm(echo_call_service(), local_peer_id).await; @@ -223,7 +227,8 @@ async fn lambda_with_scalar_join() { let mut set_variable_vm = create_avm( set_variables_call_service(variables, VariableOptionSource::FunctionName), set_variable_peer_id, - ).await; + ) + .await; let local_peer_id = "local_peer_id"; let mut local_vm = create_avm(echo_call_service(), local_peer_id).await; @@ -260,7 +265,8 @@ async fn lambda_with_canon_stream_join() { let mut set_variable_vm = create_avm( set_variables_call_service(variables, VariableOptionSource::FunctionName), set_variable_peer_id, - ).await; + ) + .await; let local_peer_id = "local_peer_id"; let mut local_vm = create_avm(echo_call_service(), local_peer_id).await; diff --git a/air/tests/test_module/features/scopes/scalars_scope.rs b/air/tests/test_module/features/scopes/scalars_scope.rs index 8493d789d0..dd2f4ebd18 100644 --- a/air/tests/test_module/features/scopes/scalars_scope.rs +++ b/air/tests/test_module/features/scopes/scalars_scope.rs @@ -83,11 +83,14 @@ async fn before_after_of_next() { let vm_peer_0_id = "vm_peer_0_id"; let counter = std::cell::Cell::new(0); - let vm_peer_0_call_service: CallServiceClosure = Box::new(move |_params| { - let uncelled_request_id = counter.get(); - counter.set(uncelled_request_id + 1); - async move { CallServiceResult::ok(json!(uncelled_request_id))} - }.boxed_local()); + let vm_peer_0_call_service: CallServiceClosure = Box::new(move |_params| { + { + let uncelled_request_id = counter.get(); + counter.set(uncelled_request_id + 1); + async move { CallServiceResult::ok(json!(uncelled_request_id)) } + } + .boxed_local() + }); let mut peer_0_vm = create_avm(vm_peer_0_call_service, vm_peer_0_id).await; let vm_peer_1_id = "vm_peer_1_id"; @@ -133,7 +136,8 @@ async fn local_and_global_scalars() { let mut set_variable_vm = create_avm( set_variable_call_service(iterable_content.clone()), set_variable_peer_id, - ).await; + ) + .await; let local_setter_peer_id = "local_setter_peer_id"; let counter = std::cell::Cell::new(0); diff --git a/air/tests/test_module/features/signatures/algorithms.rs b/air/tests/test_module/features/signatures/algorithms.rs index 7d6dd94b1e..afbc8bdec7 100644 --- a/air/tests/test_module/features/signatures/algorithms.rs +++ b/air/tests/test_module/features/signatures/algorithms.rs @@ -82,7 +82,8 @@ fn test_banned_signature() { current_data, TestRunParameters::from_init_peer_id("init_peer_fake_id"), ) - .await.unwrap(); + .await + .unwrap(); assert_error_eq!( &res, diff --git a/air/tests/test_module/features/signatures/attacks.rs b/air/tests/test_module/features/signatures/attacks.rs index 62f0d081ac..db80dba818 100644 --- a/air/tests/test_module/features/signatures/attacks.rs +++ b/air/tests/test_module/features/signatures/attacks.rs @@ -86,7 +86,8 @@ async fn test_attack_injection_current_peer_scalar() { let cur_data = mallory_data.serialize().unwrap(); let res = alice_avm .call(&air_script, prev_data, cur_data, test_run_params) - .await.unwrap(); + .await + .unwrap(); assert_ne!(res.ret_code, 0); } @@ -227,7 +228,8 @@ async fn test_attack_injection_current_injection_unused() { let cur_data = mallory_data.serialize().unwrap(); let res = alice_avm .call(&air_script, prev_data, cur_data, test_run_params) - .await.unwrap(); + .await + .unwrap(); assert_ne!(res.ret_code, 0, "{}", res.error_message); } @@ -286,7 +288,10 @@ async fn test_attack_injection_other_peer_scalar() { let test_run_params = TestRunParameters::from_init_peer_id(alice_peer_id); let prev_data = ""; let cur_data = mallory_data.serialize().unwrap(); - let res = bob_avm.call(&air_script, prev_data, cur_data, test_run_params).await.unwrap(); + let res = bob_avm + .call(&air_script, prev_data, cur_data, test_run_params) + .await + .unwrap(); assert_ne!(res.ret_code, 0); } @@ -344,7 +349,10 @@ async fn test_attack_injection_other_peer_stream() { let test_run_params = TestRunParameters::from_init_peer_id(alice_peer_id); let prev_data = ""; let cur_data = mallory_data.serialize().unwrap(); - let res = bob_avm.call(&air_script, prev_data, cur_data, test_run_params).await.unwrap(); + let res = bob_avm + .call(&air_script, prev_data, cur_data, test_run_params) + .await + .unwrap(); assert_ne!(res.ret_code, 0, "{}", res.error_message); } @@ -402,7 +410,10 @@ async fn test_attack_injection_other_peer_unused() { let test_run_params = TestRunParameters::from_init_peer_id(alice_peer_id); let prev_data = ""; let cur_data = mallory_data.serialize().unwrap(); - let res = bob_avm.call(&air_script, prev_data, cur_data, test_run_params).await.unwrap(); + let res = bob_avm + .call(&air_script, prev_data, cur_data, test_run_params) + .await + .unwrap(); // please not that such injection is not caught assert_eq!(res.ret_code, 0, "{}", res.error_message); @@ -433,7 +444,10 @@ async fn test_attack_replay() { assert_eq!(res1.ret_code, 0, "test validity check failed: {}", res1.error_message); assert_eq!(res1, res2, "test validity check failed"); - let res_bob = bob_avm.call(&air_script, "", res1.data.clone(), run_params1).await.unwrap(); + let res_bob = bob_avm + .call(&air_script, "", res1.data.clone(), run_params1) + .await + .unwrap(); assert_eq!( res_bob.ret_code, 0, "test validity check failed: {}", @@ -442,7 +456,10 @@ async fn test_attack_replay() { let mallory_run_params = TestRunParameters::from_init_peer_id(&alice_peer_id).with_particle_id("second_particle"); - let res_replay = bob_avm.call(&air_script, "", res1.data, mallory_run_params).await.unwrap(); + let res_replay = bob_avm + .call(&air_script, "", res1.data, mallory_run_params) + .await + .unwrap(); let dalek_error = ed25519_dalek::ed25519::Error::from_source("Verification equation was not satisfied"); let nested_error = fluence_keypair::error::VerificationError::Ed25519( diff --git a/air/tests/test_module/features/signatures/corruption.rs b/air/tests/test_module/features/signatures/corruption.rs index e9195de2e5..a2637f9a3a 100644 --- a/air/tests/test_module/features/signatures/corruption.rs +++ b/air/tests/test_module/features/signatures/corruption.rs @@ -89,7 +89,10 @@ async fn test_attack_replace_value() { let test_run_params = TestRunParameters::from_init_peer_id(alice_peer_id); let prev_data = ""; let cur_data = mallory_data.serialize().unwrap(); - let res = bob_avm.call(&air_script, prev_data, cur_data, test_run_params).await.unwrap(); + let res = bob_avm + .call(&air_script, prev_data, cur_data, test_run_params) + .await + .unwrap(); assert_error_eq!( &res, @@ -166,7 +169,10 @@ async fn test_attack_replace_tetraplet() { let test_run_params = TestRunParameters::from_init_peer_id(alice_peer_id); let prev_data = ""; let cur_data = mallory_data.serialize().unwrap(); - let res = bob_avm.call(&air_script, prev_data, cur_data, test_run_params).await.unwrap(); + let res = bob_avm + .call(&air_script, prev_data, cur_data, test_run_params) + .await + .unwrap(); assert_error_eq!( &res, @@ -249,7 +255,10 @@ async fn test_attack_replace_call_result() { let test_run_params = TestRunParameters::from_init_peer_id(alice_peer_id); let prev_data = ""; let cur_data = mallory_data.serialize().unwrap(); - let res = bob_avm.call(&air_script, prev_data, cur_data, test_run_params).await.unwrap(); + let res = bob_avm + .call(&air_script, prev_data, cur_data, test_run_params) + .await + .unwrap(); assert_error_eq!( &res, @@ -339,7 +348,10 @@ async fn test_attack_replace_canon_value() { let test_run_params = TestRunParameters::from_init_peer_id(alice_peer_id); let prev_data = ""; let cur_data = mallory_data.serialize().unwrap(); - let res = bob_avm.call(&air_script, prev_data, cur_data, test_run_params).await.unwrap(); + let res = bob_avm + .call(&air_script, prev_data, cur_data, test_run_params) + .await + .unwrap(); assert_error_eq!( &res, @@ -438,7 +450,10 @@ async fn test_attack_replace_canon_result_values() { let test_run_params = TestRunParameters::from_init_peer_id(alice_peer_id); let prev_data = ""; let cur_data = mallory_data.serialize().unwrap(); - let res = bob_avm.call(&air_script, prev_data, cur_data, test_run_params).await.unwrap(); + let res = bob_avm + .call(&air_script, prev_data, cur_data, test_run_params) + .await + .unwrap(); assert_error_eq!( &res, @@ -541,7 +556,10 @@ async fn test_attack_replace_canon_result_tetraplet() { let test_run_params = TestRunParameters::from_init_peer_id(alice_peer_id); let prev_data = ""; let cur_data = mallory_data.serialize().unwrap(); - let res = bob_avm.call(&air_script, prev_data, cur_data, test_run_params).await.unwrap(); + let res = bob_avm + .call(&air_script, prev_data, cur_data, test_run_params) + .await + .unwrap(); assert_error_eq!( &res, diff --git a/air/tests/test_module/features/signatures/runtime.rs b/air/tests/test_module/features/signatures/runtime.rs index 4f9855e485..af74ae948a 100644 --- a/air/tests/test_module/features/signatures/runtime.rs +++ b/air/tests/test_module/features/signatures/runtime.rs @@ -51,7 +51,10 @@ async fn test_runtime_executed_call_argument_hash() { let mut bob_avm = create_avm_with_key::(bob_keypair, echo_call_service()).await; let mut mallory_avm = create_avm_with_key::(mallory_keypair, echo_call_service()).await; - let alice_res = alice_avm.call(&air_script, "", "", test_run_params.clone()).await.unwrap(); + let alice_res = alice_avm + .call(&air_script, "", "", test_run_params.clone()) + .await + .unwrap(); let mallory_res = mallory_avm .call(&air_script, "", alice_res.data, test_run_params.clone()) .await @@ -67,7 +70,10 @@ async fn test_runtime_executed_call_argument_hash() { let mallory_data = mallory_env.serialize().unwrap(); - let bob_res = bob_avm.call(air_script, "", mallory_data, test_run_params).await.unwrap(); + let bob_res = bob_avm + .call(air_script, "", mallory_data, test_run_params) + .await + .unwrap(); assert_error_eq!( &bob_res, UncatchableError::InstructionParametersMismatch { @@ -108,7 +114,10 @@ async fn test_runtime_executed_call_tetraplet() { let mut bob_avm = create_avm_with_key::(bob_keypair, echo_call_service()).await; let mut mallory_avm = create_avm_with_key::(mallory_keypair, echo_call_service()).await; - let alice_res = alice_avm.call(&air_script, "", "", test_run_params.clone()).await.unwrap(); + let alice_res = alice_avm + .call(&air_script, "", "", test_run_params.clone()) + .await + .unwrap(); let mallory_res = mallory_avm .call(&air_script, "", alice_res.data, test_run_params.clone()) .await @@ -124,7 +133,10 @@ async fn test_runtime_executed_call_tetraplet() { let mallory_data = mallory_env.serialize().unwrap(); - let bob_res = bob_avm.call(air_script, "", mallory_data, test_run_params).await.unwrap(); + let bob_res = bob_avm + .call(air_script, "", mallory_data, test_run_params) + .await + .unwrap(); let expected_value = format!( concat!( r#"SecurityTetraplet {{ peer_pk: "{alice_peer_id}","#, @@ -183,7 +195,10 @@ async fn test_runtime_executed_failed_argument_hash() { let mut bob_avm = create_avm_with_key::(bob_keypair, echo_call_service()).await; let mut mallory_avm = create_avm_with_key::(mallory_keypair, echo_call_service()).await; - let alice_res = alice_avm.call(&air_script, "", "", test_run_params.clone()).await.unwrap(); + let alice_res = alice_avm + .call(&air_script, "", "", test_run_params.clone()) + .await + .unwrap(); let mallory_res = mallory_avm .call(&air_script, "", alice_res.data, test_run_params.clone()) .await @@ -199,7 +214,10 @@ async fn test_runtime_executed_failed_argument_hash() { let mallory_data = mallory_env.serialize().unwrap(); - let bob_res = bob_avm.call(air_script, "", mallory_data, test_run_params).await.unwrap(); + let bob_res = bob_avm + .call(air_script, "", mallory_data, test_run_params) + .await + .unwrap(); assert_error_eq!( &bob_res, UncatchableError::InstructionParametersMismatch { @@ -244,7 +262,10 @@ async fn test_runtime_failed_call_tetraplet() { let mut bob_avm = create_avm_with_key::(bob_keypair, echo_call_service()).await; let mut mallory_avm = create_avm_with_key::(mallory_keypair, echo_call_service()).await; - let alice_res = alice_avm.call(&air_script, "", "", test_run_params.clone()).await.unwrap(); + let alice_res = alice_avm + .call(&air_script, "", "", test_run_params.clone()) + .await + .unwrap(); let mallory_res = mallory_avm .call(&air_script, "", alice_res.data, test_run_params.clone()) .await @@ -260,7 +281,10 @@ async fn test_runtime_failed_call_tetraplet() { let mallory_data = mallory_env.serialize().unwrap(); - let bob_res = bob_avm.call(air_script, "", mallory_data, test_run_params).await.unwrap(); + let bob_res = bob_avm + .call(air_script, "", mallory_data, test_run_params) + .await + .unwrap(); let expected_value = format!( concat!( r#"SecurityTetraplet {{ peer_pk: "{alice_peer_id}","#, @@ -317,7 +341,10 @@ async fn test_runtime_canon_tetraplet() { let mut bob_avm = create_avm_with_key::(bob_keypair, echo_call_service()).await; let mut mallory_avm = create_avm_with_key::(mallory_keypair, echo_call_service()).await; - let alice_res = alice_avm.call(&air_script, "", "", test_run_params.clone()).await.unwrap(); + let alice_res = alice_avm + .call(&air_script, "", "", test_run_params.clone()) + .await + .unwrap(); let mallory_res = mallory_avm .call(&air_script, "", alice_res.data, test_run_params.clone()) .await @@ -333,7 +360,10 @@ async fn test_runtime_canon_tetraplet() { let mallory_data = mallory_env.serialize().unwrap(); - let bob_res = bob_avm.call(air_script, "", mallory_data, test_run_params).await.unwrap(); + let bob_res = bob_avm + .call(air_script, "", mallory_data, test_run_params) + .await + .unwrap(); let expected_value = format!( concat!( r#"SecurityTetraplet {{ peer_pk: "{alice_peer_id}","#, diff --git a/air/tests/test_module/features/signatures/signing.rs b/air/tests/test_module/features/signatures/signing.rs index 00885a5c14..84ac74ed15 100644 --- a/air/tests/test_module/features/signatures/signing.rs +++ b/air/tests/test_module/features/signatures/signing.rs @@ -34,7 +34,7 @@ async fn test_signature_empty() { vec![PeerId::from(init_peer_name)].into_iter(), script, ) - .await + .await .unwrap(); let res = exec.execute_one(init_peer_name).await.unwrap(); assert_eq!(res.ret_code, 0, "{:?}", res); @@ -57,11 +57,15 @@ async fn test_signature_call_var() { (call "{init_peer_name}" ("" "") [] var) ; ok = "ok" "# ); - let exec = - AirScriptExecutor::from_annotated(TestRunParameters::from_init_peer_id(init_peer_name), &air_script).await.unwrap(); - + let exec = AirScriptExecutor::from_annotated(TestRunParameters::from_init_peer_id(init_peer_name), &air_script) + .await + .unwrap(); - let exec_results = exec.execution_iter(init_peer_id.as_str()).unwrap().collect::>().await; + let exec_results = exec + .execution_iter(init_peer_id.as_str()) + .unwrap() + .collect::>() + .await; let res = exec_results.last().unwrap(); assert_eq!(res.ret_code, 0, "{:?}", res); let data = data_from_result(&res); @@ -85,8 +89,9 @@ async fn test_signature_call_stream() { (call "{init_peer_name}" ("" "") [] $var) ; ok = "ok" "# ); - let exec = - AirScriptExecutor::from_annotated(TestRunParameters::from_init_peer_id(init_peer_name), &air_script).await.unwrap(); + let exec = AirScriptExecutor::from_annotated(TestRunParameters::from_init_peer_id(init_peer_name), &air_script) + .await + .unwrap(); let exec_results = exec.execution_iter(init_peer_name).unwrap().collect::>().await; let res = exec_results.last().unwrap(); @@ -114,8 +119,9 @@ async fn test_signature_call_unused() { (call "{init_peer_name}" ("" "") []) ; ok = "ok" "# ); - let exec = - AirScriptExecutor::from_annotated(TestRunParameters::from_init_peer_id(init_peer_name), &air_script).await.unwrap(); + let exec = AirScriptExecutor::from_annotated(TestRunParameters::from_init_peer_id(init_peer_name), &air_script) + .await + .unwrap(); let exec_results = exec.execution_iter(init_peer_name).unwrap().collect::>().await; let res = exec_results.last().unwrap(); @@ -147,8 +153,9 @@ async fn test_signature_call_merged() { "# ); - let exec = - AirScriptExecutor::from_annotated(TestRunParameters::from_init_peer_id(init_peer_name), &air_script).await.unwrap(); + let exec = AirScriptExecutor::from_annotated(TestRunParameters::from_init_peer_id(init_peer_name), &air_script) + .await + .unwrap(); let _ = exec.execute_one(init_peer_name).await.unwrap(); let _ = exec.execute_one(other_peer_name).await.unwrap(); let res2 = exec.execute_one(init_peer_name).await.unwrap(); @@ -187,10 +194,15 @@ async fn test_signature_call_twice() { (next i)))) "# ); - let exec = - AirScriptExecutor::from_annotated(TestRunParameters::from_init_peer_id(init_peer_name), &air_script).await.unwrap(); + let exec = AirScriptExecutor::from_annotated(TestRunParameters::from_init_peer_id(init_peer_name), &air_script) + .await + .unwrap(); - let exec_results = exec.execution_iter(init_peer_id.as_str()).unwrap().collect::>().await; + let exec_results = exec + .execution_iter(init_peer_id.as_str()) + .unwrap() + .collect::>() + .await; let res = exec_results.last().unwrap(); assert_eq!(res.ret_code, 0, "{:?}", res); let data = data_from_result(&res); @@ -230,8 +242,9 @@ async fn test_signature_canon_basic() { (canon "{init_peer_name}" $stream #canon))) "# ); - let exec = - AirScriptExecutor::from_annotated(TestRunParameters::from_init_peer_id(init_peer_name), &air_script).await.unwrap(); + let exec = AirScriptExecutor::from_annotated(TestRunParameters::from_init_peer_id(init_peer_name), &air_script) + .await + .unwrap(); let exec_results = exec.execution_iter(init_peer_name).unwrap().collect::>().await; let res = exec_results.last().unwrap(); @@ -309,8 +322,9 @@ async fn test_signature_canon_merge() { (call "{init_peer_name}" ("" "") []))) ; ok = "ok" "# ); - let exec = - AirScriptExecutor::from_annotated(TestRunParameters::from_init_peer_id(init_peer_name), &air_script).await.unwrap(); + let exec = AirScriptExecutor::from_annotated(TestRunParameters::from_init_peer_id(init_peer_name), &air_script) + .await + .unwrap(); exec.execute_all(init_peer_name).await; exec.execute_one(other_peer_name).await; @@ -389,8 +403,9 @@ async fn test_signature_canon_result() { (canon "{init_peer_name}" $stream #canon))) "# ); - let exec = - AirScriptExecutor::from_annotated(TestRunParameters::from_init_peer_id(init_peer_name), &air_script).await.unwrap(); + let exec = AirScriptExecutor::from_annotated(TestRunParameters::from_init_peer_id(init_peer_name), &air_script) + .await + .unwrap(); let exec_results = exec.execution_iter(init_peer_name).unwrap().collect::>().await; let res = exec_results.last().unwrap(); diff --git a/air/tests/test_module/features/streams/compactification.rs b/air/tests/test_module/features/streams/compactification.rs index f1b6d0a997..891207e3ef 100644 --- a/air/tests/test_module/features/streams/compactification.rs +++ b/air/tests/test_module/features/streams/compactification.rs @@ -32,7 +32,9 @@ async fn global_streams_are_compactified() { "# ); - let executor = AirScriptExecutor::from_annotated(TestRunParameters::from_init_peer_id(peer_name), &script).await.unwrap(); + let executor = AirScriptExecutor::from_annotated(TestRunParameters::from_init_peer_id(peer_name), &script) + .await + .unwrap(); let result = executor.execute_all(peer_name).await.unwrap(); let actual_trace = trace_from_result(result.last().unwrap()); @@ -68,7 +70,9 @@ async fn global_stream_maps_are_compactified() { "# ); - let executor = AirScriptExecutor::from_annotated(TestRunParameters::from_init_peer_id(peer_name), &script).await.unwrap(); + let executor = AirScriptExecutor::from_annotated(TestRunParameters::from_init_peer_id(peer_name), &script) + .await + .unwrap(); let result = executor.execute_all(peer_name).await.unwrap(); let actual_trace = trace_from_result(result.last().unwrap()); @@ -104,7 +108,9 @@ async fn local_streams_are_compactified() { "# ); - let executor = AirScriptExecutor::from_annotated(TestRunParameters::from_init_peer_id(peer_name), &script).await.unwrap(); + let executor = AirScriptExecutor::from_annotated(TestRunParameters::from_init_peer_id(peer_name), &script) + .await + .unwrap(); let result = executor.execute_all(peer_name).await.unwrap(); let actual_trace = trace_from_result(result.last().unwrap()); @@ -142,7 +148,9 @@ async fn local_stream_maps_are_compactified() { "# ); - let executor = AirScriptExecutor::from_annotated(TestRunParameters::from_init_peer_id(peer_name), &script).await.unwrap(); + let executor = AirScriptExecutor::from_annotated(TestRunParameters::from_init_peer_id(peer_name), &script) + .await + .unwrap(); let result = executor.execute_all(peer_name).await.unwrap(); let actual_trace = trace_from_result(result.last().unwrap()); diff --git a/air/tests/test_module/features/streams/merging.rs b/air/tests/test_module/features/streams/merging.rs index 023830d453..74a082e511 100644 --- a/air/tests/test_module/features/streams/merging.rs +++ b/air/tests/test_module/features/streams/merging.rs @@ -90,7 +90,7 @@ async fn merging_fold_iterations_extensively() { vec!["relay", "p1", "p2", "p3"].into_iter().map(Into::into), script, ) - .await + .await .unwrap(); let mut queue = std::collections::vec_deque::VecDeque::new(); @@ -228,7 +228,7 @@ async fn merging_fold_iterations_extensively_2() { vec!["relay", "p1", "p2", "p3"].into_iter().map(Into::into), script, ) - .await + .await .unwrap(); let mut queue = std::collections::vec_deque::VecDeque::new(); diff --git a/air/tests/test_module/features/streams/recursive_streams.rs b/air/tests/test_module/features/streams/recursive_streams.rs index 82f2437c38..2fcc436268 100644 --- a/air/tests/test_module/features/streams/recursive_streams.rs +++ b/air/tests/test_module/features/streams/recursive_streams.rs @@ -19,8 +19,8 @@ use air_interpreter_data::ExecutionTrace; use air_test_framework::AirScriptExecutor; use air_test_utils::prelude::*; -use pretty_assertions::assert_eq; use futures::FutureExt; +use pretty_assertions::assert_eq; #[tokio::test] async fn recursive_stream_with_early_exit() { @@ -32,7 +32,8 @@ async fn recursive_stream_with_early_exit() { let mut vm = create_avm( set_variables_call_service(variable_mappings, VariableOptionSource::FunctionName), vm_peer_id, - ).await; + ) + .await; let script = format!( r#" diff --git a/air/tests/test_module/features/streams/streams.rs b/air/tests/test_module/features/streams/streams.rs index 1a1507d5bc..4738d7d630 100644 --- a/air/tests/test_module/features/streams/streams.rs +++ b/air/tests/test_module/features/streams/streams.rs @@ -17,23 +17,26 @@ use air_interpreter_data::ExecutionTrace; use air_test_utils::prelude::*; -use pretty_assertions::assert_eq; use futures::FutureExt; +use pretty_assertions::assert_eq; use std::ops::Deref; #[tokio::test] async fn empty_stream() { fn arg_type_check_closure() -> CallServiceClosure<'static> { - Box::new(move |params| async move { - let actual_call_args: Vec> = - serde_json::from_value(JValue::Array(params.arguments)).expect("json deserialization shouldn't fail"); - let expected_call_args: Vec> = vec![vec![]]; - - assert_eq!(actual_call_args, expected_call_args); - - CallServiceResult::ok(json!("")) - }.boxed_local()) + Box::new(move |params| { + async move { + let actual_call_args: Vec> = serde_json::from_value(JValue::Array(params.arguments)) + .expect("json deserialization shouldn't fail"); + let expected_call_args: Vec> = vec![vec![]]; + + assert_eq!(actual_call_args, expected_call_args); + + CallServiceResult::ok(json!("")) + } + .boxed_local() + }) } let vm_peer_id = "vm_peer_id"; diff --git a/air/tests/test_module/features/streams/streams_early_exit.rs b/air/tests/test_module/features/streams/streams_early_exit.rs index b5e8426c86..d3b772530f 100644 --- a/air/tests/test_module/features/streams/streams_early_exit.rs +++ b/air/tests/test_module/features/streams/streams_early_exit.rs @@ -320,7 +320,8 @@ async fn fold_par_early_exit() { let mut variables_setter = create_avm( set_variables_call_service(variables, VariableOptionSource::Argument(0)), variables_setter_id, - ).await; + ) + .await; let mut stream_setter = create_avm(echo_call_service(), stream_setter_id).await; let mut fold_executor = create_avm(unit_call_service(), fold_executor_id).await; let mut error_trigger = create_avm(fallible_call_service("error"), error_trigger_id).await; diff --git a/air/tests/test_module/features/tetraplets/provenance.rs b/air/tests/test_module/features/tetraplets/provenance.rs index 6f1c4dedd7..eca1d07d19 100644 --- a/air/tests/test_module/features/tetraplets/provenance.rs +++ b/air/tests/test_module/features/tetraplets/provenance.rs @@ -26,10 +26,9 @@ async fn call_result() { (call "B" ("service" "func") [] $s) ; ok = "some_data" (canon "B" $s #c)) "#; - let runner = - AirScriptExecutor::from_annotated(TestRunParameters::from_init_peer_id(init_peer_name), air_script) - .await - .unwrap(); + let runner = AirScriptExecutor::from_annotated(TestRunParameters::from_init_peer_id(init_peer_name), air_script) + .await + .unwrap(); let result = runner.execute_one(init_peer_name).await.unwrap(); assert_eq!(result.ret_code, 0, "{:?}", result.error_message); @@ -83,8 +82,9 @@ async fn call_result_iteration() { (next a)))) (canon "A" $s #c)) "#; - let runner = - AirScriptExecutor::from_annotated(TestRunParameters::from_init_peer_id(init_peer_name), air_script).await.unwrap(); + let runner = AirScriptExecutor::from_annotated(TestRunParameters::from_init_peer_id(init_peer_name), air_script) + .await + .unwrap(); let result = runner.execute_one(init_peer_name).await.unwrap(); assert_eq!(result.ret_code, 0, "{:?}", result.error_message); @@ -151,8 +151,9 @@ async fn literal() { (ap 1 $s) (canon "B" $s #c)) "#; - let runner = - AirScriptExecutor::from_annotated(TestRunParameters::from_init_peer_id(init_peer_name), air_script).await.unwrap(); + let runner = AirScriptExecutor::from_annotated(TestRunParameters::from_init_peer_id(init_peer_name), air_script) + .await + .unwrap(); let result = runner.execute_one(init_peer_name).await.unwrap(); assert_eq!(result.ret_code, 0, "{:?}", result.error_message); @@ -197,8 +198,9 @@ async fn canon_in_canon() { (ap #c $s) (canon "B" $s #d))) "#; - let runner = - AirScriptExecutor::from_annotated(TestRunParameters::from_init_peer_id(init_peer_name), air_script).await.unwrap(); + let runner = AirScriptExecutor::from_annotated(TestRunParameters::from_init_peer_id(init_peer_name), air_script) + .await + .unwrap(); let result = runner.execute_one(init_peer_name).await.unwrap(); assert_eq!(result.ret_code, 0, "{:?}", result.error_message); @@ -275,8 +277,9 @@ async fn lambda_result_iteration() { (next y)))) (canon "A" $s #c)) "#; - let runner = - AirScriptExecutor::from_annotated(TestRunParameters::from_init_peer_id(init_peer_name), air_script).await.unwrap(); + let runner = AirScriptExecutor::from_annotated(TestRunParameters::from_init_peer_id(init_peer_name), air_script) + .await + .unwrap(); let result = runner.execute_one(init_peer_name).await.unwrap(); assert_eq!(result.ret_code, 0, "{:?}", result.error_message); diff --git a/air/tests/test_module/features/tetraplets/security_tetraplets.rs b/air/tests/test_module/features/tetraplets/security_tetraplets.rs index b4f19c4467..cf6a9b37ca 100644 --- a/air/tests/test_module/features/tetraplets/security_tetraplets.rs +++ b/air/tests/test_module/features/tetraplets/security_tetraplets.rs @@ -16,9 +16,9 @@ use air_test_utils::key_utils::at; use air_test_utils::prelude::*; +use futures::FutureExt; use polyplets::SecurityTetraplet; use pretty_assertions::assert_eq; -use futures::FutureExt; use std::cell::RefCell; use std::rc::Rc; @@ -42,9 +42,9 @@ fn arg_host_function() -> (CallServiceClosure<'static>, Rc::default()).await.unwrap(); + let auth_service = AppService::new(auth_service_config, auth_module_name, <_>::default()) + .await + .unwrap(); let log_module_name = String::from("log_storage"); let log_service_config = construct_service_config(log_module_name.clone()); - let log_service = AppService::new(log_service_config, log_module_name, <_>::default()).await.unwrap(); + let log_service = AppService::new(log_service_config, log_module_name, <_>::default()) + .await + .unwrap(); let services = maplit::hashmap!( "auth" => auth_service, @@ -386,7 +392,8 @@ async fn tetraplet_with_wasm_modules() { .unwrap(); CallServiceResult::ok(result) - }.boxed_local() + } + .boxed_local() }); let local_peer_id = "local_peer_id"; diff --git a/air/tests/test_module/instructions/ap.rs b/air/tests/test_module/instructions/ap.rs index 6221b058d1..c66c1928dd 100644 --- a/air/tests/test_module/instructions/ap.rs +++ b/air/tests/test_module/instructions/ap.rs @@ -19,8 +19,8 @@ use air::ExecutionCidState; use air_test_framework::AirScriptExecutor; use air_test_utils::key_utils::at; use air_test_utils::prelude::*; -use pretty_assertions::assert_eq; use futures::FutureExt; +use pretty_assertions::assert_eq; use std::cell::RefCell; use std::rc::Rc; diff --git a/air/tests/test_module/instructions/call.rs b/air/tests/test_module/instructions/call.rs index 3d257bfb17..bcf2870c50 100644 --- a/air/tests/test_module/instructions/call.rs +++ b/air/tests/test_module/instructions/call.rs @@ -19,8 +19,8 @@ use air::UncatchableError; use air_test_framework::AirScriptExecutor; use air_test_utils::key_utils::at; use air_test_utils::prelude::*; -use pretty_assertions::assert_eq; use futures::FutureExt; +use pretty_assertions::assert_eq; // Check that %init_peer_id% alias works correctly (by comparing result with it and explicit peer id). // Additionally, check that empty string for data does the same as empty call path. @@ -164,11 +164,10 @@ async fn duplicate_variables() { // Check that string literals can be used as call parameters. #[tokio::test] async fn string_parameters() { - let call_service: CallServiceClosure = - Box::new(|mut params| { - let result = CallServiceResult::ok(params.arguments.remove(0)); - async move { result }.boxed_local() - }); + let call_service: CallServiceClosure = Box::new(|mut params| { + let result = CallServiceResult::ok(params.arguments.remove(0)); + async move { result }.boxed_local() + }); let vm_peer_id = "A"; let mut vm = create_avm(call_service, vm_peer_id).await; diff --git a/air/tests/test_module/instructions/canon.rs b/air/tests/test_module/instructions/canon.rs index b2ff2b8d2b..578324c4f5 100644 --- a/air/tests/test_module/instructions/canon.rs +++ b/air/tests/test_module/instructions/canon.rs @@ -18,8 +18,8 @@ use air::ExecutionCidState; use air_test_framework::AirScriptExecutor; use air_test_utils::key_utils::at; use air_test_utils::prelude::*; -use pretty_assertions::assert_eq; use futures::FutureExt; +use pretty_assertions::assert_eq; use std::cell::RefCell; use std::ops::Deref; @@ -244,7 +244,7 @@ async fn canon_gates() { let stop_len_count = 2; let vm_3_call_service: CallServiceClosure = Box::new(move |params: CallRequestParams| { let value = params.arguments[0].as_array().unwrap().len(); - let result = if value >= stop_len_count { + let result = if value >= stop_len_count { CallServiceResult::ok(json!(true)) } else { CallServiceResult::ok(json!(false)) diff --git a/air/tests/test_module/instructions/fail.rs b/air/tests/test_module/instructions/fail.rs index b983178000..0063af5333 100644 --- a/air/tests/test_module/instructions/fail.rs +++ b/air/tests/test_module/instructions/fail.rs @@ -182,7 +182,8 @@ async fn fail_with_canon_stream() { let mut vm = create_avm( set_variable_call_service(json!({"error_code": error_code, "message": error_message})), vm_peer_id, - ).await; + ) + .await; let script = format!( r#" diff --git a/air/tests/test_module/instructions/fold.rs b/air/tests/test_module/instructions/fold.rs index 4c6bc9cb6a..e5eb706bf4 100644 --- a/air/tests/test_module/instructions/fold.rs +++ b/air/tests/test_module/instructions/fold.rs @@ -22,8 +22,8 @@ use air_test_framework::AirScriptExecutor; use air_test_utils::key_utils::at; use air_test_utils::prelude::*; -use pretty_assertions::assert_eq; use futures::FutureExt; +use pretty_assertions::assert_eq; use std::cell::RefCell; use std::rc::Rc; @@ -33,7 +33,8 @@ async fn lfold() { let mut set_variable_vm = create_avm( set_variable_call_service(json!(["1", "2", "3", "4", "5"])), "set_variable", - ).await; + ) + .await; let lfold = r#" (seq @@ -68,7 +69,8 @@ async fn rfold() { let mut set_variable_vm = create_avm( set_variable_call_service(json!(["1", "2", "3", "4", "5"])), "set_variable", - ).await; + ) + .await; let rfold = r#" (seq @@ -103,7 +105,8 @@ async fn inner_fold() { let mut set_variable_vm = create_avm( set_variable_call_service(json!(["1", "2", "3", "4", "5"])), "set_variable", - ).await; + ) + .await; let script = r#" (seq @@ -149,7 +152,8 @@ async fn inner_fold_with_same_iterator() { let mut vm = create_avm( set_variable_call_service(json!(["1", "2", "3", "4", "5"])), "set_variable", - ).await; + ) + .await; let script = r#" (seq @@ -278,7 +282,8 @@ async fn lambda() { let mut set_variable_vm = create_avm( set_variable_call_service(json!({ "array": ["1","2","3","4","5"] })), "set_variable", - ).await; + ) + .await; let script = r#" (seq diff --git a/air/tests/test_module/instructions/match_.rs b/air/tests/test_module/instructions/match_.rs index a0b4b1c61d..e64686a2ae 100644 --- a/air/tests/test_module/instructions/match_.rs +++ b/air/tests/test_module/instructions/match_.rs @@ -349,7 +349,8 @@ async fn issue_165() { let mut result_setter = create_avm( set_variable_call_service(serde_json::json!({"success": true})), result_setter_peer_id, - ).await; + ) + .await; let echo_peer_id = "echo_peer_id"; let mut echo_peer = create_avm(echo_call_service(), echo_peer_id).await; diff --git a/air/tests/test_module/instructions/new.rs b/air/tests/test_module/instructions/new.rs index 687b79b15e..2296598636 100644 --- a/air/tests/test_module/instructions/new.rs +++ b/air/tests/test_module/instructions/new.rs @@ -17,8 +17,8 @@ use air_interpreter_data::ExecutionTrace; use air_test_utils::prelude::*; -use pretty_assertions::assert_eq; use futures::FutureExt; +use pretty_assertions::assert_eq; #[tokio::test] #[ignore] @@ -37,7 +37,8 @@ async fn new_with_global_streams_seq() { let mut set_variable_vm = create_avm( set_variables_call_service(variables_mapping, VariableOptionSource::Argument(0)), set_variable_peer_id, - ).await; + ) + .await; let script = format!( r#" @@ -415,7 +416,8 @@ async fn new_with_scalars_with_errors() { let mut set_variable_vm = create_avm( set_variables_call_service(variables_mapping, VariableOptionSource::Argument(0)), set_variable_peer_id, - ).await; + ) + .await; let variable_receiver_peer_id = "variable_receiver_peer_id"; let mut variable_receiver_vm = create_avm(echo_call_service(), variable_receiver_peer_id).await; @@ -474,7 +476,8 @@ async fn new_with_global_scalars() { let mut set_variable_vm = create_avm( set_variables_call_service(variables_mapping, VariableOptionSource::Argument(0)), set_variable_peer_id, - ).await; + ) + .await; let variable_receiver_peer_id = "variable_receiver_peer_id"; let mut variable_receiver = create_avm(echo_call_service(), variable_receiver_peer_id).await; diff --git a/air/tests/test_module/integration/chat_join.rs b/air/tests/test_module/integration/chat_join.rs index 93d617627a..aa73da8bf6 100644 --- a/air/tests/test_module/integration/chat_join.rs +++ b/air/tests/test_module/integration/chat_join.rs @@ -17,8 +17,8 @@ use air_interpreter_data::ExecutionTrace; use air_test_utils::prelude::*; -use pretty_assertions::assert_eq; use futures::FutureExt; +use pretty_assertions::assert_eq; #[tokio::test] async fn join_chat_1() { @@ -38,11 +38,10 @@ async fn join_chat_1() { let remote_peer_id = "remote_peer_id"; let members = json!([[client_1_peer_id, relay_1_peer_id], [client_2_peer_id, relay_2_peer_id]]); - let members_call_service: CallServiceClosure = - Box::new(move |_| { - let result = CallServiceResult::ok(members.clone()); - async move { result }.boxed_local() - }); + let members_call_service: CallServiceClosure = Box::new(move |_| { + let result = CallServiceResult::ok(members.clone()); + async move { result }.boxed_local() + }); let mut remote = create_avm(members_call_service, remote_peer_id).await; let script = format!( @@ -301,11 +300,10 @@ async fn join_chat_1() { #[tokio::test] async fn join_chat_2() { - let members_call_service1: CallServiceClosure = - Box::new(|_| { - let result = CallServiceResult::ok(json!([["A"], ["B"]])); - async move { result }.boxed_local() - }); + let members_call_service1: CallServiceClosure = Box::new(|_| { + let result = CallServiceResult::ok(json!([["A"], ["B"]])); + async move { result }.boxed_local() + }); let relay_1_peer_id = "relay_1_peer_id"; let mut relay_1 = create_avm(unit_call_service(), relay_1_peer_id).await; @@ -406,11 +404,10 @@ async fn init_peer_id() { let remote_peer_id = "remote_peer_id"; let members = json!([[client_1_peer_id], ["B"]]); - let members_call_service: CallServiceClosure = - Box::new(move |_| { - let result = CallServiceResult::ok(members.clone()); - async move { result }.boxed_local() - }); + let members_call_service: CallServiceClosure = Box::new(move |_| { + let result = CallServiceResult::ok(members.clone()); + async move { result }.boxed_local() + }); let mut remote = create_avm(members_call_service, remote_peer_id).await; let script = format!( diff --git a/air/tests/test_module/integration/create_service.rs b/air/tests/test_module/integration/create_service.rs index bc33fbdec8..aaed03717d 100644 --- a/air/tests/test_module/integration/create_service.rs +++ b/air/tests/test_module/integration/create_service.rs @@ -45,7 +45,8 @@ async fn create_service() { let mut set_variables_vm = create_avm( set_variables_call_service(variables_mapping, VariableOptionSource::Argument(0)), "set_variables", - ).await; + ) + .await; let add_module_response = "add_module response"; let add_blueprint_response = "add_blueprint response"; diff --git a/air/tests/test_module/integration/dashboard.rs b/air/tests/test_module/integration/dashboard.rs index 088e3726a9..c87fab5caf 100644 --- a/air/tests/test_module/integration/dashboard.rs +++ b/air/tests/test_module/integration/dashboard.rs @@ -16,8 +16,8 @@ use air_test_utils::prelude::*; -use futures::StreamExt; use futures::FutureExt; +use futures::StreamExt; use std::cell::RefCell; use std::collections::HashSet; @@ -163,15 +163,16 @@ async fn dashboard() { let mut relay = create_avm( create_peer_host_function(relay_id.clone(), known_peer_ids.clone()), relay_id.clone(), - ).await; + ) + .await; - let mut known_peers = - futures::stream::iter(known_peer_ids.iter().cloned()) + let mut known_peers = futures::stream::iter(known_peer_ids.iter().cloned()) .then(|peer_id| async { let vm = create_avm( create_peer_host_function(peer_id.clone(), known_peer_ids.clone()), peer_id.clone(), - ).await; + ) + .await; AVMState { vm, peer_id, diff --git a/air/tests/test_module/issues/issue_173.rs b/air/tests/test_module/issues/issue_173.rs index 06ee333cf9..a942118182 100644 --- a/air/tests/test_module/issues/issue_173.rs +++ b/air/tests/test_module/issues/issue_173.rs @@ -34,7 +34,8 @@ async fn issue_173() { let mut set_variable_vm = create_avm( set_variables_call_service(variables_mapping, VariableOptionSource::Argument(0)), set_variable_peer_id, - ).await; + ) + .await; let script = format!( r#" diff --git a/air/tests/test_module/issues/issue_177.rs b/air/tests/test_module/issues/issue_177.rs index 6c87ab91ff..6d71c2c8f3 100644 --- a/air/tests/test_module/issues/issue_177.rs +++ b/air/tests/test_module/issues/issue_177.rs @@ -57,11 +57,13 @@ async fn issue_177() { let mut client = create_avm( set_variables_call_service(variables.clone(), VariableOptionSource::FunctionName), client_peer_id, - ).await; + ) + .await; let mut relay = create_avm( set_variables_call_service(variables, VariableOptionSource::FunctionName), relay_peer_id, - ).await; + ) + .await; let script = include_str!("scripts/issue_177.air"); @@ -231,17 +233,19 @@ async fn issue_177() { }; // timeout requests provided - let client_result_5 = client.call_single( - script, - client_result_4.data, - "", - client_peer_id, - 0, - 0, - None, - call_results, - "", - ).await; + let client_result_5 = client + .call_single( + script, + client_result_4.data, + "", + client_peer_id, + 0, + 0, + None, + call_results, + "", + ) + .await; // before patch the interpreter crashed here assert!(client_result_5.is_ok()); } diff --git a/air/tests/test_module/issues/issue_214.rs b/air/tests/test_module/issues/issue_214.rs index 288c6589b0..cbd1214983 100644 --- a/air/tests/test_module/issues/issue_214.rs +++ b/air/tests/test_module/issues/issue_214.rs @@ -35,7 +35,8 @@ async fn issue_214() { let mut client = create_avm( set_variables_call_service(variables_mapping, VariableOptionSource::FunctionName), client_id, - ).await; + ) + .await; let script = format!( r#" diff --git a/air/tests/test_module/issues/issue_216.rs b/air/tests/test_module/issues/issue_216.rs index dc02c6b364..24f8d42304 100644 --- a/air/tests/test_module/issues/issue_216.rs +++ b/air/tests/test_module/issues/issue_216.rs @@ -27,7 +27,8 @@ async fn issue_216() { let mut some_peer = create_avm( set_variables_call_service(variables_mapping, VariableOptionSource::FunctionName), some_peer_id, - ).await; + ) + .await; let client_id = "client_peer_id"; let mut client = create_avm(echo_call_service(), client_id).await; diff --git a/air/tests/test_module/issues/issue_221.rs b/air/tests/test_module/issues/issue_221.rs index 9d1ac20241..8626220a41 100644 --- a/air/tests/test_module/issues/issue_221.rs +++ b/air/tests/test_module/issues/issue_221.rs @@ -77,7 +77,7 @@ async fn issue_221() { vec![peer_1_name, peer_2_name].into_iter().map(Into::into), &script, ) - .await + .await .expect("Invalid annotated AIR script"); let peer_1_id = at(peer_1_name); diff --git a/air/tests/test_module/issues/issue_363.rs b/air/tests/test_module/issues/issue_363.rs index f70672084a..5db846916f 100644 --- a/air/tests/test_module/issues/issue_363.rs +++ b/air/tests/test_module/issues/issue_363.rs @@ -26,7 +26,8 @@ async fn issue_363() { ["p2", [[["p2", 13], ["p1", 14]], [["p2", 16], ["p1", 18]]]] ])), client_peer_id, - ).await; + ) + .await; let p1_peer_id = "p1"; let mut p1_vm = create_avm(set_variable_call_service(json!("p1")), p1_peer_id).await; diff --git a/air/tests/test_module/issues/issue_632.rs b/air/tests/test_module/issues/issue_632.rs index 2797fea86d..11a41f7e9e 100644 --- a/air/tests/test_module/issues/issue_632.rs +++ b/air/tests/test_module/issues/issue_632.rs @@ -14,8 +14,8 @@ * limitations under the License. */ -use std::cell::RefCell; use air_test_utils::{key_utils::derive_dummy_keypair, prelude::*}; +use std::cell::RefCell; use std::rc::Rc; @@ -72,7 +72,8 @@ async fn issue_310() { maplit::hashmap! { 1u32 => CallServiceResult::ok(json!(0)), }, - ).await; + ) + .await; assert_eq!(res2.ret_code, 0); // in the version without ap join behavior, it was 1. assert_eq!(res2.call_requests.len(), 0); @@ -82,7 +83,8 @@ async fn issue_310() { maplit::hashmap! { 2u32 => CallServiceResult::ok(json!(0)), }, - ).await; + ) + .await; // previously was an error: // on instruction 'ap x $y' trace handler encountered an error: state from previous `Call(..)` diff --git a/air/tests/test_module/negative_tests/execution_step.rs b/air/tests/test_module/negative_tests/execution_step.rs index 36269f5764..6352728244 100644 --- a/air/tests/test_module/negative_tests/execution_step.rs +++ b/air/tests/test_module/negative_tests/execution_step.rs @@ -448,7 +448,10 @@ async fn index_access_not_u32_i64() { ); let result = peer_vm_1.call(script.clone(), "", "", <_>::default()).await.unwrap(); - let result = peer_vm_2.call(script.clone(), "", result.data, <_>::default()).await.unwrap(); + let result = peer_vm_2 + .call(script.clone(), "", result.data, <_>::default()) + .await + .unwrap(); let expected_error = air::CatchableError::LambdaApplierError(air::LambdaError::IndexAccessNotU32 { accessor: number }); assert!(check_error(&result, expected_error)); @@ -547,7 +550,10 @@ async fn canon_stream_not_have_enough_values_call_arg() { )"# ); - let result = local_vm.call(&join_stream_script, "", "", <_>::default()).await.unwrap(); + let result = local_vm + .call(&join_stream_script, "", "", <_>::default()) + .await + .unwrap(); let actual_trace = trace_from_result(&result); assert_eq!(actual_trace.len(), 2); // only the first call and canon should produce a trace let expected_error = @@ -571,7 +577,10 @@ async fn unsupported_map_keytype() { "# ); - let result = local_vm.call(&join_stream_script, "", "", <_>::default()).await.unwrap(); + let result = local_vm + .call(&join_stream_script, "", "", <_>::default()) + .await + .unwrap(); let expected_error = CatchableError::StreamMapError(unsupported_map_key_type(map_name)); assert!(check_error(&result, expected_error)); } diff --git a/avm/server/src/runner.rs b/avm/server/src/runner.rs index 4f68a0b647..187609f0ef 100644 --- a/avm/server/src/runner.rs +++ b/avm/server/src/runner.rs @@ -25,10 +25,10 @@ use air_utils::measure; use avm_interface::raw_outcome::RawAVMOutcome; use avm_interface::CallResults; use fluence_keypair::KeyPair; -use marine::IValue; use marine::generic::Marine; use marine::generic::MarineConfig; use marine::generic::ModuleDescriptor; +use marine::IValue; use marine_wasm_backend_traits::WasmBackend; use std::path::PathBuf; @@ -59,7 +59,7 @@ impl AVMRunner { air_wasm_path: PathBuf, total_memory_limit: Option, logging_mask: i32, - wasm_backend: WB + wasm_backend: WB, ) -> RunnerResult { let (wasm_dir, wasm_filename) = split_dirname(air_wasm_path)?; @@ -162,12 +162,14 @@ impl AVMRunner { args.push(IValue::U8(tracing_output_mode)); let result = measure!( - self.marine.call_with_ivalues_async( - &self.wasm_filename, - "invoke_tracing", - &args, - <_>::default(), - ).await?, + self.marine + .call_with_ivalues_async( + &self.wasm_filename, + "invoke_tracing", + &args, + <_>::default(), + ) + .await?, tracing::Level::INFO, "marine.call_with_ivalues", method = "invoke_tracing", @@ -181,15 +183,21 @@ impl AVMRunner { Ok(outcome) } - pub async fn to_human_readable_data<'this>(&'this mut self, data: Vec) -> RunnerResult { + pub async fn to_human_readable_data<'this>( + &'this mut self, + data: Vec, + ) -> RunnerResult { let args = vec![IValue::ByteArray(data)]; - let result = self.marine.call_with_ivalues_async( - &self.wasm_filename, - "to_human_readable_data", - &args, - <_>::default(), - ).await?; + let result = self + .marine + .call_with_ivalues_async( + &self.wasm_filename, + "to_human_readable_data", + &args, + <_>::default(), + ) + .await?; let result = try_as_one_value_vec(result)?; let outcome = try_as_string(result, "result").map_err(RunnerError::Aux)?; Ok(outcome) diff --git a/crates/air-lib/test-utils/src/call_services.rs b/crates/air-lib/test-utils/src/call_services.rs index e6b1ce36ab..055247ac29 100644 --- a/crates/air-lib/test-utils/src/call_services.rs +++ b/crates/air-lib/test-utils/src/call_services.rs @@ -25,24 +25,25 @@ use std::collections::HashMap; use std::rc::Rc; pub fn unit_call_service() -> CallServiceClosure<'static> { - Box::new(|_| async { - CallServiceResult::ok(json!("result from unit_call_service")) - }.boxed_local()) + Box::new(|_| { + async { CallServiceResult::ok(json!("result from unit_call_service")) }.boxed_local() + }) } pub fn echo_call_service() -> CallServiceClosure<'static> { - Box::new(|mut params| async move { - CallServiceResult::ok(params.arguments.remove(0)) - }.boxed_local()) + Box::new(|mut params| { + async move { CallServiceResult::ok(params.arguments.remove(0)) }.boxed_local() + }) } pub fn set_variable_call_service(json: JValue) -> CallServiceClosure<'static> { Box::new(move |_| { - let json = json.clone(); - async move { - CallServiceResult::ok(json) + { + let json = json.clone(); + async move { CallServiceResult::ok(json) } } - }.boxed_local()) + .boxed_local() + }) } /// Manages which source will be used to choose a variable. @@ -79,7 +80,8 @@ pub fn set_variables_call_service( || CallServiceResult::ok(json!("default result from set_variables_call_service")), |var| CallServiceResult::ok(var.clone()), ) - }.boxed_local() + } + .boxed_local() }) } @@ -88,13 +90,13 @@ pub fn return_string_call_service(ret_str: impl Into) -> CallServiceClos Box::new(move |_| { let ret_str = ret_str.clone(); - async move { - CallServiceResult::ok(json!(ret_str.to_string())) - }.boxed_local() + async move { CallServiceResult::ok(json!(ret_str.to_string())) }.boxed_local() }) } -pub fn fallible_call_service(fallible_service_id: impl Into) -> CallServiceClosure<'static> { +pub fn fallible_call_service( + fallible_service_id: impl Into, +) -> CallServiceClosure<'static> { let fallible_service_id = Rc::new(fallible_service_id.into()); Box::new(move |params| { @@ -107,7 +109,8 @@ pub fn fallible_call_service(fallible_service_id: impl Into) -> CallServ // return success for services with other service id CallServiceResult::ok(json!("success result from fallible_call_service")) } - }.boxed_local() + } + .boxed_local() }) } @@ -124,7 +127,8 @@ pub fn fallible_call_service_by_arg(arg: impl Into) -> CallServiceClosur // return success for services with other arg CallServiceResult::ok(json!("success result from fallible_call_service_by_arg")) } - }.boxed_local() + } + .boxed_local() }) } @@ -139,12 +143,13 @@ pub fn tetraplet_host_function( let arg_tetraplets_inner = arg_tetraplets.clone(); let host_function: CallServiceClosure<'_> = Box::new(move |params| { - let arg_tetraplets_inner= arg_tetraplets_inner.clone(); + let arg_tetraplets_inner = arg_tetraplets_inner.clone(); let closure = closure.clone(); async move { *arg_tetraplets_inner.borrow_mut() = params.tetraplets.clone(); closure(params).await - }.boxed_local() + } + .boxed_local() }); (host_function, arg_tetraplets) diff --git a/crates/air-lib/test-utils/src/lib.rs b/crates/air-lib/test-utils/src/lib.rs index bec615e73d..288913c576 100644 --- a/crates/air-lib/test-utils/src/lib.rs +++ b/crates/air-lib/test-utils/src/lib.rs @@ -51,14 +51,18 @@ pub mod prelude { pub use serde_json::json; } -pub type CallServiceClosure<'x> = Box LocalBoxFuture<'x, CallServiceResult> + 'static>; +pub type CallServiceClosure<'x> = + Box LocalBoxFuture<'x, CallServiceResult> + 'static>; pub type JValue = serde_json::Value; #[macro_export] macro_rules! checked_call_vm { ($vm:expr, $test_run_parameters:expr, $script:expr, $prev_data:expr, $data:expr) => {{ - match $vm.call($script, $prev_data, $data, $test_run_parameters).await { + match $vm + .call($script, $prev_data, $data, $test_run_parameters) + .await + { Ok(v) if v.ret_code != 0 => { panic!("VM returns a error: {} {}", v.ret_code, v.error_message) } @@ -71,7 +75,10 @@ macro_rules! checked_call_vm { #[macro_export] macro_rules! call_vm { ($vm:expr, $test_run_parameters:expr, $script:expr, $prev_data:expr, $data:expr) => { - match $vm.call($script, $prev_data, $data, $test_run_parameters) .await{ + match $vm + .call($script, $prev_data, $data, $test_run_parameters) + .await + { Ok(v) => v, Err(err) => panic!("VM call failed: {}", err), } diff --git a/crates/air-lib/test-utils/src/native_test_runner.rs b/crates/air-lib/test-utils/src/native_test_runner.rs index 6867f0e4ca..7a83ca2fca 100644 --- a/crates/air-lib/test-utils/src/native_test_runner.rs +++ b/crates/air-lib/test-utils/src/native_test_runner.rs @@ -38,9 +38,7 @@ impl NativeAirRunner { impl AirRunner for NativeAirRunner { fn new(current_peer_id: impl Into) -> LocalBoxFuture<'static, Self> { let current_peer_id = current_peer_id.into(); - async move { - Self::new(current_peer_id) - }.boxed_local() + async move { Self::new(current_peer_id) }.boxed_local() } fn call<'this>( @@ -90,7 +88,8 @@ impl AirRunner for NativeAirRunner { let outcome = RawAVMOutcome::from_interpreter_outcome(outcome)?; Ok(outcome) - }.boxed_local() + } + .boxed_local() } fn get_current_peer_id(&self) -> &str { diff --git a/crates/air-lib/test-utils/src/test_runner.rs b/crates/air-lib/test-utils/src/test_runner.rs index 267264fd19..c9a5d88f86 100644 --- a/crates/air-lib/test-utils/src/test_runner.rs +++ b/crates/air-lib/test-utils/src/test_runner.rs @@ -118,17 +118,13 @@ impl TestRunner { return Ok(outcome); } - call_results = - futures::stream::iter(outcome - .call_requests - .into_iter() - ) + call_results = futures::stream::iter(outcome.call_requests.into_iter()) .then(|(id, call_parameters)| { let service_result = (self.call_service)(call_parameters); - async move { - (id, service_result.await) - }}) - .collect::>().await; + async move { (id, service_result.await) } + }) + .collect::>() + .await; prev_data = outcome.data; data = vec![]; @@ -148,18 +144,20 @@ impl TestRunner { call_results: avm_server::CallResults, particle_id: impl Into, ) -> Result> { - self.runner.call( - air, - prev_data, - data, - init_peer_id, - timestamp, - ttl, - override_current_peer_id, - call_results, - &self.keypair, - particle_id.into(), - ).await + self.runner + .call( + air, + prev_data, + data, + init_peer_id, + timestamp, + ttl, + override_current_peer_id, + call_results, + &self.keypair, + particle_id.into(), + ) + .await } } @@ -270,7 +268,8 @@ mod tests { let mut client = create_custom_avm::( set_variables_call_service(variables, VariableOptionSource::FunctionName), host_peer_id, - ).await; + ) + .await; let current_result_1 = client .runner diff --git a/crates/air-lib/test-utils/src/wasm_test_runner.rs b/crates/air-lib/test-utils/src/wasm_test_runner.rs index 8769555c0c..8b1202b300 100644 --- a/crates/air-lib/test-utils/src/wasm_test_runner.rs +++ b/crates/air-lib/test-utils/src/wasm_test_runner.rs @@ -19,16 +19,15 @@ use crate::test_runner::AirRunner; use avm_server::avm_runner::*; use fluence_keypair::KeyPair; -use once_cell::sync::OnceCell; -use object_pool::Reusable; use futures::future::LocalBoxFuture; use futures::FutureExt; -use marine_wasmtime_backend::WasmtimeWasmBackend; use marine_wasmtime_backend::WasmtimeConfig; +use marine_wasmtime_backend::WasmtimeWasmBackend; +use object_pool::Reusable; +use once_cell::sync::OnceCell; use std::path::PathBuf; - // 10 Mb const AVM_MAX_HEAP_SIZE: u64 = 10 * 1024 * 1024; const AIR_WASM_PATH: &str = "../target/wasm32-wasi/debug/air_interpreter_server.wasm"; @@ -39,7 +38,6 @@ pub struct WasmAirRunner { runner: Reusable<'static, AVMRunner>, } - fn create_wasm_backend() -> WasmtimeWasmBackend { let mut config = WasmtimeConfig::new(); config @@ -57,7 +55,7 @@ async fn make_pooled_avm_runner() -> AVMRunner { PathBuf::from(AIR_WASM_PATH), Some(AVM_MAX_HEAP_SIZE), logging_mask, - wasm_backend + wasm_backend, ) .await .expect("vm should be created") @@ -67,7 +65,8 @@ impl AirRunner for WasmAirRunner { fn new(current_peer_id: impl Into) -> LocalBoxFuture<'static, Self> { let current_peer_id = current_peer_id.into(); async move { - static POOL_CELL: OnceCell>> = OnceCell::new(); + static POOL_CELL: OnceCell>> = + OnceCell::new(); let pool = POOL_CELL.get_or_init(|| { object_pool::Pool::new( // we create an empty pool and let it fill on demand @@ -78,14 +77,15 @@ impl AirRunner for WasmAirRunner { let runner = match pool.try_pull() { Some(runner) => runner, - None => Reusable::new(pool, make_pooled_avm_runner().await) + None => Reusable::new(pool, make_pooled_avm_runner().await), }; Self { current_peer_id: current_peer_id.into(), runner, } - }.boxed_local() + } + .boxed_local() } fn call<'this>( @@ -110,19 +110,23 @@ impl AirRunner for WasmAirRunner { let current_peer_id = override_current_peer_id.unwrap_or_else(|| self.current_peer_id.clone()); - Ok(self.runner.call( - air, - prev_data, - data, - init_peer_id, - timestamp, - ttl, - current_peer_id, - call_results, - &keypair, - particle_id, - ).await?) - }.boxed_local() + Ok(self + .runner + .call( + air, + prev_data, + data, + init_peer_id, + timestamp, + ttl, + current_peer_id, + call_results, + &keypair, + particle_id, + ) + .await?) + } + .boxed_local() } fn get_current_peer_id(&self) -> &str { @@ -148,15 +152,17 @@ impl AirRunner for ReleaseWasmAirRunner { PathBuf::from(RELEASE_AIR_WASM_PATH), Some(AVM_MAX_HEAP_SIZE), logging_mask, - wasm_backend) - .await - .expect("vm should be created"); + wasm_backend, + ) + .await + .expect("vm should be created"); Self { current_peer_id: current_peer_id.into(), runner, } - }.boxed_local() + } + .boxed_local() } fn call<'this>( @@ -179,21 +185,25 @@ impl AirRunner for ReleaseWasmAirRunner { let keypair = keypair.clone(); async move { let current_peer_id = - override_current_peer_id.unwrap_or_else(|| self.current_peer_id.clone()); - - Ok(self.runner.call( - air, - prev_data, - data, - init_peer_id, - timestamp, - ttl, - current_peer_id, - call_results, - &keypair, - particle_id, - ).await?) - }.boxed_local() + override_current_peer_id.unwrap_or_else(|| self.current_peer_id.clone()); + + Ok(self + .runner + .call( + air, + prev_data, + data, + init_peer_id, + timestamp, + ttl, + current_peer_id, + call_results, + &keypair, + particle_id, + ) + .await?) + } + .boxed_local() } fn get_current_peer_id(&self) -> &str { diff --git a/crates/testing-framework/src/asserts/behavior.rs b/crates/testing-framework/src/asserts/behavior.rs index 24d43f9894..98c26e785f 100644 --- a/crates/testing-framework/src/asserts/behavior.rs +++ b/crates/testing-framework/src/asserts/behavior.rs @@ -62,7 +62,10 @@ pub(crate) fn parse_behaviour(inp: &str) -> IResult<&str, Behavior, super::parse } impl Behavior { - pub(crate) async fn call(&self, params: air_test_utils::CallRequestParams) -> CallServiceResult { + pub(crate) async fn call( + &self, + params: air_test_utils::CallRequestParams, + ) -> CallServiceResult { use Behavior::*; match self { diff --git a/crates/testing-framework/src/ephemeral/mod.rs b/crates/testing-framework/src/ephemeral/mod.rs index 96ca22bbdf..42ac1d1952 100644 --- a/crates/testing-framework/src/ephemeral/mod.rs +++ b/crates/testing-framework/src/ephemeral/mod.rs @@ -107,7 +107,10 @@ impl Peer { queue_cell: &PeerQueueCell, ) -> Result { let prev_data = queue_cell.take_prev_data(); - let res = self.runner.call(air, prev_data, data, test_run_params).await; + let res = self + .runner + .call(air, prev_data, data, test_run_params) + .await; if let Ok(outcome) = &res { queue_cell.set_prev_data(outcome.data.clone()); } diff --git a/crates/testing-framework/src/ephemeral/neighborhood.rs b/crates/testing-framework/src/ephemeral/neighborhood.rs index a295ef2c67..53deef11fb 100644 --- a/crates/testing-framework/src/ephemeral/neighborhood.rs +++ b/crates/testing-framework/src/ephemeral/neighborhood.rs @@ -199,18 +199,20 @@ impl PeerEnv { let queue_cell = queue.get_peer_queue_cell(self.peer.peer_id.clone()); let maybe_data = queue_cell.pop_data(); - let maybe_data: futures::future::OptionFuture<_> = maybe_data.map(|data| async { - let res = self - .peer - .invoke(air, data, test_parameters.clone(), &queue_cell) - .await; - - if let Ok(outcome) = &res { - queue.distribute_to_peers(network, &outcome.next_peer_pks, &outcome.data) - } - - res - }).into(); + let maybe_data: futures::future::OptionFuture<_> = maybe_data + .map(|data| async { + let res = self + .peer + .invoke(air, data, test_parameters.clone(), &queue_cell) + .await; + + if let Ok(outcome) = &res { + queue.distribute_to_peers(network, &outcome.next_peer_pks, &outcome.data) + } + + res + }) + .into(); maybe_data.await } diff --git a/crates/testing-framework/src/execution/mod.rs b/crates/testing-framework/src/execution/mod.rs index 57862f9535..21f902cb33 100644 --- a/crates/testing-framework/src/execution/mod.rs +++ b/crates/testing-framework/src/execution/mod.rs @@ -26,8 +26,8 @@ use air_test_utils::{ RawAVMOutcome, }; -use futures::StreamExt; use futures::future::OptionFuture; +use futures::StreamExt; #[allow(unused)] // compiler gives warning, but it is used use futures::future::LocalBoxFuture; @@ -58,7 +58,8 @@ impl AirScriptExecutor { vec![], std::iter::empty(), annotated_air_script, - ).await + ) + .await } } @@ -133,10 +134,7 @@ impl AirScriptExecutor { PeerId: Borrow + for<'a> From<&'a Id>, Id: Eq + Hash + ?Sized, { - let exec_iter: OptionFuture<_> = self - .execution_iter(peer_id) - .map(|it| it.collect()) - .into(); + let exec_iter: OptionFuture<_> = self.execution_iter(peer_id).map(|it| it.collect()).into(); exec_iter.await } @@ -213,12 +211,22 @@ mod tests { let outcome = &result_init[0]; assert_eq!(outcome.next_peer_pks, vec![peer1_id.clone()]); - assert!(exec.execution_iter(peer2_name).unwrap().next().await.is_none()); + assert!(exec + .execution_iter(peer2_name) + .unwrap() + .next() + .await + .is_none()); let results1: Vec<_> = exec.execution_iter(peer1_name).unwrap().collect().await; assert_eq!(results1.len(), 1); let outcome1 = &results1[0]; assert_eq!(outcome1.ret_code, 0); - assert!(exec.execution_iter(peer1_name).unwrap().next().await.is_none()); + assert!(exec + .execution_iter(peer1_name) + .unwrap() + .next() + .await + .is_none()); let outcome2 = exec.execute_one(peer2_name).await.unwrap(); assert_eq!(outcome2.ret_code, 0); @@ -330,13 +338,23 @@ mod tests { assert_eq!(outcome1.ret_code, 0); assert_eq!(outcome1.error_message, ""); - assert!(exec.execution_iter(peer2_name).unwrap().next().await.is_none()); + assert!(exec + .execution_iter(peer2_name) + .unwrap() + .next() + .await + .is_none()); { let results1 = exec.execute_all(peer1_name).await.unwrap(); assert_eq!(results1.len(), 1); let outcome1 = &results1[0]; assert_eq!(outcome1.ret_code, 0, "{:?}", outcome1); - assert!(exec.execution_iter(peer1_name).unwrap().next().await.is_none()); + assert!(exec + .execution_iter(peer1_name) + .unwrap() + .next() + .await + .is_none()); assert_next_pks!(&outcome1.next_peer_pks, [peer2_id.as_str()]); } @@ -345,7 +363,12 @@ mod tests { assert_eq!(results2.len(), 1); let outcome2 = &results2[0]; assert_eq!(outcome2.ret_code, 0, "{:?}", outcome2); - assert!(exec.execution_iter(peer2_name).unwrap().next().await.is_none()); + assert!(exec + .execution_iter(peer2_name) + .unwrap() + .next() + .await + .is_none()); assert_next_pks!(&outcome2.next_peer_pks, [peer3_id.as_str()]); let trace = trace_from_result(outcome2); @@ -375,7 +398,12 @@ mod tests { assert_eq!(results3.len(), 1); let outcome3 = &results3[0]; assert_eq!(outcome3.ret_code, 0, "{:?}", outcome3); - assert!(exec.execution_iter(peer3_name).unwrap().next().await.is_none()); + assert!(exec + .execution_iter(peer3_name) + .unwrap() + .next() + .await + .is_none()); let trace = trace_from_result(outcome3); assert_eq!( @@ -535,13 +563,23 @@ mod tests { assert_eq!(outcome1.ret_code, 0); assert_eq!(outcome1.error_message, ""); - assert!(exec.execution_iter(peer2_name).unwrap().next().await.is_none()); + assert!(exec + .execution_iter(peer2_name) + .unwrap() + .next() + .await + .is_none()); { let results1 = exec.execute_all(peer1_name).await.unwrap(); assert_eq!(results1.len(), 1); let outcome1 = &results1[0]; assert_eq!(outcome1.ret_code, 0, "{:?}", outcome1); - assert!(exec.execution_iter(peer1_name).unwrap().next().await.is_none()); + assert!(exec + .execution_iter(peer1_name) + .unwrap() + .next() + .await + .is_none()); assert_next_pks!(&outcome1.next_peer_pks, [peer2_id.as_str()]); } @@ -550,7 +588,12 @@ mod tests { assert_eq!(results2.len(), 1); let outcome2 = &results2[0]; assert_eq!(outcome2.ret_code, 0, "{:?}", outcome2); - assert!(exec.execution_iter(peer2_name).unwrap().next().await.is_none()); + assert!(exec + .execution_iter(peer2_name) + .unwrap() + .next() + .await + .is_none()); assert_next_pks!(&outcome2.next_peer_pks, [peer3_id.as_str()]); let trace = trace_from_result(outcome2); @@ -718,11 +761,15 @@ mod tests { } impl MarineService for Service { - fn call<'this>(&'this self, _params: CallRequestParams) -> LocalBoxFuture<'this, crate::services::FunctionOutcome> { + fn call<'this>( + &'this self, + _params: CallRequestParams, + ) -> LocalBoxFuture<'this, crate::services::FunctionOutcome> { async { let mut cell = self.state.borrow_mut(); crate::services::FunctionOutcome::from_value(cell.next().unwrap()) - }.boxed_local() + } + .boxed_local() } } let service = Service { @@ -731,11 +778,14 @@ mod tests { let network = Network::::new( std::iter::empty::(), vec![service.to_handle()], - ).await; + ) + .await; let peer_name = "peer1"; let air_script = format!(r#"(call "{peer_name}" ("service" "function") [])"#); - let transformed1 = TransformedAirScript::new(&air_script, network.clone()).await.unwrap(); + let transformed1 = TransformedAirScript::new(&air_script, network.clone()) + .await + .unwrap(); let exectution1 = AirScriptExecutor::from_transformed_air_script( TestRunParameters::from_init_peer_id(peer_name), transformed1, @@ -743,7 +793,9 @@ mod tests { .await .unwrap(); - let transformed2 = TransformedAirScript::new(&air_script, network).await.unwrap(); + let transformed2 = TransformedAirScript::new(&air_script, network) + .await + .unwrap(); let exectution2 = AirScriptExecutor::from_transformed_air_script( TestRunParameters::from_init_peer_id(peer_name), transformed2, @@ -784,7 +836,8 @@ mod tests { (call "peer1" ("service" "func") [1 22] arg) ; behaviour=echo ) "#, - ).await; + ) + .await; match &res { Ok(_) => { @@ -852,7 +905,7 @@ mod tests { std::iter::empty(), air_script, ) - .await + .await .unwrap(); let result_init: Vec<_> = exec.execution_iter(peer_name).unwrap().collect().await; @@ -947,7 +1000,7 @@ mod tests { std::iter::empty(), air_script, ) - .await + .await .unwrap(); let result_init: Vec<_> = exec.execution_iter(peer_name).unwrap().collect().await; diff --git a/crates/testing-framework/src/queue.rs b/crates/testing-framework/src/queue.rs index a9fac6639b..4c062883a0 100644 --- a/crates/testing-framework/src/queue.rs +++ b/crates/testing-framework/src/queue.rs @@ -21,10 +21,9 @@ use air_test_utils::{ RawAVMOutcome, }; -use futures::{ - stream::StreamExt -}; +use futures::stream::StreamExt; +use std::pin::pin; use std::{ borrow::Borrow, cell::RefCell, @@ -34,7 +33,6 @@ use std::{ ops::Deref, rc::Rc, }; -use std::pin::pin; #[derive(Debug, Default)] pub(crate) struct PeerQueueCell { @@ -99,11 +97,10 @@ impl ExecutionQueue { peer_env.map(|peer_env_cell| { futures::stream::poll_fn(move |ctx| { let mut peer_env = peer_env_cell.borrow_mut(); - let x = pin!(peer_env - .execute_once(air, &network, self, test_parameters)) - .poll(ctx); + let x = pin!(peer_env.execute_once(air, &network, self, test_parameters)).poll(ctx); x - }).map(|r| r.unwrap_or_else(|err| panic!("VM call failed: {}", err))) + }) + .map(|r| r.unwrap_or_else(|err| panic!("VM call failed: {}", err))) }) } diff --git a/crates/testing-framework/src/services/mod.rs b/crates/testing-framework/src/services/mod.rs index 265f43c324..ad50242172 100644 --- a/crates/testing-framework/src/services/mod.rs +++ b/crates/testing-framework/src/services/mod.rs @@ -48,7 +48,10 @@ impl FunctionOutcome { /// A mocked Marine service. pub trait MarineService { - fn call<'this>(&'this self, params: CallRequestParams) -> LocalBoxFuture<'this, FunctionOutcome>; + fn call<'this>( + &'this self, + params: CallRequestParams, + ) -> LocalBoxFuture<'this, FunctionOutcome>; fn to_handle(self) -> MarineServiceHandle where @@ -62,11 +65,15 @@ pub trait MarineService { pub struct MarineServiceHandle(Rc>>); impl MarineService for MarineServiceHandle { - fn call<'this>(&'this self, params: CallRequestParams) -> LocalBoxFuture<'this, FunctionOutcome> { + fn call<'this>( + &'this self, + params: CallRequestParams, + ) -> LocalBoxFuture<'this, FunctionOutcome> { async { let mut guard = self.0.borrow_mut(); MarineService::call(guard.as_mut(), params).await - }.boxed_local() + } + .boxed_local() } } @@ -81,11 +88,14 @@ pub(crate) fn services_to_call_service_closure( match outcome { FunctionOutcome::ServiceResult(result, _) => return result, FunctionOutcome::NotDefined => continue, - FunctionOutcome::Empty => return CallServiceResult::ok(serde_json::Value::Null), + FunctionOutcome::Empty => { + return CallServiceResult::ok(serde_json::Value::Null) + } } } panic!("No function found for params {:?}", params) - }.boxed_local() + } + .boxed_local() }) } diff --git a/crates/testing-framework/src/services/results.rs b/crates/testing-framework/src/services/results.rs index bf974c0f84..9732bc5ce0 100644 --- a/crates/testing-framework/src/services/results.rs +++ b/crates/testing-framework/src/services/results.rs @@ -17,8 +17,8 @@ use super::{FunctionOutcome, MarineService}; use crate::asserts::ServiceDefinition; -use futures::FutureExt; use futures::future::LocalBoxFuture; +use futures::FutureExt; use air_test_utils::CallRequestParams; @@ -39,7 +39,10 @@ impl ResultStore { } impl MarineService for ResultStore { - fn call<'this>(&'this self, mut params: CallRequestParams) -> LocalBoxFuture<'this, FunctionOutcome> { + fn call<'this>( + &'this self, + mut params: CallRequestParams, + ) -> LocalBoxFuture<'this, FunctionOutcome> { async { let results = self.results.borrow(); let (real_service_id, suffix) = match params.service_id.rsplit_once("..") { @@ -48,9 +51,9 @@ impl MarineService for ResultStore { }; if let Ok(result_id) = suffix.parse::() { - let service_desc = results - .get(&result_id) - .unwrap_or_else(|| panic!("failed to parse service name {:?}", params.service_id)); + let service_desc = results.get(&result_id).unwrap_or_else(|| { + panic!("failed to parse service name {:?}", params.service_id) + }); // hide the artificial service_id params.service_id = real_service_id.to_owned(); FunctionOutcome::from_service_result(service_desc.call(params).await) @@ -58,7 +61,8 @@ impl MarineService for ResultStore { // Pass malformed service names further in a chain FunctionOutcome::NotDefined } - }.boxed_local() + } + .boxed_local() } } @@ -73,7 +77,10 @@ impl MarineServiceWrapper { } impl MarineService for MarineServiceWrapper { - fn call<'this>(&'this self, params: CallRequestParams) -> LocalBoxFuture<'this, FunctionOutcome> { + fn call<'this>( + &'this self, + params: CallRequestParams, + ) -> LocalBoxFuture<'this, FunctionOutcome> { self.wrapped.call(params) } } diff --git a/crates/testing-framework/src/transform/walker.rs b/crates/testing-framework/src/transform/walker.rs index 0f3b0a588b..da68c34183 100644 --- a/crates/testing-framework/src/transform/walker.rs +++ b/crates/testing-framework/src/transform/walker.rs @@ -168,7 +168,9 @@ mod tests { async fn test_translate_call_no_result() { let network = Network::::new(std::iter::empty::(), vec![]).await; let script = r#"(call peer_id ("service_id" func) [])"#; - let transformed = TransformedAirScript::new_unvalidated(script, network).await.unwrap(); + let transformed = TransformedAirScript::new_unvalidated(script, network) + .await + .unwrap(); assert_eq!(&*transformed, script); } @@ -185,7 +187,9 @@ mod tests { async fn test_translate_call_result() { let network = Network::::new(std::iter::empty::(), vec![]).await; let script = r#"(call "peer_id" ("service_id" func) []) ; ok = 42"#; - let transformer = TransformedAirScript::new_unvalidated(script, network.clone()).await.unwrap(); + let transformer = TransformedAirScript::new_unvalidated(script, network.clone()) + .await + .unwrap(); let peer_id = at("peer_id"); @@ -219,7 +223,9 @@ mod tests { ))"#; let network = Network::::new(std::iter::empty::(), vec![]).await; - let transformed = TransformedAirScript::new_unvalidated(script, network.clone()).await.unwrap(); + let transformed = TransformedAirScript::new_unvalidated(script, network.clone()) + .await + .unwrap(); assert_eq!( &*transformed, concat!( @@ -259,7 +265,9 @@ mod tests { ))"#; let network = Network::::new(std::iter::empty::(), vec![]).await; - let t = TransformedAirScript::new_unvalidated(script, network.clone()).await.unwrap(); + let t = TransformedAirScript::new_unvalidated(script, network.clone()) + .await + .unwrap(); let peer_id1 = at("peer_id1"); let peer_id2 = at("peer_id2"); @@ -296,7 +304,9 @@ mod tests { let script = r#"(call "peer_id1" ("service_id" "func") [1 @"peer_id3"] x) ; ok={"test":@"peer_id2"}"#; let network = Network::::new(std::iter::empty::(), vec![]).await; - let t = TransformedAirScript::new(script, network.clone()).await.unwrap(); + let t = TransformedAirScript::new(script, network.clone()) + .await + .unwrap(); let peer_id1 = at("peer_id1"); let peer_id2 = at("peer_id2"); diff --git a/tools/cli/air/src/data.rs b/tools/cli/air/src/data.rs index 31a5755088..8cac0488f2 100644 --- a/tools/cli/air/src/data.rs +++ b/tools/cli/air/src/data.rs @@ -81,11 +81,8 @@ pub(crate) async fn to_human_readable_data(args: Args) -> Result<(), Box anyhow::Result<()> { &args.air_interpreter_path, &args.air_near_contract_path, args.max_heap_size, - ).await?; + ) + .await?; let execution_data = match &args.source { Source::Anomaly(anomaly) => data::anomaly::load(anomaly)?, diff --git a/tools/cli/air/src/trace/run/native.rs b/tools/cli/air/src/trace/run/native.rs index 49b0195ea1..6b9ea0fb48 100644 --- a/tools/cli/air/src/trace/run/native.rs +++ b/tools/cli/air/src/trace/run/native.rs @@ -74,15 +74,17 @@ impl AirRunner for NativeAvmRunner { let outcome = RawAVMOutcome::from_interpreter_outcome(outcome)?; Ok(outcome) - }.boxed_local() + } + .boxed_local() } } impl DataToHumanReadable for NativeAvmRunner { - fn to_human_readable<'this>(&'this mut self, data: Vec) -> LocalBoxFuture<'this, Result>> { - async move { - air::to_human_readable_data(data) - }.boxed_local() + fn to_human_readable<'this>( + &'this mut self, + data: Vec, + ) -> LocalBoxFuture<'this, Result>> { + async move { air::to_human_readable_data(data) }.boxed_local() } } diff --git a/tools/cli/air/src/trace/run/runner.rs b/tools/cli/air/src/trace/run/runner.rs index 5b91fa7f03..886430f46a 100644 --- a/tools/cli/air/src/trace/run/runner.rs +++ b/tools/cli/air/src/trace/run/runner.rs @@ -41,5 +41,8 @@ pub(crate) trait AirRunner { } pub(crate) trait DataToHumanReadable { - fn to_human_readable<'this>(&'this mut self, data: Vec) -> LocalBoxFuture<'this, Result>>; + fn to_human_readable<'this>( + &'this mut self, + data: Vec, + ) -> LocalBoxFuture<'this, Result>>; } diff --git a/tools/cli/air/src/trace/run/wasm.rs b/tools/cli/air/src/trace/run/wasm.rs index cf3d8bce24..d5640e2eb8 100644 --- a/tools/cli/air/src/trace/run/wasm.rs +++ b/tools/cli/air/src/trace/run/wasm.rs @@ -18,14 +18,14 @@ use super::runner::AirRunner; use super::runner::DataToHumanReadable; use air_test_utils::avm_runner::AVMRunner; use fluence_keypair::KeyPair; -use marine_wasmtime_backend::WasmtimeWasmBackend; -use marine_wasmtime_backend::WasmtimeConfig; use futures::future::LocalBoxFuture; use futures::FutureExt; +use marine_wasmtime_backend::WasmtimeConfig; +use marine_wasmtime_backend::WasmtimeWasmBackend; +use anyhow::anyhow; use std::error::Error as StdError; use std::path::Path; -use anyhow::anyhow; pub(crate) struct WasmAvmRunner(AVMRunner); @@ -47,35 +47,45 @@ impl AirRunner for WasmAvmRunner { ) -> LocalBoxFuture<'this, anyhow::Result> { let keypair = keypair.clone(); async move { - let call_tracing = self.0.call_tracing( - air, - prev_data, - data, - init_peer_id, - timestamp, - ttl, - current_peer_id, - call_results, - tracing_params, - tracing_output_mode, - keypair.key_format().into(), - keypair.secret().expect("Failed to get secret"), - particle_id, - ).await; + let call_tracing = self + .0 + .call_tracing( + air, + prev_data, + data, + init_peer_id, + timestamp, + ttl, + current_peer_id, + call_results, + tracing_params, + tracing_output_mode, + keypair.key_format().into(), + keypair.secret().expect("Failed to get secret"), + particle_id, + ) + .await; let memory_stats = self.0.memory_stats(); tracing::warn!(memory_size = memory_stats.memory_size); Ok(call_tracing?) - }.boxed_local() + } + .boxed_local() } } impl DataToHumanReadable for WasmAvmRunner { - fn to_human_readable<'this>(&'this mut self, data: Vec) -> LocalBoxFuture<'this, Result>> { + fn to_human_readable<'this>( + &'this mut self, + data: Vec, + ) -> LocalBoxFuture<'this, Result>> { async { - self.0.to_human_readable_data(data).await + self.0 + .to_human_readable_data(data) + .await .map_err(|e| Box::new(e) as Box) - }.boxed_local() + } + .boxed_local() } } @@ -89,10 +99,13 @@ pub(crate) async fn create_wasm_avm_runner( .wasm_backtrace(true) .epoch_interruption(false); let wasm_backend = WasmtimeWasmBackend::new(config).map_err(|e| anyhow!(e))?; - Ok(Box::new(WasmAvmRunner(AVMRunner::new( - air_interpreter_wasm_path.to_owned(), - max_heap_size, - 0, - wasm_backend - ).await?))) + Ok(Box::new(WasmAvmRunner( + AVMRunner::new( + air_interpreter_wasm_path.to_owned(), + max_heap_size, + 0, + wasm_backend, + ) + .await?, + ))) } From 0b8eb81efe5fff1bffe7a05bdc31f533b4158986 Mon Sep 17 00:00:00 2001 From: Valery Antopol Date: Tue, 13 Feb 2024 15:47:54 +0400 Subject: [PATCH 07/14] merge with master --- .../auth_module/Cargo.lock | 45 ++++++++++++------- .../log_storage/Cargo.lock | 45 ++++++++++++------- tools/cli/air/src/trace/run/wasm.rs | 3 +- 3 files changed, 59 insertions(+), 34 deletions(-) diff --git a/air/tests/test_module/features/tetraplets/security_tetraplets/auth_module/Cargo.lock b/air/tests/test_module/features/tetraplets/security_tetraplets/auth_module/Cargo.lock index 1037a44712..63eaaf381f 100644 --- a/air/tests/test_module/features/tetraplets/security_tetraplets/auth_module/Cargo.lock +++ b/air/tests/test_module/features/tetraplets/security_tetraplets/auth_module/Cargo.lock @@ -33,9 +33,9 @@ dependencies = [ name = "air-interpreter-cid" version = "0.9.0" dependencies = [ - "blake3", "cid", "digest 0.10.7", + "fluence-blake3", "multihash 0.19.1", "multihash-codetable", "rkyv", @@ -71,7 +71,7 @@ dependencies = [ [[package]] name = "air-interpreter-interface" -version = "0.17.1" +version = "0.17.2" dependencies = [ "air-interpreter-sede", "marine-call-parameters", @@ -170,7 +170,7 @@ dependencies = [ [[package]] name = "aquavm-air" -version = "0.58.0" +version = "0.59.0" dependencies = [ "air-execution-info-collector", "air-interpreter-cid", @@ -371,7 +371,6 @@ dependencies = [ "cc", "cfg-if", "constant_time_eq 0.3.0", - "digest 0.10.7", ] [[package]] @@ -821,6 +820,20 @@ version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80" +[[package]] +name = "fluence-blake3" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a3c704928408e9b8f7c9d5b24a4f205dd5cb89d378aa31a01140df810093bf5" +dependencies = [ + "arrayref", + "arrayvec", + "cc", + "cfg-if", + "constant_time_eq 0.3.0", + "digest 0.10.7", +] + [[package]] name = "fluence-keypair" version = "0.10.4" @@ -1156,9 +1169,9 @@ checksum = "3e2e65a1a2e43cfcb47a895c4c8b10d1f4a61097f9f254f183aee60cad9c651d" [[package]] name = "marine-call-parameters" -version = "0.10.3" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef9a7c6ed5fa9052474c1cd76d3b3e67dbc4c455c76263c2c043214e12cce6bd" +checksum = "f47b1186bad0b2a5e9218e3f6fbe0612ef6b17c58c58537d77bd08044596ea95" dependencies = [ "marine-macro", "marine-rs-sdk-main", @@ -1168,9 +1181,9 @@ dependencies = [ [[package]] name = "marine-macro" -version = "0.10.3" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "acdaa50f8239afa104ef8a99d4219288f68169e29c913485bbd094a35fe79113" +checksum = "727b1a5449eb1676837c5fc22a8c31dc9980dcef4de938f26f2eaf7c2c54331b" dependencies = [ "marine-macro-impl", "marine-rs-sdk-main", @@ -1178,9 +1191,9 @@ dependencies = [ [[package]] name = "marine-macro-impl" -version = "0.10.3" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "460ef42c1bf6dbb88976a00514f8e1b97a7ccb60e3e6009cbb563b0d163166c7" +checksum = "57c8cd8a228856db057bd4a32c6e2708848b2b1db7552be0a6063d534cafb4e2" dependencies = [ "proc-macro2", "quote", @@ -1191,9 +1204,9 @@ dependencies = [ [[package]] name = "marine-rs-sdk" -version = "0.10.3" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "034cab8adf708e87db08f093e0c7b8ea49359cc875ed2a778c1bf245b5d9d9f8" +checksum = "7662e4c6c08f7cd1b63cd6ff8e473e3239a9d3dd10fb46bec357cb8331423268" dependencies = [ "marine-call-parameters", "marine-macro", @@ -1204,9 +1217,9 @@ dependencies = [ [[package]] name = "marine-rs-sdk-main" -version = "0.10.3" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "031eeea016dab58c1ccb0c65b798cb5e47d214b05115c8c06198717d18275756" +checksum = "6cba9000500575b4965ec44e44bbbfd056d121be1195969ce1a5cc146646c37b" dependencies = [ "log", "serde", @@ -1214,9 +1227,9 @@ dependencies = [ [[package]] name = "marine-timestamp-macro" -version = "0.10.3" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f812a03cb13b79ab75e38053a77ecc4b4738a1b485b650d971dec3dbbcb2561" +checksum = "47ec0d664570661ecba1feba2dda610ab63f23733edf189dcde7b5ed23966144" dependencies = [ "chrono", "quote", diff --git a/air/tests/test_module/features/tetraplets/security_tetraplets/log_storage/Cargo.lock b/air/tests/test_module/features/tetraplets/security_tetraplets/log_storage/Cargo.lock index f641b47055..4434f5208c 100644 --- a/air/tests/test_module/features/tetraplets/security_tetraplets/log_storage/Cargo.lock +++ b/air/tests/test_module/features/tetraplets/security_tetraplets/log_storage/Cargo.lock @@ -33,9 +33,9 @@ dependencies = [ name = "air-interpreter-cid" version = "0.9.0" dependencies = [ - "blake3", "cid", "digest 0.10.7", + "fluence-blake3", "multihash 0.19.1", "multihash-codetable", "rkyv", @@ -71,7 +71,7 @@ dependencies = [ [[package]] name = "air-interpreter-interface" -version = "0.17.1" +version = "0.17.2" dependencies = [ "air-interpreter-sede", "marine-call-parameters", @@ -170,7 +170,7 @@ dependencies = [ [[package]] name = "aquavm-air" -version = "0.58.0" +version = "0.59.0" dependencies = [ "air-execution-info-collector", "air-interpreter-cid", @@ -363,7 +363,6 @@ dependencies = [ "cc", "cfg-if", "constant_time_eq 0.3.0", - "digest 0.10.7", ] [[package]] @@ -813,6 +812,20 @@ version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80" +[[package]] +name = "fluence-blake3" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a3c704928408e9b8f7c9d5b24a4f205dd5cb89d378aa31a01140df810093bf5" +dependencies = [ + "arrayref", + "arrayvec", + "cc", + "cfg-if", + "constant_time_eq 0.3.0", + "digest 0.10.7", +] + [[package]] name = "fluence-keypair" version = "0.10.4" @@ -1156,9 +1169,9 @@ checksum = "3e2e65a1a2e43cfcb47a895c4c8b10d1f4a61097f9f254f183aee60cad9c651d" [[package]] name = "marine-call-parameters" -version = "0.10.3" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef9a7c6ed5fa9052474c1cd76d3b3e67dbc4c455c76263c2c043214e12cce6bd" +checksum = "f47b1186bad0b2a5e9218e3f6fbe0612ef6b17c58c58537d77bd08044596ea95" dependencies = [ "marine-macro", "marine-rs-sdk-main", @@ -1168,9 +1181,9 @@ dependencies = [ [[package]] name = "marine-macro" -version = "0.10.3" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "acdaa50f8239afa104ef8a99d4219288f68169e29c913485bbd094a35fe79113" +checksum = "727b1a5449eb1676837c5fc22a8c31dc9980dcef4de938f26f2eaf7c2c54331b" dependencies = [ "marine-macro-impl", "marine-rs-sdk-main", @@ -1178,9 +1191,9 @@ dependencies = [ [[package]] name = "marine-macro-impl" -version = "0.10.3" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "460ef42c1bf6dbb88976a00514f8e1b97a7ccb60e3e6009cbb563b0d163166c7" +checksum = "57c8cd8a228856db057bd4a32c6e2708848b2b1db7552be0a6063d534cafb4e2" dependencies = [ "proc-macro2", "quote", @@ -1191,9 +1204,9 @@ dependencies = [ [[package]] name = "marine-rs-sdk" -version = "0.10.3" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "034cab8adf708e87db08f093e0c7b8ea49359cc875ed2a778c1bf245b5d9d9f8" +checksum = "7662e4c6c08f7cd1b63cd6ff8e473e3239a9d3dd10fb46bec357cb8331423268" dependencies = [ "marine-call-parameters", "marine-macro", @@ -1204,9 +1217,9 @@ dependencies = [ [[package]] name = "marine-rs-sdk-main" -version = "0.10.3" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "031eeea016dab58c1ccb0c65b798cb5e47d214b05115c8c06198717d18275756" +checksum = "6cba9000500575b4965ec44e44bbbfd056d121be1195969ce1a5cc146646c37b" dependencies = [ "log", "serde", @@ -1214,9 +1227,9 @@ dependencies = [ [[package]] name = "marine-timestamp-macro" -version = "0.10.3" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f812a03cb13b79ab75e38053a77ecc4b4738a1b485b650d971dec3dbbcb2561" +checksum = "47ec0d664570661ecba1feba2dda610ab63f23733edf189dcde7b5ed23966144" dependencies = [ "chrono", "quote", diff --git a/tools/cli/air/src/trace/run/wasm.rs b/tools/cli/air/src/trace/run/wasm.rs index f28e29e8dc..d5f0a687ff 100644 --- a/tools/cli/air/src/trace/run/wasm.rs +++ b/tools/cli/air/src/trace/run/wasm.rs @@ -23,7 +23,6 @@ use futures::FutureExt; use marine_wasmtime_backend::WasmtimeConfig; use marine_wasmtime_backend::WasmtimeWasmBackend; -use anyhow::anyhow; use std::error::Error as StdError; use std::path::Path; @@ -98,7 +97,7 @@ pub(crate) async fn create_wasm_avm_runner( .debug_info(true) .wasm_backtrace(true) .epoch_interruption(false); - let wasm_backend = WasmtimeWasmBackend::new(config).map_err(|e| anyhow!(e))?; + let wasm_backend = WasmtimeWasmBackend::new(config) ?; Ok(Box::new(WasmAvmRunner( AVMRunner::new( air_interpreter_wasm_path.to_owned(), From 385200e3e8ab63751741a89b93fc2e5899bd9eba Mon Sep 17 00:00:00 2001 From: Valery Antopol Date: Wed, 14 Feb 2024 17:50:28 +0400 Subject: [PATCH 08/14] use git dependency --- Cargo.lock | 13 +++++++++++++ air/Cargo.toml | 2 +- avm/server/Cargo.toml | 6 +++--- crates/air-lib/test-utils/Cargo.toml | 4 ++-- crates/air-lib/test-utils/src/wasm_test_runner.rs | 4 ++-- tools/cli/air/Cargo.toml | 2 +- 6 files changed, 22 insertions(+), 9 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index b521e31410..4a5285fdce 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2445,6 +2445,7 @@ dependencies = [ [[package]] name = "fluence-app-service" version = "0.32.0" +source = "git+https://github.com/fluencelabs/marine?branch=feat/async-call#5e48c7990ea28ac24feddede08cdf6165b68d473" dependencies = [ "log", "maplit", @@ -3139,6 +3140,7 @@ dependencies = [ [[package]] name = "it-json-serde" version = "0.5.1" +source = "git+https://github.com/fluencelabs/marine?branch=feat/async-call#5e48c7990ea28ac24feddede08cdf6165b68d473" dependencies = [ "serde", "serde_derive", @@ -3460,6 +3462,7 @@ dependencies = [ [[package]] name = "marine-core" version = "0.27.0" +source = "git+https://github.com/fluencelabs/marine?branch=feat/async-call#5e48c7990ea28ac24feddede08cdf6165b68d473" dependencies = [ "anyhow", "bytesize", @@ -3488,6 +3491,7 @@ dependencies = [ [[package]] name = "marine-it-generator" version = "0.14.0" +source = "git+https://github.com/fluencelabs/marine?branch=feat/async-call#5e48c7990ea28ac24feddede08cdf6165b68d473" dependencies = [ "it-lilo", "marine-it-parser", @@ -3503,6 +3507,7 @@ dependencies = [ [[package]] name = "marine-it-interfaces" version = "0.9.1" +source = "git+https://github.com/fluencelabs/marine?branch=feat/async-call#5e48c7990ea28ac24feddede08cdf6165b68d473" dependencies = [ "multimap 0.8.3", "wasmer-interface-types-fl", @@ -3511,6 +3516,7 @@ dependencies = [ [[package]] name = "marine-it-parser" version = "0.15.1" +source = "git+https://github.com/fluencelabs/marine?branch=feat/async-call#5e48c7990ea28ac24feddede08cdf6165b68d473" dependencies = [ "anyhow", "itertools", @@ -3574,6 +3580,7 @@ dependencies = [ [[package]] name = "marine-min-it-version" version = "0.3.2" +source = "git+https://github.com/fluencelabs/marine?branch=feat/async-call#5e48c7990ea28ac24feddede08cdf6165b68d473" dependencies = [ "once_cell", "semver 1.0.21", @@ -3582,6 +3589,7 @@ dependencies = [ [[package]] name = "marine-module-info-parser" version = "0.12.0" +source = "git+https://github.com/fluencelabs/marine?branch=feat/async-call#5e48c7990ea28ac24feddede08cdf6165b68d473" dependencies = [ "anyhow", "chrono", @@ -3597,6 +3605,7 @@ dependencies = [ [[package]] name = "marine-module-interface" version = "0.8.1" +source = "git+https://github.com/fluencelabs/marine?branch=feat/async-call#5e48c7990ea28ac24feddede08cdf6165b68d473" dependencies = [ "anyhow", "itertools", @@ -3645,6 +3654,7 @@ dependencies = [ [[package]] name = "marine-runtime" version = "0.33.0" +source = "git+https://github.com/fluencelabs/marine?branch=feat/async-call#5e48c7990ea28ac24feddede08cdf6165b68d473" dependencies = [ "bytesize", "it-json-serde", @@ -3683,10 +3693,12 @@ dependencies = [ [[package]] name = "marine-utils" version = "0.5.1" +source = "git+https://github.com/fluencelabs/marine?branch=feat/async-call#5e48c7990ea28ac24feddede08cdf6165b68d473" [[package]] name = "marine-wasm-backend-traits" version = "0.5.1" +source = "git+https://github.com/fluencelabs/marine?branch=feat/async-call#5e48c7990ea28ac24feddede08cdf6165b68d473" dependencies = [ "anyhow", "futures", @@ -3701,6 +3713,7 @@ dependencies = [ [[package]] name = "marine-wasmtime-backend" version = "0.5.1" +source = "git+https://github.com/fluencelabs/marine?branch=feat/async-call#5e48c7990ea28ac24feddede08cdf6165b68d473" dependencies = [ "anyhow", "futures", diff --git a/air/Cargo.toml b/air/Cargo.toml index ab14de7364..5fab54e05d 100644 --- a/air/Cargo.toml +++ b/air/Cargo.toml @@ -52,7 +52,7 @@ rkyv = { version = "0.7.43", features = ["strict", "validation", "size_32", "arc [dev_dependencies] air-test-utils = { path = "../crates/air-lib/test-utils" } air-testing-framework = { path = "../crates/testing-framework" } -fluence-app-service = {version = "0.32.0", path = "../../marine/crates/fluence-app-service"} +fluence-app-service = {version = "0.32.0", git = "https://github.com/fluencelabs/marine", branch = "feat/async-call"} marine-rs-sdk = { version = "0.12.0", features = ["logger"] } borsh = "0.10.3" diff --git a/avm/server/Cargo.toml b/avm/server/Cargo.toml index e58cc8bb3b..c59b7f9fe4 100644 --- a/avm/server/Cargo.toml +++ b/avm/server/Cargo.toml @@ -19,9 +19,9 @@ air-interpreter-interface = { version = "0.17.2", path = "../../crates/air-lib/i air-interpreter-sede = { version = "0.1.0", path = "../../crates/air-lib/interpreter-sede" } air-utils = { version = "0.2.0", path = "../../crates/air-lib/utils" } avm-data-store = { version = "0.7.7", path = "../../crates/data-store" } -marine-runtime = {version = "0.33.0", path = "../../../marine/marine"} -marine-wasmtime-backend = {version = "0.5.1", path = "../../../marine/crates/wasmtime-backend"} -marine-wasm-backend-traits = {version = "0.5.1", path = "../../../marine/crates/wasm-backend-traits"} +marine-runtime = {version = "0.33.0", git = "https://github.com/fluencelabs/marine", branch = "feat/async-call"} +marine-wasmtime-backend = {version = "0.5.1", git = "https://github.com/fluencelabs/marine", branch = "feat/async-call"} +marine-wasm-backend-traits = {version = "0.5.1", git = "https://github.com/fluencelabs/marine", branch = "feat/async-call"} polyplets = { version = "0.6.0", path = "../../crates/air-lib/polyplets" } avm-interface = { version = "0.31.2", path = "../../avm/interface" } diff --git a/crates/air-lib/test-utils/Cargo.toml b/crates/air-lib/test-utils/Cargo.toml index 246185c178..25c6c62901 100644 --- a/crates/air-lib/test-utils/Cargo.toml +++ b/crates/air-lib/test-utils/Cargo.toml @@ -34,8 +34,8 @@ fluence-keypair = "0.10.4" ed25519-dalek = "2.1.0" rand_chacha = "0.3.1" sha2 = "0.10.6" -marine-wasm-backend-traits = {version = "0.5.1", path = "../../../../marine/crates/wasm-backend-traits"} -marine-wasmtime-backend = {version = "0.5.1", path = "../../../../marine/crates/wasmtime-backend"} +marine-wasm-backend-traits = {version = "0.5.1", git = "https://github.com/fluencelabs/marine", branch = "feat/async-call"} +marine-wasmtime-backend = {version = "0.5.1", git = "https://github.com/fluencelabs/marine", branch = "feat/async-call"} futures = "0.3.30" diff --git a/crates/air-lib/test-utils/src/wasm_test_runner.rs b/crates/air-lib/test-utils/src/wasm_test_runner.rs index 8b1202b300..29b30744e0 100644 --- a/crates/air-lib/test-utils/src/wasm_test_runner.rs +++ b/crates/air-lib/test-utils/src/wasm_test_runner.rs @@ -28,8 +28,8 @@ use once_cell::sync::OnceCell; use std::path::PathBuf; -// 10 Mb -const AVM_MAX_HEAP_SIZE: u64 = 10 * 1024 * 1024; +// 100 Mb +const AVM_MAX_HEAP_SIZE: u64 = 100 * 1024 * 1024; const AIR_WASM_PATH: &str = "../target/wasm32-wasi/debug/air_interpreter_server.wasm"; const RELEASE_AIR_WASM_PATH: &str = "../target/wasm32-wasi/release/air_interpreter_server.wasm"; diff --git a/tools/cli/air/Cargo.toml b/tools/cli/air/Cargo.toml index 325dbbe07c..6da591262a 100644 --- a/tools/cli/air/Cargo.toml +++ b/tools/cli/air/Cargo.toml @@ -32,7 +32,7 @@ termcolor = "1.2.0" fluence-keypair = "0.10.4" bs58 = "0.5.0" zeroize = "1.6.0" -marine-wasmtime-backend = {version = "0.5.1", path = "../../../../marine/crates/wasmtime-backend"} +marine-wasmtime-backend = {version = "0.5.1", git = "https://github.com/fluencelabs/marine", branch = "feat/async-call"} tokio = { version = "1", features = ["rt", "macros"] } futures = "0.3.30" From 2ff0b983f60d9077965bcff8f05e91634d62cfd8 Mon Sep 17 00:00:00 2001 From: Valery Antopol Date: Wed, 14 Feb 2024 18:04:09 +0400 Subject: [PATCH 09/14] merge fix + fmt --- .../features/data_merging/data_merge.rs | 3 ++- .../test_module/features/streams/streams.rs | 5 +++-- air/tests/test_module/integration/dashboard.rs | 8 ++++---- .../negative_tests/execution_step.rs | 18 ++++++++++++------ crates/air-lib/test-utils/src/call_services.rs | 4 +++- tools/cli/air/src/trace/run/wasm.rs | 2 +- 6 files changed, 25 insertions(+), 15 deletions(-) diff --git a/air/tests/test_module/features/data_merging/data_merge.rs b/air/tests/test_module/features/data_merging/data_merge.rs index d4f35f8eb6..cfd17f17f5 100644 --- a/air/tests/test_module/features/data_merging/data_merge.rs +++ b/air/tests/test_module/features/data_merging/data_merge.rs @@ -183,7 +183,8 @@ async fn stream_merge() { let neighborhood_call_service: CallServiceClosure = Box::new(|params| { async move { let args_count = (params.function_name.as_bytes()[0] - b'0') as usize; - let args: Vec> = serde_json::from_value(serde_json::Value::Array(params.arguments)).expect("valid json"); + let args: Vec> = + serde_json::from_value(serde_json::Value::Array(params.arguments)).expect("valid json"); assert_eq!(args[0].len(), args_count); CallServiceResult::ok(json!(args)) diff --git a/air/tests/test_module/features/streams/streams.rs b/air/tests/test_module/features/streams/streams.rs index 55ae30791b..832db5a412 100644 --- a/air/tests/test_module/features/streams/streams.rs +++ b/air/tests/test_module/features/streams/streams.rs @@ -27,8 +27,9 @@ async fn empty_stream() { fn arg_type_check_closure() -> CallServiceClosure<'static> { Box::new(move |params| { async move { - let actual_call_args: Vec> = serde_json::from_value(serde_json::Value::Array(params.arguments)) - .expect("json deserialization shouldn't fail"); + let actual_call_args: Vec> = + serde_json::from_value(serde_json::Value::Array(params.arguments)) + .expect("json deserialization shouldn't fail"); let expected_call_args: Vec> = vec![vec![]]; assert_eq!(actual_call_args, expected_call_args); diff --git a/air/tests/test_module/integration/dashboard.rs b/air/tests/test_module/integration/dashboard.rs index 6631a7f366..a244edada3 100644 --- a/air/tests/test_module/integration/dashboard.rs +++ b/air/tests/test_module/integration/dashboard.rs @@ -96,10 +96,10 @@ fn peer_host_function( interfaces: Vec, ident: String, ) -> CallServiceClosure<'static> { - let known_peers = serde_json::Value::Array(known_peers.into_iter().map(JValue::String).collect()); - let blueprints = serde_json::Value::Array(blueprints.into_iter().map(JValue::String).collect()); - let modules = serde_json::Value::Array(modules.into_iter().map(JValue::String).collect()); - let interfaces = serde_json::Value::Array(interfaces.into_iter().map(JValue::String).collect()); + let known_peers = serde_json::Value::Array(known_peers.into_iter().map(serde_json::Value::String).collect()); + let blueprints = serde_json::Value::Array(blueprints.into_iter().map(serde_json::Value::String).collect()); + let modules = serde_json::Value::Array(modules.into_iter().map(serde_json::Value::String).collect()); + let interfaces = serde_json::Value::Array(interfaces.into_iter().map(serde_json::Value::String).collect()); let identify = serde_json::Value::String(ident.clone()); let ident = serde_json::Value::String(ident); diff --git a/air/tests/test_module/negative_tests/execution_step.rs b/air/tests/test_module/negative_tests/execution_step.rs index fc8a32fcb7..4509832187 100644 --- a/air/tests/test_module/negative_tests/execution_step.rs +++ b/air/tests/test_module/negative_tests/execution_step.rs @@ -356,8 +356,10 @@ async fn array_accessor_not_match_value() { ); let result = peer_vm_1.call(script.clone(), "", "", <_>::default()).await.unwrap(); - let expected_error = - air::CatchableError::LambdaApplierError(air::LambdaError::ArrayAccessorNotMatchValue { value: arg.into(), idx }); + let expected_error = air::CatchableError::LambdaApplierError(air::LambdaError::ArrayAccessorNotMatchValue { + value: arg.into(), + idx, + }); assert!(check_error(&result, expected_error)); } @@ -377,8 +379,10 @@ async fn value_not_contain_such_array_idx_call_arg_lambda() { ); let result = peer_vm_1.call(script.clone(), "", "", <_>::default()).await.unwrap(); - let expected_error = - air::CatchableError::LambdaApplierError(air::LambdaError::ValueNotContainSuchArrayIdx { value: arg.into(), idx }); + let expected_error = air::CatchableError::LambdaApplierError(air::LambdaError::ValueNotContainSuchArrayIdx { + value: arg.into(), + idx, + }); assert!(check_error(&result, expected_error)); } @@ -398,8 +402,10 @@ async fn value_not_contain_such_field_call_arg_lambda() { ); let result = peer_vm_1.call(script.clone(), "", "", <_>::default()).await.unwrap(); - let expected_error = - air::CatchableError::LambdaApplierError(air::LambdaError::ValueNotContainSuchField { value: arg.into(), field_name }); + let expected_error = air::CatchableError::LambdaApplierError(air::LambdaError::ValueNotContainSuchField { + value: arg.into(), + field_name, + }); assert!(check_error(&result, expected_error)); } diff --git a/crates/air-lib/test-utils/src/call_services.rs b/crates/air-lib/test-utils/src/call_services.rs index 8e3a82d839..2ec8854aea 100644 --- a/crates/air-lib/test-utils/src/call_services.rs +++ b/crates/air-lib/test-utils/src/call_services.rs @@ -114,7 +114,9 @@ pub fn fallible_call_service( }) } -pub fn fallible_call_service_by_arg(arg: impl Into) -> CallServiceClosure<'static> { +pub fn fallible_call_service_by_arg( + arg: impl Into, +) -> CallServiceClosure<'static> { let arg = Rc::new(arg.into()); Box::new(move |params| { diff --git a/tools/cli/air/src/trace/run/wasm.rs b/tools/cli/air/src/trace/run/wasm.rs index d5f0a687ff..89c2fb1943 100644 --- a/tools/cli/air/src/trace/run/wasm.rs +++ b/tools/cli/air/src/trace/run/wasm.rs @@ -97,7 +97,7 @@ pub(crate) async fn create_wasm_avm_runner( .debug_info(true) .wasm_backtrace(true) .epoch_interruption(false); - let wasm_backend = WasmtimeWasmBackend::new(config) ?; + let wasm_backend = WasmtimeWasmBackend::new(config)?; Ok(Box::new(WasmAvmRunner( AVMRunner::new( air_interpreter_wasm_path.to_owned(), From 5bb34bcad3244c039bf5ab9ccd394c7e1600f940 Mon Sep 17 00:00:00 2001 From: Valery Antopol Date: Wed, 14 Feb 2024 19:01:44 +0400 Subject: [PATCH 10/14] fix bench builder --- .../test-utils/src/wasm_test_runner.rs | 2 +- junk/gen-bench-data/Cargo.toml | 2 + junk/gen-bench-data/src/calls.rs | 11 +- junk/gen-bench-data/src/dashboard.rs | 48 +++--- junk/gen-bench-data/src/main.rs | 141 ++++++++++-------- junk/gen-bench-data/src/network_explore.rs | 16 +- tools/cli/air/src/trace/run/wasm.rs | 2 +- 7 files changed, 121 insertions(+), 101 deletions(-) diff --git a/crates/air-lib/test-utils/src/wasm_test_runner.rs b/crates/air-lib/test-utils/src/wasm_test_runner.rs index 29b30744e0..4d5643385e 100644 --- a/crates/air-lib/test-utils/src/wasm_test_runner.rs +++ b/crates/air-lib/test-utils/src/wasm_test_runner.rs @@ -39,7 +39,7 @@ pub struct WasmAirRunner { } fn create_wasm_backend() -> WasmtimeWasmBackend { - let mut config = WasmtimeConfig::new(); + let mut config = WasmtimeConfig::default(); config .debug_info(true) .epoch_interruption(false) diff --git a/junk/gen-bench-data/Cargo.toml b/junk/gen-bench-data/Cargo.toml index 2915b651f0..b7c3afaca9 100644 --- a/junk/gen-bench-data/Cargo.toml +++ b/junk/gen-bench-data/Cargo.toml @@ -23,3 +23,5 @@ serde_json = "1.0.97" serde = "1.0.165" hex = "0.4.3" rand = "0.8.5" +tokio = {version = "1.35.1", features = ["macros", "rt"]} +futures = "0.3.30" diff --git a/junk/gen-bench-data/src/calls.rs b/junk/gen-bench-data/src/calls.rs index 8523bf0d71..c9c8a4e81a 100644 --- a/junk/gen-bench-data/src/calls.rs +++ b/junk/gen-bench-data/src/calls.rs @@ -13,7 +13,7 @@ static AIR_SCRIPT: &str = r#" (next i)))) "#; -pub(crate) fn call_requests(size: usize) -> Data { +pub(crate) async fn call_requests(size: usize) -> Data { let values: Vec<_> = (0..size).map(|n| format!("{n}")).collect(); let data = json!(values); let init_peer_name = "peer_id"; @@ -24,7 +24,7 @@ pub(crate) fn call_requests(size: usize) -> Data { init_peer_keypair.clone(), // actually, is not used set_variable_call_service(data.clone()), - ); + ).await; let init_call_results: CallResults = <_>::default(); @@ -40,6 +40,7 @@ pub(crate) fn call_requests(size: usize) -> Data { init_call_results, particle_id, ) + .await .unwrap(); // initialization call requests @@ -64,7 +65,7 @@ pub(crate) fn call_requests(size: usize) -> Data { } } -pub(crate) fn call_results(size: usize) -> Data { +pub(crate) async fn call_results(size: usize) -> Data { let values: Vec<_> = (0..size).map(|n| format!("{n}")).collect(); let data = json!(values); let init_peer_name = "peer_id"; @@ -75,7 +76,7 @@ pub(crate) fn call_results(size: usize) -> Data { init_peer_keypair.clone(), // actually, is not used set_variable_call_service(data.clone()), - ); + ).await; let call_results: CallResults = <_>::default(); @@ -91,6 +92,7 @@ pub(crate) fn call_results(size: usize) -> Data { call_results, particle_id, ) + .await .unwrap(); // initialization call requests @@ -112,6 +114,7 @@ pub(crate) fn call_results(size: usize) -> Data { init_call_results, particle_id, ) + .await .unwrap(); let call_results: CallResults = res diff --git a/junk/gen-bench-data/src/dashboard.rs b/junk/gen-bench-data/src/dashboard.rs index bc95842bdf..d3e1e92d25 100644 --- a/junk/gen-bench-data/src/dashboard.rs +++ b/junk/gen-bench-data/src/dashboard.rs @@ -21,6 +21,7 @@ use air_test_utils::key_utils::derive_dummy_keypair; use air_test_utils::prelude::*; use maplit::hashmap; use serde_json::Value as JValue; +use futures::FutureExt; use std::cell::RefCell; use std::collections::HashSet; @@ -40,7 +41,7 @@ fn client_host_function( known_peers: Vec, client_id: String, relay_id: String, -) -> (CallServiceClosure, Rc>) { +) -> (CallServiceClosure<'static>, Rc>) { let all_info = Rc::new(RefCell::new(String::new())); let known_peers = JValue::Array( known_peers @@ -68,7 +69,7 @@ fn client_host_function( ); let all_info_inner = all_info.clone(); - let host_function: CallServiceClosure = Box::new(move |params| -> CallServiceResult { + let host_function: CallServiceClosure<'static> = Box::new(move |params| { let ret_value = match serde_json::from_value(serde_json::Value::Array(params.arguments.clone())) { Ok(args) => to_ret_value( params.service_id.as_str(), @@ -81,7 +82,7 @@ fn client_host_function( } }; - CallServiceResult::ok(ret_value) + async move { CallServiceResult::ok(ret_value) }.boxed_local() }); (host_function, all_info) @@ -93,7 +94,7 @@ fn peer_host_function( modules: Vec, interfaces: Vec, ident: String, -) -> CallServiceClosure { +) -> CallServiceClosure<'static> { let known_peers = JValue::Array(known_peers.into_iter().map(JValue::String).collect()); let blueprints = JValue::Array(blueprints.into_iter().map(JValue::String).collect()); let modules = JValue::Array(modules.into_iter().map(JValue::String).collect()); @@ -115,7 +116,7 @@ fn peer_host_function( }, ); - Box::new(move |params| -> CallServiceResult { + Box::new(move |params| { let args: Vec = serde_json::from_value(serde_json::Value::Array(params.arguments)).unwrap(); let t_args = args.iter().map(|s| s.as_str()).collect::>(); let ret_value = to_ret_value( @@ -124,12 +125,12 @@ fn peer_host_function( t_args, ); - CallServiceResult::ok(ret_value) + async move { CallServiceResult::ok(ret_value) }.boxed_local() }) } #[rustfmt::skip] -fn create_peer_host_function(peer_id: String, known_peer_ids: Vec) -> CallServiceClosure { +fn create_peer_host_function(peer_id: String, known_peer_ids: Vec) -> CallServiceClosure<'static> { let relay_blueprints = (0..=2).map(|id| format!("{peer_id}_blueprint_{id}")).collect::>(); let relay_modules = (0..=2).map(|id| format!("{peer_id}_module_{id}")).collect::>(); let relay_interfaces = (0..=2).map(|id| format!("{peer_id}_interface_{id}")).collect::>(); @@ -150,7 +151,7 @@ struct AVMState { prev_result: Vec, } -pub(crate) fn dashboard() -> super::Data { +pub(crate) async fn dashboard() -> super::Data { let script = include_str!("dashboard/dashboard.air"); let known_peer_keys = create_peers(); @@ -165,27 +166,24 @@ pub(crate) fn dashboard() -> super::Data { let (host_function, all_info) = client_host_function(known_peer_ids.clone(), client_id.clone(), relay_id.clone()); - let mut client = create_avm_with_key::(client_key, host_function); + let mut client = create_avm_with_key::(client_key, host_function).await; let mut relay = create_avm_with_key::( relay_key.clone(), create_peer_host_function(relay_id.clone(), known_peer_ids.clone()), - ); - - let mut known_peers = known_peer_keys - .iter() - .cloned() - .map(|(peer_key, peer_id)| { - let vm = create_avm_with_key::( - peer_key, - create_peer_host_function(peer_id.clone(), known_peer_ids.clone()), - ); - AVMState { - vm, - peer_id, - prev_result: vec![], - } + ).await; + + let mut known_peers = Vec::<_>::new(); + for (peer_key, peer_id) in known_peer_keys.iter().cloned() { + let vm = create_avm_with_key::( + peer_key, + create_peer_host_function(peer_id.clone(), known_peer_ids.clone()), + ).await; + known_peers.push(AVMState { + vm, + peer_id, + prev_result: vec![], }) - .collect::>(); + } let test_params = TestRunParameters::from_init_peer_id(client_id.clone()) .with_particle_id(super::PARTICLE_ID); diff --git a/junk/gen-bench-data/src/main.rs b/junk/gen-bench-data/src/main.rs index 3285fc3f10..4c9480ef27 100644 --- a/junk/gen-bench-data/src/main.rs +++ b/junk/gen-bench-data/src/main.rs @@ -81,41 +81,42 @@ enum Bench { Hybrid100MB, } -fn main() { +#[tokio::main] +async fn main() { let args = Cli::parse(); let data = match args.bench { - Bench::MultipleCids10 => multiple_cids(10), - Bench::MultipleCids50 => multiple_cids(50), - Bench::MultiplePeers5 => multiple_peers(5), - Bench::MultiplePeers8 => multiple_peers(8), - Bench::MultiplePeers25 => multiple_peers(25), - Bench::MultipleSigs10 => multiple_sigs(10), - Bench::MultipleSigs30 => multiple_sigs(30), - Bench::MultipleSigs200 => multiple_sigs(200), - Bench::Dashboard => dashboard::dashboard(), - Bench::NetworkExplore => network_explore::network_explore(), - Bench::PopulateMapMultipleKeys => populate_map_multiple_keys(MAX_STREAM_SIZE), - Bench::PopulateMapSingleKey => populate_map_single_key(770), - Bench::CanonMapMultipleKeys => canon_map_multiple_keys(MAX_STREAM_SIZE), - Bench::CanonMapSingleKey => canon_map_single_key(770), - Bench::CanonMapScalarMultipleKeys => canon_map_scalar_multiple_keys(MAX_STREAM_SIZE), - Bench::CanonMapScalarSingleKey => canon_map_scalar_single_key(770), - Bench::CanonMapKeyByLens => canon_map_key_by_lens(770), - Bench::CanonMapKeyElementByLens => canon_map_key_element_by_lens(770), + Bench::MultipleCids10 => multiple_cids(10).await, + Bench::MultipleCids50 => multiple_cids(50).await, + Bench::MultiplePeers5 => multiple_peers(5).await, + Bench::MultiplePeers8 => multiple_peers(8).await, + Bench::MultiplePeers25 => multiple_peers(25).await, + Bench::MultipleSigs10 => multiple_sigs(10).await, + Bench::MultipleSigs30 => multiple_sigs(30).await, + Bench::MultipleSigs200 => multiple_sigs(200).await, + Bench::Dashboard => dashboard::dashboard().await, + Bench::NetworkExplore => network_explore::network_explore().await, + Bench::PopulateMapMultipleKeys => populate_map_multiple_keys(MAX_STREAM_SIZE).await, + Bench::PopulateMapSingleKey => populate_map_single_key(770).await, + Bench::CanonMapMultipleKeys => canon_map_multiple_keys(MAX_STREAM_SIZE).await, + Bench::CanonMapSingleKey => canon_map_single_key(770).await, + Bench::CanonMapScalarMultipleKeys => canon_map_scalar_multiple_keys(MAX_STREAM_SIZE).await, + Bench::CanonMapScalarSingleKey => canon_map_scalar_single_key(770).await, + Bench::CanonMapKeyByLens => canon_map_key_by_lens(770).await, + Bench::CanonMapKeyElementByLens => canon_map_key_element_by_lens(770).await, Bench::LongData => long_data(), Bench::BigValuesData => big_values_data(), - Bench::CallRequests500 => calls::call_requests(500), - Bench::CallResults500 => calls::call_results(500), + Bench::CallRequests500 => calls::call_requests(500).await, + Bench::CallResults500 => calls::call_results(500).await, Bench::Parser10000_100 => parser_10000_100(), Bench::ParserCalls10000_100 => parser_calls(10000, 100), Bench::Null => null(), - Bench::CallResult100MB => mem_consumption_with_size_in_mb(100), - Bench::Lense100MB => mem_consumption_w_lense_with_size_in_mb(100), - Bench::Map100MB => mem_consumption_w_map_2_scalar_with_size_in_mb(100), - Bench::CanonMap100MB => mem_consumption_w_canon_map_with_size_in_mb(100), + Bench::CallResult100MB => mem_consumption_with_size_in_mb(100).await, + Bench::Lense100MB => mem_consumption_w_lense_with_size_in_mb(100).await, + Bench::Map100MB => mem_consumption_w_map_2_scalar_with_size_in_mb(100).await, + Bench::CanonMap100MB => mem_consumption_w_canon_map_with_size_in_mb(100).await, Bench::ParserAir100MB => mem_consumption_air_100mb(280000, 10), - Bench::Hybrid100MB => mem_consumption_hybrid_with_size_in_mb(100), + Bench::Hybrid100MB => mem_consumption_hybrid_with_size_in_mb(100).await, }; save_data(&args.dest_dir, data).unwrap(); @@ -228,7 +229,7 @@ pub(crate) struct Data { pub(crate) keypair: String, } -fn multiple_cids(size: usize) -> Data { +async fn multiple_cids(size: usize) -> Data { let data: String = (0..size).map(|n| format!(r#""val{}""#, n)).join(","); let air_script = format!(include_str!("multiple_cids.air.tmpl"), data = data); @@ -238,10 +239,11 @@ fn multiple_cids(size: usize) -> Data { vec![], &air_script, ) + .await .unwrap(); - let prev_res = exec.execute_one("init_peer_id").unwrap(); - let cur_res = exec.execute_one("other_peer_id").unwrap(); + let prev_res = exec.execute_one("init_peer_id").await.unwrap(); + let cur_res = exec.execute_one("other_peer_id").await.unwrap(); assert!(!prev_res.next_peer_pks.is_empty()); @@ -271,7 +273,7 @@ fn multiple_cids(size: usize) -> Data { } } -fn multiple_peers(size: usize) -> Data { +async fn multiple_peers(size: usize) -> Data { let data = (0..size).map(|n| format!(r#"@"p{}""#, n)).join(","); let peers: Vec<_> = (0..size).map(|n| format!("p{}", n).into()).collect(); let air_script = format!(include_str!("multiple_peers.air.tmpl"), data = data); @@ -282,15 +284,16 @@ fn multiple_peers(size: usize) -> Data { peers.clone(), &air_script, ) + .await .unwrap(); - let prev_res = exec.execute_one("init_peer_id").unwrap(); + let prev_res = exec.execute_one("init_peer_id").await.unwrap(); for peer in &peers { - exec.execute_one(peer).unwrap(); + exec.execute_one(peer).await.unwrap(); } - let cur_res = exec.execute_one("other_peer_id").unwrap(); + let cur_res = exec.execute_one("other_peer_id").await.unwrap(); let keypair = exec .get_network() @@ -318,7 +321,7 @@ fn multiple_peers(size: usize) -> Data { } } -fn multiple_sigs(size: usize) -> Data { +async fn multiple_sigs(size: usize) -> Data { let data = (0..size).map(|n| format!(r#""val{}""#, n)).join(","); let air_script = format!(include_str!("multiple_sigs.air.tmpl"), data = data); @@ -328,10 +331,11 @@ fn multiple_sigs(size: usize) -> Data { vec![], &air_script, ) + .await .unwrap(); - let prev_res = exec.execute_one("init_peer_id").unwrap(); - let cur_res = exec.execute_one("other_peer_id").unwrap(); + let prev_res = exec.execute_one("init_peer_id").await.unwrap(); + let cur_res = exec.execute_one("other_peer_id").await.unwrap(); assert!(!prev_res.next_peer_pks.is_empty()); @@ -361,7 +365,7 @@ fn multiple_sigs(size: usize) -> Data { } } -fn canon_map_key_by_lens(size: usize) -> Data { +async fn canon_map_key_by_lens(size: usize) -> Data { let data: String = (0..size).map(|n| format!(r#""val{}""#, n)).join(","); let air_script = format!(include_str!("canon_map_key_by_lens.air.tmpl"), data = data); @@ -371,9 +375,10 @@ fn canon_map_key_by_lens(size: usize) -> Data { vec![], &air_script, ) + .await .unwrap(); - let prev_res = exec.execute_one("init_peer_id").unwrap(); + let prev_res = exec.execute_one("init_peer_id").await.unwrap(); let keypair = exec .get_network() @@ -402,7 +407,7 @@ fn canon_map_key_by_lens(size: usize) -> Data { } } -fn canon_map_key_element_by_lens(size: usize) -> Data { +async fn canon_map_key_element_by_lens(size: usize) -> Data { let data: String = (0..size).map(|n| format!(r#""val{}""#, n)).join(","); let air_script = format!( include_str!("canon_map_key_element_by_lens.air.tmpl"), @@ -416,9 +421,10 @@ fn canon_map_key_element_by_lens(size: usize) -> Data { vec![], &air_script, ) + .await .unwrap(); - let prev_res = exec.execute_one("init_peer_id").unwrap(); + let prev_res = exec.execute_one("init_peer_id").await.unwrap(); let keypair = exec .get_network() @@ -447,7 +453,7 @@ fn canon_map_key_element_by_lens(size: usize) -> Data { } } -fn populate_map_multiple_keys(size: usize) -> Data { +async fn populate_map_multiple_keys(size: usize) -> Data { let sq_root = (size as f64).sqrt() as usize; let data: String = (0..sq_root).map(|n| format!(r#""val{}""#, n)).join(","); let air_script = format!( @@ -461,9 +467,10 @@ fn populate_map_multiple_keys(size: usize) -> Data { vec![], &air_script, ) + .await .unwrap(); - let prev_res = exec.execute_one("init_peer_id").unwrap(); + let prev_res = exec.execute_one("init_peer_id").await.unwrap(); let keypair = exec .get_network() @@ -492,7 +499,7 @@ fn populate_map_multiple_keys(size: usize) -> Data { } } -fn populate_map_single_key(size: usize) -> Data { +async fn populate_map_single_key(size: usize) -> Data { let data: String = (0..size).map(|n| format!(r#""val{}""#, n)).join(","); let air_script = format!( include_str!("populate_map_single_key.air.tmpl"), @@ -505,9 +512,10 @@ fn populate_map_single_key(size: usize) -> Data { vec![], &air_script, ) + .await .unwrap(); - let prev_res = exec.execute_one("init_peer_id").unwrap(); + let prev_res = exec.execute_one("init_peer_id").await.unwrap(); let keypair = exec .get_network() @@ -536,7 +544,7 @@ fn populate_map_single_key(size: usize) -> Data { } } -fn canon_map_multiple_keys(size: usize) -> Data { +async fn canon_map_multiple_keys(size: usize) -> Data { let sq_root = (size as f64).sqrt() as usize; let data: String = (0..sq_root).map(|n| format!(r#""val{}""#, n)).join(","); let air_script = format!( @@ -550,9 +558,10 @@ fn canon_map_multiple_keys(size: usize) -> Data { vec![], &air_script, ) + .await .unwrap(); - let prev_res = exec.execute_one("init_peer_id").unwrap(); + let prev_res = exec.execute_one("init_peer_id").await.unwrap(); let keypair = exec .get_network() @@ -581,7 +590,7 @@ fn canon_map_multiple_keys(size: usize) -> Data { } } -fn canon_map_single_key(size: usize) -> Data { +async fn canon_map_single_key(size: usize) -> Data { let data: String = (0..size).map(|n| format!(r#""val{}""#, n)).join(","); let air_script = format!(include_str!("canon_map_single_key.air.tmpl"), data = data); @@ -591,9 +600,10 @@ fn canon_map_single_key(size: usize) -> Data { vec![], &air_script, ) + .await .unwrap(); - let prev_res = exec.execute_one("init_peer_id").unwrap(); + let prev_res = exec.execute_one("init_peer_id").await.unwrap(); let keypair = exec .get_network() @@ -622,7 +632,7 @@ fn canon_map_single_key(size: usize) -> Data { } } -fn canon_map_scalar_multiple_keys(size: usize) -> Data { +async fn canon_map_scalar_multiple_keys(size: usize) -> Data { let sq_root = (size as f64).sqrt() as usize; let data: String = (0..sq_root).map(|n| format!(r#""val{}""#, n)).join(","); let air_script = format!( @@ -636,9 +646,10 @@ fn canon_map_scalar_multiple_keys(size: usize) -> Data { vec![], &air_script, ) + .await .unwrap(); - let prev_res = exec.execute_one("init_peer_id").unwrap(); + let prev_res = exec.execute_one("init_peer_id").await.unwrap(); let keypair = exec .get_network() @@ -667,7 +678,7 @@ fn canon_map_scalar_multiple_keys(size: usize) -> Data { } } -fn canon_map_scalar_single_key(size: usize) -> Data { +async fn canon_map_scalar_single_key(size: usize) -> Data { let data: String = (0..size).map(|n| format!(r#""val{}""#, n)).join(","); let air_script = format!( include_str!("canon_map_scalar_single_key.air.tmpl"), @@ -680,9 +691,10 @@ fn canon_map_scalar_single_key(size: usize) -> Data { vec![], &air_script, ) + .await .unwrap(); - let prev_res = exec.execute_one("init_peer_id").unwrap(); + let prev_res = exec.execute_one("init_peer_id").await.unwrap(); let keypair = exec .get_network() @@ -770,7 +782,7 @@ fn generate_random_data(random_data_size: usize) -> Vec { random_data } -fn mem_consumption_with_size_in_mb(data_size: usize) -> Data { +async fn mem_consumption_with_size_in_mb(data_size: usize) -> Data { let random_data = generate_random_data(data_size); let air_script = format!( @@ -784,6 +796,7 @@ fn mem_consumption_with_size_in_mb(data_size: usize) -> Data { vec![], &air_script, ) + .await .unwrap(); let keypair = exec @@ -795,7 +808,7 @@ fn mem_consumption_with_size_in_mb(data_size: usize) -> Data { .get_keypair() .clone(); - let prev_res = exec.execute_one("init_peer_id").unwrap(); + let prev_res = exec.execute_one("init_peer_id").await.unwrap(); let peer_id: String = exec.resolve_name("other_peer_id").to_string(); let init_peer_id: String = exec.resolve_name("init_peer_id").to_string(); @@ -815,7 +828,7 @@ fn mem_consumption_with_size_in_mb(data_size: usize) -> Data { } } -fn mem_consumption_w_lense_with_size_in_mb(data_size: usize) -> Data { +async fn mem_consumption_w_lense_with_size_in_mb(data_size: usize) -> Data { let random_data = generate_random_data(data_size); let air_script = format!( @@ -829,6 +842,7 @@ fn mem_consumption_w_lense_with_size_in_mb(data_size: usize) -> Data { vec![], &air_script, ) + .await .unwrap(); let keypair = exec @@ -840,7 +854,7 @@ fn mem_consumption_w_lense_with_size_in_mb(data_size: usize) -> Data { .get_keypair() .clone(); - let prev_res = exec.execute_one("init_peer_id").unwrap(); + let prev_res = exec.execute_one("init_peer_id").await.unwrap(); let peer_id: String = exec.resolve_name("other_peer_id").to_string(); let init_peer_id: String = exec.resolve_name("init_peer_id").to_string(); @@ -860,7 +874,7 @@ fn mem_consumption_w_lense_with_size_in_mb(data_size: usize) -> Data { } } -fn mem_consumption_w_map_2_scalar_with_size_in_mb(data_size: usize) -> Data { +async fn mem_consumption_w_map_2_scalar_with_size_in_mb(data_size: usize) -> Data { let random_data = generate_random_data(data_size); let air_script = format!( @@ -874,6 +888,7 @@ fn mem_consumption_w_map_2_scalar_with_size_in_mb(data_size: usize) -> Data { vec![], &air_script, ) + .await .unwrap(); let keypair = exec @@ -885,7 +900,7 @@ fn mem_consumption_w_map_2_scalar_with_size_in_mb(data_size: usize) -> Data { .get_keypair() .clone(); - let prev_res = exec.execute_one("init_peer_id").unwrap(); + let prev_res = exec.execute_one("init_peer_id").await.unwrap(); let peer_id: String = exec.resolve_name("other_peer_id").to_string(); let init_peer_id: String = exec.resolve_name("init_peer_id").to_string(); @@ -905,7 +920,7 @@ fn mem_consumption_w_map_2_scalar_with_size_in_mb(data_size: usize) -> Data { } } -fn mem_consumption_w_canon_map_with_size_in_mb(data_size: usize) -> Data { +async fn mem_consumption_w_canon_map_with_size_in_mb(data_size: usize) -> Data { let random_data = generate_random_data(data_size); let air_script = format!( @@ -919,6 +934,7 @@ fn mem_consumption_w_canon_map_with_size_in_mb(data_size: usize) -> Data { vec![], &air_script, ) + .await .unwrap(); let keypair = exec @@ -930,7 +946,7 @@ fn mem_consumption_w_canon_map_with_size_in_mb(data_size: usize) -> Data { .get_keypair() .clone(); - let prev_res = exec.execute_one("init_peer_id").unwrap(); + let prev_res = exec.execute_one("init_peer_id").await.unwrap(); let peer_id: String = exec.resolve_name("other_peer_id").to_string(); let init_peer_id: String = exec.resolve_name("init_peer_id").to_string(); @@ -950,7 +966,7 @@ fn mem_consumption_w_canon_map_with_size_in_mb(data_size: usize) -> Data { } } -fn mem_consumption_hybrid_with_size_in_mb(data_size: usize) -> Data { +async fn mem_consumption_hybrid_with_size_in_mb(data_size: usize) -> Data { let random_data = generate_random_data(data_size); let air_script = format!( @@ -964,6 +980,7 @@ fn mem_consumption_hybrid_with_size_in_mb(data_size: usize) -> Data { vec![], &air_script, ) + .await .unwrap(); let keypair = exec @@ -975,7 +992,7 @@ fn mem_consumption_hybrid_with_size_in_mb(data_size: usize) -> Data { .get_keypair() .clone(); - let prev_res = exec.execute_one("init_peer_id").unwrap(); + let prev_res = exec.execute_one("init_peer_id").await.unwrap(); let peer_id: String = exec.resolve_name("other_peer_id").to_string(); let init_peer_id: String = exec.resolve_name("init_peer_id").to_string(); diff --git a/junk/gen-bench-data/src/network_explore.rs b/junk/gen-bench-data/src/network_explore.rs index 110bcbb353..f6546830e7 100644 --- a/junk/gen-bench-data/src/network_explore.rs +++ b/junk/gen-bench-data/src/network_explore.rs @@ -20,7 +20,7 @@ use air_test_utils::key_utils::derive_dummy_keypair; use air_test_utils::prelude::*; use maplit::hashmap; -pub(crate) fn network_explore() -> Data { +pub(crate) async fn network_explore() -> Data { let relay_name = "relay_id"; let client_name = "client_id"; @@ -41,23 +41,23 @@ pub(crate) fn network_explore() -> Data { let client_call_service = set_variables_call_service(set_variables_state, VariableOptionSource::Argument(0)); - let mut client = create_avm_with_key::(client_key, client_call_service); + let mut client = create_avm_with_key::(client_key, client_call_service).await; let relay_call_service = set_variable_call_service(json!([&client_1_id, &client_2_id, &client_3_id, &relay_id])); - let mut relay = create_avm_with_key::(relay_key.clone(), relay_call_service); + let mut relay = create_avm_with_key::(relay_key.clone(), relay_call_service).await; let client_1_call_service = set_variable_call_service(json!([&client_1_id, &client_3_id, &relay_id, &client_2_id])); - let mut client_1 = create_avm_with_key::(client_1_key, client_1_call_service); + let mut client_1 = create_avm_with_key::(client_1_key, client_1_call_service).await; let client_2_call_service = set_variable_call_service(json!([&relay_id, &client_3_id, &client_1_id, &client_2_id])); - let mut client_2 = create_avm_with_key::(client_2_key, client_2_call_service); + let mut client_2 = create_avm_with_key::(client_2_key, client_2_call_service).await; let client_3_call_service = set_variable_call_service(json!([&relay_id, &client_3_id, &client_1_id, &client_2_id])); - let mut client_3 = create_avm_with_key::(client_3_key, client_3_call_service); + let mut client_3 = create_avm_with_key::(client_3_key, client_3_call_service).await; let raw_script = include_str!("network_explore.air"); @@ -66,9 +66,9 @@ pub(crate) fn network_explore() -> Data { let network = air_test_framework::Network::::new( std::iter::empty::(), vec![], - ); + ).await; let transformed_script = - air_test_framework::TransformedAirScript::new(raw_script, network).unwrap(); + air_test_framework::TransformedAirScript::new(raw_script, network).await.unwrap(); &(*transformed_script).to_string() }; diff --git a/tools/cli/air/src/trace/run/wasm.rs b/tools/cli/air/src/trace/run/wasm.rs index 89c2fb1943..a2e81cf6f7 100644 --- a/tools/cli/air/src/trace/run/wasm.rs +++ b/tools/cli/air/src/trace/run/wasm.rs @@ -92,7 +92,7 @@ pub(crate) async fn create_wasm_avm_runner( air_interpreter_wasm_path: &Path, max_heap_size: Option, ) -> eyre::Result> { - let mut config = WasmtimeConfig::new(); + let mut config = WasmtimeConfig::default(); config .debug_info(true) .wasm_backtrace(true) From e2fdc05b51d9b470f7108503fc10d4edacbeaf24 Mon Sep 17 00:00:00 2001 From: Valery Antopol Date: Wed, 14 Feb 2024 19:53:56 +0400 Subject: [PATCH 11/14] add Cargo.lock --- junk/gen-bench-data/Cargo.lock | 4974 ++++++++++++++++++++++++++++++++ 1 file changed, 4974 insertions(+) create mode 100644 junk/gen-bench-data/Cargo.lock diff --git a/junk/gen-bench-data/Cargo.lock b/junk/gen-bench-data/Cargo.lock new file mode 100644 index 0000000000..46af254f71 --- /dev/null +++ b/junk/gen-bench-data/Cargo.lock @@ -0,0 +1,4974 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "addr2line" +version = "0.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb" +dependencies = [ + "gimli 0.28.1", +] + +[[package]] +name = "adler" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" + +[[package]] +name = "ahash" +version = "0.7.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a824f2aa7e75a0c98c5a504fceb80649e9c35265d44525b5f94de4771a395cd" +dependencies = [ + "getrandom", + "once_cell", + "version_check", +] + +[[package]] +name = "ahash" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77c3a9648d43b9cd48db467b3f87fdd6e146bcc88ab0180006cef2179fe11d01" +dependencies = [ + "cfg-if", + "once_cell", + "version_check", + "zerocopy", +] + +[[package]] +name = "aho-corasick" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2969dcb958b36655471fc61f7e416fa76033bdd4bfed0678d8fee1e2d07a1f0" +dependencies = [ + "memchr", +] + +[[package]] +name = "air-execution-info-collector" +version = "0.7.12" +dependencies = [ + "aquavm-air-parser", +] + +[[package]] +name = "air-interpreter-cid" +version = "0.9.0" +dependencies = [ + "cid", + "digest 0.10.7", + "fluence-blake3", + "multihash 0.19.1", + "multihash-codetable", + "rkyv", + "serde", + "serde_json", + "sha2 0.10.8", + "thiserror", +] + +[[package]] +name = "air-interpreter-data" +version = "0.17.0" +dependencies = [ + "air-interpreter-cid", + "air-interpreter-sede", + "air-interpreter-signatures", + "air-interpreter-value", + "air-utils", + "aquavm-air-parser", + "fluence-keypair", + "newtype_derive", + "num-traits", + "once_cell", + "polyplets", + "rkyv", + "rmp-serde", + "semver 1.0.20", + "serde", + "serde_bytes", + "serde_json", + "thiserror", + "tracing", +] + +[[package]] +name = "air-interpreter-interface" +version = "0.17.2" +dependencies = [ + "air-interpreter-sede", + "air-interpreter-value", + "fluence-it-types", + "marine-call-parameters 0.12.0", + "marine-rs-sdk", + "serde", + "serde_bytes", + "serde_json", +] + +[[package]] +name = "air-interpreter-sede" +version = "0.1.0" +dependencies = [ + "marine-rs-sdk", + "rmp-serde", + "serde", + "serde_bytes", + "serde_json", + "thiserror", + "unsigned-varint 0.8.0", +] + +[[package]] +name = "air-interpreter-signatures" +version = "0.1.7" +dependencies = [ + "air-interpreter-cid", + "borsh", + "borsh-derive", + "bs58", + "fluence-keypair", + "rkyv", + "serde", + "thiserror", +] + +[[package]] +name = "air-interpreter-value" +version = "0.1.0" +dependencies = [ + "serde", + "serde_json", +] + +[[package]] +name = "air-lambda-ast" +version = "0.1.0" +dependencies = [ + "itertools", + "non-empty-vec", + "serde", +] + +[[package]] +name = "air-lambda-parser" +version = "0.1.0" +dependencies = [ + "air-lambda-ast", + "itertools", + "lalrpop", + "lalrpop-util", + "regex", + "serde", + "thiserror", +] + +[[package]] +name = "air-log-targets" +version = "0.1.0" + +[[package]] +name = "air-test-utils" +version = "0.15.1" +dependencies = [ + "air-interpreter-cid", + "air-interpreter-data", + "air-interpreter-interface", + "air-interpreter-sede", + "air-interpreter-signatures", + "air-interpreter-value", + "aquavm-air", + "avm-interface", + "avm-server", + "ed25519-dalek", + "fluence-keypair", + "futures", + "marine-rs-sdk", + "marine-wasm-backend-traits", + "marine-wasmtime-backend", + "object-pool", + "once_cell", + "rand_chacha", + "semver 1.0.20", + "serde", + "serde_json", + "sha2 0.10.8", + "tokio", +] + +[[package]] +name = "air-testing-framework" +version = "0.8.4" +dependencies = [ + "air-interpreter-signatures", + "air-test-utils", + "aquavm-air-parser", + "async-recursion", + "fluence-keypair", + "futures", + "itertools", + "nom", + "nom_locate", + "regex", + "serde_json", + "strum", + "tokio", +] + +[[package]] +name = "air-trace-handler" +version = "0.5.10" +dependencies = [ + "air-interpreter-cid", + "air-interpreter-data", + "air-log-targets", + "aquavm-air-parser", + "bimap", + "log", + "num-traits", + "polyplets", + "serde_json", + "thiserror", + "tracing", +] + +[[package]] +name = "air-utils" +version = "0.2.0" + +[[package]] +name = "ambient-authority" +version = "0.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e9d4ee0d472d1cd2e28c97dfa124b3d8d992e10eb0a035f33f5d12e3a177ba3b" + +[[package]] +name = "android-tzdata" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0" + +[[package]] +name = "android_system_properties" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" +dependencies = [ + "libc", +] + +[[package]] +name = "anstream" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d664a92ecae85fd0a7392615844904654d1d5f5514837f471ddef4a057aba1b6" +dependencies = [ + "anstyle", + "anstyle-parse", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "utf8parse", +] + +[[package]] +name = "anstyle" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7079075b41f533b8c61d2a4d073c4676e1f8b249ff94a393b0595db304e0dd87" + +[[package]] +name = "anstyle-parse" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c75ac65da39e5fe5ab759307499ddad880d724eed2f6ce5b5e8a26f4f387928c" +dependencies = [ + "utf8parse", +] + +[[package]] +name = "anstyle-query" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e28923312444cdd728e4738b3f9c9cac739500909bb3d3c94b43551b16517648" +dependencies = [ + "windows-sys 0.52.0", +] + +[[package]] +name = "anstyle-wincon" +version = "3.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1cd54b81ec8d6180e24654d0b371ad22fc3dd083b6ff8ba325b72e00c87660a7" +dependencies = [ + "anstyle", + "windows-sys 0.52.0", +] + +[[package]] +name = "anyhow" +version = "1.0.75" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4668cab20f66d8d020e1fbc0ebe47217433c1b6c8f2040faf858554e394ace6" + +[[package]] +name = "aquavm-air" +version = "0.59.0" +dependencies = [ + "air-execution-info-collector", + "air-interpreter-cid", + "air-interpreter-data", + "air-interpreter-interface", + "air-interpreter-sede", + "air-interpreter-signatures", + "air-interpreter-value", + "air-lambda-ast", + "air-lambda-parser", + "air-log-targets", + "air-trace-handler", + "air-utils", + "aquavm-air-parser", + "concat-idents", + "fluence-keypair", + "log", + "maplit", + "non-empty-vec", + "once_cell", + "polyplets", + "rkyv", + "semver 1.0.20", + "serde", + "serde_json", + "strum", + "strum_macros", + "thiserror", + "tracing", + "typed-index-collections", +] + +[[package]] +name = "aquavm-air-parser" +version = "0.11.1" +dependencies = [ + "air-interpreter-value", + "air-lambda-ast", + "air-lambda-parser", + "codespan", + "codespan-reporting", + "itertools", + "lalrpop", + "lalrpop-util", + "multimap 0.9.1", + "regex", + "serde", + "serde_json", + "thiserror", + "tracing", +] + +[[package]] +name = "arbitrary" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d5a26814d8dcb93b0e5a0ff3c6d80a8843bafb21b39e8e18a6f05471870e110" + +[[package]] +name = "arrayref" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b4930d2cb77ce62f89ee5d5289b4ac049559b1c45539271f5ed4fdc7db34545" + +[[package]] +name = "arrayvec" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" + +[[package]] +name = "ascii-canvas" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8824ecca2e851cec16968d54a01dd372ef8f95b244fb84b84e70128be347c3c6" +dependencies = [ + "term", +] + +[[package]] +name = "asn1_der" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6fce6b6a0ffdafebd82c87e79e3f40e8d2c523e5fea5566ff6b90509bf98d638" +dependencies = [ + "asn1_der_derive", +] + +[[package]] +name = "asn1_der" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "155a5a185e42c6b77ac7b88a15143d930a9e9727a5b7b77eed417404ab15c247" + +[[package]] +name = "asn1_der_derive" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d0864d84b8e07b145449be9a8537db86bf9de5ce03b913214694643b4743502" +dependencies = [ + "quote", + "syn 1.0.109", +] + +[[package]] +name = "async-recursion" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5fd55a5ba1179988837d24ab4c7cc8ed6efdeff578ede0416b4225a5fca35bd0" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.48", +] + +[[package]] +name = "async-trait" +version = "0.1.74" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a66537f1bb974b254c98ed142ff995236e81b9d0fe4db0575f46612cb15eb0f9" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.48", +] + +[[package]] +name = "autocfg" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" + +[[package]] +name = "avm-data-store" +version = "0.7.7" +dependencies = [ + "avm-interface", + "serde", + "serde_bytes", +] + +[[package]] +name = "avm-interface" +version = "0.31.2" +dependencies = [ + "air-interpreter-interface", + "air-interpreter-sede", + "air-utils", + "log", + "maplit", + "polyplets", + "serde", + "serde_json", + "thiserror", + "tracing", +] + +[[package]] +name = "avm-server" +version = "0.35.0" +dependencies = [ + "air-interpreter-interface", + "air-interpreter-sede", + "air-utils", + "avm-data-store", + "avm-interface", + "eyre", + "fluence-keypair", + "log", + "maplit", + "marine-runtime", + "marine-wasm-backend-traits", + "marine-wasmtime-backend", + "parking_lot 0.12.1", + "polyplets", + "serde", + "serde_json", + "thiserror", + "tokio", + "tracing", +] + +[[package]] +name = "backtrace" +version = "0.3.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2089b7e3f35b9dd2d0ed921ead4f6d318c27680d4a5bd167b3ee120edb105837" +dependencies = [ + "addr2line", + "cc", + "cfg-if", + "libc", + "miniz_oxide", + "object", + "rustc-demangle", +] + +[[package]] +name = "base-x" +version = "0.2.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4cbbc9d0964165b47557570cce6c952866c2678457aca742aafc9fb771d30270" + +[[package]] +name = "base64" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" + +[[package]] +name = "base64" +version = "0.21.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" + +[[package]] +name = "base64ct" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" + +[[package]] +name = "bimap" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "230c5f1ca6a325a32553f8640d31ac9b49f2411e901e427570154868b46da4f7" + +[[package]] +name = "bincode" +version = "1.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad" +dependencies = [ + "serde", +] + +[[package]] +name = "bit-set" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0700ddab506f33b20a03b13996eccd309a48e5ff77d0d95926aa0210fb4e95f1" +dependencies = [ + "bit-vec", +] + +[[package]] +name = "bit-vec" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb" + +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + +[[package]] +name = "bitflags" +version = "2.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07" + +[[package]] +name = "bitvec" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bc2832c24239b0141d5674bb9174f9d68a8b5b3f2753311927c172ca46f7e9c" +dependencies = [ + "funty", + "radium", + "tap", + "wyz", +] + +[[package]] +name = "blake2b_simd" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23285ad32269793932e830392f2fe2f83e26488fd3ec778883a93c8323735780" +dependencies = [ + "arrayref", + "arrayvec", + "constant_time_eq", +] + +[[package]] +name = "blake2s_simd" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94230421e395b9920d23df13ea5d77a20e1725331f90fbbf6df6040b33f756ae" +dependencies = [ + "arrayref", + "arrayvec", + "constant_time_eq", +] + +[[package]] +name = "blake3" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0231f06152bf547e9c2b5194f247cd97aacf6dcd8b15d8e5ec0663f64580da87" +dependencies = [ + "arrayref", + "arrayvec", + "cc", + "cfg-if", + "constant_time_eq", +] + +[[package]] +name = "block-buffer" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" +dependencies = [ + "generic-array", +] + +[[package]] +name = "block-buffer" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +dependencies = [ + "generic-array", +] + +[[package]] +name = "borsh" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4114279215a005bc675e386011e594e1d9b800918cea18fcadadcce864a2046b" +dependencies = [ + "borsh-derive", + "hashbrown 0.13.2", +] + +[[package]] +name = "borsh-derive" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0754613691538d51f329cce9af41d7b7ca150bc973056f1156611489475f54f7" +dependencies = [ + "borsh-derive-internal", + "borsh-schema-derive-internal", + "proc-macro-crate 0.1.5", + "proc-macro2", + "syn 1.0.109", +] + +[[package]] +name = "borsh-derive-internal" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "afb438156919598d2c7bad7e1c0adf3d26ed3840dbc010db1a882a65583ca2fb" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "borsh-schema-derive-internal" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "634205cc43f74a1b9046ef87c4540ebda95696ec0f315024860cad7c5b0f5ccd" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "bs58" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f5353f36341f7451062466f0b755b96ac3a9547e4d7f6b70d603fc721a7d7896" +dependencies = [ + "tinyvec", +] + +[[package]] +name = "bumpalo" +version = "3.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec" + +[[package]] +name = "bytecheck" +version = "0.6.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23cdc57ce23ac53c931e88a43d06d070a6fd142f2617be5855eb75efc9beb1c2" +dependencies = [ + "bytecheck_derive", + "ptr_meta", + "simdutf8", +] + +[[package]] +name = "bytecheck_derive" +version = "0.6.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3db406d29fbcd95542e92559bed4d8ad92636d1ca8b3b72ede10b4bcc010e659" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "bytecount" +version = "0.6.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1e5f035d16fc623ae5f74981db80a439803888314e3a555fd6f04acd51a3205" + +[[package]] +name = "byteorder" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" + +[[package]] +name = "bytes" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223" + +[[package]] +name = "bytesize" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a3e368af43e418a04d52505cf3dbc23dda4e3407ae2fa99fd0e4f308ce546acc" +dependencies = [ + "serde", +] + +[[package]] +name = "cap-fs-ext" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88e341d15ac1029aadce600be764a1a1edafe40e03cde23285bc1d261b3a4866" +dependencies = [ + "cap-primitives", + "cap-std", + "io-lifetimes", + "windows-sys 0.52.0", +] + +[[package]] +name = "cap-net-ext" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "434168fe6533055f0f4204039abe3ff6d7db338ef46872a5fa39e9d5ad5ab7a9" +dependencies = [ + "cap-primitives", + "cap-std", + "rustix", + "smallvec", +] + +[[package]] +name = "cap-primitives" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe16767ed8eee6d3f1f00d6a7576b81c226ab917eb54b96e5f77a5216ef67abb" +dependencies = [ + "ambient-authority", + "fs-set-times", + "io-extras", + "io-lifetimes", + "ipnet", + "maybe-owned", + "rustix", + "windows-sys 0.52.0", + "winx", +] + +[[package]] +name = "cap-rand" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20e5695565f0cd7106bc3c7170323597540e772bb73e0be2cd2c662a0f8fa4ca" +dependencies = [ + "ambient-authority", + "rand", +] + +[[package]] +name = "cap-std" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "593db20e4c51f62d3284bae7ee718849c3214f93a3b94ea1899ad85ba119d330" +dependencies = [ + "cap-primitives", + "io-extras", + "io-lifetimes", + "rustix", +] + +[[package]] +name = "cap-time-ext" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "03261630f291f425430a36f38c847828265bc928f517cdd2004c56f4b02f002b" +dependencies = [ + "ambient-authority", + "cap-primitives", + "iana-time-zone", + "once_cell", + "rustix", + "winx", +] + +[[package]] +name = "cc" +version = "1.0.83" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" +dependencies = [ + "jobserver", + "libc", +] + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "chrono" +version = "0.4.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f2c685bad3eb3d45a01354cedb7d5faa66194d1d58ba6e267a8de788f79db38" +dependencies = [ + "android-tzdata", + "iana-time-zone", + "js-sys", + "num-traits", + "serde", + "wasm-bindgen", + "windows-targets 0.48.5", +] + +[[package]] +name = "cid" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "472ac98592f38dfd48f188d5713a328422ed22fa39eb52b8bca495370134762a" +dependencies = [ + "core2", + "multibase", + "multihash 0.19.1", + "unsigned-varint 0.8.0", +] + +[[package]] +name = "clap" +version = "4.4.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfaff671f6b22ca62406885ece523383b9b64022e341e53e009a62ebc47a45f2" +dependencies = [ + "clap_builder", + "clap_derive", +] + +[[package]] +name = "clap_builder" +version = "4.4.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a216b506622bb1d316cd51328dce24e07bdff4a6128a47c7e7fad11878d5adbb" +dependencies = [ + "anstream", + "anstyle", + "clap_lex", + "strsim", +] + +[[package]] +name = "clap_derive" +version = "4.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf9804afaaf59a91e75b022a30fb7229a7901f60c755489cc61c9b423b836442" +dependencies = [ + "heck 0.4.1", + "proc-macro2", + "quote", + "syn 2.0.48", +] + +[[package]] +name = "clap_lex" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "702fc72eb24e5a1e48ce58027a675bc24edd52096d5397d4aea7c6dd9eca0bd1" + +[[package]] +name = "codespan" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3362992a0d9f1dd7c3d0e89e0ab2bb540b7a95fea8cd798090e758fda2899b5e" +dependencies = [ + "codespan-reporting", +] + +[[package]] +name = "codespan-reporting" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3538270d33cc669650c4b093848450d380def10c331d38c768e34cac80576e6e" +dependencies = [ + "termcolor", + "unicode-width", +] + +[[package]] +name = "colorchoice" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7" + +[[package]] +name = "concat-idents" +version = "1.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f76990911f2267d837d9d0ad060aa63aaad170af40904b29461734c339030d4d" +dependencies = [ + "quote", + "syn 2.0.48", +] + +[[package]] +name = "const-oid" +version = "0.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" + +[[package]] +name = "constant_time_eq" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7144d30dcf0fafbce74250a3963025d8d52177934239851c917d29f1df280c2" + +[[package]] +name = "core-foundation-sys" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f" + +[[package]] +name = "core2" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b49ba7ef1ad6107f8824dbe97de947cbaac53c44e7f9756a1fba0d37c1eec505" +dependencies = [ + "memchr", +] + +[[package]] +name = "cpp_demangle" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eeaa953eaad386a53111e47172c2fedba671e5684c8dd601a5f474f4f118710f" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "cpufeatures" +version = "0.2.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce420fe07aecd3e67c5f910618fe65e94158f6dcc0adf44e00d69ce2bdfe0fd0" +dependencies = [ + "libc", +] + +[[package]] +name = "cranelift-bforest" +version = "0.100.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "751cbf89e513f283c0641eb7f95dc72fda5051dd95ca203d1dc45e26bc89dba8" +dependencies = [ + "cranelift-entity", +] + +[[package]] +name = "cranelift-codegen" +version = "0.100.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "210730edc05121e915201cc36595e1f00062094669fa07ac362340e3627b3dc5" +dependencies = [ + "bumpalo", + "cranelift-bforest", + "cranelift-codegen-meta", + "cranelift-codegen-shared", + "cranelift-control", + "cranelift-entity", + "cranelift-isle", + "gimli 0.28.1", + "hashbrown 0.14.3", + "log", + "regalloc2", + "smallvec", + "target-lexicon", +] + +[[package]] +name = "cranelift-codegen-meta" +version = "0.100.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5dc7fdf210c53db047f3eaf49b3a89efee0cc3d9a2ce0c0f0236933273d0c53" +dependencies = [ + "cranelift-codegen-shared", +] + +[[package]] +name = "cranelift-codegen-shared" +version = "0.100.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f46875cc87d963119d78fe5c19852757dc6eea3cb9622c0df69c26b242cd44b4" + +[[package]] +name = "cranelift-control" +version = "0.100.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "375dca8f58d8a801a85e11730c1529c5c4a9c3593dfb12118391ac437b037155" +dependencies = [ + "arbitrary", +] + +[[package]] +name = "cranelift-entity" +version = "0.100.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc619b86fe3c72f43fc417c9fd67a04ec0c98296e5940922d9fd9e6eedf72521" +dependencies = [ + "serde", + "serde_derive", +] + +[[package]] +name = "cranelift-frontend" +version = "0.100.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7eb607fd19ae264da18f9f2532e7302b826f7fbf77bf88365fc075f2e3419436" +dependencies = [ + "cranelift-codegen", + "log", + "smallvec", + "target-lexicon", +] + +[[package]] +name = "cranelift-isle" +version = "0.100.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9fe806a6470dddfdf79e878af6a96afb1235a09fe3e21f9e0c2f18d402820432" + +[[package]] +name = "cranelift-native" +version = "0.100.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fac7f1722660b10af1f7229c0048f716bfd8bd344549b0e06e3eb6417ec3fe5b" +dependencies = [ + "cranelift-codegen", + "libc", + "target-lexicon", +] + +[[package]] +name = "cranelift-wasm" +version = "0.100.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1b65810be56b619c3c55debade92798d999f34bf0670370c578afab5d905f06" +dependencies = [ + "cranelift-codegen", + "cranelift-entity", + "cranelift-frontend", + "itertools", + "log", + "smallvec", + "wasmparser 0.112.0", + "wasmtime-types", +] + +[[package]] +name = "crc32fast" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "crossbeam-deque" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fca89a0e215bab21874660c67903c5f143333cab1da83d041c7ded6053774751" +dependencies = [ + "cfg-if", + "crossbeam-epoch", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-epoch" +version = "0.9.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d2fe95351b870527a5d09bf563ed3c97c0cffb87cf1c78a591bf48bb218d9aa" +dependencies = [ + "autocfg", + "cfg-if", + "crossbeam-utils", + "memoffset", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c06d96137f14f244c37f989d9fff8f95e6c18b918e71f36638f8c49112e4c78f" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "crunchy" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" + +[[package]] +name = "crypto-common" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" +dependencies = [ + "generic-array", + "typenum", +] + +[[package]] +name = "crypto-mac" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b584a330336237c1eecd3e94266efb216c56ed91225d634cb2991c5f3fd1aeab" +dependencies = [ + "generic-array", + "subtle", +] + +[[package]] +name = "curve25519-dalek" +version = "4.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e89b8c6a2e4b1f45971ad09761aafb85514a84744b67a95e32c3cc1352d1f65c" +dependencies = [ + "cfg-if", + "cpufeatures", + "curve25519-dalek-derive", + "digest 0.10.7", + "fiat-crypto", + "platforms", + "rustc_version 0.4.0", + "subtle", + "zeroize", +] + +[[package]] +name = "curve25519-dalek-derive" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.48", +] + +[[package]] +name = "darling" +version = "0.20.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0209d94da627ab5605dcccf08bb18afa5009cfbef48d8a8b7d7bdbc79be25c5e" +dependencies = [ + "darling_core", + "darling_macro", +] + +[[package]] +name = "darling_core" +version = "0.20.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "177e3443818124b357d8e76f53be906d60937f0d3a90773a664fa63fa253e621" +dependencies = [ + "fnv", + "ident_case", + "proc-macro2", + "quote", + "strsim", + "syn 2.0.48", +] + +[[package]] +name = "darling_macro" +version = "0.20.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "836a9bbc7ad63342d6d6e7b815ccab164bc77a2d95d84bc3117a8c0d5c98e2d5" +dependencies = [ + "darling_core", + "quote", + "syn 2.0.48", +] + +[[package]] +name = "data-encoding" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e962a19be5cfc3f3bf6dd8f61eb50107f356ad6270fbb3ed41476571db78be5" + +[[package]] +name = "data-encoding-macro" +version = "0.1.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20c01c06f5f429efdf2bae21eb67c28b3df3cf85b7dd2d8ef09c0838dac5d33e" +dependencies = [ + "data-encoding", + "data-encoding-macro-internal", +] + +[[package]] +name = "data-encoding-macro-internal" +version = "0.1.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0047d07f2c89b17dd631c80450d69841a6b5d7fb17278cbc43d7e4cfcf2576f3" +dependencies = [ + "data-encoding", + "syn 1.0.109", +] + +[[package]] +name = "debugid" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef552e6f588e446098f6ba40d89ac146c8c7b64aade83c051ee00bb5d2bc18d" +dependencies = [ + "uuid", +] + +[[package]] +name = "der" +version = "0.7.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fffa369a668c8af7dbf8b5e56c9f744fbd399949ed171606040001947de40b1c" +dependencies = [ + "const-oid", + "zeroize", +] + +[[package]] +name = "deranged" +version = "0.3.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8eb30d70a07a3b04884d2677f06bec33509dc67ca60d92949e5535352d3191dc" +dependencies = [ + "powerfmt", + "serde", +] + +[[package]] +name = "derivative" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "diff" +version = "0.1.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56254986775e3233ffa9c4d7d3faaf6d36a2c09d30b20687e9f88bc8bafc16c8" + +[[package]] +name = "digest" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" +dependencies = [ + "generic-array", +] + +[[package]] +name = "digest" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +dependencies = [ + "block-buffer 0.10.4", + "crypto-common", + "subtle", +] + +[[package]] +name = "directories-next" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "339ee130d97a610ea5a5872d2bbb130fdf68884ff09d3028b81bec8a1ac23bbc" +dependencies = [ + "cfg-if", + "dirs-sys-next", +] + +[[package]] +name = "dirs" +version = "4.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca3aa72a6f96ea37bbc5aa912f6788242832f75369bdfdadcb0e38423f100059" +dependencies = [ + "dirs-sys", +] + +[[package]] +name = "dirs-next" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b98cf8ebf19c3d1b223e151f99a4f9f0690dca41414773390fc824184ac833e1" +dependencies = [ + "cfg-if", + "dirs-sys-next", +] + +[[package]] +name = "dirs-sys" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b1d1d91c932ef41c0f2663aa8b0ca0342d444d842c06914aa0a7e352d0bada6" +dependencies = [ + "libc", + "redox_users", + "winapi", +] + +[[package]] +name = "dirs-sys-next" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ebda144c4fe02d1f7ea1a7d9641b6fc6b580adcfa024ae48797ecdeb6825b4d" +dependencies = [ + "libc", + "redox_users", + "winapi", +] + +[[package]] +name = "ed25519" +version = "2.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "115531babc129696a58c64a4fef0a8bf9e9698629fb97e9e40767d235cfbcd53" +dependencies = [ + "pkcs8", + "serde", + "signature", +] + +[[package]] +name = "ed25519-dalek" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f628eaec48bfd21b865dc2950cfa014450c01d2fa2b69a86c2fd5844ec523c0" +dependencies = [ + "curve25519-dalek", + "ed25519", + "rand_core", + "serde", + "sha2 0.10.8", + "subtle", + "zeroize", +] + +[[package]] +name = "either" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" + +[[package]] +name = "ena" +version = "0.14.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c533630cf40e9caa44bd91aadc88a75d75a4c3a12b4cfde353cbed41daa1e1f1" +dependencies = [ + "log", +] + +[[package]] +name = "encoding_rs" +version = "0.8.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7268b386296a025e474d5140678f75d6de9493ae55a5d709eeb9dd08149945e1" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "equivalent" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" + +[[package]] +name = "errno" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a258e46cdc063eb8519c00b9fc845fc47bcfca4130e2f08e88665ceda8474245" +dependencies = [ + "libc", + "windows-sys 0.52.0", +] + +[[package]] +name = "eyre" +version = "0.6.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6267a1fa6f59179ea4afc8e50fd8612a3cc60bc858f786ff877a4a8cb042799" +dependencies = [ + "indenter", + "once_cell", +] + +[[package]] +name = "fallible-iterator" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4443176a9f2c162692bd3d352d745ef9413eec5782a80d8fd6f8a1ac692a07f7" + +[[package]] +name = "fallible-iterator" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2acce4a10f12dc2fb14a218589d4f1f62ef011b2d0cc4b3cb1bba8e94da14649" + +[[package]] +name = "fd-lock" +version = "4.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b93f7a0db71c99f68398f80653ed05afb0b00e062e1a20c7ff849c4edfabbbcc" +dependencies = [ + "cfg-if", + "rustix", + "windows-sys 0.52.0", +] + +[[package]] +name = "fiat-crypto" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "27573eac26f4dd11e2b1916c3fe1baa56407c83c71a773a8ba17ec0bca03b6b7" + +[[package]] +name = "fixedbitset" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80" + +[[package]] +name = "fluence-blake3" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a3c704928408e9b8f7c9d5b24a4f205dd5cb89d378aa31a01140df810093bf5" +dependencies = [ + "arrayref", + "arrayvec", + "cc", + "cfg-if", + "constant_time_eq", + "digest 0.10.7", +] + +[[package]] +name = "fluence-it-types" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "45e8d8d5ed4d1f5d21ee5fcd0f6a7b0feea113d918e7ece4f3dd0f8a0b99caa6" +dependencies = [ + "it-to-bytes", + "nom", + "serde", + "variant_count", + "wast 8.0.0", +] + +[[package]] +name = "fluence-keypair" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "273ecbe8b6757f46e9d2b61f56ac636f27defa88aebc17a4fd6a7b78bf84cca3" +dependencies = [ + "asn1_der 0.6.3", + "bs58", + "ed25519-dalek", + "eyre", + "lazy_static", + "libp2p-identity", + "libsecp256k1", + "multihash 0.18.1", + "rand", + "ring 0.16.20", + "serde", + "serde_bytes", + "sha2 0.10.8", + "thiserror", + "zeroize", +] + +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "form_urlencoded" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456" +dependencies = [ + "percent-encoding", +] + +[[package]] +name = "fs-set-times" +version = "0.20.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "033b337d725b97690d86893f9de22b67b80dcc4e9ad815f348254c38119db8fb" +dependencies = [ + "io-lifetimes", + "rustix", + "windows-sys 0.52.0", +] + +[[package]] +name = "funty" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" + +[[package]] +name = "futures" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "645c6916888f6cb6350d2550b80fb63e734897a8498abe35cfb732b6487804b0" +dependencies = [ + "futures-channel", + "futures-core", + "futures-executor", + "futures-io", + "futures-sink", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-channel" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78" +dependencies = [ + "futures-core", + "futures-sink", +] + +[[package]] +name = "futures-core" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" + +[[package]] +name = "futures-executor" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a576fc72ae164fca6b9db127eaa9a9dda0d61316034f33a0a0d4eda41f02b01d" +dependencies = [ + "futures-core", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-io" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1" + +[[package]] +name = "futures-macro" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.48", +] + +[[package]] +name = "futures-sink" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9fb8e00e87438d937621c1c6269e53f536c14d3fbd6a042bb24879e57d474fb5" + +[[package]] +name = "futures-task" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004" + +[[package]] +name = "futures-util" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48" +dependencies = [ + "futures-channel", + "futures-core", + "futures-io", + "futures-macro", + "futures-sink", + "futures-task", + "memchr", + "pin-project-lite", + "pin-utils", + "slab", +] + +[[package]] +name = "fxhash" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c31b6d751ae2c7f11320402d34e41349dd1016f8d5d45e48c4312bc8625af50c" +dependencies = [ + "byteorder", +] + +[[package]] +name = "fxprof-processed-profile" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "27d12c0aed7f1e24276a241aadc4cb8ea9f83000f34bc062b7cc2d51e3b0fabd" +dependencies = [ + "bitflags 2.4.1", + "debugid", + "fxhash", + "serde", + "serde_json", +] + +[[package]] +name = "gen-bench-data" +version = "0.1.0" +dependencies = [ + "air-interpreter-cid", + "air-interpreter-data", + "air-interpreter-interface", + "air-interpreter-sede", + "air-interpreter-signatures", + "air-test-utils", + "air-testing-framework", + "aquavm-air", + "bs58", + "clap", + "fluence-keypair", + "futures", + "hex", + "itertools", + "maplit", + "rand", + "serde", + "serde_json", + "tokio", +] + +[[package]] +name = "generic-array" +version = "0.14.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" +dependencies = [ + "typenum", + "version_check", +] + +[[package]] +name = "getrandom" +version = "0.2.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe9006bed769170c11f845cf00c7c1e9092aeb3f268e007c3e760ac68008070f" +dependencies = [ + "cfg-if", + "libc", + "wasi", +] + +[[package]] +name = "gimli" +version = "0.26.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22030e2c5a68ec659fde1e949a745124b48e6fa8b045b7ed5bd1fe4ccc5c4e5d" +dependencies = [ + "fallible-iterator 0.2.0", + "indexmap 1.9.3", + "stable_deref_trait", +] + +[[package]] +name = "gimli" +version = "0.28.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" +dependencies = [ + "fallible-iterator 0.3.0", + "indexmap 2.1.0", + "stable_deref_trait", +] + +[[package]] +name = "hashbrown" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" +dependencies = [ + "ahash 0.7.7", +] + +[[package]] +name = "hashbrown" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" +dependencies = [ + "ahash 0.8.7", +] + +[[package]] +name = "hashbrown" +version = "0.14.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" +dependencies = [ + "ahash 0.8.7", +] + +[[package]] +name = "heck" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d621efb26863f0e9924c6ac577e8275e5e6b77455db64ffa6c65c904e9e132c" +dependencies = [ + "unicode-segmentation", +] + +[[package]] +name = "heck" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" + +[[package]] +name = "hermit-abi" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d77f7ec81a6d05a3abb01ab6eb7590f6083d08449fe5a1c8b1e620283546ccb7" + +[[package]] +name = "hex" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" + +[[package]] +name = "hkdf" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b5f8eb2ad728638ea2c7d47a21db23b7b58a72ed6a38256b8a1849f15fbbdf7" +dependencies = [ + "hmac 0.12.1", +] + +[[package]] +name = "hmac" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "126888268dcc288495a26bf004b38c5fdbb31682f992c84ceb046a1f0fe38840" +dependencies = [ + "crypto-mac", + "digest 0.9.0", +] + +[[package]] +name = "hmac" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" +dependencies = [ + "digest 0.10.7", +] + +[[package]] +name = "hmac-drbg" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "17ea0a1394df5b6574da6e0c1ade9e78868c9fb0a4e5ef4428e32da4676b85b1" +dependencies = [ + "digest 0.9.0", + "generic-array", + "hmac 0.8.1", +] + +[[package]] +name = "iana-time-zone" +version = "0.1.58" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8326b86b6cff230b97d0d312a6c40a60726df3332e721f72a1b035f451663b20" +dependencies = [ + "android_system_properties", + "core-foundation-sys", + "iana-time-zone-haiku", + "js-sys", + "wasm-bindgen", + "windows-core", +] + +[[package]] +name = "iana-time-zone-haiku" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" +dependencies = [ + "cc", +] + +[[package]] +name = "id-arena" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25a2bc672d1148e28034f176e01fffebb08b35768468cc954630da77a1449005" + +[[package]] +name = "ident_case" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" + +[[package]] +name = "idna" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6" +dependencies = [ + "unicode-bidi", + "unicode-normalization", +] + +[[package]] +name = "indenter" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce23b50ad8242c51a442f3ff322d56b02f08852c77e4c0b4d3fd684abc89c683" + +[[package]] +name = "indexmap" +version = "1.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" +dependencies = [ + "autocfg", + "hashbrown 0.12.3", + "serde", +] + +[[package]] +name = "indexmap" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d530e1a18b1cb4c484e6e34556a0d948706958449fca0cab753d649f2bce3d1f" +dependencies = [ + "equivalent", + "hashbrown 0.14.3", + "serde", +] + +[[package]] +name = "instant" +version = "0.1.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "io-extras" +version = "0.18.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c301e73fb90e8a29e600a9f402d095765f74310d582916a952f618836a1bd1ed" +dependencies = [ + "io-lifetimes", + "windows-sys 0.52.0", +] + +[[package]] +name = "io-lifetimes" +version = "2.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a611371471e98973dbcab4e0ec66c31a10bc356eeb4d54a0e05eac8158fe38c" + +[[package]] +name = "ipnet" +version = "2.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f518f335dce6725a761382244631d86cf0ccb2863413590b31338feb467f9c3" + +[[package]] +name = "is-terminal" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b" +dependencies = [ + "hermit-abi", + "rustix", + "windows-sys 0.48.0", +] + +[[package]] +name = "it-json-serde" +version = "0.5.1" +source = "git+https://github.com/fluencelabs/marine?branch=feat/async-call#60ebd0905e834c952e94faf04eb39bef9461254f" +dependencies = [ + "serde", + "serde_derive", + "serde_json", + "thiserror", + "wasmer-interface-types-fl", +] + +[[package]] +name = "it-lilo" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fa7310e6ce8b8b6f11c3d0b5dd5824675fab3cfd335f70bcf9a51198de39cfe" +dependencies = [ + "anyhow", + "async-recursion", + "fluence-it-types", + "futures", + "it-memory-traits", + "log", + "paste", + "thiserror", +] + +[[package]] +name = "it-memory-traits" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e83089981169d53e2b13df7c8d132b471bf2fc4c85afe427c4a74115695c4612" +dependencies = [ + "thiserror", +] + +[[package]] +name = "it-to-bytes" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "729c74bb4236418898a219c6d96f14cba77456dd7c04a2e99e65e9c643709b56" + +[[package]] +name = "itertools" +version = "0.10.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" +dependencies = [ + "either", +] + +[[package]] +name = "itoa" +version = "1.0.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1a46d1a171d865aa5f83f92695765caa047a9b4cbae2cbf37dbd613a793fd4c" + +[[package]] +name = "ittapi" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25a5c0b993601cad796222ea076565c5d9f337d35592f8622c753724f06d7271" +dependencies = [ + "anyhow", + "ittapi-sys", + "log", +] + +[[package]] +name = "ittapi-sys" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb7b5e473765060536a660eed127f758cf1a810c73e49063264959c60d1727d9" +dependencies = [ + "cc", +] + +[[package]] +name = "jobserver" +version = "0.1.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c37f63953c4c63420ed5fd3d6d398c719489b9f872b9fa683262f8edd363c7d" +dependencies = [ + "libc", +] + +[[package]] +name = "js-sys" +version = "0.3.66" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cee9c64da59eae3b50095c18d3e74f8b73c0b86d2792824ff01bbce68ba229ca" +dependencies = [ + "wasm-bindgen", +] + +[[package]] +name = "keccak" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f6d5ed8676d904364de097082f4e7d240b571b67989ced0240f08b7f966f940" +dependencies = [ + "cpufeatures", +] + +[[package]] +name = "lalrpop" +version = "0.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da4081d44f4611b66c6dd725e6de3169f9f63905421e8626fcb86b6a898998b8" +dependencies = [ + "ascii-canvas", + "bit-set", + "diff", + "ena", + "is-terminal", + "itertools", + "lalrpop-util", + "petgraph", + "pico-args", + "regex", + "regex-syntax 0.7.5", + "string_cache", + "term", + "tiny-keccak", + "unicode-xid", +] + +[[package]] +name = "lalrpop-util" +version = "0.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f35c735096c0293d313e8f2a641627472b83d01b937177fe76e5e2708d31e0d" +dependencies = [ + "regex", +] + +[[package]] +name = "lazy_static" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" + +[[package]] +name = "leb128" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "884e2677b40cc8c339eaefcb701c32ef1fd2493d71118dc0ca4b6a736c93bd67" + +[[package]] +name = "libc" +version = "0.2.151" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "302d7ab3130588088d277783b1e2d2e10c9e9e4a16dd9050e6ec93fb3e7048f4" + +[[package]] +name = "libp2p-identity" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "999ec70441b2fb35355076726a6bc466c932e9bdc66f6a11c6c0aa17c7ab9be0" +dependencies = [ + "asn1_der 0.7.6", + "bs58", + "ed25519-dalek", + "hkdf", + "libsecp256k1", + "multihash 0.19.1", + "quick-protobuf", + "rand", + "ring 0.17.7", + "sha2 0.10.8", + "thiserror", + "tracing", + "zeroize", +] + +[[package]] +name = "libredox" +version = "0.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85c833ca1e66078851dba29046874e38f08b2c883700aa29a03ddd3b23814ee8" +dependencies = [ + "bitflags 2.4.1", + "libc", + "redox_syscall 0.4.1", +] + +[[package]] +name = "libsecp256k1" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95b09eff1b35ed3b33b877ced3a691fc7a481919c7e29c53c906226fcf55e2a1" +dependencies = [ + "arrayref", + "base64 0.13.1", + "digest 0.9.0", + "hmac-drbg", + "libsecp256k1-core", + "libsecp256k1-gen-ecmult", + "libsecp256k1-gen-genmult", + "rand", + "serde", + "sha2 0.9.9", + "typenum", +] + +[[package]] +name = "libsecp256k1-core" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5be9b9bb642d8522a44d533eab56c16c738301965504753b03ad1de3425d5451" +dependencies = [ + "crunchy", + "digest 0.9.0", + "subtle", +] + +[[package]] +name = "libsecp256k1-gen-ecmult" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3038c808c55c87e8a172643a7d87187fc6c4174468159cb3090659d55bcb4809" +dependencies = [ + "libsecp256k1-core", +] + +[[package]] +name = "libsecp256k1-gen-genmult" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3db8d6ba2cec9eacc40e6e8ccc98931840301f1006e95647ceb2dd5c3aa06f7c" +dependencies = [ + "libsecp256k1-core", +] + +[[package]] +name = "linux-raw-sys" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4cd1a83af159aa67994778be9070f0ae1bd732942279cabb14f86f986a21456" + +[[package]] +name = "lock_api" +version = "0.4.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c168f8615b12bc01f9c17e2eb0cc07dcae1940121185446edc3744920e8ef45" +dependencies = [ + "autocfg", + "scopeguard", +] + +[[package]] +name = "log" +version = "0.4.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" + +[[package]] +name = "mach" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b823e83b2affd8f40a9ee8c29dbc56404c1e34cd2710921f2801e2cf29527afa" +dependencies = [ + "libc", +] + +[[package]] +name = "maplit" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3e2e65a1a2e43cfcb47a895c4c8b10d1f4a61097f9f254f183aee60cad9c651d" + +[[package]] +name = "marine-call-parameters" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef9a7c6ed5fa9052474c1cd76d3b3e67dbc4c455c76263c2c043214e12cce6bd" +dependencies = [ + "marine-macro 0.10.3", + "marine-rs-sdk-main 0.10.3", + "serde", +] + +[[package]] +name = "marine-call-parameters" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f47b1186bad0b2a5e9218e3f6fbe0612ef6b17c58c58537d77bd08044596ea95" +dependencies = [ + "marine-macro 0.12.0", + "marine-rs-sdk-main 0.12.0", + "rkyv", + "serde", +] + +[[package]] +name = "marine-core" +version = "0.27.0" +source = "git+https://github.com/fluencelabs/marine?branch=feat/async-call#60ebd0905e834c952e94faf04eb39bef9461254f" +dependencies = [ + "anyhow", + "bytesize", + "futures", + "it-lilo", + "it-memory-traits", + "log", + "marine-it-generator", + "marine-it-interfaces", + "marine-it-parser", + "marine-min-it-version", + "marine-module-info-parser", + "marine-module-interface", + "marine-utils", + "marine-wasm-backend-traits", + "marine-wasmtime-backend", + "multimap 0.8.3", + "once_cell", + "paste", + "semver 1.0.20", + "serde", + "thiserror", + "wasmer-interface-types-fl", +] + +[[package]] +name = "marine-it-generator" +version = "0.14.0" +source = "git+https://github.com/fluencelabs/marine?branch=feat/async-call#60ebd0905e834c952e94faf04eb39bef9461254f" +dependencies = [ + "it-lilo", + "marine-it-parser", + "marine-macro-impl 0.12.0", + "once_cell", + "serde", + "serde_json", + "thiserror", + "walrus", + "wasmer-interface-types-fl", +] + +[[package]] +name = "marine-it-interfaces" +version = "0.9.1" +source = "git+https://github.com/fluencelabs/marine?branch=feat/async-call#60ebd0905e834c952e94faf04eb39bef9461254f" +dependencies = [ + "multimap 0.8.3", + "wasmer-interface-types-fl", +] + +[[package]] +name = "marine-it-parser" +version = "0.15.1" +source = "git+https://github.com/fluencelabs/marine?branch=feat/async-call#60ebd0905e834c952e94faf04eb39bef9461254f" +dependencies = [ + "anyhow", + "itertools", + "marine-it-interfaces", + "marine-module-interface", + "marine-wasm-backend-traits", + "nom", + "semver 1.0.20", + "serde", + "thiserror", + "walrus", + "wasmer-interface-types-fl", +] + +[[package]] +name = "marine-macro" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "acdaa50f8239afa104ef8a99d4219288f68169e29c913485bbd094a35fe79113" +dependencies = [ + "marine-macro-impl 0.10.3", + "marine-rs-sdk-main 0.10.3", +] + +[[package]] +name = "marine-macro" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "727b1a5449eb1676837c5fc22a8c31dc9980dcef4de938f26f2eaf7c2c54331b" +dependencies = [ + "marine-macro-impl 0.12.0", + "marine-rs-sdk-main 0.12.0", +] + +[[package]] +name = "marine-macro-impl" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "460ef42c1bf6dbb88976a00514f8e1b97a7ccb60e3e6009cbb563b0d163166c7" +dependencies = [ + "proc-macro2", + "quote", + "serde", + "serde_json", + "syn 1.0.109", +] + +[[package]] +name = "marine-macro-impl" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57c8cd8a228856db057bd4a32c6e2708848b2b1db7552be0a6063d534cafb4e2" +dependencies = [ + "proc-macro2", + "quote", + "serde", + "serde_json", + "syn 1.0.109", +] + +[[package]] +name = "marine-min-it-version" +version = "0.3.2" +source = "git+https://github.com/fluencelabs/marine?branch=feat/async-call#60ebd0905e834c952e94faf04eb39bef9461254f" +dependencies = [ + "once_cell", + "semver 1.0.20", +] + +[[package]] +name = "marine-module-info-parser" +version = "0.12.0" +source = "git+https://github.com/fluencelabs/marine?branch=feat/async-call#60ebd0905e834c952e94faf04eb39bef9461254f" +dependencies = [ + "anyhow", + "chrono", + "derivative", + "marine-rs-sdk-main 0.12.0", + "marine-wasm-backend-traits", + "semver 1.0.20", + "serde", + "thiserror", + "walrus", +] + +[[package]] +name = "marine-module-interface" +version = "0.8.1" +source = "git+https://github.com/fluencelabs/marine?branch=feat/async-call#60ebd0905e834c952e94faf04eb39bef9461254f" +dependencies = [ + "anyhow", + "itertools", + "marine-it-interfaces", + "nom", + "semver 1.0.20", + "serde", + "thiserror", + "walrus", + "wasmer-interface-types-fl", +] + +[[package]] +name = "marine-rs-sdk" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7662e4c6c08f7cd1b63cd6ff8e473e3239a9d3dd10fb46bec357cb8331423268" +dependencies = [ + "marine-call-parameters 0.12.0", + "marine-macro 0.12.0", + "marine-rs-sdk-main 0.12.0", + "marine-timestamp-macro", + "serde", +] + +[[package]] +name = "marine-rs-sdk-main" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "031eeea016dab58c1ccb0c65b798cb5e47d214b05115c8c06198717d18275756" +dependencies = [ + "log", + "serde", +] + +[[package]] +name = "marine-rs-sdk-main" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6cba9000500575b4965ec44e44bbbfd056d121be1195969ce1a5cc146646c37b" +dependencies = [ + "log", + "serde", +] + +[[package]] +name = "marine-runtime" +version = "0.33.0" +source = "git+https://github.com/fluencelabs/marine?branch=feat/async-call#60ebd0905e834c952e94faf04eb39bef9461254f" +dependencies = [ + "bytesize", + "it-json-serde", + "it-memory-traits", + "itertools", + "log", + "marine-call-parameters 0.10.3", + "marine-core", + "marine-module-interface", + "marine-rs-sdk", + "marine-rs-sdk-main 0.12.0", + "marine-utils", + "marine-wasm-backend-traits", + "marine-wasmtime-backend", + "parking_lot 0.12.1", + "safe-transmute", + "serde", + "serde_derive", + "serde_json", + "serde_with", + "thiserror", + "toml", + "wasmer-interface-types-fl", +] + +[[package]] +name = "marine-timestamp-macro" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47ec0d664570661ecba1feba2dda610ab63f23733edf189dcde7b5ed23966144" +dependencies = [ + "chrono", + "quote", +] + +[[package]] +name = "marine-utils" +version = "0.5.1" +source = "git+https://github.com/fluencelabs/marine?branch=feat/async-call#60ebd0905e834c952e94faf04eb39bef9461254f" + +[[package]] +name = "marine-wasm-backend-traits" +version = "0.5.1" +source = "git+https://github.com/fluencelabs/marine?branch=feat/async-call#60ebd0905e834c952e94faf04eb39bef9461254f" +dependencies = [ + "anyhow", + "futures", + "it-memory-traits", + "multimap 0.8.3", + "paste", + "thiserror", + "wasmer-interface-types-fl", + "wasmparser 0.101.1", +] + +[[package]] +name = "marine-wasmtime-backend" +version = "0.5.1" +source = "git+https://github.com/fluencelabs/marine?branch=feat/async-call#60ebd0905e834c952e94faf04eb39bef9461254f" +dependencies = [ + "anyhow", + "futures", + "it-memory-traits", + "log", + "marine-wasm-backend-traits", + "multimap 0.8.3", + "paste", + "wasmer-interface-types-fl", + "wasmtime", + "wasmtime-wasi", +] + +[[package]] +name = "maybe-owned" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4facc753ae494aeb6e3c22f839b158aebd4f9270f55cd3c79906c45476c47ab4" + +[[package]] +name = "memchr" +version = "2.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167" + +[[package]] +name = "memfd" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2cffa4ad52c6f791f4f8b15f0c05f9824b2ced1160e88cc393d64fff9a8ac64" +dependencies = [ + "rustix", +] + +[[package]] +name = "memoffset" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a634b1c61a95585bd15607c6ab0c4e5b226e695ff2800ba0cdccddf208c406c" +dependencies = [ + "autocfg", +] + +[[package]] +name = "minimal-lexical" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" + +[[package]] +name = "miniz_oxide" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d811f3e15f28568be3407c8e7fdb6514c1cda3cb30683f15b6a1a1dc4ea14a7" +dependencies = [ + "adler", +] + +[[package]] +name = "mio" +version = "0.8.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f3d0b296e374a4e6f3c7b0a1f5a51d748a0d34c85e7dc48fc3fa9a87657fe09" +dependencies = [ + "libc", + "wasi", + "windows-sys 0.48.0", +] + +[[package]] +name = "multibase" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b3539ec3c1f04ac9748a260728e855f261b4977f5c3406612c884564f329404" +dependencies = [ + "base-x", + "data-encoding", + "data-encoding-macro", +] + +[[package]] +name = "multihash" +version = "0.18.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfd8a792c1694c6da4f68db0a9d707c72bd260994da179e6030a5dcee00bb815" +dependencies = [ + "blake2b_simd", + "blake2s_simd", + "blake3", + "core2", + "digest 0.10.7", + "multihash-derive 0.8.0", + "sha2 0.10.8", + "sha3", + "unsigned-varint 0.7.2", +] + +[[package]] +name = "multihash" +version = "0.19.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "076d548d76a0e2a0d4ab471d0b1c36c577786dfc4471242035d97a12a735c492" +dependencies = [ + "core2", + "unsigned-varint 0.7.2", +] + +[[package]] +name = "multihash-codetable" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6d815ecb3c8238d00647f8630ede7060a642c9f704761cd6082cb4028af6935" +dependencies = [ + "blake2b_simd", + "blake2s_simd", + "blake3", + "core2", + "digest 0.10.7", + "multihash-derive 0.9.0", + "ripemd", + "sha1", + "sha2 0.10.8", + "sha3", + "strobe-rs", +] + +[[package]] +name = "multihash-derive" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc076939022111618a5026d3be019fd8b366e76314538ff9a1b59ffbcbf98bcd" +dependencies = [ + "proc-macro-crate 1.3.1", + "proc-macro-error", + "proc-macro2", + "quote", + "syn 1.0.109", + "synstructure", +] + +[[package]] +name = "multihash-derive" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "890e72cb7396cb99ed98c1246a97b243cc16394470d94e0bc8b0c2c11d84290e" +dependencies = [ + "core2", + "multihash 0.19.1", + "multihash-derive-impl", +] + +[[package]] +name = "multihash-derive-impl" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d38685e08adb338659871ecfc6ee47ba9b22dcc8abcf6975d379cc49145c3040" +dependencies = [ + "proc-macro-crate 1.3.1", + "proc-macro-error", + "proc-macro2", + "quote", + "syn 1.0.109", + "synstructure", +] + +[[package]] +name = "multimap" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5ce46fe64a9d73be07dcbe690a38ce1b293be448fd8ce1e6c1b8062c9f72c6a" +dependencies = [ + "serde", +] + +[[package]] +name = "multimap" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1a5d38b9b352dbd913288736af36af41c48d61b1a8cd34bcecd727561b7d511" +dependencies = [ + "serde", +] + +[[package]] +name = "new_debug_unreachable" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e4a24736216ec316047a1fc4252e27dabb04218aa4a3f37c6e7ddbf1f9782b54" + +[[package]] +name = "newtype_derive" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac8cd24d9f185bb7223958d8c1ff7a961b74b1953fd05dba7cc568a63b3861ec" +dependencies = [ + "rustc_version 0.1.7", +] + +[[package]] +name = "nom" +version = "7.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" +dependencies = [ + "memchr", + "minimal-lexical", +] + +[[package]] +name = "nom_locate" +version = "4.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e3c83c053b0713da60c5b8de47fe8e494fe3ece5267b2f23090a07a053ba8f3" +dependencies = [ + "bytecount", + "memchr", + "nom", +] + +[[package]] +name = "non-empty-vec" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ceeba69aa8d4c53cdceeac8f17eb2656bb88b468bbe6c0889d34edfdea26ec8b" +dependencies = [ + "serde", +] + +[[package]] +name = "num-traits" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c" +dependencies = [ + "autocfg", +] + +[[package]] +name = "num_cpus" +version = "1.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" +dependencies = [ + "hermit-abi", + "libc", +] + +[[package]] +name = "object" +version = "0.32.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6a622008b6e321afc04970976f62ee297fdbaa6f95318ca343e3eebb9648441" +dependencies = [ + "crc32fast", + "hashbrown 0.14.3", + "indexmap 2.1.0", + "memchr", +] + +[[package]] +name = "object-pool" +version = "0.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee9a3e7196d09ec86002b939f1576e8e446d58def8fd48fe578e2c72d5328d68" +dependencies = [ + "parking_lot 0.11.2", +] + +[[package]] +name = "once_cell" +version = "1.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" + +[[package]] +name = "opaque-debug" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" + +[[package]] +name = "parking_lot" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99" +dependencies = [ + "instant", + "lock_api", + "parking_lot_core 0.8.6", +] + +[[package]] +name = "parking_lot" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" +dependencies = [ + "lock_api", + "parking_lot_core 0.9.9", +] + +[[package]] +name = "parking_lot_core" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60a2cfe6f0ad2bfc16aefa463b497d5c7a5ecd44a23efa72aa342d90177356dc" +dependencies = [ + "cfg-if", + "instant", + "libc", + "redox_syscall 0.2.16", + "smallvec", + "winapi", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c42a9226546d68acdd9c0a280d17ce19bfe27a46bf68784e4066115788d008e" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall 0.4.1", + "smallvec", + "windows-targets 0.48.5", +] + +[[package]] +name = "paste" +version = "1.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c" + +[[package]] +name = "percent-encoding" +version = "2.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" + +[[package]] +name = "petgraph" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1d3afd2628e69da2be385eb6f2fd57c8ac7977ceeff6dc166ff1657b0e386a9" +dependencies = [ + "fixedbitset", + "indexmap 2.1.0", +] + +[[package]] +name = "phf_shared" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6796ad771acdc0123d2a88dc428b5e38ef24456743ddb1744ed628f9815c096" +dependencies = [ + "siphasher", +] + +[[package]] +name = "pico-args" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5be167a7af36ee22fe3115051bc51f6e6c7054c9348e28deb4f49bd6f705a315" + +[[package]] +name = "pin-project-lite" +version = "0.2.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58" + +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + +[[package]] +name = "pkcs8" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7" +dependencies = [ + "der", + "spki", +] + +[[package]] +name = "pkg-config" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69d3587f8a9e599cc7ec2c00e331f71c4e69a5f9a4b8a6efd5b07466b9736f9a" + +[[package]] +name = "platforms" +version = "3.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "14e6ab3f592e6fb464fc9712d8d6e6912de6473954635fd76a589d832cffcbb0" + +[[package]] +name = "polyplets" +version = "0.6.0" +dependencies = [ + "marine-call-parameters 0.12.0", + "serde", +] + +[[package]] +name = "powerfmt" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" + +[[package]] +name = "ppv-lite86" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" + +[[package]] +name = "precomputed-hash" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c" + +[[package]] +name = "proc-macro-crate" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d6ea3c4595b96363c13943497db34af4460fb474a95c43f4446ad341b8c9785" +dependencies = [ + "toml", +] + +[[package]] +name = "proc-macro-crate" +version = "1.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f4c021e1093a56626774e81216a4ce732a735e5bad4868a03f3ed65ca0c3919" +dependencies = [ + "once_cell", + "toml_edit", +] + +[[package]] +name = "proc-macro-error" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" +dependencies = [ + "proc-macro-error-attr", + "proc-macro2", + "quote", + "syn 1.0.109", + "version_check", +] + +[[package]] +name = "proc-macro-error-attr" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" +dependencies = [ + "proc-macro2", + "quote", + "version_check", +] + +[[package]] +name = "proc-macro2" +version = "1.0.78" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2422ad645d89c99f8f3e6b88a9fdeca7fabeac836b1002371c4367c8f984aae" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "psm" +version = "0.1.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5787f7cda34e3033a72192c018bc5883100330f362ef279a8cbccfce8bb4e874" +dependencies = [ + "cc", +] + +[[package]] +name = "ptr_meta" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0738ccf7ea06b608c10564b31debd4f5bc5e197fc8bfe088f68ae5ce81e7a4f1" +dependencies = [ + "ptr_meta_derive", +] + +[[package]] +name = "ptr_meta_derive" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16b845dbfca988fa33db069c0e230574d15a3088f147a87b64c7589eb662c9ac" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "pulldown-cmark" +version = "0.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57206b407293d2bcd3af849ce869d52068623f19e1b5ff8e8778e3309439682b" +dependencies = [ + "bitflags 2.4.1", + "memchr", + "unicase", +] + +[[package]] +name = "quick-protobuf" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d6da84cc204722a989e01ba2f6e1e276e190f22263d0cb6ce8526fcdb0d2e1f" +dependencies = [ + "byteorder", +] + +[[package]] +name = "quote" +version = "1.0.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "radium" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09" + +[[package]] +name = "rand" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +dependencies = [ + "libc", + "rand_chacha", + "rand_core", +] + +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core", +] + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom", +] + +[[package]] +name = "rayon" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c27db03db7734835b3f53954b534c91069375ce6ccaa2e065441e07d9b6cdb1" +dependencies = [ + "either", + "rayon-core", +] + +[[package]] +name = "rayon-core" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ce3fb6ad83f861aac485e76e1985cd109d9a3713802152be56c3b1f0e0658ed" +dependencies = [ + "crossbeam-deque", + "crossbeam-utils", +] + +[[package]] +name = "redox_syscall" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" +dependencies = [ + "bitflags 1.3.2", +] + +[[package]] +name = "redox_syscall" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" +dependencies = [ + "bitflags 1.3.2", +] + +[[package]] +name = "redox_users" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a18479200779601e498ada4e8c1e1f50e3ee19deb0259c25825a98b5603b2cb4" +dependencies = [ + "getrandom", + "libredox", + "thiserror", +] + +[[package]] +name = "regalloc2" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad156d539c879b7a24a363a2016d77961786e71f48f2e2fc8302a92abd2429a6" +dependencies = [ + "hashbrown 0.13.2", + "log", + "rustc-hash", + "slice-group-by", + "smallvec", +] + +[[package]] +name = "regex" +version = "1.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "380b951a9c5e80ddfd6136919eef32310721aa4aacd4889a8d39124b026ab343" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata", + "regex-syntax 0.8.2", +] + +[[package]] +name = "regex-automata" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f804c7828047e88b2d32e2d7fe5a105da8ee3264f01902f796c8e067dc2483f" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax 0.8.2", +] + +[[package]] +name = "regex-syntax" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dbb5fb1acd8a1a18b3dd5be62d25485eb770e05afb408a9627d14d451bae12da" + +[[package]] +name = "regex-syntax" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" + +[[package]] +name = "rend" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "71fe3824f5629716b1589be05dacd749f6aa084c87e00e016714a8cdfccc997c" +dependencies = [ + "bytecheck", +] + +[[package]] +name = "ring" +version = "0.16.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3053cf52e236a3ed746dfc745aa9cacf1b791d846bdaf412f60a8d7d6e17c8fc" +dependencies = [ + "cc", + "libc", + "once_cell", + "spin 0.5.2", + "untrusted 0.7.1", + "web-sys", + "winapi", +] + +[[package]] +name = "ring" +version = "0.17.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "688c63d65483050968b2a8937f7995f443e27041a0f7700aa59b0822aedebb74" +dependencies = [ + "cc", + "getrandom", + "libc", + "spin 0.9.8", + "untrusted 0.9.0", + "windows-sys 0.48.0", +] + +[[package]] +name = "ripemd" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd124222d17ad93a644ed9d011a40f4fb64aa54275c08cc216524a9ea82fb09f" +dependencies = [ + "digest 0.10.7", +] + +[[package]] +name = "rkyv" +version = "0.7.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5cba464629b3394fc4dbc6f940ff8f5b4ff5c7aef40f29166fd4ad12acbc99c0" +dependencies = [ + "bitvec", + "bytecheck", + "bytes", + "hashbrown 0.12.3", + "ptr_meta", + "rend", + "rkyv_derive", + "seahash", + "tinyvec", + "uuid", +] + +[[package]] +name = "rkyv_derive" +version = "0.7.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7dddfff8de25e6f62b9d64e6e432bf1c6736c57d20323e15ee10435fbda7c65" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "rmp" +version = "0.8.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f9860a6cc38ed1da53456442089b4dfa35e7cedaa326df63017af88385e6b20" +dependencies = [ + "byteorder", + "num-traits", + "paste", +] + +[[package]] +name = "rmp-serde" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bffea85eea980d8a74453e5d02a8d93028f3c34725de143085a844ebe953258a" +dependencies = [ + "byteorder", + "rmp", + "serde", +] + +[[package]] +name = "rustc-demangle" +version = "0.1.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" + +[[package]] +name = "rustc-hash" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" + +[[package]] +name = "rustc_version" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c5f5376ea5e30ce23c03eb77cbe4962b988deead10910c372b226388b594c084" +dependencies = [ + "semver 0.1.20", +] + +[[package]] +name = "rustc_version" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" +dependencies = [ + "semver 1.0.20", +] + +[[package]] +name = "rustix" +version = "0.38.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72e572a5e8ca657d7366229cdde4bd14c4eb5499a9573d4d366fe1b599daa316" +dependencies = [ + "bitflags 2.4.1", + "errno", + "itoa", + "libc", + "linux-raw-sys", + "once_cell", + "windows-sys 0.52.0", +] + +[[package]] +name = "rustversion" +version = "1.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4" + +[[package]] +name = "ryu" +version = "1.0.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f98d2aa92eebf49b69786be48e4477826b256916e84a57ff2a4f21923b48eb4c" + +[[package]] +name = "safe-transmute" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "98a01dab6acf992653be49205bdd549f32f17cb2803e8eacf1560bf97259aae8" + +[[package]] +name = "scopeguard" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" + +[[package]] +name = "seahash" +version = "4.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c107b6f4780854c8b126e228ea8869f4d7b71260f962fefb57b996b8959ba6b" + +[[package]] +name = "semver" +version = "0.1.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4f410fedcf71af0345d7607d246e7ad15faaadd49d240ee3b24e5dc21a820ac" + +[[package]] +name = "semver" +version = "1.0.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "836fa6a3e1e547f9a2c4040802ec865b5d85f4014efe00555d7090a3dcaa1090" +dependencies = [ + "serde", +] + +[[package]] +name = "serde" +version = "1.0.196" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "870026e60fa08c69f064aa766c10f10b1d62db9ccd4d0abb206472bee0ce3b32" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_bytes" +version = "0.11.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b8497c313fd43ab992087548117643f6fcd935cbf36f176ffda0aacf9591734" +dependencies = [ + "serde", +] + +[[package]] +name = "serde_derive" +version = "1.0.196" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33c85360c95e7d137454dc81d9a4ed2b8efd8fbe19cee57357b32b9771fccb67" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.48", +] + +[[package]] +name = "serde_json" +version = "1.0.108" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d1c7e3eac408d115102c4c24ad393e0821bb3a5df4d506a80f85f7a742a526b" +dependencies = [ + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "serde_with" +version = "2.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07ff71d2c147a7b57362cead5e22f772cd52f6ab31cfcd9edcd7f6aeb2a0afbe" +dependencies = [ + "base64 0.13.1", + "chrono", + "hex", + "indexmap 1.9.3", + "serde", + "serde_json", + "serde_with_macros", + "time", +] + +[[package]] +name = "serde_with_macros" +version = "2.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "881b6f881b17d13214e5d494c939ebab463d01264ce1811e9d4ac3a882e7695f" +dependencies = [ + "darling", + "proc-macro2", + "quote", + "syn 2.0.48", +] + +[[package]] +name = "sha1" +version = "0.10.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest 0.10.7", +] + +[[package]] +name = "sha2" +version = "0.9.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4d58a1e1bf39749807d89cf2d98ac2dfa0ff1cb3faa38fbb64dd88ac8013d800" +dependencies = [ + "block-buffer 0.9.0", + "cfg-if", + "cpufeatures", + "digest 0.9.0", + "opaque-debug", +] + +[[package]] +name = "sha2" +version = "0.10.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest 0.10.7", +] + +[[package]] +name = "sha3" +version = "0.10.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75872d278a8f37ef87fa0ddbda7802605cb18344497949862c0d4dcb291eba60" +dependencies = [ + "digest 0.10.7", + "keccak", +] + +[[package]] +name = "shellexpand" +version = "2.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ccc8076840c4da029af4f87e4e8daeb0fca6b87bbb02e10cb60b791450e11e4" +dependencies = [ + "dirs", +] + +[[package]] +name = "signature" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de" +dependencies = [ + "rand_core", +] + +[[package]] +name = "simdutf8" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f27f6278552951f1f2b8cf9da965d10969b2efdea95a6ec47987ab46edfe263a" + +[[package]] +name = "siphasher" +version = "0.3.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38b58827f4464d87d377d175e90bf58eb00fd8716ff0a62f80356b5e61555d0d" + +[[package]] +name = "slab" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" +dependencies = [ + "autocfg", +] + +[[package]] +name = "slice-group-by" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "826167069c09b99d56f31e9ae5c99049e932a98c9dc2dac47645b08dbbf76ba7" + +[[package]] +name = "smallvec" +version = "1.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4dccd0940a2dcdf68d092b8cbab7dc0ad8fa938bf95787e1b916b0e3d0e8e970" + +[[package]] +name = "socket2" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b5fac59a5cb5dd637972e5fca70daf0523c9067fcdc4842f053dae04a18f8e9" +dependencies = [ + "libc", + "windows-sys 0.48.0", +] + +[[package]] +name = "spin" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" + +[[package]] +name = "spin" +version = "0.9.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" + +[[package]] +name = "spki" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d91ed6c858b01f942cd56b37a94b3e0a1798290327d1236e4d9cf4eaca44d29d" +dependencies = [ + "base64ct", + "der", +] + +[[package]] +name = "sptr" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b9b39299b249ad65f3b7e96443bad61c02ca5cd3589f46cb6d610a0fd6c0d6a" + +[[package]] +name = "stable_deref_trait" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" + +[[package]] +name = "string_cache" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f91138e76242f575eb1d3b38b4f1362f10d3a43f47d182a5b359af488a02293b" +dependencies = [ + "new_debug_unreachable", + "once_cell", + "parking_lot 0.12.1", + "phf_shared", + "precomputed-hash", +] + +[[package]] +name = "strobe-rs" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fabb238a1cccccfa4c4fb703670c0d157e1256c1ba695abf1b93bd2bb14bab2d" +dependencies = [ + "bitflags 1.3.2", + "byteorder", + "keccak", + "subtle", + "zeroize", +] + +[[package]] +name = "strsim" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" + +[[package]] +name = "strum" +version = "0.24.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "063e6045c0e62079840579a7e47a355ae92f60eb74daaf156fb1e84ba164e63f" +dependencies = [ + "strum_macros", +] + +[[package]] +name = "strum_macros" +version = "0.24.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e385be0d24f186b4ce2f9982191e7101bb737312ad61c1f2f984f34bcf85d59" +dependencies = [ + "heck 0.4.1", + "proc-macro2", + "quote", + "rustversion", + "syn 1.0.109", +] + +[[package]] +name = "subtle" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc" + +[[package]] +name = "syn" +version = "1.0.109" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "syn" +version = "2.0.48" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f3531638e407dfc0814761abb7c00a5b54992b849452a0646b7f65c9f770f3f" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "synstructure" +version = "0.12.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f36bdaa60a83aca3921b5259d5400cbf5e90fc51931376a9bd4a0eb79aa7210f" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", + "unicode-xid", +] + +[[package]] +name = "system-interface" +version = "0.26.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0682e006dd35771e392a6623ac180999a9a854b1d4a6c12fb2e804941c2b1f58" +dependencies = [ + "bitflags 2.4.1", + "cap-fs-ext", + "cap-std", + "fd-lock", + "io-lifetimes", + "rustix", + "windows-sys 0.52.0", + "winx", +] + +[[package]] +name = "tap" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" + +[[package]] +name = "target-lexicon" +version = "0.12.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "14c39fd04924ca3a864207c66fc2cd7d22d7c016007f9ce846cbb9326331930a" + +[[package]] +name = "term" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c59df8ac95d96ff9bede18eb7300b0fda5e5d8d90960e76f8e14ae765eedbf1f" +dependencies = [ + "dirs-next", + "rustversion", + "winapi", +] + +[[package]] +name = "termcolor" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff1bc3d3f05aff0403e8ac0d92ced918ec05b666a43f83297ccef5bea8a3d449" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "thiserror" +version = "1.0.51" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f11c217e1416d6f036b870f14e0413d480dbf28edbee1f877abaf0206af43bb7" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.51" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "01742297787513b79cf8e29d1056ede1313e2420b7b3b15d0a768b4921f549df" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.48", +] + +[[package]] +name = "time" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f657ba42c3f86e7680e53c8cd3af8abbe56b5491790b46e22e19c0d57463583e" +dependencies = [ + "deranged", + "itoa", + "powerfmt", + "serde", + "time-core", + "time-macros", +] + +[[package]] +name = "time-core" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" + +[[package]] +name = "time-macros" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26197e33420244aeb70c3e8c78376ca46571bc4e701e4791c2cd9f57dcb3a43f" +dependencies = [ + "time-core", +] + +[[package]] +name = "tiny-keccak" +version = "2.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c9d3793400a45f954c52e73d068316d76b6f4e36977e3fcebb13a2721e80237" +dependencies = [ + "crunchy", +] + +[[package]] +name = "tinyvec" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" +dependencies = [ + "tinyvec_macros", +] + +[[package]] +name = "tinyvec_macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" + +[[package]] +name = "tokio" +version = "1.36.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61285f6515fa018fb2d1e46eb21223fff441ee8db5d0f1435e8ab4f5cdb80931" +dependencies = [ + "backtrace", + "bytes", + "libc", + "mio", + "num_cpus", + "pin-project-lite", + "socket2", + "tokio-macros", + "windows-sys 0.48.0", +] + +[[package]] +name = "tokio-macros" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.48", +] + +[[package]] +name = "toml" +version = "0.5.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4f7f0dd8d50a853a531c426359045b1998f04219d88799810762cd4ad314234" +dependencies = [ + "serde", +] + +[[package]] +name = "toml_datetime" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3550f4e9685620ac18a50ed434eb3aec30db8ba93b0287467bca5826ea25baf1" + +[[package]] +name = "toml_edit" +version = "0.19.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" +dependencies = [ + "indexmap 2.1.0", + "toml_datetime", + "winnow", +] + +[[package]] +name = "tracing" +version = "0.1.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" +dependencies = [ + "log", + "pin-project-lite", + "tracing-attributes", + "tracing-core", +] + +[[package]] +name = "tracing-attributes" +version = "0.1.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.48", +] + +[[package]] +name = "tracing-core" +version = "0.1.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" +dependencies = [ + "once_cell", +] + +[[package]] +name = "typed-index-collections" +version = "3.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "183496e014253d15abbe6235677b1392dba2d40524c88938991226baa38ac7c4" + +[[package]] +name = "typenum" +version = "1.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" + +[[package]] +name = "unicase" +version = "2.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7d2d4dafb69621809a81864c9c1b864479e1235c0dd4e199924b9742439ed89" +dependencies = [ + "version_check", +] + +[[package]] +name = "unicode-bidi" +version = "0.3.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f2528f27a9eb2b21e69c95319b30bd0efd85d09c379741b0f78ea1d86be2416" + +[[package]] +name = "unicode-ident" +version = "1.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" + +[[package]] +name = "unicode-normalization" +version = "0.1.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921" +dependencies = [ + "tinyvec", +] + +[[package]] +name = "unicode-segmentation" +version = "1.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1dd624098567895118886609431a7c3b8f516e41d30e0643f03d94592a147e36" + +[[package]] +name = "unicode-width" +version = "0.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e51733f11c9c4f72aa0c160008246859e340b00807569a0da0e7a1079b27ba85" + +[[package]] +name = "unicode-xid" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" + +[[package]] +name = "unsigned-varint" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6889a77d49f1f013504cec6bf97a2c730394adedaeb1deb5ea08949a50541105" + +[[package]] +name = "unsigned-varint" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eb066959b24b5196ae73cb057f45598450d2c5f71460e98c49b738086eff9c06" + +[[package]] +name = "untrusted" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" + +[[package]] +name = "untrusted" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" + +[[package]] +name = "url" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "31e6302e3bb753d46e83516cae55ae196fc0c309407cf11ab35cc51a4c2a4633" +dependencies = [ + "form_urlencoded", + "idna", + "percent-encoding", +] + +[[package]] +name = "utf8parse" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" + +[[package]] +name = "uuid" +version = "1.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f00cc9702ca12d3c81455259621e676d0f7251cec66a21e98fe2e9a37db93b2a" + +[[package]] +name = "variant_count" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aae2faf80ac463422992abf4de234731279c058aaf33171ca70277c98406b124" +dependencies = [ + "quote", + "syn 1.0.109", +] + +[[package]] +name = "version_check" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" + +[[package]] +name = "walrus" +version = "0.20.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c03529cd0c4400a2449f640d2f27cd1b48c3065226d15e26d98e4429ab0adb7" +dependencies = [ + "anyhow", + "gimli 0.26.2", + "id-arena", + "leb128", + "log", + "walrus-macro", + "wasm-encoder 0.29.0", + "wasmparser 0.80.2", +] + +[[package]] +name = "walrus-macro" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0a6e5bd22c71e77d60140b0bd5be56155a37e5bd14e24f5f87298040d0cc40d7" +dependencies = [ + "heck 0.3.3", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "wasi" +version = "0.11.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" + +[[package]] +name = "wasi-cap-std-sync" +version = "13.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77c4db6155e71cfae4ed732d87c2583faf4bbdcb77372697eb77d636f46108ba" +dependencies = [ + "anyhow", + "async-trait", + "cap-fs-ext", + "cap-rand", + "cap-std", + "cap-time-ext", + "fs-set-times", + "io-extras", + "io-lifetimes", + "is-terminal", + "once_cell", + "rustix", + "system-interface", + "tracing", + "wasi-common", + "windows-sys 0.48.0", +] + +[[package]] +name = "wasi-common" +version = "13.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf3f291b2a567f266ac488715f1742f62b2ca633524708c62ead9c0f71b7d72c" +dependencies = [ + "anyhow", + "bitflags 2.4.1", + "cap-rand", + "cap-std", + "io-extras", + "log", + "rustix", + "thiserror", + "tracing", + "wasmtime", + "wiggle", + "windows-sys 0.48.0", +] + +[[package]] +name = "wasm-bindgen" +version = "0.2.89" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ed0d4f68a3015cc185aff4db9506a015f4b96f95303897bfa23f846db54064e" +dependencies = [ + "cfg-if", + "wasm-bindgen-macro", +] + +[[package]] +name = "wasm-bindgen-backend" +version = "0.2.89" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b56f625e64f3a1084ded111c4d5f477df9f8c92df113852fa5a374dbda78826" +dependencies = [ + "bumpalo", + "log", + "once_cell", + "proc-macro2", + "quote", + "syn 2.0.48", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.89" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0162dbf37223cd2afce98f3d0785506dcb8d266223983e4b5b525859e6e182b2" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.89" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0eb82fcb7930ae6219a7ecfd55b217f5f0893484b7a13022ebb2b2bf20b5283" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.48", + "wasm-bindgen-backend", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.89" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ab9b36309365056cd639da3134bf87fa8f3d86008abf99e612384a6eecd459f" + +[[package]] +name = "wasm-encoder" +version = "0.29.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "18c41dbd92eaebf3612a39be316540b8377c871cb9bde6b064af962984912881" +dependencies = [ + "leb128", +] + +[[package]] +name = "wasm-encoder" +version = "0.32.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ba64e81215916eaeb48fee292f29401d69235d62d8b8fd92a7b2844ec5ae5f7" +dependencies = [ + "leb128", +] + +[[package]] +name = "wasm-encoder" +version = "0.38.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ad2b51884de9c7f4fe2fd1043fccb8dcad4b1e29558146ee57a144d15779f3f" +dependencies = [ + "leb128", +] + +[[package]] +name = "wasmer-interface-types-fl" +version = "0.28.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a753426d5a76076aa16a435b5a5f316e3803461f551975d196928bc92e42916" +dependencies = [ + "anyhow", + "fluence-it-types", + "futures", + "it-lilo", + "it-memory-traits", + "it-to-bytes", + "itertools", + "log", + "nom", + "paste", + "safe-transmute", + "semver 1.0.20", + "serde", + "serde_json", + "thiserror", + "wast 8.0.0", +] + +[[package]] +name = "wasmparser" +version = "0.80.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "449167e2832691a1bff24cde28d2804e90e09586a448c8e76984792c44334a6b" + +[[package]] +name = "wasmparser" +version = "0.101.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf2f22ef84ac5666544afa52f326f13e16f3d019d2e61e704fd8091c9358b130" +dependencies = [ + "indexmap 1.9.3", + "url", +] + +[[package]] +name = "wasmparser" +version = "0.112.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e986b010f47fcce49cf8ea5d5f9e5d2737832f12b53ae8ae785bbe895d0877bf" +dependencies = [ + "indexmap 2.1.0", + "semver 1.0.20", +] + +[[package]] +name = "wasmparser" +version = "0.121.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9dbe55c8f9d0dbd25d9447a5a889ff90c0cc3feaa7395310d3d826b2c703eaab" +dependencies = [ + "bitflags 2.4.1", + "indexmap 2.1.0", + "semver 1.0.20", +] + +[[package]] +name = "wasmprinter" +version = "0.2.80" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60e73986a6b7fdfedb7c5bf9e7eb71135486507c8fbc4c0c42cffcb6532988b7" +dependencies = [ + "anyhow", + "wasmparser 0.121.2", +] + +[[package]] +name = "wasmtime" +version = "13.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0263693caa1486bd4d26a5f18511948a706c9290689386b81b851ce088063ce" +dependencies = [ + "anyhow", + "async-trait", + "bincode", + "bumpalo", + "cfg-if", + "encoding_rs", + "fxprof-processed-profile", + "indexmap 2.1.0", + "libc", + "log", + "object", + "once_cell", + "paste", + "psm", + "rayon", + "serde", + "serde_derive", + "serde_json", + "target-lexicon", + "wasm-encoder 0.32.0", + "wasmparser 0.112.0", + "wasmtime-cache", + "wasmtime-component-macro", + "wasmtime-component-util", + "wasmtime-cranelift", + "wasmtime-environ", + "wasmtime-fiber", + "wasmtime-jit", + "wasmtime-runtime", + "wasmtime-winch", + "wat", + "windows-sys 0.48.0", +] + +[[package]] +name = "wasmtime-asm-macros" +version = "13.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4711e5969236ecfbe70c807804ff9ffb5206c1dbb5c55c5e8200d9f7e8e76adf" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "wasmtime-cache" +version = "13.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b79f9f79188e5a26b6911b79d3171c06699d9a17ae07f6a265c51635b8d80c2" +dependencies = [ + "anyhow", + "base64 0.21.7", + "bincode", + "directories-next", + "log", + "rustix", + "serde", + "serde_derive", + "sha2 0.10.8", + "toml", + "windows-sys 0.48.0", + "zstd", +] + +[[package]] +name = "wasmtime-component-macro" +version = "13.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed724d0f41c21bcf8754651a59d0423c530069ddca4cf3822768489ad313a812" +dependencies = [ + "anyhow", + "proc-macro2", + "quote", + "syn 2.0.48", + "wasmtime-component-util", + "wasmtime-wit-bindgen", + "wit-parser", +] + +[[package]] +name = "wasmtime-component-util" +version = "13.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e7d69464b94bd312a27d93d0b482cd74bedf01f030199ef0740d6300ebca1d3" + +[[package]] +name = "wasmtime-cranelift" +version = "13.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e63f53c61ba05eb815f905c1738ad82c95333dd42ef5a8cc2aa3d7dfb2b08d7" +dependencies = [ + "anyhow", + "cfg-if", + "cranelift-codegen", + "cranelift-control", + "cranelift-entity", + "cranelift-frontend", + "cranelift-native", + "cranelift-wasm", + "gimli 0.28.1", + "log", + "object", + "target-lexicon", + "thiserror", + "wasmparser 0.112.0", + "wasmtime-cranelift-shared", + "wasmtime-environ", + "wasmtime-versioned-export-macros", +] + +[[package]] +name = "wasmtime-cranelift-shared" +version = "13.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4f6b197d68612f7dc3a17aa9f9587533715ecb8b4755609ce9baf7fb92b74ddc" +dependencies = [ + "anyhow", + "cranelift-codegen", + "cranelift-control", + "cranelift-native", + "gimli 0.28.1", + "object", + "target-lexicon", + "wasmtime-environ", +] + +[[package]] +name = "wasmtime-environ" +version = "13.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "18e2558c8b04fd27764d8601d46b8dc39555b79720a41e626bce210a80758932" +dependencies = [ + "anyhow", + "cranelift-entity", + "gimli 0.28.1", + "indexmap 2.1.0", + "log", + "object", + "serde", + "serde_derive", + "target-lexicon", + "thiserror", + "wasm-encoder 0.32.0", + "wasmparser 0.112.0", + "wasmprinter", + "wasmtime-component-util", + "wasmtime-types", +] + +[[package]] +name = "wasmtime-fiber" +version = "13.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a615a2cf64a49c0dc659c7d850c6cd377b975e0abfdcf0888b282d274a82e730" +dependencies = [ + "cc", + "cfg-if", + "rustix", + "wasmtime-asm-macros", + "wasmtime-versioned-export-macros", + "windows-sys 0.48.0", +] + +[[package]] +name = "wasmtime-jit" +version = "13.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd775514b8034b85b0323bfdc60abb1c28d27dbf6e22aad083ed57dac95cf72e" +dependencies = [ + "addr2line", + "anyhow", + "bincode", + "cfg-if", + "cpp_demangle", + "gimli 0.28.1", + "ittapi", + "log", + "object", + "rustc-demangle", + "rustix", + "serde", + "serde_derive", + "target-lexicon", + "wasmtime-environ", + "wasmtime-jit-debug", + "wasmtime-jit-icache-coherence", + "wasmtime-runtime", + "windows-sys 0.48.0", +] + +[[package]] +name = "wasmtime-jit-debug" +version = "13.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c054e27c6ce2a6191edabe89e646da013044dd5369e1d203c89f977f9bd32937" +dependencies = [ + "object", + "once_cell", + "rustix", + "wasmtime-versioned-export-macros", +] + +[[package]] +name = "wasmtime-jit-icache-coherence" +version = "13.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f323977cddf4a262d1b856366b665c5b4d01793c57b79fb42505b9fd9e61e5b" +dependencies = [ + "cfg-if", + "libc", + "windows-sys 0.48.0", +] + +[[package]] +name = "wasmtime-runtime" +version = "13.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29e26461bba043f73cb4183f4ce0d606c0eaac112475867b11e5ea36fe1cac8e" +dependencies = [ + "anyhow", + "cc", + "cfg-if", + "encoding_rs", + "indexmap 2.1.0", + "libc", + "log", + "mach", + "memfd", + "memoffset", + "paste", + "rand", + "rustix", + "sptr", + "wasm-encoder 0.32.0", + "wasmtime-asm-macros", + "wasmtime-environ", + "wasmtime-fiber", + "wasmtime-jit-debug", + "wasmtime-versioned-export-macros", + "wasmtime-wmemcheck", + "windows-sys 0.48.0", +] + +[[package]] +name = "wasmtime-types" +version = "13.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6fd7e9b29fee64eea5058cb5e7cb3480b52c2f1312d431d16ea8617ceebeb421" +dependencies = [ + "cranelift-entity", + "serde", + "serde_derive", + "thiserror", + "wasmparser 0.112.0", +] + +[[package]] +name = "wasmtime-versioned-export-macros" +version = "13.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6362c557c36d8ad4aaab735f14ed9e4f78d6b40ec85a02a88fd859af87682e52" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.48", +] + +[[package]] +name = "wasmtime-wasi" +version = "13.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52c9e79f73320d96cd7644b021502dffee09dd92300b073f3541ae44e9ae377c" +dependencies = [ + "anyhow", + "async-trait", + "bitflags 2.4.1", + "bytes", + "cap-fs-ext", + "cap-net-ext", + "cap-rand", + "cap-std", + "cap-time-ext", + "fs-set-times", + "futures", + "io-extras", + "io-lifetimes", + "is-terminal", + "libc", + "once_cell", + "rustix", + "system-interface", + "thiserror", + "tokio", + "tracing", + "wasi-cap-std-sync", + "wasi-common", + "wasmtime", + "wiggle", + "windows-sys 0.48.0", +] + +[[package]] +name = "wasmtime-winch" +version = "13.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa5fc7212424c04c01a20bfa66c4c518e8749dde6546f5e05815dcacbec80723" +dependencies = [ + "anyhow", + "cranelift-codegen", + "gimli 0.28.1", + "object", + "target-lexicon", + "wasmparser 0.112.0", + "wasmtime-cranelift-shared", + "wasmtime-environ", + "winch-codegen", +] + +[[package]] +name = "wasmtime-wit-bindgen" +version = "13.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dcc03bd58f77a68dc6a0b2ba2f8e64b1f902b50389d21bbcc690ef2f3bb87198" +dependencies = [ + "anyhow", + "heck 0.4.1", + "indexmap 2.1.0", + "wit-parser", +] + +[[package]] +name = "wasmtime-wmemcheck" +version = "13.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e485bf54eba675ca615f8f55788d3a8cd44e7bd09b8b4011edc22c2c41d859e" + +[[package]] +name = "wast" +version = "8.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9df3d716118a503b2f6bbb6ff46b21997ab0cc167b01de7a188e45e4b01e8d" +dependencies = [ + "leb128", +] + +[[package]] +name = "wast" +version = "35.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ef140f1b49946586078353a453a1d28ba90adfc54dde75710bc1931de204d68" +dependencies = [ + "leb128", +] + +[[package]] +name = "wast" +version = "69.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1ee37317321afde358e4d7593745942c48d6d17e0e6e943704de9bbee121e7a" +dependencies = [ + "leb128", + "memchr", + "unicode-width", + "wasm-encoder 0.38.1", +] + +[[package]] +name = "wat" +version = "1.0.82" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aeb338ee8dee4d4cd05e6426683f21c5087dc7cfc8903e839ccf48d43332da3c" +dependencies = [ + "wast 69.0.1", +] + +[[package]] +name = "web-sys" +version = "0.3.66" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50c24a44ec86bb68fbecd1b3efed7e85ea5621b39b35ef2766b66cd984f8010f" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "wiggle" +version = "13.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e81ddbdc400b38d04241d740d0406ef343bd242c460f252fe59f29ad964ad24c" +dependencies = [ + "anyhow", + "async-trait", + "bitflags 2.4.1", + "thiserror", + "tracing", + "wasmtime", + "wiggle-macro", +] + +[[package]] +name = "wiggle-generate" +version = "13.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c993123d6db1a1908ef8352aabdf2e681a3dcdedc3656beb747e4db16d3cf08" +dependencies = [ + "anyhow", + "heck 0.4.1", + "proc-macro2", + "quote", + "shellexpand", + "syn 2.0.48", + "witx", +] + +[[package]] +name = "wiggle-macro" +version = "13.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "476e3e09bc68e82624b70a322265515523754cb9e05fcacceabd216e276bc2ed" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.48", + "wiggle-generate", +] + +[[package]] +name = "winapi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + +[[package]] +name = "winapi-util" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f29e6f9198ba0d26b4c9f07dbe6f9ed633e1f3d5b8b414090084349e46a52596" +dependencies = [ + "winapi", +] + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + +[[package]] +name = "winch-codegen" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9b01ca6722f7421c9cdbe4c9b62342ce864d0a9e8736d56dac717a86b1a65ae" +dependencies = [ + "anyhow", + "cranelift-codegen", + "gimli 0.28.1", + "regalloc2", + "smallvec", + "target-lexicon", + "wasmparser 0.112.0", + "wasmtime-environ", +] + +[[package]] +name = "windows-core" +version = "0.51.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1f8cf84f35d2db49a46868f947758c7a1138116f7fac3bc844f43ade1292e64" +dependencies = [ + "windows-targets 0.48.5", +] + +[[package]] +name = "windows-sys" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" +dependencies = [ + "windows-targets 0.48.5", +] + +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets 0.52.0", +] + +[[package]] +name = "windows-targets" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" +dependencies = [ + "windows_aarch64_gnullvm 0.48.5", + "windows_aarch64_msvc 0.48.5", + "windows_i686_gnu 0.48.5", + "windows_i686_msvc 0.48.5", + "windows_x86_64_gnu 0.48.5", + "windows_x86_64_gnullvm 0.48.5", + "windows_x86_64_msvc 0.48.5", +] + +[[package]] +name = "windows-targets" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a18201040b24831fbb9e4eb208f8892e1f50a37feb53cc7ff887feb8f50e7cd" +dependencies = [ + "windows_aarch64_gnullvm 0.52.0", + "windows_aarch64_msvc 0.52.0", + "windows_i686_gnu 0.52.0", + "windows_i686_msvc 0.52.0", + "windows_x86_64_gnu 0.52.0", + "windows_x86_64_gnullvm 0.52.0", + "windows_x86_64_msvc 0.52.0", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb7764e35d4db8a7921e09562a0304bf2f93e0a51bfccee0bd0bb0b666b015ea" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbaa0368d4f1d2aaefc55b6fcfee13f41544ddf36801e793edbbfd7d7df075ef" + +[[package]] +name = "windows_i686_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a28637cb1fa3560a16915793afb20081aba2c92ee8af57b4d5f28e4b3e7df313" + +[[package]] +name = "windows_i686_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffe5e8e31046ce6230cc7215707b816e339ff4d4d67c65dffa206fd0f7aa7b9a" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d6fa32db2bc4a2f5abeacf2b69f7992cd09dca97498da74a151a3132c26befd" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a657e1e9d3f514745a572a6846d3c7aa7dbe1658c056ed9c3344c4109a6949e" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" + +[[package]] +name = "winnow" +version = "0.5.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b5c3db89721d50d0e2a673f5043fc4722f76dcc352d7b1ab8b8288bed4ed2c5" +dependencies = [ + "memchr", +] + +[[package]] +name = "winx" +version = "0.36.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9643b83820c0cd246ecabe5fa454dd04ba4fa67996369466d0747472d337346" +dependencies = [ + "bitflags 2.4.1", + "windows-sys 0.52.0", +] + +[[package]] +name = "wit-parser" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a39edca9abb16309def3843af73b58d47d243fe33a9ceee572446bcc57556b9a" +dependencies = [ + "anyhow", + "id-arena", + "indexmap 2.1.0", + "log", + "pulldown-cmark", + "semver 1.0.20", + "serde", + "serde_json", + "unicode-xid", + "url", +] + +[[package]] +name = "witx" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e366f27a5cabcddb2706a78296a40b8fcc451e1a6aba2fc1d94b4a01bdaaef4b" +dependencies = [ + "anyhow", + "log", + "thiserror", + "wast 35.0.2", +] + +[[package]] +name = "wyz" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05f360fc0b24296329c78fda852a1e9ae82de9cf7b27dae4b7f62f118f77b9ed" +dependencies = [ + "tap", +] + +[[package]] +name = "zerocopy" +version = "0.7.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c4061bedbb353041c12f413700357bec76df2c7e2ca8e4df8bac24c6bf68e3d" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.7.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b3c129550b3e6de3fd0ba67ba5c81818f9805e58b8d7fee80a3a59d2c9fc601a" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.48", +] + +[[package]] +name = "zeroize" +version = "1.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "525b4ec142c6b68a2d10f01f7bbf6755599ca3f81ea53b8431b7dd348f5fdb2d" +dependencies = [ + "zeroize_derive", +] + +[[package]] +name = "zeroize_derive" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.48", +] + +[[package]] +name = "zstd" +version = "0.11.2+zstd.1.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20cc960326ece64f010d2d2107537f26dc589a6573a316bd5b1dba685fa5fde4" +dependencies = [ + "zstd-safe", +] + +[[package]] +name = "zstd-safe" +version = "5.0.2+zstd.1.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d2a5585e04f9eea4b2a3d1eca508c4dee9592a89ef6f450c11719da0726f4db" +dependencies = [ + "libc", + "zstd-sys", +] + +[[package]] +name = "zstd-sys" +version = "2.0.9+zstd.1.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e16efa8a874a0481a574084d34cc26fdb3b99627480f785888deb6386506656" +dependencies = [ + "cc", + "pkg-config", +] From 4fbea148aeb0731c6e0d2b0534bcb77098478aed Mon Sep 17 00:00:00 2001 From: Valery Antopol Date: Tue, 20 Feb 2024 14:40:36 +0400 Subject: [PATCH 12/14] fix + fmt after merge --- Cargo.lock | 1 + .../features/signatures/attacks.rs | 12 ++-- .../features/signatures/runtime.rs | 21 ++++--- air/tests/test_module/issues/issue_632.rs | 2 +- avm/server/src/avm.rs | 12 +++- .../test-utils/src/native_test_runner.rs | 5 +- crates/air-lib/test-utils/src/test_runner.rs | 5 +- .../test-utils/src/wasm_test_runner.rs | 16 +++-- .../src/ephemeral/neighborhood.rs | 58 +++++++++++-------- crates/testing-framework/src/execution/mod.rs | 19 +++--- .../testing-framework/src/transform/walker.rs | 45 ++++++++------ tools/cli/air/src/data.rs | 3 +- tools/cli/air/src/trace/run/native.rs | 16 ++--- 13 files changed, 138 insertions(+), 77 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e2d0076b28..b675066f00 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -492,6 +492,7 @@ dependencies = [ "atty", "avm-data-store", "avm-interface", + "avm-server", "bs58 0.5.0", "clap 4.4.11", "eyre", diff --git a/air/tests/test_module/features/signatures/attacks.rs b/air/tests/test_module/features/signatures/attacks.rs index 2f34c1e05d..eea1e6e8eb 100644 --- a/air/tests/test_module/features/signatures/attacks.rs +++ b/air/tests/test_module/features/signatures/attacks.rs @@ -80,7 +80,8 @@ async fn test_attack_injection_current_peer_scalar() { Version::new(1, 1, 1), ); - let mut alice_avm = create_avm_with_key::(alice_keypair, unit_call_service(), <_>::default()).await; + let mut alice_avm = + create_avm_with_key::(alice_keypair, unit_call_service(), <_>::default()).await; let test_run_params = TestRunParameters::from_init_peer_id(alice_peer_id); let prev_data = alice_data.serialize().unwrap(); let cur_data = mallory_data.serialize().unwrap(); @@ -152,7 +153,8 @@ async fn test_attack_injection_current_peer_stream() { Version::new(1, 1, 1), ); - let mut alice_avm = create_avm_with_key::(alice_keypair, unit_call_service(), <_>::default()).await; + let mut alice_avm = + create_avm_with_key::(alice_keypair, unit_call_service(), <_>::default()).await; let test_run_params = TestRunParameters::from_init_peer_id(alice_peer_id); let prev_data = alice_data.serialize().unwrap(); let cur_data = mallory_data.serialize().unwrap(); @@ -222,7 +224,8 @@ async fn test_attack_injection_current_injection_unused() { Version::new(1, 1, 1), ); - let mut alice_avm = create_avm_with_key::(alice_keypair, unit_call_service(), <_>::default()).await; + let mut alice_avm = + create_avm_with_key::(alice_keypair, unit_call_service(), <_>::default()).await; let test_run_params = TestRunParameters::from_init_peer_id(alice_peer_id); let prev_data = alice_data.serialize().unwrap(); let cur_data = mallory_data.serialize().unwrap(); @@ -434,7 +437,8 @@ async fn test_attack_replay() { let mut alice_avm = create_avm_with_key::(alice_keypair.clone(), unit_call_service(), <_>::default()).await; - let mut bob_avm = create_avm_with_key::(bob_keypair.clone(), unit_call_service(), <_>::default()).await; + let mut bob_avm = + create_avm_with_key::(bob_keypair.clone(), unit_call_service(), <_>::default()).await; let run_params1 = TestRunParameters::from_init_peer_id(&alice_peer_id).with_particle_id("first_particle"); let run_params2 = run_params1.clone(); diff --git a/air/tests/test_module/features/signatures/runtime.rs b/air/tests/test_module/features/signatures/runtime.rs index 9df8ef3809..120063d1cd 100644 --- a/air/tests/test_module/features/signatures/runtime.rs +++ b/air/tests/test_module/features/signatures/runtime.rs @@ -47,9 +47,11 @@ async fn test_runtime_executed_call_argument_hash() { "# ); - let mut alice_avm = create_avm_with_key::(alice_keypair, echo_call_service(), <_>::default()).await; + let mut alice_avm = + create_avm_with_key::(alice_keypair, echo_call_service(), <_>::default()).await; let mut bob_avm = create_avm_with_key::(bob_keypair, echo_call_service(), <_>::default()).await; - let mut mallory_avm = create_avm_with_key::(mallory_keypair, echo_call_service(), <_>::default()).await; + let mut mallory_avm = + create_avm_with_key::(mallory_keypair, echo_call_service(), <_>::default()).await; let alice_res = alice_avm .call(&air_script, "", "", test_run_params.clone()) @@ -110,9 +112,11 @@ async fn test_runtime_executed_call_tetraplet() { "# ); - let mut alice_avm = create_avm_with_key::(alice_keypair, echo_call_service(), <_>::default()).await; + let mut alice_avm = + create_avm_with_key::(alice_keypair, echo_call_service(), <_>::default()).await; let mut bob_avm = create_avm_with_key::(bob_keypair, echo_call_service(), <_>::default()).await; - let mut mallory_avm = create_avm_with_key::(mallory_keypair, echo_call_service(), <_>::default()).await; + let mut mallory_avm = + create_avm_with_key::(mallory_keypair, echo_call_service(), <_>::default()).await; let alice_res = alice_avm .call(&air_script, "", "", test_run_params.clone()) @@ -194,7 +198,8 @@ async fn test_runtime_executed_failed_argument_hash() { let mut alice_avm = create_avm_with_key::(alice_keypair, fallible_call_service_by_arg(43), <_>::default()).await; let mut bob_avm = create_avm_with_key::(bob_keypair, echo_call_service(), <_>::default()).await; - let mut mallory_avm = create_avm_with_key::(mallory_keypair, echo_call_service(), <_>::default()).await; + let mut mallory_avm = + create_avm_with_key::(mallory_keypair, echo_call_service(), <_>::default()).await; let alice_res = alice_avm .call(&air_script, "", "", test_run_params.clone()) @@ -262,7 +267,8 @@ async fn test_runtime_failed_call_tetraplet() { let mut alice_avm = create_avm_with_key::(alice_keypair, fallible_call_service("service1"), <_>::default()).await; let mut bob_avm = create_avm_with_key::(bob_keypair, echo_call_service(), <_>::default()).await; - let mut mallory_avm = create_avm_with_key::(mallory_keypair, echo_call_service(), <_>::default()).await; + let mut mallory_avm = + create_avm_with_key::(mallory_keypair, echo_call_service(), <_>::default()).await; let alice_res = alice_avm .call(&air_script, "", "", test_run_params.clone()) @@ -342,7 +348,8 @@ async fn test_runtime_canon_tetraplet() { let mut alice_avm = create_avm_with_key::(alice_keypair, fallible_call_service("service1"), <_>::default()).await; let mut bob_avm = create_avm_with_key::(bob_keypair, echo_call_service(), <_>::default()).await; - let mut mallory_avm = create_avm_with_key::(mallory_keypair, echo_call_service(), <_>::default()).await; + let mut mallory_avm = + create_avm_with_key::(mallory_keypair, echo_call_service(), <_>::default()).await; let alice_res = alice_avm .call(&air_script, "", "", test_run_params.clone()) diff --git a/air/tests/test_module/issues/issue_632.rs b/air/tests/test_module/issues/issue_632.rs index 8b5094b84f..b7c56b42ca 100644 --- a/air/tests/test_module/issues/issue_632.rs +++ b/air/tests/test_module/issues/issue_632.rs @@ -37,7 +37,7 @@ async fn issue_310() { ) "#; - let runner = Rc::new(RefCell::new(DefaultAirRunner::new(&peer_id, <_>::default().await)); + let runner = Rc::new(RefCell::new(DefaultAirRunner::new(&peer_id, <_>::default()).await)); let call = |prev_data, call_results| { let runner = runner.clone(); let peer_id = peer_id.clone(); diff --git a/avm/server/src/avm.rs b/avm/server/src/avm.rs index 47f4f4a362..f02dacbbed 100644 --- a/avm/server/src/avm.rs +++ b/avm/server/src/avm.rs @@ -72,9 +72,15 @@ impl AVM { data_store.initialize()?; - let runner = AVMRunner::new(air_wasm_path, max_heap_size, <_>::default(), logging_mask) - .await - .map_err(AVMError::RunnerError)?; + let runner = AVMRunner::new( + air_wasm_path, + max_heap_size, + <_>::default(), + logging_mask, + wasm_backend, + ) + .await + .map_err(AVMError::RunnerError)?; let runner = SendSafeRunner(runner); let avm = Self { runner, data_store }; diff --git a/crates/air-lib/test-utils/src/native_test_runner.rs b/crates/air-lib/test-utils/src/native_test_runner.rs index b69fde18b3..4038870d83 100644 --- a/crates/air-lib/test-utils/src/native_test_runner.rs +++ b/crates/air-lib/test-utils/src/native_test_runner.rs @@ -40,7 +40,10 @@ impl NativeAirRunner { } } impl AirRunner for NativeAirRunner { - fn new(current_peer_id: impl Into, test_init_parameters: TestInitParameters) -> LocalBoxFuture<'static, Self> { + fn new( + current_peer_id: impl Into, + test_init_parameters: TestInitParameters, + ) -> LocalBoxFuture<'static, Self> { let current_peer_id = current_peer_id.into(); async move { Self::new(current_peer_id, test_init_parameters) }.boxed_local() } diff --git a/crates/air-lib/test-utils/src/test_runner.rs b/crates/air-lib/test-utils/src/test_runner.rs index 79502c87ec..9de57123f8 100644 --- a/crates/air-lib/test-utils/src/test_runner.rs +++ b/crates/air-lib/test-utils/src/test_runner.rs @@ -37,7 +37,10 @@ use std::collections::HashMap; use std::collections::HashSet; pub trait AirRunner { - fn new(current_call_id: impl Into, test_init_parameters: TestInitParameters) -> LocalBoxFuture<'static, Self>; + fn new( + current_call_id: impl Into, + test_init_parameters: TestInitParameters, + ) -> LocalBoxFuture<'static, Self>; #[allow(clippy::too_many_arguments)] fn call<'this>( diff --git a/crates/air-lib/test-utils/src/wasm_test_runner.rs b/crates/air-lib/test-utils/src/wasm_test_runner.rs index 322616bcf0..a721955f3b 100644 --- a/crates/air-lib/test-utils/src/wasm_test_runner.rs +++ b/crates/air-lib/test-utils/src/wasm_test_runner.rs @@ -49,7 +49,9 @@ fn create_wasm_backend() -> WasmtimeWasmBackend { WasmtimeWasmBackend::new(config).unwrap() } -async fn make_pooled_avm_runner(test_init_parameters: TestInitParameters) -> AVMRunner { +async fn make_pooled_avm_runner( + test_init_parameters: TestInitParameters, +) -> AVMRunner { let logging_mask = i32::MAX; let wasm_backend = create_wasm_backend(); AVMRunner::new( @@ -64,7 +66,10 @@ async fn make_pooled_avm_runner(test_init_parameters: TestInitParameters) -> AVM } impl AirRunner for WasmAirRunner { - fn new(current_peer_id: impl Into, test_init_parameters: TestInitParameters) -> LocalBoxFuture<'static, Self> { + fn new( + current_peer_id: impl Into, + test_init_parameters: TestInitParameters, + ) -> LocalBoxFuture<'static, Self> { let current_peer_id = current_peer_id.into(); async move { static POOL_CELL: OnceCell>> = @@ -144,9 +149,12 @@ pub struct ReleaseWasmAirRunner { } impl AirRunner for ReleaseWasmAirRunner { - fn new(current_peer_id: impl Into, test_init_parameters: TestInitParameters) -> LocalBoxFuture<'static, Self> { + fn new( + current_peer_id: impl Into, + test_init_parameters: TestInitParameters, + ) -> LocalBoxFuture<'static, Self> { let current_peer_id = current_peer_id.into(); - async { + async move { let logging_mask = i32::MAX; let wasm_backend = create_wasm_backend(); diff --git a/crates/testing-framework/src/ephemeral/neighborhood.rs b/crates/testing-framework/src/ephemeral/neighborhood.rs index 3b7941d380..cc082b2e1a 100644 --- a/crates/testing-framework/src/ephemeral/neighborhood.rs +++ b/crates/testing-framework/src/ephemeral/neighborhood.rs @@ -249,10 +249,11 @@ mod tests { let peer_id = PeerId::from(peer_id); let other_id = PeerId::from(other_id); let network = - Network::::new(std::iter::empty::(), vec![], <_>::default()).await; + Network::::new(std::iter::empty::(), vec![], <_>::default()) + .await; let penv = PeerEnv::new( - Peer::new(peer_pk, Rc::from(vec![]).await, <_>::default()), + Peer::new(peer_pk, Rc::from(vec![]), <_>::default()).await, &network, ); assert!(penv.is_reachable(&peer_id)); @@ -268,10 +269,11 @@ mod tests { let peer_id = PeerId::from(peer_id); let other_id = PeerId::from(other_id); let network = - Network::::new(std::iter::empty::(), vec![], <_>::default()).await; + Network::::new(std::iter::empty::(), vec![], <_>::default()) + .await; let mut penv = PeerEnv::new( - Peer::new(peer_pk, Rc::from(vec![]).await, <_>::default()), + Peer::new(peer_pk, Rc::from(vec![]), <_>::default()).await, &network, ); { @@ -300,10 +302,11 @@ mod tests { let other_id1 = PeerId::from(other_id1); let other_id2 = PeerId::from(other_id2); let network = - Network::::new(std::iter::empty::(), vec![], <_>::default()).await; + Network::::new(std::iter::empty::(), vec![], <_>::default()) + .await; let penv = PeerEnv::new( - Peer::new(peer_pk, Rc::from(vec![]).await, <_>::default()), + Peer::new(peer_pk, Rc::from(vec![]), <_>::default()).await, &network, ); // iter is empty @@ -327,10 +330,11 @@ mod tests { let other_id1 = PeerId::from(other_id1); let other_id2 = PeerId::from(other_id2); let network = - Network::::new(std::iter::empty::(), vec![], <_>::default()).await; + Network::::new(std::iter::empty::(), vec![], <_>::default()) + .await; let penv = PeerEnv::new( - Peer::new(peer_pk, Rc::from(vec![]).await, <_>::default()), + Peer::new(peer_pk, Rc::from(vec![]), <_>::default()).await, &network, ); @@ -354,10 +358,11 @@ mod tests { let other_id1 = PeerId::from(other_id1); let other_id2 = PeerId::from(other_id2); let network = - Network::::new(std::iter::empty::(), vec![], <_>::default()).await; + Network::::new(std::iter::empty::(), vec![], <_>::default()) + .await; let mut penv = PeerEnv::new( - Peer::new(peer_pk, Rc::from(vec![]).await, <_>::default()), + Peer::new(peer_pk, Rc::from(vec![]), <_>::default()).await, &network, ); @@ -379,10 +384,11 @@ mod tests { let (_other_pk1, other_id1) = derive_dummy_keypair(other_name1); let other_id1 = PeerId::from(other_id1); let network = - Network::::new(std::iter::empty::(), vec![], <_>::default()).await; + Network::::new(std::iter::empty::(), vec![], <_>::default()) + .await; let mut penv = PeerEnv::new( - Peer::new(peer_pk, Rc::from(vec![]).await, <_>::default()), + Peer::new(peer_pk, Rc::from(vec![]), <_>::default()).await, &network, ); @@ -403,10 +409,11 @@ mod tests { let (peer_pk, _peer_id) = derive_dummy_keypair(peer_name); let network = - Network::::new(std::iter::empty::(), vec![], <_>::default()).await; + Network::::new(std::iter::empty::(), vec![], <_>::default()) + .await; let mut penv = PeerEnv::new( - Peer::new(peer_pk, Rc::from(vec![]).await, <_>::default()), + Peer::new(peer_pk, Rc::from(vec![]), <_>::default()).await, &network, ); penv.get_neighborhood_mut() @@ -422,11 +429,12 @@ mod tests { #[tokio::test] async fn test_remove_from_neiborhood() { let network = - Network::::new(std::iter::empty::(), vec![], <_>::default()).await; + Network::::new(std::iter::empty::(), vec![], <_>::default()) + .await; let (peer_pk, _peer_id) = derive_dummy_keypair("someone"); let mut penv = PeerEnv::new( - Peer::new(peer_pk, Rc::from(vec![]).await, <_>::default()), + Peer::new(peer_pk, Rc::from(vec![]), <_>::default()).await, &network, ); penv.get_neighborhood_mut() @@ -449,7 +457,8 @@ mod tests { let (_other_pk, other_id) = derive_dummy_keypair(other_name1); let other_id = PeerId::from(other_id); let network = - Network::::new(std::iter::empty::(), vec![], <_>::default()).await; + Network::::new(std::iter::empty::(), vec![], <_>::default()) + .await; let mut penv = PeerEnv::new( Peer::new(peer_pk, Rc::from(vec![]), <_>::default()).await, &network, @@ -472,10 +481,11 @@ mod tests { let (_other_pk, other_id) = derive_dummy_keypair(other_name1); let other_id = PeerId::from(other_id); let network = - Network::::new(std::iter::empty::(), vec![], <_>::default()).await; + Network::::new(std::iter::empty::(), vec![], <_>::default()) + .await; let mut penv = PeerEnv::new( - Peer::new(peer_pk, Rc::from(vec![]).await, <_>::default()), + Peer::new(peer_pk, Rc::from(vec![]), <_>::default()).await, &network, ); @@ -501,9 +511,10 @@ mod tests { let (_other_pk, other_id) = derive_dummy_keypair(other_name1); let other_id = PeerId::from(other_id); let network = - Network::::new(std::iter::empty::(), vec![], <_>::default()).await; + Network::::new(std::iter::empty::(), vec![], <_>::default()) + .await; let mut penv = PeerEnv::new( - Peer::new(peer_pk, Rc::from(vec![]).await, <_>::default()), + Peer::new(peer_pk, Rc::from(vec![]), <_>::default()).await, &network, ); @@ -529,10 +540,11 @@ mod tests { let other_id = PeerId::from(other_id); let remote_id = PeerId::from(remote_id); let network = - Network::::new(std::iter::empty::(), vec![], <_>::default()).await; + Network::::new(std::iter::empty::(), vec![], <_>::default()) + .await; let mut penv = PeerEnv::new( - Peer::new(peer_pk, Rc::from(vec![]).await, <_>::default()), + Peer::new(peer_pk, Rc::from(vec![]), <_>::default()).await, &network, ); penv.get_neighborhood_mut() diff --git a/crates/testing-framework/src/execution/mod.rs b/crates/testing-framework/src/execution/mod.rs index 654db3d974..bb7f7ae88b 100644 --- a/crates/testing-framework/src/execution/mod.rs +++ b/crates/testing-framework/src/execution/mod.rs @@ -71,8 +71,9 @@ impl AirScriptExecutor { ) -> Result { let network = transformed_air_script.get_network(); let init_peer_id = test_parameters.init_peer_id.clone(); - let real_init_peer_id = - network.ensure_named_peer(init_peer_id.as_str(), test_init_parameters).await; + let real_init_peer_id = network + .ensure_named_peer(init_peer_id.as_str(), test_init_parameters) + .await; test_parameters.init_peer_id = real_init_peer_id.to_string(); let queue = ExecutionQueue::new(); @@ -97,7 +98,8 @@ impl AirScriptExecutor { annotated_air_script: &str, ) -> Result { let network = Network::new(extra_peers.into_iter(), common_services, <_>::default()).await; - let transformed = TransformedAirScript::new(annotated_air_script, network, <_>::default()).await?; + let transformed = + TransformedAirScript::new(annotated_air_script, network, <_>::default()).await?; Self::from_transformed_air_script(test_parameters, <_>::default(), transformed).await } @@ -113,6 +115,7 @@ impl AirScriptExecutor { Self::from_transformed_air_script(test_parameters, test_init_parameters, transformed).await } + pub async fn new_with_init_parameters( test_parameters: TestRunParameters, test_init_parameters: TestInitParameters, @@ -124,11 +127,13 @@ impl AirScriptExecutor { extra_peers.into_iter(), common_services, test_init_parameters, - ); + ) + .await; let transformed = TransformedAirScript::new(annotated_air_script, network, test_init_parameters).await?; Self::from_transformed_air_script(test_parameters, test_init_parameters, transformed).await + } /// Return Iterator for handling all the queued datas /// for particular peer_id. @@ -724,7 +729,8 @@ mod tests { async fn test_transformed_distinct() { let peer_name = "peer1"; let network = - Network::::new(std::iter::empty::(), vec![], <_>::default()).await; + Network::::new(std::iter::empty::(), vec![], <_>::default()) + .await; let transformed1 = TransformedAirScript::new( &format!(r#"(call "{peer_name}" ("service" "function") []) ; ok = 42"#), @@ -809,8 +815,7 @@ mod tests { let peer_name = "peer1"; let air_script = format!(r#"(call "{peer_name}" ("service" "function") [])"#); - let transformed1 = - TransformedAirScript::new(&air_script, network.clone(), <_>::default()) + let transformed1 = TransformedAirScript::new(&air_script, network.clone(), <_>::default()) .await .unwrap(); let exectution1 = AirScriptExecutor::from_transformed_air_script( diff --git a/crates/testing-framework/src/transform/walker.rs b/crates/testing-framework/src/transform/walker.rs index 794dbb30e5..1fc2e0933a 100644 --- a/crates/testing-framework/src/transform/walker.rs +++ b/crates/testing-framework/src/transform/walker.rs @@ -82,7 +82,11 @@ struct Transformer<'net, R> { impl Transformer<'_, R> { #[async_recursion::async_recursion(?Send)] - pub(crate) async fn transform(&self, sexp: &mut Sexp, test_init_parameters: TestInitParameters) { + pub(crate) async fn transform( + &self, + sexp: &mut Sexp, + test_init_parameters: TestInitParameters, + ) { match sexp { Sexp::Call(call) => self.handle_call(call, test_init_parameters).await, Sexp::Canon(canon) => self.handle_canon(canon, test_init_parameters).await, @@ -167,18 +171,21 @@ mod tests { #[tokio::test] async fn test_translate_null() { let network = - Network::::new(std::iter::empty::(), vec![], <_>::default()).await; - let transformed = TransformedAirScript::new("(null)", network, <_>::default()).await.unwrap(); + Network::::new(std::iter::empty::(), vec![], <_>::default()) + .await; + let transformed = TransformedAirScript::new("(null)", network, <_>::default()) + .await + .unwrap(); assert_eq!(&*transformed, "(null)"); } #[tokio::test] async fn test_translate_call_no_result() { let network = - Network::::new(std::iter::empty::(), vec![], <_>::default()).await; + Network::::new(std::iter::empty::(), vec![], <_>::default()) + .await; let script = r#"(call peer_id ("service_id" func) [])"#; - let transformed = - TransformedAirScript::new_unvalidated(script, network, <_>::default()) + let transformed = TransformedAirScript::new_unvalidated(script, network, <_>::default()) .await .unwrap(); assert_eq!(&*transformed, script); @@ -188,7 +195,8 @@ mod tests { #[should_panic] async fn test_translate_call_no_string() { let network = - Network::::new(std::iter::empty::(), vec![], <_>::default()).await; + Network::::new(std::iter::empty::(), vec![], <_>::default()) + .await; let script = r#"(call "peer_id" (service_id func) [])"#; let transformed = TransformedAirScript::new(script, network, <_>::default()).await; assert_eq!(transformed.as_deref(), Ok(script)); @@ -197,12 +205,13 @@ mod tests { #[tokio::test] async fn test_translate_call_result() { let network = - Network::::new(std::iter::empty::(), vec![], <_>::default()).await; + Network::::new(std::iter::empty::(), vec![], <_>::default()) + .await; let script = r#"(call "peer_id" ("service_id" func) []) ; ok = 42"#; let transformer = TransformedAirScript::new_unvalidated(script, network.clone(), <_>::default()) - .await - .unwrap(); + .await + .unwrap(); let peer_id = at("peer_id"); @@ -236,11 +245,12 @@ mod tests { ))"#; let network = - Network::::new(std::iter::empty::(), vec![], <_>::default()).await; + Network::::new(std::iter::empty::(), vec![], <_>::default()) + .await; let transformed = TransformedAirScript::new_unvalidated(script, network.clone(), <_>::default()) - .await - .unwrap(); + .await + .unwrap(); assert_eq!( &*transformed, concat!( @@ -280,9 +290,9 @@ mod tests { ))"#; let network = - Network::::new(std::iter::empty::(), vec![], <_>::default()).await; - let t = - TransformedAirScript::new_unvalidated(script, network.clone(), <_>::default()) + Network::::new(std::iter::empty::(), vec![], <_>::default()) + .await; + let t = TransformedAirScript::new_unvalidated(script, network.clone(), <_>::default()) .await .unwrap(); @@ -321,7 +331,8 @@ mod tests { let script = r#"(call "peer_id1" ("service_id" "func") [1 @"peer_id3"] x) ; ok={"test":@"peer_id2"}"#; let network = - Network::::new(std::iter::empty::(), vec![], <_>::default()).await; + Network::::new(std::iter::empty::(), vec![], <_>::default()) + .await; let t = TransformedAirScript::new(script, network.clone(), <_>::default()) .await .unwrap(); diff --git a/tools/cli/air/src/data.rs b/tools/cli/air/src/data.rs index 9a691d8258..c59f0364af 100644 --- a/tools/cli/air/src/data.rs +++ b/tools/cli/air/src/data.rs @@ -82,7 +82,8 @@ pub(crate) async fn to_human_readable_data(args: Args) -> Result<(), Box::default()).await?; + let mut runner = + create_runner(args.mode.into(), &args.air_interpreter_path, <_>::default()).await?; let out = { runner.to_human_readable(data).await? }; println!("{out}"); diff --git a/tools/cli/air/src/trace/run/native.rs b/tools/cli/air/src/trace/run/native.rs index 6b7c3b21af..5b5c053f6b 100644 --- a/tools/cli/air/src/trace/run/native.rs +++ b/tools/cli/air/src/trace/run/native.rs @@ -58,14 +58,14 @@ impl AirRunner for NativeAvmRunner { let raw_call_results = into_raw_result(call_results); let raw_call_results = CallResultsRepr.serialize(&raw_call_results).unwrap(); - let key_format = keypair.key_format().into(); - let secret_key_bytes = keypair.secret().expect("Failed to get secret key"); - let AquaVMRuntimeLimits { - air_size_limit, - particle_size_limit, - call_result_size_limit, - hard_limit_enabled, - } = self.aquavm_runtime_limits; + let key_format = keypair.key_format().into(); + let secret_key_bytes = keypair.secret().expect("Failed to get secret key"); + let AquaVMRuntimeLimits { + air_size_limit, + particle_size_limit, + call_result_size_limit, + hard_limit_enabled, + } = self.aquavm_runtime_limits; let outcome = air::execute_air( air, From d4a222f4975090dbf37162cb431b158a49c14e0f Mon Sep 17 00:00:00 2001 From: Valery Antopol Date: Wed, 27 Mar 2024 23:41:41 +0400 Subject: [PATCH 13/14] fix build with latest marine --- Cargo.lock | 1079 +++-------------- .../tetraplets/security_tetraplets.rs | 6 +- crates/air-lib/test-utils/Cargo.toml | 4 +- tools/cli/air/Cargo.toml | 2 +- 4 files changed, 161 insertions(+), 930 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c12f96b45b..08f9ae625b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -8,62 +8,6 @@ version = "0.11.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fe438c63458706e03479442743baae6c88256498e6431708f6dfc520a26515d3" -[[package]] -name = "actix" -version = "0.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cba56612922b907719d4a01cf11c8d5b458e7d3dba946d0435f20f58d6795ed2" -dependencies = [ - "actix-macros", - "actix-rt", - "actix_derive", - "bitflags 2.4.1", - "bytes", - "crossbeam-channel", - "futures-core", - "futures-sink", - "futures-task", - "futures-util", - "log", - "once_cell", - "parking_lot 0.12.1", - "pin-project-lite", - "smallvec", - "tokio", - "tokio-util 0.7.10", -] - -[[package]] -name = "actix-macros" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e01ed3140b2f8d422c68afa1ed2e85d996ea619c988ac834d255db32138655cb" -dependencies = [ - "quote", - "syn 2.0.48", -] - -[[package]] -name = "actix-rt" -version = "2.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28f32d40287d3f402ae0028a9d54bef51af15c8769492826a69d28f81893151d" -dependencies = [ - "futures-core", - "tokio", -] - -[[package]] -name = "actix_derive" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c7db3d5a9718568e4cf4a537cfd7070e6e6ff7481510d0237fb529ac850f6d3" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.48", -] - [[package]] name = "addr2line" version = "0.21.0" @@ -284,8 +228,11 @@ dependencies = [ "avm-server", "ed25519-dalek 2.1.0", "fluence-keypair", + "futures", "maplit", "marine-rs-sdk", + "marine-wasm-backend-traits", + "marine-wasmtime-backend", "object-pool", "once_cell", "rand_chacha 0.3.1", @@ -293,6 +240,7 @@ dependencies = [ "serde", "serde_json", "sha2 0.10.8", + "tokio", ] [[package]] @@ -302,7 +250,9 @@ dependencies = [ "air-interpreter-signatures", "air-test-utils", "aquavm-air-parser", + "async-recursion", "fluence-keypair", + "futures", "itertools", "maplit", "nom", @@ -310,7 +260,8 @@ dependencies = [ "pretty_assertions 1.4.0", "regex", "serde_json", - "strum", + "strum 0.24.1", + "tokio", ] [[package]] @@ -452,6 +403,7 @@ dependencies = [ "env_logger", "fluence-app-service", "fluence-keypair", + "futures", "log", "maplit", "marine-rs-sdk", @@ -463,9 +415,10 @@ dependencies = [ "semver 1.0.21", "serde", "serde_json", - "strum", - "strum_macros", + "strum 0.24.1", + "strum_macros 0.24.3", "thiserror", + "tokio", "tracing", "typed-index-collections", ] @@ -488,7 +441,9 @@ dependencies = [ "clap 4.4.11", "eyre", "fluence-keypair", + "futures", "itertools", + "marine-wasmtime-backend", "near-sdk", "semver 1.0.21", "serde", @@ -528,9 +483,6 @@ name = "arbitrary" version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7d5a26814d8dcb93b0e5a0ff3c6d80a8843bafb21b39e8e18a6f05471870e110" -dependencies = [ - "derive_arbitrary", -] [[package]] name = "arrayref" @@ -673,6 +625,17 @@ dependencies = [ "windows-sys 0.48.0", ] +[[package]] +name = "async-recursion" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "30c5ef0ede93efbf733c1a727f3b6b5a1060bbedd5600183e66f6e4be4af0ec5" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.48", +] + [[package]] name = "async-signal" version = "0.2.5" @@ -691,28 +654,6 @@ dependencies = [ "windows-sys 0.48.0", ] -[[package]] -name = "async-stream" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd56dd203fef61ac097dd65721a419ddccb106b2d2b70ba60a6b529f03961a51" -dependencies = [ - "async-stream-impl", - "futures-core", - "pin-project-lite", -] - -[[package]] -name = "async-stream-impl" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.48", -] - [[package]] name = "async-task" version = "4.6.0" @@ -793,11 +734,14 @@ dependencies = [ "log", "maplit", "marine-runtime", + "marine-wasm-backend-traits", + "marine-wasmtime-backend", "parking_lot 0.12.1", "polyplets", "serde", "serde_json", "thiserror", + "tokio", "tracing", ] @@ -1019,7 +963,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4114279215a005bc675e386011e594e1d9b800918cea18fcadadcce864a2046b" dependencies = [ "borsh-derive 0.10.3", - "hashbrown 0.13.2", + "hashbrown 0.11.2", ] [[package]] @@ -1743,16 +1687,6 @@ dependencies = [ "itertools", ] -[[package]] -name = "crossbeam-channel" -version = "0.5.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14c3242926edf34aec4ac3a77108ad4854bffaa2e4ddc1824124ce59231302d5" -dependencies = [ - "cfg-if 1.0.0", - "crossbeam-utils", -] - [[package]] name = "crossbeam-deque" version = "0.8.4" @@ -2014,17 +1948,6 @@ dependencies = [ "syn 1.0.109", ] -[[package]] -name = "derive_arbitrary" -version = "1.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67e77553c4162a157adbf834ebae5b415acbecbeafc7a74b0e886657506a7611" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.48", -] - [[package]] name = "derive_more" version = "0.99.17" @@ -2141,12 +2064,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "dyn-clone" -version = "1.0.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "545b22097d44f8a9581187cdf93de7a71e4722bf51200cfaba810865b49a495d" - [[package]] name = "easy-ext" version = "0.2.9" @@ -2226,26 +2143,6 @@ dependencies = [ "cfg-if 1.0.0", ] -[[package]] -name = "enum-map" -version = "2.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6866f3bfdf8207509a033af1a75a7b08abda06bbaaeae6669323fd5a097df2e9" -dependencies = [ - "enum-map-derive", -] - -[[package]] -name = "enum-map-derive" -version = "0.17.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f282cfdfe92516eb26c2af8589c274c7c17681f5ecc03c18255fe741c6aa64eb" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.48", -] - [[package]] name = "env_logger" version = "0.7.1" @@ -2428,9 +2325,8 @@ dependencies = [ [[package]] name = "fluence-app-service" -version = "0.34.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e95950035a16589b5ed736ee920839e475b864965b4e4061e2bc1faaf58f1f2" +version = "0.35.2" +source = "git+https://github.com/fluencelabs/marine?branch=feat/async-call#e8d89e3de1f21e0678e3722e2e1e31ba74fba2ac" dependencies = [ "log", "maplit", @@ -2553,12 +2449,13 @@ checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" [[package]] name = "futures" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da0290714b38af9b4a7b094b8a37086d1b4e61f2df9122c3cad2577669145335" +checksum = "645c6916888f6cb6350d2550b80fb63e734897a8498abe35cfb732b6487804b0" dependencies = [ "futures-channel", "futures-core", + "futures-executor", "futures-io", "futures-sink", "futures-task", @@ -2567,9 +2464,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff4dd66668b557604244583e3e1e1eada8c5c2e96a6d0d6653ede395b78bbacb" +checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78" dependencies = [ "futures-core", "futures-sink", @@ -2577,15 +2474,15 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb1d22c66e66d9d72e1758f0bd7d4fd0bee04cad842ee34587d68c07e45d088c" +checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" [[package]] name = "futures-executor" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f4fb8693db0cf099eadcca0efe2a5a22e4550f98ed16aba6c48700da29597bc" +checksum = "a576fc72ae164fca6b9db127eaa9a9dda0d61316034f33a0a0d4eda41f02b01d" dependencies = [ "futures-core", "futures-task", @@ -2594,9 +2491,9 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8bf34a163b5c4c52d0478a4d757da8fb65cabef42ba90515efee0f6f9fa45aaa" +checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1" [[package]] name = "futures-lite" @@ -2623,27 +2520,39 @@ dependencies = [ "pin-project-lite", ] +[[package]] +name = "futures-macro" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.48", +] + [[package]] name = "futures-sink" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e36d3378ee38c2a36ad710c5d30c2911d752cb941c00c72dbabfb786a7970817" +checksum = "9fb8e00e87438d937621c1c6269e53f536c14d3fbd6a042bb24879e57d474fb5" [[package]] name = "futures-task" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "efd193069b0ddadc69c46389b740bbccdd97203899b48d09c5f7969591d6bae2" +checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004" [[package]] name = "futures-util" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a19526d624e703a3179b3d322efec918b6246ea0fa51d41124525f00f1cc8104" +checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48" dependencies = [ "futures-channel", "futures-core", "futures-io", + "futures-macro", "futures-sink", "futures-task", "memchr", @@ -2743,7 +2652,7 @@ dependencies = [ "indexmap 2.1.0", "slab", "tokio", - "tokio-util 0.7.10", + "tokio-util", "tracing", ] @@ -2830,9 +2739,6 @@ name = "hex" version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" -dependencies = [ - "serde", -] [[package]] name = "hkdf" @@ -2942,25 +2848,13 @@ dependencies = [ "httpdate", "itoa", "pin-project-lite", - "socket2 0.5.5", + "socket2 0.4.10", "tokio", "tower-service", "tracing", "want", ] -[[package]] -name = "hyper-timeout" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbb958482e8c7be4bc3cf272a766a2b0bf1a6755e7a6ae777f017a31d11b13b1" -dependencies = [ - "hyper", - "pin-project-lite", - "tokio", - "tokio-io-timeout", -] - [[package]] name = "hyper-tls" version = "0.5.0" @@ -3112,8 +3006,7 @@ dependencies = [ [[package]] name = "it-json-serde" version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a74b6ed688d9de56b4e4cb5aca2bd7a883909f1be8d8d6ba40e3a2d25b9feba5" +source = "git+https://github.com/fluencelabs/marine?branch=feat/async-call#e8d89e3de1f21e0678e3722e2e1e31ba74fba2ac" dependencies = [ "serde", "serde_derive", @@ -3124,12 +3017,14 @@ dependencies = [ [[package]] name = "it-lilo" -version = "0.6.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20108e77e11eeb1ef019f54c3868e0f2e9227295502f0702fa2e7e730ea748f8" +checksum = "1fa7310e6ce8b8b6f11c3d0b5dd5824675fab3cfd335f70bcf9a51198de39cfe" dependencies = [ "anyhow", + "async-recursion", "fluence-it-types", + "futures", "it-memory-traits", "log", "paste", @@ -3138,9 +3033,9 @@ dependencies = [ [[package]] name = "it-memory-traits" -version = "0.4.0" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d563f2a6baee17cf471b7951dfb96ab17fecc5e8947de39f1057cf3fb4cc906d" +checksum = "e83089981169d53e2b13df7c8d132b471bf2fc4c85afe427c4a74115695c4612" dependencies = [ "thiserror", ] @@ -3204,12 +3099,6 @@ dependencies = [ "wasm-bindgen", ] -[[package]] -name = "json_comments" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9dbbfed4e59ba9750e15ba154fdfd9329cee16ff3df539c2666b70f58cc32105" - [[package]] name = "keccak" version = "0.1.4" @@ -3256,9 +3145,6 @@ name = "lazy_static" version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" -dependencies = [ - "spin 0.5.2", -] [[package]] name = "leb128" @@ -3454,12 +3340,12 @@ dependencies = [ [[package]] name = "marine-core" -version = "0.29.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81f40fac4650a022a2ce8d7b6df5614062fc32cb25fb44e61027997e90a3aff6" +version = "0.30.0" +source = "git+https://github.com/fluencelabs/marine?branch=feat/async-call#e8d89e3de1f21e0678e3722e2e1e31ba74fba2ac" dependencies = [ "anyhow", "bytesize", + "futures", "it-lilo", "it-memory-traits", "log", @@ -3483,9 +3369,8 @@ dependencies = [ [[package]] name = "marine-it-generator" -version = "0.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23bdd0119dc71f98e2f0a4bef305e43b9a4d9b9adbead12bc05b0fac1d5a247c" +version = "0.17.0" +source = "git+https://github.com/fluencelabs/marine?branch=feat/async-call#e8d89e3de1f21e0678e3722e2e1e31ba74fba2ac" dependencies = [ "it-lilo", "marine-it-parser", @@ -3501,8 +3386,7 @@ dependencies = [ [[package]] name = "marine-it-interfaces" version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c610d90a031911c17b2babc32c9fad7261bae6ab0bf118051cd665b5d9bcfbe" +source = "git+https://github.com/fluencelabs/marine?branch=feat/async-call#e8d89e3de1f21e0678e3722e2e1e31ba74fba2ac" dependencies = [ "multimap 0.8.3", "wasmer-interface-types-fl", @@ -3510,9 +3394,8 @@ dependencies = [ [[package]] name = "marine-it-parser" -version = "0.15.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "921afa7f139791b24c4cb91c918d1ef7411ef40c3b801309ec43f6b2c89b107b" +version = "0.16.0" +source = "git+https://github.com/fluencelabs/marine?branch=feat/async-call#e8d89e3de1f21e0678e3722e2e1e31ba74fba2ac" dependencies = [ "anyhow", "itertools", @@ -3622,8 +3505,7 @@ dependencies = [ [[package]] name = "marine-min-it-version" version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "147e6e4c9d3dc9afbb06b2e3bc069b63c749733f698d0c364c320a72b133f1d5" +source = "git+https://github.com/fluencelabs/marine?branch=feat/async-call#e8d89e3de1f21e0678e3722e2e1e31ba74fba2ac" dependencies = [ "once_cell", "semver 1.0.21", @@ -3631,9 +3513,8 @@ dependencies = [ [[package]] name = "marine-module-info-parser" -version = "0.14.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b312830884d07fc495a43e867d9641163897f0b0b047842cf1172cc61f57075" +version = "0.15.0" +source = "git+https://github.com/fluencelabs/marine?branch=feat/async-call#e8d89e3de1f21e0678e3722e2e1e31ba74fba2ac" dependencies = [ "anyhow", "chrono", @@ -3649,8 +3530,7 @@ dependencies = [ [[package]] name = "marine-module-interface" version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d92d2243bf0d3aea6401d9e57a1ee17677b624337981322e0153cc2d54744080" +source = "git+https://github.com/fluencelabs/marine?branch=feat/async-call#e8d89e3de1f21e0678e3722e2e1e31ba74fba2ac" dependencies = [ "anyhow", "itertools", @@ -3718,9 +3598,8 @@ dependencies = [ [[package]] name = "marine-runtime" -version = "0.35.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c599c7c13e976170a1211e31fe2fb4557e0479cbdba331b19a5a9e87f145f52" +version = "0.36.2" +source = "git+https://github.com/fluencelabs/marine?branch=feat/async-call#e8d89e3de1f21e0678e3722e2e1e31ba74fba2ac" dependencies = [ "bytesize", "it-json-serde", @@ -3742,7 +3621,7 @@ dependencies = [ "serde", "serde_derive", "serde_json", - "serde_with 2.3.3", + "serde_with", "thiserror", "toml", "wasmer-interface-types-fl", @@ -3761,16 +3640,15 @@ dependencies = [ [[package]] name = "marine-utils" version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fce56bfabfd0af5326ff81c32c8d2261aa03b10e00ea6c165de4ebf8a3f998e4" +source = "git+https://github.com/fluencelabs/marine?branch=feat/async-call#e8d89e3de1f21e0678e3722e2e1e31ba74fba2ac" [[package]] name = "marine-wasm-backend-traits" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "220bc47cfabb8b4ab97bf2bd7bbab9738857b69beeda0a1ac5776c600b64bb46" +version = "0.6.0" +source = "git+https://github.com/fluencelabs/marine?branch=feat/async-call#e8d89e3de1f21e0678e3722e2e1e31ba74fba2ac" dependencies = [ "anyhow", + "futures", "it-memory-traits", "multimap 0.8.3", "paste", @@ -3781,11 +3659,11 @@ dependencies = [ [[package]] name = "marine-wasmtime-backend" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aaa0dc5a7da0e3334f3ce5b341ba4354341af9a1f9efae24884a1b931efdf23e" +version = "0.6.0" +source = "git+https://github.com/fluencelabs/marine?branch=feat/async-call#e8d89e3de1f21e0678e3722e2e1e31ba74fba2ac" dependencies = [ "anyhow", + "futures", "it-memory-traits", "log", "marine-wasm-backend-traits", @@ -4005,18 +3883,6 @@ dependencies = [ "tempfile", ] -[[package]] -name = "near-abi" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4ac4e2d843390b1a007ad206022b4252d0fe3756d8b6609bc025cce07949bc5" -dependencies = [ - "borsh 1.1.2", - "schemars", - "semver 1.0.21", - "serde", -] - [[package]] name = "near-account-id" version = "0.15.0" @@ -4029,22 +3895,11 @@ dependencies = [ [[package]] name = "near-account-id" -version = "0.17.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc0cb40869cab7f5232f934f45db35bffe0f2d2a7cb0cd0346202fbe4ebf2dd7" -dependencies = [ - "borsh 0.10.3", - "serde", -] - -[[package]] -name = "near-account-id" -version = "1.0.0-alpha.4" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d10d45a9c49c3e975c362cf4d1dc1d7b72a716b30394bea56ee2a8fb225f50b7" +checksum = "35cbb989542587b47205e608324ddd391f0cee1c22b4b64ae49f458334b95907" dependencies = [ "borsh 1.1.2", - "schemars", "serde", ] @@ -4057,8 +3912,8 @@ dependencies = [ "anyhow", "chrono", "derive_more", - "near-crypto 0.15.0", - "near-primitives 0.15.0", + "near-crypto", + "near-primitives", "num-rational", "serde", "serde_json", @@ -4067,18 +3922,6 @@ dependencies = [ "tracing", ] -[[package]] -name = "near-config-utils" -version = "0.17.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5523e7dce493c45bc3241eb3100d943ec471852f9b1f84b46a34789eadf17031" -dependencies = [ - "anyhow", - "json_comments", - "thiserror", - "tracing", -] - [[package]] name = "near-crypto" version = "0.15.0" @@ -4097,49 +3940,13 @@ dependencies = [ "once_cell", "primitive-types", "rand 0.7.3", - "secp256k1 0.24.3", - "serde", - "serde_json", - "subtle", - "thiserror", -] - -[[package]] -name = "near-crypto" -version = "0.17.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff6b382b626e7e0cd372d027c6672ac97b4b6ee6114288c9e58d8180b935d315" -dependencies = [ - "blake2", - "borsh 0.10.3", - "bs58 0.4.0", - "c2-chacha", - "curve25519-dalek 3.2.0", - "derive_more", - "ed25519-dalek 1.0.1", - "hex 0.4.3", - "near-account-id 0.17.0", - "near-config-utils", - "near-stdx", - "once_cell", - "primitive-types", - "rand 0.7.3", - "secp256k1 0.27.0", + "secp256k1", "serde", "serde_json", "subtle", "thiserror", ] -[[package]] -name = "near-fmt" -version = "0.17.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c44c842c6cfcd9b8c387cccd4cd0619a5f21920cde5d5c292af3cc5d40510672" -dependencies = [ - "near-primitives-core 0.17.0", -] - [[package]] name = "near-gas" version = "0.2.5" @@ -4147,7 +3954,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "14e75c875026229902d065e4435804497337b631ec69ba746b102954273e9ad1" dependencies = [ "borsh 1.1.2", - "schemars", "serde", ] @@ -4161,9 +3967,9 @@ dependencies = [ "lazy_static", "log", "near-chain-configs", - "near-crypto 0.15.0", + "near-crypto", "near-jsonrpc-primitives", - "near-primitives 0.15.0", + "near-primitives", "reqwest", "serde", "serde_json", @@ -4178,45 +3984,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ada226c74f05508c516f109a97b9f23335120d0bfda208f0d187b6bbfe6eef5a" dependencies = [ "near-chain-configs", - "near-crypto 0.15.0", - "near-primitives 0.15.0", - "near-rpc-error-macro 0.15.0", + "near-crypto", + "near-primitives", + "near-rpc-error-macro", "serde", "serde_json", "thiserror", ] [[package]] -name = "near-o11y" -version = "0.17.0" +name = "near-primitives" +version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af7d35397b02b131c188c72f3885e97daeccab134ec2fc8cc0073a94cf1cfe19" -dependencies = [ - "actix", - "atty", - "clap 4.4.11", - "near-crypto 0.17.0", - "near-primitives-core 0.17.0", - "once_cell", - "opentelemetry", - "opentelemetry-otlp", - "opentelemetry-semantic-conventions", - "prometheus", - "serde", - "strum", - "thiserror", - "tokio", - "tracing", - "tracing-appender", - "tracing-opentelemetry", - "tracing-subscriber", -] - -[[package]] -name = "near-primitives" -version = "0.15.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97670b302dce15f09bba50f24c67aa08130fd01528cc61d4415892401e88e974" +checksum = "97670b302dce15f09bba50f24c67aa08130fd01528cc61d4415892401e88e974" dependencies = [ "borsh 0.9.3", "byteorder", @@ -4226,10 +4006,10 @@ dependencies = [ "derive_more", "easy-ext", "hex 0.4.3", - "near-crypto 0.15.0", - "near-primitives-core 0.15.0", - "near-rpc-error-macro 0.15.0", - "near-vm-errors 0.15.0", + "near-crypto", + "near-primitives-core", + "near-rpc-error-macro", + "near-vm-errors", "num-rational", "once_cell", "primitive-types", @@ -4238,45 +4018,8 @@ dependencies = [ "serde", "serde_json", "smart-default", - "strum", - "thiserror", -] - -[[package]] -name = "near-primitives" -version = "0.17.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05f7051aaf199adc4d068620fca6d5f70f906a1540d03a8bb3701271f8881835" -dependencies = [ - "arbitrary", - "borsh 0.10.3", - "bytesize", - "cfg-if 1.0.0", - "chrono", - "derive_more", - "easy-ext", - "enum-map", - "hex 0.4.3", - "near-crypto 0.17.0", - "near-fmt", - "near-primitives-core 0.17.0", - "near-rpc-error-macro 0.17.0", - "near-stdx", - "near-vm-errors 0.17.0", - "num-rational", - "once_cell", - "primitive-types", - "rand 0.8.5", - "reed-solomon-erasure", - "serde", - "serde_json", - "serde_with 3.4.0", - "serde_yaml", - "smart-default", - "strum", + "strum 0.24.1", "thiserror", - "time 0.3.30", - "tracing", ] [[package]] @@ -4294,29 +4037,7 @@ dependencies = [ "serde", "serde_repr", "sha2 0.10.8", - "strum", -] - -[[package]] -name = "near-primitives-core" -version = "0.17.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "775fec19ef51a341abdbf792a9dda5b4cb89f488f681b2fd689b9321d24db47b" -dependencies = [ - "arbitrary", - "base64 0.21.5", - "borsh 0.10.3", - "bs58 0.4.0", - "derive_more", - "enum-map", - "near-account-id 0.17.0", - "num-rational", - "serde", - "serde_repr", - "serde_with 3.4.0", - "sha2 0.10.8", - "strum", - "thiserror", + "strum 0.24.1", ] [[package]] @@ -4330,40 +4051,17 @@ dependencies = [ "syn 1.0.109", ] -[[package]] -name = "near-rpc-error-core" -version = "0.17.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84c1eda300e2e78f4f945ae58117d49e806899f4a51ee2faa09eda5ebc2e6571" -dependencies = [ - "quote", - "serde", - "syn 2.0.48", -] - [[package]] name = "near-rpc-error-macro" version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b5beb352f3b91d8c491646c2fa4fdbbbf463c7b9c0226951c28f0197de44f99" dependencies = [ - "near-rpc-error-core 0.15.0", + "near-rpc-error-core", "serde", "syn 1.0.109", ] -[[package]] -name = "near-rpc-error-macro" -version = "0.17.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31d2dadd765101c77e664029dd6fbec090e696877d4ae903c620d02ceda4969a" -dependencies = [ - "fs2", - "near-rpc-error-core 0.17.0", - "serde", - "syn 2.0.48", -] - [[package]] name = "near-sandbox-utils" version = "0.6.2" @@ -4381,25 +4079,19 @@ dependencies = [ [[package]] name = "near-sdk" -version = "5.0.0-alpha.1" +version = "5.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62385d178cbf20d7b62277e0ffe5d65b133989994240b2789d5510fa7de332da" +checksum = "b5c2e7c9524308b1b301cca05d875de13b3b20dc8b92e71f3890b380372e4c88" dependencies = [ - "base64 0.13.1", + "base64 0.21.5", "borsh 1.1.2", - "bs58 0.4.0", - "near-abi", - "near-account-id 1.0.0-alpha.4", - "near-crypto 0.17.0", + "bs58 0.5.0", + "near-account-id 1.0.0", "near-gas", - "near-primitives 0.17.0", - "near-primitives-core 0.17.0", "near-sdk-macros", "near-sys", "near-token", - "near-vm-logic", "once_cell", - "schemars", "serde", "serde_json", "wee_alloc", @@ -4407,9 +4099,9 @@ dependencies = [ [[package]] name = "near-sdk-macros" -version = "5.0.0-alpha.1" +version = "5.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d00f960e5f28e8b5a223de7ba35f494c094c213c7b50f94927713a93736013dd" +checksum = "e1e9b23d9d7757ade258921c9cbc7923542e64d9d3b52a6cd91f746c77cb0a0f" dependencies = [ "Inflector", "darling", @@ -4417,17 +4109,11 @@ dependencies = [ "quote", "serde", "serde_json", - "strum", - "strum_macros", + "strum 0.26.2", + "strum_macros 0.26.2", "syn 2.0.48", ] -[[package]] -name = "near-stdx" -version = "0.17.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6540152fba5e96fe5d575b79e8cd244cf2add747bb01362426bdc069bc3a23bc" - [[package]] name = "near-sys" version = "0.2.1" @@ -4441,7 +4127,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7b68f3f8a2409f72b43efdbeff8e820b81e70824c49fee8572979d789d1683fb" dependencies = [ "borsh 1.1.2", - "schemars", "serde", ] @@ -4453,46 +4138,9 @@ checksum = "5591c9c8afa83a040cb5c3f29bc52b2efae2c32d4bcaee1bba723738da1a5cf6" dependencies = [ "borsh 0.9.3", "near-account-id 0.15.0", - "near-rpc-error-macro 0.15.0", - "serde", - "strum", -] - -[[package]] -name = "near-vm-errors" -version = "0.17.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec545d1bede0579e7c15dd2dce9b998dc975c52f2165702ff40bec7ff69728bb" -dependencies = [ - "borsh 0.10.3", - "near-account-id 0.17.0", - "near-rpc-error-macro 0.17.0", - "serde", - "strum", - "thiserror", -] - -[[package]] -name = "near-vm-logic" -version = "0.17.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30d7487c678ed1963a0ecd5033f72bb41caa58debd6fe8025a9bef6e1a6a519a" -dependencies = [ - "borsh 0.10.3", - "ed25519-dalek 1.0.1", - "near-account-id 0.17.0", - "near-crypto 0.17.0", - "near-fmt", - "near-o11y", - "near-primitives 0.17.0", - "near-primitives-core 0.17.0", - "near-stdx", - "near-vm-errors 0.17.0", - "ripemd", + "near-rpc-error-macro", "serde", - "sha2 0.10.8", - "sha3", - "zeropool-bn", + "strum 0.24.1", ] [[package]] @@ -4540,16 +4188,6 @@ dependencies = [ "serde", ] -[[package]] -name = "nu-ansi-term" -version = "0.46.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84" -dependencies = [ - "overload", - "winapi", -] - [[package]] name = "num-bigint" version = "0.3.3" @@ -4686,54 +4324,6 @@ dependencies = [ "vcpkg", ] -[[package]] -name = "opentelemetry" -version = "0.17.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6105e89802af13fdf48c49d7646d3b533a70e536d818aae7e78ba0433d01acb8" -dependencies = [ - "async-trait", - "crossbeam-channel", - "futures-channel", - "futures-executor", - "futures-util", - "js-sys", - "lazy_static", - "percent-encoding", - "pin-project", - "rand 0.8.5", - "thiserror", - "tokio", - "tokio-stream", -] - -[[package]] -name = "opentelemetry-otlp" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d1a6ca9de4c8b00aa7f1a153bd76cb263287155cec642680d79d98706f3d28a" -dependencies = [ - "async-trait", - "futures", - "futures-util", - "http", - "opentelemetry", - "prost", - "thiserror", - "tokio", - "tonic", - "tonic-build", -] - -[[package]] -name = "opentelemetry-semantic-conventions" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "985cc35d832d412224b2cffe2f9194b1b89b6aa5d0bef76d080dce09d90e62bd" -dependencies = [ - "opentelemetry", -] - [[package]] name = "output_vt100" version = "0.1.3" @@ -4743,12 +4333,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "overload" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" - [[package]] name = "parking" version = "2.2.0" @@ -5092,80 +4676,6 @@ dependencies = [ "unicode-ident", ] -[[package]] -name = "prometheus" -version = "0.13.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "449811d15fbdf5ceb5c1144416066429cf82316e2ec8ce0c1f6f8a02e7bbcf8c" -dependencies = [ - "cfg-if 1.0.0", - "fnv", - "lazy_static", - "memchr", - "parking_lot 0.12.1", - "protobuf", - "thiserror", -] - -[[package]] -name = "prost" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "444879275cb4fd84958b1a1d5420d15e6fcf7c235fe47f053c9c2a80aceb6001" -dependencies = [ - "bytes", - "prost-derive", -] - -[[package]] -name = "prost-build" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62941722fb675d463659e49c4f3fe1fe792ff24fe5bbaa9c08cd3b98a1c354f5" -dependencies = [ - "bytes", - "heck 0.3.3", - "itertools", - "lazy_static", - "log", - "multimap 0.8.3", - "petgraph", - "prost", - "prost-types", - "regex", - "tempfile", - "which", -] - -[[package]] -name = "prost-derive" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9cc1a3263e07e0bf68e96268f37665207b49560d98739662cdfaae215c720fe" -dependencies = [ - "anyhow", - "itertools", - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "prost-types" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "534b7a0e836e3c482d2693070f982e39e7611da9695d4d1f5a4b186b51faef0a" -dependencies = [ - "bytes", - "prost", -] - -[[package]] -name = "protobuf" -version = "2.28.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "106dd99e98437432fed6519dedecfade6a06a73bb7b2a1e019fdd2bee5778d94" - [[package]] name = "psm" version = "0.1.21" @@ -5605,12 +5115,6 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" -[[package]] -name = "rustc-hex" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e75f6a532d0fd9f7f13144f392b6ad56a32696bfcd9c78f797f16bbb6f072d6" - [[package]] name = "rustc_version" version = "0.1.7" @@ -5694,30 +5198,6 @@ dependencies = [ "windows-sys 0.48.0", ] -[[package]] -name = "schemars" -version = "0.8.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45a28f4c49489add4ce10783f7911893516f15afe45d015608d41faca6bc4d29" -dependencies = [ - "dyn-clone", - "schemars_derive", - "serde", - "serde_json", -] - -[[package]] -name = "schemars_derive" -version = "0.8.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c767fd6fa65d9ccf9cf026122c1b555f2ef9a4f0cea69da4d7dbc3e258d30967" -dependencies = [ - "proc-macro2", - "quote", - "serde_derive_internals", - "syn 1.0.109", -] - [[package]] name = "scopeguard" version = "1.2.0" @@ -5737,17 +5217,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6b1629c9c557ef9b293568b338dddfc8208c98a18c59d722a9d53f859d9c9b62" dependencies = [ "rand 0.8.5", - "secp256k1-sys 0.6.1", -] - -[[package]] -name = "secp256k1" -version = "0.27.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25996b82292a7a57ed3508f052cfff8640d38d32018784acd714758b43da9c8f" -dependencies = [ - "rand 0.8.5", - "secp256k1-sys 0.8.1", + "secp256k1-sys", ] [[package]] @@ -5759,15 +5229,6 @@ dependencies = [ "cc", ] -[[package]] -name = "secp256k1-sys" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70a129b9e9efbfb223753b9163c4ab3b13cff7fd9c7f010fbac25ab4099fa07e" -dependencies = [ - "cc", -] - [[package]] name = "security-framework" version = "2.9.2" @@ -5845,17 +5306,6 @@ dependencies = [ "syn 2.0.48", ] -[[package]] -name = "serde_derive_internals" -version = "0.26.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85bf8229e7920a9f636479437026331ce11aa132b4dde37d121944a44d6e5f3c" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - [[package]] name = "serde_json" version = "1.0.108" @@ -5902,24 +5352,7 @@ dependencies = [ "indexmap 1.9.3", "serde", "serde_json", - "serde_with_macros 2.3.3", - "time 0.3.30", -] - -[[package]] -name = "serde_with" -version = "3.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64cd236ccc1b7a29e7e2739f27c0b2dd199804abc4290e32f59f3b68d6405c23" -dependencies = [ - "base64 0.21.5", - "chrono", - "hex 0.4.3", - "indexmap 1.9.3", - "indexmap 2.1.0", - "serde", - "serde_json", - "serde_with_macros 3.4.0", + "serde_with_macros", "time 0.3.30", ] @@ -5935,31 +5368,6 @@ dependencies = [ "syn 2.0.48", ] -[[package]] -name = "serde_with_macros" -version = "3.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93634eb5f75a2323b16de4748022ac4297f9e76b6dced2be287a099f41b5e788" -dependencies = [ - "darling", - "proc-macro2", - "quote", - "syn 2.0.48", -] - -[[package]] -name = "serde_yaml" -version = "0.9.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3cc7a1570e38322cfe4154732e5110f887ea57e22b76f4bfd32b5bdd3368666c" -dependencies = [ - "indexmap 2.1.0", - "itoa", - "ryu", - "serde", - "unsafe-libyaml", -] - [[package]] name = "sha1" version = "0.10.6" @@ -6195,9 +5603,15 @@ version = "0.24.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "063e6045c0e62079840579a7e47a355ae92f60eb74daaf156fb1e84ba164e63f" dependencies = [ - "strum_macros", + "strum_macros 0.24.3", ] +[[package]] +name = "strum" +version = "0.26.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d8cec3501a5194c432b2b7976db6b7d10ec95c253208b45f83f7136aa985e29" + [[package]] name = "strum_macros" version = "0.24.3" @@ -6211,6 +5625,19 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "strum_macros" +version = "0.26.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6cf59daf282c0a494ba14fd21610a0325f9f90ec9d1231dea26bcb1d696c946" +dependencies = [ + "heck 0.4.1", + "proc-macro2", + "quote", + "rustversion", + "syn 2.0.48", +] + [[package]] name = "subtle" version = "2.5.0" @@ -6471,11 +5898,11 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.28.2" +version = "1.36.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94d7b1cfd2aa4011f2de74c2c4c63665e27a71006b0a192dcd2710272e73dfa2" +checksum = "61285f6515fa018fb2d1e46eb21223fff441ee8db5d0f1435e8ab4f5cdb80931" dependencies = [ - "autocfg", + "backtrace", "bytes", "libc", "mio", @@ -6483,26 +5910,16 @@ dependencies = [ "parking_lot 0.12.1", "pin-project-lite", "signal-hook-registry", - "socket2 0.4.10", + "socket2 0.5.5", "tokio-macros", "windows-sys 0.48.0", ] -[[package]] -name = "tokio-io-timeout" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30b74022ada614a1b4834de765f9bb43877f910cc8ce4be40e89042c9223a8bf" -dependencies = [ - "pin-project-lite", - "tokio", -] - [[package]] name = "tokio-macros" -version = "2.1.0" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" +checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" dependencies = [ "proc-macro2", "quote", @@ -6530,31 +5947,6 @@ dependencies = [ "tokio", ] -[[package]] -name = "tokio-stream" -version = "0.1.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "397c988d37662c7dda6d2208364a706264bf3d6138b11d436cbac0ad38832842" -dependencies = [ - "futures-core", - "pin-project-lite", - "tokio", -] - -[[package]] -name = "tokio-util" -version = "0.6.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36943ee01a6d67977dd3f84a5a1d2efeb4ada3a1ae771cadfaa535d9d9fc6507" -dependencies = [ - "bytes", - "futures-core", - "futures-sink", - "log", - "pin-project-lite", - "tokio", -] - [[package]] name = "tokio-util" version = "0.7.10" @@ -6606,75 +5998,6 @@ dependencies = [ "winnow", ] -[[package]] -name = "tonic" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff08f4649d10a70ffa3522ca559031285d8e421d727ac85c60825761818f5d0a" -dependencies = [ - "async-stream", - "async-trait", - "base64 0.13.1", - "bytes", - "futures-core", - "futures-util", - "h2", - "http", - "http-body", - "hyper", - "hyper-timeout", - "percent-encoding", - "pin-project", - "prost", - "prost-derive", - "tokio", - "tokio-stream", - "tokio-util 0.6.10", - "tower", - "tower-layer", - "tower-service", - "tracing", - "tracing-futures", -] - -[[package]] -name = "tonic-build" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9403f1bafde247186684b230dc6f38b5cd514584e8bec1dd32514be4745fa757" -dependencies = [ - "proc-macro2", - "prost-build", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "tower" -version = "0.4.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8fa9be0de6cf49e536ce1851f987bd21a43b771b09473c3549a6c853db37c1c" -dependencies = [ - "futures-core", - "futures-util", - "indexmap 1.9.3", - "pin-project", - "pin-project-lite", - "rand 0.8.5", - "slab", - "tokio", - "tokio-util 0.7.10", - "tower-layer", - "tower-service", - "tracing", -] - -[[package]] -name = "tower-layer" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c20c8dbed6283a09604c3e69b4b7eeb54e298b8a600d4d5ecb5ad39de609f1d0" - [[package]] name = "tower-service" version = "0.3.2" @@ -6693,18 +6016,6 @@ dependencies = [ "tracing-core", ] -[[package]] -name = "tracing-appender" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3566e8ce28cc0a3fe42519fc80e6b4c943cc4c8cef275620eb8dac2d3d4e06cf" -dependencies = [ - "crossbeam-channel", - "thiserror", - "time 0.3.30", - "tracing-subscriber", -] - [[package]] name = "tracing-attributes" version = "0.1.27" @@ -6726,52 +6037,6 @@ dependencies = [ "valuable", ] -[[package]] -name = "tracing-futures" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97d095ae15e245a057c8e8451bab9b3ee1e1f68e9ba2b4fbc18d0ac5237835f2" -dependencies = [ - "pin-project", - "tracing", -] - -[[package]] -name = "tracing-log" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f751112709b4e791d8ce53e32c4ed2d353565a795ce84da2285393f41557bdf2" -dependencies = [ - "log", - "once_cell", - "tracing-core", -] - -[[package]] -name = "tracing-log" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee855f1f400bd0e5c02d150ae5de3840039a3f54b025156404e34c23c03f47c3" -dependencies = [ - "log", - "once_cell", - "tracing-core", -] - -[[package]] -name = "tracing-opentelemetry" -version = "0.17.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbbe89715c1dbbb790059e2565353978564924ee85017b5fff365c872ff6721f" -dependencies = [ - "once_cell", - "opentelemetry", - "tracing", - "tracing-core", - "tracing-log 0.1.4", - "tracing-subscriber", -] - [[package]] name = "tracing-serde" version = "0.1.3" @@ -6789,7 +6054,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ad0f048c97dbd9faa9b7df56362b8ebcaa52adb06b498c050d2f4e32f90a7a8b" dependencies = [ "matchers", - "nu-ansi-term", "once_cell", "regex", "serde", @@ -6800,7 +6064,6 @@ dependencies = [ "time 0.3.30", "tracing", "tracing-core", - "tracing-log 0.2.0", "tracing-serde", ] @@ -6882,12 +6145,6 @@ version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" -[[package]] -name = "unsafe-libyaml" -version = "0.2.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab4c90930b95a82d00dc9e9ac071b4991924390d46cbd0dfe566148667605e4b" - [[package]] name = "unsigned-varint" version = "0.7.2" @@ -7179,18 +6436,20 @@ dependencies = [ [[package]] name = "wasmer-interface-types-fl" -version = "0.27.0" +version = "0.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62958478f282fbf2b05c12f9630972bd8194937de1ab22d6a59d43093be32886" +checksum = "7a753426d5a76076aa16a435b5a5f316e3803461f551975d196928bc92e42916" dependencies = [ "anyhow", "fluence-it-types", + "futures", "it-lilo", "it-memory-traits", "it-to-bytes", "itertools", "log", "nom", + "paste", "safe-transmute", "semver 1.0.21", "serde", @@ -7648,18 +6907,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "which" -version = "4.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87ba24419a2078cd2b0f2ede2691b6c66d8e47836da3b6db8265ebad47afbfc7" -dependencies = [ - "either", - "home", - "once_cell", - "rustix 0.38.28", -] - [[package]] name = "wiggle" version = "13.0.1" @@ -7965,10 +7212,10 @@ dependencies = [ "hex 0.4.3", "libc", "near-account-id 0.15.0", - "near-crypto 0.15.0", + "near-crypto", "near-jsonrpc-client", "near-jsonrpc-primitives", - "near-primitives 0.15.0", + "near-primitives", "near-sandbox-utils", "portpicker", "rand 0.8.5", @@ -8048,20 +7295,6 @@ dependencies = [ "syn 2.0.48", ] -[[package]] -name = "zeropool-bn" -version = "0.5.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71e61de68ede9ffdd69c01664f65a178c5188b73f78faa21f0936016a888ff7c" -dependencies = [ - "borsh 0.9.3", - "byteorder", - "crunchy", - "lazy_static", - "rand 0.8.5", - "rustc-hex", -] - [[package]] name = "zip" version = "0.5.13" diff --git a/air/tests/test_module/features/tetraplets/security_tetraplets.rs b/air/tests/test_module/features/tetraplets/security_tetraplets.rs index bfadf17e43..4c7f7ecf77 100644 --- a/air/tests/test_module/features/tetraplets/security_tetraplets.rs +++ b/air/tests/test_module/features/tetraplets/security_tetraplets.rs @@ -334,11 +334,10 @@ fn construct_service_config(module_name: impl Into) -> AppServiceConfig default_modules_config: None, }; - let service_base_dir = std::env::temp_dir(); + let service_working_dir = std::env::temp_dir(); AppServiceConfig { - service_working_dir: service_base_dir.clone(), - service_base_dir, + service_working_dir, marine_config, } } @@ -425,7 +424,6 @@ fn to_app_service_call_parameters( service_creator_peer_id: call_parameters.service_creator_peer_id, host_id: call_parameters.host_id, worker_id: call_parameters.worker_id, - particle_id: call_parameters.particle_id, tetraplets: call_parameters .tetraplets .into_iter() diff --git a/crates/air-lib/test-utils/Cargo.toml b/crates/air-lib/test-utils/Cargo.toml index eef40f69d8..0cc9d6f210 100644 --- a/crates/air-lib/test-utils/Cargo.toml +++ b/crates/air-lib/test-utils/Cargo.toml @@ -35,8 +35,8 @@ ed25519-dalek = "2.1.0" rand_chacha = "0.3.1" sha2 = "0.10.6" air-interpreter-value = { version = "0.1.0", path = "../interpreter-value" } -marine-wasm-backend-traits = {version = "0.5.1", git = "https://github.com/fluencelabs/marine", branch = "feat/async-call"} -marine-wasmtime-backend = {version = "0.5.1", git = "https://github.com/fluencelabs/marine", branch = "feat/async-call"} +marine-wasm-backend-traits = {version = "0.6.0", git = "https://github.com/fluencelabs/marine", branch = "feat/async-call"} +marine-wasmtime-backend = {version = "0.6.0", git = "https://github.com/fluencelabs/marine", branch = "feat/async-call"} futures = "0.3.30" tokio = {version = "1.28.2", features = ["rt", "macros"]} diff --git a/tools/cli/air/Cargo.toml b/tools/cli/air/Cargo.toml index b745cb379c..bbd856fcf4 100644 --- a/tools/cli/air/Cargo.toml +++ b/tools/cli/air/Cargo.toml @@ -33,7 +33,7 @@ termcolor = "1.2.0" fluence-keypair = "0.10.4" bs58 = "0.5.0" zeroize = "1.6.0" -marine-wasmtime-backend = {version = "0.5.1", git = "https://github.com/fluencelabs/marine", branch = "feat/async-call"} +marine-wasmtime-backend = {version = "0.6.0", git = "https://github.com/fluencelabs/marine", branch = "feat/async-call"} tokio = { version = "1", features = ["rt", "macros"] } futures = "0.3.30" From 044691d97b26340da340f444b7d492c11093478d Mon Sep 17 00:00:00 2001 From: Valery Antopol Date: Mon, 15 Apr 2024 15:48:43 +0400 Subject: [PATCH 14/14] use released marine --- Cargo.lock | 65 +++++++++++++++++----------- air/Cargo.toml | 2 +- avm/server/Cargo.toml | 6 +-- crates/air-lib/test-utils/Cargo.toml | 4 +- tools/cli/air/Cargo.toml | 2 +- 5 files changed, 46 insertions(+), 33 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 08f9ae625b..d2fc35bfcc 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -963,7 +963,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4114279215a005bc675e386011e594e1d9b800918cea18fcadadcce864a2046b" dependencies = [ "borsh-derive 0.10.3", - "hashbrown 0.11.2", + "hashbrown 0.13.2", ] [[package]] @@ -2325,8 +2325,9 @@ dependencies = [ [[package]] name = "fluence-app-service" -version = "0.35.2" -source = "git+https://github.com/fluencelabs/marine?branch=feat/async-call#e8d89e3de1f21e0678e3722e2e1e31ba74fba2ac" +version = "0.36.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3e423d621b41b09b24581ff639abe8590da6af5b374b90aa5f6232a67c59a203" dependencies = [ "log", "maplit", @@ -2848,7 +2849,7 @@ dependencies = [ "httpdate", "itoa", "pin-project-lite", - "socket2 0.4.10", + "socket2 0.5.5", "tokio", "tower-service", "tracing", @@ -3005,8 +3006,9 @@ dependencies = [ [[package]] name = "it-json-serde" -version = "0.5.1" -source = "git+https://github.com/fluencelabs/marine?branch=feat/async-call#e8d89e3de1f21e0678e3722e2e1e31ba74fba2ac" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9011f4a5b18c9148bbdfac7d364266e34b4cda2fc585230f1dab706c315cf556" dependencies = [ "serde", "serde_derive", @@ -3340,8 +3342,9 @@ dependencies = [ [[package]] name = "marine-core" -version = "0.30.0" -source = "git+https://github.com/fluencelabs/marine?branch=feat/async-call#e8d89e3de1f21e0678e3722e2e1e31ba74fba2ac" +version = "0.31.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67d0d9d1ea05ecf84c887afc720d9fb139e5453cb7ffd8102f36b54bd02c2222" dependencies = [ "anyhow", "bytesize", @@ -3369,8 +3372,9 @@ dependencies = [ [[package]] name = "marine-it-generator" -version = "0.17.0" -source = "git+https://github.com/fluencelabs/marine?branch=feat/async-call#e8d89e3de1f21e0678e3722e2e1e31ba74fba2ac" +version = "0.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "daf8c8aac013e8dc4d828e4a1160e9b8b7224e6847c17fa0b25836aaf6226628" dependencies = [ "it-lilo", "marine-it-parser", @@ -3385,8 +3389,9 @@ dependencies = [ [[package]] name = "marine-it-interfaces" -version = "0.9.1" -source = "git+https://github.com/fluencelabs/marine?branch=feat/async-call#e8d89e3de1f21e0678e3722e2e1e31ba74fba2ac" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34970fe6e4da4fcee6d911e96afb1b99ead0c80e41ba2531a36a1075fbbfb03f" dependencies = [ "multimap 0.8.3", "wasmer-interface-types-fl", @@ -3394,8 +3399,9 @@ dependencies = [ [[package]] name = "marine-it-parser" -version = "0.16.0" -source = "git+https://github.com/fluencelabs/marine?branch=feat/async-call#e8d89e3de1f21e0678e3722e2e1e31ba74fba2ac" +version = "0.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa3a1f23268aedbe23baed2a3a00ea21bf7b61aa61feb393b70dd0597414cb5e" dependencies = [ "anyhow", "itertools", @@ -3505,7 +3511,8 @@ dependencies = [ [[package]] name = "marine-min-it-version" version = "0.3.2" -source = "git+https://github.com/fluencelabs/marine?branch=feat/async-call#e8d89e3de1f21e0678e3722e2e1e31ba74fba2ac" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "147e6e4c9d3dc9afbb06b2e3bc069b63c749733f698d0c364c320a72b133f1d5" dependencies = [ "once_cell", "semver 1.0.21", @@ -3513,8 +3520,9 @@ dependencies = [ [[package]] name = "marine-module-info-parser" -version = "0.15.0" -source = "git+https://github.com/fluencelabs/marine?branch=feat/async-call#e8d89e3de1f21e0678e3722e2e1e31ba74fba2ac" +version = "0.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba0abfe0aae8f0b89e79278e6f09ed094396aed413a5cddfff67e9a95adf6891" dependencies = [ "anyhow", "chrono", @@ -3529,8 +3537,9 @@ dependencies = [ [[package]] name = "marine-module-interface" -version = "0.8.1" -source = "git+https://github.com/fluencelabs/marine?branch=feat/async-call#e8d89e3de1f21e0678e3722e2e1e31ba74fba2ac" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95e139be29c46e01a1087175834a95881e6e60b1f3304bc10e098450e5bd2b64" dependencies = [ "anyhow", "itertools", @@ -3598,8 +3607,9 @@ dependencies = [ [[package]] name = "marine-runtime" -version = "0.36.2" -source = "git+https://github.com/fluencelabs/marine?branch=feat/async-call#e8d89e3de1f21e0678e3722e2e1e31ba74fba2ac" +version = "0.37.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "31b89585db43f79da40041d5100f84c360ada9e5ac086d95fbbbab118771f2ec" dependencies = [ "bytesize", "it-json-serde", @@ -3640,12 +3650,14 @@ dependencies = [ [[package]] name = "marine-utils" version = "0.5.1" -source = "git+https://github.com/fluencelabs/marine?branch=feat/async-call#e8d89e3de1f21e0678e3722e2e1e31ba74fba2ac" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fce56bfabfd0af5326ff81c32c8d2261aa03b10e00ea6c165de4ebf8a3f998e4" [[package]] name = "marine-wasm-backend-traits" -version = "0.6.0" -source = "git+https://github.com/fluencelabs/marine?branch=feat/async-call#e8d89e3de1f21e0678e3722e2e1e31ba74fba2ac" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e15277ea4420bfd8c3a26aceded5d64c35c416afaedfccc3b21832eb578f6c1d" dependencies = [ "anyhow", "futures", @@ -3659,8 +3671,9 @@ dependencies = [ [[package]] name = "marine-wasmtime-backend" -version = "0.6.0" -source = "git+https://github.com/fluencelabs/marine?branch=feat/async-call#e8d89e3de1f21e0678e3722e2e1e31ba74fba2ac" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f8537d3b8d370431746ef24f7fab31cc0e41e39cb14a024e4895325c7e8b27f" dependencies = [ "anyhow", "futures", diff --git a/air/Cargo.toml b/air/Cargo.toml index 88f722c66e..50760e0fab 100644 --- a/air/Cargo.toml +++ b/air/Cargo.toml @@ -53,7 +53,7 @@ rkyv = { version = "0.7.43", features = ["strict", "validation", "size_32", "arc [dev_dependencies] air-test-utils = { path = "../crates/air-lib/test-utils" } air-testing-framework = { path = "../crates/testing-framework" } -fluence-app-service = {version = "0.35.2", git = "https://github.com/fluencelabs/marine", branch = "feat/async-call"} +fluence-app-service = "0.36.0" marine-rs-sdk = { version = "0.14.0", features = ["logger"] } borsh = "0.10.3" diff --git a/avm/server/Cargo.toml b/avm/server/Cargo.toml index 3f09312c0f..ed18a46b00 100644 --- a/avm/server/Cargo.toml +++ b/avm/server/Cargo.toml @@ -19,9 +19,9 @@ air-interpreter-interface = { version = "0.19.0", path = "../../crates/air-lib/i air-interpreter-sede = { version = "0.1.0", path = "../../crates/air-lib/interpreter-sede" } air-utils = { version = "0.3.0", path = "../../crates/air-lib/utils" } avm-data-store = { version = "0.7.9", path = "../../crates/data-store" } -marine-runtime = {version = "0.36.2", git = "https://github.com/fluencelabs/marine", branch = "feat/async-call"} -marine-wasmtime-backend = {version = "0.6.0", git = "https://github.com/fluencelabs/marine", branch = "feat/async-call"} -marine-wasm-backend-traits = {version = "0.6.0", git = "https://github.com/fluencelabs/marine", branch = "feat/async-call"} +marine-runtime = "0.37.0" +marine-wasmtime-backend = "0.7.0" +marine-wasm-backend-traits = "0.7.0" polyplets = { version = "0.7.0", path = "../../crates/air-lib/polyplets" } avm-interface = { version = "0.32.1", path = "../../avm/interface" } diff --git a/crates/air-lib/test-utils/Cargo.toml b/crates/air-lib/test-utils/Cargo.toml index 0cc9d6f210..51a81ccf8c 100644 --- a/crates/air-lib/test-utils/Cargo.toml +++ b/crates/air-lib/test-utils/Cargo.toml @@ -35,8 +35,8 @@ ed25519-dalek = "2.1.0" rand_chacha = "0.3.1" sha2 = "0.10.6" air-interpreter-value = { version = "0.1.0", path = "../interpreter-value" } -marine-wasm-backend-traits = {version = "0.6.0", git = "https://github.com/fluencelabs/marine", branch = "feat/async-call"} -marine-wasmtime-backend = {version = "0.6.0", git = "https://github.com/fluencelabs/marine", branch = "feat/async-call"} +marine-wasm-backend-traits = "0.7.0" +marine-wasmtime-backend = "0.7.0" futures = "0.3.30" tokio = {version = "1.28.2", features = ["rt", "macros"]} diff --git a/tools/cli/air/Cargo.toml b/tools/cli/air/Cargo.toml index bbd856fcf4..e165678ee8 100644 --- a/tools/cli/air/Cargo.toml +++ b/tools/cli/air/Cargo.toml @@ -33,7 +33,7 @@ termcolor = "1.2.0" fluence-keypair = "0.10.4" bs58 = "0.5.0" zeroize = "1.6.0" -marine-wasmtime-backend = {version = "0.6.0", git = "https://github.com/fluencelabs/marine", branch = "feat/async-call"} +marine-wasmtime-backend = "0.7.0" tokio = { version = "1", features = ["rt", "macros"] } futures = "0.3.30"