From 5e89aa773210480c40d02d9415a1f293f6f63cf5 Mon Sep 17 00:00:00 2001 From: Alin Cruceat Date: Tue, 11 Jul 2023 10:58:38 +0300 Subject: [PATCH 01/15] reorganize --- framework/meta/src/template.rs | 2 + .../meta/src/template/repo_temp_download.rs | 9 ++- .../meta/src/template/template_adjuster.rs | 65 ++++++++++++++++++ .../meta/src/template/template_download.rs | 66 ++----------------- framework/meta/tests/template_test.rs | 12 +--- 5 files changed, 81 insertions(+), 73 deletions(-) create mode 100644 framework/meta/src/template/template_adjuster.rs diff --git a/framework/meta/src/template.rs b/framework/meta/src/template.rs index a9cf4f2aea..38ec4d37f1 100644 --- a/framework/meta/src/template.rs +++ b/framework/meta/src/template.rs @@ -1,9 +1,11 @@ mod repo_temp_download; +mod template_adjuster; mod template_download; mod template_list; mod template_metadata; mod template_source; pub use repo_temp_download::{RepoSource, RepoTempDownload}; +pub use template_adjuster::TemplateAdjuster; pub use template_download::{template_download, TemplateDownloader}; pub use template_list::{print_template_names, template_names_from_repo}; diff --git a/framework/meta/src/template/repo_temp_download.rs b/framework/meta/src/template/repo_temp_download.rs index 1669278707..458c594f04 100644 --- a/framework/meta/src/template/repo_temp_download.rs +++ b/framework/meta/src/template/repo_temp_download.rs @@ -1,6 +1,6 @@ use std::{ fs::{self, File}, - io::Write, + io::{ErrorKind, Write}, path::{Path, PathBuf}, }; @@ -101,7 +101,12 @@ impl RepoTempDownload { } fn delete_temp_folder(&self) { - fs::remove_dir_all(self.repository_temp_dir_path()).unwrap(); + fs::remove_dir_all(self.repository_temp_dir_path()).unwrap_or_else(|error| { + // don't throw error if the temp repo doesn't exist + if error.kind() != ErrorKind::NotFound { + panic!("{:?}", error); + } + }); } } diff --git a/framework/meta/src/template/template_adjuster.rs b/framework/meta/src/template/template_adjuster.rs new file mode 100644 index 0000000000..2529853f59 --- /dev/null +++ b/framework/meta/src/template/template_adjuster.rs @@ -0,0 +1,65 @@ +use toml::value::Table; + +use crate::CargoTomlContents; + +use super::TemplateDownloader; + +const ROOT_CARGO_TOML: &str = "./Cargo.toml"; +const META_CARGO_TOML: &str = "./meta/Cargo.toml"; +const WASM_CARGO_TOML: &str = "./wasm/Cargo.toml"; + +pub struct TemplateAdjuster; + +impl TemplateAdjuster { + pub fn update_dependencies(&self, downloader: &TemplateDownloader) { + self.update_dependencies_root(downloader); + self.update_dependencies_wasm(downloader); + self.update_dependencies_meta(downloader); + } + + fn update_dependencies_root(&self, downloader: &TemplateDownloader) { + let cargo_toml_path = downloader.target_path.join(ROOT_CARGO_TOML); + let mut toml = CargoTomlContents::load_from_file(&cargo_toml_path); + + let deps_map = toml.dependencies_mut(); + remove_paths_from_dependencies(deps_map, &[]); + + let dev_deps_map = toml.dev_dependencies_mut(); + remove_paths_from_dependencies(dev_deps_map, &[]); + toml.insert_default_workspace(); + + toml.save_to_file(&cargo_toml_path); + } + + fn update_dependencies_meta(&self, downloader: &TemplateDownloader) { + let cargo_toml_path = downloader.target_path.join(META_CARGO_TOML); + let mut toml = CargoTomlContents::load_from_file(&cargo_toml_path); + + let deps_map = toml.dependencies_mut(); + remove_paths_from_dependencies(deps_map, &[self.template_name(downloader).as_str()]); + + toml.save_to_file(&cargo_toml_path); + } + + fn update_dependencies_wasm(&self, downloader: &TemplateDownloader) { + let cargo_toml_path = downloader.target_path.join(WASM_CARGO_TOML); + let mut toml = CargoTomlContents::load_from_file(&cargo_toml_path); + + let deps_map = toml.dependencies_mut(); + remove_paths_from_dependencies(deps_map, &[self.template_name(downloader).as_str()]); + + toml.save_to_file(&cargo_toml_path); + } + + fn template_name(&self, downloader: &TemplateDownloader) -> String { + downloader.template_source.metadata.name.clone() + } +} +pub fn remove_paths_from_dependencies(deps_map: &mut Table, ignore_deps: &[&str]) { + for (key, value) in deps_map { + if ignore_deps.contains(&key.as_str()) { + continue; + } + value.as_table_mut().unwrap().remove("path"); + } +} diff --git a/framework/meta/src/template/template_download.rs b/framework/meta/src/template/template_download.rs index c19010638b..cb30dd1b6b 100644 --- a/framework/meta/src/template/template_download.rs +++ b/framework/meta/src/template/template_download.rs @@ -1,18 +1,13 @@ use std::path::PathBuf; -use toml::value::Table; - -use crate::{cli_args::TemplateArgs, CargoTomlContents}; +use crate::cli_args::TemplateArgs; use super::{ repo_temp_download::RepoSource, template_source::{template_sources, TemplateSource}, + TemplateAdjuster, }; -const ROOT_CARGO_TOML: &str = "./Cargo.toml"; -const META_CARGO_TOML: &str = "./meta/Cargo.toml"; -const WASM_CARGO_TOML: &str = "./wasm/Cargo.toml"; - pub async fn template_download(args: &TemplateArgs) { let repo_temp_download = RepoSource::download_from_github(std::env::temp_dir()).await; let downloader = TemplateDownloader::new( @@ -27,6 +22,7 @@ pub struct TemplateDownloader<'a> { pub repo_source: &'a RepoSource, pub template_source: TemplateSource<'a>, pub target_path: PathBuf, + pub adjuster: TemplateAdjuster, } impl<'a> TemplateDownloader<'a> { @@ -41,64 +37,12 @@ impl<'a> TemplateDownloader<'a> { repo_source, template_source, target_path, + adjuster: TemplateAdjuster, } } pub fn template_download(&self) { self.template_source.copy_template(&self.target_path); - self.update_dependencies(); - } - - fn update_dependencies(&self) { - self.update_dependencies_root(); - self.update_dependencies_wasm(); - self.update_dependencies_meta(); - } - - fn template_name(&self) -> String { - self.template_source.metadata.name.clone() - } - - fn update_dependencies_root(&self) { - let cargo_toml_path = self.target_path.join(ROOT_CARGO_TOML); - let mut toml = CargoTomlContents::load_from_file(&cargo_toml_path); - - let deps_map = toml.dependencies_mut(); - remove_paths_from_dependencies(deps_map, &[]); - - let dev_deps_map = toml.dev_dependencies_mut(); - remove_paths_from_dependencies(dev_deps_map, &[]); - toml.insert_default_workspace(); - - toml.save_to_file(&cargo_toml_path); - } - - fn update_dependencies_meta(&self) { - let cargo_toml_path = self.target_path.join(META_CARGO_TOML); - let mut toml = CargoTomlContents::load_from_file(&cargo_toml_path); - - let deps_map = toml.dependencies_mut(); - remove_paths_from_dependencies(deps_map, &[self.template_name().as_str()]); - - toml.save_to_file(&cargo_toml_path); - } - - pub fn update_dependencies_wasm(&self) { - let cargo_toml_path = self.target_path.join(WASM_CARGO_TOML); - let mut toml = CargoTomlContents::load_from_file(&cargo_toml_path); - - let deps_map = toml.dependencies_mut(); - remove_paths_from_dependencies(deps_map, &[self.template_name().as_str()]); - - toml.save_to_file(&cargo_toml_path); - } -} - -pub fn remove_paths_from_dependencies(deps_map: &mut Table, ignore_deps: &[&str]) { - for (key, value) in deps_map { - if ignore_deps.contains(&key.as_str()) { - continue; - } - value.as_table_mut().unwrap().remove("path"); + self.adjuster.update_dependencies(&self); } } diff --git a/framework/meta/tests/template_test.rs b/framework/meta/tests/template_test.rs index 6ca110412b..6cd33eb518 100644 --- a/framework/meta/tests/template_test.rs +++ b/framework/meta/tests/template_test.rs @@ -29,18 +29,10 @@ async fn test_template_download() { let target_dir = template_temp_path.join("new-adder"); - // let args = TemplateArgs { - // name: target_dir.clone(), - // template: "adder".to_string(), - // }; - let downloader = TemplateDownloader::new(&repo_source, "adder".to_string(), target_dir); + let downloader = TemplateDownloader::new(&repo_source, "adder".to_string(), target_dir.clone()); downloader.template_download(); - // let _ = TemplateCreator::with_path(template_temp_path) - // .download_contract_template(&args) - // .await; - - // cargo_test(build_dir); + cargo_test(target_dir); } pub fn cargo_test(contract_location: PathBuf) { From 8c5a9d46d5c99fa6e946f316c753bc8cdb6fe47a Mon Sep 17 00:00:00 2001 From: Alin Cruceat Date: Wed, 19 Jul 2023 14:32:08 +0300 Subject: [PATCH 02/15] Master into feat template (#1173) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Implement `IntoIterator` for storage mappers and some types * Use explicit `Item` types in `IntoIterator` impls * sc-meta test generator tool * sc-meta test generator tool - refactor, test, whitespace fix * sc-meta test generator tool - create flag * cleanup * updated tests using sc-meta test-gen * cargo fmt * implementation * clippy * fix depositor * undo actions * undo actions * fix tests part 1 * fix tests part 2 * fix tests 2 * forward + test * claim tests update * swap indexes for UnorderedSetMapper (#1033) * implementation + test * update test * fix set index * fix indexes * add sanity check for index * update description * test swap case indexes equal * fix after review * sc 0.39.8, vm 0.1.8 * publish.sh instructions update * Cargo.lock update * call value egld as ManagedRef * call value all esdts as ManagedRef * call value - removed esdt_value() * clippy fix * sc 0.40.0, vm 0.2.0 * Cargo.lock update * meta crate EI checker * clippy fix * cleanup * ManagedVecItem impl for arrays * ManagedVecItem payload size cleanup * sc 0.40.1, vm 0.2.1 * Cargo.lock update * allocator syntax changes for rustc 1.71.0 * Use new github workflow (by commit hash). * Use newer workflow. * Use newer workflow. * Use newer workflow. * Use newer workflow. * removed unnecessary alloc feature flags * github action fix * version fix * Allocator option in multicontract.toml * clippy fix * panic fmt managed implementation * panic fmt value formatting test * Added missing allocator config * new allocators: LeakingAllocator, StaticAllocator * deprecated legacy methods from API wrappers * deleted test-gen tool * wasm-adapter refactor * wasm macro fix * simplified allocators * doc fix * Fix `assert_positive` function * Remove commented code * allocator memory_size function * BigUint bitwise operation integration tests * stack size in multicontract.toml * packing abi + contract binary in one file * stack size examples * printing contract size * sc file build info in root * meta crate reorg * test fix * meta crate reorg: output contract * meta crate reorg * meta crate reorg: renamed sc_file_json -> mxsc_file_json * codec moved under /data * Cargo.lock update * sc 0.41.0, vm 0.3.0 * changelog update * Cargo.lock update * format-tests dependency fix * update default issue callback * check if token state is pending * check pending on simple issue * clippy * test fix * tests update part2 * default issue callback set consistency * test fixes part 3 * is not available bug fix * fix test with empty string value * add example inside snippet * change check not set or pending * fungible token mapper refactor * top encode backwards compatibility * undo encoding in test * encoding fix in checks * remove match from read token id * fix text with empty storage as reset * fix custom callback set token id * undo storage mapper fungible token set * remove set `notset` value * fix decoding * add clear to custom callbacks * rename check + add clear to error * default callbacks direct set storage * token_mapper have TokenMapperState in memory * update snippet * token mapper bugfix * token mappers folder * sc 0.41.1, vm 0.3.1 * publish.sh update * Cargo.lock update * fix comment * Digital cash fix (#1078) * digital cash changes 1 * private key handles 1 single deposit * digital cash lib rs update * update readme digital cash * digital cash tests update part 1 * scenatio update part 1 * update key and signatures * claim fees + more tests * update claim tests * fix signatures * multi esdt tests * readme update * Update contracts/examples/digital-cash/src/digital_cash.rs Co-authored-by: dorin-iancu <72252689+dorin-iancu@users.noreply.github.com> * fix after review --------- Co-authored-by: dorin-iancu <72252689+dorin-iancu@users.noreply.github.com> * chore(sdk/core): bump bip39 to v2.0.0 * chore(sdk/core): bump rand to v0.8.5 * sc 0.41.2, codec 0.17.2, vm 0.3.2 * update Cargo.lock * fixed deploy on devnet (signed) * explicit enum ABI * large-storage contract & test * ManagedBufferCachedBuilder bugfix * sc 0.41.3, vm 0.3.3 * Cargo.lock update * meta all command pretty print current index * proxy-pause sc use a proper sc for extension (#1138) * proxy- pause sc use a proper sc for extension * update cargo toml version * fix contract builder to proxy-pause test * update all contracts * rebranding * master merge leftovers --------- Co-authored-by: Oleksandr Movchan Co-authored-by: Andrei Marinica Co-authored-by: Andrei Marinica Co-authored-by: Robert Sasu Co-authored-by: Andrei Băncioiu Co-authored-by: Costin Carabaș Co-authored-by: dorin.iancu Co-authored-by: dorin-iancu <72252689+dorin-iancu@users.noreply.github.com> Co-authored-by: rupansh Co-authored-by: Bogdan --- .github/workflows/actions.yml | 4 +- CHANGELOG.md | 34 ++ Cargo.toml | 10 +- README.md | 2 +- contracts/benchmarks/large-storage/.gitignore | 7 + contracts/benchmarks/large-storage/Cargo.toml | 17 + .../benchmarks/large-storage/meta/Cargo.toml | 12 + .../benchmarks/large-storage/meta/src/main.rs | 3 + .../benchmarks/large-storage/multiversx.json | 3 + contracts/benchmarks/large-storage/pi.txt | 1 + .../scenarios/large_storage.scen.json | 82 +++++ .../large-storage/src/large_storage.rs | 36 ++ .../tests/large_storage_go_test.rs | 4 + .../tests/large_storage_rs_test.rs | 16 + .../benchmarks/large-storage/wasm/Cargo.lock | 209 +++++++++++ .../benchmarks/large-storage/wasm/Cargo.toml | 26 ++ .../benchmarks/large-storage/wasm/src/lib.rs | 26 ++ .../mappers/benchmark-common/Cargo.toml | 4 +- .../mappers/linked-list-repeat/Cargo.toml | 4 +- .../linked-list-repeat/meta/Cargo.toml | 2 +- .../tests/scenario_go_test.rs | 8 +- .../tests/scenario_rs_test.rs | 8 +- .../linked-list-repeat/wasm/Cargo.lock | 85 +---- .../linked-list-repeat/wasm/Cargo.toml | 2 +- .../linked-list-repeat/wasm/src/lib.rs | 2 +- .../benchmarks/mappers/map-repeat/Cargo.toml | 4 +- .../mappers/map-repeat/meta/Cargo.toml | 2 +- .../map-repeat/tests/scenario_go_test.rs | 8 +- .../map-repeat/tests/scenario_rs_test.rs | 8 +- .../mappers/map-repeat/wasm/Cargo.lock | 85 +---- .../mappers/map-repeat/wasm/Cargo.toml | 2 +- .../mappers/map-repeat/wasm/src/lib.rs | 2 +- .../mappers/queue-repeat/Cargo.toml | 4 +- .../mappers/queue-repeat/meta/Cargo.toml | 2 +- .../queue-repeat/tests/scenario_go_test.rs | 5 + .../queue-repeat/tests/scenario_rs_test.rs | 8 +- .../mappers/queue-repeat/wasm/Cargo.lock | 85 +---- .../mappers/queue-repeat/wasm/Cargo.toml | 2 +- .../mappers/queue-repeat/wasm/src/lib.rs | 2 +- .../benchmarks/mappers/set-repeat/Cargo.toml | 4 +- .../mappers/set-repeat/meta/Cargo.toml | 2 +- .../set-repeat/tests/scenario_go_test.rs | 8 +- .../set-repeat/tests/scenario_rs_test.rs | 8 +- .../mappers/set-repeat/wasm/Cargo.lock | 85 +---- .../mappers/set-repeat/wasm/Cargo.toml | 2 +- .../mappers/set-repeat/wasm/src/lib.rs | 2 +- .../mappers/single-value-repeat/Cargo.toml | 4 +- .../single-value-repeat/meta/Cargo.toml | 2 +- .../tests/scenario_go_test.rs | 8 +- .../tests/scenario_rs_test.rs | 8 +- .../single-value-repeat/wasm/Cargo.lock | 85 +---- .../single-value-repeat/wasm/Cargo.toml | 2 +- .../single-value-repeat/wasm/src/lib.rs | 2 +- .../benchmarks/mappers/vec-repeat/Cargo.toml | 4 +- .../mappers/vec-repeat/meta/Cargo.toml | 2 +- .../vec-repeat/tests/scenario_go_test.rs | 8 +- .../vec-repeat/tests/scenario_rs_test.rs | 8 +- .../mappers/vec-repeat/wasm/Cargo.lock | 85 +---- .../mappers/vec-repeat/wasm/Cargo.toml | 2 +- .../mappers/vec-repeat/wasm/src/lib.rs | 2 +- .../benchmarks/send-tx-repeat/Cargo.toml | 5 +- .../benchmarks/send-tx-repeat/meta/Cargo.toml | 2 +- .../benchmarks/send-tx-repeat/wasm/Cargo.lock | 85 +---- .../benchmarks/send-tx-repeat/wasm/Cargo.toml | 2 +- .../benchmarks/send-tx-repeat/wasm/src/lib.rs | 2 +- contracts/benchmarks/str-repeat/Cargo.toml | 4 +- .../benchmarks/str-repeat/meta/Cargo.toml | 2 +- .../benchmarks/str-repeat/multicontract.toml | 7 + .../str-repeat/tests/scenario_rs_test.rs | 2 +- .../benchmarks/str-repeat/wasm/Cargo.lock | 85 +---- .../benchmarks/str-repeat/wasm/Cargo.toml | 2 +- .../benchmarks/str-repeat/wasm/src/lib.rs | 4 +- contracts/core/price-aggregator/Cargo.toml | 10 +- .../core/price-aggregator/meta/Cargo.toml | 4 +- .../core/price-aggregator/wasm/Cargo.lock | 89 +---- .../core/price-aggregator/wasm/Cargo.toml | 2 +- .../core/price-aggregator/wasm/src/lib.rs | 2 +- contracts/core/wegld-swap/Cargo.toml | 10 +- contracts/core/wegld-swap/meta/Cargo.toml | 4 +- contracts/core/wegld-swap/src/wegld.rs | 4 +- .../tests/wegld_swap_scenario_rs_test.rs | 22 ++ contracts/core/wegld-swap/wasm/Cargo.toml | 2 +- contracts/core/wegld-swap/wasm/src/lib.rs | 2 +- contracts/examples/adder/Cargo.toml | 4 +- contracts/examples/adder/meta/Cargo.toml | 2 +- contracts/examples/adder/wasm/Cargo.lock | 85 +---- contracts/examples/adder/wasm/Cargo.toml | 2 +- contracts/examples/adder/wasm/src/lib.rs | 2 +- .../bonding-curve-contract/Cargo.toml | 6 +- .../bonding-curve-contract/meta/Cargo.toml | 2 +- .../tests/bonding_curve_scenario_go_test.rs | 28 +- .../tests/bonding_curve_scenario_rs_test.rs | 28 +- .../bonding-curve-contract/wasm/Cargo.lock | 87 +---- .../bonding-curve-contract/wasm/Cargo.toml | 2 +- .../bonding-curve-contract/wasm/src/lib.rs | 2 +- contracts/examples/check-pause/.gitignore | 7 + contracts/examples/check-pause/Cargo.toml | 25 ++ .../examples/check-pause/meta/Cargo.toml | 13 + .../examples/check-pause/meta/src/main.rs | 3 + .../examples/check-pause/multiversx.json | 3 + .../examples/check-pause/src/check_pause.rs | 16 + .../examples/check-pause/wasm/Cargo.lock | 217 +++++++++++ .../examples/check-pause/wasm/Cargo.toml | 28 ++ .../examples/check-pause/wasm/src/lib.rs | 28 ++ .../examples/crowdfunding-esdt/Cargo.toml | 4 +- .../crowdfunding-esdt/interaction/alice.pem | 5 + .../interaction/devnet.snippets.sh | 14 +- .../crowdfunding-esdt/meta/Cargo.toml | 2 +- .../crowdfunding_esdt_scenario_go_test.rs | 20 + .../crowdfunding_esdt_scenario_rs_test.rs | 20 + .../crowdfunding-esdt/wasm/Cargo.lock | 85 +---- .../crowdfunding-esdt/wasm/Cargo.toml | 2 +- .../crowdfunding-esdt/wasm/src/lib.rs | 2 +- contracts/examples/crypto-bubbles/Cargo.toml | 4 +- .../examples/crypto-bubbles/meta/Cargo.toml | 2 +- .../crypto-bubbles/src/crypto_bubbles.rs | 2 +- .../tests/crypto_bubbles_scenario_go_test.rs | 16 +- .../tests/crypto_bubbles_scenario_rs_test.rs | 16 +- .../examples/crypto-bubbles/wasm/Cargo.lock | 85 +---- .../examples/crypto-bubbles/wasm/Cargo.toml | 2 +- .../examples/crypto-bubbles/wasm/src/lib.rs | 2 +- .../crypto-kitties/common/kitty/Cargo.toml | 2 +- .../crypto-kitties/common/random/Cargo.toml | 2 +- .../crypto-kitties/kitty-auction/Cargo.toml | 4 +- .../kitty-auction/meta/Cargo.toml | 2 +- .../crypto-kitties/kitty-auction/src/lib.rs | 8 +- .../kitty-auction/wasm/Cargo.lock | 85 +---- .../kitty-auction/wasm/Cargo.toml | 2 +- .../kitty-auction/wasm/src/lib.rs | 2 +- .../kitty-genetic-alg/Cargo.toml | 4 +- .../kitty-genetic-alg/meta/Cargo.toml | 2 +- .../kitty-genetic-alg/wasm/Cargo.lock | 85 +---- .../kitty-genetic-alg/wasm/Cargo.toml | 2 +- .../kitty-genetic-alg/wasm/src/lib.rs | 2 +- .../crypto-kitties/kitty-ownership/Cargo.toml | 4 +- .../kitty-ownership/meta/Cargo.toml | 2 +- .../crypto-kitties/kitty-ownership/src/lib.rs | 2 +- .../kitty-ownership/wasm/Cargo.lock | 85 +---- .../kitty-ownership/wasm/Cargo.toml | 2 +- .../kitty-ownership/wasm/src/lib.rs | 2 +- contracts/examples/crypto-zombies/Cargo.toml | 4 +- .../examples/crypto-zombies/meta/Cargo.toml | 2 +- .../crypto-zombies/src/zombie_helper.rs | 2 +- .../examples/crypto-zombies/wasm/Cargo.lock | 85 +---- .../examples/crypto-zombies/wasm/Cargo.toml | 2 +- .../examples/crypto-zombies/wasm/src/lib.rs | 2 +- contracts/examples/digital-cash/Cargo.toml | 4 +- contracts/examples/digital-cash/README.md | 29 ++ .../examples/digital-cash/meta/Cargo.toml | 2 +- .../scenarios/claim-egld.scen.json | 169 +++------ .../scenarios/claim-esdt.scen.json | 178 +++------ .../scenarios/claim-fees.scen.json | 125 +++++++ .../scenarios/claim-multi-esdt.scen.json | 191 ++++++++++ .../digital-cash/scenarios/forward.scen.json | 206 +++++++++++ .../scenarios/fund-egld-and-esdt.scen.json | 341 ++++++++++++++++-- .../scenarios/set-accounts.scen.json | 54 ++- .../scenarios/withdraw-egld.scen.json | 138 ++++--- .../scenarios/withdraw-esdt.scen.json | 139 ++++--- .../scenarios/withdraw-multi-esdt.scen.json | 231 ++++++++++++ .../examples/digital-cash/src/deposit_info.rs | 24 +- .../examples/digital-cash/src/digital_cash.rs | 236 ++++++++++-- .../tests/digital_cash_scenario_go_test.rs | 10 + .../tests/digital_cash_scenario_rs_test.rs | 12 +- .../examples/digital-cash/wasm/Cargo.lock | 85 +---- .../examples/digital-cash/wasm/Cargo.toml | 2 +- .../examples/digital-cash/wasm/src/lib.rs | 9 +- contracts/examples/empty/Cargo.toml | 4 +- contracts/examples/empty/meta/Cargo.toml | 2 +- contracts/examples/empty/wasm/Cargo.lock | 85 +---- contracts/examples/empty/wasm/Cargo.toml | 2 +- contracts/examples/empty/wasm/src/lib.rs | 2 +- .../esdt-transfer-with-fee/Cargo.toml | 4 +- .../esdt-transfer-with-fee/meta/Cargo.toml | 2 +- .../src/esdt_transfer_with_fee.rs | 2 +- ...esdt_transfer_with_fee_scenario_go_test.rs | 12 +- ...esdt_transfer_with_fee_scenario_rs_test.rs | 12 +- .../esdt-transfer-with-fee/wasm/Cargo.lock | 85 +---- .../esdt-transfer-with-fee/wasm/Cargo.toml | 2 +- .../esdt-transfer-with-fee/wasm/src/lib.rs | 2 +- contracts/examples/factorial/Cargo.toml | 4 +- contracts/examples/factorial/meta/Cargo.toml | 2 +- contracts/examples/factorial/wasm/Cargo.lock | 85 +---- contracts/examples/factorial/wasm/Cargo.toml | 2 +- contracts/examples/factorial/wasm/src/lib.rs | 2 +- contracts/examples/fractional-nfts/Cargo.toml | 6 +- .../examples/fractional-nfts/meta/Cargo.toml | 2 +- .../fractional-nfts/src/fractional_nfts.rs | 2 +- .../examples/fractional-nfts/wasm/Cargo.lock | 87 +---- .../examples/fractional-nfts/wasm/Cargo.toml | 2 +- .../examples/fractional-nfts/wasm/src/lib.rs | 2 +- contracts/examples/lottery-esdt/Cargo.toml | 4 +- .../examples/lottery-esdt/documentation.md | 2 +- .../examples/lottery-esdt/meta/Cargo.toml | 2 +- .../tests/lottery_esdt_scenario_go_test.rs | 2 +- .../tests/lottery_esdt_scenario_rs_test.rs | 43 ++- .../examples/lottery-esdt/wasm/Cargo.lock | 85 +---- .../examples/lottery-esdt/wasm/Cargo.toml | 2 +- .../examples/lottery-esdt/wasm/src/lib.rs | 2 +- contracts/examples/multisig/Cargo.toml | 6 +- contracts/examples/multisig/README.md | 6 +- .../examples/multisig/interact-rs/Cargo.toml | 4 +- .../examples/multisig/interact-rs/state.toml | 1 + contracts/examples/multisig/meta/Cargo.toml | 2 +- .../tests/multisig_scenario_go_test.rs | 24 +- .../tests/multisig_scenario_rs_test.rs | 20 +- .../multisig/wasm-multisig-full/Cargo.lock | 87 +---- .../multisig/wasm-multisig-full/Cargo.toml | 2 +- .../multisig/wasm-multisig-full/src/lib.rs | 2 +- .../multisig/wasm-multisig-view/Cargo.lock | 87 +---- .../multisig/wasm-multisig-view/Cargo.toml | 2 +- .../multisig/wasm-multisig-view/src/lib.rs | 2 +- contracts/examples/multisig/wasm/Cargo.lock | 87 +---- contracts/examples/multisig/wasm/Cargo.toml | 2 +- contracts/examples/multisig/wasm/src/lib.rs | 2 +- contracts/examples/nft-minter/Cargo.toml | 4 +- contracts/examples/nft-minter/meta/Cargo.toml | 2 +- .../examples/nft-minter/src/nft_module.rs | 2 +- .../tests/nft_minter_scenario_rs_test.rs | 23 ++ .../nft-minter/tests/scenario_go_test.rs | 8 +- contracts/examples/nft-minter/wasm/Cargo.lock | 85 +---- contracts/examples/nft-minter/wasm/Cargo.toml | 2 +- contracts/examples/nft-minter/wasm/src/lib.rs | 2 +- .../examples/nft-storage-prepay/Cargo.toml | 4 +- .../nft-storage-prepay/meta/Cargo.toml | 2 +- .../src/nft_storage_prepay.rs | 3 +- .../nft-storage-prepay/wasm/Cargo.lock | 85 +---- .../nft-storage-prepay/wasm/Cargo.toml | 2 +- .../nft-storage-prepay/wasm/src/lib.rs | 2 +- contracts/examples/order-book/.gitignore | 2 +- .../examples/order-book/factory/Cargo.toml | 4 +- .../order-book/factory/meta/Cargo.toml | 2 +- .../order-book/factory/wasm/Cargo.lock | 85 +---- .../order-book/factory/wasm/Cargo.toml | 2 +- .../order-book/factory/wasm/src/lib.rs | 2 +- contracts/examples/order-book/pair/Cargo.toml | 7 +- .../examples/order-book/pair/meta/Cargo.toml | 2 +- .../pair/tests/pair_scenario_go_test.rs | 29 ++ .../pair/tests/pair_scenario_rs_test.rs | 42 +++ .../examples/order-book/pair/wasm/Cargo.lock | 85 +---- .../examples/order-book/pair/wasm/Cargo.toml | 2 +- .../examples/order-book/pair/wasm/src/lib.rs | 2 +- contracts/examples/ping-pong-egld/Cargo.toml | 4 +- .../examples/ping-pong-egld/meta/Cargo.toml | 2 +- .../examples/ping-pong-egld/src/ping_pong.rs | 4 +- .../tests/ping_pong_egld_scenario_rs_test.rs | 26 ++ .../examples/ping-pong-egld/wasm/Cargo.lock | 85 +---- .../examples/ping-pong-egld/wasm/Cargo.toml | 2 +- .../examples/ping-pong-egld/wasm/src/lib.rs | 2 +- contracts/examples/proxy-pause/Cargo.toml | 9 +- .../examples/proxy-pause/meta/Cargo.toml | 2 +- .../proxy-pause/scenarios/init.scen.json | 8 +- .../scenarios/pause-and-unpause.scen.json | 6 +- .../tests/proxy_pause_scenario_go_test.rs | 7 +- .../tests/proxy_pause_scenario_rs_test.rs | 11 +- .../examples/proxy-pause/wasm/Cargo.lock | 85 +---- .../examples/proxy-pause/wasm/Cargo.toml | 2 +- .../examples/proxy-pause/wasm/src/lib.rs | 2 +- .../examples/rewards-distribution/Cargo.toml | 6 +- .../rewards-distribution/meta/Cargo.toml | 2 +- .../rewards-distribution/wasm/Cargo.lock | 87 +---- .../rewards-distribution/wasm/Cargo.toml | 2 +- .../rewards-distribution/wasm/src/lib.rs | 2 +- contracts/examples/seed-nft-minter/Cargo.toml | 6 +- .../examples/seed-nft-minter/meta/Cargo.toml | 2 +- .../seed-nft-minter/src/nft_module.rs | 2 +- .../examples/seed-nft-minter/wasm/Cargo.lock | 87 +---- .../examples/seed-nft-minter/wasm/Cargo.toml | 2 +- .../examples/seed-nft-minter/wasm/src/lib.rs | 2 +- contracts/examples/token-release/Cargo.toml | 4 +- .../examples/token-release/meta/Cargo.toml | 2 +- .../tests/token_release_scenario_go_test.rs | 12 +- .../tests/token_release_scenario_rs_test.rs | 12 +- .../examples/token-release/wasm/Cargo.lock | 85 +---- .../examples/token-release/wasm/Cargo.toml | 2 +- .../examples/token-release/wasm/src/lib.rs | 2 +- contracts/feature-tests/abi-tester/Cargo.toml | 6 +- .../abi_tester_expected_main.abi.json | 2 +- .../abi_tester_expected_view.abi.json | 2 +- .../feature-tests/abi-tester/meta/Cargo.toml | 2 +- .../abi-tester/wasm-abi-tester-ev/Cargo.lock | 85 +---- .../abi-tester/wasm-abi-tester-ev/Cargo.toml | 2 +- .../abi-tester/wasm-abi-tester-ev/src/lib.rs | 2 +- .../feature-tests/abi-tester/wasm/Cargo.lock | 85 +---- .../feature-tests/abi-tester/wasm/Cargo.toml | 2 +- .../feature-tests/abi-tester/wasm/src/lib.rs | 2 +- .../feature-tests/alloc-features/Cargo.toml | 4 +- .../alloc-features/meta/Cargo.toml | 2 +- .../alloc-features/multicontract.toml | 8 + .../src/crypto_features_alloc.rs | 2 + .../src/elliptic_curve_features_legacy.rs | 2 + .../tests/alloc_features_scenario_go_test.rs | 18 +- .../tests/alloc_features_scenario_rs_test.rs | 28 +- .../alloc-features/wasm/Cargo.lock | 85 +---- .../alloc-features/wasm/Cargo.toml | 2 +- .../alloc-features/wasm/src/lib.rs | 4 +- .../feature-tests/basic-features/Cargo.toml | 6 +- .../basic-features/meta/Cargo.toml | 2 +- .../src/blockchain_api_features.rs | 2 +- .../src/storage_mapper_fungible_token.rs | 14 +- .../src/storage_mapper_non_fungible_token.rs | 2 +- .../tests/basic_features_big_num_test.rs | 34 +- .../tests/basic_features_scenario_go_test.rs | 85 +++-- .../tests/basic_features_scenario_rs_test.rs | 98 ++--- .../basic-features/wasm/Cargo.lock | 87 +---- .../basic-features/wasm/Cargo.toml | 2 +- .../basic-features/wasm/src/lib.rs | 4 +- .../big-float-features/Cargo.toml | 4 +- .../big-float-features/meta/Cargo.toml | 2 +- .../tests/big_float_scenario_go_test.rs | 18 +- .../tests/big_float_scenario_rs_test.rs | 12 +- .../big-float-features/wasm/Cargo.lock | 85 +---- .../big-float-features/wasm/Cargo.toml | 2 +- .../big-float-features/wasm/src/lib.rs | 2 +- .../feature-tests/composability/Cargo.toml | 2 +- .../esdt-contract-pair/Cargo.toml | 4 +- .../first-contract/Cargo.toml | 4 +- .../first-contract/meta/Cargo.toml | 4 +- .../first-contract/wasm/Cargo.lock | 85 +---- .../first-contract/wasm/Cargo.toml | 2 +- .../first-contract/wasm/src/lib.rs | 2 +- .../second-contract/Cargo.toml | 4 +- .../second-contract/meta/Cargo.toml | 4 +- .../second-contract/wasm/Cargo.lock | 85 +---- .../second-contract/wasm/Cargo.toml | 2 +- .../second-contract/wasm/src/lib.rs | 2 +- .../Cargo.toml | 4 +- .../child/Cargo.toml | 4 +- .../child/meta/Cargo.toml | 4 +- .../child/src/lib.rs | 2 +- .../child/wasm/Cargo.lock | 85 +---- .../child/wasm/Cargo.toml | 2 +- .../child/wasm/src/lib.rs | 2 +- .../parent/Cargo.toml | 4 +- .../parent/meta/Cargo.toml | 4 +- .../parent/src/lib.rs | 2 +- .../parent/wasm/Cargo.lock | 85 +---- .../parent/wasm/Cargo.toml | 2 +- .../parent/wasm/src/lib.rs | 2 +- .../composability/forwarder-raw/Cargo.toml | 6 +- .../forwarder-raw/meta/Cargo.toml | 2 +- .../forwarder-raw/src/forwarder_raw.rs | 8 +- .../wasm-no-managed-ei/Cargo.toml | 2 +- .../wasm-no-managed-ei/src/lib.rs | 2 +- .../forwarder-raw/wasm/Cargo.lock | 85 +---- .../forwarder-raw/wasm/Cargo.toml | 2 +- .../forwarder-raw/wasm/src/lib.rs | 2 +- .../composability/forwarder/Cargo.toml | 4 +- .../composability/forwarder/meta/Cargo.toml | 2 +- .../composability/forwarder/src/call_queue.rs | 2 +- .../composability/forwarder/src/call_sync.rs | 5 +- .../composability/forwarder/src/esdt.rs | 2 +- .../composability/forwarder/src/nft.rs | 2 +- .../composability/forwarder/src/sft.rs | 2 +- .../forwarder/wasm-no-managed-ei/Cargo.toml | 2 +- .../forwarder/wasm-no-managed-ei/src/lib.rs | 2 +- .../composability/forwarder/wasm/Cargo.lock | 85 +---- .../composability/forwarder/wasm/Cargo.toml | 2 +- .../composability/forwarder/wasm/src/lib.rs | 2 +- .../local-esdt-and-nft/Cargo.toml | 4 +- .../local-esdt-and-nft/meta/Cargo.toml | 2 +- .../local-esdt-and-nft/src/lib.rs | 6 +- .../local-esdt-and-nft/wasm/Cargo.lock | 85 +---- .../local-esdt-and-nft/wasm/Cargo.toml | 2 +- .../local-esdt-and-nft/wasm/src/lib.rs | 2 +- .../promises-features/Cargo.toml | 6 +- .../promises-features/meta/Cargo.toml | 2 +- .../promises-features/multicontract.toml | 7 + .../promises-features/wasm/Cargo.lock | 85 +---- .../promises-features/wasm/Cargo.toml | 2 +- .../promises-features/wasm/src/lib.rs | 2 +- .../composability/proxy-test-first/Cargo.toml | 6 +- .../proxy-test-first/meta/Cargo.toml | 2 +- .../proxy-test-first/multicontract.toml | 7 + .../proxy-test-first/src/proxy-test-first.rs | 8 +- .../wasm-no-managed-ei/Cargo.toml | 2 +- .../wasm-no-managed-ei/src/lib.rs | 4 +- .../proxy-test-first/wasm/Cargo.lock | 85 +---- .../proxy-test-first/wasm/Cargo.toml | 2 +- .../proxy-test-first/wasm/src/lib.rs | 4 +- .../proxy-test-second/Cargo.toml | 4 +- .../proxy-test-second/meta/Cargo.toml | 2 +- .../proxy-test-second/multicontract.toml | 7 + .../wasm-no-managed-ei/Cargo.toml | 2 +- .../wasm-no-managed-ei/src/lib.rs | 4 +- .../proxy-test-second/wasm/Cargo.lock | 85 +---- .../proxy-test-second/wasm/Cargo.toml | 2 +- .../proxy-test-second/wasm/src/lib.rs | 4 +- .../composability/recursive-caller/Cargo.toml | 6 +- .../recursive-caller/meta/Cargo.toml | 2 +- .../wasm-no-managed-ei/Cargo.toml | 2 +- .../wasm-no-managed-ei/src/lib.rs | 2 +- .../recursive-caller/wasm/Cargo.lock | 85 +---- .../recursive-caller/wasm/Cargo.toml | 2 +- .../recursive-caller/wasm/src/lib.rs | 2 +- .../transfer-role-features/Cargo.toml | 6 +- .../transfer-role-features/meta/Cargo.toml | 2 +- .../transfer-role-features/src/lib.rs | 4 +- .../transfer-role-features/wasm/Cargo.lock | 87 +---- .../transfer-role-features/wasm/Cargo.toml | 2 +- .../transfer-role-features/wasm/src/lib.rs | 2 +- .../composability/vault/Cargo.toml | 4 +- .../composability/vault/meta/Cargo.toml | 2 +- .../composability/vault/src/vault.rs | 8 +- .../composability/vault/wasm/Cargo.lock | 85 +---- .../composability/vault/wasm/Cargo.toml | 2 +- .../composability/vault/wasm/src/lib.rs | 2 +- .../crowdfunding-erc20/Cargo.toml | 4 +- .../crowdfunding-erc20/meta/Cargo.toml | 2 +- .../crowdfunding_erc20_scenario_go_test.rs | 2 +- .../crowdfunding_erc20_scenario_rs_test.rs | 2 +- .../crowdfunding-erc20/wasm/Cargo.lock | 85 +---- .../crowdfunding-erc20/wasm/Cargo.toml | 2 +- .../crowdfunding-erc20/wasm/src/lib.rs | 2 +- .../erc1155-marketplace/Cargo.toml | 5 +- .../erc1155-marketplace/meta/Cargo.toml | 2 +- .../erc1155-marketplace/multicontract.toml | 7 + .../erc1155_marketplace_scenario_rs_test.rs | 16 +- .../erc1155-marketplace/wasm/Cargo.lock | 93 +---- .../erc1155-marketplace/wasm/Cargo.toml | 2 +- .../erc1155-marketplace/wasm/src/lib.rs | 4 +- .../erc1155-user-mock/Cargo.toml | 5 +- .../erc1155-user-mock/meta/Cargo.toml | 2 +- .../erc1155-user-mock/src/lib.rs | 4 +- .../erc1155-user-mock/wasm/Cargo.lock | 85 +---- .../erc1155-user-mock/wasm/Cargo.toml | 2 +- .../erc1155-user-mock/wasm/src/lib.rs | 2 +- .../erc-style-contracts/erc1155/Cargo.toml | 11 +- .../erc1155/meta/Cargo.toml | 2 +- .../erc1155/multicontract.toml | 7 + .../erc1155/tests/erc1155_scenario_rs_test.rs | 135 ++++--- .../erc1155/wasm/Cargo.lock | 93 +---- .../erc1155/wasm/Cargo.toml | 2 +- .../erc1155/wasm/src/lib.rs | 4 +- .../erc-style-contracts/erc20/Cargo.toml | 4 +- .../erc-style-contracts/erc20/meta/Cargo.toml | 2 +- .../erc20/tests/erc20_scenario_go_test.rs | 94 ++--- .../erc20/tests/erc20_scenario_rs_test.rs | 99 ++--- .../erc-style-contracts/erc20/wasm/Cargo.lock | 85 +---- .../erc-style-contracts/erc20/wasm/Cargo.toml | 2 +- .../erc-style-contracts/erc20/wasm/src/lib.rs | 2 +- .../erc-style-contracts/erc721/Cargo.toml | 4 +- .../erc721/documentation.md | 2 +- .../erc721/meta/Cargo.toml | 2 +- .../erc721/tests/nft_scenario_go_test.rs | 2 +- .../erc721/tests/nft_scenario_rs_test.rs | 2 +- .../erc721/wasm/Cargo.lock | 85 +---- .../erc721/wasm/Cargo.toml | 2 +- .../erc721/wasm/src/lib.rs | 2 +- .../lottery-erc20/Cargo.toml | 6 +- .../lottery-erc20/documentation.md | 2 +- .../lottery-erc20/meta/Cargo.toml | 2 +- .../lottery-erc20/multicontract.toml | 7 + .../lottery-erc20/src/lottery.rs | 1 + .../tests/lottery_erc20_scenario_go_test.rs | 4 +- .../tests/lottery_erc20_scenario_rs_test.rs | 4 +- .../lottery-erc20/wasm/Cargo.lock | 85 +---- .../lottery-erc20/wasm/Cargo.toml | 2 +- .../lottery-erc20/wasm/src/lib.rs | 4 +- .../esdt-system-sc-mock/Cargo.toml | 4 +- .../esdt-system-sc-mock/meta/Cargo.toml | 2 +- .../esdt_system_sc_mock_scenario_go_test.rs | 5 + .../esdt_system_sc_mock_scenario_rs_test.rs | 11 + .../esdt-system-sc-mock/wasm/Cargo.lock | 85 +---- .../esdt-system-sc-mock/wasm/Cargo.toml | 2 +- .../esdt-system-sc-mock/wasm/src/lib.rs | 2 +- .../formatted-message-features/Cargo.toml | 4 +- .../meta/Cargo.toml | 2 +- .../wasm/Cargo.lock | 85 +---- .../wasm/Cargo.toml | 2 +- .../wasm/src/lib.rs | 2 +- .../crypto-bubbles-legacy/Cargo.toml | 4 +- .../crypto-bubbles-legacy/meta/Cargo.toml | 2 +- .../crypto-bubbles-legacy/multicontract.toml | 8 + .../src/crypto_bubbles_legacy.rs | 3 +- .../crypto_bubbles_legacy_scenario_go_test.rs | 16 +- .../crypto_bubbles_legacy_scenario_rs_test.rs | 16 +- .../crypto-bubbles-legacy/wasm/Cargo.lock | 36 +- .../crypto-bubbles-legacy/wasm/Cargo.toml | 5 +- .../crypto-bubbles-legacy/wasm/src/lib.rs | 4 +- .../multi-contract-features/Cargo.toml | 4 +- .../multi-contract-features/meta/Cargo.toml | 2 +- .../tests/multi_contract_scenario_go_test.rs | 8 +- .../tests/multi_contract_scenario_rs_test.rs | 8 +- .../Cargo.lock | 85 +---- .../Cargo.toml | 2 +- .../src/lib.rs | 2 +- .../Cargo.lock | 85 +---- .../Cargo.toml | 2 +- .../src/lib.rs | 2 +- .../multi-contract-features/wasm/Cargo.lock | 85 +---- .../multi-contract-features/wasm/Cargo.toml | 2 +- .../multi-contract-features/wasm/src/lib.rs | 2 +- .../panic-message-features/Cargo.toml | 4 +- .../panic-message-features/meta/Cargo.toml | 2 +- .../scenarios/panic-message.scen.json | 6 +- .../src/panic_features.rs | 4 +- .../panic-message-features/wasm/Cargo.lock | 85 +---- .../panic-message-features/wasm/Cargo.toml | 2 +- .../panic-message-features/wasm/src/lib.rs | 2 +- .../feature-tests/payable-features/Cargo.toml | 4 +- .../payable-features/meta/Cargo.toml | 2 +- .../payable-features/src/payable_features.rs | 14 +- .../tests/payable_scenario_go_test.rs | 5 + .../tests/payable_scenario_rs_test.rs | 10 +- .../payable-features/wasm/Cargo.lock | 85 +---- .../payable-features/wasm/Cargo.toml | 2 +- .../payable-features/wasm/src/lib.rs | 2 +- .../rust-snippets-generator-test/Cargo.toml | 4 +- .../interact-rs/Cargo.toml | 4 +- .../meta/Cargo.toml | 2 +- .../wasm/Cargo.lock | 85 +---- .../wasm/Cargo.toml | 2 +- .../wasm/src/lib.rs | 2 +- .../rust-testing-framework-tester/Cargo.toml | 4 +- .../meta/Cargo.toml | 2 +- .../multicontract.toml | 7 + .../rust-testing-framework-tester/src/lib.rs | 7 +- .../tests/rust_mandos_v1_test.rs | 13 - ...sting_framework_tester_scenario_go_test.rs | 20 + ...sting_framework_tester_scenario_rs_test.rs | 34 ++ .../wasm/Cargo.lock | 85 +---- .../wasm/Cargo.toml | 2 +- .../wasm/src/lib.rs | 4 +- contracts/feature-tests/use-module/Cargo.toml | 9 +- .../feature-tests/use-module/meta/Cargo.toml | 2 +- .../use-module/meta/abi/Cargo.toml | 4 +- .../use-module/src/token_merge_mod_impl.rs | 6 +- .../tests/use_module_scenario_go_test.rs | 18 +- .../tests/use_module_scenario_rs_test.rs | 28 +- .../use_module_expected_main.abi.json | 19 +- .../use_module_expected_view.abi.json | 19 +- .../wasm-use-module-view/Cargo.lock | 87 +---- .../wasm-use-module-view/Cargo.toml | 2 +- .../wasm-use-module-view/src/lib.rs | 2 +- .../feature-tests/use-module/wasm/Cargo.lock | 87 +---- .../feature-tests/use-module/wasm/Cargo.toml | 2 +- .../feature-tests/use-module/wasm/src/lib.rs | 2 +- contracts/modules/Cargo.toml | 6 +- contracts/modules/README.md | 4 +- .../modules/src/default_issue_callbacks.rs | 17 +- contracts/modules/src/dns.rs | 4 +- contracts/modules/src/esdt.rs | 4 +- contracts/modules/src/governance/README.md | 2 +- .../src/governance/governance_configurable.rs | 2 +- .../src/token_merge/merged_token_setup.rs | 2 +- contracts/modules/src/token_merge/mod.rs | 11 +- data/README.md | 7 + {framework => data}/codec-derive/Cargo.toml | 2 +- {framework => data}/codec-derive/README.md | 0 {framework => data}/codec-derive/src/lib.rs | 0 .../codec-derive/src/nested_de_derive.rs | 0 .../codec-derive/src/nested_en_derive.rs | 0 .../codec-derive/src/top_de_derive.rs | 0 .../codec-derive/src/top_en_derive.rs | 0 {framework => data}/codec-derive/src/util.rs | 0 {framework => data}/codec/Cargo.toml | 6 +- {framework => data}/codec/README.md | 0 {framework => data}/codec/src/codec_err.rs | 0 .../codec/src/codec_err_handler.rs | 0 .../codec/src/default_traits.rs | 0 .../codec/src/equivalent/codec_convert.rs | 0 .../codec/src/equivalent/codec_from.rs | 0 .../codec/src/equivalent/codec_into.rs | 0 .../codec/src/equivalent/mod.rs | 0 .../codec/src/impl_for_types/impl_array.rs | 0 .../src/impl_for_types/impl_array_vec.rs | 0 .../codec/src/impl_for_types/impl_bool.rs | 0 .../codec/src/impl_for_types/impl_bytes.rs | 0 .../codec/src/impl_for_types/impl_empty.rs | 0 .../src/impl_for_types/impl_non_zero_usize.rs | 0 .../src/impl_for_types/impl_num_signed.rs | 0 .../src/impl_for_types/impl_num_unsigned.rs | 0 .../codec/src/impl_for_types/impl_option.rs | 0 .../codec/src/impl_for_types/impl_phantom.rs | 0 .../codec/src/impl_for_types/impl_ref.rs | 0 .../src/impl_for_types/impl_rust_big_int.rs | 0 .../src/impl_for_types/impl_rust_big_uint.rs | 0 .../codec/src/impl_for_types/impl_slice.rs | 0 .../codec/src/impl_for_types/impl_string.rs | 0 .../codec/src/impl_for_types/impl_tuple.rs | 0 .../codec/src/impl_for_types/impl_unit.rs | 0 .../codec/src/impl_for_types/impl_vec.rs | 0 .../codec/src/impl_for_types/local_macro.rs | 0 .../codec/src/impl_for_types/mod.rs | 0 {framework => data}/codec/src/lib.rs | 0 .../codec/src/multi/into_multi_value.rs | 0 {framework => data}/codec/src/multi/mod.rs | 0 .../codec/src/multi/top_de_multi.rs | 0 .../codec/src/multi/top_de_multi_input.rs | 0 .../codec/src/multi/top_en_multi.rs | 0 .../codec/src/multi/top_en_multi_output.rs | 0 .../codec/src/multi_types/mod.rs | 0 .../src/multi_types/multi_value_ignore.rs | 0 .../src/multi_types/multi_value_optional.rs | 0 .../multi_types/multi_value_placeholder.rs | 0 .../src/multi_types/multi_value_tuple.rs | 0 .../codec/src/multi_types/multi_value_unit.rs | 0 .../codec/src/multi_types/multi_value_vec.rs | 0 {framework => data}/codec/src/num_conv.rs | 0 {framework => data}/codec/src/single/mod.rs | 0 .../codec/src/single/nested_de.rs | 0 .../codec/src/single/nested_de_input.rs | 0 .../codec/src/single/nested_de_input_owned.rs | 0 .../codec/src/single/nested_de_input_slice.rs | 0 .../codec/src/single/nested_en.rs | 0 .../codec/src/single/nested_en_output.rs | 0 .../codec/src/single/top_de.rs | 0 .../codec/src/single/top_de_input.rs | 0 .../codec/src/single/top_en.rs | 0 .../codec/src/single/top_en_output.rs | 0 {framework => data}/codec/src/test_util.rs | 0 {framework => data}/codec/src/transmute.rs | 0 .../codec/src/try_static_cast.rs | 0 .../codec/tests/derive_empty_struct_test.rs | 0 .../tests/derive_enum_or_default_test.rs | 0 .../codec/tests/derive_enum_test.rs | 0 ...ive_enum_tricky_defaults_fieldless_test.rs | 0 .../tests/derive_enum_tricky_defaults_test.rs | 0 .../codec/tests/derive_hygiene.rs | 0 .../derive_struct_or_default_generic_test.rs | 0 .../tests/derive_struct_or_default_test.rs | 0 .../codec/tests/derive_struct_test.rs | 0 .../tests/derive_struct_with_generic_test.rs | 0 .../codec/tests/derive_tuple_struct_test.rs | 0 .../codec/tests/explicit_impl_enum.rs | 0 .../codec/tests/explicit_impl_struct.rs | 0 .../tests/explicit_impl_wrapped_array.rs | 0 framework/README.md | 1 - framework/base/Cargo.toml | 8 +- framework/base/src/abi/type_abi.rs | 2 +- framework/base/src/abi/type_description.rs | 12 + .../wrappers/blockchain_wrapper.rs | 28 ++ .../wrappers/call_value_wrapper.rs | 21 +- .../contract_base/wrappers/crypto_wrapper.rs | 18 + framework/base/src/err_msg.rs | 1 + framework/base/src/hex_call_data/cd_de.rs | 2 +- framework/base/src/hex_call_data/cd_ser.rs | 2 +- framework/base/src/io/call_value_init.rs | 6 +- .../base/src/storage/mappers/bi_di_mapper.rs | 15 + .../src/storage/mappers/linked_list_mapper.rs | 14 + .../base/src/storage/mappers/map_mapper.rs | 15 + .../src/storage/mappers/map_storage_mapper.rs | 15 + framework/base/src/storage/mappers/mod.rs | 10 +- .../base/src/storage/mappers/queue_mapper.rs | 14 + .../base/src/storage/mappers/set_mapper.rs | 14 + framework/base/src/storage/mappers/token.rs | 11 + .../{ => token}/fungible_token_mapper.rs | 95 +++-- .../{ => token}/non_fungible_token_mapper.rs | 88 ++++- .../{ => token}/token_attributes_mapper.rs | 2 +- .../mappers/{ => token}/token_mapper.rs | 34 +- .../mappers/token/token_mapper_state.rs | 73 ++++ .../src/storage/mappers/unique_id_mapper.rs | 13 + .../storage/mappers/unordered_set_mapper.rs | 29 ++ .../base/src/storage/mappers/vec_mapper.rs | 16 +- .../types/io/operation_completion_status.rs | 34 +- .../src/types/managed/basic/elliptic_curve.rs | 16 + .../multi_value/multi_value_managed_vec.rs | 14 + .../wrapped/managed_buffer_cached_builder.rs | 6 +- .../src/types/managed/wrapped/managed_ref.rs | 10 + .../types/managed/wrapped/managed_vec_item.rs | 64 ++-- .../types/managed/wrapped/token_identifier.rs | 6 +- .../src/types/static_buffer/sparse_array.rs | 13 + framework/derive/Cargo.toml | 2 +- framework/derive/src/generate/proxy_gen.rs | 7 +- framework/meta/Cargo.toml | 6 +- .../meta/src/{abi_json/mod.rs => abi_json.rs} | 18 +- .../meta/src/abi_json/contract_abi_json.rs | 6 +- framework/meta/src/abi_json/type_abi_json.rs | 26 +- .../meta/src/{cli_args/mod.rs => cli_args.rs} | 0 .../meta/src/cli_args/cli_args_standalone.rs | 24 +- framework/meta/src/cmd.rs | 2 + .../meta/src/{meta_cli.rs => cmd/contract.rs} | 53 +-- .../contract/generate_snippets.rs} | 0 .../generate_snippets/snippet_crate_gen.rs | 0 .../generate_snippets/snippet_gen_common.rs | 0 .../generate_snippets/snippet_gen_main.rs | 3 +- .../snippet_sc_functions_gen.rs | 0 .../generate_snippets/snippet_template_gen.rs | 0 .../generate_snippets/snippet_type_map.rs | 0 .../meta/src/{ => cmd/contract}/meta_abi.rs | 24 +- .../src/{ => cmd/contract}/meta_config.rs | 10 +- .../meta/src/cmd/contract/output_contract.rs | 16 + .../output_contract/multi_contract_serde.rs | 10 + .../contract/output_contract/oc_builder.rs} | 12 +- .../contract/output_contract/oc_config.rs} | 85 +---- .../output_contract/oc_global_config.rs | 66 ++++ .../contract/output_contract/oc_settings.rs | 44 +++ .../oc_settings/oc_allocator.rs | 46 +++ .../output_contract/oc_settings/oc_parse.rs | 24 ++ .../oc_settings/oc_parse_stack_size.rs | 48 +++ .../contract}/output_contract/wasm_build.rs | 133 +++++-- .../contract}/output_contract/wasm_clean.rs | 0 .../output_contract/wasm_crate_gen.rs | 17 +- .../contract}/output_contract/wasm_update.rs | 0 .../contract/validate_abi.rs} | 0 framework/meta/src/cmd/standalone.rs | 41 +++ .../{meta_all.rs => cmd/standalone/all.rs} | 20 +- .../{meta_info.rs => cmd/standalone/info.rs} | 2 +- .../src/{ => cmd/standalone}/local_deps.rs | 0 .../meta/src/cmd/standalone/scen_test_gen.rs | 22 ++ .../cmd/standalone/scen_test_gen/stg_main.rs | 143 ++++++++ .../cmd/standalone/scen_test_gen/stg_parse.rs | 94 +++++ .../cmd/standalone/scen_test_gen/stg_print.rs | 14 + .../scen_test_gen/stg_process_code.rs | 42 +++ .../standalone/scen_test_gen/stg_section.rs | 157 ++++++++ .../cmd/standalone/scen_test_gen/stg_write.rs | 45 +++ .../mod.rs => cmd/standalone/upgrade.rs} | 0 .../standalone/upgrade}/upgrade_0_31.rs | 0 .../standalone/upgrade}/upgrade_0_32.rs | 0 .../standalone/upgrade}/upgrade_0_39.rs | 0 .../standalone/upgrade}/upgrade_common.rs | 2 +- .../standalone/upgrade}/upgrade_print.rs | 0 .../standalone/upgrade}/upgrade_selector.rs | 13 +- .../standalone/upgrade}/upgrade_versions.rs | 10 +- framework/meta/src/ei.rs | 11 + framework/meta/src/ei/ei_1_0.rs | 204 +++++++++++ framework/meta/src/ei/ei_1_1.rs | 214 +++++++++++ framework/meta/src/ei/ei_1_2.rs | 263 ++++++++++++++ framework/meta/src/ei/ei_1_3.rs | 265 ++++++++++++++ framework/meta/src/ei/ei_version.rs | 65 ++++ .../mod.rs => folder_structure.rs} | 0 .../folder_structure/relevant_directory.rs | 10 + framework/meta/src/lib.rs | 25 +- framework/meta/src/mxsc_file_json.rs | 29 ++ framework/meta/src/output_contract/mod.rs | 13 - .../meta/src/output_contract/print_util.rs | 41 --- framework/meta/src/print_util.rs | 114 ++++++ framework/meta/src/tools.rs | 4 + framework/meta/src/tools/git_describe.rs | 22 ++ .../post_build.rs} | 0 framework/meta/tests/ei_test.rs | 105 ++++++ framework/meta/tests/multi_contract_test.rs | 6 +- framework/meta/tests/stg_process_code_test.rs | 51 +++ framework/scenario/Cargo.toml | 4 +- .../scenario/tests/token_identifier_test.rs | 4 +- framework/snippets/Cargo.toml | 4 +- framework/wasm-adapter/Cargo.toml | 7 +- framework/wasm-adapter/src/lib.rs | 4 +- framework/wasm-adapter/src/panic.rs | 47 +++ framework/wasm-adapter/src/wasm_alloc.rs | 12 + .../src/wasm_alloc/fail_allocator.rs | 18 + .../src/wasm_alloc/leaking_allocator.rs | 66 ++++ .../src/wasm_alloc/memory_grow.rs | 39 ++ .../src/wasm_alloc/static_allocator.rs | 56 +++ framework/wasm-adapter/src/wasm_deps.rs | 22 -- framework/wasm-adapter/src/wasm_macros.rs | 36 +- publish.sh | 14 +- sdk/core/Cargo.toml | 6 +- sdk/core/src/wallet.rs | 3 +- tools/mxpy-snippet-generator/Cargo.toml | 2 +- tools/rust-debugger/format-tests/Cargo.toml | 4 +- .../format-tests/src/format_tests.rs | 4 +- .../multiversx_sc_lldb_pretty_printers.py | 20 +- tools/test-gen/.gitignore | 3 - tools/test-gen/Cargo.toml | 11 - tools/test-gen/src/test_gen.rs | 80 ---- vm/Cargo.toml | 8 +- vm/src/api/managed_types/big_int_api_mock.rs | 2 +- vm/src/world_mock/esdt_instance.rs | 2 +- vm/src/world_mock/esdt_instance_metadata.rs | 2 +- .../derive_managed_vec_item_struct_2_test.rs | 7 +- vm/tests/test_hash_unordered_set_mapper.rs | 52 +++ 762 files changed, 8611 insertions(+), 7011 deletions(-) create mode 100644 contracts/benchmarks/large-storage/.gitignore create mode 100644 contracts/benchmarks/large-storage/Cargo.toml create mode 100644 contracts/benchmarks/large-storage/meta/Cargo.toml create mode 100644 contracts/benchmarks/large-storage/meta/src/main.rs create mode 100644 contracts/benchmarks/large-storage/multiversx.json create mode 100644 contracts/benchmarks/large-storage/pi.txt create mode 100644 contracts/benchmarks/large-storage/scenarios/large_storage.scen.json create mode 100644 contracts/benchmarks/large-storage/src/large_storage.rs create mode 100644 contracts/benchmarks/large-storage/tests/large_storage_go_test.rs create mode 100644 contracts/benchmarks/large-storage/tests/large_storage_rs_test.rs create mode 100755 contracts/benchmarks/large-storage/wasm/Cargo.lock create mode 100644 contracts/benchmarks/large-storage/wasm/Cargo.toml create mode 100644 contracts/benchmarks/large-storage/wasm/src/lib.rs create mode 100644 contracts/benchmarks/str-repeat/multicontract.toml create mode 100644 contracts/core/wegld-swap/tests/wegld_swap_scenario_rs_test.rs create mode 100644 contracts/examples/check-pause/.gitignore create mode 100644 contracts/examples/check-pause/Cargo.toml create mode 100644 contracts/examples/check-pause/meta/Cargo.toml create mode 100644 contracts/examples/check-pause/meta/src/main.rs create mode 100644 contracts/examples/check-pause/multiversx.json create mode 100644 contracts/examples/check-pause/src/check_pause.rs create mode 100644 contracts/examples/check-pause/wasm/Cargo.lock create mode 100644 contracts/examples/check-pause/wasm/Cargo.toml create mode 100644 contracts/examples/check-pause/wasm/src/lib.rs create mode 100644 contracts/examples/crowdfunding-esdt/interaction/alice.pem create mode 100644 contracts/examples/digital-cash/README.md create mode 100644 contracts/examples/digital-cash/scenarios/claim-fees.scen.json create mode 100644 contracts/examples/digital-cash/scenarios/claim-multi-esdt.scen.json create mode 100644 contracts/examples/digital-cash/scenarios/forward.scen.json create mode 100644 contracts/examples/digital-cash/scenarios/withdraw-multi-esdt.scen.json create mode 100644 contracts/examples/multisig/interact-rs/state.toml create mode 100644 contracts/examples/nft-minter/tests/nft_minter_scenario_rs_test.rs create mode 100644 contracts/examples/order-book/pair/tests/pair_scenario_go_test.rs create mode 100644 contracts/examples/order-book/pair/tests/pair_scenario_rs_test.rs create mode 100644 contracts/feature-tests/alloc-features/multicontract.toml create mode 100644 contracts/feature-tests/composability/promises-features/multicontract.toml create mode 100644 contracts/feature-tests/composability/proxy-test-first/multicontract.toml create mode 100644 contracts/feature-tests/composability/proxy-test-second/multicontract.toml create mode 100644 contracts/feature-tests/erc-style-contracts/erc1155-marketplace/multicontract.toml create mode 100644 contracts/feature-tests/erc-style-contracts/erc1155/multicontract.toml create mode 100644 contracts/feature-tests/erc-style-contracts/lottery-erc20/multicontract.toml create mode 100644 contracts/feature-tests/esdt-system-sc-mock/tests/esdt_system_sc_mock_scenario_go_test.rs create mode 100644 contracts/feature-tests/esdt-system-sc-mock/tests/esdt_system_sc_mock_scenario_rs_test.rs create mode 100644 contracts/feature-tests/legacy-examples/crypto-bubbles-legacy/multicontract.toml create mode 100644 contracts/feature-tests/rust-testing-framework-tester/multicontract.toml create mode 100644 contracts/feature-tests/rust-testing-framework-tester/tests/rust_testing_framework_tester_scenario_go_test.rs create mode 100644 contracts/feature-tests/rust-testing-framework-tester/tests/rust_testing_framework_tester_scenario_rs_test.rs create mode 100644 data/README.md rename {framework => data}/codec-derive/Cargo.toml (97%) rename {framework => data}/codec-derive/README.md (100%) rename {framework => data}/codec-derive/src/lib.rs (100%) rename {framework => data}/codec-derive/src/nested_de_derive.rs (100%) rename {framework => data}/codec-derive/src/nested_en_derive.rs (100%) rename {framework => data}/codec-derive/src/top_de_derive.rs (100%) rename {framework => data}/codec-derive/src/top_en_derive.rs (100%) rename {framework => data}/codec-derive/src/util.rs (100%) rename {framework => data}/codec/Cargo.toml (94%) rename {framework => data}/codec/README.md (100%) rename {framework => data}/codec/src/codec_err.rs (100%) rename {framework => data}/codec/src/codec_err_handler.rs (100%) rename {framework => data}/codec/src/default_traits.rs (100%) rename {framework => data}/codec/src/equivalent/codec_convert.rs (100%) rename {framework => data}/codec/src/equivalent/codec_from.rs (100%) rename {framework => data}/codec/src/equivalent/codec_into.rs (100%) rename {framework => data}/codec/src/equivalent/mod.rs (100%) rename {framework => data}/codec/src/impl_for_types/impl_array.rs (100%) rename {framework => data}/codec/src/impl_for_types/impl_array_vec.rs (100%) rename {framework => data}/codec/src/impl_for_types/impl_bool.rs (100%) rename {framework => data}/codec/src/impl_for_types/impl_bytes.rs (100%) rename {framework => data}/codec/src/impl_for_types/impl_empty.rs (100%) rename {framework => data}/codec/src/impl_for_types/impl_non_zero_usize.rs (100%) rename {framework => data}/codec/src/impl_for_types/impl_num_signed.rs (100%) rename {framework => data}/codec/src/impl_for_types/impl_num_unsigned.rs (100%) rename {framework => data}/codec/src/impl_for_types/impl_option.rs (100%) rename {framework => data}/codec/src/impl_for_types/impl_phantom.rs (100%) rename {framework => data}/codec/src/impl_for_types/impl_ref.rs (100%) rename {framework => data}/codec/src/impl_for_types/impl_rust_big_int.rs (100%) rename {framework => data}/codec/src/impl_for_types/impl_rust_big_uint.rs (100%) rename {framework => data}/codec/src/impl_for_types/impl_slice.rs (100%) rename {framework => data}/codec/src/impl_for_types/impl_string.rs (100%) rename {framework => data}/codec/src/impl_for_types/impl_tuple.rs (100%) rename {framework => data}/codec/src/impl_for_types/impl_unit.rs (100%) rename {framework => data}/codec/src/impl_for_types/impl_vec.rs (100%) rename {framework => data}/codec/src/impl_for_types/local_macro.rs (100%) rename {framework => data}/codec/src/impl_for_types/mod.rs (100%) rename {framework => data}/codec/src/lib.rs (100%) rename {framework => data}/codec/src/multi/into_multi_value.rs (100%) rename {framework => data}/codec/src/multi/mod.rs (100%) rename {framework => data}/codec/src/multi/top_de_multi.rs (100%) rename {framework => data}/codec/src/multi/top_de_multi_input.rs (100%) rename {framework => data}/codec/src/multi/top_en_multi.rs (100%) rename {framework => data}/codec/src/multi/top_en_multi_output.rs (100%) rename {framework => data}/codec/src/multi_types/mod.rs (100%) rename {framework => data}/codec/src/multi_types/multi_value_ignore.rs (100%) rename {framework => data}/codec/src/multi_types/multi_value_optional.rs (100%) rename {framework => data}/codec/src/multi_types/multi_value_placeholder.rs (100%) rename {framework => data}/codec/src/multi_types/multi_value_tuple.rs (100%) rename {framework => data}/codec/src/multi_types/multi_value_unit.rs (100%) rename {framework => data}/codec/src/multi_types/multi_value_vec.rs (100%) rename {framework => data}/codec/src/num_conv.rs (100%) rename {framework => data}/codec/src/single/mod.rs (100%) rename {framework => data}/codec/src/single/nested_de.rs (100%) rename {framework => data}/codec/src/single/nested_de_input.rs (100%) rename {framework => data}/codec/src/single/nested_de_input_owned.rs (100%) rename {framework => data}/codec/src/single/nested_de_input_slice.rs (100%) rename {framework => data}/codec/src/single/nested_en.rs (100%) rename {framework => data}/codec/src/single/nested_en_output.rs (100%) rename {framework => data}/codec/src/single/top_de.rs (100%) rename {framework => data}/codec/src/single/top_de_input.rs (100%) rename {framework => data}/codec/src/single/top_en.rs (100%) rename {framework => data}/codec/src/single/top_en_output.rs (100%) rename {framework => data}/codec/src/test_util.rs (100%) rename {framework => data}/codec/src/transmute.rs (100%) rename {framework => data}/codec/src/try_static_cast.rs (100%) rename {framework => data}/codec/tests/derive_empty_struct_test.rs (100%) rename {framework => data}/codec/tests/derive_enum_or_default_test.rs (100%) rename {framework => data}/codec/tests/derive_enum_test.rs (100%) rename {framework => data}/codec/tests/derive_enum_tricky_defaults_fieldless_test.rs (100%) rename {framework => data}/codec/tests/derive_enum_tricky_defaults_test.rs (100%) rename {framework => data}/codec/tests/derive_hygiene.rs (100%) rename {framework => data}/codec/tests/derive_struct_or_default_generic_test.rs (100%) rename {framework => data}/codec/tests/derive_struct_or_default_test.rs (100%) rename {framework => data}/codec/tests/derive_struct_test.rs (100%) rename {framework => data}/codec/tests/derive_struct_with_generic_test.rs (100%) rename {framework => data}/codec/tests/derive_tuple_struct_test.rs (100%) rename {framework => data}/codec/tests/explicit_impl_enum.rs (100%) rename {framework => data}/codec/tests/explicit_impl_struct.rs (100%) rename {framework => data}/codec/tests/explicit_impl_wrapped_array.rs (100%) create mode 100644 framework/base/src/storage/mappers/token.rs rename framework/base/src/storage/mappers/{ => token}/fungible_token_mapper.rs (70%) rename framework/base/src/storage/mappers/{ => token}/non_fungible_token_mapper.rs (81%) rename framework/base/src/storage/mappers/{ => token}/token_attributes_mapper.rs (99%) rename framework/base/src/storage/mappers/{ => token}/token_mapper.rs (80%) create mode 100644 framework/base/src/storage/mappers/token/token_mapper_state.rs rename framework/meta/src/{abi_json/mod.rs => abi_json.rs} (71%) rename framework/meta/src/{cli_args/mod.rs => cli_args.rs} (100%) create mode 100644 framework/meta/src/cmd.rs rename framework/meta/src/{meta_cli.rs => cmd/contract.rs} (54%) rename framework/meta/src/{generate_snippets/mod.rs => cmd/contract/generate_snippets.rs} (100%) rename framework/meta/src/{ => cmd/contract}/generate_snippets/snippet_crate_gen.rs (100%) rename framework/meta/src/{ => cmd/contract}/generate_snippets/snippet_gen_common.rs (100%) rename framework/meta/src/{ => cmd/contract}/generate_snippets/snippet_gen_main.rs (96%) rename framework/meta/src/{ => cmd/contract}/generate_snippets/snippet_sc_functions_gen.rs (100%) rename framework/meta/src/{ => cmd/contract}/generate_snippets/snippet_template_gen.rs (100%) rename framework/meta/src/{ => cmd/contract}/generate_snippets/snippet_type_map.rs (100%) rename framework/meta/src/{ => cmd/contract}/meta_abi.rs (64%) rename framework/meta/src/{ => cmd/contract}/meta_config.rs (94%) create mode 100644 framework/meta/src/cmd/contract/output_contract.rs rename framework/meta/src/{ => cmd/contract}/output_contract/multi_contract_serde.rs (85%) rename framework/meta/src/{output_contract/output_contract_builder.rs => cmd/contract/output_contract/oc_builder.rs} (96%) rename framework/meta/src/{output_contract/output_contract_model.rs => cmd/contract/output_contract/oc_config.rs} (66%) create mode 100644 framework/meta/src/cmd/contract/output_contract/oc_global_config.rs create mode 100644 framework/meta/src/cmd/contract/output_contract/oc_settings.rs create mode 100644 framework/meta/src/cmd/contract/output_contract/oc_settings/oc_allocator.rs create mode 100644 framework/meta/src/cmd/contract/output_contract/oc_settings/oc_parse.rs create mode 100644 framework/meta/src/cmd/contract/output_contract/oc_settings/oc_parse_stack_size.rs rename framework/meta/src/{ => cmd/contract}/output_contract/wasm_build.rs (58%) rename framework/meta/src/{ => cmd/contract}/output_contract/wasm_clean.rs (100%) rename framework/meta/src/{ => cmd/contract}/output_contract/wasm_crate_gen.rs (91%) rename framework/meta/src/{ => cmd/contract}/output_contract/wasm_update.rs (100%) rename framework/meta/src/{meta_validate_abi.rs => cmd/contract/validate_abi.rs} (100%) create mode 100644 framework/meta/src/cmd/standalone.rs rename framework/meta/src/{meta_all.rs => cmd/standalone/all.rs} (79%) rename framework/meta/src/{meta_info.rs => cmd/standalone/info.rs} (86%) rename framework/meta/src/{ => cmd/standalone}/local_deps.rs (100%) create mode 100644 framework/meta/src/cmd/standalone/scen_test_gen.rs create mode 100644 framework/meta/src/cmd/standalone/scen_test_gen/stg_main.rs create mode 100644 framework/meta/src/cmd/standalone/scen_test_gen/stg_parse.rs create mode 100644 framework/meta/src/cmd/standalone/scen_test_gen/stg_print.rs create mode 100644 framework/meta/src/cmd/standalone/scen_test_gen/stg_process_code.rs create mode 100644 framework/meta/src/cmd/standalone/scen_test_gen/stg_section.rs create mode 100644 framework/meta/src/cmd/standalone/scen_test_gen/stg_write.rs rename framework/meta/src/{sc_upgrade/mod.rs => cmd/standalone/upgrade.rs} (100%) rename framework/meta/src/{sc_upgrade => cmd/standalone/upgrade}/upgrade_0_31.rs (100%) rename framework/meta/src/{sc_upgrade => cmd/standalone/upgrade}/upgrade_0_32.rs (100%) rename framework/meta/src/{sc_upgrade => cmd/standalone/upgrade}/upgrade_0_39.rs (100%) rename framework/meta/src/{sc_upgrade => cmd/standalone/upgrade}/upgrade_common.rs (99%) rename framework/meta/src/{sc_upgrade => cmd/standalone/upgrade}/upgrade_print.rs (100%) rename framework/meta/src/{sc_upgrade => cmd/standalone/upgrade}/upgrade_selector.rs (89%) rename framework/meta/src/{sc_upgrade => cmd/standalone/upgrade}/upgrade_versions.rs (90%) create mode 100644 framework/meta/src/ei.rs create mode 100644 framework/meta/src/ei/ei_1_0.rs create mode 100644 framework/meta/src/ei/ei_1_1.rs create mode 100644 framework/meta/src/ei/ei_1_2.rs create mode 100644 framework/meta/src/ei/ei_1_3.rs create mode 100644 framework/meta/src/ei/ei_version.rs rename framework/meta/src/{folder_structure/mod.rs => folder_structure.rs} (100%) create mode 100644 framework/meta/src/mxsc_file_json.rs delete mode 100644 framework/meta/src/output_contract/mod.rs delete mode 100644 framework/meta/src/output_contract/print_util.rs create mode 100644 framework/meta/src/print_util.rs create mode 100644 framework/meta/src/tools.rs create mode 100644 framework/meta/src/tools/git_describe.rs rename framework/meta/src/{meta_wasm_tools.rs => tools/post_build.rs} (100%) create mode 100644 framework/meta/tests/ei_test.rs create mode 100644 framework/meta/tests/stg_process_code_test.rs create mode 100644 framework/wasm-adapter/src/panic.rs create mode 100644 framework/wasm-adapter/src/wasm_alloc.rs create mode 100644 framework/wasm-adapter/src/wasm_alloc/fail_allocator.rs create mode 100644 framework/wasm-adapter/src/wasm_alloc/leaking_allocator.rs create mode 100644 framework/wasm-adapter/src/wasm_alloc/memory_grow.rs create mode 100644 framework/wasm-adapter/src/wasm_alloc/static_allocator.rs delete mode 100644 framework/wasm-adapter/src/wasm_deps.rs delete mode 100644 tools/test-gen/.gitignore delete mode 100644 tools/test-gen/Cargo.toml delete mode 100644 tools/test-gen/src/test_gen.rs diff --git a/.github/workflows/actions.yml b/.github/workflows/actions.yml index 67961e5b74..7f546506e7 100644 --- a/.github/workflows/actions.yml +++ b/.github/workflows/actions.yml @@ -13,9 +13,9 @@ permissions: jobs: contracts: name: Contracts - uses: multiversx/mx-sc-actions/.github/workflows/contracts.yml@v2 + uses: multiversx/mx-sc-actions/.github/workflows/contracts.yml@v2.3.0 with: - rust-toolchain: nightly-2022-12-08 + rust-toolchain: nightly-2023-04-24 vmtools-version: v1.4.60 secrets: token: ${{ secrets.GITHUB_TOKEN }} diff --git a/CHANGELOG.md b/CHANGELOG.md index e4ddfc64e2..10d5a0d6aa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -27,6 +27,40 @@ They are: - `multiversx-sdk`, in short `sdk`, allows communication with the chain(s), 1 crate. +## [sc 0.41.3, vm 0.3.3] - 2023-06-19 +- Bugfix on `ManagedBufferCachedBuilder`, involving large inputs. +- Explicit enum ABI: `OperationCompletionStatus` is now properly described in the ABI as an enum that gets serialized by name instead of discriminant. + +## [sc 0.41.2, codec 0.17.2, vm 0.3.2] - 2023-06-09 +- Releasing a new version of the codec, without the dependency to `wee_alloc`. + +## [sc 0.41.1, vm 0.3.1] - 2023-05-15 +- Fixed an edge case for the token storage mappers (`FungibleTokenMapper`, `NonFungibleTokenMapper`). + +## [sc 0.41.0, vm 0.3.0] - 2023-05-05 +- Fixed compatibility with rustc v1.71.0. +- Allocator system: + - Contracts can now choose their own allocator. This works in multi-contract contexts. + - New allocators: `fail` (default), `static64k`, `leaking`. + - Removed dependency to `wee_alloc`, but using it is still possible if the contract references it directly. + - Contract call stack size is now configurable in `multicontract.toml`. + - The 'panic with message' system now relies on managed buffers instead of on an allocator. +- Fixed BigUint bitwise operations in the debugger. +- When building contracts, an additional `.mxsc.json` file is created, which packs both the contract binary, the ABI, and some additional metadata. +- Refactor: reorganized the meta crate. +- Deprecated some legacy methods in the API wrappers. + +## [sc 0.40.1, vm 0.2.1] - 2023-04-24 +- Building contracts also triggers an EI check, which verifies compatibility with various VM versions. It currently only issues warnings. +- `ManagedVecItem` implementation for arrays. + +## [sc 0.40.0, vm 0.2.0] - 2023-04-20 +- Call value `egld_value` and `all_esdt_transfers` methods return `ManagedRef` instead of owned objects, because they are cached (to avoid accidental corruption of the underlying cache). + +## [sc 0.39.8, vm 0.1.8] - 2023-03-29 +- `multiversx-sc-meta` `test-gen` command: generates Rust integration tests based on scenarios present in the `scenarios` folder. + - `UnorderedSetMapper` `swap_indexes` method. + ## [sc 0.39.7, vm 0.1.7] - 2023-03-18 - `TokenIdentifier` `ticker` method. - `ManagedBuffer` `concat` method. diff --git a/Cargo.toml b/Cargo.toml index 17c9f680e0..2877d382af 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,9 +2,10 @@ resolver = "2" members = [ + "data/codec", + "data/codec-derive", + "framework/base", - "framework/codec", - "framework/codec-derive", "framework/derive", "framework/meta", "framework/scenario", @@ -14,7 +15,6 @@ members = [ "sdk/core", "sdk/scenario-format", - "tools/test-gen", "tools/mxpy-snippet-generator", "vm", @@ -39,6 +39,8 @@ members = [ "contracts/benchmarks/mappers/single-value-repeat/meta", "contracts/benchmarks/mappers/vec-repeat", "contracts/benchmarks/mappers/vec-repeat/meta", + "contracts/benchmarks/large-storage", + "contracts/benchmarks/large-storage/meta", "contracts/benchmarks/str-repeat", "contracts/benchmarks/str-repeat/meta", "contracts/benchmarks/send-tx-repeat", @@ -56,6 +58,8 @@ members = [ "contracts/examples/crypto-bubbles/meta", "contracts/examples/crypto-zombies", "contracts/examples/crypto-zombies/meta", + "contracts/examples/check-pause", + "contracts/examples/check-pause/meta", "contracts/examples/crypto-kitties/kitty-ownership", "contracts/examples/crypto-kitties/kitty-ownership/meta", "contracts/examples/crypto-kitties/kitty-genetic-alg", diff --git a/README.md b/README.md index de9facca9b..bb32c0995d 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ The crowdfunding tutorial is a great place to start: https://docs.multiversx.com # IDE -The framework is designed to be easiest to use with the Elrond IDE VSCode extension: https://marketplace.visualstudio.com/items?itemName=Elrond.vscode-elrond-ide +The framework is designed to be easiest to use with the IDE VSCode extension: https://marketplace.visualstudio.com/items?itemName=Elrond.vscode-elrond-ide # Building contracts diff --git a/contracts/benchmarks/large-storage/.gitignore b/contracts/benchmarks/large-storage/.gitignore new file mode 100644 index 0000000000..9494cb146e --- /dev/null +++ b/contracts/benchmarks/large-storage/.gitignore @@ -0,0 +1,7 @@ +# Generated by Cargo +# will have compiled files and executables +/target/ +*/target/ + +# The mxpy output +output diff --git a/contracts/benchmarks/large-storage/Cargo.toml b/contracts/benchmarks/large-storage/Cargo.toml new file mode 100644 index 0000000000..74fea7934d --- /dev/null +++ b/contracts/benchmarks/large-storage/Cargo.toml @@ -0,0 +1,17 @@ +[package] +name = "large-storage" +version = "0.0.0" +authors = ["Andrei Marinica "] +edition = "2021" +publish = false + +[lib] +path = "src/large_storage.rs" + +[dependencies.multiversx-sc] +version = "0.41.3" +path = "../../../framework/base" + +[dev-dependencies.multiversx-sc-scenario] +version = "0.41.3" +path = "../../../framework/scenario" diff --git a/contracts/benchmarks/large-storage/meta/Cargo.toml b/contracts/benchmarks/large-storage/meta/Cargo.toml new file mode 100644 index 0000000000..212926ad47 --- /dev/null +++ b/contracts/benchmarks/large-storage/meta/Cargo.toml @@ -0,0 +1,12 @@ +[package] +name = "large-storage-meta" +version = "0.0.0" +edition = "2021" +publish = false + +[dependencies.large-storage] +path = ".." + +[dependencies.multiversx-sc-meta] +version = "0.41.3" +path = "../../../../framework/meta" diff --git a/contracts/benchmarks/large-storage/meta/src/main.rs b/contracts/benchmarks/large-storage/meta/src/main.rs new file mode 100644 index 0000000000..fc0906971a --- /dev/null +++ b/contracts/benchmarks/large-storage/meta/src/main.rs @@ -0,0 +1,3 @@ +fn main() { + multiversx_sc_meta::cli_main::(); +} diff --git a/contracts/benchmarks/large-storage/multiversx.json b/contracts/benchmarks/large-storage/multiversx.json new file mode 100644 index 0000000000..7365539625 --- /dev/null +++ b/contracts/benchmarks/large-storage/multiversx.json @@ -0,0 +1,3 @@ +{ + "language": "rust" +} \ No newline at end of file diff --git a/contracts/benchmarks/large-storage/pi.txt b/contracts/benchmarks/large-storage/pi.txt new file mode 100644 index 0000000000..76b1879836 --- /dev/null +++ b/contracts/benchmarks/large-storage/pi.txt @@ -0,0 +1 @@ +3.14159265358979323846264338327950288419716939937510582097494459230781640628620899862803482534211706798214808651328230664709384460955058223172535940812848111745028410270193852110555964462294895493038196442881097566593344612847564823378678316527120190914564856692346034861045432664821339360726024914127372458700660631558817488152092096282925409171536436789259036001133053054882046652138414695194151160943305727036575959195309218611738193261179310511854807446237996274956735188575272489122793818301194912983367336244065664308602139494639522473719070217986094370277053921717629317675238467481846766940513200056812714526356082778577134275778960917363717872146844090122495343014654958537105079227968925892354201995611212902196086403441815981362977477130996051870721134999999837297804995105973173281609631859502445945534690830264252230825334468503526193118817101000313783875288658753320838142061717766914730359825349042875546873115956286388235378759375195778185778053217122680661300192787661119590921642019893809525720106548586327886593615338182796823030195203530185296899577362259941389124972177528347913151557485724245415069595082953311686172785588907509838175463746493931925506040092770167113900984882401285836160356370766010471018194295559619894676783744944825537977472684710404753464620804668425906949129331367702898915210475216205696602405803815019351125338243003558764024749647326391419927260426992279678235478163600934172164121992458631503028618297455570674983850549458858692699569092721079750930295532116534498720275596023648066549911988183479775356636980742654252786255181841757467289097777279380008164706001614524919217321721477235014144197356854816136115735255213347574184946843852332390739414333454776241686251898356948556209921922218427255025425688767179049460165346680498862723279178608578438382796797668145410095388378636095068006422512520511739298489608412848862694560424196528502221066118630674427862203919494504712371378696095636437191728746776465757396241389086583264599581339047802759009946576407895126946839835259570982582262052248940772671947826848260147699090264013639443745530506820349625245174939965143142980919065925093722169646151570985838741059788595977297549893016175392846813826868386894277415599185592524595395943104997252468084598727364469584865383673622262609912460805124388439045124413654976278079771569143599770012961608944169486855584840635342207222582848864815845602850601684273945226746767889525213852254995466672782398645659611635488623057745649803559363456817432411251507606947945109659609402522887971089314566913686722874894056010150330861792868092087476091782493858900971490967598526136554978189312978482168299894872265880485756401427047755513237964145152374623436454285844479526586782105114135473573952311342716610213596953623144295248493718711014576540359027993440374200731057853906219838744780847848968332144571386875194350643021845319104848100537061468067491927819119793995206141966342875444064374512371819217999839101591956181467514269123974894090718649423196156794520809514655022523160388193014209376213785595663893778708303906979207734672218256259966150142150306803844773454920260541466592520149744285073251866600213243408819071048633173464965145390579626856100550810665879699816357473638405257145910289706414011097120628043903975951567715770042033786993600723055876317635942187312514712053292819182618612586732157919841484882916447060957527069572209175671167229109816909152801735067127485832228718352093539657251210835791513698820914442100675103346711031412671113699086585163983150197016515116851714376576183515565088490998985998238734552833163550764791853589322618548963213293308985706420467525907091548141654985946163718027098199430992448895757128289059232332609729971208443357326548938239119325974636673058360414281388303203824903758985243744170291327656180937734440307074692112019130203303801976211011004492932151608424448596376698389522868478312355265821314495768572624334418930396864262434107732269780280731891544110104468232527162010526522721116603966655730925471105578537634668206531098965269186205647693125705863566201855810072936065987648611791045334885034611365768675324944166803962657978771855608455296541266540853061434443185867697514566140680070023787765913440171274947042056223053899456131407112700040785473326993908145466464588079727082668306343285878569830523580893306575740679545716377525420211495576158140025012622859413021647155097925923099079654737612551765675135751782966645477917450112996148903046399471329621073404375189573596145890193897131117904297828564750320319869151402870808599048010941214722131794764777262241425485454033215718530614228813758504306332175182979866223717215916077166925474873898665494945011465406284336639379003976926567214638530673609657120918076383271664162748888007869256029022847210403172118608204190004229661711963779213375751149595015660496318629472654736425230817703675159067350235072835405670403867435136222247715891504953098444893330963408780769325993978054193414473774418426312986080998886874132604721569516239658645730216315981931951673538129741677294786724229246543668009806769282382806899640048243540370141631496589794092432378969070697794223625082216889573837986230015937764716512289357860158816175578297352334460428151262720373431465319777741603199066554187639792933441952154134189948544473456738316249934191318148092777710386387734317720754565453220777092120190516609628049092636019759882816133231666365286193266863360627356763035447762803504507772355471058595487027908143562401451718062464362679456127531813407833033625423278394497538243720583531147711992606381334677687969597030983391307710987040859133746414428227726346594704745878477872019277152807317679077071572134447306057007334924369311383504931631284042512192565179806941135280131470130478164378851852909285452011658393419656213491434159562586586557055269049652098580338507224264829397285847831630577775606888764462482468579260395352773480304802900587607582510474709164396136267604492562742042083208566119062545433721315359584506877246029016187667952406163425225771954291629919306455377991403734043287526288896399587947572917464263574552540790914513571113694109119393251910760208252026187985318877058429725916778131496990090192116971737278476847268608490033770242429165130050051683233643503895170298939223345172201381280696501178440874519601212285993716231301711444846409038906449544400619869075485160263275052983491874078668088183385102283345085048608250393021332197155184306354550076682829493041377655279397517546139539846833936383047461199665385815384205685338621867252334028308711232827892125077126294632295639898989358211674562701021835646220134967151881909730381198004973407239610368540664319395097901906996395524530054505806855019567302292191393391856803449039820595510022635353619204199474553859381023439554495977837790237421617271117236434354394782218185286240851400666044332588856986705431547069657474585503323233421073015459405165537906866273337995851156257843229882737231989875714159578111963583300594087306812160287649628674460477464915995054973742562690104903778198683593814657412680492564879855614537234786733039046883834363465537949864192705638729317487233208376011230299113679386270894387993620162951541337142489283072201269014754668476535761647737946752004907571555278196536213239264061601363581559074220202031872776052772190055614842555187925303435139844253223415762336106425063904975008656271095359194658975141310348227693062474353632569160781547818115284366795706110861533150445212747392454494542368288606134084148637767009612071512491404302725386076482363414334623518975766452164137679690314950191085759844239198629164219399490723623464684411739403265918404437805133389452574239950829659122850855582157250310712570126683024029295252201187267675622041542051618416348475651699981161410100299607838690929160302884002691041407928862150784245167090870006992821206604183718065355672525325675328612910424877618258297651579598470356222629348600341587229805349896502262917487882027342092222453398562647669149055628425039127577102840279980663658254889264880254566101729670266407655904290994568150652653053718294127033693137851786090407086671149655834343476933857817113864558736781230145876871266034891390956200993936103102916161528813843790990423174733639480457593149314052976347574811935670911013775172100803155902485309066920376719220332290943346768514221447737939375170344366199104033751117354719185504644902636551281622882446257591633303910722538374218214088350865739177150968288747826569959957449066175834413752239709683408005355984917541738188399944697486762655165827658483588453142775687900290951702835297163445621296404352311760066510124120065975585127617858382920419748442360800719304576189323492292796501987518721272675079812554709589045563579212210333466974992356302549478024901141952123828153091140790738602515227429958180724716259166854513331239480494707911915326734302824418604142636395480004480026704962482017928964766975831832713142517029692348896276684403232609275249603579964692565049368183609003238092934595889706953653494060340216654437558900456328822505452556405644824651518754711962184439658253375438856909411303150952617937800297412076651479394259029896959469955657612186561967337862362561252163208628692221032748892186543648022967807057656151446320469279068212073883778142335628236089632080682224680122482611771858963814091839036736722208883215137556003727983940041529700287830766709444745601345564172543709069793961225714298946715435784687886144458123145935719849225284716050492212424701412147805734551050080190869960330276347870810817545011930714122339086639383395294257869050764310063835198343893415961318543475464955697810382930971646514384070070736041123735998434522516105070270562352660127648483084076118301305279320542746286540360367453286510570658748822569815793678976697422057505968344086973502014102067235850200724522563265134105592401902742162484391403599895353945909440704691209140938700126456001623742880210927645793106579229552498872758461012648369998922569596881592056001016552563756785667227966198857827948488558343975187445455129656344348039664205579829368043522027709842942325330225763418070394769941597915945300697521482933665556615678736400536665641654732170439035213295435291694145990416087532018683793702348886894791510716378529023452924407736594956305100742108714261349745956151384987137570471017879573104229690666702144986374645952808243694457897723300487647652413390759204340196340391147320233807150952220106825634274716460243354400515212669324934196739770415956837535551667302739007497297363549645332888698440611964961627734495182736955882207573551766515898551909866653935494810688732068599075407923424023009259007017319603622547564789406475483466477604114632339056513433068449539790709030234604614709616968868850140834704054607429586991382966824681857103188790652870366508324319744047718556789348230894310682870272280973624809399627060747264553992539944280811373694338872940630792615959954626246297070625948455690347119729964090894180595343932512362355081349490043642785271383159125689892951964272875739469142725343669415323610045373048819855170659412173524625895487301676002988659257866285612496655235338294287854253404830833070165372285635591525347844598183134112900199920598135220511733658564078264849427644113763938669248031183644536985891754426473998822846218449008777697763127957226726555625962825427653183001340709223343657791601280931794017185985999338492354956400570995585611349802524990669842330173503580440811685526531170995708994273287092584878944364600504108922669178352587078595129834417295351953788553457374260859029081765155780390594640873506123226112009373108048548526357228257682034160504846627750450031262008007998049254853469414697751649327095049346393824322271885159740547021482897111777923761225788734771881968254629812686858170507402725502633290449762778944236216741191862694396506715157795867564823993917604260176338704549901761436412046921823707648878341968968611815581587360629386038101712158552726683008238340465647588040513808016336388742163714064354955618689641122821407533026551004241048967835285882902436709048871181909094945331442182876618103100735477054981596807720094746961343609286148494178501718077930681085469000944589952794243981392135055864221964834915126390128038320010977386806628779239718014613432445726400973742570073592100315415089367930081699805365202760072774967458400283624053460372634165542590276018348403068113818551059797056640075094260878857357960373245141467867036880988060971642584975951380693094494015154222219432913021739125383559150310033303251117491569691745027149433151558854039221640972291011290355218157628232831823425483261119128009282525619020526301639114772473314857391077758744253876117465786711694147764214411112635835538713610110232679877564102468240322648346417663698066378576813492045302240819727856471983963087815432211669122464159117767322532643356861461865452226812688726844596844241610785401676814208088502800541436131462308210259417375623899420757136275167457318918945628352570441335437585753426986994725470316566139919996826282472706413362221789239031760854289437339356188916512504244040089527198378738648058472689546243882343751788520143956005710481194988423906061369573423155907967034614914344788636041031823507365027785908975782727313050488939890099239135033732508559826558670892426124294736701939077271307068691709264625484232407485503660801360466895118400936686095463250021458529309500009071510582362672932645373821049387249966993394246855164832611341461106802674466373343753407642940266829738652209357016263846485285149036293201991996882851718395366913452224447080459239660281715655156566611135982311225062890585491450971575539002439315351909021071194573002438801766150352708626025378817975194780610137150044899172100222013350131060163915415895780371177927752259787428919179155224171895853616805947412341933984202187456492564434623925319531351033114763949119950728584306583619353693296992898379149419394060857248639688369032655643642166442576079147108699843157337496488352927693282207629472823815374099615455987982598910937171262182830258481123890119682214294576675807186538065064870261338928229949725745303328389638184394477077940228435988341003583854238973542439564755568409522484455413923941000162076936368467764130178196593799715574685419463348937484391297423914336593604100352343777065888677811394986164787471407932638587386247328896456435987746676384794665040741118256583788784548581489629612739984134427260860618724554523606431537101127468097787044640947582803487697589483282412392929605829486191966709189580898332012103184303401284951162035342801441276172858302435598300320420245120728725355811958401491809692533950757784000674655260314461670508276827722235341911026341631571474061238504258459884199076112872580591139356896014316682831763235673254170734208173322304629879928049085140947903688786878949305469557030726190095020764334933591060245450864536289354568629585313153371838682656178622736371697577418302398600659148161640494496501173213138957470620884748023653710311508984279927544268532779743113951435741722197597993596852522857452637962896126915723579866205734083757668738842664059909935050008133754324546359675048442352848747014435454195762584735642161981340734685411176688311865448937769795665172796623267148103386439137518659467300244345005449953997423723287124948347060440634716063258306498297955101095418362350303094530973358344628394763047756450150085075789495489313939448992161255255977014368589435858775263796255970816776438001254365023714127834679261019955852247172201777237004178084194239487254068015560359983905489857235467456423905858502167190313952629445543913166313453089390620467843877850542393905247313620129476918749751910114723152893267725339181466073000890277689631148109022097245207591672970078505807171863810549679731001678708506942070922329080703832634534520380278609905569001341371823683709919495164896007550493412678764367463849020639640197666855923356546391383631857456981471962108410809618846054560390384553437291414465134749407848844237721751543342603066988317683310011331086904219390310801437843341513709243530136776310849135161564226984750743032971674696406665315270353254671126675224605511995818319637637076179919192035795820075956053023462677579439363074630569010801149427141009391369138107258137813578940055995001835425118417213605572752210352680373572652792241737360575112788721819084490061780138897107708229310027976659358387589093956881485602632243937265624727760378908144588378550197028437793624078250527048758164703245812908783952324532378960298416692254896497156069811921865849267704039564812781021799132174163058105545988013004845629976511212415363745150056350701278159267142413421033015661653560247338078430286552572227530499988370153487930080626018096238151613669033411113865385109193673938352293458883225508870645075394739520439680790670868064450969865488016828743437861264538158342807530618454859037982179945996811544197425363443996029025100158882721647450068207041937615845471231834600726293395505482395571372568402322682130124767945226448209102356477527230820810635188991526928891084555711266039650343978962782500161101532351605196559042118449499077899920073294769058685778787209829013529566139788848605097860859570177312981553149516814671769597609942100361835591387778176984587581044662839988060061622984861693533738657877359833616133841338536842119789389001852956919678045544828584837011709672125353387586215823101331038776682721157269495181795897546939926421979155233857662316762754757035469941489290413018638611943919628388705436777432242768091323654494853667680000010652624854730558615989991401707698385483188750142938908995068545307651168033373222651756622075269517914422528081651716677667279303548515420402381746089232839170327542575086765511785939500279338959205766827896776445318404041855401043513483895312013263783692835808271937831265496174599705674507183320650345566440344904536275600112501843356073612227659492783937064784264567633881880756561216896050416113903906396016202215368494109260538768871483798955999911209916464644119185682770045742434340216722764455893301277815868695250694993646101756850601671453543158148010545886056455013320375864548584032402987170934809105562116715468484778039447569798042631809917564228098739987669732376957370158080682290459921236616890259627304306793165311494017647376938735140933618332161428021497633991898354848756252987524238730775595559554651963944018218409984124898262367377146722606163364329640633572810707887581640438148501884114318859882769449011932129682715888413386943468285900666408063140777577257056307294004929403024204984165654797367054855804458657202276378404668233798528271057843197535417950113472736257740802134768260450228515797957976474670228409995616015691089038458245026792659420555039587922981852648007068376504183656209455543461351341525700659748819163413595567196496540321872716026485930490397874895890661272507948282769389535217536218507962977851461884327192232238101587444505286652380225328438913752738458923844225354726530981715784478342158223270206902872323300538621634798850946954720047952311201504329322662827276321779088400878614802214753765781058197022263097174950721272484794781695729614236585957820908307332335603484653187302930266596450137183754288975579714499246540386817992138934692447419850973346267933210726868707680626399193619650440995421676278409146698569257150743157407938053239252394775574415918458215625181921552337096074833292349210345146264374498055961033079941453477845746999921285999993996122816152193148887693880222810830019860165494165426169685867883726095877456761825072759929508931805218729246108676399589161458550583972742098090978172932393010676638682404011130402470073508578287246271349463685318154696904669686939254725194139929146524238577625500474852954768147954670070503479995888676950161249722820403039954632788306959762493615101024365553522306906129493885990157346610237122354789112925476961760050479749280607212680392269110277722610254414922157650450812067717357120271802429681062037765788371669091094180744878140490755178203856539099104775941413215432844062503018027571696508209642734841469572639788425600845312140659358090412711359200419759851362547961606322887361813673732445060792441176399759746193835845749159880976674470930065463424234606342374746660804317012600520559284936959414340814685298150539471789004518357551541252235905906872648786357525419112888773717663748602766063496035367947026923229718683277173932361920077745221262475186983349515101986426988784717193966497690708252174233656627259284406204302141137199227852699846988477023238238400556555178890876613601304770984386116870523105531491625172837327286760072481729876375698163354150746088386636406934704372066886512756882661497307886570156850169186474885416791545965072342877306998537139043002665307839877638503238182155355973235306860430106757608389086270498418885951380910304235957824951439885901131858358406674723702971497850841458530857813391562707603563907639473114554958322669457024941398316343323789759556808568362972538679132750555425244919435891284050452269538121791319145135009938463117740179715122837854601160359554028644059024964669307077690554810288502080858008781157738171917417760173307385547580060560143377432990127286772530431825197579167929699650414607066457125888346979796429316229655201687973000356463045793088403274807718115553309098870255052076804630346086581653948769519600440848206596737947316808641564565053004988161649057883115434548505266006982309315777650037807046612647060214575057932709620478256152471459189652236083966456241051955105223572397395128818164059785914279148165426328920042816091369377737222999833270820829699557377273756676155271139225880552018988762011416800546873655806334716037342917039079863965229613128017826797172898229360702880690877686605932527463784053976918480820410219447197138692560841624511239806201131845412447820501107987607171556831540788654390412108730324020106853419472304766667217498698685470767812051247367924791931508564447753798537997322344561227858432968466475133365736923872014647236794278700425032555899268843495928761240075587569464137056251400117971331662071537154360068764773186755871487839890810742953094106059694431584775397009439883949144323536685392099468796450665339857388878661476294434140104988899316005120767810358861166020296119363968213496075011164983278563531614516845769568710900299976984126326650234771672865737857908574664607722834154031144152941880478254387617707904300015669867767957609099669360755949651527363498118964130433116627747123388174060373174397054067031096767657486953587896700319258662594105105335843846560233917967492678447637084749783336555790073841914731988627135259546251816043422537299628632674968240580602964211463864368642247248872834341704415734824818333016405669596688667695634914163284264149745333499994800026699875888159350735781519588990053951208535103572613736403436753471410483601754648830040784641674521673719048310967671134434948192626811107399482506073949507350316901973185211955263563258433909982249862406703107683184466072912487475403161796994113973877658998685541703188477886759290260700432126661791922352093822787888098863359911608192353555704646349113208591897961327913197564909760001399623444553501434642686046449586247690943470482932941404111465409239883444351591332010773944111840741076849810663472410482393582740194493566516108846312567852977697346843030614624180358529331597345830384554103370109167677637427621021370135485445092630719011473184857492331816720721372793556795284439254815609137281284063330393735624200160456645574145881660521666087387480472433912129558777639069690370788285277538940524607584962315743691711317613478388271941686066257210368513215664780014767523103935786068961112599602818393095487090590738613519145918195102973278755710497290114871718971800469616977700179139196137914171627070189584692143436967629274591099400600849835684252019155937037010110497473394938778859894174330317853487076032219829705797511914405109942358830345463534923498268836240433272674155403016195056806541809394099820206099941402168909007082133072308966211977553066591881411915778362729274615618571037217247100952142369648308641025928874579993223749551912219519034244523075351338068568073544649951272031744871954039761073080602699062580760202927314552520780799141842906388443734996814582733720726639176702011830046481900024130835088465841521489912761065137415394356572113903285749187690944137020905170314877734616528798482353382972601361109845148418238081205409961252745808810994869722161285248974255555160763716750548961730168096138038119143611439921063800508321409876045993093248510251682944672606661381517457125597549535802399831469822036133808284993567055755247129027453977621404931820146580080215665360677655087838043041343105918046068008345911366408348874080057412725867047922583191274157390809143831384564241509408491339180968402511639919368532255573389669537490266209232613188558915808324555719484538756287861288590041060060737465014026278240273469625282171749415823317492396835301361786536737606421667781377399510065895288774276626368418306801908046098498094697636673356622829151323527888061577682781595886691802389403330764419124034120223163685778603572769415417788264352381319050280870185750470463129333537572853866058889045831114507739429352019943219711716422350056440429798920815943071670198574692738486538334361457946341759225738985880016980147574205429958012429581054565108310462972829375841611625325625165724980784920998979906200359365099347215829651741357984910471116607915874369865412223483418877229294463351786538567319625598520260729476740726167671455736498121056777168934849176607717052771876011999081441130586455779105256843048114402619384023224709392498029335507318458903553971330884461741079591625117148648744686112476054286734367090466784686702740918810142497111496578177242793470702166882956108777944050484375284433751088282647719785400065097040330218625561473321177711744133502816088403517814525419643203095760186946490886815452856213469883554445602495566684366029221951248309106053772019802183101032704178386654471812603971906884623708575180800353270471856594994761242481109992886791589690495639476246084240659309486215076903149870206735338483495508363660178487710608098042692471324100094640143736032656451845667924566695510015022983307984960799498824970617236744936122622296179081431141466094123415935930958540791390872083227335495720807571651718765994498569379562387555161757543809178052802946420044721539628074636021132942559160025707356281263873310600589106524570802447493754318414940148211999627645310680066311838237616396631809314446712986155275982014514102756006892975024630401735148919457636078935285550531733141645705049964438909363084387448478396168405184527328840323452024705685164657164771393237755172947951261323982296023945485797545865174587877133181387529598094121742273003522965080891777050682592488223221549380483714547816472139768209633205083056479204820859204754998573203888763916019952409189389455767687497308569559580106595265030362661597506622250840674288982659075106375635699682115109496697445805472886936310203678232501823237084597901115484720876182124778132663304120762165873129708112307581598212486398072124078688781145016558251361789030708608701989758898074566439551574153631931919810705753366337380382721527988493503974800158905194208797113080512339332219034662499171691509485414018710603546037946433790058909577211808044657439628061867178610171567409676620802957665770512912099079443046328929473061595104309022214393718495606340561893425130572682914657832933405246350289291754708725648426003496296116541382300773133272983050016025672401418515204189070115428857992081219844931569990591820118197335001261877280368124819958770702075324063612593134385955425477819611429351635612234966615226147353996740515849986035529533292457523888101362023476246690558164389678630976273655047243486430712184943734853006063876445662721866617012381277156213797461498613287441177145524447089971445228856629424402301847912054784985745216346964489738920624019435183100882834802492490854030778638751659113028739587870981007727182718745290139728366148421428717055317965430765045343246005363614726181809699769334862640774351999286863238350887566835950972655748154319401955768504372480010204137498318722596773871549583997184449072791419658459300839426370208756353982169620553248032122674989114026785285996734052420310917978999057188219493913207534317079800237365909853755202389116434671855829068537118979526262344924833924963424497146568465912489185566295893299090352392333336474352037077010108438800329075983421701855422838616172104176030116459187805393674474720599850235828918336929223373239994804371084196594731626548257480994825099918330069765693671596893644933488647442135008407006608835972350395323401795825570360169369909886711321097988970705172807558551912699306730992507040702455685077867906947661262980822516331363995211709845280926303759224267425755998928927837047444521893632034894155210445972618838003006776179313813991620580627016510244588692476492468919246121253102757313908404700071435613623169923716948481325542009145304103713545329662063921054798243921251725401323149027405858920632175894943454890684639931375709103463327141531622328055229729795380188016285907357295541627886764982741861642187898857410716490691918511628152854867941736389066538857642291583425006736124538491606741373401735727799563410433268835695078149313780073623541800706191802673285511919426760912210359874692411728374931261633950012395992405084543756985079570462226646190001035004901830341535458428337643781119885563187777925372011667185395418359844383052037628194407615941068207169703022851522505731260930468984234331527321313612165828080752126315477306044237747535059522871744026663891488171730864361113890694202790881431194487994171540421034121908470940802540239329429454938786402305129271190975135360009219711054120966831115163287054230284700731206580326264171161659576132723515666625366727189985341998952368848309993027574199164638414270779887088742292770538912271724863220288984251252872178260305009945108247835729056919885554678860794628053712270424665431921452817607414824038278358297193010178883456741678113989547504483393146896307633966572267270433932167454218245570625247972199786685427989779923395790575818906225254735822052364248507834071101449804787266919901864388229323053823185597328697809222535295910173414073348847610055640182423921926950620831838145469839236646136398910121021770959767049083050818547041946643713122996923588953849301363565761861060622287055994233716310212784574464639897381885667462608794820186474876727272220626764653380998019668836809941590757768526398651462533363124505364026105696055131838131742611844201890888531963569869627950367384243130113317533053298020166888174813429886815855778103432317530647849832106297184251843855344276201282345707169885305183261796411785796088881503296022907056144762209150947390359466469162353968092013945781758910889319921122600739281491694816152738427362642980982340632002440244958944561291670495082358124873917996486411334803247577752197089327722623494860150466526814398770516153170266969297049283162855042128981467061953319702695072143782304768752802873541261663917082459251700107141808548006369232594620190022780874098597719218051585321473926532515590354102092846659252999143537918253145452905984158176370589279069098969111643811878094353715213322614436253144901274547726957393934815469163116249288735747188240715039950094467319543161938554852076657388251396391635767231510055560372633948672082078086537349424401157996675073607111593513319591971209489647175530245313647709420946356969822266737752099451684506436238242118535348879893956731878066061078854400055082765703055874485418057788917192078814233511386629296671796434687600770479995378833878703487180218424373421122739402557176908196030920182401884270570460926225641783752652633583242406612533115294234579655695025068100183109004112453790153329661569705223792103257069370510908307894799990049993953221536227484766036136776979785673865846709366795885837887956259464648913766521995882869338018360119323685785585581955560421562508836502033220245137621582046181067051953306530606065010548871672453779428313388716313955969058320834168984760656071183471362181232462272588419902861420872849568796393254642853430753011052857138296437099903569488852851904029560473461311382638788975517885604249987483163828040468486189381895905420398898726506976202019955484126500053944282039301274816381585303964399254702016727593285743666616441109625663373054092195196751483287348089574777752783442210910731113518280460363471981856555729571447476825528578633493428584231187494400032296906977583159038580393535213588600796003420975473922967333106493956018122378128545843176055617338611267347807458506760630482294096530411183066710818930311088717281675195796753471885372293096161432040063813224658411111577583585811350185690478153689381377184728147519983505047812977185990847076219746058874232569958288925350419379582606162118423687685114183160683158679946016520577405294230536017803133572632670547903384012573059123396018801378254219270947673371919872873852480574212489211834708766296672072723256505651293331260595057777275424712416483128329820723617505746738701282095755443059683955556868611883971355220844528526400812520276655576774959696266126045652456840861392382657685833846984997787267065551918544686984694784957346226062942196245570853712727765230989554501930377321666491825781546772920052126671434632096378918523232150189761260343736840671941930377468809992968775824410478781232662531818459604538535438391144967753128642609252115376732588667226040425234910870269580996475958057946639734190640100363619040420331135793365424263035614570090112448008900208014780566037101541223288914657223931450760716706435568274377439657890679726874384730763464516775621030986040927170909512808630902973850445271828927496892121066700816485833955377359191369501531620189088874842107987068991148046692706509407620465027725286507289053285485614331608126930056937854178610969692025388650345771831766868859236814884752764984688219497397297077371871884004143231276365048145311228509900207424092558592529261030210673681543470152523487863516439762358604191941296976904052648323470099111542426012734380220893310966863678986949779940012601642276092608234930411806438291383473546797253992623387915829984864592717340592256207491053085315371829116816372193951887009577881815868504645076993439409874335144316263303172477474868979182092394808331439708406730840795893581089665647758599055637695252326536144247802308268118310377358870892406130313364773710116282146146616794040905186152603600925219472188909181073358719641421444786548995285823439470500798303885388608310357193060027711945580219119428999227223534587075662469261776631788551443502182870266856106650035310502163182060176092179846849368631612937279518730789726373537171502563787335797718081848784588665043358243770041477104149349274384575871071597315594394264125702709651251081155482479394035976811881172824721582501094960966253933953809221955919181885526780621499231727631632183398969380756168559117529984501320671293924041445938623988093812404521914848316462101473891825101090967738690664041589736104764365000680771056567184862814963711188321924456639458144914861655004956769826903089111856879869294705135248160917432430153836847072928989828460222373014526556798986277679680914697983782687643115988321090437156112997665215396354644208691975673700057387649784376862876817924974694384274652563163230055513041742273416464551278127845777724575203865437542828256714128858345444351325620544642410110379554641905811686230596447695870540721419852121067343324107567675758184569906930460475227701670056845439692340417110898889934163505851578873534308155208117720718803791040469830695786854739376564336319797868036718730796939242363214484503547763156702553900654231179201534649779290662415083288583952905426376876689688050333172278001858850697362324038947004718976193473443084374437599250341788079722358591342458131440498477017323616947197657153531977549971627856631190469126091825912498903676541769799036237552865263757337635269693443544004730671988689019681474287677908669796885225016369498567302175231325292653758964151714795595387842784998664563028788319620998304945198743963690706827626574858104391122326187940599415540632701319898957037611053236062986748037791537675115830432084987209202809297526498125691634250005229088726469252846661046653921714820801305022980526378364269597337070539227891535105688839381132497570713310295044303467159894487868471164383280506925077662745001220035262037094660234146489983902525888301486781621967751945831677187627572005054397944124599007711520515461993050983869825428464072555409274031325716326407929341833421470904125425335232480219322770753555467958716383587501815933871742360615511710131235256334858203651461418700492057043720182617331947157008675785393360786227395581857975872587441025420771054753612940474601000940954449596628814869159038990718659805636171376922272907641977551777201042764969496110562205925024202177042696221549587264539892276976603105249808557594716310758701332088614632664125911486338812202844406941694882615295776253250198703598706743804698219420563812558334364219492322759372212890564209430823525440841108645453694049692714940033197828613181861888111184082578659287574263844500599442295685864604810330153889114994869354360302218109434667640000223625505736312946262960961987605642599639461386923308371962659547392346241345977957485246478379807956931986508159776753505539189911513352522987361127791827485420086895396583594219633315028695611920122988898870060799927954111882690230789131076036176347794894320321027733594169086500719328040171638406449878717537567811853213284082165711075495282949749362146082155832056872321855740651610962748743750980922302116099826330339154694946444910045152809250897450748967603240907689836529406579201983152654106581368237919840906457124689484702093577611931399802468134052003947819498662026240089021501661638135383815150377350229660746279529103840686855690701575166241929872444827194293310048548244545807188976330032325258215812803274679620028147624318286221710543528983482082734516801861317195933247110746622285087106661177034653528395776259977446721857158161264111432717943478859908928084866949141390977167369002777585026866465405659503948678411107901161040085727445629384254941675946054871172359464291058509099502149587931121961359083158826206823321561530868337308381732793281969838750870834838804638847844188400318471269745437093732983624028751979208023218787448828728437273780178270080587824107493575148899789117397461293203510814327032514090304874622629423443275712600866425083331876886507564292716055252895449215376517514921963671810494353178583834538652556566406572513635750643532365089367904317025978781771903148679638408288102094614900797151377170990619549696400708676671023300486726314755105372317571143223174114116806228642063889062101923552235467116621374996932693217370431059872250394565749246169782609702533594750209138366737728944386964000281103440260847128990007468077648440887113413525033678773167977093727786821661178653442317322646378476978751443320953400016506921305464768909850502030150448808342618452087305309731894929164253229336124315143065782640702838984098416029503092418971209716016492656134134334222988279099217860426798124572853458013382609958771781131021673402565627440072968340661984806766158050216918337236803990279316064204368120799003162644491461902194582296909921227885539487835383056468648816555622943156731282743908264506116289428035016613366978240517701552196265227254558507386405852998303791803504328767038092521679075712040612375963276856748450791511473134400018325703449209097124358094479004624943134550289006806487042935340374360326258205357901183956490893543451013429696175452495739606214902887289327925206965353863964432253883275224996059869747598823299162635459733244451637553343774929289905811757863555556269374269109471170021654117182197505198317871371060510637955585889055688528879890847509157646390746936198815078146852621332524738376511929901561091897779220087057933964638274906806987691681974923656242260871541761004306089043779766785196618914041449252704808819714988015420577870065215940092897776013307568479669929554336561398477380603943688958876460549838714789684828053847017308711177611596635050399793438693391197898871091565417091330826076474063057114110988 \ No newline at end of file diff --git a/contracts/benchmarks/large-storage/scenarios/large_storage.scen.json b/contracts/benchmarks/large-storage/scenarios/large_storage.scen.json new file mode 100644 index 0000000000..99f9d8fb17 --- /dev/null +++ b/contracts/benchmarks/large-storage/scenarios/large_storage.scen.json @@ -0,0 +1,82 @@ +{ + "name": "large-storage", + "steps": [ + { + "step": "setState", + "accounts": { + "address:owner": { + "nonce": "0", + "balance": "0" + } + }, + "newAddresses": [ + { + "creatorAddress": "address:owner", + "creatorNonce": "0", + "newAddress": "sc:contract" + } + ] + }, + { + "step": "scDeploy", + "id": "deploy", + "tx": { + "from": "address:owner", + "contractCode": "file:../output/large-storage.wasm", + "arguments": [], + "gasLimit": "2,000,000", + "gasPrice": "0" + }, + "expect": { + "out": [], + "status": "", + "logs": [], + "gas": "*", + "refund": "*" + } + }, + { + "step": "scCall", + "id": "save", + "tx": { + "from": "address:owner", + "to": "sc:contract", + "function": "saveStructure", + "arguments": [ + "str:abc", + "1", + "file:../pi.txt" + ], + "gasLimit": "600,000,000", + "gasPrice": "0" + }, + "expect": { + "out": [], + "status": "", + "logs": [], + "gas": "*", + "refund": "*" + } + }, + { + "step": "checkState", + "accounts": { + "sc:contract": { + "nonce": "0", + "balance": "0", + "storage": { + "str:savedStructure": [ + "u32:3", + "str:abc", + "1", + "u32:40330", + "file:../pi.txt" + ] + }, + "code": "*" + }, + "+": "" + } + } + ] +} diff --git a/contracts/benchmarks/large-storage/src/large_storage.rs b/contracts/benchmarks/large-storage/src/large_storage.rs new file mode 100644 index 0000000000..46e62ceedb --- /dev/null +++ b/contracts/benchmarks/large-storage/src/large_storage.rs @@ -0,0 +1,36 @@ +#![no_std] + +multiversx_sc::imports!(); +multiversx_sc::derive_imports!(); + +#[derive(TypeAbi, TopEncode, TopDecode, NestedEncode, NestedDecode, Clone)] +pub enum SampleEnum { + Value1, + Value2, +} +#[derive(TypeAbi, TopEncode, TopDecode, NestedEncode, NestedDecode, Clone)] +pub struct Structure { + pub field1: ManagedBuffer, + pub field2: SampleEnum, + pub field3: ManagedBuffer, +} + +#[multiversx_sc::contract] +pub trait LargeStorageBenchmark { + #[init] + fn init(&self) {} + + #[endpoint(saveStructure)] + fn save_structure(&self, field1: ManagedBuffer, field2: SampleEnum, field3: ManagedBuffer) { + let s = Structure { + field1, + field2, + field3, + }; + self.structure().set(s); + } + + #[view(savedStructure)] + #[storage_mapper("savedStructure")] + fn structure(&self) -> SingleValueMapper>; +} diff --git a/contracts/benchmarks/large-storage/tests/large_storage_go_test.rs b/contracts/benchmarks/large-storage/tests/large_storage_go_test.rs new file mode 100644 index 0000000000..1bc503fcc8 --- /dev/null +++ b/contracts/benchmarks/large-storage/tests/large_storage_go_test.rs @@ -0,0 +1,4 @@ +#[test] +fn large_storage_go() { + multiversx_sc_scenario::run_go("scenarios/large_storage.scen.json"); +} diff --git a/contracts/benchmarks/large-storage/tests/large_storage_rs_test.rs b/contracts/benchmarks/large-storage/tests/large_storage_rs_test.rs new file mode 100644 index 0000000000..6fa98b392e --- /dev/null +++ b/contracts/benchmarks/large-storage/tests/large_storage_rs_test.rs @@ -0,0 +1,16 @@ +use multiversx_sc_scenario::*; + +fn world() -> ScenarioWorld { + let mut blockchain = ScenarioWorld::new(); + blockchain.set_current_dir_from_workspace("contracts/benchmarks/large-storage"); + blockchain.register_contract( + "file:output/large-storage.wasm", + large_storage::ContractBuilder, + ); + blockchain +} + +#[test] +fn large_storage_rs() { + multiversx_sc_scenario::run_rs("scenarios/large_storage.scen.json", world()); +} diff --git a/contracts/benchmarks/large-storage/wasm/Cargo.lock b/contracts/benchmarks/large-storage/wasm/Cargo.lock new file mode 100755 index 0000000000..b9559cdeef --- /dev/null +++ b/contracts/benchmarks/large-storage/wasm/Cargo.lock @@ -0,0 +1,209 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "ahash" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f" +dependencies = [ + "cfg-if", + "once_cell", + "version_check", +] + +[[package]] +name = "arrayvec" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" + +[[package]] +name = "autocfg" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" + +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "endian-type" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c34f04666d835ff5d62e058c3995147c06f42fe86ff053337632bca83e42702d" + +[[package]] +name = "hashbrown" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" +dependencies = [ + "ahash", +] + +[[package]] +name = "hex" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" + +[[package]] +name = "hex-literal" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ebdb29d2ea9ed0083cd8cece49bbd968021bd99b0849edb4a9a7ee0fdf6a4e0" + +[[package]] +name = "large-storage" +version = "0.0.0" +dependencies = [ + "multiversx-sc", +] + +[[package]] +name = "large-storage-wasm" +version = "0.0.0" +dependencies = [ + "large-storage", + "multiversx-sc-wasm-adapter", +] + +[[package]] +name = "multiversx-sc" +version = "0.41.3" +dependencies = [ + "bitflags", + "hashbrown", + "hex-literal", + "multiversx-sc-codec", + "multiversx-sc-derive", + "num-traits", +] + +[[package]] +name = "multiversx-sc-codec" +version = "0.17.2" +dependencies = [ + "arrayvec", + "multiversx-sc-codec-derive", +] + +[[package]] +name = "multiversx-sc-codec-derive" +version = "0.17.2" +dependencies = [ + "hex", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "multiversx-sc-derive" +version = "0.41.3" +dependencies = [ + "hex", + "proc-macro2", + "quote", + "radix_trie", + "syn", +] + +[[package]] +name = "multiversx-sc-wasm-adapter" +version = "0.41.3" +dependencies = [ + "multiversx-sc", +] + +[[package]] +name = "nibble_vec" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77a5d83df9f36fe23f0c3648c6bbb8b0298bb5f1939c8f2704431371f4b84d43" +dependencies = [ + "smallvec", +] + +[[package]] +name = "num-traits" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd" +dependencies = [ + "autocfg", +] + +[[package]] +name = "once_cell" +version = "1.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" + +[[package]] +name = "proc-macro2" +version = "1.0.60" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dec2b086b7a862cf4de201096214fa870344cf922b2b30c167badb3af3195406" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "radix_trie" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c069c179fcdc6a2fe24d8d18305cf085fdbd4f922c041943e203685d6a1c58fd" +dependencies = [ + "endian-type", + "nibble_vec", +] + +[[package]] +name = "smallvec" +version = "1.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0" + +[[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 = "unicode-ident" +version = "1.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0" + +[[package]] +name = "version_check" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" diff --git a/contracts/benchmarks/large-storage/wasm/Cargo.toml b/contracts/benchmarks/large-storage/wasm/Cargo.toml new file mode 100644 index 0000000000..1af57cddba --- /dev/null +++ b/contracts/benchmarks/large-storage/wasm/Cargo.toml @@ -0,0 +1,26 @@ +[package] +name = "large-storage-wasm" +version = "0.0.0" +authors = ["Andrei Marinica "] +edition = "2021" +publish = false + +[lib] +crate-type = ["cdylib"] + +[profile.release] +codegen-units = 1 +opt-level = "z" +lto = true +debug = false +panic = "abort" + +[dependencies.large-storage] +path = ".." + +[dependencies.multiversx-sc-wasm-adapter] +version = "0.41.3" +path = "../../../../framework/wasm-adapter" + +[workspace] +members = ["."] diff --git a/contracts/benchmarks/large-storage/wasm/src/lib.rs b/contracts/benchmarks/large-storage/wasm/src/lib.rs new file mode 100644 index 0000000000..950df7bb3c --- /dev/null +++ b/contracts/benchmarks/large-storage/wasm/src/lib.rs @@ -0,0 +1,26 @@ +// Code generated by the multiversx-sc multi-contract system. DO NOT EDIT. + +//////////////////////////////////////////////////// +////////////////// AUTO-GENERATED ////////////////// +//////////////////////////////////////////////////// + +// Init: 1 +// Endpoints: 2 +// Async Callback (empty): 1 +// Total number of exported functions: 4 + +#![no_std] +#![feature(lang_items)] + +multiversx_sc_wasm_adapter::allocator!(); +multiversx_sc_wasm_adapter::panic_handler!(); + +multiversx_sc_wasm_adapter::endpoints! { + large_storage + ( + saveStructure + savedStructure + ) +} + +multiversx_sc_wasm_adapter::empty_callback! {} diff --git a/contracts/benchmarks/mappers/benchmark-common/Cargo.toml b/contracts/benchmarks/mappers/benchmark-common/Cargo.toml index 98553cd650..662695e60d 100644 --- a/contracts/benchmarks/mappers/benchmark-common/Cargo.toml +++ b/contracts/benchmarks/mappers/benchmark-common/Cargo.toml @@ -9,9 +9,9 @@ publish = false path = "src/lib.rs" [dependencies.multiversx-sc] -version = "0.39.7" +version = "0.41.3" path = "../../../../framework/base" [dev-dependencies.multiversx-sc-scenario] -version = "0.39.7" +version = "0.41.3" path = "../../../../framework/scenario" diff --git a/contracts/benchmarks/mappers/linked-list-repeat/Cargo.toml b/contracts/benchmarks/mappers/linked-list-repeat/Cargo.toml index a835d36702..58e6a48598 100644 --- a/contracts/benchmarks/mappers/linked-list-repeat/Cargo.toml +++ b/contracts/benchmarks/mappers/linked-list-repeat/Cargo.toml @@ -13,9 +13,9 @@ path = "../benchmark-common" [dependencies.multiversx-sc] -version = "0.39.7" +version = "0.41.3" path = "../../../../framework/base" [dev-dependencies.multiversx-sc-scenario] -version = "0.39.7" +version = "0.41.3" path = "../../../../framework/scenario" diff --git a/contracts/benchmarks/mappers/linked-list-repeat/meta/Cargo.toml b/contracts/benchmarks/mappers/linked-list-repeat/meta/Cargo.toml index a5d1c40a9a..24cef932df 100644 --- a/contracts/benchmarks/mappers/linked-list-repeat/meta/Cargo.toml +++ b/contracts/benchmarks/mappers/linked-list-repeat/meta/Cargo.toml @@ -9,5 +9,5 @@ publish = false path = ".." [dependencies.multiversx-sc-meta] -version = "0.39.7" +version = "0.41.3" path = "../../../../../framework/meta" diff --git a/contracts/benchmarks/mappers/linked-list-repeat/tests/scenario_go_test.rs b/contracts/benchmarks/mappers/linked-list-repeat/tests/scenario_go_test.rs index 5136e45e93..3a47565462 100644 --- a/contracts/benchmarks/mappers/linked-list-repeat/tests/scenario_go_test.rs +++ b/contracts/benchmarks/mappers/linked-list-repeat/tests/scenario_go_test.rs @@ -1,9 +1,9 @@ #[test] -fn linked_list_repeat_struct_go() { - multiversx_sc_scenario::run_go("scenarios/linked_list_repeat_struct.scen.json"); +fn linked_list_repeat_go() { + multiversx_sc_scenario::run_go("scenarios/linked_list_repeat.scen.json"); } #[test] -fn linked_list_repeat_go() { - multiversx_sc_scenario::run_go("scenarios/linked_list_repeat.scen.json"); +fn linked_list_repeat_struct_go() { + multiversx_sc_scenario::run_go("scenarios/linked_list_repeat_struct.scen.json"); } diff --git a/contracts/benchmarks/mappers/linked-list-repeat/tests/scenario_rs_test.rs b/contracts/benchmarks/mappers/linked-list-repeat/tests/scenario_rs_test.rs index bf3ace4903..c690bd7c40 100644 --- a/contracts/benchmarks/mappers/linked-list-repeat/tests/scenario_rs_test.rs +++ b/contracts/benchmarks/mappers/linked-list-repeat/tests/scenario_rs_test.rs @@ -12,11 +12,11 @@ fn world() -> ScenarioWorld { } #[test] -fn linked_list_repeat_struct_rs() { - multiversx_sc_scenario::run_rs("scenarios/linked_list_repeat_struct.scen.json", world()); +fn linked_list_repeat_rs() { + multiversx_sc_scenario::run_rs("scenarios/linked_list_repeat.scen.json", world()); } #[test] -fn linked_list_repeat_rs() { - multiversx_sc_scenario::run_rs("scenarios/linked_list_repeat.scen.json", world()); +fn linked_list_repeat_struct_rs() { + multiversx_sc_scenario::run_rs("scenarios/linked_list_repeat_struct.scen.json", world()); } diff --git a/contracts/benchmarks/mappers/linked-list-repeat/wasm/Cargo.lock b/contracts/benchmarks/mappers/linked-list-repeat/wasm/Cargo.lock index e0abeb47f3..f38b9856c7 100644 --- a/contracts/benchmarks/mappers/linked-list-repeat/wasm/Cargo.lock +++ b/contracts/benchmarks/mappers/linked-list-repeat/wasm/Cargo.lock @@ -8,16 +8,16 @@ version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "once_cell", "version_check", ] [[package]] name = "arrayvec" -version = "0.7.2" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" +checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" [[package]] name = "autocfg" @@ -38,12 +38,6 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" -[[package]] -name = "cfg-if" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" - [[package]] name = "cfg-if" version = "1.0.0" @@ -77,12 +71,6 @@ version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ebdb29d2ea9ed0083cd8cece49bbd968021bd99b0849edb4a9a7ee0fdf6a4e0" -[[package]] -name = "libc" -version = "0.2.140" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99227334921fae1a979cf0bfdfcc6b3e5ce376ef57e16fb6fb3ea2ed6095f80c" - [[package]] name = "linked-list-repeat" version = "0.0.0" @@ -99,15 +87,9 @@ dependencies = [ "multiversx-sc-wasm-adapter", ] -[[package]] -name = "memory_units" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8452105ba047068f40ff7093dd1d9da90898e63dd61736462e9cdda6a90ad3c3" - [[package]] name = "multiversx-sc" -version = "0.39.7" +version = "0.41.3" dependencies = [ "bitflags", "hashbrown", @@ -119,7 +101,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.17.1" +version = "0.17.2" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -127,7 +109,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.17.1" +version = "0.17.2" dependencies = [ "hex", "proc-macro2", @@ -137,7 +119,7 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.39.7" +version = "0.41.3" dependencies = [ "hex", "proc-macro2", @@ -148,10 +130,9 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.39.7" +version = "0.41.3" dependencies = [ "multiversx-sc", - "wee_alloc", ] [[package]] @@ -174,24 +155,24 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.17.1" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" +checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" [[package]] name = "proc-macro2" -version = "1.0.52" +version = "1.0.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d0e1ae9e836cc3beddd63db0df682593d7e2d3d891ae8c9083d2113e1744224" +checksum = "dec2b086b7a862cf4de201096214fa870344cf922b2b30c167badb3af3195406" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.26" +version = "1.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4424af4bf778aae2051a77b60283332f386554255d722233d09fbfc7e30da2fc" +checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488" dependencies = [ "proc-macro2", ] @@ -225,46 +206,12 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.8" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4" +checksum = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0" [[package]] name = "version_check" version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" - -[[package]] -name = "wee_alloc" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbb3b5a6b2bb17cb6ad44a2e68a43e8d2722c997da10e928665c72ec6c0a0b8e" -dependencies = [ - "cfg-if 0.1.10", - "libc", - "memory_units", - "winapi", -] - -[[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-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" diff --git a/contracts/benchmarks/mappers/linked-list-repeat/wasm/Cargo.toml b/contracts/benchmarks/mappers/linked-list-repeat/wasm/Cargo.toml index 3e59c11ede..4601990d69 100644 --- a/contracts/benchmarks/mappers/linked-list-repeat/wasm/Cargo.toml +++ b/contracts/benchmarks/mappers/linked-list-repeat/wasm/Cargo.toml @@ -19,7 +19,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.39.7" +version = "0.41.3" path = "../../../../../framework/wasm-adapter" [workspace] diff --git a/contracts/benchmarks/mappers/linked-list-repeat/wasm/src/lib.rs b/contracts/benchmarks/mappers/linked-list-repeat/wasm/src/lib.rs index 9f50e42597..4161e62be3 100644 --- a/contracts/benchmarks/mappers/linked-list-repeat/wasm/src/lib.rs +++ b/contracts/benchmarks/mappers/linked-list-repeat/wasm/src/lib.rs @@ -10,7 +10,7 @@ // Total number of exported functions: 10 #![no_std] -#![feature(alloc_error_handler, lang_items)] +#![feature(lang_items)] multiversx_sc_wasm_adapter::allocator!(); multiversx_sc_wasm_adapter::panic_handler!(); diff --git a/contracts/benchmarks/mappers/map-repeat/Cargo.toml b/contracts/benchmarks/mappers/map-repeat/Cargo.toml index 9f063b1314..af33494ae7 100644 --- a/contracts/benchmarks/mappers/map-repeat/Cargo.toml +++ b/contracts/benchmarks/mappers/map-repeat/Cargo.toml @@ -13,9 +13,9 @@ path = "../benchmark-common" [dependencies.multiversx-sc] -version = "0.39.7" +version = "0.41.3" path = "../../../../framework/base" [dev-dependencies.multiversx-sc-scenario] -version = "0.39.7" +version = "0.41.3" path = "../../../../framework/scenario" diff --git a/contracts/benchmarks/mappers/map-repeat/meta/Cargo.toml b/contracts/benchmarks/mappers/map-repeat/meta/Cargo.toml index ab2fb4af95..910e2d7408 100644 --- a/contracts/benchmarks/mappers/map-repeat/meta/Cargo.toml +++ b/contracts/benchmarks/mappers/map-repeat/meta/Cargo.toml @@ -9,5 +9,5 @@ publish = false path = ".." [dependencies.multiversx-sc-meta] -version = "0.39.7" +version = "0.41.3" path = "../../../../../framework/meta" diff --git a/contracts/benchmarks/mappers/map-repeat/tests/scenario_go_test.rs b/contracts/benchmarks/mappers/map-repeat/tests/scenario_go_test.rs index 53f31d1788..1d85fa142c 100644 --- a/contracts/benchmarks/mappers/map-repeat/tests/scenario_go_test.rs +++ b/contracts/benchmarks/mappers/map-repeat/tests/scenario_go_test.rs @@ -1,9 +1,9 @@ #[test] -fn map_repeat_struct_go() { - multiversx_sc_scenario::run_go("scenarios/map_repeat_struct.scen.json"); +fn map_repeat_go() { + multiversx_sc_scenario::run_go("scenarios/map_repeat.scen.json"); } #[test] -fn map_repeat_go() { - multiversx_sc_scenario::run_go("scenarios/map_repeat.scen.json"); +fn map_repeat_struct_go() { + multiversx_sc_scenario::run_go("scenarios/map_repeat_struct.scen.json"); } diff --git a/contracts/benchmarks/mappers/map-repeat/tests/scenario_rs_test.rs b/contracts/benchmarks/mappers/map-repeat/tests/scenario_rs_test.rs index 221a4e2b5c..46b80d8688 100644 --- a/contracts/benchmarks/mappers/map-repeat/tests/scenario_rs_test.rs +++ b/contracts/benchmarks/mappers/map-repeat/tests/scenario_rs_test.rs @@ -9,11 +9,11 @@ fn world() -> ScenarioWorld { } #[test] -fn map_repeat_struct_rs() { - multiversx_sc_scenario::run_rs("scenarios/map_repeat_struct.scen.json", world()); +fn map_repeat_rs() { + multiversx_sc_scenario::run_rs("scenarios/map_repeat.scen.json", world()); } #[test] -fn map_repeat_rs() { - multiversx_sc_scenario::run_rs("scenarios/map_repeat.scen.json", world()); +fn map_repeat_struct_rs() { + multiversx_sc_scenario::run_rs("scenarios/map_repeat_struct.scen.json", world()); } diff --git a/contracts/benchmarks/mappers/map-repeat/wasm/Cargo.lock b/contracts/benchmarks/mappers/map-repeat/wasm/Cargo.lock index 5819567abf..f0ac075af4 100644 --- a/contracts/benchmarks/mappers/map-repeat/wasm/Cargo.lock +++ b/contracts/benchmarks/mappers/map-repeat/wasm/Cargo.lock @@ -8,16 +8,16 @@ version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "once_cell", "version_check", ] [[package]] name = "arrayvec" -version = "0.7.2" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" +checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" [[package]] name = "autocfg" @@ -38,12 +38,6 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" -[[package]] -name = "cfg-if" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" - [[package]] name = "cfg-if" version = "1.0.0" @@ -77,12 +71,6 @@ version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ebdb29d2ea9ed0083cd8cece49bbd968021bd99b0849edb4a9a7ee0fdf6a4e0" -[[package]] -name = "libc" -version = "0.2.140" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99227334921fae1a979cf0bfdfcc6b3e5ce376ef57e16fb6fb3ea2ed6095f80c" - [[package]] name = "map-repeat" version = "0.0.0" @@ -99,15 +87,9 @@ dependencies = [ "multiversx-sc-wasm-adapter", ] -[[package]] -name = "memory_units" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8452105ba047068f40ff7093dd1d9da90898e63dd61736462e9cdda6a90ad3c3" - [[package]] name = "multiversx-sc" -version = "0.39.7" +version = "0.41.3" dependencies = [ "bitflags", "hashbrown", @@ -119,7 +101,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.17.1" +version = "0.17.2" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -127,7 +109,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.17.1" +version = "0.17.2" dependencies = [ "hex", "proc-macro2", @@ -137,7 +119,7 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.39.7" +version = "0.41.3" dependencies = [ "hex", "proc-macro2", @@ -148,10 +130,9 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.39.7" +version = "0.41.3" dependencies = [ "multiversx-sc", - "wee_alloc", ] [[package]] @@ -174,24 +155,24 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.17.1" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" +checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" [[package]] name = "proc-macro2" -version = "1.0.52" +version = "1.0.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d0e1ae9e836cc3beddd63db0df682593d7e2d3d891ae8c9083d2113e1744224" +checksum = "dec2b086b7a862cf4de201096214fa870344cf922b2b30c167badb3af3195406" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.26" +version = "1.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4424af4bf778aae2051a77b60283332f386554255d722233d09fbfc7e30da2fc" +checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488" dependencies = [ "proc-macro2", ] @@ -225,46 +206,12 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.8" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4" +checksum = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0" [[package]] name = "version_check" version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" - -[[package]] -name = "wee_alloc" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbb3b5a6b2bb17cb6ad44a2e68a43e8d2722c997da10e928665c72ec6c0a0b8e" -dependencies = [ - "cfg-if 0.1.10", - "libc", - "memory_units", - "winapi", -] - -[[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-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" diff --git a/contracts/benchmarks/mappers/map-repeat/wasm/Cargo.toml b/contracts/benchmarks/mappers/map-repeat/wasm/Cargo.toml index 10dab337fa..386b1e995b 100644 --- a/contracts/benchmarks/mappers/map-repeat/wasm/Cargo.toml +++ b/contracts/benchmarks/mappers/map-repeat/wasm/Cargo.toml @@ -19,7 +19,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.39.7" +version = "0.41.3" path = "../../../../../framework/wasm-adapter" [workspace] diff --git a/contracts/benchmarks/mappers/map-repeat/wasm/src/lib.rs b/contracts/benchmarks/mappers/map-repeat/wasm/src/lib.rs index 6c2151e6c7..a1d9039f95 100644 --- a/contracts/benchmarks/mappers/map-repeat/wasm/src/lib.rs +++ b/contracts/benchmarks/mappers/map-repeat/wasm/src/lib.rs @@ -10,7 +10,7 @@ // Total number of exported functions: 8 #![no_std] -#![feature(alloc_error_handler, lang_items)] +#![feature(lang_items)] multiversx_sc_wasm_adapter::allocator!(); multiversx_sc_wasm_adapter::panic_handler!(); diff --git a/contracts/benchmarks/mappers/queue-repeat/Cargo.toml b/contracts/benchmarks/mappers/queue-repeat/Cargo.toml index 2eca86a736..288e6b6f99 100644 --- a/contracts/benchmarks/mappers/queue-repeat/Cargo.toml +++ b/contracts/benchmarks/mappers/queue-repeat/Cargo.toml @@ -13,9 +13,9 @@ path = "../benchmark-common" [dependencies.multiversx-sc] -version = "0.39.7" +version = "0.41.3" path = "../../../../framework/base" [dev-dependencies.multiversx-sc-scenario] -version = "0.39.7" +version = "0.41.3" path = "../../../../framework/scenario" diff --git a/contracts/benchmarks/mappers/queue-repeat/meta/Cargo.toml b/contracts/benchmarks/mappers/queue-repeat/meta/Cargo.toml index 09e1189744..844b0f8342 100644 --- a/contracts/benchmarks/mappers/queue-repeat/meta/Cargo.toml +++ b/contracts/benchmarks/mappers/queue-repeat/meta/Cargo.toml @@ -9,5 +9,5 @@ publish = false path = ".." [dependencies.multiversx-sc-meta] -version = "0.39.7" +version = "0.41.3" path = "../../../../../framework/meta" diff --git a/contracts/benchmarks/mappers/queue-repeat/tests/scenario_go_test.rs b/contracts/benchmarks/mappers/queue-repeat/tests/scenario_go_test.rs index 91566ba3a5..41bf9fbb3a 100644 --- a/contracts/benchmarks/mappers/queue-repeat/tests/scenario_go_test.rs +++ b/contracts/benchmarks/mappers/queue-repeat/tests/scenario_go_test.rs @@ -2,3 +2,8 @@ fn queue_repeat_go() { multiversx_sc_scenario::run_go("scenarios/queue_repeat.scen.json"); } + +#[test] +fn queue_repeat_struct_go() { + multiversx_sc_scenario::run_go("scenarios/queue_repeat_struct.scen.json"); +} diff --git a/contracts/benchmarks/mappers/queue-repeat/tests/scenario_rs_test.rs b/contracts/benchmarks/mappers/queue-repeat/tests/scenario_rs_test.rs index c8a45b2493..2401544ba8 100644 --- a/contracts/benchmarks/mappers/queue-repeat/tests/scenario_rs_test.rs +++ b/contracts/benchmarks/mappers/queue-repeat/tests/scenario_rs_test.rs @@ -12,11 +12,11 @@ fn world() -> ScenarioWorld { } #[test] -fn queue_repeat_struct_rs() { - multiversx_sc_scenario::run_rs("scenarios/queue_repeat_struct.scen.json", world()); +fn queue_repeat_rs() { + multiversx_sc_scenario::run_rs("scenarios/queue_repeat.scen.json", world()); } #[test] -fn queue_repeat_rs() { - multiversx_sc_scenario::run_rs("scenarios/queue_repeat.scen.json", world()); +fn queue_repeat_struct_rs() { + multiversx_sc_scenario::run_rs("scenarios/queue_repeat_struct.scen.json", world()); } diff --git a/contracts/benchmarks/mappers/queue-repeat/wasm/Cargo.lock b/contracts/benchmarks/mappers/queue-repeat/wasm/Cargo.lock index 9b4a1da32b..bd549f24f6 100644 --- a/contracts/benchmarks/mappers/queue-repeat/wasm/Cargo.lock +++ b/contracts/benchmarks/mappers/queue-repeat/wasm/Cargo.lock @@ -8,16 +8,16 @@ version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "once_cell", "version_check", ] [[package]] name = "arrayvec" -version = "0.7.2" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" +checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" [[package]] name = "autocfg" @@ -38,12 +38,6 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" -[[package]] -name = "cfg-if" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" - [[package]] name = "cfg-if" version = "1.0.0" @@ -77,21 +71,9 @@ version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ebdb29d2ea9ed0083cd8cece49bbd968021bd99b0849edb4a9a7ee0fdf6a4e0" -[[package]] -name = "libc" -version = "0.2.140" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99227334921fae1a979cf0bfdfcc6b3e5ce376ef57e16fb6fb3ea2ed6095f80c" - -[[package]] -name = "memory_units" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8452105ba047068f40ff7093dd1d9da90898e63dd61736462e9cdda6a90ad3c3" - [[package]] name = "multiversx-sc" -version = "0.39.7" +version = "0.41.3" dependencies = [ "bitflags", "hashbrown", @@ -103,7 +85,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.17.1" +version = "0.17.2" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -111,7 +93,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.17.1" +version = "0.17.2" dependencies = [ "hex", "proc-macro2", @@ -121,7 +103,7 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.39.7" +version = "0.41.3" dependencies = [ "hex", "proc-macro2", @@ -132,10 +114,9 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.39.7" +version = "0.41.3" dependencies = [ "multiversx-sc", - "wee_alloc", ] [[package]] @@ -158,15 +139,15 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.17.1" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" +checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" [[package]] name = "proc-macro2" -version = "1.0.52" +version = "1.0.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d0e1ae9e836cc3beddd63db0df682593d7e2d3d891ae8c9083d2113e1744224" +checksum = "dec2b086b7a862cf4de201096214fa870344cf922b2b30c167badb3af3195406" dependencies = [ "unicode-ident", ] @@ -189,9 +170,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.26" +version = "1.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4424af4bf778aae2051a77b60283332f386554255d722233d09fbfc7e30da2fc" +checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488" dependencies = [ "proc-macro2", ] @@ -225,46 +206,12 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.8" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4" +checksum = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0" [[package]] name = "version_check" version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" - -[[package]] -name = "wee_alloc" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbb3b5a6b2bb17cb6ad44a2e68a43e8d2722c997da10e928665c72ec6c0a0b8e" -dependencies = [ - "cfg-if 0.1.10", - "libc", - "memory_units", - "winapi", -] - -[[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-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" diff --git a/contracts/benchmarks/mappers/queue-repeat/wasm/Cargo.toml b/contracts/benchmarks/mappers/queue-repeat/wasm/Cargo.toml index 0bd2ad9c13..c97065dea2 100644 --- a/contracts/benchmarks/mappers/queue-repeat/wasm/Cargo.toml +++ b/contracts/benchmarks/mappers/queue-repeat/wasm/Cargo.toml @@ -19,7 +19,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.39.7" +version = "0.41.3" path = "../../../../../framework/wasm-adapter" [workspace] diff --git a/contracts/benchmarks/mappers/queue-repeat/wasm/src/lib.rs b/contracts/benchmarks/mappers/queue-repeat/wasm/src/lib.rs index 5fc7fee0f0..7af40cde4f 100644 --- a/contracts/benchmarks/mappers/queue-repeat/wasm/src/lib.rs +++ b/contracts/benchmarks/mappers/queue-repeat/wasm/src/lib.rs @@ -10,7 +10,7 @@ // Total number of exported functions: 10 #![no_std] -#![feature(alloc_error_handler, lang_items)] +#![feature(lang_items)] multiversx_sc_wasm_adapter::allocator!(); multiversx_sc_wasm_adapter::panic_handler!(); diff --git a/contracts/benchmarks/mappers/set-repeat/Cargo.toml b/contracts/benchmarks/mappers/set-repeat/Cargo.toml index 9a10ddce76..f77a528c34 100644 --- a/contracts/benchmarks/mappers/set-repeat/Cargo.toml +++ b/contracts/benchmarks/mappers/set-repeat/Cargo.toml @@ -13,9 +13,9 @@ path = "../benchmark-common" [dependencies.multiversx-sc] -version = "0.39.7" +version = "0.41.3" path = "../../../../framework/base" [dev-dependencies.multiversx-sc-scenario] -version = "0.39.7" +version = "0.41.3" path = "../../../../framework/scenario" diff --git a/contracts/benchmarks/mappers/set-repeat/meta/Cargo.toml b/contracts/benchmarks/mappers/set-repeat/meta/Cargo.toml index 225e3564be..0ea4b2f7cc 100644 --- a/contracts/benchmarks/mappers/set-repeat/meta/Cargo.toml +++ b/contracts/benchmarks/mappers/set-repeat/meta/Cargo.toml @@ -9,5 +9,5 @@ publish = false path = ".." [dependencies.multiversx-sc-meta] -version = "0.39.7" +version = "0.41.3" path = "../../../../../framework/meta" diff --git a/contracts/benchmarks/mappers/set-repeat/tests/scenario_go_test.rs b/contracts/benchmarks/mappers/set-repeat/tests/scenario_go_test.rs index 5c016e7ed5..1658cca035 100644 --- a/contracts/benchmarks/mappers/set-repeat/tests/scenario_go_test.rs +++ b/contracts/benchmarks/mappers/set-repeat/tests/scenario_go_test.rs @@ -1,9 +1,9 @@ #[test] -fn set_repeat_struct_go() { - multiversx_sc_scenario::run_go("scenarios/set_repeat_struct.scen.json"); +fn set_repeat_go() { + multiversx_sc_scenario::run_go("scenarios/set_repeat.scen.json"); } #[test] -fn set_repeat_go() { - multiversx_sc_scenario::run_go("scenarios/set_repeat.scen.json"); +fn set_repeat_struct_go() { + multiversx_sc_scenario::run_go("scenarios/set_repeat_struct.scen.json"); } diff --git a/contracts/benchmarks/mappers/set-repeat/tests/scenario_rs_test.rs b/contracts/benchmarks/mappers/set-repeat/tests/scenario_rs_test.rs index 7e8a606b98..b23abb1be2 100644 --- a/contracts/benchmarks/mappers/set-repeat/tests/scenario_rs_test.rs +++ b/contracts/benchmarks/mappers/set-repeat/tests/scenario_rs_test.rs @@ -9,11 +9,11 @@ fn world() -> ScenarioWorld { } #[test] -fn set_repeat_struct_rs() { - multiversx_sc_scenario::run_rs("scenarios/set_repeat_struct.scen.json", world()); +fn set_repeat_rs() { + multiversx_sc_scenario::run_rs("scenarios/set_repeat.scen.json", world()); } #[test] -fn set_repeat_rs() { - multiversx_sc_scenario::run_rs("scenarios/set_repeat.scen.json", world()); +fn set_repeat_struct_rs() { + multiversx_sc_scenario::run_rs("scenarios/set_repeat_struct.scen.json", world()); } diff --git a/contracts/benchmarks/mappers/set-repeat/wasm/Cargo.lock b/contracts/benchmarks/mappers/set-repeat/wasm/Cargo.lock index 5acfa67d97..30e613292b 100644 --- a/contracts/benchmarks/mappers/set-repeat/wasm/Cargo.lock +++ b/contracts/benchmarks/mappers/set-repeat/wasm/Cargo.lock @@ -8,16 +8,16 @@ version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "once_cell", "version_check", ] [[package]] name = "arrayvec" -version = "0.7.2" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" +checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" [[package]] name = "autocfg" @@ -38,12 +38,6 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" -[[package]] -name = "cfg-if" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" - [[package]] name = "cfg-if" version = "1.0.0" @@ -77,21 +71,9 @@ version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ebdb29d2ea9ed0083cd8cece49bbd968021bd99b0849edb4a9a7ee0fdf6a4e0" -[[package]] -name = "libc" -version = "0.2.140" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99227334921fae1a979cf0bfdfcc6b3e5ce376ef57e16fb6fb3ea2ed6095f80c" - -[[package]] -name = "memory_units" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8452105ba047068f40ff7093dd1d9da90898e63dd61736462e9cdda6a90ad3c3" - [[package]] name = "multiversx-sc" -version = "0.39.7" +version = "0.41.3" dependencies = [ "bitflags", "hashbrown", @@ -103,7 +85,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.17.1" +version = "0.17.2" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -111,7 +93,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.17.1" +version = "0.17.2" dependencies = [ "hex", "proc-macro2", @@ -121,7 +103,7 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.39.7" +version = "0.41.3" dependencies = [ "hex", "proc-macro2", @@ -132,10 +114,9 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.39.7" +version = "0.41.3" dependencies = [ "multiversx-sc", - "wee_alloc", ] [[package]] @@ -158,24 +139,24 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.17.1" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" +checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" [[package]] name = "proc-macro2" -version = "1.0.52" +version = "1.0.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d0e1ae9e836cc3beddd63db0df682593d7e2d3d891ae8c9083d2113e1744224" +checksum = "dec2b086b7a862cf4de201096214fa870344cf922b2b30c167badb3af3195406" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.26" +version = "1.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4424af4bf778aae2051a77b60283332f386554255d722233d09fbfc7e30da2fc" +checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488" dependencies = [ "proc-macro2", ] @@ -225,46 +206,12 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.8" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4" +checksum = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0" [[package]] name = "version_check" version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" - -[[package]] -name = "wee_alloc" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbb3b5a6b2bb17cb6ad44a2e68a43e8d2722c997da10e928665c72ec6c0a0b8e" -dependencies = [ - "cfg-if 0.1.10", - "libc", - "memory_units", - "winapi", -] - -[[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-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" diff --git a/contracts/benchmarks/mappers/set-repeat/wasm/Cargo.toml b/contracts/benchmarks/mappers/set-repeat/wasm/Cargo.toml index 44aca9d731..52a099330a 100644 --- a/contracts/benchmarks/mappers/set-repeat/wasm/Cargo.toml +++ b/contracts/benchmarks/mappers/set-repeat/wasm/Cargo.toml @@ -19,7 +19,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.39.7" +version = "0.41.3" path = "../../../../../framework/wasm-adapter" [workspace] diff --git a/contracts/benchmarks/mappers/set-repeat/wasm/src/lib.rs b/contracts/benchmarks/mappers/set-repeat/wasm/src/lib.rs index 89fb3a60cb..2885ed8ade 100644 --- a/contracts/benchmarks/mappers/set-repeat/wasm/src/lib.rs +++ b/contracts/benchmarks/mappers/set-repeat/wasm/src/lib.rs @@ -10,7 +10,7 @@ // Total number of exported functions: 10 #![no_std] -#![feature(alloc_error_handler, lang_items)] +#![feature(lang_items)] multiversx_sc_wasm_adapter::allocator!(); multiversx_sc_wasm_adapter::panic_handler!(); diff --git a/contracts/benchmarks/mappers/single-value-repeat/Cargo.toml b/contracts/benchmarks/mappers/single-value-repeat/Cargo.toml index f2394095eb..6f08e5fca3 100644 --- a/contracts/benchmarks/mappers/single-value-repeat/Cargo.toml +++ b/contracts/benchmarks/mappers/single-value-repeat/Cargo.toml @@ -13,9 +13,9 @@ path = "../benchmark-common" [dependencies.multiversx-sc] -version = "0.39.7" +version = "0.41.3" path = "../../../../framework/base" [dev-dependencies.multiversx-sc-scenario] -version = "0.39.7" +version = "0.41.3" path = "../../../../framework/scenario" diff --git a/contracts/benchmarks/mappers/single-value-repeat/meta/Cargo.toml b/contracts/benchmarks/mappers/single-value-repeat/meta/Cargo.toml index c8ed38f6b5..7aeb8056af 100644 --- a/contracts/benchmarks/mappers/single-value-repeat/meta/Cargo.toml +++ b/contracts/benchmarks/mappers/single-value-repeat/meta/Cargo.toml @@ -9,5 +9,5 @@ publish = false path = ".." [dependencies.multiversx-sc-meta] -version = "0.39.7" +version = "0.41.3" path = "../../../../../framework/meta" diff --git a/contracts/benchmarks/mappers/single-value-repeat/tests/scenario_go_test.rs b/contracts/benchmarks/mappers/single-value-repeat/tests/scenario_go_test.rs index 2c3c6094da..b087ac45e2 100644 --- a/contracts/benchmarks/mappers/single-value-repeat/tests/scenario_go_test.rs +++ b/contracts/benchmarks/mappers/single-value-repeat/tests/scenario_go_test.rs @@ -1,9 +1,9 @@ #[test] -fn single_value_repeat_struct_go() { - multiversx_sc_scenario::run_go("scenarios/single_value_repeat_struct.scen.json"); +fn single_value_repeat_go() { + multiversx_sc_scenario::run_go("scenarios/single_value_repeat.scen.json"); } #[test] -fn single_value_repeat_go() { - multiversx_sc_scenario::run_go("scenarios/single_value_repeat.scen.json"); +fn single_value_repeat_struct_go() { + multiversx_sc_scenario::run_go("scenarios/single_value_repeat_struct.scen.json"); } diff --git a/contracts/benchmarks/mappers/single-value-repeat/tests/scenario_rs_test.rs b/contracts/benchmarks/mappers/single-value-repeat/tests/scenario_rs_test.rs index 95ef7c1a41..db9f8706e9 100644 --- a/contracts/benchmarks/mappers/single-value-repeat/tests/scenario_rs_test.rs +++ b/contracts/benchmarks/mappers/single-value-repeat/tests/scenario_rs_test.rs @@ -12,11 +12,11 @@ fn world() -> ScenarioWorld { } #[test] -fn single_value_repeat_struct_rs() { - multiversx_sc_scenario::run_rs("scenarios/single_value_repeat_struct.scen.json", world()); +fn single_value_repeat_rs() { + multiversx_sc_scenario::run_rs("scenarios/single_value_repeat.scen.json", world()); } #[test] -fn single_value_repeat_rs() { - multiversx_sc_scenario::run_rs("scenarios/single_value_repeat.scen.json", world()); +fn single_value_repeat_struct_rs() { + multiversx_sc_scenario::run_rs("scenarios/single_value_repeat_struct.scen.json", world()); } diff --git a/contracts/benchmarks/mappers/single-value-repeat/wasm/Cargo.lock b/contracts/benchmarks/mappers/single-value-repeat/wasm/Cargo.lock index 32b1d7aac2..2823beae70 100644 --- a/contracts/benchmarks/mappers/single-value-repeat/wasm/Cargo.lock +++ b/contracts/benchmarks/mappers/single-value-repeat/wasm/Cargo.lock @@ -8,16 +8,16 @@ version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "once_cell", "version_check", ] [[package]] name = "arrayvec" -version = "0.7.2" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" +checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" [[package]] name = "autocfg" @@ -38,12 +38,6 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" -[[package]] -name = "cfg-if" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" - [[package]] name = "cfg-if" version = "1.0.0" @@ -77,21 +71,9 @@ version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ebdb29d2ea9ed0083cd8cece49bbd968021bd99b0849edb4a9a7ee0fdf6a4e0" -[[package]] -name = "libc" -version = "0.2.140" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99227334921fae1a979cf0bfdfcc6b3e5ce376ef57e16fb6fb3ea2ed6095f80c" - -[[package]] -name = "memory_units" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8452105ba047068f40ff7093dd1d9da90898e63dd61736462e9cdda6a90ad3c3" - [[package]] name = "multiversx-sc" -version = "0.39.7" +version = "0.41.3" dependencies = [ "bitflags", "hashbrown", @@ -103,7 +85,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.17.1" +version = "0.17.2" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -111,7 +93,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.17.1" +version = "0.17.2" dependencies = [ "hex", "proc-macro2", @@ -121,7 +103,7 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.39.7" +version = "0.41.3" dependencies = [ "hex", "proc-macro2", @@ -132,10 +114,9 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.39.7" +version = "0.41.3" dependencies = [ "multiversx-sc", - "wee_alloc", ] [[package]] @@ -158,24 +139,24 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.17.1" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" +checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" [[package]] name = "proc-macro2" -version = "1.0.52" +version = "1.0.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d0e1ae9e836cc3beddd63db0df682593d7e2d3d891ae8c9083d2113e1744224" +checksum = "dec2b086b7a862cf4de201096214fa870344cf922b2b30c167badb3af3195406" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.26" +version = "1.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4424af4bf778aae2051a77b60283332f386554255d722233d09fbfc7e30da2fc" +checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488" dependencies = [ "proc-macro2", ] @@ -225,46 +206,12 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.8" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4" +checksum = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0" [[package]] name = "version_check" version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" - -[[package]] -name = "wee_alloc" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbb3b5a6b2bb17cb6ad44a2e68a43e8d2722c997da10e928665c72ec6c0a0b8e" -dependencies = [ - "cfg-if 0.1.10", - "libc", - "memory_units", - "winapi", -] - -[[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-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" diff --git a/contracts/benchmarks/mappers/single-value-repeat/wasm/Cargo.toml b/contracts/benchmarks/mappers/single-value-repeat/wasm/Cargo.toml index 9daab3cc04..cedc3d61bd 100644 --- a/contracts/benchmarks/mappers/single-value-repeat/wasm/Cargo.toml +++ b/contracts/benchmarks/mappers/single-value-repeat/wasm/Cargo.toml @@ -19,7 +19,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.39.7" +version = "0.41.3" path = "../../../../../framework/wasm-adapter" [workspace] diff --git a/contracts/benchmarks/mappers/single-value-repeat/wasm/src/lib.rs b/contracts/benchmarks/mappers/single-value-repeat/wasm/src/lib.rs index 627636977e..79d582469c 100644 --- a/contracts/benchmarks/mappers/single-value-repeat/wasm/src/lib.rs +++ b/contracts/benchmarks/mappers/single-value-repeat/wasm/src/lib.rs @@ -10,7 +10,7 @@ // Total number of exported functions: 8 #![no_std] -#![feature(alloc_error_handler, lang_items)] +#![feature(lang_items)] multiversx_sc_wasm_adapter::allocator!(); multiversx_sc_wasm_adapter::panic_handler!(); diff --git a/contracts/benchmarks/mappers/vec-repeat/Cargo.toml b/contracts/benchmarks/mappers/vec-repeat/Cargo.toml index 7398c6a7fd..77c89ae110 100644 --- a/contracts/benchmarks/mappers/vec-repeat/Cargo.toml +++ b/contracts/benchmarks/mappers/vec-repeat/Cargo.toml @@ -13,9 +13,9 @@ path = "../benchmark-common" [dependencies.multiversx-sc] -version = "0.39.7" +version = "0.41.3" path = "../../../../framework/base" [dev-dependencies.multiversx-sc-scenario] -version = "0.39.7" +version = "0.41.3" path = "../../../../framework/scenario" diff --git a/contracts/benchmarks/mappers/vec-repeat/meta/Cargo.toml b/contracts/benchmarks/mappers/vec-repeat/meta/Cargo.toml index 299f0ddda2..9cb05c3475 100644 --- a/contracts/benchmarks/mappers/vec-repeat/meta/Cargo.toml +++ b/contracts/benchmarks/mappers/vec-repeat/meta/Cargo.toml @@ -8,5 +8,5 @@ publish = false path = ".." [dependencies.multiversx-sc-meta] -version = "0.39.7" +version = "0.41.3" path = "../../../../../framework/meta" diff --git a/contracts/benchmarks/mappers/vec-repeat/tests/scenario_go_test.rs b/contracts/benchmarks/mappers/vec-repeat/tests/scenario_go_test.rs index 2d71d44235..cbd67c78f7 100644 --- a/contracts/benchmarks/mappers/vec-repeat/tests/scenario_go_test.rs +++ b/contracts/benchmarks/mappers/vec-repeat/tests/scenario_go_test.rs @@ -1,9 +1,9 @@ #[test] -fn vec_repeat_struct_go() { - multiversx_sc_scenario::run_go("scenarios/vec_repeat_struct.scen.json"); +fn vec_repeat_go() { + multiversx_sc_scenario::run_go("scenarios/vec_repeat.scen.json"); } #[test] -fn vec_repeat_go() { - multiversx_sc_scenario::run_go("scenarios/vec_repeat.scen.json"); +fn vec_repeat_struct_go() { + multiversx_sc_scenario::run_go("scenarios/vec_repeat_struct.scen.json"); } diff --git a/contracts/benchmarks/mappers/vec-repeat/tests/scenario_rs_test.rs b/contracts/benchmarks/mappers/vec-repeat/tests/scenario_rs_test.rs index df25d59a0d..da2d217df2 100644 --- a/contracts/benchmarks/mappers/vec-repeat/tests/scenario_rs_test.rs +++ b/contracts/benchmarks/mappers/vec-repeat/tests/scenario_rs_test.rs @@ -9,11 +9,11 @@ fn world() -> ScenarioWorld { } #[test] -fn vec_repeat_struct_rs() { - multiversx_sc_scenario::run_rs("scenarios/vec_repeat_struct.scen.json", world()); +fn vec_repeat_rs() { + multiversx_sc_scenario::run_rs("scenarios/vec_repeat.scen.json", world()); } #[test] -fn vec_repeat_rs() { - multiversx_sc_scenario::run_rs("scenarios/vec_repeat.scen.json", world()); +fn vec_repeat_struct_rs() { + multiversx_sc_scenario::run_rs("scenarios/vec_repeat_struct.scen.json", world()); } diff --git a/contracts/benchmarks/mappers/vec-repeat/wasm/Cargo.lock b/contracts/benchmarks/mappers/vec-repeat/wasm/Cargo.lock index 9a0650e8ec..eb4a725ae3 100644 --- a/contracts/benchmarks/mappers/vec-repeat/wasm/Cargo.lock +++ b/contracts/benchmarks/mappers/vec-repeat/wasm/Cargo.lock @@ -8,16 +8,16 @@ version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "once_cell", "version_check", ] [[package]] name = "arrayvec" -version = "0.7.2" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" +checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" [[package]] name = "autocfg" @@ -38,12 +38,6 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" -[[package]] -name = "cfg-if" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" - [[package]] name = "cfg-if" version = "1.0.0" @@ -77,21 +71,9 @@ version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ebdb29d2ea9ed0083cd8cece49bbd968021bd99b0849edb4a9a7ee0fdf6a4e0" -[[package]] -name = "libc" -version = "0.2.140" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99227334921fae1a979cf0bfdfcc6b3e5ce376ef57e16fb6fb3ea2ed6095f80c" - -[[package]] -name = "memory_units" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8452105ba047068f40ff7093dd1d9da90898e63dd61736462e9cdda6a90ad3c3" - [[package]] name = "multiversx-sc" -version = "0.39.7" +version = "0.41.3" dependencies = [ "bitflags", "hashbrown", @@ -103,7 +85,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.17.1" +version = "0.17.2" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -111,7 +93,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.17.1" +version = "0.17.2" dependencies = [ "hex", "proc-macro2", @@ -121,7 +103,7 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.39.7" +version = "0.41.3" dependencies = [ "hex", "proc-macro2", @@ -132,10 +114,9 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.39.7" +version = "0.41.3" dependencies = [ "multiversx-sc", - "wee_alloc", ] [[package]] @@ -158,24 +139,24 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.17.1" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" +checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" [[package]] name = "proc-macro2" -version = "1.0.52" +version = "1.0.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d0e1ae9e836cc3beddd63db0df682593d7e2d3d891ae8c9083d2113e1744224" +checksum = "dec2b086b7a862cf4de201096214fa870344cf922b2b30c167badb3af3195406" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.26" +version = "1.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4424af4bf778aae2051a77b60283332f386554255d722233d09fbfc7e30da2fc" +checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488" dependencies = [ "proc-macro2", ] @@ -209,9 +190,9 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.8" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4" +checksum = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0" [[package]] name = "vec-repeat" @@ -234,37 +215,3 @@ name = "version_check" version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" - -[[package]] -name = "wee_alloc" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbb3b5a6b2bb17cb6ad44a2e68a43e8d2722c997da10e928665c72ec6c0a0b8e" -dependencies = [ - "cfg-if 0.1.10", - "libc", - "memory_units", - "winapi", -] - -[[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-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" diff --git a/contracts/benchmarks/mappers/vec-repeat/wasm/Cargo.toml b/contracts/benchmarks/mappers/vec-repeat/wasm/Cargo.toml index db0f6b4234..6467159e7d 100644 --- a/contracts/benchmarks/mappers/vec-repeat/wasm/Cargo.toml +++ b/contracts/benchmarks/mappers/vec-repeat/wasm/Cargo.toml @@ -19,7 +19,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.39.7" +version = "0.41.3" path = "../../../../../framework/wasm-adapter" [workspace] diff --git a/contracts/benchmarks/mappers/vec-repeat/wasm/src/lib.rs b/contracts/benchmarks/mappers/vec-repeat/wasm/src/lib.rs index 13171c89d6..9d1b54fedb 100644 --- a/contracts/benchmarks/mappers/vec-repeat/wasm/src/lib.rs +++ b/contracts/benchmarks/mappers/vec-repeat/wasm/src/lib.rs @@ -10,7 +10,7 @@ // Total number of exported functions: 10 #![no_std] -#![feature(alloc_error_handler, lang_items)] +#![feature(lang_items)] multiversx_sc_wasm_adapter::allocator!(); multiversx_sc_wasm_adapter::panic_handler!(); diff --git a/contracts/benchmarks/send-tx-repeat/Cargo.toml b/contracts/benchmarks/send-tx-repeat/Cargo.toml index 3f8391c6bc..88dbbd92cf 100644 --- a/contracts/benchmarks/send-tx-repeat/Cargo.toml +++ b/contracts/benchmarks/send-tx-repeat/Cargo.toml @@ -9,10 +9,9 @@ publish = false path = "src/send_tx_repeat.rs" [dependencies.multiversx-sc] -version = "0.39.7" +version = "0.41.3" path = "../../../framework/base" -features = ["alloc"] [dev-dependencies.multiversx-sc-scenario] -version = "0.39.7" +version = "0.41.3" path = "../../../framework/scenario" diff --git a/contracts/benchmarks/send-tx-repeat/meta/Cargo.toml b/contracts/benchmarks/send-tx-repeat/meta/Cargo.toml index 256bea4be7..7a56ac830b 100644 --- a/contracts/benchmarks/send-tx-repeat/meta/Cargo.toml +++ b/contracts/benchmarks/send-tx-repeat/meta/Cargo.toml @@ -8,5 +8,5 @@ publish = false path = ".." [dependencies.multiversx-sc-meta] -version = "0.39.7" +version = "0.41.3" path = "../../../../framework/meta" diff --git a/contracts/benchmarks/send-tx-repeat/wasm/Cargo.lock b/contracts/benchmarks/send-tx-repeat/wasm/Cargo.lock index e5150fc4fd..2153188e07 100755 --- a/contracts/benchmarks/send-tx-repeat/wasm/Cargo.lock +++ b/contracts/benchmarks/send-tx-repeat/wasm/Cargo.lock @@ -8,16 +8,16 @@ version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "once_cell", "version_check", ] [[package]] name = "arrayvec" -version = "0.7.2" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" +checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" [[package]] name = "autocfg" @@ -31,12 +31,6 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" -[[package]] -name = "cfg-if" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" - [[package]] name = "cfg-if" version = "1.0.0" @@ -70,21 +64,9 @@ version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ebdb29d2ea9ed0083cd8cece49bbd968021bd99b0849edb4a9a7ee0fdf6a4e0" -[[package]] -name = "libc" -version = "0.2.140" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99227334921fae1a979cf0bfdfcc6b3e5ce376ef57e16fb6fb3ea2ed6095f80c" - -[[package]] -name = "memory_units" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8452105ba047068f40ff7093dd1d9da90898e63dd61736462e9cdda6a90ad3c3" - [[package]] name = "multiversx-sc" -version = "0.39.7" +version = "0.41.3" dependencies = [ "bitflags", "hashbrown", @@ -96,7 +78,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.17.1" +version = "0.17.2" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -104,7 +86,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.17.1" +version = "0.17.2" dependencies = [ "hex", "proc-macro2", @@ -114,7 +96,7 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.39.7" +version = "0.41.3" dependencies = [ "hex", "proc-macro2", @@ -125,10 +107,9 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.39.7" +version = "0.41.3" dependencies = [ "multiversx-sc", - "wee_alloc", ] [[package]] @@ -151,24 +132,24 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.17.1" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" +checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" [[package]] name = "proc-macro2" -version = "1.0.52" +version = "1.0.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d0e1ae9e836cc3beddd63db0df682593d7e2d3d891ae8c9083d2113e1744224" +checksum = "dec2b086b7a862cf4de201096214fa870344cf922b2b30c167badb3af3195406" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.26" +version = "1.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4424af4bf778aae2051a77b60283332f386554255d722233d09fbfc7e30da2fc" +checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488" dependencies = [ "proc-macro2", ] @@ -217,46 +198,12 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.8" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4" +checksum = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0" [[package]] name = "version_check" version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" - -[[package]] -name = "wee_alloc" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbb3b5a6b2bb17cb6ad44a2e68a43e8d2722c997da10e928665c72ec6c0a0b8e" -dependencies = [ - "cfg-if 0.1.10", - "libc", - "memory_units", - "winapi", -] - -[[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-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" diff --git a/contracts/benchmarks/send-tx-repeat/wasm/Cargo.toml b/contracts/benchmarks/send-tx-repeat/wasm/Cargo.toml index 7131a251af..23287fa97d 100644 --- a/contracts/benchmarks/send-tx-repeat/wasm/Cargo.toml +++ b/contracts/benchmarks/send-tx-repeat/wasm/Cargo.toml @@ -19,7 +19,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.39.7" +version = "0.41.3" path = "../../../../framework/wasm-adapter" [workspace] diff --git a/contracts/benchmarks/send-tx-repeat/wasm/src/lib.rs b/contracts/benchmarks/send-tx-repeat/wasm/src/lib.rs index c266a3a59f..98d88515ee 100644 --- a/contracts/benchmarks/send-tx-repeat/wasm/src/lib.rs +++ b/contracts/benchmarks/send-tx-repeat/wasm/src/lib.rs @@ -10,7 +10,7 @@ // Total number of exported functions: 3 #![no_std] -#![feature(alloc_error_handler, lang_items)] +#![feature(lang_items)] multiversx_sc_wasm_adapter::allocator!(); multiversx_sc_wasm_adapter::panic_handler!(); diff --git a/contracts/benchmarks/str-repeat/Cargo.toml b/contracts/benchmarks/str-repeat/Cargo.toml index 42f1264840..59cae4af18 100644 --- a/contracts/benchmarks/str-repeat/Cargo.toml +++ b/contracts/benchmarks/str-repeat/Cargo.toml @@ -9,10 +9,10 @@ publish = false path = "src/str_repeat.rs" [dependencies.multiversx-sc] -version = "0.39.7" +version = "0.41.3" path = "../../../framework/base" features = ["alloc"] [dev-dependencies.multiversx-sc-scenario] -version = "0.39.7" +version = "0.41.3" path = "../../../framework/scenario" diff --git a/contracts/benchmarks/str-repeat/meta/Cargo.toml b/contracts/benchmarks/str-repeat/meta/Cargo.toml index 6c50f892d7..45b64cc727 100644 --- a/contracts/benchmarks/str-repeat/meta/Cargo.toml +++ b/contracts/benchmarks/str-repeat/meta/Cargo.toml @@ -8,5 +8,5 @@ publish = false path = ".." [dependencies.multiversx-sc-meta] -version = "0.39.7" +version = "0.41.3" path = "../../../../framework/meta" diff --git a/contracts/benchmarks/str-repeat/multicontract.toml b/contracts/benchmarks/str-repeat/multicontract.toml new file mode 100644 index 0000000000..4b0f5d0ecd --- /dev/null +++ b/contracts/benchmarks/str-repeat/multicontract.toml @@ -0,0 +1,7 @@ +[settings] +main = "str-repeat" + +# the only purpose of this config is to specify the allocator +[contracts.str-repeat] +add-unlabelled = true +allocator = "leaking" diff --git a/contracts/benchmarks/str-repeat/tests/scenario_rs_test.rs b/contracts/benchmarks/str-repeat/tests/scenario_rs_test.rs index 0c560f18ee..31023c4a83 100644 --- a/contracts/benchmarks/str-repeat/tests/scenario_rs_test.rs +++ b/contracts/benchmarks/str-repeat/tests/scenario_rs_test.rs @@ -7,6 +7,6 @@ fn world() -> ScenarioWorld { } #[test] -fn test_str_repeat_rs() { +fn str_repeat_rs() { multiversx_sc_scenario::run_rs("scenarios/str_repeat.scen.json", world()); } diff --git a/contracts/benchmarks/str-repeat/wasm/Cargo.lock b/contracts/benchmarks/str-repeat/wasm/Cargo.lock index 44a2db7234..f259bb192c 100755 --- a/contracts/benchmarks/str-repeat/wasm/Cargo.lock +++ b/contracts/benchmarks/str-repeat/wasm/Cargo.lock @@ -8,16 +8,16 @@ version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "once_cell", "version_check", ] [[package]] name = "arrayvec" -version = "0.7.2" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" +checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" [[package]] name = "autocfg" @@ -31,12 +31,6 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" -[[package]] -name = "cfg-if" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" - [[package]] name = "cfg-if" version = "1.0.0" @@ -70,21 +64,9 @@ version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ebdb29d2ea9ed0083cd8cece49bbd968021bd99b0849edb4a9a7ee0fdf6a4e0" -[[package]] -name = "libc" -version = "0.2.140" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99227334921fae1a979cf0bfdfcc6b3e5ce376ef57e16fb6fb3ea2ed6095f80c" - -[[package]] -name = "memory_units" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8452105ba047068f40ff7093dd1d9da90898e63dd61736462e9cdda6a90ad3c3" - [[package]] name = "multiversx-sc" -version = "0.39.7" +version = "0.41.3" dependencies = [ "bitflags", "hashbrown", @@ -96,7 +78,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.17.1" +version = "0.17.2" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -104,7 +86,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.17.1" +version = "0.17.2" dependencies = [ "hex", "proc-macro2", @@ -114,7 +96,7 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.39.7" +version = "0.41.3" dependencies = [ "hex", "proc-macro2", @@ -125,10 +107,9 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.39.7" +version = "0.41.3" dependencies = [ "multiversx-sc", - "wee_alloc", ] [[package]] @@ -151,24 +132,24 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.17.1" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" +checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" [[package]] name = "proc-macro2" -version = "1.0.52" +version = "1.0.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d0e1ae9e836cc3beddd63db0df682593d7e2d3d891ae8c9083d2113e1744224" +checksum = "dec2b086b7a862cf4de201096214fa870344cf922b2b30c167badb3af3195406" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.26" +version = "1.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4424af4bf778aae2051a77b60283332f386554255d722233d09fbfc7e30da2fc" +checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488" dependencies = [ "proc-macro2", ] @@ -217,46 +198,12 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.8" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4" +checksum = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0" [[package]] name = "version_check" version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" - -[[package]] -name = "wee_alloc" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbb3b5a6b2bb17cb6ad44a2e68a43e8d2722c997da10e928665c72ec6c0a0b8e" -dependencies = [ - "cfg-if 0.1.10", - "libc", - "memory_units", - "winapi", -] - -[[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-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" diff --git a/contracts/benchmarks/str-repeat/wasm/Cargo.toml b/contracts/benchmarks/str-repeat/wasm/Cargo.toml index 189f76d316..1e53e213d0 100644 --- a/contracts/benchmarks/str-repeat/wasm/Cargo.toml +++ b/contracts/benchmarks/str-repeat/wasm/Cargo.toml @@ -19,7 +19,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.39.7" +version = "0.41.3" path = "../../../../framework/wasm-adapter" [workspace] diff --git a/contracts/benchmarks/str-repeat/wasm/src/lib.rs b/contracts/benchmarks/str-repeat/wasm/src/lib.rs index ee21165345..611374ed1a 100644 --- a/contracts/benchmarks/str-repeat/wasm/src/lib.rs +++ b/contracts/benchmarks/str-repeat/wasm/src/lib.rs @@ -10,9 +10,9 @@ // Total number of exported functions: 5 #![no_std] -#![feature(alloc_error_handler, lang_items)] +#![feature(lang_items)] -multiversx_sc_wasm_adapter::allocator!(); +multiversx_sc_wasm_adapter::allocator!(leaking); multiversx_sc_wasm_adapter::panic_handler!(); multiversx_sc_wasm_adapter::endpoints! { diff --git a/contracts/core/price-aggregator/Cargo.toml b/contracts/core/price-aggregator/Cargo.toml index 3f840a27dd..4704949635 100644 --- a/contracts/core/price-aggregator/Cargo.toml +++ b/contracts/core/price-aggregator/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "multiversx-price-aggregator-sc" -version = "0.39.7" +version = "0.41.3" authors = [ "Claudiu-Marcel Bruda ", "MultiversX ", @@ -10,7 +10,7 @@ readme = "README.md" repository = "https://github.com/multiversx/mx-sdk-rs" homepage = "https://multiversx.com/" documentation = "https://docs.multiversx.com/" -description = "Elrond Price aggregator Smart Contract" +description = "MultiversX Price aggregator Smart Contract" keywords = ["multiversx", "wasm", "webassembly", "blockchain", "contract"] categories = ["no-std", "wasm", "cryptography::cryptocurrencies"] edition = "2021" @@ -19,15 +19,15 @@ edition = "2021" path = "src/lib.rs" [dependencies.multiversx-sc] -version = "0.39.7" +version = "0.41.3" path = "../../../framework/base" [dependencies.multiversx-sc-modules] -version = "0.39.7" +version = "0.41.3" path = "../../../contracts/modules" [dev-dependencies.multiversx-sc-scenario] -version = "0.39.7" +version = "0.41.3" path = "../../../framework/scenario" [dependencies] diff --git a/contracts/core/price-aggregator/meta/Cargo.toml b/contracts/core/price-aggregator/meta/Cargo.toml index 21b191a01c..14217ee6bd 100644 --- a/contracts/core/price-aggregator/meta/Cargo.toml +++ b/contracts/core/price-aggregator/meta/Cargo.toml @@ -8,9 +8,9 @@ publish = false path = ".." [dependencies.multiversx-sc] -version = "0.39.7" +version = "0.41.3" path = "../../../../framework/base" [dependencies.multiversx-sc-meta] -version = "0.39.7" +version = "0.41.3" path = "../../../../framework/meta" diff --git a/contracts/core/price-aggregator/wasm/Cargo.lock b/contracts/core/price-aggregator/wasm/Cargo.lock index d2c2eaa478..ac62e7dcb2 100644 --- a/contracts/core/price-aggregator/wasm/Cargo.lock +++ b/contracts/core/price-aggregator/wasm/Cargo.lock @@ -8,16 +8,16 @@ version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "once_cell", "version_check", ] [[package]] name = "arrayvec" -version = "0.7.2" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" +checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" [[package]] name = "autocfg" @@ -31,12 +31,6 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" -[[package]] -name = "cfg-if" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" - [[package]] name = "cfg-if" version = "1.0.0" @@ -70,21 +64,9 @@ version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ebdb29d2ea9ed0083cd8cece49bbd968021bd99b0849edb4a9a7ee0fdf6a4e0" -[[package]] -name = "libc" -version = "0.2.140" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99227334921fae1a979cf0bfdfcc6b3e5ce376ef57e16fb6fb3ea2ed6095f80c" - -[[package]] -name = "memory_units" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8452105ba047068f40ff7093dd1d9da90898e63dd61736462e9cdda6a90ad3c3" - [[package]] name = "multiversx-price-aggregator-sc" -version = "0.39.7" +version = "0.41.3" dependencies = [ "arrayvec", "multiversx-sc", @@ -101,7 +83,7 @@ dependencies = [ [[package]] name = "multiversx-sc" -version = "0.39.7" +version = "0.41.3" dependencies = [ "bitflags", "hashbrown", @@ -113,7 +95,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.17.1" +version = "0.17.2" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -121,7 +103,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.17.1" +version = "0.17.2" dependencies = [ "hex", "proc-macro2", @@ -131,7 +113,7 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.39.7" +version = "0.41.3" dependencies = [ "hex", "proc-macro2", @@ -142,17 +124,16 @@ dependencies = [ [[package]] name = "multiversx-sc-modules" -version = "0.39.7" +version = "0.41.3" dependencies = [ "multiversx-sc", ] [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.39.7" +version = "0.41.3" dependencies = [ "multiversx-sc", - "wee_alloc", ] [[package]] @@ -175,24 +156,24 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.17.1" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" +checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" [[package]] name = "proc-macro2" -version = "1.0.52" +version = "1.0.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d0e1ae9e836cc3beddd63db0df682593d7e2d3d891ae8c9083d2113e1744224" +checksum = "dec2b086b7a862cf4de201096214fa870344cf922b2b30c167badb3af3195406" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.26" +version = "1.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4424af4bf778aae2051a77b60283332f386554255d722233d09fbfc7e30da2fc" +checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488" dependencies = [ "proc-macro2", ] @@ -226,46 +207,12 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.8" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4" +checksum = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0" [[package]] name = "version_check" version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" - -[[package]] -name = "wee_alloc" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbb3b5a6b2bb17cb6ad44a2e68a43e8d2722c997da10e928665c72ec6c0a0b8e" -dependencies = [ - "cfg-if 0.1.10", - "libc", - "memory_units", - "winapi", -] - -[[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-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" diff --git a/contracts/core/price-aggregator/wasm/Cargo.toml b/contracts/core/price-aggregator/wasm/Cargo.toml index 15c1e073f2..cc3249f55d 100644 --- a/contracts/core/price-aggregator/wasm/Cargo.toml +++ b/contracts/core/price-aggregator/wasm/Cargo.toml @@ -19,7 +19,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.39.7" +version = "0.41.3" path = "../../../../framework/wasm-adapter" [workspace] diff --git a/contracts/core/price-aggregator/wasm/src/lib.rs b/contracts/core/price-aggregator/wasm/src/lib.rs index b3b9df2308..1c0d0f4d22 100644 --- a/contracts/core/price-aggregator/wasm/src/lib.rs +++ b/contracts/core/price-aggregator/wasm/src/lib.rs @@ -10,7 +10,7 @@ // Total number of exported functions: 21 #![no_std] -#![feature(alloc_error_handler, lang_items)] +#![feature(lang_items)] multiversx_sc_wasm_adapter::allocator!(); multiversx_sc_wasm_adapter::panic_handler!(); diff --git a/contracts/core/wegld-swap/Cargo.toml b/contracts/core/wegld-swap/Cargo.toml index d19cf47dd2..0d247ec212 100644 --- a/contracts/core/wegld-swap/Cargo.toml +++ b/contracts/core/wegld-swap/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "multiversx-wegld-swap-sc" -version = "0.39.7" +version = "0.41.3" authors = [ "Dorin Iancu ", @@ -11,7 +11,7 @@ readme = "README.md" repository = "https://github.com/multiversx/mx-sdk-rs" homepage = "https://multiversx.com/" documentation = "https://docs.multiversx.com/" -description = "Elrond Price aggregator Smart Contract" +description = "MultiversX Wrapped EGLD Smart Contract" keywords = ["multiversx", "wasm", "webassembly", "blockchain", "contract"] categories = ["no-std", "wasm", "cryptography::cryptocurrencies"] edition = "2021" @@ -20,13 +20,13 @@ edition = "2021" path = "src/wegld.rs" [dependencies.multiversx-sc] -version = "0.39.7" +version = "0.41.3" path = "../../../framework/base" [dependencies.multiversx-sc-modules] -version = "0.39.7" +version = "0.41.3" path = "../../../contracts/modules" [dev-dependencies.multiversx-sc-scenario] -version = "0.39.7" +version = "0.41.3" path = "../../../framework/scenario" diff --git a/contracts/core/wegld-swap/meta/Cargo.toml b/contracts/core/wegld-swap/meta/Cargo.toml index 87cf9fb596..d46628c5d1 100644 --- a/contracts/core/wegld-swap/meta/Cargo.toml +++ b/contracts/core/wegld-swap/meta/Cargo.toml @@ -11,9 +11,9 @@ publish = false path = ".." [dependencies.multiversx-sc] -version = "0.39.7" +version = "0.41.3" path = "../../../../framework/base" [dependencies.multiversx-sc-meta] -version = "0.39.7" +version = "0.41.3" path = "../../../../framework/meta" diff --git a/contracts/core/wegld-swap/src/wegld.rs b/contracts/core/wegld-swap/src/wegld.rs index a60b484e6a..4b12bbc80a 100644 --- a/contracts/core/wegld-swap/src/wegld.rs +++ b/contracts/core/wegld-swap/src/wegld.rs @@ -17,7 +17,7 @@ pub trait EgldEsdtSwap: multiversx_sc_modules::pause::PauseModule { self.require_not_paused(); let payment_amount = self.call_value().egld_value(); - require!(payment_amount > 0u32, "Payment must be more than 0"); + require!(*payment_amount > 0u32, "Payment must be more than 0"); let wrapped_egld_token_id = self.wrapped_egld_token_id().get(); self.send() @@ -27,7 +27,7 @@ pub trait EgldEsdtSwap: multiversx_sc_modules::pause::PauseModule { self.send() .direct_esdt(&caller, &wrapped_egld_token_id, 0, &payment_amount); - EsdtTokenPayment::new(wrapped_egld_token_id, 0, payment_amount) + EsdtTokenPayment::new(wrapped_egld_token_id, 0, payment_amount.clone_value()) } #[payable("*")] diff --git a/contracts/core/wegld-swap/tests/wegld_swap_scenario_rs_test.rs b/contracts/core/wegld-swap/tests/wegld_swap_scenario_rs_test.rs new file mode 100644 index 0000000000..76907fe23c --- /dev/null +++ b/contracts/core/wegld-swap/tests/wegld_swap_scenario_rs_test.rs @@ -0,0 +1,22 @@ +use multiversx_sc_scenario::*; + +fn world() -> ScenarioWorld { + let mut blockchain = ScenarioWorld::new(); + blockchain.set_current_dir_from_workspace("contracts/core/wegld-swap"); + + blockchain.register_contract( + "file:output/multiversx-wegld-swap-sc.wasm", + multiversx_wegld_swap_sc::ContractBuilder, + ); + blockchain +} + +#[test] +fn unwrap_egld_rs() { + multiversx_sc_scenario::run_rs("scenarios/unwrap_egld.scen.json", world()); +} + +#[test] +fn wrap_egld_rs() { + multiversx_sc_scenario::run_rs("scenarios/wrap_egld.scen.json", world()); +} diff --git a/contracts/core/wegld-swap/wasm/Cargo.toml b/contracts/core/wegld-swap/wasm/Cargo.toml index acd078b9c6..f71c2ad697 100644 --- a/contracts/core/wegld-swap/wasm/Cargo.toml +++ b/contracts/core/wegld-swap/wasm/Cargo.toml @@ -24,5 +24,5 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.39.7" +version = "0.41.3" path = "../../../../framework/wasm-adapter" diff --git a/contracts/core/wegld-swap/wasm/src/lib.rs b/contracts/core/wegld-swap/wasm/src/lib.rs index 3d2c5f2ce9..d521513401 100644 --- a/contracts/core/wegld-swap/wasm/src/lib.rs +++ b/contracts/core/wegld-swap/wasm/src/lib.rs @@ -10,7 +10,7 @@ // Total number of exported functions: 9 #![no_std] -#![feature(alloc_error_handler, lang_items)] +#![feature(lang_items)] multiversx_sc_wasm_adapter::allocator!(); multiversx_sc_wasm_adapter::panic_handler!(); diff --git a/contracts/examples/adder/Cargo.toml b/contracts/examples/adder/Cargo.toml index c2d0f9af22..eb43f6e765 100644 --- a/contracts/examples/adder/Cargo.toml +++ b/contracts/examples/adder/Cargo.toml @@ -9,9 +9,9 @@ publish = false path = "src/adder.rs" [dependencies.multiversx-sc] -version = "0.39.7" +version = "0.41.3" path = "../../../framework/base" [dev-dependencies.multiversx-sc-scenario] -version = "0.39.7" +version = "0.41.3" path = "../../../framework/scenario" diff --git a/contracts/examples/adder/meta/Cargo.toml b/contracts/examples/adder/meta/Cargo.toml index a6995b0da7..e63d1b1795 100644 --- a/contracts/examples/adder/meta/Cargo.toml +++ b/contracts/examples/adder/meta/Cargo.toml @@ -8,5 +8,5 @@ publish = false path = ".." [dependencies.multiversx-sc-meta] -version = "0.39.7" +version = "0.41.3" path = "../../../../framework/meta" diff --git a/contracts/examples/adder/wasm/Cargo.lock b/contracts/examples/adder/wasm/Cargo.lock index b0f72f20e3..7f7909ebc9 100755 --- a/contracts/examples/adder/wasm/Cargo.lock +++ b/contracts/examples/adder/wasm/Cargo.lock @@ -23,16 +23,16 @@ version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "once_cell", "version_check", ] [[package]] name = "arrayvec" -version = "0.7.2" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" +checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" [[package]] name = "autocfg" @@ -46,12 +46,6 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" -[[package]] -name = "cfg-if" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" - [[package]] name = "cfg-if" version = "1.0.0" @@ -85,21 +79,9 @@ version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ebdb29d2ea9ed0083cd8cece49bbd968021bd99b0849edb4a9a7ee0fdf6a4e0" -[[package]] -name = "libc" -version = "0.2.140" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99227334921fae1a979cf0bfdfcc6b3e5ce376ef57e16fb6fb3ea2ed6095f80c" - -[[package]] -name = "memory_units" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8452105ba047068f40ff7093dd1d9da90898e63dd61736462e9cdda6a90ad3c3" - [[package]] name = "multiversx-sc" -version = "0.39.7" +version = "0.41.3" dependencies = [ "bitflags", "hashbrown", @@ -111,7 +93,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.17.1" +version = "0.17.2" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -119,7 +101,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.17.1" +version = "0.17.2" dependencies = [ "hex", "proc-macro2", @@ -129,7 +111,7 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.39.7" +version = "0.41.3" dependencies = [ "hex", "proc-macro2", @@ -140,10 +122,9 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.39.7" +version = "0.41.3" dependencies = [ "multiversx-sc", - "wee_alloc", ] [[package]] @@ -166,24 +147,24 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.17.1" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" +checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" [[package]] name = "proc-macro2" -version = "1.0.52" +version = "1.0.63" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d0e1ae9e836cc3beddd63db0df682593d7e2d3d891ae8c9083d2113e1744224" +checksum = "7b368fba921b0dce7e60f5e04ec15e565b3303972b42bcfde1d0713b881959eb" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.26" +version = "1.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4424af4bf778aae2051a77b60283332f386554255d722233d09fbfc7e30da2fc" +checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488" dependencies = [ "proc-macro2", ] @@ -217,46 +198,12 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.8" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4" +checksum = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0" [[package]] name = "version_check" version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" - -[[package]] -name = "wee_alloc" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbb3b5a6b2bb17cb6ad44a2e68a43e8d2722c997da10e928665c72ec6c0a0b8e" -dependencies = [ - "cfg-if 0.1.10", - "libc", - "memory_units", - "winapi", -] - -[[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-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" diff --git a/contracts/examples/adder/wasm/Cargo.toml b/contracts/examples/adder/wasm/Cargo.toml index fae08eadfe..33cbd64825 100644 --- a/contracts/examples/adder/wasm/Cargo.toml +++ b/contracts/examples/adder/wasm/Cargo.toml @@ -19,7 +19,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.39.7" +version = "0.41.3" path = "../../../../framework/wasm-adapter" [workspace] diff --git a/contracts/examples/adder/wasm/src/lib.rs b/contracts/examples/adder/wasm/src/lib.rs index 1fb04a8fdb..d14d54c52b 100644 --- a/contracts/examples/adder/wasm/src/lib.rs +++ b/contracts/examples/adder/wasm/src/lib.rs @@ -10,7 +10,7 @@ // Total number of exported functions: 4 #![no_std] -#![feature(alloc_error_handler, lang_items)] +#![feature(lang_items)] multiversx_sc_wasm_adapter::allocator!(); multiversx_sc_wasm_adapter::panic_handler!(); diff --git a/contracts/examples/bonding-curve-contract/Cargo.toml b/contracts/examples/bonding-curve-contract/Cargo.toml index b7e2ea0f62..1ca207f0f4 100644 --- a/contracts/examples/bonding-curve-contract/Cargo.toml +++ b/contracts/examples/bonding-curve-contract/Cargo.toml @@ -9,14 +9,14 @@ publish = false path = "src/bonding_curve_contract.rs" [dependencies.multiversx-sc] -version = "0.39.7" +version = "0.41.3" path = "../../../framework/base" [dependencies.multiversx-sc-modules] -version = "0.39.7" +version = "0.41.3" path = "../../../contracts/modules" [dev-dependencies.multiversx-sc-scenario] -version = "0.39.7" +version = "0.41.3" path = "../../../framework/scenario" diff --git a/contracts/examples/bonding-curve-contract/meta/Cargo.toml b/contracts/examples/bonding-curve-contract/meta/Cargo.toml index 3c77b28826..f8aaad9e24 100644 --- a/contracts/examples/bonding-curve-contract/meta/Cargo.toml +++ b/contracts/examples/bonding-curve-contract/meta/Cargo.toml @@ -9,5 +9,5 @@ publish = false path = ".." [dependencies.multiversx-sc-meta] -version = "0.39.7" +version = "0.41.3" path = "../../../../framework/meta" diff --git a/contracts/examples/bonding-curve-contract/tests/bonding_curve_scenario_go_test.rs b/contracts/examples/bonding-curve-contract/tests/bonding_curve_scenario_go_test.rs index be158d728f..dee51e3145 100644 --- a/contracts/examples/bonding-curve-contract/tests/bonding_curve_scenario_go_test.rs +++ b/contracts/examples/bonding-curve-contract/tests/bonding_curve_scenario_go_test.rs @@ -1,34 +1,34 @@ #[test] -fn deploy_rs() { - multiversx_sc_scenario::run_go("scenarios/deploy.scen.json"); +fn buy_go() { + multiversx_sc_scenario::run_go("scenarios/buy.scen.json"); } #[test] -fn deposit_rs() { - multiversx_sc_scenario::run_go("scenarios/deposit.scen.json"); +fn claim_go() { + multiversx_sc_scenario::run_go("scenarios/claim.scen.json"); } #[test] -fn set_bonding_curve_rs() { - multiversx_sc_scenario::run_go("scenarios/set_bonding_curve.scen.json"); +fn deploy_go() { + multiversx_sc_scenario::run_go("scenarios/deploy.scen.json"); } #[test] -fn buy_rs() { - multiversx_sc_scenario::run_go("scenarios/buy.scen.json"); +fn deposit_go() { + multiversx_sc_scenario::run_go("scenarios/deposit.scen.json"); } #[test] -fn sell_rs() { - multiversx_sc_scenario::run_go("scenarios/sell.scen.json"); +fn deposit_more_view_go() { + multiversx_sc_scenario::run_go("scenarios/deposit_more_view.scen.json"); } #[test] -fn deposit_more_view_rs() { - multiversx_sc_scenario::run_go("scenarios/deposit_more_view.scen.json"); +fn sell_go() { + multiversx_sc_scenario::run_go("scenarios/sell.scen.json"); } #[test] -fn claim_rs() { - multiversx_sc_scenario::run_go("scenarios/claim.scen.json"); +fn set_bonding_curve_go() { + multiversx_sc_scenario::run_go("scenarios/set_bonding_curve.scen.json"); } diff --git a/contracts/examples/bonding-curve-contract/tests/bonding_curve_scenario_rs_test.rs b/contracts/examples/bonding-curve-contract/tests/bonding_curve_scenario_rs_test.rs index 84064cf3e8..0fc3650ce7 100644 --- a/contracts/examples/bonding-curve-contract/tests/bonding_curve_scenario_rs_test.rs +++ b/contracts/examples/bonding-curve-contract/tests/bonding_curve_scenario_rs_test.rs @@ -10,36 +10,36 @@ fn world() -> ScenarioWorld { } #[test] -fn deploy_rs() { - multiversx_sc_scenario::run_rs("scenarios/deploy.scen.json", world()); +fn buy_rs() { + multiversx_sc_scenario::run_rs("scenarios/buy.scen.json", world()); } #[test] -fn deposit_rs() { - multiversx_sc_scenario::run_rs("scenarios/deposit.scen.json", world()); +fn claim_rs() { + multiversx_sc_scenario::run_rs("scenarios/claim.scen.json", world()); } #[test] -fn set_bonding_curve_rs() { - multiversx_sc_scenario::run_rs("scenarios/set_bonding_curve.scen.json", world()); +fn deploy_rs() { + multiversx_sc_scenario::run_rs("scenarios/deploy.scen.json", world()); } #[test] -fn buy_rs() { - multiversx_sc_scenario::run_rs("scenarios/buy.scen.json", world()); +fn deposit_rs() { + multiversx_sc_scenario::run_rs("scenarios/deposit.scen.json", world()); } #[test] -fn sell_rs() { - multiversx_sc_scenario::run_rs("scenarios/sell.scen.json", world()); +fn deposit_more_view_rs() { + multiversx_sc_scenario::run_rs("scenarios/deposit_more_view.scen.json", world()); } #[test] -fn deposit_more_view_rs() { - multiversx_sc_scenario::run_rs("scenarios/deposit_more_view.scen.json", world()); +fn sell_rs() { + multiversx_sc_scenario::run_rs("scenarios/sell.scen.json", world()); } #[test] -fn claim_rs() { - multiversx_sc_scenario::run_rs("scenarios/claim.scen.json", world()); +fn set_bonding_curve_rs() { + multiversx_sc_scenario::run_rs("scenarios/set_bonding_curve.scen.json", world()); } diff --git a/contracts/examples/bonding-curve-contract/wasm/Cargo.lock b/contracts/examples/bonding-curve-contract/wasm/Cargo.lock index a599a4f495..3cd0d18278 100644 --- a/contracts/examples/bonding-curve-contract/wasm/Cargo.lock +++ b/contracts/examples/bonding-curve-contract/wasm/Cargo.lock @@ -8,16 +8,16 @@ version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "once_cell", "version_check", ] [[package]] name = "arrayvec" -version = "0.7.2" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" +checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" [[package]] name = "autocfg" @@ -47,12 +47,6 @@ dependencies = [ "multiversx-sc-wasm-adapter", ] -[[package]] -name = "cfg-if" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" - [[package]] name = "cfg-if" version = "1.0.0" @@ -86,21 +80,9 @@ version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ebdb29d2ea9ed0083cd8cece49bbd968021bd99b0849edb4a9a7ee0fdf6a4e0" -[[package]] -name = "libc" -version = "0.2.140" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99227334921fae1a979cf0bfdfcc6b3e5ce376ef57e16fb6fb3ea2ed6095f80c" - -[[package]] -name = "memory_units" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8452105ba047068f40ff7093dd1d9da90898e63dd61736462e9cdda6a90ad3c3" - [[package]] name = "multiversx-sc" -version = "0.39.7" +version = "0.41.3" dependencies = [ "bitflags", "hashbrown", @@ -112,7 +94,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.17.1" +version = "0.17.2" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -120,7 +102,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.17.1" +version = "0.17.2" dependencies = [ "hex", "proc-macro2", @@ -130,7 +112,7 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.39.7" +version = "0.41.3" dependencies = [ "hex", "proc-macro2", @@ -141,17 +123,16 @@ dependencies = [ [[package]] name = "multiversx-sc-modules" -version = "0.39.7" +version = "0.41.3" dependencies = [ "multiversx-sc", ] [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.39.7" +version = "0.41.3" dependencies = [ "multiversx-sc", - "wee_alloc", ] [[package]] @@ -174,24 +155,24 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.17.1" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" +checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" [[package]] name = "proc-macro2" -version = "1.0.52" +version = "1.0.63" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d0e1ae9e836cc3beddd63db0df682593d7e2d3d891ae8c9083d2113e1744224" +checksum = "7b368fba921b0dce7e60f5e04ec15e565b3303972b42bcfde1d0713b881959eb" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.26" +version = "1.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4424af4bf778aae2051a77b60283332f386554255d722233d09fbfc7e30da2fc" +checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488" dependencies = [ "proc-macro2", ] @@ -225,46 +206,12 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.8" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4" +checksum = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0" [[package]] name = "version_check" version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" - -[[package]] -name = "wee_alloc" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbb3b5a6b2bb17cb6ad44a2e68a43e8d2722c997da10e928665c72ec6c0a0b8e" -dependencies = [ - "cfg-if 0.1.10", - "libc", - "memory_units", - "winapi", -] - -[[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-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" diff --git a/contracts/examples/bonding-curve-contract/wasm/Cargo.toml b/contracts/examples/bonding-curve-contract/wasm/Cargo.toml index 8edbcb654a..1ce5fa8b6f 100644 --- a/contracts/examples/bonding-curve-contract/wasm/Cargo.toml +++ b/contracts/examples/bonding-curve-contract/wasm/Cargo.toml @@ -19,7 +19,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.39.7" +version = "0.41.3" path = "../../../../framework/wasm-adapter" [workspace] diff --git a/contracts/examples/bonding-curve-contract/wasm/src/lib.rs b/contracts/examples/bonding-curve-contract/wasm/src/lib.rs index d634ecd48e..4dd5665175 100644 --- a/contracts/examples/bonding-curve-contract/wasm/src/lib.rs +++ b/contracts/examples/bonding-curve-contract/wasm/src/lib.rs @@ -10,7 +10,7 @@ // Total number of exported functions: 12 #![no_std] -#![feature(alloc_error_handler, lang_items)] +#![feature(lang_items)] multiversx_sc_wasm_adapter::allocator!(); multiversx_sc_wasm_adapter::panic_handler!(); diff --git a/contracts/examples/check-pause/.gitignore b/contracts/examples/check-pause/.gitignore new file mode 100644 index 0000000000..2c76bc983e --- /dev/null +++ b/contracts/examples/check-pause/.gitignore @@ -0,0 +1,7 @@ +# Generated by Cargo +# will have compiled files and executables +/target/ +*/target/ + +# The mxpy output +/output*/ diff --git a/contracts/examples/check-pause/Cargo.toml b/contracts/examples/check-pause/Cargo.toml new file mode 100644 index 0000000000..969f4c8daf --- /dev/null +++ b/contracts/examples/check-pause/Cargo.toml @@ -0,0 +1,25 @@ +[package] +name = "check-pause" +version = "0.0.0" +authors = ["Alin Cruceat "] +edition = "2021" +publish = false + +[lib] +path = "src/check_pause.rs" + +[dev-dependencies] +num-bigint = "0.4.2" + +[dependencies.multiversx-sc] +version = "0.41.3" +path = "../../../framework/base" + +[dependencies.multiversx-sc-modules] +version = "0.41.3" +path = "../../../contracts/modules" + +[dev-dependencies.multiversx-sc-scenario] +version = "0.41.3" +path = "../../../framework/scenario" + diff --git a/contracts/examples/check-pause/meta/Cargo.toml b/contracts/examples/check-pause/meta/Cargo.toml new file mode 100644 index 0000000000..bdaa9b21c4 --- /dev/null +++ b/contracts/examples/check-pause/meta/Cargo.toml @@ -0,0 +1,13 @@ +[package] +name = "check-pause-meta" +version = "0.0.0" +edition = "2021" +publish = false +authors = ["Alin Cruceat "] + +[dependencies.check-pause] +path = ".." + +[dependencies.multiversx-sc-meta] +version = "0.41.3" +path = "../../../../framework/meta" diff --git a/contracts/examples/check-pause/meta/src/main.rs b/contracts/examples/check-pause/meta/src/main.rs new file mode 100644 index 0000000000..50f10f59cb --- /dev/null +++ b/contracts/examples/check-pause/meta/src/main.rs @@ -0,0 +1,3 @@ +fn main() { + multiversx_sc_meta::cli_main::(); +} diff --git a/contracts/examples/check-pause/multiversx.json b/contracts/examples/check-pause/multiversx.json new file mode 100644 index 0000000000..7365539625 --- /dev/null +++ b/contracts/examples/check-pause/multiversx.json @@ -0,0 +1,3 @@ +{ + "language": "rust" +} \ No newline at end of file diff --git a/contracts/examples/check-pause/src/check_pause.rs b/contracts/examples/check-pause/src/check_pause.rs new file mode 100644 index 0000000000..82f5ba55a9 --- /dev/null +++ b/contracts/examples/check-pause/src/check_pause.rs @@ -0,0 +1,16 @@ +#![no_std] + +multiversx_sc::imports!(); + +use multiversx_sc_modules::pause; + +#[multiversx_sc::contract] +pub trait CheckPauseContract: pause::PauseModule { + #[init] + fn init(&self) {} + + #[endpoint(checkPause)] + fn check_pause(&self) -> SCResult { + Ok(self.is_paused()) + } +} diff --git a/contracts/examples/check-pause/wasm/Cargo.lock b/contracts/examples/check-pause/wasm/Cargo.lock new file mode 100644 index 0000000000..996ab7c9e0 --- /dev/null +++ b/contracts/examples/check-pause/wasm/Cargo.lock @@ -0,0 +1,217 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "ahash" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f" +dependencies = [ + "cfg-if", + "once_cell", + "version_check", +] + +[[package]] +name = "arrayvec" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" + +[[package]] +name = "autocfg" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" + +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "check-pause" +version = "0.0.0" +dependencies = [ + "multiversx-sc", + "multiversx-sc-modules", +] + +[[package]] +name = "check-pause-wasm" +version = "0.0.0" +dependencies = [ + "check-pause", + "multiversx-sc-wasm-adapter", +] + +[[package]] +name = "endian-type" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c34f04666d835ff5d62e058c3995147c06f42fe86ff053337632bca83e42702d" + +[[package]] +name = "hashbrown" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" +dependencies = [ + "ahash", +] + +[[package]] +name = "hex" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" + +[[package]] +name = "hex-literal" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ebdb29d2ea9ed0083cd8cece49bbd968021bd99b0849edb4a9a7ee0fdf6a4e0" + +[[package]] +name = "multiversx-sc" +version = "0.41.3" +dependencies = [ + "bitflags", + "hashbrown", + "hex-literal", + "multiversx-sc-codec", + "multiversx-sc-derive", + "num-traits", +] + +[[package]] +name = "multiversx-sc-codec" +version = "0.17.2" +dependencies = [ + "arrayvec", + "multiversx-sc-codec-derive", +] + +[[package]] +name = "multiversx-sc-codec-derive" +version = "0.17.2" +dependencies = [ + "hex", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "multiversx-sc-derive" +version = "0.41.3" +dependencies = [ + "hex", + "proc-macro2", + "quote", + "radix_trie", + "syn", +] + +[[package]] +name = "multiversx-sc-modules" +version = "0.41.3" +dependencies = [ + "multiversx-sc", +] + +[[package]] +name = "multiversx-sc-wasm-adapter" +version = "0.41.3" +dependencies = [ + "multiversx-sc", +] + +[[package]] +name = "nibble_vec" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77a5d83df9f36fe23f0c3648c6bbb8b0298bb5f1939c8f2704431371f4b84d43" +dependencies = [ + "smallvec", +] + +[[package]] +name = "num-traits" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd" +dependencies = [ + "autocfg", +] + +[[package]] +name = "once_cell" +version = "1.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" + +[[package]] +name = "proc-macro2" +version = "1.0.63" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b368fba921b0dce7e60f5e04ec15e565b3303972b42bcfde1d0713b881959eb" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "radix_trie" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c069c179fcdc6a2fe24d8d18305cf085fdbd4f922c041943e203685d6a1c58fd" +dependencies = [ + "endian-type", + "nibble_vec", +] + +[[package]] +name = "smallvec" +version = "1.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0" + +[[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 = "unicode-ident" +version = "1.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0" + +[[package]] +name = "version_check" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" diff --git a/contracts/examples/check-pause/wasm/Cargo.toml b/contracts/examples/check-pause/wasm/Cargo.toml new file mode 100644 index 0000000000..f2f0fb69b5 --- /dev/null +++ b/contracts/examples/check-pause/wasm/Cargo.toml @@ -0,0 +1,28 @@ +[package] +name = "check-pause-wasm" +version = "0.0.0" +edition = "2021" +authors = ["Alin Cruceat "] +publish = false + +[lib] +crate-type = [ "cdylib",] + +[workspace] +members = [".",] + +[dev-dependencies] + +[profile.release] +codegen-units = 1 +opt-level = "z" +lto = true +debug = false +panic = "abort" + +[dependencies.check-pause] +path = ".." + +[dependencies.multiversx-sc-wasm-adapter] +version = "0.41.3" +path = "../../../../framework/wasm-adapter" diff --git a/contracts/examples/check-pause/wasm/src/lib.rs b/contracts/examples/check-pause/wasm/src/lib.rs new file mode 100644 index 0000000000..c8a0d49bb5 --- /dev/null +++ b/contracts/examples/check-pause/wasm/src/lib.rs @@ -0,0 +1,28 @@ +// Code generated by the multiversx-sc multi-contract system. DO NOT EDIT. + +//////////////////////////////////////////////////// +////////////////// AUTO-GENERATED ////////////////// +//////////////////////////////////////////////////// + +// Init: 1 +// Endpoints: 4 +// Async Callback (empty): 1 +// Total number of exported functions: 6 + +#![no_std] +#![feature(lang_items)] + +multiversx_sc_wasm_adapter::allocator!(); +multiversx_sc_wasm_adapter::panic_handler!(); + +multiversx_sc_wasm_adapter::endpoints! { + check_pause + ( + checkPause + pause + unpause + isPaused + ) +} + +multiversx_sc_wasm_adapter::empty_callback! {} diff --git a/contracts/examples/crowdfunding-esdt/Cargo.toml b/contracts/examples/crowdfunding-esdt/Cargo.toml index 7ce2b8262d..214d3191dc 100644 --- a/contracts/examples/crowdfunding-esdt/Cargo.toml +++ b/contracts/examples/crowdfunding-esdt/Cargo.toml @@ -9,11 +9,11 @@ publish = false path = "src/crowdfunding_esdt.rs" [dependencies.multiversx-sc] -version = "0.39.7" +version = "0.41.3" path = "../../../framework/base" [dev-dependencies.multiversx-sc-scenario] -version = "0.39.7" +version = "0.41.3" path = "../../../framework/scenario" [dev-dependencies] diff --git a/contracts/examples/crowdfunding-esdt/interaction/alice.pem b/contracts/examples/crowdfunding-esdt/interaction/alice.pem new file mode 100644 index 0000000000..3f513ab9a1 --- /dev/null +++ b/contracts/examples/crowdfunding-esdt/interaction/alice.pem @@ -0,0 +1,5 @@ +-----BEGIN PRIVATE KEY for erd1l453hd0gt5gzdp7czpuall8ggt2dcv5zwmfdf3sd3lguxseux2fsmsgldz----- +MWE5MjdlMmFmNTMwNmE5YmIyZWE3NzdmNzNlMDZlY2MwYWM5YWFhNzJmYjRlYTNm +ZWNmNjU5NDUxMzk0Y2NjZmZkNjkxYmI1ZTg1ZDEwMjY4N2Q4MTA3OWRmZmNlODQy +ZDRkYzMyODI3NmQyZDRjNjBkOGZkMWMzNDMzYzMyOTM= +-----END PRIVATE KEY for erd1l453hd0gt5gzdp7czpuall8ggt2dcv5zwmfdf3sd3lguxseux2fsmsgldz----- diff --git a/contracts/examples/crowdfunding-esdt/interaction/devnet.snippets.sh b/contracts/examples/crowdfunding-esdt/interaction/devnet.snippets.sh index 57ccd92165..c9dabb5bca 100644 --- a/contracts/examples/crowdfunding-esdt/interaction/devnet.snippets.sh +++ b/contracts/examples/crowdfunding-esdt/interaction/devnet.snippets.sh @@ -1,19 +1,25 @@ -ALICE="${USERS}/alice.pem" +ALICE="./interaction/alice.pem" +PROJECT="${PWD}" +PROXY=https://devnet-gateway.multiversx.com +CHAINID=D + BOB="${USERS}/bob.pem" ADDRESS=$(mxpy data load --key=address-devnet) DEPLOY_TRANSACTION=$(mxpy data load --key=deployTransaction-devnet) -DEPLOY_GAS="80000000" +DEPLOY_GAS="25000000" TARGET=10 -DEADLINE_UNIX_TIMESTAMP=1609452000 # Fri Jan 01 2021 00:00:00 GMT+0200 (Eastern European Standard Time) + +DEADLINE_UNIX_TIMESTAMP=$(date -d '2100-05-12 00:00:01' +"%s") EGLD_TOKEN_ID=0x45474c44 # "EGLD" deploy() { mxpy --verbose contract deploy --project=${PROJECT} --recall-nonce --pem=${ALICE} \ --gas-limit=${DEPLOY_GAS} \ --arguments ${TARGET} ${DEADLINE_UNIX_TIMESTAMP} ${EGLD_TOKEN_ID} \ - --outfile="deploy-devnet.interaction.json" --send || return + --proxy=${PROXY} --chain=${CHAINID} --send + --outfile="deploy-devnet.interaction.json" || return TRANSACTION=$(mxpy data parse --file="deploy-devnet.interaction.json" --expression="data['emittedTransactionHash']") ADDRESS=$(mxpy data parse --file="deploy-devnet.interaction.json" --expression="data['contractAddress']") diff --git a/contracts/examples/crowdfunding-esdt/meta/Cargo.toml b/contracts/examples/crowdfunding-esdt/meta/Cargo.toml index 14c9a50ff6..b34332c58b 100644 --- a/contracts/examples/crowdfunding-esdt/meta/Cargo.toml +++ b/contracts/examples/crowdfunding-esdt/meta/Cargo.toml @@ -9,5 +9,5 @@ publish = false path = ".." [dependencies.multiversx-sc-meta] -version = "0.39.7" +version = "0.41.3" path = "../../../../framework/meta" diff --git a/contracts/examples/crowdfunding-esdt/tests/crowdfunding_esdt_scenario_go_test.rs b/contracts/examples/crowdfunding-esdt/tests/crowdfunding_esdt_scenario_go_test.rs index d70974096e..4b89f05c27 100644 --- a/contracts/examples/crowdfunding-esdt/tests/crowdfunding_esdt_scenario_go_test.rs +++ b/contracts/examples/crowdfunding-esdt/tests/crowdfunding_esdt_scenario_go_test.rs @@ -1,3 +1,23 @@ +#[test] +fn generated_fund_go() { + multiversx_sc_scenario::run_go("scenarios/_generated_fund.scen.json"); +} + +#[test] +fn generated_init_go() { + multiversx_sc_scenario::run_go("scenarios/_generated_init.scen.json"); +} + +#[test] +fn generated_query_status_go() { + multiversx_sc_scenario::run_go("scenarios/_generated_query_status.scen.json"); +} + +#[test] +fn generated_sc_err_go() { + multiversx_sc_scenario::run_go("scenarios/_generated_sc_err.scen.json"); +} + #[test] fn crowdfunding_claim_failed_go() { multiversx_sc_scenario::run_go("scenarios/crowdfunding-claim-failed.scen.json"); diff --git a/contracts/examples/crowdfunding-esdt/tests/crowdfunding_esdt_scenario_rs_test.rs b/contracts/examples/crowdfunding-esdt/tests/crowdfunding_esdt_scenario_rs_test.rs index d67a1f31fc..a6dc21113b 100644 --- a/contracts/examples/crowdfunding-esdt/tests/crowdfunding_esdt_scenario_rs_test.rs +++ b/contracts/examples/crowdfunding-esdt/tests/crowdfunding_esdt_scenario_rs_test.rs @@ -11,6 +11,26 @@ fn world() -> ScenarioWorld { blockchain } +#[test] +fn generated_fund_rs() { + multiversx_sc_scenario::run_rs("scenarios/_generated_fund.scen.json", world()); +} + +#[test] +fn generated_init_rs() { + multiversx_sc_scenario::run_rs("scenarios/_generated_init.scen.json", world()); +} + +#[test] +fn generated_query_status_rs() { + multiversx_sc_scenario::run_rs("scenarios/_generated_query_status.scen.json", world()); +} + +#[test] +fn generated_sc_err_rs() { + multiversx_sc_scenario::run_rs("scenarios/_generated_sc_err.scen.json", world()); +} + #[test] fn crowdfunding_claim_failed_rs() { multiversx_sc_scenario::run_rs("scenarios/crowdfunding-claim-failed.scen.json", world()); diff --git a/contracts/examples/crowdfunding-esdt/wasm/Cargo.lock b/contracts/examples/crowdfunding-esdt/wasm/Cargo.lock index ee6d079dbe..f644d3244f 100644 --- a/contracts/examples/crowdfunding-esdt/wasm/Cargo.lock +++ b/contracts/examples/crowdfunding-esdt/wasm/Cargo.lock @@ -8,16 +8,16 @@ version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "once_cell", "version_check", ] [[package]] name = "arrayvec" -version = "0.7.2" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" +checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" [[package]] name = "autocfg" @@ -31,12 +31,6 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" -[[package]] -name = "cfg-if" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" - [[package]] name = "cfg-if" version = "1.0.0" @@ -85,21 +79,9 @@ version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ebdb29d2ea9ed0083cd8cece49bbd968021bd99b0849edb4a9a7ee0fdf6a4e0" -[[package]] -name = "libc" -version = "0.2.140" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99227334921fae1a979cf0bfdfcc6b3e5ce376ef57e16fb6fb3ea2ed6095f80c" - -[[package]] -name = "memory_units" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8452105ba047068f40ff7093dd1d9da90898e63dd61736462e9cdda6a90ad3c3" - [[package]] name = "multiversx-sc" -version = "0.39.7" +version = "0.41.3" dependencies = [ "bitflags", "hashbrown", @@ -111,7 +93,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.17.1" +version = "0.17.2" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -119,7 +101,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.17.1" +version = "0.17.2" dependencies = [ "hex", "proc-macro2", @@ -129,7 +111,7 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.39.7" +version = "0.41.3" dependencies = [ "hex", "proc-macro2", @@ -140,10 +122,9 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.39.7" +version = "0.41.3" dependencies = [ "multiversx-sc", - "wee_alloc", ] [[package]] @@ -166,24 +147,24 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.17.1" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" +checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" [[package]] name = "proc-macro2" -version = "1.0.52" +version = "1.0.63" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d0e1ae9e836cc3beddd63db0df682593d7e2d3d891ae8c9083d2113e1744224" +checksum = "7b368fba921b0dce7e60f5e04ec15e565b3303972b42bcfde1d0713b881959eb" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.26" +version = "1.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4424af4bf778aae2051a77b60283332f386554255d722233d09fbfc7e30da2fc" +checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488" dependencies = [ "proc-macro2", ] @@ -217,46 +198,12 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.8" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4" +checksum = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0" [[package]] name = "version_check" version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" - -[[package]] -name = "wee_alloc" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbb3b5a6b2bb17cb6ad44a2e68a43e8d2722c997da10e928665c72ec6c0a0b8e" -dependencies = [ - "cfg-if 0.1.10", - "libc", - "memory_units", - "winapi", -] - -[[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-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" diff --git a/contracts/examples/crowdfunding-esdt/wasm/Cargo.toml b/contracts/examples/crowdfunding-esdt/wasm/Cargo.toml index b22d3ee6f8..db7721ab2a 100644 --- a/contracts/examples/crowdfunding-esdt/wasm/Cargo.toml +++ b/contracts/examples/crowdfunding-esdt/wasm/Cargo.toml @@ -19,7 +19,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.39.7" +version = "0.41.3" path = "../../../../framework/wasm-adapter" [workspace] diff --git a/contracts/examples/crowdfunding-esdt/wasm/src/lib.rs b/contracts/examples/crowdfunding-esdt/wasm/src/lib.rs index 953bd29fb6..9b54846c8b 100644 --- a/contracts/examples/crowdfunding-esdt/wasm/src/lib.rs +++ b/contracts/examples/crowdfunding-esdt/wasm/src/lib.rs @@ -10,7 +10,7 @@ // Total number of exported functions: 10 #![no_std] -#![feature(alloc_error_handler, lang_items)] +#![feature(lang_items)] multiversx_sc_wasm_adapter::allocator!(); multiversx_sc_wasm_adapter::panic_handler!(); diff --git a/contracts/examples/crypto-bubbles/Cargo.toml b/contracts/examples/crypto-bubbles/Cargo.toml index 23f89f8a3d..036c0683a9 100644 --- a/contracts/examples/crypto-bubbles/Cargo.toml +++ b/contracts/examples/crypto-bubbles/Cargo.toml @@ -9,9 +9,9 @@ publish = false path = "src/crypto_bubbles.rs" [dependencies.multiversx-sc] -version = "0.39.7" +version = "0.41.3" path = "../../../framework/base" [dev-dependencies.multiversx-sc-scenario] -version = "0.39.7" +version = "0.41.3" path = "../../../framework/scenario" diff --git a/contracts/examples/crypto-bubbles/meta/Cargo.toml b/contracts/examples/crypto-bubbles/meta/Cargo.toml index f793f25e34..e1ec906ffc 100644 --- a/contracts/examples/crypto-bubbles/meta/Cargo.toml +++ b/contracts/examples/crypto-bubbles/meta/Cargo.toml @@ -9,5 +9,5 @@ publish = false path = ".." [dependencies.multiversx-sc-meta] -version = "0.39.7" +version = "0.41.3" path = "../../../../framework/meta" diff --git a/contracts/examples/crypto-bubbles/src/crypto_bubbles.rs b/contracts/examples/crypto-bubbles/src/crypto_bubbles.rs index b5325ac83e..75af47f65c 100644 --- a/contracts/examples/crypto-bubbles/src/crypto_bubbles.rs +++ b/contracts/examples/crypto-bubbles/src/crypto_bubbles.rs @@ -16,7 +16,7 @@ pub trait CryptoBubbles { let payment = self.call_value().egld_value(); let caller = self.blockchain().get_caller(); self.player_balance(&caller) - .update(|balance| *balance += &payment); + .update(|balance| *balance += &*payment); self.top_up_event(&caller, &payment); } diff --git a/contracts/examples/crypto-bubbles/tests/crypto_bubbles_scenario_go_test.rs b/contracts/examples/crypto-bubbles/tests/crypto_bubbles_scenario_go_test.rs index bd58115026..e36dc3e515 100644 --- a/contracts/examples/crypto-bubbles/tests/crypto_bubbles_scenario_go_test.rs +++ b/contracts/examples/crypto-bubbles/tests/crypto_bubbles_scenario_go_test.rs @@ -1,5 +1,5 @@ #[test] -fn balanceof_go() { +fn balance_of_go() { multiversx_sc_scenario::run_go("scenarios/balanceOf.scen.json"); } @@ -14,32 +14,32 @@ fn exceptions_go() { } #[test] -fn joingame_go() { +fn join_game_go() { multiversx_sc_scenario::run_go("scenarios/joinGame.scen.json"); } #[test] -fn rewardandsendtowallet_go() { +fn reward_and_send_to_wallet_go() { multiversx_sc_scenario::run_go("scenarios/rewardAndSendToWallet.scen.json"); } #[test] -fn rewardwinner_go() { +fn reward_winner_go() { multiversx_sc_scenario::run_go("scenarios/rewardWinner.scen.json"); } #[test] -fn rewardwinner_last_go() { +fn reward_winner_last_go() { multiversx_sc_scenario::run_go("scenarios/rewardWinner_Last.scen.json"); } #[test] -fn topup_ok_go() { +fn top_up_ok_go() { multiversx_sc_scenario::run_go("scenarios/topUp_ok.scen.json"); } #[test] -fn topup_withdraw_go() { +fn top_up_withdraw_go() { multiversx_sc_scenario::run_go("scenarios/topUp_withdraw.scen.json"); } @@ -49,6 +49,6 @@ fn withdraw_ok_go() { } #[test] -fn withdraw_toomuch_go() { +fn withdraw_too_much_go() { multiversx_sc_scenario::run_go("scenarios/withdraw_TooMuch.scen.json"); } diff --git a/contracts/examples/crypto-bubbles/tests/crypto_bubbles_scenario_rs_test.rs b/contracts/examples/crypto-bubbles/tests/crypto_bubbles_scenario_rs_test.rs index e6127e6629..d8d6081917 100644 --- a/contracts/examples/crypto-bubbles/tests/crypto_bubbles_scenario_rs_test.rs +++ b/contracts/examples/crypto-bubbles/tests/crypto_bubbles_scenario_rs_test.rs @@ -12,7 +12,7 @@ fn world() -> ScenarioWorld { } #[test] -fn balanceof_rs() { +fn balance_of_rs() { multiversx_sc_scenario::run_rs("scenarios/balanceOf.scen.json", world()); } @@ -27,32 +27,32 @@ fn exceptions_rs() { } #[test] -fn joingame_rs() { +fn join_game_rs() { multiversx_sc_scenario::run_rs("scenarios/joinGame.scen.json", world()); } #[test] -fn rewardandsendtowallet_rs() { +fn reward_and_send_to_wallet_rs() { multiversx_sc_scenario::run_rs("scenarios/rewardAndSendToWallet.scen.json", world()); } #[test] -fn rewardwinner_rs() { +fn reward_winner_rs() { multiversx_sc_scenario::run_rs("scenarios/rewardWinner.scen.json", world()); } #[test] -fn rewardwinner_last_rs() { +fn reward_winner_last_rs() { multiversx_sc_scenario::run_rs("scenarios/rewardWinner_Last.scen.json", world()); } #[test] -fn topup_ok_rs() { +fn top_up_ok_rs() { multiversx_sc_scenario::run_rs("scenarios/topUp_ok.scen.json", world()); } #[test] -fn topup_withdraw_rs() { +fn top_up_withdraw_rs() { multiversx_sc_scenario::run_rs("scenarios/topUp_withdraw.scen.json", world()); } @@ -62,6 +62,6 @@ fn withdraw_ok_rs() { } #[test] -fn withdraw_toomuch_rs() { +fn withdraw_too_much_rs() { multiversx_sc_scenario::run_rs("scenarios/withdraw_TooMuch.scen.json", world()); } diff --git a/contracts/examples/crypto-bubbles/wasm/Cargo.lock b/contracts/examples/crypto-bubbles/wasm/Cargo.lock index 732f99085b..151def4527 100755 --- a/contracts/examples/crypto-bubbles/wasm/Cargo.lock +++ b/contracts/examples/crypto-bubbles/wasm/Cargo.lock @@ -8,16 +8,16 @@ version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "once_cell", "version_check", ] [[package]] name = "arrayvec" -version = "0.7.2" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" +checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" [[package]] name = "autocfg" @@ -31,12 +31,6 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" -[[package]] -name = "cfg-if" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" - [[package]] name = "cfg-if" version = "1.0.0" @@ -85,21 +79,9 @@ version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ebdb29d2ea9ed0083cd8cece49bbd968021bd99b0849edb4a9a7ee0fdf6a4e0" -[[package]] -name = "libc" -version = "0.2.140" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99227334921fae1a979cf0bfdfcc6b3e5ce376ef57e16fb6fb3ea2ed6095f80c" - -[[package]] -name = "memory_units" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8452105ba047068f40ff7093dd1d9da90898e63dd61736462e9cdda6a90ad3c3" - [[package]] name = "multiversx-sc" -version = "0.39.7" +version = "0.41.3" dependencies = [ "bitflags", "hashbrown", @@ -111,7 +93,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.17.1" +version = "0.17.2" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -119,7 +101,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.17.1" +version = "0.17.2" dependencies = [ "hex", "proc-macro2", @@ -129,7 +111,7 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.39.7" +version = "0.41.3" dependencies = [ "hex", "proc-macro2", @@ -140,10 +122,9 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.39.7" +version = "0.41.3" dependencies = [ "multiversx-sc", - "wee_alloc", ] [[package]] @@ -166,24 +147,24 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.17.1" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" +checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" [[package]] name = "proc-macro2" -version = "1.0.52" +version = "1.0.63" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d0e1ae9e836cc3beddd63db0df682593d7e2d3d891ae8c9083d2113e1744224" +checksum = "7b368fba921b0dce7e60f5e04ec15e565b3303972b42bcfde1d0713b881959eb" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.26" +version = "1.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4424af4bf778aae2051a77b60283332f386554255d722233d09fbfc7e30da2fc" +checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488" dependencies = [ "proc-macro2", ] @@ -217,46 +198,12 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.8" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4" +checksum = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0" [[package]] name = "version_check" version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" - -[[package]] -name = "wee_alloc" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbb3b5a6b2bb17cb6ad44a2e68a43e8d2722c997da10e928665c72ec6c0a0b8e" -dependencies = [ - "cfg-if 0.1.10", - "libc", - "memory_units", - "winapi", -] - -[[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-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" diff --git a/contracts/examples/crypto-bubbles/wasm/Cargo.toml b/contracts/examples/crypto-bubbles/wasm/Cargo.toml index 9268290559..43d35766e9 100644 --- a/contracts/examples/crypto-bubbles/wasm/Cargo.toml +++ b/contracts/examples/crypto-bubbles/wasm/Cargo.toml @@ -19,7 +19,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.39.7" +version = "0.41.3" path = "../../../../framework/wasm-adapter" [workspace] diff --git a/contracts/examples/crypto-bubbles/wasm/src/lib.rs b/contracts/examples/crypto-bubbles/wasm/src/lib.rs index 6dadb765f0..382e0bee9c 100644 --- a/contracts/examples/crypto-bubbles/wasm/src/lib.rs +++ b/contracts/examples/crypto-bubbles/wasm/src/lib.rs @@ -10,7 +10,7 @@ // Total number of exported functions: 8 #![no_std] -#![feature(alloc_error_handler, lang_items)] +#![feature(lang_items)] multiversx_sc_wasm_adapter::allocator!(); multiversx_sc_wasm_adapter::panic_handler!(); diff --git a/contracts/examples/crypto-kitties/common/kitty/Cargo.toml b/contracts/examples/crypto-kitties/common/kitty/Cargo.toml index 1242a451a8..672dd04b23 100644 --- a/contracts/examples/crypto-kitties/common/kitty/Cargo.toml +++ b/contracts/examples/crypto-kitties/common/kitty/Cargo.toml @@ -9,7 +9,7 @@ publish = false path = "src/lib.rs" [dependencies.multiversx-sc] -version = "0.39.7" +version = "0.41.3" path = "../../../../../framework/base" [dependencies.random] diff --git a/contracts/examples/crypto-kitties/common/random/Cargo.toml b/contracts/examples/crypto-kitties/common/random/Cargo.toml index 3fcac90b36..125887ad12 100644 --- a/contracts/examples/crypto-kitties/common/random/Cargo.toml +++ b/contracts/examples/crypto-kitties/common/random/Cargo.toml @@ -8,5 +8,5 @@ edition = "2021" path = "src/lib.rs" [dependencies.multiversx-sc] -version = "0.39.7" +version = "0.41.3" path = "../../../../../framework/base" diff --git a/contracts/examples/crypto-kitties/kitty-auction/Cargo.toml b/contracts/examples/crypto-kitties/kitty-auction/Cargo.toml index a6a961c152..3cfc5c438f 100644 --- a/contracts/examples/crypto-kitties/kitty-auction/Cargo.toml +++ b/contracts/examples/crypto-kitties/kitty-auction/Cargo.toml @@ -17,9 +17,9 @@ version = "0.0.0" path = "../kitty-ownership" [dependencies.multiversx-sc] -version = "0.39.7" +version = "0.41.3" path = "../../../../framework/base" [dev-dependencies.multiversx-sc-scenario] -version = "0.39.7" +version = "0.41.3" path = "../../../../framework/scenario" diff --git a/contracts/examples/crypto-kitties/kitty-auction/meta/Cargo.toml b/contracts/examples/crypto-kitties/kitty-auction/meta/Cargo.toml index d33d46e6ec..68a02561f1 100644 --- a/contracts/examples/crypto-kitties/kitty-auction/meta/Cargo.toml +++ b/contracts/examples/crypto-kitties/kitty-auction/meta/Cargo.toml @@ -8,5 +8,5 @@ publish = false path = ".." [dependencies.multiversx-sc-meta] -version = "0.39.7" +version = "0.41.3" path = "../../../../../framework/meta" diff --git a/contracts/examples/crypto-kitties/kitty-auction/src/lib.rs b/contracts/examples/crypto-kitties/kitty-auction/src/lib.rs index a61838992a..b371268418 100644 --- a/contracts/examples/crypto-kitties/kitty-auction/src/lib.rs +++ b/contracts/examples/crypto-kitties/kitty-auction/src/lib.rs @@ -169,15 +169,15 @@ pub trait KittyAuction { "auction ended already!" ); require!( - payment >= auction.starting_price, + *payment >= auction.starting_price, "bid amount must be higher than or equal to starting price!" ); require!( - payment > auction.current_bid, + *payment > auction.current_bid, "bid amount must be higher than current winning bid!" ); require!( - payment <= auction.ending_price, + *payment <= auction.ending_price, "bid amount must be less than or equal to ending price!" ); @@ -188,7 +188,7 @@ pub trait KittyAuction { } // update auction bid and winner - auction.current_bid = payment; + auction.current_bid = payment.clone_value(); auction.current_winner = caller; self.auction(kitty_id).set(auction); } diff --git a/contracts/examples/crypto-kitties/kitty-auction/wasm/Cargo.lock b/contracts/examples/crypto-kitties/kitty-auction/wasm/Cargo.lock index 73fdbac6e9..6ea34f90ad 100755 --- a/contracts/examples/crypto-kitties/kitty-auction/wasm/Cargo.lock +++ b/contracts/examples/crypto-kitties/kitty-auction/wasm/Cargo.lock @@ -8,16 +8,16 @@ version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "once_cell", "version_check", ] [[package]] name = "arrayvec" -version = "0.7.2" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" +checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" [[package]] name = "autocfg" @@ -31,12 +31,6 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" -[[package]] -name = "cfg-if" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" - [[package]] name = "cfg-if" version = "1.0.0" @@ -114,21 +108,9 @@ dependencies = [ "random", ] -[[package]] -name = "libc" -version = "0.2.140" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99227334921fae1a979cf0bfdfcc6b3e5ce376ef57e16fb6fb3ea2ed6095f80c" - -[[package]] -name = "memory_units" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8452105ba047068f40ff7093dd1d9da90898e63dd61736462e9cdda6a90ad3c3" - [[package]] name = "multiversx-sc" -version = "0.39.7" +version = "0.41.3" dependencies = [ "bitflags", "hashbrown", @@ -140,7 +122,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.17.1" +version = "0.17.2" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -148,7 +130,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.17.1" +version = "0.17.2" dependencies = [ "hex", "proc-macro2", @@ -158,7 +140,7 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.39.7" +version = "0.41.3" dependencies = [ "hex", "proc-macro2", @@ -169,10 +151,9 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.39.7" +version = "0.41.3" dependencies = [ "multiversx-sc", - "wee_alloc", ] [[package]] @@ -195,24 +176,24 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.17.1" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" +checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" [[package]] name = "proc-macro2" -version = "1.0.52" +version = "1.0.63" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d0e1ae9e836cc3beddd63db0df682593d7e2d3d891ae8c9083d2113e1744224" +checksum = "7b368fba921b0dce7e60f5e04ec15e565b3303972b42bcfde1d0713b881959eb" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.26" +version = "1.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4424af4bf778aae2051a77b60283332f386554255d722233d09fbfc7e30da2fc" +checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488" dependencies = [ "proc-macro2", ] @@ -253,46 +234,12 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.8" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4" +checksum = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0" [[package]] name = "version_check" version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" - -[[package]] -name = "wee_alloc" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbb3b5a6b2bb17cb6ad44a2e68a43e8d2722c997da10e928665c72ec6c0a0b8e" -dependencies = [ - "cfg-if 0.1.10", - "libc", - "memory_units", - "winapi", -] - -[[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-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" diff --git a/contracts/examples/crypto-kitties/kitty-auction/wasm/Cargo.toml b/contracts/examples/crypto-kitties/kitty-auction/wasm/Cargo.toml index 69c37188db..431cb6344a 100644 --- a/contracts/examples/crypto-kitties/kitty-auction/wasm/Cargo.toml +++ b/contracts/examples/crypto-kitties/kitty-auction/wasm/Cargo.toml @@ -21,5 +21,5 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.39.7" +version = "0.41.3" path = "../../../../../framework/wasm-adapter" diff --git a/contracts/examples/crypto-kitties/kitty-auction/wasm/src/lib.rs b/contracts/examples/crypto-kitties/kitty-auction/wasm/src/lib.rs index 077f3588e3..1ca93e9d8e 100644 --- a/contracts/examples/crypto-kitties/kitty-auction/wasm/src/lib.rs +++ b/contracts/examples/crypto-kitties/kitty-auction/wasm/src/lib.rs @@ -10,7 +10,7 @@ // Total number of exported functions: 11 #![no_std] -#![feature(alloc_error_handler, lang_items)] +#![feature(lang_items)] multiversx_sc_wasm_adapter::allocator!(); multiversx_sc_wasm_adapter::panic_handler!(); diff --git a/contracts/examples/crypto-kitties/kitty-genetic-alg/Cargo.toml b/contracts/examples/crypto-kitties/kitty-genetic-alg/Cargo.toml index 6abd457d0a..8756ffff1d 100644 --- a/contracts/examples/crypto-kitties/kitty-genetic-alg/Cargo.toml +++ b/contracts/examples/crypto-kitties/kitty-genetic-alg/Cargo.toml @@ -18,9 +18,9 @@ version = "0.0.0" path = "../common/random" [dependencies.multiversx-sc] -version = "0.39.7" +version = "0.41.3" path = "../../../../framework/base" [dev-dependencies.multiversx-sc-scenario] -version = "0.39.7" +version = "0.41.3" path = "../../../../framework/scenario" diff --git a/contracts/examples/crypto-kitties/kitty-genetic-alg/meta/Cargo.toml b/contracts/examples/crypto-kitties/kitty-genetic-alg/meta/Cargo.toml index ebfdce9f33..376fc604ea 100644 --- a/contracts/examples/crypto-kitties/kitty-genetic-alg/meta/Cargo.toml +++ b/contracts/examples/crypto-kitties/kitty-genetic-alg/meta/Cargo.toml @@ -8,5 +8,5 @@ publish = false path = ".." [dependencies.multiversx-sc-meta] -version = "0.39.7" +version = "0.41.3" path = "../../../../../framework/meta" diff --git a/contracts/examples/crypto-kitties/kitty-genetic-alg/wasm/Cargo.lock b/contracts/examples/crypto-kitties/kitty-genetic-alg/wasm/Cargo.lock index d6c7ac2b6d..c43de4999a 100755 --- a/contracts/examples/crypto-kitties/kitty-genetic-alg/wasm/Cargo.lock +++ b/contracts/examples/crypto-kitties/kitty-genetic-alg/wasm/Cargo.lock @@ -8,16 +8,16 @@ version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "once_cell", "version_check", ] [[package]] name = "arrayvec" -version = "0.7.2" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" +checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" [[package]] name = "autocfg" @@ -31,12 +31,6 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" -[[package]] -name = "cfg-if" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" - [[package]] name = "cfg-if" version = "1.0.0" @@ -95,21 +89,9 @@ dependencies = [ "multiversx-sc-wasm-adapter", ] -[[package]] -name = "libc" -version = "0.2.140" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99227334921fae1a979cf0bfdfcc6b3e5ce376ef57e16fb6fb3ea2ed6095f80c" - -[[package]] -name = "memory_units" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8452105ba047068f40ff7093dd1d9da90898e63dd61736462e9cdda6a90ad3c3" - [[package]] name = "multiversx-sc" -version = "0.39.7" +version = "0.41.3" dependencies = [ "bitflags", "hashbrown", @@ -121,7 +103,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.17.1" +version = "0.17.2" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -129,7 +111,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.17.1" +version = "0.17.2" dependencies = [ "hex", "proc-macro2", @@ -139,7 +121,7 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.39.7" +version = "0.41.3" dependencies = [ "hex", "proc-macro2", @@ -150,10 +132,9 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.39.7" +version = "0.41.3" dependencies = [ "multiversx-sc", - "wee_alloc", ] [[package]] @@ -176,24 +157,24 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.17.1" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" +checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" [[package]] name = "proc-macro2" -version = "1.0.52" +version = "1.0.63" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d0e1ae9e836cc3beddd63db0df682593d7e2d3d891ae8c9083d2113e1744224" +checksum = "7b368fba921b0dce7e60f5e04ec15e565b3303972b42bcfde1d0713b881959eb" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.26" +version = "1.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4424af4bf778aae2051a77b60283332f386554255d722233d09fbfc7e30da2fc" +checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488" dependencies = [ "proc-macro2", ] @@ -234,46 +215,12 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.8" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4" +checksum = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0" [[package]] name = "version_check" version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" - -[[package]] -name = "wee_alloc" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbb3b5a6b2bb17cb6ad44a2e68a43e8d2722c997da10e928665c72ec6c0a0b8e" -dependencies = [ - "cfg-if 0.1.10", - "libc", - "memory_units", - "winapi", -] - -[[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-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" diff --git a/contracts/examples/crypto-kitties/kitty-genetic-alg/wasm/Cargo.toml b/contracts/examples/crypto-kitties/kitty-genetic-alg/wasm/Cargo.toml index c477a9438e..460a9f8379 100644 --- a/contracts/examples/crypto-kitties/kitty-genetic-alg/wasm/Cargo.toml +++ b/contracts/examples/crypto-kitties/kitty-genetic-alg/wasm/Cargo.toml @@ -21,5 +21,5 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.39.7" +version = "0.41.3" path = "../../../../../framework/wasm-adapter" diff --git a/contracts/examples/crypto-kitties/kitty-genetic-alg/wasm/src/lib.rs b/contracts/examples/crypto-kitties/kitty-genetic-alg/wasm/src/lib.rs index 6dfd73d1a9..0babb284c2 100644 --- a/contracts/examples/crypto-kitties/kitty-genetic-alg/wasm/src/lib.rs +++ b/contracts/examples/crypto-kitties/kitty-genetic-alg/wasm/src/lib.rs @@ -10,7 +10,7 @@ // Total number of exported functions: 3 #![no_std] -#![feature(alloc_error_handler, lang_items)] +#![feature(lang_items)] multiversx_sc_wasm_adapter::allocator!(); multiversx_sc_wasm_adapter::panic_handler!(); diff --git a/contracts/examples/crypto-kitties/kitty-ownership/Cargo.toml b/contracts/examples/crypto-kitties/kitty-ownership/Cargo.toml index 655c926f2f..5aab687092 100644 --- a/contracts/examples/crypto-kitties/kitty-ownership/Cargo.toml +++ b/contracts/examples/crypto-kitties/kitty-ownership/Cargo.toml @@ -21,9 +21,9 @@ version = "0.0.0" path = "../kitty-genetic-alg" [dependencies.multiversx-sc] -version = "0.39.7" +version = "0.41.3" path = "../../../../framework/base" [dev-dependencies.multiversx-sc-scenario] -version = "0.39.7" +version = "0.41.3" path = "../../../../framework/scenario" diff --git a/contracts/examples/crypto-kitties/kitty-ownership/meta/Cargo.toml b/contracts/examples/crypto-kitties/kitty-ownership/meta/Cargo.toml index d5e53bc83d..58c88f530d 100644 --- a/contracts/examples/crypto-kitties/kitty-ownership/meta/Cargo.toml +++ b/contracts/examples/crypto-kitties/kitty-ownership/meta/Cargo.toml @@ -8,5 +8,5 @@ publish = false path = ".." [dependencies.multiversx-sc-meta] -version = "0.39.7" +version = "0.41.3" path = "../../../../../framework/meta" diff --git a/contracts/examples/crypto-kitties/kitty-ownership/src/lib.rs b/contracts/examples/crypto-kitties/kitty-ownership/src/lib.rs index 0df64ed030..d0b4d7073a 100644 --- a/contracts/examples/crypto-kitties/kitty-ownership/src/lib.rs +++ b/contracts/examples/crypto-kitties/kitty-ownership/src/lib.rs @@ -289,7 +289,7 @@ pub trait KittyOwnership { let auto_birth_fee = self.birth_fee().get(); let caller = self.blockchain().get_caller(); - require!(payment == auto_birth_fee, "Wrong fee!"); + require!(*payment == auto_birth_fee, "Wrong fee!"); require!( caller == self.kitty_owner(matron_id).get(), "Only the owner of the matron can call this function!" diff --git a/contracts/examples/crypto-kitties/kitty-ownership/wasm/Cargo.lock b/contracts/examples/crypto-kitties/kitty-ownership/wasm/Cargo.lock index cca8e8c420..b034b41abc 100755 --- a/contracts/examples/crypto-kitties/kitty-ownership/wasm/Cargo.lock +++ b/contracts/examples/crypto-kitties/kitty-ownership/wasm/Cargo.lock @@ -8,16 +8,16 @@ version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "once_cell", "version_check", ] [[package]] name = "arrayvec" -version = "0.7.2" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" +checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" [[package]] name = "autocfg" @@ -31,12 +31,6 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" -[[package]] -name = "cfg-if" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" - [[package]] name = "cfg-if" version = "1.0.0" @@ -105,21 +99,9 @@ dependencies = [ "multiversx-sc-wasm-adapter", ] -[[package]] -name = "libc" -version = "0.2.140" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99227334921fae1a979cf0bfdfcc6b3e5ce376ef57e16fb6fb3ea2ed6095f80c" - -[[package]] -name = "memory_units" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8452105ba047068f40ff7093dd1d9da90898e63dd61736462e9cdda6a90ad3c3" - [[package]] name = "multiversx-sc" -version = "0.39.7" +version = "0.41.3" dependencies = [ "bitflags", "hashbrown", @@ -131,7 +113,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.17.1" +version = "0.17.2" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -139,7 +121,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.17.1" +version = "0.17.2" dependencies = [ "hex", "proc-macro2", @@ -149,7 +131,7 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.39.7" +version = "0.41.3" dependencies = [ "hex", "proc-macro2", @@ -160,10 +142,9 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.39.7" +version = "0.41.3" dependencies = [ "multiversx-sc", - "wee_alloc", ] [[package]] @@ -186,24 +167,24 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.17.1" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" +checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" [[package]] name = "proc-macro2" -version = "1.0.52" +version = "1.0.63" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d0e1ae9e836cc3beddd63db0df682593d7e2d3d891ae8c9083d2113e1744224" +checksum = "7b368fba921b0dce7e60f5e04ec15e565b3303972b42bcfde1d0713b881959eb" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.26" +version = "1.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4424af4bf778aae2051a77b60283332f386554255d722233d09fbfc7e30da2fc" +checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488" dependencies = [ "proc-macro2", ] @@ -244,46 +225,12 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.8" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4" +checksum = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0" [[package]] name = "version_check" version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" - -[[package]] -name = "wee_alloc" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbb3b5a6b2bb17cb6ad44a2e68a43e8d2722c997da10e928665c72ec6c0a0b8e" -dependencies = [ - "cfg-if 0.1.10", - "libc", - "memory_units", - "winapi", -] - -[[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-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" diff --git a/contracts/examples/crypto-kitties/kitty-ownership/wasm/Cargo.toml b/contracts/examples/crypto-kitties/kitty-ownership/wasm/Cargo.toml index a640218c3a..d05267bd27 100644 --- a/contracts/examples/crypto-kitties/kitty-ownership/wasm/Cargo.toml +++ b/contracts/examples/crypto-kitties/kitty-ownership/wasm/Cargo.toml @@ -21,5 +21,5 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.39.7" +version = "0.41.3" path = "../../../../../framework/wasm-adapter" diff --git a/contracts/examples/crypto-kitties/kitty-ownership/wasm/src/lib.rs b/contracts/examples/crypto-kitties/kitty-ownership/wasm/src/lib.rs index 2496860ad0..62b7ddb308 100644 --- a/contracts/examples/crypto-kitties/kitty-ownership/wasm/src/lib.rs +++ b/contracts/examples/crypto-kitties/kitty-ownership/wasm/src/lib.rs @@ -10,7 +10,7 @@ // Total number of exported functions: 23 #![no_std] -#![feature(alloc_error_handler, lang_items)] +#![feature(lang_items)] multiversx_sc_wasm_adapter::allocator!(); multiversx_sc_wasm_adapter::panic_handler!(); diff --git a/contracts/examples/crypto-zombies/Cargo.toml b/contracts/examples/crypto-zombies/Cargo.toml index bace3834a4..66953af5a4 100644 --- a/contracts/examples/crypto-zombies/Cargo.toml +++ b/contracts/examples/crypto-zombies/Cargo.toml @@ -9,9 +9,9 @@ publish = false path = "src/lib.rs" [dependencies.multiversx-sc] -version = "0.39.4" +version = "0.41.3" path = "../../../framework/base" [dev-dependencies.multiversx-sc-scenario] -version = "0.39.4" +version = "0.41.3" path = "../../../framework/scenario" diff --git a/contracts/examples/crypto-zombies/meta/Cargo.toml b/contracts/examples/crypto-zombies/meta/Cargo.toml index 00e79eadbd..4af5c2be82 100644 --- a/contracts/examples/crypto-zombies/meta/Cargo.toml +++ b/contracts/examples/crypto-zombies/meta/Cargo.toml @@ -8,5 +8,5 @@ publish = false path = ".." [dependencies.multiversx-sc-meta] -version = "0.39.4" +version = "0.41.3" path = "../../../../framework/meta" diff --git a/contracts/examples/crypto-zombies/src/zombie_helper.rs b/contracts/examples/crypto-zombies/src/zombie_helper.rs index 3f9206c47d..20d1263bf3 100644 --- a/contracts/examples/crypto-zombies/src/zombie_helper.rs +++ b/contracts/examples/crypto-zombies/src/zombie_helper.rs @@ -21,7 +21,7 @@ pub trait ZombieHelper: storage::Storage { fn level_up(&self, zombie_id: usize) { let payment_amount = self.call_value().egld_value(); let fee = self.level_up_fee().get(); - require!(payment_amount == fee, "Payment must be must be 0.001 EGLD"); + require!(*payment_amount == fee, "Payment must be must be 0.001 EGLD"); self.zombies(&zombie_id) .update(|my_zombie| my_zombie.level += 1); } diff --git a/contracts/examples/crypto-zombies/wasm/Cargo.lock b/contracts/examples/crypto-zombies/wasm/Cargo.lock index 095feca0b8..abbe6437be 100755 --- a/contracts/examples/crypto-zombies/wasm/Cargo.lock +++ b/contracts/examples/crypto-zombies/wasm/Cargo.lock @@ -8,16 +8,16 @@ version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "once_cell", "version_check", ] [[package]] name = "arrayvec" -version = "0.7.2" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" +checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" [[package]] name = "autocfg" @@ -31,12 +31,6 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" -[[package]] -name = "cfg-if" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" - [[package]] name = "cfg-if" version = "1.0.0" @@ -85,21 +79,9 @@ version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ebdb29d2ea9ed0083cd8cece49bbd968021bd99b0849edb4a9a7ee0fdf6a4e0" -[[package]] -name = "libc" -version = "0.2.140" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99227334921fae1a979cf0bfdfcc6b3e5ce376ef57e16fb6fb3ea2ed6095f80c" - -[[package]] -name = "memory_units" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8452105ba047068f40ff7093dd1d9da90898e63dd61736462e9cdda6a90ad3c3" - [[package]] name = "multiversx-sc" -version = "0.39.7" +version = "0.41.3" dependencies = [ "bitflags", "hashbrown", @@ -111,7 +93,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.17.1" +version = "0.17.2" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -119,7 +101,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.17.1" +version = "0.17.2" dependencies = [ "hex", "proc-macro2", @@ -129,7 +111,7 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.39.7" +version = "0.41.3" dependencies = [ "hex", "proc-macro2", @@ -140,10 +122,9 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.39.7" +version = "0.41.3" dependencies = [ "multiversx-sc", - "wee_alloc", ] [[package]] @@ -166,24 +147,24 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.17.1" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" +checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" [[package]] name = "proc-macro2" -version = "1.0.52" +version = "1.0.63" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d0e1ae9e836cc3beddd63db0df682593d7e2d3d891ae8c9083d2113e1744224" +checksum = "7b368fba921b0dce7e60f5e04ec15e565b3303972b42bcfde1d0713b881959eb" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.26" +version = "1.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4424af4bf778aae2051a77b60283332f386554255d722233d09fbfc7e30da2fc" +checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488" dependencies = [ "proc-macro2", ] @@ -217,46 +198,12 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.8" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4" +checksum = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0" [[package]] name = "version_check" version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" - -[[package]] -name = "wee_alloc" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbb3b5a6b2bb17cb6ad44a2e68a43e8d2722c997da10e928665c72ec6c0a0b8e" -dependencies = [ - "cfg-if 0.1.10", - "libc", - "memory_units", - "winapi", -] - -[[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-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" diff --git a/contracts/examples/crypto-zombies/wasm/Cargo.toml b/contracts/examples/crypto-zombies/wasm/Cargo.toml index e084edb078..9947846ab7 100644 --- a/contracts/examples/crypto-zombies/wasm/Cargo.toml +++ b/contracts/examples/crypto-zombies/wasm/Cargo.toml @@ -19,7 +19,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.39.4" +version = "0.41.3" path = "../../../../framework/wasm-adapter" [workspace] diff --git a/contracts/examples/crypto-zombies/wasm/src/lib.rs b/contracts/examples/crypto-zombies/wasm/src/lib.rs index 531bf78d2f..b874fece2b 100644 --- a/contracts/examples/crypto-zombies/wasm/src/lib.rs +++ b/contracts/examples/crypto-zombies/wasm/src/lib.rs @@ -10,7 +10,7 @@ // Total number of exported functions: 19 #![no_std] -#![feature(alloc_error_handler, lang_items)] +#![feature(lang_items)] multiversx_sc_wasm_adapter::allocator!(); multiversx_sc_wasm_adapter::panic_handler!(); diff --git a/contracts/examples/digital-cash/Cargo.toml b/contracts/examples/digital-cash/Cargo.toml index cdf0cf2a4e..3fa284f121 100644 --- a/contracts/examples/digital-cash/Cargo.toml +++ b/contracts/examples/digital-cash/Cargo.toml @@ -9,9 +9,9 @@ publish = false path = "src/digital_cash.rs" [dependencies.multiversx-sc] -version = "0.39.7" +version = "0.41.3" path = "../../../framework/base" [dev-dependencies.multiversx-sc-scenario] -version = "0.39.7" +version = "0.41.3" path = "../../../framework/scenario" diff --git a/contracts/examples/digital-cash/README.md b/contracts/examples/digital-cash/README.md new file mode 100644 index 0000000000..a3856cc84c --- /dev/null +++ b/contracts/examples/digital-cash/README.md @@ -0,0 +1,29 @@ +# Digital Cash Contract + +The basic idea of MultiversX Digital Cash is that ONE link can hold information (ESDT tokens, EGLD) on chain, this link can be sent from one person to another, there is no need to hold any wallet to receive, consume and send it forward to another person. + +# Usage + +## Covering up payment fees & funding + +The contract allows funding any number of tokens in 1 call within a address under a valability if the fee cost was covered. + +In order to fund one should first call `deposit_fees` depositing the fee funds as `eGLD` within the contract. Only after, if the fees cover the transfer of the certain number of tokens, it is possible to deposit the funds, making them available for claiming or forwarding. + +`fund` after making sure everything is ok on the fee aspect will set up the `deposit` storage increasing the number of tokens to transfer by the number of tokens paid to the endpoint and set the expiration date by the number of rounds specified within the `valability` parameter. + +The fees are unique per address and only cover one instance of transfer, either if it is a `claim` or a `forward`, per number of tokens transfered. Only by making one of these actions will consume the fee funds following to to refund the rest of the fees to the depositor. + +## Claiming funds + +Claiming the funds require the signature parameter to be valid. Next the round will be checked to ve greater than the `expiration_round` within the deposit. Once these requirement was fulfilled the funds will be sent to the caller and the remaining of the fee funds sent back to the depositor. + +## Withdrawing funds + +If the valability of a deposit has expired it can no longer be claimed. Anyone on this point can call `withdraw` making the funds go back to the depositor together with the unused fee funds. + +## Forwarding funds + +Funds cam be forwarded to another address using the signature, but the forwarded address requires to have the fees covered. This actions will also consume the funds from the initial address. + +After the forward in case of a withdraw the funds will go to the `depositor_address` set within the `forwarded_address` deposit storage. diff --git a/contracts/examples/digital-cash/meta/Cargo.toml b/contracts/examples/digital-cash/meta/Cargo.toml index 908a844ef6..dc87f7b5cb 100644 --- a/contracts/examples/digital-cash/meta/Cargo.toml +++ b/contracts/examples/digital-cash/meta/Cargo.toml @@ -8,5 +8,5 @@ publish = false path = ".." [dependencies.multiversx-sc-meta] -version = "0.39.7" +version = "0.41.3" path = "../../../../framework/meta" diff --git a/contracts/examples/digital-cash/scenarios/claim-egld.scen.json b/contracts/examples/digital-cash/scenarios/claim-egld.scen.json index 91302e63f4..8945970816 100644 --- a/contracts/examples/digital-cash/scenarios/claim-egld.scen.json +++ b/contracts/examples/digital-cash/scenarios/claim-egld.scen.json @@ -3,103 +3,18 @@ "steps": [ { "step": "externalSteps", - "path": "set-accounts.scen.json" - }, - { - "step": "setState", - "comment": "set block", - "currentBlockInfo": { - "blockTimestamp": "511", - "blockNonce": "5", - "blockRound": "555", - "blockEpoch": "1" - } - }, - { - "step": "setState", - "accounts": { - "0xebfd923cd251f857ed7639e87143ac83f12f423827abc4a0cdde0119c3e37915": { - "nonce": "0", - "balance": "1,000,000" - } - } - }, - { - "step": "scCall", - "id": "fund", - "tx": { - "from": "address:acc1", - "to": "sc:the_digital_cash_contract", - "egldValue": "5", - "function": "fund", - "arguments": [ - "0xdfc7efc43c36853ab160e783ad65766043734e30ce46188a448c44e2bbab9d91", - "u64:605" - ], - "gasLimit": "500,000,000", - "gasPrice": "0" - }, - "expect": { - "out": [], - "status": "0", - "message": "", - "logs": "*", - "gas": "*", - "refund": "*" - } - }, - { - "step": "checkState", - "accounts": { - "sc:the_digital_cash_contract": { - "nonce": "0", - "balance": "5", - "storage": { - "str:deposit|0xdfc7efc43c36853ab160e783ad65766043734e30ce46188a448c44e2bbab9d91": { - "1-amount": "biguint:5", - "2-depositor_address": "address:acc1", - "3-expiration_round": "u64:655", - "4-token_name": "nested:str:EGLD", - "5-nonce": "u64:0" - } - }, - "code": "file:../output/digital-cash.wasm" - }, - "address:acc1": { - "nonce": "1", - "balance": "999,995", - "storage": {} - }, - "address:acc2": { - "nonce": "0", - "balance": "1,000,000", - "esdt": { - "str:CASHTOKEN-123456": "100" - }, - "storage": {} - }, - "0xebfd923cd251f857ed7639e87143ac83f12f423827abc4a0cdde0119c3e37915": { - "nonce": "0", - "balance": "1,000,000", - "storage": {} - }, - "address:digital_cash_owner_address": { - "nonce": "1", - "balance": "0", - "storage": {} - } - } + "path": "fund-egld-and-esdt.scen.json" }, { "step": "scCall", "id": "claim2", "tx": { - "from": "0xebfd923cd251f857ed7639e87143ac83f12f423827abc4a0cdde0119c3e37915", + "from": "address:acc2", "to": "sc:the_digital_cash_contract", "function": "claim", "arguments": [ - "0xdfc7efc43c36853ab160e783ad65766043734e30ce46188a448c44e2bbab9d81", - "0xf638006f25df5fc9e24ab265e90326b5edf29189608384ff3a3d47104ae7debb3a0867698680f0b78a73833ceb395932427956bc2427669e8c48ef01e7c37705" + "0xd0474a3a065d3f0c0a62ae680ef6435e48eb482899d2ae30ff7a3a4b0ef19c60", + "0x443c75ceadb9ec42acff7e1b92e0305182279446c1d6c0502959484c147a0430d3f96f0b988e646f6736d5bf8e4a843d8ba7730d6fa7e60f0ef3edd225ce630f" ], "gasLimit": "500,000,000", "gasPrice": "0" @@ -127,12 +42,12 @@ "step": "scCall", "id": "claim3", "tx": { - "from": "0xebfd923cd251f857ed7639e87143ac83f12f423827abc4a0cdde0119c3e37915", + "from": "address:acc2", "to": "sc:the_digital_cash_contract", "function": "claim", "arguments": [ - "0xdfc7efc43c36853ab160e783ad65766043734e30ce46188a448c44e2bbab9d91", - "0xf638006f25df5fc9e24ab265e90326b5edf29189608384ff3a3d47104ae7debb3a0867698680f0b78a73833ceb395932427956bc2427669e8c48ef01e7c37705" + "0xdb474a3a065d3f0c0a62ae680ef6435e48eb482899d2ae30ff7a3a4b0ef19c60", + "0x443c75ceadb9ec42acff7e1b92e0305182279446c1d6c0502959484c147a0430d3f96f0b988e646f6736d5bf8e4a843d8ba7730d6fa7e60f0ef3edd225ce630f" ], "gasLimit": "500,000,000", "gasPrice": "0" @@ -151,8 +66,8 @@ "comment": "set block", "currentBlockInfo": { "blockTimestamp": "511", - "blockNonce": "12", - "blockRound": "12", + "blockNonce": "8", + "blockRound": "8", "blockEpoch": "1" } }, @@ -160,12 +75,12 @@ "step": "scCall", "id": "claim4", "tx": { - "from": "0xebfd923cd251f857ed7639e87143ac83f12f423827abc4a0cdde0119c3e37915", + "from": "address:acc2", "to": "sc:the_digital_cash_contract", "function": "claim", "arguments": [ - "0xdfc7efc43c36853ab160e783ad65766043734e30ce46188a448c44e2bbab9d91", - "0xf638006f25ddf5fc9e24ab265e90326b5edf29189608384ff3a3d47104ae7debb3a0867698680f0b78a73833ceb395932427956bc2427669e8c48ef01e7c37705" + "0xdb474a3a065d3f0c0a62ae680ef6435e48eb482899d2ae30ff7a3a4b0ef19c60", + "0x12bb9e58dad361e9dadd0af1021ce53f9ca12b6580f5b3ab4f9c321ee055a38bcdcf35924eb46aef7a80b22387ded0b837734ac8a57e19ea12c33ef808f996c00" ], "gasLimit": "500,000,000", "gasPrice": "0" @@ -183,12 +98,12 @@ "step": "scCall", "id": "claim5", "tx": { - "from": "0xebfd923cd251f857ed7639e87143ac83f12f423827abc4a0cdde0119c3e37915", + "from": "address:acc2", "to": "sc:the_digital_cash_contract", "function": "claim", "arguments": [ - "0xdfc7efc43c36853ab160e783ad65766043734e30ce46188a448c44e2bbab9d91", - "0xf638006f25df5fc9e24ab265e90326b5edf29189608384ff3a3d47104ae7debb3a0867698680f0b78a73833ceb395932427956bc2427669e8c48ef01e7c37705" + "0xdb474a3a065d3f0c0a62ae680ef6435e48eb482899d2ae30ff7a3a4b0ef19c60", + "0x443c75ceadb9ec42acff7e1b92e0305182279446c1d6c0502959484c147a0430d3f96f0b988e646f6736d5bf8e4a843d8ba7730d6fa7e60f0ef3edd225ce630f" ], "gasLimit": "500,000,000", "gasPrice": "0" @@ -207,26 +122,62 @@ "accounts": { "sc:the_digital_cash_contract": { "nonce": "0", - "balance": "0", - "storage": {}, + "balance": "2,010", + "esdt": { + "str:CASHTOKEN-123456": "50", + "str:CASHTOKEN-112233": "50", + "str:CASHTOKEN-445566": "50", + "str:CASHTOKEN-778899": "50" + }, + "storage": { + "str:deposit|0x487bd4010b50c24a02018345fe5171edf4182e6294325382c75ef4c4409f01bd": { + "0-depositor_address": "address:acc2", + "1-esdt_funds": "u32:1|nested:str:CASHTOKEN-123456|u64:0|biguint:50", + "2-egld_funds": "biguint:0", + "3-valability": "u64:100", + "4-expiration_round": "u64:16", + "5-fees": { + "0-num_token_to_transfer": "u32:1", + "1-value": "biguint:1,000" + } + }, + "str:deposit|0x885532043a061e0c779e4064b85193f72cffd22c5bcc208c209128e60f21bf0d": { + "0-depositor_address": "address:acc3", + "1-esdt_funds": "u32:3|nested:str:CASHTOKEN-112233|u64:0|biguint:50|nested:str:CASHTOKEN-445566|u64:0|biguint:50|nested:str:CASHTOKEN-778899|u64:0|biguint:50", + "2-egld_funds": "biguint:0", + "3-valability": "u64:100", + "4-expiration_round": "u64:16", + "5-fees": { + "0-num_token_to_transfer": "u32:3", + "1-value": "biguint:1,000" + } + }, + "str:fee": "10", + "str:collected_fees": "10" + }, "code": "file:../output/digital-cash.wasm" }, "address:acc1": { - "nonce": "1", - "balance": "999,995", + "nonce": "3", + "balance": "998,990", "storage": {} }, "address:acc2": { - "nonce": "0", + "nonce": "6", "balance": "1,000,000", "esdt": { - "str:CASHTOKEN-123456": "100" + "str:CASHTOKEN-123456": "50" }, "storage": {} }, - "0xebfd923cd251f857ed7639e87143ac83f12f423827abc4a0cdde0119c3e37915": { - "nonce": "4", - "balance": "1,000,005", + "address:acc3": { + "nonce": "3", + "balance": "999,000", + "esdt": { + "str:CASHTOKEN-112233": "50", + "str:CASHTOKEN-445566": "50", + "str:CASHTOKEN-778899": "50" + }, "storage": {} }, "address:digital_cash_owner_address": { diff --git a/contracts/examples/digital-cash/scenarios/claim-esdt.scen.json b/contracts/examples/digital-cash/scenarios/claim-esdt.scen.json index bc19710f78..7ced2430e0 100644 --- a/contracts/examples/digital-cash/scenarios/claim-esdt.scen.json +++ b/contracts/examples/digital-cash/scenarios/claim-esdt.scen.json @@ -3,111 +3,18 @@ "steps": [ { "step": "externalSteps", - "path": "set-accounts.scen.json" - }, - { - "step": "setState", - "comment": "set block", - "currentBlockInfo": { - "blockTimestamp": "511", - "blockNonce": "5", - "blockRound": "555", - "blockEpoch": "1" - } - }, - { - "step": "setState", - "accounts": { - "0xebfd923cd251f857ed7639e87143ac83f12f423827abc4a0cdde0119c3e37915": { - "nonce": "0", - "balance": "1,000,000" - } - } - }, - { - "step": "scCall", - "id": "fund", - "tx": { - "from": "address:acc2", - "to": "sc:the_digital_cash_contract", - "esdtValue": [ - { - "tokenIdentifier": "str:CASHTOKEN-123456", - "value": "50" - } - ], - "function": "fund", - "arguments": [ - "0xdfc7efc43c36853ab160e783ad65766043734e30ce46188a448c44e2bbab9d91", - "u64:605" - ], - "gasLimit": "500,000,000", - "gasPrice": "0" - }, - "expect": { - "out": [], - "status": "0", - "message": "", - "logs": "*", - "gas": "*", - "refund": "*" - } - }, - { - "step": "checkState", - "accounts": { - "sc:the_digital_cash_contract": { - "nonce": "0", - "balance": "0", - "esdt": { - "str:CASHTOKEN-123456": "50" - }, - "storage": { - "str:deposit|0xdfc7efc43c36853ab160e783ad65766043734e30ce46188a448c44e2bbab9d91": { - "1-amount": "biguint:50", - "2-depositor_address": "address:acc2", - "3-expiration_round": "u64:655", - "4-token_name": "nested:str:CASHTOKEN-123456", - "5-nonce": "u64:0" - } - }, - "code": "file:../output/digital-cash.wasm" - }, - "address:acc1": { - "nonce": "0", - "balance": "1,000,000", - "storage": {} - }, - "address:acc2": { - "nonce": "1", - "balance": "1,000,000", - "esdt": { - "str:CASHTOKEN-123456": "50" - }, - "storage": {} - }, - "0xebfd923cd251f857ed7639e87143ac83f12f423827abc4a0cdde0119c3e37915": { - "nonce": "0", - "balance": "1,000,000", - "storage": {} - }, - "address:digital_cash_owner_address": { - "nonce": "1", - "balance": "0", - "storage": {} - } - } + "path": "fund-egld-and-esdt.scen.json" }, { "step": "scCall", "id": "claim2", "tx": { - "from": "0xebfd923cd251f857ed7639e87143ac83f12f423827abc4a0cdde0119c3e37915", + "from": "address:acc1", "to": "sc:the_digital_cash_contract", "function": "claim", "arguments": [ - "0xdfc7efc43c36853ab160e783ad65766043734e30ce46188a448c44e2bbab9d81", - "0xf638006f25df5fc9e24ab265e90326b5edf29189608384ff3a3d47104ae7debb3a0867698680f0b78a73833ceb395932427956bc2427669e8c48ef01e7c37705" + "0x287bd4010b50c24a02018345fe5171edf4182e6294325382c75ef4c4409f01bd", + "0xdd092ec3a8d971daede79da4e5c5c90d66af9f2209a6f6541affa00c46a72fc2596e4db1b1bb226ce76e50730733078ff74a79ff7d0d185054375e0989330600" ], "gasLimit": "500,000,000", "gasPrice": "0" @@ -135,12 +42,12 @@ "step": "scCall", "id": "claim3", "tx": { - "from": "0xebfd923cd251f857ed7639e87143ac83f12f423827abc4a0cdde0119c3e37915", + "from": "address:acc1", "to": "sc:the_digital_cash_contract", "function": "claim", "arguments": [ - "0xdfc7efc43c36853ab160e783ad65766043734e30ce46188a448c44e2bbab9d91", - "0xf638006f25df5fc9e24ab265e90326b5edf29189608384ff3a3d47104ae7debb3a0867698680f0b78a73833ceb395932427956bc2427669e8c48ef01e7c37705" + "0x487bd4010b50c24a02018345fe5171edf4182e6294325382c75ef4c4409f01bd", + "0xdd092ec3a8d971daede79da4e5c5c90d66af9f2209a6f6541affa00c46a72fc2596e4db1b1bb226ce76e50730733078ff74a79ff7d0d185054375e0989330600" ], "gasLimit": "500,000,000", "gasPrice": "0" @@ -159,8 +66,8 @@ "comment": "set block", "currentBlockInfo": { "blockTimestamp": "511", - "blockNonce": "12", - "blockRound": "12", + "blockNonce": "9", + "blockRound": "9", "blockEpoch": "1" } }, @@ -168,12 +75,12 @@ "step": "scCall", "id": "claim4", "tx": { - "from": "0xebfd923cd251f857ed7639e87143ac83f12f423827abc4a0cdde0119c3e37915", + "from": "address:acc1", "to": "sc:the_digital_cash_contract", "function": "claim", "arguments": [ - "0xdfc7efc43c36853ab160e783ad65766043734e30ce46188a448c44e2bbab9d91", - "0xf638006f25ddf5fc9e24ab265e90326b5edf29189608384ff3a3d47104ae7debb3a0867698680f0b78a73833ceb395932427956bc2427669e8c48ef01e7c37705" + "0x487bd4010b50c24a02018345fe5171edf4182e6294325382c75ef4c4409f01bd", + "0x1dd092ec3a8d971daede79da4e5c5c90d66af9f2209a6f6541affa00c46a72fc2596e4db1b1bb226ce76e50730733078ff74a79ff7d0d185054375e0989330600" ], "gasLimit": "500,000,000", "gasPrice": "0" @@ -191,12 +98,12 @@ "step": "scCall", "id": "claim5", "tx": { - "from": "0xebfd923cd251f857ed7639e87143ac83f12f423827abc4a0cdde0119c3e37915", + "from": "address:acc1", "to": "sc:the_digital_cash_contract", "function": "claim", "arguments": [ - "0xdfc7efc43c36853ab160e783ad65766043734e30ce46188a448c44e2bbab9d91", - "0xf638006f25df5fc9e24ab265e90326b5edf29189608384ff3a3d47104ae7debb3a0867698680f0b78a73833ceb395932427956bc2427669e8c48ef01e7c37705" + "0x487bd4010b50c24a02018345fe5171edf4182e6294325382c75ef4c4409f01bd", + "0xdd092ec3a8d971daede79da4e5c5c90d66af9f2209a6f6541affa00c46a72fc2596e4db1b1bb226ce76e50730733078ff74a79ff7d0d185054375e0989330600" ], "gasLimit": "500,000,000", "gasPrice": "0" @@ -215,28 +122,63 @@ "accounts": { "sc:the_digital_cash_contract": { "nonce": "0", - "balance": "0", - "storage": {}, + "balance": "3,010", + "esdt": { + "str:CASHTOKEN-112233": "50", + "str:CASHTOKEN-445566": "50", + "str:CASHTOKEN-778899": "50" + }, + "storage": { + "str:deposit|0xdb474a3a065d3f0c0a62ae680ef6435e48eb482899d2ae30ff7a3a4b0ef19c60": { + "0-depositor_address": "address:acc1", + "1-esdt_funds": "u32:0", + "2-egld_funds": "biguint:1,000", + "3-valability": "u64:60", + "4-expiration_round": "u64:10", + "5-fees": { + "0-num_token_to_transfer": "u32:1", + "1-value": "biguint:1,000" + } + }, + "str:deposit|0x885532043a061e0c779e4064b85193f72cffd22c5bcc208c209128e60f21bf0d": { + "0-depositor_address": "address:acc3", + "1-esdt_funds": "u32:3|nested:str:CASHTOKEN-112233|u64:0|biguint:50|nested:str:CASHTOKEN-445566|u64:0|biguint:50|nested:str:CASHTOKEN-778899|u64:0|biguint:50", + "2-egld_funds": "biguint:0", + "3-valability": "u64:100", + "4-expiration_round": "u64:16", + "5-fees": { + "0-num_token_to_transfer": "u32:3", + "1-value": "biguint:1,000" + } + }, + "str:fee": "10", + "str:collected_fees": "10" + }, "code": "file:../output/digital-cash.wasm" }, "address:acc1": { - "nonce": "0", - "balance": "1,000,000", + "nonce": "7", + "balance": "998,000", + "esdt": { + "str:CASHTOKEN-123456": "50" + }, "storage": {} }, "address:acc2": { - "nonce": "1", - "balance": "1,000,000", + "nonce": "2", + "balance": "999,990", "esdt": { "str:CASHTOKEN-123456": "50" }, "storage": {} }, - "0xebfd923cd251f857ed7639e87143ac83f12f423827abc4a0cdde0119c3e37915": { - "nonce": "4", - "balance": "1,000,000", + "address:acc3": { + "nonce": "3", + "balance": "999,000", "esdt": { - "str:CASHTOKEN-123456": "50" + "str:CASHTOKEN-112233": "50", + "str:CASHTOKEN-445566": "50", + "str:CASHTOKEN-778899": "50" }, "storage": {} }, diff --git a/contracts/examples/digital-cash/scenarios/claim-fees.scen.json b/contracts/examples/digital-cash/scenarios/claim-fees.scen.json new file mode 100644 index 0000000000..6256577609 --- /dev/null +++ b/contracts/examples/digital-cash/scenarios/claim-fees.scen.json @@ -0,0 +1,125 @@ +{ + "name": "claim-fees", + "steps": [ + { + "step": "externalSteps", + "path": "claim-egld.scen.json" + }, + { + "step": "scCall", + "id": "claim-fees-fail", + "tx": { + "from": "address:acc2", + "to": "sc:the_digital_cash_contract", + "function": "claim_fees", + "gasLimit": "500,000,000", + "gasPrice": "0" + }, + "expect": { + "out": [], + "status": "4", + "message": "str:Endpoint can only be called by owner", + "logs": "*", + "gas": "*", + "refund": "*" + } + }, + { + "step": "setState", + "comment": "set block", + "currentBlockInfo": { + "blockTimestamp": "511", + "blockNonce": "1555", + "blockRound": "1555", + "blockEpoch": "1" + } + }, + { + "step": "scCall", + "id": "claim-fees-ok", + "tx": { + "from": "address:digital_cash_owner_address", + "to": "sc:the_digital_cash_contract", + "function": "claim_fees", + "gasLimit": "500,000,000", + "gasPrice": "0" + }, + "expect": { + "out": [], + "status": "0", + "logs": "*", + "gas": "*", + "refund": "*" + } + }, + { + "step": "checkState", + "accounts": { + "sc:the_digital_cash_contract": { + "nonce": "0", + "balance": "2,000", + "esdt": { + "str:CASHTOKEN-123456": "50", + "str:CASHTOKEN-112233": "50", + "str:CASHTOKEN-445566": "50", + "str:CASHTOKEN-778899": "50" + }, + "storage": { + "str:deposit|0x487bd4010b50c24a02018345fe5171edf4182e6294325382c75ef4c4409f01bd": { + "0-depositor_address": "address:acc2", + "1-esdt_funds": "u32:1|nested:str:CASHTOKEN-123456|u64:0|biguint:50", + "2-egld_funds": "biguint:0", + "3-valability": "u64:100", + "4-expiration_round": "u64:16", + "5-fees": { + "0-num_token_to_transfer": "u32:1", + "1-value": "biguint:1,000" + } + }, + "str:deposit|0x885532043a061e0c779e4064b85193f72cffd22c5bcc208c209128e60f21bf0d": { + "0-depositor_address": "address:acc3", + "1-esdt_funds": "u32:3|nested:str:CASHTOKEN-112233|u64:0|biguint:50|nested:str:CASHTOKEN-445566|u64:0|biguint:50|nested:str:CASHTOKEN-778899|u64:0|biguint:50", + "2-egld_funds": "biguint:0", + "3-valability": "u64:100", + "4-expiration_round": "u64:16", + "5-fees": { + "0-num_token_to_transfer": "u32:3", + "1-value": "biguint:1,000" + } + }, + "str:fee": "10" + }, + "code": "file:../output/digital-cash.wasm" + }, + "address:acc1": { + "nonce": "3", + "balance": "998,990", + "storage": {} + }, + "address:acc2": { + "nonce": "7", + "balance": "1,000,000", + "esdt": { + "str:CASHTOKEN-123456": "50" + }, + "storage": {} + }, + "address:acc3": { + "nonce": "3", + "balance": "999,000", + "esdt": { + "str:CASHTOKEN-112233": "50", + "str:CASHTOKEN-445566": "50", + "str:CASHTOKEN-778899": "50" + }, + "storage": {} + }, + "address:digital_cash_owner_address": { + "nonce": "2", + "balance": "10", + "storage": {} + } + } + } + ] +} diff --git a/contracts/examples/digital-cash/scenarios/claim-multi-esdt.scen.json b/contracts/examples/digital-cash/scenarios/claim-multi-esdt.scen.json new file mode 100644 index 0000000000..d2701252eb --- /dev/null +++ b/contracts/examples/digital-cash/scenarios/claim-multi-esdt.scen.json @@ -0,0 +1,191 @@ +{ + "name": "claim-multi-esdt", + "steps": [ + { + "step": "externalSteps", + "path": "fund-egld-and-esdt.scen.json" + }, + { + "step": "scCall", + "id": "claim2", + "tx": { + "from": "address:acc2", + "to": "sc:the_digital_cash_contract", + "function": "claim", + "arguments": [ + "0x805532043a061e0c779e4064b85193f72cffd22c5bcc208c209128e60f21bf0d", + "0x1ac4f6d4d45836d97ffeda83a66aaea7631a3bb3d4063421ccb2b9de9485bdb4c9bd6e44e003f6a9c9eb74379467238204ff579471d203b1878c3f1530592a02" + ], + "gasLimit": "500,000,000", + "gasPrice": "0" + }, + "expect": { + "out": [], + "status": "4", + "message": "str:non-existent key", + "logs": "*", + "gas": "*", + "refund": "*" + } + }, + { + "step": "setState", + "comment": "set block", + "currentBlockInfo": { + "blockTimestamp": "511", + "blockNonce": "1555", + "blockRound": "1555", + "blockEpoch": "1" + } + }, + { + "step": "scCall", + "id": "claim3", + "tx": { + "from": "address:acc2", + "to": "sc:the_digital_cash_contract", + "function": "claim", + "arguments": [ + "0x885532043a061e0c779e4064b85193f72cffd22c5bcc208c209128e60f21bf0d", + "0x1ac4f6d4d45836d97ffeda83a66aaea7631a3bb3d4063421ccb2b9de9485bdb4c9bd6e44e003f6a9c9eb74379467238204ff579471d203b1878c3f1530592a02" + ], + "gasLimit": "500,000,000", + "gasPrice": "0" + }, + "expect": { + "out": [], + "status": "4", + "message": "str:deposit expired", + "logs": "*", + "gas": "*", + "refund": "*" + } + }, + { + "step": "setState", + "comment": "set block", + "currentBlockInfo": { + "blockTimestamp": "511", + "blockNonce": "9", + "blockRound": "9", + "blockEpoch": "1" + } + }, + { + "step": "scCall", + "id": "claim4", + "tx": { + "from": "address:acc2", + "to": "sc:the_digital_cash_contract", + "function": "claim", + "arguments": [ + "0x885532043a061e0c779e4064b85193f72cffd22c5bcc208c209128e60f21bf0d", + "0x11ac4f6d4d45836d97ffeda83a66aaea7631a3bb3d4063421ccb2b9de9485bdb4c9bd6e44e003f6a9c9eb74379467238204ff579471d203b1878c3f1530592a02" + ], + "gasLimit": "500,000,000", + "gasPrice": "0" + }, + "expect": { + "out": [], + "status": "4", + "message": "str:argument decode error (signature): bad array length", + "logs": "*", + "gas": "*", + "refund": "*" + } + }, + { + "step": "scCall", + "id": "claim5", + "tx": { + "from": "address:acc2", + "to": "sc:the_digital_cash_contract", + "function": "claim", + "arguments": [ + "0x885532043a061e0c779e4064b85193f72cffd22c5bcc208c209128e60f21bf0d", + "0x1ac4f6d4d45836d97ffeda83a66aaea7631a3bb3d4063421ccb2b9de9485bdb4c9bd6e44e003f6a9c9eb74379467238204ff579471d203b1878c3f1530592a02" + ], + "gasLimit": "500,000,000", + "gasPrice": "0" + }, + "expect": { + "out": [], + "status": "0", + "message": "", + "logs": "*", + "gas": "*", + "refund": "*" + } + }, + { + "step": "checkState", + "accounts": { + "sc:the_digital_cash_contract": { + "nonce": "0", + "balance": "3,030", + "esdt": { + "str:CASHTOKEN-123456": "50" + }, + "storage": { + "str:deposit|0xdb474a3a065d3f0c0a62ae680ef6435e48eb482899d2ae30ff7a3a4b0ef19c60": { + "0-depositor_address": "address:acc1", + "1-esdt_funds": "u32:0", + "2-egld_funds": "biguint:1,000", + "3-valability": "u64:60", + "4-expiration_round": "u64:10", + "5-fees": { + "0-num_token_to_transfer": "u32:1", + "1-value": "biguint:1,000" + } + }, + "str:deposit|0x487bd4010b50c24a02018345fe5171edf4182e6294325382c75ef4c4409f01bd": { + "0-depositor_address": "address:acc2", + "1-esdt_funds": "u32:1|nested:str:CASHTOKEN-123456|u64:0|biguint:50", + "2-egld_funds": "biguint:0", + "3-valability": "u64:100", + "4-expiration_round": "u64:16", + "5-fees": { + "0-num_token_to_transfer": "u32:1", + "1-value": "biguint:1,000" + } + }, + "str:fee": "10", + "str:collected_fees": "30" + }, + "code": "file:../output/digital-cash.wasm" + }, + "address:acc1": { + "nonce": "3", + "balance": "998,000", + "storage": {} + }, + "address:acc2": { + "nonce": "6", + "balance": "999,000", + "esdt": { + "str:CASHTOKEN-123456": "50", + "str:CASHTOKEN-112233": "50", + "str:CASHTOKEN-445566": "50", + "str:CASHTOKEN-778899": "50" + }, + "storage": {} + }, + "address:acc3": { + "nonce": "3", + "balance": "999,970", + "esdt": { + "str:CASHTOKEN-112233": "50", + "str:CASHTOKEN-445566": "50", + "str:CASHTOKEN-778899": "50" + }, + "storage": {} + }, + "address:digital_cash_owner_address": { + "nonce": "1", + "balance": "0", + "storage": {} + } + } + } + ] +} diff --git a/contracts/examples/digital-cash/scenarios/forward.scen.json b/contracts/examples/digital-cash/scenarios/forward.scen.json new file mode 100644 index 0000000000..faed1b6a0d --- /dev/null +++ b/contracts/examples/digital-cash/scenarios/forward.scen.json @@ -0,0 +1,206 @@ +{ + "name": "forward", + "steps": [ + { + "step": "externalSteps", + "path": "fund-egld-and-esdt.scen.json" + }, + { + "step": "scCall", + "id": "forward-fail", + "tx": { + "from": "address:acc2", + "to": "sc:the_digital_cash_contract", + "function": "forward", + "arguments": [ + "0xdb474a3a065d3f0c0a62ae680ef6435e48eb482899d2ae30ff7a3a4b0ef19c60", + "0xa40e72cdac3580e7203a4c2565c932f7691c35e624bcfd82718d7f559c88f440", + "0x443c75ceadb9ec42acff7e1b92e0305182279446c1d6c0502959484c147a0430d3f96f0b988e646f6736d5bf8e4a843d8ba7730d6fa7e60f0ef3edd225ce630f" + ], + "gasLimit": "500,000,000", + "gasPrice": "0" + }, + "expect": { + "out": [], + "status": "4", + "message": "str:cannot deposit funds without covering the fee cost first", + "logs": "*", + "gas": "*", + "refund": "*" + } + }, + { + "step": "scCall", + "id": "deposit-fees-2", + "tx": { + "from": "address:acc2", + "to": "sc:the_digital_cash_contract", + "egldValue": "1,000", + "function": "deposit_fees", + "arguments": [ + "0xa40e72cdac3580e7203a4c2565c932f7691c35e624bcfd82718d7f559c88f440" + ], + "gasLimit": "500,000,000", + "gasPrice": "0" + }, + "expect": { + "out": [], + "status": "0", + "message": "", + "logs": "*", + "gas": "*", + "refund": "*" + } + }, + { + "step": "scCall", + "id": "forward-ok", + "tx": { + "from": "address:acc2", + "to": "sc:the_digital_cash_contract", + "function": "forward", + "arguments": [ + "0xdb474a3a065d3f0c0a62ae680ef6435e48eb482899d2ae30ff7a3a4b0ef19c60", + "0xa40e72cdac3580e7203a4c2565c932f7691c35e624bcfd82718d7f559c88f440", + "0x443c75ceadb9ec42acff7e1b92e0305182279446c1d6c0502959484c147a0430d3f96f0b988e646f6736d5bf8e4a843d8ba7730d6fa7e60f0ef3edd225ce630f" + ], + "gasLimit": "500,000,000", + "gasPrice": "0" + }, + "expect": { + "out": [], + "status": "0", + "logs": "*", + "gas": "*", + "refund": "*" + } + }, + { + "step": "scCall", + "id": "deposit-fees-4", + "tx": { + "from": "address:acc2", + "to": "sc:the_digital_cash_contract", + "egldValue": "1,000", + "function": "deposit_fees", + "arguments": [ + "0x8dc17613990e9b7476401a36d112d1a4d31190dec21e7e9a3c933872a27613ee" + ], + "gasLimit": "500,000,000", + "gasPrice": "0" + }, + "expect": { + "out": [], + "status": "0", + "message": "", + "logs": "*", + "gas": "*", + "refund": "*" + } + }, + { + "step": "scCall", + "id": "forward-ok", + "tx": { + "from": "address:acc2", + "to": "sc:the_digital_cash_contract", + "function": "forward", + "arguments": [ + "0x885532043a061e0c779e4064b85193f72cffd22c5bcc208c209128e60f21bf0d", + "0x8dc17613990e9b7476401a36d112d1a4d31190dec21e7e9a3c933872a27613ee", + "0x1ac4f6d4d45836d97ffeda83a66aaea7631a3bb3d4063421ccb2b9de9485bdb4c9bd6e44e003f6a9c9eb74379467238204ff579471d203b1878c3f1530592a02" + ], + "gasLimit": "500,000,000", + "gasPrice": "0" + }, + "expect": { + "out": [], + "status": "0", + "logs": "*", + "gas": "*", + "refund": "*" + } + }, + { + "step": "checkState", + "accounts": { + "sc:the_digital_cash_contract": { + "nonce": "0", + "balance": "4,040", + "esdt": { + "str:CASHTOKEN-123456": "50", + "str:CASHTOKEN-112233": "50", + "str:CASHTOKEN-445566": "50", + "str:CASHTOKEN-778899": "50" + }, + "storage": { + "str:deposit|0xa40e72cdac3580e7203a4c2565c932f7691c35e624bcfd82718d7f559c88f440": { + "0-depositor_address": "address:acc2", + "1-esdt_funds": "u32:0", + "2-egld_funds": "biguint:1,000", + "3-valability": "u64:60", + "4-expiration_round": "u64:10", + "5-fees": { + "0-num_token_to_transfer": "u32:1", + "1-value": "biguint:1,000" + } + }, + "str:deposit|0x487bd4010b50c24a02018345fe5171edf4182e6294325382c75ef4c4409f01bd": { + "0-depositor_address": "address:acc2", + "1-esdt_funds": "u32:1|nested:str:CASHTOKEN-123456|u64:0|biguint:50", + "2-egld_funds": "biguint:0", + "3-valability": "u64:100", + "4-expiration_round": "u64:16", + "5-fees": { + "0-num_token_to_transfer": "u32:1", + "1-value": "biguint:1,000" + } + }, + "str:deposit|0x8dc17613990e9b7476401a36d112d1a4d31190dec21e7e9a3c933872a27613ee": { + "0-depositor_address": "address:acc2", + "1-esdt_funds": "u32:3|nested:str:CASHTOKEN-112233|u64:0|biguint:50|nested:str:CASHTOKEN-445566|u64:0|biguint:50|nested:str:CASHTOKEN-778899|u64:0|biguint:50", + "2-egld_funds": "biguint:0", + "3-valability": "u64:100", + "4-expiration_round": "u64:16", + "5-fees": { + "0-num_token_to_transfer": "u32:3", + "1-value": "biguint:1,000" + } + }, + "str:fee": "10", + "str:collected_fees": "40" + }, + "code": "file:../output/digital-cash.wasm" + }, + "address:acc1": { + "nonce": "3", + "balance": "998,990", + "storage": {} + }, + "address:acc2": { + "nonce": "7", + "balance": "997,000", + "esdt": { + "str:CASHTOKEN-123456": "50" + }, + "storage": {} + }, + "address:acc3": { + "nonce": "3", + "balance": "999,970", + "esdt": { + "str:CASHTOKEN-112233": "50", + "str:CASHTOKEN-445566": "50", + "str:CASHTOKEN-778899": "50" + }, + "storage": {} + }, + "address:digital_cash_owner_address": { + "nonce": "1", + "balance": "0", + "storage": {} + } + } + } + ] +} diff --git a/contracts/examples/digital-cash/scenarios/fund-egld-and-esdt.scen.json b/contracts/examples/digital-cash/scenarios/fund-egld-and-esdt.scen.json index 6e532cae7e..77f90d130d 100644 --- a/contracts/examples/digital-cash/scenarios/fund-egld-and-esdt.scen.json +++ b/contracts/examples/digital-cash/scenarios/fund-egld-and-esdt.scen.json @@ -7,19 +7,66 @@ }, { "step": "scCall", - "id": "fund", + "id": "fail-fund", "tx": { "from": "address:acc1", "to": "sc:the_digital_cash_contract", - "egldValue": "1,000,000", + "egldValue": "1,000", "function": "fund", "arguments": [ - "0x558fd9b0dd9fed3d3bed883d3b92907743362c56b9728392f84b261f1cc5ae0a", + "0xdb474a3a065d3f0c0a62ae680ef6435e48eb482899d2ae30ff7a3a4b0ef19c60", "u64:100" ], "gasLimit": "500,000,000", "gasPrice": "0" }, + "expect": { + "out": [], + "status": "4", + "message": "str:fees not covered", + "logs": "*", + "gas": "*", + "refund": "*" + } + }, + { + "step": "scCall", + "id": "deposit-fees-1", + "tx": { + "from": "address:acc1", + "to": "sc:the_digital_cash_contract", + "egldValue": "1,000", + "function": "deposit_fees", + "arguments": [ + "0xdb474a3a065d3f0c0a62ae680ef6435e48eb482899d2ae30ff7a3a4b0ef19c60" + ], + "gasLimit": "500,000,000", + "gasPrice": "0" + }, + "expect": { + "out": [], + "status": "0", + "message": "", + "logs": "*", + "gas": "*", + "refund": "*" + } + }, + { + "step": "scCall", + "id": "fund-1", + "tx": { + "from": "address:acc1", + "to": "sc:the_digital_cash_contract", + "egldValue": "1,000", + "function": "fund", + "arguments": [ + "0xdb474a3a065d3f0c0a62ae680ef6435e48eb482899d2ae30ff7a3a4b0ef19c60", + "u64:60" + ], + "gasLimit": "500,000,000", + "gasPrice": "0" + }, "expect": { "out": [], "status": "0", @@ -34,21 +81,26 @@ "accounts": { "sc:the_digital_cash_contract": { "nonce": "0", - "balance": "1,000,000", + "balance": "2,000", "storage": { - "str:deposit|0x558fd9b0dd9fed3d3bed883d3b92907743362c56b9728392f84b261f1cc5ae0a": { - "1-amount": "biguint:1,000,000", - "2-depositor_address": "address:acc1", - "3-expiration_round": "u64:16", - "4-token_name": "nested:str:EGLD", - "5-nonce": "u64:0" - } + "str:deposit|0xdb474a3a065d3f0c0a62ae680ef6435e48eb482899d2ae30ff7a3a4b0ef19c60": { + "0-depositor_address": "address:acc1", + "1-esdt_funds": "u32:0", + "2-egld_funds": "biguint:1,000", + "3-valability": "u64:60", + "4-expiration_round": "u64:10", + "5-fees": { + "0-num_token_to_transfer": "u32:1", + "1-value": "biguint:1,000" + } + }, + "str:fee": "10" }, "code": "file:../output/digital-cash.wasm" }, "address:acc1": { - "nonce": "1", - "balance": "0", + "nonce": "3", + "balance": "998000", "storage": {} }, "address:acc2": { @@ -59,6 +111,16 @@ }, "storage": {} }, + "address:acc3": { + "nonce": "0", + "balance": "1,000,000", + "esdt": { + "str:CASHTOKEN-112233": "100", + "str:CASHTOKEN-445566": "100", + "str:CASHTOKEN-778899": "100" + }, + "storage": {} + }, "address:digital_cash_owner_address": { "nonce": "1", "balance": "0", @@ -66,6 +128,29 @@ } } }, + { + "step": "scCall", + "id": "deposit-fees-2", + "tx": { + "from": "address:acc2", + "to": "sc:the_digital_cash_contract", + "egldValue": "1,000", + "function": "deposit_fees", + "arguments": [ + "0x487bd4010b50c24a02018345fe5171edf4182e6294325382c75ef4c4409f01bd" + ], + "gasLimit": "500,000,000", + "gasPrice": "0" + }, + "expect": { + "out": [], + "status": "0", + "message": "", + "logs": "*", + "gas": "*", + "refund": "*" + } + }, { "step": "scCall", "id": "fund-2", @@ -80,7 +165,7 @@ ], "function": "fund", "arguments": [ - "0xe868c2baab2a20b612f1351da5945c52c60f5321c6cde572149db90c9e8fbfc8", + "0x487bd4010b50c24a02018345fe5171edf4182e6294325382c75ef4c4409f01bd", "u64:100" ], "gasLimit": "100,000,000", @@ -99,41 +184,235 @@ "accounts": { "sc:the_digital_cash_contract": { "nonce": "0", - "balance": "1,000,000", + "balance": "3,000", "esdt": { - "''CASHTOKEN-123456": "50" + "str:CASHTOKEN-123456": "50" }, "storage": { - "str:deposit|0x558fd9b0dd9fed3d3bed883d3b92907743362c56b9728392f84b261f1cc5ae0a": { - "1-amount": "biguint:1,000,000", - "2-depositor_address": "address:acc1", - "3-expiration_round": "u64:16", - "4-token_name": "nested:str:EGLD", - "5-nonce": "u64:0" + "str:deposit|0xdb474a3a065d3f0c0a62ae680ef6435e48eb482899d2ae30ff7a3a4b0ef19c60": { + "0-depositor_address": "address:acc1", + "1-esdt_funds": "u32:0", + "2-egld_funds": "biguint:1,000", + "3-valability": "u64:60", + "4-expiration_round": "u64:10", + "5-fees": { + "0-num_token_to_transfer": "u32:1", + "1-value": "biguint:1,000" + } }, - "str:deposit|0xe868c2baab2a20b612f1351da5945c52c60f5321c6cde572149db90c9e8fbfc8": { - "1-amount": "biguint:50", - "2-depositor_address": "address:acc2", - "3-expiration_round": "u64:16", - "4-token_name": "nested:str:CASHTOKEN-123456", - "5-nonce": "u64:0" - } + "str:deposit|0x487bd4010b50c24a02018345fe5171edf4182e6294325382c75ef4c4409f01bd": { + "0-depositor_address": "address:acc2", + "1-esdt_funds": "u32:1|nested:str:CASHTOKEN-123456|u64:0|biguint:50", + "2-egld_funds": "biguint:0", + "3-valability": "u64:100", + "4-expiration_round": "u64:16", + "5-fees": { + "0-num_token_to_transfer": "u32:1", + "1-value": "biguint:1,000" + } + }, + "str:fee": "10" }, "code": "file:../output/digital-cash.wasm" }, "address:acc1": { + "nonce": "3", + "balance": "998,000", + "storage": {} + }, + "address:acc2": { + "nonce": "2", + "balance": "999,000", + "esdt": { + "str:CASHTOKEN-123456": "50" + }, + "storage": {} + }, + "address:acc3": { + "nonce": "0", + "balance": "1,000,000", + "esdt": { + "str:CASHTOKEN-112233": "100", + "str:CASHTOKEN-445566": "100", + "str:CASHTOKEN-778899": "100" + }, + "storage": {} + }, + "address:digital_cash_owner_address": { "nonce": "1", "balance": "0", "storage": {} + } + } + }, + { + "step": "scCall", + "id": "fund-fail-2", + "tx": { + "from": "address:acc3", + "to": "sc:the_digital_cash_contract", + "esdtValue": [ + { + "tokenIdentifier": "str:CASHTOKEN-112233", + "value": "50" + }, + { + "tokenIdentifier": "str:CASHTOKEN-445566", + "value": "50" + }, + { + "tokenIdentifier": "str:CASHTOKEN-778899", + "value": "50" + } + ], + "function": "fund", + "arguments": [ + "0x487bd4010b50c24a02018345fe5171edf4182e6294325382c75ef4c4409f01bd", + "u64:100" + ], + "gasLimit": "100,000,000", + "gasPrice": "0" + }, + "expect": { + "out": [], + "status": "4", + "message": "str:key already used", + "gas": "*", + "refund": "*" + } + }, + { + "step": "scCall", + "id": "deposit-fees-3", + "tx": { + "from": "address:acc3", + "to": "sc:the_digital_cash_contract", + "egldValue": "1,000", + "function": "deposit_fees", + "arguments": [ + "0x885532043a061e0c779e4064b85193f72cffd22c5bcc208c209128e60f21bf0d" + ], + "gasLimit": "500,000,000", + "gasPrice": "0" + }, + "expect": { + "out": [], + "status": "0", + "message": "", + "logs": "*", + "gas": "*", + "refund": "*" + } + }, + { + "step": "scCall", + "id": "fund-2", + "tx": { + "from": "address:acc3", + "to": "sc:the_digital_cash_contract", + "esdtValue": [ + { + "tokenIdentifier": "str:CASHTOKEN-112233", + "value": "50" + }, + { + "tokenIdentifier": "str:CASHTOKEN-445566", + "value": "50" + }, + { + "tokenIdentifier": "str:CASHTOKEN-778899", + "value": "50" + } + ], + "function": "fund", + "arguments": [ + "0x885532043a061e0c779e4064b85193f72cffd22c5bcc208c209128e60f21bf0d", + "u64:100" + ], + "gasLimit": "100,000,000", + "gasPrice": "0" + }, + "expect": { + "out": [], + "status": "", + "message": "", + "gas": "*", + "refund": "*" + } + }, + { + "step": "checkState", + "accounts": { + "sc:the_digital_cash_contract": { + "nonce": "0", + "balance": "4,000", + "esdt": { + "str:CASHTOKEN-123456": "50", + "str:CASHTOKEN-112233": "50", + "str:CASHTOKEN-445566": "50", + "str:CASHTOKEN-778899": "50" + }, + "storage": { + "str:deposit|0xdb474a3a065d3f0c0a62ae680ef6435e48eb482899d2ae30ff7a3a4b0ef19c60": { + "0-depositor_address": "address:acc1", + "1-esdt_funds": "u32:0", + "2-egld_funds": "biguint:1,000", + "3-valability": "u64:60", + "4-expiration_round": "u64:10", + "5-fees": { + "0-num_token_to_transfer": "u32:1", + "1-value": "biguint:1,000" + } + }, + "str:deposit|0x487bd4010b50c24a02018345fe5171edf4182e6294325382c75ef4c4409f01bd": { + "0-depositor_address": "address:acc2", + "1-esdt_funds": "u32:1|nested:str:CASHTOKEN-123456|u64:0|biguint:50", + "2-egld_funds": "biguint:0", + "3-valability": "u64:100", + "4-expiration_round": "u64:16", + "5-fees": { + "0-num_token_to_transfer": "u32:1", + "1-value": "biguint:1,000" + } + }, + "str:deposit|0x885532043a061e0c779e4064b85193f72cffd22c5bcc208c209128e60f21bf0d": { + "0-depositor_address": "address:acc3", + "1-esdt_funds": "u32:3|nested:str:CASHTOKEN-112233|u64:0|biguint:50|nested:str:CASHTOKEN-445566|u64:0|biguint:50|nested:str:CASHTOKEN-778899|u64:0|biguint:50", + "2-egld_funds": "biguint:0", + "3-valability": "u64:100", + "4-expiration_round": "u64:16", + "5-fees": { + "0-num_token_to_transfer": "u32:3", + "1-value": "biguint:1,000" + } + }, + "str:fee": "10" + }, + "code": "file:../output/digital-cash.wasm" + }, + "address:acc1": { + "nonce": "3", + "balance": "998,000", + "storage": {} }, "address:acc2": { - "nonce": "1", - "balance": "1,000,000", + "nonce": "2", + "balance": "999,000", "esdt": { "str:CASHTOKEN-123456": "50" }, "storage": {} }, + "address:acc3": { + "nonce": "3", + "balance": "999,000", + "esdt": { + "str:CASHTOKEN-112233": "50", + "str:CASHTOKEN-445566": "50", + "str:CASHTOKEN-778899": "50" + }, + "storage": {} + }, "address:digital_cash_owner_address": { "nonce": "1", "balance": "0", diff --git a/contracts/examples/digital-cash/scenarios/set-accounts.scen.json b/contracts/examples/digital-cash/scenarios/set-accounts.scen.json index ad67410199..0c742a688d 100644 --- a/contracts/examples/digital-cash/scenarios/set-accounts.scen.json +++ b/contracts/examples/digital-cash/scenarios/set-accounts.scen.json @@ -15,6 +15,15 @@ "str:CASHTOKEN-123456": "100" } }, + "address:acc3": { + "nonce": "0", + "balance": "1,000,000", + "esdt": { + "str:CASHTOKEN-112233": "100", + "str:CASHTOKEN-445566": "100", + "str:CASHTOKEN-778899": "100" + } + }, "address:digital_cash_owner_address": { "nonce": "0", "balance": "0" @@ -34,7 +43,9 @@ "tx": { "from": "address:digital_cash_owner_address", "contractCode": "file:../output/digital-cash.wasm", - "arguments": [], + "arguments": [ + "10" + ], "gasLimit": "5,000,000", "gasPrice": "0" }, @@ -44,6 +55,47 @@ "gas": "*", "refund": "*" } + }, + { + "step": "checkState", + "accounts": { + "sc:the_digital_cash_contract": { + "nonce": "0", + "balance": "0", + "storage": { + "str:fee": "10" + }, + "code": "file:../output/digital-cash.wasm" + }, + "address:acc1": { + "nonce": "0", + "balance": "1,000,000", + "storage": {} + }, + "address:acc2": { + "nonce": "0", + "balance": "1,000,000", + "esdt": { + "str:CASHTOKEN-123456": "100" + }, + "storage": {} + }, + "address:acc3": { + "nonce": "0", + "balance": "1,000,000", + "esdt": { + "str:CASHTOKEN-112233": "100", + "str:CASHTOKEN-445566": "100", + "str:CASHTOKEN-778899": "100" + }, + "storage": {} + }, + "address:digital_cash_owner_address": { + "nonce": "1", + "balance": "0", + "storage": {} + } + } } ] } diff --git a/contracts/examples/digital-cash/scenarios/withdraw-egld.scen.json b/contracts/examples/digital-cash/scenarios/withdraw-egld.scen.json index 33628dbcb8..09cc07d0ac 100644 --- a/contracts/examples/digital-cash/scenarios/withdraw-egld.scen.json +++ b/contracts/examples/digital-cash/scenarios/withdraw-egld.scen.json @@ -5,16 +5,6 @@ "step": "externalSteps", "path": "fund-egld-and-esdt.scen.json" }, - { - "step": "setState", - "comment": "set block", - "currentBlockInfo": { - "blockTimestamp": "511", - "blockNonce": "15", - "blockRound": "15", - "blockEpoch": "0" - } - }, { "step": "scCall", "id": "withdraw-esdt-1", @@ -23,7 +13,7 @@ "to": "sc:the_digital_cash_contract", "function": "withdraw", "arguments": [ - "0x558fd9b0dd9fed3d3bed883d3b92907743362c56b9728392f84b261f1cc5ae0a" + "0xdb474a3a065d3f0c0a62ae680ef6435e48eb482899d2ae30ff7a3a4b0ef19c60" ], "gasLimit": "500,000,000", "gasPrice": "0" @@ -42,41 +32,74 @@ "accounts": { "sc:the_digital_cash_contract": { "nonce": "0", - "balance": "1,000,000", + "balance": "4,000", "esdt": { - "str:CASHTOKEN-123456": "50" + "str:CASHTOKEN-123456": "50", + "str:CASHTOKEN-112233": "50", + "str:CASHTOKEN-445566": "50", + "str:CASHTOKEN-778899": "50" }, "storage": { - "str:deposit|0x558fd9b0dd9fed3d3bed883d3b92907743362c56b9728392f84b261f1cc5ae0a": { - "1-amount": "biguint:1,000,000", - "2-depositor_address": "address:acc1", - "3-expiration_round": "u64:16", - "4-token_name": "nested:str:EGLD", - "5-nonce": "u64:0" + "str:deposit|0xdb474a3a065d3f0c0a62ae680ef6435e48eb482899d2ae30ff7a3a4b0ef19c60": { + "0-depositor_address": "address:acc1", + "1-esdt_funds": "u32:0", + "2-egld_funds": "biguint:1,000", + "3-valability": "u64:60", + "4-expiration_round": "u64:10", + "5-fees": { + "0-num_token_to_transfer": "u32:1", + "1-value": "biguint:1,000" + } }, - "str:deposit|0xe868c2baab2a20b612f1351da5945c52c60f5321c6cde572149db90c9e8fbfc8": { - "1-amount": "biguint:50", - "2-depositor_address": "address:acc2", - "3-expiration_round": "u64:16", - "4-token_name": "nested:str:CASHTOKEN-123456", - "5-nonce": "u64:0" - } + "str:deposit|0x487bd4010b50c24a02018345fe5171edf4182e6294325382c75ef4c4409f01bd": { + "0-depositor_address": "address:acc2", + "1-esdt_funds": "u32:1|nested:str:CASHTOKEN-123456|u64:0|biguint:50", + "2-egld_funds": "biguint:0", + "3-valability": "u64:100", + "4-expiration_round": "u64:16", + "5-fees": { + "0-num_token_to_transfer": "u32:1", + "1-value": "biguint:1,000" + } + }, + "str:deposit|0x885532043a061e0c779e4064b85193f72cffd22c5bcc208c209128e60f21bf0d": { + "0-depositor_address": "address:acc3", + "1-esdt_funds": "u32:3|nested:str:CASHTOKEN-112233|u64:0|biguint:50|nested:str:CASHTOKEN-445566|u64:0|biguint:50|nested:str:CASHTOKEN-778899|u64:0|biguint:50", + "2-egld_funds": "biguint:0", + "3-valability": "u64:100", + "4-expiration_round": "u64:16", + "5-fees": { + "0-num_token_to_transfer": "u32:3", + "1-value": "biguint:1,000" + } + }, + "str:fee": "10" }, "code": "file:../output/digital-cash.wasm" }, "address:acc1": { - "nonce": "2", - "balance": "0", + "nonce": "4", + "balance": "998,000", "storage": {} }, "address:acc2": { - "nonce": "1", - "balance": "1,000,000", + "nonce": "2", + "balance": "999,000", "esdt": { "str:CASHTOKEN-123456": "50" }, "storage": {} }, + "address:acc3": { + "nonce": "3", + "balance": "999,000", + "esdt": { + "str:CASHTOKEN-112233": "50", + "str:CASHTOKEN-445566": "50", + "str:CASHTOKEN-778899": "50" + }, + "storage": {} + }, "address:digital_cash_owner_address": { "nonce": "1", "balance": "0", @@ -124,7 +147,7 @@ "to": "sc:the_digital_cash_contract", "function": "withdraw", "arguments": [ - "0x558fd9b0dd9fed3d3bed883d3b92907743362c56b9728392f84b261f1cc5ae0a" + "0xdb474a3a065d3f0c0a62ae680ef6435e48eb482899d2ae30ff7a3a4b0ef19c60" ], "gasLimit": "500,000,000", "gasPrice": "0" @@ -143,34 +166,63 @@ "accounts": { "sc:the_digital_cash_contract": { "nonce": "0", - "balance": "0", + "balance": "2,000", "esdt": { - "str:CASHTOKEN-123456": "50" + "str:CASHTOKEN-123456": "50", + "str:CASHTOKEN-112233": "50", + "str:CASHTOKEN-445566": "50", + "str:CASHTOKEN-778899": "50" }, "storage": { - "str:deposit|0xe868c2baab2a20b612f1351da5945c52c60f5321c6cde572149db90c9e8fbfc8": { - "1-amount": "biguint:50", - "2-depositor_address": "address:acc2", - "3-expiration_round": "u64:16", - "4-token_name": "nested:str:CASHTOKEN-123456", - "5-nonce": "u64:0" - } + "str:deposit|0x487bd4010b50c24a02018345fe5171edf4182e6294325382c75ef4c4409f01bd": { + "0-depositor_address": "address:acc2", + "1-esdt_funds": "u32:1|nested:str:CASHTOKEN-123456|u64:0|biguint:50", + "2-egld_funds": "biguint:0", + "3-valability": "u64:100", + "4-expiration_round": "u64:16", + "5-fees": { + "0-num_token_to_transfer": "u32:1", + "1-value": "biguint:1,000" + } + }, + "str:deposit|0x885532043a061e0c779e4064b85193f72cffd22c5bcc208c209128e60f21bf0d": { + "0-depositor_address": "address:acc3", + "1-esdt_funds": "u32:3|nested:str:CASHTOKEN-112233|u64:0|biguint:50|nested:str:CASHTOKEN-445566|u64:0|biguint:50|nested:str:CASHTOKEN-778899|u64:0|biguint:50", + "2-egld_funds": "biguint:0", + "3-valability": "u64:100", + "4-expiration_round": "u64:16", + "5-fees": { + "0-num_token_to_transfer": "u32:3", + "1-value": "biguint:1,000" + } + }, + "str:fee": "10" }, "code": "file:../output/digital-cash.wasm" }, "address:acc1": { - "nonce": "4", + "nonce": "6", "balance": "1,000,000", "storage": {} }, "address:acc2": { - "nonce": "1", - "balance": "1,000,000", + "nonce": "2", + "balance": "999,000", "esdt": { "str:CASHTOKEN-123456": "50" }, "storage": {} }, + "address:acc3": { + "nonce": "3", + "balance": "999,000", + "esdt": { + "str:CASHTOKEN-112233": "50", + "str:CASHTOKEN-445566": "50", + "str:CASHTOKEN-778899": "50" + }, + "storage": {} + }, "address:digital_cash_owner_address": { "nonce": "1", "balance": "0", diff --git a/contracts/examples/digital-cash/scenarios/withdraw-esdt.scen.json b/contracts/examples/digital-cash/scenarios/withdraw-esdt.scen.json index db38397ee6..f6cd263b38 100644 --- a/contracts/examples/digital-cash/scenarios/withdraw-esdt.scen.json +++ b/contracts/examples/digital-cash/scenarios/withdraw-esdt.scen.json @@ -5,16 +5,6 @@ "step": "externalSteps", "path": "fund-egld-and-esdt.scen.json" }, - { - "step": "setState", - "comment": "set block", - "currentBlockInfo": { - "blockTimestamp": "511", - "blockNonce": "15", - "blockRound": "15", - "blockEpoch": "0" - } - }, { "step": "scCall", "id": "withdraw-esdt-1", @@ -23,7 +13,7 @@ "to": "sc:the_digital_cash_contract", "function": "withdraw", "arguments": [ - "0xe868c2baab2a20b612f1351da5945c52c60f5321c6cde572149db90c9e8fbfc8" + "0x487bd4010b50c24a02018345fe5171edf4182e6294325382c75ef4c4409f01bd" ], "gasLimit": "500,000,000", "gasPrice": "0" @@ -42,41 +32,74 @@ "accounts": { "sc:the_digital_cash_contract": { "nonce": "0", - "balance": "1,000,000", + "balance": "4,000", "esdt": { - "str:CASHTOKEN-123456": "50" + "str:CASHTOKEN-123456": "50", + "str:CASHTOKEN-112233": "50", + "str:CASHTOKEN-445566": "50", + "str:CASHTOKEN-778899": "50" }, "storage": { - "str:deposit|0x558fd9b0dd9fed3d3bed883d3b92907743362c56b9728392f84b261f1cc5ae0a": { - "1-amount": "biguint:1,000,000", - "2-depositor_address": "address:acc1", - "3-expiration_round": "u64:16", - "4-token_name": "nested:str:EGLD", - "5-nonce": "u64:0" + "str:deposit|0xdb474a3a065d3f0c0a62ae680ef6435e48eb482899d2ae30ff7a3a4b0ef19c60": { + "0-depositor_address": "address:acc1", + "1-esdt_funds": "u32:0", + "2-egld_funds": "biguint:1,000", + "3-valability": "u64:60", + "4-expiration_round": "u64:10", + "5-fees": { + "0-num_token_to_transfer": "u32:1", + "1-value": "biguint:1,000" + } + }, + "str:deposit|0x487bd4010b50c24a02018345fe5171edf4182e6294325382c75ef4c4409f01bd": { + "0-depositor_address": "address:acc2", + "1-esdt_funds": "u32:1|nested:str:CASHTOKEN-123456|u64:0|biguint:50", + "2-egld_funds": "biguint:0", + "3-valability": "u64:100", + "4-expiration_round": "u64:16", + "5-fees": { + "0-num_token_to_transfer": "u32:1", + "1-value": "biguint:1,000" + } + }, + "str:deposit|0x885532043a061e0c779e4064b85193f72cffd22c5bcc208c209128e60f21bf0d": { + "0-depositor_address": "address:acc3", + "1-esdt_funds": "u32:3|nested:str:CASHTOKEN-112233|u64:0|biguint:50|nested:str:CASHTOKEN-445566|u64:0|biguint:50|nested:str:CASHTOKEN-778899|u64:0|biguint:50", + "2-egld_funds": "biguint:0", + "3-valability": "u64:100", + "4-expiration_round": "u64:16", + "5-fees": { + "0-num_token_to_transfer": "u32:3", + "1-value": "biguint:1,000" + } }, - "str:deposit|0xe868c2baab2a20b612f1351da5945c52c60f5321c6cde572149db90c9e8fbfc8": { - "1-amount": "biguint:50", - "2-depositor_address": "address:acc2", - "3-expiration_round": "u64:16", - "4-token_name": "nested:str:CASHTOKEN-123456", - "5-nonce": "u64:0" - } + "str:fee": "10" }, "code": "file:../output/digital-cash.wasm" }, "address:acc1": { - "nonce": "1", - "balance": "0", + "nonce": "3", + "balance": "998,000", "storage": {} }, "address:acc2": { - "nonce": "2", - "balance": "1,000,000", + "nonce": "3", + "balance": "999,000", "esdt": { "str:CASHTOKEN-123456": "50" }, "storage": {} }, + "address:acc3": { + "nonce": "3", + "balance": "999,000", + "esdt": { + "str:CASHTOKEN-112233": "50", + "str:CASHTOKEN-445566": "50", + "str:CASHTOKEN-778899": "50" + }, + "storage": {} + }, "address:digital_cash_owner_address": { "nonce": "1", "balance": "0", @@ -92,7 +115,7 @@ "to": "sc:the_digital_cash_contract", "function": "withdraw", "arguments": [ - "0xe868c2baab2a20b612f1351da5945c52c60f5321c6cde572149db90c9e8fbfc7" + "0xe808c2baab2a20b612f1351da5945c52c60f5321c6cde572149db90c9e8fbfc7" ], "gasLimit": "500,000,000", "gasPrice": "0" @@ -124,7 +147,7 @@ "to": "sc:the_digital_cash_contract", "function": "withdraw", "arguments": [ - "0xe868c2baab2a20b612f1351da5945c52c60f5321c6cde572149db90c9e8fbfc8" + "0x487bd4010b50c24a02018345fe5171edf4182e6294325382c75ef4c4409f01bd" ], "gasLimit": "500,000,000", "gasPrice": "0" @@ -143,34 +166,62 @@ "accounts": { "sc:the_digital_cash_contract": { "nonce": "0", - "balance": "1,000,000", + "balance": "3,000", "esdt": { - "str:CASHTOKEN-123456": "0" + "str:CASHTOKEN-112233": "50", + "str:CASHTOKEN-445566": "50", + "str:CASHTOKEN-778899": "50" }, "storage": { - "str:deposit|0x558fd9b0dd9fed3d3bed883d3b92907743362c56b9728392f84b261f1cc5ae0a": { - "1-amount": "biguint:1,000,000", - "2-depositor_address": "address:acc1", - "3-expiration_round": "u64:16", - "4-token_name": "nested:str:EGLD", - "5-nonce": "u64:0" - } + "str:deposit|0xdb474a3a065d3f0c0a62ae680ef6435e48eb482899d2ae30ff7a3a4b0ef19c60": { + "0-depositor_address": "address:acc1", + "1-esdt_funds": "u32:0", + "2-egld_funds": "biguint:1,000", + "3-valability": "u64:60", + "4-expiration_round": "u64:10", + "5-fees": { + "0-num_token_to_transfer": "u32:1", + "1-value": "biguint:1,000" + } + }, + "str:deposit|0x885532043a061e0c779e4064b85193f72cffd22c5bcc208c209128e60f21bf0d": { + "0-depositor_address": "address:acc3", + "1-esdt_funds": "u32:3|nested:str:CASHTOKEN-112233|u64:0|biguint:50|nested:str:CASHTOKEN-445566|u64:0|biguint:50|nested:str:CASHTOKEN-778899|u64:0|biguint:50", + "2-egld_funds": "biguint:0", + "3-valability": "u64:100", + "4-expiration_round": "u64:16", + "5-fees": { + "0-num_token_to_transfer": "u32:3", + "1-value": "biguint:1,000" + } + }, + "str:fee": "10" }, "code": "file:../output/digital-cash.wasm" }, "address:acc1": { - "nonce": "1", - "balance": "0", + "nonce": "3", + "balance": "998,000", "storage": {} }, "address:acc2": { - "nonce": "4", + "nonce": "5", "balance": "1,000,000", "esdt": { "str:CASHTOKEN-123456": "100" }, "storage": {} }, + "address:acc3": { + "nonce": "3", + "balance": "999,000", + "esdt": { + "str:CASHTOKEN-112233": "50", + "str:CASHTOKEN-445566": "50", + "str:CASHTOKEN-778899": "50" + }, + "storage": {} + }, "address:digital_cash_owner_address": { "nonce": "1", "balance": "0", diff --git a/contracts/examples/digital-cash/scenarios/withdraw-multi-esdt.scen.json b/contracts/examples/digital-cash/scenarios/withdraw-multi-esdt.scen.json new file mode 100644 index 0000000000..f9194207bd --- /dev/null +++ b/contracts/examples/digital-cash/scenarios/withdraw-multi-esdt.scen.json @@ -0,0 +1,231 @@ +{ + "name": "withdraw-multi-esdt", + "steps": [ + { + "step": "externalSteps", + "path": "fund-egld-and-esdt.scen.json" + }, + { + "step": "scCall", + "id": "withdraw-esdt-1", + "tx": { + "from": "address:acc2", + "to": "sc:the_digital_cash_contract", + "function": "withdraw", + "arguments": [ + "0x487bd4010b50c24a02018345fe5171edf4182e6294325382c75ef4c4409f01bd" + ], + "gasLimit": "500,000,000", + "gasPrice": "0" + }, + "expect": { + "out": [], + "status": "4", + "message": "str:withdrawal has not been available yet", + "logs": "*", + "gas": "*", + "refund": "*" + } + }, + { + "step": "checkState", + "accounts": { + "sc:the_digital_cash_contract": { + "nonce": "0", + "balance": "4,000", + "esdt": { + "str:CASHTOKEN-123456": "50", + "str:CASHTOKEN-112233": "50", + "str:CASHTOKEN-445566": "50", + "str:CASHTOKEN-778899": "50" + }, + "storage": { + "str:deposit|0xdb474a3a065d3f0c0a62ae680ef6435e48eb482899d2ae30ff7a3a4b0ef19c60": { + "0-depositor_address": "address:acc1", + "1-esdt_funds": "u32:0", + "2-egld_funds": "biguint:1,000", + "3-valability": "u64:60", + "4-expiration_round": "u64:10", + "5-fees": { + "0-num_token_to_transfer": "u32:1", + "1-value": "biguint:1,000" + } + }, + "str:deposit|0x487bd4010b50c24a02018345fe5171edf4182e6294325382c75ef4c4409f01bd": { + "0-depositor_address": "address:acc2", + "1-esdt_funds": "u32:1|nested:str:CASHTOKEN-123456|u64:0|biguint:50", + "2-egld_funds": "biguint:0", + "3-valability": "u64:100", + "4-expiration_round": "u64:16", + "5-fees": { + "0-num_token_to_transfer": "u32:1", + "1-value": "biguint:1,000" + } + }, + "str:deposit|0x885532043a061e0c779e4064b85193f72cffd22c5bcc208c209128e60f21bf0d": { + "0-depositor_address": "address:acc3", + "1-esdt_funds": "u32:3|nested:str:CASHTOKEN-112233|u64:0|biguint:50|nested:str:CASHTOKEN-445566|u64:0|biguint:50|nested:str:CASHTOKEN-778899|u64:0|biguint:50", + "2-egld_funds": "biguint:0", + "3-valability": "u64:100", + "4-expiration_round": "u64:16", + "5-fees": { + "0-num_token_to_transfer": "u32:3", + "1-value": "biguint:1,000" + } + }, + "str:fee": "10" + }, + "code": "file:../output/digital-cash.wasm" + }, + "address:acc1": { + "nonce": "3", + "balance": "998,000", + "storage": {} + }, + "address:acc2": { + "nonce": "3", + "balance": "999,000", + "esdt": { + "str:CASHTOKEN-123456": "50" + }, + "storage": {} + }, + "address:acc3": { + "nonce": "3", + "balance": "999,000", + "esdt": { + "str:CASHTOKEN-112233": "50", + "str:CASHTOKEN-445566": "50", + "str:CASHTOKEN-778899": "50" + }, + "storage": {} + }, + "address:digital_cash_owner_address": { + "nonce": "1", + "balance": "0", + "storage": {} + } + } + }, + { + "step": "scCall", + "id": "withdraw-esdt-2", + "tx": { + "from": "address:acc2", + "to": "sc:the_digital_cash_contract", + "function": "withdraw", + "arguments": [ + "0x805532043a061e0c779e4064b85193f72cffd22c5bcc208c209128e60f21bf0d" + ], + "gasLimit": "500,000,000", + "gasPrice": "0" + }, + "expect": { + "out": [], + "status": "4", + "message": "str:non-existent key", + "logs": "*", + "gas": "*", + "refund": "*" + } + }, + { + "step": "setState", + "comment": "set block", + "currentBlockInfo": { + "blockTimestamp": "511", + "blockNonce": "300", + "blockRound": "300", + "blockEpoch": "1" + } + }, + { + "step": "scCall", + "id": "withdraw-esdt-3", + "tx": { + "from": "address:acc2", + "to": "sc:the_digital_cash_contract", + "function": "withdraw", + "arguments": [ + "0x885532043a061e0c779e4064b85193f72cffd22c5bcc208c209128e60f21bf0d" + ], + "gasLimit": "500,000,000", + "gasPrice": "0" + }, + "expect": { + "out": [], + "status": "0", + "message": "", + "logs": "*", + "gas": "*", + "refund": "*" + } + }, + { + "step": "checkState", + "accounts": { + "sc:the_digital_cash_contract": { + "nonce": "0", + "balance": "3,000", + "esdt": { + "str:CASHTOKEN-123456": "50" + }, + "storage": { + "str:deposit|0xdb474a3a065d3f0c0a62ae680ef6435e48eb482899d2ae30ff7a3a4b0ef19c60": { + "0-depositor_address": "address:acc1", + "1-esdt_funds": "u32:0", + "2-egld_funds": "biguint:1,000", + "3-valability": "u64:60", + "4-expiration_round": "u64:10", + "5-fees": { + "0-num_token_to_transfer": "u32:1", + "1-value": "biguint:1,000" + } + }, + "str:deposit|0x487bd4010b50c24a02018345fe5171edf4182e6294325382c75ef4c4409f01bd": { + "0-depositor_address": "address:acc2", + "1-esdt_funds": "u32:1|nested:str:CASHTOKEN-123456|u64:0|biguint:50", + "2-egld_funds": "biguint:0", + "3-valability": "u64:100", + "4-expiration_round": "u64:16", + "5-fees": { + "0-num_token_to_transfer": "u32:1", + "1-value": "biguint:1,000" + } + }, + "str:fee": "10" + }, + "code": "file:../output/digital-cash.wasm" + }, + "address:acc1": { + "nonce": "3", + "balance": "998,000", + "storage": {} + }, + "address:acc2": { + "nonce": "5", + "balance": "999,000", + "esdt": { + "str:CASHTOKEN-123456": "50" + }, + "storage": {} + }, + "address:acc3": { + "nonce": "3", + "balance": "1,000,000", + "esdt": { + "str:CASHTOKEN-112233": "100", + "str:CASHTOKEN-445566": "100", + "str:CASHTOKEN-778899": "100" + }, + "storage": {} + }, + "address:digital_cash_owner_address": { + "nonce": "1", + "balance": "0", + "storage": {} + } + } + } + ] +} diff --git a/contracts/examples/digital-cash/src/deposit_info.rs b/contracts/examples/digital-cash/src/deposit_info.rs index 9aa4fa8687..db35242441 100644 --- a/contracts/examples/digital-cash/src/deposit_info.rs +++ b/contracts/examples/digital-cash/src/deposit_info.rs @@ -1,15 +1,31 @@ use multiversx_sc::{ api::ManagedTypeApi, - types::{BigUint, EgldOrEsdtTokenIdentifier, ManagedAddress}, + types::{BigUint, EsdtTokenPayment, ManagedAddress, ManagedVec}, }; multiversx_sc::derive_imports!(); #[derive(NestedEncode, NestedDecode, TopEncode, TopDecode, TypeAbi)] pub struct DepositInfo { - pub amount: BigUint, pub depositor_address: ManagedAddress, + pub esdt_funds: ManagedVec>, + pub egld_funds: BigUint, + pub valability: u64, pub expiration_round: u64, - pub token_name: EgldOrEsdtTokenIdentifier, - pub nonce: u64, + pub fees: Fee, +} + +impl DepositInfo +where + M: ManagedTypeApi, +{ + pub fn get_num_tokens(&self) -> usize { + (self.egld_funds != BigUint::zero()) as usize + self.esdt_funds.len() + } +} + +#[derive(NestedEncode, NestedDecode, TopEncode, TopDecode, TypeAbi, Default)] +pub struct Fee { + pub num_token_to_transfer: usize, + pub value: BigUint, } diff --git a/contracts/examples/digital-cash/src/digital_cash.rs b/contracts/examples/digital-cash/src/digital_cash.rs index 1361d6e77e..ea4a8daea9 100644 --- a/contracts/examples/digital-cash/src/digital_cash.rs +++ b/contracts/examples/digital-cash/src/digital_cash.rs @@ -5,7 +5,8 @@ multiversx_sc::imports!(); multiversx_sc::derive_imports!(); mod deposit_info; -use deposit_info::DepositInfo; + +use deposit_info::{DepositInfo, Fee}; pub const SECONDS_PER_ROUND: u64 = 6; pub use multiversx_sc::api::{ED25519_KEY_BYTE_LEN, ED25519_SIGNATURE_BYTE_LEN}; @@ -13,47 +14,67 @@ pub use multiversx_sc::api::{ED25519_KEY_BYTE_LEN, ED25519_SIGNATURE_BYTE_LEN}; #[multiversx_sc::contract] pub trait DigitalCash { #[init] - fn init(&self) {} + fn init(&self, fee: BigUint) { + self.fee().set(fee); + } //endpoints #[endpoint] #[payable("*")] fn fund(&self, address: ManagedAddress, valability: u64) { - let payment = self.call_value().egld_or_single_esdt(); - require!( - payment.amount > BigUint::zero(), - "amount must be greater than 0" - ); - require!(self.deposit(&address).is_empty(), "key already used"); + require!(!self.deposit(&address).is_empty(), "fees not covered"); + + let esdt_payment = self.call_value().all_esdt_transfers().clone_value(); + let egld_payment = self.call_value().egld_value().clone_value(); + + let num_tokens = (egld_payment != BigUint::zero()) as usize + esdt_payment.len(); + + require!(num_tokens > 0, "amount must be greater than 0"); + + let fee = self.fee().get(); - let deposit = DepositInfo { - amount: payment.amount, - depositor_address: self.blockchain().get_caller(), - expiration_round: self.get_expiration_round(valability), - token_name: payment.token_identifier, - nonce: payment.token_nonce, - }; + self.deposit(&address).update(|deposit| { + require!( + deposit.egld_funds == BigUint::zero() && deposit.esdt_funds.is_empty(), + "key already used" + ); + require!( + fee * num_tokens as u64 <= deposit.fees.value, + "cannot deposit funds without covering the fee cost first" + ); - self.deposit(&address).set(&deposit); + deposit.fees.num_token_to_transfer += num_tokens; + deposit.valability = valability; + deposit.expiration_round = self.get_expiration_round(valability); + deposit.esdt_funds = esdt_payment; + deposit.egld_funds = egld_payment; + }); } #[endpoint] fn withdraw(&self, address: ManagedAddress) { require!(!self.deposit(&address).is_empty(), "non-existent key"); + let block_round = self.blockchain().get_block_round(); + let deposit = self.deposit(&address).get(); require!( - deposit.expiration_round < self.blockchain().get_block_round(), + deposit.expiration_round < block_round, "withdrawal has not been available yet" ); - self.send().direct( - &deposit.depositor_address, - &deposit.token_name, - deposit.nonce, - &deposit.amount, - ); + + let egld_funds = deposit.egld_funds + deposit.fees.value; + if egld_funds != BigUint::zero() { + self.send() + .direct_egld(&deposit.depositor_address, &egld_funds); + } + + if !deposit.esdt_funds.is_empty() { + self.send() + .direct_multi(&deposit.depositor_address, &deposit.esdt_funds); + } self.deposit(&address).clear(); } @@ -66,39 +87,172 @@ pub trait DigitalCash { ) { require!(!self.deposit(&address).is_empty(), "non-existent key"); - let deposit = self.deposit(&address).get(); let caller_address = self.blockchain().get_caller(); + self.require_signature(&address, &caller_address, signature); - require!( - deposit.expiration_round >= self.blockchain().get_block_round(), - "deposit expired" - ); + let block_round = self.blockchain().get_block_round(); + + let fee = self.fee().get(); - let key = address.as_managed_byte_array(); + self.deposit(&address).update(|deposit| { + require!(deposit.expiration_round >= block_round, "deposit expired"); + let num_tokens_transfered = &deposit.get_num_tokens(); + let fee_cost = fee * *num_tokens_transfered as u64; + + deposit.fees.num_token_to_transfer -= num_tokens_transfered; + deposit.fees.value -= &fee_cost; + + self.collected_fees() + .update(|collected_fees| *collected_fees += fee_cost); + + if deposit.egld_funds != BigUint::zero() { + self.send() + .direct_egld(&caller_address, &deposit.egld_funds); + } + + if !deposit.esdt_funds.is_empty() { + self.send() + .direct_multi(&caller_address, &deposit.esdt_funds); + } + + if deposit.fees.value > 0 { + self.send() + .direct_egld(&deposit.depositor_address, &deposit.fees.value); + } + }); + + self.deposit(&address).clear(); + } + + #[endpoint] + #[only_owner] + fn claim_fees(&self) { + let caller_address = self.blockchain().get_caller(); + let fees = self.collected_fees().get(); + + self.send().direct_egld(&caller_address, &fees); + self.collected_fees().clear(); + } + + fn require_signature( + &self, + address: &ManagedAddress, + caller_address: &ManagedAddress, + signature: ManagedByteArray, + ) { + let addr = address.as_managed_buffer(); let message = caller_address.as_managed_buffer(); require!( self.crypto() - .verify_ed25519_legacy_managed::<32>(key, message, &signature), + .verify_ed25519(addr, message, signature.as_managed_buffer()), "invalid signature" ); + } + + #[endpoint] + #[payable("EGLD")] + fn deposit_fees(&self, address: ManagedAddress) { + let payment = self.call_value().egld_value().clone_value(); + let caller_address = self.blockchain().get_caller(); + + if self.deposit(&address).is_empty() { + let new_deposit = DepositInfo { + depositor_address: caller_address, + esdt_funds: ManagedVec::new(), + egld_funds: BigUint::zero(), + valability: 0, + expiration_round: 0, + fees: Fee { + num_token_to_transfer: 0, + value: payment, + }, + }; + self.deposit(&address).set(new_deposit) + } else { + self.deposit(&address) + .update(|deposit| deposit.fees.value += payment); + } + } - self.send().direct( - &caller_address, - &deposit.token_name, - deposit.nonce, - &deposit.amount, + #[endpoint] + fn forward( + &self, + address: ManagedAddress, + forward_address: ManagedAddress, + signature: ManagedByteArray, + ) { + require!( + !self.deposit(&forward_address).is_empty(), + "cannot deposit funds without covering the fee cost first" ); + + let caller_address = self.blockchain().get_caller(); + let fee = self.fee().get(); + self.require_signature(&address, &caller_address, signature); + + let mut forwarded_deposit = self.deposit(&address).get(); + let num_tokens = forwarded_deposit.get_num_tokens(); + self.deposit(&forward_address).update(|deposit| { + require!( + deposit.egld_funds == BigUint::zero() && deposit.esdt_funds.is_empty(), + "key already used" + ); + require!( + &fee * num_tokens as u64 <= deposit.fees.value, + "cannot forward funds without the owner covering the fee cost first" + ); + + deposit.fees.num_token_to_transfer += num_tokens; + deposit.valability = forwarded_deposit.valability; + deposit.expiration_round = self.get_expiration_round(forwarded_deposit.valability); + deposit.esdt_funds = forwarded_deposit.esdt_funds; + deposit.egld_funds = forwarded_deposit.egld_funds; + }); + + let forward_fee = &fee * num_tokens as u64; + + forwarded_deposit.fees.value -= &forward_fee; + + self.collected_fees() + .update(|collected_fees| *collected_fees += forward_fee); + + if forwarded_deposit.fees.value > 0 { + self.send().direct_egld( + &forwarded_deposit.depositor_address, + &forwarded_deposit.fees.value, + ); + } + self.deposit(&address).clear(); } //views #[view(amount)] - fn get_amount(&self, address: ManagedAddress) -> BigUint { + fn get_amount( + &self, + address: ManagedAddress, + token: EgldOrEsdtTokenIdentifier, + nonce: u64, + ) -> BigUint { require!(!self.deposit(&address).is_empty(), "non-existent key"); - let data = self.deposit(&address).get(); - data.amount + let mut amount = BigUint::zero(); + + require!(!self.deposit(&address).is_empty(), "non-existent key"); + + let deposit = self.deposit(&address).get(); + if token.is_egld() { + amount = deposit.egld_funds; + } else { + for esdt in deposit.esdt_funds.into_iter() { + if esdt.token_identifier == token && esdt.token_nonce == nonce { + amount = esdt.amount; + } + } + } + + amount } //private functions @@ -113,4 +267,10 @@ pub trait DigitalCash { #[view] #[storage_mapper("deposit")] fn deposit(&self, donor: &ManagedAddress) -> SingleValueMapper>; + + #[storage_mapper("fee")] + fn fee(&self) -> SingleValueMapper; + + #[storage_mapper("collected_fees")] + fn collected_fees(&self) -> SingleValueMapper; } diff --git a/contracts/examples/digital-cash/tests/digital_cash_scenario_go_test.rs b/contracts/examples/digital-cash/tests/digital_cash_scenario_go_test.rs index 8e45776299..9f78e742f6 100644 --- a/contracts/examples/digital-cash/tests/digital_cash_scenario_go_test.rs +++ b/contracts/examples/digital-cash/tests/digital_cash_scenario_go_test.rs @@ -8,6 +8,11 @@ fn claim_esdt_go() { multiversx_sc_scenario::run_go("scenarios/claim-esdt.scen.json"); } +#[test] +fn claim_fees_go() { + multiversx_sc_scenario::run_go("scenarios/claim-fees.scen.json"); +} + #[test] fn fund_egld_and_esdt_go() { multiversx_sc_scenario::run_go("scenarios/fund-egld-and-esdt.scen.json"); @@ -27,3 +32,8 @@ fn withdraw_egld_go() { fn withdraw_esdt_go() { multiversx_sc_scenario::run_go("scenarios/withdraw-esdt.scen.json"); } + +#[test] +fn forward_go() { + multiversx_sc_scenario::run_go("scenarios/forward.scen.json"); +} diff --git a/contracts/examples/digital-cash/tests/digital_cash_scenario_rs_test.rs b/contracts/examples/digital-cash/tests/digital_cash_scenario_rs_test.rs index 73c36d28c9..5371f44301 100644 --- a/contracts/examples/digital-cash/tests/digital_cash_scenario_rs_test.rs +++ b/contracts/examples/digital-cash/tests/digital_cash_scenario_rs_test.rs @@ -11,18 +11,21 @@ fn world() -> ScenarioWorld { blockchain } -#[ignore] // verify_ed25519 not implemented #[test] fn claim_egld_rs() { multiversx_sc_scenario::run_rs("scenarios/claim-egld.scen.json", world()); } -#[ignore] // verify_ed25519 not implemented #[test] fn claim_esdt_rs() { multiversx_sc_scenario::run_rs("scenarios/claim-esdt.scen.json", world()); } +#[test] +fn claim_fees_rs() { + multiversx_sc_scenario::run_rs("scenarios/claim-fees.scen.json", world()); +} + #[test] fn fund_egld_and_esdt_rs() { multiversx_sc_scenario::run_rs("scenarios/fund-egld-and-esdt.scen.json", world()); @@ -42,3 +45,8 @@ fn withdraw_egld_rs() { fn withdraw_esdt_rs() { multiversx_sc_scenario::run_rs("scenarios/withdraw-esdt.scen.json", world()); } + +#[test] +fn forward_rs() { + multiversx_sc_scenario::run_rs("scenarios/forward.scen.json", world()); +} diff --git a/contracts/examples/digital-cash/wasm/Cargo.lock b/contracts/examples/digital-cash/wasm/Cargo.lock index 4881687581..e043882be5 100644 --- a/contracts/examples/digital-cash/wasm/Cargo.lock +++ b/contracts/examples/digital-cash/wasm/Cargo.lock @@ -8,16 +8,16 @@ version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "once_cell", "version_check", ] [[package]] name = "arrayvec" -version = "0.7.2" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" +checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" [[package]] name = "autocfg" @@ -31,12 +31,6 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" -[[package]] -name = "cfg-if" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" - [[package]] name = "cfg-if" version = "1.0.0" @@ -85,21 +79,9 @@ version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ebdb29d2ea9ed0083cd8cece49bbd968021bd99b0849edb4a9a7ee0fdf6a4e0" -[[package]] -name = "libc" -version = "0.2.140" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99227334921fae1a979cf0bfdfcc6b3e5ce376ef57e16fb6fb3ea2ed6095f80c" - -[[package]] -name = "memory_units" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8452105ba047068f40ff7093dd1d9da90898e63dd61736462e9cdda6a90ad3c3" - [[package]] name = "multiversx-sc" -version = "0.39.7" +version = "0.41.3" dependencies = [ "bitflags", "hashbrown", @@ -111,7 +93,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.17.1" +version = "0.17.2" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -119,7 +101,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.17.1" +version = "0.17.2" dependencies = [ "hex", "proc-macro2", @@ -129,7 +111,7 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.39.7" +version = "0.41.3" dependencies = [ "hex", "proc-macro2", @@ -140,10 +122,9 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.39.7" +version = "0.41.3" dependencies = [ "multiversx-sc", - "wee_alloc", ] [[package]] @@ -166,24 +147,24 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.17.1" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" +checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" [[package]] name = "proc-macro2" -version = "1.0.52" +version = "1.0.63" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d0e1ae9e836cc3beddd63db0df682593d7e2d3d891ae8c9083d2113e1744224" +checksum = "7b368fba921b0dce7e60f5e04ec15e565b3303972b42bcfde1d0713b881959eb" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.26" +version = "1.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4424af4bf778aae2051a77b60283332f386554255d722233d09fbfc7e30da2fc" +checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488" dependencies = [ "proc-macro2", ] @@ -217,46 +198,12 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.8" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4" +checksum = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0" [[package]] name = "version_check" version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" - -[[package]] -name = "wee_alloc" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbb3b5a6b2bb17cb6ad44a2e68a43e8d2722c997da10e928665c72ec6c0a0b8e" -dependencies = [ - "cfg-if 0.1.10", - "libc", - "memory_units", - "winapi", -] - -[[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-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" diff --git a/contracts/examples/digital-cash/wasm/Cargo.toml b/contracts/examples/digital-cash/wasm/Cargo.toml index 581ba96749..5bf4820284 100644 --- a/contracts/examples/digital-cash/wasm/Cargo.toml +++ b/contracts/examples/digital-cash/wasm/Cargo.toml @@ -24,5 +24,5 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.39.7" +version = "0.41.3" path = "../../../../framework/wasm-adapter" diff --git a/contracts/examples/digital-cash/wasm/src/lib.rs b/contracts/examples/digital-cash/wasm/src/lib.rs index a0038d5376..7e096e68bd 100644 --- a/contracts/examples/digital-cash/wasm/src/lib.rs +++ b/contracts/examples/digital-cash/wasm/src/lib.rs @@ -5,12 +5,12 @@ //////////////////////////////////////////////////// // Init: 1 -// Endpoints: 5 +// Endpoints: 8 // Async Callback (empty): 1 -// Total number of exported functions: 7 +// Total number of exported functions: 10 #![no_std] -#![feature(alloc_error_handler, lang_items)] +#![feature(lang_items)] multiversx_sc_wasm_adapter::allocator!(); multiversx_sc_wasm_adapter::panic_handler!(); @@ -21,6 +21,9 @@ multiversx_sc_wasm_adapter::endpoints! { fund withdraw claim + claim_fees + deposit_fees + forward amount deposit ) diff --git a/contracts/examples/empty/Cargo.toml b/contracts/examples/empty/Cargo.toml index bebef4d5ed..fbe798150e 100644 --- a/contracts/examples/empty/Cargo.toml +++ b/contracts/examples/empty/Cargo.toml @@ -9,11 +9,11 @@ publish = false path = "src/empty.rs" [dependencies.multiversx-sc] -version = "0.39.7" +version = "0.41.3" path = "../../../framework/base" [dev-dependencies.multiversx-sc-scenario] -version = "0.39.7" +version = "0.41.3" path = "../../../framework/scenario" [dev-dependencies] diff --git a/contracts/examples/empty/meta/Cargo.toml b/contracts/examples/empty/meta/Cargo.toml index c77a31b6eb..855b2fb513 100644 --- a/contracts/examples/empty/meta/Cargo.toml +++ b/contracts/examples/empty/meta/Cargo.toml @@ -8,5 +8,5 @@ publish = false path = ".." [dependencies.multiversx-sc-meta] -version = "0.39.7" +version = "0.41.3" path = "../../../../framework/meta" diff --git a/contracts/examples/empty/wasm/Cargo.lock b/contracts/examples/empty/wasm/Cargo.lock index c4e45ad252..3c5a7f8e4d 100755 --- a/contracts/examples/empty/wasm/Cargo.lock +++ b/contracts/examples/empty/wasm/Cargo.lock @@ -8,16 +8,16 @@ version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "once_cell", "version_check", ] [[package]] name = "arrayvec" -version = "0.7.2" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" +checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" [[package]] name = "autocfg" @@ -31,12 +31,6 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" -[[package]] -name = "cfg-if" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" - [[package]] name = "cfg-if" version = "1.0.0" @@ -85,21 +79,9 @@ version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ebdb29d2ea9ed0083cd8cece49bbd968021bd99b0849edb4a9a7ee0fdf6a4e0" -[[package]] -name = "libc" -version = "0.2.140" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99227334921fae1a979cf0bfdfcc6b3e5ce376ef57e16fb6fb3ea2ed6095f80c" - -[[package]] -name = "memory_units" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8452105ba047068f40ff7093dd1d9da90898e63dd61736462e9cdda6a90ad3c3" - [[package]] name = "multiversx-sc" -version = "0.39.7" +version = "0.41.3" dependencies = [ "bitflags", "hashbrown", @@ -111,7 +93,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.17.1" +version = "0.17.2" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -119,7 +101,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.17.1" +version = "0.17.2" dependencies = [ "hex", "proc-macro2", @@ -129,7 +111,7 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.39.7" +version = "0.41.3" dependencies = [ "hex", "proc-macro2", @@ -140,10 +122,9 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.39.7" +version = "0.41.3" dependencies = [ "multiversx-sc", - "wee_alloc", ] [[package]] @@ -166,24 +147,24 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.17.1" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" +checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" [[package]] name = "proc-macro2" -version = "1.0.52" +version = "1.0.63" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d0e1ae9e836cc3beddd63db0df682593d7e2d3d891ae8c9083d2113e1744224" +checksum = "7b368fba921b0dce7e60f5e04ec15e565b3303972b42bcfde1d0713b881959eb" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.26" +version = "1.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4424af4bf778aae2051a77b60283332f386554255d722233d09fbfc7e30da2fc" +checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488" dependencies = [ "proc-macro2", ] @@ -217,46 +198,12 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.8" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4" +checksum = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0" [[package]] name = "version_check" version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" - -[[package]] -name = "wee_alloc" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbb3b5a6b2bb17cb6ad44a2e68a43e8d2722c997da10e928665c72ec6c0a0b8e" -dependencies = [ - "cfg-if 0.1.10", - "libc", - "memory_units", - "winapi", -] - -[[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-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" diff --git a/contracts/examples/empty/wasm/Cargo.toml b/contracts/examples/empty/wasm/Cargo.toml index 282555770e..985a434542 100644 --- a/contracts/examples/empty/wasm/Cargo.toml +++ b/contracts/examples/empty/wasm/Cargo.toml @@ -18,7 +18,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.39.7" +version = "0.41.3" path = "../../../../framework/wasm-adapter" [workspace] diff --git a/contracts/examples/empty/wasm/src/lib.rs b/contracts/examples/empty/wasm/src/lib.rs index 10559e14df..89ef4fc932 100644 --- a/contracts/examples/empty/wasm/src/lib.rs +++ b/contracts/examples/empty/wasm/src/lib.rs @@ -10,7 +10,7 @@ // Total number of exported functions: 2 #![no_std] -#![feature(alloc_error_handler, lang_items)] +#![feature(lang_items)] multiversx_sc_wasm_adapter::allocator!(); multiversx_sc_wasm_adapter::panic_handler!(); diff --git a/contracts/examples/esdt-transfer-with-fee/Cargo.toml b/contracts/examples/esdt-transfer-with-fee/Cargo.toml index 6234209b13..83712c3d17 100644 --- a/contracts/examples/esdt-transfer-with-fee/Cargo.toml +++ b/contracts/examples/esdt-transfer-with-fee/Cargo.toml @@ -9,9 +9,9 @@ publish = false path = "src/esdt_transfer_with_fee.rs" [dependencies.multiversx-sc] -version = "0.39.7" +version = "0.41.3" path = "../../../framework/base" [dev-dependencies.multiversx-sc-scenario] -version = "0.39.7" +version = "0.41.3" path = "../../../framework/scenario" diff --git a/contracts/examples/esdt-transfer-with-fee/meta/Cargo.toml b/contracts/examples/esdt-transfer-with-fee/meta/Cargo.toml index 0034d69d58..438b108b53 100644 --- a/contracts/examples/esdt-transfer-with-fee/meta/Cargo.toml +++ b/contracts/examples/esdt-transfer-with-fee/meta/Cargo.toml @@ -8,5 +8,5 @@ publish = false path = ".." [dependencies.multiversx-sc-meta] -version = "0.39.7" +version = "0.41.3" path = "../../../../framework/meta" diff --git a/contracts/examples/esdt-transfer-with-fee/src/esdt_transfer_with_fee.rs b/contracts/examples/esdt-transfer-with-fee/src/esdt_transfer_with_fee.rs index 754289fc0b..85abae23b6 100644 --- a/contracts/examples/esdt-transfer-with-fee/src/esdt_transfer_with_fee.rs +++ b/contracts/examples/esdt-transfer-with-fee/src/esdt_transfer_with_fee.rs @@ -48,7 +48,7 @@ pub trait EsdtTransferWithFee { #[endpoint] fn transfer(&self, address: ManagedAddress) { require!( - self.call_value().egld_value() == 0, + *self.call_value().egld_value() == 0, "EGLD transfers not allowed" ); let payments = self.call_value().all_esdt_transfers(); diff --git a/contracts/examples/esdt-transfer-with-fee/tests/esdt_transfer_with_fee_scenario_go_test.rs b/contracts/examples/esdt-transfer-with-fee/tests/esdt_transfer_with_fee_scenario_go_test.rs index 924ad5ec7b..7a985e0fe4 100644 --- a/contracts/examples/esdt-transfer-with-fee/tests/esdt_transfer_with_fee_scenario_go_test.rs +++ b/contracts/examples/esdt-transfer-with-fee/tests/esdt_transfer_with_fee_scenario_go_test.rs @@ -1,14 +1,14 @@ #[test] -fn deploy_go() { - multiversx_sc_scenario::run_go("scenarios/deploy.scen.json"); +fn claim_go() { + multiversx_sc_scenario::run_go("scenarios/claim.scen.json"); } #[test] -fn setup_fees_go() { - multiversx_sc_scenario::run_go("scenarios/setup_fees_and_transfer.scen.json"); +fn deploy_go() { + multiversx_sc_scenario::run_go("scenarios/deploy.scen.json"); } #[test] -fn claim_go() { - multiversx_sc_scenario::run_go("scenarios/claim.scen.json"); +fn setup_fees_and_transfer_go() { + multiversx_sc_scenario::run_go("scenarios/setup_fees_and_transfer.scen.json"); } diff --git a/contracts/examples/esdt-transfer-with-fee/tests/esdt_transfer_with_fee_scenario_rs_test.rs b/contracts/examples/esdt-transfer-with-fee/tests/esdt_transfer_with_fee_scenario_rs_test.rs index ad2db0fc83..3d110f12ca 100644 --- a/contracts/examples/esdt-transfer-with-fee/tests/esdt_transfer_with_fee_scenario_rs_test.rs +++ b/contracts/examples/esdt-transfer-with-fee/tests/esdt_transfer_with_fee_scenario_rs_test.rs @@ -12,16 +12,16 @@ fn world() -> ScenarioWorld { } #[test] -fn deploy_rs() { - multiversx_sc_scenario::run_rs("scenarios/deploy.scen.json", world()); +fn claim_rs() { + multiversx_sc_scenario::run_rs("scenarios/claim.scen.json", world()); } #[test] -fn setup_fees_rs() { - multiversx_sc_scenario::run_rs("scenarios/setup_fees_and_transfer.scen.json", world()); +fn deploy_rs() { + multiversx_sc_scenario::run_rs("scenarios/deploy.scen.json", world()); } #[test] -fn claim_rs() { - multiversx_sc_scenario::run_rs("scenarios/claim.scen.json", world()); +fn setup_fees_and_transfer_rs() { + multiversx_sc_scenario::run_rs("scenarios/setup_fees_and_transfer.scen.json", world()); } diff --git a/contracts/examples/esdt-transfer-with-fee/wasm/Cargo.lock b/contracts/examples/esdt-transfer-with-fee/wasm/Cargo.lock index 3de9f1bc13..90fb011ea0 100644 --- a/contracts/examples/esdt-transfer-with-fee/wasm/Cargo.lock +++ b/contracts/examples/esdt-transfer-with-fee/wasm/Cargo.lock @@ -8,16 +8,16 @@ version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "once_cell", "version_check", ] [[package]] name = "arrayvec" -version = "0.7.2" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" +checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" [[package]] name = "autocfg" @@ -31,12 +31,6 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" -[[package]] -name = "cfg-if" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" - [[package]] name = "cfg-if" version = "1.0.0" @@ -85,21 +79,9 @@ version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ebdb29d2ea9ed0083cd8cece49bbd968021bd99b0849edb4a9a7ee0fdf6a4e0" -[[package]] -name = "libc" -version = "0.2.140" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99227334921fae1a979cf0bfdfcc6b3e5ce376ef57e16fb6fb3ea2ed6095f80c" - -[[package]] -name = "memory_units" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8452105ba047068f40ff7093dd1d9da90898e63dd61736462e9cdda6a90ad3c3" - [[package]] name = "multiversx-sc" -version = "0.39.7" +version = "0.41.3" dependencies = [ "bitflags", "hashbrown", @@ -111,7 +93,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.17.1" +version = "0.17.2" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -119,7 +101,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.17.1" +version = "0.17.2" dependencies = [ "hex", "proc-macro2", @@ -129,7 +111,7 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.39.7" +version = "0.41.3" dependencies = [ "hex", "proc-macro2", @@ -140,10 +122,9 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.39.7" +version = "0.41.3" dependencies = [ "multiversx-sc", - "wee_alloc", ] [[package]] @@ -166,24 +147,24 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.17.1" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" +checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" [[package]] name = "proc-macro2" -version = "1.0.52" +version = "1.0.63" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d0e1ae9e836cc3beddd63db0df682593d7e2d3d891ae8c9083d2113e1744224" +checksum = "7b368fba921b0dce7e60f5e04ec15e565b3303972b42bcfde1d0713b881959eb" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.26" +version = "1.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4424af4bf778aae2051a77b60283332f386554255d722233d09fbfc7e30da2fc" +checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488" dependencies = [ "proc-macro2", ] @@ -217,46 +198,12 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.8" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4" +checksum = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0" [[package]] name = "version_check" version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" - -[[package]] -name = "wee_alloc" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbb3b5a6b2bb17cb6ad44a2e68a43e8d2722c997da10e928665c72ec6c0a0b8e" -dependencies = [ - "cfg-if 0.1.10", - "libc", - "memory_units", - "winapi", -] - -[[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-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" diff --git a/contracts/examples/esdt-transfer-with-fee/wasm/Cargo.toml b/contracts/examples/esdt-transfer-with-fee/wasm/Cargo.toml index 1968094013..3db6573cb0 100644 --- a/contracts/examples/esdt-transfer-with-fee/wasm/Cargo.toml +++ b/contracts/examples/esdt-transfer-with-fee/wasm/Cargo.toml @@ -19,7 +19,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.39.7" +version = "0.41.3" path = "../../../../framework/wasm-adapter" [workspace] diff --git a/contracts/examples/esdt-transfer-with-fee/wasm/src/lib.rs b/contracts/examples/esdt-transfer-with-fee/wasm/src/lib.rs index 5cd7fcbe24..b2db83e31d 100644 --- a/contracts/examples/esdt-transfer-with-fee/wasm/src/lib.rs +++ b/contracts/examples/esdt-transfer-with-fee/wasm/src/lib.rs @@ -10,7 +10,7 @@ // Total number of exported functions: 8 #![no_std] -#![feature(alloc_error_handler, lang_items)] +#![feature(lang_items)] multiversx_sc_wasm_adapter::allocator!(); multiversx_sc_wasm_adapter::panic_handler!(); diff --git a/contracts/examples/factorial/Cargo.toml b/contracts/examples/factorial/Cargo.toml index 6a553c82b0..44b0dead89 100644 --- a/contracts/examples/factorial/Cargo.toml +++ b/contracts/examples/factorial/Cargo.toml @@ -9,9 +9,9 @@ publish = false path = "src/factorial.rs" [dependencies.multiversx-sc] -version = "0.39.7" +version = "0.41.3" path = "../../../framework/base" [dev-dependencies.multiversx-sc-scenario] -version = "0.39.7" +version = "0.41.3" path = "../../../framework/scenario" diff --git a/contracts/examples/factorial/meta/Cargo.toml b/contracts/examples/factorial/meta/Cargo.toml index 70f37d6d18..8be038dd6d 100644 --- a/contracts/examples/factorial/meta/Cargo.toml +++ b/contracts/examples/factorial/meta/Cargo.toml @@ -9,5 +9,5 @@ publish = false path = ".." [dependencies.multiversx-sc-meta] -version = "0.39.7" +version = "0.41.3" path = "../../../../framework/meta" diff --git a/contracts/examples/factorial/wasm/Cargo.lock b/contracts/examples/factorial/wasm/Cargo.lock index f88f6b9f8a..5f853f6434 100755 --- a/contracts/examples/factorial/wasm/Cargo.lock +++ b/contracts/examples/factorial/wasm/Cargo.lock @@ -8,16 +8,16 @@ version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "once_cell", "version_check", ] [[package]] name = "arrayvec" -version = "0.7.2" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" +checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" [[package]] name = "autocfg" @@ -31,12 +31,6 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" -[[package]] -name = "cfg-if" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" - [[package]] name = "cfg-if" version = "1.0.0" @@ -85,21 +79,9 @@ version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ebdb29d2ea9ed0083cd8cece49bbd968021bd99b0849edb4a9a7ee0fdf6a4e0" -[[package]] -name = "libc" -version = "0.2.140" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99227334921fae1a979cf0bfdfcc6b3e5ce376ef57e16fb6fb3ea2ed6095f80c" - -[[package]] -name = "memory_units" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8452105ba047068f40ff7093dd1d9da90898e63dd61736462e9cdda6a90ad3c3" - [[package]] name = "multiversx-sc" -version = "0.39.7" +version = "0.41.3" dependencies = [ "bitflags", "hashbrown", @@ -111,7 +93,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.17.1" +version = "0.17.2" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -119,7 +101,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.17.1" +version = "0.17.2" dependencies = [ "hex", "proc-macro2", @@ -129,7 +111,7 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.39.7" +version = "0.41.3" dependencies = [ "hex", "proc-macro2", @@ -140,10 +122,9 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.39.7" +version = "0.41.3" dependencies = [ "multiversx-sc", - "wee_alloc", ] [[package]] @@ -166,24 +147,24 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.17.1" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" +checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" [[package]] name = "proc-macro2" -version = "1.0.52" +version = "1.0.63" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d0e1ae9e836cc3beddd63db0df682593d7e2d3d891ae8c9083d2113e1744224" +checksum = "7b368fba921b0dce7e60f5e04ec15e565b3303972b42bcfde1d0713b881959eb" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.26" +version = "1.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4424af4bf778aae2051a77b60283332f386554255d722233d09fbfc7e30da2fc" +checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488" dependencies = [ "proc-macro2", ] @@ -217,46 +198,12 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.8" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4" +checksum = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0" [[package]] name = "version_check" version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" - -[[package]] -name = "wee_alloc" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbb3b5a6b2bb17cb6ad44a2e68a43e8d2722c997da10e928665c72ec6c0a0b8e" -dependencies = [ - "cfg-if 0.1.10", - "libc", - "memory_units", - "winapi", -] - -[[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-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" diff --git a/contracts/examples/factorial/wasm/Cargo.toml b/contracts/examples/factorial/wasm/Cargo.toml index 2b2c234e26..decad491d9 100644 --- a/contracts/examples/factorial/wasm/Cargo.toml +++ b/contracts/examples/factorial/wasm/Cargo.toml @@ -19,7 +19,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.39.7" +version = "0.41.3" path = "../../../../framework/wasm-adapter" [workspace] diff --git a/contracts/examples/factorial/wasm/src/lib.rs b/contracts/examples/factorial/wasm/src/lib.rs index 5aca3b09b3..31719e5005 100644 --- a/contracts/examples/factorial/wasm/src/lib.rs +++ b/contracts/examples/factorial/wasm/src/lib.rs @@ -10,7 +10,7 @@ // Total number of exported functions: 3 #![no_std] -#![feature(alloc_error_handler, lang_items)] +#![feature(lang_items)] multiversx_sc_wasm_adapter::allocator!(); multiversx_sc_wasm_adapter::panic_handler!(); diff --git a/contracts/examples/fractional-nfts/Cargo.toml b/contracts/examples/fractional-nfts/Cargo.toml index 46571800d5..544eaf5dae 100644 --- a/contracts/examples/fractional-nfts/Cargo.toml +++ b/contracts/examples/fractional-nfts/Cargo.toml @@ -9,13 +9,13 @@ publish = false path = "src/fractional_nfts.rs" [dependencies.multiversx-sc] -version = "0.39.7" +version = "0.41.3" path = "../../../framework/base" [dependencies.multiversx-sc-modules] -version = "0.39.7" +version = "0.41.3" path = "../../../contracts/modules" [dev-dependencies.multiversx-sc-scenario] -version = "0.39.7" +version = "0.41.3" path = "../../../framework/scenario" diff --git a/contracts/examples/fractional-nfts/meta/Cargo.toml b/contracts/examples/fractional-nfts/meta/Cargo.toml index e153eb5d5b..29ba8600d7 100644 --- a/contracts/examples/fractional-nfts/meta/Cargo.toml +++ b/contracts/examples/fractional-nfts/meta/Cargo.toml @@ -9,5 +9,5 @@ publish = false path = ".." [dependencies.multiversx-sc-meta] -version = "0.39.7" +version = "0.41.3" path = "../../../../framework/meta" diff --git a/contracts/examples/fractional-nfts/src/fractional_nfts.rs b/contracts/examples/fractional-nfts/src/fractional_nfts.rs index 17017c00d6..a429cfad10 100644 --- a/contracts/examples/fractional-nfts/src/fractional_nfts.rs +++ b/contracts/examples/fractional-nfts/src/fractional_nfts.rs @@ -22,7 +22,7 @@ pub trait FractionalNfts: default_issue_callbacks::DefaultIssueCallbacksModule { let issue_cost = self.call_value().egld_value(); self.fractional_token().issue_and_set_all_roles( EsdtTokenType::SemiFungible, - issue_cost, + issue_cost.clone_value(), token_display_name, token_ticker, num_decimals, diff --git a/contracts/examples/fractional-nfts/wasm/Cargo.lock b/contracts/examples/fractional-nfts/wasm/Cargo.lock index 573db01c93..c1eae1d751 100644 --- a/contracts/examples/fractional-nfts/wasm/Cargo.lock +++ b/contracts/examples/fractional-nfts/wasm/Cargo.lock @@ -8,16 +8,16 @@ version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "once_cell", "version_check", ] [[package]] name = "arrayvec" -version = "0.7.2" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" +checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" [[package]] name = "autocfg" @@ -31,12 +31,6 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" -[[package]] -name = "cfg-if" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" - [[package]] name = "cfg-if" version = "1.0.0" @@ -86,21 +80,9 @@ version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ebdb29d2ea9ed0083cd8cece49bbd968021bd99b0849edb4a9a7ee0fdf6a4e0" -[[package]] -name = "libc" -version = "0.2.140" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99227334921fae1a979cf0bfdfcc6b3e5ce376ef57e16fb6fb3ea2ed6095f80c" - -[[package]] -name = "memory_units" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8452105ba047068f40ff7093dd1d9da90898e63dd61736462e9cdda6a90ad3c3" - [[package]] name = "multiversx-sc" -version = "0.39.7" +version = "0.41.3" dependencies = [ "bitflags", "hashbrown", @@ -112,7 +94,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.17.1" +version = "0.17.2" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -120,7 +102,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.17.1" +version = "0.17.2" dependencies = [ "hex", "proc-macro2", @@ -130,7 +112,7 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.39.7" +version = "0.41.3" dependencies = [ "hex", "proc-macro2", @@ -141,17 +123,16 @@ dependencies = [ [[package]] name = "multiversx-sc-modules" -version = "0.39.7" +version = "0.41.3" dependencies = [ "multiversx-sc", ] [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.39.7" +version = "0.41.3" dependencies = [ "multiversx-sc", - "wee_alloc", ] [[package]] @@ -174,24 +155,24 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.17.1" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" +checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" [[package]] name = "proc-macro2" -version = "1.0.52" +version = "1.0.63" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d0e1ae9e836cc3beddd63db0df682593d7e2d3d891ae8c9083d2113e1744224" +checksum = "7b368fba921b0dce7e60f5e04ec15e565b3303972b42bcfde1d0713b881959eb" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.26" +version = "1.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4424af4bf778aae2051a77b60283332f386554255d722233d09fbfc7e30da2fc" +checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488" dependencies = [ "proc-macro2", ] @@ -225,46 +206,12 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.8" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4" +checksum = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0" [[package]] name = "version_check" version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" - -[[package]] -name = "wee_alloc" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbb3b5a6b2bb17cb6ad44a2e68a43e8d2722c997da10e928665c72ec6c0a0b8e" -dependencies = [ - "cfg-if 0.1.10", - "libc", - "memory_units", - "winapi", -] - -[[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-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" diff --git a/contracts/examples/fractional-nfts/wasm/Cargo.toml b/contracts/examples/fractional-nfts/wasm/Cargo.toml index 83172cb7d9..2c4f29d7fd 100644 --- a/contracts/examples/fractional-nfts/wasm/Cargo.toml +++ b/contracts/examples/fractional-nfts/wasm/Cargo.toml @@ -19,7 +19,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.39.7" +version = "0.41.3" path = "../../../../framework/wasm-adapter" [workspace] diff --git a/contracts/examples/fractional-nfts/wasm/src/lib.rs b/contracts/examples/fractional-nfts/wasm/src/lib.rs index c373671883..906c6de272 100644 --- a/contracts/examples/fractional-nfts/wasm/src/lib.rs +++ b/contracts/examples/fractional-nfts/wasm/src/lib.rs @@ -10,7 +10,7 @@ // Total number of exported functions: 6 #![no_std] -#![feature(alloc_error_handler, lang_items)] +#![feature(lang_items)] multiversx_sc_wasm_adapter::allocator!(); multiversx_sc_wasm_adapter::panic_handler!(); diff --git a/contracts/examples/lottery-esdt/Cargo.toml b/contracts/examples/lottery-esdt/Cargo.toml index 3a28c4f7c0..62c675a549 100644 --- a/contracts/examples/lottery-esdt/Cargo.toml +++ b/contracts/examples/lottery-esdt/Cargo.toml @@ -9,9 +9,9 @@ publish = false path = "src/lottery.rs" [dependencies.multiversx-sc] -version = "0.39.7" +version = "0.41.3" path = "../../../framework/base" [dev-dependencies.multiversx-sc-scenario] -version = "0.39.7" +version = "0.41.3" path = "../../../framework/scenario" diff --git a/contracts/examples/lottery-esdt/documentation.md b/contracts/examples/lottery-esdt/documentation.md index af2fa1b34b..6e111918f3 100644 --- a/contracts/examples/lottery-esdt/documentation.md +++ b/contracts/examples/lottery-esdt/documentation.md @@ -1,6 +1,6 @@ # Abstract -The lottery smart contract is designed to allow anyone to create their very own lottery, directly on the blockchain. Having said that, the purpose of this contract is just to have a bit of fun and show what’s possible on the current version of the Elrond blockchain. We do not endorse gambling. +The lottery smart contract is designed to allow anyone to create their very own lottery, directly on the blockchain. Having said that, the purpose of this contract is just to have a bit of fun and show what’s possible on the current version of the MultiversX blockchain. We do not endorse gambling. This is the esdt version, which allows any arbitrary token to be used as currency. diff --git a/contracts/examples/lottery-esdt/meta/Cargo.toml b/contracts/examples/lottery-esdt/meta/Cargo.toml index 35197e6f00..b4f59abe46 100644 --- a/contracts/examples/lottery-esdt/meta/Cargo.toml +++ b/contracts/examples/lottery-esdt/meta/Cargo.toml @@ -9,5 +9,5 @@ publish = false path = ".." [dependencies.multiversx-sc-meta] -version = "0.39.7" +version = "0.41.3" path = "../../../../framework/meta" diff --git a/contracts/examples/lottery-esdt/tests/lottery_esdt_scenario_go_test.rs b/contracts/examples/lottery-esdt/tests/lottery_esdt_scenario_go_test.rs index db5c9a4aa0..7ecf6fdbf3 100644 --- a/contracts/examples/lottery-esdt/tests/lottery_esdt_scenario_go_test.rs +++ b/contracts/examples/lottery-esdt/tests/lottery_esdt_scenario_go_test.rs @@ -64,7 +64,7 @@ fn complex_prize_distribution_go() { } #[test] -fn determine_winner_different_ticket_holders_winner_acc1_go() { +fn determine_winner_different_ticket_holders_winner_acc_1_go() { multiversx_sc_scenario::run_go( "scenarios/determine-winner-different-ticket-holders-winner-acc1.scen.json", ); diff --git a/contracts/examples/lottery-esdt/tests/lottery_esdt_scenario_rs_test.rs b/contracts/examples/lottery-esdt/tests/lottery_esdt_scenario_rs_test.rs index d09f08c0f1..9659030030 100644 --- a/contracts/examples/lottery-esdt/tests/lottery_esdt_scenario_rs_test.rs +++ b/contracts/examples/lottery-esdt/tests/lottery_esdt_scenario_rs_test.rs @@ -24,6 +24,11 @@ fn buy_more_tickets_than_allowed_rs() { multiversx_sc_scenario::run_rs("scenarios/buy-more-tickets-than-allowed.scen.json", world()); } +#[test] +fn buy_ticket_rs() { + multiversx_sc_scenario::run_rs("scenarios/buy-ticket.scen.json", world()); +} + #[test] fn buy_ticket_after_deadline_rs() { multiversx_sc_scenario::run_rs("scenarios/buy-ticket-after-deadline.scen.json", world()); @@ -73,12 +78,13 @@ fn buy_ticket_wrong_fee_rs() { } #[test] -fn buy_ticket_simple_rs() { - multiversx_sc_scenario::run_rs("scenarios/buy-ticket.scen.json", world()); +#[ignore] +fn complex_prize_distribution_rs() { + multiversx_sc_scenario::run_rs("scenarios/complex-prize-distribution.scen.json", world()); } #[test] -fn determine_winner_different_ticket_holders_winner_acc1_rs() { +fn determine_winner_different_ticket_holders_winner_acc_1_rs() { multiversx_sc_scenario::run_rs( "scenarios/determine-winner-different-ticket-holders-winner-acc1.scen.json", world(), @@ -98,21 +104,24 @@ fn determine_winner_same_ticket_holder_rs() { ); } -/* NOT SUPPORTED YET #[test] +#[ignore = "NOT SUPPORTED YET"] fn determine_winner_split_prize_pool_rs() { multiversx_sc_scenario::run_rs( "scenarios/determine-winner-split-prize-pool.scen.json", world(), ); } -*/ - #[test] fn lottery_init_rs() { multiversx_sc_scenario::run_rs("scenarios/lottery-init.scen.json", world()); } +#[test] +fn lottery_with_burn_percentage_rs() { + multiversx_sc_scenario::run_rs("scenarios/lottery-with-burn-percentage.scen.json", world()); +} + #[test] fn start_after_announced_winner_rs() { multiversx_sc_scenario::run_rs("scenarios/start-after-announced-winner.scen.json", world()); @@ -140,32 +149,32 @@ fn start_fixed_deadline_rs() { } #[test] -fn start_limited_tickets_and_fixed_deadline_invalid_deadline_rs() { - multiversx_sc_scenario::run_rs( - "scenarios/start-limited-tickets-and-fixed-deadline-invalid-deadline.scen.json", - world(), - ); +fn start_limited_tickets_rs() { + multiversx_sc_scenario::run_rs("scenarios/start-limited-tickets.scen.json", world()); } #[test] -fn start_limited_tickets_and_fixed_deadline_invalid_ticket_price_arg_rs() { +fn start_limited_tickets_and_fixed_deadline_rs() { multiversx_sc_scenario::run_rs( - "scenarios/start-limited-tickets-and-fixed-deadline-invalid-ticket-price-arg.scen.json", + "scenarios/start-limited-tickets-and-fixed-deadline.scen.json", world(), ); } #[test] -fn start_limited_tickets_and_fixed_deadline_valid_rs() { +fn start_limited_tickets_and_fixed_deadline_invalid_deadline_rs() { multiversx_sc_scenario::run_rs( - "scenarios/start-limited-tickets-and-fixed-deadline.scen.json", + "scenarios/start-limited-tickets-and-fixed-deadline-invalid-deadline.scen.json", world(), ); } #[test] -fn start_limited_tickets_simple_rs() { - multiversx_sc_scenario::run_rs("scenarios/start-limited-tickets.scen.json", world()); +fn start_limited_tickets_and_fixed_deadline_invalid_ticket_price_arg_rs() { + multiversx_sc_scenario::run_rs( + "scenarios/start-limited-tickets-and-fixed-deadline-invalid-ticket-price-arg.scen.json", + world(), + ); } #[test] diff --git a/contracts/examples/lottery-esdt/wasm/Cargo.lock b/contracts/examples/lottery-esdt/wasm/Cargo.lock index 74e116a1cb..b5c4986454 100755 --- a/contracts/examples/lottery-esdt/wasm/Cargo.lock +++ b/contracts/examples/lottery-esdt/wasm/Cargo.lock @@ -8,16 +8,16 @@ version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "once_cell", "version_check", ] [[package]] name = "arrayvec" -version = "0.7.2" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" +checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" [[package]] name = "autocfg" @@ -31,12 +31,6 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" -[[package]] -name = "cfg-if" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" - [[package]] name = "cfg-if" version = "1.0.0" @@ -70,12 +64,6 @@ version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ebdb29d2ea9ed0083cd8cece49bbd968021bd99b0849edb4a9a7ee0fdf6a4e0" -[[package]] -name = "libc" -version = "0.2.140" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99227334921fae1a979cf0bfdfcc6b3e5ce376ef57e16fb6fb3ea2ed6095f80c" - [[package]] name = "lottery-esdt" version = "0.0.0" @@ -91,15 +79,9 @@ dependencies = [ "multiversx-sc-wasm-adapter", ] -[[package]] -name = "memory_units" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8452105ba047068f40ff7093dd1d9da90898e63dd61736462e9cdda6a90ad3c3" - [[package]] name = "multiversx-sc" -version = "0.39.7" +version = "0.41.3" dependencies = [ "bitflags", "hashbrown", @@ -111,7 +93,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.17.1" +version = "0.17.2" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -119,7 +101,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.17.1" +version = "0.17.2" dependencies = [ "hex", "proc-macro2", @@ -129,7 +111,7 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.39.7" +version = "0.41.3" dependencies = [ "hex", "proc-macro2", @@ -140,10 +122,9 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.39.7" +version = "0.41.3" dependencies = [ "multiversx-sc", - "wee_alloc", ] [[package]] @@ -166,24 +147,24 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.17.1" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" +checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" [[package]] name = "proc-macro2" -version = "1.0.52" +version = "1.0.63" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d0e1ae9e836cc3beddd63db0df682593d7e2d3d891ae8c9083d2113e1744224" +checksum = "7b368fba921b0dce7e60f5e04ec15e565b3303972b42bcfde1d0713b881959eb" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.26" +version = "1.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4424af4bf778aae2051a77b60283332f386554255d722233d09fbfc7e30da2fc" +checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488" dependencies = [ "proc-macro2", ] @@ -217,46 +198,12 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.8" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4" +checksum = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0" [[package]] name = "version_check" version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" - -[[package]] -name = "wee_alloc" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbb3b5a6b2bb17cb6ad44a2e68a43e8d2722c997da10e928665c72ec6c0a0b8e" -dependencies = [ - "cfg-if 0.1.10", - "libc", - "memory_units", - "winapi", -] - -[[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-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" diff --git a/contracts/examples/lottery-esdt/wasm/Cargo.toml b/contracts/examples/lottery-esdt/wasm/Cargo.toml index bc9f35c71f..c78a15089d 100644 --- a/contracts/examples/lottery-esdt/wasm/Cargo.toml +++ b/contracts/examples/lottery-esdt/wasm/Cargo.toml @@ -19,7 +19,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.39.7" +version = "0.41.3" path = "../../../../framework/wasm-adapter" [workspace] diff --git a/contracts/examples/lottery-esdt/wasm/src/lib.rs b/contracts/examples/lottery-esdt/wasm/src/lib.rs index 053610c85d..6163d73872 100644 --- a/contracts/examples/lottery-esdt/wasm/src/lib.rs +++ b/contracts/examples/lottery-esdt/wasm/src/lib.rs @@ -10,7 +10,7 @@ // Total number of exported functions: 9 #![no_std] -#![feature(alloc_error_handler, lang_items)] +#![feature(lang_items)] multiversx_sc_wasm_adapter::allocator!(); multiversx_sc_wasm_adapter::panic_handler!(); diff --git a/contracts/examples/multisig/Cargo.toml b/contracts/examples/multisig/Cargo.toml index 73ec3eb486..723bdf2412 100644 --- a/contracts/examples/multisig/Cargo.toml +++ b/contracts/examples/multisig/Cargo.toml @@ -9,15 +9,15 @@ publish = false path = "src/multisig.rs" [dependencies.multiversx-sc] -version = "0.39.7" +version = "0.41.3" path = "../../../framework/base" [dependencies.multiversx-sc-modules] -version = "0.39.7" +version = "0.41.3" path = "../../../contracts/modules" [dev-dependencies.multiversx-sc-scenario] -version = "0.39.7" +version = "0.41.3" path = "../../../framework/scenario" [dev-dependencies.adder] diff --git a/contracts/examples/multisig/README.md b/contracts/examples/multisig/README.md index 55ec044f55..0e5e3b86b5 100644 --- a/contracts/examples/multisig/README.md +++ b/contracts/examples/multisig/README.md @@ -27,14 +27,14 @@ The required guidelines are: * **No libraries.** Extending the last guideline, our contract has no upstream dependencies other than itself. This minimizes the chance of us misunderstanding or misusing some piece of library code. It also forces us to stay simple and eases auditing and eventually formal verification. -* **Minimal internal state.** Complex applications can be built inside of Elrond smart contracts. Storing minimal internal state allows our contract’s code to be simpler, and to be written in a more functional style, which is easier to test and reason about. +* **Minimal internal state.** Complex applications can be built inside of MultiversX smart contracts. Storing minimal internal state allows our contract’s code to be simpler, and to be written in a more functional style, which is easier to test and reason about. * **Uses cold-storage.** The proposer which creates an action or spends from the contract has no special rights or access to the MSC. Authorization is handled by directly signing messages by the board members’ wallets that can be hardware wallets (Trezor; Ledger, etc.) or software wallets. * **Complete end-to-end testing.** The contract itself is exhaustively unit tested, audited and formally verified. ## Roles -* **Deployer** - This is the address that deploys the MSC. By default this address is also the owner of the SC, but the owner can be changed later if required, as this is by default supported by the Elrond protocol itself. This is the address that initially set up the configuration of the SC: board members, quorum, etc. It is important to mention that at deployment a very important configuration parameter is the option to allow the SC to be upgradeable or not. It is recommended for most use cases the SC to be non-upgradeable. Leaving the SC upgradable will give the owner of the SC the possibility to upgrade the SC and bypass the board, defeating the purpose of a MSC. If keeping the SC upgradeable is desired, a possible approach would be to make the owner another MSC, and both SCs could maintain the same board, so an upgrade action would need the approval of the board. +* **Deployer** - This is the address that deploys the MSC. By default this address is also the owner of the SC, but the owner can be changed later if required, as this is by default supported by the MultiversX protocol itself. This is the address that initially set up the configuration of the SC: board members, quorum, etc. It is important to mention that at deployment a very important configuration parameter is the option to allow the SC to be upgradeable or not. It is recommended for most use cases the SC to be non-upgradeable. Leaving the SC upgradable will give the owner of the SC the possibility to upgrade the SC and bypass the board, defeating the purpose of a MSC. If keeping the SC upgradeable is desired, a possible approach would be to make the owner another MSC, and both SCs could maintain the same board, so an upgrade action would need the approval of the board. * **Owner** - The deployer is initially the owner of the MSC, but if desired can be changed later by the current owner to a different owner. If the SC is upgradeable, the owner can also upgrade the SC. @@ -79,4 +79,4 @@ MSC is a deployable SC written in Rust and compiled in WASM. ## Conclusion -Multisig accounts are a critical safety feature for all users of the Elrond ecosystem. Decentralised applications will rely heavily upon multisig security. +Multisig accounts are a critical safety feature for all users of the MultiversX ecosystem. Decentralised applications will rely heavily upon multisig security. diff --git a/contracts/examples/multisig/interact-rs/Cargo.toml b/contracts/examples/multisig/interact-rs/Cargo.toml index 81faf4d203..b1df6ae41e 100644 --- a/contracts/examples/multisig/interact-rs/Cargo.toml +++ b/contracts/examples/multisig/interact-rs/Cargo.toml @@ -13,9 +13,9 @@ path = "src/multisig_interact.rs" path = ".." [dependencies.multiversx-sc-modules] -version = "0.39.7" +version = "0.41.3" path = "../../../../contracts/modules" [dependencies.multiversx-sc-snippets] -version = "0.39.7" +version = "0.41.3" path = "../../../../framework/snippets" diff --git a/contracts/examples/multisig/interact-rs/state.toml b/contracts/examples/multisig/interact-rs/state.toml new file mode 100644 index 0000000000..1368fc8693 --- /dev/null +++ b/contracts/examples/multisig/interact-rs/state.toml @@ -0,0 +1 @@ +multisig_address = "bech32:erd1qqqqqqqqqqqqqpgq4zwnar0qxtrrlsfj3gfdqfnlgzvyt020a4squ8uhe5" diff --git a/contracts/examples/multisig/meta/Cargo.toml b/contracts/examples/multisig/meta/Cargo.toml index a1084a386b..28524f8119 100644 --- a/contracts/examples/multisig/meta/Cargo.toml +++ b/contracts/examples/multisig/meta/Cargo.toml @@ -9,5 +9,5 @@ publish = false path = ".." [dependencies.multiversx-sc-meta] -version = "0.39.7" +version = "0.41.3" path = "../../../../framework/meta" diff --git a/contracts/examples/multisig/tests/multisig_scenario_go_test.rs b/contracts/examples/multisig/tests/multisig_scenario_go_test.rs index 2510fbe062..7ff49bb1b5 100644 --- a/contracts/examples/multisig/tests/multisig_scenario_go_test.rs +++ b/contracts/examples/multisig/tests/multisig_scenario_go_test.rs @@ -8,44 +8,38 @@ fn call_other_shard_2_go() { multiversx_sc_scenario::run_go("scenarios/call_other_shard-2.scen.json"); } -#[ignore] -#[test] -fn call_other_shard_insufficient_gas_go() { - multiversx_sc_scenario::run_go("scenarios/call_other_shard-insufficient-gas.scen.json"); -} - #[test] -fn changeboard_go() { +fn change_board_go() { multiversx_sc_scenario::run_go("scenarios/changeBoard.scen.json"); } #[test] -fn changequorum_go() { +fn change_quorum_go() { multiversx_sc_scenario::run_go("scenarios/changeQuorum.scen.json"); } #[test] -fn changequorum_toobig_go() { +fn change_quorum_too_big_go() { multiversx_sc_scenario::run_go("scenarios/changeQuorum_tooBig.scen.json"); } #[test] -fn deployadder_err_go() { +fn deploy_adder_err_go() { multiversx_sc_scenario::run_go("scenarios/deployAdder_err.scen.json"); } #[test] -fn deployadder_then_call_go() { +fn deploy_adder_then_call_go() { multiversx_sc_scenario::run_go("scenarios/deployAdder_then_call.scen.json"); } #[test] -fn deployfactorial_go() { +fn deploy_factorial_go() { multiversx_sc_scenario::run_go("scenarios/deployFactorial.scen.json"); } #[test] -fn deployothermultisig_go() { +fn deploy_other_multisig_go() { multiversx_sc_scenario::run_go("scenarios/deployOtherMultisig.scen.json"); } @@ -60,9 +54,9 @@ fn remove_everyone_go() { } // TODO: investigate gas issue -#[ignore] #[test] -fn sendesdt_go() { +#[ignore] +fn send_esdt_go() { multiversx_sc_scenario::run_go("scenarios/sendEsdt.scen.json"); } diff --git a/contracts/examples/multisig/tests/multisig_scenario_rs_test.rs b/contracts/examples/multisig/tests/multisig_scenario_rs_test.rs index 384604d8c9..7f87ba8223 100644 --- a/contracts/examples/multisig/tests/multisig_scenario_rs_test.rs +++ b/contracts/examples/multisig/tests/multisig_scenario_rs_test.rs @@ -25,50 +25,50 @@ fn world() -> ScenarioWorld { blockchain } -#[ignore] #[test] +#[ignore] fn call_other_shard_1_rs() { multiversx_sc_scenario::run_rs("scenarios/call_other_shard-1.scen.json", world()); } -#[ignore] #[test] +#[ignore] fn call_other_shard_2_rs() { multiversx_sc_scenario::run_rs("scenarios/call_other_shard-2.scen.json", world()); } #[test] -fn changeboard_rs() { +fn change_board_rs() { multiversx_sc_scenario::run_rs("scenarios/changeBoard.scen.json", world()); } #[test] -fn changequorum_rs() { +fn change_quorum_rs() { multiversx_sc_scenario::run_rs("scenarios/changeQuorum.scen.json", world()); } #[test] -fn changequorum_toobig_rs() { +fn change_quorum_too_big_rs() { multiversx_sc_scenario::run_rs("scenarios/changeQuorum_tooBig.scen.json", world()); } #[test] -fn deployadder_err_rs() { +fn deploy_adder_err_rs() { multiversx_sc_scenario::run_rs("scenarios/deployAdder_err.scen.json", world()); } #[test] -fn deployadder_then_call_rs() { +fn deploy_adder_then_call_rs() { multiversx_sc_scenario::run_rs("scenarios/deployAdder_then_call.scen.json", world()); } #[test] -fn deployfactorial_rs() { +fn deploy_factorial_rs() { multiversx_sc_scenario::run_rs("scenarios/deployFactorial.scen.json", world()); } #[test] -fn deployothermultisig_rs() { +fn deploy_other_multisig_rs() { multiversx_sc_scenario::run_rs("scenarios/deployOtherMultisig.scen.json", world()); } @@ -83,7 +83,7 @@ fn remove_everyone_rs() { } #[test] -fn sendesdt_rs() { +fn send_esdt_rs() { multiversx_sc_scenario::run_rs("scenarios/sendEsdt.scen.json", world()); } diff --git a/contracts/examples/multisig/wasm-multisig-full/Cargo.lock b/contracts/examples/multisig/wasm-multisig-full/Cargo.lock index 7a49b8c53f..923a298a14 100644 --- a/contracts/examples/multisig/wasm-multisig-full/Cargo.lock +++ b/contracts/examples/multisig/wasm-multisig-full/Cargo.lock @@ -8,16 +8,16 @@ version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "once_cell", "version_check", ] [[package]] name = "arrayvec" -version = "0.7.2" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" +checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" [[package]] name = "autocfg" @@ -31,12 +31,6 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" -[[package]] -name = "cfg-if" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" - [[package]] name = "cfg-if" version = "1.0.0" @@ -70,18 +64,6 @@ version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ebdb29d2ea9ed0083cd8cece49bbd968021bd99b0849edb4a9a7ee0fdf6a4e0" -[[package]] -name = "libc" -version = "0.2.140" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99227334921fae1a979cf0bfdfcc6b3e5ce376ef57e16fb6fb3ea2ed6095f80c" - -[[package]] -name = "memory_units" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8452105ba047068f40ff7093dd1d9da90898e63dd61736462e9cdda6a90ad3c3" - [[package]] name = "multisig" version = "1.0.0" @@ -100,7 +82,7 @@ dependencies = [ [[package]] name = "multiversx-sc" -version = "0.39.7" +version = "0.41.3" dependencies = [ "bitflags", "hashbrown", @@ -112,7 +94,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.17.1" +version = "0.17.2" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -120,7 +102,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.17.1" +version = "0.17.2" dependencies = [ "hex", "proc-macro2", @@ -130,7 +112,7 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.39.7" +version = "0.41.3" dependencies = [ "hex", "proc-macro2", @@ -141,17 +123,16 @@ dependencies = [ [[package]] name = "multiversx-sc-modules" -version = "0.39.7" +version = "0.41.3" dependencies = [ "multiversx-sc", ] [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.39.7" +version = "0.41.3" dependencies = [ "multiversx-sc", - "wee_alloc", ] [[package]] @@ -174,24 +155,24 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.17.1" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" +checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" [[package]] name = "proc-macro2" -version = "1.0.52" +version = "1.0.63" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d0e1ae9e836cc3beddd63db0df682593d7e2d3d891ae8c9083d2113e1744224" +checksum = "7b368fba921b0dce7e60f5e04ec15e565b3303972b42bcfde1d0713b881959eb" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.26" +version = "1.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4424af4bf778aae2051a77b60283332f386554255d722233d09fbfc7e30da2fc" +checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488" dependencies = [ "proc-macro2", ] @@ -225,46 +206,12 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.8" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4" +checksum = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0" [[package]] name = "version_check" version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" - -[[package]] -name = "wee_alloc" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbb3b5a6b2bb17cb6ad44a2e68a43e8d2722c997da10e928665c72ec6c0a0b8e" -dependencies = [ - "cfg-if 0.1.10", - "libc", - "memory_units", - "winapi", -] - -[[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-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" diff --git a/contracts/examples/multisig/wasm-multisig-full/Cargo.toml b/contracts/examples/multisig/wasm-multisig-full/Cargo.toml index 6d0181f0c8..a3ef8a96f3 100644 --- a/contracts/examples/multisig/wasm-multisig-full/Cargo.toml +++ b/contracts/examples/multisig/wasm-multisig-full/Cargo.toml @@ -17,7 +17,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.39.7" +version = "0.41.3" path = "../../../../framework/wasm-adapter" [workspace] diff --git a/contracts/examples/multisig/wasm-multisig-full/src/lib.rs b/contracts/examples/multisig/wasm-multisig-full/src/lib.rs index f0b2430237..4a7ec575b3 100644 --- a/contracts/examples/multisig/wasm-multisig-full/src/lib.rs +++ b/contracts/examples/multisig/wasm-multisig-full/src/lib.rs @@ -10,7 +10,7 @@ // Total number of exported functions: 30 #![no_std] -#![feature(alloc_error_handler, lang_items)] +#![feature(lang_items)] multiversx_sc_wasm_adapter::allocator!(); multiversx_sc_wasm_adapter::panic_handler!(); diff --git a/contracts/examples/multisig/wasm-multisig-view/Cargo.lock b/contracts/examples/multisig/wasm-multisig-view/Cargo.lock index a2ce2222f2..155cb6ea9e 100644 --- a/contracts/examples/multisig/wasm-multisig-view/Cargo.lock +++ b/contracts/examples/multisig/wasm-multisig-view/Cargo.lock @@ -8,16 +8,16 @@ version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "once_cell", "version_check", ] [[package]] name = "arrayvec" -version = "0.7.2" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" +checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" [[package]] name = "autocfg" @@ -31,12 +31,6 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" -[[package]] -name = "cfg-if" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" - [[package]] name = "cfg-if" version = "1.0.0" @@ -70,18 +64,6 @@ version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ebdb29d2ea9ed0083cd8cece49bbd968021bd99b0849edb4a9a7ee0fdf6a4e0" -[[package]] -name = "libc" -version = "0.2.140" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99227334921fae1a979cf0bfdfcc6b3e5ce376ef57e16fb6fb3ea2ed6095f80c" - -[[package]] -name = "memory_units" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8452105ba047068f40ff7093dd1d9da90898e63dd61736462e9cdda6a90ad3c3" - [[package]] name = "multisig" version = "1.0.0" @@ -100,7 +82,7 @@ dependencies = [ [[package]] name = "multiversx-sc" -version = "0.39.7" +version = "0.41.3" dependencies = [ "bitflags", "hashbrown", @@ -112,7 +94,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.17.1" +version = "0.17.2" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -120,7 +102,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.17.1" +version = "0.17.2" dependencies = [ "hex", "proc-macro2", @@ -130,7 +112,7 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.39.7" +version = "0.41.3" dependencies = [ "hex", "proc-macro2", @@ -141,17 +123,16 @@ dependencies = [ [[package]] name = "multiversx-sc-modules" -version = "0.39.7" +version = "0.41.3" dependencies = [ "multiversx-sc", ] [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.39.7" +version = "0.41.3" dependencies = [ "multiversx-sc", - "wee_alloc", ] [[package]] @@ -174,24 +155,24 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.17.1" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" +checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" [[package]] name = "proc-macro2" -version = "1.0.52" +version = "1.0.63" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d0e1ae9e836cc3beddd63db0df682593d7e2d3d891ae8c9083d2113e1744224" +checksum = "7b368fba921b0dce7e60f5e04ec15e565b3303972b42bcfde1d0713b881959eb" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.26" +version = "1.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4424af4bf778aae2051a77b60283332f386554255d722233d09fbfc7e30da2fc" +checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488" dependencies = [ "proc-macro2", ] @@ -225,46 +206,12 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.8" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4" +checksum = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0" [[package]] name = "version_check" version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" - -[[package]] -name = "wee_alloc" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbb3b5a6b2bb17cb6ad44a2e68a43e8d2722c997da10e928665c72ec6c0a0b8e" -dependencies = [ - "cfg-if 0.1.10", - "libc", - "memory_units", - "winapi", -] - -[[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-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" diff --git a/contracts/examples/multisig/wasm-multisig-view/Cargo.toml b/contracts/examples/multisig/wasm-multisig-view/Cargo.toml index a4debf5749..3300667614 100644 --- a/contracts/examples/multisig/wasm-multisig-view/Cargo.toml +++ b/contracts/examples/multisig/wasm-multisig-view/Cargo.toml @@ -17,7 +17,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.39.7" +version = "0.41.3" path = "../../../../framework/wasm-adapter" [workspace] diff --git a/contracts/examples/multisig/wasm-multisig-view/src/lib.rs b/contracts/examples/multisig/wasm-multisig-view/src/lib.rs index 74b6389ef5..f601b68a32 100644 --- a/contracts/examples/multisig/wasm-multisig-view/src/lib.rs +++ b/contracts/examples/multisig/wasm-multisig-view/src/lib.rs @@ -10,7 +10,7 @@ // Total number of exported functions: 10 #![no_std] -#![feature(alloc_error_handler, lang_items)] +#![feature(lang_items)] multiversx_sc_wasm_adapter::allocator!(); multiversx_sc_wasm_adapter::panic_handler!(); diff --git a/contracts/examples/multisig/wasm/Cargo.lock b/contracts/examples/multisig/wasm/Cargo.lock index 42089f277b..9cac86ca9e 100755 --- a/contracts/examples/multisig/wasm/Cargo.lock +++ b/contracts/examples/multisig/wasm/Cargo.lock @@ -8,16 +8,16 @@ version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "once_cell", "version_check", ] [[package]] name = "arrayvec" -version = "0.7.2" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" +checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" [[package]] name = "autocfg" @@ -31,12 +31,6 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" -[[package]] -name = "cfg-if" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" - [[package]] name = "cfg-if" version = "1.0.0" @@ -70,18 +64,6 @@ version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ebdb29d2ea9ed0083cd8cece49bbd968021bd99b0849edb4a9a7ee0fdf6a4e0" -[[package]] -name = "libc" -version = "0.2.140" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99227334921fae1a979cf0bfdfcc6b3e5ce376ef57e16fb6fb3ea2ed6095f80c" - -[[package]] -name = "memory_units" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8452105ba047068f40ff7093dd1d9da90898e63dd61736462e9cdda6a90ad3c3" - [[package]] name = "multisig" version = "1.0.0" @@ -100,7 +82,7 @@ dependencies = [ [[package]] name = "multiversx-sc" -version = "0.39.7" +version = "0.41.3" dependencies = [ "bitflags", "hashbrown", @@ -112,7 +94,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.17.1" +version = "0.17.2" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -120,7 +102,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.17.1" +version = "0.17.2" dependencies = [ "hex", "proc-macro2", @@ -130,7 +112,7 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.39.7" +version = "0.41.3" dependencies = [ "hex", "proc-macro2", @@ -141,17 +123,16 @@ dependencies = [ [[package]] name = "multiversx-sc-modules" -version = "0.39.7" +version = "0.41.3" dependencies = [ "multiversx-sc", ] [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.39.7" +version = "0.41.3" dependencies = [ "multiversx-sc", - "wee_alloc", ] [[package]] @@ -174,24 +155,24 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.17.1" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" +checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" [[package]] name = "proc-macro2" -version = "1.0.52" +version = "1.0.63" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d0e1ae9e836cc3beddd63db0df682593d7e2d3d891ae8c9083d2113e1744224" +checksum = "7b368fba921b0dce7e60f5e04ec15e565b3303972b42bcfde1d0713b881959eb" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.26" +version = "1.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4424af4bf778aae2051a77b60283332f386554255d722233d09fbfc7e30da2fc" +checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488" dependencies = [ "proc-macro2", ] @@ -225,46 +206,12 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.8" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4" +checksum = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0" [[package]] name = "version_check" version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" - -[[package]] -name = "wee_alloc" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbb3b5a6b2bb17cb6ad44a2e68a43e8d2722c997da10e928665c72ec6c0a0b8e" -dependencies = [ - "cfg-if 0.1.10", - "libc", - "memory_units", - "winapi", -] - -[[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-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" diff --git a/contracts/examples/multisig/wasm/Cargo.toml b/contracts/examples/multisig/wasm/Cargo.toml index b1361613d0..fcfd8dbd72 100644 --- a/contracts/examples/multisig/wasm/Cargo.toml +++ b/contracts/examples/multisig/wasm/Cargo.toml @@ -19,7 +19,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.39.7" +version = "0.41.3" path = "../../../../framework/wasm-adapter" [workspace] diff --git a/contracts/examples/multisig/wasm/src/lib.rs b/contracts/examples/multisig/wasm/src/lib.rs index dc3d22f861..d125f10c33 100644 --- a/contracts/examples/multisig/wasm/src/lib.rs +++ b/contracts/examples/multisig/wasm/src/lib.rs @@ -10,7 +10,7 @@ // Total number of exported functions: 22 #![no_std] -#![feature(alloc_error_handler, lang_items)] +#![feature(lang_items)] multiversx_sc_wasm_adapter::allocator!(); multiversx_sc_wasm_adapter::panic_handler!(); diff --git a/contracts/examples/nft-minter/Cargo.toml b/contracts/examples/nft-minter/Cargo.toml index 46bbd3a6fa..001132a040 100644 --- a/contracts/examples/nft-minter/Cargo.toml +++ b/contracts/examples/nft-minter/Cargo.toml @@ -9,9 +9,9 @@ publish = false path = "src/lib.rs" [dependencies.multiversx-sc] -version = "0.39.7" +version = "0.41.3" path = "../../../framework/base" [dev-dependencies.multiversx-sc-scenario] -version = "0.39.7" +version = "0.41.3" path = "../../../framework/scenario" diff --git a/contracts/examples/nft-minter/meta/Cargo.toml b/contracts/examples/nft-minter/meta/Cargo.toml index 8750e4e88a..1b41543421 100644 --- a/contracts/examples/nft-minter/meta/Cargo.toml +++ b/contracts/examples/nft-minter/meta/Cargo.toml @@ -9,5 +9,5 @@ publish = false path = ".." [dependencies.multiversx-sc-meta] -version = "0.39.7" +version = "0.41.3" path = "../../../../framework/meta" diff --git a/contracts/examples/nft-minter/src/nft_module.rs b/contracts/examples/nft-minter/src/nft_module.rs index e72d40ff23..5643201724 100644 --- a/contracts/examples/nft-minter/src/nft_module.rs +++ b/contracts/examples/nft-minter/src/nft_module.rs @@ -25,7 +25,7 @@ pub trait NftModule { self.send() .esdt_system_sc_proxy() .issue_non_fungible( - payment_amount, + payment_amount.clone_value(), &token_name, &token_ticker, NonFungibleTokenProperties { diff --git a/contracts/examples/nft-minter/tests/nft_minter_scenario_rs_test.rs b/contracts/examples/nft-minter/tests/nft_minter_scenario_rs_test.rs new file mode 100644 index 0000000000..8d79be9d27 --- /dev/null +++ b/contracts/examples/nft-minter/tests/nft_minter_scenario_rs_test.rs @@ -0,0 +1,23 @@ +use multiversx_sc_scenario::*; + +fn world() -> ScenarioWorld { + todo!() +} + +#[test] +#[ignore = "not supported"] +fn buy_nft_rs() { + multiversx_sc_scenario::run_rs("scenarios/buy_nft.scen.json", world()); +} + +#[test] +#[ignore = "not supported"] +fn create_nft_rs() { + multiversx_sc_scenario::run_rs("scenarios/create_nft.scen.json", world()); +} + +#[test] +#[ignore = "not supported"] +fn init_rs() { + multiversx_sc_scenario::run_rs("scenarios/init.scen.json", world()); +} diff --git a/contracts/examples/nft-minter/tests/scenario_go_test.rs b/contracts/examples/nft-minter/tests/scenario_go_test.rs index 2484bcdf31..bbac38ff10 100644 --- a/contracts/examples/nft-minter/tests/scenario_go_test.rs +++ b/contracts/examples/nft-minter/tests/scenario_go_test.rs @@ -1,6 +1,6 @@ #[test] -fn init_go() { - multiversx_sc_scenario::run_go("scenarios/init.scen.json"); +fn buy_nft_go() { + multiversx_sc_scenario::run_go("scenarios/buy_nft.scen.json"); } #[test] @@ -9,6 +9,6 @@ fn create_nft_go() { } #[test] -fn buy_nft_go() { - multiversx_sc_scenario::run_go("scenarios/buy_nft.scen.json"); +fn init_go() { + multiversx_sc_scenario::run_go("scenarios/init.scen.json"); } diff --git a/contracts/examples/nft-minter/wasm/Cargo.lock b/contracts/examples/nft-minter/wasm/Cargo.lock index c07b7a0538..a9e70ac54d 100644 --- a/contracts/examples/nft-minter/wasm/Cargo.lock +++ b/contracts/examples/nft-minter/wasm/Cargo.lock @@ -8,16 +8,16 @@ version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "once_cell", "version_check", ] [[package]] name = "arrayvec" -version = "0.7.2" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" +checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" [[package]] name = "autocfg" @@ -31,12 +31,6 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" -[[package]] -name = "cfg-if" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" - [[package]] name = "cfg-if" version = "1.0.0" @@ -70,21 +64,9 @@ version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ebdb29d2ea9ed0083cd8cece49bbd968021bd99b0849edb4a9a7ee0fdf6a4e0" -[[package]] -name = "libc" -version = "0.2.140" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99227334921fae1a979cf0bfdfcc6b3e5ce376ef57e16fb6fb3ea2ed6095f80c" - -[[package]] -name = "memory_units" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8452105ba047068f40ff7093dd1d9da90898e63dd61736462e9cdda6a90ad3c3" - [[package]] name = "multiversx-sc" -version = "0.39.7" +version = "0.41.3" dependencies = [ "bitflags", "hashbrown", @@ -96,7 +78,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.17.1" +version = "0.17.2" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -104,7 +86,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.17.1" +version = "0.17.2" dependencies = [ "hex", "proc-macro2", @@ -114,7 +96,7 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.39.7" +version = "0.41.3" dependencies = [ "hex", "proc-macro2", @@ -125,10 +107,9 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.39.7" +version = "0.41.3" dependencies = [ "multiversx-sc", - "wee_alloc", ] [[package]] @@ -166,24 +147,24 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.17.1" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" +checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" [[package]] name = "proc-macro2" -version = "1.0.52" +version = "1.0.63" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d0e1ae9e836cc3beddd63db0df682593d7e2d3d891ae8c9083d2113e1744224" +checksum = "7b368fba921b0dce7e60f5e04ec15e565b3303972b42bcfde1d0713b881959eb" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.26" +version = "1.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4424af4bf778aae2051a77b60283332f386554255d722233d09fbfc7e30da2fc" +checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488" dependencies = [ "proc-macro2", ] @@ -217,46 +198,12 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.8" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4" +checksum = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0" [[package]] name = "version_check" version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" - -[[package]] -name = "wee_alloc" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbb3b5a6b2bb17cb6ad44a2e68a43e8d2722c997da10e928665c72ec6c0a0b8e" -dependencies = [ - "cfg-if 0.1.10", - "libc", - "memory_units", - "winapi", -] - -[[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-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" diff --git a/contracts/examples/nft-minter/wasm/Cargo.toml b/contracts/examples/nft-minter/wasm/Cargo.toml index 760a91e361..532ab8749a 100644 --- a/contracts/examples/nft-minter/wasm/Cargo.toml +++ b/contracts/examples/nft-minter/wasm/Cargo.toml @@ -19,7 +19,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.39.7" +version = "0.41.3" path = "../../../../framework/wasm-adapter" [workspace] diff --git a/contracts/examples/nft-minter/wasm/src/lib.rs b/contracts/examples/nft-minter/wasm/src/lib.rs index ff469303e9..645eee95ff 100644 --- a/contracts/examples/nft-minter/wasm/src/lib.rs +++ b/contracts/examples/nft-minter/wasm/src/lib.rs @@ -10,7 +10,7 @@ // Total number of exported functions: 8 #![no_std] -#![feature(alloc_error_handler, lang_items)] +#![feature(lang_items)] multiversx_sc_wasm_adapter::allocator!(); multiversx_sc_wasm_adapter::panic_handler!(); diff --git a/contracts/examples/nft-storage-prepay/Cargo.toml b/contracts/examples/nft-storage-prepay/Cargo.toml index bd09d87173..d7cadb9314 100644 --- a/contracts/examples/nft-storage-prepay/Cargo.toml +++ b/contracts/examples/nft-storage-prepay/Cargo.toml @@ -10,9 +10,9 @@ path = "src/nft_storage_prepay.rs" [dependencies.multiversx-sc] -version = "0.39.7" +version = "0.41.3" path = "../../../framework/base" [dev-dependencies.multiversx-sc-scenario] -version = "0.39.7" +version = "0.41.3" path = "../../../framework/scenario" diff --git a/contracts/examples/nft-storage-prepay/meta/Cargo.toml b/contracts/examples/nft-storage-prepay/meta/Cargo.toml index 796e195116..d1d6842600 100644 --- a/contracts/examples/nft-storage-prepay/meta/Cargo.toml +++ b/contracts/examples/nft-storage-prepay/meta/Cargo.toml @@ -11,5 +11,5 @@ publish = false path = ".." [dependencies.multiversx-sc-meta] -version = "0.39.7" +version = "0.41.3" path = "../../../../framework/meta" diff --git a/contracts/examples/nft-storage-prepay/src/nft_storage_prepay.rs b/contracts/examples/nft-storage-prepay/src/nft_storage_prepay.rs index 597aa613f3..e546da11e3 100644 --- a/contracts/examples/nft-storage-prepay/src/nft_storage_prepay.rs +++ b/contracts/examples/nft-storage-prepay/src/nft_storage_prepay.rs @@ -52,7 +52,8 @@ pub trait NftStoragePrepay { fn deposit_payment_for_storage(&self) { let payment = self.call_value().egld_value(); let caller = self.blockchain().get_caller(); - self.deposit(&caller).update(|deposit| *deposit += payment); + self.deposit(&caller) + .update(|deposit| *deposit += &*payment); } /// defaults to max amount diff --git a/contracts/examples/nft-storage-prepay/wasm/Cargo.lock b/contracts/examples/nft-storage-prepay/wasm/Cargo.lock index 525a99005c..7e2546abbb 100755 --- a/contracts/examples/nft-storage-prepay/wasm/Cargo.lock +++ b/contracts/examples/nft-storage-prepay/wasm/Cargo.lock @@ -8,16 +8,16 @@ version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "once_cell", "version_check", ] [[package]] name = "arrayvec" -version = "0.7.2" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" +checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" [[package]] name = "autocfg" @@ -31,12 +31,6 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" -[[package]] -name = "cfg-if" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" - [[package]] name = "cfg-if" version = "1.0.0" @@ -70,21 +64,9 @@ version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ebdb29d2ea9ed0083cd8cece49bbd968021bd99b0849edb4a9a7ee0fdf6a4e0" -[[package]] -name = "libc" -version = "0.2.140" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99227334921fae1a979cf0bfdfcc6b3e5ce376ef57e16fb6fb3ea2ed6095f80c" - -[[package]] -name = "memory_units" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8452105ba047068f40ff7093dd1d9da90898e63dd61736462e9cdda6a90ad3c3" - [[package]] name = "multiversx-sc" -version = "0.39.7" +version = "0.41.3" dependencies = [ "bitflags", "hashbrown", @@ -96,7 +78,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.17.1" +version = "0.17.2" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -104,7 +86,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.17.1" +version = "0.17.2" dependencies = [ "hex", "proc-macro2", @@ -114,7 +96,7 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.39.7" +version = "0.41.3" dependencies = [ "hex", "proc-macro2", @@ -125,10 +107,9 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.39.7" +version = "0.41.3" dependencies = [ "multiversx-sc", - "wee_alloc", ] [[package]] @@ -166,24 +147,24 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.17.1" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" +checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" [[package]] name = "proc-macro2" -version = "1.0.52" +version = "1.0.63" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d0e1ae9e836cc3beddd63db0df682593d7e2d3d891ae8c9083d2113e1744224" +checksum = "7b368fba921b0dce7e60f5e04ec15e565b3303972b42bcfde1d0713b881959eb" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.26" +version = "1.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4424af4bf778aae2051a77b60283332f386554255d722233d09fbfc7e30da2fc" +checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488" dependencies = [ "proc-macro2", ] @@ -217,46 +198,12 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.8" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4" +checksum = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0" [[package]] name = "version_check" version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" - -[[package]] -name = "wee_alloc" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbb3b5a6b2bb17cb6ad44a2e68a43e8d2722c997da10e928665c72ec6c0a0b8e" -dependencies = [ - "cfg-if 0.1.10", - "libc", - "memory_units", - "winapi", -] - -[[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-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" diff --git a/contracts/examples/nft-storage-prepay/wasm/Cargo.toml b/contracts/examples/nft-storage-prepay/wasm/Cargo.toml index 6d0e0d4269..fec13ec010 100644 --- a/contracts/examples/nft-storage-prepay/wasm/Cargo.toml +++ b/contracts/examples/nft-storage-prepay/wasm/Cargo.toml @@ -24,5 +24,5 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.39.7" +version = "0.41.3" path = "../../../../framework/wasm-adapter" diff --git a/contracts/examples/nft-storage-prepay/wasm/src/lib.rs b/contracts/examples/nft-storage-prepay/wasm/src/lib.rs index 8f4d215925..96723df723 100644 --- a/contracts/examples/nft-storage-prepay/wasm/src/lib.rs +++ b/contracts/examples/nft-storage-prepay/wasm/src/lib.rs @@ -10,7 +10,7 @@ // Total number of exported functions: 10 #![no_std] -#![feature(alloc_error_handler, lang_items)] +#![feature(lang_items)] multiversx_sc_wasm_adapter::allocator!(); multiversx_sc_wasm_adapter::panic_handler!(); diff --git a/contracts/examples/order-book/.gitignore b/contracts/examples/order-book/.gitignore index 7840166905..0a5dc603ac 100644 --- a/contracts/examples/order-book/.gitignore +++ b/contracts/examples/order-book/.gitignore @@ -1,4 +1,4 @@ -# Elrond IDE +# IDE **/node_modules **/output/** **/testnet/** diff --git a/contracts/examples/order-book/factory/Cargo.toml b/contracts/examples/order-book/factory/Cargo.toml index 73227e46a7..9f03b3b36d 100644 --- a/contracts/examples/order-book/factory/Cargo.toml +++ b/contracts/examples/order-book/factory/Cargo.toml @@ -8,10 +8,10 @@ publish = false path = "src/lib.rs" [dependencies.multiversx-sc] -version = "0.39.7" +version = "0.41.3" path = "../../../../framework/base" [dev-dependencies.multiversx-sc-scenario] -version = "0.39.7" +version = "0.41.3" path = "../../../../framework/scenario" diff --git a/contracts/examples/order-book/factory/meta/Cargo.toml b/contracts/examples/order-book/factory/meta/Cargo.toml index 1ba5eebd52..25925512aa 100644 --- a/contracts/examples/order-book/factory/meta/Cargo.toml +++ b/contracts/examples/order-book/factory/meta/Cargo.toml @@ -9,5 +9,5 @@ publish = false path = ".." [dependencies.multiversx-sc-meta] -version = "0.39.7" +version = "0.41.3" path = "../../../../../framework/meta" diff --git a/contracts/examples/order-book/factory/wasm/Cargo.lock b/contracts/examples/order-book/factory/wasm/Cargo.lock index 69777e4a17..31fc1fed7d 100644 --- a/contracts/examples/order-book/factory/wasm/Cargo.lock +++ b/contracts/examples/order-book/factory/wasm/Cargo.lock @@ -8,16 +8,16 @@ version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "once_cell", "version_check", ] [[package]] name = "arrayvec" -version = "0.7.2" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" +checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" [[package]] name = "autocfg" @@ -31,12 +31,6 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" -[[package]] -name = "cfg-if" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" - [[package]] name = "cfg-if" version = "1.0.0" @@ -70,21 +64,9 @@ version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ebdb29d2ea9ed0083cd8cece49bbd968021bd99b0849edb4a9a7ee0fdf6a4e0" -[[package]] -name = "libc" -version = "0.2.140" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99227334921fae1a979cf0bfdfcc6b3e5ce376ef57e16fb6fb3ea2ed6095f80c" - -[[package]] -name = "memory_units" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8452105ba047068f40ff7093dd1d9da90898e63dd61736462e9cdda6a90ad3c3" - [[package]] name = "multiversx-sc" -version = "0.39.7" +version = "0.41.3" dependencies = [ "bitflags", "hashbrown", @@ -96,7 +78,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.17.1" +version = "0.17.2" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -104,7 +86,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.17.1" +version = "0.17.2" dependencies = [ "hex", "proc-macro2", @@ -114,7 +96,7 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.39.7" +version = "0.41.3" dependencies = [ "hex", "proc-macro2", @@ -125,10 +107,9 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.39.7" +version = "0.41.3" dependencies = [ "multiversx-sc", - "wee_alloc", ] [[package]] @@ -151,9 +132,9 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.17.1" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" +checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" [[package]] name = "order-book-factory" @@ -172,18 +153,18 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.52" +version = "1.0.63" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d0e1ae9e836cc3beddd63db0df682593d7e2d3d891ae8c9083d2113e1744224" +checksum = "7b368fba921b0dce7e60f5e04ec15e565b3303972b42bcfde1d0713b881959eb" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.26" +version = "1.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4424af4bf778aae2051a77b60283332f386554255d722233d09fbfc7e30da2fc" +checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488" dependencies = [ "proc-macro2", ] @@ -217,46 +198,12 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.8" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4" +checksum = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0" [[package]] name = "version_check" version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" - -[[package]] -name = "wee_alloc" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbb3b5a6b2bb17cb6ad44a2e68a43e8d2722c997da10e928665c72ec6c0a0b8e" -dependencies = [ - "cfg-if 0.1.10", - "libc", - "memory_units", - "winapi", -] - -[[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-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" diff --git a/contracts/examples/order-book/factory/wasm/Cargo.toml b/contracts/examples/order-book/factory/wasm/Cargo.toml index 5d5acf139b..f351bb0c05 100644 --- a/contracts/examples/order-book/factory/wasm/Cargo.toml +++ b/contracts/examples/order-book/factory/wasm/Cargo.toml @@ -23,5 +23,5 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.39.7" +version = "0.41.3" path = "../../../../../framework/wasm-adapter" diff --git a/contracts/examples/order-book/factory/wasm/src/lib.rs b/contracts/examples/order-book/factory/wasm/src/lib.rs index 3ba7eb510c..448317617b 100644 --- a/contracts/examples/order-book/factory/wasm/src/lib.rs +++ b/contracts/examples/order-book/factory/wasm/src/lib.rs @@ -10,7 +10,7 @@ // Total number of exported functions: 4 #![no_std] -#![feature(alloc_error_handler, lang_items)] +#![feature(lang_items)] multiversx_sc_wasm_adapter::allocator!(); multiversx_sc_wasm_adapter::panic_handler!(); diff --git a/contracts/examples/order-book/pair/Cargo.toml b/contracts/examples/order-book/pair/Cargo.toml index 812e60f491..035ce9e013 100644 --- a/contracts/examples/order-book/pair/Cargo.toml +++ b/contracts/examples/order-book/pair/Cargo.toml @@ -8,6 +8,9 @@ publish = false path = "src/lib.rs" [dependencies.multiversx-sc] -version = "0.39.7" +version = "0.41.3" path = "../../../../framework/base" -features = ["alloc"] + +[dev-dependencies.multiversx-sc-scenario] +version = "0.41.3" +path = "../../../../framework/scenario" diff --git a/contracts/examples/order-book/pair/meta/Cargo.toml b/contracts/examples/order-book/pair/meta/Cargo.toml index 2de3d0db70..579cf2a1ff 100644 --- a/contracts/examples/order-book/pair/meta/Cargo.toml +++ b/contracts/examples/order-book/pair/meta/Cargo.toml @@ -9,5 +9,5 @@ publish = false path = ".." [dependencies.multiversx-sc-meta] -version = "0.39.7" +version = "0.41.3" path = "../../../../../framework/meta" diff --git a/contracts/examples/order-book/pair/tests/pair_scenario_go_test.rs b/contracts/examples/order-book/pair/tests/pair_scenario_go_test.rs new file mode 100644 index 0000000000..2d3679c044 --- /dev/null +++ b/contracts/examples/order-book/pair/tests/pair_scenario_go_test.rs @@ -0,0 +1,29 @@ +#[test] +fn cancel_all_orders_go() { + multiversx_sc_scenario::run_go("scenarios/cancel_all_orders.scen.json"); +} + +#[test] +fn cancel_orders_go() { + multiversx_sc_scenario::run_go("scenarios/cancel_orders.scen.json"); +} + +#[test] +fn create_buy_order_check_go() { + multiversx_sc_scenario::run_go("scenarios/create_buy_order_check.scen.json"); +} + +#[test] +fn create_sell_order_check_go() { + multiversx_sc_scenario::run_go("scenarios/create_sell_order_check.scen.json"); +} + +#[test] +fn free_orders_go() { + multiversx_sc_scenario::run_go("scenarios/free_orders.scen.json"); +} + +#[test] +fn match_orders_go() { + multiversx_sc_scenario::run_go("scenarios/match_orders.scen.json"); +} diff --git a/contracts/examples/order-book/pair/tests/pair_scenario_rs_test.rs b/contracts/examples/order-book/pair/tests/pair_scenario_rs_test.rs new file mode 100644 index 0000000000..4209c833db --- /dev/null +++ b/contracts/examples/order-book/pair/tests/pair_scenario_rs_test.rs @@ -0,0 +1,42 @@ +use multiversx_sc_scenario::*; + +fn world() -> ScenarioWorld { + let mut blockchain = ScenarioWorld::new(); + blockchain.set_current_dir_from_workspace("contracts/examples/order-book/pair"); + + blockchain.register_contract( + "file:output/order-book-pair.wasm", + order_book_pair::ContractBuilder, + ); + blockchain +} + +#[test] +fn cancel_all_orders_rs() { + multiversx_sc_scenario::run_rs("scenarios/cancel_all_orders.scen.json", world()); +} + +#[test] +fn cancel_orders_rs() { + multiversx_sc_scenario::run_rs("scenarios/cancel_orders.scen.json", world()); +} + +#[test] +fn create_buy_order_check_rs() { + multiversx_sc_scenario::run_rs("scenarios/create_buy_order_check.scen.json", world()); +} + +#[test] +fn create_sell_order_check_rs() { + multiversx_sc_scenario::run_rs("scenarios/create_sell_order_check.scen.json", world()); +} + +#[test] +fn free_orders_rs() { + multiversx_sc_scenario::run_rs("scenarios/free_orders.scen.json", world()); +} + +#[test] +fn match_orders_rs() { + multiversx_sc_scenario::run_rs("scenarios/match_orders.scen.json", world()); +} diff --git a/contracts/examples/order-book/pair/wasm/Cargo.lock b/contracts/examples/order-book/pair/wasm/Cargo.lock index 774fffe1e3..2c650c20b5 100644 --- a/contracts/examples/order-book/pair/wasm/Cargo.lock +++ b/contracts/examples/order-book/pair/wasm/Cargo.lock @@ -8,16 +8,16 @@ version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "once_cell", "version_check", ] [[package]] name = "arrayvec" -version = "0.7.2" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" +checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" [[package]] name = "autocfg" @@ -31,12 +31,6 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" -[[package]] -name = "cfg-if" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" - [[package]] name = "cfg-if" version = "1.0.0" @@ -70,21 +64,9 @@ version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ebdb29d2ea9ed0083cd8cece49bbd968021bd99b0849edb4a9a7ee0fdf6a4e0" -[[package]] -name = "libc" -version = "0.2.140" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99227334921fae1a979cf0bfdfcc6b3e5ce376ef57e16fb6fb3ea2ed6095f80c" - -[[package]] -name = "memory_units" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8452105ba047068f40ff7093dd1d9da90898e63dd61736462e9cdda6a90ad3c3" - [[package]] name = "multiversx-sc" -version = "0.39.7" +version = "0.41.3" dependencies = [ "bitflags", "hashbrown", @@ -96,7 +78,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.17.1" +version = "0.17.2" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -104,7 +86,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.17.1" +version = "0.17.2" dependencies = [ "hex", "proc-macro2", @@ -114,7 +96,7 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.39.7" +version = "0.41.3" dependencies = [ "hex", "proc-macro2", @@ -125,10 +107,9 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.39.7" +version = "0.41.3" dependencies = [ "multiversx-sc", - "wee_alloc", ] [[package]] @@ -151,9 +132,9 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.17.1" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" +checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" [[package]] name = "order-book-pair" @@ -172,18 +153,18 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.52" +version = "1.0.63" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d0e1ae9e836cc3beddd63db0df682593d7e2d3d891ae8c9083d2113e1744224" +checksum = "7b368fba921b0dce7e60f5e04ec15e565b3303972b42bcfde1d0713b881959eb" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.26" +version = "1.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4424af4bf778aae2051a77b60283332f386554255d722233d09fbfc7e30da2fc" +checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488" dependencies = [ "proc-macro2", ] @@ -217,46 +198,12 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.8" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4" +checksum = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0" [[package]] name = "version_check" version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" - -[[package]] -name = "wee_alloc" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbb3b5a6b2bb17cb6ad44a2e68a43e8d2722c997da10e928665c72ec6c0a0b8e" -dependencies = [ - "cfg-if 0.1.10", - "libc", - "memory_units", - "winapi", -] - -[[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-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" diff --git a/contracts/examples/order-book/pair/wasm/Cargo.toml b/contracts/examples/order-book/pair/wasm/Cargo.toml index 6ebd761b2b..8e265bcee7 100644 --- a/contracts/examples/order-book/pair/wasm/Cargo.toml +++ b/contracts/examples/order-book/pair/wasm/Cargo.toml @@ -23,5 +23,5 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.39.7" +version = "0.41.3" path = "../../../../../framework/wasm-adapter" diff --git a/contracts/examples/order-book/pair/wasm/src/lib.rs b/contracts/examples/order-book/pair/wasm/src/lib.rs index 4d27cb65fa..4e4517ec04 100644 --- a/contracts/examples/order-book/pair/wasm/src/lib.rs +++ b/contracts/examples/order-book/pair/wasm/src/lib.rs @@ -10,7 +10,7 @@ // Total number of exported functions: 15 #![no_std] -#![feature(alloc_error_handler, lang_items)] +#![feature(lang_items)] multiversx_sc_wasm_adapter::allocator!(); multiversx_sc_wasm_adapter::panic_handler!(); diff --git a/contracts/examples/ping-pong-egld/Cargo.toml b/contracts/examples/ping-pong-egld/Cargo.toml index b2351a85df..59274a0639 100644 --- a/contracts/examples/ping-pong-egld/Cargo.toml +++ b/contracts/examples/ping-pong-egld/Cargo.toml @@ -9,10 +9,10 @@ publish = false path = "src/ping_pong.rs" [dependencies.multiversx-sc] -version = "0.39.7" +version = "0.41.3" path = "../../../framework/base" [dev-dependencies.multiversx-sc-scenario] -version = "0.39.7" +version = "0.41.3" path = "../../../framework/scenario" diff --git a/contracts/examples/ping-pong-egld/meta/Cargo.toml b/contracts/examples/ping-pong-egld/meta/Cargo.toml index 2a4b459d57..7fb2155153 100644 --- a/contracts/examples/ping-pong-egld/meta/Cargo.toml +++ b/contracts/examples/ping-pong-egld/meta/Cargo.toml @@ -9,5 +9,5 @@ publish = false path = ".." [dependencies.multiversx-sc-meta] -version = "0.39.7" +version = "0.41.3" path = "../../../../framework/meta" diff --git a/contracts/examples/ping-pong-egld/src/ping_pong.rs b/contracts/examples/ping-pong-egld/src/ping_pong.rs index fe51e96aa0..540db3783a 100644 --- a/contracts/examples/ping-pong-egld/src/ping_pong.rs +++ b/contracts/examples/ping-pong-egld/src/ping_pong.rs @@ -54,7 +54,7 @@ pub trait PingPong { let payment = self.call_value().egld_value(); require!( - payment == self.ping_amount().get(), + *payment == self.ping_amount().get(), "the payment must match the fixed sum" ); @@ -74,7 +74,7 @@ pub trait PingPong { &self .blockchain() .get_sc_balance(&EgldOrEsdtTokenIdentifier::egld(), 0) - + &payment + + &*payment <= max_funds, "smart contract full" ); diff --git a/contracts/examples/ping-pong-egld/tests/ping_pong_egld_scenario_rs_test.rs b/contracts/examples/ping-pong-egld/tests/ping_pong_egld_scenario_rs_test.rs index 47d1efeac3..d0070a0877 100644 --- a/contracts/examples/ping-pong-egld/tests/ping_pong_egld_scenario_rs_test.rs +++ b/contracts/examples/ping-pong-egld/tests/ping_pong_egld_scenario_rs_test.rs @@ -40,6 +40,14 @@ fn ping_pong_call_ping_before_activation_rs() { ); } +#[test] +fn ping_pong_call_ping_before_beginning_rs() { + multiversx_sc_scenario::run_rs( + "scenarios/ping-pong-call-ping-before-beginning.scen.json", + world(), + ); +} + #[test] fn ping_pong_call_ping_second_user_rs() { multiversx_sc_scenario::run_rs( @@ -79,6 +87,24 @@ fn ping_pong_call_pong_all_after_pong_rs() { ); } +#[test] +#[ignore = "unsupported, relies on gas"] +fn ping_pong_call_pong_all_interrupted_1_rs() { + multiversx_sc_scenario::run_rs( + "scenarios/ping-pong-call-pong-all-interrupted-1.scen.json", + world(), + ); +} + +#[test] +#[ignore = "unsupported, relies on gas"] +fn ping_pong_call_pong_all_interrupted_2_rs() { + multiversx_sc_scenario::run_rs( + "scenarios/ping-pong-call-pong-all-interrupted-2.scen.json", + world(), + ); +} + #[test] fn ping_pong_call_pong_before_deadline_rs() { multiversx_sc_scenario::run_rs( diff --git a/contracts/examples/ping-pong-egld/wasm/Cargo.lock b/contracts/examples/ping-pong-egld/wasm/Cargo.lock index 4aeaf83637..71bfce7647 100755 --- a/contracts/examples/ping-pong-egld/wasm/Cargo.lock +++ b/contracts/examples/ping-pong-egld/wasm/Cargo.lock @@ -8,16 +8,16 @@ version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "once_cell", "version_check", ] [[package]] name = "arrayvec" -version = "0.7.2" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" +checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" [[package]] name = "autocfg" @@ -31,12 +31,6 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" -[[package]] -name = "cfg-if" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" - [[package]] name = "cfg-if" version = "1.0.0" @@ -70,21 +64,9 @@ version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ebdb29d2ea9ed0083cd8cece49bbd968021bd99b0849edb4a9a7ee0fdf6a4e0" -[[package]] -name = "libc" -version = "0.2.140" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99227334921fae1a979cf0bfdfcc6b3e5ce376ef57e16fb6fb3ea2ed6095f80c" - -[[package]] -name = "memory_units" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8452105ba047068f40ff7093dd1d9da90898e63dd61736462e9cdda6a90ad3c3" - [[package]] name = "multiversx-sc" -version = "0.39.7" +version = "0.41.3" dependencies = [ "bitflags", "hashbrown", @@ -96,7 +78,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.17.1" +version = "0.17.2" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -104,7 +86,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.17.1" +version = "0.17.2" dependencies = [ "hex", "proc-macro2", @@ -114,7 +96,7 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.39.7" +version = "0.41.3" dependencies = [ "hex", "proc-macro2", @@ -125,10 +107,9 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.39.7" +version = "0.41.3" dependencies = [ "multiversx-sc", - "wee_alloc", ] [[package]] @@ -151,9 +132,9 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.17.1" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" +checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" [[package]] name = "ping-pong-egld" @@ -172,18 +153,18 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.52" +version = "1.0.63" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d0e1ae9e836cc3beddd63db0df682593d7e2d3d891ae8c9083d2113e1744224" +checksum = "7b368fba921b0dce7e60f5e04ec15e565b3303972b42bcfde1d0713b881959eb" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.26" +version = "1.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4424af4bf778aae2051a77b60283332f386554255d722233d09fbfc7e30da2fc" +checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488" dependencies = [ "proc-macro2", ] @@ -217,46 +198,12 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.8" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4" +checksum = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0" [[package]] name = "version_check" version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" - -[[package]] -name = "wee_alloc" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbb3b5a6b2bb17cb6ad44a2e68a43e8d2722c997da10e928665c72ec6c0a0b8e" -dependencies = [ - "cfg-if 0.1.10", - "libc", - "memory_units", - "winapi", -] - -[[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-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" diff --git a/contracts/examples/ping-pong-egld/wasm/Cargo.toml b/contracts/examples/ping-pong-egld/wasm/Cargo.toml index 73c19a9efd..5410d88aa1 100644 --- a/contracts/examples/ping-pong-egld/wasm/Cargo.toml +++ b/contracts/examples/ping-pong-egld/wasm/Cargo.toml @@ -21,5 +21,5 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.39.7" +version = "0.41.3" path = "../../../../framework/wasm-adapter" diff --git a/contracts/examples/ping-pong-egld/wasm/src/lib.rs b/contracts/examples/ping-pong-egld/wasm/src/lib.rs index aece2d02bd..58398d82c2 100644 --- a/contracts/examples/ping-pong-egld/wasm/src/lib.rs +++ b/contracts/examples/ping-pong-egld/wasm/src/lib.rs @@ -10,7 +10,7 @@ // Total number of exported functions: 12 #![no_std] -#![feature(alloc_error_handler, lang_items)] +#![feature(lang_items)] multiversx_sc_wasm_adapter::allocator!(); multiversx_sc_wasm_adapter::panic_handler!(); diff --git a/contracts/examples/proxy-pause/Cargo.toml b/contracts/examples/proxy-pause/Cargo.toml index 07686248d1..6e7cd56189 100644 --- a/contracts/examples/proxy-pause/Cargo.toml +++ b/contracts/examples/proxy-pause/Cargo.toml @@ -9,12 +9,13 @@ publish = false path = "src/proxy_pause.rs" [dependencies.multiversx-sc] -version = "0.39.7" +version = "0.41.3" path = "../../../framework/base" [dev-dependencies.multiversx-sc-scenario] -version = "0.39.7" +version = "0.41.3" path = "../../../framework/scenario" -[dev-dependencies.use-module] -path = "../../feature-tests/use-module" +[dev-dependencies.check-pause] +path = "../check-pause" + diff --git a/contracts/examples/proxy-pause/meta/Cargo.toml b/contracts/examples/proxy-pause/meta/Cargo.toml index 002e3b65b0..7e83335bfd 100644 --- a/contracts/examples/proxy-pause/meta/Cargo.toml +++ b/contracts/examples/proxy-pause/meta/Cargo.toml @@ -11,5 +11,5 @@ authors = [ "you",] path = ".." [dependencies.multiversx-sc-meta] -version = "0.39.7" +version = "0.41.3" path = "../../../../framework/meta" diff --git a/contracts/examples/proxy-pause/scenarios/init.scen.json b/contracts/examples/proxy-pause/scenarios/init.scen.json index b92e2af69f..98cb9830cc 100644 --- a/contracts/examples/proxy-pause/scenarios/init.scen.json +++ b/contracts/examples/proxy-pause/scenarios/init.scen.json @@ -9,10 +9,10 @@ "nonce": "1", "balance": "0" }, - "sc:use-module": { + "sc:check-pause": { "nonce": "1", "balance": "0", - "code": "file:../../../feature-tests/use-module/output/use-module.wasm", + "code": "file:../../check-pause/output/check-pause.wasm", "owner": "sc:proxy-pause" } }, @@ -71,7 +71,7 @@ "to": "sc:proxy-pause", "function": "addContracts", "arguments": [ - "sc:use-module" + "sc:check-pause" ], "gasLimit": "20,000,000", "gasPrice": "0" @@ -97,7 +97,7 @@ }, "expect": { "out": [ - "sc:use-module" + "sc:check-pause" ], "status": "", "logs": [], diff --git a/contracts/examples/proxy-pause/scenarios/pause-and-unpause.scen.json b/contracts/examples/proxy-pause/scenarios/pause-and-unpause.scen.json index cc812a5d48..11ac973087 100644 --- a/contracts/examples/proxy-pause/scenarios/pause-and-unpause.scen.json +++ b/contracts/examples/proxy-pause/scenarios/pause-and-unpause.scen.json @@ -11,7 +11,7 @@ "id": "1-check-is-initially-not-paused", "tx": { "from": "address:owner", - "to": "sc:use-module", + "to": "sc:check-pause", "function": "checkPause", "arguments": [], "gasLimit": "30,000,000", @@ -51,7 +51,7 @@ "id": "3-check-is-paused", "tx": { "from": "address:owner", - "to": "sc:use-module", + "to": "sc:check-pause", "function": "checkPause", "arguments": [], "gasLimit": "20,000,000", @@ -91,7 +91,7 @@ "id": "4-check-has-resumed", "tx": { "from": "address:owner", - "to": "sc:use-module", + "to": "sc:check-pause", "function": "checkPause", "arguments": [], "gasLimit": "20,000,000", diff --git a/contracts/examples/proxy-pause/tests/proxy_pause_scenario_go_test.rs b/contracts/examples/proxy-pause/tests/proxy_pause_scenario_go_test.rs index a8aa59da6f..915d5d50be 100644 --- a/contracts/examples/proxy-pause/tests/proxy_pause_scenario_go_test.rs +++ b/contracts/examples/proxy-pause/tests/proxy_pause_scenario_go_test.rs @@ -1,4 +1,9 @@ #[test] -fn pause_go() { +fn init_go() { + multiversx_sc_scenario::run_go("scenarios/init.scen.json"); +} + +#[test] +fn pause_and_unpause_go() { multiversx_sc_scenario::run_go("scenarios/pause-and-unpause.scen.json"); } diff --git a/contracts/examples/proxy-pause/tests/proxy_pause_scenario_rs_test.rs b/contracts/examples/proxy-pause/tests/proxy_pause_scenario_rs_test.rs index 58a76d01fb..feece4f9a9 100644 --- a/contracts/examples/proxy-pause/tests/proxy_pause_scenario_rs_test.rs +++ b/contracts/examples/proxy-pause/tests/proxy_pause_scenario_rs_test.rs @@ -7,13 +7,18 @@ fn world() -> ScenarioWorld { blockchain.register_contract("file:output/proxy-pause.wasm", proxy_pause::ContractBuilder); blockchain.register_contract( - "file:../../feature-tests/use-module/output/use-module.wasm", - use_module::ContractBuilder, + "file:../check-pause/output/check-pause.wasm", + check_pause::ContractBuilder, ); blockchain } #[test] -fn pause_rs() { +fn init_rs() { + multiversx_sc_scenario::run_rs("scenarios/init.scen.json", world()); +} + +#[test] +fn pause_and_unpause_rs() { multiversx_sc_scenario::run_rs("scenarios/pause-and-unpause.scen.json", world()); } diff --git a/contracts/examples/proxy-pause/wasm/Cargo.lock b/contracts/examples/proxy-pause/wasm/Cargo.lock index 972e8890ab..e83d3bea76 100644 --- a/contracts/examples/proxy-pause/wasm/Cargo.lock +++ b/contracts/examples/proxy-pause/wasm/Cargo.lock @@ -8,16 +8,16 @@ version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "once_cell", "version_check", ] [[package]] name = "arrayvec" -version = "0.7.2" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" +checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" [[package]] name = "autocfg" @@ -31,12 +31,6 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" -[[package]] -name = "cfg-if" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" - [[package]] name = "cfg-if" version = "1.0.0" @@ -70,21 +64,9 @@ version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ebdb29d2ea9ed0083cd8cece49bbd968021bd99b0849edb4a9a7ee0fdf6a4e0" -[[package]] -name = "libc" -version = "0.2.140" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99227334921fae1a979cf0bfdfcc6b3e5ce376ef57e16fb6fb3ea2ed6095f80c" - -[[package]] -name = "memory_units" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8452105ba047068f40ff7093dd1d9da90898e63dd61736462e9cdda6a90ad3c3" - [[package]] name = "multiversx-sc" -version = "0.39.7" +version = "0.41.3" dependencies = [ "bitflags", "hashbrown", @@ -96,7 +78,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.17.1" +version = "0.17.2" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -104,7 +86,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.17.1" +version = "0.17.2" dependencies = [ "hex", "proc-macro2", @@ -114,7 +96,7 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.39.7" +version = "0.41.3" dependencies = [ "hex", "proc-macro2", @@ -125,10 +107,9 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.39.7" +version = "0.41.3" dependencies = [ "multiversx-sc", - "wee_alloc", ] [[package]] @@ -151,15 +132,15 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.17.1" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" +checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" [[package]] name = "proc-macro2" -version = "1.0.52" +version = "1.0.63" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d0e1ae9e836cc3beddd63db0df682593d7e2d3d891ae8c9083d2113e1744224" +checksum = "7b368fba921b0dce7e60f5e04ec15e565b3303972b42bcfde1d0713b881959eb" dependencies = [ "unicode-ident", ] @@ -181,9 +162,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.26" +version = "1.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4424af4bf778aae2051a77b60283332f386554255d722233d09fbfc7e30da2fc" +checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488" dependencies = [ "proc-macro2", ] @@ -217,46 +198,12 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.8" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4" +checksum = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0" [[package]] name = "version_check" version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" - -[[package]] -name = "wee_alloc" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbb3b5a6b2bb17cb6ad44a2e68a43e8d2722c997da10e928665c72ec6c0a0b8e" -dependencies = [ - "cfg-if 0.1.10", - "libc", - "memory_units", - "winapi", -] - -[[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-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" diff --git a/contracts/examples/proxy-pause/wasm/Cargo.toml b/contracts/examples/proxy-pause/wasm/Cargo.toml index 6d31ad1c98..b2fc232120 100644 --- a/contracts/examples/proxy-pause/wasm/Cargo.toml +++ b/contracts/examples/proxy-pause/wasm/Cargo.toml @@ -24,5 +24,5 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.39.7" +version = "0.41.3" path = "../../../../framework/wasm-adapter" diff --git a/contracts/examples/proxy-pause/wasm/src/lib.rs b/contracts/examples/proxy-pause/wasm/src/lib.rs index d6ec593053..a2d9ba0993 100644 --- a/contracts/examples/proxy-pause/wasm/src/lib.rs +++ b/contracts/examples/proxy-pause/wasm/src/lib.rs @@ -10,7 +10,7 @@ // Total number of exported functions: 10 #![no_std] -#![feature(alloc_error_handler, lang_items)] +#![feature(lang_items)] multiversx_sc_wasm_adapter::allocator!(); multiversx_sc_wasm_adapter::panic_handler!(); diff --git a/contracts/examples/rewards-distribution/Cargo.toml b/contracts/examples/rewards-distribution/Cargo.toml index 92740937fd..d517ddce4a 100644 --- a/contracts/examples/rewards-distribution/Cargo.toml +++ b/contracts/examples/rewards-distribution/Cargo.toml @@ -9,13 +9,13 @@ publish = false path = "src/rewards_distribution.rs" [dependencies.multiversx-sc] -version = "0.39.7" +version = "0.41.3" path = "../../../framework/base" [dependencies.multiversx-sc-modules] -version = "0.39.7" +version = "0.41.3" path = "../../../contracts/modules" [dev-dependencies.multiversx-sc-scenario] -version = "0.39.7" +version = "0.41.3" path = "../../../framework/scenario" diff --git a/contracts/examples/rewards-distribution/meta/Cargo.toml b/contracts/examples/rewards-distribution/meta/Cargo.toml index 6dfe95e112..9f0ff63d12 100644 --- a/contracts/examples/rewards-distribution/meta/Cargo.toml +++ b/contracts/examples/rewards-distribution/meta/Cargo.toml @@ -11,5 +11,5 @@ authors = ["Claudiu-Marcel Bruda "] path = ".." [dependencies.multiversx-sc-meta] -version = "0.39.7" +version = "0.41.3" path = "../../../../framework/meta" diff --git a/contracts/examples/rewards-distribution/wasm/Cargo.lock b/contracts/examples/rewards-distribution/wasm/Cargo.lock index 21d5fb4c9c..726b9d6b04 100644 --- a/contracts/examples/rewards-distribution/wasm/Cargo.lock +++ b/contracts/examples/rewards-distribution/wasm/Cargo.lock @@ -8,16 +8,16 @@ version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "once_cell", "version_check", ] [[package]] name = "arrayvec" -version = "0.7.2" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" +checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" [[package]] name = "autocfg" @@ -31,12 +31,6 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" -[[package]] -name = "cfg-if" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" - [[package]] name = "cfg-if" version = "1.0.0" @@ -70,21 +64,9 @@ version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ebdb29d2ea9ed0083cd8cece49bbd968021bd99b0849edb4a9a7ee0fdf6a4e0" -[[package]] -name = "libc" -version = "0.2.140" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99227334921fae1a979cf0bfdfcc6b3e5ce376ef57e16fb6fb3ea2ed6095f80c" - -[[package]] -name = "memory_units" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8452105ba047068f40ff7093dd1d9da90898e63dd61736462e9cdda6a90ad3c3" - [[package]] name = "multiversx-sc" -version = "0.39.7" +version = "0.41.3" dependencies = [ "bitflags", "hashbrown", @@ -96,7 +78,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.17.1" +version = "0.17.2" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -104,7 +86,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.17.1" +version = "0.17.2" dependencies = [ "hex", "proc-macro2", @@ -114,7 +96,7 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.39.7" +version = "0.41.3" dependencies = [ "hex", "proc-macro2", @@ -125,17 +107,16 @@ dependencies = [ [[package]] name = "multiversx-sc-modules" -version = "0.39.7" +version = "0.41.3" dependencies = [ "multiversx-sc", ] [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.39.7" +version = "0.41.3" dependencies = [ "multiversx-sc", - "wee_alloc", ] [[package]] @@ -158,24 +139,24 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.17.1" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" +checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" [[package]] name = "proc-macro2" -version = "1.0.52" +version = "1.0.63" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d0e1ae9e836cc3beddd63db0df682593d7e2d3d891ae8c9083d2113e1744224" +checksum = "7b368fba921b0dce7e60f5e04ec15e565b3303972b42bcfde1d0713b881959eb" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.26" +version = "1.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4424af4bf778aae2051a77b60283332f386554255d722233d09fbfc7e30da2fc" +checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488" dependencies = [ "proc-macro2", ] @@ -225,46 +206,12 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.8" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4" +checksum = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0" [[package]] name = "version_check" version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" - -[[package]] -name = "wee_alloc" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbb3b5a6b2bb17cb6ad44a2e68a43e8d2722c997da10e928665c72ec6c0a0b8e" -dependencies = [ - "cfg-if 0.1.10", - "libc", - "memory_units", - "winapi", -] - -[[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-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" diff --git a/contracts/examples/rewards-distribution/wasm/Cargo.toml b/contracts/examples/rewards-distribution/wasm/Cargo.toml index ba7a7ea305..00b5e10f74 100644 --- a/contracts/examples/rewards-distribution/wasm/Cargo.toml +++ b/contracts/examples/rewards-distribution/wasm/Cargo.toml @@ -24,5 +24,5 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.39.7" +version = "0.41.3" path = "../../../../framework/wasm-adapter" diff --git a/contracts/examples/rewards-distribution/wasm/src/lib.rs b/contracts/examples/rewards-distribution/wasm/src/lib.rs index 737abcc038..92806cb55e 100644 --- a/contracts/examples/rewards-distribution/wasm/src/lib.rs +++ b/contracts/examples/rewards-distribution/wasm/src/lib.rs @@ -10,7 +10,7 @@ // Total number of exported functions: 15 #![no_std] -#![feature(alloc_error_handler, lang_items)] +#![feature(lang_items)] multiversx_sc_wasm_adapter::allocator!(); multiversx_sc_wasm_adapter::panic_handler!(); diff --git a/contracts/examples/seed-nft-minter/Cargo.toml b/contracts/examples/seed-nft-minter/Cargo.toml index f0c346113c..e3778d1637 100644 --- a/contracts/examples/seed-nft-minter/Cargo.toml +++ b/contracts/examples/seed-nft-minter/Cargo.toml @@ -9,13 +9,13 @@ publish = false path = "src/seed_nft_minter.rs" [dependencies.multiversx-sc] -version = "0.39.7" +version = "0.41.3" path = "../../../framework/base" [dependencies.multiversx-sc-modules] -version = "0.39.7" +version = "0.41.3" path = "../../../contracts/modules" [dev-dependencies.multiversx-sc-scenario] -version = "0.39.7" +version = "0.41.3" path = "../../../framework/scenario" diff --git a/contracts/examples/seed-nft-minter/meta/Cargo.toml b/contracts/examples/seed-nft-minter/meta/Cargo.toml index 80cff4b683..05268b6a95 100644 --- a/contracts/examples/seed-nft-minter/meta/Cargo.toml +++ b/contracts/examples/seed-nft-minter/meta/Cargo.toml @@ -11,5 +11,5 @@ authors = ["Claudiu-Marcel Bruda "] path = ".." [dependencies.multiversx-sc-meta] -version = "0.39.7" +version = "0.41.3" path = "../../../../framework/meta" diff --git a/contracts/examples/seed-nft-minter/src/nft_module.rs b/contracts/examples/seed-nft-minter/src/nft_module.rs index f05a465fb7..f24ea67fc3 100644 --- a/contracts/examples/seed-nft-minter/src/nft_module.rs +++ b/contracts/examples/seed-nft-minter/src/nft_module.rs @@ -28,7 +28,7 @@ pub trait NftModule: let issue_cost = self.call_value().egld_value(); self.nft_token_id().issue_and_set_all_roles( EsdtTokenType::NonFungible, - issue_cost, + issue_cost.clone_value(), token_display_name, token_ticker, 0, diff --git a/contracts/examples/seed-nft-minter/wasm/Cargo.lock b/contracts/examples/seed-nft-minter/wasm/Cargo.lock index 9cdf6f3f03..0e1e8ab4fd 100644 --- a/contracts/examples/seed-nft-minter/wasm/Cargo.lock +++ b/contracts/examples/seed-nft-minter/wasm/Cargo.lock @@ -8,16 +8,16 @@ version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "once_cell", "version_check", ] [[package]] name = "arrayvec" -version = "0.7.2" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" +checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" [[package]] name = "autocfg" @@ -31,12 +31,6 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" -[[package]] -name = "cfg-if" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" - [[package]] name = "cfg-if" version = "1.0.0" @@ -70,21 +64,9 @@ version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ebdb29d2ea9ed0083cd8cece49bbd968021bd99b0849edb4a9a7ee0fdf6a4e0" -[[package]] -name = "libc" -version = "0.2.140" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99227334921fae1a979cf0bfdfcc6b3e5ce376ef57e16fb6fb3ea2ed6095f80c" - -[[package]] -name = "memory_units" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8452105ba047068f40ff7093dd1d9da90898e63dd61736462e9cdda6a90ad3c3" - [[package]] name = "multiversx-sc" -version = "0.39.7" +version = "0.41.3" dependencies = [ "bitflags", "hashbrown", @@ -96,7 +78,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.17.1" +version = "0.17.2" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -104,7 +86,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.17.1" +version = "0.17.2" dependencies = [ "hex", "proc-macro2", @@ -114,7 +96,7 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.39.7" +version = "0.41.3" dependencies = [ "hex", "proc-macro2", @@ -125,17 +107,16 @@ dependencies = [ [[package]] name = "multiversx-sc-modules" -version = "0.39.7" +version = "0.41.3" dependencies = [ "multiversx-sc", ] [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.39.7" +version = "0.41.3" dependencies = [ "multiversx-sc", - "wee_alloc", ] [[package]] @@ -158,24 +139,24 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.17.1" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" +checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" [[package]] name = "proc-macro2" -version = "1.0.52" +version = "1.0.63" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d0e1ae9e836cc3beddd63db0df682593d7e2d3d891ae8c9083d2113e1744224" +checksum = "7b368fba921b0dce7e60f5e04ec15e565b3303972b42bcfde1d0713b881959eb" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.26" +version = "1.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4424af4bf778aae2051a77b60283332f386554255d722233d09fbfc7e30da2fc" +checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488" dependencies = [ "proc-macro2", ] @@ -225,46 +206,12 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.8" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4" +checksum = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0" [[package]] name = "version_check" version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" - -[[package]] -name = "wee_alloc" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbb3b5a6b2bb17cb6ad44a2e68a43e8d2722c997da10e928665c72ec6c0a0b8e" -dependencies = [ - "cfg-if 0.1.10", - "libc", - "memory_units", - "winapi", -] - -[[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-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" diff --git a/contracts/examples/seed-nft-minter/wasm/Cargo.toml b/contracts/examples/seed-nft-minter/wasm/Cargo.toml index ca359ea6a6..8ff322ee9b 100644 --- a/contracts/examples/seed-nft-minter/wasm/Cargo.toml +++ b/contracts/examples/seed-nft-minter/wasm/Cargo.toml @@ -24,5 +24,5 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.39.7" +version = "0.41.3" path = "../../../../framework/wasm-adapter" diff --git a/contracts/examples/seed-nft-minter/wasm/src/lib.rs b/contracts/examples/seed-nft-minter/wasm/src/lib.rs index 8d313c47f8..cb34c0fc60 100644 --- a/contracts/examples/seed-nft-minter/wasm/src/lib.rs +++ b/contracts/examples/seed-nft-minter/wasm/src/lib.rs @@ -10,7 +10,7 @@ // Total number of exported functions: 11 #![no_std] -#![feature(alloc_error_handler, lang_items)] +#![feature(lang_items)] multiversx_sc_wasm_adapter::allocator!(); multiversx_sc_wasm_adapter::panic_handler!(); diff --git a/contracts/examples/token-release/Cargo.toml b/contracts/examples/token-release/Cargo.toml index 83e8442f62..aae26dbdf5 100644 --- a/contracts/examples/token-release/Cargo.toml +++ b/contracts/examples/token-release/Cargo.toml @@ -9,10 +9,10 @@ publish = false path = "src/token_release.rs" [dependencies.multiversx-sc] -version = "0.39.7" +version = "0.41.3" path = "../../../framework/base" [dev-dependencies.multiversx-sc-scenario] -version = "0.39.7" +version = "0.41.3" path = "../../../framework/scenario" diff --git a/contracts/examples/token-release/meta/Cargo.toml b/contracts/examples/token-release/meta/Cargo.toml index 03a428ae00..88cd3e8de4 100644 --- a/contracts/examples/token-release/meta/Cargo.toml +++ b/contracts/examples/token-release/meta/Cargo.toml @@ -10,6 +10,6 @@ publish = false path = ".." [dependencies.multiversx-sc-meta] -version = "0.39.7" +version = "0.41.3" path = "../../../../framework/meta" diff --git a/contracts/examples/token-release/tests/token_release_scenario_go_test.rs b/contracts/examples/token-release/tests/token_release_scenario_go_test.rs index 2c622b255c..60fb97640a 100644 --- a/contracts/examples/token-release/tests/token_release_scenario_go_test.rs +++ b/contracts/examples/token-release/tests/token_release_scenario_go_test.rs @@ -1,29 +1,29 @@ #[test] -fn token_release_add_group_go() { +fn test_add_group_go() { multiversx_sc_scenario::run_go("scenarios/test-add-group.scen.json"); } #[test] -fn token_release_add_user_go() { +fn test_add_user_go() { multiversx_sc_scenario::run_go("scenarios/test-add-user.scen.json"); } #[test] -fn token_release_change_user_go() { +fn test_change_user_go() { multiversx_sc_scenario::run_go("scenarios/test-change-user.scen.json"); } #[test] -fn token_release_claim_go() { +fn test_claim_go() { multiversx_sc_scenario::run_go("scenarios/test-claim.scen.json"); } #[test] -fn token_release_end_setup_go() { +fn test_end_setup_go() { multiversx_sc_scenario::run_go("scenarios/test-end-setup.scen.json"); } #[test] -fn token_release_init_go() { +fn test_init_go() { multiversx_sc_scenario::run_go("scenarios/test-init.scen.json"); } diff --git a/contracts/examples/token-release/tests/token_release_scenario_rs_test.rs b/contracts/examples/token-release/tests/token_release_scenario_rs_test.rs index 4582676f99..d491bb833b 100644 --- a/contracts/examples/token-release/tests/token_release_scenario_rs_test.rs +++ b/contracts/examples/token-release/tests/token_release_scenario_rs_test.rs @@ -12,31 +12,31 @@ fn world() -> ScenarioWorld { } #[test] -fn token_release_add_group_rs() { +fn test_add_group_rs() { multiversx_sc_scenario::run_rs("scenarios/test-add-group.scen.json", world()); } #[test] -fn token_release_add_user_rs() { +fn test_add_user_rs() { multiversx_sc_scenario::run_rs("scenarios/test-add-user.scen.json", world()); } #[test] -fn token_release_change_user_rs() { +fn test_change_user_rs() { multiversx_sc_scenario::run_rs("scenarios/test-change-user.scen.json", world()); } #[test] -fn token_release_claim_rs() { +fn test_claim_rs() { multiversx_sc_scenario::run_rs("scenarios/test-claim.scen.json", world()); } #[test] -fn token_release_end_setup_rs() { +fn test_end_setup_rs() { multiversx_sc_scenario::run_rs("scenarios/test-end-setup.scen.json", world()); } #[test] -fn token_release_init_rs() { +fn test_init_rs() { multiversx_sc_scenario::run_rs("scenarios/test-init.scen.json", world()); } diff --git a/contracts/examples/token-release/wasm/Cargo.lock b/contracts/examples/token-release/wasm/Cargo.lock index 28dd84a4b5..a144982874 100644 --- a/contracts/examples/token-release/wasm/Cargo.lock +++ b/contracts/examples/token-release/wasm/Cargo.lock @@ -8,16 +8,16 @@ version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "once_cell", "version_check", ] [[package]] name = "arrayvec" -version = "0.7.2" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" +checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" [[package]] name = "autocfg" @@ -31,12 +31,6 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" -[[package]] -name = "cfg-if" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" - [[package]] name = "cfg-if" version = "1.0.0" @@ -70,21 +64,9 @@ version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ebdb29d2ea9ed0083cd8cece49bbd968021bd99b0849edb4a9a7ee0fdf6a4e0" -[[package]] -name = "libc" -version = "0.2.140" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99227334921fae1a979cf0bfdfcc6b3e5ce376ef57e16fb6fb3ea2ed6095f80c" - -[[package]] -name = "memory_units" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8452105ba047068f40ff7093dd1d9da90898e63dd61736462e9cdda6a90ad3c3" - [[package]] name = "multiversx-sc" -version = "0.39.7" +version = "0.41.3" dependencies = [ "bitflags", "hashbrown", @@ -96,7 +78,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.17.1" +version = "0.17.2" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -104,7 +86,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.17.1" +version = "0.17.2" dependencies = [ "hex", "proc-macro2", @@ -114,7 +96,7 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.39.7" +version = "0.41.3" dependencies = [ "hex", "proc-macro2", @@ -125,10 +107,9 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.39.7" +version = "0.41.3" dependencies = [ "multiversx-sc", - "wee_alloc", ] [[package]] @@ -151,24 +132,24 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.17.1" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" +checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" [[package]] name = "proc-macro2" -version = "1.0.52" +version = "1.0.63" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d0e1ae9e836cc3beddd63db0df682593d7e2d3d891ae8c9083d2113e1744224" +checksum = "7b368fba921b0dce7e60f5e04ec15e565b3303972b42bcfde1d0713b881959eb" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.26" +version = "1.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4424af4bf778aae2051a77b60283332f386554255d722233d09fbfc7e30da2fc" +checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488" dependencies = [ "proc-macro2", ] @@ -217,46 +198,12 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.8" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4" +checksum = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0" [[package]] name = "version_check" version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" - -[[package]] -name = "wee_alloc" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbb3b5a6b2bb17cb6ad44a2e68a43e8d2722c997da10e928665c72ec6c0a0b8e" -dependencies = [ - "cfg-if 0.1.10", - "libc", - "memory_units", - "winapi", -] - -[[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-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" diff --git a/contracts/examples/token-release/wasm/Cargo.toml b/contracts/examples/token-release/wasm/Cargo.toml index f9c84d16f2..51415dfb3a 100644 --- a/contracts/examples/token-release/wasm/Cargo.toml +++ b/contracts/examples/token-release/wasm/Cargo.toml @@ -21,5 +21,5 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.39.7" +version = "0.41.3" path = "../../../../framework/wasm-adapter" diff --git a/contracts/examples/token-release/wasm/src/lib.rs b/contracts/examples/token-release/wasm/src/lib.rs index ff3175741b..f35207830f 100644 --- a/contracts/examples/token-release/wasm/src/lib.rs +++ b/contracts/examples/token-release/wasm/src/lib.rs @@ -10,7 +10,7 @@ // Total number of exported functions: 15 #![no_std] -#![feature(alloc_error_handler, lang_items)] +#![feature(lang_items)] multiversx_sc_wasm_adapter::allocator!(); multiversx_sc_wasm_adapter::panic_handler!(); diff --git a/contracts/feature-tests/abi-tester/Cargo.toml b/contracts/feature-tests/abi-tester/Cargo.toml index 88d6037b15..a7b8582e01 100644 --- a/contracts/feature-tests/abi-tester/Cargo.toml +++ b/contracts/feature-tests/abi-tester/Cargo.toml @@ -9,14 +9,14 @@ publish = false path = "src/abi_tester.rs" [dependencies.multiversx-sc] -version = "0.39.7" +version = "0.41.3" path = "../../../framework/base" features = ["alloc"] [dev-dependencies.multiversx-sc-scenario] -version = "0.39.7" +version = "0.41.3" path = "../../../framework/scenario" [dev-dependencies.multiversx-sc-meta] -version = "0.39.7" +version = "0.41.3" path = "../../../framework/meta" diff --git a/contracts/feature-tests/abi-tester/abi_tester_expected_main.abi.json b/contracts/feature-tests/abi-tester/abi_tester_expected_main.abi.json index 411ccd5b47..a21013abc5 100644 --- a/contracts/feature-tests/abi-tester/abi_tester_expected_main.abi.json +++ b/contracts/feature-tests/abi-tester/abi_tester_expected_main.abi.json @@ -14,7 +14,7 @@ }, "framework": { "name": "multiversx-sc", - "version": "0.39.7" + "version": "0.41.3" } }, "docs": [ diff --git a/contracts/feature-tests/abi-tester/abi_tester_expected_view.abi.json b/contracts/feature-tests/abi-tester/abi_tester_expected_view.abi.json index b7b49fde4f..28c0ee1210 100644 --- a/contracts/feature-tests/abi-tester/abi_tester_expected_view.abi.json +++ b/contracts/feature-tests/abi-tester/abi_tester_expected_view.abi.json @@ -14,7 +14,7 @@ }, "framework": { "name": "multiversx-sc", - "version": "0.39.7" + "version": "0.41.3" } }, "docs": [ diff --git a/contracts/feature-tests/abi-tester/meta/Cargo.toml b/contracts/feature-tests/abi-tester/meta/Cargo.toml index c3caabc1c2..dbd46b504f 100644 --- a/contracts/feature-tests/abi-tester/meta/Cargo.toml +++ b/contracts/feature-tests/abi-tester/meta/Cargo.toml @@ -9,5 +9,5 @@ publish = false path = ".." [dependencies.multiversx-sc-meta] -version = "0.39.7" +version = "0.41.3" path = "../../../../framework/meta" diff --git a/contracts/feature-tests/abi-tester/wasm-abi-tester-ev/Cargo.lock b/contracts/feature-tests/abi-tester/wasm-abi-tester-ev/Cargo.lock index 8b4aafa63a..ded9314a37 100644 --- a/contracts/feature-tests/abi-tester/wasm-abi-tester-ev/Cargo.lock +++ b/contracts/feature-tests/abi-tester/wasm-abi-tester-ev/Cargo.lock @@ -23,16 +23,16 @@ version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "once_cell", "version_check", ] [[package]] name = "arrayvec" -version = "0.7.2" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" +checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" [[package]] name = "autocfg" @@ -46,12 +46,6 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" -[[package]] -name = "cfg-if" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" - [[package]] name = "cfg-if" version = "1.0.0" @@ -85,21 +79,9 @@ version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ebdb29d2ea9ed0083cd8cece49bbd968021bd99b0849edb4a9a7ee0fdf6a4e0" -[[package]] -name = "libc" -version = "0.2.140" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99227334921fae1a979cf0bfdfcc6b3e5ce376ef57e16fb6fb3ea2ed6095f80c" - -[[package]] -name = "memory_units" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8452105ba047068f40ff7093dd1d9da90898e63dd61736462e9cdda6a90ad3c3" - [[package]] name = "multiversx-sc" -version = "0.39.7" +version = "0.41.3" dependencies = [ "bitflags", "hashbrown", @@ -111,7 +93,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.17.1" +version = "0.17.2" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -119,7 +101,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.17.1" +version = "0.17.2" dependencies = [ "hex", "proc-macro2", @@ -129,7 +111,7 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.39.7" +version = "0.41.3" dependencies = [ "hex", "proc-macro2", @@ -140,10 +122,9 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.39.7" +version = "0.41.3" dependencies = [ "multiversx-sc", - "wee_alloc", ] [[package]] @@ -166,24 +147,24 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.17.1" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" +checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" [[package]] name = "proc-macro2" -version = "1.0.52" +version = "1.0.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d0e1ae9e836cc3beddd63db0df682593d7e2d3d891ae8c9083d2113e1744224" +checksum = "dec2b086b7a862cf4de201096214fa870344cf922b2b30c167badb3af3195406" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.26" +version = "1.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4424af4bf778aae2051a77b60283332f386554255d722233d09fbfc7e30da2fc" +checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488" dependencies = [ "proc-macro2", ] @@ -217,46 +198,12 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.8" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4" +checksum = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0" [[package]] name = "version_check" version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" - -[[package]] -name = "wee_alloc" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbb3b5a6b2bb17cb6ad44a2e68a43e8d2722c997da10e928665c72ec6c0a0b8e" -dependencies = [ - "cfg-if 0.1.10", - "libc", - "memory_units", - "winapi", -] - -[[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-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" diff --git a/contracts/feature-tests/abi-tester/wasm-abi-tester-ev/Cargo.toml b/contracts/feature-tests/abi-tester/wasm-abi-tester-ev/Cargo.toml index 2e7d84e1d5..8bedc213f6 100644 --- a/contracts/feature-tests/abi-tester/wasm-abi-tester-ev/Cargo.toml +++ b/contracts/feature-tests/abi-tester/wasm-abi-tester-ev/Cargo.toml @@ -17,7 +17,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.39.7" +version = "0.41.3" path = "../../../../framework/wasm-adapter" [workspace] diff --git a/contracts/feature-tests/abi-tester/wasm-abi-tester-ev/src/lib.rs b/contracts/feature-tests/abi-tester/wasm-abi-tester-ev/src/lib.rs index 7ba1808f3d..db8c99d2c7 100644 --- a/contracts/feature-tests/abi-tester/wasm-abi-tester-ev/src/lib.rs +++ b/contracts/feature-tests/abi-tester/wasm-abi-tester-ev/src/lib.rs @@ -10,7 +10,7 @@ // Total number of exported functions: 5 #![no_std] -#![feature(alloc_error_handler, lang_items)] +#![feature(lang_items)] multiversx_sc_wasm_adapter::allocator!(); multiversx_sc_wasm_adapter::panic_handler!(); diff --git a/contracts/feature-tests/abi-tester/wasm/Cargo.lock b/contracts/feature-tests/abi-tester/wasm/Cargo.lock index 48b5440162..5eb0609420 100755 --- a/contracts/feature-tests/abi-tester/wasm/Cargo.lock +++ b/contracts/feature-tests/abi-tester/wasm/Cargo.lock @@ -23,16 +23,16 @@ version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "once_cell", "version_check", ] [[package]] name = "arrayvec" -version = "0.7.2" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" +checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" [[package]] name = "autocfg" @@ -46,12 +46,6 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" -[[package]] -name = "cfg-if" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" - [[package]] name = "cfg-if" version = "1.0.0" @@ -85,21 +79,9 @@ version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ebdb29d2ea9ed0083cd8cece49bbd968021bd99b0849edb4a9a7ee0fdf6a4e0" -[[package]] -name = "libc" -version = "0.2.140" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99227334921fae1a979cf0bfdfcc6b3e5ce376ef57e16fb6fb3ea2ed6095f80c" - -[[package]] -name = "memory_units" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8452105ba047068f40ff7093dd1d9da90898e63dd61736462e9cdda6a90ad3c3" - [[package]] name = "multiversx-sc" -version = "0.39.7" +version = "0.41.3" dependencies = [ "bitflags", "hashbrown", @@ -111,7 +93,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.17.1" +version = "0.17.2" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -119,7 +101,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.17.1" +version = "0.17.2" dependencies = [ "hex", "proc-macro2", @@ -129,7 +111,7 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.39.7" +version = "0.41.3" dependencies = [ "hex", "proc-macro2", @@ -140,10 +122,9 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.39.7" +version = "0.41.3" dependencies = [ "multiversx-sc", - "wee_alloc", ] [[package]] @@ -166,24 +147,24 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.17.1" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" +checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" [[package]] name = "proc-macro2" -version = "1.0.52" +version = "1.0.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d0e1ae9e836cc3beddd63db0df682593d7e2d3d891ae8c9083d2113e1744224" +checksum = "dec2b086b7a862cf4de201096214fa870344cf922b2b30c167badb3af3195406" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.26" +version = "1.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4424af4bf778aae2051a77b60283332f386554255d722233d09fbfc7e30da2fc" +checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488" dependencies = [ "proc-macro2", ] @@ -217,46 +198,12 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.8" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4" +checksum = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0" [[package]] name = "version_check" version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" - -[[package]] -name = "wee_alloc" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbb3b5a6b2bb17cb6ad44a2e68a43e8d2722c997da10e928665c72ec6c0a0b8e" -dependencies = [ - "cfg-if 0.1.10", - "libc", - "memory_units", - "winapi", -] - -[[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-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" diff --git a/contracts/feature-tests/abi-tester/wasm/Cargo.toml b/contracts/feature-tests/abi-tester/wasm/Cargo.toml index 5b71b02da5..8863e85ea1 100644 --- a/contracts/feature-tests/abi-tester/wasm/Cargo.toml +++ b/contracts/feature-tests/abi-tester/wasm/Cargo.toml @@ -19,7 +19,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.39.7" +version = "0.41.3" path = "../../../../framework/wasm-adapter" [workspace] diff --git a/contracts/feature-tests/abi-tester/wasm/src/lib.rs b/contracts/feature-tests/abi-tester/wasm/src/lib.rs index 94135097a8..8216928861 100644 --- a/contracts/feature-tests/abi-tester/wasm/src/lib.rs +++ b/contracts/feature-tests/abi-tester/wasm/src/lib.rs @@ -10,7 +10,7 @@ // Total number of exported functions: 29 #![no_std] -#![feature(alloc_error_handler, lang_items)] +#![feature(lang_items)] multiversx_sc_wasm_adapter::allocator!(); multiversx_sc_wasm_adapter::panic_handler!(); diff --git a/contracts/feature-tests/alloc-features/Cargo.toml b/contracts/feature-tests/alloc-features/Cargo.toml index 215a2a9fac..d22ce332a2 100644 --- a/contracts/feature-tests/alloc-features/Cargo.toml +++ b/contracts/feature-tests/alloc-features/Cargo.toml @@ -9,12 +9,12 @@ publish = false path = "src/alloc_features_main.rs" [dependencies.multiversx-sc] -version = "0.39.7" +version = "0.41.3" path = "../../../framework/base" features = ["alloc"] [dev-dependencies.multiversx-sc-scenario] -version = "0.39.7" +version = "0.41.3" path = "../../../framework/scenario" [dev-dependencies.esdt-system-sc-mock] diff --git a/contracts/feature-tests/alloc-features/meta/Cargo.toml b/contracts/feature-tests/alloc-features/meta/Cargo.toml index 670d56e40c..05f4e6e84c 100644 --- a/contracts/feature-tests/alloc-features/meta/Cargo.toml +++ b/contracts/feature-tests/alloc-features/meta/Cargo.toml @@ -9,5 +9,5 @@ publish = false path = ".." [dependencies.multiversx-sc-meta] -version = "0.39.7" +version = "0.41.3" path = "../../../../framework/meta" diff --git a/contracts/feature-tests/alloc-features/multicontract.toml b/contracts/feature-tests/alloc-features/multicontract.toml new file mode 100644 index 0000000000..d16a678ca5 --- /dev/null +++ b/contracts/feature-tests/alloc-features/multicontract.toml @@ -0,0 +1,8 @@ +[settings] +main = "alloc-features" + +# the only purpose of this config is to specify the allocator +[contracts.alloc-features] +add-unlabelled = true +allocator = "static64k" +stack-size = "32k" diff --git a/contracts/feature-tests/alloc-features/src/crypto_features_alloc.rs b/contracts/feature-tests/alloc-features/src/crypto_features_alloc.rs index 4d7efe85e2..0c155732ad 100644 --- a/contracts/feature-tests/alloc-features/src/crypto_features_alloc.rs +++ b/contracts/feature-tests/alloc-features/src/crypto_features_alloc.rs @@ -1,3 +1,5 @@ +#![allow(deprecated)] + multiversx_sc::imports!(); /// Crypto functions that use the allocator. diff --git a/contracts/feature-tests/alloc-features/src/elliptic_curve_features_legacy.rs b/contracts/feature-tests/alloc-features/src/elliptic_curve_features_legacy.rs index 7d6afa1862..05707a2f09 100644 --- a/contracts/feature-tests/alloc-features/src/elliptic_curve_features_legacy.rs +++ b/contracts/feature-tests/alloc-features/src/elliptic_curve_features_legacy.rs @@ -1,3 +1,5 @@ +#![allow(deprecated)] + multiversx_sc::imports!(); /// All elliptic curve functions provided by Arwen exposed here. diff --git a/contracts/feature-tests/alloc-features/tests/alloc_features_scenario_go_test.rs b/contracts/feature-tests/alloc-features/tests/alloc_features_scenario_go_test.rs index 72a6eda414..1a93086984 100644 --- a/contracts/feature-tests/alloc-features/tests/alloc_features_scenario_go_test.rs +++ b/contracts/feature-tests/alloc-features/tests/alloc_features_scenario_go_test.rs @@ -9,17 +9,17 @@ fn crypto_elliptic_curves_legacy_go() { } #[test] -fn crypto_keccak256_legacy_alloc_go() { +fn crypto_keccak_256_legacy_alloc_go() { multiversx_sc_scenario::run_go("scenarios/crypto_keccak256_legacy_alloc.scen.json"); } #[test] -fn crypto_ripemd160_legacy_go() { +fn crypto_ripemd_160_legacy_go() { multiversx_sc_scenario::run_go("scenarios/crypto_ripemd160_legacy.scen.json"); } #[test] -fn crypto_sha256_legacy_alloc_go() { +fn crypto_sha_256_legacy_alloc_go() { multiversx_sc_scenario::run_go("scenarios/crypto_sha256_legacy_alloc.scen.json"); } @@ -29,12 +29,12 @@ fn crypto_verify_bls_legacy_go() { } #[test] -fn crypto_verify_ed25519_legacy_go() { +fn crypto_verify_ed_25519_legacy_go() { multiversx_sc_scenario::run_go("scenarios/crypto_verify_ed25519_legacy.scen.json"); } #[test] -fn crypto_verify_secp256k1_legacy_go() { +fn crypto_verify_secp_256_k_1_legacy_go() { multiversx_sc_scenario::run_go("scenarios/crypto_verify_secp256k1_legacy.scen.json"); } @@ -64,7 +64,7 @@ fn echo_ser_ex_1_go() { } #[test] -fn echo_slice_u8_go() { +fn echo_slice_u_8_go() { multiversx_sc_scenario::run_go("scenarios/echo_slice_u8.scen.json"); } @@ -84,12 +84,12 @@ fn echo_string_go() { } #[test] -fn echo_varargs_u32_alloc_go() { +fn echo_varargs_u_32_alloc_go() { multiversx_sc_scenario::run_go("scenarios/echo_varargs_u32_alloc.scen.json"); } #[test] -fn echo_vec_u8_go() { +fn echo_vec_u_8_go() { multiversx_sc_scenario::run_go("scenarios/echo_vec_u8.scen.json"); } @@ -139,6 +139,6 @@ fn storage_opt_address_go() { } #[test] -fn storage_vec_u8_go() { +fn storage_vec_u_8_go() { multiversx_sc_scenario::run_go("scenarios/storage_vec_u8.scen.json"); } diff --git a/contracts/feature-tests/alloc-features/tests/alloc_features_scenario_rs_test.rs b/contracts/feature-tests/alloc-features/tests/alloc_features_scenario_rs_test.rs index 124fa960ae..01a00fbb26 100644 --- a/contracts/feature-tests/alloc-features/tests/alloc_features_scenario_rs_test.rs +++ b/contracts/feature-tests/alloc-features/tests/alloc_features_scenario_rs_test.rs @@ -16,42 +16,42 @@ fn boxed_bytes_zeros_rs() { multiversx_sc_scenario::run_rs("scenarios/boxed_bytes_zeros.scen.json", world()); } -#[ignore] #[test] +#[ignore = "mock not implemented"] fn crypto_elliptic_curves_legacy_rs() { multiversx_sc_scenario::run_rs("scenarios/crypto_elliptic_curves_legacy.scen.json", world()); } #[test] -fn crypto_keccak256_legacy_alloc_rs() { +fn crypto_keccak_256_legacy_alloc_rs() { multiversx_sc_scenario::run_rs("scenarios/crypto_keccak256_legacy_alloc.scen.json", world()); } -#[ignore] #[test] -fn crypto_ripemd160_rs() { - multiversx_sc_scenario::run_rs("scenarios/crypto_ripemd160.scen.json", world()); +#[ignore = "mock not implemented"] +fn crypto_ripemd_160_legacy_rs() { + multiversx_sc_scenario::run_rs("scenarios/crypto_ripemd160_legacy.scen.json", world()); } #[test] -fn crypto_sha256_legacy_alloc_rs() { +fn crypto_sha_256_legacy_alloc_rs() { multiversx_sc_scenario::run_rs("scenarios/crypto_sha256_legacy_alloc.scen.json", world()); } -#[ignore] #[test] +#[ignore = "mock not implemented"] fn crypto_verify_bls_legacy_rs() { multiversx_sc_scenario::run_rs("scenarios/crypto_verify_bls_legacy.scen.json", world()); } #[test] -fn crypto_verify_ed25519_legacy_rs() { +fn crypto_verify_ed_25519_legacy_rs() { multiversx_sc_scenario::run_rs("scenarios/crypto_verify_ed25519_legacy.scen.json", world()); } -#[ignore] #[test] -fn crypto_verify_secp256k1_legacy_rs() { +#[ignore = "mock not implemented"] +fn crypto_verify_secp_256_k_1_legacy_rs() { multiversx_sc_scenario::run_rs( "scenarios/crypto_verify_secp256k1_legacy.scen.json", world(), @@ -84,7 +84,7 @@ fn echo_ser_ex_1_rs() { } #[test] -fn echo_slice_u8_rs() { +fn echo_slice_u_8_rs() { multiversx_sc_scenario::run_rs("scenarios/echo_slice_u8.scen.json", world()); } @@ -104,12 +104,12 @@ fn echo_string_rs() { } #[test] -fn echo_varargs_u32_alloc_rs() { +fn echo_varargs_u_32_alloc_rs() { multiversx_sc_scenario::run_rs("scenarios/echo_varargs_u32_alloc.scen.json", world()); } #[test] -fn echo_vec_u8_rs() { +fn echo_vec_u_8_rs() { multiversx_sc_scenario::run_rs("scenarios/echo_vec_u8.scen.json", world()); } @@ -159,6 +159,6 @@ fn storage_opt_address_rs() { } #[test] -fn storage_vec_u8_rs() { +fn storage_vec_u_8_rs() { multiversx_sc_scenario::run_rs("scenarios/storage_vec_u8.scen.json", world()); } diff --git a/contracts/feature-tests/alloc-features/wasm/Cargo.lock b/contracts/feature-tests/alloc-features/wasm/Cargo.lock index efae046f0e..c3c3601759 100644 --- a/contracts/feature-tests/alloc-features/wasm/Cargo.lock +++ b/contracts/feature-tests/alloc-features/wasm/Cargo.lock @@ -8,7 +8,7 @@ version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "once_cell", "version_check", ] @@ -30,9 +30,9 @@ dependencies = [ [[package]] name = "arrayvec" -version = "0.7.2" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" +checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" [[package]] name = "autocfg" @@ -46,12 +46,6 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" -[[package]] -name = "cfg-if" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" - [[package]] name = "cfg-if" version = "1.0.0" @@ -85,21 +79,9 @@ version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ebdb29d2ea9ed0083cd8cece49bbd968021bd99b0849edb4a9a7ee0fdf6a4e0" -[[package]] -name = "libc" -version = "0.2.140" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99227334921fae1a979cf0bfdfcc6b3e5ce376ef57e16fb6fb3ea2ed6095f80c" - -[[package]] -name = "memory_units" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8452105ba047068f40ff7093dd1d9da90898e63dd61736462e9cdda6a90ad3c3" - [[package]] name = "multiversx-sc" -version = "0.39.7" +version = "0.41.3" dependencies = [ "bitflags", "hashbrown", @@ -111,7 +93,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.17.1" +version = "0.17.2" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -119,7 +101,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.17.1" +version = "0.17.2" dependencies = [ "hex", "proc-macro2", @@ -129,7 +111,7 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.39.7" +version = "0.41.3" dependencies = [ "hex", "proc-macro2", @@ -140,10 +122,9 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.39.7" +version = "0.41.3" dependencies = [ "multiversx-sc", - "wee_alloc", ] [[package]] @@ -166,24 +147,24 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.17.1" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" +checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" [[package]] name = "proc-macro2" -version = "1.0.52" +version = "1.0.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d0e1ae9e836cc3beddd63db0df682593d7e2d3d891ae8c9083d2113e1744224" +checksum = "dec2b086b7a862cf4de201096214fa870344cf922b2b30c167badb3af3195406" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.26" +version = "1.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4424af4bf778aae2051a77b60283332f386554255d722233d09fbfc7e30da2fc" +checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488" dependencies = [ "proc-macro2", ] @@ -217,46 +198,12 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.8" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4" +checksum = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0" [[package]] name = "version_check" version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" - -[[package]] -name = "wee_alloc" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbb3b5a6b2bb17cb6ad44a2e68a43e8d2722c997da10e928665c72ec6c0a0b8e" -dependencies = [ - "cfg-if 0.1.10", - "libc", - "memory_units", - "winapi", -] - -[[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-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" diff --git a/contracts/feature-tests/alloc-features/wasm/Cargo.toml b/contracts/feature-tests/alloc-features/wasm/Cargo.toml index 22b3017e14..6c56d61935 100644 --- a/contracts/feature-tests/alloc-features/wasm/Cargo.toml +++ b/contracts/feature-tests/alloc-features/wasm/Cargo.toml @@ -19,7 +19,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.39.7" +version = "0.41.3" path = "../../../../framework/wasm-adapter" [workspace] diff --git a/contracts/feature-tests/alloc-features/wasm/src/lib.rs b/contracts/feature-tests/alloc-features/wasm/src/lib.rs index bf57fb0dc0..df20154e07 100644 --- a/contracts/feature-tests/alloc-features/wasm/src/lib.rs +++ b/contracts/feature-tests/alloc-features/wasm/src/lib.rs @@ -10,9 +10,9 @@ // Total number of exported functions: 76 #![no_std] -#![feature(alloc_error_handler, lang_items)] +#![feature(lang_items)] -multiversx_sc_wasm_adapter::allocator!(); +multiversx_sc_wasm_adapter::allocator!(static64k); multiversx_sc_wasm_adapter::panic_handler!(); multiversx_sc_wasm_adapter::endpoints! { diff --git a/contracts/feature-tests/basic-features/Cargo.toml b/contracts/feature-tests/basic-features/Cargo.toml index 631285fc55..68b41866c1 100644 --- a/contracts/feature-tests/basic-features/Cargo.toml +++ b/contracts/feature-tests/basic-features/Cargo.toml @@ -9,15 +9,15 @@ publish = false path = "src/basic_features_main.rs" [dependencies.multiversx-sc] -version = "0.39.7" +version = "0.41.3" path = "../../../framework/base" [dev-dependencies.multiversx-sc-scenario] -version = "0.39.7" +version = "0.41.3" path = "../../../framework/scenario" [dependencies.multiversx-sc-modules] -version = "0.39.7" +version = "0.41.3" path = "../../../contracts/modules" [dev-dependencies.esdt-system-sc-mock] diff --git a/contracts/feature-tests/basic-features/meta/Cargo.toml b/contracts/feature-tests/basic-features/meta/Cargo.toml index 01910894ee..118fbc4b30 100644 --- a/contracts/feature-tests/basic-features/meta/Cargo.toml +++ b/contracts/feature-tests/basic-features/meta/Cargo.toml @@ -9,5 +9,5 @@ publish = false path = ".." [dependencies.multiversx-sc-meta] -version = "0.39.7" +version = "0.41.3" path = "../../../../framework/meta" diff --git a/contracts/feature-tests/basic-features/src/blockchain_api_features.rs b/contracts/feature-tests/basic-features/src/blockchain_api_features.rs index 1b1a19b4d1..73538d8aca 100644 --- a/contracts/feature-tests/basic-features/src/blockchain_api_features.rs +++ b/contracts/feature-tests/basic-features/src/blockchain_api_features.rs @@ -29,7 +29,7 @@ pub trait BlockchainApiFeatures { } #[endpoint] - fn get_tx_hash_legacy(&self) -> ManagedByteArray { + fn get_tx_hash(&self) -> ManagedByteArray { self.blockchain().get_tx_hash() } diff --git a/contracts/feature-tests/basic-features/src/storage_mapper_fungible_token.rs b/contracts/feature-tests/basic-features/src/storage_mapper_fungible_token.rs index d197a3b7ca..6eccdd3f83 100644 --- a/contracts/feature-tests/basic-features/src/storage_mapper_fungible_token.rs +++ b/contracts/feature-tests/basic-features/src/storage_mapper_fungible_token.rs @@ -13,7 +13,7 @@ pub trait FungibleTokenMapperFeatures: ) { let payment_amount = self.call_value().egld_value(); self.fungible_token_mapper().issue( - payment_amount, + payment_amount.clone_value(), ManagedBuffer::new(), token_ticker, initial_supply, @@ -33,7 +33,7 @@ pub trait FungibleTokenMapperFeatures: }; self.fungible_token_mapper().issue( - payment, + payment.clone_value(), ManagedBuffer::new(), token_ticker, initial_supply, @@ -51,7 +51,9 @@ pub trait FungibleTokenMapperFeatures: ManagedAsyncCallResult::Ok(token_id) => { self.fungible_token_mapper().set_token_id(token_id); }, - ManagedAsyncCallResult::Err(_) => {}, + ManagedAsyncCallResult::Err(_) => { + self.fungible_token_mapper().clear(); + }, } } @@ -62,7 +64,9 @@ pub trait FungibleTokenMapperFeatures: let token_identifier = self.call_value().single_esdt().token_identifier; self.fungible_token_mapper().set_token_id(token_identifier); }, - ManagedAsyncCallResult::Err(_) => {}, + ManagedAsyncCallResult::Err(_) => { + self.fungible_token_mapper().clear(); + }, } } @@ -71,7 +75,7 @@ pub trait FungibleTokenMapperFeatures: fn issue_and_set_all_roles_fungible(&self, token_ticker: ManagedBuffer) { let payment = self.call_value().egld_value(); self.fungible_token_mapper().issue_and_set_all_roles( - payment, + payment.clone_value(), ManagedBuffer::new(), token_ticker, 0, diff --git a/contracts/feature-tests/basic-features/src/storage_mapper_non_fungible_token.rs b/contracts/feature-tests/basic-features/src/storage_mapper_non_fungible_token.rs index 61775b743c..92963e5c11 100644 --- a/contracts/feature-tests/basic-features/src/storage_mapper_non_fungible_token.rs +++ b/contracts/feature-tests/basic-features/src/storage_mapper_non_fungible_token.rs @@ -18,7 +18,7 @@ pub trait NonFungibleTokenMapperFeatures: let payment = self.call_value().egld_value(); self.non_fungible_token_mapper().issue_and_set_all_roles( EsdtTokenType::Meta, - payment, + payment.clone_value(), ManagedBuffer::new(), token_ticker, 0, diff --git a/contracts/feature-tests/basic-features/tests/basic_features_big_num_test.rs b/contracts/feature-tests/basic-features/tests/basic_features_big_num_test.rs index 5bdac10834..78d0b12fec 100644 --- a/contracts/feature-tests/basic-features/tests/basic_features_big_num_test.rs +++ b/contracts/feature-tests/basic-features/tests/basic_features_big_num_test.rs @@ -1,7 +1,7 @@ use multiversx_sc::types::{BigInt, BigUint, ManagedBuffer}; use multiversx_sc_scenario::*; -use basic_features::big_num_methods::BigIntMethods; +use basic_features::{big_num_methods::BigIntMethods, big_num_operators::BigIntOperators}; #[test] fn test_big_uint_zero() { @@ -42,3 +42,35 @@ fn test_big_int_from() { let result = bf.big_int_from_i64_2(6); assert_eq!(BigInt::from(6), result); } + +fn check_big_uint_bitwise_and(a: u64, b: u64) { + let bf = basic_features::contract_obj::(); + let result = bf.bit_and_big_uint(BigUint::from(a), BigUint::from(b)); + assert_eq!(BigUint::from(a & b), result); +} + +#[test] +fn test_big_uint_bitwise_and() { + let _ = DebugApi::dummy(); + check_big_uint_bitwise_and(1, 1); + check_big_uint_bitwise_and(5, 7); + check_big_uint_bitwise_and(0, 1023); + check_big_uint_bitwise_and(0, 0); +} + +fn check_big_uint_shift(a: u64, b: usize) { + let bf = basic_features::contract_obj::(); + let result = bf.shl_big_uint(BigUint::from(a), b); + assert_eq!(BigUint::from(a << b), result); + let result = bf.shr_big_uint(BigUint::from(a), b); + assert_eq!(BigUint::from(a >> b), result); +} + +#[test] +fn test_big_uint_bitwise_shift() { + let _ = DebugApi::dummy(); + check_big_uint_shift(1, 3); + check_big_uint_shift(256, 0); + check_big_uint_shift(1023, 5); + check_big_uint_shift(0, 10); +} diff --git a/contracts/feature-tests/basic-features/tests/basic_features_scenario_go_test.rs b/contracts/feature-tests/basic-features/tests/basic_features_scenario_go_test.rs index ff00eb1899..a963e87ea3 100644 --- a/contracts/feature-tests/basic-features/tests/basic_features_scenario_go_test.rs +++ b/contracts/feature-tests/basic-features/tests/basic_features_scenario_go_test.rs @@ -1,10 +1,10 @@ #[test] -fn big_int_from_i64_go() { +fn big_int_from_i_64_go() { multiversx_sc_scenario::run_go("scenarios/big_int_from_i64.scen.json"); } #[test] -fn big_int_to_i64_go() { +fn big_int_to_i_64_go() { multiversx_sc_scenario::run_go("scenarios/big_int_to_i64.scen.json"); } @@ -14,22 +14,22 @@ fn big_num_conversions_go() { } #[test] -fn big_uint_eq_u64_go() { +fn big_uint_eq_u_64_go() { multiversx_sc_scenario::run_go("scenarios/big_uint_eq_u64.scen.json"); } #[test] -fn big_uint_sqrt_go() { - multiversx_sc_scenario::run_go("scenarios/big_uint_sqrt.scen.json"); +fn big_uint_from_u_64_go() { + multiversx_sc_scenario::run_go("scenarios/big_uint_from_u64.scen.json"); } #[test] -fn big_uint_from_u64_go() { - multiversx_sc_scenario::run_go("scenarios/big_uint_from_u64.scen.json"); +fn big_uint_sqrt_go() { + multiversx_sc_scenario::run_go("scenarios/big_uint_sqrt.scen.json"); } #[test] -fn big_uint_to_u64_go() { +fn big_uint_to_u_64_go() { multiversx_sc_scenario::run_go("scenarios/big_uint_to_u64.scen.json"); } @@ -54,42 +54,47 @@ fn crypto_elliptic_curves_go() { } #[test] -fn crypto_keccak256_go() { +fn crypto_keccak_256_go() { multiversx_sc_scenario::run_go("scenarios/crypto_keccak256.scen.json"); } #[test] -fn crypto_keccak256_legacy_managed_go() { +fn crypto_keccak_256_legacy_managed_go() { multiversx_sc_scenario::run_go("scenarios/crypto_keccak256_legacy_managed.scen.json"); } #[test] -fn crypto_ripemd160_go() { +fn crypto_ripemd_160_go() { multiversx_sc_scenario::run_go("scenarios/crypto_ripemd160.scen.json"); } #[test] -fn crypto_sha256_go() { +fn crypto_sha_256_go() { multiversx_sc_scenario::run_go("scenarios/crypto_sha256.scen.json"); } +#[test] +fn crypto_sha_256_legacy_managed_go() { + multiversx_sc_scenario::run_go("scenarios/crypto_sha256_legacy_managed.scen.json"); +} + #[test] fn crypto_verify_bls_go() { multiversx_sc_scenario::run_go("scenarios/crypto_verify_bls.scen.json"); } #[test] -fn crypto_verify_ed25519_go() { +fn crypto_verify_ed_25519_go() { multiversx_sc_scenario::run_go("scenarios/crypto_verify_ed25519.scen.json"); } #[test] -fn crypto_verify_secp256k1_go() { +fn crypto_verify_secp_256_k_1_go() { multiversx_sc_scenario::run_go("scenarios/crypto_verify_secp256k1.scen.json"); } #[test] -fn echo_array_u8_go() { +fn echo_array_u_8_go() { multiversx_sc_scenario::run_go("scenarios/echo_array_u8.scen.json"); } @@ -114,12 +119,12 @@ fn echo_big_uint_go() { } #[test] -fn echo_i32_go() { +fn echo_i_32_go() { multiversx_sc_scenario::run_go("scenarios/echo_i32.scen.json"); } #[test] -fn echo_i64_go() { +fn echo_i_64_go() { multiversx_sc_scenario::run_go("scenarios/echo_i64.scen.json"); } @@ -159,7 +164,7 @@ fn echo_tuple_into_multiresult_go() { } #[test] -fn echo_u64_go() { +fn echo_u_64_go() { multiversx_sc_scenario::run_go("scenarios/echo_u64.scen.json"); } @@ -179,7 +184,7 @@ fn echo_varargs_managed_sum_go() { } #[test] -fn echo_varargs_u32_go() { +fn echo_varargs_u_32_go() { multiversx_sc_scenario::run_go("scenarios/echo_varargs_u32.scen.json"); } @@ -234,13 +239,13 @@ fn managed_vec_address_push_go() { } #[test] -fn managed_vec_biguint_push_go() { - multiversx_sc_scenario::run_go("scenarios/managed_vec_biguint_push.scen.json"); +fn managed_vec_array_push_go() { + multiversx_sc_scenario::run_go("scenarios/managed_vec_array_push.scen.json"); } #[test] -fn managed_vec_array_push_go() { - multiversx_sc_scenario::run_go("scenarios/managed_vec_array_push.scen.json"); +fn managed_vec_biguint_push_go() { + multiversx_sc_scenario::run_go("scenarios/managed_vec_biguint_push.scen.json"); } #[test] @@ -273,11 +278,6 @@ fn sc_properties_go() { multiversx_sc_scenario::run_go("scenarios/sc_properties.scen.json"); } -#[test] -fn storage_raw_api_features_go() { - multiversx_sc_scenario::run_go("scenarios/storage_raw_api_features.scen.json"); -} - #[test] fn storage_big_int_go() { multiversx_sc_scenario::run_go("scenarios/storage_big_int.scen.json"); @@ -299,12 +299,12 @@ fn storage_clear_go() { } #[test] -fn storage_i64_go() { +fn storage_i_64_go() { multiversx_sc_scenario::run_go("scenarios/storage_i64.scen.json"); } #[test] -fn storage_i64_bad_go() { +fn storage_i_64_bad_go() { multiversx_sc_scenario::run_go("scenarios/storage_i64_bad.scen.json"); } @@ -319,17 +319,17 @@ fn storage_managed_address_go() { } #[test] -fn storage_map1_go() { +fn storage_map_1_go() { multiversx_sc_scenario::run_go("scenarios/storage_map1.scen.json"); } #[test] -fn storage_map2_go() { +fn storage_map_2_go() { multiversx_sc_scenario::run_go("scenarios/storage_map2.scen.json"); } #[test] -fn storage_map3_go() { +fn storage_map_3_go() { multiversx_sc_scenario::run_go("scenarios/storage_map3.scen.json"); } @@ -378,6 +378,11 @@ fn storage_mapper_token_attributes_go() { multiversx_sc_scenario::run_go("scenarios/storage_mapper_token_attributes.scen.json"); } +#[test] +fn storage_mapper_unique_id_go() { + multiversx_sc_scenario::run_go("scenarios/storage_mapper_unique_id.scen.json"); +} + #[test] fn storage_mapper_vec_go() { multiversx_sc_scenario::run_go("scenarios/storage_mapper_vec.scen.json"); @@ -393,18 +398,23 @@ fn storage_opt_managed_addr_go() { multiversx_sc_scenario::run_go("scenarios/storage_opt_managed_addr.scen.json"); } +#[test] +fn storage_raw_api_features_go() { + multiversx_sc_scenario::run_go("scenarios/storage_raw_api_features.scen.json"); +} + #[test] fn storage_reserved_go() { multiversx_sc_scenario::run_go("scenarios/storage_reserved.scen.json"); } #[test] -fn storage_u64_go() { +fn storage_u_64_go() { multiversx_sc_scenario::run_go("scenarios/storage_u64.scen.json"); } #[test] -fn storage_u64_bad_go() { +fn storage_u_64_bad_go() { multiversx_sc_scenario::run_go("scenarios/storage_u64_bad.scen.json"); } @@ -422,8 +432,3 @@ fn storage_usize_bad_go() { fn struct_eq_go() { multiversx_sc_scenario::run_go("scenarios/struct_eq.scen.json"); } - -#[test] -fn storage_mapper_unique_id_go() { - multiversx_sc_scenario::run_go("scenarios/storage_mapper_unique_id.scen.json"); -} diff --git a/contracts/feature-tests/basic-features/tests/basic_features_scenario_rs_test.rs b/contracts/feature-tests/basic-features/tests/basic_features_scenario_rs_test.rs index f634b3c225..7de11281be 100644 --- a/contracts/feature-tests/basic-features/tests/basic_features_scenario_rs_test.rs +++ b/contracts/feature-tests/basic-features/tests/basic_features_scenario_rs_test.rs @@ -17,12 +17,12 @@ fn world() -> ScenarioWorld { } #[test] -fn big_int_from_i64_rs() { +fn big_int_from_i_64_rs() { multiversx_sc_scenario::run_rs("scenarios/big_int_from_i64.scen.json", world()); } #[test] -fn big_int_to_i64_rs() { +fn big_int_to_i_64_rs() { multiversx_sc_scenario::run_rs("scenarios/big_int_to_i64.scen.json", world()); } @@ -32,22 +32,22 @@ fn big_num_conversions_rs() { } #[test] -fn big_uint_eq_u64_rs() { +fn big_uint_eq_u_64_rs() { multiversx_sc_scenario::run_rs("scenarios/big_uint_eq_u64.scen.json", world()); } #[test] -fn big_uint_sqrt_rs() { - multiversx_sc_scenario::run_rs("scenarios/big_uint_sqrt.scen.json", world()); +fn big_uint_from_u_64_rs() { + multiversx_sc_scenario::run_rs("scenarios/big_uint_from_u64.scen.json", world()); } #[test] -fn big_uint_from_u64_rs() { - multiversx_sc_scenario::run_rs("scenarios/big_uint_from_u64.scen.json", world()); +fn big_uint_sqrt_rs() { + multiversx_sc_scenario::run_rs("scenarios/big_uint_sqrt.scen.json", world()); } #[test] -fn big_uint_to_u64_rs() { +fn big_uint_to_u_64_rs() { multiversx_sc_scenario::run_rs("scenarios/big_uint_to_u64.scen.json", world()); } @@ -66,60 +66,60 @@ fn count_ones_rs() { multiversx_sc_scenario::run_rs("scenarios/count_ones.scen.json", world()); } -#[ignore] #[test] +#[ignore] fn crypto_elliptic_curves_rs() { multiversx_sc_scenario::run_rs("scenarios/crypto_elliptic_curves.scen.json", world()); } #[test] -fn crypto_keccak256_rs() { +fn crypto_keccak_256_rs() { multiversx_sc_scenario::run_rs("scenarios/crypto_keccak256.scen.json", world()); } #[test] -fn crypto_keccak256_legacy_managed_rs() { +fn crypto_keccak_256_legacy_managed_rs() { multiversx_sc_scenario::run_rs( "scenarios/crypto_keccak256_legacy_managed.scen.json", world(), ); } -#[ignore] #[test] -fn crypto_ripemd160_rs() { +#[ignore] +fn crypto_ripemd_160_rs() { multiversx_sc_scenario::run_rs("scenarios/crypto_ripemd160.scen.json", world()); } #[test] -fn crypto_sha256_rs() { +fn crypto_sha_256_rs() { multiversx_sc_scenario::run_rs("scenarios/crypto_sha256.scen.json", world()); } #[test] -fn crypto_sha256_legacy_managed_rs() { +fn crypto_sha_256_legacy_managed_rs() { multiversx_sc_scenario::run_rs("scenarios/crypto_sha256_legacy_managed.scen.json", world()); } -#[ignore] #[test] +#[ignore] fn crypto_verify_bls_rs() { multiversx_sc_scenario::run_rs("scenarios/crypto_verify_bls.scen.json", world()); } #[test] -fn crypto_verify_ed25519_rs() { +fn crypto_verify_ed_25519_rs() { multiversx_sc_scenario::run_rs("scenarios/crypto_verify_ed25519.scen.json", world()); } -#[ignore] #[test] -fn crypto_verify_secp256k1_rs() { +#[ignore] +fn crypto_verify_secp_256_k_1_rs() { multiversx_sc_scenario::run_rs("scenarios/crypto_verify_secp256k1.scen.json", world()); } #[test] -fn echo_array_u8_rs() { +fn echo_array_u_8_rs() { multiversx_sc_scenario::run_rs("scenarios/echo_array_u8.scen.json", world()); } @@ -144,12 +144,12 @@ fn echo_big_uint_rs() { } #[test] -fn echo_i32_rs() { +fn echo_i_32_rs() { multiversx_sc_scenario::run_rs("scenarios/echo_i32.scen.json", world()); } #[test] -fn echo_i64_rs() { +fn echo_i_64_rs() { multiversx_sc_scenario::run_rs("scenarios/echo_i64.scen.json", world()); } @@ -192,7 +192,7 @@ fn echo_tuple_into_multiresult_rs() { } #[test] -fn echo_u64_rs() { +fn echo_u_64_rs() { multiversx_sc_scenario::run_rs("scenarios/echo_u64.scen.json", world()); } @@ -212,7 +212,7 @@ fn echo_varargs_managed_sum_rs() { } #[test] -fn echo_varargs_u32_rs() { +fn echo_varargs_u_32_rs() { multiversx_sc_scenario::run_rs("scenarios/echo_varargs_u32.scen.json", world()); } @@ -262,8 +262,8 @@ fn managed_buffer_eq_rs() { multiversx_sc_scenario::run_rs("scenarios/managed_buffer_eq.scen.json", world()); } -#[ignore] #[test] +#[ignore] fn managed_buffer_set_random_rs() { multiversx_sc_scenario::run_rs("scenarios/managed_buffer_set_random.scen.json", world()); } @@ -274,13 +274,13 @@ fn managed_vec_address_push_rs() { } #[test] -fn managed_vec_biguint_push_rs() { - multiversx_sc_scenario::run_rs("scenarios/managed_vec_biguint_push.scen.json", world()); +fn managed_vec_array_push_rs() { + multiversx_sc_scenario::run_rs("scenarios/managed_vec_array_push.scen.json", world()); } #[test] -fn managed_vec_array_push_rs() { - multiversx_sc_scenario::run_rs("scenarios/managed_vec_array_push.scen.json", world()); +fn managed_vec_biguint_push_rs() { + multiversx_sc_scenario::run_rs("scenarios/managed_vec_biguint_push.scen.json", world()); } #[test] @@ -294,8 +294,8 @@ fn only_user_account_rs() { } // Will never run in scenarios-rs. -#[ignore] #[test] +#[ignore] fn out_of_gas_rs() { multiversx_sc_scenario::run_rs("scenarios/out_of_gas.scen.json", world()); } @@ -315,11 +315,6 @@ fn sc_properties_rs() { multiversx_sc_scenario::run_rs("scenarios/sc_properties.scen.json", world()); } -#[test] -fn storage_raw_api_features_rs() { - multiversx_sc_scenario::run_rs("scenarios/storage_raw_api_features.scen.json", world()); -} - #[test] fn storage_big_int_rs() { multiversx_sc_scenario::run_rs("scenarios/storage_big_int.scen.json", world()); @@ -341,12 +336,12 @@ fn storage_clear_rs() { } #[test] -fn storage_i64_rs() { +fn storage_i_64_rs() { multiversx_sc_scenario::run_rs("scenarios/storage_i64.scen.json", world()); } #[test] -fn storage_i64_bad_rs() { +fn storage_i_64_bad_rs() { multiversx_sc_scenario::run_rs("scenarios/storage_i64_bad.scen.json", world()); } @@ -361,22 +356,22 @@ fn storage_managed_address_rs() { } #[test] -fn storage_map1_rs() { +fn storage_map_1_rs() { multiversx_sc_scenario::run_rs("scenarios/storage_map1.scen.json", world()); } #[test] -fn storage_map2_rs() { +fn storage_map_2_rs() { multiversx_sc_scenario::run_rs("scenarios/storage_map2.scen.json", world()); } #[test] -fn storage_map3_rs() { +fn storage_map_3_rs() { multiversx_sc_scenario::run_rs("scenarios/storage_map3.scen.json", world()); } -#[ignore] #[test] +#[ignore] fn storage_mapper_fungible_token_rs() { multiversx_sc_scenario::run_rs("scenarios/storage_mapper_fungible_token.scen.json", world()); } @@ -396,8 +391,8 @@ fn storage_mapper_map_storage_rs() { multiversx_sc_scenario::run_rs("scenarios/storage_mapper_map_storage.scen.json", world()); } -#[ignore] #[test] +#[ignore] fn storage_mapper_non_fungible_token_rs() { multiversx_sc_scenario::run_rs( "scenarios/storage_mapper_non_fungible_token.scen.json", @@ -428,6 +423,11 @@ fn storage_mapper_token_attributes_rs() { ); } +#[test] +fn storage_mapper_unique_id_rs() { + multiversx_sc_scenario::run_rs("scenarios/storage_mapper_unique_id.scen.json", world()); +} + #[test] fn storage_mapper_vec_rs() { multiversx_sc_scenario::run_rs("scenarios/storage_mapper_vec.scen.json", world()); @@ -443,18 +443,23 @@ fn storage_opt_managed_addr_rs() { multiversx_sc_scenario::run_rs("scenarios/storage_opt_managed_addr.scen.json", world()); } +#[test] +fn storage_raw_api_features_rs() { + multiversx_sc_scenario::run_rs("scenarios/storage_raw_api_features.scen.json", world()); +} + #[test] fn storage_reserved_rs() { multiversx_sc_scenario::run_rs("scenarios/storage_reserved.scen.json", world()); } #[test] -fn storage_u64_rs() { +fn storage_u_64_rs() { multiversx_sc_scenario::run_rs("scenarios/storage_u64.scen.json", world()); } #[test] -fn storage_u64_bad_rs() { +fn storage_u_64_bad_rs() { multiversx_sc_scenario::run_rs("scenarios/storage_u64_bad.scen.json", world()); } @@ -472,8 +477,3 @@ fn storage_usize_bad_rs() { fn struct_eq_rs() { multiversx_sc_scenario::run_rs("scenarios/struct_eq.scen.json", world()); } - -#[test] -fn storage_mapper_unique_id_rs() { - multiversx_sc_scenario::run_rs("scenarios/storage_mapper_unique_id.scen.json", world()); -} diff --git a/contracts/feature-tests/basic-features/wasm/Cargo.lock b/contracts/feature-tests/basic-features/wasm/Cargo.lock index 83fa757ccc..41f23cdaae 100755 --- a/contracts/feature-tests/basic-features/wasm/Cargo.lock +++ b/contracts/feature-tests/basic-features/wasm/Cargo.lock @@ -8,16 +8,16 @@ version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "once_cell", "version_check", ] [[package]] name = "arrayvec" -version = "0.7.2" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" +checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" [[package]] name = "autocfg" @@ -47,12 +47,6 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" -[[package]] -name = "cfg-if" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" - [[package]] name = "cfg-if" version = "1.0.0" @@ -86,21 +80,9 @@ version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ebdb29d2ea9ed0083cd8cece49bbd968021bd99b0849edb4a9a7ee0fdf6a4e0" -[[package]] -name = "libc" -version = "0.2.140" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99227334921fae1a979cf0bfdfcc6b3e5ce376ef57e16fb6fb3ea2ed6095f80c" - -[[package]] -name = "memory_units" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8452105ba047068f40ff7093dd1d9da90898e63dd61736462e9cdda6a90ad3c3" - [[package]] name = "multiversx-sc" -version = "0.39.7" +version = "0.41.3" dependencies = [ "bitflags", "hashbrown", @@ -112,7 +94,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.17.1" +version = "0.17.2" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -120,7 +102,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.17.1" +version = "0.17.2" dependencies = [ "hex", "proc-macro2", @@ -130,7 +112,7 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.39.7" +version = "0.41.3" dependencies = [ "hex", "proc-macro2", @@ -141,17 +123,16 @@ dependencies = [ [[package]] name = "multiversx-sc-modules" -version = "0.39.7" +version = "0.41.3" dependencies = [ "multiversx-sc", ] [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.39.7" +version = "0.41.3" dependencies = [ "multiversx-sc", - "wee_alloc", ] [[package]] @@ -174,24 +155,24 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.17.1" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" +checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" [[package]] name = "proc-macro2" -version = "1.0.52" +version = "1.0.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d0e1ae9e836cc3beddd63db0df682593d7e2d3d891ae8c9083d2113e1744224" +checksum = "dec2b086b7a862cf4de201096214fa870344cf922b2b30c167badb3af3195406" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.26" +version = "1.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4424af4bf778aae2051a77b60283332f386554255d722233d09fbfc7e30da2fc" +checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488" dependencies = [ "proc-macro2", ] @@ -225,46 +206,12 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.8" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4" +checksum = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0" [[package]] name = "version_check" version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" - -[[package]] -name = "wee_alloc" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbb3b5a6b2bb17cb6ad44a2e68a43e8d2722c997da10e928665c72ec6c0a0b8e" -dependencies = [ - "cfg-if 0.1.10", - "libc", - "memory_units", - "winapi", -] - -[[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-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" diff --git a/contracts/feature-tests/basic-features/wasm/Cargo.toml b/contracts/feature-tests/basic-features/wasm/Cargo.toml index ded272455a..5b6cac156a 100644 --- a/contracts/feature-tests/basic-features/wasm/Cargo.toml +++ b/contracts/feature-tests/basic-features/wasm/Cargo.toml @@ -19,7 +19,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.39.7" +version = "0.41.3" path = "../../../../framework/wasm-adapter" [workspace] diff --git a/contracts/feature-tests/basic-features/wasm/src/lib.rs b/contracts/feature-tests/basic-features/wasm/src/lib.rs index fea747cb65..9b9ec4b3a2 100644 --- a/contracts/feature-tests/basic-features/wasm/src/lib.rs +++ b/contracts/feature-tests/basic-features/wasm/src/lib.rs @@ -10,7 +10,7 @@ // Total number of exported functions: 342 #![no_std] -#![feature(alloc_error_handler, lang_items)] +#![feature(lang_items)] multiversx_sc_wasm_adapter::allocator!(); multiversx_sc_wasm_adapter::panic_handler!(); @@ -124,7 +124,7 @@ multiversx_sc_wasm_adapter::endpoints! { get_shard_of_address is_smart_contract get_state_root_hash - get_tx_hash_legacy + get_tx_hash get_gas_left get_cumulated_validator_rewards codec_err_finish diff --git a/contracts/feature-tests/big-float-features/Cargo.toml b/contracts/feature-tests/big-float-features/Cargo.toml index d8e3fdb932..b6790e6d71 100644 --- a/contracts/feature-tests/big-float-features/Cargo.toml +++ b/contracts/feature-tests/big-float-features/Cargo.toml @@ -9,12 +9,12 @@ publish = false path = "src/big_float_main.rs" [dependencies.multiversx-sc] -version = "0.39.7" +version = "0.41.3" path = "../../../framework/base" features = ["big-float"] [dev-dependencies.multiversx-sc-scenario] -version = "0.39.7" +version = "0.41.3" path = "../../../framework/scenario" [dev-dependencies.esdt-system-sc-mock] diff --git a/contracts/feature-tests/big-float-features/meta/Cargo.toml b/contracts/feature-tests/big-float-features/meta/Cargo.toml index 2ec5f58140..6a920279c4 100644 --- a/contracts/feature-tests/big-float-features/meta/Cargo.toml +++ b/contracts/feature-tests/big-float-features/meta/Cargo.toml @@ -9,5 +9,5 @@ publish = false path = ".." [dependencies.multiversx-sc-meta] -version = "0.39.7" +version = "0.41.3" path = "../../../../framework/meta" diff --git a/contracts/feature-tests/big-float-features/tests/big_float_scenario_go_test.rs b/contracts/feature-tests/big-float-features/tests/big_float_scenario_go_test.rs index 501152fb29..e8ec73d2fd 100644 --- a/contracts/feature-tests/big-float-features/tests/big_float_scenario_go_test.rs +++ b/contracts/feature-tests/big-float-features/tests/big_float_scenario_go_test.rs @@ -1,8 +1,3 @@ -#[test] -fn big_float_new_from_frac_go() { - multiversx_sc_scenario::run_go("scenarios/big_float_new_from_frac.scen.json"); -} - #[test] fn big_float_new_from_big_int_go() { multiversx_sc_scenario::run_go("scenarios/big_float_new_from_big_int.scen.json"); @@ -13,6 +8,11 @@ fn big_float_new_from_big_uint_go() { multiversx_sc_scenario::run_go("scenarios/big_float_new_from_big_uint.scen.json"); } +#[test] +fn big_float_new_from_frac_go() { + multiversx_sc_scenario::run_go("scenarios/big_float_new_from_frac.scen.json"); +} + #[test] fn big_float_new_from_int_go() { multiversx_sc_scenario::run_go("scenarios/big_float_new_from_int.scen.json"); @@ -34,11 +34,11 @@ fn big_float_new_from_sci_go() { } #[test] -fn big_float_operators_go() { - multiversx_sc_scenario::run_go("scenarios/big_float_operators.scen.json"); +fn big_float_operator_checks_go() { + multiversx_sc_scenario::run_go("scenarios/big_float_operator_checks.scen.json"); } #[test] -fn big_float_operator_checks_go() { - multiversx_sc_scenario::run_go("scenarios/big_float_operator_checks.scen.json"); +fn big_float_operators_go() { + multiversx_sc_scenario::run_go("scenarios/big_float_operators.scen.json"); } diff --git a/contracts/feature-tests/big-float-features/tests/big_float_scenario_rs_test.rs b/contracts/feature-tests/big-float-features/tests/big_float_scenario_rs_test.rs index 11cc0bd215..e236ee7163 100644 --- a/contracts/feature-tests/big-float-features/tests/big_float_scenario_rs_test.rs +++ b/contracts/feature-tests/big-float-features/tests/big_float_scenario_rs_test.rs @@ -36,8 +36,8 @@ fn big_float_new_from_int_rs() { multiversx_sc_scenario::run_rs("scenarios/big_float_new_from_int.scen.json", world()); } -#[ignore] #[test] +#[ignore] fn big_float_new_from_managed_buffer_rs() { multiversx_sc_scenario::run_rs( "scenarios/big_float_new_from_managed_buffer.scen.json", @@ -56,12 +56,12 @@ fn big_float_new_from_sci_rs() { } #[test] -fn big_float_operators_rs() { - multiversx_sc_scenario::run_rs("scenarios/big_float_operators.scen.json", world()); -} - #[ignore] -#[test] fn big_float_operator_checks_rs() { multiversx_sc_scenario::run_rs("scenarios/big_float_operator_checks.scen.json", world()); } + +#[test] +fn big_float_operators_rs() { + multiversx_sc_scenario::run_rs("scenarios/big_float_operators.scen.json", world()); +} diff --git a/contracts/feature-tests/big-float-features/wasm/Cargo.lock b/contracts/feature-tests/big-float-features/wasm/Cargo.lock index 3841b476e0..aa3c065268 100644 --- a/contracts/feature-tests/big-float-features/wasm/Cargo.lock +++ b/contracts/feature-tests/big-float-features/wasm/Cargo.lock @@ -8,16 +8,16 @@ version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "once_cell", "version_check", ] [[package]] name = "arrayvec" -version = "0.7.2" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" +checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" [[package]] name = "autocfg" @@ -46,12 +46,6 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" -[[package]] -name = "cfg-if" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" - [[package]] name = "cfg-if" version = "1.0.0" @@ -85,21 +79,9 @@ version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ebdb29d2ea9ed0083cd8cece49bbd968021bd99b0849edb4a9a7ee0fdf6a4e0" -[[package]] -name = "libc" -version = "0.2.140" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99227334921fae1a979cf0bfdfcc6b3e5ce376ef57e16fb6fb3ea2ed6095f80c" - -[[package]] -name = "memory_units" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8452105ba047068f40ff7093dd1d9da90898e63dd61736462e9cdda6a90ad3c3" - [[package]] name = "multiversx-sc" -version = "0.39.7" +version = "0.41.3" dependencies = [ "bitflags", "hashbrown", @@ -111,7 +93,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.17.1" +version = "0.17.2" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -119,7 +101,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.17.1" +version = "0.17.2" dependencies = [ "hex", "proc-macro2", @@ -129,7 +111,7 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.39.7" +version = "0.41.3" dependencies = [ "hex", "proc-macro2", @@ -140,10 +122,9 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.39.7" +version = "0.41.3" dependencies = [ "multiversx-sc", - "wee_alloc", ] [[package]] @@ -166,24 +147,24 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.17.1" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" +checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" [[package]] name = "proc-macro2" -version = "1.0.52" +version = "1.0.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d0e1ae9e836cc3beddd63db0df682593d7e2d3d891ae8c9083d2113e1744224" +checksum = "dec2b086b7a862cf4de201096214fa870344cf922b2b30c167badb3af3195406" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.26" +version = "1.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4424af4bf778aae2051a77b60283332f386554255d722233d09fbfc7e30da2fc" +checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488" dependencies = [ "proc-macro2", ] @@ -217,46 +198,12 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.8" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4" +checksum = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0" [[package]] name = "version_check" version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" - -[[package]] -name = "wee_alloc" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbb3b5a6b2bb17cb6ad44a2e68a43e8d2722c997da10e928665c72ec6c0a0b8e" -dependencies = [ - "cfg-if 0.1.10", - "libc", - "memory_units", - "winapi", -] - -[[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-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" diff --git a/contracts/feature-tests/big-float-features/wasm/Cargo.toml b/contracts/feature-tests/big-float-features/wasm/Cargo.toml index 57252caa63..bf05faa5ab 100644 --- a/contracts/feature-tests/big-float-features/wasm/Cargo.toml +++ b/contracts/feature-tests/big-float-features/wasm/Cargo.toml @@ -19,7 +19,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.39.7" +version = "0.41.3" path = "../../../../framework/wasm-adapter" [workspace] diff --git a/contracts/feature-tests/big-float-features/wasm/src/lib.rs b/contracts/feature-tests/big-float-features/wasm/src/lib.rs index 5beef912c2..1d7df1a837 100644 --- a/contracts/feature-tests/big-float-features/wasm/src/lib.rs +++ b/contracts/feature-tests/big-float-features/wasm/src/lib.rs @@ -10,7 +10,7 @@ // Total number of exported functions: 72 #![no_std] -#![feature(alloc_error_handler, lang_items)] +#![feature(lang_items)] multiversx_sc_wasm_adapter::allocator!(); multiversx_sc_wasm_adapter::panic_handler!(); diff --git a/contracts/feature-tests/composability/Cargo.toml b/contracts/feature-tests/composability/Cargo.toml index 6fed3bddd0..bd6550ae43 100644 --- a/contracts/feature-tests/composability/Cargo.toml +++ b/contracts/feature-tests/composability/Cargo.toml @@ -27,5 +27,5 @@ path = "recursive-caller" path = "vault" [dev-dependencies.multiversx-sc-scenario] -version = "0.39.7" +version = "0.41.3" path = "../../../framework/scenario" diff --git a/contracts/feature-tests/composability/esdt-contract-pair/Cargo.toml b/contracts/feature-tests/composability/esdt-contract-pair/Cargo.toml index e8c5501121..cd218f06ce 100644 --- a/contracts/feature-tests/composability/esdt-contract-pair/Cargo.toml +++ b/contracts/feature-tests/composability/esdt-contract-pair/Cargo.toml @@ -12,9 +12,9 @@ path = "first-contract" path = "second-contract" [dev-dependencies.multiversx-sc] -version = "0.39.7" +version = "0.41.3" path = "../../../../framework/base" [dev-dependencies.multiversx-sc-scenario] -version = "0.39.7" +version = "0.41.3" path = "../../../../framework/scenario" diff --git a/contracts/feature-tests/composability/esdt-contract-pair/first-contract/Cargo.toml b/contracts/feature-tests/composability/esdt-contract-pair/first-contract/Cargo.toml index d3babf4b25..eca5f7cdff 100644 --- a/contracts/feature-tests/composability/esdt-contract-pair/first-contract/Cargo.toml +++ b/contracts/feature-tests/composability/esdt-contract-pair/first-contract/Cargo.toml @@ -10,10 +10,10 @@ path = "src/lib.rs" [dependencies.multiversx-sc] -version = "0.39.7" +version = "0.41.3" path = "../../../../../framework/base" [dev-dependencies.multiversx-sc-scenario] -version = "0.39.7" +version = "0.41.3" path = "../../../../../framework/scenario" diff --git a/contracts/feature-tests/composability/esdt-contract-pair/first-contract/meta/Cargo.toml b/contracts/feature-tests/composability/esdt-contract-pair/first-contract/meta/Cargo.toml index 8dffc39592..9fed1c18ce 100644 --- a/contracts/feature-tests/composability/esdt-contract-pair/first-contract/meta/Cargo.toml +++ b/contracts/feature-tests/composability/esdt-contract-pair/first-contract/meta/Cargo.toml @@ -8,9 +8,9 @@ publish = false path = ".." [dependencies.multiversx-sc] -version = "0.39.7" +version = "0.41.3" path = "../../../../../../framework/base" [dependencies.multiversx-sc-meta] -version = "0.39.7" +version = "0.41.3" path = "../../../../../../framework/meta" diff --git a/contracts/feature-tests/composability/esdt-contract-pair/first-contract/wasm/Cargo.lock b/contracts/feature-tests/composability/esdt-contract-pair/first-contract/wasm/Cargo.lock index 2be336adfc..782453e7e6 100755 --- a/contracts/feature-tests/composability/esdt-contract-pair/first-contract/wasm/Cargo.lock +++ b/contracts/feature-tests/composability/esdt-contract-pair/first-contract/wasm/Cargo.lock @@ -8,16 +8,16 @@ version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "once_cell", "version_check", ] [[package]] name = "arrayvec" -version = "0.7.2" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" +checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" [[package]] name = "autocfg" @@ -31,12 +31,6 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" -[[package]] -name = "cfg-if" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" - [[package]] name = "cfg-if" version = "1.0.0" @@ -85,21 +79,9 @@ version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ebdb29d2ea9ed0083cd8cece49bbd968021bd99b0849edb4a9a7ee0fdf6a4e0" -[[package]] -name = "libc" -version = "0.2.140" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99227334921fae1a979cf0bfdfcc6b3e5ce376ef57e16fb6fb3ea2ed6095f80c" - -[[package]] -name = "memory_units" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8452105ba047068f40ff7093dd1d9da90898e63dd61736462e9cdda6a90ad3c3" - [[package]] name = "multiversx-sc" -version = "0.39.7" +version = "0.41.3" dependencies = [ "bitflags", "hashbrown", @@ -111,7 +93,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.17.1" +version = "0.17.2" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -119,7 +101,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.17.1" +version = "0.17.2" dependencies = [ "hex", "proc-macro2", @@ -129,7 +111,7 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.39.7" +version = "0.41.3" dependencies = [ "hex", "proc-macro2", @@ -140,10 +122,9 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.39.7" +version = "0.41.3" dependencies = [ "multiversx-sc", - "wee_alloc", ] [[package]] @@ -166,24 +147,24 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.17.1" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" +checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" [[package]] name = "proc-macro2" -version = "1.0.52" +version = "1.0.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d0e1ae9e836cc3beddd63db0df682593d7e2d3d891ae8c9083d2113e1744224" +checksum = "dec2b086b7a862cf4de201096214fa870344cf922b2b30c167badb3af3195406" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.26" +version = "1.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4424af4bf778aae2051a77b60283332f386554255d722233d09fbfc7e30da2fc" +checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488" dependencies = [ "proc-macro2", ] @@ -217,46 +198,12 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.8" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4" +checksum = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0" [[package]] name = "version_check" version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" - -[[package]] -name = "wee_alloc" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbb3b5a6b2bb17cb6ad44a2e68a43e8d2722c997da10e928665c72ec6c0a0b8e" -dependencies = [ - "cfg-if 0.1.10", - "libc", - "memory_units", - "winapi", -] - -[[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-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" diff --git a/contracts/feature-tests/composability/esdt-contract-pair/first-contract/wasm/Cargo.toml b/contracts/feature-tests/composability/esdt-contract-pair/first-contract/wasm/Cargo.toml index 57abab4ecb..9c98ec6827 100644 --- a/contracts/feature-tests/composability/esdt-contract-pair/first-contract/wasm/Cargo.toml +++ b/contracts/feature-tests/composability/esdt-contract-pair/first-contract/wasm/Cargo.toml @@ -19,7 +19,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.39.7" +version = "0.41.3" path = "../../../../../../framework/wasm-adapter" [workspace] diff --git a/contracts/feature-tests/composability/esdt-contract-pair/first-contract/wasm/src/lib.rs b/contracts/feature-tests/composability/esdt-contract-pair/first-contract/wasm/src/lib.rs index 0c47457edd..19d94710db 100644 --- a/contracts/feature-tests/composability/esdt-contract-pair/first-contract/wasm/src/lib.rs +++ b/contracts/feature-tests/composability/esdt-contract-pair/first-contract/wasm/src/lib.rs @@ -10,7 +10,7 @@ // Total number of exported functions: 9 #![no_std] -#![feature(alloc_error_handler, lang_items)] +#![feature(lang_items)] multiversx_sc_wasm_adapter::allocator!(); multiversx_sc_wasm_adapter::panic_handler!(); diff --git a/contracts/feature-tests/composability/esdt-contract-pair/second-contract/Cargo.toml b/contracts/feature-tests/composability/esdt-contract-pair/second-contract/Cargo.toml index 6727bdae4b..5d4e54a0d3 100644 --- a/contracts/feature-tests/composability/esdt-contract-pair/second-contract/Cargo.toml +++ b/contracts/feature-tests/composability/esdt-contract-pair/second-contract/Cargo.toml @@ -10,10 +10,10 @@ path = "src/lib.rs" [dependencies.multiversx-sc] -version = "0.39.7" +version = "0.41.3" path = "../../../../../framework/base" [dev-dependencies.multiversx-sc-scenario] -version = "0.39.7" +version = "0.41.3" path = "../../../../../framework/scenario" diff --git a/contracts/feature-tests/composability/esdt-contract-pair/second-contract/meta/Cargo.toml b/contracts/feature-tests/composability/esdt-contract-pair/second-contract/meta/Cargo.toml index 931c7fa5c4..7c7971548a 100644 --- a/contracts/feature-tests/composability/esdt-contract-pair/second-contract/meta/Cargo.toml +++ b/contracts/feature-tests/composability/esdt-contract-pair/second-contract/meta/Cargo.toml @@ -8,9 +8,9 @@ publish = false path = ".." [dependencies.multiversx-sc] -version = "0.39.7" +version = "0.41.3" path = "../../../../../../framework/base" [dependencies.multiversx-sc-meta] -version = "0.39.7" +version = "0.41.3" path = "../../../../../../framework/meta" diff --git a/contracts/feature-tests/composability/esdt-contract-pair/second-contract/wasm/Cargo.lock b/contracts/feature-tests/composability/esdt-contract-pair/second-contract/wasm/Cargo.lock index 431906eddc..c50c0f3ff5 100755 --- a/contracts/feature-tests/composability/esdt-contract-pair/second-contract/wasm/Cargo.lock +++ b/contracts/feature-tests/composability/esdt-contract-pair/second-contract/wasm/Cargo.lock @@ -8,16 +8,16 @@ version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "once_cell", "version_check", ] [[package]] name = "arrayvec" -version = "0.7.2" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" +checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" [[package]] name = "autocfg" @@ -31,12 +31,6 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" -[[package]] -name = "cfg-if" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" - [[package]] name = "cfg-if" version = "1.0.0" @@ -70,21 +64,9 @@ version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ebdb29d2ea9ed0083cd8cece49bbd968021bd99b0849edb4a9a7ee0fdf6a4e0" -[[package]] -name = "libc" -version = "0.2.140" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99227334921fae1a979cf0bfdfcc6b3e5ce376ef57e16fb6fb3ea2ed6095f80c" - -[[package]] -name = "memory_units" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8452105ba047068f40ff7093dd1d9da90898e63dd61736462e9cdda6a90ad3c3" - [[package]] name = "multiversx-sc" -version = "0.39.7" +version = "0.41.3" dependencies = [ "bitflags", "hashbrown", @@ -96,7 +78,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.17.1" +version = "0.17.2" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -104,7 +86,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.17.1" +version = "0.17.2" dependencies = [ "hex", "proc-macro2", @@ -114,7 +96,7 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.39.7" +version = "0.41.3" dependencies = [ "hex", "proc-macro2", @@ -125,10 +107,9 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.39.7" +version = "0.41.3" dependencies = [ "multiversx-sc", - "wee_alloc", ] [[package]] @@ -151,24 +132,24 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.17.1" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" +checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" [[package]] name = "proc-macro2" -version = "1.0.52" +version = "1.0.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d0e1ae9e836cc3beddd63db0df682593d7e2d3d891ae8c9083d2113e1744224" +checksum = "dec2b086b7a862cf4de201096214fa870344cf922b2b30c167badb3af3195406" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.26" +version = "1.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4424af4bf778aae2051a77b60283332f386554255d722233d09fbfc7e30da2fc" +checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488" dependencies = [ "proc-macro2", ] @@ -217,46 +198,12 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.8" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4" +checksum = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0" [[package]] name = "version_check" version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" - -[[package]] -name = "wee_alloc" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbb3b5a6b2bb17cb6ad44a2e68a43e8d2722c997da10e928665c72ec6c0a0b8e" -dependencies = [ - "cfg-if 0.1.10", - "libc", - "memory_units", - "winapi", -] - -[[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-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" diff --git a/contracts/feature-tests/composability/esdt-contract-pair/second-contract/wasm/Cargo.toml b/contracts/feature-tests/composability/esdt-contract-pair/second-contract/wasm/Cargo.toml index 2bf8d61d12..cffa112c86 100644 --- a/contracts/feature-tests/composability/esdt-contract-pair/second-contract/wasm/Cargo.toml +++ b/contracts/feature-tests/composability/esdt-contract-pair/second-contract/wasm/Cargo.toml @@ -19,7 +19,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.39.7" +version = "0.41.3" path = "../../../../../../framework/wasm-adapter" [workspace] diff --git a/contracts/feature-tests/composability/esdt-contract-pair/second-contract/wasm/src/lib.rs b/contracts/feature-tests/composability/esdt-contract-pair/second-contract/wasm/src/lib.rs index d95e186663..44c413e39a 100644 --- a/contracts/feature-tests/composability/esdt-contract-pair/second-contract/wasm/src/lib.rs +++ b/contracts/feature-tests/composability/esdt-contract-pair/second-contract/wasm/src/lib.rs @@ -10,7 +10,7 @@ // Total number of exported functions: 5 #![no_std] -#![feature(alloc_error_handler, lang_items)] +#![feature(lang_items)] multiversx_sc_wasm_adapter::allocator!(); multiversx_sc_wasm_adapter::panic_handler!(); diff --git a/contracts/feature-tests/composability/execute-on-dest-esdt-issue-callback/Cargo.toml b/contracts/feature-tests/composability/execute-on-dest-esdt-issue-callback/Cargo.toml index 51be639bf3..232bc33b24 100644 --- a/contracts/feature-tests/composability/execute-on-dest-esdt-issue-callback/Cargo.toml +++ b/contracts/feature-tests/composability/execute-on-dest-esdt-issue-callback/Cargo.toml @@ -16,9 +16,9 @@ path = "parent" path = "child" [dependencies.multiversx-sc] -version = "0.39.7" +version = "0.41.3" path = "../../../framework/base" [dev-dependencies.multiversx-sc-scenario] -version = "0.39.7" +version = "0.41.3" path = "../../../framework/scenario" diff --git a/contracts/feature-tests/composability/execute-on-dest-esdt-issue-callback/child/Cargo.toml b/contracts/feature-tests/composability/execute-on-dest-esdt-issue-callback/child/Cargo.toml index 6153ca9298..0d29aedac6 100644 --- a/contracts/feature-tests/composability/execute-on-dest-esdt-issue-callback/child/Cargo.toml +++ b/contracts/feature-tests/composability/execute-on-dest-esdt-issue-callback/child/Cargo.toml @@ -10,9 +10,9 @@ path = "src/lib.rs" [dependencies.multiversx-sc] -version = "0.39.7" +version = "0.41.3" path = "../../../../../framework/base" [dev-dependencies.multiversx-sc-scenario] -version = "0.39.7" +version = "0.41.3" path = "../../../../../framework/scenario" diff --git a/contracts/feature-tests/composability/execute-on-dest-esdt-issue-callback/child/meta/Cargo.toml b/contracts/feature-tests/composability/execute-on-dest-esdt-issue-callback/child/meta/Cargo.toml index 01556fd04c..c8b0d49500 100644 --- a/contracts/feature-tests/composability/execute-on-dest-esdt-issue-callback/child/meta/Cargo.toml +++ b/contracts/feature-tests/composability/execute-on-dest-esdt-issue-callback/child/meta/Cargo.toml @@ -8,9 +8,9 @@ publish = false path = ".." [dependencies.multiversx-sc] -version = "0.39.7" +version = "0.41.3" path = "../../../../../../framework/base" [dependencies.multiversx-sc-meta] -version = "0.39.7" +version = "0.41.3" path = "../../../../../../framework/meta" diff --git a/contracts/feature-tests/composability/execute-on-dest-esdt-issue-callback/child/src/lib.rs b/contracts/feature-tests/composability/execute-on-dest-esdt-issue-callback/child/src/lib.rs index 63f3ba256f..3126cdbfd8 100644 --- a/contracts/feature-tests/composability/execute-on-dest-esdt-issue-callback/child/src/lib.rs +++ b/contracts/feature-tests/composability/execute-on-dest-esdt-issue-callback/child/src/lib.rs @@ -21,7 +21,7 @@ pub trait Child { self.send() .esdt_system_sc_proxy() .issue_fungible( - issue_cost, + issue_cost.clone_value(), &token_display_name, &token_ticker, &initial_supply, diff --git a/contracts/feature-tests/composability/execute-on-dest-esdt-issue-callback/child/wasm/Cargo.lock b/contracts/feature-tests/composability/execute-on-dest-esdt-issue-callback/child/wasm/Cargo.lock index 67d2286210..eba417be68 100755 --- a/contracts/feature-tests/composability/execute-on-dest-esdt-issue-callback/child/wasm/Cargo.lock +++ b/contracts/feature-tests/composability/execute-on-dest-esdt-issue-callback/child/wasm/Cargo.lock @@ -8,16 +8,16 @@ version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "once_cell", "version_check", ] [[package]] name = "arrayvec" -version = "0.7.2" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" +checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" [[package]] name = "autocfg" @@ -31,12 +31,6 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" -[[package]] -name = "cfg-if" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" - [[package]] name = "cfg-if" version = "1.0.0" @@ -85,21 +79,9 @@ version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ebdb29d2ea9ed0083cd8cece49bbd968021bd99b0849edb4a9a7ee0fdf6a4e0" -[[package]] -name = "libc" -version = "0.2.140" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99227334921fae1a979cf0bfdfcc6b3e5ce376ef57e16fb6fb3ea2ed6095f80c" - -[[package]] -name = "memory_units" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8452105ba047068f40ff7093dd1d9da90898e63dd61736462e9cdda6a90ad3c3" - [[package]] name = "multiversx-sc" -version = "0.39.7" +version = "0.41.3" dependencies = [ "bitflags", "hashbrown", @@ -111,7 +93,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.17.1" +version = "0.17.2" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -119,7 +101,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.17.1" +version = "0.17.2" dependencies = [ "hex", "proc-macro2", @@ -129,7 +111,7 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.39.7" +version = "0.41.3" dependencies = [ "hex", "proc-macro2", @@ -140,10 +122,9 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.39.7" +version = "0.41.3" dependencies = [ "multiversx-sc", - "wee_alloc", ] [[package]] @@ -166,24 +147,24 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.17.1" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" +checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" [[package]] name = "proc-macro2" -version = "1.0.52" +version = "1.0.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d0e1ae9e836cc3beddd63db0df682593d7e2d3d891ae8c9083d2113e1744224" +checksum = "dec2b086b7a862cf4de201096214fa870344cf922b2b30c167badb3af3195406" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.26" +version = "1.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4424af4bf778aae2051a77b60283332f386554255d722233d09fbfc7e30da2fc" +checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488" dependencies = [ "proc-macro2", ] @@ -217,46 +198,12 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.8" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4" +checksum = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0" [[package]] name = "version_check" version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" - -[[package]] -name = "wee_alloc" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbb3b5a6b2bb17cb6ad44a2e68a43e8d2722c997da10e928665c72ec6c0a0b8e" -dependencies = [ - "cfg-if 0.1.10", - "libc", - "memory_units", - "winapi", -] - -[[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-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" diff --git a/contracts/feature-tests/composability/execute-on-dest-esdt-issue-callback/child/wasm/Cargo.toml b/contracts/feature-tests/composability/execute-on-dest-esdt-issue-callback/child/wasm/Cargo.toml index 39eaa653cf..7fa2c6cd61 100644 --- a/contracts/feature-tests/composability/execute-on-dest-esdt-issue-callback/child/wasm/Cargo.toml +++ b/contracts/feature-tests/composability/execute-on-dest-esdt-issue-callback/child/wasm/Cargo.toml @@ -19,7 +19,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.39.7" +version = "0.41.3" path = "../../../../../../framework/wasm-adapter" [workspace] diff --git a/contracts/feature-tests/composability/execute-on-dest-esdt-issue-callback/child/wasm/src/lib.rs b/contracts/feature-tests/composability/execute-on-dest-esdt-issue-callback/child/wasm/src/lib.rs index d994df3b00..1a68267f6d 100644 --- a/contracts/feature-tests/composability/execute-on-dest-esdt-issue-callback/child/wasm/src/lib.rs +++ b/contracts/feature-tests/composability/execute-on-dest-esdt-issue-callback/child/wasm/src/lib.rs @@ -10,7 +10,7 @@ // Total number of exported functions: 4 #![no_std] -#![feature(alloc_error_handler, lang_items)] +#![feature(lang_items)] multiversx_sc_wasm_adapter::allocator!(); multiversx_sc_wasm_adapter::panic_handler!(); diff --git a/contracts/feature-tests/composability/execute-on-dest-esdt-issue-callback/parent/Cargo.toml b/contracts/feature-tests/composability/execute-on-dest-esdt-issue-callback/parent/Cargo.toml index bdb4e8cb25..2fe7f05f9b 100644 --- a/contracts/feature-tests/composability/execute-on-dest-esdt-issue-callback/parent/Cargo.toml +++ b/contracts/feature-tests/composability/execute-on-dest-esdt-issue-callback/parent/Cargo.toml @@ -13,10 +13,10 @@ path = "src/lib.rs" path = "../child" [dependencies.multiversx-sc] -version = "0.39.7" +version = "0.41.3" path = "../../../../../framework/base" [dev-dependencies.multiversx-sc-scenario] -version = "0.39.7" +version = "0.41.3" path = "../../../../../framework/scenario" diff --git a/contracts/feature-tests/composability/execute-on-dest-esdt-issue-callback/parent/meta/Cargo.toml b/contracts/feature-tests/composability/execute-on-dest-esdt-issue-callback/parent/meta/Cargo.toml index ffdf6100f2..0ad0499c84 100644 --- a/contracts/feature-tests/composability/execute-on-dest-esdt-issue-callback/parent/meta/Cargo.toml +++ b/contracts/feature-tests/composability/execute-on-dest-esdt-issue-callback/parent/meta/Cargo.toml @@ -8,9 +8,9 @@ publish = false path = ".." [dependencies.multiversx-sc] -version = "0.39.7" +version = "0.41.3" path = "../../../../../../framework/base" [dependencies.multiversx-sc-meta] -version = "0.39.7" +version = "0.41.3" path = "../../../../../../framework/meta" diff --git a/contracts/feature-tests/composability/execute-on-dest-esdt-issue-callback/parent/src/lib.rs b/contracts/feature-tests/composability/execute-on-dest-esdt-issue-callback/parent/src/lib.rs index 357f829fae..ddb8a09a09 100644 --- a/contracts/feature-tests/composability/execute-on-dest-esdt-issue-callback/parent/src/lib.rs +++ b/contracts/feature-tests/composability/execute-on-dest-esdt-issue-callback/parent/src/lib.rs @@ -43,7 +43,7 @@ pub trait Parent { let _: IgnoreValue = self .child_proxy(child_contract_adress) .issue_wrapped_egld(token_display_name, token_ticker, initial_supply) - .with_egld_transfer(issue_cost) + .with_egld_transfer(issue_cost.clone_value()) .with_gas_limit(ISSUE_EXPECTED_GAS_COST) .execute_on_dest_context(); } diff --git a/contracts/feature-tests/composability/execute-on-dest-esdt-issue-callback/parent/wasm/Cargo.lock b/contracts/feature-tests/composability/execute-on-dest-esdt-issue-callback/parent/wasm/Cargo.lock index 7ce781f137..9a942d00ea 100755 --- a/contracts/feature-tests/composability/execute-on-dest-esdt-issue-callback/parent/wasm/Cargo.lock +++ b/contracts/feature-tests/composability/execute-on-dest-esdt-issue-callback/parent/wasm/Cargo.lock @@ -8,16 +8,16 @@ version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "once_cell", "version_check", ] [[package]] name = "arrayvec" -version = "0.7.2" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" +checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" [[package]] name = "autocfg" @@ -31,12 +31,6 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" -[[package]] -name = "cfg-if" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" - [[package]] name = "cfg-if" version = "1.0.0" @@ -77,21 +71,9 @@ version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ebdb29d2ea9ed0083cd8cece49bbd968021bd99b0849edb4a9a7ee0fdf6a4e0" -[[package]] -name = "libc" -version = "0.2.140" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99227334921fae1a979cf0bfdfcc6b3e5ce376ef57e16fb6fb3ea2ed6095f80c" - -[[package]] -name = "memory_units" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8452105ba047068f40ff7093dd1d9da90898e63dd61736462e9cdda6a90ad3c3" - [[package]] name = "multiversx-sc" -version = "0.39.7" +version = "0.41.3" dependencies = [ "bitflags", "hashbrown", @@ -103,7 +85,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.17.1" +version = "0.17.2" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -111,7 +93,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.17.1" +version = "0.17.2" dependencies = [ "hex", "proc-macro2", @@ -121,7 +103,7 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.39.7" +version = "0.41.3" dependencies = [ "hex", "proc-macro2", @@ -132,10 +114,9 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.39.7" +version = "0.41.3" dependencies = [ "multiversx-sc", - "wee_alloc", ] [[package]] @@ -158,9 +139,9 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.17.1" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" +checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" [[package]] name = "parent" @@ -180,18 +161,18 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.52" +version = "1.0.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d0e1ae9e836cc3beddd63db0df682593d7e2d3d891ae8c9083d2113e1744224" +checksum = "dec2b086b7a862cf4de201096214fa870344cf922b2b30c167badb3af3195406" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.26" +version = "1.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4424af4bf778aae2051a77b60283332f386554255d722233d09fbfc7e30da2fc" +checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488" dependencies = [ "proc-macro2", ] @@ -225,46 +206,12 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.8" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4" +checksum = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0" [[package]] name = "version_check" version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" - -[[package]] -name = "wee_alloc" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbb3b5a6b2bb17cb6ad44a2e68a43e8d2722c997da10e928665c72ec6c0a0b8e" -dependencies = [ - "cfg-if 0.1.10", - "libc", - "memory_units", - "winapi", -] - -[[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-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" diff --git a/contracts/feature-tests/composability/execute-on-dest-esdt-issue-callback/parent/wasm/Cargo.toml b/contracts/feature-tests/composability/execute-on-dest-esdt-issue-callback/parent/wasm/Cargo.toml index e429c7186d..b1a841d18d 100644 --- a/contracts/feature-tests/composability/execute-on-dest-esdt-issue-callback/parent/wasm/Cargo.toml +++ b/contracts/feature-tests/composability/execute-on-dest-esdt-issue-callback/parent/wasm/Cargo.toml @@ -19,7 +19,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.39.7" +version = "0.41.3" path = "../../../../../../framework/wasm-adapter" [workspace] diff --git a/contracts/feature-tests/composability/execute-on-dest-esdt-issue-callback/parent/wasm/src/lib.rs b/contracts/feature-tests/composability/execute-on-dest-esdt-issue-callback/parent/wasm/src/lib.rs index 7156c7730a..ee23e145e7 100644 --- a/contracts/feature-tests/composability/execute-on-dest-esdt-issue-callback/parent/wasm/src/lib.rs +++ b/contracts/feature-tests/composability/execute-on-dest-esdt-issue-callback/parent/wasm/src/lib.rs @@ -10,7 +10,7 @@ // Total number of exported functions: 6 #![no_std] -#![feature(alloc_error_handler, lang_items)] +#![feature(lang_items)] multiversx_sc_wasm_adapter::allocator!(); multiversx_sc_wasm_adapter::panic_handler!(); diff --git a/contracts/feature-tests/composability/forwarder-raw/Cargo.toml b/contracts/feature-tests/composability/forwarder-raw/Cargo.toml index f45d20a240..867a471acc 100644 --- a/contracts/feature-tests/composability/forwarder-raw/Cargo.toml +++ b/contracts/feature-tests/composability/forwarder-raw/Cargo.toml @@ -12,14 +12,14 @@ path = "src/forwarder_raw.rs" ei-unmanaged = ["multiversx-sc/ei-unmanaged"] [dependencies.multiversx-sc] -version = "0.39.7" +version = "0.41.3" path = "../../../../framework/base" [dependencies.multiversx-sc-wasm-adapter] -version = "0.39.7" +version = "0.41.3" path = "../../../../framework/wasm-adapter" optional = true [dev-dependencies.multiversx-sc-scenario] -version = "0.39.7" +version = "0.41.3" path = "../../../../framework/scenario" diff --git a/contracts/feature-tests/composability/forwarder-raw/meta/Cargo.toml b/contracts/feature-tests/composability/forwarder-raw/meta/Cargo.toml index cac7ecdc95..d4d7bac62f 100644 --- a/contracts/feature-tests/composability/forwarder-raw/meta/Cargo.toml +++ b/contracts/feature-tests/composability/forwarder-raw/meta/Cargo.toml @@ -8,5 +8,5 @@ publish = false path = ".." [dependencies.multiversx-sc-meta] -version = "0.39.7" +version = "0.41.3" path = "../../../../../framework/meta" diff --git a/contracts/feature-tests/composability/forwarder-raw/src/forwarder_raw.rs b/contracts/feature-tests/composability/forwarder-raw/src/forwarder_raw.rs index 165f99f74d..54f33b4984 100644 --- a/contracts/feature-tests/composability/forwarder-raw/src/forwarder_raw.rs +++ b/contracts/feature-tests/composability/forwarder-raw/src/forwarder_raw.rs @@ -88,7 +88,7 @@ pub trait ForwarderRaw { self.forward_contract_call( to, EgldOrEsdtTokenIdentifier::egld(), - payment, + payment.clone_value(), endpoint_name, args, ) @@ -245,11 +245,11 @@ pub trait ForwarderRaw { let payments = self.call_value().all_esdt_transfers(); if payments.is_empty() { let egld_value = self.call_value().egld_value(); - if egld_value > 0 { + if *egld_value > 0 { let _ = self.callback_payments().push(&( EgldOrEsdtTokenIdentifier::egld(), 0, - egld_value, + egld_value.clone_value(), )); } } else { @@ -304,7 +304,7 @@ pub trait ForwarderRaw { ) { let payment = self.call_value().egld_value(); let one_third_gas = self.blockchain().get_gas_left() / 3; - let half_payment = payment / 2u32; + let half_payment = &*payment / 2u32; let arg_buffer = args.to_arg_buffer(); let result = self.send_raw().execute_on_dest_context_raw( diff --git a/contracts/feature-tests/composability/forwarder-raw/wasm-no-managed-ei/Cargo.toml b/contracts/feature-tests/composability/forwarder-raw/wasm-no-managed-ei/Cargo.toml index bda24ee36c..eb5705f477 100644 --- a/contracts/feature-tests/composability/forwarder-raw/wasm-no-managed-ei/Cargo.toml +++ b/contracts/feature-tests/composability/forwarder-raw/wasm-no-managed-ei/Cargo.toml @@ -20,7 +20,7 @@ path = ".." features = ["ei-unmanaged"] [dependencies.multiversx-sc-wasm-adapter] -version = "0.39.7" +version = "0.41.3" path = "../../../../../framework/wasm-adapter" features = ["ei-unmanaged-node"] diff --git a/contracts/feature-tests/composability/forwarder-raw/wasm-no-managed-ei/src/lib.rs b/contracts/feature-tests/composability/forwarder-raw/wasm-no-managed-ei/src/lib.rs index 6fac13f47b..39485bb00f 100644 --- a/contracts/feature-tests/composability/forwarder-raw/wasm-no-managed-ei/src/lib.rs +++ b/contracts/feature-tests/composability/forwarder-raw/wasm-no-managed-ei/src/lib.rs @@ -10,7 +10,7 @@ // Total number of exported functions: 27 #![no_std] -#![feature(alloc_error_handler, lang_items)] +#![feature(lang_items)] multiversx_sc_wasm_adapter::allocator!(); multiversx_sc_wasm_adapter::panic_handler!(); diff --git a/contracts/feature-tests/composability/forwarder-raw/wasm/Cargo.lock b/contracts/feature-tests/composability/forwarder-raw/wasm/Cargo.lock index 2920d40702..e5d7fda93e 100755 --- a/contracts/feature-tests/composability/forwarder-raw/wasm/Cargo.lock +++ b/contracts/feature-tests/composability/forwarder-raw/wasm/Cargo.lock @@ -8,16 +8,16 @@ version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "once_cell", "version_check", ] [[package]] name = "arrayvec" -version = "0.7.2" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" +checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" [[package]] name = "autocfg" @@ -31,12 +31,6 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" -[[package]] -name = "cfg-if" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" - [[package]] name = "cfg-if" version = "1.0.0" @@ -85,21 +79,9 @@ version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ebdb29d2ea9ed0083cd8cece49bbd968021bd99b0849edb4a9a7ee0fdf6a4e0" -[[package]] -name = "libc" -version = "0.2.140" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99227334921fae1a979cf0bfdfcc6b3e5ce376ef57e16fb6fb3ea2ed6095f80c" - -[[package]] -name = "memory_units" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8452105ba047068f40ff7093dd1d9da90898e63dd61736462e9cdda6a90ad3c3" - [[package]] name = "multiversx-sc" -version = "0.39.7" +version = "0.41.3" dependencies = [ "bitflags", "hashbrown", @@ -111,7 +93,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.17.1" +version = "0.17.2" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -119,7 +101,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.17.1" +version = "0.17.2" dependencies = [ "hex", "proc-macro2", @@ -129,7 +111,7 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.39.7" +version = "0.41.3" dependencies = [ "hex", "proc-macro2", @@ -140,10 +122,9 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.39.7" +version = "0.41.3" dependencies = [ "multiversx-sc", - "wee_alloc", ] [[package]] @@ -166,24 +147,24 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.17.1" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" +checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" [[package]] name = "proc-macro2" -version = "1.0.52" +version = "1.0.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d0e1ae9e836cc3beddd63db0df682593d7e2d3d891ae8c9083d2113e1744224" +checksum = "dec2b086b7a862cf4de201096214fa870344cf922b2b30c167badb3af3195406" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.26" +version = "1.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4424af4bf778aae2051a77b60283332f386554255d722233d09fbfc7e30da2fc" +checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488" dependencies = [ "proc-macro2", ] @@ -217,46 +198,12 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.8" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4" +checksum = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0" [[package]] name = "version_check" version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" - -[[package]] -name = "wee_alloc" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbb3b5a6b2bb17cb6ad44a2e68a43e8d2722c997da10e928665c72ec6c0a0b8e" -dependencies = [ - "cfg-if 0.1.10", - "libc", - "memory_units", - "winapi", -] - -[[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-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" diff --git a/contracts/feature-tests/composability/forwarder-raw/wasm/Cargo.toml b/contracts/feature-tests/composability/forwarder-raw/wasm/Cargo.toml index 24551330db..215d6be6bc 100644 --- a/contracts/feature-tests/composability/forwarder-raw/wasm/Cargo.toml +++ b/contracts/feature-tests/composability/forwarder-raw/wasm/Cargo.toml @@ -19,7 +19,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.39.7" +version = "0.41.3" path = "../../../../../framework/wasm-adapter" [workspace] diff --git a/contracts/feature-tests/composability/forwarder-raw/wasm/src/lib.rs b/contracts/feature-tests/composability/forwarder-raw/wasm/src/lib.rs index 6fac13f47b..39485bb00f 100644 --- a/contracts/feature-tests/composability/forwarder-raw/wasm/src/lib.rs +++ b/contracts/feature-tests/composability/forwarder-raw/wasm/src/lib.rs @@ -10,7 +10,7 @@ // Total number of exported functions: 27 #![no_std] -#![feature(alloc_error_handler, lang_items)] +#![feature(lang_items)] multiversx_sc_wasm_adapter::allocator!(); multiversx_sc_wasm_adapter::panic_handler!(); diff --git a/contracts/feature-tests/composability/forwarder/Cargo.toml b/contracts/feature-tests/composability/forwarder/Cargo.toml index 38dd032fb2..0758afcd12 100644 --- a/contracts/feature-tests/composability/forwarder/Cargo.toml +++ b/contracts/feature-tests/composability/forwarder/Cargo.toml @@ -15,10 +15,10 @@ ei-unmanaged = ["multiversx-sc/ei-unmanaged"] path = "../vault" [dependencies.multiversx-sc] -version = "0.39.7" +version = "0.41.3" path = "../../../../framework/base" [dev-dependencies.multiversx-sc-scenario] -version = "0.39.7" +version = "0.41.3" path = "../../../../framework/scenario" diff --git a/contracts/feature-tests/composability/forwarder/meta/Cargo.toml b/contracts/feature-tests/composability/forwarder/meta/Cargo.toml index f18f0d3e1e..857b036e1e 100644 --- a/contracts/feature-tests/composability/forwarder/meta/Cargo.toml +++ b/contracts/feature-tests/composability/forwarder/meta/Cargo.toml @@ -8,5 +8,5 @@ publish = false path = ".." [dependencies.multiversx-sc-meta] -version = "0.39.7" +version = "0.41.3" path = "../../../../../framework/meta" diff --git a/contracts/feature-tests/composability/forwarder/src/call_queue.rs b/contracts/feature-tests/composability/forwarder/src/call_queue.rs index 9eaa2c9533..910bff77fb 100644 --- a/contracts/feature-tests/composability/forwarder/src/call_queue.rs +++ b/contracts/feature-tests/composability/forwarder/src/call_queue.rs @@ -54,7 +54,7 @@ pub trait ForwarderQueuedCallModule { self.forward_queued_calls_event( max_call_depth, &self.call_value().egld_value(), - &esdt_transfers_multi.into_multi_value(), + &esdt_transfers_multi.clone_value().into_multi_value(), ); if max_call_depth == 0 { diff --git a/contracts/feature-tests/composability/forwarder/src/call_sync.rs b/contracts/feature-tests/composability/forwarder/src/call_sync.rs index 3a3531b61b..d2e3389bed 100644 --- a/contracts/feature-tests/composability/forwarder/src/call_sync.rs +++ b/contracts/feature-tests/composability/forwarder/src/call_sync.rs @@ -128,19 +128,20 @@ pub trait ForwarderSyncCallModule { #[endpoint] fn forward_sync_retrieve_funds_with_accept_func( &self, - #[payment_multi] payments: ManagedVec>, to: ManagedAddress, token: TokenIdentifier, amount: BigUint, ) { + let payments = self.call_value().all_esdt_transfers(); + self.vault_proxy() .contract(to) .retrieve_funds_with_transfer_exec( - payments, token, amount, OptionalValue::::Some(b"accept_funds_func".into()), ) + .with_multi_token_transfer(payments.clone_value()) .execute_on_dest_context::<()>(); } diff --git a/contracts/feature-tests/composability/forwarder/src/esdt.rs b/contracts/feature-tests/composability/forwarder/src/esdt.rs index 9323463c01..ed809e514a 100644 --- a/contracts/feature-tests/composability/forwarder/src/esdt.rs +++ b/contracts/feature-tests/composability/forwarder/src/esdt.rs @@ -96,7 +96,7 @@ pub trait ForwarderEsdtModule: storage::ForwarderStorageModule { self.send() .esdt_system_sc_proxy() .issue_fungible( - issue_cost, + issue_cost.clone_value(), &token_display_name, &token_ticker, &initial_supply, diff --git a/contracts/feature-tests/composability/forwarder/src/nft.rs b/contracts/feature-tests/composability/forwarder/src/nft.rs index 1c6a68c90c..97d7a2dbd2 100644 --- a/contracts/feature-tests/composability/forwarder/src/nft.rs +++ b/contracts/feature-tests/composability/forwarder/src/nft.rs @@ -56,7 +56,7 @@ pub trait ForwarderNftModule: storage::ForwarderStorageModule { self.send() .esdt_system_sc_proxy() .issue_non_fungible( - issue_cost, + issue_cost.clone_value(), &token_display_name, &token_ticker, NonFungibleTokenProperties { diff --git a/contracts/feature-tests/composability/forwarder/src/sft.rs b/contracts/feature-tests/composability/forwarder/src/sft.rs index 9ceca1f2c0..12e1a2f431 100644 --- a/contracts/feature-tests/composability/forwarder/src/sft.rs +++ b/contracts/feature-tests/composability/forwarder/src/sft.rs @@ -13,7 +13,7 @@ pub trait ForwarderSftModule: storage::ForwarderStorageModule { self.send() .esdt_system_sc_proxy() .issue_semi_fungible( - issue_cost, + issue_cost.clone_value(), &token_display_name, &token_ticker, SemiFungibleTokenProperties { diff --git a/contracts/feature-tests/composability/forwarder/wasm-no-managed-ei/Cargo.toml b/contracts/feature-tests/composability/forwarder/wasm-no-managed-ei/Cargo.toml index 95a961201c..db7bcd5d85 100644 --- a/contracts/feature-tests/composability/forwarder/wasm-no-managed-ei/Cargo.toml +++ b/contracts/feature-tests/composability/forwarder/wasm-no-managed-ei/Cargo.toml @@ -20,7 +20,7 @@ path = ".." features = ["ei-unmanaged"] [dependencies.multiversx-sc-wasm-adapter] -version = "0.39.7" +version = "0.41.3" path = "../../../../../framework/wasm-adapter" features = ["ei-unmanaged-node"] diff --git a/contracts/feature-tests/composability/forwarder/wasm-no-managed-ei/src/lib.rs b/contracts/feature-tests/composability/forwarder/wasm-no-managed-ei/src/lib.rs index 8bd7cf1605..6b97c23741 100644 --- a/contracts/feature-tests/composability/forwarder/wasm-no-managed-ei/src/lib.rs +++ b/contracts/feature-tests/composability/forwarder/wasm-no-managed-ei/src/lib.rs @@ -10,7 +10,7 @@ // Total number of exported functions: 71 #![no_std] -#![feature(alloc_error_handler, lang_items)] +#![feature(lang_items)] multiversx_sc_wasm_adapter::allocator!(); multiversx_sc_wasm_adapter::panic_handler!(); diff --git a/contracts/feature-tests/composability/forwarder/wasm/Cargo.lock b/contracts/feature-tests/composability/forwarder/wasm/Cargo.lock index c8680ab8a6..c938ebb07b 100755 --- a/contracts/feature-tests/composability/forwarder/wasm/Cargo.lock +++ b/contracts/feature-tests/composability/forwarder/wasm/Cargo.lock @@ -8,16 +8,16 @@ version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "once_cell", "version_check", ] [[package]] name = "arrayvec" -version = "0.7.2" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" +checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" [[package]] name = "autocfg" @@ -31,12 +31,6 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" -[[package]] -name = "cfg-if" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" - [[package]] name = "cfg-if" version = "1.0.0" @@ -86,21 +80,9 @@ version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ebdb29d2ea9ed0083cd8cece49bbd968021bd99b0849edb4a9a7ee0fdf6a4e0" -[[package]] -name = "libc" -version = "0.2.140" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99227334921fae1a979cf0bfdfcc6b3e5ce376ef57e16fb6fb3ea2ed6095f80c" - -[[package]] -name = "memory_units" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8452105ba047068f40ff7093dd1d9da90898e63dd61736462e9cdda6a90ad3c3" - [[package]] name = "multiversx-sc" -version = "0.39.7" +version = "0.41.3" dependencies = [ "bitflags", "hashbrown", @@ -112,7 +94,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.17.1" +version = "0.17.2" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -120,7 +102,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.17.1" +version = "0.17.2" dependencies = [ "hex", "proc-macro2", @@ -130,7 +112,7 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.39.7" +version = "0.41.3" dependencies = [ "hex", "proc-macro2", @@ -141,10 +123,9 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.39.7" +version = "0.41.3" dependencies = [ "multiversx-sc", - "wee_alloc", ] [[package]] @@ -167,24 +148,24 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.17.1" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" +checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" [[package]] name = "proc-macro2" -version = "1.0.52" +version = "1.0.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d0e1ae9e836cc3beddd63db0df682593d7e2d3d891ae8c9083d2113e1744224" +checksum = "dec2b086b7a862cf4de201096214fa870344cf922b2b30c167badb3af3195406" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.26" +version = "1.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4424af4bf778aae2051a77b60283332f386554255d722233d09fbfc7e30da2fc" +checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488" dependencies = [ "proc-macro2", ] @@ -218,9 +199,9 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.8" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4" +checksum = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0" [[package]] name = "vault" @@ -234,37 +215,3 @@ name = "version_check" version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" - -[[package]] -name = "wee_alloc" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbb3b5a6b2bb17cb6ad44a2e68a43e8d2722c997da10e928665c72ec6c0a0b8e" -dependencies = [ - "cfg-if 0.1.10", - "libc", - "memory_units", - "winapi", -] - -[[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-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" diff --git a/contracts/feature-tests/composability/forwarder/wasm/Cargo.toml b/contracts/feature-tests/composability/forwarder/wasm/Cargo.toml index 387dcbc386..290daf40c0 100644 --- a/contracts/feature-tests/composability/forwarder/wasm/Cargo.toml +++ b/contracts/feature-tests/composability/forwarder/wasm/Cargo.toml @@ -19,7 +19,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.39.7" +version = "0.41.3" path = "../../../../../framework/wasm-adapter" [workspace] diff --git a/contracts/feature-tests/composability/forwarder/wasm/src/lib.rs b/contracts/feature-tests/composability/forwarder/wasm/src/lib.rs index 8bd7cf1605..6b97c23741 100644 --- a/contracts/feature-tests/composability/forwarder/wasm/src/lib.rs +++ b/contracts/feature-tests/composability/forwarder/wasm/src/lib.rs @@ -10,7 +10,7 @@ // Total number of exported functions: 71 #![no_std] -#![feature(alloc_error_handler, lang_items)] +#![feature(lang_items)] multiversx_sc_wasm_adapter::allocator!(); multiversx_sc_wasm_adapter::panic_handler!(); diff --git a/contracts/feature-tests/composability/local-esdt-and-nft/Cargo.toml b/contracts/feature-tests/composability/local-esdt-and-nft/Cargo.toml index cf66506740..a5e648726c 100644 --- a/contracts/feature-tests/composability/local-esdt-and-nft/Cargo.toml +++ b/contracts/feature-tests/composability/local-esdt-and-nft/Cargo.toml @@ -10,9 +10,9 @@ path = "src/lib.rs" [dependencies.multiversx-sc] -version = "0.39.7" +version = "0.41.3" path = "../../../../framework/base" [dev-dependencies.multiversx-sc-scenario] -version = "0.39.7" +version = "0.41.3" path = "../../../../framework/scenario" diff --git a/contracts/feature-tests/composability/local-esdt-and-nft/meta/Cargo.toml b/contracts/feature-tests/composability/local-esdt-and-nft/meta/Cargo.toml index 8a4c1e452d..666dc71259 100644 --- a/contracts/feature-tests/composability/local-esdt-and-nft/meta/Cargo.toml +++ b/contracts/feature-tests/composability/local-esdt-and-nft/meta/Cargo.toml @@ -8,5 +8,5 @@ publish = false path = ".." [dependencies.multiversx-sc-meta] -version = "0.39.7" +version = "0.41.3" path = "../../../../../framework/meta" diff --git a/contracts/feature-tests/composability/local-esdt-and-nft/src/lib.rs b/contracts/feature-tests/composability/local-esdt-and-nft/src/lib.rs index eb609a5f46..235e3cde63 100644 --- a/contracts/feature-tests/composability/local-esdt-and-nft/src/lib.rs +++ b/contracts/feature-tests/composability/local-esdt-and-nft/src/lib.rs @@ -32,7 +32,7 @@ pub trait LocalEsdtAndEsdtNft { self.send() .esdt_system_sc_proxy() .issue_fungible( - issue_cost, + issue_cost.clone_value(), &token_display_name, &token_ticker, &initial_supply, @@ -74,7 +74,7 @@ pub trait LocalEsdtAndEsdtNft { self.send() .esdt_system_sc_proxy() .issue_non_fungible( - issue_cost, + issue_cost.clone_value(), &token_display_name, &token_ticker, NonFungibleTokenProperties { @@ -179,7 +179,7 @@ pub trait LocalEsdtAndEsdtNft { self.send() .esdt_system_sc_proxy() .issue_semi_fungible( - issue_cost, + issue_cost.clone_value(), &token_display_name, &token_ticker, SemiFungibleTokenProperties { diff --git a/contracts/feature-tests/composability/local-esdt-and-nft/wasm/Cargo.lock b/contracts/feature-tests/composability/local-esdt-and-nft/wasm/Cargo.lock index 14f4c30d70..453b986a0e 100755 --- a/contracts/feature-tests/composability/local-esdt-and-nft/wasm/Cargo.lock +++ b/contracts/feature-tests/composability/local-esdt-and-nft/wasm/Cargo.lock @@ -8,16 +8,16 @@ version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "once_cell", "version_check", ] [[package]] name = "arrayvec" -version = "0.7.2" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" +checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" [[package]] name = "autocfg" @@ -31,12 +31,6 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" -[[package]] -name = "cfg-if" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" - [[package]] name = "cfg-if" version = "1.0.0" @@ -70,12 +64,6 @@ version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ebdb29d2ea9ed0083cd8cece49bbd968021bd99b0849edb4a9a7ee0fdf6a4e0" -[[package]] -name = "libc" -version = "0.2.140" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99227334921fae1a979cf0bfdfcc6b3e5ce376ef57e16fb6fb3ea2ed6095f80c" - [[package]] name = "local-esdt-and-nft" version = "0.0.0" @@ -91,15 +79,9 @@ dependencies = [ "multiversx-sc-wasm-adapter", ] -[[package]] -name = "memory_units" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8452105ba047068f40ff7093dd1d9da90898e63dd61736462e9cdda6a90ad3c3" - [[package]] name = "multiversx-sc" -version = "0.39.7" +version = "0.41.3" dependencies = [ "bitflags", "hashbrown", @@ -111,7 +93,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.17.1" +version = "0.17.2" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -119,7 +101,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.17.1" +version = "0.17.2" dependencies = [ "hex", "proc-macro2", @@ -129,7 +111,7 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.39.7" +version = "0.41.3" dependencies = [ "hex", "proc-macro2", @@ -140,10 +122,9 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.39.7" +version = "0.41.3" dependencies = [ "multiversx-sc", - "wee_alloc", ] [[package]] @@ -166,24 +147,24 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.17.1" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" +checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" [[package]] name = "proc-macro2" -version = "1.0.52" +version = "1.0.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d0e1ae9e836cc3beddd63db0df682593d7e2d3d891ae8c9083d2113e1744224" +checksum = "dec2b086b7a862cf4de201096214fa870344cf922b2b30c167badb3af3195406" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.26" +version = "1.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4424af4bf778aae2051a77b60283332f386554255d722233d09fbfc7e30da2fc" +checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488" dependencies = [ "proc-macro2", ] @@ -217,46 +198,12 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.8" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4" +checksum = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0" [[package]] name = "version_check" version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" - -[[package]] -name = "wee_alloc" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbb3b5a6b2bb17cb6ad44a2e68a43e8d2722c997da10e928665c72ec6c0a0b8e" -dependencies = [ - "cfg-if 0.1.10", - "libc", - "memory_units", - "winapi", -] - -[[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-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" diff --git a/contracts/feature-tests/composability/local-esdt-and-nft/wasm/Cargo.toml b/contracts/feature-tests/composability/local-esdt-and-nft/wasm/Cargo.toml index 63648b96a9..9958cfc8e8 100644 --- a/contracts/feature-tests/composability/local-esdt-and-nft/wasm/Cargo.toml +++ b/contracts/feature-tests/composability/local-esdt-and-nft/wasm/Cargo.toml @@ -19,7 +19,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.39.7" +version = "0.41.3" path = "../../../../../framework/wasm-adapter" [workspace] diff --git a/contracts/feature-tests/composability/local-esdt-and-nft/wasm/src/lib.rs b/contracts/feature-tests/composability/local-esdt-and-nft/wasm/src/lib.rs index 511f0e59ed..210d7dc9bf 100644 --- a/contracts/feature-tests/composability/local-esdt-and-nft/wasm/src/lib.rs +++ b/contracts/feature-tests/composability/local-esdt-and-nft/wasm/src/lib.rs @@ -10,7 +10,7 @@ // Total number of exported functions: 20 #![no_std] -#![feature(alloc_error_handler, lang_items)] +#![feature(lang_items)] multiversx_sc_wasm_adapter::allocator!(); multiversx_sc_wasm_adapter::panic_handler!(); diff --git a/contracts/feature-tests/composability/promises-features/Cargo.toml b/contracts/feature-tests/composability/promises-features/Cargo.toml index 75f3cfa605..fa97de0fed 100644 --- a/contracts/feature-tests/composability/promises-features/Cargo.toml +++ b/contracts/feature-tests/composability/promises-features/Cargo.toml @@ -12,15 +12,15 @@ path = "src/promises_main.rs" path = "../vault" [dependencies.multiversx-sc] -version = "0.39.7" +version = "0.41.3" path = "../../../../framework/base" features = ["promises"] [dependencies.multiversx-sc-wasm-adapter] -version = "0.39.7" +version = "0.41.3" path = "../../../../framework/wasm-adapter" optional = true [dev-dependencies.multiversx-sc-scenario] -version = "0.39.7" +version = "0.41.3" path = "../../../../framework/scenario" diff --git a/contracts/feature-tests/composability/promises-features/meta/Cargo.toml b/contracts/feature-tests/composability/promises-features/meta/Cargo.toml index c78b47a6cd..7db7e8b395 100644 --- a/contracts/feature-tests/composability/promises-features/meta/Cargo.toml +++ b/contracts/feature-tests/composability/promises-features/meta/Cargo.toml @@ -8,5 +8,5 @@ publish = false path = ".." [dependencies.multiversx-sc-meta] -version = "0.39.7" +version = "0.41.3" path = "../../../../../framework/meta" diff --git a/contracts/feature-tests/composability/promises-features/multicontract.toml b/contracts/feature-tests/composability/promises-features/multicontract.toml new file mode 100644 index 0000000000..79ef7a04a8 --- /dev/null +++ b/contracts/feature-tests/composability/promises-features/multicontract.toml @@ -0,0 +1,7 @@ +[settings] +main = "promises-features" + +[contracts.promises-features] +name = "promises-features" +add-unlabelled = true +ei = "1.3" # the whole point of this config is to explicitly specify that this contract needs EI 1.3/VM 1.5 diff --git a/contracts/feature-tests/composability/promises-features/wasm/Cargo.lock b/contracts/feature-tests/composability/promises-features/wasm/Cargo.lock index 7698974065..8cef4d847f 100644 --- a/contracts/feature-tests/composability/promises-features/wasm/Cargo.lock +++ b/contracts/feature-tests/composability/promises-features/wasm/Cargo.lock @@ -8,16 +8,16 @@ version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "once_cell", "version_check", ] [[package]] name = "arrayvec" -version = "0.7.2" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" +checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" [[package]] name = "autocfg" @@ -31,12 +31,6 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" -[[package]] -name = "cfg-if" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" - [[package]] name = "cfg-if" version = "1.0.0" @@ -70,21 +64,9 @@ version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ebdb29d2ea9ed0083cd8cece49bbd968021bd99b0849edb4a9a7ee0fdf6a4e0" -[[package]] -name = "libc" -version = "0.2.140" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99227334921fae1a979cf0bfdfcc6b3e5ce376ef57e16fb6fb3ea2ed6095f80c" - -[[package]] -name = "memory_units" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8452105ba047068f40ff7093dd1d9da90898e63dd61736462e9cdda6a90ad3c3" - [[package]] name = "multiversx-sc" -version = "0.39.7" +version = "0.41.3" dependencies = [ "bitflags", "hashbrown", @@ -96,7 +78,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.17.1" +version = "0.17.2" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -104,7 +86,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.17.1" +version = "0.17.2" dependencies = [ "hex", "proc-macro2", @@ -114,7 +96,7 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.39.7" +version = "0.41.3" dependencies = [ "hex", "proc-macro2", @@ -125,10 +107,9 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.39.7" +version = "0.41.3" dependencies = [ "multiversx-sc", - "wee_alloc", ] [[package]] @@ -151,15 +132,15 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.17.1" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" +checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" [[package]] name = "proc-macro2" -version = "1.0.52" +version = "1.0.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d0e1ae9e836cc3beddd63db0df682593d7e2d3d891ae8c9083d2113e1744224" +checksum = "dec2b086b7a862cf4de201096214fa870344cf922b2b30c167badb3af3195406" dependencies = [ "unicode-ident", ] @@ -182,9 +163,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.26" +version = "1.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4424af4bf778aae2051a77b60283332f386554255d722233d09fbfc7e30da2fc" +checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488" dependencies = [ "proc-macro2", ] @@ -218,9 +199,9 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.8" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4" +checksum = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0" [[package]] name = "vault" @@ -234,37 +215,3 @@ name = "version_check" version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" - -[[package]] -name = "wee_alloc" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbb3b5a6b2bb17cb6ad44a2e68a43e8d2722c997da10e928665c72ec6c0a0b8e" -dependencies = [ - "cfg-if 0.1.10", - "libc", - "memory_units", - "winapi", -] - -[[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-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" diff --git a/contracts/feature-tests/composability/promises-features/wasm/Cargo.toml b/contracts/feature-tests/composability/promises-features/wasm/Cargo.toml index ca55fafdba..1729324b6c 100644 --- a/contracts/feature-tests/composability/promises-features/wasm/Cargo.toml +++ b/contracts/feature-tests/composability/promises-features/wasm/Cargo.toml @@ -19,7 +19,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.39.7" +version = "0.41.3" path = "../../../../../framework/wasm-adapter" [workspace] diff --git a/contracts/feature-tests/composability/promises-features/wasm/src/lib.rs b/contracts/feature-tests/composability/promises-features/wasm/src/lib.rs index b246c5f026..4d06b453af 100644 --- a/contracts/feature-tests/composability/promises-features/wasm/src/lib.rs +++ b/contracts/feature-tests/composability/promises-features/wasm/src/lib.rs @@ -11,7 +11,7 @@ // Total number of exported functions: 11 #![no_std] -#![feature(alloc_error_handler, lang_items)] +#![feature(lang_items)] multiversx_sc_wasm_adapter::allocator!(); multiversx_sc_wasm_adapter::panic_handler!(); diff --git a/contracts/feature-tests/composability/proxy-test-first/Cargo.toml b/contracts/feature-tests/composability/proxy-test-first/Cargo.toml index 53a278da75..95be399389 100644 --- a/contracts/feature-tests/composability/proxy-test-first/Cargo.toml +++ b/contracts/feature-tests/composability/proxy-test-first/Cargo.toml @@ -15,15 +15,15 @@ ei-unmanaged = ["multiversx-sc/ei-unmanaged"] hex-literal = "0.3.1" [dependencies.multiversx-sc] -version = "0.39.7" +version = "0.41.3" path = "../../../../framework/base" features = ["alloc"] [dependencies.multiversx-sc-wasm-adapter] -version = "0.39.7" +version = "0.41.3" path = "../../../../framework/wasm-adapter" optional = true [dev-dependencies.multiversx-sc-scenario] -version = "0.39.7" +version = "0.41.3" path = "../../../../framework/scenario" diff --git a/contracts/feature-tests/composability/proxy-test-first/meta/Cargo.toml b/contracts/feature-tests/composability/proxy-test-first/meta/Cargo.toml index 2e2b9af50a..a2f211521a 100644 --- a/contracts/feature-tests/composability/proxy-test-first/meta/Cargo.toml +++ b/contracts/feature-tests/composability/proxy-test-first/meta/Cargo.toml @@ -8,5 +8,5 @@ publish = false path = ".." [dependencies.multiversx-sc-meta] -version = "0.39.7" +version = "0.41.3" path = "../../../../../framework/meta" diff --git a/contracts/feature-tests/composability/proxy-test-first/multicontract.toml b/contracts/feature-tests/composability/proxy-test-first/multicontract.toml new file mode 100644 index 0000000000..4eadb0439a --- /dev/null +++ b/contracts/feature-tests/composability/proxy-test-first/multicontract.toml @@ -0,0 +1,7 @@ +[settings] +main = "proxy-test-first" + +# the only purpose of this config is to specify the allocator +[contracts.proxy-test-first] +add-unlabelled = true +allocator = "static64k" diff --git a/contracts/feature-tests/composability/proxy-test-first/src/proxy-test-first.rs b/contracts/feature-tests/composability/proxy-test-first/src/proxy-test-first.rs index cf10df6a1a..97dcf6f6f8 100644 --- a/contracts/feature-tests/composability/proxy-test-first/src/proxy-test-first.rs +++ b/contracts/feature-tests/composability/proxy-test-first/src/proxy-test-first.rs @@ -65,7 +65,7 @@ pub trait ProxyTestFirst { let (address, init_result) = self .message_me_proxy() .init(123) - .with_egld_transfer(payment) + .with_egld_transfer(payment.clone_value()) .deploy_contract::(&code, CodeMetadata::DEFAULT); self.set_other_contract(&address); init_result + 1 @@ -80,7 +80,7 @@ pub trait ProxyTestFirst { self.message_me_proxy() .contract(other_contract) .init(456) - .with_egld_transfer(payment) + .with_egld_transfer(payment.clone_value()) .upgrade_contract(&code, CodeMetadata::DEFAULT); } @@ -92,7 +92,7 @@ pub trait ProxyTestFirst { self.pay_me_proxy() .contract(other_contract) .pay_me(0x56) - .with_egld_transfer(payment) + .with_egld_transfer(payment.clone_value()) .async_call() .call_and_exit() } @@ -105,7 +105,7 @@ pub trait ProxyTestFirst { self.pay_me_proxy() .contract(other_contract) .pay_me_with_result(0x56) - .with_egld_transfer(payment) + .with_egld_transfer(payment.clone_value()) .async_call() .with_callback(self.callbacks().pay_callback()) .call_and_exit() diff --git a/contracts/feature-tests/composability/proxy-test-first/wasm-no-managed-ei/Cargo.toml b/contracts/feature-tests/composability/proxy-test-first/wasm-no-managed-ei/Cargo.toml index 969fc8035e..e76a43ee4e 100644 --- a/contracts/feature-tests/composability/proxy-test-first/wasm-no-managed-ei/Cargo.toml +++ b/contracts/feature-tests/composability/proxy-test-first/wasm-no-managed-ei/Cargo.toml @@ -20,7 +20,7 @@ path = ".." features = ["ei-unmanaged"] [dependencies.multiversx-sc-wasm-adapter] -version = "0.39.7" +version = "0.41.3" path = "../../../../../framework/wasm-adapter" features = ["ei-unmanaged-node"] diff --git a/contracts/feature-tests/composability/proxy-test-first/wasm-no-managed-ei/src/lib.rs b/contracts/feature-tests/composability/proxy-test-first/wasm-no-managed-ei/src/lib.rs index 3c7bf5c94f..210378e038 100644 --- a/contracts/feature-tests/composability/proxy-test-first/wasm-no-managed-ei/src/lib.rs +++ b/contracts/feature-tests/composability/proxy-test-first/wasm-no-managed-ei/src/lib.rs @@ -10,9 +10,9 @@ // Total number of exported functions: 8 #![no_std] -#![feature(alloc_error_handler, lang_items)] +#![feature(lang_items)] -multiversx_sc_wasm_adapter::allocator!(); +multiversx_sc_wasm_adapter::allocator!(static64k); multiversx_sc_wasm_adapter::panic_handler!(); multiversx_sc_wasm_adapter::endpoints! { diff --git a/contracts/feature-tests/composability/proxy-test-first/wasm/Cargo.lock b/contracts/feature-tests/composability/proxy-test-first/wasm/Cargo.lock index 8f7b406a6d..2842e6a75c 100755 --- a/contracts/feature-tests/composability/proxy-test-first/wasm/Cargo.lock +++ b/contracts/feature-tests/composability/proxy-test-first/wasm/Cargo.lock @@ -8,16 +8,16 @@ version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "once_cell", "version_check", ] [[package]] name = "arrayvec" -version = "0.7.2" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" +checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" [[package]] name = "autocfg" @@ -31,12 +31,6 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" -[[package]] -name = "cfg-if" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" - [[package]] name = "cfg-if" version = "1.0.0" @@ -70,21 +64,9 @@ version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ebdb29d2ea9ed0083cd8cece49bbd968021bd99b0849edb4a9a7ee0fdf6a4e0" -[[package]] -name = "libc" -version = "0.2.140" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99227334921fae1a979cf0bfdfcc6b3e5ce376ef57e16fb6fb3ea2ed6095f80c" - -[[package]] -name = "memory_units" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8452105ba047068f40ff7093dd1d9da90898e63dd61736462e9cdda6a90ad3c3" - [[package]] name = "multiversx-sc" -version = "0.39.7" +version = "0.41.3" dependencies = [ "bitflags", "hashbrown", @@ -96,7 +78,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.17.1" +version = "0.17.2" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -104,7 +86,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.17.1" +version = "0.17.2" dependencies = [ "hex", "proc-macro2", @@ -114,7 +96,7 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.39.7" +version = "0.41.3" dependencies = [ "hex", "proc-macro2", @@ -125,10 +107,9 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.39.7" +version = "0.41.3" dependencies = [ "multiversx-sc", - "wee_alloc", ] [[package]] @@ -151,15 +132,15 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.17.1" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" +checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" [[package]] name = "proc-macro2" -version = "1.0.52" +version = "1.0.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d0e1ae9e836cc3beddd63db0df682593d7e2d3d891ae8c9083d2113e1744224" +checksum = "dec2b086b7a862cf4de201096214fa870344cf922b2b30c167badb3af3195406" dependencies = [ "unicode-ident", ] @@ -182,9 +163,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.26" +version = "1.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4424af4bf778aae2051a77b60283332f386554255d722233d09fbfc7e30da2fc" +checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488" dependencies = [ "proc-macro2", ] @@ -218,46 +199,12 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.8" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4" +checksum = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0" [[package]] name = "version_check" version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" - -[[package]] -name = "wee_alloc" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbb3b5a6b2bb17cb6ad44a2e68a43e8d2722c997da10e928665c72ec6c0a0b8e" -dependencies = [ - "cfg-if 0.1.10", - "libc", - "memory_units", - "winapi", -] - -[[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-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" diff --git a/contracts/feature-tests/composability/proxy-test-first/wasm/Cargo.toml b/contracts/feature-tests/composability/proxy-test-first/wasm/Cargo.toml index 3063881ee0..c28caec208 100644 --- a/contracts/feature-tests/composability/proxy-test-first/wasm/Cargo.toml +++ b/contracts/feature-tests/composability/proxy-test-first/wasm/Cargo.toml @@ -19,7 +19,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.39.7" +version = "0.41.3" path = "../../../../../framework/wasm-adapter" [workspace] diff --git a/contracts/feature-tests/composability/proxy-test-first/wasm/src/lib.rs b/contracts/feature-tests/composability/proxy-test-first/wasm/src/lib.rs index 3c7bf5c94f..210378e038 100644 --- a/contracts/feature-tests/composability/proxy-test-first/wasm/src/lib.rs +++ b/contracts/feature-tests/composability/proxy-test-first/wasm/src/lib.rs @@ -10,9 +10,9 @@ // Total number of exported functions: 8 #![no_std] -#![feature(alloc_error_handler, lang_items)] +#![feature(lang_items)] -multiversx_sc_wasm_adapter::allocator!(); +multiversx_sc_wasm_adapter::allocator!(static64k); multiversx_sc_wasm_adapter::panic_handler!(); multiversx_sc_wasm_adapter::endpoints! { diff --git a/contracts/feature-tests/composability/proxy-test-second/Cargo.toml b/contracts/feature-tests/composability/proxy-test-second/Cargo.toml index 4a5eae51ac..0b29ad5f1d 100644 --- a/contracts/feature-tests/composability/proxy-test-second/Cargo.toml +++ b/contracts/feature-tests/composability/proxy-test-second/Cargo.toml @@ -12,10 +12,10 @@ path = "src/proxy-test-second.rs" ei-unmanaged = ["multiversx-sc/ei-unmanaged"] [dependencies.multiversx-sc] -version = "0.39.7" +version = "0.41.3" path = "../../../../framework/base" features = ["alloc"] [dev-dependencies.multiversx-sc-scenario] -version = "0.39.7" +version = "0.41.3" path = "../../../../framework/scenario" diff --git a/contracts/feature-tests/composability/proxy-test-second/meta/Cargo.toml b/contracts/feature-tests/composability/proxy-test-second/meta/Cargo.toml index 0f16e12616..299520c8e5 100644 --- a/contracts/feature-tests/composability/proxy-test-second/meta/Cargo.toml +++ b/contracts/feature-tests/composability/proxy-test-second/meta/Cargo.toml @@ -8,5 +8,5 @@ publish = false path = ".." [dependencies.multiversx-sc-meta] -version = "0.39.7" +version = "0.41.3" path = "../../../../../framework/meta" diff --git a/contracts/feature-tests/composability/proxy-test-second/multicontract.toml b/contracts/feature-tests/composability/proxy-test-second/multicontract.toml new file mode 100644 index 0000000000..7968fcac6c --- /dev/null +++ b/contracts/feature-tests/composability/proxy-test-second/multicontract.toml @@ -0,0 +1,7 @@ +[settings] +main = "proxy-test-second" + +# the only purpose of this config is to specify the allocator +[contracts.proxy-test-second] +add-unlabelled = true +allocator = "static64k" diff --git a/contracts/feature-tests/composability/proxy-test-second/wasm-no-managed-ei/Cargo.toml b/contracts/feature-tests/composability/proxy-test-second/wasm-no-managed-ei/Cargo.toml index cbafc35475..4a39199b91 100644 --- a/contracts/feature-tests/composability/proxy-test-second/wasm-no-managed-ei/Cargo.toml +++ b/contracts/feature-tests/composability/proxy-test-second/wasm-no-managed-ei/Cargo.toml @@ -20,7 +20,7 @@ path = ".." features = ["ei-unmanaged"] [dependencies.multiversx-sc-wasm-adapter] -version = "0.39.7" +version = "0.41.3" path = "../../../../../framework/wasm-adapter" features = ["ei-unmanaged-node"] diff --git a/contracts/feature-tests/composability/proxy-test-second/wasm-no-managed-ei/src/lib.rs b/contracts/feature-tests/composability/proxy-test-second/wasm-no-managed-ei/src/lib.rs index 4368b11f52..f316dff71a 100644 --- a/contracts/feature-tests/composability/proxy-test-second/wasm-no-managed-ei/src/lib.rs +++ b/contracts/feature-tests/composability/proxy-test-second/wasm-no-managed-ei/src/lib.rs @@ -10,9 +10,9 @@ // Total number of exported functions: 5 #![no_std] -#![feature(alloc_error_handler, lang_items)] +#![feature(lang_items)] -multiversx_sc_wasm_adapter::allocator!(); +multiversx_sc_wasm_adapter::allocator!(static64k); multiversx_sc_wasm_adapter::panic_handler!(); multiversx_sc_wasm_adapter::endpoints! { diff --git a/contracts/feature-tests/composability/proxy-test-second/wasm/Cargo.lock b/contracts/feature-tests/composability/proxy-test-second/wasm/Cargo.lock index b517bda70e..375a02d9ba 100755 --- a/contracts/feature-tests/composability/proxy-test-second/wasm/Cargo.lock +++ b/contracts/feature-tests/composability/proxy-test-second/wasm/Cargo.lock @@ -8,16 +8,16 @@ version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "once_cell", "version_check", ] [[package]] name = "arrayvec" -version = "0.7.2" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" +checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" [[package]] name = "autocfg" @@ -31,12 +31,6 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" -[[package]] -name = "cfg-if" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" - [[package]] name = "cfg-if" version = "1.0.0" @@ -70,21 +64,9 @@ version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ebdb29d2ea9ed0083cd8cece49bbd968021bd99b0849edb4a9a7ee0fdf6a4e0" -[[package]] -name = "libc" -version = "0.2.140" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99227334921fae1a979cf0bfdfcc6b3e5ce376ef57e16fb6fb3ea2ed6095f80c" - -[[package]] -name = "memory_units" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8452105ba047068f40ff7093dd1d9da90898e63dd61736462e9cdda6a90ad3c3" - [[package]] name = "multiversx-sc" -version = "0.39.7" +version = "0.41.3" dependencies = [ "bitflags", "hashbrown", @@ -96,7 +78,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.17.1" +version = "0.17.2" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -104,7 +86,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.17.1" +version = "0.17.2" dependencies = [ "hex", "proc-macro2", @@ -114,7 +96,7 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.39.7" +version = "0.41.3" dependencies = [ "hex", "proc-macro2", @@ -125,10 +107,9 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.39.7" +version = "0.41.3" dependencies = [ "multiversx-sc", - "wee_alloc", ] [[package]] @@ -151,15 +132,15 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.17.1" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" +checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" [[package]] name = "proc-macro2" -version = "1.0.52" +version = "1.0.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d0e1ae9e836cc3beddd63db0df682593d7e2d3d891ae8c9083d2113e1744224" +checksum = "dec2b086b7a862cf4de201096214fa870344cf922b2b30c167badb3af3195406" dependencies = [ "unicode-ident", ] @@ -181,9 +162,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.26" +version = "1.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4424af4bf778aae2051a77b60283332f386554255d722233d09fbfc7e30da2fc" +checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488" dependencies = [ "proc-macro2", ] @@ -217,46 +198,12 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.8" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4" +checksum = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0" [[package]] name = "version_check" version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" - -[[package]] -name = "wee_alloc" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbb3b5a6b2bb17cb6ad44a2e68a43e8d2722c997da10e928665c72ec6c0a0b8e" -dependencies = [ - "cfg-if 0.1.10", - "libc", - "memory_units", - "winapi", -] - -[[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-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" diff --git a/contracts/feature-tests/composability/proxy-test-second/wasm/Cargo.toml b/contracts/feature-tests/composability/proxy-test-second/wasm/Cargo.toml index e60f149245..6e64482f63 100644 --- a/contracts/feature-tests/composability/proxy-test-second/wasm/Cargo.toml +++ b/contracts/feature-tests/composability/proxy-test-second/wasm/Cargo.toml @@ -19,7 +19,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.39.7" +version = "0.41.3" path = "../../../../../framework/wasm-adapter" [workspace] diff --git a/contracts/feature-tests/composability/proxy-test-second/wasm/src/lib.rs b/contracts/feature-tests/composability/proxy-test-second/wasm/src/lib.rs index 4368b11f52..f316dff71a 100644 --- a/contracts/feature-tests/composability/proxy-test-second/wasm/src/lib.rs +++ b/contracts/feature-tests/composability/proxy-test-second/wasm/src/lib.rs @@ -10,9 +10,9 @@ // Total number of exported functions: 5 #![no_std] -#![feature(alloc_error_handler, lang_items)] +#![feature(lang_items)] -multiversx_sc_wasm_adapter::allocator!(); +multiversx_sc_wasm_adapter::allocator!(static64k); multiversx_sc_wasm_adapter::panic_handler!(); multiversx_sc_wasm_adapter::endpoints! { diff --git a/contracts/feature-tests/composability/recursive-caller/Cargo.toml b/contracts/feature-tests/composability/recursive-caller/Cargo.toml index 1f0c0eeb51..c773067447 100644 --- a/contracts/feature-tests/composability/recursive-caller/Cargo.toml +++ b/contracts/feature-tests/composability/recursive-caller/Cargo.toml @@ -15,14 +15,14 @@ ei-unmanaged = ["multiversx-sc/ei-unmanaged"] path = "../vault" [dependencies.multiversx-sc] -version = "0.39.7" +version = "0.41.3" path = "../../../../framework/base" [dependencies.multiversx-sc-wasm-adapter] -version = "0.39.7" +version = "0.41.3" path = "../../../../framework/wasm-adapter" optional = true [dev-dependencies.multiversx-sc-scenario] -version = "0.39.7" +version = "0.41.3" path = "../../../../framework/scenario" diff --git a/contracts/feature-tests/composability/recursive-caller/meta/Cargo.toml b/contracts/feature-tests/composability/recursive-caller/meta/Cargo.toml index 219905d440..264031aa61 100644 --- a/contracts/feature-tests/composability/recursive-caller/meta/Cargo.toml +++ b/contracts/feature-tests/composability/recursive-caller/meta/Cargo.toml @@ -8,5 +8,5 @@ publish = false path = ".." [dependencies.multiversx-sc-meta] -version = "0.39.7" +version = "0.41.3" path = "../../../../../framework/meta" diff --git a/contracts/feature-tests/composability/recursive-caller/wasm-no-managed-ei/Cargo.toml b/contracts/feature-tests/composability/recursive-caller/wasm-no-managed-ei/Cargo.toml index b4dcd759c5..fc4b33fe6e 100644 --- a/contracts/feature-tests/composability/recursive-caller/wasm-no-managed-ei/Cargo.toml +++ b/contracts/feature-tests/composability/recursive-caller/wasm-no-managed-ei/Cargo.toml @@ -20,7 +20,7 @@ path = ".." features = ["ei-unmanaged"] [dependencies.multiversx-sc-wasm-adapter] -version = "0.39.7" +version = "0.41.3" path = "../../../../../framework/wasm-adapter" features = ["ei-unmanaged-node"] diff --git a/contracts/feature-tests/composability/recursive-caller/wasm-no-managed-ei/src/lib.rs b/contracts/feature-tests/composability/recursive-caller/wasm-no-managed-ei/src/lib.rs index e005909204..448dacad09 100644 --- a/contracts/feature-tests/composability/recursive-caller/wasm-no-managed-ei/src/lib.rs +++ b/contracts/feature-tests/composability/recursive-caller/wasm-no-managed-ei/src/lib.rs @@ -10,7 +10,7 @@ // Total number of exported functions: 3 #![no_std] -#![feature(alloc_error_handler, lang_items)] +#![feature(lang_items)] multiversx_sc_wasm_adapter::allocator!(); multiversx_sc_wasm_adapter::panic_handler!(); diff --git a/contracts/feature-tests/composability/recursive-caller/wasm/Cargo.lock b/contracts/feature-tests/composability/recursive-caller/wasm/Cargo.lock index 89500b051a..1a4d4b4319 100755 --- a/contracts/feature-tests/composability/recursive-caller/wasm/Cargo.lock +++ b/contracts/feature-tests/composability/recursive-caller/wasm/Cargo.lock @@ -8,16 +8,16 @@ version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "once_cell", "version_check", ] [[package]] name = "arrayvec" -version = "0.7.2" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" +checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" [[package]] name = "autocfg" @@ -31,12 +31,6 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" -[[package]] -name = "cfg-if" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" - [[package]] name = "cfg-if" version = "1.0.0" @@ -70,21 +64,9 @@ version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ebdb29d2ea9ed0083cd8cece49bbd968021bd99b0849edb4a9a7ee0fdf6a4e0" -[[package]] -name = "libc" -version = "0.2.140" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99227334921fae1a979cf0bfdfcc6b3e5ce376ef57e16fb6fb3ea2ed6095f80c" - -[[package]] -name = "memory_units" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8452105ba047068f40ff7093dd1d9da90898e63dd61736462e9cdda6a90ad3c3" - [[package]] name = "multiversx-sc" -version = "0.39.7" +version = "0.41.3" dependencies = [ "bitflags", "hashbrown", @@ -96,7 +78,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.17.1" +version = "0.17.2" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -104,7 +86,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.17.1" +version = "0.17.2" dependencies = [ "hex", "proc-macro2", @@ -114,7 +96,7 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.39.7" +version = "0.41.3" dependencies = [ "hex", "proc-macro2", @@ -125,10 +107,9 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.39.7" +version = "0.41.3" dependencies = [ "multiversx-sc", - "wee_alloc", ] [[package]] @@ -151,24 +132,24 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.17.1" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" +checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" [[package]] name = "proc-macro2" -version = "1.0.52" +version = "1.0.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d0e1ae9e836cc3beddd63db0df682593d7e2d3d891ae8c9083d2113e1744224" +checksum = "dec2b086b7a862cf4de201096214fa870344cf922b2b30c167badb3af3195406" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.26" +version = "1.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4424af4bf778aae2051a77b60283332f386554255d722233d09fbfc7e30da2fc" +checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488" dependencies = [ "proc-macro2", ] @@ -218,9 +199,9 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.8" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4" +checksum = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0" [[package]] name = "vault" @@ -234,37 +215,3 @@ name = "version_check" version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" - -[[package]] -name = "wee_alloc" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbb3b5a6b2bb17cb6ad44a2e68a43e8d2722c997da10e928665c72ec6c0a0b8e" -dependencies = [ - "cfg-if 0.1.10", - "libc", - "memory_units", - "winapi", -] - -[[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-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" diff --git a/contracts/feature-tests/composability/recursive-caller/wasm/Cargo.toml b/contracts/feature-tests/composability/recursive-caller/wasm/Cargo.toml index 455707cfc6..98101bcdd6 100644 --- a/contracts/feature-tests/composability/recursive-caller/wasm/Cargo.toml +++ b/contracts/feature-tests/composability/recursive-caller/wasm/Cargo.toml @@ -19,7 +19,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.39.7" +version = "0.41.3" path = "../../../../../framework/wasm-adapter" [workspace] diff --git a/contracts/feature-tests/composability/recursive-caller/wasm/src/lib.rs b/contracts/feature-tests/composability/recursive-caller/wasm/src/lib.rs index e005909204..448dacad09 100644 --- a/contracts/feature-tests/composability/recursive-caller/wasm/src/lib.rs +++ b/contracts/feature-tests/composability/recursive-caller/wasm/src/lib.rs @@ -10,7 +10,7 @@ // Total number of exported functions: 3 #![no_std] -#![feature(alloc_error_handler, lang_items)] +#![feature(lang_items)] multiversx_sc_wasm_adapter::allocator!(); multiversx_sc_wasm_adapter::panic_handler!(); diff --git a/contracts/feature-tests/composability/transfer-role-features/Cargo.toml b/contracts/feature-tests/composability/transfer-role-features/Cargo.toml index e4b0be9f73..6eebe66fdb 100644 --- a/contracts/feature-tests/composability/transfer-role-features/Cargo.toml +++ b/contracts/feature-tests/composability/transfer-role-features/Cargo.toml @@ -12,13 +12,13 @@ path = "src/lib.rs" path = "../vault" [dependencies.multiversx-sc] -version = "0.39.7" +version = "0.41.3" path = "../../../../framework/base" [dependencies.multiversx-sc-modules] -version = "0.39.7" +version = "0.41.3" path = "../../../../contracts/modules" [dev-dependencies.multiversx-sc-scenario] -version = "0.39.7" +version = "0.41.3" path = "../../../../framework/scenario" diff --git a/contracts/feature-tests/composability/transfer-role-features/meta/Cargo.toml b/contracts/feature-tests/composability/transfer-role-features/meta/Cargo.toml index f653d0f2b8..cf7a3234c8 100644 --- a/contracts/feature-tests/composability/transfer-role-features/meta/Cargo.toml +++ b/contracts/feature-tests/composability/transfer-role-features/meta/Cargo.toml @@ -8,5 +8,5 @@ publish = false path = ".." [dependencies.multiversx-sc-meta] -version = "0.39.7" +version = "0.41.3" path = "../../../../../framework/meta" diff --git a/contracts/feature-tests/composability/transfer-role-features/src/lib.rs b/contracts/feature-tests/composability/transfer-role-features/src/lib.rs index 47b2182f49..b689b76d43 100644 --- a/contracts/feature-tests/composability/transfer-role-features/src/lib.rs +++ b/contracts/feature-tests/composability/transfer-role-features/src/lib.rs @@ -30,7 +30,7 @@ pub trait TransferRoleFeatures: } if !self.blockchain().is_smart_contract(&dest) { - self.transfer_to_user(original_caller, dest, payments, endpoint_name); + self.transfer_to_user(original_caller, dest, payments.clone_value(), endpoint_name); } else { let mut args_buffer = ManagedArgBuffer::new(); for arg in args { @@ -40,7 +40,7 @@ pub trait TransferRoleFeatures: self.transfer_to_contract_raw( original_caller, dest, - payments, + payments.clone_value(), endpoint_name, args_buffer, None, diff --git a/contracts/feature-tests/composability/transfer-role-features/wasm/Cargo.lock b/contracts/feature-tests/composability/transfer-role-features/wasm/Cargo.lock index cc8afd11a0..195eff0a99 100644 --- a/contracts/feature-tests/composability/transfer-role-features/wasm/Cargo.lock +++ b/contracts/feature-tests/composability/transfer-role-features/wasm/Cargo.lock @@ -8,16 +8,16 @@ version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "once_cell", "version_check", ] [[package]] name = "arrayvec" -version = "0.7.2" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" +checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" [[package]] name = "autocfg" @@ -31,12 +31,6 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" -[[package]] -name = "cfg-if" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" - [[package]] name = "cfg-if" version = "1.0.0" @@ -70,21 +64,9 @@ version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ebdb29d2ea9ed0083cd8cece49bbd968021bd99b0849edb4a9a7ee0fdf6a4e0" -[[package]] -name = "libc" -version = "0.2.140" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99227334921fae1a979cf0bfdfcc6b3e5ce376ef57e16fb6fb3ea2ed6095f80c" - -[[package]] -name = "memory_units" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8452105ba047068f40ff7093dd1d9da90898e63dd61736462e9cdda6a90ad3c3" - [[package]] name = "multiversx-sc" -version = "0.39.7" +version = "0.41.3" dependencies = [ "bitflags", "hashbrown", @@ -96,7 +78,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.17.1" +version = "0.17.2" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -104,7 +86,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.17.1" +version = "0.17.2" dependencies = [ "hex", "proc-macro2", @@ -114,7 +96,7 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.39.7" +version = "0.41.3" dependencies = [ "hex", "proc-macro2", @@ -125,17 +107,16 @@ dependencies = [ [[package]] name = "multiversx-sc-modules" -version = "0.39.7" +version = "0.41.3" dependencies = [ "multiversx-sc", ] [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.39.7" +version = "0.41.3" dependencies = [ "multiversx-sc", - "wee_alloc", ] [[package]] @@ -158,24 +139,24 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.17.1" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" +checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" [[package]] name = "proc-macro2" -version = "1.0.52" +version = "1.0.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d0e1ae9e836cc3beddd63db0df682593d7e2d3d891ae8c9083d2113e1744224" +checksum = "dec2b086b7a862cf4de201096214fa870344cf922b2b30c167badb3af3195406" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.26" +version = "1.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4424af4bf778aae2051a77b60283332f386554255d722233d09fbfc7e30da2fc" +checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488" dependencies = [ "proc-macro2", ] @@ -225,46 +206,12 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.8" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4" +checksum = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0" [[package]] name = "version_check" version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" - -[[package]] -name = "wee_alloc" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbb3b5a6b2bb17cb6ad44a2e68a43e8d2722c997da10e928665c72ec6c0a0b8e" -dependencies = [ - "cfg-if 0.1.10", - "libc", - "memory_units", - "winapi", -] - -[[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-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" diff --git a/contracts/feature-tests/composability/transfer-role-features/wasm/Cargo.toml b/contracts/feature-tests/composability/transfer-role-features/wasm/Cargo.toml index c5aa9c2e1d..23993851eb 100644 --- a/contracts/feature-tests/composability/transfer-role-features/wasm/Cargo.toml +++ b/contracts/feature-tests/composability/transfer-role-features/wasm/Cargo.toml @@ -19,7 +19,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.39.7" +version = "0.41.3" path = "../../../../../framework/wasm-adapter" [workspace] diff --git a/contracts/feature-tests/composability/transfer-role-features/wasm/src/lib.rs b/contracts/feature-tests/composability/transfer-role-features/wasm/src/lib.rs index 9813805491..7b87c78f63 100644 --- a/contracts/feature-tests/composability/transfer-role-features/wasm/src/lib.rs +++ b/contracts/feature-tests/composability/transfer-role-features/wasm/src/lib.rs @@ -10,7 +10,7 @@ // Total number of exported functions: 3 #![no_std] -#![feature(alloc_error_handler, lang_items)] +#![feature(lang_items)] multiversx_sc_wasm_adapter::allocator!(); multiversx_sc_wasm_adapter::panic_handler!(); diff --git a/contracts/feature-tests/composability/vault/Cargo.toml b/contracts/feature-tests/composability/vault/Cargo.toml index 8675d76178..c79a4777a3 100644 --- a/contracts/feature-tests/composability/vault/Cargo.toml +++ b/contracts/feature-tests/composability/vault/Cargo.toml @@ -10,9 +10,9 @@ path = "src/vault.rs" [dependencies.multiversx-sc] -version = "0.39.7" +version = "0.41.3" path = "../../../../framework/base" [dev-dependencies.multiversx-sc-scenario] -version = "0.39.7" +version = "0.41.3" path = "../../../../framework/scenario" diff --git a/contracts/feature-tests/composability/vault/meta/Cargo.toml b/contracts/feature-tests/composability/vault/meta/Cargo.toml index d15b97571b..8d7cfda4f2 100644 --- a/contracts/feature-tests/composability/vault/meta/Cargo.toml +++ b/contracts/feature-tests/composability/vault/meta/Cargo.toml @@ -8,5 +8,5 @@ publish = false path = ".." [dependencies.multiversx-sc-meta] -version = "0.39.7" +version = "0.41.3" path = "../../../../../framework/meta" diff --git a/contracts/feature-tests/composability/vault/src/vault.rs b/contracts/feature-tests/composability/vault/src/vault.rs index 1bc80462d4..53de13c371 100644 --- a/contracts/feature-tests/composability/vault/src/vault.rs +++ b/contracts/feature-tests/composability/vault/src/vault.rs @@ -38,7 +38,10 @@ pub trait Vault { } fn esdt_transfers_multi(&self) -> MultiValueEncoded { - self.call_value().all_esdt_transfers().into_multi_value() + self.call_value() + .all_esdt_transfers() + .clone_value() + .into_multi_value() } #[payable("*")] @@ -63,7 +66,7 @@ pub trait Vault { self.call_counts(ManagedBuffer::from(b"accept_funds_echo_payment")) .update(|c| *c += 1); - (egld_value, esdt_transfers_multi).into() + (egld_value.clone_value(), esdt_transfers_multi).into() } #[payable("*")] @@ -84,7 +87,6 @@ pub trait Vault { #[endpoint] fn retrieve_funds_with_transfer_exec( &self, - #[payment_multi] _payments: ManagedVec>, token: TokenIdentifier, amount: BigUint, opt_receive_func: OptionalValue, diff --git a/contracts/feature-tests/composability/vault/wasm/Cargo.lock b/contracts/feature-tests/composability/vault/wasm/Cargo.lock index 897312f205..c4aa20465f 100755 --- a/contracts/feature-tests/composability/vault/wasm/Cargo.lock +++ b/contracts/feature-tests/composability/vault/wasm/Cargo.lock @@ -8,16 +8,16 @@ version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "once_cell", "version_check", ] [[package]] name = "arrayvec" -version = "0.7.2" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" +checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" [[package]] name = "autocfg" @@ -31,12 +31,6 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" -[[package]] -name = "cfg-if" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" - [[package]] name = "cfg-if" version = "1.0.0" @@ -70,21 +64,9 @@ version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ebdb29d2ea9ed0083cd8cece49bbd968021bd99b0849edb4a9a7ee0fdf6a4e0" -[[package]] -name = "libc" -version = "0.2.140" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99227334921fae1a979cf0bfdfcc6b3e5ce376ef57e16fb6fb3ea2ed6095f80c" - -[[package]] -name = "memory_units" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8452105ba047068f40ff7093dd1d9da90898e63dd61736462e9cdda6a90ad3c3" - [[package]] name = "multiversx-sc" -version = "0.39.7" +version = "0.41.3" dependencies = [ "bitflags", "hashbrown", @@ -96,7 +78,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.17.1" +version = "0.17.2" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -104,7 +86,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.17.1" +version = "0.17.2" dependencies = [ "hex", "proc-macro2", @@ -114,7 +96,7 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.39.7" +version = "0.41.3" dependencies = [ "hex", "proc-macro2", @@ -125,10 +107,9 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.39.7" +version = "0.41.3" dependencies = [ "multiversx-sc", - "wee_alloc", ] [[package]] @@ -151,24 +132,24 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.17.1" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" +checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" [[package]] name = "proc-macro2" -version = "1.0.52" +version = "1.0.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d0e1ae9e836cc3beddd63db0df682593d7e2d3d891ae8c9083d2113e1744224" +checksum = "dec2b086b7a862cf4de201096214fa870344cf922b2b30c167badb3af3195406" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.26" +version = "1.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4424af4bf778aae2051a77b60283332f386554255d722233d09fbfc7e30da2fc" +checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488" dependencies = [ "proc-macro2", ] @@ -202,9 +183,9 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.8" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4" +checksum = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0" [[package]] name = "vault" @@ -226,37 +207,3 @@ name = "version_check" version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" - -[[package]] -name = "wee_alloc" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbb3b5a6b2bb17cb6ad44a2e68a43e8d2722c997da10e928665c72ec6c0a0b8e" -dependencies = [ - "cfg-if 0.1.10", - "libc", - "memory_units", - "winapi", -] - -[[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-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" diff --git a/contracts/feature-tests/composability/vault/wasm/Cargo.toml b/contracts/feature-tests/composability/vault/wasm/Cargo.toml index d84030c209..af4f6817f4 100644 --- a/contracts/feature-tests/composability/vault/wasm/Cargo.toml +++ b/contracts/feature-tests/composability/vault/wasm/Cargo.toml @@ -19,7 +19,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.39.7" +version = "0.41.3" path = "../../../../../framework/wasm-adapter" [workspace] diff --git a/contracts/feature-tests/composability/vault/wasm/src/lib.rs b/contracts/feature-tests/composability/vault/wasm/src/lib.rs index d39100edb0..8caed87137 100644 --- a/contracts/feature-tests/composability/vault/wasm/src/lib.rs +++ b/contracts/feature-tests/composability/vault/wasm/src/lib.rs @@ -10,7 +10,7 @@ // Total number of exported functions: 15 #![no_std] -#![feature(alloc_error_handler, lang_items)] +#![feature(lang_items)] multiversx_sc_wasm_adapter::allocator!(); multiversx_sc_wasm_adapter::panic_handler!(); diff --git a/contracts/feature-tests/erc-style-contracts/crowdfunding-erc20/Cargo.toml b/contracts/feature-tests/erc-style-contracts/crowdfunding-erc20/Cargo.toml index 91a8c6a7cf..1270cfc39c 100644 --- a/contracts/feature-tests/erc-style-contracts/crowdfunding-erc20/Cargo.toml +++ b/contracts/feature-tests/erc-style-contracts/crowdfunding-erc20/Cargo.toml @@ -12,10 +12,10 @@ path = "src/crowdfunding_erc20.rs" path = "../erc20" [dependencies.multiversx-sc] -version = "0.39.7" +version = "0.41.3" path = "../../../../framework/base" [dev-dependencies.multiversx-sc-scenario] -version = "0.39.7" +version = "0.41.3" path = "../../../../framework/scenario" diff --git a/contracts/feature-tests/erc-style-contracts/crowdfunding-erc20/meta/Cargo.toml b/contracts/feature-tests/erc-style-contracts/crowdfunding-erc20/meta/Cargo.toml index 36aebb07c3..ba828d6fc2 100644 --- a/contracts/feature-tests/erc-style-contracts/crowdfunding-erc20/meta/Cargo.toml +++ b/contracts/feature-tests/erc-style-contracts/crowdfunding-erc20/meta/Cargo.toml @@ -9,5 +9,5 @@ publish = false path = ".." [dependencies.multiversx-sc-meta] -version = "0.39.7" +version = "0.41.3" path = "../../../../../framework/meta" diff --git a/contracts/feature-tests/erc-style-contracts/crowdfunding-erc20/tests/crowdfunding_erc20_scenario_go_test.rs b/contracts/feature-tests/erc-style-contracts/crowdfunding-erc20/tests/crowdfunding_erc20_scenario_go_test.rs index f096903865..04b48b59c1 100644 --- a/contracts/feature-tests/erc-style-contracts/crowdfunding-erc20/tests/crowdfunding_erc20_scenario_go_test.rs +++ b/contracts/feature-tests/erc-style-contracts/crowdfunding-erc20/tests/crowdfunding_erc20_scenario_go_test.rs @@ -1,5 +1,5 @@ #[test] -fn deploy_erc20_and_crowdfunding_go() { +fn deploy_erc_20_and_crowdfunding_go() { multiversx_sc_scenario::run_go("scenarios/deploy_erc20_and_crowdfunding.scen.json"); } diff --git a/contracts/feature-tests/erc-style-contracts/crowdfunding-erc20/tests/crowdfunding_erc20_scenario_rs_test.rs b/contracts/feature-tests/erc-style-contracts/crowdfunding-erc20/tests/crowdfunding_erc20_scenario_rs_test.rs index 9e342362b0..d4ac30da4f 100644 --- a/contracts/feature-tests/erc-style-contracts/crowdfunding-erc20/tests/crowdfunding_erc20_scenario_rs_test.rs +++ b/contracts/feature-tests/erc-style-contracts/crowdfunding-erc20/tests/crowdfunding_erc20_scenario_rs_test.rs @@ -17,7 +17,7 @@ fn world() -> ScenarioWorld { } #[test] -fn deploy_erc20_and_crowdfunding_rs() { +fn deploy_erc_20_and_crowdfunding_rs() { multiversx_sc_scenario::run_rs("scenarios/deploy_erc20_and_crowdfunding.scen.json", world()); } diff --git a/contracts/feature-tests/erc-style-contracts/crowdfunding-erc20/wasm/Cargo.lock b/contracts/feature-tests/erc-style-contracts/crowdfunding-erc20/wasm/Cargo.lock index 8ffdb88e5c..853c5483a0 100644 --- a/contracts/feature-tests/erc-style-contracts/crowdfunding-erc20/wasm/Cargo.lock +++ b/contracts/feature-tests/erc-style-contracts/crowdfunding-erc20/wasm/Cargo.lock @@ -8,16 +8,16 @@ version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "once_cell", "version_check", ] [[package]] name = "arrayvec" -version = "0.7.2" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" +checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" [[package]] name = "autocfg" @@ -31,12 +31,6 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" -[[package]] -name = "cfg-if" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" - [[package]] name = "cfg-if" version = "1.0.0" @@ -93,21 +87,9 @@ version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ebdb29d2ea9ed0083cd8cece49bbd968021bd99b0849edb4a9a7ee0fdf6a4e0" -[[package]] -name = "libc" -version = "0.2.140" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99227334921fae1a979cf0bfdfcc6b3e5ce376ef57e16fb6fb3ea2ed6095f80c" - -[[package]] -name = "memory_units" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8452105ba047068f40ff7093dd1d9da90898e63dd61736462e9cdda6a90ad3c3" - [[package]] name = "multiversx-sc" -version = "0.39.7" +version = "0.41.3" dependencies = [ "bitflags", "hashbrown", @@ -119,7 +101,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.17.1" +version = "0.17.2" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -127,7 +109,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.17.1" +version = "0.17.2" dependencies = [ "hex", "proc-macro2", @@ -137,7 +119,7 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.39.7" +version = "0.41.3" dependencies = [ "hex", "proc-macro2", @@ -148,10 +130,9 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.39.7" +version = "0.41.3" dependencies = [ "multiversx-sc", - "wee_alloc", ] [[package]] @@ -174,24 +155,24 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.17.1" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" +checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" [[package]] name = "proc-macro2" -version = "1.0.52" +version = "1.0.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d0e1ae9e836cc3beddd63db0df682593d7e2d3d891ae8c9083d2113e1744224" +checksum = "dec2b086b7a862cf4de201096214fa870344cf922b2b30c167badb3af3195406" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.26" +version = "1.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4424af4bf778aae2051a77b60283332f386554255d722233d09fbfc7e30da2fc" +checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488" dependencies = [ "proc-macro2", ] @@ -225,46 +206,12 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.8" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4" +checksum = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0" [[package]] name = "version_check" version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" - -[[package]] -name = "wee_alloc" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbb3b5a6b2bb17cb6ad44a2e68a43e8d2722c997da10e928665c72ec6c0a0b8e" -dependencies = [ - "cfg-if 0.1.10", - "libc", - "memory_units", - "winapi", -] - -[[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-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" diff --git a/contracts/feature-tests/erc-style-contracts/crowdfunding-erc20/wasm/Cargo.toml b/contracts/feature-tests/erc-style-contracts/crowdfunding-erc20/wasm/Cargo.toml index 49a6be0b30..6b2850056f 100644 --- a/contracts/feature-tests/erc-style-contracts/crowdfunding-erc20/wasm/Cargo.toml +++ b/contracts/feature-tests/erc-style-contracts/crowdfunding-erc20/wasm/Cargo.toml @@ -19,7 +19,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.39.7" +version = "0.41.3" path = "../../../../../framework/wasm-adapter" [workspace] diff --git a/contracts/feature-tests/erc-style-contracts/crowdfunding-erc20/wasm/src/lib.rs b/contracts/feature-tests/erc-style-contracts/crowdfunding-erc20/wasm/src/lib.rs index d999535a06..a90f2af4e2 100644 --- a/contracts/feature-tests/erc-style-contracts/crowdfunding-erc20/wasm/src/lib.rs +++ b/contracts/feature-tests/erc-style-contracts/crowdfunding-erc20/wasm/src/lib.rs @@ -10,7 +10,7 @@ // Total number of exported functions: 10 #![no_std] -#![feature(alloc_error_handler, lang_items)] +#![feature(lang_items)] multiversx_sc_wasm_adapter::allocator!(); multiversx_sc_wasm_adapter::panic_handler!(); diff --git a/contracts/feature-tests/erc-style-contracts/erc1155-marketplace/Cargo.toml b/contracts/feature-tests/erc-style-contracts/erc1155-marketplace/Cargo.toml index 0b2a5f3448..91c05cf538 100644 --- a/contracts/feature-tests/erc-style-contracts/erc1155-marketplace/Cargo.toml +++ b/contracts/feature-tests/erc-style-contracts/erc1155-marketplace/Cargo.toml @@ -13,9 +13,10 @@ path = "src/lib.rs" path = "../erc1155" [dependencies.multiversx-sc] -version = "0.39.7" +version = "0.41.3" path = "../../../../framework/base" +features = ["alloc"] [dev-dependencies.multiversx-sc-scenario] -version = "0.39.7" +version = "0.41.3" path = "../../../../framework/scenario" diff --git a/contracts/feature-tests/erc-style-contracts/erc1155-marketplace/meta/Cargo.toml b/contracts/feature-tests/erc-style-contracts/erc1155-marketplace/meta/Cargo.toml index fc2f1cc5bf..2a0ef80a1f 100644 --- a/contracts/feature-tests/erc-style-contracts/erc1155-marketplace/meta/Cargo.toml +++ b/contracts/feature-tests/erc-style-contracts/erc1155-marketplace/meta/Cargo.toml @@ -9,5 +9,5 @@ publish = false path = ".." [dependencies.multiversx-sc-meta] -version = "0.39.7" +version = "0.41.3" path = "../../../../../framework/meta" diff --git a/contracts/feature-tests/erc-style-contracts/erc1155-marketplace/multicontract.toml b/contracts/feature-tests/erc-style-contracts/erc1155-marketplace/multicontract.toml new file mode 100644 index 0000000000..764ada4ee2 --- /dev/null +++ b/contracts/feature-tests/erc-style-contracts/erc1155-marketplace/multicontract.toml @@ -0,0 +1,7 @@ +[settings] +main = "erc1155-marketplace" + +# the only purpose of this config is to specify the allocator +[contracts.erc1155-marketplace] +add-unlabelled = true +allocator = "static64k" diff --git a/contracts/feature-tests/erc-style-contracts/erc1155-marketplace/tests/erc1155_marketplace_scenario_rs_test.rs b/contracts/feature-tests/erc-style-contracts/erc1155-marketplace/tests/erc1155_marketplace_scenario_rs_test.rs index 2431cbe639..0ee70f3a57 100644 --- a/contracts/feature-tests/erc-style-contracts/erc1155-marketplace/tests/erc1155_marketplace_scenario_rs_test.rs +++ b/contracts/feature-tests/erc-style-contracts/erc1155-marketplace/tests/erc1155_marketplace_scenario_rs_test.rs @@ -15,31 +15,31 @@ fn world() -> ScenarioWorld { } #[test] -fn auction_single_token_egld_test_rs() { - multiversx_sc_scenario::run_rs("scenarios/auction_single_token_egld.scen.json", world()); +fn auction_batch_rs() { + multiversx_sc_scenario::run_rs("scenarios/auction_batch.scen.json", world()); } #[test] -fn auction_batch_test_rs() { - multiversx_sc_scenario::run_rs("scenarios/auction_batch.scen.json", world()); +fn auction_single_token_egld_rs() { + multiversx_sc_scenario::run_rs("scenarios/auction_single_token_egld.scen.json", world()); } #[test] -fn bid_first_egld_test_rs() { +fn bid_first_egld_rs() { multiversx_sc_scenario::run_rs("scenarios/bid_first_egld.scen.json", world()); } #[test] -fn bid_second_egld_test_rs() { +fn bid_second_egld_rs() { multiversx_sc_scenario::run_rs("scenarios/bid_second_egld.scen.json", world()); } #[test] -fn bid_third_egld_test_rs() { +fn bid_third_egld_rs() { multiversx_sc_scenario::run_rs("scenarios/bid_third_egld.scen.json", world()); } #[test] -fn end_auction_test_rs() { +fn end_auction_rs() { multiversx_sc_scenario::run_rs("scenarios/end_auction.scen.json", world()); } diff --git a/contracts/feature-tests/erc-style-contracts/erc1155-marketplace/wasm/Cargo.lock b/contracts/feature-tests/erc-style-contracts/erc1155-marketplace/wasm/Cargo.lock index 3b2af1e820..2cc30b8254 100644 --- a/contracts/feature-tests/erc-style-contracts/erc1155-marketplace/wasm/Cargo.lock +++ b/contracts/feature-tests/erc-style-contracts/erc1155-marketplace/wasm/Cargo.lock @@ -8,16 +8,16 @@ version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "once_cell", "version_check", ] [[package]] name = "arrayvec" -version = "0.7.2" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" +checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" [[package]] name = "autocfg" @@ -31,12 +31,6 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" -[[package]] -name = "cfg-if" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" - [[package]] name = "cfg-if" version = "1.0.0" @@ -53,7 +47,6 @@ checksum = "c34f04666d835ff5d62e058c3995147c06f42fe86ff053337632bca83e42702d" name = "erc1155" version = "0.0.0" dependencies = [ - "erc1155-user-mock", "multiversx-sc", ] @@ -73,13 +66,6 @@ dependencies = [ "multiversx-sc-wasm-adapter", ] -[[package]] -name = "erc1155-user-mock" -version = "0.0.0" -dependencies = [ - "multiversx-sc", -] - [[package]] name = "hashbrown" version = "0.13.2" @@ -101,21 +87,9 @@ version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ebdb29d2ea9ed0083cd8cece49bbd968021bd99b0849edb4a9a7ee0fdf6a4e0" -[[package]] -name = "libc" -version = "0.2.140" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99227334921fae1a979cf0bfdfcc6b3e5ce376ef57e16fb6fb3ea2ed6095f80c" - -[[package]] -name = "memory_units" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8452105ba047068f40ff7093dd1d9da90898e63dd61736462e9cdda6a90ad3c3" - [[package]] name = "multiversx-sc" -version = "0.39.7" +version = "0.41.3" dependencies = [ "bitflags", "hashbrown", @@ -127,7 +101,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.17.1" +version = "0.17.2" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -135,7 +109,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.17.1" +version = "0.17.2" dependencies = [ "hex", "proc-macro2", @@ -145,7 +119,7 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.39.7" +version = "0.41.3" dependencies = [ "hex", "proc-macro2", @@ -156,10 +130,9 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.39.7" +version = "0.41.3" dependencies = [ "multiversx-sc", - "wee_alloc", ] [[package]] @@ -182,24 +155,24 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.17.1" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" +checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" [[package]] name = "proc-macro2" -version = "1.0.52" +version = "1.0.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d0e1ae9e836cc3beddd63db0df682593d7e2d3d891ae8c9083d2113e1744224" +checksum = "dec2b086b7a862cf4de201096214fa870344cf922b2b30c167badb3af3195406" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.26" +version = "1.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4424af4bf778aae2051a77b60283332f386554255d722233d09fbfc7e30da2fc" +checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488" dependencies = [ "proc-macro2", ] @@ -233,46 +206,12 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.8" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4" +checksum = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0" [[package]] name = "version_check" version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" - -[[package]] -name = "wee_alloc" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbb3b5a6b2bb17cb6ad44a2e68a43e8d2722c997da10e928665c72ec6c0a0b8e" -dependencies = [ - "cfg-if 0.1.10", - "libc", - "memory_units", - "winapi", -] - -[[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-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" diff --git a/contracts/feature-tests/erc-style-contracts/erc1155-marketplace/wasm/Cargo.toml b/contracts/feature-tests/erc-style-contracts/erc1155-marketplace/wasm/Cargo.toml index 98ea1863b0..bf3be68df9 100644 --- a/contracts/feature-tests/erc-style-contracts/erc1155-marketplace/wasm/Cargo.toml +++ b/contracts/feature-tests/erc-style-contracts/erc1155-marketplace/wasm/Cargo.toml @@ -19,7 +19,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.39.7" +version = "0.41.3" path = "../../../../../framework/wasm-adapter" [workspace] diff --git a/contracts/feature-tests/erc-style-contracts/erc1155-marketplace/wasm/src/lib.rs b/contracts/feature-tests/erc-style-contracts/erc1155-marketplace/wasm/src/lib.rs index 109f910f02..2c96a88ceb 100644 --- a/contracts/feature-tests/erc-style-contracts/erc1155-marketplace/wasm/src/lib.rs +++ b/contracts/feature-tests/erc-style-contracts/erc1155-marketplace/wasm/src/lib.rs @@ -10,9 +10,9 @@ // Total number of exported functions: 14 #![no_std] -#![feature(alloc_error_handler, lang_items)] +#![feature(lang_items)] -multiversx_sc_wasm_adapter::allocator!(); +multiversx_sc_wasm_adapter::allocator!(static64k); multiversx_sc_wasm_adapter::panic_handler!(); multiversx_sc_wasm_adapter::endpoints! { diff --git a/contracts/feature-tests/erc-style-contracts/erc1155-user-mock/Cargo.toml b/contracts/feature-tests/erc-style-contracts/erc1155-user-mock/Cargo.toml index 245c7ed3fc..3b81d18618 100644 --- a/contracts/feature-tests/erc-style-contracts/erc1155-user-mock/Cargo.toml +++ b/contracts/feature-tests/erc-style-contracts/erc1155-user-mock/Cargo.toml @@ -9,11 +9,10 @@ publish = false path = "src/lib.rs" [dependencies.multiversx-sc] -version = "0.39.7" +version = "0.41.3" path = "../../../../framework/base" -features = ["alloc"] [dev-dependencies.multiversx-sc-scenario] -version = "0.39.7" +version = "0.41.3" path = "../../../../framework/scenario" diff --git a/contracts/feature-tests/erc-style-contracts/erc1155-user-mock/meta/Cargo.toml b/contracts/feature-tests/erc-style-contracts/erc1155-user-mock/meta/Cargo.toml index 57aec5c643..b3c3910507 100644 --- a/contracts/feature-tests/erc-style-contracts/erc1155-user-mock/meta/Cargo.toml +++ b/contracts/feature-tests/erc-style-contracts/erc1155-user-mock/meta/Cargo.toml @@ -9,5 +9,5 @@ publish = false path = ".." [dependencies.multiversx-sc-meta] -version = "0.39.7" +version = "0.41.3" path = "../../../../../framework/meta" diff --git a/contracts/feature-tests/erc-style-contracts/erc1155-user-mock/src/lib.rs b/contracts/feature-tests/erc-style-contracts/erc1155-user-mock/src/lib.rs index 557336a709..4e0d43fee8 100644 --- a/contracts/feature-tests/erc-style-contracts/erc1155-user-mock/src/lib.rs +++ b/contracts/feature-tests/erc-style-contracts/erc1155-user-mock/src/lib.rs @@ -23,8 +23,8 @@ pub trait Erc1155UserMock { &self, _operator: ManagedAddress, _from: ManagedAddress, - _type_ids: Vec, - _values: Vec, + _type_ids: ManagedVec, + _values: ManagedVec, _data: ManagedBuffer, ) { } diff --git a/contracts/feature-tests/erc-style-contracts/erc1155-user-mock/wasm/Cargo.lock b/contracts/feature-tests/erc-style-contracts/erc1155-user-mock/wasm/Cargo.lock index 8b7da3dab0..e72403c639 100644 --- a/contracts/feature-tests/erc-style-contracts/erc1155-user-mock/wasm/Cargo.lock +++ b/contracts/feature-tests/erc-style-contracts/erc1155-user-mock/wasm/Cargo.lock @@ -8,16 +8,16 @@ version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "once_cell", "version_check", ] [[package]] name = "arrayvec" -version = "0.7.2" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" +checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" [[package]] name = "autocfg" @@ -31,12 +31,6 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" -[[package]] -name = "cfg-if" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" - [[package]] name = "cfg-if" version = "1.0.0" @@ -85,21 +79,9 @@ version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ebdb29d2ea9ed0083cd8cece49bbd968021bd99b0849edb4a9a7ee0fdf6a4e0" -[[package]] -name = "libc" -version = "0.2.140" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99227334921fae1a979cf0bfdfcc6b3e5ce376ef57e16fb6fb3ea2ed6095f80c" - -[[package]] -name = "memory_units" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8452105ba047068f40ff7093dd1d9da90898e63dd61736462e9cdda6a90ad3c3" - [[package]] name = "multiversx-sc" -version = "0.39.7" +version = "0.41.3" dependencies = [ "bitflags", "hashbrown", @@ -111,7 +93,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.17.1" +version = "0.17.2" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -119,7 +101,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.17.1" +version = "0.17.2" dependencies = [ "hex", "proc-macro2", @@ -129,7 +111,7 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.39.7" +version = "0.41.3" dependencies = [ "hex", "proc-macro2", @@ -140,10 +122,9 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.39.7" +version = "0.41.3" dependencies = [ "multiversx-sc", - "wee_alloc", ] [[package]] @@ -166,24 +147,24 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.17.1" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" +checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" [[package]] name = "proc-macro2" -version = "1.0.52" +version = "1.0.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d0e1ae9e836cc3beddd63db0df682593d7e2d3d891ae8c9083d2113e1744224" +checksum = "dec2b086b7a862cf4de201096214fa870344cf922b2b30c167badb3af3195406" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.26" +version = "1.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4424af4bf778aae2051a77b60283332f386554255d722233d09fbfc7e30da2fc" +checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488" dependencies = [ "proc-macro2", ] @@ -217,46 +198,12 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.8" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4" +checksum = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0" [[package]] name = "version_check" version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" - -[[package]] -name = "wee_alloc" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbb3b5a6b2bb17cb6ad44a2e68a43e8d2722c997da10e928665c72ec6c0a0b8e" -dependencies = [ - "cfg-if 0.1.10", - "libc", - "memory_units", - "winapi", -] - -[[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-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" diff --git a/contracts/feature-tests/erc-style-contracts/erc1155-user-mock/wasm/Cargo.toml b/contracts/feature-tests/erc-style-contracts/erc1155-user-mock/wasm/Cargo.toml index 0f1bb86c19..24e935caff 100644 --- a/contracts/feature-tests/erc-style-contracts/erc1155-user-mock/wasm/Cargo.toml +++ b/contracts/feature-tests/erc-style-contracts/erc1155-user-mock/wasm/Cargo.toml @@ -19,7 +19,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.39.7" +version = "0.41.3" path = "../../../../../framework/wasm-adapter" [workspace] diff --git a/contracts/feature-tests/erc-style-contracts/erc1155-user-mock/wasm/src/lib.rs b/contracts/feature-tests/erc-style-contracts/erc1155-user-mock/wasm/src/lib.rs index 15fb1e1bd5..76765539e9 100644 --- a/contracts/feature-tests/erc-style-contracts/erc1155-user-mock/wasm/src/lib.rs +++ b/contracts/feature-tests/erc-style-contracts/erc1155-user-mock/wasm/src/lib.rs @@ -10,7 +10,7 @@ // Total number of exported functions: 4 #![no_std] -#![feature(alloc_error_handler, lang_items)] +#![feature(lang_items)] multiversx_sc_wasm_adapter::allocator!(); multiversx_sc_wasm_adapter::panic_handler!(); diff --git a/contracts/feature-tests/erc-style-contracts/erc1155/Cargo.toml b/contracts/feature-tests/erc-style-contracts/erc1155/Cargo.toml index 56a8c62b94..f8d1648400 100644 --- a/contracts/feature-tests/erc-style-contracts/erc1155/Cargo.toml +++ b/contracts/feature-tests/erc-style-contracts/erc1155/Cargo.toml @@ -8,13 +8,14 @@ publish = false [lib] path = "src/erc1155.rs" -[dependencies.erc1155-user-mock] -path="../erc1155-user-mock" - [dependencies.multiversx-sc] -version = "0.39.7" +version = "0.41.3" path = "../../../../framework/base" +features = ["alloc"] [dev-dependencies.multiversx-sc-scenario] -version = "0.39.7" +version = "0.41.3" path = "../../../../framework/scenario" + +[dev-dependencies.erc1155-user-mock] +path="../erc1155-user-mock" diff --git a/contracts/feature-tests/erc-style-contracts/erc1155/meta/Cargo.toml b/contracts/feature-tests/erc-style-contracts/erc1155/meta/Cargo.toml index 5e63494a5d..4c98a8edb1 100644 --- a/contracts/feature-tests/erc-style-contracts/erc1155/meta/Cargo.toml +++ b/contracts/feature-tests/erc-style-contracts/erc1155/meta/Cargo.toml @@ -9,5 +9,5 @@ publish = false path = ".." [dependencies.multiversx-sc-meta] -version = "0.39.7" +version = "0.41.3" path = "../../../../../framework/meta" diff --git a/contracts/feature-tests/erc-style-contracts/erc1155/multicontract.toml b/contracts/feature-tests/erc-style-contracts/erc1155/multicontract.toml new file mode 100644 index 0000000000..9d5da94a85 --- /dev/null +++ b/contracts/feature-tests/erc-style-contracts/erc1155/multicontract.toml @@ -0,0 +1,7 @@ +[settings] +main = "erc1155" + +# the only purpose of this config is to specify the allocator +[contracts.erc1155] +add-unlabelled = true +allocator = "static64k" diff --git a/contracts/feature-tests/erc-style-contracts/erc1155/tests/erc1155_scenario_rs_test.rs b/contracts/feature-tests/erc-style-contracts/erc1155/tests/erc1155_scenario_rs_test.rs index 7b973187e0..55e3ae7502 100644 --- a/contracts/feature-tests/erc-style-contracts/erc1155/tests/erc1155_scenario_rs_test.rs +++ b/contracts/feature-tests/erc-style-contracts/erc1155/tests/erc1155_scenario_rs_test.rs @@ -12,147 +12,144 @@ fn world() -> ScenarioWorld { } #[test] -fn deploy_test_rs() { - multiversx_sc_scenario::run_rs("scenarios/deploy.scen.json", world()); -} - -// Create token tests - -#[test] -fn create_token_fungible_test_rs() { - multiversx_sc_scenario::run_rs("scenarios/create_token_fungible.scen.json", world()); -} - -#[test] -fn create_token_non_fungible_test_rs() { - multiversx_sc_scenario::run_rs("scenarios/create_token_non_fungible.scen.json", world()); -} - -#[test] -fn create_two_fungible_same_creator_test_rs() { - multiversx_sc_scenario::run_rs( - "scenarios/create_two_tokens_both_fungible_same_creator.scen.json", - world(), - ); +fn batch_transfer_both_types_rs() { + multiversx_sc_scenario::run_rs("scenarios/batch_transfer_both_types.scen.json", world()); } #[test] -fn create_two_fungible_different_creator_test_rs() { +fn batch_transfer_both_types_to_sc_rs() { multiversx_sc_scenario::run_rs( - "scenarios/create_two_tokens_both_fungible_different_creator.scen.json", + "scenarios/batch_transfer_both_types_to_sc.scen.json", world(), ); } #[test] -fn create_two_non_fungible_same_creator_test_rs() { - multiversx_sc_scenario::run_rs( - "scenarios/create_two_tokens_both_non_fungible_same_creator.scen.json", - world(), - ); +fn batch_transfer_fungible_rs() { + multiversx_sc_scenario::run_rs("scenarios/batch_transfer_fungible.scen.json", world()); } #[test] -fn create_one_fungible_one_non_fungible_test_rs() { - multiversx_sc_scenario::run_rs( - "scenarios/create_one_fungible_one_non_fungible.scen.json", - world(), - ); +fn batch_transfer_fungible_to_sc_rs() { + multiversx_sc_scenario::run_rs("scenarios/batch_transfer_fungible_to_sc.scen.json", world()); } -// transfer tests - to account #[test] -fn transfer_fungible_ok_test_rs() { - multiversx_sc_scenario::run_rs("scenarios/transfer_fungible_ok.scen.json", world()); +fn batch_transfer_non_fungible_rs() { + multiversx_sc_scenario::run_rs("scenarios/batch_transfer_non_fungible.scen.json", world()); } #[test] -fn transfer_fungible_not_enough_balance_test_rs() { +fn batch_transfer_non_fungible_to_sc_rs() { multiversx_sc_scenario::run_rs( - "scenarios/transfer_fungible_not_enough_balance.scen.json", + "scenarios/batch_transfer_non_fungible_to_sc.scen.json", world(), ); } +// burn tests #[test] -fn transfer_non_fungible_ok_test_rs() { - multiversx_sc_scenario::run_rs("scenarios/transfer_non_fungible_ok.scen.json", world()); +fn burn_fungible_rs() { + multiversx_sc_scenario::run_rs("scenarios/burn_fungible.scen.json", world()); } #[test] -fn batch_transfer_fungible_test_rs() { - multiversx_sc_scenario::run_rs("scenarios/batch_transfer_fungible.scen.json", world()); +fn burn_non_fungible_rs() { + multiversx_sc_scenario::run_rs("scenarios/burn_non_fungible.scen.json", world()); } #[test] -fn batch_transfer_non_fungible_test_rs() { - multiversx_sc_scenario::run_rs("scenarios/batch_transfer_non_fungible.scen.json", world()); +fn create_one_fungible_one_non_fungible_rs() { + multiversx_sc_scenario::run_rs( + "scenarios/create_one_fungible_one_non_fungible.scen.json", + world(), + ); } +// Create token tests #[test] -fn batch_transfer_both_types_test_rs() { - multiversx_sc_scenario::run_rs("scenarios/batch_transfer_both_types.scen.json", world()); +fn create_token_fungible_rs() { + multiversx_sc_scenario::run_rs("scenarios/create_token_fungible.scen.json", world()); } #[test] -fn transfer_fungible_ok_to_sc_test_rs() { - multiversx_sc_scenario::run_rs("scenarios/transfer_fungible_ok_to_sc.scen.json", world()); +fn create_token_non_fungible_rs() { + multiversx_sc_scenario::run_rs("scenarios/create_token_non_fungible.scen.json", world()); } #[test] -fn transfer_non_fungible_ok_to_sc_test_rs() { +fn create_two_tokens_both_fungible_different_creator_rs() { multiversx_sc_scenario::run_rs( - "scenarios/transfer_non_fungible_ok_to_sc.scen.json", + "scenarios/create_two_tokens_both_fungible_different_creator.scen.json", world(), ); } #[test] -fn batch_transfer_fungible_to_sc_test_rs() { - multiversx_sc_scenario::run_rs("scenarios/batch_transfer_fungible_to_sc.scen.json", world()); -} - -#[test] -fn batch_transfer_non_fungible_to_sc_test_rs() { +fn create_two_tokens_both_fungible_same_creator_rs() { multiversx_sc_scenario::run_rs( - "scenarios/batch_transfer_non_fungible_to_sc.scen.json", + "scenarios/create_two_tokens_both_fungible_same_creator.scen.json", world(), ); } #[test] -fn batch_transfer_both_types_to_sc_test_rs() { +fn create_two_tokens_both_non_fungible_same_creator_rs() { multiversx_sc_scenario::run_rs( - "scenarios/batch_transfer_both_types_to_sc.scen.json", + "scenarios/create_two_tokens_both_non_fungible_same_creator.scen.json", world(), ); } -// mint tests +#[test] +fn deploy_rs() { + multiversx_sc_scenario::run_rs("scenarios/deploy.scen.json", world()); +} +// mint tests #[test] -fn mint_fungible_test_rs() { +fn mint_fungible_rs() { multiversx_sc_scenario::run_rs("scenarios/mint_fungible.scen.json", world()); } #[test] -fn mint_non_fungible_test_rs() { +fn mint_non_fungible_rs() { multiversx_sc_scenario::run_rs("scenarios/mint_non_fungible.scen.json", world()); } #[test] -fn mint_not_creator_test_rs() { +fn mint_not_creator_rs() { multiversx_sc_scenario::run_rs("scenarios/mint_not_creator.scen.json", world()); } -// burn tests +#[test] +fn transfer_fungible_not_enough_balance_rs() { + multiversx_sc_scenario::run_rs( + "scenarios/transfer_fungible_not_enough_balance.scen.json", + world(), + ); +} +// transfer tests - to account #[test] -fn burn_fungible_test_rs() { - multiversx_sc_scenario::run_rs("scenarios/burn_fungible.scen.json", world()); +fn transfer_fungible_ok_rs() { + multiversx_sc_scenario::run_rs("scenarios/transfer_fungible_ok.scen.json", world()); } #[test] -fn burn_non_fungible_test_rs() { - multiversx_sc_scenario::run_rs("scenarios/burn_non_fungible.scen.json", world()); +fn transfer_fungible_ok_to_sc_rs() { + multiversx_sc_scenario::run_rs("scenarios/transfer_fungible_ok_to_sc.scen.json", world()); +} + +#[test] +fn transfer_non_fungible_ok_rs() { + multiversx_sc_scenario::run_rs("scenarios/transfer_non_fungible_ok.scen.json", world()); +} + +#[test] +fn transfer_non_fungible_ok_to_sc_rs() { + multiversx_sc_scenario::run_rs( + "scenarios/transfer_non_fungible_ok_to_sc.scen.json", + world(), + ); } diff --git a/contracts/feature-tests/erc-style-contracts/erc1155/wasm/Cargo.lock b/contracts/feature-tests/erc-style-contracts/erc1155/wasm/Cargo.lock index 3ffebc27b0..981c4f529c 100644 --- a/contracts/feature-tests/erc-style-contracts/erc1155/wasm/Cargo.lock +++ b/contracts/feature-tests/erc-style-contracts/erc1155/wasm/Cargo.lock @@ -8,16 +8,16 @@ version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "once_cell", "version_check", ] [[package]] name = "arrayvec" -version = "0.7.2" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" +checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" [[package]] name = "autocfg" @@ -31,12 +31,6 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" -[[package]] -name = "cfg-if" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" - [[package]] name = "cfg-if" version = "1.0.0" @@ -52,14 +46,6 @@ checksum = "c34f04666d835ff5d62e058c3995147c06f42fe86ff053337632bca83e42702d" [[package]] name = "erc1155" version = "0.0.0" -dependencies = [ - "erc1155-user-mock", - "multiversx-sc", -] - -[[package]] -name = "erc1155-user-mock" -version = "0.0.0" dependencies = [ "multiversx-sc", ] @@ -93,21 +79,9 @@ version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ebdb29d2ea9ed0083cd8cece49bbd968021bd99b0849edb4a9a7ee0fdf6a4e0" -[[package]] -name = "libc" -version = "0.2.140" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99227334921fae1a979cf0bfdfcc6b3e5ce376ef57e16fb6fb3ea2ed6095f80c" - -[[package]] -name = "memory_units" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8452105ba047068f40ff7093dd1d9da90898e63dd61736462e9cdda6a90ad3c3" - [[package]] name = "multiversx-sc" -version = "0.39.7" +version = "0.41.3" dependencies = [ "bitflags", "hashbrown", @@ -119,7 +93,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.17.1" +version = "0.17.2" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -127,7 +101,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.17.1" +version = "0.17.2" dependencies = [ "hex", "proc-macro2", @@ -137,7 +111,7 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.39.7" +version = "0.41.3" dependencies = [ "hex", "proc-macro2", @@ -148,10 +122,9 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.39.7" +version = "0.41.3" dependencies = [ "multiversx-sc", - "wee_alloc", ] [[package]] @@ -174,24 +147,24 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.17.1" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" +checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" [[package]] name = "proc-macro2" -version = "1.0.52" +version = "1.0.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d0e1ae9e836cc3beddd63db0df682593d7e2d3d891ae8c9083d2113e1744224" +checksum = "dec2b086b7a862cf4de201096214fa870344cf922b2b30c167badb3af3195406" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.26" +version = "1.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4424af4bf778aae2051a77b60283332f386554255d722233d09fbfc7e30da2fc" +checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488" dependencies = [ "proc-macro2", ] @@ -225,46 +198,12 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.8" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4" +checksum = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0" [[package]] name = "version_check" version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" - -[[package]] -name = "wee_alloc" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbb3b5a6b2bb17cb6ad44a2e68a43e8d2722c997da10e928665c72ec6c0a0b8e" -dependencies = [ - "cfg-if 0.1.10", - "libc", - "memory_units", - "winapi", -] - -[[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-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" diff --git a/contracts/feature-tests/erc-style-contracts/erc1155/wasm/Cargo.toml b/contracts/feature-tests/erc-style-contracts/erc1155/wasm/Cargo.toml index 2135d806d6..d02557429f 100644 --- a/contracts/feature-tests/erc-style-contracts/erc1155/wasm/Cargo.toml +++ b/contracts/feature-tests/erc-style-contracts/erc1155/wasm/Cargo.toml @@ -19,7 +19,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.39.7" +version = "0.41.3" path = "../../../../../framework/wasm-adapter" [workspace] diff --git a/contracts/feature-tests/erc-style-contracts/erc1155/wasm/src/lib.rs b/contracts/feature-tests/erc-style-contracts/erc1155/wasm/src/lib.rs index 5dba26a2f8..079dcb28c6 100644 --- a/contracts/feature-tests/erc-style-contracts/erc1155/wasm/src/lib.rs +++ b/contracts/feature-tests/erc-style-contracts/erc1155/wasm/src/lib.rs @@ -10,9 +10,9 @@ // Total number of exported functions: 15 #![no_std] -#![feature(alloc_error_handler, lang_items)] +#![feature(lang_items)] -multiversx_sc_wasm_adapter::allocator!(); +multiversx_sc_wasm_adapter::allocator!(static64k); multiversx_sc_wasm_adapter::panic_handler!(); multiversx_sc_wasm_adapter::endpoints! { diff --git a/contracts/feature-tests/erc-style-contracts/erc20/Cargo.toml b/contracts/feature-tests/erc-style-contracts/erc20/Cargo.toml index 4f1bd135b4..d279feda91 100644 --- a/contracts/feature-tests/erc-style-contracts/erc20/Cargo.toml +++ b/contracts/feature-tests/erc-style-contracts/erc20/Cargo.toml @@ -9,9 +9,9 @@ publish = false path = "src/erc20.rs" [dependencies.multiversx-sc] -version = "0.39.7" +version = "0.41.3" path = "../../../../framework/base" [dev-dependencies.multiversx-sc-scenario] -version = "0.39.7" +version = "0.41.3" path = "../../../../framework/scenario" diff --git a/contracts/feature-tests/erc-style-contracts/erc20/meta/Cargo.toml b/contracts/feature-tests/erc-style-contracts/erc20/meta/Cargo.toml index 2ed3f324e7..1913c1bd92 100644 --- a/contracts/feature-tests/erc-style-contracts/erc20/meta/Cargo.toml +++ b/contracts/feature-tests/erc-style-contracts/erc20/meta/Cargo.toml @@ -9,5 +9,5 @@ publish = false path = ".." [dependencies.multiversx-sc-meta] -version = "0.39.7" +version = "0.41.3" path = "../../../../../framework/meta" diff --git a/contracts/feature-tests/erc-style-contracts/erc20/tests/erc20_scenario_go_test.rs b/contracts/feature-tests/erc-style-contracts/erc20/tests/erc20_scenario_go_test.rs index c288fcefee..6d7e1fca28 100644 --- a/contracts/feature-tests/erc-style-contracts/erc20/tests/erc20_scenario_go_test.rs +++ b/contracts/feature-tests/erc-style-contracts/erc20/tests/erc20_scenario_go_test.rs @@ -1,25 +1,25 @@ #[test] -fn allowance_callercaller_go() { +fn allowance_caller_caller_go() { multiversx_sc_scenario::run_go("scenarios/allowance_CallerCaller.scen.json"); } #[test] -fn allowance_callerother_go() { +fn allowance_caller_other_go() { multiversx_sc_scenario::run_go("scenarios/allowance_CallerOther.scen.json"); } #[test] -fn allowance_othercaller_go() { +fn allowance_other_caller_go() { multiversx_sc_scenario::run_go("scenarios/allowance_OtherCaller.scen.json"); } #[test] -fn allowance_othereqother_go() { +fn allowance_other_eq_other_go() { multiversx_sc_scenario::run_go("scenarios/allowance_OtherEqOther.scen.json"); } #[test] -fn allowance_otherneqother_go() { +fn allowance_other_n_eq_other_go() { multiversx_sc_scenario::run_go("scenarios/allowance_OtherNEqOther.scen.json"); } @@ -44,17 +44,17 @@ fn approve_other_zero_go() { } #[test] -fn approve_switchcaller_go() { +fn approve_switch_caller_go() { multiversx_sc_scenario::run_go("scenarios/approve_SwitchCaller.scen.json"); } #[test] -fn balanceof_caller_go() { +fn balance_of_caller_go() { multiversx_sc_scenario::run_go("scenarios/balanceOf_Caller.scen.json"); } #[test] -fn balanceof_noncaller_go() { +fn balance_of_non_caller_go() { multiversx_sc_scenario::run_go("scenarios/balanceOf_NonCaller.scen.json"); } @@ -69,203 +69,203 @@ fn not_payable_esdt_go() { } #[test] -fn totalsupply_positive_go() { +fn total_supply_positive_go() { multiversx_sc_scenario::run_go("scenarios/totalSupply_Positive.scen.json"); } #[test] -fn totalsupply_zero_go() { +fn total_supply_zero_go() { multiversx_sc_scenario::run_go("scenarios/totalSupply_Zero.scen.json"); } #[test] -fn transferfrom_alldistinct_balanceeqallowance_go() { +fn transfer_from_all_distinct_balance_eq_allowance_go() { multiversx_sc_scenario::run_go( "scenarios/transferFrom_AllDistinct-BalanceEqAllowance.scen.json", ); } #[test] -fn transferfrom_alldistinct_balanceneqallowance_go() { +fn transfer_from_all_distinct_balance_n_eq_allowance_go() { multiversx_sc_scenario::run_go( "scenarios/transferFrom_AllDistinct-BalanceNEqAllowance.scen.json", ); } #[test] -fn transferfrom_alldistinct_entireallowancemorethanbalance_go() { +fn transfer_from_all_distinct_entire_allowance_more_than_balance_go() { multiversx_sc_scenario::run_go( "scenarios/transferFrom_AllDistinct-EntireAllowanceMoreThanBalance.scen.json", ); } #[test] -fn transferfrom_alldistinct_entirebalanceeqallowance_go() { +fn transfer_from_all_distinct_entire_balance_eq_allowance_go() { multiversx_sc_scenario::run_go( "scenarios/transferFrom_AllDistinct-EntireBalanceEqAllowance.scen.json", ); } #[test] -fn transferfrom_alldistinct_entirebalancemorethanallowance_go() { +fn transfer_from_all_distinct_entire_balance_more_than_allowance_go() { multiversx_sc_scenario::run_go( "scenarios/transferFrom_AllDistinct-EntireBalanceMoreThanAllowance.scen.json", ); } #[test] -fn transferfrom_alldistinct_morethanallowancelessthanbalance_go() { +fn transfer_from_all_distinct_more_than_allowance_less_than_balance_go() { multiversx_sc_scenario::run_go( "scenarios/transferFrom_AllDistinct-MoreThanAllowanceLessThanBalance.scen.json", ); } #[test] -fn transferfrom_alldistinct_morethanbalancelessthanallowance_go() { +fn transfer_from_all_distinct_more_than_balance_less_than_allowance_go() { multiversx_sc_scenario::run_go( "scenarios/transferFrom_AllDistinct-MoreThanBalanceLessThanAllowance.scen.json", ); } #[test] -fn transferfrom_alldistinct_nooverflow_go() { +fn transfer_from_all_distinct_no_overflow_go() { multiversx_sc_scenario::run_go("scenarios/transferFrom_AllDistinct-NoOverflow.scen.json"); } #[test] -fn transferfrom_alldistinct_stillnooverflow_go() { +fn transfer_from_all_distinct_still_no_overflow_go() { multiversx_sc_scenario::run_go("scenarios/transferFrom_AllDistinct-StillNoOverflow.scen.json"); } #[test] -fn transferfrom_allequal_allowancerelevant_go() { +fn transfer_from_all_equal_allowance_relevant_go() { multiversx_sc_scenario::run_go("scenarios/transferFrom_AllEqual-AllowanceRelevant.scen.json"); } #[test] -fn transferfrom_allequal_entirebalance_go() { +fn transfer_from_all_equal_entire_balance_go() { multiversx_sc_scenario::run_go("scenarios/transferFrom_AllEqual-EntireBalance.scen.json"); } #[test] -fn transferfrom_callereqfrom_allowancerelevant_go() { +fn transfer_from_caller_eq_from_allowance_relevant_go() { multiversx_sc_scenario::run_go( "scenarios/transferFrom_CallerEqFrom-AllowanceRelevant.scen.json", ); } #[test] -fn transferfrom_callereqfrom_entirebalance_go() { +fn transfer_from_caller_eq_from_entire_balance_go() { multiversx_sc_scenario::run_go("scenarios/transferFrom_CallerEqFrom-EntireBalance.scen.json"); } #[test] -fn transferfrom_callereqfrom_morethanbalance_go() { +fn transfer_from_caller_eq_from_more_than_balance_go() { multiversx_sc_scenario::run_go("scenarios/transferFrom_CallerEqFrom-MoreThanBalance.scen.json"); } #[test] -fn transferfrom_callereqto_balanceneqallowance_go() { +fn transfer_from_caller_eq_to_balance_n_eq_allowance_go() { multiversx_sc_scenario::run_go( "scenarios/transferFrom_CallerEqTo-BalanceNEqAllowance.scen.json", ); } #[test] -fn transferfrom_callereqto_morethanallowancelessthanbalance_go() { +fn transfer_from_caller_eq_to_more_than_allowance_less_than_balance_go() { multiversx_sc_scenario::run_go( "scenarios/transferFrom_CallerEqTo-MoreThanAllowanceLessThanBalance.scen.json", ); } #[test] -fn transferfrom_callereqto_morethanbalancelessthanallowance_go() { +fn transfer_from_caller_eq_to_more_than_balance_less_than_allowance_go() { multiversx_sc_scenario::run_go( "scenarios/transferFrom_CallerEqTo-MoreThanBalanceLessThanAllowance.scen.json", ); } #[test] -fn transferfrom_exploratory_multipletransferssucceed_go() { +fn transfer_from_exploratory_multiple_transfers_succeed_go() { multiversx_sc_scenario::run_go( "scenarios/transferFrom_Exploratory-MultipleTransfersSucceed.scen.json", ); } #[test] -fn transferfrom_exploratory_multipletransfersthrow_go() { +fn transfer_from_exploratory_multiple_transfers_throw_go() { multiversx_sc_scenario::run_go( "scenarios/transferFrom_Exploratory-MultipleTransfersThrow.scen.json", ); } #[test] -fn transferfrom_fromeqto_balanceeqallowance_go() { +fn transfer_from_from_eq_to_balance_eq_allowance_go() { multiversx_sc_scenario::run_go("scenarios/transferFrom_FromEqTo-BalanceEqAllowance.scen.json"); } #[test] -fn transferfrom_fromeqto_balanceneqallowance_go() { +fn transfer_from_from_eq_to_balance_n_eq_allowance_go() { multiversx_sc_scenario::run_go("scenarios/transferFrom_FromEqTo-BalanceNEqAllowance.scen.json"); } #[test] -fn transferfrom_fromeqto_entireallowancemorethanbalance_go() { +fn transfer_from_from_eq_to_entire_allowance_more_than_balance_go() { multiversx_sc_scenario::run_go( "scenarios/transferFrom_FromEqTo-EntireAllowanceMoreThanBalance.scen.json", ); } #[test] -fn transferfrom_fromeqto_entirebalanceeqallowance_go() { +fn transfer_from_from_eq_to_entire_balance_eq_allowance_go() { multiversx_sc_scenario::run_go( "scenarios/transferFrom_FromEqTo-EntireBalanceEqAllowance.scen.json", ); } #[test] -fn transferfrom_fromeqto_entirebalancemorethanallowance_go() { +fn transfer_from_from_eq_to_entire_balance_more_than_allowance_go() { multiversx_sc_scenario::run_go( "scenarios/transferFrom_FromEqTo-EntireBalanceMoreThanAllowance.scen.json", ); } #[test] -fn transferfrom_fromeqto_morethanallowancelessthanbalance_go() { +fn transfer_from_from_eq_to_more_than_allowance_less_than_balance_go() { multiversx_sc_scenario::run_go( "scenarios/transferFrom_FromEqTo-MoreThanAllowanceLessThanBalance.scen.json", ); } #[test] -fn transferfrom_fromeqto_morethanbalancelessthanallowance_go() { +fn transfer_from_from_eq_to_more_than_balance_less_than_allowance_go() { multiversx_sc_scenario::run_go( "scenarios/transferFrom_FromEqTo-MoreThanBalanceLessThanAllowance.scen.json", ); } #[test] -fn transferfrom_fromeqto_nooverflow_go() { +fn transfer_from_from_eq_to_no_overflow_go() { multiversx_sc_scenario::run_go("scenarios/transferFrom_FromEqTo-NoOverflow.scen.json"); } #[test] -fn transfer_caller_allowanceirrelevant_go() { +fn transfer_caller_allowance_irrelevant_go() { multiversx_sc_scenario::run_go("scenarios/transfer_Caller-AllowanceIrrelevant.scen.json"); } #[test] -fn transfer_caller_entirebalance_go() { +fn transfer_caller_entire_balance_go() { multiversx_sc_scenario::run_go("scenarios/transfer_Caller-EntireBalance.scen.json"); } #[test] -fn transfer_caller_morethanbalance_go() { +fn transfer_caller_more_than_balance_go() { multiversx_sc_scenario::run_go("scenarios/transfer_Caller-MoreThanBalance.scen.json"); } #[test] -fn transfer_caller_nooverflow_go() { +fn transfer_caller_no_overflow_go() { multiversx_sc_scenario::run_go("scenarios/transfer_Caller-NoOverflow.scen.json"); } @@ -275,7 +275,7 @@ fn transfer_caller_positive_go() { } #[test] -fn transfer_caller_stillnooverflow_go() { +fn transfer_caller_still_no_overflow_go() { multiversx_sc_scenario::run_go("scenarios/transfer_Caller-StillNoOverflow.scen.json"); } @@ -285,22 +285,22 @@ fn transfer_caller_zero_go() { } #[test] -fn transfer_other_allowanceirrelevant_go() { +fn transfer_other_allowance_irrelevant_go() { multiversx_sc_scenario::run_go("scenarios/transfer_Other-AllowanceIrrelevant.scen.json"); } #[test] -fn transfer_other_entirebalance_go() { +fn transfer_other_entire_balance_go() { multiversx_sc_scenario::run_go("scenarios/transfer_Other-EntireBalance.scen.json"); } #[test] -fn transfer_other_morethanbalance_go() { +fn transfer_other_more_than_balance_go() { multiversx_sc_scenario::run_go("scenarios/transfer_Other-MoreThanBalance.scen.json"); } #[test] -fn transfer_other_nooverflow_go() { +fn transfer_other_no_overflow_go() { multiversx_sc_scenario::run_go("scenarios/transfer_Other-NoOverflow.scen.json"); } @@ -310,7 +310,7 @@ fn transfer_other_positive_go() { } #[test] -fn transfer_other_stillnooverflow_go() { +fn transfer_other_still_no_overflow_go() { multiversx_sc_scenario::run_go("scenarios/transfer_Other-StillNoOverflow.scen.json"); } diff --git a/contracts/feature-tests/erc-style-contracts/erc20/tests/erc20_scenario_rs_test.rs b/contracts/feature-tests/erc-style-contracts/erc20/tests/erc20_scenario_rs_test.rs index 7cef3b2f90..70a27fbb05 100644 --- a/contracts/feature-tests/erc-style-contracts/erc20/tests/erc20_scenario_rs_test.rs +++ b/contracts/feature-tests/erc-style-contracts/erc20/tests/erc20_scenario_rs_test.rs @@ -9,27 +9,27 @@ fn world() -> ScenarioWorld { } #[test] -fn allowance_callercaller_rs() { +fn allowance_caller_caller_rs() { multiversx_sc_scenario::run_rs("scenarios/allowance_CallerCaller.scen.json", world()); } #[test] -fn allowance_callerother_rs() { +fn allowance_caller_other_rs() { multiversx_sc_scenario::run_rs("scenarios/allowance_CallerOther.scen.json", world()); } #[test] -fn allowance_othercaller_rs() { +fn allowance_other_caller_rs() { multiversx_sc_scenario::run_rs("scenarios/allowance_OtherCaller.scen.json", world()); } #[test] -fn allowance_othereqother_rs() { +fn allowance_other_eq_other_rs() { multiversx_sc_scenario::run_rs("scenarios/allowance_OtherEqOther.scen.json", world()); } #[test] -fn allowance_otherneqother_rs() { +fn allowance_other_n_eq_other_rs() { multiversx_sc_scenario::run_rs("scenarios/allowance_OtherNEqOther.scen.json", world()); } @@ -54,17 +54,17 @@ fn approve_other_zero_rs() { } #[test] -fn approve_switchcaller_rs() { +fn approve_switch_caller_rs() { multiversx_sc_scenario::run_rs("scenarios/approve_SwitchCaller.scen.json", world()); } #[test] -fn balanceof_caller_rs() { +fn balance_of_caller_rs() { multiversx_sc_scenario::run_rs("scenarios/balanceOf_Caller.scen.json", world()); } #[test] -fn balanceof_noncaller_rs() { +fn balance_of_non_caller_rs() { multiversx_sc_scenario::run_rs("scenarios/balanceOf_NonCaller.scen.json", world()); } @@ -74,17 +74,22 @@ fn not_payable_rs() { } #[test] -fn totalsupply_positive_rs() { +fn not_payable_esdt_rs() { + multiversx_sc_scenario::run_rs("scenarios/not_payable_esdt.scen.json", world()); +} + +#[test] +fn total_supply_positive_rs() { multiversx_sc_scenario::run_rs("scenarios/totalSupply_Positive.scen.json", world()); } #[test] -fn totalsupply_zero_rs() { +fn total_supply_zero_rs() { multiversx_sc_scenario::run_rs("scenarios/totalSupply_Zero.scen.json", world()); } #[test] -fn transferfrom_alldistinct_balanceeqallowance_rs() { +fn transfer_from_all_distinct_balance_eq_allowance_rs() { multiversx_sc_scenario::run_rs( "scenarios/transferFrom_AllDistinct-BalanceEqAllowance.scen.json", world(), @@ -92,7 +97,7 @@ fn transferfrom_alldistinct_balanceeqallowance_rs() { } #[test] -fn transferfrom_alldistinct_balanceneqallowance_rs() { +fn transfer_from_all_distinct_balance_n_eq_allowance_rs() { multiversx_sc_scenario::run_rs( "scenarios/transferFrom_AllDistinct-BalanceNEqAllowance.scen.json", world(), @@ -100,7 +105,7 @@ fn transferfrom_alldistinct_balanceneqallowance_rs() { } #[test] -fn transferfrom_alldistinct_entireallowancemorethanbalance_rs() { +fn transfer_from_all_distinct_entire_allowance_more_than_balance_rs() { multiversx_sc_scenario::run_rs( "scenarios/transferFrom_AllDistinct-EntireAllowanceMoreThanBalance.scen.json", world(), @@ -108,7 +113,7 @@ fn transferfrom_alldistinct_entireallowancemorethanbalance_rs() { } #[test] -fn transferfrom_alldistinct_entirebalanceeqallowance_rs() { +fn transfer_from_all_distinct_entire_balance_eq_allowance_rs() { multiversx_sc_scenario::run_rs( "scenarios/transferFrom_AllDistinct-EntireBalanceEqAllowance.scen.json", world(), @@ -116,7 +121,7 @@ fn transferfrom_alldistinct_entirebalanceeqallowance_rs() { } #[test] -fn transferfrom_alldistinct_entirebalancemorethanallowance_rs() { +fn transfer_from_all_distinct_entire_balance_more_than_allowance_rs() { multiversx_sc_scenario::run_rs( "scenarios/transferFrom_AllDistinct-EntireBalanceMoreThanAllowance.scen.json", world(), @@ -124,7 +129,7 @@ fn transferfrom_alldistinct_entirebalancemorethanallowance_rs() { } #[test] -fn transferfrom_alldistinct_morethanallowancelessthanbalance_rs() { +fn transfer_from_all_distinct_more_than_allowance_less_than_balance_rs() { multiversx_sc_scenario::run_rs( "scenarios/transferFrom_AllDistinct-MoreThanAllowanceLessThanBalance.scen.json", world(), @@ -132,7 +137,7 @@ fn transferfrom_alldistinct_morethanallowancelessthanbalance_rs() { } #[test] -fn transferfrom_alldistinct_morethanbalancelessthanallowance_rs() { +fn transfer_from_all_distinct_more_than_balance_less_than_allowance_rs() { multiversx_sc_scenario::run_rs( "scenarios/transferFrom_AllDistinct-MoreThanBalanceLessThanAllowance.scen.json", world(), @@ -140,7 +145,7 @@ fn transferfrom_alldistinct_morethanbalancelessthanallowance_rs() { } #[test] -fn transferfrom_alldistinct_nooverflow_rs() { +fn transfer_from_all_distinct_no_overflow_rs() { multiversx_sc_scenario::run_rs( "scenarios/transferFrom_AllDistinct-NoOverflow.scen.json", world(), @@ -148,7 +153,7 @@ fn transferfrom_alldistinct_nooverflow_rs() { } #[test] -fn transferfrom_alldistinct_stillnooverflow_rs() { +fn transfer_from_all_distinct_still_no_overflow_rs() { multiversx_sc_scenario::run_rs( "scenarios/transferFrom_AllDistinct-StillNoOverflow.scen.json", world(), @@ -156,7 +161,7 @@ fn transferfrom_alldistinct_stillnooverflow_rs() { } #[test] -fn transferfrom_allequal_allowancerelevant_rs() { +fn transfer_from_all_equal_allowance_relevant_rs() { multiversx_sc_scenario::run_rs( "scenarios/transferFrom_AllEqual-AllowanceRelevant.scen.json", world(), @@ -164,7 +169,7 @@ fn transferfrom_allequal_allowancerelevant_rs() { } #[test] -fn transferfrom_allequal_entirebalance_rs() { +fn transfer_from_all_equal_entire_balance_rs() { multiversx_sc_scenario::run_rs( "scenarios/transferFrom_AllEqual-EntireBalance.scen.json", world(), @@ -172,7 +177,7 @@ fn transferfrom_allequal_entirebalance_rs() { } #[test] -fn transferfrom_callereqfrom_allowancerelevant_rs() { +fn transfer_from_caller_eq_from_allowance_relevant_rs() { multiversx_sc_scenario::run_rs( "scenarios/transferFrom_CallerEqFrom-AllowanceRelevant.scen.json", world(), @@ -180,7 +185,7 @@ fn transferfrom_callereqfrom_allowancerelevant_rs() { } #[test] -fn transferfrom_callereqfrom_entirebalance_rs() { +fn transfer_from_caller_eq_from_entire_balance_rs() { multiversx_sc_scenario::run_rs( "scenarios/transferFrom_CallerEqFrom-EntireBalance.scen.json", world(), @@ -188,7 +193,7 @@ fn transferfrom_callereqfrom_entirebalance_rs() { } #[test] -fn transferfrom_callereqfrom_morethanbalance_rs() { +fn transfer_from_caller_eq_from_more_than_balance_rs() { multiversx_sc_scenario::run_rs( "scenarios/transferFrom_CallerEqFrom-MoreThanBalance.scen.json", world(), @@ -196,7 +201,7 @@ fn transferfrom_callereqfrom_morethanbalance_rs() { } #[test] -fn transferfrom_callereqto_balanceneqallowance_rs() { +fn transfer_from_caller_eq_to_balance_n_eq_allowance_rs() { multiversx_sc_scenario::run_rs( "scenarios/transferFrom_CallerEqTo-BalanceNEqAllowance.scen.json", world(), @@ -204,7 +209,7 @@ fn transferfrom_callereqto_balanceneqallowance_rs() { } #[test] -fn transferfrom_callereqto_morethanallowancelessthanbalance_rs() { +fn transfer_from_caller_eq_to_more_than_allowance_less_than_balance_rs() { multiversx_sc_scenario::run_rs( "scenarios/transferFrom_CallerEqTo-MoreThanAllowanceLessThanBalance.scen.json", world(), @@ -212,7 +217,7 @@ fn transferfrom_callereqto_morethanallowancelessthanbalance_rs() { } #[test] -fn transferfrom_callereqto_morethanbalancelessthanallowance_rs() { +fn transfer_from_caller_eq_to_more_than_balance_less_than_allowance_rs() { multiversx_sc_scenario::run_rs( "scenarios/transferFrom_CallerEqTo-MoreThanBalanceLessThanAllowance.scen.json", world(), @@ -220,7 +225,7 @@ fn transferfrom_callereqto_morethanbalancelessthanallowance_rs() { } #[test] -fn transferfrom_exploratory_multipletransferssucceed_rs() { +fn transfer_from_exploratory_multiple_transfers_succeed_rs() { multiversx_sc_scenario::run_rs( "scenarios/transferFrom_Exploratory-MultipleTransfersSucceed.scen.json", world(), @@ -228,7 +233,7 @@ fn transferfrom_exploratory_multipletransferssucceed_rs() { } #[test] -fn transferfrom_exploratory_multipletransfersthrow_rs() { +fn transfer_from_exploratory_multiple_transfers_throw_rs() { multiversx_sc_scenario::run_rs( "scenarios/transferFrom_Exploratory-MultipleTransfersThrow.scen.json", world(), @@ -236,7 +241,7 @@ fn transferfrom_exploratory_multipletransfersthrow_rs() { } #[test] -fn transferfrom_fromeqto_balanceeqallowance_rs() { +fn transfer_from_from_eq_to_balance_eq_allowance_rs() { multiversx_sc_scenario::run_rs( "scenarios/transferFrom_FromEqTo-BalanceEqAllowance.scen.json", world(), @@ -244,7 +249,7 @@ fn transferfrom_fromeqto_balanceeqallowance_rs() { } #[test] -fn transferfrom_fromeqto_balanceneqallowance_rs() { +fn transfer_from_from_eq_to_balance_n_eq_allowance_rs() { multiversx_sc_scenario::run_rs( "scenarios/transferFrom_FromEqTo-BalanceNEqAllowance.scen.json", world(), @@ -252,7 +257,7 @@ fn transferfrom_fromeqto_balanceneqallowance_rs() { } #[test] -fn transferfrom_fromeqto_entireallowancemorethanbalance_rs() { +fn transfer_from_from_eq_to_entire_allowance_more_than_balance_rs() { multiversx_sc_scenario::run_rs( "scenarios/transferFrom_FromEqTo-EntireAllowanceMoreThanBalance.scen.json", world(), @@ -260,7 +265,7 @@ fn transferfrom_fromeqto_entireallowancemorethanbalance_rs() { } #[test] -fn transferfrom_fromeqto_entirebalanceeqallowance_rs() { +fn transfer_from_from_eq_to_entire_balance_eq_allowance_rs() { multiversx_sc_scenario::run_rs( "scenarios/transferFrom_FromEqTo-EntireBalanceEqAllowance.scen.json", world(), @@ -268,7 +273,7 @@ fn transferfrom_fromeqto_entirebalanceeqallowance_rs() { } #[test] -fn transferfrom_fromeqto_entirebalancemorethanallowance_rs() { +fn transfer_from_from_eq_to_entire_balance_more_than_allowance_rs() { multiversx_sc_scenario::run_rs( "scenarios/transferFrom_FromEqTo-EntireBalanceMoreThanAllowance.scen.json", world(), @@ -276,7 +281,7 @@ fn transferfrom_fromeqto_entirebalancemorethanallowance_rs() { } #[test] -fn transferfrom_fromeqto_morethanallowancelessthanbalance_rs() { +fn transfer_from_from_eq_to_more_than_allowance_less_than_balance_rs() { multiversx_sc_scenario::run_rs( "scenarios/transferFrom_FromEqTo-MoreThanAllowanceLessThanBalance.scen.json", world(), @@ -284,7 +289,7 @@ fn transferfrom_fromeqto_morethanallowancelessthanbalance_rs() { } #[test] -fn transferfrom_fromeqto_morethanbalancelessthanallowance_rs() { +fn transfer_from_from_eq_to_more_than_balance_less_than_allowance_rs() { multiversx_sc_scenario::run_rs( "scenarios/transferFrom_FromEqTo-MoreThanBalanceLessThanAllowance.scen.json", world(), @@ -292,7 +297,7 @@ fn transferfrom_fromeqto_morethanbalancelessthanallowance_rs() { } #[test] -fn transferfrom_fromeqto_nooverflow_rs() { +fn transfer_from_from_eq_to_no_overflow_rs() { multiversx_sc_scenario::run_rs( "scenarios/transferFrom_FromEqTo-NoOverflow.scen.json", world(), @@ -300,7 +305,7 @@ fn transferfrom_fromeqto_nooverflow_rs() { } #[test] -fn transfer_caller_allowanceirrelevant_rs() { +fn transfer_caller_allowance_irrelevant_rs() { multiversx_sc_scenario::run_rs( "scenarios/transfer_Caller-AllowanceIrrelevant.scen.json", world(), @@ -308,12 +313,12 @@ fn transfer_caller_allowanceirrelevant_rs() { } #[test] -fn transfer_caller_entirebalance_rs() { +fn transfer_caller_entire_balance_rs() { multiversx_sc_scenario::run_rs("scenarios/transfer_Caller-EntireBalance.scen.json", world()); } #[test] -fn transfer_caller_morethanbalance_rs() { +fn transfer_caller_more_than_balance_rs() { multiversx_sc_scenario::run_rs( "scenarios/transfer_Caller-MoreThanBalance.scen.json", world(), @@ -321,7 +326,7 @@ fn transfer_caller_morethanbalance_rs() { } #[test] -fn transfer_caller_nooverflow_rs() { +fn transfer_caller_no_overflow_rs() { multiversx_sc_scenario::run_rs("scenarios/transfer_Caller-NoOverflow.scen.json", world()); } @@ -331,7 +336,7 @@ fn transfer_caller_positive_rs() { } #[test] -fn transfer_caller_stillnooverflow_rs() { +fn transfer_caller_still_no_overflow_rs() { multiversx_sc_scenario::run_rs( "scenarios/transfer_Caller-StillNoOverflow.scen.json", world(), @@ -344,7 +349,7 @@ fn transfer_caller_zero_rs() { } #[test] -fn transfer_other_allowanceirrelevant_rs() { +fn transfer_other_allowance_irrelevant_rs() { multiversx_sc_scenario::run_rs( "scenarios/transfer_Other-AllowanceIrrelevant.scen.json", world(), @@ -352,12 +357,12 @@ fn transfer_other_allowanceirrelevant_rs() { } #[test] -fn transfer_other_entirebalance_rs() { +fn transfer_other_entire_balance_rs() { multiversx_sc_scenario::run_rs("scenarios/transfer_Other-EntireBalance.scen.json", world()); } #[test] -fn transfer_other_morethanbalance_rs() { +fn transfer_other_more_than_balance_rs() { multiversx_sc_scenario::run_rs( "scenarios/transfer_Other-MoreThanBalance.scen.json", world(), @@ -365,7 +370,7 @@ fn transfer_other_morethanbalance_rs() { } #[test] -fn transfer_other_nooverflow_rs() { +fn transfer_other_no_overflow_rs() { multiversx_sc_scenario::run_rs("scenarios/transfer_Other-NoOverflow.scen.json", world()); } @@ -375,7 +380,7 @@ fn transfer_other_positive_rs() { } #[test] -fn transfer_other_stillnooverflow_rs() { +fn transfer_other_still_no_overflow_rs() { multiversx_sc_scenario::run_rs( "scenarios/transfer_Other-StillNoOverflow.scen.json", world(), diff --git a/contracts/feature-tests/erc-style-contracts/erc20/wasm/Cargo.lock b/contracts/feature-tests/erc-style-contracts/erc20/wasm/Cargo.lock index 5b2c1ffb92..b2393b8fa5 100644 --- a/contracts/feature-tests/erc-style-contracts/erc20/wasm/Cargo.lock +++ b/contracts/feature-tests/erc-style-contracts/erc20/wasm/Cargo.lock @@ -8,16 +8,16 @@ version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "once_cell", "version_check", ] [[package]] name = "arrayvec" -version = "0.7.2" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" +checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" [[package]] name = "autocfg" @@ -31,12 +31,6 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" -[[package]] -name = "cfg-if" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" - [[package]] name = "cfg-if" version = "1.0.0" @@ -85,21 +79,9 @@ version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ebdb29d2ea9ed0083cd8cece49bbd968021bd99b0849edb4a9a7ee0fdf6a4e0" -[[package]] -name = "libc" -version = "0.2.140" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99227334921fae1a979cf0bfdfcc6b3e5ce376ef57e16fb6fb3ea2ed6095f80c" - -[[package]] -name = "memory_units" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8452105ba047068f40ff7093dd1d9da90898e63dd61736462e9cdda6a90ad3c3" - [[package]] name = "multiversx-sc" -version = "0.39.7" +version = "0.41.3" dependencies = [ "bitflags", "hashbrown", @@ -111,7 +93,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.17.1" +version = "0.17.2" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -119,7 +101,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.17.1" +version = "0.17.2" dependencies = [ "hex", "proc-macro2", @@ -129,7 +111,7 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.39.7" +version = "0.41.3" dependencies = [ "hex", "proc-macro2", @@ -140,10 +122,9 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.39.7" +version = "0.41.3" dependencies = [ "multiversx-sc", - "wee_alloc", ] [[package]] @@ -166,24 +147,24 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.17.1" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" +checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" [[package]] name = "proc-macro2" -version = "1.0.52" +version = "1.0.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d0e1ae9e836cc3beddd63db0df682593d7e2d3d891ae8c9083d2113e1744224" +checksum = "dec2b086b7a862cf4de201096214fa870344cf922b2b30c167badb3af3195406" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.26" +version = "1.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4424af4bf778aae2051a77b60283332f386554255d722233d09fbfc7e30da2fc" +checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488" dependencies = [ "proc-macro2", ] @@ -217,46 +198,12 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.8" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4" +checksum = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0" [[package]] name = "version_check" version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" - -[[package]] -name = "wee_alloc" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbb3b5a6b2bb17cb6ad44a2e68a43e8d2722c997da10e928665c72ec6c0a0b8e" -dependencies = [ - "cfg-if 0.1.10", - "libc", - "memory_units", - "winapi", -] - -[[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-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" diff --git a/contracts/feature-tests/erc-style-contracts/erc20/wasm/Cargo.toml b/contracts/feature-tests/erc-style-contracts/erc20/wasm/Cargo.toml index f052b24676..679a0242c7 100644 --- a/contracts/feature-tests/erc-style-contracts/erc20/wasm/Cargo.toml +++ b/contracts/feature-tests/erc-style-contracts/erc20/wasm/Cargo.toml @@ -19,7 +19,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.39.7" +version = "0.41.3" path = "../../../../../framework/wasm-adapter" [workspace] diff --git a/contracts/feature-tests/erc-style-contracts/erc20/wasm/src/lib.rs b/contracts/feature-tests/erc-style-contracts/erc20/wasm/src/lib.rs index e6020ccc92..7445c11c37 100644 --- a/contracts/feature-tests/erc-style-contracts/erc20/wasm/src/lib.rs +++ b/contracts/feature-tests/erc-style-contracts/erc20/wasm/src/lib.rs @@ -10,7 +10,7 @@ // Total number of exported functions: 8 #![no_std] -#![feature(alloc_error_handler, lang_items)] +#![feature(lang_items)] multiversx_sc_wasm_adapter::allocator!(); multiversx_sc_wasm_adapter::panic_handler!(); diff --git a/contracts/feature-tests/erc-style-contracts/erc721/Cargo.toml b/contracts/feature-tests/erc-style-contracts/erc721/Cargo.toml index 182f80559d..1644ea3b97 100644 --- a/contracts/feature-tests/erc-style-contracts/erc721/Cargo.toml +++ b/contracts/feature-tests/erc-style-contracts/erc721/Cargo.toml @@ -10,9 +10,9 @@ path = "src/erc721.rs" [dependencies.multiversx-sc] -version = "0.39.7" +version = "0.41.3" path = "../../../../framework/base" [dev-dependencies.multiversx-sc-scenario] -version = "0.39.7" +version = "0.41.3" path = "../../../../framework/scenario" diff --git a/contracts/feature-tests/erc-style-contracts/erc721/documentation.md b/contracts/feature-tests/erc-style-contracts/erc721/documentation.md index b5f9200fa5..b85fc8e9b9 100644 --- a/contracts/feature-tests/erc-style-contracts/erc721/documentation.md +++ b/contracts/feature-tests/erc-style-contracts/erc721/documentation.md @@ -1,6 +1,6 @@ # Abstract -Non Fungible Token (NFT) implementation, using the Elrond Rust Framework. This is a very simplistic implementation where each token simply has an ID, an assigned owner, and optionally a "co-owner", also known as "approved account". +Non Fungible Token (NFT) implementation, using the MultiversX SC Framework. This is a very simplistic implementation where each token simply has an ID, an assigned owner, and optionally a "co-owner", also known as "approved account". # Deployment diff --git a/contracts/feature-tests/erc-style-contracts/erc721/meta/Cargo.toml b/contracts/feature-tests/erc-style-contracts/erc721/meta/Cargo.toml index ba559b3f66..51f93ebd2a 100644 --- a/contracts/feature-tests/erc-style-contracts/erc721/meta/Cargo.toml +++ b/contracts/feature-tests/erc-style-contracts/erc721/meta/Cargo.toml @@ -9,5 +9,5 @@ publish = false path = ".." [dependencies.multiversx-sc-meta] -version = "0.39.7" +version = "0.41.3" path = "../../../../../framework/meta" diff --git a/contracts/feature-tests/erc-style-contracts/erc721/tests/nft_scenario_go_test.rs b/contracts/feature-tests/erc-style-contracts/erc721/tests/nft_scenario_go_test.rs index 52d43d579e..a7f0a9ff63 100644 --- a/contracts/feature-tests/erc-style-contracts/erc721/tests/nft_scenario_go_test.rs +++ b/contracts/feature-tests/erc-style-contracts/erc721/tests/nft_scenario_go_test.rs @@ -24,7 +24,7 @@ fn nft_mint_more_tokens_caller_not_owner_go() { } #[test] -fn nft_mint_more_tokens_receiver_acc1_go() { +fn nft_mint_more_tokens_receiver_acc_1_go() { multiversx_sc_scenario::run_go("scenarios/nft-mint-more-tokens-receiver-acc1.scen.json"); } diff --git a/contracts/feature-tests/erc-style-contracts/erc721/tests/nft_scenario_rs_test.rs b/contracts/feature-tests/erc-style-contracts/erc721/tests/nft_scenario_rs_test.rs index 1737d4fd7f..6023925273 100644 --- a/contracts/feature-tests/erc-style-contracts/erc721/tests/nft_scenario_rs_test.rs +++ b/contracts/feature-tests/erc-style-contracts/erc721/tests/nft_scenario_rs_test.rs @@ -38,7 +38,7 @@ fn nft_mint_more_tokens_caller_not_owner_rs() { } #[test] -fn nft_mint_more_tokens_receiver_acc1_rs() { +fn nft_mint_more_tokens_receiver_acc_1_rs() { multiversx_sc_scenario::run_rs( "scenarios/nft-mint-more-tokens-receiver-acc1.scen.json", world(), diff --git a/contracts/feature-tests/erc-style-contracts/erc721/wasm/Cargo.lock b/contracts/feature-tests/erc-style-contracts/erc721/wasm/Cargo.lock index 5ad653a887..806b06027f 100644 --- a/contracts/feature-tests/erc-style-contracts/erc721/wasm/Cargo.lock +++ b/contracts/feature-tests/erc-style-contracts/erc721/wasm/Cargo.lock @@ -8,16 +8,16 @@ version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "once_cell", "version_check", ] [[package]] name = "arrayvec" -version = "0.7.2" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" +checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" [[package]] name = "autocfg" @@ -31,12 +31,6 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" -[[package]] -name = "cfg-if" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" - [[package]] name = "cfg-if" version = "1.0.0" @@ -85,21 +79,9 @@ version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ebdb29d2ea9ed0083cd8cece49bbd968021bd99b0849edb4a9a7ee0fdf6a4e0" -[[package]] -name = "libc" -version = "0.2.140" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99227334921fae1a979cf0bfdfcc6b3e5ce376ef57e16fb6fb3ea2ed6095f80c" - -[[package]] -name = "memory_units" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8452105ba047068f40ff7093dd1d9da90898e63dd61736462e9cdda6a90ad3c3" - [[package]] name = "multiversx-sc" -version = "0.39.7" +version = "0.41.3" dependencies = [ "bitflags", "hashbrown", @@ -111,7 +93,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.17.1" +version = "0.17.2" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -119,7 +101,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.17.1" +version = "0.17.2" dependencies = [ "hex", "proc-macro2", @@ -129,7 +111,7 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.39.7" +version = "0.41.3" dependencies = [ "hex", "proc-macro2", @@ -140,10 +122,9 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.39.7" +version = "0.41.3" dependencies = [ "multiversx-sc", - "wee_alloc", ] [[package]] @@ -166,24 +147,24 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.17.1" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" +checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" [[package]] name = "proc-macro2" -version = "1.0.52" +version = "1.0.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d0e1ae9e836cc3beddd63db0df682593d7e2d3d891ae8c9083d2113e1744224" +checksum = "dec2b086b7a862cf4de201096214fa870344cf922b2b30c167badb3af3195406" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.26" +version = "1.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4424af4bf778aae2051a77b60283332f386554255d722233d09fbfc7e30da2fc" +checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488" dependencies = [ "proc-macro2", ] @@ -217,46 +198,12 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.8" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4" +checksum = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0" [[package]] name = "version_check" version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" - -[[package]] -name = "wee_alloc" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbb3b5a6b2bb17cb6ad44a2e68a43e8d2722c997da10e928665c72ec6c0a0b8e" -dependencies = [ - "cfg-if 0.1.10", - "libc", - "memory_units", - "winapi", -] - -[[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-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" diff --git a/contracts/feature-tests/erc-style-contracts/erc721/wasm/Cargo.toml b/contracts/feature-tests/erc-style-contracts/erc721/wasm/Cargo.toml index 1443d56c67..c66ee0cdfa 100644 --- a/contracts/feature-tests/erc-style-contracts/erc721/wasm/Cargo.toml +++ b/contracts/feature-tests/erc-style-contracts/erc721/wasm/Cargo.toml @@ -21,5 +21,5 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.39.7" +version = "0.41.3" path = "../../../../../framework/wasm-adapter" diff --git a/contracts/feature-tests/erc-style-contracts/erc721/wasm/src/lib.rs b/contracts/feature-tests/erc-style-contracts/erc721/wasm/src/lib.rs index 0b25c1fa7d..3421a0f394 100644 --- a/contracts/feature-tests/erc-style-contracts/erc721/wasm/src/lib.rs +++ b/contracts/feature-tests/erc-style-contracts/erc721/wasm/src/lib.rs @@ -10,7 +10,7 @@ // Total number of exported functions: 10 #![no_std] -#![feature(alloc_error_handler, lang_items)] +#![feature(lang_items)] multiversx_sc_wasm_adapter::allocator!(); multiversx_sc_wasm_adapter::panic_handler!(); diff --git a/contracts/feature-tests/erc-style-contracts/lottery-erc20/Cargo.toml b/contracts/feature-tests/erc-style-contracts/lottery-erc20/Cargo.toml index 944e2ecdab..edfe336233 100644 --- a/contracts/feature-tests/erc-style-contracts/lottery-erc20/Cargo.toml +++ b/contracts/feature-tests/erc-style-contracts/lottery-erc20/Cargo.toml @@ -12,15 +12,15 @@ path = "src/lottery.rs" path = "../erc20" [dependencies.multiversx-sc] -version = "0.39.7" +version = "0.41.3" path = "../../../../framework/base" features = ["alloc"] [dependencies.multiversx-sc-wasm-adapter] -version = "0.39.7" +version = "0.41.3" path = "../../../../framework/wasm-adapter" optional = true [dev-dependencies.multiversx-sc-scenario] -version = "0.39.7" +version = "0.41.3" path = "../../../../framework/scenario" diff --git a/contracts/feature-tests/erc-style-contracts/lottery-erc20/documentation.md b/contracts/feature-tests/erc-style-contracts/lottery-erc20/documentation.md index eecb185f81..988f3a63e4 100644 --- a/contracts/feature-tests/erc-style-contracts/lottery-erc20/documentation.md +++ b/contracts/feature-tests/erc-style-contracts/lottery-erc20/documentation.md @@ -2,7 +2,7 @@ This is a lottery smart contract designed to be used with the erc20 token. -The lottery smart contract is designed to allow anyone to create their very own lottery, directly on the blockchain. Having said that, the purpose of this contract is just to have a bit of fun and show what’s possible on the current version of the Elrond blockchain. We do not endorse gambling and this should never really be used with high sums of erc20 tokens. +The lottery smart contract is designed to allow anyone to create their very own lottery, directly on the blockchain. Having said that, the purpose of this contract is just to have a bit of fun and show what’s possible on the current version of the MultiversX blockchain. We do not endorse gambling and this should never really be used with high sums of erc20 tokens. Now that that’s out of the way, there’s not much else to say in this section. It’s just a lottery! You buy tickets and hope to win. The difference between this and the traditional lottery is that you don’t pick some numbers, you just buy a ticket and at the end, one (or more) of the tickets are declared the “winning tickets”. diff --git a/contracts/feature-tests/erc-style-contracts/lottery-erc20/meta/Cargo.toml b/contracts/feature-tests/erc-style-contracts/lottery-erc20/meta/Cargo.toml index ee87339293..412ec44a3b 100644 --- a/contracts/feature-tests/erc-style-contracts/lottery-erc20/meta/Cargo.toml +++ b/contracts/feature-tests/erc-style-contracts/lottery-erc20/meta/Cargo.toml @@ -9,5 +9,5 @@ publish = false path = ".." [dependencies.multiversx-sc-meta] -version = "0.39.7" +version = "0.41.3" path = "../../../../../framework/meta" diff --git a/contracts/feature-tests/erc-style-contracts/lottery-erc20/multicontract.toml b/contracts/feature-tests/erc-style-contracts/lottery-erc20/multicontract.toml new file mode 100644 index 0000000000..e9ce66307a --- /dev/null +++ b/contracts/feature-tests/erc-style-contracts/lottery-erc20/multicontract.toml @@ -0,0 +1,7 @@ +[settings] +main = "lottery-erc20" + +# the only purpose of this config is to specify the allocator +[contracts.lottery-erc20] +add-unlabelled = true +allocator = "static64k" diff --git a/contracts/feature-tests/erc-style-contracts/lottery-erc20/src/lottery.rs b/contracts/feature-tests/erc-style-contracts/lottery-erc20/src/lottery.rs index df238e4ffb..396273e5a0 100644 --- a/contracts/feature-tests/erc-style-contracts/lottery-erc20/src/lottery.rs +++ b/contracts/feature-tests/erc-style-contracts/lottery-erc20/src/lottery.rs @@ -287,6 +287,7 @@ pub trait Lottery { } fn get_random_winning_ticket_id(&self, prev_winners: &[u32], total_tickets: u32) -> u32 { + #[allow(deprecated)] let seed = self.blockchain().get_block_random_seed_legacy(); let mut rand = Random::new(*seed); diff --git a/contracts/feature-tests/erc-style-contracts/lottery-erc20/tests/lottery_erc20_scenario_go_test.rs b/contracts/feature-tests/erc-style-contracts/lottery-erc20/tests/lottery_erc20_scenario_go_test.rs index 952fde2f31..e0ca80016c 100644 --- a/contracts/feature-tests/erc-style-contracts/lottery-erc20/tests/lottery_erc20_scenario_go_test.rs +++ b/contracts/feature-tests/erc-style-contracts/lottery-erc20/tests/lottery_erc20_scenario_go_test.rs @@ -59,7 +59,7 @@ fn buy_ticket_wrong_fee_go() { } #[test] -fn determine_winner_different_ticket_holders_winner_acc1_go() { +fn determine_winner_different_ticket_holders_winner_acc_1_go() { multiversx_sc_scenario::run_go( "scenarios/determine-winner-different-ticket-holders-winner-acc1.scen.json", ); @@ -75,8 +75,8 @@ fn determine_winner_same_ticket_holder_go() { multiversx_sc_scenario::run_go("scenarios/determine-winner-same-ticket-holder.scen.json"); } -#[ignore] #[test] +#[ignore] fn determine_winner_split_prize_pool_go() { multiversx_sc_scenario::run_go("scenarios/determine-winner-split-prize-pool.scen.json"); } diff --git a/contracts/feature-tests/erc-style-contracts/lottery-erc20/tests/lottery_erc20_scenario_rs_test.rs b/contracts/feature-tests/erc-style-contracts/lottery-erc20/tests/lottery_erc20_scenario_rs_test.rs index c552c8fcea..e9502bd944 100644 --- a/contracts/feature-tests/erc-style-contracts/lottery-erc20/tests/lottery_erc20_scenario_rs_test.rs +++ b/contracts/feature-tests/erc-style-contracts/lottery-erc20/tests/lottery_erc20_scenario_rs_test.rs @@ -83,7 +83,7 @@ fn buy_ticket_wrong_fee_rs() { } #[test] -fn determine_winner_different_ticket_holders_winner_acc1_rs() { +fn determine_winner_different_ticket_holders_winner_acc_1_rs() { multiversx_sc_scenario::run_rs( "scenarios/determine-winner-different-ticket-holders-winner-acc1.scen.json", world(), @@ -104,8 +104,8 @@ fn determine_winner_same_ticket_holder_rs() { } // TODO: un-ignore after the scenario runner supports chaining async calls -#[ignore] #[test] +#[ignore] fn determine_winner_split_prize_pool_rs() { multiversx_sc_scenario::run_rs( "scenarios/determine-winner-split-prize-pool.scen.json", diff --git a/contracts/feature-tests/erc-style-contracts/lottery-erc20/wasm/Cargo.lock b/contracts/feature-tests/erc-style-contracts/lottery-erc20/wasm/Cargo.lock index cb4bc3b30d..59d1c738b4 100644 --- a/contracts/feature-tests/erc-style-contracts/lottery-erc20/wasm/Cargo.lock +++ b/contracts/feature-tests/erc-style-contracts/lottery-erc20/wasm/Cargo.lock @@ -8,16 +8,16 @@ version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "once_cell", "version_check", ] [[package]] name = "arrayvec" -version = "0.7.2" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" +checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" [[package]] name = "autocfg" @@ -31,12 +31,6 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" -[[package]] -name = "cfg-if" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" - [[package]] name = "cfg-if" version = "1.0.0" @@ -77,12 +71,6 @@ version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ebdb29d2ea9ed0083cd8cece49bbd968021bd99b0849edb4a9a7ee0fdf6a4e0" -[[package]] -name = "libc" -version = "0.2.140" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99227334921fae1a979cf0bfdfcc6b3e5ce376ef57e16fb6fb3ea2ed6095f80c" - [[package]] name = "lottery-erc20" version = "0.0.0" @@ -99,15 +87,9 @@ dependencies = [ "multiversx-sc-wasm-adapter", ] -[[package]] -name = "memory_units" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8452105ba047068f40ff7093dd1d9da90898e63dd61736462e9cdda6a90ad3c3" - [[package]] name = "multiversx-sc" -version = "0.39.7" +version = "0.41.3" dependencies = [ "bitflags", "hashbrown", @@ -119,7 +101,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.17.1" +version = "0.17.2" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -127,7 +109,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.17.1" +version = "0.17.2" dependencies = [ "hex", "proc-macro2", @@ -137,7 +119,7 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.39.7" +version = "0.41.3" dependencies = [ "hex", "proc-macro2", @@ -148,10 +130,9 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.39.7" +version = "0.41.3" dependencies = [ "multiversx-sc", - "wee_alloc", ] [[package]] @@ -174,24 +155,24 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.17.1" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" +checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" [[package]] name = "proc-macro2" -version = "1.0.52" +version = "1.0.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d0e1ae9e836cc3beddd63db0df682593d7e2d3d891ae8c9083d2113e1744224" +checksum = "dec2b086b7a862cf4de201096214fa870344cf922b2b30c167badb3af3195406" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.26" +version = "1.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4424af4bf778aae2051a77b60283332f386554255d722233d09fbfc7e30da2fc" +checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488" dependencies = [ "proc-macro2", ] @@ -225,46 +206,12 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.8" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4" +checksum = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0" [[package]] name = "version_check" version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" - -[[package]] -name = "wee_alloc" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbb3b5a6b2bb17cb6ad44a2e68a43e8d2722c997da10e928665c72ec6c0a0b8e" -dependencies = [ - "cfg-if 0.1.10", - "libc", - "memory_units", - "winapi", -] - -[[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-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" diff --git a/contracts/feature-tests/erc-style-contracts/lottery-erc20/wasm/Cargo.toml b/contracts/feature-tests/erc-style-contracts/lottery-erc20/wasm/Cargo.toml index db26f09074..ca3a824db6 100644 --- a/contracts/feature-tests/erc-style-contracts/lottery-erc20/wasm/Cargo.toml +++ b/contracts/feature-tests/erc-style-contracts/lottery-erc20/wasm/Cargo.toml @@ -22,5 +22,5 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.39.7" +version = "0.41.3" path = "../../../../../framework/wasm-adapter" diff --git a/contracts/feature-tests/erc-style-contracts/lottery-erc20/wasm/src/lib.rs b/contracts/feature-tests/erc-style-contracts/lottery-erc20/wasm/src/lib.rs index 3016350aab..dc4ea3df80 100644 --- a/contracts/feature-tests/erc-style-contracts/lottery-erc20/wasm/src/lib.rs +++ b/contracts/feature-tests/erc-style-contracts/lottery-erc20/wasm/src/lib.rs @@ -10,9 +10,9 @@ // Total number of exported functions: 9 #![no_std] -#![feature(alloc_error_handler, lang_items)] +#![feature(lang_items)] -multiversx_sc_wasm_adapter::allocator!(); +multiversx_sc_wasm_adapter::allocator!(static64k); multiversx_sc_wasm_adapter::panic_handler!(); multiversx_sc_wasm_adapter::endpoints! { diff --git a/contracts/feature-tests/esdt-system-sc-mock/Cargo.toml b/contracts/feature-tests/esdt-system-sc-mock/Cargo.toml index 96a47aa7ef..62db41fec5 100644 --- a/contracts/feature-tests/esdt-system-sc-mock/Cargo.toml +++ b/contracts/feature-tests/esdt-system-sc-mock/Cargo.toml @@ -9,9 +9,9 @@ publish = false path = "src/esdt_system_sc_mock.rs" [dependencies.multiversx-sc] -version = "0.39.7" +version = "0.41.3" path = "../../../framework/base" [dev-dependencies.multiversx-sc-scenario] -version = "0.39.7" +version = "0.41.3" path = "../../../framework/scenario" diff --git a/contracts/feature-tests/esdt-system-sc-mock/meta/Cargo.toml b/contracts/feature-tests/esdt-system-sc-mock/meta/Cargo.toml index 62239c628e..9f0400d13a 100644 --- a/contracts/feature-tests/esdt-system-sc-mock/meta/Cargo.toml +++ b/contracts/feature-tests/esdt-system-sc-mock/meta/Cargo.toml @@ -9,5 +9,5 @@ publish = false path = ".." [dependencies.multiversx-sc-meta] -version = "0.39.7" +version = "0.41.3" path = "../../../../framework/meta" diff --git a/contracts/feature-tests/esdt-system-sc-mock/tests/esdt_system_sc_mock_scenario_go_test.rs b/contracts/feature-tests/esdt-system-sc-mock/tests/esdt_system_sc_mock_scenario_go_test.rs new file mode 100644 index 0000000000..2f31bab3b4 --- /dev/null +++ b/contracts/feature-tests/esdt-system-sc-mock/tests/esdt_system_sc_mock_scenario_go_test.rs @@ -0,0 +1,5 @@ +#[test] +#[ignore = "builtin SC not implemented"] +fn esdt_system_sc_go() { + multiversx_sc_scenario::run_go("scenarios/esdt_system_sc.scen.json"); +} diff --git a/contracts/feature-tests/esdt-system-sc-mock/tests/esdt_system_sc_mock_scenario_rs_test.rs b/contracts/feature-tests/esdt-system-sc-mock/tests/esdt_system_sc_mock_scenario_rs_test.rs new file mode 100644 index 0000000000..c486c3e00d --- /dev/null +++ b/contracts/feature-tests/esdt-system-sc-mock/tests/esdt_system_sc_mock_scenario_rs_test.rs @@ -0,0 +1,11 @@ +use multiversx_sc_scenario::*; + +fn world() -> ScenarioWorld { + todo!() +} + +#[test] +#[ignore = "builtin SC not implemented"] +fn esdt_system_sc_rs() { + multiversx_sc_scenario::run_rs("scenarios/esdt_system_sc.scen.json", world()); +} diff --git a/contracts/feature-tests/esdt-system-sc-mock/wasm/Cargo.lock b/contracts/feature-tests/esdt-system-sc-mock/wasm/Cargo.lock index ce79122376..757d4aca74 100644 --- a/contracts/feature-tests/esdt-system-sc-mock/wasm/Cargo.lock +++ b/contracts/feature-tests/esdt-system-sc-mock/wasm/Cargo.lock @@ -8,16 +8,16 @@ version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "once_cell", "version_check", ] [[package]] name = "arrayvec" -version = "0.7.2" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" +checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" [[package]] name = "autocfg" @@ -31,12 +31,6 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" -[[package]] -name = "cfg-if" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" - [[package]] name = "cfg-if" version = "1.0.0" @@ -85,21 +79,9 @@ version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ebdb29d2ea9ed0083cd8cece49bbd968021bd99b0849edb4a9a7ee0fdf6a4e0" -[[package]] -name = "libc" -version = "0.2.140" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99227334921fae1a979cf0bfdfcc6b3e5ce376ef57e16fb6fb3ea2ed6095f80c" - -[[package]] -name = "memory_units" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8452105ba047068f40ff7093dd1d9da90898e63dd61736462e9cdda6a90ad3c3" - [[package]] name = "multiversx-sc" -version = "0.39.7" +version = "0.41.3" dependencies = [ "bitflags", "hashbrown", @@ -111,7 +93,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.17.1" +version = "0.17.2" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -119,7 +101,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.17.1" +version = "0.17.2" dependencies = [ "hex", "proc-macro2", @@ -129,7 +111,7 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.39.7" +version = "0.41.3" dependencies = [ "hex", "proc-macro2", @@ -140,10 +122,9 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.39.7" +version = "0.41.3" dependencies = [ "multiversx-sc", - "wee_alloc", ] [[package]] @@ -166,24 +147,24 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.17.1" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" +checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" [[package]] name = "proc-macro2" -version = "1.0.52" +version = "1.0.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d0e1ae9e836cc3beddd63db0df682593d7e2d3d891ae8c9083d2113e1744224" +checksum = "dec2b086b7a862cf4de201096214fa870344cf922b2b30c167badb3af3195406" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.26" +version = "1.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4424af4bf778aae2051a77b60283332f386554255d722233d09fbfc7e30da2fc" +checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488" dependencies = [ "proc-macro2", ] @@ -217,46 +198,12 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.8" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4" +checksum = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0" [[package]] name = "version_check" version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" - -[[package]] -name = "wee_alloc" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbb3b5a6b2bb17cb6ad44a2e68a43e8d2722c997da10e928665c72ec6c0a0b8e" -dependencies = [ - "cfg-if 0.1.10", - "libc", - "memory_units", - "winapi", -] - -[[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-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" diff --git a/contracts/feature-tests/esdt-system-sc-mock/wasm/Cargo.toml b/contracts/feature-tests/esdt-system-sc-mock/wasm/Cargo.toml index db597948bc..f285c60cee 100644 --- a/contracts/feature-tests/esdt-system-sc-mock/wasm/Cargo.toml +++ b/contracts/feature-tests/esdt-system-sc-mock/wasm/Cargo.toml @@ -19,7 +19,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.39.7" +version = "0.41.3" path = "../../../../framework/wasm-adapter" [workspace] diff --git a/contracts/feature-tests/esdt-system-sc-mock/wasm/src/lib.rs b/contracts/feature-tests/esdt-system-sc-mock/wasm/src/lib.rs index 79bcf3f66d..eb8e3b7ffc 100644 --- a/contracts/feature-tests/esdt-system-sc-mock/wasm/src/lib.rs +++ b/contracts/feature-tests/esdt-system-sc-mock/wasm/src/lib.rs @@ -10,7 +10,7 @@ // Total number of exported functions: 8 #![no_std] -#![feature(alloc_error_handler, lang_items)] +#![feature(lang_items)] multiversx_sc_wasm_adapter::allocator!(); multiversx_sc_wasm_adapter::panic_handler!(); diff --git a/contracts/feature-tests/formatted-message-features/Cargo.toml b/contracts/feature-tests/formatted-message-features/Cargo.toml index 592ae83cc7..6a6147710f 100644 --- a/contracts/feature-tests/formatted-message-features/Cargo.toml +++ b/contracts/feature-tests/formatted-message-features/Cargo.toml @@ -9,9 +9,9 @@ publish = false path = "src/formatted_message_features.rs" [dependencies.multiversx-sc] -version = "0.39.7" +version = "0.41.3" path = "../../../framework/base" [dev-dependencies.multiversx-sc-scenario] -version = "0.39.7" +version = "0.41.3" path = "../../../framework/scenario" diff --git a/contracts/feature-tests/formatted-message-features/meta/Cargo.toml b/contracts/feature-tests/formatted-message-features/meta/Cargo.toml index ad34c09d7d..2b3ef87221 100644 --- a/contracts/feature-tests/formatted-message-features/meta/Cargo.toml +++ b/contracts/feature-tests/formatted-message-features/meta/Cargo.toml @@ -11,5 +11,5 @@ authors = [ "you",] path = ".." [dependencies.multiversx-sc-meta] -version = "0.39.7" +version = "0.41.3" path = "../../../../framework/meta" diff --git a/contracts/feature-tests/formatted-message-features/wasm/Cargo.lock b/contracts/feature-tests/formatted-message-features/wasm/Cargo.lock index 5d271441f4..82a6a1888e 100644 --- a/contracts/feature-tests/formatted-message-features/wasm/Cargo.lock +++ b/contracts/feature-tests/formatted-message-features/wasm/Cargo.lock @@ -8,16 +8,16 @@ version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "once_cell", "version_check", ] [[package]] name = "arrayvec" -version = "0.7.2" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" +checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" [[package]] name = "autocfg" @@ -31,12 +31,6 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" -[[package]] -name = "cfg-if" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" - [[package]] name = "cfg-if" version = "1.0.0" @@ -85,21 +79,9 @@ version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ebdb29d2ea9ed0083cd8cece49bbd968021bd99b0849edb4a9a7ee0fdf6a4e0" -[[package]] -name = "libc" -version = "0.2.140" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99227334921fae1a979cf0bfdfcc6b3e5ce376ef57e16fb6fb3ea2ed6095f80c" - -[[package]] -name = "memory_units" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8452105ba047068f40ff7093dd1d9da90898e63dd61736462e9cdda6a90ad3c3" - [[package]] name = "multiversx-sc" -version = "0.39.7" +version = "0.41.3" dependencies = [ "bitflags", "hashbrown", @@ -111,7 +93,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.17.1" +version = "0.17.2" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -119,7 +101,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.17.1" +version = "0.17.2" dependencies = [ "hex", "proc-macro2", @@ -129,7 +111,7 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.39.7" +version = "0.41.3" dependencies = [ "hex", "proc-macro2", @@ -140,10 +122,9 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.39.7" +version = "0.41.3" dependencies = [ "multiversx-sc", - "wee_alloc", ] [[package]] @@ -166,24 +147,24 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.17.1" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" +checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" [[package]] name = "proc-macro2" -version = "1.0.52" +version = "1.0.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d0e1ae9e836cc3beddd63db0df682593d7e2d3d891ae8c9083d2113e1744224" +checksum = "dec2b086b7a862cf4de201096214fa870344cf922b2b30c167badb3af3195406" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.26" +version = "1.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4424af4bf778aae2051a77b60283332f386554255d722233d09fbfc7e30da2fc" +checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488" dependencies = [ "proc-macro2", ] @@ -217,46 +198,12 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.8" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4" +checksum = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0" [[package]] name = "version_check" version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" - -[[package]] -name = "wee_alloc" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbb3b5a6b2bb17cb6ad44a2e68a43e8d2722c997da10e928665c72ec6c0a0b8e" -dependencies = [ - "cfg-if 0.1.10", - "libc", - "memory_units", - "winapi", -] - -[[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-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" diff --git a/contracts/feature-tests/formatted-message-features/wasm/Cargo.toml b/contracts/feature-tests/formatted-message-features/wasm/Cargo.toml index 71897ec504..21adc38180 100644 --- a/contracts/feature-tests/formatted-message-features/wasm/Cargo.toml +++ b/contracts/feature-tests/formatted-message-features/wasm/Cargo.toml @@ -24,5 +24,5 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.39.7" +version = "0.41.3" path = "../../../../framework/wasm-adapter" diff --git a/contracts/feature-tests/formatted-message-features/wasm/src/lib.rs b/contracts/feature-tests/formatted-message-features/wasm/src/lib.rs index a9acbab1b1..0d9412d4d2 100644 --- a/contracts/feature-tests/formatted-message-features/wasm/src/lib.rs +++ b/contracts/feature-tests/formatted-message-features/wasm/src/lib.rs @@ -10,7 +10,7 @@ // Total number of exported functions: 17 #![no_std] -#![feature(alloc_error_handler, lang_items)] +#![feature(lang_items)] multiversx_sc_wasm_adapter::allocator!(); multiversx_sc_wasm_adapter::panic_handler!(); diff --git a/contracts/feature-tests/legacy-examples/crypto-bubbles-legacy/Cargo.toml b/contracts/feature-tests/legacy-examples/crypto-bubbles-legacy/Cargo.toml index 04c04be2d9..5634a40aaf 100644 --- a/contracts/feature-tests/legacy-examples/crypto-bubbles-legacy/Cargo.toml +++ b/contracts/feature-tests/legacy-examples/crypto-bubbles-legacy/Cargo.toml @@ -9,10 +9,10 @@ publish = false path = "src/crypto_bubbles_legacy.rs" [dependencies.multiversx-sc] -version = "0.39.7" +version = "0.41.3" path = "../../../../framework/base" features = ["alloc"] [dev-dependencies.multiversx-sc-scenario] -version = "0.39.7" +version = "0.41.3" path = "../../../../framework/scenario" diff --git a/contracts/feature-tests/legacy-examples/crypto-bubbles-legacy/meta/Cargo.toml b/contracts/feature-tests/legacy-examples/crypto-bubbles-legacy/meta/Cargo.toml index 2b68786027..27629050a4 100644 --- a/contracts/feature-tests/legacy-examples/crypto-bubbles-legacy/meta/Cargo.toml +++ b/contracts/feature-tests/legacy-examples/crypto-bubbles-legacy/meta/Cargo.toml @@ -8,5 +8,5 @@ publish = false path = ".." [dependencies.multiversx-sc-meta] -version = "0.39.7" +version = "0.41.3" path = "../../../../../framework/meta" diff --git a/contracts/feature-tests/legacy-examples/crypto-bubbles-legacy/multicontract.toml b/contracts/feature-tests/legacy-examples/crypto-bubbles-legacy/multicontract.toml new file mode 100644 index 0000000000..bf01587813 --- /dev/null +++ b/contracts/feature-tests/legacy-examples/crypto-bubbles-legacy/multicontract.toml @@ -0,0 +1,8 @@ +[settings] +main = "crypto-bubbles-legacy" + +# the only purpose of this config is to specify the allocator +[contracts.crypto-bubbles-legacy] +add-unlabelled = true +allocator = "wee_alloc" +stack-size = "16 pages" diff --git a/contracts/feature-tests/legacy-examples/crypto-bubbles-legacy/src/crypto_bubbles_legacy.rs b/contracts/feature-tests/legacy-examples/crypto-bubbles-legacy/src/crypto_bubbles_legacy.rs index ba9c7324db..f6302d8f6f 100644 --- a/contracts/feature-tests/legacy-examples/crypto-bubbles-legacy/src/crypto_bubbles_legacy.rs +++ b/contracts/feature-tests/legacy-examples/crypto-bubbles-legacy/src/crypto_bubbles_legacy.rs @@ -1,4 +1,5 @@ #![no_std] +#![allow(deprecated)] multiversx_sc::imports!(); @@ -16,7 +17,7 @@ pub trait CryptoBubbles { let payment = self.call_value().egld_value(); let caller = self.blockchain().get_caller_legacy(); self.player_balance(&caller) - .update(|balance| *balance += &payment); + .update(|balance| *balance += &*payment); self.top_up_event(&caller, &payment); } diff --git a/contracts/feature-tests/legacy-examples/crypto-bubbles-legacy/tests/crypto_bubbles_legacy_scenario_go_test.rs b/contracts/feature-tests/legacy-examples/crypto-bubbles-legacy/tests/crypto_bubbles_legacy_scenario_go_test.rs index bd58115026..e36dc3e515 100644 --- a/contracts/feature-tests/legacy-examples/crypto-bubbles-legacy/tests/crypto_bubbles_legacy_scenario_go_test.rs +++ b/contracts/feature-tests/legacy-examples/crypto-bubbles-legacy/tests/crypto_bubbles_legacy_scenario_go_test.rs @@ -1,5 +1,5 @@ #[test] -fn balanceof_go() { +fn balance_of_go() { multiversx_sc_scenario::run_go("scenarios/balanceOf.scen.json"); } @@ -14,32 +14,32 @@ fn exceptions_go() { } #[test] -fn joingame_go() { +fn join_game_go() { multiversx_sc_scenario::run_go("scenarios/joinGame.scen.json"); } #[test] -fn rewardandsendtowallet_go() { +fn reward_and_send_to_wallet_go() { multiversx_sc_scenario::run_go("scenarios/rewardAndSendToWallet.scen.json"); } #[test] -fn rewardwinner_go() { +fn reward_winner_go() { multiversx_sc_scenario::run_go("scenarios/rewardWinner.scen.json"); } #[test] -fn rewardwinner_last_go() { +fn reward_winner_last_go() { multiversx_sc_scenario::run_go("scenarios/rewardWinner_Last.scen.json"); } #[test] -fn topup_ok_go() { +fn top_up_ok_go() { multiversx_sc_scenario::run_go("scenarios/topUp_ok.scen.json"); } #[test] -fn topup_withdraw_go() { +fn top_up_withdraw_go() { multiversx_sc_scenario::run_go("scenarios/topUp_withdraw.scen.json"); } @@ -49,6 +49,6 @@ fn withdraw_ok_go() { } #[test] -fn withdraw_toomuch_go() { +fn withdraw_too_much_go() { multiversx_sc_scenario::run_go("scenarios/withdraw_TooMuch.scen.json"); } diff --git a/contracts/feature-tests/legacy-examples/crypto-bubbles-legacy/tests/crypto_bubbles_legacy_scenario_rs_test.rs b/contracts/feature-tests/legacy-examples/crypto-bubbles-legacy/tests/crypto_bubbles_legacy_scenario_rs_test.rs index 8d9e6ed6ab..d54b238f07 100644 --- a/contracts/feature-tests/legacy-examples/crypto-bubbles-legacy/tests/crypto_bubbles_legacy_scenario_rs_test.rs +++ b/contracts/feature-tests/legacy-examples/crypto-bubbles-legacy/tests/crypto_bubbles_legacy_scenario_rs_test.rs @@ -14,7 +14,7 @@ fn world() -> ScenarioWorld { } #[test] -fn balanceof_rs() { +fn balance_of_rs() { multiversx_sc_scenario::run_rs("scenarios/balanceOf.scen.json", world()); } @@ -29,32 +29,32 @@ fn exceptions_rs() { } #[test] -fn joingame_rs() { +fn join_game_rs() { multiversx_sc_scenario::run_rs("scenarios/joinGame.scen.json", world()); } #[test] -fn rewardandsendtowallet_rs() { +fn reward_and_send_to_wallet_rs() { multiversx_sc_scenario::run_rs("scenarios/rewardAndSendToWallet.scen.json", world()); } #[test] -fn rewardwinner_rs() { +fn reward_winner_rs() { multiversx_sc_scenario::run_rs("scenarios/rewardWinner.scen.json", world()); } #[test] -fn rewardwinner_last_rs() { +fn reward_winner_last_rs() { multiversx_sc_scenario::run_rs("scenarios/rewardWinner_Last.scen.json", world()); } #[test] -fn topup_ok_rs() { +fn top_up_ok_rs() { multiversx_sc_scenario::run_rs("scenarios/topUp_ok.scen.json", world()); } #[test] -fn topup_withdraw_rs() { +fn top_up_withdraw_rs() { multiversx_sc_scenario::run_rs("scenarios/topUp_withdraw.scen.json", world()); } @@ -64,6 +64,6 @@ fn withdraw_ok_rs() { } #[test] -fn withdraw_toomuch_rs() { +fn withdraw_too_much_rs() { multiversx_sc_scenario::run_rs("scenarios/withdraw_TooMuch.scen.json", world()); } diff --git a/contracts/feature-tests/legacy-examples/crypto-bubbles-legacy/wasm/Cargo.lock b/contracts/feature-tests/legacy-examples/crypto-bubbles-legacy/wasm/Cargo.lock index 9cc527fd3e..4308b4f7a8 100644 --- a/contracts/feature-tests/legacy-examples/crypto-bubbles-legacy/wasm/Cargo.lock +++ b/contracts/feature-tests/legacy-examples/crypto-bubbles-legacy/wasm/Cargo.lock @@ -15,9 +15,9 @@ dependencies = [ [[package]] name = "arrayvec" -version = "0.7.2" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" +checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" [[package]] name = "autocfg" @@ -56,6 +56,7 @@ version = "0.0.0" dependencies = [ "crypto-bubbles-legacy", "multiversx-sc-wasm-adapter", + "wee_alloc", ] [[package]] @@ -87,9 +88,9 @@ checksum = "7ebdb29d2ea9ed0083cd8cece49bbd968021bd99b0849edb4a9a7ee0fdf6a4e0" [[package]] name = "libc" -version = "0.2.140" +version = "0.2.146" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99227334921fae1a979cf0bfdfcc6b3e5ce376ef57e16fb6fb3ea2ed6095f80c" +checksum = "f92be4933c13fd498862a9e02a3055f8a8d9c039ce33db97306fd5a6caa7f29b" [[package]] name = "memory_units" @@ -99,7 +100,7 @@ checksum = "8452105ba047068f40ff7093dd1d9da90898e63dd61736462e9cdda6a90ad3c3" [[package]] name = "multiversx-sc" -version = "0.39.7" +version = "0.41.3" dependencies = [ "bitflags", "hashbrown", @@ -111,7 +112,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.17.1" +version = "0.17.2" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -119,7 +120,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.17.1" +version = "0.17.2" dependencies = [ "hex", "proc-macro2", @@ -129,7 +130,7 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.39.7" +version = "0.41.3" dependencies = [ "hex", "proc-macro2", @@ -140,10 +141,9 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.39.7" +version = "0.41.3" dependencies = [ "multiversx-sc", - "wee_alloc", ] [[package]] @@ -166,24 +166,24 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.17.1" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" +checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" [[package]] name = "proc-macro2" -version = "1.0.52" +version = "1.0.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d0e1ae9e836cc3beddd63db0df682593d7e2d3d891ae8c9083d2113e1744224" +checksum = "dec2b086b7a862cf4de201096214fa870344cf922b2b30c167badb3af3195406" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.26" +version = "1.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4424af4bf778aae2051a77b60283332f386554255d722233d09fbfc7e30da2fc" +checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488" dependencies = [ "proc-macro2", ] @@ -217,9 +217,9 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.8" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4" +checksum = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0" [[package]] name = "version_check" diff --git a/contracts/feature-tests/legacy-examples/crypto-bubbles-legacy/wasm/Cargo.toml b/contracts/feature-tests/legacy-examples/crypto-bubbles-legacy/wasm/Cargo.toml index e760072082..3f02f15817 100644 --- a/contracts/feature-tests/legacy-examples/crypto-bubbles-legacy/wasm/Cargo.toml +++ b/contracts/feature-tests/legacy-examples/crypto-bubbles-legacy/wasm/Cargo.toml @@ -19,8 +19,11 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.39.7" +version = "0.41.3" path = "../../../../../framework/wasm-adapter" +[dependencies] +wee_alloc = "0.4" #now needs to be added explicitly in the contract wasm crate + [workspace] members = ["."] diff --git a/contracts/feature-tests/legacy-examples/crypto-bubbles-legacy/wasm/src/lib.rs b/contracts/feature-tests/legacy-examples/crypto-bubbles-legacy/wasm/src/lib.rs index c44c8ce002..b12fb5ddaf 100644 --- a/contracts/feature-tests/legacy-examples/crypto-bubbles-legacy/wasm/src/lib.rs +++ b/contracts/feature-tests/legacy-examples/crypto-bubbles-legacy/wasm/src/lib.rs @@ -10,9 +10,9 @@ // Total number of exported functions: 8 #![no_std] -#![feature(alloc_error_handler, lang_items)] +#![feature(lang_items)] -multiversx_sc_wasm_adapter::allocator!(); +multiversx_sc_wasm_adapter::allocator!(wee_alloc); multiversx_sc_wasm_adapter::panic_handler!(); multiversx_sc_wasm_adapter::endpoints! { diff --git a/contracts/feature-tests/multi-contract-features/Cargo.toml b/contracts/feature-tests/multi-contract-features/Cargo.toml index c38bf525fd..68f45d6d71 100644 --- a/contracts/feature-tests/multi-contract-features/Cargo.toml +++ b/contracts/feature-tests/multi-contract-features/Cargo.toml @@ -12,9 +12,9 @@ path = "src/multi_contract_features.rs" example_feature = [] [dependencies.multiversx-sc] -version = "0.39.7" +version = "0.41.3" path = "../../../framework/base" [dev-dependencies.multiversx-sc-scenario] -version = "0.39.7" +version = "0.41.3" path = "../../../framework/scenario" diff --git a/contracts/feature-tests/multi-contract-features/meta/Cargo.toml b/contracts/feature-tests/multi-contract-features/meta/Cargo.toml index c960c2a978..c3cd8e5e63 100644 --- a/contracts/feature-tests/multi-contract-features/meta/Cargo.toml +++ b/contracts/feature-tests/multi-contract-features/meta/Cargo.toml @@ -9,5 +9,5 @@ publish = false path = ".." [dependencies.multiversx-sc-meta] -version = "0.39.7" +version = "0.41.3" path = "../../../../framework/meta" diff --git a/contracts/feature-tests/multi-contract-features/tests/multi_contract_scenario_go_test.rs b/contracts/feature-tests/multi-contract-features/tests/multi_contract_scenario_go_test.rs index 25bd5bb2bd..b4bd413371 100644 --- a/contracts/feature-tests/multi-contract-features/tests/multi_contract_scenario_go_test.rs +++ b/contracts/feature-tests/multi-contract-features/tests/multi_contract_scenario_go_test.rs @@ -4,11 +4,11 @@ fn mcf_example_feature_go() { } #[test] -fn mcf_external_pure_go() { - multiversx_sc_scenario::run_go("scenarios/mcf-external-pure.scen.json"); +fn mcf_external_get_go() { + multiversx_sc_scenario::run_go("scenarios/mcf-external-get.scen.json"); } #[test] -fn mcf_external_get_go() { - multiversx_sc_scenario::run_go("scenarios/mcf-external-get.scen.json"); +fn mcf_external_pure_go() { + multiversx_sc_scenario::run_go("scenarios/mcf-external-pure.scen.json"); } diff --git a/contracts/feature-tests/multi-contract-features/tests/multi_contract_scenario_rs_test.rs b/contracts/feature-tests/multi-contract-features/tests/multi_contract_scenario_rs_test.rs index 1faffe468d..356e8d80e6 100644 --- a/contracts/feature-tests/multi-contract-features/tests/multi_contract_scenario_rs_test.rs +++ b/contracts/feature-tests/multi-contract-features/tests/multi_contract_scenario_rs_test.rs @@ -25,11 +25,11 @@ fn mcf_example_feature_rs() { } #[test] -fn mcf_external_pure_rs() { - multiversx_sc_scenario::run_rs("scenarios/mcf-external-pure.scen.json", world()); +fn mcf_external_get_rs() { + multiversx_sc_scenario::run_rs("scenarios/mcf-external-get.scen.json", world()); } #[test] -fn mcf_external_get_rs() { - multiversx_sc_scenario::run_rs("scenarios/mcf-external-get.scen.json", world()); +fn mcf_external_pure_rs() { + multiversx_sc_scenario::run_rs("scenarios/mcf-external-pure.scen.json", world()); } diff --git a/contracts/feature-tests/multi-contract-features/wasm-multi-contract-example-feature/Cargo.lock b/contracts/feature-tests/multi-contract-features/wasm-multi-contract-example-feature/Cargo.lock index 743b649b3a..5b8f27e6cf 100644 --- a/contracts/feature-tests/multi-contract-features/wasm-multi-contract-example-feature/Cargo.lock +++ b/contracts/feature-tests/multi-contract-features/wasm-multi-contract-example-feature/Cargo.lock @@ -8,16 +8,16 @@ version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "once_cell", "version_check", ] [[package]] name = "arrayvec" -version = "0.7.2" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" +checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" [[package]] name = "autocfg" @@ -31,12 +31,6 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" -[[package]] -name = "cfg-if" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" - [[package]] name = "cfg-if" version = "1.0.0" @@ -70,18 +64,6 @@ version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ebdb29d2ea9ed0083cd8cece49bbd968021bd99b0849edb4a9a7ee0fdf6a4e0" -[[package]] -name = "libc" -version = "0.2.140" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99227334921fae1a979cf0bfdfcc6b3e5ce376ef57e16fb6fb3ea2ed6095f80c" - -[[package]] -name = "memory_units" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8452105ba047068f40ff7093dd1d9da90898e63dd61736462e9cdda6a90ad3c3" - [[package]] name = "multi-contract-example-feature-wasm" version = "0.0.0" @@ -99,7 +81,7 @@ dependencies = [ [[package]] name = "multiversx-sc" -version = "0.39.7" +version = "0.41.3" dependencies = [ "bitflags", "hashbrown", @@ -111,7 +93,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.17.1" +version = "0.17.2" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -119,7 +101,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.17.1" +version = "0.17.2" dependencies = [ "hex", "proc-macro2", @@ -129,7 +111,7 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.39.7" +version = "0.41.3" dependencies = [ "hex", "proc-macro2", @@ -140,10 +122,9 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.39.7" +version = "0.41.3" dependencies = [ "multiversx-sc", - "wee_alloc", ] [[package]] @@ -166,24 +147,24 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.17.1" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" +checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" [[package]] name = "proc-macro2" -version = "1.0.52" +version = "1.0.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d0e1ae9e836cc3beddd63db0df682593d7e2d3d891ae8c9083d2113e1744224" +checksum = "dec2b086b7a862cf4de201096214fa870344cf922b2b30c167badb3af3195406" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.26" +version = "1.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4424af4bf778aae2051a77b60283332f386554255d722233d09fbfc7e30da2fc" +checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488" dependencies = [ "proc-macro2", ] @@ -217,46 +198,12 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.8" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4" +checksum = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0" [[package]] name = "version_check" version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" - -[[package]] -name = "wee_alloc" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbb3b5a6b2bb17cb6ad44a2e68a43e8d2722c997da10e928665c72ec6c0a0b8e" -dependencies = [ - "cfg-if 0.1.10", - "libc", - "memory_units", - "winapi", -] - -[[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-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" diff --git a/contracts/feature-tests/multi-contract-features/wasm-multi-contract-example-feature/Cargo.toml b/contracts/feature-tests/multi-contract-features/wasm-multi-contract-example-feature/Cargo.toml index 6466052a4c..64d5f612a5 100644 --- a/contracts/feature-tests/multi-contract-features/wasm-multi-contract-example-feature/Cargo.toml +++ b/contracts/feature-tests/multi-contract-features/wasm-multi-contract-example-feature/Cargo.toml @@ -18,7 +18,7 @@ path = ".." features = ["example_feature"] [dependencies.multiversx-sc-wasm-adapter] -version = "0.39.7" +version = "0.41.3" path = "../../../../framework/wasm-adapter" [workspace] diff --git a/contracts/feature-tests/multi-contract-features/wasm-multi-contract-example-feature/src/lib.rs b/contracts/feature-tests/multi-contract-features/wasm-multi-contract-example-feature/src/lib.rs index 381742b780..01dffe7d74 100644 --- a/contracts/feature-tests/multi-contract-features/wasm-multi-contract-example-feature/src/lib.rs +++ b/contracts/feature-tests/multi-contract-features/wasm-multi-contract-example-feature/src/lib.rs @@ -10,7 +10,7 @@ // Total number of exported functions: 4 #![no_std] -#![feature(alloc_error_handler, lang_items)] +#![feature(lang_items)] multiversx_sc_wasm_adapter::allocator!(); multiversx_sc_wasm_adapter::panic_handler!(); diff --git a/contracts/feature-tests/multi-contract-features/wasm-multi-contract-features-view/Cargo.lock b/contracts/feature-tests/multi-contract-features/wasm-multi-contract-features-view/Cargo.lock index c9842d7e66..2c8799f752 100644 --- a/contracts/feature-tests/multi-contract-features/wasm-multi-contract-features-view/Cargo.lock +++ b/contracts/feature-tests/multi-contract-features/wasm-multi-contract-features-view/Cargo.lock @@ -8,16 +8,16 @@ version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "once_cell", "version_check", ] [[package]] name = "arrayvec" -version = "0.7.2" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" +checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" [[package]] name = "autocfg" @@ -31,12 +31,6 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" -[[package]] -name = "cfg-if" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" - [[package]] name = "cfg-if" version = "1.0.0" @@ -70,18 +64,6 @@ version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ebdb29d2ea9ed0083cd8cece49bbd968021bd99b0849edb4a9a7ee0fdf6a4e0" -[[package]] -name = "libc" -version = "0.2.140" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99227334921fae1a979cf0bfdfcc6b3e5ce376ef57e16fb6fb3ea2ed6095f80c" - -[[package]] -name = "memory_units" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8452105ba047068f40ff7093dd1d9da90898e63dd61736462e9cdda6a90ad3c3" - [[package]] name = "multi-contract-features" version = "0.0.0" @@ -99,7 +81,7 @@ dependencies = [ [[package]] name = "multiversx-sc" -version = "0.39.7" +version = "0.41.3" dependencies = [ "bitflags", "hashbrown", @@ -111,7 +93,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.17.1" +version = "0.17.2" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -119,7 +101,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.17.1" +version = "0.17.2" dependencies = [ "hex", "proc-macro2", @@ -129,7 +111,7 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.39.7" +version = "0.41.3" dependencies = [ "hex", "proc-macro2", @@ -140,10 +122,9 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.39.7" +version = "0.41.3" dependencies = [ "multiversx-sc", - "wee_alloc", ] [[package]] @@ -166,24 +147,24 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.17.1" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" +checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" [[package]] name = "proc-macro2" -version = "1.0.52" +version = "1.0.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d0e1ae9e836cc3beddd63db0df682593d7e2d3d891ae8c9083d2113e1744224" +checksum = "dec2b086b7a862cf4de201096214fa870344cf922b2b30c167badb3af3195406" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.26" +version = "1.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4424af4bf778aae2051a77b60283332f386554255d722233d09fbfc7e30da2fc" +checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488" dependencies = [ "proc-macro2", ] @@ -217,46 +198,12 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.8" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4" +checksum = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0" [[package]] name = "version_check" version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" - -[[package]] -name = "wee_alloc" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbb3b5a6b2bb17cb6ad44a2e68a43e8d2722c997da10e928665c72ec6c0a0b8e" -dependencies = [ - "cfg-if 0.1.10", - "libc", - "memory_units", - "winapi", -] - -[[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-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" diff --git a/contracts/feature-tests/multi-contract-features/wasm-multi-contract-features-view/Cargo.toml b/contracts/feature-tests/multi-contract-features/wasm-multi-contract-features-view/Cargo.toml index 6505efce7a..fc8b19acff 100644 --- a/contracts/feature-tests/multi-contract-features/wasm-multi-contract-features-view/Cargo.toml +++ b/contracts/feature-tests/multi-contract-features/wasm-multi-contract-features-view/Cargo.toml @@ -17,7 +17,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.39.7" +version = "0.41.3" path = "../../../../framework/wasm-adapter" [workspace] diff --git a/contracts/feature-tests/multi-contract-features/wasm-multi-contract-features-view/src/lib.rs b/contracts/feature-tests/multi-contract-features/wasm-multi-contract-features-view/src/lib.rs index f2d6208833..1116d0744c 100644 --- a/contracts/feature-tests/multi-contract-features/wasm-multi-contract-features-view/src/lib.rs +++ b/contracts/feature-tests/multi-contract-features/wasm-multi-contract-features-view/src/lib.rs @@ -10,7 +10,7 @@ // Total number of exported functions: 5 #![no_std] -#![feature(alloc_error_handler, lang_items)] +#![feature(lang_items)] multiversx_sc_wasm_adapter::allocator!(); multiversx_sc_wasm_adapter::panic_handler!(); diff --git a/contracts/feature-tests/multi-contract-features/wasm/Cargo.lock b/contracts/feature-tests/multi-contract-features/wasm/Cargo.lock index 1b7898985b..d8d60333f7 100755 --- a/contracts/feature-tests/multi-contract-features/wasm/Cargo.lock +++ b/contracts/feature-tests/multi-contract-features/wasm/Cargo.lock @@ -8,16 +8,16 @@ version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "once_cell", "version_check", ] [[package]] name = "arrayvec" -version = "0.7.2" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" +checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" [[package]] name = "autocfg" @@ -31,12 +31,6 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" -[[package]] -name = "cfg-if" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" - [[package]] name = "cfg-if" version = "1.0.0" @@ -70,18 +64,6 @@ version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ebdb29d2ea9ed0083cd8cece49bbd968021bd99b0849edb4a9a7ee0fdf6a4e0" -[[package]] -name = "libc" -version = "0.2.140" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99227334921fae1a979cf0bfdfcc6b3e5ce376ef57e16fb6fb3ea2ed6095f80c" - -[[package]] -name = "memory_units" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8452105ba047068f40ff7093dd1d9da90898e63dd61736462e9cdda6a90ad3c3" - [[package]] name = "multi-contract-features" version = "0.0.0" @@ -99,7 +81,7 @@ dependencies = [ [[package]] name = "multiversx-sc" -version = "0.39.7" +version = "0.41.3" dependencies = [ "bitflags", "hashbrown", @@ -111,7 +93,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.17.1" +version = "0.17.2" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -119,7 +101,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.17.1" +version = "0.17.2" dependencies = [ "hex", "proc-macro2", @@ -129,7 +111,7 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.39.7" +version = "0.41.3" dependencies = [ "hex", "proc-macro2", @@ -140,10 +122,9 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.39.7" +version = "0.41.3" dependencies = [ "multiversx-sc", - "wee_alloc", ] [[package]] @@ -166,24 +147,24 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.17.1" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" +checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" [[package]] name = "proc-macro2" -version = "1.0.52" +version = "1.0.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d0e1ae9e836cc3beddd63db0df682593d7e2d3d891ae8c9083d2113e1744224" +checksum = "dec2b086b7a862cf4de201096214fa870344cf922b2b30c167badb3af3195406" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.26" +version = "1.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4424af4bf778aae2051a77b60283332f386554255d722233d09fbfc7e30da2fc" +checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488" dependencies = [ "proc-macro2", ] @@ -217,46 +198,12 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.8" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4" +checksum = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0" [[package]] name = "version_check" version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" - -[[package]] -name = "wee_alloc" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbb3b5a6b2bb17cb6ad44a2e68a43e8d2722c997da10e928665c72ec6c0a0b8e" -dependencies = [ - "cfg-if 0.1.10", - "libc", - "memory_units", - "winapi", -] - -[[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-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" diff --git a/contracts/feature-tests/multi-contract-features/wasm/Cargo.toml b/contracts/feature-tests/multi-contract-features/wasm/Cargo.toml index 7cc7ab7be1..3f58490c2d 100644 --- a/contracts/feature-tests/multi-contract-features/wasm/Cargo.toml +++ b/contracts/feature-tests/multi-contract-features/wasm/Cargo.toml @@ -19,7 +19,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.39.7" +version = "0.41.3" path = "../../../../framework/wasm-adapter" [workspace] diff --git a/contracts/feature-tests/multi-contract-features/wasm/src/lib.rs b/contracts/feature-tests/multi-contract-features/wasm/src/lib.rs index 381742b780..01dffe7d74 100644 --- a/contracts/feature-tests/multi-contract-features/wasm/src/lib.rs +++ b/contracts/feature-tests/multi-contract-features/wasm/src/lib.rs @@ -10,7 +10,7 @@ // Total number of exported functions: 4 #![no_std] -#![feature(alloc_error_handler, lang_items)] +#![feature(lang_items)] multiversx_sc_wasm_adapter::allocator!(); multiversx_sc_wasm_adapter::panic_handler!(); diff --git a/contracts/feature-tests/panic-message-features/Cargo.toml b/contracts/feature-tests/panic-message-features/Cargo.toml index 89316d996e..ea65bd5f2d 100644 --- a/contracts/feature-tests/panic-message-features/Cargo.toml +++ b/contracts/feature-tests/panic-message-features/Cargo.toml @@ -9,9 +9,9 @@ publish = false path = "src/panic_features.rs" [dependencies.multiversx-sc] -version = "0.39.7" +version = "0.41.3" path = "../../../framework/base" [dev-dependencies.multiversx-sc-scenario] -version = "0.39.7" +version = "0.41.3" path = "../../../framework/scenario" diff --git a/contracts/feature-tests/panic-message-features/meta/Cargo.toml b/contracts/feature-tests/panic-message-features/meta/Cargo.toml index 77b9140752..8156a2de29 100644 --- a/contracts/feature-tests/panic-message-features/meta/Cargo.toml +++ b/contracts/feature-tests/panic-message-features/meta/Cargo.toml @@ -8,5 +8,5 @@ publish = false path = ".." [dependencies.multiversx-sc-meta] -version = "0.39.7" +version = "0.41.3" path = "../../../../framework/meta" diff --git a/contracts/feature-tests/panic-message-features/scenarios/panic-message.scen.json b/contracts/feature-tests/panic-message-features/scenarios/panic-message.scen.json index 2ac1ec7bbb..321cae054a 100644 --- a/contracts/feature-tests/panic-message-features/scenarios/panic-message.scen.json +++ b/contracts/feature-tests/panic-message-features/scenarios/panic-message.scen.json @@ -23,14 +23,16 @@ "from": "address:an_account", "to": "sc:panic_features", "function": "panicWithMessage", - "arguments": [], + "arguments": [ + "123" + ], "gasLimit": "50,000,000", "gasPrice": "0" }, "expect": { "out": [], "status": "0x04", - "message": "str:panic occurred: example panic message", + "message": "str:panic occurred: example panic message 123", "logs": "*", "gas": "*", "refund": "*" diff --git a/contracts/feature-tests/panic-message-features/src/panic_features.rs b/contracts/feature-tests/panic-message-features/src/panic_features.rs index bf1eb1506b..5ce7e6fae0 100644 --- a/contracts/feature-tests/panic-message-features/src/panic_features.rs +++ b/contracts/feature-tests/panic-message-features/src/panic_features.rs @@ -11,7 +11,7 @@ pub trait PanicMessageFeatures { fn init(&self) {} #[endpoint(panicWithMessage)] - fn panic_with_message(&self) { - panic!("example panic message"); + fn panic_with_message(&self, some_value: u32) { + panic!("example panic message {some_value}"); } } diff --git a/contracts/feature-tests/panic-message-features/wasm/Cargo.lock b/contracts/feature-tests/panic-message-features/wasm/Cargo.lock index 08bd01fd50..f4cc960d08 100755 --- a/contracts/feature-tests/panic-message-features/wasm/Cargo.lock +++ b/contracts/feature-tests/panic-message-features/wasm/Cargo.lock @@ -8,16 +8,16 @@ version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "once_cell", "version_check", ] [[package]] name = "arrayvec" -version = "0.7.2" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" +checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" [[package]] name = "autocfg" @@ -31,12 +31,6 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" -[[package]] -name = "cfg-if" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" - [[package]] name = "cfg-if" version = "1.0.0" @@ -70,21 +64,9 @@ version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ebdb29d2ea9ed0083cd8cece49bbd968021bd99b0849edb4a9a7ee0fdf6a4e0" -[[package]] -name = "libc" -version = "0.2.140" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99227334921fae1a979cf0bfdfcc6b3e5ce376ef57e16fb6fb3ea2ed6095f80c" - -[[package]] -name = "memory_units" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8452105ba047068f40ff7093dd1d9da90898e63dd61736462e9cdda6a90ad3c3" - [[package]] name = "multiversx-sc" -version = "0.39.7" +version = "0.41.3" dependencies = [ "bitflags", "hashbrown", @@ -96,7 +78,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.17.1" +version = "0.17.2" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -104,7 +86,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.17.1" +version = "0.17.2" dependencies = [ "hex", "proc-macro2", @@ -114,7 +96,7 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.39.7" +version = "0.41.3" dependencies = [ "hex", "proc-macro2", @@ -125,10 +107,9 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.39.7" +version = "0.41.3" dependencies = [ "multiversx-sc", - "wee_alloc", ] [[package]] @@ -151,9 +132,9 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.17.1" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" +checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" [[package]] name = "panic-message-features" @@ -172,18 +153,18 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.52" +version = "1.0.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d0e1ae9e836cc3beddd63db0df682593d7e2d3d891ae8c9083d2113e1744224" +checksum = "dec2b086b7a862cf4de201096214fa870344cf922b2b30c167badb3af3195406" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.26" +version = "1.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4424af4bf778aae2051a77b60283332f386554255d722233d09fbfc7e30da2fc" +checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488" dependencies = [ "proc-macro2", ] @@ -217,46 +198,12 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.8" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4" +checksum = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0" [[package]] name = "version_check" version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" - -[[package]] -name = "wee_alloc" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbb3b5a6b2bb17cb6ad44a2e68a43e8d2722c997da10e928665c72ec6c0a0b8e" -dependencies = [ - "cfg-if 0.1.10", - "libc", - "memory_units", - "winapi", -] - -[[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-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" diff --git a/contracts/feature-tests/panic-message-features/wasm/Cargo.toml b/contracts/feature-tests/panic-message-features/wasm/Cargo.toml index ff87f89cee..4f39f9f28b 100644 --- a/contracts/feature-tests/panic-message-features/wasm/Cargo.toml +++ b/contracts/feature-tests/panic-message-features/wasm/Cargo.toml @@ -19,7 +19,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.39.7" +version = "0.41.3" path = "../../../../framework/wasm-adapter" [workspace] diff --git a/contracts/feature-tests/panic-message-features/wasm/src/lib.rs b/contracts/feature-tests/panic-message-features/wasm/src/lib.rs index cdcad656ca..374c753d09 100644 --- a/contracts/feature-tests/panic-message-features/wasm/src/lib.rs +++ b/contracts/feature-tests/panic-message-features/wasm/src/lib.rs @@ -10,7 +10,7 @@ // Total number of exported functions: 3 #![no_std] -#![feature(alloc_error_handler, lang_items)] +#![feature(lang_items)] multiversx_sc_wasm_adapter::allocator!(); multiversx_sc_wasm_adapter::panic_handler_with_message!(); diff --git a/contracts/feature-tests/payable-features/Cargo.toml b/contracts/feature-tests/payable-features/Cargo.toml index d802a8eebd..f485310d41 100644 --- a/contracts/feature-tests/payable-features/Cargo.toml +++ b/contracts/feature-tests/payable-features/Cargo.toml @@ -9,9 +9,9 @@ publish = false path = "src/payable_features.rs" [dependencies.multiversx-sc] -version = "0.39.7" +version = "0.41.3" path = "../../../framework/base" [dev-dependencies.multiversx-sc-scenario] -version = "0.39.7" +version = "0.41.3" path = "../../../framework/scenario" diff --git a/contracts/feature-tests/payable-features/meta/Cargo.toml b/contracts/feature-tests/payable-features/meta/Cargo.toml index 1e1f1a25c6..8ca89bf58f 100644 --- a/contracts/feature-tests/payable-features/meta/Cargo.toml +++ b/contracts/feature-tests/payable-features/meta/Cargo.toml @@ -9,5 +9,5 @@ publish = false path = ".." [dependencies.multiversx-sc-meta] -version = "0.39.7" +version = "0.41.3" path = "../../../../framework/meta" diff --git a/contracts/feature-tests/payable-features/src/payable_features.rs b/contracts/feature-tests/payable-features/src/payable_features.rs index 02d31ab679..d8296f8592 100644 --- a/contracts/feature-tests/payable-features/src/payable_features.rs +++ b/contracts/feature-tests/payable-features/src/payable_features.rs @@ -16,8 +16,8 @@ pub trait PayableFeatures { &self, ) -> MultiValue2>> { ( - self.call_value().egld_value(), - self.call_value().all_esdt_transfers(), + self.call_value().egld_value().clone_value(), + self.call_value().all_esdt_transfers().clone_value(), ) .into() } @@ -26,9 +26,9 @@ pub trait PayableFeatures { #[payable("*")] fn payment_multiple( &self, - #[payment_multi] payments: ManagedVec>, + #[payment_multi] payments: ManagedRef<'static, ManagedVec>>, ) -> ManagedVec> { - payments + payments.clone_value() } #[endpoint] @@ -81,7 +81,7 @@ pub trait PayableFeatures { &self, #[payment_token] token: EgldOrEsdtTokenIdentifier, ) -> MultiValue2 { - let payment = self.call_value().egld_value(); + let payment = self.call_value().egld_value().clone_value(); (payment, token).into() } @@ -101,7 +101,7 @@ pub trait PayableFeatures { &self, #[payment_token] token: EgldOrEsdtTokenIdentifier, ) -> MultiValue2 { - let payment = self.call_value().egld_value(); + let payment = self.call_value().egld_value().clone_value(); (payment, token).into() } @@ -110,7 +110,7 @@ pub trait PayableFeatures { fn payable_egld_4(&self) -> MultiValue2 { let payment = self.call_value().egld_value(); let token = self.call_value().egld_or_single_esdt().token_identifier; - (payment, token).into() + (payment.clone_value(), token).into() } #[endpoint] diff --git a/contracts/feature-tests/payable-features/tests/payable_scenario_go_test.rs b/contracts/feature-tests/payable-features/tests/payable_scenario_go_test.rs index 006f82230f..2587faf390 100644 --- a/contracts/feature-tests/payable-features/tests/payable_scenario_go_test.rs +++ b/contracts/feature-tests/payable-features/tests/payable_scenario_go_test.rs @@ -48,6 +48,11 @@ fn payable_multi_array_go() { multiversx_sc_scenario::run_go("scenarios/payable_multi_array.scen.json"); } +#[test] +fn payable_multiple_go() { + multiversx_sc_scenario::run_go("scenarios/payable_multiple.scen.json"); +} + #[test] fn payable_token_1_go() { multiversx_sc_scenario::run_go("scenarios/payable_token_1.scen.json"); diff --git a/contracts/feature-tests/payable-features/tests/payable_scenario_rs_test.rs b/contracts/feature-tests/payable-features/tests/payable_scenario_rs_test.rs index 6a6c23a37d..0383694283 100644 --- a/contracts/feature-tests/payable-features/tests/payable_scenario_rs_test.rs +++ b/contracts/feature-tests/payable-features/tests/payable_scenario_rs_test.rs @@ -15,11 +15,6 @@ fn call_value_check_rs() { multiversx_sc_scenario::run_rs("scenarios/call-value-check.scen.json", world()); } -#[test] -fn payable_multiple_rs() { - multiversx_sc_scenario::run_rs("scenarios/payable_multiple.scen.json", world()); -} - #[test] fn payable_any_1_rs() { multiversx_sc_scenario::run_rs("scenarios/payable_any_1.scen.json", world()); @@ -65,6 +60,11 @@ fn payable_multi_array_rs() { multiversx_sc_scenario::run_rs("scenarios/payable_multi_array.scen.json", world()); } +#[test] +fn payable_multiple_rs() { + multiversx_sc_scenario::run_rs("scenarios/payable_multiple.scen.json", world()); +} + #[test] fn payable_token_1_rs() { multiversx_sc_scenario::run_rs("scenarios/payable_token_1.scen.json", world()); diff --git a/contracts/feature-tests/payable-features/wasm/Cargo.lock b/contracts/feature-tests/payable-features/wasm/Cargo.lock index 3e8133c08d..4eeed16499 100755 --- a/contracts/feature-tests/payable-features/wasm/Cargo.lock +++ b/contracts/feature-tests/payable-features/wasm/Cargo.lock @@ -8,16 +8,16 @@ version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "once_cell", "version_check", ] [[package]] name = "arrayvec" -version = "0.7.2" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" +checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" [[package]] name = "autocfg" @@ -31,12 +31,6 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" -[[package]] -name = "cfg-if" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" - [[package]] name = "cfg-if" version = "1.0.0" @@ -70,21 +64,9 @@ version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ebdb29d2ea9ed0083cd8cece49bbd968021bd99b0849edb4a9a7ee0fdf6a4e0" -[[package]] -name = "libc" -version = "0.2.140" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99227334921fae1a979cf0bfdfcc6b3e5ce376ef57e16fb6fb3ea2ed6095f80c" - -[[package]] -name = "memory_units" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8452105ba047068f40ff7093dd1d9da90898e63dd61736462e9cdda6a90ad3c3" - [[package]] name = "multiversx-sc" -version = "0.39.7" +version = "0.41.3" dependencies = [ "bitflags", "hashbrown", @@ -96,7 +78,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.17.1" +version = "0.17.2" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -104,7 +86,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.17.1" +version = "0.17.2" dependencies = [ "hex", "proc-macro2", @@ -114,7 +96,7 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.39.7" +version = "0.41.3" dependencies = [ "hex", "proc-macro2", @@ -125,10 +107,9 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.39.7" +version = "0.41.3" dependencies = [ "multiversx-sc", - "wee_alloc", ] [[package]] @@ -151,9 +132,9 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.17.1" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" +checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" [[package]] name = "payable-features" @@ -172,18 +153,18 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.52" +version = "1.0.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d0e1ae9e836cc3beddd63db0df682593d7e2d3d891ae8c9083d2113e1744224" +checksum = "dec2b086b7a862cf4de201096214fa870344cf922b2b30c167badb3af3195406" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.26" +version = "1.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4424af4bf778aae2051a77b60283332f386554255d722233d09fbfc7e30da2fc" +checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488" dependencies = [ "proc-macro2", ] @@ -217,46 +198,12 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.8" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4" +checksum = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0" [[package]] name = "version_check" version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" - -[[package]] -name = "wee_alloc" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbb3b5a6b2bb17cb6ad44a2e68a43e8d2722c997da10e928665c72ec6c0a0b8e" -dependencies = [ - "cfg-if 0.1.10", - "libc", - "memory_units", - "winapi", -] - -[[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-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" diff --git a/contracts/feature-tests/payable-features/wasm/Cargo.toml b/contracts/feature-tests/payable-features/wasm/Cargo.toml index 511bc61986..9076f2bd37 100644 --- a/contracts/feature-tests/payable-features/wasm/Cargo.toml +++ b/contracts/feature-tests/payable-features/wasm/Cargo.toml @@ -19,7 +19,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.39.7" +version = "0.41.3" path = "../../../../framework/wasm-adapter" [workspace] diff --git a/contracts/feature-tests/payable-features/wasm/src/lib.rs b/contracts/feature-tests/payable-features/wasm/src/lib.rs index 2d0ded46b2..a33084f826 100644 --- a/contracts/feature-tests/payable-features/wasm/src/lib.rs +++ b/contracts/feature-tests/payable-features/wasm/src/lib.rs @@ -10,7 +10,7 @@ // Total number of exported functions: 17 #![no_std] -#![feature(alloc_error_handler, lang_items)] +#![feature(lang_items)] multiversx_sc_wasm_adapter::allocator!(); multiversx_sc_wasm_adapter::panic_handler!(); diff --git a/contracts/feature-tests/rust-snippets-generator-test/Cargo.toml b/contracts/feature-tests/rust-snippets-generator-test/Cargo.toml index b33694180c..1985293000 100644 --- a/contracts/feature-tests/rust-snippets-generator-test/Cargo.toml +++ b/contracts/feature-tests/rust-snippets-generator-test/Cargo.toml @@ -9,9 +9,9 @@ publish = false path = "src/lib.rs" [dependencies.multiversx-sc] -version = "0.39.7" +version = "0.41.3" path = "../../../framework/base" [dev-dependencies.multiversx-sc-scenario] -version = "0.39.7" +version = "0.41.3" path = "../../../framework/scenario" diff --git a/contracts/feature-tests/rust-snippets-generator-test/interact-rs/Cargo.toml b/contracts/feature-tests/rust-snippets-generator-test/interact-rs/Cargo.toml index adba02a903..be09083595 100644 --- a/contracts/feature-tests/rust-snippets-generator-test/interact-rs/Cargo.toml +++ b/contracts/feature-tests/rust-snippets-generator-test/interact-rs/Cargo.toml @@ -13,11 +13,11 @@ path = "src/lib.rs" path = ".." [dependencies.multiversx-sc-snippets] -version = "0.39.7" +version = "0.41.3" path = "../../../../framework/snippets" [dependencies.multiversx-sc-scenario] -version = "0.39.7" +version = "0.41.3" path = "../../../../framework/scenario" [dependencies.multiversx-chain-vm] diff --git a/contracts/feature-tests/rust-snippets-generator-test/meta/Cargo.toml b/contracts/feature-tests/rust-snippets-generator-test/meta/Cargo.toml index bbcedc93b1..363d165d02 100644 --- a/contracts/feature-tests/rust-snippets-generator-test/meta/Cargo.toml +++ b/contracts/feature-tests/rust-snippets-generator-test/meta/Cargo.toml @@ -9,5 +9,5 @@ publish = false path = ".." [dependencies.multiversx-sc-meta] -version = "0.39.7" +version = "0.41.3" path = "../../../../framework/meta" diff --git a/contracts/feature-tests/rust-snippets-generator-test/wasm/Cargo.lock b/contracts/feature-tests/rust-snippets-generator-test/wasm/Cargo.lock index 27c2b6c4d3..67822d9c70 100644 --- a/contracts/feature-tests/rust-snippets-generator-test/wasm/Cargo.lock +++ b/contracts/feature-tests/rust-snippets-generator-test/wasm/Cargo.lock @@ -8,16 +8,16 @@ version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "once_cell", "version_check", ] [[package]] name = "arrayvec" -version = "0.7.2" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" +checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" [[package]] name = "autocfg" @@ -31,12 +31,6 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" -[[package]] -name = "cfg-if" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" - [[package]] name = "cfg-if" version = "1.0.0" @@ -70,21 +64,9 @@ version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ebdb29d2ea9ed0083cd8cece49bbd968021bd99b0849edb4a9a7ee0fdf6a4e0" -[[package]] -name = "libc" -version = "0.2.140" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99227334921fae1a979cf0bfdfcc6b3e5ce376ef57e16fb6fb3ea2ed6095f80c" - -[[package]] -name = "memory_units" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8452105ba047068f40ff7093dd1d9da90898e63dd61736462e9cdda6a90ad3c3" - [[package]] name = "multiversx-sc" -version = "0.39.7" +version = "0.41.3" dependencies = [ "bitflags", "hashbrown", @@ -96,7 +78,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.17.1" +version = "0.17.2" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -104,7 +86,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.17.1" +version = "0.17.2" dependencies = [ "hex", "proc-macro2", @@ -114,7 +96,7 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.39.7" +version = "0.41.3" dependencies = [ "hex", "proc-macro2", @@ -125,10 +107,9 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.39.7" +version = "0.41.3" dependencies = [ "multiversx-sc", - "wee_alloc", ] [[package]] @@ -151,24 +132,24 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.17.1" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" +checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" [[package]] name = "proc-macro2" -version = "1.0.52" +version = "1.0.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d0e1ae9e836cc3beddd63db0df682593d7e2d3d891ae8c9083d2113e1744224" +checksum = "dec2b086b7a862cf4de201096214fa870344cf922b2b30c167badb3af3195406" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.26" +version = "1.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4424af4bf778aae2051a77b60283332f386554255d722233d09fbfc7e30da2fc" +checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488" dependencies = [ "proc-macro2", ] @@ -217,46 +198,12 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.8" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4" +checksum = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0" [[package]] name = "version_check" version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" - -[[package]] -name = "wee_alloc" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbb3b5a6b2bb17cb6ad44a2e68a43e8d2722c997da10e928665c72ec6c0a0b8e" -dependencies = [ - "cfg-if 0.1.10", - "libc", - "memory_units", - "winapi", -] - -[[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-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" diff --git a/contracts/feature-tests/rust-snippets-generator-test/wasm/Cargo.toml b/contracts/feature-tests/rust-snippets-generator-test/wasm/Cargo.toml index c7d43cfafa..3cfe55387b 100644 --- a/contracts/feature-tests/rust-snippets-generator-test/wasm/Cargo.toml +++ b/contracts/feature-tests/rust-snippets-generator-test/wasm/Cargo.toml @@ -19,7 +19,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.39.7" +version = "0.41.3" path = "../../../../framework/wasm-adapter" [workspace] diff --git a/contracts/feature-tests/rust-snippets-generator-test/wasm/src/lib.rs b/contracts/feature-tests/rust-snippets-generator-test/wasm/src/lib.rs index 91ac1eec1c..891fdd43d3 100644 --- a/contracts/feature-tests/rust-snippets-generator-test/wasm/src/lib.rs +++ b/contracts/feature-tests/rust-snippets-generator-test/wasm/src/lib.rs @@ -10,7 +10,7 @@ // Total number of exported functions: 18 #![no_std] -#![feature(alloc_error_handler, lang_items)] +#![feature(lang_items)] multiversx_sc_wasm_adapter::allocator!(); multiversx_sc_wasm_adapter::panic_handler!(); diff --git a/contracts/feature-tests/rust-testing-framework-tester/Cargo.toml b/contracts/feature-tests/rust-testing-framework-tester/Cargo.toml index 5565fabd5e..32797d184b 100644 --- a/contracts/feature-tests/rust-testing-framework-tester/Cargo.toml +++ b/contracts/feature-tests/rust-testing-framework-tester/Cargo.toml @@ -6,7 +6,7 @@ edition = "2021" publish = false [dependencies.multiversx-sc] -version = "0.39.7" +version = "0.41.3" path = "../../../framework/base" features = [ "alloc" ] @@ -17,7 +17,7 @@ path = "../../examples/adder" path = "../../feature-tests/basic-features" [dev-dependencies.multiversx-sc-scenario] -version = "0.39.7" +version = "0.41.3" path = "../../../framework/scenario" [dev-dependencies] diff --git a/contracts/feature-tests/rust-testing-framework-tester/meta/Cargo.toml b/contracts/feature-tests/rust-testing-framework-tester/meta/Cargo.toml index 4c19f60549..23adbc9ab1 100644 --- a/contracts/feature-tests/rust-testing-framework-tester/meta/Cargo.toml +++ b/contracts/feature-tests/rust-testing-framework-tester/meta/Cargo.toml @@ -8,5 +8,5 @@ publish = false path = ".." [dependencies.multiversx-sc-meta] -version = "0.39.7" +version = "0.41.3" path = "../../../../framework/meta" diff --git a/contracts/feature-tests/rust-testing-framework-tester/multicontract.toml b/contracts/feature-tests/rust-testing-framework-tester/multicontract.toml new file mode 100644 index 0000000000..a67a75068a --- /dev/null +++ b/contracts/feature-tests/rust-testing-framework-tester/multicontract.toml @@ -0,0 +1,7 @@ +[settings] +main = "rust-testing-framework-tester" + +# the only purpose of this config is to specify the allocator +[contracts.rust-testing-framework-tester] +add-unlabelled = true +allocator = "static64k" diff --git a/contracts/feature-tests/rust-testing-framework-tester/src/lib.rs b/contracts/feature-tests/rust-testing-framework-tester/src/lib.rs index d0914d848d..010f002e6a 100644 --- a/contracts/feature-tests/rust-testing-framework-tester/src/lib.rs +++ b/contracts/feature-tests/rust-testing-framework-tester/src/lib.rs @@ -37,6 +37,7 @@ pub trait RustTestingFrameworkTester: dummy_module::DummyModule { #[endpoint] fn get_caller_legacy(&self) -> Address { + #[allow(deprecated)] self.blockchain().get_caller_legacy() } @@ -55,14 +56,14 @@ pub trait RustTestingFrameworkTester: dummy_module::DummyModule { #[payable("EGLD")] #[endpoint] fn receive_egld(&self) -> BigUint { - self.call_value().egld_value() + self.call_value().egld_value().clone_value() } #[payable("EGLD")] #[endpoint] fn recieve_egld_half(&self) { let caller = self.blockchain().get_caller(); - let payment_amount = self.call_value().egld_value() / 2u32; + let payment_amount = &*self.call_value().egld_value() / 2u32; self.send().direct( &caller, &EgldOrEsdtTokenIdentifier::egld(), @@ -98,7 +99,7 @@ pub trait RustTestingFrameworkTester: dummy_module::DummyModule { #[payable("*")] #[endpoint] fn receive_multi_esdt(&self) -> ManagedVec> { - self.call_value().all_esdt_transfers() + self.call_value().all_esdt_transfers().clone_value() } #[payable("*")] diff --git a/contracts/feature-tests/rust-testing-framework-tester/tests/rust_mandos_v1_test.rs b/contracts/feature-tests/rust-testing-framework-tester/tests/rust_mandos_v1_test.rs index f7cdee8ea6..09f749ad86 100644 --- a/contracts/feature-tests/rust-testing-framework-tester/tests/rust_mandos_v1_test.rs +++ b/contracts/feature-tests/rust-testing-framework-tester/tests/rust_mandos_v1_test.rs @@ -1416,20 +1416,7 @@ fn test_back_and_forth_transfers() { wrapper .execute_esdt_multi_transfer(&user, &forwarder_wrapper, &transfers, |sc| { - let mut managed_payments = ManagedVec::new(); - managed_payments.push(EsdtTokenPayment::new( - managed_token_id!(&first_token_id[..]), - 0, - managed_biguint!(first_token_amount.to_u64().unwrap()), - )); - managed_payments.push(EsdtTokenPayment::new( - managed_token_id!(&second_token_id[..]), - 0, - managed_biguint!(second_token_amount.to_u64().unwrap()), - )); - sc.forward_sync_retrieve_funds_with_accept_func( - managed_payments, managed_address!(vault_wrapper.address_ref()), managed_token_id!(&third_token_id[..]), managed_biguint!(third_token_amount.to_u64().unwrap()), diff --git a/contracts/feature-tests/rust-testing-framework-tester/tests/rust_testing_framework_tester_scenario_go_test.rs b/contracts/feature-tests/rust-testing-framework-tester/tests/rust_testing_framework_tester_scenario_go_test.rs new file mode 100644 index 0000000000..6f9766a7bb --- /dev/null +++ b/contracts/feature-tests/rust-testing-framework-tester/tests/rust_testing_framework_tester_scenario_go_test.rs @@ -0,0 +1,20 @@ +#[test] +fn test_go() { + multiversx_sc_scenario::run_go("scenarios/test.scen.json"); +} + +#[test] +fn test_esdt_generation_go() { + multiversx_sc_scenario::run_go("scenarios/test_esdt_generation.scen.json"); +} + +#[test] +fn test_multiple_sc_go() { + multiversx_sc_scenario::run_go("scenarios/test_multiple_sc.scen.json"); +} + +#[test] +#[ignore = "not supported"] +fn trace_deploy_go() { + multiversx_sc_scenario::run_go("scenarios/trace-deploy.scen.json"); +} diff --git a/contracts/feature-tests/rust-testing-framework-tester/tests/rust_testing_framework_tester_scenario_rs_test.rs b/contracts/feature-tests/rust-testing-framework-tester/tests/rust_testing_framework_tester_scenario_rs_test.rs new file mode 100644 index 0000000000..2c460439ed --- /dev/null +++ b/contracts/feature-tests/rust-testing-framework-tester/tests/rust_testing_framework_tester_scenario_rs_test.rs @@ -0,0 +1,34 @@ +use multiversx_sc_scenario::*; + +fn world() -> ScenarioWorld { + let mut blockchain = ScenarioWorld::new(); + blockchain + .set_current_dir_from_workspace("contracts/feature-tests/rust-testing-framework-tester"); + + blockchain.register_contract( + "file:output/rust-testing-framework-tester.wasm", + rust_testing_framework_tester::ContractBuilder, + ); + blockchain +} + +#[test] +fn test_rs() { + multiversx_sc_scenario::run_rs("scenarios/test.scen.json", world()); +} + +#[test] +fn test_esdt_generation_rs() { + multiversx_sc_scenario::run_rs("scenarios/test_esdt_generation.scen.json", world()); +} + +#[test] +fn test_multiple_sc_rs() { + multiversx_sc_scenario::run_rs("scenarios/test_multiple_sc.scen.json", world()); +} + +#[test] +#[ignore = "not supported"] +fn trace_deploy_rs() { + multiversx_sc_scenario::run_rs("scenarios/trace-deploy.scen.json", world()); +} diff --git a/contracts/feature-tests/rust-testing-framework-tester/wasm/Cargo.lock b/contracts/feature-tests/rust-testing-framework-tester/wasm/Cargo.lock index f22536e2da..80ff1e0c45 100644 --- a/contracts/feature-tests/rust-testing-framework-tester/wasm/Cargo.lock +++ b/contracts/feature-tests/rust-testing-framework-tester/wasm/Cargo.lock @@ -8,16 +8,16 @@ version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "once_cell", "version_check", ] [[package]] name = "arrayvec" -version = "0.7.2" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" +checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" [[package]] name = "autocfg" @@ -31,12 +31,6 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" -[[package]] -name = "cfg-if" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" - [[package]] name = "cfg-if" version = "1.0.0" @@ -70,21 +64,9 @@ version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ebdb29d2ea9ed0083cd8cece49bbd968021bd99b0849edb4a9a7ee0fdf6a4e0" -[[package]] -name = "libc" -version = "0.2.140" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99227334921fae1a979cf0bfdfcc6b3e5ce376ef57e16fb6fb3ea2ed6095f80c" - -[[package]] -name = "memory_units" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8452105ba047068f40ff7093dd1d9da90898e63dd61736462e9cdda6a90ad3c3" - [[package]] name = "multiversx-sc" -version = "0.39.7" +version = "0.41.3" dependencies = [ "bitflags", "hashbrown", @@ -96,7 +78,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.17.1" +version = "0.17.2" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -104,7 +86,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.17.1" +version = "0.17.2" dependencies = [ "hex", "proc-macro2", @@ -114,7 +96,7 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.39.7" +version = "0.41.3" dependencies = [ "hex", "proc-macro2", @@ -125,10 +107,9 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.39.7" +version = "0.41.3" dependencies = [ "multiversx-sc", - "wee_alloc", ] [[package]] @@ -151,24 +132,24 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.17.1" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" +checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" [[package]] name = "proc-macro2" -version = "1.0.52" +version = "1.0.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d0e1ae9e836cc3beddd63db0df682593d7e2d3d891ae8c9083d2113e1744224" +checksum = "dec2b086b7a862cf4de201096214fa870344cf922b2b30c167badb3af3195406" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.26" +version = "1.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4424af4bf778aae2051a77b60283332f386554255d722233d09fbfc7e30da2fc" +checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488" dependencies = [ "proc-macro2", ] @@ -217,46 +198,12 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.8" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4" +checksum = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0" [[package]] name = "version_check" version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" - -[[package]] -name = "wee_alloc" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbb3b5a6b2bb17cb6ad44a2e68a43e8d2722c997da10e928665c72ec6c0a0b8e" -dependencies = [ - "cfg-if 0.1.10", - "libc", - "memory_units", - "winapi", -] - -[[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-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" diff --git a/contracts/feature-tests/rust-testing-framework-tester/wasm/Cargo.toml b/contracts/feature-tests/rust-testing-framework-tester/wasm/Cargo.toml index 12e6da87a8..fa7346bae6 100644 --- a/contracts/feature-tests/rust-testing-framework-tester/wasm/Cargo.toml +++ b/contracts/feature-tests/rust-testing-framework-tester/wasm/Cargo.toml @@ -19,7 +19,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.39.7" +version = "0.41.3" path = "../../../../framework/wasm-adapter" [workspace] diff --git a/contracts/feature-tests/rust-testing-framework-tester/wasm/src/lib.rs b/contracts/feature-tests/rust-testing-framework-tester/wasm/src/lib.rs index 5ee1b0d3ee..6da201c2d2 100644 --- a/contracts/feature-tests/rust-testing-framework-tester/wasm/src/lib.rs +++ b/contracts/feature-tests/rust-testing-framework-tester/wasm/src/lib.rs @@ -10,9 +10,9 @@ // Total number of exported functions: 28 #![no_std] -#![feature(alloc_error_handler, lang_items)] +#![feature(lang_items)] -multiversx_sc_wasm_adapter::allocator!(); +multiversx_sc_wasm_adapter::allocator!(static64k); multiversx_sc_wasm_adapter::panic_handler!(); multiversx_sc_wasm_adapter::endpoints! { diff --git a/contracts/feature-tests/use-module/Cargo.toml b/contracts/feature-tests/use-module/Cargo.toml index 5dc9e37a8e..4aaeced697 100644 --- a/contracts/feature-tests/use-module/Cargo.toml +++ b/contracts/feature-tests/use-module/Cargo.toml @@ -9,18 +9,17 @@ publish = false path = "src/use_module.rs" [dependencies.multiversx-sc-modules] -version = "0.39.7" +version = "0.41.3" path = "../../../contracts/modules" [dependencies.multiversx-sc] -version = "0.39.7" +version = "0.41.3" path = "../../../framework/base" -features = [ "alloc" ] [dev-dependencies.multiversx-sc-scenario] -version = "0.39.7" +version = "0.41.3" path = "../../../framework/scenario" [dev-dependencies.multiversx-sc-meta] -version = "0.39.7" +version = "0.41.3" path = "../../../framework/meta" diff --git a/contracts/feature-tests/use-module/meta/Cargo.toml b/contracts/feature-tests/use-module/meta/Cargo.toml index 63f10e82ab..b2f9e47937 100644 --- a/contracts/feature-tests/use-module/meta/Cargo.toml +++ b/contracts/feature-tests/use-module/meta/Cargo.toml @@ -9,5 +9,5 @@ publish = false path = ".." [dependencies.multiversx-sc-meta] -version = "0.39.7" +version = "0.41.3" path = "../../../../framework/meta" diff --git a/contracts/feature-tests/use-module/meta/abi/Cargo.toml b/contracts/feature-tests/use-module/meta/abi/Cargo.toml index deb5d1531c..684311aaef 100644 --- a/contracts/feature-tests/use-module/meta/abi/Cargo.toml +++ b/contracts/feature-tests/use-module/meta/abi/Cargo.toml @@ -9,9 +9,9 @@ publish = false path = ".." [dependencies.multiversx-sc] -version = "0.39.7" +version = "0.41.3" path = "../../../../framework/base" [dependencies.multiversx-sc-meta] -version = "0.39.7" +version = "0.41.3" path = "../../../../framework/meta" diff --git a/contracts/feature-tests/use-module/src/token_merge_mod_impl.rs b/contracts/feature-tests/use-module/src/token_merge_mod_impl.rs index d0e150cc4d..617cce5ad6 100644 --- a/contracts/feature-tests/use-module/src/token_merge_mod_impl.rs +++ b/contracts/feature-tests/use-module/src/token_merge_mod_impl.rs @@ -28,7 +28,7 @@ pub trait TokenMergeModImpl: fn merge_tokens_endpoint(&self) -> EsdtTokenPayment { let payments = self.call_value().all_esdt_transfers(); let attributes_creator = DefaultMergedAttributesWrapper::new(); - self.merge_tokens(payments, &attributes_creator) + self.merge_tokens(&*payments, &attributes_creator) } #[payable("*")] @@ -36,14 +36,14 @@ pub trait TokenMergeModImpl: fn merge_tokens_custom_attributes_endpoint(&self) -> EsdtTokenPayment { let payments = self.call_value().all_esdt_transfers(); let attributes_creator = CustomMergedAttributesWrapper::new(); - self.merge_tokens(payments, &attributes_creator) + self.merge_tokens(&*payments, &attributes_creator) } #[payable("*")] #[endpoint(splitTokens)] fn split_tokens_endpoint(&self) -> ManagedVec { let payments = self.call_value().all_esdt_transfers(); - self.split_tokens(payments) + self.split_tokens(&*payments) } #[payable("*")] diff --git a/contracts/feature-tests/use-module/tests/use_module_scenario_go_test.rs b/contracts/feature-tests/use-module/tests/use_module_scenario_go_test.rs index 63a04471dd..cef8374079 100644 --- a/contracts/feature-tests/use-module/tests/use_module_scenario_go_test.rs +++ b/contracts/feature-tests/use-module/tests/use_module_scenario_go_test.rs @@ -19,8 +19,13 @@ fn use_module_internal_go() { } #[test] -fn use_module_only_owner_go() { - multiversx_sc_scenario::run_go("scenarios/use_module_only_owner.scen.json"); +fn use_module_no_endpoint_go() { + multiversx_sc_scenario::run_go("scenarios/use_module_no_endpoint.scen.json"); +} + +#[test] +fn use_module_ongoing_operation_example_go() { + multiversx_sc_scenario::run_go("scenarios/use_module_ongoing_operation_example.scen.json"); } #[test] @@ -29,16 +34,11 @@ fn use_module_only_admin_go() { } #[test] -fn use_module_no_endpoint_go() { - multiversx_sc_scenario::run_go("scenarios/use_module_no_endpoint.scen.json"); +fn use_module_only_owner_go() { + multiversx_sc_scenario::run_go("scenarios/use_module_only_owner.scen.json"); } #[test] fn use_module_pause_go() { multiversx_sc_scenario::run_go("scenarios/use_module_pause.scen.json"); } - -#[test] -fn use_module_ongoing_operation_go() { - multiversx_sc_scenario::run_go("scenarios/use_module_ongoing_operation_example.scen.json"); -} diff --git a/contracts/feature-tests/use-module/tests/use_module_scenario_rs_test.rs b/contracts/feature-tests/use-module/tests/use_module_scenario_rs_test.rs index 1909edca99..ee5afadb5e 100644 --- a/contracts/feature-tests/use-module/tests/use_module_scenario_rs_test.rs +++ b/contracts/feature-tests/use-module/tests/use_module_scenario_rs_test.rs @@ -67,8 +67,18 @@ fn use_module_internal_rs() { } #[test] -fn use_module_only_owner_rs() { - multiversx_sc_scenario::run_rs("scenarios/use_module_only_owner.scen.json", world()); +fn use_module_no_endpoint_rs() { + multiversx_sc_scenario::run_rs("scenarios/use_module_no_endpoint.scen.json", world()); +} + +/// Will not work in scenarios-rs, since there is no gas usage +#[test] +#[ignore] +fn use_module_ongoing_operation_example_rs() { + multiversx_sc_scenario::run_rs( + "scenarios/use_module_ongoing_operation_example.scen.json", + world(), + ); } #[test] @@ -77,21 +87,11 @@ fn use_module_only_admin_rs() { } #[test] -fn use_module_no_endpoint_rs() { - multiversx_sc_scenario::run_rs("scenarios/use_module_no_endpoint.scen.json", world()); +fn use_module_only_owner_rs() { + multiversx_sc_scenario::run_rs("scenarios/use_module_only_owner.scen.json", world()); } #[test] fn use_module_pause_rs() { multiversx_sc_scenario::run_rs("scenarios/use_module_pause.scen.json", world()); } - -/// Will not work in scenarios-rs, since there is no gas usage -#[test] -#[ignore] -fn use_module_ongoing_operation_rs() { - multiversx_sc_scenario::run_rs( - "scenarios/use_module_ongoing_operation_example.scen.json", - world(), - ); -} diff --git a/contracts/feature-tests/use-module/use_module_expected_main.abi.json b/contracts/feature-tests/use-module/use_module_expected_main.abi.json index 20c06cef15..d7cdbb7743 100644 --- a/contracts/feature-tests/use-module/use_module_expected_main.abi.json +++ b/contracts/feature-tests/use-module/use_module_expected_main.abi.json @@ -14,7 +14,7 @@ }, "framework": { "name": "multiversx-sc", - "version": "0.39.7" + "version": "0.41.3" } }, "docs": [ @@ -1123,6 +1123,23 @@ } ] }, + "OperationCompletionStatus": { + "type": "explicit-enum", + "variants": [ + { + "docs": [ + "indicates that operation was completed" + ], + "name": "completed" + }, + { + "docs": [ + "indicates that operation was interrupted prematurely, due to low gas" + ], + "name": "interrupted" + } + ] + }, "ProposalFees": { "type": "struct", "fields": [ diff --git a/contracts/feature-tests/use-module/use_module_expected_view.abi.json b/contracts/feature-tests/use-module/use_module_expected_view.abi.json index 60c716c03a..31b7239973 100644 --- a/contracts/feature-tests/use-module/use_module_expected_view.abi.json +++ b/contracts/feature-tests/use-module/use_module_expected_view.abi.json @@ -14,7 +14,7 @@ }, "framework": { "name": "multiversx-sc", - "version": "0.39.7" + "version": "0.41.3" } }, "docs": [ @@ -378,6 +378,23 @@ } ] }, + "OperationCompletionStatus": { + "type": "explicit-enum", + "variants": [ + { + "docs": [ + "indicates that operation was completed" + ], + "name": "completed" + }, + { + "docs": [ + "indicates that operation was interrupted prematurely, due to low gas" + ], + "name": "interrupted" + } + ] + }, "ProposalFees": { "type": "struct", "fields": [ diff --git a/contracts/feature-tests/use-module/wasm-use-module-view/Cargo.lock b/contracts/feature-tests/use-module/wasm-use-module-view/Cargo.lock index 960b6d4f73..f141f96099 100644 --- a/contracts/feature-tests/use-module/wasm-use-module-view/Cargo.lock +++ b/contracts/feature-tests/use-module/wasm-use-module-view/Cargo.lock @@ -8,16 +8,16 @@ version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "once_cell", "version_check", ] [[package]] name = "arrayvec" -version = "0.7.2" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" +checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" [[package]] name = "autocfg" @@ -31,12 +31,6 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" -[[package]] -name = "cfg-if" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" - [[package]] name = "cfg-if" version = "1.0.0" @@ -70,21 +64,9 @@ version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ebdb29d2ea9ed0083cd8cece49bbd968021bd99b0849edb4a9a7ee0fdf6a4e0" -[[package]] -name = "libc" -version = "0.2.140" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99227334921fae1a979cf0bfdfcc6b3e5ce376ef57e16fb6fb3ea2ed6095f80c" - -[[package]] -name = "memory_units" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8452105ba047068f40ff7093dd1d9da90898e63dd61736462e9cdda6a90ad3c3" - [[package]] name = "multiversx-sc" -version = "0.39.7" +version = "0.41.3" dependencies = [ "bitflags", "hashbrown", @@ -96,7 +78,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.17.1" +version = "0.17.2" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -104,7 +86,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.17.1" +version = "0.17.2" dependencies = [ "hex", "proc-macro2", @@ -114,7 +96,7 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.39.7" +version = "0.41.3" dependencies = [ "hex", "proc-macro2", @@ -125,17 +107,16 @@ dependencies = [ [[package]] name = "multiversx-sc-modules" -version = "0.39.7" +version = "0.41.3" dependencies = [ "multiversx-sc", ] [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.39.7" +version = "0.41.3" dependencies = [ "multiversx-sc", - "wee_alloc", ] [[package]] @@ -158,24 +139,24 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.17.1" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" +checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" [[package]] name = "proc-macro2" -version = "1.0.52" +version = "1.0.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d0e1ae9e836cc3beddd63db0df682593d7e2d3d891ae8c9083d2113e1744224" +checksum = "dec2b086b7a862cf4de201096214fa870344cf922b2b30c167badb3af3195406" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.26" +version = "1.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4424af4bf778aae2051a77b60283332f386554255d722233d09fbfc7e30da2fc" +checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488" dependencies = [ "proc-macro2", ] @@ -209,9 +190,9 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.8" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4" +checksum = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0" [[package]] name = "use-module" @@ -234,37 +215,3 @@ name = "version_check" version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" - -[[package]] -name = "wee_alloc" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbb3b5a6b2bb17cb6ad44a2e68a43e8d2722c997da10e928665c72ec6c0a0b8e" -dependencies = [ - "cfg-if 0.1.10", - "libc", - "memory_units", - "winapi", -] - -[[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-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" diff --git a/contracts/feature-tests/use-module/wasm-use-module-view/Cargo.toml b/contracts/feature-tests/use-module/wasm-use-module-view/Cargo.toml index 31de4fb138..0926cf2be5 100644 --- a/contracts/feature-tests/use-module/wasm-use-module-view/Cargo.toml +++ b/contracts/feature-tests/use-module/wasm-use-module-view/Cargo.toml @@ -17,7 +17,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.39.7" +version = "0.41.3" path = "../../../../framework/wasm-adapter" [workspace] diff --git a/contracts/feature-tests/use-module/wasm-use-module-view/src/lib.rs b/contracts/feature-tests/use-module/wasm-use-module-view/src/lib.rs index f9a74a74e9..6b29aa4ef1 100644 --- a/contracts/feature-tests/use-module/wasm-use-module-view/src/lib.rs +++ b/contracts/feature-tests/use-module/wasm-use-module-view/src/lib.rs @@ -10,7 +10,7 @@ // Total number of exported functions: 4 #![no_std] -#![feature(alloc_error_handler, lang_items)] +#![feature(lang_items)] multiversx_sc_wasm_adapter::allocator!(); multiversx_sc_wasm_adapter::panic_handler!(); diff --git a/contracts/feature-tests/use-module/wasm/Cargo.lock b/contracts/feature-tests/use-module/wasm/Cargo.lock index 5def36753c..02f8afb753 100644 --- a/contracts/feature-tests/use-module/wasm/Cargo.lock +++ b/contracts/feature-tests/use-module/wasm/Cargo.lock @@ -8,16 +8,16 @@ version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "once_cell", "version_check", ] [[package]] name = "arrayvec" -version = "0.7.2" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" +checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" [[package]] name = "autocfg" @@ -31,12 +31,6 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" -[[package]] -name = "cfg-if" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" - [[package]] name = "cfg-if" version = "1.0.0" @@ -70,21 +64,9 @@ version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ebdb29d2ea9ed0083cd8cece49bbd968021bd99b0849edb4a9a7ee0fdf6a4e0" -[[package]] -name = "libc" -version = "0.2.140" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99227334921fae1a979cf0bfdfcc6b3e5ce376ef57e16fb6fb3ea2ed6095f80c" - -[[package]] -name = "memory_units" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8452105ba047068f40ff7093dd1d9da90898e63dd61736462e9cdda6a90ad3c3" - [[package]] name = "multiversx-sc" -version = "0.39.7" +version = "0.41.3" dependencies = [ "bitflags", "hashbrown", @@ -96,7 +78,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.17.1" +version = "0.17.2" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -104,7 +86,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.17.1" +version = "0.17.2" dependencies = [ "hex", "proc-macro2", @@ -114,7 +96,7 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.39.7" +version = "0.41.3" dependencies = [ "hex", "proc-macro2", @@ -125,17 +107,16 @@ dependencies = [ [[package]] name = "multiversx-sc-modules" -version = "0.39.7" +version = "0.41.3" dependencies = [ "multiversx-sc", ] [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.39.7" +version = "0.41.3" dependencies = [ "multiversx-sc", - "wee_alloc", ] [[package]] @@ -158,24 +139,24 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.17.1" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" +checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" [[package]] name = "proc-macro2" -version = "1.0.52" +version = "1.0.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d0e1ae9e836cc3beddd63db0df682593d7e2d3d891ae8c9083d2113e1744224" +checksum = "dec2b086b7a862cf4de201096214fa870344cf922b2b30c167badb3af3195406" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.26" +version = "1.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4424af4bf778aae2051a77b60283332f386554255d722233d09fbfc7e30da2fc" +checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488" dependencies = [ "proc-macro2", ] @@ -209,9 +190,9 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.8" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4" +checksum = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0" [[package]] name = "use-module" @@ -234,37 +215,3 @@ name = "version_check" version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" - -[[package]] -name = "wee_alloc" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbb3b5a6b2bb17cb6ad44a2e68a43e8d2722c997da10e928665c72ec6c0a0b8e" -dependencies = [ - "cfg-if 0.1.10", - "libc", - "memory_units", - "winapi", -] - -[[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-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" diff --git a/contracts/feature-tests/use-module/wasm/Cargo.toml b/contracts/feature-tests/use-module/wasm/Cargo.toml index 5d6ab5d1d7..3f27b332d7 100644 --- a/contracts/feature-tests/use-module/wasm/Cargo.toml +++ b/contracts/feature-tests/use-module/wasm/Cargo.toml @@ -19,7 +19,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.39.7" +version = "0.41.3" path = "../../../../framework/wasm-adapter" [workspace] diff --git a/contracts/feature-tests/use-module/wasm/src/lib.rs b/contracts/feature-tests/use-module/wasm/src/lib.rs index 14001ed3c0..795e252989 100644 --- a/contracts/feature-tests/use-module/wasm/src/lib.rs +++ b/contracts/feature-tests/use-module/wasm/src/lib.rs @@ -10,7 +10,7 @@ // Total number of exported functions: 64 #![no_std] -#![feature(alloc_error_handler, lang_items)] +#![feature(lang_items)] multiversx_sc_wasm_adapter::allocator!(); multiversx_sc_wasm_adapter::panic_handler!(); diff --git a/contracts/modules/Cargo.toml b/contracts/modules/Cargo.toml index a982616153..8733caf4f5 100644 --- a/contracts/modules/Cargo.toml +++ b/contracts/modules/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "multiversx-sc-modules" -version = "0.39.7" +version = "0.41.3" edition = "2021" authors = ["MultiversX "] @@ -9,7 +9,7 @@ readme = "README.md" repository = "https://github.com/multiversx/mx-sdk-rs" homepage = "https://multiversx.com/" documentation = "https://docs.multiversx.com/" -description = "Elrond WebAssembly standard smart contract modules" +description = "MultiversX WebAssembly standard smart contract modules" keywords = ["multiversx", "wasm", "webassembly", "blockchain", "contract"] categories = ["no-std", "wasm", "cryptography::cryptocurrencies"] @@ -17,5 +17,5 @@ categories = ["no-std", "wasm", "cryptography::cryptocurrencies"] alloc = ["multiversx-sc/alloc"] [dependencies.multiversx-sc] -version = "0.39.7" +version = "0.41.3" path = "../../framework/base" diff --git a/contracts/modules/README.md b/contracts/modules/README.md index ff27629ba0..5c450203ca 100644 --- a/contracts/modules/README.md +++ b/contracts/modules/README.md @@ -1,7 +1,7 @@ -# Standard modules for Elrond smart contracts +# Standard modules for MultiversX smart contracts [![Crates.io](https://img.shields.io/crates/v/multiversx-sc-modules)](https://crates.io/crates/multiversx-sc-modules) -This crate contains several smart contract modules developed by the Elrond team, which can be used to add standard functionality to any smart contract. +This crate contains several smart contract modules developed by the MultiversX team, which can be used to add standard functionality to any smart contract. It is enough to add the module traits as supertraits of the contract traits to receive all endpoints and all functionality from the modules in contracts. diff --git a/contracts/modules/src/default_issue_callbacks.rs b/contracts/modules/src/default_issue_callbacks.rs index e8f161cf66..7c0d096b2e 100644 --- a/contracts/modules/src/default_issue_callbacks.rs +++ b/contracts/modules/src/default_issue_callbacks.rs @@ -1,4 +1,7 @@ +use multiversx_sc::{storage::StorageKey, storage_clear, storage_set}; + multiversx_sc::imports!(); +multiversx_sc::derive_imports!(); // Always keep in sync with the token-related storage mappers. Only modify if really necessary. #[multiversx_sc::module] @@ -10,14 +13,14 @@ pub trait DefaultIssueCallbacksModule { storage_key: ManagedBuffer, #[call_result] result: ManagedAsyncCallResult, ) { + let key = StorageKey::from(storage_key); match result { ManagedAsyncCallResult::Ok(token_id) => { - let mapper = - SingleValueMapper::::new(storage_key.into()); - mapper.set(&token_id); + storage_set(key.as_ref(), &TokenMapperState::Token(token_id)); }, ManagedAsyncCallResult::Err(_) => { self.return_failed_issue_funds(initial_caller); + storage_clear(key.as_ref()); }, } } @@ -29,22 +32,22 @@ pub trait DefaultIssueCallbacksModule { storage_key: ManagedBuffer, #[call_result] result: ManagedAsyncCallResult<()>, ) { + let key = StorageKey::from(storage_key); match result { ManagedAsyncCallResult::Ok(()) => { let token_id = self.call_value().single_esdt().token_identifier; - let mapper = - SingleValueMapper::::new(storage_key.into()); - mapper.set(&token_id); + storage_set(key.as_ref(), &TokenMapperState::Token(token_id)); }, ManagedAsyncCallResult::Err(_) => { self.return_failed_issue_funds(initial_caller); + storage_clear(key.as_ref()); }, } } fn return_failed_issue_funds(&self, initial_caller: ManagedAddress) { let egld_returned = self.call_value().egld_value(); - if egld_returned > 0u32 { + if *egld_returned > 0u32 { self.send().direct_egld(&initial_caller, &egld_returned); } } diff --git a/contracts/modules/src/dns.rs b/contracts/modules/src/dns.rs index 1e5d074b91..0bbeb38101 100644 --- a/contracts/modules/src/dns.rs +++ b/contracts/modules/src/dns.rs @@ -13,7 +13,7 @@ multiversx_sc::imports!(); /// Standard smart contract module that deals with registering usernames in a DNS contract. /// -/// Elrond usernames/herotags need to be requested by the beneficiary. +/// MultiversX usernames/herotags need to be requested by the beneficiary. /// For a contract, this means that they need an endpoint via which to request a username from the DNS. /// #[multiversx_sc::module] @@ -25,7 +25,7 @@ pub trait DnsModule { #[only_owner] #[endpoint(dnsRegister)] fn dns_register(&self, dns_address: ManagedAddress, name: ManagedBuffer) { - let payment = self.call_value().egld_value(); + let payment = self.call_value().egld_value().clone_value(); self.dns_proxy(dns_address) .register(&name) .with_egld_transfer(payment) diff --git a/contracts/modules/src/esdt.rs b/contracts/modules/src/esdt.rs index d4ecbe4371..18f43b896f 100644 --- a/contracts/modules/src/esdt.rs +++ b/contracts/modules/src/esdt.rs @@ -34,7 +34,7 @@ pub trait EsdtModule { ) { require!(self.token_id().is_empty(), "Token already issued"); - let issue_cost = self.call_value().egld_value(); + let issue_cost = self.call_value().egld_value().clone_value(); let num_decimals = match opt_num_decimals { OptionalValue::Some(d) => d, OptionalValue::None => 0, @@ -64,7 +64,7 @@ pub trait EsdtModule { // return payment to initial caller let initial_caller = self.blockchain().get_owner_address(); let egld_returned = self.call_value().egld_value(); - if egld_returned > 0u32 { + if *egld_returned > 0u32 { self.send().direct_egld(&initial_caller, &egld_returned); } }, diff --git a/contracts/modules/src/governance/README.md b/contracts/modules/src/governance/README.md index 784a135030..f61d955953 100644 --- a/contracts/modules/src/governance/README.md +++ b/contracts/modules/src/governance/README.md @@ -1,4 +1,4 @@ -# Elrond smart contract module - Governance +# MultiversX smart contract module - Governance This is a standard smart contract module, that when added to a smart contract offers governance features: - proposing actions diff --git a/contracts/modules/src/governance/governance_configurable.rs b/contracts/modules/src/governance/governance_configurable.rs index 407e4eab89..796e3232b6 100644 --- a/contracts/modules/src/governance/governance_configurable.rs +++ b/contracts/modules/src/governance/governance_configurable.rs @@ -1,6 +1,6 @@ multiversx_sc::imports!(); -/// # Elrond smart contract module - Governance +/// # MultiversX smart contract module - Governance /// /// This is a standard smart contract module, that when added to a smart contract offers governance features: /// - proposing actions diff --git a/contracts/modules/src/token_merge/merged_token_setup.rs b/contracts/modules/src/token_merge/merged_token_setup.rs index ffdf1a79fd..f99618e073 100644 --- a/contracts/modules/src/token_merge/merged_token_setup.rs +++ b/contracts/modules/src/token_merge/merged_token_setup.rs @@ -17,7 +17,7 @@ pub trait MergedTokenSetupModule { let payment_amount = self.call_value().egld_value(); self.merged_token().issue_and_set_all_roles( EsdtTokenType::NonFungible, - payment_amount, + payment_amount.clone_value(), token_display_name, token_ticker, 0, diff --git a/contracts/modules/src/token_merge/mod.rs b/contracts/modules/src/token_merge/mod.rs index 9250a07d42..024626e2f1 100644 --- a/contracts/modules/src/token_merge/mod.rs +++ b/contracts/modules/src/token_merge/mod.rs @@ -21,7 +21,7 @@ pub trait TokenMergeModule: { fn merge_tokens>( &self, - payments: ManagedVec, + payments: &ManagedVec, attr_creator: &AttributesCreator, ) -> EsdtTokenPayment { self.require_not_paused(); @@ -36,7 +36,7 @@ pub trait TokenMergeModule: let mut already_merged_tokens = ArrayVec::<_, MAX_MERGED_TOKENS>::new(); let mut single_tokens = ArrayVec::<_, MAX_MERGED_TOKENS>::new(); - for token in &payments { + for token in payments { if token.token_identifier == merged_token_id { let token_data = self.blockchain().get_esdt_token_data( &sc_address, @@ -81,7 +81,10 @@ pub trait TokenMergeModule: merged_token_payment } - fn split_tokens(&self, payments: ManagedVec) -> ManagedVec { + fn split_tokens( + &self, + payments: &ManagedVec, + ) -> ManagedVec { self.require_not_paused(); require!(!payments.is_empty(), "No payments"); @@ -89,7 +92,7 @@ pub trait TokenMergeModule: let sc_address = self.blockchain().get_sc_address(); let mut output_payments = ManagedVec::new(); - for token in &payments { + for token in payments { require!( token.token_identifier == merged_token_id, "Invalid token to split" diff --git a/data/README.md b/data/README.md new file mode 100644 index 0000000000..15023742f7 --- /dev/null +++ b/data/README.md @@ -0,0 +1,7 @@ +# MultiversX Data Encoding & Handling + +The crates in this folder deal with data manipulation. + +They are as follows: + - `multiversx-sc-codec` - the standard serializer/deserializer for SC data + - `multiversx-sc-codec-derive` - procedural macros for `multiversx-sc-codec` diff --git a/framework/codec-derive/Cargo.toml b/data/codec-derive/Cargo.toml similarity index 97% rename from framework/codec-derive/Cargo.toml rename to data/codec-derive/Cargo.toml index ed28538449..e2cb3508ce 100644 --- a/framework/codec-derive/Cargo.toml +++ b/data/codec-derive/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "multiversx-sc-codec-derive" -version = "0.17.1" +version = "0.17.2" edition = "2021" authors = ["dorin.iancu ", "Andrei Marinica ", "MultiversX "] diff --git a/framework/codec-derive/README.md b/data/codec-derive/README.md similarity index 100% rename from framework/codec-derive/README.md rename to data/codec-derive/README.md diff --git a/framework/codec-derive/src/lib.rs b/data/codec-derive/src/lib.rs similarity index 100% rename from framework/codec-derive/src/lib.rs rename to data/codec-derive/src/lib.rs diff --git a/framework/codec-derive/src/nested_de_derive.rs b/data/codec-derive/src/nested_de_derive.rs similarity index 100% rename from framework/codec-derive/src/nested_de_derive.rs rename to data/codec-derive/src/nested_de_derive.rs diff --git a/framework/codec-derive/src/nested_en_derive.rs b/data/codec-derive/src/nested_en_derive.rs similarity index 100% rename from framework/codec-derive/src/nested_en_derive.rs rename to data/codec-derive/src/nested_en_derive.rs diff --git a/framework/codec-derive/src/top_de_derive.rs b/data/codec-derive/src/top_de_derive.rs similarity index 100% rename from framework/codec-derive/src/top_de_derive.rs rename to data/codec-derive/src/top_de_derive.rs diff --git a/framework/codec-derive/src/top_en_derive.rs b/data/codec-derive/src/top_en_derive.rs similarity index 100% rename from framework/codec-derive/src/top_en_derive.rs rename to data/codec-derive/src/top_en_derive.rs diff --git a/framework/codec-derive/src/util.rs b/data/codec-derive/src/util.rs similarity index 100% rename from framework/codec-derive/src/util.rs rename to data/codec-derive/src/util.rs diff --git a/framework/codec/Cargo.toml b/data/codec/Cargo.toml similarity index 94% rename from framework/codec/Cargo.toml rename to data/codec/Cargo.toml index e88ea49549..aa5bcfe148 100644 --- a/framework/codec/Cargo.toml +++ b/data/codec/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "multiversx-sc-codec" -version = "0.17.1" +version = "0.17.2" edition = "2021" authors = ["Andrei Marinica ", "MultiversX "] @@ -19,7 +19,7 @@ alloc = [] [dependencies.multiversx-sc-codec-derive] path = "../codec-derive" -version = "=0.17.1" +version = "=0.17.2" optional = true [dependencies] @@ -28,4 +28,4 @@ num-bigint = { version = "0.4.2", optional = true } # can only be used in std co [dev-dependencies.multiversx-sc-codec-derive] path = "../codec-derive" -version = "=0.17.1" +version = "=0.17.2" diff --git a/framework/codec/README.md b/data/codec/README.md similarity index 100% rename from framework/codec/README.md rename to data/codec/README.md diff --git a/framework/codec/src/codec_err.rs b/data/codec/src/codec_err.rs similarity index 100% rename from framework/codec/src/codec_err.rs rename to data/codec/src/codec_err.rs diff --git a/framework/codec/src/codec_err_handler.rs b/data/codec/src/codec_err_handler.rs similarity index 100% rename from framework/codec/src/codec_err_handler.rs rename to data/codec/src/codec_err_handler.rs diff --git a/framework/codec/src/default_traits.rs b/data/codec/src/default_traits.rs similarity index 100% rename from framework/codec/src/default_traits.rs rename to data/codec/src/default_traits.rs diff --git a/framework/codec/src/equivalent/codec_convert.rs b/data/codec/src/equivalent/codec_convert.rs similarity index 100% rename from framework/codec/src/equivalent/codec_convert.rs rename to data/codec/src/equivalent/codec_convert.rs diff --git a/framework/codec/src/equivalent/codec_from.rs b/data/codec/src/equivalent/codec_from.rs similarity index 100% rename from framework/codec/src/equivalent/codec_from.rs rename to data/codec/src/equivalent/codec_from.rs diff --git a/framework/codec/src/equivalent/codec_into.rs b/data/codec/src/equivalent/codec_into.rs similarity index 100% rename from framework/codec/src/equivalent/codec_into.rs rename to data/codec/src/equivalent/codec_into.rs diff --git a/framework/codec/src/equivalent/mod.rs b/data/codec/src/equivalent/mod.rs similarity index 100% rename from framework/codec/src/equivalent/mod.rs rename to data/codec/src/equivalent/mod.rs diff --git a/framework/codec/src/impl_for_types/impl_array.rs b/data/codec/src/impl_for_types/impl_array.rs similarity index 100% rename from framework/codec/src/impl_for_types/impl_array.rs rename to data/codec/src/impl_for_types/impl_array.rs diff --git a/framework/codec/src/impl_for_types/impl_array_vec.rs b/data/codec/src/impl_for_types/impl_array_vec.rs similarity index 100% rename from framework/codec/src/impl_for_types/impl_array_vec.rs rename to data/codec/src/impl_for_types/impl_array_vec.rs diff --git a/framework/codec/src/impl_for_types/impl_bool.rs b/data/codec/src/impl_for_types/impl_bool.rs similarity index 100% rename from framework/codec/src/impl_for_types/impl_bool.rs rename to data/codec/src/impl_for_types/impl_bool.rs diff --git a/framework/codec/src/impl_for_types/impl_bytes.rs b/data/codec/src/impl_for_types/impl_bytes.rs similarity index 100% rename from framework/codec/src/impl_for_types/impl_bytes.rs rename to data/codec/src/impl_for_types/impl_bytes.rs diff --git a/framework/codec/src/impl_for_types/impl_empty.rs b/data/codec/src/impl_for_types/impl_empty.rs similarity index 100% rename from framework/codec/src/impl_for_types/impl_empty.rs rename to data/codec/src/impl_for_types/impl_empty.rs diff --git a/framework/codec/src/impl_for_types/impl_non_zero_usize.rs b/data/codec/src/impl_for_types/impl_non_zero_usize.rs similarity index 100% rename from framework/codec/src/impl_for_types/impl_non_zero_usize.rs rename to data/codec/src/impl_for_types/impl_non_zero_usize.rs diff --git a/framework/codec/src/impl_for_types/impl_num_signed.rs b/data/codec/src/impl_for_types/impl_num_signed.rs similarity index 100% rename from framework/codec/src/impl_for_types/impl_num_signed.rs rename to data/codec/src/impl_for_types/impl_num_signed.rs diff --git a/framework/codec/src/impl_for_types/impl_num_unsigned.rs b/data/codec/src/impl_for_types/impl_num_unsigned.rs similarity index 100% rename from framework/codec/src/impl_for_types/impl_num_unsigned.rs rename to data/codec/src/impl_for_types/impl_num_unsigned.rs diff --git a/framework/codec/src/impl_for_types/impl_option.rs b/data/codec/src/impl_for_types/impl_option.rs similarity index 100% rename from framework/codec/src/impl_for_types/impl_option.rs rename to data/codec/src/impl_for_types/impl_option.rs diff --git a/framework/codec/src/impl_for_types/impl_phantom.rs b/data/codec/src/impl_for_types/impl_phantom.rs similarity index 100% rename from framework/codec/src/impl_for_types/impl_phantom.rs rename to data/codec/src/impl_for_types/impl_phantom.rs diff --git a/framework/codec/src/impl_for_types/impl_ref.rs b/data/codec/src/impl_for_types/impl_ref.rs similarity index 100% rename from framework/codec/src/impl_for_types/impl_ref.rs rename to data/codec/src/impl_for_types/impl_ref.rs diff --git a/framework/codec/src/impl_for_types/impl_rust_big_int.rs b/data/codec/src/impl_for_types/impl_rust_big_int.rs similarity index 100% rename from framework/codec/src/impl_for_types/impl_rust_big_int.rs rename to data/codec/src/impl_for_types/impl_rust_big_int.rs diff --git a/framework/codec/src/impl_for_types/impl_rust_big_uint.rs b/data/codec/src/impl_for_types/impl_rust_big_uint.rs similarity index 100% rename from framework/codec/src/impl_for_types/impl_rust_big_uint.rs rename to data/codec/src/impl_for_types/impl_rust_big_uint.rs diff --git a/framework/codec/src/impl_for_types/impl_slice.rs b/data/codec/src/impl_for_types/impl_slice.rs similarity index 100% rename from framework/codec/src/impl_for_types/impl_slice.rs rename to data/codec/src/impl_for_types/impl_slice.rs diff --git a/framework/codec/src/impl_for_types/impl_string.rs b/data/codec/src/impl_for_types/impl_string.rs similarity index 100% rename from framework/codec/src/impl_for_types/impl_string.rs rename to data/codec/src/impl_for_types/impl_string.rs diff --git a/framework/codec/src/impl_for_types/impl_tuple.rs b/data/codec/src/impl_for_types/impl_tuple.rs similarity index 100% rename from framework/codec/src/impl_for_types/impl_tuple.rs rename to data/codec/src/impl_for_types/impl_tuple.rs diff --git a/framework/codec/src/impl_for_types/impl_unit.rs b/data/codec/src/impl_for_types/impl_unit.rs similarity index 100% rename from framework/codec/src/impl_for_types/impl_unit.rs rename to data/codec/src/impl_for_types/impl_unit.rs diff --git a/framework/codec/src/impl_for_types/impl_vec.rs b/data/codec/src/impl_for_types/impl_vec.rs similarity index 100% rename from framework/codec/src/impl_for_types/impl_vec.rs rename to data/codec/src/impl_for_types/impl_vec.rs diff --git a/framework/codec/src/impl_for_types/local_macro.rs b/data/codec/src/impl_for_types/local_macro.rs similarity index 100% rename from framework/codec/src/impl_for_types/local_macro.rs rename to data/codec/src/impl_for_types/local_macro.rs diff --git a/framework/codec/src/impl_for_types/mod.rs b/data/codec/src/impl_for_types/mod.rs similarity index 100% rename from framework/codec/src/impl_for_types/mod.rs rename to data/codec/src/impl_for_types/mod.rs diff --git a/framework/codec/src/lib.rs b/data/codec/src/lib.rs similarity index 100% rename from framework/codec/src/lib.rs rename to data/codec/src/lib.rs diff --git a/framework/codec/src/multi/into_multi_value.rs b/data/codec/src/multi/into_multi_value.rs similarity index 100% rename from framework/codec/src/multi/into_multi_value.rs rename to data/codec/src/multi/into_multi_value.rs diff --git a/framework/codec/src/multi/mod.rs b/data/codec/src/multi/mod.rs similarity index 100% rename from framework/codec/src/multi/mod.rs rename to data/codec/src/multi/mod.rs diff --git a/framework/codec/src/multi/top_de_multi.rs b/data/codec/src/multi/top_de_multi.rs similarity index 100% rename from framework/codec/src/multi/top_de_multi.rs rename to data/codec/src/multi/top_de_multi.rs diff --git a/framework/codec/src/multi/top_de_multi_input.rs b/data/codec/src/multi/top_de_multi_input.rs similarity index 100% rename from framework/codec/src/multi/top_de_multi_input.rs rename to data/codec/src/multi/top_de_multi_input.rs diff --git a/framework/codec/src/multi/top_en_multi.rs b/data/codec/src/multi/top_en_multi.rs similarity index 100% rename from framework/codec/src/multi/top_en_multi.rs rename to data/codec/src/multi/top_en_multi.rs diff --git a/framework/codec/src/multi/top_en_multi_output.rs b/data/codec/src/multi/top_en_multi_output.rs similarity index 100% rename from framework/codec/src/multi/top_en_multi_output.rs rename to data/codec/src/multi/top_en_multi_output.rs diff --git a/framework/codec/src/multi_types/mod.rs b/data/codec/src/multi_types/mod.rs similarity index 100% rename from framework/codec/src/multi_types/mod.rs rename to data/codec/src/multi_types/mod.rs diff --git a/framework/codec/src/multi_types/multi_value_ignore.rs b/data/codec/src/multi_types/multi_value_ignore.rs similarity index 100% rename from framework/codec/src/multi_types/multi_value_ignore.rs rename to data/codec/src/multi_types/multi_value_ignore.rs diff --git a/framework/codec/src/multi_types/multi_value_optional.rs b/data/codec/src/multi_types/multi_value_optional.rs similarity index 100% rename from framework/codec/src/multi_types/multi_value_optional.rs rename to data/codec/src/multi_types/multi_value_optional.rs diff --git a/framework/codec/src/multi_types/multi_value_placeholder.rs b/data/codec/src/multi_types/multi_value_placeholder.rs similarity index 100% rename from framework/codec/src/multi_types/multi_value_placeholder.rs rename to data/codec/src/multi_types/multi_value_placeholder.rs diff --git a/framework/codec/src/multi_types/multi_value_tuple.rs b/data/codec/src/multi_types/multi_value_tuple.rs similarity index 100% rename from framework/codec/src/multi_types/multi_value_tuple.rs rename to data/codec/src/multi_types/multi_value_tuple.rs diff --git a/framework/codec/src/multi_types/multi_value_unit.rs b/data/codec/src/multi_types/multi_value_unit.rs similarity index 100% rename from framework/codec/src/multi_types/multi_value_unit.rs rename to data/codec/src/multi_types/multi_value_unit.rs diff --git a/framework/codec/src/multi_types/multi_value_vec.rs b/data/codec/src/multi_types/multi_value_vec.rs similarity index 100% rename from framework/codec/src/multi_types/multi_value_vec.rs rename to data/codec/src/multi_types/multi_value_vec.rs diff --git a/framework/codec/src/num_conv.rs b/data/codec/src/num_conv.rs similarity index 100% rename from framework/codec/src/num_conv.rs rename to data/codec/src/num_conv.rs diff --git a/framework/codec/src/single/mod.rs b/data/codec/src/single/mod.rs similarity index 100% rename from framework/codec/src/single/mod.rs rename to data/codec/src/single/mod.rs diff --git a/framework/codec/src/single/nested_de.rs b/data/codec/src/single/nested_de.rs similarity index 100% rename from framework/codec/src/single/nested_de.rs rename to data/codec/src/single/nested_de.rs diff --git a/framework/codec/src/single/nested_de_input.rs b/data/codec/src/single/nested_de_input.rs similarity index 100% rename from framework/codec/src/single/nested_de_input.rs rename to data/codec/src/single/nested_de_input.rs diff --git a/framework/codec/src/single/nested_de_input_owned.rs b/data/codec/src/single/nested_de_input_owned.rs similarity index 100% rename from framework/codec/src/single/nested_de_input_owned.rs rename to data/codec/src/single/nested_de_input_owned.rs diff --git a/framework/codec/src/single/nested_de_input_slice.rs b/data/codec/src/single/nested_de_input_slice.rs similarity index 100% rename from framework/codec/src/single/nested_de_input_slice.rs rename to data/codec/src/single/nested_de_input_slice.rs diff --git a/framework/codec/src/single/nested_en.rs b/data/codec/src/single/nested_en.rs similarity index 100% rename from framework/codec/src/single/nested_en.rs rename to data/codec/src/single/nested_en.rs diff --git a/framework/codec/src/single/nested_en_output.rs b/data/codec/src/single/nested_en_output.rs similarity index 100% rename from framework/codec/src/single/nested_en_output.rs rename to data/codec/src/single/nested_en_output.rs diff --git a/framework/codec/src/single/top_de.rs b/data/codec/src/single/top_de.rs similarity index 100% rename from framework/codec/src/single/top_de.rs rename to data/codec/src/single/top_de.rs diff --git a/framework/codec/src/single/top_de_input.rs b/data/codec/src/single/top_de_input.rs similarity index 100% rename from framework/codec/src/single/top_de_input.rs rename to data/codec/src/single/top_de_input.rs diff --git a/framework/codec/src/single/top_en.rs b/data/codec/src/single/top_en.rs similarity index 100% rename from framework/codec/src/single/top_en.rs rename to data/codec/src/single/top_en.rs diff --git a/framework/codec/src/single/top_en_output.rs b/data/codec/src/single/top_en_output.rs similarity index 100% rename from framework/codec/src/single/top_en_output.rs rename to data/codec/src/single/top_en_output.rs diff --git a/framework/codec/src/test_util.rs b/data/codec/src/test_util.rs similarity index 100% rename from framework/codec/src/test_util.rs rename to data/codec/src/test_util.rs diff --git a/framework/codec/src/transmute.rs b/data/codec/src/transmute.rs similarity index 100% rename from framework/codec/src/transmute.rs rename to data/codec/src/transmute.rs diff --git a/framework/codec/src/try_static_cast.rs b/data/codec/src/try_static_cast.rs similarity index 100% rename from framework/codec/src/try_static_cast.rs rename to data/codec/src/try_static_cast.rs diff --git a/framework/codec/tests/derive_empty_struct_test.rs b/data/codec/tests/derive_empty_struct_test.rs similarity index 100% rename from framework/codec/tests/derive_empty_struct_test.rs rename to data/codec/tests/derive_empty_struct_test.rs diff --git a/framework/codec/tests/derive_enum_or_default_test.rs b/data/codec/tests/derive_enum_or_default_test.rs similarity index 100% rename from framework/codec/tests/derive_enum_or_default_test.rs rename to data/codec/tests/derive_enum_or_default_test.rs diff --git a/framework/codec/tests/derive_enum_test.rs b/data/codec/tests/derive_enum_test.rs similarity index 100% rename from framework/codec/tests/derive_enum_test.rs rename to data/codec/tests/derive_enum_test.rs diff --git a/framework/codec/tests/derive_enum_tricky_defaults_fieldless_test.rs b/data/codec/tests/derive_enum_tricky_defaults_fieldless_test.rs similarity index 100% rename from framework/codec/tests/derive_enum_tricky_defaults_fieldless_test.rs rename to data/codec/tests/derive_enum_tricky_defaults_fieldless_test.rs diff --git a/framework/codec/tests/derive_enum_tricky_defaults_test.rs b/data/codec/tests/derive_enum_tricky_defaults_test.rs similarity index 100% rename from framework/codec/tests/derive_enum_tricky_defaults_test.rs rename to data/codec/tests/derive_enum_tricky_defaults_test.rs diff --git a/framework/codec/tests/derive_hygiene.rs b/data/codec/tests/derive_hygiene.rs similarity index 100% rename from framework/codec/tests/derive_hygiene.rs rename to data/codec/tests/derive_hygiene.rs diff --git a/framework/codec/tests/derive_struct_or_default_generic_test.rs b/data/codec/tests/derive_struct_or_default_generic_test.rs similarity index 100% rename from framework/codec/tests/derive_struct_or_default_generic_test.rs rename to data/codec/tests/derive_struct_or_default_generic_test.rs diff --git a/framework/codec/tests/derive_struct_or_default_test.rs b/data/codec/tests/derive_struct_or_default_test.rs similarity index 100% rename from framework/codec/tests/derive_struct_or_default_test.rs rename to data/codec/tests/derive_struct_or_default_test.rs diff --git a/framework/codec/tests/derive_struct_test.rs b/data/codec/tests/derive_struct_test.rs similarity index 100% rename from framework/codec/tests/derive_struct_test.rs rename to data/codec/tests/derive_struct_test.rs diff --git a/framework/codec/tests/derive_struct_with_generic_test.rs b/data/codec/tests/derive_struct_with_generic_test.rs similarity index 100% rename from framework/codec/tests/derive_struct_with_generic_test.rs rename to data/codec/tests/derive_struct_with_generic_test.rs diff --git a/framework/codec/tests/derive_tuple_struct_test.rs b/data/codec/tests/derive_tuple_struct_test.rs similarity index 100% rename from framework/codec/tests/derive_tuple_struct_test.rs rename to data/codec/tests/derive_tuple_struct_test.rs diff --git a/framework/codec/tests/explicit_impl_enum.rs b/data/codec/tests/explicit_impl_enum.rs similarity index 100% rename from framework/codec/tests/explicit_impl_enum.rs rename to data/codec/tests/explicit_impl_enum.rs diff --git a/framework/codec/tests/explicit_impl_struct.rs b/data/codec/tests/explicit_impl_struct.rs similarity index 100% rename from framework/codec/tests/explicit_impl_struct.rs rename to data/codec/tests/explicit_impl_struct.rs diff --git a/framework/codec/tests/explicit_impl_wrapped_array.rs b/data/codec/tests/explicit_impl_wrapped_array.rs similarity index 100% rename from framework/codec/tests/explicit_impl_wrapped_array.rs rename to data/codec/tests/explicit_impl_wrapped_array.rs diff --git a/framework/README.md b/framework/README.md index 92d3bdbba2..bb31ff40ca 100644 --- a/framework/README.md +++ b/framework/README.md @@ -4,7 +4,6 @@ The crates in this folder form the MultiversX smart contract framework. They are as follows: - `multiversx-sc` - the base crate for smart contract libraries, it is the only dependency the smart contract code sees. - - `multiversx-sc-codec` / `multiversx-sc-codec-derive` - the standard serializer/deserializer for SC data - `multiversx-sc-derive` - procedural macros for friendlier SC code - `multiversx-sc-meta` - smart contract meta-programming: build system and other tools - `multiversx-sc-scenario` - the main testing tool, contracts are tested by via scenarios diff --git a/framework/base/Cargo.toml b/framework/base/Cargo.toml index db5f444301..8cf49178c6 100644 --- a/framework/base/Cargo.toml +++ b/framework/base/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "multiversx-sc" -version = "0.39.7" +version = "0.41.3" edition = "2021" authors = ["Andrei Marinica ", "MultiversX "] @@ -31,10 +31,10 @@ version = "0.2" default-features = false [dependencies.multiversx-sc-derive] -version = "=0.39.7" +version = "=0.41.3" path = "../derive" [dependencies.multiversx-sc-codec] -version = "=0.17.1" -path = "../codec" +version = "=0.17.2" +path = "../../data/codec" features = ["derive"] diff --git a/framework/base/src/abi/type_abi.rs b/framework/base/src/abi/type_abi.rs index cc28b94883..77931357ec 100644 --- a/framework/base/src/abi/type_abi.rs +++ b/framework/base/src/abi/type_abi.rs @@ -6,7 +6,7 @@ pub trait TypeAbi { core::any::type_name::().into() } - /// A type can provide more than its own description. + /// A type can provide more than its own name. /// For instance, a struct can also provide the descriptions of the type of its fields. /// TypeAbi doesn't care for the exact accumulator type, /// which is abstracted by the TypeDescriptionContainer trait. diff --git a/framework/base/src/abi/type_description.rs b/framework/base/src/abi/type_description.rs index 79b170f649..30baaa9e9c 100644 --- a/framework/base/src/abi/type_description.rs +++ b/framework/base/src/abi/type_description.rs @@ -24,6 +24,7 @@ pub enum TypeContents { NotSpecified, Enum(Vec), Struct(Vec), + ExplicitEnum(Vec), } impl TypeContents { @@ -46,3 +47,14 @@ pub struct StructFieldDescription { pub name: &'static str, pub field_type: String, } + +/// An explicit enum is an enum that gets serialized by name instead of discriminant. +/// +/// This makes it easier for humans to read readable in the transaction output. +/// +/// It cannot have data fields, only simple enums allowed. +#[derive(Clone, Debug)] +pub struct ExplicitEnumVariantDescription { + pub docs: &'static [&'static str], + pub name: &'static str, +} diff --git a/framework/base/src/contract_base/wrappers/blockchain_wrapper.rs b/framework/base/src/contract_base/wrappers/blockchain_wrapper.rs index 61b59e51e0..ecbf74601a 100644 --- a/framework/base/src/contract_base/wrappers/blockchain_wrapper.rs +++ b/framework/base/src/contract_base/wrappers/blockchain_wrapper.rs @@ -39,6 +39,7 @@ where } } + #[deprecated(since = "0.41.0", note = "Please use method `get_caller` instead.")] #[cfg(feature = "alloc")] #[inline] pub fn get_caller_legacy(&self) -> crate::types::Address { @@ -52,6 +53,7 @@ where ManagedAddress::from_handle(handle) } + #[deprecated(since = "0.41.0", note = "Please use method `get_sc_address` instead.")] #[cfg(feature = "alloc")] #[inline] pub fn get_sc_address_legacy(&self) -> crate::types::Address { @@ -65,6 +67,10 @@ where ManagedAddress::from_handle(handle) } + #[deprecated( + since = "0.41.0", + note = "Please use method `get_owner_address` instead." + )] #[cfg(feature = "alloc")] #[inline] pub fn get_owner_address_legacy(&self) -> crate::types::Address { @@ -92,6 +98,10 @@ where } } + #[deprecated( + since = "0.41.0", + note = "Please use method `get_shard_of_address` instead." + )] #[cfg(feature = "alloc")] #[inline] pub fn get_shard_of_address_legacy(&self, address: &crate::types::Address) -> u32 { @@ -103,6 +113,10 @@ where A::blockchain_api_impl().get_shard_of_address(address.get_handle()) } + #[deprecated( + since = "0.41.0", + note = "Please use method `is_smart_contract` instead." + )] #[cfg(feature = "alloc")] #[inline] pub fn is_smart_contract_legacy(&self, address: &crate::types::Address) -> bool { @@ -114,6 +128,7 @@ where A::blockchain_api_impl().is_smart_contract(address.get_handle()) } + #[deprecated(since = "0.41.0", note = "Please use method `get_balance` instead.")] #[cfg(feature = "alloc")] #[inline] pub fn get_balance_legacy(&self, address: &crate::types::Address) -> BigUint { @@ -139,6 +154,10 @@ where ) } + #[deprecated( + since = "0.41.0", + note = "Please use method `get_state_root_hash` instead." + )] #[cfg(feature = "alloc")] #[inline] pub fn get_state_root_hash_legacy(&self) -> crate::types::H256 { @@ -152,6 +171,7 @@ where ManagedByteArray::from_handle(handle) } + #[deprecated(since = "0.41.0", note = "Please use method `get_tx_hash` instead.")] #[cfg(feature = "alloc")] #[inline] pub fn get_tx_hash_legacy(&self) -> crate::types::H256 { @@ -190,6 +210,10 @@ where A::blockchain_api_impl().get_block_epoch() } + #[deprecated( + since = "0.41.0", + note = "Please use method `get_block_random_seed` instead." + )] #[cfg(feature = "alloc")] #[inline] pub fn get_block_random_seed_legacy(&self) -> crate::types::Box<[u8; 48]> { @@ -223,6 +247,10 @@ where A::blockchain_api_impl().get_prev_block_epoch() } + #[deprecated( + since = "0.41.0", + note = "Please use method `get_prev_block_random_seed` instead." + )] #[cfg(feature = "alloc")] #[inline] pub fn get_prev_block_random_seed_legacy(&self) -> crate::types::Box<[u8; 48]> { diff --git a/framework/base/src/contract_base/wrappers/call_value_wrapper.rs b/framework/base/src/contract_base/wrappers/call_value_wrapper.rs index 89d8af2463..08c70e38a6 100644 --- a/framework/base/src/contract_base/wrappers/call_value_wrapper.rs +++ b/framework/base/src/contract_base/wrappers/call_value_wrapper.rs @@ -7,7 +7,7 @@ use crate::{ }, err_msg, types::{ - BigUint, EgldOrEsdtTokenIdentifier, EgldOrEsdtTokenPayment, EsdtTokenPayment, ManagedType, + BigUint, EgldOrEsdtTokenIdentifier, EgldOrEsdtTokenPayment, EsdtTokenPayment, ManagedRef, ManagedVec, TokenIdentifier, }, }; @@ -32,27 +32,27 @@ where /// Retrieves the EGLD call value from the VM. /// Will return 0 in case of an ESDT transfer (cannot have both EGLD and ESDT transfer simultaneously). - pub fn egld_value(&self) -> BigUint { + pub fn egld_value(&self) -> ManagedRef<'static, A, BigUint> { let mut call_value_handle = A::static_var_api_impl().get_call_value_egld_handle(); if call_value_handle == const_handles::UNINITIALIZED_HANDLE { call_value_handle = use_raw_handle(const_handles::CALL_VALUE_EGLD); A::static_var_api_impl().set_call_value_egld_handle(call_value_handle.clone()); A::call_value_api_impl().load_egld_value(call_value_handle.clone()); } - BigUint::from_handle(call_value_handle) // unsafe, TODO: replace with ManagedRef<...> + unsafe { ManagedRef::wrap_handle(call_value_handle) } } /// Returns all ESDT transfers that accompany this SC call. /// Will return 0 results if nothing was transfered, or just EGLD. /// Fully managed underlying types, very efficient. - pub fn all_esdt_transfers(&self) -> ManagedVec> { + pub fn all_esdt_transfers(&self) -> ManagedRef<'static, A, ManagedVec>> { let mut call_value_handle = A::static_var_api_impl().get_call_value_multi_esdt_handle(); if call_value_handle == const_handles::UNINITIALIZED_HANDLE { call_value_handle = use_raw_handle(const_handles::CALL_VALUE_MULTI_ESDT); A::static_var_api_impl().set_call_value_multi_esdt_handle(call_value_handle.clone()); A::call_value_api_impl().load_all_esdt_transfers(call_value_handle.clone()); } - ManagedVec::from_handle(call_value_handle) // unsafe, TODO: replace with ManagedRef<...> + unsafe { ManagedRef::wrap_handle(call_value_handle) } } /// Verify and casts the received multi ESDT transfer in to an array. @@ -91,15 +91,6 @@ where (payment.token_identifier, payment.amount) } - /// Retrieves the ESDT call value from the VM. - /// Will return 0 in case of an EGLD transfer (cannot have both EGLD and ESDT transfer simultaneously). - pub fn esdt_value(&self) -> BigUint { - let call_value_single_esdt: A::BigIntHandle = - use_raw_handle(const_handles::CALL_VALUE_SINGLE_ESDT); - A::call_value_api_impl().load_single_esdt_value(call_value_single_esdt.clone()); - BigUint::from_handle(call_value_single_esdt) - } - /// Accepts and returns either an EGLD payment, or a single ESDT token. /// /// Will halt execution if more than one ESDT transfer was received. @@ -111,7 +102,7 @@ where 0 => EgldOrEsdtTokenPayment { token_identifier: EgldOrEsdtTokenIdentifier::egld(), token_nonce: 0, - amount: self.egld_value(), + amount: self.egld_value().clone_value(), }, 1 => esdt_transfers.get(0).into(), _ => A::error_api_impl().signal_error(err_msg::INCORRECT_NUM_ESDT_TRANSFERS.as_bytes()), diff --git a/framework/base/src/contract_base/wrappers/crypto_wrapper.rs b/framework/base/src/contract_base/wrappers/crypto_wrapper.rs index 92805648a1..ab11ab74d9 100644 --- a/framework/base/src/contract_base/wrappers/crypto_wrapper.rs +++ b/framework/base/src/contract_base/wrappers/crypto_wrapper.rs @@ -35,6 +35,7 @@ where ManagedByteArray::from_handle(new_handle) } + #[deprecated(since = "0.41.0", note = "Please use method `sha256` instead.")] #[cfg(feature = "alloc")] pub fn sha256_legacy_alloc(&self, data: &[u8]) -> crate::types::H256 { crate::types::H256::from(A::crypto_api_impl().sha256_legacy(data)) @@ -62,6 +63,7 @@ where ManagedByteArray::from_handle(new_handle) } + #[deprecated(since = "0.41.0", note = "Please use method `keccak256` instead.")] #[cfg(feature = "alloc")] pub fn keccak256_legacy_alloc(&self, data: &[u8]) -> crate::types::H256 { crate::types::H256::from(A::crypto_api_impl().keccak256_legacy(data)) @@ -80,6 +82,7 @@ where ManagedByteArray::new_from_bytes(&A::crypto_api_impl().keccak256_legacy(data_buffer_slice)) } + #[deprecated(since = "0.41.0", note = "Please use method `ripemd160` instead.")] #[cfg(feature = "alloc")] pub fn ripemd160_legacy(&self, data: &[u8]) -> crate::types::Box<[u8; 20]> { crate::types::Box::new(A::crypto_api_impl().ripemd160_legacy(data)) @@ -94,6 +97,7 @@ where ManagedByteArray::from_handle(new_handle) } + #[deprecated(since = "0.41.0", note = "Please use method `verify_bls` instead.")] pub fn verify_bls_legacy(&self, key: &[u8], message: &[u8], signature: &[u8]) -> bool { A::crypto_api_impl().verify_bls_legacy(key, message, signature) } @@ -111,10 +115,12 @@ where ) } + #[deprecated(since = "0.41.0", note = "Please use method `verify_ed25519` instead.")] pub fn verify_ed25519_legacy(&self, key: &[u8], message: &[u8], signature: &[u8]) -> bool { A::crypto_api_impl().verify_ed25519_legacy(key, message, signature) } + #[deprecated(since = "0.41.0", note = "Please use method `verify_ed25519` instead.")] pub fn verify_ed25519_legacy_managed( &self, key: &ManagedByteArray, @@ -148,6 +154,10 @@ where /// Note: the signature is minimum 2 bytes in length, /// the second byte encodes the length of the remaining signature bytes. + #[deprecated( + since = "0.41.0", + note = "Please use method `verify_secp256k1` instead." + )] pub fn verify_secp256k1_legacy(&self, key: &[u8], message: &[u8], signature: &[u8]) -> bool { A::crypto_api_impl().verify_secp256k1_legacy(key, message, signature) } @@ -165,6 +175,10 @@ where ) } + #[deprecated( + since = "0.41.0", + note = "Please use method `verify_custom_secp256k1` instead." + )] pub fn verify_custom_secp256k1_legacy( &self, key: &[u8], @@ -190,6 +204,10 @@ where ) } + #[deprecated( + since = "0.41.0", + note = "Please use method `encode_secp256k1_der_signature` instead." + )] #[cfg(feature = "alloc")] pub fn encode_secp256k1_der_signature_legacy( &self, diff --git a/framework/base/src/err_msg.rs b/framework/base/src/err_msg.rs index cb5cf000a6..2c97601bdf 100644 --- a/framework/base/src/err_msg.rs +++ b/framework/base/src/err_msg.rs @@ -1,4 +1,5 @@ pub const PANIC_OCCURRED: &str = "panic occurred"; +pub const MEM_ALLOC_ERROR: &str = "memory allocation error"; pub const NON_PAYABLE_FUNC_EGLD: &str = "function does not accept EGLD payment"; pub const NON_PAYABLE_FUNC_ESDT: &str = "function does not accept ESDT payment"; diff --git a/framework/base/src/hex_call_data/cd_de.rs b/framework/base/src/hex_call_data/cd_de.rs index 0b3559aaf4..ce6d6bdb63 100644 --- a/framework/base/src/hex_call_data/cd_de.rs +++ b/framework/base/src/hex_call_data/cd_de.rs @@ -6,7 +6,7 @@ use crate::{ }; use alloc::{boxed::Box, vec::Vec}; -/// Deserializes from Elrond's smart contract call format. +/// Deserializes from the MultiversX smart contract call format. /// /// This format consists of the function name, followed by '@', follwed by hex-encoded argument bytes separated by '@' characters. /// Example: "funcName@00000@aaaa@1234@@". diff --git a/framework/base/src/hex_call_data/cd_ser.rs b/framework/base/src/hex_call_data/cd_ser.rs index e1ff784c5b..04c7daf179 100644 --- a/framework/base/src/hex_call_data/cd_ser.rs +++ b/framework/base/src/hex_call_data/cd_ser.rs @@ -7,7 +7,7 @@ use alloc::vec::Vec; use super::SEPARATOR; -/// Serializes to Elrond's smart contract call format. +/// Serializes to the MultiversX smart contract call format. /// /// This format consists of the function name, followed by '@', follwed by hex-encoded argument bytes separated by '@' characters. /// Example: "funcName@00000@aaaa@1234@@". diff --git a/framework/base/src/io/call_value_init.rs b/framework/base/src/io/call_value_init.rs index 758dcd92c1..0a7a6a19f3 100644 --- a/framework/base/src/io/call_value_init.rs +++ b/framework/base/src/io/call_value_init.rs @@ -5,7 +5,9 @@ use crate::{ }, contract_base::CallValueWrapper, err_msg, - types::{BigUint, EgldOrEsdtTokenIdentifier, EsdtTokenPayment, ManagedType, ManagedVec}, + types::{ + BigUint, EgldOrEsdtTokenIdentifier, EsdtTokenPayment, ManagedRef, ManagedType, ManagedVec, + }, }; /// Called initially in the generated code whenever no payable annotation is provided. @@ -88,7 +90,7 @@ where } /// Initializes an argument annotated with `#[payment_multi]`. -pub fn arg_payment_multi() -> ManagedVec> +pub fn arg_payment_multi() -> ManagedRef<'static, A, ManagedVec>> where A: CallValueApi + ManagedTypeApi, { diff --git a/framework/base/src/storage/mappers/bi_di_mapper.rs b/framework/base/src/storage/mappers/bi_di_mapper.rs index 831f091720..15503955d5 100644 --- a/framework/base/src/storage/mappers/bi_di_mapper.rs +++ b/framework/base/src/storage/mappers/bi_di_mapper.rs @@ -180,6 +180,21 @@ where } } +impl<'a, SA, K, V> IntoIterator for &'a BiDiMapper +where + SA: StorageMapperApi, + K: TopEncode + TopDecode + NestedEncode + NestedDecode + 'static + Default + PartialEq, + V: TopEncode + TopDecode + NestedEncode + NestedDecode + 'static + Default + PartialEq, +{ + type Item = (K, V); + + type IntoIter = Iter<'a, SA, K, V>; + + fn into_iter(self) -> Self::IntoIter { + self.iter() + } +} + pub struct Iter<'a, SA, K, V> where SA: StorageMapperApi, diff --git a/framework/base/src/storage/mappers/linked_list_mapper.rs b/framework/base/src/storage/mappers/linked_list_mapper.rs index 02ff068801..6d9b8cefe0 100644 --- a/framework/base/src/storage/mappers/linked_list_mapper.rs +++ b/framework/base/src/storage/mappers/linked_list_mapper.rs @@ -501,6 +501,20 @@ where } } +impl<'a, SA, T> IntoIterator for &'a LinkedListMapper +where + SA: StorageMapperApi, + T: TopEncode + TopDecode + NestedEncode + NestedDecode + Clone + 'static, +{ + type Item = LinkedListNode; + + type IntoIter = Iter<'a, SA, T>; + + fn into_iter(self) -> Self::IntoIter { + self.iter() + } +} + pub struct Iter<'a, SA, T> where SA: StorageMapperApi, diff --git a/framework/base/src/storage/mappers/map_mapper.rs b/framework/base/src/storage/mappers/map_mapper.rs index 906fa0b00d..145ae6d4e3 100644 --- a/framework/base/src/storage/mappers/map_mapper.rs +++ b/framework/base/src/storage/mappers/map_mapper.rs @@ -162,6 +162,21 @@ where } } +impl<'a, SA, K, V> IntoIterator for &'a MapMapper +where + SA: StorageMapperApi, + K: TopEncode + TopDecode + NestedEncode + NestedDecode, + V: TopEncode + TopDecode, +{ + type Item = (K, V); + + type IntoIter = Iter<'a, SA, K, V>; + + fn into_iter(self) -> Self::IntoIter { + self.iter() + } +} + pub struct Iter<'a, SA, K, V> where SA: StorageMapperApi, diff --git a/framework/base/src/storage/mappers/map_storage_mapper.rs b/framework/base/src/storage/mappers/map_storage_mapper.rs index 0bf6654c80..23acfaf2cb 100644 --- a/framework/base/src/storage/mappers/map_storage_mapper.rs +++ b/framework/base/src/storage/mappers/map_storage_mapper.rs @@ -151,6 +151,21 @@ where } } +impl<'a, SA, K, V> IntoIterator for &'a MapStorageMapper +where + SA: StorageMapperApi, + K: TopEncode + TopDecode + NestedEncode + NestedDecode + 'static, + V: StorageMapper + StorageClearable, +{ + type Item = (K, V); + + type IntoIter = Iter<'a, SA, K, V>; + + fn into_iter(self) -> Self::IntoIter { + self.iter() + } +} + pub struct Iter<'a, SA, K, V> where SA: StorageMapperApi, diff --git a/framework/base/src/storage/mappers/mod.rs b/framework/base/src/storage/mappers/mod.rs index 31bfe1d364..74dd2a5847 100644 --- a/framework/base/src/storage/mappers/mod.rs +++ b/framework/base/src/storage/mappers/mod.rs @@ -1,15 +1,12 @@ mod bi_di_mapper; -mod fungible_token_mapper; mod linked_list_mapper; mod map_mapper; mod map_storage_mapper; mod mapper; -mod non_fungible_token_mapper; mod queue_mapper; mod set_mapper; mod single_value_mapper; -mod token_attributes_mapper; -mod token_mapper; +mod token; mod unique_id_mapper; mod unordered_set_mapper; mod user_mapper; @@ -17,17 +14,14 @@ mod vec_mapper; mod whitelist_mapper; pub use bi_di_mapper::BiDiMapper; -pub use fungible_token_mapper::FungibleTokenMapper; pub use linked_list_mapper::{LinkedListMapper, LinkedListNode}; pub use map_mapper::MapMapper; pub use map_storage_mapper::MapStorageMapper; pub use mapper::{StorageClearable, StorageMapper}; -pub use non_fungible_token_mapper::NonFungibleTokenMapper; pub use queue_mapper::QueueMapper; pub use set_mapper::SetMapper; pub use single_value_mapper::{SingleValue, SingleValueMapper}; -pub use token_attributes_mapper::TokenAttributesMapper; -pub use token_mapper::StorageTokenWrapper; +pub use token::*; pub use unique_id_mapper::{UniqueId, UniqueIdMapper}; pub use unordered_set_mapper::UnorderedSetMapper; pub use user_mapper::UserMapper; diff --git a/framework/base/src/storage/mappers/queue_mapper.rs b/framework/base/src/storage/mappers/queue_mapper.rs index 18c232d7dd..6bfaacfeb3 100644 --- a/framework/base/src/storage/mappers/queue_mapper.rs +++ b/framework/base/src/storage/mappers/queue_mapper.rs @@ -405,6 +405,20 @@ where } } +impl<'a, SA, T> IntoIterator for &'a QueueMapper +where + SA: StorageMapperApi, + T: TopEncode + TopDecode + 'static, +{ + type Item = T; + + type IntoIter = Iter<'a, SA, T>; + + fn into_iter(self) -> Self::IntoIter { + self.iter() + } +} + /// An iterator over the elements of a `QueueMapper`. /// /// This `struct` is created by [`QueueMapper::iter()`]. See its diff --git a/framework/base/src/storage/mappers/set_mapper.rs b/framework/base/src/storage/mappers/set_mapper.rs index 9ee6790a38..127164136a 100644 --- a/framework/base/src/storage/mappers/set_mapper.rs +++ b/framework/base/src/storage/mappers/set_mapper.rs @@ -150,6 +150,20 @@ where } } +impl<'a, SA, T> IntoIterator for &'a SetMapper +where + SA: StorageMapperApi, + T: TopEncode + TopDecode + NestedEncode + NestedDecode + 'static, +{ + type Item = T; + + type IntoIter = Iter<'a, SA, T>; + + fn into_iter(self) -> Self::IntoIter { + self.iter() + } +} + impl Extend for SetMapper where SA: StorageMapperApi, diff --git a/framework/base/src/storage/mappers/token.rs b/framework/base/src/storage/mappers/token.rs new file mode 100644 index 0000000000..3fa7032349 --- /dev/null +++ b/framework/base/src/storage/mappers/token.rs @@ -0,0 +1,11 @@ +mod fungible_token_mapper; +mod non_fungible_token_mapper; +mod token_attributes_mapper; +mod token_mapper; +mod token_mapper_state; + +pub use fungible_token_mapper::FungibleTokenMapper; +pub use non_fungible_token_mapper::NonFungibleTokenMapper; +pub use token_attributes_mapper::TokenAttributesMapper; +pub use token_mapper::StorageTokenWrapper; +pub use token_mapper_state::TokenMapperState; diff --git a/framework/base/src/storage/mappers/fungible_token_mapper.rs b/framework/base/src/storage/mappers/token/fungible_token_mapper.rs similarity index 70% rename from framework/base/src/storage/mappers/fungible_token_mapper.rs rename to framework/base/src/storage/mappers/token/fungible_token_mapper.rs index f2b6a4075e..5cc3b88e2a 100644 --- a/framework/base/src/storage/mappers/fungible_token_mapper.rs +++ b/framework/base/src/storage/mappers/token/fungible_token_mapper.rs @@ -1,20 +1,24 @@ -use crate::codec::{CodecFrom, EncodeErrorHandler, TopEncodeMulti, TopEncodeMultiOutput}; +use crate::{ + abi::TypeAbi, + api::ErrorApiImpl, + codec::{CodecFrom, EncodeErrorHandler, TopEncodeMulti, TopEncodeMultiOutput}, + storage_clear, storage_get, storage_set, +}; use super::{ - token_mapper::{ - read_token_id, store_token_id, StorageTokenWrapper, TOKEN_ID_ALREADY_SET_ERR_MSG, - }, - StorageMapper, + super::StorageMapper, + token_mapper::{check_not_set, store_token_id, StorageTokenWrapper, INVALID_TOKEN_ID_ERR_MSG}, + TokenMapperState, }; use crate::{ - abi::{TypeAbi, TypeName}, - api::{CallTypeApi, ErrorApiImpl, StorageMapperApi}, + abi::TypeName, + api::{CallTypeApi, StorageMapperApi}, contract_base::{BlockchainWrapper, SendWrapper}, esdt::{ESDTSystemSmartContractProxy, FungibleTokenProperties}, storage::StorageKey, types::{ BigUint, CallbackClosure, ContractCall, EsdtTokenPayment, EsdtTokenType, ManagedAddress, - ManagedBuffer, ManagedRef, ManagedType, TokenIdentifier, + ManagedBuffer, ManagedType, TokenIdentifier, }, }; @@ -27,7 +31,7 @@ where SA: StorageMapperApi + CallTypeApi, { key: StorageKey, - token_id: TokenIdentifier, + token_state: TokenMapperState, } impl StorageMapper for FungibleTokenMapper @@ -36,7 +40,7 @@ where { fn new(base_key: StorageKey) -> Self { Self { - token_id: read_token_id(base_key.as_ref()), + token_state: storage_get(base_key.as_ref()), key: base_key, } } @@ -46,21 +50,33 @@ impl StorageTokenWrapper for FungibleTokenMapper where SA: StorageMapperApi + CallTypeApi, { - fn get_storage_key(&self) -> ManagedRef> { + fn get_storage_key(&self) -> crate::types::ManagedRef> { self.key.as_ref() } + fn get_token_state(&self) -> TokenMapperState { + self.token_state.clone() + } + fn get_token_id(&self) -> TokenIdentifier { - self.token_id.clone() + if let TokenMapperState::Token(token) = &self.token_state { + token.clone() + } else { + SA::error_api_impl().signal_error(INVALID_TOKEN_ID_ERR_MSG) + } } fn get_token_id_ref(&self) -> &TokenIdentifier { - &self.token_id + if let TokenMapperState::Token(token) = &self.token_state { + token + } else { + SA::error_api_impl().signal_error(INVALID_TOKEN_ID_ERR_MSG); + } } fn set_token_id(&mut self, token_id: TokenIdentifier) { store_token_id(self, &token_id); - self.token_id = token_id; + self.token_state = TokenMapperState::Token(token_id); } } @@ -68,7 +84,22 @@ impl FungibleTokenMapper where SA: StorageMapperApi + CallTypeApi, { - /// Important: If you use custom callback, remember to save the token ID in the callback! + /// Important: If you use custom callback, remember to save the token ID in the callback and clear the mapper in case of error! Clear is unusable outside this specific case. + /// + /// #[callback] + /// fn my_custom_callback( + /// &self, + /// #[call_result] result: ManagedAsyncCallResult<()>, + /// ) { + /// match result { + /// ManagedAsyncCallResult::Ok(token_id) => { + /// self.fungible_token_mapper().set_token_id(token_id); + /// }, + /// ManagedAsyncCallResult::Err(_) => { + /// self.fungible_token_mapper().clear(); + /// }, + /// } + /// /// If you want to use default callbacks, import the default_issue_callbacks::DefaultIssueCallbacksModule from multiversx-sc-modules /// and pass None for the opt_callback argument pub fn issue( @@ -80,9 +111,7 @@ where num_decimals: usize, opt_callback: Option>, ) -> ! { - if !self.is_empty() { - SA::error_api_impl().signal_error(TOKEN_ID_ALREADY_SET_ERR_MSG); - } + check_not_set(self); let system_sc_proxy = ESDTSystemSmartContractProxy::::new_proxy_obj(); let callback = match opt_callback { @@ -94,6 +123,7 @@ where ..Default::default() }; + storage_set(self.get_storage_key(), &TokenMapperState::::Pending); system_sc_proxy .issue_fungible( issue_cost, @@ -107,7 +137,22 @@ where .call_and_exit(); } - /// Important: If you use custom callback, remember to save the token ID in the callback! + /// Important: If you use custom callback, remember to save the token ID in the callback and clear the mapper in case of error! Clear is unusable outside this specific case. + /// + /// #[callback] + /// fn my_custom_callback( + /// &self, + /// #[call_result] result: ManagedAsyncCallResult<()>, + /// ) { + /// match result { + /// ManagedAsyncCallResult::Ok(token_id) => { + /// self.fungible_token_mapper().set_token_id(token_id); + /// }, + /// ManagedAsyncCallResult::Err(_) => { + /// self.fungible_token_mapper().clear(); + /// }, + /// } + /// /// If you want to use default callbacks, import the default_issue_callbacks::DefaultIssueCallbacksModule from multiversx-sc-modules /// and pass None for the opt_callback argument pub fn issue_and_set_all_roles( @@ -118,9 +163,7 @@ where num_decimals: usize, opt_callback: Option>, ) -> ! { - if !self.is_empty() { - SA::error_api_impl().signal_error(TOKEN_ID_ALREADY_SET_ERR_MSG); - } + check_not_set(self); let system_sc_proxy = ESDTSystemSmartContractProxy::::new_proxy_obj(); let callback = match opt_callback { @@ -128,6 +171,7 @@ where None => self.default_callback_closure_obj(&BigUint::zero()), }; + storage_set(self.get_storage_key(), &TokenMapperState::::Pending); system_sc_proxy .issue_and_set_all_roles( issue_cost, @@ -141,6 +185,13 @@ where .call_and_exit(); } + pub fn clear(&mut self) { + let state: TokenMapperState = storage_get(self.key.as_ref()); + if state.is_pending() { + storage_clear(self.key.as_ref()); + } + } + fn default_callback_closure_obj(&self, initial_supply: &BigUint) -> CallbackClosure { let initial_caller = BlockchainWrapper::::new().get_caller(); let cb_name = if initial_supply > &0 { diff --git a/framework/base/src/storage/mappers/non_fungible_token_mapper.rs b/framework/base/src/storage/mappers/token/non_fungible_token_mapper.rs similarity index 81% rename from framework/base/src/storage/mappers/non_fungible_token_mapper.rs rename to framework/base/src/storage/mappers/token/non_fungible_token_mapper.rs index 16ad8e06c3..11207c70a3 100644 --- a/framework/base/src/storage/mappers/non_fungible_token_mapper.rs +++ b/framework/base/src/storage/mappers/token/non_fungible_token_mapper.rs @@ -1,13 +1,15 @@ -use crate::codec::{ - CodecFrom, EncodeErrorHandler, TopDecode, TopEncode, TopEncodeMulti, TopEncodeMultiOutput, +use crate::{ + codec::{ + CodecFrom, EncodeErrorHandler, TopDecode, TopEncode, TopEncodeMulti, TopEncodeMultiOutput, + }, + storage_clear, storage_get, storage_set, }; use super::{ + super::StorageMapper, fungible_token_mapper::DEFAULT_ISSUE_CALLBACK_NAME, - token_mapper::{ - read_token_id, store_token_id, StorageTokenWrapper, TOKEN_ID_ALREADY_SET_ERR_MSG, - }, - StorageMapper, + token_mapper::{check_not_set, store_token_id, StorageTokenWrapper, INVALID_TOKEN_ID_ERR_MSG}, + TokenMapperState, }; use crate::{ abi::{TypeAbi, TypeName}, @@ -32,7 +34,7 @@ where SA: StorageMapperApi + CallTypeApi, { key: StorageKey, - token_id: TokenIdentifier, + token_state: TokenMapperState, } impl StorageMapper for NonFungibleTokenMapper @@ -41,7 +43,7 @@ where { fn new(base_key: StorageKey) -> Self { Self { - token_id: read_token_id(base_key.as_ref()), + token_state: storage_get(base_key.as_ref()), key: base_key, } } @@ -55,17 +57,29 @@ where self.key.as_ref() } + fn get_token_state(&self) -> TokenMapperState { + self.token_state.clone() + } + fn get_token_id(&self) -> TokenIdentifier { - self.token_id.clone() + if let TokenMapperState::Token(token) = &self.token_state { + token.clone() + } else { + SA::error_api_impl().signal_error(INVALID_TOKEN_ID_ERR_MSG); + } } fn get_token_id_ref(&self) -> &TokenIdentifier { - &self.token_id + if let TokenMapperState::Token(token) = &self.token_state { + token + } else { + SA::error_api_impl().signal_error(INVALID_TOKEN_ID_ERR_MSG); + } } fn set_token_id(&mut self, token_id: TokenIdentifier) { store_token_id(self, &token_id); - self.token_id = token_id; + self.token_state = TokenMapperState::Token(token_id); } } @@ -73,7 +87,22 @@ impl NonFungibleTokenMapper where SA: StorageMapperApi + CallTypeApi, { - /// Important: If you use custom callback, remember to save the token ID in the callback! + /// Important: If you use custom callback, remember to save the token ID in the callback and clear the mapper in case of error! Clear is unusable outside this specific case. + /// + /// #[callback] + /// fn my_custom_callback( + /// &self, + /// #[call_result] result: ManagedAsyncCallResult<()>, + /// ) { + /// match result { + /// ManagedAsyncCallResult::Ok(token_id) => { + /// self.fungible_token_mapper().set_token_id(token_id); + /// }, + /// ManagedAsyncCallResult::Err(_) => { + /// self.fungible_token_mapper().clear(); + /// }, + /// } + /// /// If you want to use default callbacks, import the default_issue_callbacks::DefaultIssueCallbacksModule from multiversx-sc-modules /// and pass None for the opt_callback argument pub fn issue( @@ -85,9 +114,7 @@ where num_decimals: usize, opt_callback: Option>, ) -> ! { - if !self.is_empty() { - SA::error_api_impl().signal_error(TOKEN_ID_ALREADY_SET_ERR_MSG); - } + check_not_set(self); let callback = match opt_callback { Some(cb) => cb, @@ -106,13 +133,29 @@ where _ => SA::error_api_impl().signal_error(INVALID_TOKEN_TYPE_ERR_MSG), }; + storage_set(self.get_storage_key(), &TokenMapperState::::Pending); contract_call .async_call() .with_callback(callback) .call_and_exit(); } - /// Important: If you use custom callback, remember to save the token ID in the callback! + /// Important: If you use custom callback, remember to save the token ID in the callback and clear the mapper in case of error! Clear is unusable outside this specific case. + /// + /// #[callback] + /// fn my_custom_callback( + /// &self, + /// #[call_result] result: ManagedAsyncCallResult<()>, + /// ) { + /// match result { + /// ManagedAsyncCallResult::Ok(token_id) => { + /// self.fungible_token_mapper().set_token_id(token_id); + /// }, + /// ManagedAsyncCallResult::Err(_) => { + /// self.fungible_token_mapper().clear(); + /// }, + /// } + /// /// If you want to use default callbacks, import the default_issue_callbacks::DefaultIssueCallbacksModule from multiversx-sc-modules /// and pass None for the opt_callback argument pub fn issue_and_set_all_roles( @@ -124,9 +167,8 @@ where num_decimals: usize, opt_callback: Option>, ) -> ! { - if !self.is_empty() { - SA::error_api_impl().signal_error(TOKEN_ID_ALREADY_SET_ERR_MSG); - } + check_not_set(self); + if token_type == EsdtTokenType::Fungible || token_type == EsdtTokenType::Invalid { SA::error_api_impl().signal_error(INVALID_TOKEN_TYPE_ERR_MSG); } @@ -137,6 +179,7 @@ where None => self.default_callback_closure_obj(), }; + storage_set(self.get_storage_key(), &TokenMapperState::::Pending); system_sc_proxy .issue_and_set_all_roles( issue_cost, @@ -150,6 +193,13 @@ where .call_and_exit(); } + pub fn clear(&mut self) { + let state: TokenMapperState = storage_get(self.key.as_ref()); + if state.is_pending() { + storage_clear(self.key.as_ref()); + } + } + fn default_callback_closure_obj(&self) -> CallbackClosure { let initial_caller = BlockchainWrapper::::new().get_caller(); let cb_name = DEFAULT_ISSUE_CALLBACK_NAME; diff --git a/framework/base/src/storage/mappers/token_attributes_mapper.rs b/framework/base/src/storage/mappers/token/token_attributes_mapper.rs similarity index 99% rename from framework/base/src/storage/mappers/token_attributes_mapper.rs rename to framework/base/src/storage/mappers/token/token_attributes_mapper.rs index 1eceb87d71..33b00f56f3 100644 --- a/framework/base/src/storage/mappers/token_attributes_mapper.rs +++ b/framework/base/src/storage/mappers/token/token_attributes_mapper.rs @@ -2,7 +2,7 @@ use core::marker::PhantomData; use crate::codec::{NestedDecode, NestedEncode, TopDecode, TopEncode}; -use super::StorageMapper; +use super::super::StorageMapper; use crate::{ api::{ErrorApiImpl, ManagedTypeApi, StorageMapperApi}, storage::{storage_clear, storage_get, storage_get_len, storage_set, StorageKey}, diff --git a/framework/base/src/storage/mappers/token_mapper.rs b/framework/base/src/storage/mappers/token/token_mapper.rs similarity index 80% rename from framework/base/src/storage/mappers/token_mapper.rs rename to framework/base/src/storage/mappers/token/token_mapper.rs index 6b9f7e5018..e0867f7414 100644 --- a/framework/base/src/storage/mappers/token_mapper.rs +++ b/framework/base/src/storage/mappers/token/token_mapper.rs @@ -10,7 +10,10 @@ use crate::{ }, }; +use super::TokenMapperState; + pub(crate) const TOKEN_ID_ALREADY_SET_ERR_MSG: &[u8] = b"Token ID already set"; +pub(crate) const PENDING_ERR_MSG: &[u8] = b"Issue was already called"; pub(crate) const MUST_SET_TOKEN_ID_ERR_MSG: &[u8] = b"Must issue or set token ID first"; pub(crate) const INVALID_TOKEN_ID_ERR_MSG: &[u8] = b"Invalid token ID"; pub(crate) const INVALID_PAYMENT_TOKEN_ERR_MSG: &[u8] = b"Invalid payment token"; @@ -25,6 +28,8 @@ where storage_get_len(self.get_storage_key()) == 0 } + fn get_token_state(&self) -> TokenMapperState; + fn get_token_id(&self) -> TokenIdentifier; fn get_token_id_ref(&self) -> &TokenIdentifier; @@ -95,13 +100,6 @@ where } } -#[inline] -pub(crate) fn read_token_id( - storage_key: ManagedRef>, -) -> TokenIdentifier { - storage_get(storage_key) -} - pub(crate) fn store_token_id< SA: StorageMapperApi + CallTypeApi, Mapper: StorageTokenWrapper, @@ -109,12 +107,28 @@ pub(crate) fn store_token_id< mapper: &Mapper, token_id: &TokenIdentifier, ) { - if !mapper.is_empty() { + if mapper.get_token_state().is_set() { SA::error_api_impl().signal_error(TOKEN_ID_ALREADY_SET_ERR_MSG); } if !token_id.is_valid_esdt_identifier() { SA::error_api_impl().signal_error(INVALID_TOKEN_ID_ERR_MSG); } - - storage_set(mapper.get_storage_key(), token_id); + storage_set( + mapper.get_storage_key(), + &TokenMapperState::Token(token_id.clone()), + ); +} +pub(crate) fn check_not_set>( + mapper: &Mapper, +) { + let storage_value: TokenMapperState = storage_get(mapper.get_storage_key()); + match storage_value { + TokenMapperState::NotSet => {}, + TokenMapperState::Pending => { + SA::error_api_impl().signal_error(PENDING_ERR_MSG); + }, + TokenMapperState::Token(_) => { + SA::error_api_impl().signal_error(TOKEN_ID_ALREADY_SET_ERR_MSG); + }, + } } diff --git a/framework/base/src/storage/mappers/token/token_mapper_state.rs b/framework/base/src/storage/mappers/token/token_mapper_state.rs new file mode 100644 index 0000000000..7229ecc268 --- /dev/null +++ b/framework/base/src/storage/mappers/token/token_mapper_state.rs @@ -0,0 +1,73 @@ +use crate::{ + api::ManagedTypeApi, + codec::{self}, + types::{ManagedBuffer, TokenIdentifier}, +}; + +const PENDING_ENCODING: &[u8; 7] = b"pending"; + +#[derive(Default, Clone)] +pub enum TokenMapperState { + #[default] + NotSet, + Pending, + Token(TokenIdentifier), +} + +impl TokenMapperState { + pub fn is_set(&self) -> bool { + matches!(self, TokenMapperState::Token(_)) + } + + pub fn is_pending(&self) -> bool { + matches!(self, TokenMapperState::Pending) + } + + pub fn is_not_set(&self) -> bool { + matches!(self, TokenMapperState::NotSet) + } + + pub fn is_not_available(&self) -> bool { + matches!(self, TokenMapperState::Pending | TokenMapperState::NotSet) + } +} + +impl codec::TopEncode for TokenMapperState { + fn top_encode_or_handle_err( + &self, + output: O, + h: H, + ) -> core::result::Result<(), H::HandledErr> + where + O: codec::TopEncodeOutput, + H: codec::EncodeErrorHandler, + { + match self { + TokenMapperState::NotSet => codec::TopEncode::top_encode_or_handle_err(&"", output, h), + TokenMapperState::Pending => { + codec::TopEncode::top_encode_or_handle_err(&"pending", output, h) + }, + TokenMapperState::Token(token) => { + codec::TopEncode::top_encode_or_handle_err(&token, output, h) + }, + } + } +} + +impl codec::TopDecode for TokenMapperState { + fn top_decode_or_handle_err(input: I, h: H) -> core::result::Result + where + I: codec::TopDecodeInput, + H: codec::DecodeErrorHandler, + { + let decoded_input = ManagedBuffer::top_decode_or_handle_err(input, h)?; + if decoded_input.is_empty() { + Ok(TokenMapperState::NotSet) + } else if decoded_input == PENDING_ENCODING { + Ok(TokenMapperState::Pending) + } else { + let token_id = TokenIdentifier::from_esdt_bytes(decoded_input); + Ok(TokenMapperState::Token(token_id)) + } + } +} diff --git a/framework/base/src/storage/mappers/unique_id_mapper.rs b/framework/base/src/storage/mappers/unique_id_mapper.rs index 07e7f13a05..1d5b5df391 100644 --- a/framework/base/src/storage/mappers/unique_id_mapper.rs +++ b/framework/base/src/storage/mappers/unique_id_mapper.rs @@ -114,6 +114,19 @@ where } } +impl<'a, SA> IntoIterator for &'a UniqueIdMapper +where + SA: StorageMapperApi, +{ + type Item = usize; + + type IntoIter = Iter<'a, SA>; + + fn into_iter(self) -> Self::IntoIter { + self.iter() + } +} + pub struct Iter<'a, SA> where SA: StorageMapperApi, diff --git a/framework/base/src/storage/mappers/unordered_set_mapper.rs b/framework/base/src/storage/mappers/unordered_set_mapper.rs index fa408eec5d..6e52d62662 100644 --- a/framework/base/src/storage/mappers/unordered_set_mapper.rs +++ b/framework/base/src/storage/mappers/unordered_set_mapper.rs @@ -154,6 +154,21 @@ where true } + /// Exchanges the indexes of two values. Returns whether the operation was + /// successful. + pub fn swap_indexes(&mut self, index1: usize, index2: usize) -> bool { + if index1 == NULL_ENTRY || index2 == NULL_ENTRY { + return false; + } + let value1 = self.get_by_index(index1); + let value2 = self.get_by_index(index2); + self.vec_mapper.set(index2, &value1); + self.vec_mapper.set(index1, &value2); + self.set_index(&value1, index2); + self.set_index(&value2, index1); + true + } + /// An iterator visiting all elements in arbitrary order. /// The iterator element type is `&'a T`. pub fn iter(&self) -> Iter { @@ -161,6 +176,20 @@ where } } +impl<'a, SA, T> IntoIterator for &'a UnorderedSetMapper +where + SA: StorageMapperApi, + T: TopEncode + TopDecode + NestedEncode + NestedDecode + 'static, +{ + type Item = T; + + type IntoIter = Iter<'a, SA, T>; + + fn into_iter(self) -> Self::IntoIter { + self.iter() + } +} + impl Extend for UnorderedSetMapper where SA: StorageMapperApi, diff --git a/framework/base/src/storage/mappers/vec_mapper.rs b/framework/base/src/storage/mappers/vec_mapper.rs index ba8b986626..f0c761067f 100644 --- a/framework/base/src/storage/mappers/vec_mapper.rs +++ b/framework/base/src/storage/mappers/vec_mapper.rs @@ -203,7 +203,7 @@ where self.item_is_empty_unchecked_at_address(address, index) } - /// Get item at index from storage. + /// Set item at index in storage. /// Index must be valid (1 <= index <= count). pub fn set(&self, index: usize, item: &T) { if index == 0 || index > self.len() { @@ -280,6 +280,20 @@ where } } +impl<'a, SA, T> IntoIterator for &'a VecMapper +where + SA: StorageMapperApi, + T: TopEncode + TopDecode + 'static, +{ + type Item = T; + + type IntoIter = Iter<'a, SA, T>; + + fn into_iter(self) -> Self::IntoIter { + self.iter() + } +} + /// An iterator over the elements of a `VecMapper`. /// /// This `struct` is created by [`VecMapper::iter()`]. See its diff --git a/framework/base/src/types/io/operation_completion_status.rs b/framework/base/src/types/io/operation_completion_status.rs index 537b6b16b3..9971094725 100644 --- a/framework/base/src/types/io/operation_completion_status.rs +++ b/framework/base/src/types/io/operation_completion_status.rs @@ -1,10 +1,16 @@ use crate::{ - abi::{TypeAbi, TypeName}, + abi::{ + ExplicitEnumVariantDescription, TypeAbi, TypeContents, TypeDescription, + TypeDescriptionContainer, TypeName, + }, api::ManagedTypeApi, codec::{CodecFrom, EncodeErrorHandler, TopEncodeMulti, TopEncodeMultiOutput}, types::ManagedBuffer, }; +const COMPLETED_STR: &str = "completed"; +const INTERRUPTED_STR: &str = "interrupted"; + /// Standard way of signalling that an operation was interrupted early, before running out of gas. /// An endpoint that performs a longer operation can check from time to time if it is running low /// on gas and can decide to save its state and exit, so that it can continue the same operation later. @@ -17,8 +23,8 @@ pub enum OperationCompletionStatus { impl OperationCompletionStatus { pub fn output_bytes(&self) -> &'static [u8] { match self { - OperationCompletionStatus::Completed => b"completed", - OperationCompletionStatus::InterruptedBeforeOutOfGas => b"interrupted", + OperationCompletionStatus::Completed => COMPLETED_STR.as_bytes(), + OperationCompletionStatus::InterruptedBeforeOutOfGas => INTERRUPTED_STR.as_bytes(), } } @@ -49,6 +55,28 @@ impl TypeAbi for OperationCompletionStatus { fn type_name() -> TypeName { TypeName::from("OperationCompletionStatus") } + + fn provide_type_descriptions(accumulator: &mut TDC) { + let type_name = Self::type_name(); + + accumulator.insert( + type_name, + TypeDescription { + docs: &[], + name: Self::type_name(), + contents: TypeContents::ExplicitEnum([ + ExplicitEnumVariantDescription { + docs: &["indicates that operation was completed"], + name: COMPLETED_STR, + }, + ExplicitEnumVariantDescription { + docs: &["indicates that operation was interrupted prematurely, due to low gas"], + name: INTERRUPTED_STR, + } + ].to_vec()), + }, + ); + } } //////////////////////////////////////////////////////////////////////////////// diff --git a/framework/base/src/types/managed/basic/elliptic_curve.rs b/framework/base/src/types/managed/basic/elliptic_curve.rs index ee69d2d644..110f9a22d3 100644 --- a/framework/base/src/types/managed/basic/elliptic_curve.rs +++ b/framework/base/src/types/managed/basic/elliptic_curve.rs @@ -151,6 +151,7 @@ impl EllipticCurve { api.ec_is_on_curve(self.handle.clone(), x_point.handle, y_point.handle) } + #[deprecated(since = "0.41.0", note = "Please use method `scalar_mult` instead.")] pub fn scalar_mult_legacy( &self, x_point: BigUint, @@ -197,6 +198,10 @@ impl EllipticCurve { ) } + #[deprecated( + since = "0.41.0", + note = "Please use method `scalar_base_mult` instead." + )] pub fn scalar_base_mult_legacy(&self, data: &[u8]) -> (BigUint, BigUint) { let api = M::managed_type_impl(); let x_result_handle = api.bi_new_zero(); @@ -229,6 +234,7 @@ impl EllipticCurve { ) } + #[deprecated(since = "0.41.0", note = "Please use method `marshal` instead.")] #[cfg(feature = "alloc")] pub fn marshal_legacy( &self, @@ -250,6 +256,10 @@ impl EllipticCurve { ManagedBuffer::from_handle(result_handle) } + #[deprecated( + since = "0.41.0", + note = "Please use method `marshal_compressed` instead." + )] #[cfg(feature = "alloc")] pub fn marshal_compressed_legacy( &self, @@ -271,6 +281,7 @@ impl EllipticCurve { ManagedBuffer::from_handle(result_handle) } + #[deprecated(since = "0.41.0", note = "Please use method `unmarshal` instead.")] pub fn unmarshal_legacy(&self, data: &[u8]) -> (BigUint, BigUint) { let api = M::managed_type_impl(); let x_pair_handle = api.bi_new_zero(); @@ -303,6 +314,10 @@ impl EllipticCurve { ) } + #[deprecated( + since = "0.41.0", + note = "Please use method `unmarshal_compressed` instead." + )] pub fn unmarshal_compressed_legacy(&self, data: &[u8]) -> (BigUint, BigUint) { let api = M::managed_type_impl(); let x_pair_handle = api.bi_new_zero(); @@ -335,6 +350,7 @@ impl EllipticCurve { ) } + #[deprecated(since = "0.41.0", note = "Please use method `generate_key` instead.")] #[cfg(feature = "alloc")] pub fn generate_key_legacy(&self) -> (BigUint, BigUint, crate::types::heap::BoxedBytes) { let api = M::managed_type_impl(); diff --git a/framework/base/src/types/managed/multi_value/multi_value_managed_vec.rs b/framework/base/src/types/managed/multi_value/multi_value_managed_vec.rs index ed599e6787..a00042ed5b 100644 --- a/framework/base/src/types/managed/multi_value/multi_value_managed_vec.rs +++ b/framework/base/src/types/managed/multi_value/multi_value_managed_vec.rs @@ -132,6 +132,20 @@ where } } +impl<'a, M, T> IntoIterator for &'a MultiValueManagedVec +where + M: ManagedTypeApi, + T: ManagedVecItem, +{ + type Item = T::Ref<'a>; + + type IntoIter = ManagedVecRefIterator<'a, M, T>; + + fn into_iter(self) -> Self::IntoIter { + self.iter() + } +} + impl From> for MultiValueManagedVec where M: ManagedTypeApi, diff --git a/framework/base/src/types/managed/wrapped/managed_buffer_cached_builder.rs b/framework/base/src/types/managed/wrapped/managed_buffer_cached_builder.rs index 21d7021191..85d6c5a264 100644 --- a/framework/base/src/types/managed/wrapped/managed_buffer_cached_builder.rs +++ b/framework/base/src/types/managed/wrapped/managed_buffer_cached_builder.rs @@ -64,7 +64,7 @@ where } fn flush_to_managed_buffer(&mut self) { - let old_static_cache = core::mem::replace(&mut self.static_cache, None); + let old_static_cache = core::mem::take(&mut self.static_cache); if let Some(static_cache) = &old_static_cache { static_cache.with_buffer_contents(|bytes| { self.managed_buffer.append_bytes(bytes); @@ -85,8 +85,7 @@ where } pub fn append_managed_buffer(&mut self, item: &ManagedBuffer) { - let mut static_cache_mut = core::mem::replace(&mut self.static_cache, None); - if let Some(static_cache) = &mut static_cache_mut { + if let Some(static_cache) = &mut self.static_cache { let success = static_cache.try_extend_from_copy_bytes(item.len(), |dest_slice| { let _ = item.load_slice(0, dest_slice); }); @@ -97,7 +96,6 @@ where } else { self.managed_buffer.append(item); } - let _ = core::mem::replace(&mut self.static_cache, static_cache_mut); } /// Converts the input to hex and adds it to the current buffer. diff --git a/framework/base/src/types/managed/wrapped/managed_ref.rs b/framework/base/src/types/managed/wrapped/managed_ref.rs index 00154dd972..748c704956 100644 --- a/framework/base/src/types/managed/wrapped/managed_ref.rs +++ b/framework/base/src/types/managed/wrapped/managed_ref.rs @@ -49,6 +49,16 @@ where } } +impl<'a, M, T> ManagedRef<'a, M, T> +where + M: ManagedTypeApi, + T: ManagedType + Clone, +{ + pub fn clone_value(&self) -> T { + self.deref().clone() + } +} + impl<'a, M, T> Clone for ManagedRef<'a, M, T> where M: ManagedTypeApi, diff --git a/framework/base/src/types/managed/wrapped/managed_vec_item.rs b/framework/base/src/types/managed/wrapped/managed_vec_item.rs index 7b10ee5354..100a85ec14 100644 --- a/framework/base/src/types/managed/wrapped/managed_vec_item.rs +++ b/framework/base/src/types/managed/wrapped/managed_vec_item.rs @@ -1,4 +1,4 @@ -use core::borrow::Borrow; +use core::{borrow::Borrow, mem::MaybeUninit}; use crate::{ api::ManagedTypeApi, @@ -8,11 +8,6 @@ use crate::{ }, }; -/// We assume that no payloads will exceed this value. -/// This limit cannot be determined at compile-time for types with generics, due to current Rust compiler contraints. -/// TODO: find a way to validate this assumption, if possible at compile time. -const MAX_PAYLOAD_SIZE: usize = 200; - /// Types that implement this trait can be items inside a `ManagedVec`. /// All these types need a payload, i.e a representation that gets stored /// in the underlying managed buffer. @@ -131,21 +126,21 @@ impl ManagedVecItem for bool { impl ManagedVecItem for Option where + [(); 1 + T::PAYLOAD_SIZE]:, T: ManagedVecItem, { - const PAYLOAD_SIZE: usize = u8::PAYLOAD_SIZE + T::PAYLOAD_SIZE; + const PAYLOAD_SIZE: usize = 1 + T::PAYLOAD_SIZE; const SKIPS_RESERIALIZATION: bool = false; type Ref<'a> = Self; fn from_byte_reader(mut reader: Reader) -> Self { - let mut arr: [u8; MAX_PAYLOAD_SIZE] = [0u8; MAX_PAYLOAD_SIZE]; - let slice = &mut arr[..Self::PAYLOAD_SIZE]; - reader(slice); - if slice[0] == 0 { + let mut byte_arr: [u8; 1 + T::PAYLOAD_SIZE] = [0u8; 1 + T::PAYLOAD_SIZE]; + reader(&mut byte_arr[..]); + if byte_arr[0] == 0 { None } else { Some(T::from_byte_reader(|bytes| { - bytes.copy_from_slice(&slice[1..]); + bytes.copy_from_slice(&byte_arr[1..]); })) } } @@ -157,15 +152,14 @@ where } fn to_byte_writer R>(&self, mut writer: Writer) -> R { - let mut arr: [u8; MAX_PAYLOAD_SIZE] = [0u8; MAX_PAYLOAD_SIZE]; - let slice = &mut arr[..Self::PAYLOAD_SIZE]; + let mut byte_arr: [u8; 1 + T::PAYLOAD_SIZE] = [0u8; 1 + T::PAYLOAD_SIZE]; if let Some(t) = self { - slice[0] = 1; + byte_arr[0] = 1; T::to_byte_writer(t, |bytes| { - slice[1..].copy_from_slice(bytes); + byte_arr[1..].copy_from_slice(bytes); }); } - writer(slice) + writer(&byte_arr[..]) } } @@ -230,15 +224,28 @@ where } } -impl ManagedVecItem for [u8; N] { - const PAYLOAD_SIZE: usize = N; - const SKIPS_RESERIALIZATION: bool = true; +impl ManagedVecItem for [T; N] +where + [(); T::PAYLOAD_SIZE * N]:, + T: ManagedVecItem, +{ + const PAYLOAD_SIZE: usize = T::PAYLOAD_SIZE * N; + const SKIPS_RESERIALIZATION: bool = T::SKIPS_RESERIALIZATION; type Ref<'a> = Self; fn from_byte_reader(mut reader: Reader) -> Self { - let mut array: [u8; N] = [0u8; N]; - reader(&mut array[..]); - array + let mut byte_arr: [u8; T::PAYLOAD_SIZE * N] = [0; T::PAYLOAD_SIZE * N]; + reader(&mut byte_arr[..]); + let mut result: [T; N] = unsafe { MaybeUninit::zeroed().assume_init() }; + let mut from_index = 0; + for item in result.iter_mut() { + let to_index = from_index + T::PAYLOAD_SIZE; + *item = T::from_byte_reader(|bytes| { + bytes.copy_from_slice(&byte_arr[from_index..to_index]); + }); + from_index = to_index; + } + result } unsafe fn from_byte_reader_as_borrow<'a, Reader: FnMut(&mut [u8])>( @@ -248,7 +255,16 @@ impl ManagedVecItem for [u8; N] { } fn to_byte_writer R>(&self, mut writer: Writer) -> R { - writer(self.as_slice()) + let mut byte_arr: [u8; T::PAYLOAD_SIZE * N] = [0; T::PAYLOAD_SIZE * N]; + let mut from_index = 0; + for item in self { + let to_index = from_index + T::PAYLOAD_SIZE; + item.to_byte_writer(|bytes| { + byte_arr[from_index..to_index].copy_from_slice(bytes); + }); + from_index = to_index; + } + writer(&byte_arr[..]) } } diff --git a/framework/base/src/types/managed/wrapped/token_identifier.rs b/framework/base/src/types/managed/wrapped/token_identifier.rs index 80e0f675b4..329b3f2b3d 100644 --- a/framework/base/src/types/managed/wrapped/token_identifier.rs +++ b/framework/base/src/types/managed/wrapped/token_identifier.rs @@ -69,9 +69,9 @@ impl TokenIdentifier { pub fn ticker(&self) -> ManagedBuffer { let token_id_len = self.buffer.len(); let ticker_len = M::managed_type_impl().get_token_ticker_len(token_id_len); - self.buffer.copy_slice(0, ticker_len).unwrap_or_else(|| { - M::error_api_impl().signal_error(err_msg::BAD_TOKEN_TICKER_FORMAT) - }) + self.buffer + .copy_slice(0, ticker_len) + .unwrap_or_else(|| M::error_api_impl().signal_error(err_msg::BAD_TOKEN_TICKER_FORMAT)) } } diff --git a/framework/base/src/types/static_buffer/sparse_array.rs b/framework/base/src/types/static_buffer/sparse_array.rs index 8657f93020..2c6ddd61e2 100644 --- a/framework/base/src/types/static_buffer/sparse_array.rs +++ b/framework/base/src/types/static_buffer/sparse_array.rs @@ -119,6 +119,19 @@ where } } +impl<'a, E, const CAPACITY: usize> IntoIterator for &'a SparseArray +where + E: ErrorApi, +{ + type Item = usize; + + type IntoIter = SparseArrayIterator<'a, E, CAPACITY>; + + fn into_iter(self) -> Self::IntoIter { + self.iter() + } +} + pub struct SparseArrayIterator<'a, E, const CAPACITY: usize> where E: ErrorApi, diff --git a/framework/derive/Cargo.toml b/framework/derive/Cargo.toml index af820956a5..0828d90b24 100644 --- a/framework/derive/Cargo.toml +++ b/framework/derive/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "multiversx-sc-derive" -version = "0.39.7" +version = "0.41.3" edition = "2021" authors = ["Andrei Marinica ", "MultiversX "] diff --git a/framework/derive/src/generate/proxy_gen.rs b/framework/derive/src/generate/proxy_gen.rs index f58d88ed36..bc44d03b95 100644 --- a/framework/derive/src/generate/proxy_gen.rs +++ b/framework/derive/src/generate/proxy_gen.rs @@ -75,7 +75,7 @@ pub fn generate_proxy_endpoint(m: &Method, endpoint_name: String) -> proc_macro2 let mut payment_count = 0; let mut payment_expr = quote! { multiversx_sc::types::BigUint::::zero() }; let mut multi_count = 0; - let mut multi_expr = quote! { multiversx_sc::types::ManagedVec::>::new() }; + let mut multi_expr_opt = None; let mut arg_push_snippets = Vec::::new(); @@ -105,7 +105,7 @@ pub fn generate_proxy_endpoint(m: &Method, endpoint_name: String) -> proc_macro2 ArgPaymentMetadata::PaymentMulti => { multi_count += 1; let pat = &arg.pat; - multi_expr = quote! { #pat }; + multi_expr_opt = Some(quote! { #pat }); }, } } @@ -154,12 +154,13 @@ pub fn generate_proxy_endpoint(m: &Method, endpoint_name: String) -> proc_macro2 }; } } else if multi_count > 0 { + let multi_expr = multi_expr_opt.unwrap(); contract_call_type = quote! { multiversx_sc::types::ContractCallWithMultiEsdt }; contract_call_init = quote! { let mut ___contract_call___ = multiversx_sc::types::ContractCallWithMultiEsdt::new( ___address___, #endpoint_name, - #multi_expr, + #multi_expr.clone_value(), ); }; } else { diff --git a/framework/meta/Cargo.toml b/framework/meta/Cargo.toml index 4168187d91..4cf57a6b2d 100644 --- a/framework/meta/Cargo.toml +++ b/framework/meta/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "multiversx-sc-meta" -version = "0.39.7" +version = "0.41.3" edition = "2021" authors = [ @@ -40,9 +40,11 @@ colored = "2.0" pathdiff = "0.2.1" common-path = "1.0.0" lazy_static = "1.4.0" +convert_case = "0.6.0" +hex = "0.4" [dependencies.multiversx-sc] -version = "=0.39.7" +version = "=0.41.3" path = "../base" features = ["alloc", "num-bigint", "promises", "big-float"] diff --git a/framework/meta/src/abi_json/mod.rs b/framework/meta/src/abi_json.rs similarity index 71% rename from framework/meta/src/abi_json/mod.rs rename to framework/meta/src/abi_json.rs index 0675a1c912..7059896279 100644 --- a/framework/meta/src/abi_json/mod.rs +++ b/framework/meta/src/abi_json.rs @@ -30,13 +30,15 @@ pub fn print_abi() { /// Will return the main contract ABI + view contract ABI. pub fn abi_to_json_dummy_environment(contract_abi: &ContractAbi) -> String { let mut abi_json = ContractAbiJson::from(contract_abi); - abi_json.build_info.contract_crate.git_version = "".to_string(); - abi_json.build_info.rustc = RustcAbiJson { - version: "x.x.x-nightly".to_string(), - commit_hash: "".to_string(), - commit_date: "".to_string(), - channel: "Channel".to_string(), - short: "rustc ( )".to_string(), - }; + if let Some(build_info) = &mut abi_json.build_info { + build_info.contract_crate.git_version = "".to_string(); + build_info.rustc = RustcAbiJson { + version: "x.x.x-nightly".to_string(), + commit_hash: "".to_string(), + commit_date: "".to_string(), + channel: "Channel".to_string(), + short: "rustc ( )".to_string(), + }; + } serialize_abi_to_json(&abi_json) } diff --git a/framework/meta/src/abi_json/contract_abi_json.rs b/framework/meta/src/abi_json/contract_abi_json.rs index 2d8e42bb32..88b813cf78 100644 --- a/framework/meta/src/abi_json/contract_abi_json.rs +++ b/framework/meta/src/abi_json/contract_abi_json.rs @@ -6,7 +6,9 @@ use std::collections::BTreeMap; #[derive(Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct ContractAbiJson { - pub build_info: BuildInfoAbiJson, + #[serde(default)] + #[serde(skip_serializing_if = "Option::is_none")] + pub build_info: Option, #[serde(skip_serializing_if = "Vec::is_empty")] pub docs: Vec, pub name: String, @@ -21,7 +23,7 @@ pub struct ContractAbiJson { impl From<&ContractAbi> for ContractAbiJson { fn from(abi: &ContractAbi) -> Self { let mut contract_json = ContractAbiJson { - build_info: BuildInfoAbiJson::from(&abi.build_info), + build_info: Some(BuildInfoAbiJson::from(&abi.build_info)), docs: abi.docs.iter().map(|d| d.to_string()).collect(), name: abi.name.to_string(), constructor: abi.constructors.get(0).map(ConstructorAbiJson::from), diff --git a/framework/meta/src/abi_json/type_abi_json.rs b/framework/meta/src/abi_json/type_abi_json.rs index a07343c214..fb1e0f8ba3 100644 --- a/framework/meta/src/abi_json/type_abi_json.rs +++ b/framework/meta/src/abi_json/type_abi_json.rs @@ -19,9 +19,10 @@ pub struct TypeDescriptionJson { impl From<&TypeDescription> for TypeDescriptionJson { fn from(abi: &TypeDescription) -> Self { let content_type = match &abi.contents { - TypeContents::NotSpecified => "not_specified", + TypeContents::NotSpecified => "not-specified", TypeContents::Enum(_) => "enum", TypeContents::Struct(_) => "struct", + TypeContents::ExplicitEnum(_) => "explicit-enum", }; let mut type_desc_json = TypeDescriptionJson { content_type: content_type.to_string(), @@ -44,6 +45,13 @@ impl From<&TypeDescription> for TypeDescriptionJson { .push(EnumVariantDescriptionJson::from(variant)); } }, + TypeContents::ExplicitEnum(variants) => { + for variant in variants { + type_desc_json + .variants + .push(EnumVariantDescriptionJson::from(variant)); + } + }, _ => {}, } @@ -75,7 +83,8 @@ pub struct EnumVariantDescriptionJson { #[serde(skip_serializing_if = "Vec::is_empty")] pub docs: Vec, pub name: String, - pub discriminant: usize, + #[serde(skip_serializing_if = "Option::is_none")] + pub discriminant: Option, #[serde(skip_serializing_if = "Vec::is_empty")] pub fields: Vec, } @@ -85,7 +94,7 @@ impl From<&EnumVariantDescription> for EnumVariantDescriptionJson { EnumVariantDescriptionJson { docs: abi.docs.iter().map(|d| d.to_string()).collect(), name: abi.name.to_string(), - discriminant: abi.discriminant, + discriminant: Some(abi.discriminant), fields: abi .fields .iter() @@ -94,3 +103,14 @@ impl From<&EnumVariantDescription> for EnumVariantDescriptionJson { } } } + +impl From<&ExplicitEnumVariantDescription> for EnumVariantDescriptionJson { + fn from(abi: &ExplicitEnumVariantDescription) -> Self { + EnumVariantDescriptionJson { + docs: abi.docs.iter().map(|d| d.to_string()).collect(), + name: abi.name.to_string(), + discriminant: None, + fields: Vec::new(), + } + } +} diff --git a/framework/meta/src/cli_args/mod.rs b/framework/meta/src/cli_args.rs similarity index 100% rename from framework/meta/src/cli_args/mod.rs rename to framework/meta/src/cli_args.rs diff --git a/framework/meta/src/cli_args/cli_args_standalone.rs b/framework/meta/src/cli_args/cli_args_standalone.rs index 5587ab463d..e490429129 100644 --- a/framework/meta/src/cli_args/cli_args_standalone.rs +++ b/framework/meta/src/cli_args/cli_args_standalone.rs @@ -1,6 +1,6 @@ use std::path::PathBuf; -use clap::{ArgAction, Args, Parser, Subcommand}; +use clap::{arg, ArgAction, Args, Parser, Subcommand}; use super::{CliArgsToRaw, ContractCliAction}; @@ -59,6 +59,11 @@ pub enum StandaloneCliAction { about = "Creates a contract by a pre-existing template" )] TemplateList, + #[command( + name = "test-gen", + about = "Generates Rust integration tests based on scenarios provided in the scenarios folder of each contract." + )] + TestGen(TestGenArgs), } #[derive(Default, Clone, PartialEq, Eq, Debug, Args)] @@ -156,3 +161,20 @@ impl CliArgsToRaw for TemplateArgs { Vec::new() } } + +#[derive(Default, Clone, PartialEq, Eq, Debug, Args)] +pub struct TestGenArgs { + /// Target directory where to generate contract integration tests. + /// Will be current directory if not specified. + #[arg(long, verbatim_doc_comment)] + pub path: Option, + + /// Ignore all directories with these names. + #[arg(long, verbatim_doc_comment)] + #[clap(global = true, default_value = "target")] + pub ignore: Vec, + + /// Creates test files if they don't exist. + #[arg(long, verbatim_doc_comment)] + pub create: bool, +} diff --git a/framework/meta/src/cmd.rs b/framework/meta/src/cmd.rs new file mode 100644 index 0000000000..85b25de6ea --- /dev/null +++ b/framework/meta/src/cmd.rs @@ -0,0 +1,2 @@ +pub mod contract; +pub mod standalone; diff --git a/framework/meta/src/meta_cli.rs b/framework/meta/src/cmd/contract.rs similarity index 54% rename from framework/meta/src/meta_cli.rs rename to framework/meta/src/cmd/contract.rs index 14072ec600..9399ec20d3 100644 --- a/framework/meta/src/meta_cli.rs +++ b/framework/meta/src/cmd/contract.rs @@ -1,38 +1,16 @@ -use super::{ - meta_config::MetaConfig, meta_validate_abi::validate_abi, output_contract::OutputContractConfig, -}; -use crate::{ - cli_args::{ContractCliAction, ContractCliArgs, StandaloneCliAction, StandaloneCliArgs}, - local_deps::local_deps, - meta_all::call_all_meta, - meta_info::call_info, - sc_upgrade::upgrade_sc, - template::{print_template_names, template_download}, -}; +mod generate_snippets; +mod meta_abi; +mod meta_config; +pub mod output_contract; + +mod validate_abi; + +use crate::cli_args::{ContractCliAction, ContractCliArgs}; use clap::Parser; +use meta_config::MetaConfig; use multiversx_sc::contract_base::ContractAbiProvider; - -/// Entry point in the program when calling it as a standalone tool. -pub async fn cli_main_standalone() { - let cli_args = StandaloneCliArgs::parse(); - match &cli_args.command { - Some(StandaloneCliAction::Info(args)) => call_info(args), - Some(StandaloneCliAction::All(args)) => call_all_meta(args), - Some(StandaloneCliAction::Upgrade(args)) => { - upgrade_sc(args); - }, - Some(StandaloneCliAction::LocalDeps(args)) => { - local_deps(args); - }, - Some(StandaloneCliAction::Template(args)) => { - template_download(args).await; - }, - Some(StandaloneCliAction::TemplateList) => { - print_template_names().await; - }, - None => {}, - } -} +use output_contract::OutputContractGlobalConfig; +use validate_abi::validate_abi; /// Entry point in the program from the contract meta crates. pub fn cli_main() { @@ -66,10 +44,13 @@ fn process_abi(cli_args: &ContractCliArgs) -> MetaC pub fn multi_contract_config( multi_contract_config_toml_path: &str, -) -> OutputContractConfig { +) -> OutputContractGlobalConfig { let original_contract_abi = ::abi(); validate_abi(&original_contract_abi).expect("Invalid contract structure"); - OutputContractConfig::load_from_file(multi_contract_config_toml_path, &original_contract_abi) - .unwrap_or_else(|| panic!("could not find file {multi_contract_config_toml_path}")) + OutputContractGlobalConfig::load_from_file( + multi_contract_config_toml_path, + &original_contract_abi, + ) + .unwrap_or_else(|| panic!("could not find file {multi_contract_config_toml_path}")) } diff --git a/framework/meta/src/generate_snippets/mod.rs b/framework/meta/src/cmd/contract/generate_snippets.rs similarity index 100% rename from framework/meta/src/generate_snippets/mod.rs rename to framework/meta/src/cmd/contract/generate_snippets.rs diff --git a/framework/meta/src/generate_snippets/snippet_crate_gen.rs b/framework/meta/src/cmd/contract/generate_snippets/snippet_crate_gen.rs similarity index 100% rename from framework/meta/src/generate_snippets/snippet_crate_gen.rs rename to framework/meta/src/cmd/contract/generate_snippets/snippet_crate_gen.rs diff --git a/framework/meta/src/generate_snippets/snippet_gen_common.rs b/framework/meta/src/cmd/contract/generate_snippets/snippet_gen_common.rs similarity index 100% rename from framework/meta/src/generate_snippets/snippet_gen_common.rs rename to framework/meta/src/cmd/contract/generate_snippets/snippet_gen_common.rs diff --git a/framework/meta/src/generate_snippets/snippet_gen_main.rs b/framework/meta/src/cmd/contract/generate_snippets/snippet_gen_main.rs similarity index 96% rename from framework/meta/src/generate_snippets/snippet_gen_main.rs rename to framework/meta/src/cmd/contract/generate_snippets/snippet_gen_main.rs index 467dfa0ae9..e46ffa83a7 100644 --- a/framework/meta/src/generate_snippets/snippet_gen_main.rs +++ b/framework/meta/src/cmd/contract/generate_snippets/snippet_gen_main.rs @@ -2,9 +2,10 @@ use std::fs::File; use multiversx_sc::abi::ContractAbi; -use crate::{cli_args::GenerateSnippetsArgs, meta_config::MetaConfig}; +use crate::cli_args::GenerateSnippetsArgs; use super::{ + super::meta_config::MetaConfig, snippet_crate_gen::{ create_and_get_lib_file, create_snippets_cargo_toml, create_snippets_folder, create_snippets_gitignore, create_src_folder, diff --git a/framework/meta/src/generate_snippets/snippet_sc_functions_gen.rs b/framework/meta/src/cmd/contract/generate_snippets/snippet_sc_functions_gen.rs similarity index 100% rename from framework/meta/src/generate_snippets/snippet_sc_functions_gen.rs rename to framework/meta/src/cmd/contract/generate_snippets/snippet_sc_functions_gen.rs diff --git a/framework/meta/src/generate_snippets/snippet_template_gen.rs b/framework/meta/src/cmd/contract/generate_snippets/snippet_template_gen.rs similarity index 100% rename from framework/meta/src/generate_snippets/snippet_template_gen.rs rename to framework/meta/src/cmd/contract/generate_snippets/snippet_template_gen.rs diff --git a/framework/meta/src/generate_snippets/snippet_type_map.rs b/framework/meta/src/cmd/contract/generate_snippets/snippet_type_map.rs similarity index 100% rename from framework/meta/src/generate_snippets/snippet_type_map.rs rename to framework/meta/src/cmd/contract/generate_snippets/snippet_type_map.rs diff --git a/framework/meta/src/meta_abi.rs b/framework/meta/src/cmd/contract/meta_abi.rs similarity index 64% rename from framework/meta/src/meta_abi.rs rename to framework/meta/src/cmd/contract/meta_abi.rs index 9edb06c3a1..6aa620b588 100644 --- a/framework/meta/src/meta_abi.rs +++ b/framework/meta/src/cmd/contract/meta_abi.rs @@ -1,7 +1,6 @@ use std::{ fs::{create_dir_all, File}, io::Write, - process::{Command, Output}, }; use crate::abi_json::{serialize_abi_to_json, ContractAbiJson}; @@ -10,7 +9,9 @@ use super::{meta_config::MetaConfig, output_contract::OutputContract}; fn write_contract_abi(output_contract: &OutputContract, git_version: &str, output_path: &str) { let mut abi_json = ContractAbiJson::from(&output_contract.abi); - abi_json.build_info.contract_crate.git_version = git_version.to_string(); + if let Some(build_info) = &mut abi_json.build_info { + build_info.contract_crate.git_version = git_version.to_string(); + } let abi_string = serialize_abi_to_json(&abi_json); let abi_file_path = format!("{output_path}/{}", output_contract.abi_output_name(),); @@ -36,23 +37,6 @@ impl MetaConfig { return String::new(); } - Command::new("git") - .args(["describe"]) - .output() - .map(git_describe_process_output) - .unwrap_or_default() - } -} - -fn git_describe_process_output(output: Output) -> String { - if output.status.success() { - let mut result = String::from_utf8(output.stdout).unwrap_or_default(); - if result.ends_with('\n') { - // for some reason we get a trailing newline - let _ = result.pop(); - } - result - } else { - String::new() + crate::tools::git_describe() } } diff --git a/framework/meta/src/meta_config.rs b/framework/meta/src/cmd/contract/meta_config.rs similarity index 94% rename from framework/meta/src/meta_config.rs rename to framework/meta/src/cmd/contract/meta_config.rs index e94017a4b1..12b983dd5a 100644 --- a/framework/meta/src/meta_config.rs +++ b/framework/meta/src/cmd/contract/meta_config.rs @@ -2,11 +2,9 @@ use std::fs; use multiversx_sc::abi::ContractAbi; -use crate::{ - meta_wasm_tools::check_tools_installed, output_contract::OutputContract, CargoTomlContents, -}; +use crate::{cli_args::BuildArgs, tools::post_build::check_tools_installed, CargoTomlContents}; -use super::{cli_args::BuildArgs, output_contract::OutputContractConfig}; +use super::output_contract::{OutputContract, OutputContractGlobalConfig}; const OUTPUT_RELATIVE_PATH: &str = "../output"; const SNIPPETS_RELATIVE_PATH: &str = "../interact-rs"; @@ -20,12 +18,12 @@ pub struct MetaConfig { pub output_dir: String, pub snippets_dir: String, pub original_contract_abi: ContractAbi, - pub output_contracts: OutputContractConfig, + pub output_contracts: OutputContractGlobalConfig, } impl MetaConfig { pub fn create(original_contract_abi: ContractAbi, load_abi_git_version: bool) -> MetaConfig { - let output_contracts = OutputContractConfig::load_from_file_or_default( + let output_contracts = OutputContractGlobalConfig::load_from_file_or_default( MULTI_CONTRACT_CONFIG_RELATIVE_PATH, &original_contract_abi, ); diff --git a/framework/meta/src/cmd/contract/output_contract.rs b/framework/meta/src/cmd/contract/output_contract.rs new file mode 100644 index 0000000000..bc65a28267 --- /dev/null +++ b/framework/meta/src/cmd/contract/output_contract.rs @@ -0,0 +1,16 @@ +mod multi_contract_serde; +mod oc_builder; +mod oc_config; +mod oc_global_config; +mod oc_settings; +mod wasm_build; +mod wasm_clean; +mod wasm_crate_gen; +mod wasm_update; + +pub use multi_contract_serde::*; +pub use oc_builder::*; +pub use oc_config::OutputContract; +pub use oc_global_config::OutputContractGlobalConfig; +pub use oc_settings::OutputContractSettings; +pub use wasm_build::*; diff --git a/framework/meta/src/output_contract/multi_contract_serde.rs b/framework/meta/src/cmd/contract/output_contract/multi_contract_serde.rs similarity index 85% rename from framework/meta/src/output_contract/multi_contract_serde.rs rename to framework/meta/src/cmd/contract/output_contract/multi_contract_serde.rs index 0de0fefeb8..d54515e5a6 100644 --- a/framework/meta/src/output_contract/multi_contract_serde.rs +++ b/framework/meta/src/cmd/contract/output_contract/multi_contract_serde.rs @@ -36,6 +36,16 @@ pub struct OutputContractSerde { #[serde(rename = "panic-message")] pub panic_message: Option, + #[serde(default)] + pub ei: Option, + + #[serde(default)] + pub allocator: Option, + + #[serde(default)] + #[serde(rename = "stack-size")] + pub stack_size: Option, + #[serde(default)] pub features: Vec, } diff --git a/framework/meta/src/output_contract/output_contract_builder.rs b/framework/meta/src/cmd/contract/output_contract/oc_builder.rs similarity index 96% rename from framework/meta/src/output_contract/output_contract_builder.rs rename to framework/meta/src/cmd/contract/output_contract/oc_builder.rs index e6e63bdc2b..9ee7408cd9 100644 --- a/framework/meta/src/output_contract/output_contract_builder.rs +++ b/framework/meta/src/cmd/contract/output_contract/oc_builder.rs @@ -6,7 +6,8 @@ use std::{ }; use super::{ - MultiContractConfigSerde, OutputContract, OutputContractConfig, OutputContractSerde, + oc_settings::{parse_allocator, parse_check_ei, parse_stack_size}, + MultiContractConfigSerde, OutputContract, OutputContractGlobalConfig, OutputContractSerde, OutputContractSettings, }; @@ -54,6 +55,9 @@ impl OutputContractBuilder { settings: OutputContractSettings { external_view: cms.external_view.unwrap_or_default(), panic_message: cms.panic_message.unwrap_or_default(), + check_ei: parse_check_ei(&cms.ei), + allocator: parse_allocator(&cms.allocator), + stack_size: parse_stack_size(&cms.stack_size), features: cms.features.clone(), }, ..Default::default() @@ -237,7 +241,7 @@ fn validate_output_contracts(contracts: &[OutputContract]) { } } -impl OutputContractConfig { +impl OutputContractGlobalConfig { /// Assembles an `OutputContractConfig` from a raw config object that was loaded via Serde. /// /// In most cases the config will be loaded from a .toml file, use `load_from_file` for that. @@ -257,7 +261,7 @@ impl OutputContractConfig { .collect(); set_main_contract_flag(&mut contracts, &config.settings.main); validate_output_contracts(&contracts); - OutputContractConfig { + OutputContractGlobalConfig { default_contract_config_name: config.settings.main.clone().unwrap_or_default(), contracts, } @@ -269,7 +273,7 @@ impl OutputContractConfig { pub fn default_config(original_abi: &ContractAbi) -> Self { let default_contract_config_name = original_abi.build_info.contract_crate.name.to_string(); let wasm_crate_name = default_wasm_crate_name(&default_contract_config_name); - OutputContractConfig { + OutputContractGlobalConfig { default_contract_config_name: default_contract_config_name.clone(), contracts: vec![OutputContract { main: true, diff --git a/framework/meta/src/output_contract/output_contract_model.rs b/framework/meta/src/cmd/contract/output_contract/oc_config.rs similarity index 66% rename from framework/meta/src/output_contract/output_contract_model.rs rename to framework/meta/src/cmd/contract/output_contract/oc_config.rs index b581da142d..f5d3cf8109 100644 --- a/framework/meta/src/output_contract/output_contract_model.rs +++ b/framework/meta/src/cmd/contract/output_contract/oc_config.rs @@ -1,83 +1,6 @@ -use multiversx_sc::abi::ContractAbi; - +use super::OutputContractSettings; use crate::cli_args::BuildArgs; - -pub const DEFAULT_LABEL: &str = "default"; - -#[derive(Debug)] -pub struct OutputContractConfig { - pub default_contract_config_name: String, - pub contracts: Vec, -} - -impl OutputContractConfig { - pub fn main_contract(&self) -> &OutputContract { - self.contracts - .iter() - .find(|contract| contract.main) - .unwrap_or_else(|| { - panic!( - "Could not find default contract '{}' among the output contracts.", - self.default_contract_config_name - ) - }) - } - - pub fn main_contract_mut(&mut self) -> &mut OutputContract { - self.contracts - .iter_mut() - .find(|contract| contract.main) - .unwrap_or_else(|| { - panic!( - "Could not find default contract '{}' among the output contracts.", - self.default_contract_config_name - ) - }) - } - - pub fn secondary_contracts(&self) -> impl Iterator { - self.contracts.iter().filter(move |contract| !contract.main) - } - - pub fn secondary_contracts_mut(&mut self) -> impl Iterator { - self.contracts - .iter_mut() - .filter(move |contract| !contract.main) - } - - pub fn get_contract_by_id(&self, contract_id: String) -> Option<&OutputContract> { - self.contracts - .iter() - .find(|contract| contract.contract_id == contract_id) - } - - pub fn get_contract_by_name(&self, contract_name: String) -> Option<&OutputContract> { - self.contracts - .iter() - .find(|contract| contract.contract_name == contract_name) - } - - /// Yields the contract with the given public name. - pub fn find_contract(&self, contract_name: &str) -> &OutputContract { - self.contracts - .iter() - .find(|contract| contract.contract_name == contract_name) - .unwrap_or_else(|| panic!("output contract {contract_name} not found")) - } -} - -#[derive(Default, Clone, PartialEq, Eq)] -pub struct OutputContractSettings { - /// External view contracts are just readers of data from another contract. - pub external_view: bool, - - /// Panic messages add a lot of bloat to the final bytecode, - /// so they should only be used for debugging purposes. - pub panic_message: bool, - - /// Features that are activated on the contract crate, from wasm. - pub features: Vec, -} +use multiversx_sc::abi::ContractAbi; /// Represents a contract created by the framework when building. /// @@ -171,6 +94,10 @@ impl OutputContract { format!("{}.wat", self.output_name_base(build_args)) } + pub fn mxsc_file_output_name(&self, build_args: &BuildArgs) -> String { + format!("{}.mxsc.json", self.output_name_base(build_args)) + } + pub fn imports_json_output_name(&self, build_args: &BuildArgs) -> String { format!("{}.imports.json", self.output_name_base(build_args)) } diff --git a/framework/meta/src/cmd/contract/output_contract/oc_global_config.rs b/framework/meta/src/cmd/contract/output_contract/oc_global_config.rs new file mode 100644 index 0000000000..b5c9c97a6a --- /dev/null +++ b/framework/meta/src/cmd/contract/output_contract/oc_global_config.rs @@ -0,0 +1,66 @@ +use super::OutputContract; + +/// An entire project configuration. +/// +/// It can contain one or several output contracts. +#[derive(Debug)] +pub struct OutputContractGlobalConfig { + pub default_contract_config_name: String, + pub contracts: Vec, +} + +impl OutputContractGlobalConfig { + pub fn main_contract(&self) -> &OutputContract { + self.contracts + .iter() + .find(|contract| contract.main) + .unwrap_or_else(|| { + panic!( + "Could not find default contract '{}' among the output contracts.", + self.default_contract_config_name + ) + }) + } + + pub fn main_contract_mut(&mut self) -> &mut OutputContract { + self.contracts + .iter_mut() + .find(|contract| contract.main) + .unwrap_or_else(|| { + panic!( + "Could not find default contract '{}' among the output contracts.", + self.default_contract_config_name + ) + }) + } + + pub fn secondary_contracts(&self) -> impl Iterator { + self.contracts.iter().filter(move |contract| !contract.main) + } + + pub fn secondary_contracts_mut(&mut self) -> impl Iterator { + self.contracts + .iter_mut() + .filter(move |contract| !contract.main) + } + + pub fn get_contract_by_id(&self, contract_id: String) -> Option<&OutputContract> { + self.contracts + .iter() + .find(|contract| contract.contract_id == contract_id) + } + + pub fn get_contract_by_name(&self, contract_name: String) -> Option<&OutputContract> { + self.contracts + .iter() + .find(|contract| contract.contract_name == contract_name) + } + + /// Yields the contract with the given public name. + pub fn find_contract(&self, contract_name: &str) -> &OutputContract { + self.contracts + .iter() + .find(|contract| contract.contract_name == contract_name) + .unwrap_or_else(|| panic!("output contract {contract_name} not found")) + } +} diff --git a/framework/meta/src/cmd/contract/output_contract/oc_settings.rs b/framework/meta/src/cmd/contract/output_contract/oc_settings.rs new file mode 100644 index 0000000000..6c3659f7ce --- /dev/null +++ b/framework/meta/src/cmd/contract/output_contract/oc_settings.rs @@ -0,0 +1,44 @@ +mod oc_allocator; +mod oc_parse; +mod oc_parse_stack_size; + +pub use oc_allocator::ContractAllocator; +pub use oc_parse::*; +pub use oc_parse_stack_size::*; + +use crate::ei::EIVersion; + +/// Collection of flags, specified in the multicontract config. +#[derive(Clone, PartialEq, Eq)] +pub struct OutputContractSettings { + /// External view contracts are just readers of data from another contract. + pub external_view: bool, + + /// Panic messages add a lot of bloat to the final bytecode, + /// so they should only be used for debugging purposes. + pub panic_message: bool, + + /// Post-processing check of the VM hooks is based on this. + pub check_ei: Option, + + /// Allocator config, i.e which allocator to choose for the contract. + pub allocator: ContractAllocator, + + pub stack_size: usize, + + /// Features that are activated on the contract crate, from wasm. + pub features: Vec, +} + +impl Default for OutputContractSettings { + fn default() -> Self { + OutputContractSettings { + external_view: Default::default(), + panic_message: Default::default(), + check_ei: Some(EIVersion::default()), + allocator: Default::default(), + stack_size: DEFAULT_STACK_SIZE, + features: Default::default(), + } + } +} diff --git a/framework/meta/src/cmd/contract/output_contract/oc_settings/oc_allocator.rs b/framework/meta/src/cmd/contract/output_contract/oc_settings/oc_allocator.rs new file mode 100644 index 0000000000..6b2b6c2317 --- /dev/null +++ b/framework/meta/src/cmd/contract/output_contract/oc_settings/oc_allocator.rs @@ -0,0 +1,46 @@ +#[derive(Default, Clone, PartialEq, Eq)] +pub enum ContractAllocator { + /// No allocation is allowed. Any attempt causes `signalError` to be thrown. + #[default] + AllocationForbidden, + + /// An allocator that never deallocates. It calls memory grow to reserve memory chuncks. + LeakingAllocator, + + /// An allocator that uses a statically pre-allocated chunk of memory, of 64kb. + /// + /// It also never deallocates. + StaticAllocator64K, + + /// Uses wee-alloc, but wee-alloc needs to be explicitly imported by the contract wasm crate. + /// + /// Mostly present for historical reasons, or if in some extreme case the contract needs deallocation. + WeeAlloc, +} + +impl ContractAllocator { + pub fn parse(s: &str) -> Option { + match s { + "fail" => Some(ContractAllocator::AllocationForbidden), + "leaking" => Some(ContractAllocator::LeakingAllocator), + "static64k" => Some(ContractAllocator::StaticAllocator64K), + "wee_alloc" => Some(ContractAllocator::WeeAlloc), + _ => None, + } + } + + pub fn parse_or_panic(s: &str) -> Self { + Self::parse(s).unwrap_or_else(|| { + panic!("Unknown allocator option '{s}'. Valid options are: 'fail', 'leaking', 'static64k', 'wee_alloc'.") + }) + } + + pub fn to_allocator_macro_selector(&self) -> &'static str { + match self { + ContractAllocator::AllocationForbidden => "", + ContractAllocator::LeakingAllocator => "leaking", + ContractAllocator::StaticAllocator64K => "static64k", + ContractAllocator::WeeAlloc => "wee_alloc", + } + } +} diff --git a/framework/meta/src/cmd/contract/output_contract/oc_settings/oc_parse.rs b/framework/meta/src/cmd/contract/output_contract/oc_settings/oc_parse.rs new file mode 100644 index 0000000000..b3fb5ef27d --- /dev/null +++ b/framework/meta/src/cmd/contract/output_contract/oc_settings/oc_parse.rs @@ -0,0 +1,24 @@ +use crate::ei::EIVersion; + +use super::ContractAllocator; + +pub fn parse_check_ei(ei: &Option) -> Option { + if let Some(ei_name) = ei { + if ei_name == "ignore" { + None + } else { + let ei_version = EIVersion::from_name(ei_name) + .unwrap_or_else(|| panic!("invalid EI version: {ei_name}")); + Some(ei_version) + } + } else { + Some(EIVersion::default()) + } +} + +pub fn parse_allocator(allocator: &Option) -> ContractAllocator { + allocator + .as_ref() + .map(|s| ContractAllocator::parse_or_panic(s)) + .unwrap_or_default() +} diff --git a/framework/meta/src/cmd/contract/output_contract/oc_settings/oc_parse_stack_size.rs b/framework/meta/src/cmd/contract/output_contract/oc_settings/oc_parse_stack_size.rs new file mode 100644 index 0000000000..6e0ddb3fd7 --- /dev/null +++ b/framework/meta/src/cmd/contract/output_contract/oc_settings/oc_parse_stack_size.rs @@ -0,0 +1,48 @@ +/// The WebAssembly page size, in bytes. +pub const WASM_PAGE_SIZE: usize = 65536; + +pub const DEFAULT_STACK_SIZE: usize = 2 * WASM_PAGE_SIZE; + +pub const STACK_SIZE_SUFFIX_KILO: &str = "k"; +pub const STACK_SIZE_SUFFIX_PAGES: &str = "pages"; +pub const STACK_SIZE_MULIPLIER_KILO: usize = 1024; + +pub fn parse_stack_size(stack_size: &Option) -> usize { + if let Some(stack_size_str) = stack_size { + parse_stack_size_expr(stack_size_str) + } else { + DEFAULT_STACK_SIZE + } +} + +fn parse_stack_size_expr(stack_size_str: &str) -> usize { + if let Some(s) = stack_size_str.strip_suffix(STACK_SIZE_SUFFIX_KILO) { + parse_stack_size_str(s) * STACK_SIZE_MULIPLIER_KILO + } else if let Some(s) = stack_size_str.strip_suffix(STACK_SIZE_SUFFIX_PAGES) { + parse_stack_size_str(s) * WASM_PAGE_SIZE + } else { + parse_stack_size_str(stack_size_str) + } +} + +fn parse_stack_size_str(s: &str) -> usize { + s.trim() + .parse() + .unwrap_or_else(|_| panic!("could not parse stack size expression: {s}")) +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_parse_stack_size_expr() { + assert_eq!(parse_stack_size_expr("1234"), 1234); + assert_eq!(parse_stack_size_expr("1k"), 1024); + assert_eq!(parse_stack_size_expr("2 k"), 2 * 1024); + assert_eq!(parse_stack_size_expr(" 10 k"), 10 * 1024); + assert_eq!(parse_stack_size_expr("1 pages"), 65536); + assert_eq!(parse_stack_size_expr("2 pages"), 65536 * 2); + assert_eq!(parse_stack_size_expr("10 pages"), 65536 * 10); + } +} diff --git a/framework/meta/src/output_contract/wasm_build.rs b/framework/meta/src/cmd/contract/output_contract/wasm_build.rs similarity index 58% rename from framework/meta/src/output_contract/wasm_build.rs rename to framework/meta/src/cmd/contract/output_contract/wasm_build.rs index f4da057d2b..071ac1e151 100644 --- a/framework/meta/src/output_contract/wasm_build.rs +++ b/framework/meta/src/cmd/contract/output_contract/wasm_build.rs @@ -1,10 +1,14 @@ -use std::{fs, process::Command}; - -use super::{ - print_util::{print_build_command, print_copy_contract}, - OutputContract, +use std::{ffi::OsStr, fs, process::Command}; + +use super::OutputContract; +use crate::{ + abi_json::ContractAbiJson, + cli_args::BuildArgs, + ei::EIVersion, + mxsc_file_json::{save_mxsc_file_json, MxscFileJson}, + print_util::*, + tools::post_build, }; -use crate::{cli_args::BuildArgs, meta_wasm_tools}; impl OutputContract { pub fn build_contract(&self, build_args: &BuildArgs, output_path: &str) { @@ -34,41 +38,42 @@ impl OutputContract { if let Some(target_dir) = &build_args.target_dir { command.args(["--target-dir", target_dir]); } - let rustflags = compose_rustflags(build_args); + let rustflags = self.compose_rustflags(build_args); if !rustflags.is_empty() { command.env("RUSTFLAGS", rustflags); } command } -} -fn compose_rustflags(build_args: &BuildArgs) -> String { - let mut rustflags = String::new(); - if !build_args.wasm_symbols { - rustflags.push_str("-C link-arg=-s"); - } - if build_args.emit_mir { - if !rustflags.is_empty() { - rustflags.push(' '); + fn compose_rustflags(&self, build_args: &BuildArgs) -> Rustflags { + let mut rustflags = Rustflags::default(); + + if !build_args.wasm_symbols { + rustflags.push_flag("-C link-arg=-s"); } - rustflags.push_str("--emit=mir"); - } - if build_args.emit_llvm_ir { - if !rustflags.is_empty() { - rustflags.push(' '); + + rustflags.push_flag(&format!( + "-C link-arg=-zstack-size={}", + self.settings.stack_size + )); + + if build_args.emit_mir { + rustflags.push_flag("--emit=mir"); + } + + if build_args.emit_llvm_ir { + rustflags.push_flag("--emit=llvm-ir"); } - rustflags.push_str("--emit=llvm-ir"); + rustflags } - rustflags -} -impl OutputContract { fn finalize_build(&self, build_args: &BuildArgs, output_path: &str) { self.copy_contracts_to_output(build_args, output_path); self.run_wasm_opt(build_args, output_path); self.run_wasm2wat(build_args, output_path); self.extract_imports(build_args, output_path); self.run_twiggy(build_args, output_path); + self.pack_mxsc_file(build_args, output_path); } fn copy_contracts_to_output(&self, build_args: &BuildArgs, output_path: &str) { @@ -79,13 +84,31 @@ impl OutputContract { .expect("failed to copy compiled contract to output directory"); } + fn pack_mxsc_file(&self, build_args: &BuildArgs, output_path: &str) { + let output_wasm_path = format!("{output_path}/{}", self.wasm_output_name(build_args)); + let compiled_bytes = fs::read(output_wasm_path).expect("failed to open compiled contract"); + let output_mxsc_path = format!("{output_path}/{}", self.mxsc_file_output_name(build_args)); + print_pack_mxsc_file(&output_mxsc_path); + print_contract_size(compiled_bytes.len()); + let mut abi = ContractAbiJson::from(&self.abi); + let build_info = core::mem::take(&mut abi.build_info).unwrap(); + let mxsc_file_json = MxscFileJson { + build_info, + abi, + size: compiled_bytes.len(), + code: hex::encode(compiled_bytes), + }; + save_mxsc_file_json(&mxsc_file_json, output_mxsc_path); + } + fn run_wasm_opt(&self, build_args: &BuildArgs, output_path: &str) { if !build_args.wasm_opt { return; } let output_wasm_path = format!("{output_path}/{}", self.wasm_output_name(build_args)); - meta_wasm_tools::run_wasm_opt(output_wasm_path.as_str()); + print_call_wasm_opt(&output_wasm_path); + post_build::run_wasm_opt(output_wasm_path.as_str()); } fn run_wasm2wat(&self, build_args: &BuildArgs, output_path: &str) { @@ -95,7 +118,8 @@ impl OutputContract { let output_wasm_path = format!("{output_path}/{}", self.wasm_output_name(build_args)); let output_wat_path = format!("{output_path}/{}", self.wat_output_name(build_args)); - meta_wasm_tools::run_wasm2wat(output_wasm_path.as_str(), output_wat_path.as_str()); + print_call_wasm2wat(&output_wasm_path, &output_wat_path); + post_build::run_wasm2wat(output_wasm_path.as_str(), output_wat_path.as_str()); } fn extract_imports(&self, build_args: &BuildArgs, output_path: &str) { @@ -109,9 +133,11 @@ impl OutputContract { output_path, self.imports_json_output_name(build_args) ); - let result = meta_wasm_tools::run_wasm_objdump(output_wasm_path.as_str()); - let import_names = meta_wasm_tools::parse_imports(result.as_str()); + print_extract_imports(&output_imports_json_path); + let result = post_build::run_wasm_objdump(output_wasm_path.as_str()); + let import_names = post_build::parse_imports(result.as_str()); write_imports_output(output_imports_json_path.as_str(), import_names.as_slice()); + validate_ei(&import_names, &self.settings.check_ei); } } @@ -120,6 +146,24 @@ fn write_imports_output(dest_path: &str, import_names: &[String]) { fs::write(dest_path, json).expect("failed to write imports json file"); } +fn validate_ei(import_names: &[String], check_ei: &Option) { + if let Some(ei) = check_ei { + print_check_ei(ei.name()); + let mut num_errors = 0; + for import_name in import_names { + if !ei.contains_vm_hook(import_name) { + print_invalid_vm_hook(import_name, ei.name()); + num_errors += 1; + } + } + if num_errors == 0 { + print_check_ei_ok(); + } + } else { + print_ignore_ei_check(); + } +} + impl OutputContract { fn run_twiggy(&self, build_args: &BuildArgs, output_path: &str) { if build_args.has_twiggy_call() { @@ -128,7 +172,7 @@ impl OutputContract { if build_args.twiggy_top { let output_twiggy_top_path = format!("{output_path}/{}", self.twiggy_top_name(build_args)); - meta_wasm_tools::run_twiggy_top( + post_build::run_twiggy_top( output_wasm_path.as_str(), output_twiggy_top_path.as_str(), ); @@ -136,7 +180,7 @@ impl OutputContract { if build_args.twiggy_paths { let output_twiggy_paths_path = format!("{output_path}/{}", self.twiggy_paths_name(build_args)); - meta_wasm_tools::run_twiggy_paths( + post_build::run_twiggy_paths( output_wasm_path.as_str(), output_twiggy_paths_path.as_str(), ); @@ -144,7 +188,7 @@ impl OutputContract { if build_args.twiggy_monos { let output_twiggy_monos_path = format!("{output_path}/{}", self.twiggy_monos_name(build_args)); - meta_wasm_tools::run_twiggy_monos( + post_build::run_twiggy_monos( output_wasm_path.as_str(), output_twiggy_monos_path.as_str(), ); @@ -152,7 +196,7 @@ impl OutputContract { if build_args.twiggy_dominators { let output_twiggy_dominators_path = format!("{output_path}/{}", self.twiggy_dominators_name(build_args)); - meta_wasm_tools::run_twiggy_dominators( + post_build::run_twiggy_dominators( output_wasm_path.as_str(), output_twiggy_dominators_path.as_str(), ); @@ -160,3 +204,26 @@ impl OutputContract { } } } + +/// For convenience, for building rustflags. +#[derive(Default)] +struct Rustflags(String); + +impl Rustflags { + fn push_flag(&mut self, s: &str) { + if !self.0.is_empty() { + self.0.push(' '); + } + self.0.push_str(s); + } + + fn is_empty(&self) -> bool { + self.0.is_empty() + } +} + +impl AsRef for Rustflags { + fn as_ref(&self) -> &OsStr { + self.0.as_ref() + } +} diff --git a/framework/meta/src/output_contract/wasm_clean.rs b/framework/meta/src/cmd/contract/output_contract/wasm_clean.rs similarity index 100% rename from framework/meta/src/output_contract/wasm_clean.rs rename to framework/meta/src/cmd/contract/output_contract/wasm_clean.rs diff --git a/framework/meta/src/output_contract/wasm_crate_gen.rs b/framework/meta/src/cmd/contract/output_contract/wasm_crate_gen.rs similarity index 91% rename from framework/meta/src/output_contract/wasm_crate_gen.rs rename to framework/meta/src/cmd/contract/output_contract/wasm_crate_gen.rs index 8ae8955374..7d0b134988 100644 --- a/framework/meta/src/output_contract/wasm_crate_gen.rs +++ b/framework/meta/src/cmd/contract/output_contract/wasm_crate_gen.rs @@ -20,9 +20,8 @@ const NUM_ASYNC_CB: usize = 1; const PREFIX_NO_STD: &str = " #![no_std] -#![feature(alloc_error_handler, lang_items)] +#![feature(lang_items)] -multiversx_sc_wasm_adapter::allocator!(); "; impl OutputContract { @@ -31,6 +30,13 @@ impl OutputContract { fs::create_dir_all(PathBuf::from(&self.wasm_crate_path()).join("src")).unwrap(); } + fn allocator_macro_invocation(&self) -> String { + format!( + "multiversx_sc_wasm_adapter::allocator!({});", + self.settings.allocator.to_allocator_macro_selector() + ) + } + fn panic_handler_macro_invocation(&self) -> &'static str { if self.settings.panic_message { "multiversx_sc_wasm_adapter::panic_handler_with_message!();" @@ -62,9 +68,8 @@ impl OutputContract { self.write_stat_comments(wasm_lib_file); wasm_lib_file.write_all(PREFIX_NO_STD.as_bytes()).unwrap(); - wasm_lib_file - .write_all(self.panic_handler_macro_invocation().as_bytes()) - .unwrap(); + writeln!(wasm_lib_file, "{}", self.allocator_macro_invocation()).unwrap(); + writeln!(wasm_lib_file, "{}", self.panic_handler_macro_invocation()).unwrap(); let mut all_endpoint_names = explicit_endpoint_names; if self.abi.has_callback { @@ -124,7 +129,7 @@ fn write_endpoints_macro<'a, I>( ) where I: Iterator, { - writeln!(wasm_lib_file, "\n").unwrap(); + writeln!(wasm_lib_file).unwrap(); writeln!(wasm_lib_file, "{full_macro_name} {{").unwrap(); writeln!(wasm_lib_file, " {contract_module_name}").unwrap(); writeln!(wasm_lib_file, " (").unwrap(); diff --git a/framework/meta/src/output_contract/wasm_update.rs b/framework/meta/src/cmd/contract/output_contract/wasm_update.rs similarity index 100% rename from framework/meta/src/output_contract/wasm_update.rs rename to framework/meta/src/cmd/contract/output_contract/wasm_update.rs diff --git a/framework/meta/src/meta_validate_abi.rs b/framework/meta/src/cmd/contract/validate_abi.rs similarity index 100% rename from framework/meta/src/meta_validate_abi.rs rename to framework/meta/src/cmd/contract/validate_abi.rs diff --git a/framework/meta/src/cmd/standalone.rs b/framework/meta/src/cmd/standalone.rs new file mode 100644 index 0000000000..1730f489b3 --- /dev/null +++ b/framework/meta/src/cmd/standalone.rs @@ -0,0 +1,41 @@ +mod all; +mod info; +mod local_deps; +pub mod scen_test_gen; +mod upgrade; + +use crate::{ + cli_args::{StandaloneCliAction, StandaloneCliArgs}, + template::{print_template_names, template_download}, +}; +use all::call_all_meta; +use clap::Parser; +use info::call_info; +use local_deps::local_deps; +use scen_test_gen::test_gen_tool; +use upgrade::upgrade_sc; + +/// Entry point in the program when calling it as a standalone tool. +pub async fn cli_main_standalone() { + let cli_args = StandaloneCliArgs::parse(); + match &cli_args.command { + Some(StandaloneCliAction::Info(args)) => call_info(args), + Some(StandaloneCliAction::All(args)) => call_all_meta(args), + Some(StandaloneCliAction::Upgrade(args)) => { + upgrade_sc(args); + }, + Some(StandaloneCliAction::LocalDeps(args)) => { + local_deps(args); + }, + Some(StandaloneCliAction::Template(args)) => { + template_download(args).await; + }, + Some(StandaloneCliAction::TemplateList) => { + print_template_names().await; + }, + Some(StandaloneCliAction::TestGen(args)) => { + test_gen_tool(args); + }, + None => {}, + } +} diff --git a/framework/meta/src/meta_all.rs b/framework/meta/src/cmd/standalone/all.rs similarity index 79% rename from framework/meta/src/meta_all.rs rename to framework/meta/src/cmd/standalone/all.rs index 609fef0d75..f05379ea56 100644 --- a/framework/meta/src/meta_all.rs +++ b/framework/meta/src/cmd/standalone/all.rs @@ -1,10 +1,9 @@ use std::{path::Path, process::Command}; -use colored::Colorize; - use crate::{ cli_args::{AllArgs, CliArgsToRaw}, folder_structure::{dir_pretty_print, RelevantDirectories}, + print_util::{print_all_command, print_all_count, print_all_index}, }; pub fn call_all_meta(args: &AllArgs) { @@ -21,15 +20,15 @@ fn perform_call_all_meta(path: impl AsRef, ignore: &[String], raw_args: Ve let dirs = RelevantDirectories::find_all(path, ignore); dir_pretty_print(dirs.iter_contract_crates(), "", &|_| {}); - println!( - "Found {} contract crates.\n", - dirs.iter_contract_crates().count(), - ); + let num_contract_crates = dirs.iter_contract_crates().count(); + print_all_count(num_contract_crates); + if dirs.is_empty() { return; } - for contract_crate in dirs.iter_contract_crates() { + for (i, contract_crate) in dirs.iter_contract_crates().enumerate() { + print_all_index(i + 1, num_contract_crates); call_contract_meta(contract_crate.path.as_path(), raw_args.as_slice()); } } @@ -42,12 +41,7 @@ pub fn call_contract_meta(contract_crate_path: &Path, cargo_run_args: &[String]) meta_path.as_path().display() ); - println!( - "\n{} `cargo run {}` in {}", - "Calling".green(), - cargo_run_args.join(" "), - meta_path.as_path().display(), - ); + print_all_command(meta_path.as_path(), cargo_run_args); let exit_status = Command::new("cargo") .current_dir(&meta_path) diff --git a/framework/meta/src/meta_info.rs b/framework/meta/src/cmd/standalone/info.rs similarity index 86% rename from framework/meta/src/meta_info.rs rename to framework/meta/src/cmd/standalone/info.rs index b184951be2..a806aa1997 100644 --- a/framework/meta/src/meta_info.rs +++ b/framework/meta/src/cmd/standalone/info.rs @@ -1,7 +1,7 @@ +use super::upgrade::{print_tree_dir_metadata, DEFAULT_LAST_VERSION}; use crate::{ cli_args::InfoArgs, folder_structure::{dir_pretty_print, RelevantDirectories}, - sc_upgrade::{print_tree_dir_metadata, DEFAULT_LAST_VERSION}, }; pub fn call_info(args: &InfoArgs) { diff --git a/framework/meta/src/local_deps.rs b/framework/meta/src/cmd/standalone/local_deps.rs similarity index 100% rename from framework/meta/src/local_deps.rs rename to framework/meta/src/cmd/standalone/local_deps.rs diff --git a/framework/meta/src/cmd/standalone/scen_test_gen.rs b/framework/meta/src/cmd/standalone/scen_test_gen.rs new file mode 100644 index 0000000000..f8ee80be7f --- /dev/null +++ b/framework/meta/src/cmd/standalone/scen_test_gen.rs @@ -0,0 +1,22 @@ +mod stg_main; +mod stg_parse; +mod stg_print; +mod stg_process_code; +mod stg_section; +mod stg_write; + +use crate::cli_args::TestGenArgs; + +pub fn test_gen_tool(args: &TestGenArgs) { + let path = if let Some(some_path) = &args.path { + some_path.as_str() + } else { + "./" + }; + + stg_main::perform_test_gen_all(path, args.ignore.as_slice(), args.create); +} + +// Good for testing. +pub use stg_process_code::process_code; +pub use stg_write::{format_test_fn_go, format_test_fn_rs, WriteTestFn}; diff --git a/framework/meta/src/cmd/standalone/scen_test_gen/stg_main.rs b/framework/meta/src/cmd/standalone/scen_test_gen/stg_main.rs new file mode 100644 index 0000000000..bcf0da057d --- /dev/null +++ b/framework/meta/src/cmd/standalone/scen_test_gen/stg_main.rs @@ -0,0 +1,143 @@ +use std::{ + collections::BTreeSet, + fs::{self, File}, + io::Write, + path::{Path, PathBuf}, +}; + +use crate::folder_structure::{RelevantDirectories, RelevantDirectory}; + +use super::{ + process_code, + stg_print::print_no_folder, + stg_write::{format_test_fn_go, format_test_fn_rs, DEFAULT_TEST_GO, DEFAULT_TEST_RS}, + WriteTestFn, +}; + +const TESTS_DIR_NAME: &str = "tests"; +const SCENARIOS_DIR_NAME: &str = "scenarios"; + +pub fn perform_test_gen_all(path: impl AsRef, ignore: &[String], create: bool) { + let root_path = path.as_ref(); + let dirs = RelevantDirectories::find_all(root_path, ignore); + + for contract_dir in dirs.iter_contract_crates() { + perform_test_gen(contract_dir, create); + } +} + +fn perform_test_gen(contract_dir: &RelevantDirectory, create: bool) { + let contract_dir_path = &contract_dir.path; + let scenarios_dir = contract_dir_path.join(SCENARIOS_DIR_NAME); + if !scenarios_dir.is_dir() { + print_no_folder(contract_dir_path, SCENARIOS_DIR_NAME); + return; + } + let scenario_names = find_scenario_names(&scenarios_dir); + + let test_dir = contract_dir_path.join(TESTS_DIR_NAME); + if !test_dir.is_dir() { + if create { + fs::create_dir_all(&test_dir).unwrap(); + } else { + print_no_folder(contract_dir_path, TESTS_DIR_NAME); + return; + } + } + + process_file( + ProcessFileConfig { + suffix: "scenario_go_test.rs", + default_impl: DEFAULT_TEST_GO, + write_test_fn: format_test_fn_go, + }, + ProcessFileContext { + test_dir: &test_dir, + crate_name: &contract_dir.dir_name_underscores(), + create_flag: create, + scenario_names: &scenario_names, + }, + ); + + process_file( + ProcessFileConfig { + suffix: "scenario_rs_test.rs", + default_impl: DEFAULT_TEST_RS, + write_test_fn: format_test_fn_rs, + }, + ProcessFileContext { + test_dir: &test_dir, + crate_name: &contract_dir.dir_name_underscores(), + create_flag: create, + scenario_names: &scenario_names, + }, + ); +} + +struct ProcessFileConfig<'a> { + suffix: &'a str, + default_impl: &'a str, + write_test_fn: WriteTestFn, +} + +struct ProcessFileContext<'a> { + test_dir: &'a Path, + crate_name: &'a str, + create_flag: bool, + scenario_names: &'a BTreeSet, +} + +fn process_file(config: ProcessFileConfig, context: ProcessFileContext) { + let existing_file_path = find_test_file(context.test_dir, config.suffix); + + if existing_file_path.is_none() && !context.create_flag { + return; + } + + let existing_code = if let Some(file_path) = &existing_file_path { + fs::read_to_string(file_path).expect("could not read test file") + } else { + config.default_impl.to_string() + }; + + let new_code = process_code(&existing_code, context.scenario_names, config.write_test_fn); + let file_path = if let Some(file_path) = &existing_file_path { + file_path.clone() + } else { + let file_name = format!("{}_{}", context.crate_name, config.suffix); + context.test_dir.join(file_name) + }; + let mut file = File::create(file_path).unwrap(); + write!(file, "{new_code}").unwrap(); +} + +fn find_test_file(test_dir: &Path, suffix: &str) -> Option { + let read_dir = fs::read_dir(test_dir).expect("error reading directory"); + for file_result in read_dir { + let file = file_result.unwrap(); + if !file.file_type().unwrap().is_file() { + continue; + } + let file_name = file.file_name().into_string().unwrap(); + if file_name.ends_with(suffix) { + return Some(file.path()); + } + } + None +} + +fn find_scenario_names(scenarios_dir: &Path) -> BTreeSet { + let mut result = BTreeSet::new(); + let read_dir = fs::read_dir(scenarios_dir).expect("error reading directory"); + for file_result in read_dir { + let file = file_result.unwrap(); + if !file.file_type().unwrap().is_file() { + continue; + } + let file_name = file.file_name().into_string().unwrap(); + if let Some(scenario_name) = file_name.strip_suffix(".scen.json") { + result.insert(scenario_name.to_string()); + } + } + result +} diff --git a/framework/meta/src/cmd/standalone/scen_test_gen/stg_parse.rs b/framework/meta/src/cmd/standalone/scen_test_gen/stg_parse.rs new file mode 100644 index 0000000000..79801a2b26 --- /dev/null +++ b/framework/meta/src/cmd/standalone/scen_test_gen/stg_parse.rs @@ -0,0 +1,94 @@ +use super::stg_section::ScenarioTestFn; + +pub const TEST_ANNOTATION: &str = "#[test]"; +pub const IGNORE_ANNOTATION: &str = "#[ignore]"; +pub const IGNORE_ANNOTATION_PREFIX: &str = "#[ignore"; +pub const SCEN_PATTERN_PREFIX: &str = "\"scenarios/"; +pub const SCEN_PATTERN_SUFFIX: &str = ".scen.json\""; + +pub fn parse_section(section_str: &str) -> Option { + let mut docs = String::new(); + let mut ignore_line = None; + let mut opt_test_line = None; + let mut all_commented_out = true; + let mut opt_scenario_file_name = None; + + for line in section_str.lines() { + // extract docs + if opt_test_line.is_none() && line.starts_with("//") { + docs.push_str(line); + docs.push('\n'); + } + + // one non-commented-out line is enough to set flag to false + if !line.starts_with("//") { + all_commented_out = false; + } + + let uncomm_line = line.strip_prefix("// ").unwrap_or(line); + if uncomm_line.starts_with(TEST_ANNOTATION) { + opt_test_line = Some(uncomm_line.to_string()); + } else if uncomm_line.starts_with(IGNORE_ANNOTATION_PREFIX) { + ignore_line = Some(uncomm_line.to_string()); + } else if let Some(scenario_file_name) = find_scenario_name(uncomm_line) { + opt_scenario_file_name = Some(scenario_file_name.to_string()); + } + } + + // functions should not be commented out, but ignored + if all_commented_out && ignore_line.is_none() { + ignore_line = Some(IGNORE_ANNOTATION.to_string()); + } + if let Some(first_line) = section_str.lines().next() { + if let Some(comment) = first_line.strip_prefix("/*") { + ignore_line = Some(format!( + "{IGNORE_ANNOTATION_PREFIX} = \"{}\"]", + comment.trim() + )); + } + } + + if let (Some(test_line), Some(scenario_file_name)) = (opt_test_line, opt_scenario_file_name) { + Some(ScenarioTestFn { + docs, + test_line, + ignore_line, + scenario_file_name, + }) + } else { + None + } +} + +/// Extracts a pattern of the form `"scenarios/.scen.json"`. +/// +/// Could be done with regex, but this is more lightweight, and good enough in here. +fn find_scenario_name(s: &str) -> Option<&str> { + if let Some(prefix_index) = s.find(SCEN_PATTERN_PREFIX) { + if let Some(suffix_index) = s.find(SCEN_PATTERN_SUFFIX) { + return s.get(prefix_index + SCEN_PATTERN_PREFIX.len()..suffix_index); + } + } + None +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_find_scenario_name() { + assert_eq!( + find_scenario_name(r#" "scenarios/test_name.scen.json" "#), + Some("test_name") + ); + assert_eq!( + find_scenario_name(r#"f("scenarios/test_name.scen.json");"#), + Some("test_name") + ); + assert_eq!( + find_scenario_name(r#"first: ".scen.json" then: "scenarios/ ..."#), + None + ); + } +} diff --git a/framework/meta/src/cmd/standalone/scen_test_gen/stg_print.rs b/framework/meta/src/cmd/standalone/scen_test_gen/stg_print.rs new file mode 100644 index 0000000000..437c237dc4 --- /dev/null +++ b/framework/meta/src/cmd/standalone/scen_test_gen/stg_print.rs @@ -0,0 +1,14 @@ +use std::path::Path; + +use colored::Colorize; + +pub fn print_no_folder(contract_dir_path: &Path, folder_name: &str) { + println!( + "{}", + format!( + "Warning: no {folder_name} folder found under {}, no action performed.", + contract_dir_path.display(), + ) + .yellow() + ); +} diff --git a/framework/meta/src/cmd/standalone/scen_test_gen/stg_process_code.rs b/framework/meta/src/cmd/standalone/scen_test_gen/stg_process_code.rs new file mode 100644 index 0000000000..26f9929409 --- /dev/null +++ b/framework/meta/src/cmd/standalone/scen_test_gen/stg_process_code.rs @@ -0,0 +1,42 @@ +use std::collections::{BTreeSet, HashMap}; + +use super::{ + stg_parse::parse_section, + stg_section::{concat_sections, split_sections, Section}, + stg_write::{format_section, WriteTestFn}, +}; + +pub fn process_code( + raw_code: &str, + scenario_names: &BTreeSet, + write_test_fn: WriteTestFn, +) -> String { + let input_sections = split_sections(raw_code); + + let mut result_sections = Vec::new(); + let mut scenario_sections = HashMap::new(); + + for mut section in input_sections { + section.test_fn = parse_section(§ion.raw); + if let Some(scenario_name) = section.scenario_name() { + scenario_sections.insert(scenario_name, section); + } else { + result_sections.push(section); + } + } + + for scenario_name in scenario_names { + let section = scenario_sections + .remove(scenario_name) + .unwrap_or_else(|| Section::new_scenario_test(scenario_name)); + result_sections.push(section); + } + + for section in &mut result_sections { + if let Some(test_fn) = §ion.test_fn { + section.raw = format_section(test_fn, write_test_fn); + } + } + + concat_sections(result_sections.as_slice()) +} diff --git a/framework/meta/src/cmd/standalone/scen_test_gen/stg_section.rs b/framework/meta/src/cmd/standalone/scen_test_gen/stg_section.rs new file mode 100644 index 0000000000..a359c6796e --- /dev/null +++ b/framework/meta/src/cmd/standalone/scen_test_gen/stg_section.rs @@ -0,0 +1,157 @@ +use super::stg_parse::TEST_ANNOTATION; + +/// Helps splitting the test file and handling whitespace. +#[derive(Default)] +pub struct Section { + /// Note: does not contain a trailing newline, normally ends with '}'. + pub raw: String, + pub num_empty_lines_after: usize, + pub test_fn: Option, +} + +/// Parsed secion. +pub struct ScenarioTestFn { + pub docs: String, + pub test_line: String, + pub ignore_line: Option, + pub scenario_file_name: String, +} + +impl Section { + pub fn new_scenario_test(scenario_name: &str) -> Self { + Section { + raw: String::new(), + num_empty_lines_after: 1, + test_fn: Some(ScenarioTestFn { + docs: String::new(), + ignore_line: None, + test_line: TEST_ANNOTATION.to_string(), + scenario_file_name: scenario_name.to_string(), + }), + } + } + + pub fn scenario_name(&self) -> Option { + self.test_fn + .as_ref() + .map(|test_fn| test_fn.scenario_file_name.clone()) + } +} + +pub fn split_sections(s: &str) -> Vec
{ + let mut result = Vec::new(); + let mut is_within_section = true; + let mut current_section = Section::default(); + + if s.is_empty() { + return result; + } + + for line in s.lines() { + if is_within_section { + current_section.raw.push_str(line); + if line == "}" { + is_within_section = false; + } else { + current_section.raw.push('\n'); + } + } else if str_is_whitespace(line) { + current_section.num_empty_lines_after += 1; + } else { + result.push(std::mem::take(&mut current_section)); + is_within_section = true; + current_section.raw.push_str(line); + current_section.raw.push('\n'); + } + } + current_section.num_empty_lines_after += 1; + result.push(current_section); + result +} + +fn str_is_whitespace(s: &str) -> bool { + for c in s.chars() { + if !c.is_whitespace() { + return false; + } + } + true +} + +pub fn concat_sections(sections: &[Section]) -> String { + let mut assembled = String::new(); + for (index, section) in sections.iter().enumerate() { + assembled.push_str(§ion.raw); + assembled.push('\n'); + let last = index == sections.len() - 1; + let num_empty_lines_after = if last && section.num_empty_lines_after > 0 { + // the final newline in the file + section.num_empty_lines_after - 1 + } else { + section.num_empty_lines_after + }; + for _ in 0..num_empty_lines_after { + assembled.push('\n'); + } + } + assembled +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_section_whitespace_1() { + const SECTIONS: &str = r#"fn section1() { + +} +"#; + let sections = split_sections(SECTIONS); + assert_eq!(sections.len(), 1); + assert_eq!(sections[0].num_empty_lines_after, 1); + assert_eq!(SECTIONS.to_string(), concat_sections(§ions)); + } + + #[test] + fn test_section_whitespace_2() { + const SECTIONS: &str = r#"fn section1() { +} +fn section2() { +} +"#; + let sections = split_sections(SECTIONS); + assert_eq!(sections.len(), 2); + assert_eq!(sections[0].num_empty_lines_after, 0); + assert_eq!(sections[1].num_empty_lines_after, 1); + assert_eq!(SECTIONS.to_string(), concat_sections(§ions)); + } + + #[test] + fn test_split_sections() { + const INPUT: &str = r#"use something; + +fn another_func() { + // ... +} + + + +#[test] +fn test_1() { + multiversx_sc_scenario::run_rs("scenarios/test1.scen.json"); +} + +#[test] +fn test_2() { + multiversx_sc_scenario::run_rs("scenarios/test2.scen.json"); +} + +"#; + let sections = split_sections(INPUT); + assert_eq!(sections.len(), 3); + assert_eq!(sections[0].num_empty_lines_after, 3); + assert_eq!(sections[1].num_empty_lines_after, 1); + assert_eq!(sections[2].num_empty_lines_after, 2); + } +} diff --git a/framework/meta/src/cmd/standalone/scen_test_gen/stg_write.rs b/framework/meta/src/cmd/standalone/scen_test_gen/stg_write.rs new file mode 100644 index 0000000000..dd43dc3268 --- /dev/null +++ b/framework/meta/src/cmd/standalone/scen_test_gen/stg_write.rs @@ -0,0 +1,45 @@ +use convert_case::{Case, Casing}; + +use super::stg_section::ScenarioTestFn; + +pub type WriteTestFn = fn(&str) -> String; + +pub const DEFAULT_TEST_GO: &str = ""; +pub const DEFAULT_TEST_RS: &str = "use multiversx_sc_scenario::*; + +fn world() -> ScenarioWorld { + todo!() +}"; + +pub fn format_test_fn_rs(scenario_file_name: &str) -> String { + format!( + " +fn {}_rs() {{ + multiversx_sc_scenario::run_rs(\"scenarios/{}.scen.json\", world()); +}}", + scenario_file_name.to_case(Case::Snake), + scenario_file_name, + ) +} + +pub fn format_test_fn_go(scenario_file_name: &str) -> String { + format!( + " +fn {}_go() {{ + multiversx_sc_scenario::run_go(\"scenarios/{}.scen.json\"); +}}", + scenario_file_name.to_case(Case::Snake), + scenario_file_name, + ) +} + +pub fn format_section(test_fn: &ScenarioTestFn, write_test_fn: WriteTestFn) -> String { + let mut section_str = test_fn.docs.clone(); + section_str.push_str(&test_fn.test_line); + if let Some(ignore_line) = &test_fn.ignore_line { + section_str.push('\n'); + section_str.push_str(ignore_line); + } + section_str.push_str(&write_test_fn(&test_fn.scenario_file_name)); + section_str +} diff --git a/framework/meta/src/sc_upgrade/mod.rs b/framework/meta/src/cmd/standalone/upgrade.rs similarity index 100% rename from framework/meta/src/sc_upgrade/mod.rs rename to framework/meta/src/cmd/standalone/upgrade.rs diff --git a/framework/meta/src/sc_upgrade/upgrade_0_31.rs b/framework/meta/src/cmd/standalone/upgrade/upgrade_0_31.rs similarity index 100% rename from framework/meta/src/sc_upgrade/upgrade_0_31.rs rename to framework/meta/src/cmd/standalone/upgrade/upgrade_0_31.rs diff --git a/framework/meta/src/sc_upgrade/upgrade_0_32.rs b/framework/meta/src/cmd/standalone/upgrade/upgrade_0_32.rs similarity index 100% rename from framework/meta/src/sc_upgrade/upgrade_0_32.rs rename to framework/meta/src/cmd/standalone/upgrade/upgrade_0_32.rs diff --git a/framework/meta/src/sc_upgrade/upgrade_0_39.rs b/framework/meta/src/cmd/standalone/upgrade/upgrade_0_39.rs similarity index 100% rename from framework/meta/src/sc_upgrade/upgrade_0_39.rs rename to framework/meta/src/cmd/standalone/upgrade/upgrade_0_39.rs diff --git a/framework/meta/src/sc_upgrade/upgrade_common.rs b/framework/meta/src/cmd/standalone/upgrade/upgrade_common.rs similarity index 99% rename from framework/meta/src/sc_upgrade/upgrade_common.rs rename to framework/meta/src/cmd/standalone/upgrade/upgrade_common.rs index e11eea1701..7fe8a30036 100644 --- a/framework/meta/src/sc_upgrade/upgrade_common.rs +++ b/framework/meta/src/cmd/standalone/upgrade/upgrade_common.rs @@ -8,10 +8,10 @@ use toml::Value; use crate::{ cargo_toml_contents::{CARGO_TOML_DEPENDENCIES, CARGO_TOML_DEV_DEPENDENCIES}, + cmd::standalone::all::call_contract_meta, folder_structure::{ DirectoryType, RelevantDirectory, VersionReq, CARGO_TOML_FILE_NAME, FRAMEWORK_CRATE_NAMES, }, - meta_all::call_contract_meta, CargoTomlContents, }; diff --git a/framework/meta/src/sc_upgrade/upgrade_print.rs b/framework/meta/src/cmd/standalone/upgrade/upgrade_print.rs similarity index 100% rename from framework/meta/src/sc_upgrade/upgrade_print.rs rename to framework/meta/src/cmd/standalone/upgrade/upgrade_print.rs diff --git a/framework/meta/src/sc_upgrade/upgrade_selector.rs b/framework/meta/src/cmd/standalone/upgrade/upgrade_selector.rs similarity index 89% rename from framework/meta/src/sc_upgrade/upgrade_selector.rs rename to framework/meta/src/cmd/standalone/upgrade/upgrade_selector.rs index 0b87bfb699..60f2178bd0 100644 --- a/framework/meta/src/sc_upgrade/upgrade_selector.rs +++ b/framework/meta/src/cmd/standalone/upgrade/upgrade_selector.rs @@ -1,16 +1,15 @@ use crate::{ cli_args::UpgradeArgs, folder_structure::{dir_pretty_print, RelevantDirectories, RelevantDirectory}, - sc_upgrade::{ - upgrade_0_39::{postprocessing_after_39_0, upgrade_to_39_0}, - upgrade_common::version_bump_in_cargo_toml, - upgrade_print::*, - upgrade_versions::{versions_iter, DEFAULT_LAST_VERSION, VERSIONS}, - }, }; use super::{ - upgrade_0_31::upgrade_to_31_0, upgrade_0_32::upgrade_to_32_0, upgrade_common::cargo_check, + upgrade_0_31::upgrade_to_31_0, + upgrade_0_32::upgrade_to_32_0, + upgrade_0_39::{postprocessing_after_39_0, upgrade_to_39_0}, + upgrade_common::{cargo_check, version_bump_in_cargo_toml}, + upgrade_print::*, + upgrade_versions::{versions_iter, DEFAULT_LAST_VERSION, VERSIONS}, }; pub fn upgrade_sc(args: &UpgradeArgs) { diff --git a/framework/meta/src/sc_upgrade/upgrade_versions.rs b/framework/meta/src/cmd/standalone/upgrade/upgrade_versions.rs similarity index 90% rename from framework/meta/src/sc_upgrade/upgrade_versions.rs rename to framework/meta/src/cmd/standalone/upgrade/upgrade_versions.rs index 1c9676d62f..5ee1b2c49a 100644 --- a/framework/meta/src/sc_upgrade/upgrade_versions.rs +++ b/framework/meta/src/cmd/standalone/upgrade/upgrade_versions.rs @@ -1,7 +1,7 @@ /// Not necessarily the last entry in `VERSIONS`. /// /// Indicates where to stop with the upgrades. -pub const DEFAULT_LAST_VERSION: &str = "0.39.7"; +pub const DEFAULT_LAST_VERSION: &str = "0.41.3"; /// Known version for the upgrader. #[rustfmt::skip] @@ -29,7 +29,15 @@ pub const VERSIONS: &[&str] = &[ "0.39.3", "0.39.4", "0.39.5", + "0.39.6", "0.39.7", + "0.39.8", + "0.40.0", + "0.40.1", + "0.41.0", + "0.41.1", + "0.41.2", + "0.41.3", ]; pub struct VersionIterator { diff --git a/framework/meta/src/ei.rs b/framework/meta/src/ei.rs new file mode 100644 index 0000000000..8198d69c87 --- /dev/null +++ b/framework/meta/src/ei.rs @@ -0,0 +1,11 @@ +mod ei_1_0; +mod ei_1_1; +mod ei_1_2; +mod ei_1_3; +mod ei_version; + +pub use ei_1_0::EI_1_0_NAMES; +pub use ei_1_1::EI_1_1_NAMES; +pub use ei_1_2::EI_1_2_NAMES; +pub use ei_1_3::EI_1_3_NAMES; +pub use ei_version::EIVersion; diff --git a/framework/meta/src/ei/ei_1_0.rs b/framework/meta/src/ei/ei_1_0.rs new file mode 100644 index 0000000000..5db6fcd3f0 --- /dev/null +++ b/framework/meta/src/ei/ei_1_0.rs @@ -0,0 +1,204 @@ +/// 1.0 is not necessarily the first version of the EI, rather the oldest version when we started keeping track of the EI. +/// +/// This list of hooks is reconstructed from history. +pub const EI_1_0_NAMES: &[&str] = &[ + "getGasLeft", + "getSCAddress", + "getOwnerAddress", + "getShardOfAddress", + "isSmartContract", + "signalError", + "getExternalBalance", + "getBlockHash", + "getESDTBalance", + "getESDTNFTNameLength", + "getESDTNFTAttributeLength", + "getESDTNFTURILength", + "getESDTTokenData", + "transferValue", + "transferValueExecute", + "transferESDTExecute", + "transferESDTNFTExecute", + "multiTransferESDTNFTExecute", + "createAsyncCall", + "setAsyncContextCallback", + "upgradeContract", + "upgradeFromSourceContract", + "deleteContract", + "asyncCall", + "getArgumentLength", + "getArgument", + "getFunction", + "getNumArguments", + "storageStore", + "storageLoadLength", + "storageLoadFromAddress", + "storageLoad", + "setStorageLock", + "getStorageLock", + "isStorageLocked", + "clearStorageLock", + "getCaller", + "checkNoPayment", + "getCallValue", + "getESDTValue", + "getESDTValueByIndex", + "getESDTTokenName", + "getESDTTokenNameByIndex", + "getESDTTokenNonce", + "getESDTTokenNonceByIndex", + "getCurrentESDTNFTNonce", + "getESDTTokenType", + "getESDTTokenTypeByIndex", + "getNumESDTTransfers", + "getCallValueTokenName", + "getCallValueTokenNameByIndex", + "writeLog", + "writeEventLog", + "getBlockTimestamp", + "getBlockNonce", + "getBlockRound", + "getBlockEpoch", + "getBlockRandomSeed", + "getStateRootHash", + "getPrevBlockTimestamp", + "getPrevBlockNonce", + "getPrevBlockRound", + "getPrevBlockEpoch", + "getPrevBlockRandomSeed", + "finish", + "executeOnSameContext", + "executeOnDestContext", + "executeReadOnly", + "createContract", + "deployFromSourceContract", + "getNumReturnData", + "getReturnDataSize", + "getReturnData", + "getOriginalTxHash", + "getCurrentTxHash", + "getPrevTxHash", + "managedSCAddress", + "managedOwnerAddress", + "managedCaller", + "managedSignalError", + "managedWriteLog", + "managedGetOriginalTxHash", + "managedGetStateRootHash", + "managedGetBlockRandomSeed", + "managedGetPrevBlockRandomSeed", + "managedGetReturnData", + "managedGetMultiESDTCallValue", + "managedGetESDTBalance", + "managedGetESDTTokenData", + "managedAsyncCall", + "managedUpgradeFromSourceContract", + "managedUpgradeContract", + "managedDeleteContract", + "managedDeployFromSourceContract", + "managedCreateContract", + "managedExecuteReadOnly", + "managedExecuteOnSameContext", + "managedExecuteOnDestContext", + "managedMultiTransferESDTNFTExecute", + "managedTransferValueExecute", + "bigIntGetUnsignedArgument", + "bigIntGetSignedArgument", + "bigIntStorageStoreUnsigned", + "bigIntStorageLoadUnsigned", + "bigIntGetCallValue", + "bigIntGetESDTCallValue", + "bigIntGetESDTCallValueByIndex", + "bigIntGetExternalBalance", + "bigIntGetESDTExternalBalance", + "bigIntNew", + "bigIntUnsignedByteLength", + "bigIntSignedByteLength", + "bigIntGetUnsignedBytes", + "bigIntGetSignedBytes", + "bigIntSetUnsignedBytes", + "bigIntSetSignedBytes", + "bigIntIsInt64", + "bigIntGetInt64", + "bigIntSetInt64", + "bigIntAdd", + "bigIntSub", + "bigIntMul", + "bigIntTDiv", + "bigIntTMod", + "bigIntEDiv", + "bigIntEMod", + "bigIntSqrt", + "bigIntPow", + "bigIntLog2", + "bigIntAbs", + "bigIntNeg", + "bigIntSign", + "bigIntCmp", + "bigIntNot", + "bigIntAnd", + "bigIntOr", + "bigIntXor", + "bigIntShr", + "bigIntShl", + "bigIntFinishUnsigned", + "bigIntFinishSigned", + "mBufferNew", + "mBufferNewFromBytes", + "mBufferGetLength", + "mBufferGetBytes", + "mBufferGetByteSlice", + "mBufferCopyByteSlice", + "mBufferEq", + "mBufferSetBytes", + "mBufferAppend", + "mBufferAppendBytes", + "mBufferToBigIntUnsigned", + "mBufferToBigIntSigned", + "mBufferFromBigIntUnsigned", + "mBufferFromBigIntSigned", + "mBufferStorageStore", + "mBufferStorageLoad", + "mBufferGetArgument", + "mBufferFinish", + "mBufferSetRandom", + "managedMapNew", + "managedMapPut", + "managedMapGet", + "managedMapRemove", + "managedMapContains", + "smallIntGetUnsignedArgument", + "smallIntGetSignedArgument", + "smallIntFinishUnsigned", + "smallIntFinishSigned", + "smallIntStorageStoreUnsigned", + "smallIntStorageStoreSigned", + "smallIntStorageLoadUnsigned", + "smallIntStorageLoadSigned", + "int64getArgument", + "int64finish", + "int64storageStore", + "int64storageLoad", + "sha256", + "keccak256", + "ripemd160", + "verifyBLS", + "verifyEd25519", + "verifyCustomSecp256k1", + "verifySecp256k1", + "encodeSecp256k1DerSignature", + "addEC", + "doubleEC", + "isOnCurveEC", + "scalarBaseMultEC", + "scalarMultEC", + "marshalEC", + "marshalCompressedEC", + "unmarshalEC", + "unmarshalCompressedEC", + "generateKeyEC", + "createEC", + "getCurveLengthEC", + "getPrivKeyByteLengthEC", + "ellipticCurveGetValues", +]; diff --git a/framework/meta/src/ei/ei_1_1.rs b/framework/meta/src/ei/ei_1_1.rs new file mode 100644 index 0000000000..ce9ccfc8a2 --- /dev/null +++ b/framework/meta/src/ei/ei_1_1.rs @@ -0,0 +1,214 @@ +/// New hooks added in Q4 2021. +/// +/// Added a few more managed type & ESDT utilities. +/// +/// This list of hooks is reconstructed from history. +pub const EI_1_1_NAMES: &[&str] = &[ + "getGasLeft", + "getSCAddress", + "getOwnerAddress", + "getShardOfAddress", + "isSmartContract", + "signalError", + "getExternalBalance", + "getBlockHash", + "getESDTBalance", + "getESDTNFTNameLength", + "getESDTNFTAttributeLength", + "getESDTNFTURILength", + "getESDTTokenData", + "getESDTLocalRoles", + "validateTokenIdentifier", + "transferValue", + "transferValueExecute", + "transferESDTExecute", + "transferESDTNFTExecute", + "multiTransferESDTNFTExecute", + "createAsyncCall", + "setAsyncContextCallback", + "upgradeContract", + "upgradeFromSourceContract", + "deleteContract", + "asyncCall", + "getArgumentLength", + "getArgument", + "getFunction", + "getNumArguments", + "storageStore", + "storageLoadLength", + "storageLoadFromAddress", + "storageLoad", + "setStorageLock", + "getStorageLock", + "isStorageLocked", + "clearStorageLock", + "getCaller", + "checkNoPayment", + "getCallValue", + "getESDTValue", + "getESDTValueByIndex", + "getESDTTokenName", + "getESDTTokenNameByIndex", + "getESDTTokenNonce", + "getESDTTokenNonceByIndex", + "getCurrentESDTNFTNonce", + "getESDTTokenType", + "getESDTTokenTypeByIndex", + "getNumESDTTransfers", + "getCallValueTokenName", + "getCallValueTokenNameByIndex", + "writeLog", + "writeEventLog", + "getBlockTimestamp", + "getBlockNonce", + "getBlockRound", + "getBlockEpoch", + "getBlockRandomSeed", + "getStateRootHash", + "getPrevBlockTimestamp", + "getPrevBlockNonce", + "getPrevBlockRound", + "getPrevBlockEpoch", + "getPrevBlockRandomSeed", + "finish", + "executeOnSameContext", + "executeOnDestContext", + "executeReadOnly", + "createContract", + "deployFromSourceContract", + "getNumReturnData", + "getReturnDataSize", + "getReturnData", + "cleanReturnData", + "deleteFromReturnData", + "getOriginalTxHash", + "getCurrentTxHash", + "getPrevTxHash", + "managedSCAddress", + "managedOwnerAddress", + "managedCaller", + "managedSignalError", + "managedWriteLog", + "managedGetOriginalTxHash", + "managedGetStateRootHash", + "managedGetBlockRandomSeed", + "managedGetPrevBlockRandomSeed", + "managedGetReturnData", + "managedGetMultiESDTCallValue", + "managedGetESDTBalance", + "managedGetESDTTokenData", + "managedAsyncCall", + "managedUpgradeFromSourceContract", + "managedUpgradeContract", + "managedDeleteContract", + "managedDeployFromSourceContract", + "managedCreateContract", + "managedExecuteReadOnly", + "managedExecuteOnSameContext", + "managedExecuteOnDestContext", + "managedMultiTransferESDTNFTExecute", + "managedTransferValueExecute", + "bigIntGetUnsignedArgument", + "bigIntGetSignedArgument", + "bigIntStorageStoreUnsigned", + "bigIntStorageLoadUnsigned", + "bigIntGetCallValue", + "bigIntGetESDTCallValue", + "bigIntGetESDTCallValueByIndex", + "bigIntGetExternalBalance", + "bigIntGetESDTExternalBalance", + "bigIntNew", + "bigIntUnsignedByteLength", + "bigIntSignedByteLength", + "bigIntGetUnsignedBytes", + "bigIntGetSignedBytes", + "bigIntSetUnsignedBytes", + "bigIntSetSignedBytes", + "bigIntIsInt64", + "bigIntGetInt64", + "bigIntSetInt64", + "bigIntAdd", + "bigIntSub", + "bigIntMul", + "bigIntTDiv", + "bigIntTMod", + "bigIntEDiv", + "bigIntEMod", + "bigIntSqrt", + "bigIntPow", + "bigIntLog2", + "bigIntAbs", + "bigIntNeg", + "bigIntSign", + "bigIntCmp", + "bigIntNot", + "bigIntAnd", + "bigIntOr", + "bigIntXor", + "bigIntShr", + "bigIntShl", + "bigIntFinishUnsigned", + "bigIntFinishSigned", + "mBufferNew", + "mBufferNewFromBytes", + "mBufferGetLength", + "mBufferGetBytes", + "mBufferGetByteSlice", + "mBufferCopyByteSlice", + "mBufferEq", + "mBufferSetBytes", + "mBufferSetByteSlice", + "mBufferAppend", + "mBufferAppendBytes", + "mBufferToBigIntUnsigned", + "mBufferToBigIntSigned", + "mBufferFromBigIntUnsigned", + "mBufferFromBigIntSigned", + "mBufferStorageStore", + "mBufferStorageLoad", + "mBufferStorageLoadFromAddress", + "mBufferGetArgument", + "mBufferFinish", + "mBufferSetRandom", + "managedMapNew", + "managedMapPut", + "managedMapGet", + "managedMapRemove", + "managedMapContains", + "smallIntGetUnsignedArgument", + "smallIntGetSignedArgument", + "smallIntFinishUnsigned", + "smallIntFinishSigned", + "smallIntStorageStoreUnsigned", + "smallIntStorageStoreSigned", + "smallIntStorageLoadUnsigned", + "smallIntStorageLoadSigned", + "int64getArgument", + "int64finish", + "int64storageStore", + "int64storageLoad", + "sha256", + "managedSha256", + "keccak256", + "managedKeccak256", + "ripemd160", + "verifyBLS", + "verifyEd25519", + "verifyCustomSecp256k1", + "verifySecp256k1", + "encodeSecp256k1DerSignature", + "addEC", + "doubleEC", + "isOnCurveEC", + "scalarBaseMultEC", + "scalarMultEC", + "marshalEC", + "marshalCompressedEC", + "unmarshalEC", + "unmarshalCompressedEC", + "generateKeyEC", + "createEC", + "getCurveLengthEC", + "getPrivKeyByteLengthEC", + "ellipticCurveGetValues", +]; diff --git a/framework/meta/src/ei/ei_1_2.rs b/framework/meta/src/ei/ei_1_2.rs new file mode 100644 index 0000000000..1493433164 --- /dev/null +++ b/framework/meta/src/ei/ei_1_2.rs @@ -0,0 +1,263 @@ +/// New hooks added in Q2 2022. This is the EI version of VM 1.4. +/// +/// This is the version currently on mainnet. +/// +/// Added: +/// - more managed type conversions +/// - more managed crypto hooks +/// - big floats +/// - some managed ESDT properties. +/// +/// This list of hooks is reconstructed from history. +pub const EI_1_2_NAMES: &[&str] = &[ + "getGasLeft", + "getSCAddress", + "getOwnerAddress", + "getShardOfAddress", + "isSmartContract", + "signalError", + "getExternalBalance", + "getBlockHash", + "getESDTBalance", + "getESDTNFTNameLength", + "getESDTNFTAttributeLength", + "getESDTNFTURILength", + "getESDTTokenData", + "getESDTLocalRoles", + "validateTokenIdentifier", + "transferValue", + "transferValueExecute", + "transferESDTExecute", + "transferESDTNFTExecute", + "multiTransferESDTNFTExecute", + "createAsyncCall", + "setAsyncContextCallback", + "upgradeContract", + "upgradeFromSourceContract", + "deleteContract", + "asyncCall", + "getArgumentLength", + "getArgument", + "getFunction", + "getNumArguments", + "storageStore", + "storageLoadLength", + "storageLoadFromAddress", + "storageLoad", + "setStorageLock", + "getStorageLock", + "isStorageLocked", + "clearStorageLock", + "getCaller", + "checkNoPayment", + "getCallValue", + "getESDTValue", + "getESDTValueByIndex", + "getESDTTokenName", + "getESDTTokenNameByIndex", + "getESDTTokenNonce", + "getESDTTokenNonceByIndex", + "getCurrentESDTNFTNonce", + "getESDTTokenType", + "getESDTTokenTypeByIndex", + "getNumESDTTransfers", + "getCallValueTokenName", + "getCallValueTokenNameByIndex", + "writeLog", + "writeEventLog", + "getBlockTimestamp", + "getBlockNonce", + "getBlockRound", + "getBlockEpoch", + "getBlockRandomSeed", + "getStateRootHash", + "getPrevBlockTimestamp", + "getPrevBlockNonce", + "getPrevBlockRound", + "getPrevBlockEpoch", + "getPrevBlockRandomSeed", + "finish", + "executeOnSameContext", + "executeOnDestContext", + "executeReadOnly", + "createContract", + "deployFromSourceContract", + "getNumReturnData", + "getReturnDataSize", + "getReturnData", + "cleanReturnData", + "deleteFromReturnData", + "getOriginalTxHash", + "getCurrentTxHash", + "getPrevTxHash", + "managedSCAddress", + "managedOwnerAddress", + "managedCaller", + "managedSignalError", + "managedWriteLog", + "managedGetOriginalTxHash", + "managedGetStateRootHash", + "managedGetBlockRandomSeed", + "managedGetPrevBlockRandomSeed", + "managedGetReturnData", + "managedGetMultiESDTCallValue", + "managedGetESDTBalance", + "managedGetESDTTokenData", + "managedAsyncCall", + "managedUpgradeFromSourceContract", + "managedUpgradeContract", + "managedDeleteContract", + "managedDeployFromSourceContract", + "managedCreateContract", + "managedExecuteReadOnly", + "managedExecuteOnSameContext", + "managedExecuteOnDestContext", + "managedMultiTransferESDTNFTExecute", + "managedTransferValueExecute", + "managedIsESDTFrozen", + "managedIsESDTLimitedTransfer", + "managedIsESDTPaused", + "managedBufferToHex", + "bigFloatNewFromParts", + "bigFloatNewFromFrac", + "bigFloatNewFromSci", + "bigFloatAdd", + "bigFloatSub", + "bigFloatMul", + "bigFloatDiv", + "bigFloatNeg", + "bigFloatClone", + "bigFloatCmp", + "bigFloatAbs", + "bigFloatSign", + "bigFloatSqrt", + "bigFloatPow", + "bigFloatFloor", + "bigFloatCeil", + "bigFloatTruncate", + "bigFloatSetInt64", + "bigFloatIsInt", + "bigFloatSetBigInt", + "bigFloatGetConstPi", + "bigFloatGetConstE", + "bigIntGetUnsignedArgument", + "bigIntGetSignedArgument", + "bigIntStorageStoreUnsigned", + "bigIntStorageLoadUnsigned", + "bigIntGetCallValue", + "bigIntGetESDTCallValue", + "bigIntGetESDTCallValueByIndex", + "bigIntGetExternalBalance", + "bigIntGetESDTExternalBalance", + "bigIntNew", + "bigIntUnsignedByteLength", + "bigIntSignedByteLength", + "bigIntGetUnsignedBytes", + "bigIntGetSignedBytes", + "bigIntSetUnsignedBytes", + "bigIntSetSignedBytes", + "bigIntIsInt64", + "bigIntGetInt64", + "bigIntSetInt64", + "bigIntAdd", + "bigIntSub", + "bigIntMul", + "bigIntTDiv", + "bigIntTMod", + "bigIntEDiv", + "bigIntEMod", + "bigIntSqrt", + "bigIntPow", + "bigIntLog2", + "bigIntAbs", + "bigIntNeg", + "bigIntSign", + "bigIntCmp", + "bigIntNot", + "bigIntAnd", + "bigIntOr", + "bigIntXor", + "bigIntShr", + "bigIntShl", + "bigIntFinishUnsigned", + "bigIntFinishSigned", + "bigIntToString", + "mBufferNew", + "mBufferNewFromBytes", + "mBufferGetLength", + "mBufferGetBytes", + "mBufferGetByteSlice", + "mBufferCopyByteSlice", + "mBufferEq", + "mBufferSetBytes", + "mBufferSetByteSlice", + "mBufferAppend", + "mBufferAppendBytes", + "mBufferToBigIntUnsigned", + "mBufferToBigIntSigned", + "mBufferFromBigIntUnsigned", + "mBufferFromBigIntSigned", + "mBufferToBigFloat", + "mBufferFromBigFloat", + "mBufferStorageStore", + "mBufferStorageLoad", + "mBufferStorageLoadFromAddress", + "mBufferGetArgument", + "mBufferFinish", + "mBufferSetRandom", + "managedMapNew", + "managedMapPut", + "managedMapGet", + "managedMapRemove", + "managedMapContains", + "smallIntGetUnsignedArgument", + "smallIntGetSignedArgument", + "smallIntFinishUnsigned", + "smallIntFinishSigned", + "smallIntStorageStoreUnsigned", + "smallIntStorageStoreSigned", + "smallIntStorageLoadUnsigned", + "smallIntStorageLoadSigned", + "int64getArgument", + "int64finish", + "int64storageStore", + "int64storageLoad", + "sha256", + "managedSha256", + "keccak256", + "managedKeccak256", + "ripemd160", + "managedRipemd160", + "verifyBLS", + "managedVerifyBLS", + "verifyEd25519", + "managedVerifyEd25519", + "verifyCustomSecp256k1", + "managedVerifyCustomSecp256k1", + "verifySecp256k1", + "managedVerifySecp256k1", + "encodeSecp256k1DerSignature", + "managedEncodeSecp256k1DerSignature", + "addEC", + "doubleEC", + "isOnCurveEC", + "scalarBaseMultEC", + "managedScalarBaseMultEC", + "scalarMultEC", + "managedScalarMultEC", + "marshalEC", + "managedMarshalEC", + "marshalCompressedEC", + "managedMarshalCompressedEC", + "unmarshalEC", + "managedUnmarshalEC", + "unmarshalCompressedEC", + "managedUnmarshalCompressedEC", + "generateKeyEC", + "managedGenerateKeyEC", + "createEC", + "managedCreateEC", + "getCurveLengthEC", + "getPrivKeyByteLengthEC", + "ellipticCurveGetValues", +]; diff --git a/framework/meta/src/ei/ei_1_3.rs b/framework/meta/src/ei/ei_1_3.rs new file mode 100644 index 0000000000..5dbf2dc841 --- /dev/null +++ b/framework/meta/src/ei/ei_1_3.rs @@ -0,0 +1,265 @@ +// Code generated by vmhooks generator. DO NOT EDIT. + +// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +// !!!!!!!!!!!!!!!!!!!!!! AUTO-GENERATED FILE !!!!!!!!!!!!!!!!!!!!!! +// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +/// VM Hooks version planned to be released with VM 1.5 in Q2 2023. +/// +/// It adds the new async call functionality (promises). +/// +/// It is the first EI version to be auto-generated by the vmhooks generator in the VM. +pub const EI_1_3_NAMES: &[&str] = &[ + "getGasLeft", + "getSCAddress", + "getOwnerAddress", + "getShardOfAddress", + "isSmartContract", + "signalError", + "getExternalBalance", + "getBlockHash", + "getESDTBalance", + "getESDTNFTNameLength", + "getESDTNFTAttributeLength", + "getESDTNFTURILength", + "getESDTTokenData", + "getESDTLocalRoles", + "validateTokenIdentifier", + "transferValue", + "transferValueExecute", + "transferESDTExecute", + "transferESDTNFTExecute", + "multiTransferESDTNFTExecute", + "createAsyncCall", + "setAsyncContextCallback", + "upgradeContract", + "upgradeFromSourceContract", + "deleteContract", + "asyncCall", + "getArgumentLength", + "getArgument", + "getFunction", + "getNumArguments", + "storageStore", + "storageLoadLength", + "storageLoadFromAddress", + "storageLoad", + "setStorageLock", + "getStorageLock", + "isStorageLocked", + "clearStorageLock", + "getCaller", + "checkNoPayment", + "getCallValue", + "getESDTValue", + "getESDTValueByIndex", + "getESDTTokenName", + "getESDTTokenNameByIndex", + "getESDTTokenNonce", + "getESDTTokenNonceByIndex", + "getCurrentESDTNFTNonce", + "getESDTTokenType", + "getESDTTokenTypeByIndex", + "getNumESDTTransfers", + "getCallValueTokenName", + "getCallValueTokenNameByIndex", + "writeLog", + "writeEventLog", + "getBlockTimestamp", + "getBlockNonce", + "getBlockRound", + "getBlockEpoch", + "getBlockRandomSeed", + "getStateRootHash", + "getPrevBlockTimestamp", + "getPrevBlockNonce", + "getPrevBlockRound", + "getPrevBlockEpoch", + "getPrevBlockRandomSeed", + "finish", + "executeOnSameContext", + "executeOnDestContext", + "executeReadOnly", + "createContract", + "deployFromSourceContract", + "getNumReturnData", + "getReturnDataSize", + "getReturnData", + "cleanReturnData", + "deleteFromReturnData", + "getOriginalTxHash", + "getCurrentTxHash", + "getPrevTxHash", + "managedSCAddress", + "managedOwnerAddress", + "managedCaller", + "managedSignalError", + "managedWriteLog", + "managedGetOriginalTxHash", + "managedGetStateRootHash", + "managedGetBlockRandomSeed", + "managedGetPrevBlockRandomSeed", + "managedGetReturnData", + "managedGetMultiESDTCallValue", + "managedGetESDTBalance", + "managedGetESDTTokenData", + "managedAsyncCall", + "managedCreateAsyncCall", + "managedGetCallbackClosure", + "managedUpgradeFromSourceContract", + "managedUpgradeContract", + "managedDeleteContract", + "managedDeployFromSourceContract", + "managedCreateContract", + "managedExecuteReadOnly", + "managedExecuteOnSameContext", + "managedExecuteOnDestContext", + "managedMultiTransferESDTNFTExecute", + "managedTransferValueExecute", + "managedIsESDTFrozen", + "managedIsESDTLimitedTransfer", + "managedIsESDTPaused", + "managedBufferToHex", + "bigFloatNewFromParts", + "bigFloatNewFromFrac", + "bigFloatNewFromSci", + "bigFloatAdd", + "bigFloatSub", + "bigFloatMul", + "bigFloatDiv", + "bigFloatNeg", + "bigFloatClone", + "bigFloatCmp", + "bigFloatAbs", + "bigFloatSign", + "bigFloatSqrt", + "bigFloatPow", + "bigFloatFloor", + "bigFloatCeil", + "bigFloatTruncate", + "bigFloatSetInt64", + "bigFloatIsInt", + "bigFloatSetBigInt", + "bigFloatGetConstPi", + "bigFloatGetConstE", + "bigIntGetUnsignedArgument", + "bigIntGetSignedArgument", + "bigIntStorageStoreUnsigned", + "bigIntStorageLoadUnsigned", + "bigIntGetCallValue", + "bigIntGetESDTCallValue", + "bigIntGetESDTCallValueByIndex", + "bigIntGetExternalBalance", + "bigIntGetESDTExternalBalance", + "bigIntNew", + "bigIntUnsignedByteLength", + "bigIntSignedByteLength", + "bigIntGetUnsignedBytes", + "bigIntGetSignedBytes", + "bigIntSetUnsignedBytes", + "bigIntSetSignedBytes", + "bigIntIsInt64", + "bigIntGetInt64", + "bigIntSetInt64", + "bigIntAdd", + "bigIntSub", + "bigIntMul", + "bigIntTDiv", + "bigIntTMod", + "bigIntEDiv", + "bigIntEMod", + "bigIntSqrt", + "bigIntPow", + "bigIntLog2", + "bigIntAbs", + "bigIntNeg", + "bigIntSign", + "bigIntCmp", + "bigIntNot", + "bigIntAnd", + "bigIntOr", + "bigIntXor", + "bigIntShr", + "bigIntShl", + "bigIntFinishUnsigned", + "bigIntFinishSigned", + "bigIntToString", + "mBufferNew", + "mBufferNewFromBytes", + "mBufferGetLength", + "mBufferGetBytes", + "mBufferGetByteSlice", + "mBufferCopyByteSlice", + "mBufferEq", + "mBufferSetBytes", + "mBufferSetByteSlice", + "mBufferAppend", + "mBufferAppendBytes", + "mBufferToBigIntUnsigned", + "mBufferToBigIntSigned", + "mBufferFromBigIntUnsigned", + "mBufferFromBigIntSigned", + "mBufferToBigFloat", + "mBufferFromBigFloat", + "mBufferStorageStore", + "mBufferStorageLoad", + "mBufferStorageLoadFromAddress", + "mBufferGetArgument", + "mBufferFinish", + "mBufferSetRandom", + "managedMapNew", + "managedMapPut", + "managedMapGet", + "managedMapRemove", + "managedMapContains", + "smallIntGetUnsignedArgument", + "smallIntGetSignedArgument", + "smallIntFinishUnsigned", + "smallIntFinishSigned", + "smallIntStorageStoreUnsigned", + "smallIntStorageStoreSigned", + "smallIntStorageLoadUnsigned", + "smallIntStorageLoadSigned", + "int64getArgument", + "int64finish", + "int64storageStore", + "int64storageLoad", + "sha256", + "managedSha256", + "keccak256", + "managedKeccak256", + "ripemd160", + "managedRipemd160", + "verifyBLS", + "managedVerifyBLS", + "verifyEd25519", + "managedVerifyEd25519", + "verifyCustomSecp256k1", + "managedVerifyCustomSecp256k1", + "verifySecp256k1", + "managedVerifySecp256k1", + "encodeSecp256k1DerSignature", + "managedEncodeSecp256k1DerSignature", + "addEC", + "doubleEC", + "isOnCurveEC", + "scalarBaseMultEC", + "managedScalarBaseMultEC", + "scalarMultEC", + "managedScalarMultEC", + "marshalEC", + "managedMarshalEC", + "marshalCompressedEC", + "managedMarshalCompressedEC", + "unmarshalEC", + "managedUnmarshalEC", + "unmarshalCompressedEC", + "managedUnmarshalCompressedEC", + "generateKeyEC", + "managedGenerateKeyEC", + "createEC", + "managedCreateEC", + "getCurveLengthEC", + "getPrivKeyByteLengthEC", + "ellipticCurveGetValues", +]; diff --git a/framework/meta/src/ei/ei_version.rs b/framework/meta/src/ei/ei_version.rs new file mode 100644 index 0000000000..4761e4191c --- /dev/null +++ b/framework/meta/src/ei/ei_version.rs @@ -0,0 +1,65 @@ +/// The version of the SC environment interface (EI), it deals with the VM hooks available at a certain point in time. +/// +/// It is not tied to the version of the VM, hence the different numbering. +#[derive(Clone, Copy, Default, PartialEq, Eq)] +pub enum EIVersion { + /// This is not necessarily the first version of the EI, + /// but rather the oldest version when we started keeping track of the EI. + V1_0, + + /// New hooks added in Q4 2021. + /// + /// Added a few more managed type & ESDT utilities. + V1_1, + + /// New hooks added in Q2 2022. This is the EI version of VM 1.4. + /// + /// This is the version currently on mainnet. + /// + /// Added: + /// - more managed type conversions + /// - more managed crypto hooks + /// - big floats + /// - some managed ESDT properties. + #[default] + V1_2, + + /// VM Hooks version planned to be released with VM 1.5 in Q2 2023. + /// + /// It adds the new async call functionality (promises). + V1_3, +} + +impl EIVersion { + pub fn from_name(name: &str) -> Option { + match name { + "1.0" => Some(EIVersion::V1_0), + "1.1" => Some(EIVersion::V1_1), + "1.2" => Some(EIVersion::V1_2), + "1.3" => Some(EIVersion::V1_3), + _ => None, + } + } + + pub fn name(&self) -> &'static str { + match self { + EIVersion::V1_0 => "1.0", + EIVersion::V1_1 => "1.1", + EIVersion::V1_2 => "1.2", + EIVersion::V1_3 => "1.3", + } + } + + pub fn vm_hook_names(&self) -> &'static [&'static str] { + match self { + EIVersion::V1_0 => super::EI_1_0_NAMES, + EIVersion::V1_1 => super::EI_1_1_NAMES, + EIVersion::V1_2 => super::EI_1_2_NAMES, + EIVersion::V1_3 => super::EI_1_3_NAMES, + } + } + + pub fn contains_vm_hook(&self, vm_hook_names: &str) -> bool { + self.vm_hook_names().contains(&vm_hook_names) + } +} diff --git a/framework/meta/src/folder_structure/mod.rs b/framework/meta/src/folder_structure.rs similarity index 100% rename from framework/meta/src/folder_structure/mod.rs rename to framework/meta/src/folder_structure.rs diff --git a/framework/meta/src/folder_structure/relevant_directory.rs b/framework/meta/src/folder_structure/relevant_directory.rs index 06b2189e9e..fc380a0014 100644 --- a/framework/meta/src/folder_structure/relevant_directory.rs +++ b/framework/meta/src/folder_structure/relevant_directory.rs @@ -37,6 +37,16 @@ pub struct RelevantDirectory { pub dir_type: DirectoryType, } +impl RelevantDirectory { + pub fn dir_name(&self) -> String { + self.path.file_name().unwrap().to_str().unwrap().to_string() + } + + pub fn dir_name_underscores(&self) -> String { + self.dir_name().replace('-', "_") + } +} + pub struct RelevantDirectories(pub(crate) Vec); impl RelevantDirectories { diff --git a/framework/meta/src/lib.rs b/framework/meta/src/lib.rs index b95e4a8346..d11e491f74 100644 --- a/framework/meta/src/lib.rs +++ b/framework/meta/src/lib.rs @@ -1,22 +1,19 @@ pub mod abi_json; mod cargo_toml_contents; pub mod cli_args; +pub mod cmd; +pub mod ei; mod folder_structure; -mod generate_snippets; -mod local_deps; -mod meta_abi; -mod meta_all; -mod meta_cli; -mod meta_config; -mod meta_info; -mod meta_validate_abi; -mod meta_wasm_tools; -pub mod output_contract; -mod sc_upgrade; +mod mxsc_file_json; +mod print_util; pub mod template; - -pub use cargo_toml_contents::CargoTomlContents; -pub use meta_cli::{cli_main, cli_main_standalone, multi_contract_config}; +mod tools; #[macro_use] extern crate lazy_static; + +pub use cargo_toml_contents::CargoTomlContents; +pub use cmd::{ + contract::{cli_main, multi_contract_config}, + standalone::cli_main_standalone, +}; diff --git a/framework/meta/src/mxsc_file_json.rs b/framework/meta/src/mxsc_file_json.rs new file mode 100644 index 0000000000..b2181fa6e1 --- /dev/null +++ b/framework/meta/src/mxsc_file_json.rs @@ -0,0 +1,29 @@ +use serde::{Deserialize, Serialize}; +use std::{fs::File, io::Write, path::Path}; + +use crate::abi_json::{BuildInfoAbiJson, ContractAbiJson}; + +#[derive(Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct MxscFileJson { + pub build_info: BuildInfoAbiJson, + pub abi: ContractAbiJson, + pub size: usize, + pub code: String, +} + +pub fn serialize_mxsc_file_json(mxsc_file_json: &MxscFileJson) -> String { + let buf = Vec::new(); + let formatter = serde_json::ser::PrettyFormatter::with_indent(b" "); + let mut ser = serde_json::Serializer::with_formatter(buf, formatter); + mxsc_file_json.serialize(&mut ser).unwrap(); + let mut serialized = String::from_utf8(ser.into_inner()).unwrap(); + serialized.push('\n'); + serialized +} + +pub fn save_mxsc_file_json(mxsc_file_json: &MxscFileJson, path: impl AsRef) { + let mxsc_file_string = serialize_mxsc_file_json(mxsc_file_json); + let mut mxsc_file = File::create(path).unwrap(); + write!(mxsc_file, "{mxsc_file_string}").unwrap(); +} diff --git a/framework/meta/src/output_contract/mod.rs b/framework/meta/src/output_contract/mod.rs deleted file mode 100644 index 1c2ebcb4ab..0000000000 --- a/framework/meta/src/output_contract/mod.rs +++ /dev/null @@ -1,13 +0,0 @@ -mod multi_contract_serde; -mod output_contract_builder; -mod output_contract_model; -mod print_util; -mod wasm_build; -mod wasm_clean; -mod wasm_crate_gen; -mod wasm_update; - -pub use multi_contract_serde::*; -pub use output_contract_builder::*; -pub use output_contract_model::*; -pub use wasm_build::*; diff --git a/framework/meta/src/output_contract/print_util.rs b/framework/meta/src/output_contract/print_util.rs deleted file mode 100644 index e45f028055..0000000000 --- a/framework/meta/src/output_contract/print_util.rs +++ /dev/null @@ -1,41 +0,0 @@ -use std::process::Command; - -use colored::Colorize; - -pub fn format_command(command: &Command) -> String { - let mut result = String::new(); - for (key, opt_value) in command.get_envs() { - if let Some(value) = opt_value { - result += - format!("{}=\"{}\" ", key.to_string_lossy(), value.to_string_lossy()).as_str(); - } - } - result.push_str(command.get_program().to_string_lossy().as_ref()); - - for arg in command.get_args() { - result.push(' '); - result.push_str(arg.to_string_lossy().as_ref()); - } - - result -} - -pub fn print_build_command(contract_name: String, command: &Command) { - let path = command - .get_current_dir() - .expect("missing command dir") - .canonicalize() - .expect("command dir canonicalization failed"); - println!( - "{}\n{}", - format!("Building {} in {} ...", contract_name, path.display()).green(), - format_command(command).green(), - ); -} - -pub fn print_copy_contract(source_wasm_path: &str, output_wasm_path: &str) { - println!( - "{}", - format!("Copying {source_wasm_path} to {output_wasm_path} ...").green(), - ); -} diff --git a/framework/meta/src/print_util.rs b/framework/meta/src/print_util.rs new file mode 100644 index 0000000000..dbb624e8d5 --- /dev/null +++ b/framework/meta/src/print_util.rs @@ -0,0 +1,114 @@ +use std::{path::Path, process::Command}; + +use colored::Colorize; + +pub fn print_all_count(num_contract_crates: usize) { + println!( + "\n{}", + format!("Found {num_contract_crates} contract crates.").truecolor(128, 128, 128), + ); +} + +pub fn print_all_index(contract_crates_index: usize, num_contract_crates: usize) { + println!( + "\n{}", + format!("({contract_crates_index}/{num_contract_crates})").truecolor(128, 128, 128), + ); +} + +pub fn print_all_command(meta_path: &Path, cargo_run_args: &[String]) { + println!( + "{} `cargo run {}` in {}", + "Calling".green(), + cargo_run_args.join(" "), + meta_path.display(), + ); +} + +pub fn format_command(command: &Command) -> String { + let mut result = String::new(); + for (key, opt_value) in command.get_envs() { + if let Some(value) = opt_value { + result += + format!("{}=\"{}\" ", key.to_string_lossy(), value.to_string_lossy()).as_str(); + } + } + result.push_str(command.get_program().to_string_lossy().as_ref()); + + for arg in command.get_args() { + result.push(' '); + result.push_str(arg.to_string_lossy().as_ref()); + } + + result +} + +pub fn print_build_command(contract_name: String, command: &Command) { + let path = command + .get_current_dir() + .expect("missing command dir") + .canonicalize() + .expect("command dir canonicalization failed"); + println!( + "{}\n{}", + format!("Building {} in {} ...", contract_name, path.display()).green(), + format_command(command).green(), + ); +} + +pub fn print_copy_contract(source_wasm_path: &str, output_wasm_path: &str) { + println!( + "{}", + format!("Copying {source_wasm_path} to {output_wasm_path} ...").green(), + ); +} + +pub fn print_call_wasm_opt(wasm_path: &str) { + println!("{}", format!("Calling wasm-opt on {wasm_path} ...").green(),); +} + +pub fn print_call_wasm2wat(wasm_path: &str, wat_path: &str) { + println!( + "{}", + format!("Calling wasm2wat on {wasm_path} -> {wat_path} ...").green(), + ); +} + +pub fn print_pack_mxsc_file(output_mxsc_path: &str) { + println!("{}", format!("Packing {output_mxsc_path} ...").green(),); +} + +pub fn print_contract_size(size: usize) { + println!("{}", format!("Contract size: {size} bytes.").blue(),); +} + +pub fn print_extract_imports(imports_path: &str) { + println!( + "{}", + format!("Extracting imports to {imports_path} ...").green(), + ); +} + +pub fn print_check_ei(ei_version: &str) { + print!( + "{}", + format!("Checking EI version: {ei_version} ...").green(), + ); +} + +pub fn print_invalid_vm_hook(import_name: &str, ei_version: &str) { + print!( + "\n{}", + format!( + "WARNING! Import '{import_name}' is not available on EI version {ei_version}! This will become a hard error in the next release." + ).yellow(), + ); +} + +pub fn print_check_ei_ok() { + println!("{}", " OK".green(),); +} + +pub fn print_ignore_ei_check() { + println!("{}", "EI version check explicitly ignored".yellow(),); +} diff --git a/framework/meta/src/tools.rs b/framework/meta/src/tools.rs new file mode 100644 index 0000000000..b8e8185661 --- /dev/null +++ b/framework/meta/src/tools.rs @@ -0,0 +1,4 @@ +mod git_describe; +pub mod post_build; + +pub use git_describe::git_describe; diff --git a/framework/meta/src/tools/git_describe.rs b/framework/meta/src/tools/git_describe.rs new file mode 100644 index 0000000000..b3de98cf10 --- /dev/null +++ b/framework/meta/src/tools/git_describe.rs @@ -0,0 +1,22 @@ +use std::process::{Command, Output}; + +pub fn git_describe() -> String { + Command::new("git") + .args(["describe"]) + .output() + .map(git_describe_process_output) + .unwrap_or_default() +} + +fn git_describe_process_output(output: Output) -> String { + if output.status.success() { + let mut result = String::from_utf8(output.stdout).unwrap_or_default(); + if result.ends_with('\n') { + // for some reason we get a trailing newline + let _ = result.pop(); + } + result + } else { + String::new() + } +} diff --git a/framework/meta/src/meta_wasm_tools.rs b/framework/meta/src/tools/post_build.rs similarity index 100% rename from framework/meta/src/meta_wasm_tools.rs rename to framework/meta/src/tools/post_build.rs diff --git a/framework/meta/tests/ei_test.rs b/framework/meta/tests/ei_test.rs new file mode 100644 index 0000000000..5a6cb581f1 --- /dev/null +++ b/framework/meta/tests/ei_test.rs @@ -0,0 +1,105 @@ +use multiversx_sc_meta::ei; + +use std::collections::HashSet; + +/// Added around November-December 2021. +pub const EI_1_1_ADDED_NAMES: &[&str] = &[ + "mBufferSetByteSlice", + "managedSha256", + "managedKeccak256", + "mBufferStorageLoadFromAddress", + "validateTokenIdentifier", + "getESDTLocalRoles", + "cleanReturnData", + "deleteFromReturnData", +]; + +/// Added around May 2022. +pub const EI_1_2_ADDED_NAMES: &[&str] = &[ + // debugging/display utilities + "bigIntToString", + "managedBufferToHex", + // more managed crypto functions + "managedRipemd160", + "managedVerifyBLS", + "managedVerifyEd25519", + "managedVerifySecp256k1", + "managedVerifyCustomSecp256k1", + "managedEncodeSecp256k1DerSignature", + "managedScalarBaseMultEC", + "managedScalarMultEC", + "managedMarshalEC", + "managedUnmarshalEC", + "managedMarshalCompressedEC", + "managedUnmarshalCompressedEC", + "managedGenerateKeyEC", + "managedCreateEC", + // big floats + "mBufferToBigFloat", + "mBufferFromBigFloat", + "bigFloatNewFromParts", + "bigFloatNewFromFrac", + "bigFloatNewFromSci", + "bigFloatAdd", + "bigFloatSub", + "bigFloatMul", + "bigFloatDiv", + "bigFloatNeg", + "bigFloatClone", + "bigFloatCmp", + "bigFloatAbs", + "bigFloatSign", + "bigFloatSqrt", + "bigFloatPow", + "bigFloatFloor", + "bigFloatCeil", + "bigFloatTruncate", + "bigFloatSetInt64", + "bigFloatIsInt", + "bigFloatSetBigInt", + "bigFloatGetConstPi", + "bigFloatGetConstE", + // more ESDT utilities + "managedIsESDTFrozen", + "managedIsESDTPaused", + "managedIsESDTLimitedTransfer", +]; + +/// Planned to be released with VM 1.5. +pub const EI_1_3_ADDED_NAMES: &[&str] = &["managedCreateAsyncCall", "managedGetCallbackClosure"]; + +fn list_to_set<'a>(list: &[&'a str]) -> HashSet<&'a str> { + let mut set = HashSet::new(); + for &item in list { + assert!(!set.contains(item), "duplicate item: {item}"); + set.insert(item); + } + set +} + +fn test_added_names(base: &[&str], added: &[&str], expected_result: &[&str]) { + let mut check = list_to_set(base); + for &added_name in added { + assert!( + !check.contains(added_name), + "added name already present: {added_name}" + ); + check.insert(added_name); + } + assert_eq!(check, list_to_set(expected_result)); +} + +#[test] +fn test_added_names_ei_1_1() { + test_added_names(ei::EI_1_0_NAMES, EI_1_1_ADDED_NAMES, ei::EI_1_1_NAMES); +} + +#[test] +fn test_added_names_ei_1_2() { + test_added_names(ei::EI_1_1_NAMES, EI_1_2_ADDED_NAMES, ei::EI_1_2_NAMES); +} + +#[test] +fn test_added_names_ei_1_3() { + test_added_names(ei::EI_1_2_NAMES, EI_1_3_ADDED_NAMES, ei::EI_1_3_NAMES); +} diff --git a/framework/meta/tests/multi_contract_test.rs b/framework/meta/tests/multi_contract_test.rs index 3eb7b68295..e84c5284bd 100644 --- a/framework/meta/tests/multi_contract_test.rs +++ b/framework/meta/tests/multi_contract_test.rs @@ -1,5 +1,7 @@ use multiversx_sc::abi::{ContractAbi, EndpointAbi}; -use multiversx_sc_meta::output_contract::{MultiContractConfigSerde, OutputContractConfig}; +use multiversx_sc_meta::cmd::contract::output_contract::{ + MultiContractConfigSerde, OutputContractGlobalConfig, +}; fn get_serialized_toml() -> MultiContractConfigSerde { toml::from_str( @@ -89,7 +91,7 @@ fn test_output_contract_config() { let serde = get_serialized_toml(); let abi = get_contract_abi(); - let contract_config = OutputContractConfig::load_from_config(&serde, &abi); + let contract_config = OutputContractGlobalConfig::load_from_config(&serde, &abi); assert_eq!( contract_config.default_contract_config_name, diff --git a/framework/meta/tests/stg_process_code_test.rs b/framework/meta/tests/stg_process_code_test.rs new file mode 100644 index 0000000000..1da5436d65 --- /dev/null +++ b/framework/meta/tests/stg_process_code_test.rs @@ -0,0 +1,51 @@ +use multiversx_sc_meta::cmd::standalone::scen_test_gen::{format_test_fn_go, process_code}; + +const GO_TEST_1: &str = r#"#[test] +fn test_1_go() { + multiversx_sc_scenario::run_go("scenarios/test1.scen.json"); +} +"#; + +const GO_TEST_0_1_2: &str = r#"#[test] +fn test_0_go() { + multiversx_sc_scenario::run_go("scenarios/test0.scen.json"); +} + +#[test] +fn test_1_go() { + multiversx_sc_scenario::run_go("scenarios/test1.scen.json"); +} + +#[test] +fn test_2_go() { + multiversx_sc_scenario::run_go("scenarios/test2.scen.json"); +} +"#; + +fn check_transformation( + input: &str, + scenario_names_list: impl IntoIterator, + expected_out: &str, +) { + let scenario_names = scenario_names_list + .into_iter() + .map(|s| s.to_string()) + .collect(); + let new_code = process_code(input, &scenario_names, format_test_fn_go); + assert_eq!(new_code.as_str(), expected_out); +} + +#[test] +fn process_code_go_1() { + check_transformation(GO_TEST_1, ["test1"], GO_TEST_1); +} + +#[test] +fn process_code_go_2() { + check_transformation(GO_TEST_1, ["test0", "test1", "test2"], GO_TEST_0_1_2); +} + +#[test] +fn process_new_code_go() { + check_transformation("", ["test1"], GO_TEST_1); +} diff --git a/framework/scenario/Cargo.toml b/framework/scenario/Cargo.toml index 4e17f6e66e..aa08706535 100644 --- a/framework/scenario/Cargo.toml +++ b/framework/scenario/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "multiversx-sc-scenario" -version = "0.39.7" +version = "0.41.3" edition = "2021" authors = [ @@ -30,5 +30,5 @@ colored = "2.0" run-go-tests = [] [dependencies.multiversx-chain-vm] -version = "=0.1.7" +version = "=0.3.3" path = "../../vm" diff --git a/framework/scenario/tests/token_identifier_test.rs b/framework/scenario/tests/token_identifier_test.rs index 314a0bb336..400634142a 100644 --- a/framework/scenario/tests/token_identifier_test.rs +++ b/framework/scenario/tests/token_identifier_test.rs @@ -1,6 +1,6 @@ use multiversx_sc::types::{ - BoxedBytes, EgldOrEsdtTokenIdentifier, EgldOrEsdtTokenPayment, EsdtTokenPayment, - TokenIdentifier, ManagedBuffer, + BoxedBytes, EgldOrEsdtTokenIdentifier, EgldOrEsdtTokenPayment, EsdtTokenPayment, ManagedBuffer, + TokenIdentifier, }; use multiversx_sc_scenario::{ managed_egld_token_id, managed_token_id, managed_token_id_wrapped, diff --git a/framework/snippets/Cargo.toml b/framework/snippets/Cargo.toml index 6303a8d371..ac277f813c 100644 --- a/framework/snippets/Cargo.toml +++ b/framework/snippets/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "multiversx-sc-snippets" -version = "0.39.7" +version = "0.41.3" edition = "2021" authors = [ @@ -23,7 +23,7 @@ log = "0.4.17" env_logger = "0.8.4" [dependencies.multiversx-sc-scenario] -version = "=0.39.7" +version = "=0.41.3" path = "../scenario" [dependencies.multiversx-sdk] diff --git a/framework/wasm-adapter/Cargo.toml b/framework/wasm-adapter/Cargo.toml index a9aa334ac4..762e215d49 100644 --- a/framework/wasm-adapter/Cargo.toml +++ b/framework/wasm-adapter/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "multiversx-sc-wasm-adapter" -version = "0.39.7" +version = "0.41.3" edition = "2021" authors = [ @@ -26,9 +26,6 @@ vm-validate-token-identifier = [] vm-esdt-local-roles = [] ei-unmanaged-node = [] -[dependencies] -wee_alloc = "0.4" - [dependencies.multiversx-sc] -version = "=0.39.7" +version = "=0.41.3" path = "../base" diff --git a/framework/wasm-adapter/src/lib.rs b/framework/wasm-adapter/src/lib.rs index bd7cf0ea5a..bf7e6797d0 100644 --- a/framework/wasm-adapter/src/lib.rs +++ b/framework/wasm-adapter/src/lib.rs @@ -1,5 +1,6 @@ #![no_std] #![feature(panic_info_message)] +#![feature(int_roundings)] // Allows us to use alloc::vec::Vec; // TODO: get rid of the legacy API and also of this. @@ -9,5 +10,6 @@ pub use multiversx_sc; pub mod api; pub mod error_hook; -pub mod wasm_deps; +pub mod panic; +pub mod wasm_alloc; mod wasm_macros; diff --git a/framework/wasm-adapter/src/panic.rs b/framework/wasm-adapter/src/panic.rs new file mode 100644 index 0000000000..164db2fc14 --- /dev/null +++ b/framework/wasm-adapter/src/panic.rs @@ -0,0 +1,47 @@ +use crate::api::VmApiImpl; +pub use alloc::alloc::Layout; +use multiversx_sc::{ + api::{ErrorApi, ErrorApiImpl}, + types::{ManagedBuffer, ManagedType}, +}; + +/// Also used in wasm crate macros. +pub use core::panic::PanicInfo; + +/// Default panic handler for all contracts. +pub fn panic_fmt(_: &PanicInfo) -> ! { + crate::error_hook::signal_error(multiversx_sc::err_msg::PANIC_OCCURRED.as_bytes()) +} + +/// Panic handler that formats and sends the original message. +/// +/// Mostly used for debugging, the additional code is normally not deemed to be worth it. +pub fn panic_fmt_with_message(panic_info: &PanicInfo) -> ! { + let mut panic_msg = ManagedPanicMessage::default(); + if let Some(args) = panic_info.message() { + panic_msg.append_str("panic occurred: "); + let _ = core::fmt::write(&mut panic_msg, *args); + } else { + panic_msg.append_str("unknown panic occurred"); + }; + + VmApiImpl::error_api_impl().signal_error_from_buffer(panic_msg.buffer.get_handle()) +} + +#[derive(Default)] +struct ManagedPanicMessage { + buffer: ManagedBuffer, +} + +impl ManagedPanicMessage { + fn append_str(&mut self, s: &str) { + self.buffer.append_bytes(s.as_bytes()); + } +} + +impl core::fmt::Write for ManagedPanicMessage { + fn write_str(&mut self, s: &str) -> core::fmt::Result { + self.append_str(s); + Ok(()) + } +} diff --git a/framework/wasm-adapter/src/wasm_alloc.rs b/framework/wasm-adapter/src/wasm_alloc.rs new file mode 100644 index 0000000000..430272772d --- /dev/null +++ b/framework/wasm-adapter/src/wasm_alloc.rs @@ -0,0 +1,12 @@ +mod fail_allocator; +mod leaking_allocator; +mod memory_grow; +mod static_allocator; + +pub use fail_allocator::FailAllocator; +pub use leaking_allocator::LeakingAllocator; +pub use static_allocator::{StaticAllocator, StaticAllocator64K}; + +fn mem_alloc_error() -> ! { + crate::error_hook::signal_error(multiversx_sc::err_msg::MEM_ALLOC_ERROR.as_bytes()) +} diff --git a/framework/wasm-adapter/src/wasm_alloc/fail_allocator.rs b/framework/wasm-adapter/src/wasm_alloc/fail_allocator.rs new file mode 100644 index 0000000000..7f1d82922b --- /dev/null +++ b/framework/wasm-adapter/src/wasm_alloc/fail_allocator.rs @@ -0,0 +1,18 @@ +use core::alloc::{GlobalAlloc, Layout}; + +fn signal_allocation_not_allowed() -> ! { + crate::error_hook::signal_error(&b"memory allocation forbidden"[..]) +} + +/// Allocator that fails (with signal error) whenever an allocation is attempted. +pub struct FailAllocator; + +unsafe impl GlobalAlloc for FailAllocator { + unsafe fn alloc(&self, _layout: Layout) -> *mut u8 { + signal_allocation_not_allowed() + } + + unsafe fn dealloc(&self, _ptr: *mut u8, _layout: Layout) { + signal_allocation_not_allowed() + } +} diff --git a/framework/wasm-adapter/src/wasm_alloc/leaking_allocator.rs b/framework/wasm-adapter/src/wasm_alloc/leaking_allocator.rs new file mode 100644 index 0000000000..59bfa218ab --- /dev/null +++ b/framework/wasm-adapter/src/wasm_alloc/leaking_allocator.rs @@ -0,0 +1,66 @@ +use super::memory_grow::{memory_grow, PageCount, PAGE_SIZE}; +use core::{ + alloc::{GlobalAlloc, Layout}, + cell::UnsafeCell, +}; + +/// A non-thread safe bump-pointer allocator. +/// Does not free or reuse memory. +/// Efficient for small allocations. +/// +/// Largely inspired by lol_alloc: +/// https://github.com/Craig-Macomber/lol_alloc +pub struct LeakingAllocator { + used: UnsafeCell, // bytes + size: UnsafeCell, // bytes +} + +/// Single-threaded context only. +unsafe impl Sync for LeakingAllocator {} + +impl LeakingAllocator { + pub const fn new() -> Self { + LeakingAllocator { + used: UnsafeCell::new(0), + size: UnsafeCell::new(0), + } + } +} + +unsafe impl GlobalAlloc for LeakingAllocator { + unsafe fn alloc(&self, layout: Layout) -> *mut u8 { + let size: &mut usize = &mut *self.size.get(); + let used: &mut usize = &mut *self.used.get(); + // This assumes PAGE_SIZE is always a multiple of the required alignment, which should be true for all practical use. + // If this is not true, this could go past size. + let alignment = layout.align(); + let offset = *used % alignment; + if offset != 0 { + *used += alignment - offset; + } + + let requested_size = layout.size(); + let new_total = *used + requested_size; + if new_total > *size { + // Request enough new space for this allocation, even if we have some space left over from the last one incase they end up non-contiguous. + // Round up to a number of pages + let requested_pages = (requested_size + PAGE_SIZE - 1) / PAGE_SIZE; + let previous_page_count = memory_grow(PageCount(requested_pages)); + + let previous_size = previous_page_count.size_in_bytes(); + if previous_size != *size { + // New memory is not contiguous with old: something else allocated in-between. + // TODO: is handling this case necessary? Maybe make it optional behind a feature? + // This assumes PAGE_SIZE is always a multiple of the required alignment, which should be true for all practical use. + *used = previous_size; + } + *size = previous_size + requested_pages * PAGE_SIZE; + } + + let start = *used; + *used += requested_size; + start as *mut u8 + } + + unsafe fn dealloc(&self, _ptr: *mut u8, _layout: Layout) {} +} diff --git a/framework/wasm-adapter/src/wasm_alloc/memory_grow.rs b/framework/wasm-adapter/src/wasm_alloc/memory_grow.rs new file mode 100644 index 0000000000..865cdcc238 --- /dev/null +++ b/framework/wasm-adapter/src/wasm_alloc/memory_grow.rs @@ -0,0 +1,39 @@ +/// A number of WebAssembly memory pages. +#[derive(Eq, PartialEq)] +pub struct PageCount(pub usize); + +impl PageCount { + pub fn size_in_bytes(self) -> usize { + self.0 * PAGE_SIZE + } +} + +/// The WebAssembly page size, in bytes. +pub const PAGE_SIZE: usize = 65536; + +#[cfg(target_arch = "wasm32")] +pub fn memory_grow(delta: PageCount) -> PageCount { + // This should use `core::arch::wasm` instead of `core::arch::wasm32`, + // but `core::arch::wasm` depends on `#![feature(simd_wasm64)]` on current nightly. + // See https://github.com/Craig-Macomber/lol_alloc/issues/1 + PageCount(core::arch::wasm32::memory_grow(0, delta.0)) +} + +#[cfg(not(target_arch = "wasm32"))] +pub fn memory_grow(_delta: PageCount) -> PageCount { + super::mem_alloc_error() +} + +/// Not currently used, leaving it for reference in case someone needs to access the data. +#[allow(unused)] +#[cfg(target_arch = "wasm32")] +pub fn memory_size() -> PageCount { + PageCount(core::arch::wasm32::memory_size(0)) +} + +/// Not currently used, leaving it for reference in case someone needs to access the data. +#[allow(unused)] +#[cfg(not(target_arch = "wasm32"))] +pub fn memory_size() -> PageCount { + super::mem_alloc_error() +} diff --git a/framework/wasm-adapter/src/wasm_alloc/static_allocator.rs b/framework/wasm-adapter/src/wasm_alloc/static_allocator.rs new file mode 100644 index 0000000000..0b0ae4d87e --- /dev/null +++ b/framework/wasm-adapter/src/wasm_alloc/static_allocator.rs @@ -0,0 +1,56 @@ +use core::{ + alloc::{GlobalAlloc, Layout}, + cell::UnsafeCell, +}; + +/// The pre-allocated buffer size. +/// +/// TODO: make configurable, experiment with it. +pub const SIZE_64K: usize = 64 * 1024; + +pub type StaticAllocator64K = StaticAllocator; + +/// Uses a statically pre-allocated section to allocate all memory. +/// +/// Does not free up memory. Cannot grow beyond what was statically pre-allocated. +/// +/// Never calls `memory.grow`. +/// +/// Largely inspired by this blog post: +/// https://surma.dev/things/rust-to-webassembly/ +#[repr(C, align(32))] +pub struct StaticAllocator { + arena: UnsafeCell<[u8; SIZE]>, + head: UnsafeCell, +} + +impl StaticAllocator { + pub const fn new() -> Self { + StaticAllocator { + arena: UnsafeCell::new([0; SIZE]), + head: UnsafeCell::new(0), + } + } +} + +unsafe impl Sync for StaticAllocator {} + +unsafe impl GlobalAlloc for StaticAllocator { + unsafe fn alloc(&self, layout: Layout) -> *mut u8 { + let size = layout.size(); + let align = layout.align(); + + // Find the next address that has the right alignment. + let idx = (*self.head.get()).next_multiple_of(align); + // Bump the head to the next free byte + *self.head.get() = idx + size; + let arena: &mut [u8; SIZE] = &mut (*self.arena.get()); + // If we ran out of arena space, kill execution with mem_alloc_error. + match arena.get_mut(idx) { + Some(item) => item as *mut u8, + _ => super::mem_alloc_error(), + } + } + + unsafe fn dealloc(&self, _ptr: *mut u8, _layout: Layout) {} +} diff --git a/framework/wasm-adapter/src/wasm_deps.rs b/framework/wasm-adapter/src/wasm_deps.rs deleted file mode 100644 index db74d8bc95..0000000000 --- a/framework/wasm-adapter/src/wasm_deps.rs +++ /dev/null @@ -1,22 +0,0 @@ -pub use alloc::alloc::Layout; -pub use core::panic::PanicInfo; -pub use wee_alloc::WeeAlloc; - -pub fn alloc_error_handler(_layout: Layout) -> ! { - crate::error_hook::signal_error(&b"allocation error"[..]) -} - -pub fn panic_fmt(_: &PanicInfo) -> ! { - crate::error_hook::signal_error(multiversx_sc::err_msg::PANIC_OCCURRED.as_bytes()) -} - -pub fn panic_fmt_with_message(panic_info: &PanicInfo) -> ! { - use alloc::string::String; - let panic_msg = if let Some(s) = panic_info.message() { - alloc::format!("panic occurred: {s:?}") - } else { - String::from("unknown panic occurred") - }; - - crate::error_hook::signal_error(panic_msg.as_bytes()) -} diff --git a/framework/wasm-adapter/src/wasm_macros.rs b/framework/wasm-adapter/src/wasm_macros.rs index 4a44cfb341..a2bf51dd20 100644 --- a/framework/wasm-adapter/src/wasm_macros.rs +++ b/framework/wasm-adapter/src/wasm_macros.rs @@ -2,22 +2,31 @@ macro_rules! allocator { () => { #[global_allocator] - static ALLOC: multiversx_sc_wasm_adapter::wasm_deps::WeeAlloc = - multiversx_sc_wasm_adapter::wasm_deps::WeeAlloc::INIT; + static ALLOC: multiversx_sc_wasm_adapter::wasm_alloc::FailAllocator = + multiversx_sc_wasm_adapter::wasm_alloc::FailAllocator; + }; + (leaking) => { + #[global_allocator] + static ALLOC: multiversx_sc_wasm_adapter::wasm_alloc::LeakingAllocator = + multiversx_sc_wasm_adapter::wasm_alloc::LeakingAllocator::new(); + }; + (static64k) => { + #[global_allocator] + static ALLOC: multiversx_sc_wasm_adapter::wasm_alloc::StaticAllocator64K = + multiversx_sc_wasm_adapter::wasm_alloc::StaticAllocator64K::new(); + }; + (wee_alloc) => { + #[global_allocator] + static ALLOC: wee_alloc::WeeAlloc = wee_alloc::WeeAlloc::INIT; }; } #[macro_export] macro_rules! panic_handler { () => { - #[alloc_error_handler] - fn alloc_error_handler(layout: multiversx_sc_wasm_adapter::wasm_deps::Layout) -> ! { - multiversx_sc_wasm_adapter::wasm_deps::alloc_error_handler(layout) - } - #[panic_handler] - fn panic_fmt(panic_info: &multiversx_sc_wasm_adapter::wasm_deps::PanicInfo) -> ! { - multiversx_sc_wasm_adapter::wasm_deps::panic_fmt(panic_info) + fn panic_fmt(panic_info: &multiversx_sc_wasm_adapter::panic::PanicInfo) -> ! { + multiversx_sc_wasm_adapter::panic::panic_fmt(panic_info) } #[lang = "eh_personality"] @@ -28,14 +37,9 @@ macro_rules! panic_handler { #[macro_export] macro_rules! panic_handler_with_message { () => { - #[alloc_error_handler] - fn alloc_error_handler(layout: multiversx_sc_wasm_adapter::wasm_deps::Layout) -> ! { - multiversx_sc_wasm_adapter::wasm_deps::alloc_error_handler(layout) - } - #[panic_handler] - fn panic_fmt(panic_info: &multiversx_sc_wasm_adapter::wasm_deps::PanicInfo) -> ! { - multiversx_sc_wasm_adapter::wasm_deps::panic_fmt_with_message(panic_info) + fn panic_fmt(panic_info: &multiversx_sc_wasm_adapter::panic::PanicInfo) -> ! { + multiversx_sc_wasm_adapter::panic::panic_fmt_with_message(panic_info) } #[lang = "eh_personality"] diff --git a/publish.sh b/publish.sh index 08f3f2864e..114d8e4833 100755 --- a/publish.sh +++ b/publish.sh @@ -48,13 +48,15 @@ # The title should be the released crates and versions, same as in the changelog and the commit message. # The description should be copied from CHANGELOG.md, as is. # -# 11. Create pull request on GitHub. The faster it gets merged in master, the better. +# 11. Run `sc-meta all update`. This will update the `Cargo.lock` files. # -# 12. (optional) Test the new framework on one of the contracts that are not in the same repo, e.g. DNS, DEX, etc. +# 12. Create pull request on GitHub. The faster it gets merged in master, the better. # -# 13. Post in Slack to `release-announcements`. +# 13. (optional) Test the new framework on one of the contracts that are not in the same repo, e.g. DNS, DEX, etc. # -# 14. Write a release announcement in Confluence. +# 14. Post in Slack to `release-announcements`. +# +# 15. Write a release announcement in Confluence. # cd sdk/core @@ -65,11 +67,11 @@ cd sdk/scenario-format/ cargo publish || return 1 cd ../.. -cd framework/codec-derive +cd data/codec-derive cargo publish || return 1 cd ../.. -cd framework/codec +cd data/codec cargo publish || return 1 cd ../.. diff --git a/sdk/core/Cargo.toml b/sdk/core/Cargo.toml index ae2bfefd11..723eb98205 100644 --- a/sdk/core/Cargo.toml +++ b/sdk/core/Cargo.toml @@ -20,10 +20,10 @@ tokio = { version = "1.24", features = ["full"] } reqwest = { version = "0.11.4", features = ["blocking", "json"] } serde = { version = "1.0.130", features = ["derive"] } serde_json = { version = "1.0.68", features = ["preserve_order"] } -serde_repr = "0.1.7" +serde_repr = "0.1.8" anyhow = "1.0.44" -rand = "0.6.0" -bip39 = "1.0.1" +rand = "0.8.5" +bip39 = { version = "2.0.0", features = ["rand"] } sha2 = "0.9.8" sha3 = "0.9.1" hmac = { version = "0.11.0", features = ["std"] } diff --git a/sdk/core/src/wallet.rs b/sdk/core/src/wallet.rs index ff96953e79..159a1e6098 100644 --- a/sdk/core/src/wallet.rs +++ b/sdk/core/src/wallet.rs @@ -30,8 +30,7 @@ pub struct Wallet { impl Wallet { // GenerateMnemonic will generate a new mnemonic value using the bip39 implementation pub fn generate_mnemonic() -> Mnemonic { - let mut rng = rand::thread_rng(); - Mnemonic::generate_in_with(&mut rng, Language::English, 24).unwrap() + Mnemonic::generate_in(Language::English, 24).unwrap() } fn seed_from_mnemonic(mnemonic: Mnemonic, password: &str) -> [u8; 64] { diff --git a/tools/mxpy-snippet-generator/Cargo.toml b/tools/mxpy-snippet-generator/Cargo.toml index 14b9ead756..d40fa7b068 100644 --- a/tools/mxpy-snippet-generator/Cargo.toml +++ b/tools/mxpy-snippet-generator/Cargo.toml @@ -10,7 +10,7 @@ name = "mxpy-snippet-generator" path = "src/mxpy_snippet_generator.rs" [dependencies.multiversx-sc] -version = "0.39.7" +version = "0.41.3" path = "../../framework/base" [dependencies] diff --git a/tools/rust-debugger/format-tests/Cargo.toml b/tools/rust-debugger/format-tests/Cargo.toml index 88768e1150..6d3877d6ad 100644 --- a/tools/rust-debugger/format-tests/Cargo.toml +++ b/tools/rust-debugger/format-tests/Cargo.toml @@ -9,11 +9,11 @@ name = "format-tests" path = "src/format_tests.rs" [dependencies.multiversx-sc] -version = "0.39.7" +version = "0.41.3" path = "../../../framework/base" [dependencies.multiversx-chain-vm] -version = "0.1.7" +version = "0.3.3" path = "../../../vm" [dev-dependencies] diff --git a/tools/rust-debugger/format-tests/src/format_tests.rs b/tools/rust-debugger/format-tests/src/format_tests.rs index eab7ac45cf..8e8c869fd7 100644 --- a/tools/rust-debugger/format-tests/src/format_tests.rs +++ b/tools/rust-debugger/format-tests/src/format_tests.rs @@ -152,7 +152,7 @@ fn main() { > = ManagedOption::some(managed_vec_of_addresses.clone()); push!(to_check, managed_option_of_vec_of_addresses, "ManagedOption::some((1) { [0] = (32) 0x000000000000000000010000000000000000000000000000000000000002ffff })"); - // 5. Elrond wasm - heap + // 5. SC wasm - heap let heap_address: Address = managed_address.to_address(); push!( to_check, @@ -174,7 +174,7 @@ fn main() { "(3) { [0] = (2) 0x6162, [1] = (4) 0x61626364, [2] = (12) 0x6162636465666768696a6b6c }" ); - // 6. Elrond codec - Multi-types + // 6. MultiversX codec - Multi-types let optional_value_some: OptionalValue> = OptionalValue::Some(BigUint::from(42u64)); push!(to_check, optional_value_some, "OptionalValue::Some(42)"); diff --git a/tools/rust-debugger/pretty-printers/multiversx_sc_lldb_pretty_printers.py b/tools/rust-debugger/pretty-printers/multiversx_sc_lldb_pretty_printers.py index 4d0ff8996f..71c2d5a257 100644 --- a/tools/rust-debugger/pretty-printers/multiversx_sc_lldb_pretty_printers.py +++ b/tools/rust-debugger/pretty-printers/multiversx_sc_lldb_pretty_printers.py @@ -15,7 +15,7 @@ NUM_BIG_INT_TYPE = "num_bigint::bigint::BigInt" NUM_BIG_UINT_TYPE = "num_bigint::biguint::BigUint" -# 2. Elrond wasm - Managed basic types +# 2. SC wasm - Managed basic types MOD_PATH = "multiversx_sc::types::managed::basic" BIG_INT_TYPE = f"{MOD_PATH}::big_int::BigInt<{DEBUG_API_TYPE}>" @@ -23,7 +23,7 @@ BIG_FLOAT_TYPE = f"{MOD_PATH}::big_float::BigFloat<{DEBUG_API_TYPE}>" MANAGED_BUFFER_TYPE = f"{MOD_PATH}::managed_buffer::ManagedBuffer<{DEBUG_API_TYPE}>" -# 3. Elrond wasm - Managed wrapped types +# 3. SC wasm - Managed wrapped types MOD_PATH = "multiversx_sc::types::managed::wrapped" TOKEN_IDENTIFIER_TYPE = f"{MOD_PATH}::token_identifier::TokenIdentifier<{DEBUG_API_TYPE}>" @@ -42,15 +42,15 @@ MANAGED_VEC_INNER_TYPE_INDEX = 1 MANAGED_VEC_TYPE = f"{MOD_PATH}::managed_vec::ManagedVec<{DEBUG_API_TYPE}, {ANY_TYPE}>" -# 4. Elrond wasm - Managed multi value types +# 4. SC wasm - Managed multi value types -# 5. Elrond wasm - heap +# 5. SC wasm - heap MOD_PATH = "multiversx_sc::types::heap" HEAP_ADDRESS_TYPE = f"{MOD_PATH}::h256_address::Address" BOXED_BYTES_TYPE = f"{MOD_PATH}::boxed_bytes::BoxedBytes" -# 6. Elrond codec - Multi-types +# 6. MultiversX codec - Multi-types MOD_PATH = "multiversx_sc_codec::multi_types" OPTIONAL_VALUE_TYPE = f"{MOD_PATH}::multi_value_optional::OptionalValue<{ANY_TYPE}>::{SOME_OR_NONE}" @@ -460,12 +460,12 @@ def summary(self, optional_value: lldb.value) -> str: # 1. num_bigint library (NUM_BIG_INT_TYPE, NumBigInt), (NUM_BIG_UINT_TYPE, NumBigUint), - # 2. Elrond wasm - Managed basic types + # 2. SC wasm - Managed basic types (BIG_INT_TYPE, BigInt), (BIG_UINT_TYPE, BigInt), (BIG_FLOAT_TYPE, BigFloat), (MANAGED_BUFFER_TYPE, ManagedBuffer), - # 3. Elrond wasm - Managed wrapped types + # 3. SC wasm - Managed wrapped types (TOKEN_IDENTIFIER_TYPE, TokenIdentifier), (MANAGED_ADDRESS_TYPE, ManagedAddress), (MANAGED_BYTE_ARRAY_TYPE, ManagedByteArray), @@ -473,11 +473,11 @@ def summary(self, optional_value: lldb.value) -> str: (ESDT_TOKEN_PAYMENT_TYPE, EsdtTokenPayment), (EGLD_OR_ESDT_TOKEN_IDENTIFIER_TYPE, EgldOrEsdtTokenIdentifier), (MANAGED_VEC_TYPE, ManagedVec), - # 4. Elrond wasm - Managed multi value types - # 5. Elrond wasm - heap + # 4. SC wasm - Managed multi value types + # 5. SC wasm - heap (HEAP_ADDRESS_TYPE, HeapAddress), (BOXED_BYTES_TYPE, BoxedBytes), - # 6. Elrond codec - Multi-types + # 6. MultiversX codec - Multi-types (OPTIONAL_VALUE_TYPE, OptionalValue), ] diff --git a/tools/test-gen/.gitignore b/tools/test-gen/.gitignore deleted file mode 100644 index d11458891e..0000000000 --- a/tools/test-gen/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -# Output files -mandos_go_test.rs -mandos_rs_test.rs diff --git a/tools/test-gen/Cargo.toml b/tools/test-gen/Cargo.toml deleted file mode 100644 index cd412f99c4..0000000000 --- a/tools/test-gen/Cargo.toml +++ /dev/null @@ -1,11 +0,0 @@ -[package] -name = "test-gen" -version = "0.0.0" -authors = ["Andrei Marinica "] -edition = "2021" - -[[bin]] -name = "test-gen" -path = "src/test_gen.rs" - -[dependencies] diff --git a/tools/test-gen/src/test_gen.rs b/tools/test-gen/src/test_gen.rs deleted file mode 100644 index 7561bf24d5..0000000000 --- a/tools/test-gen/src/test_gen.rs +++ /dev/null @@ -1,80 +0,0 @@ -use std::{env, fs, fs::File, io::Write}; - -/// Examples how to run: -/// `cargo run ../../contracts/examples/multisig/scenario` -/// `cargo run ../../contracts/feature-tests/basic-features/scenario` -fn main() { - let args: Vec = env::args().collect(); - let files_path = &args[1]; - - let names = read_dirs(files_path); - - let mut rs_file = File::create("mandos_rs_test.rs").unwrap(); - print_mandos_rs(&mut rs_file, names.as_slice()); - - let mut go_file = File::create("mandos_go_test.rs").unwrap(); - print_mandos_go(&mut go_file, names.as_slice()); -} - -fn split_file_name(name: String, separator: &str) -> Vec { - let splitted_name = name.split(separator); - let collection: Vec<&str> = splitted_name.collect(); - let mut converted_collection: Vec = Vec::new(); - - for item in collection { - converted_collection.push(String::from(item)); - } - - converted_collection -} - -fn read_dirs(path: &str) -> Vec { - let paths = fs::read_dir(path).unwrap(); - let mut names: Vec = Vec::new(); - - for dir in paths { - let dir_abs_path = dir.unwrap().path().into_os_string().into_string().unwrap(); - let mut splitted_files_name: Vec = split_file_name(dir_abs_path, "/"); - let files_name_with_extension = splitted_files_name.pop().unwrap(); - if files_name_with_extension.ends_with(".scen.json") { - splitted_files_name = split_file_name(files_name_with_extension, "."); - let files_names = String::from(splitted_files_name.first().unwrap()); - names.push(files_names); - } - } - - names.sort(); - names -} - -fn print_mandos_rs(file: &mut File, names: &[String]) { - for name in names.iter() { - writeln!( - file, - "#[test] -fn {}_rs() {{ - multiversx_sc_scenario::run_rs(\"scenarios/{}.scen.json\", world()); -}} -", - name.replace('-', "_").to_lowercase(), - name - ) - .unwrap(); - } -} - -fn print_mandos_go(file: &mut File, names: &[String]) { - for name in names.iter() { - writeln!( - file, - "#[test] -fn {}_go() {{ - multiversx_chain_vm::run_go(\"scenarios/{}.scen.json\"); -}} -", - name.replace('-', "_").to_lowercase(), - name - ) - .unwrap(); - } -} diff --git a/vm/Cargo.toml b/vm/Cargo.toml index 86a5fb51e1..0a59a14f90 100644 --- a/vm/Cargo.toml +++ b/vm/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "multiversx-chain-vm" -version = "0.1.7" +version = "0.3.3" edition = "2021" authors = [ @@ -31,12 +31,12 @@ itertools = "0.10.3" bech32 = "0.9" [dependencies.multiversx-sc] -version = "=0.39.7" +version = "=0.41.3" path = "../framework/base" features = ["alloc", "num-bigint", "promises", "big-float"] [dependencies.multiversx-sc-meta] -version = "=0.39.7" +version = "=0.41.3" path = "../framework/meta" [dependencies.multiversx-chain-scenario-format] @@ -44,5 +44,5 @@ version = "0.19.1" path = "../sdk/scenario-format" [dev-dependencies.multiversx-sc-meta] # only used in the sample_adder test -version = "=0.39.7" +version = "=0.41.3" path = "../framework/meta" diff --git a/vm/src/api/managed_types/big_int_api_mock.rs b/vm/src/api/managed_types/big_int_api_mock.rs index 5f72c4ac20..05635ab724 100644 --- a/vm/src/api/managed_types/big_int_api_mock.rs +++ b/vm/src/api/managed_types/big_int_api_mock.rs @@ -16,7 +16,7 @@ use super::managed_type_util::big_int_to_i64; fn assert_positive(bi: &num_bigint::BigInt) { assert!( - bi.sign() == num_bigint::Sign::Minus, + bi.sign() != num_bigint::Sign::Minus, "bitwise operations only allowed on positive integers" ); } diff --git a/vm/src/world_mock/esdt_instance.rs b/vm/src/world_mock/esdt_instance.rs index d0716da012..ad8c0e5d76 100644 --- a/vm/src/world_mock/esdt_instance.rs +++ b/vm/src/world_mock/esdt_instance.rs @@ -3,7 +3,7 @@ use num_traits::Zero; use super::EsdtInstanceMetadata; -/// Holds the data for a Elrond standard digital token transaction +/// Holds the data for a MultiversX standard digital token transaction #[derive(Clone, Default, Debug)] pub struct EsdtInstance { pub nonce: u64, diff --git a/vm/src/world_mock/esdt_instance_metadata.rs b/vm/src/world_mock/esdt_instance_metadata.rs index 431840eab7..daa37e77cc 100644 --- a/vm/src/world_mock/esdt_instance_metadata.rs +++ b/vm/src/world_mock/esdt_instance_metadata.rs @@ -1,6 +1,6 @@ use multiversx_sc::types::heap::Address; -/// Holds the data for a Elrond standard digital token transaction +/// Holds the data for a MultiversX standard digital token transaction #[derive(Clone, Default, Debug)] pub struct EsdtInstanceMetadata { pub name: Vec, diff --git a/vm/tests/derive_managed_vec_item_struct_2_test.rs b/vm/tests/derive_managed_vec_item_struct_2_test.rs index 7ca82cf34d..af19746593 100644 --- a/vm/tests/derive_managed_vec_item_struct_2_test.rs +++ b/vm/tests/derive_managed_vec_item_struct_2_test.rs @@ -15,6 +15,7 @@ pub struct Struct2 { pub u_64: u64, pub bool_field: bool, pub opt_field: Option, + pub arr: [u16; 2], } #[test] @@ -22,7 +23,7 @@ pub struct Struct2 { fn struct_2_static() { assert_eq!( ::PAYLOAD_SIZE, - 18 + 22 ); assert!(!::SKIPS_RESERIALIZATION); } @@ -36,6 +37,7 @@ fn struct_to_bytes_writer() { u_64: 4u64, bool_field: true, opt_field: Some(5), + arr: [0x6111, 0x6222], }; #[rustfmt::skip] @@ -46,6 +48,7 @@ fn struct_to_bytes_writer() { /* u_64 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, /* bool */ 0x01, /* opt */ 0x01, 0x05, + /* arr */ 0x61, 0x11, 0x62, 0x22, ]; ::to_byte_writer(&s, |bytes| { @@ -63,6 +66,7 @@ fn struct_2_from_bytes_reader() { u_64: 4u64, bool_field: false, opt_field: Some(5), + arr: [0x6111, 0x6222], }; #[rustfmt::skip] @@ -73,6 +77,7 @@ fn struct_2_from_bytes_reader() { /* u_64 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, /* bool */ 0x00, /* opt */ 0x01, 0x05, + /* arr */ 0x61, 0x11, 0x62, 0x22, ]; let struct_from_bytes = diff --git a/vm/tests/test_hash_unordered_set_mapper.rs b/vm/tests/test_hash_unordered_set_mapper.rs index c448dd9488..09c2d9eab7 100644 --- a/vm/tests/test_hash_unordered_set_mapper.rs +++ b/vm/tests/test_hash_unordered_set_mapper.rs @@ -16,6 +16,58 @@ fn check_set(set: &UnorderedSetMapper, expected: Vec) { assert_eq!(actual, expected); } +#[test] +fn test_swap_indexes() { + let mut set = create_set(); + set.insert(42); + set.insert(43); + set.insert(44); + set.insert(45); + assert_eq!(set.get_by_index(1), 42); + assert_eq!(set.get_by_index(2), 43); + assert_eq!(set.get_by_index(3), 44); + assert_eq!(set.get_by_index(4), 45); + assert_eq!(set.get_index(&42), 1); + assert_eq!(set.get_index(&43), 2); + assert_eq!(set.get_index(&44), 3); + assert_eq!(set.get_index(&45), 4); + set.swap_indexes(1, 3); + assert_eq!(set.get_by_index(1), 44); + assert_eq!(set.get_by_index(2), 43); + assert_eq!(set.get_by_index(3), 42); + assert_eq!(set.get_by_index(4), 45); + assert_eq!(set.get_index(&42), 3); + assert_eq!(set.get_index(&43), 2); + assert_eq!(set.get_index(&44), 1); + assert_eq!(set.get_index(&45), 4); +} + +#[test] +fn test_swap_indexes_equal() { + let mut set = create_set(); + set.insert(42); + set.insert(43); + set.insert(44); + set.insert(45); + assert_eq!(set.get_by_index(1), 42); + assert_eq!(set.get_by_index(2), 43); + assert_eq!(set.get_by_index(3), 44); + assert_eq!(set.get_by_index(4), 45); + assert_eq!(set.get_index(&42), 1); + assert_eq!(set.get_index(&43), 2); + assert_eq!(set.get_index(&44), 3); + assert_eq!(set.get_index(&45), 4); + set.swap_indexes(3, 3); + assert_eq!(set.get_by_index(1), 42); + assert_eq!(set.get_by_index(2), 43); + assert_eq!(set.get_by_index(3), 44); + assert_eq!(set.get_by_index(4), 45); + assert_eq!(set.get_index(&42), 1); + assert_eq!(set.get_index(&43), 2); + assert_eq!(set.get_index(&44), 3); + assert_eq!(set.get_index(&45), 4); +} + #[test] fn test_hash_set_simple() { let mut set = create_set(); From 8b77614cf00b999cd55f1e9b86fdcd8b50b3679f Mon Sep 17 00:00:00 2001 From: Alin Cruceat Date: Thu, 10 Aug 2023 10:05:09 +0300 Subject: [PATCH 03/15] trait rename by config file --- contracts/examples/adder/template.toml | 4 +++- framework/meta/src/cmd/standalone.rs | 2 +- framework/meta/src/cmd/standalone/upgrade.rs | 2 +- .../meta/src/template/template_adjuster.rs | 24 +++++++++++++++++-- .../meta/src/template/template_download.rs | 11 +++++++-- framework/meta/tests/template_test.rs | 3 ++- 6 files changed, 38 insertions(+), 8 deletions(-) diff --git a/contracts/examples/adder/template.toml b/contracts/examples/adder/template.toml index 4dea7b954f..48136c0653 100644 --- a/contracts/examples/adder/template.toml +++ b/contracts/examples/adder/template.toml @@ -1,4 +1,6 @@ -name = "adder" +contract_trait = "Adder" +src_file = "adder.rs" +package_name = "adder" rename_pairs = [ [ diff --git a/framework/meta/src/cmd/standalone.rs b/framework/meta/src/cmd/standalone.rs index 1730f489b3..f1ec44c4a1 100644 --- a/framework/meta/src/cmd/standalone.rs +++ b/framework/meta/src/cmd/standalone.rs @@ -2,7 +2,7 @@ mod all; mod info; mod local_deps; pub mod scen_test_gen; -mod upgrade; +pub(crate) mod upgrade; use crate::{ cli_args::{StandaloneCliAction, StandaloneCliArgs}, diff --git a/framework/meta/src/cmd/standalone/upgrade.rs b/framework/meta/src/cmd/standalone/upgrade.rs index 92e4fe0866..2960526702 100644 --- a/framework/meta/src/cmd/standalone/upgrade.rs +++ b/framework/meta/src/cmd/standalone/upgrade.rs @@ -1,7 +1,7 @@ mod upgrade_0_31; mod upgrade_0_32; mod upgrade_0_39; -mod upgrade_common; +pub(crate) mod upgrade_common; mod upgrade_print; mod upgrade_selector; mod upgrade_versions; diff --git a/framework/meta/src/template/template_adjuster.rs b/framework/meta/src/template/template_adjuster.rs index 2529853f59..ee036592af 100644 --- a/framework/meta/src/template/template_adjuster.rs +++ b/framework/meta/src/template/template_adjuster.rs @@ -1,9 +1,10 @@ +use crate::{cmd::standalone::upgrade::upgrade_common::replace_in_files, CargoTomlContents}; +use ruplacer::Query; use toml::value::Table; -use crate::CargoTomlContents; - use super::TemplateDownloader; +const TEMPLATE_TOML: &str = "./template.toml"; const ROOT_CARGO_TOML: &str = "./Cargo.toml"; const META_CARGO_TOML: &str = "./meta/Cargo.toml"; const WASM_CARGO_TOML: &str = "./wasm/Cargo.toml"; @@ -54,6 +55,25 @@ impl TemplateAdjuster { fn template_name(&self, downloader: &TemplateDownloader) -> String { downloader.template_source.metadata.name.clone() } + + pub fn rename_trait_to(&self, downloader: &TemplateDownloader, new_template_name: String) { + let cargo_toml_path = downloader.target_path.join(TEMPLATE_TOML); + let toml = CargoTomlContents::load_from_file(&cargo_toml_path); + + let contract_trait = toml + .toml_value + .get("contract_trait") + .expect("missing contract_trait in template.toml") + .as_str() + .expect("contract_trait not a string value") + .to_string(); + + replace_in_files( + &downloader.target_path, + "*rs", + &[Query::substring(&contract_trait, &new_template_name)][..], + ); + } } pub fn remove_paths_from_dependencies(deps_map: &mut Table, ignore_deps: &[&str]) { for (key, value) in deps_map { diff --git a/framework/meta/src/template/template_download.rs b/framework/meta/src/template/template_download.rs index cb30dd1b6b..ca6d276e4a 100644 --- a/framework/meta/src/template/template_download.rs +++ b/framework/meta/src/template/template_download.rs @@ -1,6 +1,6 @@ -use std::path::PathBuf; - use crate::cli_args::TemplateArgs; +use convert_case::{Case, Casing}; +use std::path::PathBuf; use super::{ repo_temp_download::RepoSource, @@ -16,6 +16,8 @@ pub async fn template_download(args: &TemplateArgs) { args.name.clone(), ); downloader.template_download(); + downloader.update_dependencies(); + downloader.rename_trait_to(args.template.to_case(Case::UpperCamel)); } pub struct TemplateDownloader<'a> { @@ -43,6 +45,11 @@ impl<'a> TemplateDownloader<'a> { pub fn template_download(&self) { self.template_source.copy_template(&self.target_path); + } + pub fn update_dependencies(&self) { self.adjuster.update_dependencies(&self); } + pub fn rename_trait_to(&self, new_template_name: String) { + self.adjuster.rename_trait_to(&self, new_template_name); + } } diff --git a/framework/meta/tests/template_test.rs b/framework/meta/tests/template_test.rs index 6cd33eb518..b01fdb7468 100644 --- a/framework/meta/tests/template_test.rs +++ b/framework/meta/tests/template_test.rs @@ -31,7 +31,8 @@ async fn test_template_download() { let downloader = TemplateDownloader::new(&repo_source, "adder".to_string(), target_dir.clone()); downloader.template_download(); - + downloader.update_dependencies(); + downloader.rename_trait_to("NewAdder".to_string()); cargo_test(target_dir); } From d0fc70185f06e537ca54b5f4e48a26caa30c1fbd Mon Sep 17 00:00:00 2001 From: Alin Cruceat Date: Thu, 10 Aug 2023 11:37:24 +0300 Subject: [PATCH 04/15] template adjuster refactor --- .../meta/src/template/template_adjuster.rs | 86 ++++++++++++++----- .../meta/src/template/template_download.rs | 8 +- 2 files changed, 68 insertions(+), 26 deletions(-) diff --git a/framework/meta/src/template/template_adjuster.rs b/framework/meta/src/template/template_adjuster.rs index ee036592af..ebfcf8d163 100644 --- a/framework/meta/src/template/template_adjuster.rs +++ b/framework/meta/src/template/template_adjuster.rs @@ -1,25 +1,71 @@ +use std::path::PathBuf; + use crate::{cmd::standalone::upgrade::upgrade_common::replace_in_files, CargoTomlContents}; use ruplacer::Query; use toml::value::Table; -use super::TemplateDownloader; - const TEMPLATE_TOML: &str = "./template.toml"; const ROOT_CARGO_TOML: &str = "./Cargo.toml"; const META_CARGO_TOML: &str = "./meta/Cargo.toml"; const WASM_CARGO_TOML: &str = "./wasm/Cargo.toml"; -pub struct TemplateAdjuster; +pub struct TemplateAdjuster { + pub target_path: PathBuf, + pub template_name: String, + pub contract_trait: String, + pub src_file: String, + pub package_name: String, + pub rename_pairs: Vec, +} impl TemplateAdjuster { - pub fn update_dependencies(&self, downloader: &TemplateDownloader) { - self.update_dependencies_root(downloader); - self.update_dependencies_wasm(downloader); - self.update_dependencies_meta(downloader); + pub fn new(target_path: PathBuf, template_name: String) -> Self { + let cargo_toml_path = target_path.join(TEMPLATE_TOML); + let toml = CargoTomlContents::load_from_file(&cargo_toml_path); + Self { + target_path, + template_name, + contract_trait: toml + .toml_value + .get("contract_trait") + .expect("missing contract_trait in template.toml") + .as_str() + .expect("contract_trait not a string value") + .to_string(), + src_file: toml + .toml_value + .get("contract_trait") + .expect("missing src_file in template.toml") + .as_str() + .expect("src_file not a string value") + .to_string(), + package_name: toml + .toml_value + .get("contract_trait") + .expect("missing package_name in template.toml") + .as_str() + .expect("package_name not a string value") + .to_string(), + rename_pairs: toml + .toml_value + .get("rename_pairs") + .expect("missing contract_trait in template.toml") + .as_array() + .expect("package_name not an array value") + .iter() + .map(|value| value.to_string()) + .collect(), + } } - fn update_dependencies_root(&self, downloader: &TemplateDownloader) { - let cargo_toml_path = downloader.target_path.join(ROOT_CARGO_TOML); + pub fn update_dependencies(&self) { + self.update_dependencies_root(); + self.update_dependencies_wasm(); + self.update_dependencies_meta(); + } + + fn update_dependencies_root(&self) { + let cargo_toml_path = self.target_path.join(ROOT_CARGO_TOML); let mut toml = CargoTomlContents::load_from_file(&cargo_toml_path); let deps_map = toml.dependencies_mut(); @@ -32,32 +78,28 @@ impl TemplateAdjuster { toml.save_to_file(&cargo_toml_path); } - fn update_dependencies_meta(&self, downloader: &TemplateDownloader) { - let cargo_toml_path = downloader.target_path.join(META_CARGO_TOML); + fn update_dependencies_meta(&self) { + let cargo_toml_path = self.target_path.join(META_CARGO_TOML); let mut toml = CargoTomlContents::load_from_file(&cargo_toml_path); let deps_map = toml.dependencies_mut(); - remove_paths_from_dependencies(deps_map, &[self.template_name(downloader).as_str()]); + remove_paths_from_dependencies(deps_map, &[&self.template_name]); toml.save_to_file(&cargo_toml_path); } - fn update_dependencies_wasm(&self, downloader: &TemplateDownloader) { - let cargo_toml_path = downloader.target_path.join(WASM_CARGO_TOML); + fn update_dependencies_wasm(&self) { + let cargo_toml_path = self.target_path.join(WASM_CARGO_TOML); let mut toml = CargoTomlContents::load_from_file(&cargo_toml_path); let deps_map = toml.dependencies_mut(); - remove_paths_from_dependencies(deps_map, &[self.template_name(downloader).as_str()]); + remove_paths_from_dependencies(deps_map, &[&self.template_name]); toml.save_to_file(&cargo_toml_path); } - fn template_name(&self, downloader: &TemplateDownloader) -> String { - downloader.template_source.metadata.name.clone() - } - - pub fn rename_trait_to(&self, downloader: &TemplateDownloader, new_template_name: String) { - let cargo_toml_path = downloader.target_path.join(TEMPLATE_TOML); + pub fn rename_trait_to(&self, new_template_name: String) { + let cargo_toml_path = self.target_path.join(TEMPLATE_TOML); let toml = CargoTomlContents::load_from_file(&cargo_toml_path); let contract_trait = toml @@ -69,7 +111,7 @@ impl TemplateAdjuster { .to_string(); replace_in_files( - &downloader.target_path, + &self.target_path, "*rs", &[Query::substring(&contract_trait, &new_template_name)][..], ); diff --git a/framework/meta/src/template/template_download.rs b/framework/meta/src/template/template_download.rs index ca6d276e4a..e69f83e607 100644 --- a/framework/meta/src/template/template_download.rs +++ b/framework/meta/src/template/template_download.rs @@ -38,8 +38,8 @@ impl<'a> TemplateDownloader<'a> { TemplateDownloader { repo_source, template_source, - target_path, - adjuster: TemplateAdjuster, + target_path: target_path.clone(), + adjuster: TemplateAdjuster::new(target_path, template_name), } } @@ -47,9 +47,9 @@ impl<'a> TemplateDownloader<'a> { self.template_source.copy_template(&self.target_path); } pub fn update_dependencies(&self) { - self.adjuster.update_dependencies(&self); + self.adjuster.update_dependencies(); } pub fn rename_trait_to(&self, new_template_name: String) { - self.adjuster.rename_trait_to(&self, new_template_name); + self.adjuster.rename_trait_to(new_template_name); } } From e20a1da1561904f674657b323b5cbc70508d43e6 Mon Sep 17 00:00:00 2001 From: Alin Cruceat Date: Thu, 10 Aug 2023 12:58:47 +0300 Subject: [PATCH 05/15] update cargo toml --- contracts/examples/adder/template.toml | 3 +- contracts/examples/empty/template.toml | 2 + .../meta/src/template/template_adjuster.rs | 136 +++++++++++------- .../meta/src/template/template_download.rs | 10 +- .../meta/src/template/template_metadata.rs | 12 +- framework/meta/tests/template_test.rs | 2 +- 6 files changed, 99 insertions(+), 66 deletions(-) diff --git a/contracts/examples/adder/template.toml b/contracts/examples/adder/template.toml index 48136c0653..f942502afc 100644 --- a/contracts/examples/adder/template.toml +++ b/contracts/examples/adder/template.toml @@ -1,7 +1,6 @@ +name = "adder" contract_trait = "Adder" src_file = "adder.rs" -package_name = "adder" - rename_pairs = [ [ "blockchain.set_current_dir_from_workspace(\"contracts/examples/adder\");", diff --git a/contracts/examples/empty/template.toml b/contracts/examples/empty/template.toml index eeb4aade61..adf83e1da0 100644 --- a/contracts/examples/empty/template.toml +++ b/contracts/examples/empty/template.toml @@ -1,3 +1,5 @@ name = "empty" +contract_trait = "EmptyContract" +src_file = "empty.rs" rename_pairs = [] diff --git a/framework/meta/src/template/template_adjuster.rs b/framework/meta/src/template/template_adjuster.rs index ebfcf8d163..68737cd877 100644 --- a/framework/meta/src/template/template_adjuster.rs +++ b/framework/meta/src/template/template_adjuster.rs @@ -1,60 +1,24 @@ use std::path::PathBuf; +use super::template_metadata::TemplateMetadata; use crate::{cmd::standalone::upgrade::upgrade_common::replace_in_files, CargoTomlContents}; +use convert_case::{Case, Casing}; use ruplacer::Query; use toml::value::Table; -const TEMPLATE_TOML: &str = "./template.toml"; const ROOT_CARGO_TOML: &str = "./Cargo.toml"; const META_CARGO_TOML: &str = "./meta/Cargo.toml"; const WASM_CARGO_TOML: &str = "./wasm/Cargo.toml"; pub struct TemplateAdjuster { pub target_path: PathBuf, - pub template_name: String, - pub contract_trait: String, - pub src_file: String, - pub package_name: String, - pub rename_pairs: Vec, + pub metadata: TemplateMetadata, } - impl TemplateAdjuster { - pub fn new(target_path: PathBuf, template_name: String) -> Self { - let cargo_toml_path = target_path.join(TEMPLATE_TOML); - let toml = CargoTomlContents::load_from_file(&cargo_toml_path); + pub fn new(target_path: PathBuf, metadata: TemplateMetadata) -> Self { Self { target_path, - template_name, - contract_trait: toml - .toml_value - .get("contract_trait") - .expect("missing contract_trait in template.toml") - .as_str() - .expect("contract_trait not a string value") - .to_string(), - src_file: toml - .toml_value - .get("contract_trait") - .expect("missing src_file in template.toml") - .as_str() - .expect("src_file not a string value") - .to_string(), - package_name: toml - .toml_value - .get("contract_trait") - .expect("missing package_name in template.toml") - .as_str() - .expect("package_name not a string value") - .to_string(), - rename_pairs: toml - .toml_value - .get("rename_pairs") - .expect("missing contract_trait in template.toml") - .as_array() - .expect("package_name not an array value") - .iter() - .map(|value| value.to_string()) - .collect(), + metadata, } } @@ -83,7 +47,7 @@ impl TemplateAdjuster { let mut toml = CargoTomlContents::load_from_file(&cargo_toml_path); let deps_map = toml.dependencies_mut(); - remove_paths_from_dependencies(deps_map, &[&self.template_name]); + remove_paths_from_dependencies(deps_map, &[&self.metadata.name]); toml.save_to_file(&cargo_toml_path); } @@ -93,29 +57,91 @@ impl TemplateAdjuster { let mut toml = CargoTomlContents::load_from_file(&cargo_toml_path); let deps_map = toml.dependencies_mut(); - remove_paths_from_dependencies(deps_map, &[&self.template_name]); + remove_paths_from_dependencies(deps_map, &[&self.metadata.name]); toml.save_to_file(&cargo_toml_path); } - pub fn rename_trait_to(&self, new_template_name: String) { - let cargo_toml_path = self.target_path.join(TEMPLATE_TOML); - let toml = CargoTomlContents::load_from_file(&cargo_toml_path); - - let contract_trait = toml - .toml_value - .get("contract_trait") - .expect("missing contract_trait in template.toml") - .as_str() - .expect("contract_trait not a string value") - .to_string(); + pub fn rename_template_to(&self, new_name: String) { + self.rename_trait_to(&new_name.to_case(Case::UpperCamel)); + self.rename_cargo_toml_root(&new_name); + self.rename_cargo_toml_meta(&new_name); + self.rename_cargo_toml_wasm(&new_name); + } + fn rename_trait_to(&self, new_template_name: &String) { replace_in_files( &self.target_path, "*rs", - &[Query::substring(&contract_trait, &new_template_name)][..], + &[Query::substring( + &self.metadata.contract_trait, + new_template_name, + )][..], + ); + } + + fn rename_cargo_toml_root(&self, new_template_name: &String) { + replace_in_files( + &self.target_path, + "*Cargo.toml", + &[Query::substring( + &self.get_package_name(&self.metadata.name), + &self.get_package_name(new_template_name), + )][..], ); } + fn rename_cargo_toml_meta(&self, new_template_name: &String) { + let mut old_meta = self.metadata.name.clone(); + old_meta.push_str("-meta"); + let mut new_meta = new_template_name.clone(); + new_meta.push_str("-meta"); + replace_in_files( + &self.target_path, + "*Cargo.toml", + &[ + Query::substring( + &self.get_package_name(&old_meta), + &self.get_package_name(&new_meta), + ), + Query::substring( + &self.get_dependecy(&self.metadata.name.clone()), + &self.get_dependecy(&new_template_name), + ), + ][..], + ); + } + fn rename_cargo_toml_wasm(&self, new_template_name: &String) { + let mut old_wasm = self.metadata.name.clone(); + old_wasm.push_str("-wasm"); + let mut new_wasm = new_template_name.clone(); + new_wasm.push_str("-wasm"); + replace_in_files( + &self.target_path, + "*Cargo.toml", + &[ + Query::substring( + &self.get_package_name(&old_wasm), + &self.get_package_name(&new_wasm), + ), + Query::substring( + &self.get_dependecy(&self.metadata.name.clone()), + &self.get_dependecy(&new_template_name), + ), + ][..], + ); + } + + fn get_package_name(&self, template: &String) -> String { + let mut package = "name =\"".to_owned(); + package.push_str(template); + package.push_str("\""); + package + } + fn get_dependecy(&self, template: &String) -> String { + let mut dependency = "dependencies.".to_owned(); + dependency.push_str(&template); + dependency + } } pub fn remove_paths_from_dependencies(deps_map: &mut Table, ignore_deps: &[&str]) { for (key, value) in deps_map { diff --git a/framework/meta/src/template/template_download.rs b/framework/meta/src/template/template_download.rs index e69f83e607..6269aa1f12 100644 --- a/framework/meta/src/template/template_download.rs +++ b/framework/meta/src/template/template_download.rs @@ -1,5 +1,4 @@ use crate::cli_args::TemplateArgs; -use convert_case::{Case, Casing}; use std::path::PathBuf; use super::{ @@ -17,7 +16,7 @@ pub async fn template_download(args: &TemplateArgs) { ); downloader.template_download(); downloader.update_dependencies(); - downloader.rename_trait_to(args.template.to_case(Case::UpperCamel)); + downloader.rename_template_to(args.template.clone()); } pub struct TemplateDownloader<'a> { @@ -35,11 +34,12 @@ impl<'a> TemplateDownloader<'a> { .find(|source| source.metadata.name == template_name) .unwrap_or_else(|| panic!("Unknown template {template_name}")); + let metadata = template_source.metadata.clone(); TemplateDownloader { repo_source, template_source, target_path: target_path.clone(), - adjuster: TemplateAdjuster::new(target_path, template_name), + adjuster: TemplateAdjuster::new(target_path, metadata), } } @@ -49,7 +49,7 @@ impl<'a> TemplateDownloader<'a> { pub fn update_dependencies(&self) { self.adjuster.update_dependencies(); } - pub fn rename_trait_to(&self, new_template_name: String) { - self.adjuster.rename_trait_to(new_template_name); + pub fn rename_template_to(&self, new_template_name: String) { + self.adjuster.rename_template_to(new_template_name); } } diff --git a/framework/meta/src/template/template_metadata.rs b/framework/meta/src/template/template_metadata.rs index e0aa6f8aa5..4579547386 100644 --- a/framework/meta/src/template/template_metadata.rs +++ b/framework/meta/src/template/template_metadata.rs @@ -1,8 +1,10 @@ use serde::{Deserialize, Serialize}; -#[derive(Serialize, Deserialize, Debug)] +#[derive(Serialize, Deserialize, Debug, Clone)] pub struct TemplateMetadata { pub name: String, + pub contract_trait: String, + pub src_file: String, pub rename_pairs: Vec<(String, String)>, } @@ -13,7 +15,9 @@ mod tests { fn parsed_metadata() -> TemplateMetadata { toml::from_str( r#" - name = "contract-name" + name = "my-contract" + contract_trait = "MyContract" + src_file = "my_contract.rs" rename_pairs = [ ["original", "new"] ] @@ -25,7 +29,9 @@ mod tests { #[test] fn test_template_metadata_parse() { let parsed = parsed_metadata(); - assert_eq!(parsed.name, "contract-name"); + assert_eq!(parsed.name, "my-contract"); + assert_eq!(parsed.contract_trait, "MyContract"); + assert_eq!(parsed.src_file, "my_contract.rs"); assert_eq!(parsed.rename_pairs.len(), 1); assert_eq!(parsed.rename_pairs[0].0, "original"); assert_eq!(parsed.rename_pairs[0].1, "new"); diff --git a/framework/meta/tests/template_test.rs b/framework/meta/tests/template_test.rs index b01fdb7468..457379cec3 100644 --- a/framework/meta/tests/template_test.rs +++ b/framework/meta/tests/template_test.rs @@ -32,7 +32,7 @@ async fn test_template_download() { let downloader = TemplateDownloader::new(&repo_source, "adder".to_string(), target_dir.clone()); downloader.template_download(); downloader.update_dependencies(); - downloader.rename_trait_to("NewAdder".to_string()); + downloader.rename_template_to("new-adder".to_string()); cargo_test(target_dir); } From 46c1327853d8c7db56f48ace87c8be0363c6841a Mon Sep 17 00:00:00 2001 From: Alin Cruceat Date: Thu, 10 Aug 2023 13:16:52 +0300 Subject: [PATCH 06/15] rename all files fix --- .../meta/src/template/template_adjuster.rs | 34 +++++++++++++++---- 1 file changed, 28 insertions(+), 6 deletions(-) diff --git a/framework/meta/src/template/template_adjuster.rs b/framework/meta/src/template/template_adjuster.rs index 68737cd877..812d2a9ef9 100644 --- a/framework/meta/src/template/template_adjuster.rs +++ b/framework/meta/src/template/template_adjuster.rs @@ -1,7 +1,10 @@ use std::path::PathBuf; use super::template_metadata::TemplateMetadata; -use crate::{cmd::standalone::upgrade::upgrade_common::replace_in_files, CargoTomlContents}; +use crate::{ + cmd::standalone::upgrade::upgrade_common::{rename_files, replace_in_files}, + CargoTomlContents, +}; use convert_case::{Case, Casing}; use ruplacer::Query; use toml::value::Table; @@ -67,6 +70,7 @@ impl TemplateAdjuster { self.rename_cargo_toml_root(&new_name); self.rename_cargo_toml_meta(&new_name); self.rename_cargo_toml_wasm(&new_name); + self.rename_files(&new_name); } fn rename_trait_to(&self, new_template_name: &String) { @@ -81,13 +85,20 @@ impl TemplateAdjuster { } fn rename_cargo_toml_root(&self, new_template_name: &String) { + let mut old_path = self.metadata.src_file.clone(); + old_path.push_str(".rs"); + let mut new_path = new_template_name.to_case(Case::Snake); + new_path.push_str(".rs"); replace_in_files( &self.target_path, "*Cargo.toml", - &[Query::substring( - &self.get_package_name(&self.metadata.name), - &self.get_package_name(new_template_name), - )][..], + &[ + Query::substring( + &self.get_package_name(&self.metadata.name), + &self.get_package_name(new_template_name), + ), + Query::substring(&old_path, &new_path), + ][..], ); } fn rename_cargo_toml_meta(&self, new_template_name: &String) { @@ -131,8 +142,19 @@ impl TemplateAdjuster { ); } + fn rename_files(&self, new_template_name: &String) { + let mut new_src_name = new_template_name.to_case(Case::Snake); + new_src_name.push_str(".rs"); + + let pattern: &[(&str, &str)] = &[ + (&self.metadata.src_file, &new_src_name), + (&self.metadata.name, new_template_name), + ]; + rename_files(&self.target_path, pattern); + } + fn get_package_name(&self, template: &String) -> String { - let mut package = "name =\"".to_owned(); + let mut package = "name = \"".to_owned(); package.push_str(template); package.push_str("\""); package From 286504d2b4c5ea7e982b9b3e9bdb5b1cbc1f6596 Mon Sep 17 00:00:00 2001 From: Alin Cruceat Date: Thu, 10 Aug 2023 14:02:38 +0300 Subject: [PATCH 07/15] rename tests & scenarios --- .../meta/src/template/template_adjuster.rs | 70 ++++++++++++++++--- 1 file changed, 60 insertions(+), 10 deletions(-) diff --git a/framework/meta/src/template/template_adjuster.rs b/framework/meta/src/template/template_adjuster.rs index 812d2a9ef9..738b4f4749 100644 --- a/framework/meta/src/template/template_adjuster.rs +++ b/framework/meta/src/template/template_adjuster.rs @@ -9,6 +9,7 @@ use convert_case::{Case, Casing}; use ruplacer::Query; use toml::value::Table; +const TEST_DIRECTORY: &str = "./tests"; const ROOT_CARGO_TOML: &str = "./Cargo.toml"; const META_CARGO_TOML: &str = "./meta/Cargo.toml"; const WASM_CARGO_TOML: &str = "./wasm/Cargo.toml"; @@ -67,9 +68,11 @@ impl TemplateAdjuster { pub fn rename_template_to(&self, new_name: String) { self.rename_trait_to(&new_name.to_case(Case::UpperCamel)); - self.rename_cargo_toml_root(&new_name); - self.rename_cargo_toml_meta(&new_name); - self.rename_cargo_toml_wasm(&new_name); + self.rename_in_cargo_toml_root(&new_name); + self.rename_in_cargo_toml_meta(&new_name); + self.rename_in_cargo_toml_wasm(&new_name); + self.rename_in_scenarios(&new_name); + self.rename_in_tests(&new_name); self.rename_files(&new_name); } @@ -84,9 +87,8 @@ impl TemplateAdjuster { ); } - fn rename_cargo_toml_root(&self, new_template_name: &String) { - let mut old_path = self.metadata.src_file.clone(); - old_path.push_str(".rs"); + fn rename_in_cargo_toml_root(&self, new_template_name: &String) { + let old_path = self.metadata.src_file.clone(); let mut new_path = new_template_name.to_case(Case::Snake); new_path.push_str(".rs"); replace_in_files( @@ -101,7 +103,7 @@ impl TemplateAdjuster { ][..], ); } - fn rename_cargo_toml_meta(&self, new_template_name: &String) { + fn rename_in_cargo_toml_meta(&self, new_template_name: &String) { let mut old_meta = self.metadata.name.clone(); old_meta.push_str("-meta"); let mut new_meta = new_template_name.clone(); @@ -121,7 +123,7 @@ impl TemplateAdjuster { ][..], ); } - fn rename_cargo_toml_wasm(&self, new_template_name: &String) { + fn rename_in_cargo_toml_wasm(&self, new_template_name: &String) { let mut old_wasm = self.metadata.name.clone(); old_wasm.push_str("-wasm"); let mut new_wasm = new_template_name.clone(); @@ -142,13 +144,61 @@ impl TemplateAdjuster { ); } + fn rename_in_scenarios(&self, new_template_name: &String) { + let mut old_wasm = self.metadata.name.clone(); + old_wasm.push_str(".wasm"); + let mut new_wasm = new_template_name.clone(); + new_wasm.push_str(".wasm"); + replace_in_files( + &self.target_path, + "*.scen.json", + &[Query::substring( + &self.get_package_name(&old_wasm), + &self.get_package_name(&new_wasm), + )][..], + ); + } + fn rename_in_tests(&self, new_template_name: &String) { + let new_name = new_template_name.to_case(Case::Snake); + let old_name = self.metadata.name.to_case(Case::Snake); + let mut new_path = "/".to_owned(); + new_path.push_str(&new_template_name); + new_path.push_str("\""); + let mut old_path = "/".to_owned(); + old_path.push_str(&self.metadata.name); + old_path.push_str("\""); + let mut new_scenarios = "scenarios/".to_owned(); + new_scenarios.push_str(&new_name); + let mut old_scenarios = "scenarios/".to_owned(); + old_scenarios.push_str(&old_name); + let mut new_package: String = new_name.clone(); + new_package.push_str("::"); + let mut old_package: String = old_name.clone(); + old_package.push_str("::"); + let mut old_wasm = self.metadata.name.clone(); + old_wasm.push_str(".wasm"); + let mut new_wasm = new_template_name.clone(); + new_wasm.push_str(".wasm"); + replace_in_files( + &self.target_path.join(TEST_DIRECTORY), + "*.rs", + &[ + Query::substring(&old_wasm, &new_wasm), + Query::substring(&old_package, &new_package), + Query::substring(&old_path, &new_path), + Query::substring(&old_scenarios, &new_scenarios), + ][..], + ); + } + fn rename_files(&self, new_template_name: &String) { - let mut new_src_name = new_template_name.to_case(Case::Snake); + let new_name = new_template_name.to_case(Case::Snake); + let mut new_src_name = new_name.clone(); new_src_name.push_str(".rs"); let pattern: &[(&str, &str)] = &[ (&self.metadata.src_file, &new_src_name), - (&self.metadata.name, new_template_name), + (&self.metadata.name, &new_name), ]; rename_files(&self.target_path, pattern); } From d5a1e7a2dd121728f98f9094c8e7f32d955e329b Mon Sep 17 00:00:00 2001 From: Alin Cruceat Date: Thu, 10 Aug 2023 14:05:29 +0300 Subject: [PATCH 08/15] clippy --- .../meta/src/template/template_adjuster.rs | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/framework/meta/src/template/template_adjuster.rs b/framework/meta/src/template/template_adjuster.rs index 738b4f4749..c153ae8168 100644 --- a/framework/meta/src/template/template_adjuster.rs +++ b/framework/meta/src/template/template_adjuster.rs @@ -76,7 +76,7 @@ impl TemplateAdjuster { self.rename_files(&new_name); } - fn rename_trait_to(&self, new_template_name: &String) { + fn rename_trait_to(&self, new_template_name: &str) { replace_in_files( &self.target_path, "*rs", @@ -87,7 +87,7 @@ impl TemplateAdjuster { ); } - fn rename_in_cargo_toml_root(&self, new_template_name: &String) { + fn rename_in_cargo_toml_root(&self, new_template_name: &str) { let old_path = self.metadata.src_file.clone(); let mut new_path = new_template_name.to_case(Case::Snake); new_path.push_str(".rs"); @@ -103,10 +103,10 @@ impl TemplateAdjuster { ][..], ); } - fn rename_in_cargo_toml_meta(&self, new_template_name: &String) { + fn rename_in_cargo_toml_meta(&self, new_template_name: &str) { let mut old_meta = self.metadata.name.clone(); old_meta.push_str("-meta"); - let mut new_meta = new_template_name.clone(); + let mut new_meta = new_template_name.to_owned(); new_meta.push_str("-meta"); replace_in_files( &self.target_path, @@ -123,10 +123,10 @@ impl TemplateAdjuster { ][..], ); } - fn rename_in_cargo_toml_wasm(&self, new_template_name: &String) { + fn rename_in_cargo_toml_wasm(&self, new_template_name: &str) { let mut old_wasm = self.metadata.name.clone(); old_wasm.push_str("-wasm"); - let mut new_wasm = new_template_name.clone(); + let mut new_wasm = new_template_name.to_owned(); new_wasm.push_str("-wasm"); replace_in_files( &self.target_path, @@ -144,10 +144,10 @@ impl TemplateAdjuster { ); } - fn rename_in_scenarios(&self, new_template_name: &String) { + fn rename_in_scenarios(&self, new_template_name: &str) { let mut old_wasm = self.metadata.name.clone(); old_wasm.push_str(".wasm"); - let mut new_wasm = new_template_name.clone(); + let mut new_wasm = new_template_name.to_owned(); new_wasm.push_str(".wasm"); replace_in_files( &self.target_path, @@ -158,7 +158,7 @@ impl TemplateAdjuster { )][..], ); } - fn rename_in_tests(&self, new_template_name: &String) { + fn rename_in_tests(&self, new_template_name: &str) { let new_name = new_template_name.to_case(Case::Snake); let old_name = self.metadata.name.to_case(Case::Snake); let mut new_path = "/".to_owned(); @@ -177,7 +177,7 @@ impl TemplateAdjuster { old_package.push_str("::"); let mut old_wasm = self.metadata.name.clone(); old_wasm.push_str(".wasm"); - let mut new_wasm = new_template_name.clone(); + let mut new_wasm = new_template_name.to_owned(); new_wasm.push_str(".wasm"); replace_in_files( &self.target_path.join(TEST_DIRECTORY), @@ -191,7 +191,7 @@ impl TemplateAdjuster { ); } - fn rename_files(&self, new_template_name: &String) { + fn rename_files(&self, new_template_name: &str) { let new_name = new_template_name.to_case(Case::Snake); let mut new_src_name = new_name.clone(); new_src_name.push_str(".rs"); @@ -203,13 +203,13 @@ impl TemplateAdjuster { rename_files(&self.target_path, pattern); } - fn get_package_name(&self, template: &String) -> String { + fn get_package_name(&self, template: &str) -> String { let mut package = "name = \"".to_owned(); package.push_str(template); package.push_str("\""); package } - fn get_dependecy(&self, template: &String) -> String { + fn get_dependecy(&self, template: &str) -> String { let mut dependency = "dependencies.".to_owned(); dependency.push_str(&template); dependency From 892b244d357f5eabfe30afdb6f8c9b4a32924034 Mon Sep 17 00:00:00 2001 From: Alin Cruceat Date: Thu, 10 Aug 2023 14:09:21 +0300 Subject: [PATCH 09/15] clippy 2 --- framework/meta/src/template/template_adjuster.rs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/framework/meta/src/template/template_adjuster.rs b/framework/meta/src/template/template_adjuster.rs index c153ae8168..9067f5f777 100644 --- a/framework/meta/src/template/template_adjuster.rs +++ b/framework/meta/src/template/template_adjuster.rs @@ -117,8 +117,8 @@ impl TemplateAdjuster { &self.get_package_name(&new_meta), ), Query::substring( - &self.get_dependecy(&self.metadata.name.clone()), - &self.get_dependecy(&new_template_name), + &self.get_dependecy(&self.metadata.name), + &self.get_dependecy(new_template_name), ), ][..], ); @@ -137,8 +137,8 @@ impl TemplateAdjuster { &self.get_package_name(&new_wasm), ), Query::substring( - &self.get_dependecy(&self.metadata.name.clone()), - &self.get_dependecy(&new_template_name), + &self.get_dependecy(&self.metadata.name), + &self.get_dependecy(new_template_name), ), ][..], ); @@ -163,10 +163,10 @@ impl TemplateAdjuster { let old_name = self.metadata.name.to_case(Case::Snake); let mut new_path = "/".to_owned(); new_path.push_str(&new_template_name); - new_path.push_str("\""); + new_path.push('\"'); let mut old_path = "/".to_owned(); old_path.push_str(&self.metadata.name); - old_path.push_str("\""); + old_path.push('\"'); let mut new_scenarios = "scenarios/".to_owned(); new_scenarios.push_str(&new_name); let mut old_scenarios = "scenarios/".to_owned(); @@ -206,12 +206,12 @@ impl TemplateAdjuster { fn get_package_name(&self, template: &str) -> String { let mut package = "name = \"".to_owned(); package.push_str(template); - package.push_str("\""); + package.push('\"'); package } fn get_dependecy(&self, template: &str) -> String { let mut dependency = "dependencies.".to_owned(); - dependency.push_str(&template); + dependency.push_str(template); dependency } } From 55bab0aa660ecf6091839d0a9ed8df90d9a28be9 Mon Sep 17 00:00:00 2001 From: Alin Cruceat Date: Thu, 10 Aug 2023 14:24:07 +0300 Subject: [PATCH 10/15] more rename to affect meta --- .../meta/src/template/template_adjuster.rs | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/framework/meta/src/template/template_adjuster.rs b/framework/meta/src/template/template_adjuster.rs index 9067f5f777..19d9c8b7d5 100644 --- a/framework/meta/src/template/template_adjuster.rs +++ b/framework/meta/src/template/template_adjuster.rs @@ -77,13 +77,19 @@ impl TemplateAdjuster { } fn rename_trait_to(&self, new_template_name: &str) { + let new_name = new_template_name.to_case(Case::Snake); + let old_name = self.metadata.name.to_case(Case::Snake); + let mut new_package: String = new_name.clone(); + new_package.push_str("::"); + let mut old_package: String = old_name.clone(); + old_package.push_str("::"); replace_in_files( &self.target_path, "*rs", - &[Query::substring( - &self.metadata.contract_trait, - new_template_name, - )][..], + &[ + Query::substring(&self.metadata.contract_trait, new_template_name), + Query::substring(&old_package, &new_package), + ][..], ); } @@ -171,10 +177,6 @@ impl TemplateAdjuster { new_scenarios.push_str(&new_name); let mut old_scenarios = "scenarios/".to_owned(); old_scenarios.push_str(&old_name); - let mut new_package: String = new_name.clone(); - new_package.push_str("::"); - let mut old_package: String = old_name.clone(); - old_package.push_str("::"); let mut old_wasm = self.metadata.name.clone(); old_wasm.push_str(".wasm"); let mut new_wasm = new_template_name.to_owned(); @@ -184,7 +186,6 @@ impl TemplateAdjuster { "*.rs", &[ Query::substring(&old_wasm, &new_wasm), - Query::substring(&old_package, &new_package), Query::substring(&old_path, &new_path), Query::substring(&old_scenarios, &new_scenarios), ][..], From f6da38af4bbf3304f4bdcd17218a0e3b809586dd Mon Sep 17 00:00:00 2001 From: Alin Cruceat Date: Thu, 10 Aug 2023 14:25:47 +0300 Subject: [PATCH 11/15] clippy --- framework/meta/src/template/template_adjuster.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/framework/meta/src/template/template_adjuster.rs b/framework/meta/src/template/template_adjuster.rs index 19d9c8b7d5..ecae5261ec 100644 --- a/framework/meta/src/template/template_adjuster.rs +++ b/framework/meta/src/template/template_adjuster.rs @@ -168,7 +168,7 @@ impl TemplateAdjuster { let new_name = new_template_name.to_case(Case::Snake); let old_name = self.metadata.name.to_case(Case::Snake); let mut new_path = "/".to_owned(); - new_path.push_str(&new_template_name); + new_path.push_str(new_template_name); new_path.push('\"'); let mut old_path = "/".to_owned(); old_path.push_str(&self.metadata.name); From cdec06454731c3ae3be908c6bf5e6851a00a96d6 Mon Sep 17 00:00:00 2001 From: Alin Cruceat Date: Thu, 10 Aug 2023 14:26:38 +0300 Subject: [PATCH 12/15] remove clone --- framework/meta/src/template/template_adjuster.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/framework/meta/src/template/template_adjuster.rs b/framework/meta/src/template/template_adjuster.rs index ecae5261ec..8738b4c6a4 100644 --- a/framework/meta/src/template/template_adjuster.rs +++ b/framework/meta/src/template/template_adjuster.rs @@ -79,9 +79,9 @@ impl TemplateAdjuster { fn rename_trait_to(&self, new_template_name: &str) { let new_name = new_template_name.to_case(Case::Snake); let old_name = self.metadata.name.to_case(Case::Snake); - let mut new_package: String = new_name.clone(); + let mut new_package: String = new_name; new_package.push_str("::"); - let mut old_package: String = old_name.clone(); + let mut old_package: String = old_name; old_package.push_str("::"); replace_in_files( &self.target_path, From d78d7d11addaf2015ca5ada3f04e9c80323fc5eb Mon Sep 17 00:00:00 2001 From: Alin Cruceat Date: Fri, 11 Aug 2023 12:27:55 +0300 Subject: [PATCH 13/15] fix tests --- .../meta/src/template/template_adjuster.rs | 30 +++++++++++-------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/framework/meta/src/template/template_adjuster.rs b/framework/meta/src/template/template_adjuster.rs index 8738b4c6a4..90de847bed 100644 --- a/framework/meta/src/template/template_adjuster.rs +++ b/framework/meta/src/template/template_adjuster.rs @@ -109,6 +109,7 @@ impl TemplateAdjuster { ][..], ); } + fn rename_in_cargo_toml_meta(&self, new_template_name: &str) { let mut old_meta = self.metadata.name.clone(); old_meta.push_str("-meta"); @@ -129,6 +130,7 @@ impl TemplateAdjuster { ][..], ); } + fn rename_in_cargo_toml_wasm(&self, new_template_name: &str) { let mut old_wasm = self.metadata.name.clone(); old_wasm.push_str("-wasm"); @@ -158,38 +160,40 @@ impl TemplateAdjuster { replace_in_files( &self.target_path, "*.scen.json", - &[Query::substring( - &self.get_package_name(&old_wasm), - &self.get_package_name(&new_wasm), - )][..], + &[Query::substring(&old_wasm, &new_wasm)][..], ); } + fn rename_in_tests(&self, new_template_name: &str) { let new_name = new_template_name.to_case(Case::Snake); let old_name = self.metadata.name.to_case(Case::Snake); + + let mut queries = Vec::::new(); + for (old, new) in self.metadata.rename_pairs.iter() { + queries.push(Query::substring(&old, &new)) + } + let mut new_path = "/".to_owned(); new_path.push_str(new_template_name); new_path.push('\"'); let mut old_path = "/".to_owned(); old_path.push_str(&self.metadata.name); old_path.push('\"'); + queries.push(Query::substring(&old_path, &new_path)); + let mut new_scenarios = "scenarios/".to_owned(); new_scenarios.push_str(&new_name); let mut old_scenarios = "scenarios/".to_owned(); old_scenarios.push_str(&old_name); + queries.push(Query::substring(&old_scenarios, &new_scenarios)); + let mut old_wasm = self.metadata.name.clone(); old_wasm.push_str(".wasm"); let mut new_wasm = new_template_name.to_owned(); new_wasm.push_str(".wasm"); - replace_in_files( - &self.target_path.join(TEST_DIRECTORY), - "*.rs", - &[ - Query::substring(&old_wasm, &new_wasm), - Query::substring(&old_path, &new_path), - Query::substring(&old_scenarios, &new_scenarios), - ][..], - ); + queries.push(Query::substring(&old_wasm, &new_wasm)); + + replace_in_files(&self.target_path.join(TEST_DIRECTORY), "*.rs", &queries); } fn rename_files(&self, new_template_name: &str) { From ab19fd6046ba2fc8ae1cb1cd05d4eecb4ed0f6ea Mon Sep 17 00:00:00 2001 From: Alin Cruceat Date: Fri, 11 Aug 2023 12:30:14 +0300 Subject: [PATCH 14/15] clippy --- .../bonding-curve-contract/src/function_selector.rs | 8 +++----- framework/meta/src/template/template_adjuster.rs | 2 +- .../esdt_data_raw/esdt_instances_raw_check.rs | 8 +++----- .../src/serde_raw/esdt_data_raw/esdt_map_raw_check.rs | 8 +++----- sdk/scenario-format/src/serde_raw/logs_raw.rs | 8 +++----- sdk/scenario-format/src/serde_raw/value_raw_check.rs | 8 +++----- .../src/serde_raw/value_raw_check_list.rs | 8 +++----- vm/src/scenario/model/esdt_data/esdt_map_check.rs | 8 +++----- vm/src/scenario/model/storage_check.rs | 8 +++----- vm/src/scenario/model/value/value_check.rs | 11 +++-------- 10 files changed, 28 insertions(+), 49 deletions(-) diff --git a/contracts/examples/bonding-curve-contract/src/function_selector.rs b/contracts/examples/bonding-curve-contract/src/function_selector.rs index 00031c784f..6db0404ccd 100644 --- a/contracts/examples/bonding-curve-contract/src/function_selector.rs +++ b/contracts/examples/bonding-curve-contract/src/function_selector.rs @@ -7,17 +7,15 @@ use crate::bonding_curve::{ }; #[derive(TopEncode, TopDecode, NestedEncode, NestedDecode, TypeAbi, PartialEq, Eq, Clone)] +#[derive(Default)] pub enum FunctionSelector { Linear(LinearFunction), CustomExample(BigUint), + #[default] None, } -impl Default for FunctionSelector { - fn default() -> Self { - FunctionSelector::None - } -} + impl CurveFunction for FunctionSelector { fn calculate_price( diff --git a/framework/meta/src/template/template_adjuster.rs b/framework/meta/src/template/template_adjuster.rs index 90de847bed..8ee4b6ae12 100644 --- a/framework/meta/src/template/template_adjuster.rs +++ b/framework/meta/src/template/template_adjuster.rs @@ -170,7 +170,7 @@ impl TemplateAdjuster { let mut queries = Vec::::new(); for (old, new) in self.metadata.rename_pairs.iter() { - queries.push(Query::substring(&old, &new)) + queries.push(Query::substring(old, new)) } let mut new_path = "/".to_owned(); diff --git a/sdk/scenario-format/src/serde_raw/esdt_data_raw/esdt_instances_raw_check.rs b/sdk/scenario-format/src/serde_raw/esdt_data_raw/esdt_instances_raw_check.rs index 515808b9ee..960b4ce4fe 100644 --- a/sdk/scenario-format/src/serde_raw/esdt_data_raw/esdt_instances_raw_check.rs +++ b/sdk/scenario-format/src/serde_raw/esdt_data_raw/esdt_instances_raw_check.rs @@ -6,7 +6,9 @@ use serde::{ }; use std::fmt; +#[derive(Default)] pub enum CheckEsdtInstancesRaw { + #[default] Unspecified, Star, Equal(Vec), @@ -22,11 +24,7 @@ impl CheckEsdtInstancesRaw { } } -impl Default for CheckEsdtInstancesRaw { - fn default() -> Self { - CheckEsdtInstancesRaw::Unspecified - } -} + impl Serialize for CheckEsdtInstancesRaw { fn serialize(&self, serializer: S) -> Result diff --git a/sdk/scenario-format/src/serde_raw/esdt_data_raw/esdt_map_raw_check.rs b/sdk/scenario-format/src/serde_raw/esdt_data_raw/esdt_map_raw_check.rs index 83e9c06e1f..46aebe1645 100644 --- a/sdk/scenario-format/src/serde_raw/esdt_data_raw/esdt_map_raw_check.rs +++ b/sdk/scenario-format/src/serde_raw/esdt_data_raw/esdt_map_raw_check.rs @@ -5,7 +5,9 @@ use serde::{ Deserialize, Serialize, }; use std::fmt; +#[derive(Default)] pub enum CheckEsdtMapRaw { + #[default] Unspecified, Star, Equal(CheckEsdtMapContentsRaw), @@ -21,11 +23,7 @@ impl CheckEsdtMapRaw { } } -impl Default for CheckEsdtMapRaw { - fn default() -> Self { - CheckEsdtMapRaw::Unspecified - } -} + impl Serialize for CheckEsdtMapRaw { fn serialize(&self, serializer: S) -> Result diff --git a/sdk/scenario-format/src/serde_raw/logs_raw.rs b/sdk/scenario-format/src/serde_raw/logs_raw.rs index 48b218d6de..53b1717335 100644 --- a/sdk/scenario-format/src/serde_raw/logs_raw.rs +++ b/sdk/scenario-format/src/serde_raw/logs_raw.rs @@ -13,9 +13,11 @@ pub struct CheckLogListRaw { pub more_allowed_at_end: bool, } +#[derive(Default)] pub enum CheckLogsRaw { Star, List(CheckLogListRaw), + #[default] Unspecified, } @@ -29,11 +31,7 @@ impl CheckLogsRaw { } } -impl Default for CheckLogsRaw { - fn default() -> Self { - CheckLogsRaw::Unspecified - } -} + impl Serialize for CheckLogsRaw { fn serialize(&self, serializer: S) -> Result diff --git a/sdk/scenario-format/src/serde_raw/value_raw_check.rs b/sdk/scenario-format/src/serde_raw/value_raw_check.rs index 387f66383e..fcb81bc898 100644 --- a/sdk/scenario-format/src/serde_raw/value_raw_check.rs +++ b/sdk/scenario-format/src/serde_raw/value_raw_check.rs @@ -5,7 +5,9 @@ use serde::{ }; use std::fmt; +#[derive(Default)] pub enum CheckBytesValueRaw { + #[default] Unspecified, Star, Equal(ValueSubTree), @@ -21,11 +23,7 @@ impl CheckBytesValueRaw { } } -impl Default for CheckBytesValueRaw { - fn default() -> Self { - CheckBytesValueRaw::Unspecified - } -} + impl Serialize for CheckBytesValueRaw { fn serialize(&self, serializer: S) -> Result diff --git a/sdk/scenario-format/src/serde_raw/value_raw_check_list.rs b/sdk/scenario-format/src/serde_raw/value_raw_check_list.rs index ef5654ebf7..f12c810e8f 100644 --- a/sdk/scenario-format/src/serde_raw/value_raw_check_list.rs +++ b/sdk/scenario-format/src/serde_raw/value_raw_check_list.rs @@ -5,7 +5,9 @@ use serde::{ }; use std::fmt; +#[derive(Default)] pub enum CheckValueListRaw { + #[default] Unspecified, Star, CheckList(Vec), @@ -21,11 +23,7 @@ impl CheckValueListRaw { } } -impl Default for CheckValueListRaw { - fn default() -> Self { - CheckValueListRaw::Unspecified - } -} + impl Serialize for CheckValueListRaw { fn serialize(&self, serializer: S) -> Result diff --git a/vm/src/scenario/model/esdt_data/esdt_map_check.rs b/vm/src/scenario/model/esdt_data/esdt_map_check.rs index 2a3bb16677..c7723e916e 100644 --- a/vm/src/scenario/model/esdt_data/esdt_map_check.rs +++ b/vm/src/scenario/model/esdt_data/esdt_map_check.rs @@ -6,17 +6,15 @@ use crate::scenario_format::{ use super::CheckEsdtMapContents; #[derive(Debug)] +#[derive(Default)] pub enum CheckEsdtMap { + #[default] Unspecified, Star, Equal(CheckEsdtMapContents), } -impl Default for CheckEsdtMap { - fn default() -> Self { - CheckEsdtMap::Unspecified - } -} + impl CheckEsdtMap { pub fn is_star(&self) -> bool { diff --git a/vm/src/scenario/model/storage_check.rs b/vm/src/scenario/model/storage_check.rs index 47e30ff688..62d7868ab2 100644 --- a/vm/src/scenario/model/storage_check.rs +++ b/vm/src/scenario/model/storage_check.rs @@ -6,16 +6,14 @@ use crate::scenario_format::{ use super::CheckStorageDetails; #[derive(Debug)] +#[derive(Default)] pub enum CheckStorage { + #[default] Star, Equal(CheckStorageDetails), } -impl Default for CheckStorage { - fn default() -> Self { - CheckStorage::Star - } -} + impl CheckStorage { pub fn is_star(&self) -> bool { diff --git a/vm/src/scenario/model/value/value_check.rs b/vm/src/scenario/model/value/value_check.rs index 38f2f65eee..5ce431c191 100644 --- a/vm/src/scenario/model/value/value_check.rs +++ b/vm/src/scenario/model/value/value_check.rs @@ -8,7 +8,9 @@ use std::{fmt, fmt::Write}; use super::BytesValue; #[derive(Debug)] +#[derive(Default)] pub enum CheckValue { + #[default] Star, Equal(T), } @@ -22,14 +24,7 @@ where } } -impl Default for CheckValue -where - T: Default, -{ - fn default() -> Self { - CheckValue::Star - } -} + impl InterpretableFrom for CheckValue where From 979e1bbd77ad924b890bb12f2d3d60a4907a3e25 Mon Sep 17 00:00:00 2001 From: Alin Cruceat Date: Fri, 11 Aug 2023 14:16:46 +0300 Subject: [PATCH 15/15] template copies just certain files listed in toml --- contracts/examples/adder/template.toml | 10 +++++++++ contracts/examples/empty/template.toml | 10 +++++++++ .../meta/src/template/repo_temp_download.rs | 22 +++++++++++++++++-- .../meta/src/template/template_download.rs | 7 +++--- .../meta/src/template/template_metadata.rs | 12 ++++++++++ .../meta/src/template/template_source.rs | 4 ++-- framework/meta/tests/template_test.rs | 2 +- 7 files changed, 59 insertions(+), 8 deletions(-) diff --git a/contracts/examples/adder/template.toml b/contracts/examples/adder/template.toml index f942502afc..01fe78a35d 100644 --- a/contracts/examples/adder/template.toml +++ b/contracts/examples/adder/template.toml @@ -7,3 +7,13 @@ rename_pairs = [ "// blockchain.set_current_dir_from_workspace(\"relative path to your workspace, if applicable\");", ], ] +files_include = [ + "meta", + "scenarios", + "src", + "tests", + "wasm/src", + "wasm/Cargo.toml", + "Cargo.toml", + "README.md", +] diff --git a/contracts/examples/empty/template.toml b/contracts/examples/empty/template.toml index adf83e1da0..6b2ab53965 100644 --- a/contracts/examples/empty/template.toml +++ b/contracts/examples/empty/template.toml @@ -3,3 +3,13 @@ contract_trait = "EmptyContract" src_file = "empty.rs" rename_pairs = [] + +files_include = [ + "meta", + "scenarios", + "src", + "tests", + "wasm/src", + "wasm/Cargo.toml", + "Cargo.toml", +] diff --git a/framework/meta/src/template/repo_temp_download.rs b/framework/meta/src/template/repo_temp_download.rs index 458c594f04..7a603e7a26 100644 --- a/framework/meta/src/template/repo_temp_download.rs +++ b/framework/meta/src/template/repo_temp_download.rs @@ -7,6 +7,7 @@ use std::{ const REPOSITORY: &str = "https://github.com/multiversx/mx-sdk-rs/archive/refs/heads/master.zip"; const ZIP_NAME: &str = "./master.zip"; const REPOSITORY_TEMP_DIR_NAME: &str = "mx-sdk-rs-master"; +const WASM_SUBDIR: &str = "wasm"; pub enum RepoSource { Downloaded(RepoTempDownload), @@ -31,9 +32,26 @@ impl RepoSource { } } - pub fn copy_repo_dir(&self, path_in_repo: impl AsRef, target_path: impl AsRef) { + pub fn copy_files( + &self, + path_in_repo: impl AsRef, + target_path: impl AsRef, + files_to_copy: &[String], + ) { + // copying recursive files in rust is not easy, reason why in order to copy only specific files the paths need to be created + + fs::create_dir(target_path.as_ref()).unwrap(); + + // same as above for the wasm subdirectory + + fs::create_dir(target_path.as_ref().join(WASM_SUBDIR)).unwrap(); + let from_path = self.repo_path().join(path_in_repo); - copy_dir::copy_dir(from_path, target_path).unwrap(); + for file in files_to_copy { + let from = from_path.join(file); + let to = target_path.as_ref().join(file); + copy_dir::copy_dir(from, to).unwrap(); + } } } diff --git a/framework/meta/src/template/template_download.rs b/framework/meta/src/template/template_download.rs index 6269aa1f12..acccb61953 100644 --- a/framework/meta/src/template/template_download.rs +++ b/framework/meta/src/template/template_download.rs @@ -14,7 +14,7 @@ pub async fn template_download(args: &TemplateArgs) { args.template.clone(), args.name.clone(), ); - downloader.template_download(); + downloader.copy_template(&downloader.template_source.metadata.files_include); downloader.update_dependencies(); downloader.rename_template_to(args.template.clone()); } @@ -43,8 +43,9 @@ impl<'a> TemplateDownloader<'a> { } } - pub fn template_download(&self) { - self.template_source.copy_template(&self.target_path); + pub fn copy_template(&self, files_to_copy: &[String]) { + self.template_source + .copy_template(&self.target_path, files_to_copy); } pub fn update_dependencies(&self) { self.adjuster.update_dependencies(); diff --git a/framework/meta/src/template/template_metadata.rs b/framework/meta/src/template/template_metadata.rs index 4579547386..2f47f47617 100644 --- a/framework/meta/src/template/template_metadata.rs +++ b/framework/meta/src/template/template_metadata.rs @@ -6,6 +6,7 @@ pub struct TemplateMetadata { pub contract_trait: String, pub src_file: String, pub rename_pairs: Vec<(String, String)>, + pub files_include: Vec, } #[cfg(test)] @@ -21,6 +22,12 @@ mod tests { rename_pairs = [ ["original", "new"] ] + files_include = [ + "/meta", + "/src", + "/wasm", + "/Cargo.toml" + ] "#, ) .unwrap() @@ -35,5 +42,10 @@ mod tests { assert_eq!(parsed.rename_pairs.len(), 1); assert_eq!(parsed.rename_pairs[0].0, "original"); assert_eq!(parsed.rename_pairs[0].1, "new"); + assert_eq!(parsed.files_include.len(), 4); + assert_eq!(parsed.files_include[0], "/meta"); + assert_eq!(parsed.files_include[1], "/src"); + assert_eq!(parsed.files_include[2], "/wasm"); + assert_eq!(parsed.files_include[3], "/Cargo.toml"); } } diff --git a/framework/meta/src/template/template_source.rs b/framework/meta/src/template/template_source.rs index 0cc8f23be0..e5b803fcb4 100644 --- a/framework/meta/src/template/template_source.rs +++ b/framework/meta/src/template/template_source.rs @@ -17,9 +17,9 @@ pub struct TemplateSource<'a> { } impl<'a> TemplateSource<'a> { - pub fn copy_template(&self, target_path: impl AsRef) { + pub fn copy_template(&self, target_path: impl AsRef, files_to_copy: &[String]) { self.repo_temp_dir - .copy_repo_dir(&self.source_path, target_path); + .copy_files(&self.source_path, target_path, files_to_copy); } } diff --git a/framework/meta/tests/template_test.rs b/framework/meta/tests/template_test.rs index 457379cec3..d176bddbc8 100644 --- a/framework/meta/tests/template_test.rs +++ b/framework/meta/tests/template_test.rs @@ -30,7 +30,7 @@ async fn test_template_download() { let target_dir = template_temp_path.join("new-adder"); let downloader = TemplateDownloader::new(&repo_source, "adder".to_string(), target_dir.clone()); - downloader.template_download(); + downloader.copy_template(&downloader.template_source.metadata.files_include); downloader.update_dependencies(); downloader.rename_template_to("new-adder".to_string()); cargo_test(target_dir);