From 0bbede253c9e6d6b3909daf1a6a3b9cf356ed581 Mon Sep 17 00:00:00 2001 From: Andrei Marinica Date: Tue, 18 Jun 2024 18:12:31 +0300 Subject: [PATCH 1/6] removed multiversx-sdk dependency from multiversx-sc-scenario --- Cargo.lock | 445 +++++++++++++++--- framework/scenario/Cargo.toml | 4 - .../scenario/model/transaction/tx_response.rs | 5 - framework/snippets/src/network_response.rs | 71 ++- .../tests/test_tx_multiple_sc_results.rs | 6 +- sdk/core/src/data/transaction.rs | 3 +- 6 files changed, 417 insertions(+), 117 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ec245b66b9..3688019cce 100755 --- a/Cargo.lock +++ b/Cargo.lock @@ -130,9 +130,9 @@ dependencies = [ [[package]] name = "anstyle-query" -version = "1.0.3" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a64c907d4e79225ac72e2a354c9ce84d50ebb4586dee56c82b3ee73004f537f5" +checksum = "ad186efb764318d35165f1758e7dcef3b10628e26d41a44bc5550652e6804391" dependencies = [ "windows-sys 0.52.0", ] @@ -182,9 +182,9 @@ checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" [[package]] name = "backtrace" -version = "0.3.72" +version = "0.3.73" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17c6a35df3749d2e8bb1b7b21a976d82b15548788d2735b9d82f329268f71a11" +checksum = "5cc23269a4f8976d0a4d2e7109211a419fe30e8d88d677cd60b6bc79c5732e0a" dependencies = [ "addr2line", "cc", @@ -384,9 +384,9 @@ checksum = "514de17de45fdb8dc022b1a7975556c53c86f9f0aa5f534b98977b171857c2c9" [[package]] name = "cc" -version = "1.0.98" +version = "1.0.99" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41c270e7540d725e65ac7f1b212ac8ce349719624d7bcff99f8e2e488e8cf03f" +checksum = "96c51067fd44124faa7f870b4b1c969379ad32b2ba805aa959430ceaa384f695" [[package]] name = "cfg-if" @@ -431,9 +431,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.4" +version = "4.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90bc066a67923782aa8515dbaea16946c5bcc5addbd668bb80af688e53e548a0" +checksum = "5db83dced34638ad474f39f250d7fea9598bdd239eaced1bdf45d597da0f433f" dependencies = [ "clap_builder", "clap_derive", @@ -441,9 +441,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.2" +version = "4.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae129e2e766ae0ec03484e609954119f123cc1fe650337e155d03b022f24f7b4" +checksum = "f7e204572485eb3fbf28f871612191521df159bc3e15a9f5064c66dba3a8c05f" dependencies = [ "anstream", "anstyle", @@ -453,9 +453,9 @@ dependencies = [ [[package]] name = "clap_derive" -version = "4.5.4" +version = "4.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "528131438037fd55894f62d6e9f068b8f45ac57ffa77517819645d10aed04f64" +checksum = "c780290ccf4fb26629baa7a1081e68ced113f1d3ec302fa5948f1c381ebf06c6" dependencies = [ "heck", "proc-macro2", @@ -465,9 +465,9 @@ dependencies = [ [[package]] name = "clap_lex" -version = "0.7.0" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "98cc8fbded0c607b7ba9dd60cd98df59af97e84d24e49c8557331cfc26d301ce" +checksum = "4b82cf0babdbd58558212896d1a4272303a57bdb245c2bf1147185fb45640e70" [[package]] name = "colorchoice" @@ -1388,12 +1388,12 @@ dependencies = [ [[package]] name = "http-body-util" -version = "0.1.1" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0475f8b2ac86659c21b64320d5d653f9efe42acd2a4e560073ec61a155a34f1d" +checksum = "793429d76616a256bcb62c2a2ec2bed781c8307e797e2598c50010f2bee2544f" dependencies = [ "bytes", - "futures-core", + "futures-util", "http", "http-body", "pin-project-lite", @@ -1401,9 +1401,9 @@ dependencies = [ [[package]] name = "httparse" -version = "1.8.0" +version = "1.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" +checksum = "0fcc0b4a115bf80b728eb8ea024ad5bd707b615bfed49e0665b6e0f86fd082d9" [[package]] name = "humantime" @@ -1431,6 +1431,23 @@ dependencies = [ "want", ] +[[package]] +name = "hyper-rustls" +version = "0.27.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ee4be2c948921a1a5320b629c4193916ed787a7f7f293fd3f7f5a6c9de74155" +dependencies = [ + "futures-util", + "http", + "hyper", + "hyper-util", + "rustls", + "rustls-pki-types", + "tokio", + "tokio-rustls", + "tower-service", +] + [[package]] name = "hyper-tls" version = "0.6.0" @@ -1467,14 +1484,134 @@ dependencies = [ "tracing", ] +[[package]] +name = "icu_collections" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db2fa452206ebee18c4b5c2274dbf1de17008e874b4dc4f0aea9d01ca79e4526" +dependencies = [ + "displaydoc", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_locid" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13acbb8371917fc971be86fc8057c41a64b521c184808a698c02acc242dbf637" +dependencies = [ + "displaydoc", + "litemap", + "tinystr", + "writeable", + "zerovec", +] + +[[package]] +name = "icu_locid_transform" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "01d11ac35de8e40fdeda00d9e1e9d92525f3f9d887cdd7aa81d727596788b54e" +dependencies = [ + "displaydoc", + "icu_locid", + "icu_locid_transform_data", + "icu_provider", + "tinystr", + "zerovec", +] + +[[package]] +name = "icu_locid_transform_data" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fdc8ff3388f852bede6b579ad4e978ab004f139284d7b28715f773507b946f6e" + +[[package]] +name = "icu_normalizer" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19ce3e0da2ec68599d193c93d088142efd7f9c5d6fc9b803774855747dc6a84f" +dependencies = [ + "displaydoc", + "icu_collections", + "icu_normalizer_data", + "icu_properties", + "icu_provider", + "smallvec", + "utf16_iter", + "utf8_iter", + "write16", + "zerovec", +] + +[[package]] +name = "icu_normalizer_data" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8cafbf7aa791e9b22bec55a167906f9e1215fd475cd22adfcf660e03e989516" + +[[package]] +name = "icu_properties" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f8ac670d7422d7f76b32e17a5db556510825b29ec9154f235977c9caba61036" +dependencies = [ + "displaydoc", + "icu_collections", + "icu_locid_transform", + "icu_properties_data", + "icu_provider", + "tinystr", + "zerovec", +] + +[[package]] +name = "icu_properties_data" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67a8effbc3dd3e4ba1afa8ad918d5684b8868b3b26500753effea8d2eed19569" + +[[package]] +name = "icu_provider" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ed421c8a8ef78d3e2dbc98a973be2f3770cb42b606e3ab18d6237c4dfde68d9" +dependencies = [ + "displaydoc", + "icu_locid", + "icu_provider_macros", + "stable_deref_trait", + "tinystr", + "writeable", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_provider_macros" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ec89e9337638ecdc08744df490b221a7399bf8d164eb52a665454e60e075ad6" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "idna" -version = "0.5.0" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6" +checksum = "4716a3a0933a1d01c2f72450e89596eb51dd34ef3c211ccd875acdf1f8fe47ed" dependencies = [ - "unicode-bidi", - "unicode-normalization", + "icu_normalizer", + "icu_properties", + "smallvec", + "utf8_iter", ] [[package]] @@ -1674,6 +1811,12 @@ version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" +[[package]] +name = "litemap" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "643cb0b8d4fcc284004d5fd0d67ccf61dfffadb7f75e1e71bc420f4688a3a704" + [[package]] name = "local-esdt-and-nft" version = "0.0.0" @@ -1781,9 +1924,9 @@ dependencies = [ [[package]] name = "memchr" -version = "2.7.2" +version = "2.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d" +checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" [[package]] name = "mime" @@ -1793,9 +1936,9 @@ checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" [[package]] name = "miniz_oxide" -version = "0.7.3" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87dfd01fe195c66b572b37921ad8803d010623c0aca821bea2302239d155cdae" +checksum = "b8a240ddb74feaf34a79a7add65a741f3167852fba007066dcac1ca548d89c08" dependencies = [ "adler", ] @@ -2031,7 +2174,6 @@ dependencies = [ "multiversx-chain-vm-executor", "multiversx-sc", "multiversx-sc-meta-lib", - "multiversx-sdk", "num-bigint", "num-traits", "pathdiff", @@ -2234,9 +2376,9 @@ dependencies = [ [[package]] name = "object" -version = "0.35.0" +version = "0.36.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8ec7ab813848ba4522158d5517a6093db1ded27575b070f4177b8d12b41db5e" +checksum = "576dfe1fc8f9df304abb159d767a29d0476f7750fbf8aa7ad07816004a207434" dependencies = [ "memchr", ] @@ -2704,18 +2846,18 @@ dependencies = [ [[package]] name = "redox_syscall" -version = "0.5.1" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "469052894dcb553421e483e4209ee581a45100d31b4018de03e5a7ad86374a7e" +checksum = "c82cf8cff14456045f55ec4241383baeff27af886adb72ffb2162f99911de0fd" dependencies = [ "bitflags 2.5.0", ] [[package]] name = "regex" -version = "1.10.4" +version = "1.10.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c117dbdfde9c8308975b6a18d71f3f385c89461f7b3fb054288ecf2a2058ba4c" +checksum = "b91213439dad192326a0d7c6ee3955910425f441d7038e0d6933b0aec5c4517f" dependencies = [ "aho-corasick", "memchr", @@ -2725,9 +2867,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.6" +version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86b83b8b9847f9bf95ef68afb0b8e6cdb80f498442f5179a29fad448fcc1eaea" +checksum = "38caf58cc5ef2fed281f89292ef23f6365465ed9a41b7a7754eb4e26496c92df" dependencies = [ "aho-corasick", "memchr", @@ -2736,15 +2878,15 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.8.3" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adad44e29e4c806119491a7f06f03de4d1af22c3a680dd47f1e6e179439d1f56" +checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b" [[package]] name = "reqwest" -version = "0.12.4" +version = "0.12.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "566cafdd92868e0939d3fb961bd0dc25fcfaaed179291093b3d43e6b3150ea10" +checksum = "c7d6d2a27d57148378eb5e111173f4276ad26340ecc5c49a4a2152167a2d6a37" dependencies = [ "base64", "bytes", @@ -2757,6 +2899,7 @@ dependencies = [ "http-body", "http-body-util", "hyper", + "hyper-rustls", "hyper-tls", "hyper-util", "ipnet", @@ -2800,6 +2943,21 @@ dependencies = [ "rewards-distribution", ] +[[package]] +name = "ring" +version = "0.17.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c17fa4cb658e3583423e915b9f3acc01cceaee1860e33d59ebae66adc3a2dc0d" +dependencies = [ + "cc", + "cfg-if", + "getrandom 0.2.15", + "libc", + "spin", + "untrusted", + "windows-sys 0.52.0", +] + [[package]] name = "ruplacer" version = "0.8.2" @@ -2881,6 +3039,19 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "rustls" +version = "0.23.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05cff451f60db80f490f3c182b77c35260baace73209e9cdbbe526bfe3a4d402" +dependencies = [ + "once_cell", + "rustls-pki-types", + "rustls-webpki", + "subtle", + "zeroize", +] + [[package]] name = "rustls-pemfile" version = "2.1.2" @@ -2897,6 +3068,17 @@ version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "976295e77ce332211c0d24d92c0e83e50f5c5f046d11082cea19f3df13a3562d" +[[package]] +name = "rustls-webpki" +version = "0.102.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff448f7e92e913c4b7d4c6d8e4540a1724b319b4152b8aef6d4cf8339712b33e" +dependencies = [ + "ring", + "rustls-pki-types", + "untrusted", +] + [[package]] name = "ryu" version = "1.0.18" @@ -3200,6 +3382,18 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "spin" +version = "0.9.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" + +[[package]] +name = "stable_deref_trait" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" + [[package]] name = "str-repeat" version = "0.0.0" @@ -3241,9 +3435,20 @@ dependencies = [ [[package]] name = "sync_wrapper" -version = "0.1.2" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" +checksum = "a7065abeca94b6a8a577f9bd45aa0867a2238b74e8eb67cf10d492bc39351394" + +[[package]] +name = "synstructure" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8af7666ab7b6390ab78131fb5b0fce11d6b7a6951602017c35fa82800708971" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] [[package]] name = "system-configuration" @@ -3298,6 +3503,16 @@ dependencies = [ "syn", ] +[[package]] +name = "tinystr" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9117f5d4db391c1cf6927e7bea3db74b9a1c1add8f7eda9ffd5364f40f57b82f" +dependencies = [ + "displaydoc", + "zerovec", +] + [[package]] name = "tinyvec" version = "1.6.0" @@ -3331,9 +3546,9 @@ dependencies = [ [[package]] name = "tokio" -version = "1.37.0" +version = "1.38.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1adbebffeca75fcfd058afa480fb6c0b81e165a0323f9c9d39c9697e37c46787" +checksum = "ba4f4a02a7a80d6f274636f0aa95c7e383b912d41fe721a31f29e29698585a4a" dependencies = [ "backtrace", "bytes", @@ -3350,9 +3565,9 @@ dependencies = [ [[package]] name = "tokio-macros" -version = "2.2.0" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" +checksum = "5f5ae998a069d4b5aba8ee9dad856af7d520c3699e6159b185c2acd48155d39a" dependencies = [ "proc-macro2", "quote", @@ -3369,6 +3584,17 @@ dependencies = [ "tokio", ] +[[package]] +name = "tokio-rustls" +version = "0.26.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c7bc40d0e5a97695bb96e27995cd3a08538541b0a846f65bba7a359f36700d4" +dependencies = [ + "rustls", + "rustls-pki-types", + "tokio", +] + [[package]] name = "tokio-util" version = "0.7.11" @@ -3384,9 +3610,9 @@ dependencies = [ [[package]] name = "toml" -version = "0.8.13" +version = "0.8.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4e43f8cc456c9704c851ae29c67e17ef65d2c30017c17a9765b89c382dc8bba" +checksum = "6f49eb2ab21d2f26bd6db7bf383edc527a7ebaee412d17af4d40fdccd442f335" dependencies = [ "indexmap", "serde", @@ -3406,9 +3632,9 @@ dependencies = [ [[package]] name = "toml_edit" -version = "0.22.13" +version = "0.22.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c127785850e8c20836d49732ae6abfa47616e60bf9d9f57c43c250361a9db96c" +checksum = "f21c7aaf97f1bd9ca9d4f9e73b0a6c74bd5afef56f2bc931943a6e1c37e04e38" dependencies = [ "indexmap", "serde", @@ -3493,12 +3719,6 @@ version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" -[[package]] -name = "unicode-bidi" -version = "0.3.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08f95100a766bf4f8f28f90d77e0a5461bbdb219042e7679bebe79004fed8d75" - [[package]] name = "unicode-ident" version = "1.0.12" @@ -3520,6 +3740,12 @@ version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d4c87d22b6e3f4a18d4d40ef354e97c90fcb14dd91d7dc0aa9d8a1172ebf7202" +[[package]] +name = "untrusted" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" + [[package]] name = "unwrap-infallible" version = "0.1.5" @@ -3528,9 +3754,9 @@ checksum = "151ac09978d3c2862c4e39b557f4eceee2cc72150bc4cb4f16abf061b6e381fb" [[package]] name = "url" -version = "2.5.0" +version = "2.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31e6302e3bb753d46e83516cae55ae196fc0c309407cf11ab35cc51a4c2a4633" +checksum = "f7c25da092f0a868cdf09e8674cd3b7ef3a7d92a24253e663a2fb85e2496de56" dependencies = [ "form_urlencoded", "idna", @@ -3555,11 +3781,23 @@ dependencies = [ "use-module", ] +[[package]] +name = "utf16_iter" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8232dd3cdaed5356e0f716d285e4b40b932ac434100fe9b7e0e8e935b9e6246" + +[[package]] +name = "utf8_iter" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" + [[package]] name = "utf8parse" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" +checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" [[package]] name = "vault" @@ -3887,9 +4125,9 @@ checksum = "bec47e5bfd1bff0eeaf6d8b485cc1074891a197ab4225d504cb7a1ab88b02bf0" [[package]] name = "winnow" -version = "0.6.9" +version = "0.6.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86c949fede1d13936a99f14fafd3e76fd642b556dd2ce96287fbe2e0151bfac6" +checksum = "59b5e5f6c299a3c7890b876a2a587f3115162487e704907d9b6cd29473052ba1" dependencies = [ "memchr", ] @@ -3904,6 +4142,42 @@ dependencies = [ "windows-sys 0.48.0", ] +[[package]] +name = "write16" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1890f4022759daae28ed4fe62859b1236caebfc61ede2f63ed4e695f3f6d936" + +[[package]] +name = "writeable" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e9df38ee2d2c3c5948ea468a8406ff0db0b29ae1ffde1bcf20ef305bcc95c51" + +[[package]] +name = "yoke" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c5b1314b079b0930c31e3af543d8ee1757b1951ae1e1565ec704403a7240ca5" +dependencies = [ + "serde", + "stable_deref_trait", + "yoke-derive", + "zerofrom", +] + +[[package]] +name = "yoke-derive" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28cc31741b18cb6f1d5ff12f5b7523e3d6eb0852bbbad19d73905511d9849b95" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "synstructure", +] + [[package]] name = "zerocopy" version = "0.7.34" @@ -3924,6 +4198,27 @@ dependencies = [ "syn", ] +[[package]] +name = "zerofrom" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91ec111ce797d0e0784a1116d0ddcdbea84322cd79e5d5ad173daeba4f93ab55" +dependencies = [ + "zerofrom-derive", +] + +[[package]] +name = "zerofrom-derive" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ea7b4a3637ea8669cedf0f1fd5c286a17f3de97b8dd5a70a6c167a1730e63a5" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "synstructure", +] + [[package]] name = "zeroize" version = "1.8.1" @@ -3944,11 +4239,33 @@ dependencies = [ "syn", ] +[[package]] +name = "zerovec" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb2cc8827d6c0994478a15c53f374f46fbd41bea663d809b14744bc42e6b109c" +dependencies = [ + "yoke", + "zerofrom", + "zerovec-derive", +] + +[[package]] +name = "zerovec-derive" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97cf56601ee5052b4417d90c8755c6683473c926039908196cf35d99f893ebe7" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "zip" -version = "2.1.1" +version = "2.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1dd56a4d5921bc2f99947ac5b3abe5f510b1be7376fdc5e9fce4a23c6a93e87c" +checksum = "775a2b471036342aa69bc5a602bc889cb0a06cda00477d0c69566757d5553d39" dependencies = [ "arbitrary", "crc32fast", diff --git a/framework/scenario/Cargo.toml b/framework/scenario/Cargo.toml index b41d274621..f8e7760dd7 100644 --- a/framework/scenario/Cargo.toml +++ b/framework/scenario/Cargo.toml @@ -55,7 +55,3 @@ version = "0.2.0" [dependencies.multiversx-chain-vm] version = "=0.8.4" path = "../../vm" - -[dependencies.multiversx-sdk] -version = "=0.4.1" -path = "../../sdk/core" diff --git a/framework/scenario/src/scenario/model/transaction/tx_response.rs b/framework/scenario/src/scenario/model/transaction/tx_response.rs index 46806b1183..fd9721721f 100644 --- a/framework/scenario/src/scenario/model/transaction/tx_response.rs +++ b/framework/scenario/src/scenario/model/transaction/tx_response.rs @@ -1,6 +1,5 @@ use multiversx_chain_vm::tx_mock::TxResult; use multiversx_sc::types::Address; -use multiversx_sdk::data::transaction::{ApiLogs, ApiSmartContractResult}; use super::{Log, TxExpect, TxResponseStatus}; @@ -21,10 +20,6 @@ pub struct TxResponse { pub gas: u64, /// The refund of the transaction. pub refund: u64, - /// The smart contract results of the transaction. - pub api_scrs: Vec, - /// The api logs of the transaction. - pub api_logs: Option, } impl TxResponse { diff --git a/framework/snippets/src/network_response.rs b/framework/snippets/src/network_response.rs index f7f0b962df..e0d9ceea58 100644 --- a/framework/snippets/src/network_response.rs +++ b/framework/snippets/src/network_response.rs @@ -13,29 +13,21 @@ const LOG_IDENTIFIER_SIGNAL_ERROR: &str = "signalError"; /// Creates a [`TxResponse`] from a [`TransactionOnNetwork`]. pub fn parse_tx_response(tx: TransactionOnNetwork) -> TxResponse { - let mut response = TxResponse { - api_scrs: tx.smart_contract_results.unwrap_or_default(), - api_logs: tx.logs, - ..Default::default() - }; - - response.tx_error = process_signal_error(&response); - if !response.tx_error.is_success() { - return response; + let tx_error = process_signal_error(&tx); + if !tx_error.is_success() { + TxResponse { + tx_error, + ..Default::default() + }; } - process( - &mut response, - tx.sender.to_bytes(), - tx.nonce, - tx.processing_type_on_destination, - ); - + let mut response = TxResponse::default(); + process(&mut response, &tx); response } -fn process_signal_error(tx_response: &TxResponse) -> TxResponseStatus { - if let Some(event) = find_log(tx_response, LOG_IDENTIFIER_SIGNAL_ERROR) { +fn process_signal_error(tx: &TransactionOnNetwork) -> TxResponseStatus { + if let Some(event) = find_log(tx, LOG_IDENTIFIER_SIGNAL_ERROR) { let topics = event.topics.as_ref(); if let Some(error) = process_topics_error(topics) { return TxResponseStatus::signal_error(&error); @@ -49,34 +41,29 @@ fn process_signal_error(tx_response: &TxResponse) -> TxResponseStatus { TxResponseStatus::default() } -fn process( - tx_response: &mut TxResponse, - sender_address: [u8; 32], - nonce: u64, - processing_type_on_destination: String, -) { - process_out(tx_response); +fn process(tx_response: &mut TxResponse, tx: &TransactionOnNetwork) { + process_out(tx_response, tx); process_new_deployed_address( tx_response, - sender_address, - nonce, - processing_type_on_destination, + tx.sender.to_bytes(), + tx.nonce, + tx.processing_type_on_destination.clone(), ); - process_new_issued_token_identifier(tx_response); + process_new_issued_token_identifier(tx_response, tx); } -fn process_out(tx_response: &mut TxResponse) { - let out_scr = tx_response.api_scrs.iter().find(is_out_scr); +fn process_out(tx_response: &mut TxResponse, tx: &TransactionOnNetwork) { + let out_scr = tx.smart_contract_results.iter().find(is_out_scr); if let Some(out_scr) = out_scr { tx_response.out = decode_scr_data_or_panic(&out_scr.data); - } else if let Some(data) = process_out_from_log(tx_response) { + } else if let Some(data) = process_out_from_log(tx) { tx_response.out = data } } -fn process_out_from_log(tx_response: &TxResponse) -> Option>> { - if let Some(logs) = &tx_response.api_logs { +fn process_out_from_log(tx: &TransactionOnNetwork) -> Option>> { + if let Some(logs) = &tx.logs { logs.events.iter().rev().find_map(|event| { if event.identifier == "writeLog" { if let Some(data) = &event.data { @@ -123,14 +110,18 @@ fn process_new_deployed_address( tx_response.new_deployed_address = Some(Address::from(address)); } -fn process_new_issued_token_identifier(tx_response: &mut TxResponse) { - for scr in tx_response.api_scrs.iter() { +fn process_new_issued_token_identifier(tx_response: &mut TxResponse, tx: &TransactionOnNetwork) { + // let api_scrs = tx + // .smart_contract_results + // .as_ref() + // .expect("missing smart contract results"); + for scr in tx.smart_contract_results.iter() { if scr.sender.to_bech32_string().unwrap() != ESDTSystemSCAddress.to_bech32_string() { continue; } - let Some(prev_tx) = tx_response - .api_scrs + let Some(prev_tx) = tx + .smart_contract_results .iter() .find(|e| e.hash == scr.prev_tx_hash) else { @@ -177,8 +168,8 @@ fn process_new_issued_token_identifier(tx_response: &mut TxResponse) { } } -fn find_log<'a>(tx_response: &'a TxResponse, log_identifier: &str) -> Option<&'a Events> { - if let Some(logs) = &tx_response.api_logs { +fn find_log<'a>(tx: &'a TransactionOnNetwork, log_identifier: &str) -> Option<&'a Events> { + if let Some(logs) = &tx.logs { logs.events .iter() .find(|event| event.identifier == log_identifier) diff --git a/framework/snippets/tests/test_tx_multiple_sc_results.rs b/framework/snippets/tests/test_tx_multiple_sc_results.rs index 25e6fc477a..05d220fe8b 100644 --- a/framework/snippets/tests/test_tx_multiple_sc_results.rs +++ b/framework/snippets/tests/test_tx_multiple_sc_results.rs @@ -281,7 +281,7 @@ fn test_transaction_multiple_sc_results() { .data .unwrap() .transaction; - let tx_response = network_response::parse_tx_response(tx_on_network); - assert_eq!(tx_response.api_scrs.len(), 4usize); - assert!(is_out_scr(&tx_response.api_scrs.get(2).unwrap())); + assert_eq!(tx_on_network.smart_contract_results.len(), 4usize); + assert!(is_out_scr(&tx_on_network.smart_contract_results.get(2).unwrap())); + let _ = network_response::parse_tx_response(tx_on_network); } diff --git a/sdk/core/src/data/transaction.rs b/sdk/core/src/data/transaction.rs index ed0a51b8df..3ee2f25684 100644 --- a/sdk/core/src/data/transaction.rs +++ b/sdk/core/src/data/transaction.rs @@ -80,7 +80,8 @@ pub struct TransactionOnNetwork { pub status: String, pub hyperblock_nonce: Option, pub hyperblock_hash: Option, - pub smart_contract_results: Option>, + #[serde(default)] + pub smart_contract_results: Vec, pub logs: Option, } From 1b254608138d482eacdeffb8678aa030f3120f8e Mon Sep 17 00:00:00 2001 From: Andrei Marinica Date: Tue, 18 Jun 2024 18:16:42 +0300 Subject: [PATCH 2/6] network response cleanup --- framework/snippets/src/network_response.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/framework/snippets/src/network_response.rs b/framework/snippets/src/network_response.rs index e0d9ceea58..2fb336a7f9 100644 --- a/framework/snippets/src/network_response.rs +++ b/framework/snippets/src/network_response.rs @@ -42,7 +42,7 @@ fn process_signal_error(tx: &TransactionOnNetwork) -> TxResponseStatus { } fn process(tx_response: &mut TxResponse, tx: &TransactionOnNetwork) { - process_out(tx_response, tx); + tx_response.out = process_out(tx); process_new_deployed_address( tx_response, tx.sender.to_bytes(), @@ -52,13 +52,15 @@ fn process(tx_response: &mut TxResponse, tx: &TransactionOnNetwork) { process_new_issued_token_identifier(tx_response, tx); } -fn process_out(tx_response: &mut TxResponse, tx: &TransactionOnNetwork) { +fn process_out(tx: &TransactionOnNetwork) -> Vec> { let out_scr = tx.smart_contract_results.iter().find(is_out_scr); if let Some(out_scr) = out_scr { - tx_response.out = decode_scr_data_or_panic(&out_scr.data); + decode_scr_data_or_panic(&out_scr.data) } else if let Some(data) = process_out_from_log(tx) { - tx_response.out = data + data + } else { + Vec::new() } } From 5a831f5c02e23671879df86f14c05848894273ac Mon Sep 17 00:00:00 2001 From: Andrei Marinica Date: Tue, 18 Jun 2024 18:21:08 +0300 Subject: [PATCH 3/6] network response cleanup, clippy fix --- .../abi-tester/src/abi_test_type.rs | 1 + framework/base/src/storage/mappers/vec_mapper.rs | 2 +- framework/snippets/src/network_response.rs | 16 ++++++---------- 3 files changed, 8 insertions(+), 11 deletions(-) diff --git a/contracts/feature-tests/abi-tester/src/abi_test_type.rs b/contracts/feature-tests/abi-tester/src/abi_test_type.rs index 2928e81c89..c70f1aec42 100644 --- a/contracts/feature-tests/abi-tester/src/abi_test_type.rs +++ b/contracts/feature-tests/abi-tester/src/abi_test_type.rs @@ -45,5 +45,6 @@ pub struct OnlyShowsUpInEsdtAttr { #[derive(TypeAbi)] pub struct ManagedDecimalWrapper { + #[allow(dead_code)] pub field: ManagedDecimal>, } diff --git a/framework/base/src/storage/mappers/vec_mapper.rs b/framework/base/src/storage/mappers/vec_mapper.rs index de2eb55d82..9869130864 100644 --- a/framework/base/src/storage/mappers/vec_mapper.rs +++ b/framework/base/src/storage/mappers/vec_mapper.rs @@ -12,7 +12,7 @@ use crate::{ storage::{storage_clear, storage_set, StorageKey}, types::{ManagedAddress, ManagedType, MultiValueEncoded}, }; -use core::{marker::PhantomData, usize}; +use core::marker::PhantomData; const ITEM_SUFFIX: &[u8] = b".item"; const LEN_SUFFIX: &[u8] = b".len"; diff --git a/framework/snippets/src/network_response.rs b/framework/snippets/src/network_response.rs index 2fb336a7f9..a41e880f25 100644 --- a/framework/snippets/src/network_response.rs +++ b/framework/snippets/src/network_response.rs @@ -15,7 +15,7 @@ const LOG_IDENTIFIER_SIGNAL_ERROR: &str = "signalError"; pub fn parse_tx_response(tx: TransactionOnNetwork) -> TxResponse { let tx_error = process_signal_error(&tx); if !tx_error.is_success() { - TxResponse { + return TxResponse { tx_error, ..Default::default() }; @@ -43,8 +43,7 @@ fn process_signal_error(tx: &TransactionOnNetwork) -> TxResponseStatus { fn process(tx_response: &mut TxResponse, tx: &TransactionOnNetwork) { tx_response.out = process_out(tx); - process_new_deployed_address( - tx_response, + tx_response.new_deployed_address = process_new_deployed_address( tx.sender.to_bytes(), tx.nonce, tx.processing_type_on_destination.clone(), @@ -57,10 +56,8 @@ fn process_out(tx: &TransactionOnNetwork) -> Vec> { if let Some(out_scr) = out_scr { decode_scr_data_or_panic(&out_scr.data) - } else if let Some(data) = process_out_from_log(tx) { - data } else { - Vec::new() + process_out_from_log(tx).unwrap_or_default() } } @@ -86,13 +83,12 @@ fn process_out_from_log(tx: &TransactionOnNetwork) -> Option>> { } fn process_new_deployed_address( - tx_response: &mut TxResponse, sender_address_bytes: [u8; 32], nonce: u64, processing_type_on_destination: String, -) { +) -> Option
{ if processing_type_on_destination != SC_DEPLOY_PROCESSING_TYPE { - return; + return None; } let sender_nonce_bytes = nonce.to_le_bytes(); @@ -109,7 +105,7 @@ fn process_new_deployed_address( address[10..30].copy_from_slice(&address_keccak[10..30]); address[30..32].copy_from_slice(&sender_address_bytes[30..32]); - tx_response.new_deployed_address = Some(Address::from(address)); + Some(Address::from(address)) } fn process_new_issued_token_identifier(tx_response: &mut TxResponse, tx: &TransactionOnNetwork) { From b6904bbe23c466a1c61fdc372de311c9d73afaea Mon Sep 17 00:00:00 2001 From: Andrei Marinica Date: Tue, 18 Jun 2024 18:28:12 +0300 Subject: [PATCH 4/6] network response cleanup --- framework/snippets/src/network_response.rs | 17 +++++------------ .../tests/test_tx_multiple_sc_results.rs | 4 +++- 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/framework/snippets/src/network_response.rs b/framework/snippets/src/network_response.rs index a41e880f25..c2a2d79dea 100644 --- a/framework/snippets/src/network_response.rs +++ b/framework/snippets/src/network_response.rs @@ -43,11 +43,7 @@ fn process_signal_error(tx: &TransactionOnNetwork) -> TxResponseStatus { fn process(tx_response: &mut TxResponse, tx: &TransactionOnNetwork) { tx_response.out = process_out(tx); - tx_response.new_deployed_address = process_new_deployed_address( - tx.sender.to_bytes(), - tx.nonce, - tx.processing_type_on_destination.clone(), - ); + tx_response.new_deployed_address = process_new_deployed_address(tx); process_new_issued_token_identifier(tx_response, tx); } @@ -82,16 +78,13 @@ fn process_out_from_log(tx: &TransactionOnNetwork) -> Option>> { } } -fn process_new_deployed_address( - sender_address_bytes: [u8; 32], - nonce: u64, - processing_type_on_destination: String, -) -> Option
{ - if processing_type_on_destination != SC_DEPLOY_PROCESSING_TYPE { +fn process_new_deployed_address(tx: &TransactionOnNetwork) -> Option
{ + if &tx.processing_type_on_destination != SC_DEPLOY_PROCESSING_TYPE { return None; } - let sender_nonce_bytes = nonce.to_le_bytes(); + let sender_address_bytes = tx.sender.to_bytes(); + let sender_nonce_bytes = tx.nonce.to_le_bytes(); let mut bytes_to_hash: Vec = Vec::new(); bytes_to_hash.extend_from_slice(&sender_address_bytes); bytes_to_hash.extend_from_slice(&sender_nonce_bytes); diff --git a/framework/snippets/tests/test_tx_multiple_sc_results.rs b/framework/snippets/tests/test_tx_multiple_sc_results.rs index 05d220fe8b..4fee781b7f 100644 --- a/framework/snippets/tests/test_tx_multiple_sc_results.rs +++ b/framework/snippets/tests/test_tx_multiple_sc_results.rs @@ -282,6 +282,8 @@ fn test_transaction_multiple_sc_results() { .unwrap() .transaction; assert_eq!(tx_on_network.smart_contract_results.len(), 4usize); - assert!(is_out_scr(&tx_on_network.smart_contract_results.get(2).unwrap())); + assert!(is_out_scr( + &tx_on_network.smart_contract_results.get(2).unwrap() + )); let _ = network_response::parse_tx_response(tx_on_network); } From e72c67761b56463b9eda0d1bb73da78db53e0f7e Mon Sep 17 00:00:00 2001 From: Andrei Marinica Date: Tue, 18 Jun 2024 18:36:09 +0300 Subject: [PATCH 5/6] network response cleanup --- framework/snippets/src/network_response.rs | 30 +++++----------------- 1 file changed, 7 insertions(+), 23 deletions(-) diff --git a/framework/snippets/src/network_response.rs b/framework/snippets/src/network_response.rs index c2a2d79dea..83d47d6237 100644 --- a/framework/snippets/src/network_response.rs +++ b/framework/snippets/src/network_response.rs @@ -44,7 +44,7 @@ fn process_signal_error(tx: &TransactionOnNetwork) -> TxResponseStatus { fn process(tx_response: &mut TxResponse, tx: &TransactionOnNetwork) { tx_response.out = process_out(tx); tx_response.new_deployed_address = process_new_deployed_address(tx); - process_new_issued_token_identifier(tx_response, tx); + tx_response.new_issued_token_identifier = process_new_issued_token_identifier(tx); } fn process_out(tx: &TransactionOnNetwork) -> Vec> { @@ -79,7 +79,7 @@ fn process_out_from_log(tx: &TransactionOnNetwork) -> Option>> { } fn process_new_deployed_address(tx: &TransactionOnNetwork) -> Option
{ - if &tx.processing_type_on_destination != SC_DEPLOY_PROCESSING_TYPE { + if tx.processing_type_on_destination != SC_DEPLOY_PROCESSING_TYPE { return None; } @@ -101,11 +101,7 @@ fn process_new_deployed_address(tx: &TransactionOnNetwork) -> Option
{ Some(Address::from(address)) } -fn process_new_issued_token_identifier(tx_response: &mut TxResponse, tx: &TransactionOnNetwork) { - // let api_scrs = tx - // .smart_contract_results - // .as_ref() - // .expect("missing smart contract results"); +fn process_new_issued_token_identifier(tx: &TransactionOnNetwork) -> Option { for scr in tx.smart_contract_results.iter() { if scr.sender.to_bech32_string().unwrap() != ESDTSystemSCAddress.to_bech32_string() { continue; @@ -137,26 +133,14 @@ fn process_new_issued_token_identifier(tx_response: &mut TxResponse, tx: &Transa if scr.data.starts_with("ESDTTransfer@") { let encoded_tid = scr.data.split('@').nth(1); - if encoded_tid.is_none() { - return; - } - - tx_response.new_issued_token_identifier = - Some(String::from_utf8(hex::decode(encoded_tid.unwrap()).unwrap()).unwrap()); - - break; + return Some(String::from_utf8(hex::decode(encoded_tid?).unwrap()).unwrap()); } else if scr.data.starts_with("@00@") { let encoded_tid = scr.data.split('@').nth(2); - if encoded_tid.is_none() { - return; - } - - tx_response.new_issued_token_identifier = - Some(String::from_utf8(hex::decode(encoded_tid.unwrap()).unwrap()).unwrap()); - - break; + return Some(String::from_utf8(hex::decode(encoded_tid?).unwrap()).unwrap()); } } + + None } fn find_log<'a>(tx: &'a TransactionOnNetwork, log_identifier: &str) -> Option<&'a Events> { From 0282f58c7a1f6139d41f939930443a2c7483517e Mon Sep 17 00:00:00 2001 From: Andrei Marinica Date: Tue, 18 Jun 2024 18:39:39 +0300 Subject: [PATCH 6/6] network response cleanup --- framework/snippets/src/network_response.rs | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/framework/snippets/src/network_response.rs b/framework/snippets/src/network_response.rs index 83d47d6237..d505e7a525 100644 --- a/framework/snippets/src/network_response.rs +++ b/framework/snippets/src/network_response.rs @@ -21,9 +21,7 @@ pub fn parse_tx_response(tx: TransactionOnNetwork) -> TxResponse { }; } - let mut response = TxResponse::default(); - process(&mut response, &tx); - response + process_success(&tx) } fn process_signal_error(tx: &TransactionOnNetwork) -> TxResponseStatus { @@ -41,10 +39,13 @@ fn process_signal_error(tx: &TransactionOnNetwork) -> TxResponseStatus { TxResponseStatus::default() } -fn process(tx_response: &mut TxResponse, tx: &TransactionOnNetwork) { - tx_response.out = process_out(tx); - tx_response.new_deployed_address = process_new_deployed_address(tx); - tx_response.new_issued_token_identifier = process_new_issued_token_identifier(tx); +fn process_success(tx: &TransactionOnNetwork) -> TxResponse { + TxResponse { + out: process_out(tx), + new_deployed_address: process_new_deployed_address(tx), + new_issued_token_identifier: process_new_issued_token_identifier(tx), + ..Default::default() + } } fn process_out(tx: &TransactionOnNetwork) -> Vec> {