From 7d93f775e42b72cb5affc73c9b0032a3a6213ee2 Mon Sep 17 00:00:00 2001 From: Andrei Marinica Date: Tue, 3 Oct 2023 23:44:33 +0300 Subject: [PATCH 01/20] test api & contracts copied from RV repo --- Cargo.lock | 848 ++++++++++++------ Cargo.toml | 14 + contracts/foundry/addercaller/.gitignore | 7 + contracts/foundry/addercaller/Cargo.toml | 18 + contracts/foundry/addercaller/meta/Cargo.toml | 14 + .../foundry/addercaller/meta/src/main.rs | 3 + contracts/foundry/addercaller/multiversx.json | 3 + .../scenarios/addercaller.scen.json | 178 ++++ .../addercaller_out_of_funds.scen.json | 69 ++ .../foundry/addercaller/src/addercaller.rs | 66 ++ contracts/foundry/addercaller/wasm/Cargo.lock | 272 ++++++ contracts/foundry/addercaller/wasm/Cargo.toml | 27 + contracts/foundry/addercaller/wasm/src/lib.rs | 26 + contracts/foundry/callee/.gitignore | 7 + contracts/foundry/callee/Cargo.toml | 18 + contracts/foundry/callee/meta/Cargo.toml | 14 + contracts/foundry/callee/meta/src/main.rs | 3 + contracts/foundry/callee/multiversx.json | 3 + contracts/foundry/callee/src/callee.rs | 22 + contracts/foundry/callee/wasm/Cargo.lock | 219 +++++ contracts/foundry/callee/wasm/Cargo.toml | 27 + contracts/foundry/callee/wasm/src/lib.rs | 25 + contracts/foundry/caller/.gitignore | 7 + contracts/foundry/caller/Cargo.toml | 18 + contracts/foundry/caller/meta/Cargo.toml | 14 + contracts/foundry/caller/meta/src/main.rs | 3 + contracts/foundry/caller/multiversx.json | 3 + .../foundry/caller/scenarios/caller.scen.json | 185 ++++ .../foundry/caller/scenarios/errors.scen.json | 96 ++ .../scenarios/exec_on_dest_ctx.scen.json | 185 ++++ .../caller/scenarios/steps/check_1.steps.json | 29 + .../scenarios/steps/check_init.steps.json | 29 + .../caller/scenarios/steps/init.steps.json | 57 ++ contracts/foundry/caller/src/caller.rs | 53 ++ contracts/foundry/caller/wasm/Cargo.lock | 219 +++++ contracts/foundry/caller/wasm/Cargo.toml | 27 + contracts/foundry/caller/wasm/src/lib.rs | 26 + contracts/foundry/foundrylike/.gitignore | 7 + contracts/foundry/foundrylike/Cargo.toml | 23 + contracts/foundry/foundrylike/foundry.json | 5 + contracts/foundry/foundrylike/meta/Cargo.toml | 15 + .../foundry/foundrylike/meta/src/main.rs | 3 + contracts/foundry/foundrylike/multiversx.json | 3 + .../scenarios/test-adder.scen.json | 71 ++ .../foundry/foundrylike/src/test_adder.rs | 113 +++ contracts/foundry/foundrylike/wasm/Cargo.lock | 227 +++++ contracts/foundry/foundrylike/wasm/Cargo.toml | 28 + contracts/foundry/foundrylike/wasm/src/lib.rs | 27 + contracts/foundry/test_multisig/.gitignore | 7 + contracts/foundry/test_multisig/Cargo.toml | 23 + contracts/foundry/test_multisig/foundry.json | 5 + .../foundry/test_multisig/meta/Cargo.toml | 15 + .../foundry/test_multisig/meta/src/main.rs | 3 + .../foundry/test_multisig/multiversx.json | 3 + .../test_multisig/src/test_multisig.rs | 134 +++ .../foundry/test_multisig/wasm/Cargo.lock | 227 +++++ .../foundry/test_multisig/wasm/Cargo.toml | 28 + .../foundry/test_multisig/wasm/src/lib.rs | 26 + contracts/foundry/test_testapi/.gitignore | 7 + contracts/foundry/test_testapi/Cargo.toml | 23 + contracts/foundry/test_testapi/foundry.json | 3 + .../foundry/test_testapi/meta/Cargo.toml | 15 + .../foundry/test_testapi/meta/src/main.rs | 3 + .../foundry/test_testapi/multiversx.json | 3 + .../foundry/test_testapi/src/test_testapi.rs | 77 ++ .../foundry/test_testapi/wasm/Cargo.lock | 227 +++++ .../foundry/test_testapi/wasm/Cargo.toml | 28 + .../foundry/test_testapi/wasm/src/lib.rs | 25 + framework/testapi/Cargo.toml | 16 + framework/testapi/src/testapi.rs | 220 +++++ 70 files changed, 4219 insertions(+), 255 deletions(-) create mode 100644 contracts/foundry/addercaller/.gitignore create mode 100644 contracts/foundry/addercaller/Cargo.toml create mode 100644 contracts/foundry/addercaller/meta/Cargo.toml create mode 100644 contracts/foundry/addercaller/meta/src/main.rs create mode 100644 contracts/foundry/addercaller/multiversx.json create mode 100644 contracts/foundry/addercaller/scenarios/addercaller.scen.json create mode 100644 contracts/foundry/addercaller/scenarios/addercaller_out_of_funds.scen.json create mode 100644 contracts/foundry/addercaller/src/addercaller.rs create mode 100644 contracts/foundry/addercaller/wasm/Cargo.lock create mode 100644 contracts/foundry/addercaller/wasm/Cargo.toml create mode 100644 contracts/foundry/addercaller/wasm/src/lib.rs create mode 100644 contracts/foundry/callee/.gitignore create mode 100644 contracts/foundry/callee/Cargo.toml create mode 100644 contracts/foundry/callee/meta/Cargo.toml create mode 100644 contracts/foundry/callee/meta/src/main.rs create mode 100644 contracts/foundry/callee/multiversx.json create mode 100644 contracts/foundry/callee/src/callee.rs create mode 100644 contracts/foundry/callee/wasm/Cargo.lock create mode 100644 contracts/foundry/callee/wasm/Cargo.toml create mode 100644 contracts/foundry/callee/wasm/src/lib.rs create mode 100644 contracts/foundry/caller/.gitignore create mode 100644 contracts/foundry/caller/Cargo.toml create mode 100644 contracts/foundry/caller/meta/Cargo.toml create mode 100644 contracts/foundry/caller/meta/src/main.rs create mode 100644 contracts/foundry/caller/multiversx.json create mode 100644 contracts/foundry/caller/scenarios/caller.scen.json create mode 100644 contracts/foundry/caller/scenarios/errors.scen.json create mode 100644 contracts/foundry/caller/scenarios/exec_on_dest_ctx.scen.json create mode 100644 contracts/foundry/caller/scenarios/steps/check_1.steps.json create mode 100644 contracts/foundry/caller/scenarios/steps/check_init.steps.json create mode 100644 contracts/foundry/caller/scenarios/steps/init.steps.json create mode 100644 contracts/foundry/caller/src/caller.rs create mode 100644 contracts/foundry/caller/wasm/Cargo.lock create mode 100644 contracts/foundry/caller/wasm/Cargo.toml create mode 100644 contracts/foundry/caller/wasm/src/lib.rs create mode 100644 contracts/foundry/foundrylike/.gitignore create mode 100644 contracts/foundry/foundrylike/Cargo.toml create mode 100644 contracts/foundry/foundrylike/foundry.json create mode 100644 contracts/foundry/foundrylike/meta/Cargo.toml create mode 100644 contracts/foundry/foundrylike/meta/src/main.rs create mode 100644 contracts/foundry/foundrylike/multiversx.json create mode 100644 contracts/foundry/foundrylike/scenarios/test-adder.scen.json create mode 100644 contracts/foundry/foundrylike/src/test_adder.rs create mode 100644 contracts/foundry/foundrylike/wasm/Cargo.lock create mode 100644 contracts/foundry/foundrylike/wasm/Cargo.toml create mode 100644 contracts/foundry/foundrylike/wasm/src/lib.rs create mode 100644 contracts/foundry/test_multisig/.gitignore create mode 100644 contracts/foundry/test_multisig/Cargo.toml create mode 100644 contracts/foundry/test_multisig/foundry.json create mode 100644 contracts/foundry/test_multisig/meta/Cargo.toml create mode 100644 contracts/foundry/test_multisig/meta/src/main.rs create mode 100644 contracts/foundry/test_multisig/multiversx.json create mode 100644 contracts/foundry/test_multisig/src/test_multisig.rs create mode 100644 contracts/foundry/test_multisig/wasm/Cargo.lock create mode 100644 contracts/foundry/test_multisig/wasm/Cargo.toml create mode 100644 contracts/foundry/test_multisig/wasm/src/lib.rs create mode 100644 contracts/foundry/test_testapi/.gitignore create mode 100644 contracts/foundry/test_testapi/Cargo.toml create mode 100644 contracts/foundry/test_testapi/foundry.json create mode 100644 contracts/foundry/test_testapi/meta/Cargo.toml create mode 100644 contracts/foundry/test_testapi/meta/src/main.rs create mode 100644 contracts/foundry/test_testapi/multiversx.json create mode 100644 contracts/foundry/test_testapi/src/test_testapi.rs create mode 100644 contracts/foundry/test_testapi/wasm/Cargo.lock create mode 100644 contracts/foundry/test_testapi/wasm/Cargo.toml create mode 100644 contracts/foundry/test_testapi/wasm/src/lib.rs create mode 100644 framework/testapi/Cargo.toml create mode 100644 framework/testapi/src/testapi.rs diff --git a/Cargo.lock b/Cargo.lock index 60f615f584..caad4adf86 100755 --- a/Cargo.lock +++ b/Cargo.lock @@ -16,9 +16,9 @@ dependencies = [ name = "abi-tester" version = "0.0.0" dependencies = [ - "multiversx-sc", - "multiversx-sc-meta", - "multiversx-sc-scenario", + "multiversx-sc 0.43.4", + "multiversx-sc-meta 0.43.4", + "multiversx-sc-scenario 0.43.4", ] [[package]] @@ -26,15 +26,15 @@ name = "abi-tester-meta" version = "0.0.0" dependencies = [ "abi-tester", - "multiversx-sc-meta", + "multiversx-sc-meta 0.43.4", ] [[package]] name = "adder" version = "0.0.0" dependencies = [ - "multiversx-sc", - "multiversx-sc-scenario", + "multiversx-sc 0.43.4", + "multiversx-sc-scenario 0.43.4", ] [[package]] @@ -53,7 +53,24 @@ name = "adder-meta" version = "0.0.0" dependencies = [ "adder", - "multiversx-sc-meta", + "multiversx-sc-meta 0.43.4", +] + +[[package]] +name = "addercaller" +version = "0.0.0" +dependencies = [ + "multiversx-sc 0.41.3", + "multiversx-sc-scenario 0.41.3", + "num-bigint", +] + +[[package]] +name = "addercaller-meta" +version = "0.0.0" +dependencies = [ + "addercaller", + "multiversx-sc-meta 0.41.3", ] [[package]] @@ -107,8 +124,8 @@ name = "alloc-features" version = "0.0.0" dependencies = [ "esdt-system-sc-mock", - "multiversx-sc", - "multiversx-sc-scenario", + "multiversx-sc 0.43.4", + "multiversx-sc-scenario 0.43.4", ] [[package]] @@ -116,7 +133,7 @@ name = "alloc-features-meta" version = "0.0.0" dependencies = [ "alloc-features", - "multiversx-sc-meta", + "multiversx-sc-meta 0.43.4", ] [[package]] @@ -234,9 +251,9 @@ name = "basic-features" version = "0.0.0" dependencies = [ "esdt-system-sc-mock", - "multiversx-sc", + "multiversx-sc 0.43.4", "multiversx-sc-modules", - "multiversx-sc-scenario", + "multiversx-sc-scenario 0.43.4", ] [[package]] @@ -255,7 +272,7 @@ name = "basic-features-meta" version = "0.0.0" dependencies = [ "basic-features", - "multiversx-sc-meta", + "multiversx-sc-meta 0.43.4", ] [[package]] @@ -268,8 +285,8 @@ checksum = "d86b93f97252c47b41663388e6d155714a9d0c398b99f1005cbc5f978b29f445" name = "benchmark-common" version = "0.0.0" dependencies = [ - "multiversx-sc", - "multiversx-sc-scenario", + "multiversx-sc 0.43.4", + "multiversx-sc-scenario 0.43.4", ] [[package]] @@ -277,8 +294,8 @@ name = "big-float-features" version = "0.0.0" dependencies = [ "esdt-system-sc-mock", - "multiversx-sc", - "multiversx-sc-scenario", + "multiversx-sc 0.43.4", + "multiversx-sc-scenario 0.43.4", ] [[package]] @@ -286,7 +303,7 @@ name = "big-float-features-meta" version = "0.0.0" dependencies = [ "big-float-features", - "multiversx-sc-meta", + "multiversx-sc-meta 0.43.4", ] [[package]] @@ -296,8 +313,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "93f2635620bf0b9d4576eb7bb9a38a55df78bd1205d26fa994b25911a69f212f" dependencies = [ "bitcoin_hashes", - "rand", - "rand_core", + "rand 0.8.5", + "rand_core 0.6.4", "serde", "unicode-normalization", ] @@ -349,9 +366,9 @@ checksum = "8d696c370c750c948ada61c69a0ee2cbbb9c50b1019ddb86d9317157a99c2cae" name = "bonding-curve-contract" version = "0.0.0" dependencies = [ - "multiversx-sc", + "multiversx-sc 0.43.4", "multiversx-sc-modules", - "multiversx-sc-scenario", + "multiversx-sc-scenario 0.43.4", ] [[package]] @@ -359,7 +376,7 @@ name = "bonding-curve-contract-meta" version = "0.0.0" dependencies = [ "bonding-curve-contract", - "multiversx-sc-meta", + "multiversx-sc-meta 0.43.4", ] [[package]] @@ -376,8 +393,8 @@ dependencies = [ name = "builtin-func-features" version = "0.0.0" dependencies = [ - "multiversx-sc", - "multiversx-sc-scenario", + "multiversx-sc 0.43.4", + "multiversx-sc-scenario 0.43.4", ] [[package]] @@ -385,7 +402,7 @@ name = "builtin-func-features-meta" version = "0.0.0" dependencies = [ "builtin-func-features", - "multiversx-sc-meta", + "multiversx-sc-meta 0.43.4", ] [[package]] @@ -427,6 +444,40 @@ dependencies = [ "pkg-config", ] +[[package]] +name = "callee" +version = "0.0.0" +dependencies = [ + "multiversx-sc 0.41.3", + "multiversx-sc-scenario 0.41.3", + "num-bigint", +] + +[[package]] +name = "callee-meta" +version = "0.0.0" +dependencies = [ + "callee", + "multiversx-sc-meta 0.41.3", +] + +[[package]] +name = "caller" +version = "0.0.0" +dependencies = [ + "multiversx-sc 0.41.3", + "multiversx-sc-scenario 0.41.3", + "num-bigint", +] + +[[package]] +name = "caller-meta" +version = "0.0.0" +dependencies = [ + "caller", + "multiversx-sc-meta 0.41.3", +] + [[package]] name = "cc" version = "1.0.83" @@ -447,9 +498,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" name = "check-pause" version = "0.0.0" dependencies = [ - "multiversx-sc", + "multiversx-sc 0.43.4", "multiversx-sc-modules", - "multiversx-sc-scenario", + "multiversx-sc-scenario 0.43.4", "num-bigint", ] @@ -458,15 +509,15 @@ name = "check-pause-meta" version = "0.0.0" dependencies = [ "check-pause", - "multiversx-sc-meta", + "multiversx-sc-meta 0.43.4", ] [[package]] name = "child" version = "0.0.0" dependencies = [ - "multiversx-sc", - "multiversx-sc-scenario", + "multiversx-sc 0.43.4", + "multiversx-sc-scenario 0.43.4", ] [[package]] @@ -474,8 +525,8 @@ name = "child-meta" version = "0.0.0" dependencies = [ "child", - "multiversx-sc", - "multiversx-sc-meta", + "multiversx-sc 0.43.4", + "multiversx-sc-meta 0.43.4", ] [[package]] @@ -561,7 +612,7 @@ dependencies = [ "forwarder", "forwarder-queue", "forwarder-raw", - "multiversx-sc-scenario", + "multiversx-sc-scenario 0.43.4", "promises-features", "proxy-test-first", "proxy-test-second", @@ -647,8 +698,8 @@ name = "crowdfunding-erc20" version = "0.0.0" dependencies = [ "erc20", - "multiversx-sc", - "multiversx-sc-scenario", + "multiversx-sc 0.43.4", + "multiversx-sc-scenario 0.43.4", ] [[package]] @@ -656,7 +707,7 @@ name = "crowdfunding-erc20-meta" version = "0.0.0" dependencies = [ "crowdfunding-erc20", - "multiversx-sc-meta", + "multiversx-sc-meta 0.43.4", ] [[package]] @@ -664,8 +715,8 @@ name = "crowdfunding-esdt" version = "0.0.0" dependencies = [ "hex", - "multiversx-sc", - "multiversx-sc-scenario", + "multiversx-sc 0.43.4", + "multiversx-sc-scenario 0.43.4", "num-bigint", "num-traits", ] @@ -675,15 +726,15 @@ name = "crowdfunding-esdt-meta" version = "0.0.0" dependencies = [ "crowdfunding-esdt", - "multiversx-sc-meta", + "multiversx-sc-meta 0.43.4", ] [[package]] name = "crypto-bubbles" version = "0.0.0" dependencies = [ - "multiversx-sc", - "multiversx-sc-scenario", + "multiversx-sc 0.43.4", + "multiversx-sc-scenario 0.43.4", ] [[package]] @@ -691,7 +742,7 @@ name = "crypto-bubbles-meta" version = "0.0.0" dependencies = [ "crypto-bubbles", - "multiversx-sc-meta", + "multiversx-sc-meta 0.43.4", ] [[package]] @@ -718,8 +769,8 @@ dependencies = [ name = "crypto-zombies" version = "0.0.0" dependencies = [ - "multiversx-sc", - "multiversx-sc-scenario", + "multiversx-sc 0.43.4", + "multiversx-sc-scenario 0.43.4", ] [[package]] @@ -727,7 +778,20 @@ name = "crypto-zombies-meta" version = "0.0.0" dependencies = [ "crypto-zombies", - "multiversx-sc-meta", + "multiversx-sc-meta 0.43.4", +] + +[[package]] +name = "curve25519-dalek" +version = "3.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b9fdf9972b2bd6af2d913799d9ebc165ea4d2e65878e329d9c6b372c4491b61" +dependencies = [ + "byteorder", + "digest 0.9.0", + "rand_core 0.5.1", + "subtle", + "zeroize", ] [[package]] @@ -832,8 +896,8 @@ dependencies = [ name = "digital-cash" version = "0.0.0" dependencies = [ - "multiversx-sc", - "multiversx-sc-scenario", + "multiversx-sc 0.43.4", + "multiversx-sc-scenario 0.43.4", ] [[package]] @@ -841,7 +905,7 @@ name = "digital-cash-meta" version = "0.0.0" dependencies = [ "digital-cash", - "multiversx-sc-meta", + "multiversx-sc-meta 0.43.4", ] [[package]] @@ -863,13 +927,27 @@ dependencies = [ "signature 2.1.0", ] +[[package]] +name = "ed25519-dalek" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c762bae6dcaf24c4c84667b8579785430908723d5c889f469d76a41d59cc7a9d" +dependencies = [ + "curve25519-dalek 3.2.0", + "ed25519 1.5.3", + "rand 0.7.3", + "serde", + "sha2 0.9.9", + "zeroize", +] + [[package]] name = "ed25519-dalek" version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7277392b266383ef8396db7fdeb1e77b6c52fed775f5df15bb24f35b72156980" dependencies = [ - "curve25519-dalek", + "curve25519-dalek 4.0.0", "ed25519 2.2.2", "serde", "sha2 0.10.7", @@ -886,8 +964,8 @@ checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" name = "empty" version = "0.0.0" dependencies = [ - "multiversx-sc", - "multiversx-sc-scenario", + "multiversx-sc 0.43.4", + "multiversx-sc-scenario 0.43.4", "num-bigint", ] @@ -896,7 +974,7 @@ name = "empty-meta" version = "0.0.0" dependencies = [ "empty", - "multiversx-sc-meta", + "multiversx-sc-meta 0.43.4", ] [[package]] @@ -959,8 +1037,8 @@ name = "erc1155" version = "0.0.0" dependencies = [ "erc1155-user-mock", - "multiversx-sc", - "multiversx-sc-scenario", + "multiversx-sc 0.43.4", + "multiversx-sc-scenario 0.43.4", ] [[package]] @@ -968,8 +1046,8 @@ name = "erc1155-marketplace" version = "0.0.0" dependencies = [ "erc1155", - "multiversx-sc", - "multiversx-sc-scenario", + "multiversx-sc 0.43.4", + "multiversx-sc-scenario 0.43.4", ] [[package]] @@ -977,7 +1055,7 @@ name = "erc1155-marketplace-meta" version = "0.0.0" dependencies = [ "erc1155-marketplace", - "multiversx-sc-meta", + "multiversx-sc-meta 0.43.4", ] [[package]] @@ -985,15 +1063,15 @@ name = "erc1155-meta" version = "0.0.0" dependencies = [ "erc1155", - "multiversx-sc-meta", + "multiversx-sc-meta 0.43.4", ] [[package]] name = "erc1155-user-mock" version = "0.0.0" dependencies = [ - "multiversx-sc", - "multiversx-sc-scenario", + "multiversx-sc 0.43.4", + "multiversx-sc-scenario 0.43.4", ] [[package]] @@ -1001,15 +1079,15 @@ name = "erc1155-user-mock-meta" version = "0.0.0" dependencies = [ "erc1155-user-mock", - "multiversx-sc-meta", + "multiversx-sc-meta 0.43.4", ] [[package]] name = "erc20" version = "0.0.0" dependencies = [ - "multiversx-sc", - "multiversx-sc-scenario", + "multiversx-sc 0.43.4", + "multiversx-sc-scenario 0.43.4", ] [[package]] @@ -1017,15 +1095,15 @@ name = "erc20-meta" version = "0.0.0" dependencies = [ "erc20", - "multiversx-sc-meta", + "multiversx-sc-meta 0.43.4", ] [[package]] name = "erc721" version = "0.0.0" dependencies = [ - "multiversx-sc", - "multiversx-sc-scenario", + "multiversx-sc 0.43.4", + "multiversx-sc-scenario 0.43.4", ] [[package]] @@ -1033,7 +1111,7 @@ name = "erc721-meta" version = "0.0.0" dependencies = [ "erc721", - "multiversx-sc-meta", + "multiversx-sc-meta 0.43.4", ] [[package]] @@ -1062,8 +1140,8 @@ name = "esdt-contract-pair" version = "0.0.0" dependencies = [ "first-contract", - "multiversx-sc", - "multiversx-sc-scenario", + "multiversx-sc 0.43.4", + "multiversx-sc-scenario 0.43.4", "second-contract", ] @@ -1071,8 +1149,8 @@ dependencies = [ name = "esdt-system-sc-mock" version = "0.0.0" dependencies = [ - "multiversx-sc", - "multiversx-sc-scenario", + "multiversx-sc 0.43.4", + "multiversx-sc-scenario 0.43.4", ] [[package]] @@ -1080,15 +1158,15 @@ name = "esdt-system-sc-mock-meta" version = "0.0.0" dependencies = [ "esdt-system-sc-mock", - "multiversx-sc-meta", + "multiversx-sc-meta 0.43.4", ] [[package]] name = "esdt-transfer-with-fee" version = "0.0.0" dependencies = [ - "multiversx-sc", - "multiversx-sc-scenario", + "multiversx-sc 0.43.4", + "multiversx-sc-scenario 0.43.4", ] [[package]] @@ -1096,15 +1174,15 @@ name = "esdt-transfer-with-fee-meta" version = "0.0.0" dependencies = [ "esdt-transfer-with-fee", - "multiversx-sc-meta", + "multiversx-sc-meta 0.43.4", ] [[package]] name = "factorial" version = "0.0.0" dependencies = [ - "multiversx-sc", - "multiversx-sc-scenario", + "multiversx-sc 0.43.4", + "multiversx-sc-scenario 0.43.4", ] [[package]] @@ -1112,14 +1190,14 @@ name = "factorial-meta" version = "0.0.0" dependencies = [ "factorial", - "multiversx-sc-meta", + "multiversx-sc-meta 0.43.4", ] [[package]] name = "factory-meta" version = "0.0.0" dependencies = [ - "multiversx-sc-meta", + "multiversx-sc-meta 0.43.4", "order-book-factory", ] @@ -1139,8 +1217,8 @@ checksum = "e825f6987101665dea6ec934c09ec6d721de7bc1bf92248e1d5810c8cd636b77" name = "first-contract" version = "0.0.0" dependencies = [ - "multiversx-sc", - "multiversx-sc-scenario", + "multiversx-sc 0.43.4", + "multiversx-sc-scenario 0.43.4", ] [[package]] @@ -1148,8 +1226,8 @@ name = "first-contract-meta" version = "0.0.0" dependencies = [ "first-contract", - "multiversx-sc", - "multiversx-sc-meta", + "multiversx-sc 0.43.4", + "multiversx-sc-meta 0.43.4", ] [[package]] @@ -1196,8 +1274,8 @@ dependencies = [ name = "formatted-message-features" version = "0.0.0" dependencies = [ - "multiversx-sc", - "multiversx-sc-scenario", + "multiversx-sc 0.43.4", + "multiversx-sc-scenario 0.43.4", ] [[package]] @@ -1205,15 +1283,15 @@ name = "formatted-message-features-meta" version = "0.0.0" dependencies = [ "formatted-message-features", - "multiversx-sc-meta", + "multiversx-sc-meta 0.43.4", ] [[package]] name = "forwarder" version = "0.0.0" dependencies = [ - "multiversx-sc", - "multiversx-sc-scenario", + "multiversx-sc 0.43.4", + "multiversx-sc-scenario 0.43.4", "vault", ] @@ -1222,15 +1300,15 @@ name = "forwarder-meta" version = "0.0.0" dependencies = [ "forwarder", - "multiversx-sc-meta", + "multiversx-sc-meta 0.43.4", ] [[package]] name = "forwarder-queue" version = "0.0.0" dependencies = [ - "multiversx-sc", - "multiversx-sc-scenario", + "multiversx-sc 0.43.4", + "multiversx-sc-scenario 0.43.4", "multiversx-sc-wasm-adapter", "vault", ] @@ -1240,15 +1318,15 @@ name = "forwarder-queue-meta" version = "0.0.0" dependencies = [ "forwarder-queue", - "multiversx-sc-meta", + "multiversx-sc-meta 0.43.4", ] [[package]] name = "forwarder-raw" version = "0.0.0" dependencies = [ - "multiversx-sc", - "multiversx-sc-scenario", + "multiversx-sc 0.43.4", + "multiversx-sc-scenario 0.43.4", ] [[package]] @@ -1256,16 +1334,16 @@ name = "forwarder-raw-meta" version = "0.0.0" dependencies = [ "forwarder-raw", - "multiversx-sc-meta", + "multiversx-sc-meta 0.43.4", ] [[package]] name = "fractional-nfts" version = "0.0.0" dependencies = [ - "multiversx-sc", + "multiversx-sc 0.43.4", "multiversx-sc-modules", - "multiversx-sc-scenario", + "multiversx-sc-scenario 0.43.4", ] [[package]] @@ -1273,7 +1351,7 @@ name = "fractional-nfts-meta" version = "0.0.0" dependencies = [ "fractional-nfts", - "multiversx-sc-meta", + "multiversx-sc-meta 0.43.4", ] [[package]] @@ -1375,6 +1453,17 @@ dependencies = [ "version_check", ] +[[package]] +name = "getrandom" +version = "0.1.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" +dependencies = [ + "cfg-if", + "libc", + "wasi 0.9.0+wasi-snapshot-preview1", +] + [[package]] name = "getrandom" version = "0.2.10" @@ -1383,7 +1472,7 @@ checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427" dependencies = [ "cfg-if", "libc", - "wasi", + "wasi 0.11.0+wasi-snapshot-preview1", ] [[package]] @@ -1713,7 +1802,7 @@ dependencies = [ name = "kitty" version = "0.0.0" dependencies = [ - "multiversx-sc", + "multiversx-sc 0.43.4", "random", ] @@ -1723,8 +1812,8 @@ version = "0.0.0" dependencies = [ "kitty", "kitty-ownership", - "multiversx-sc", - "multiversx-sc-scenario", + "multiversx-sc 0.43.4", + "multiversx-sc-scenario 0.43.4", ] [[package]] @@ -1732,7 +1821,7 @@ name = "kitty-auction-meta" version = "0.0.0" dependencies = [ "kitty-auction", - "multiversx-sc-meta", + "multiversx-sc-meta 0.43.4", ] [[package]] @@ -1740,8 +1829,8 @@ name = "kitty-genetic-alg" version = "0.0.0" dependencies = [ "kitty", - "multiversx-sc", - "multiversx-sc-scenario", + "multiversx-sc 0.43.4", + "multiversx-sc-scenario 0.43.4", "random", ] @@ -1750,7 +1839,7 @@ name = "kitty-genetic-alg-meta" version = "0.0.0" dependencies = [ "kitty-genetic-alg", - "multiversx-sc-meta", + "multiversx-sc-meta 0.43.4", ] [[package]] @@ -1759,8 +1848,8 @@ version = "0.0.0" dependencies = [ "kitty", "kitty-genetic-alg", - "multiversx-sc", - "multiversx-sc-scenario", + "multiversx-sc 0.43.4", + "multiversx-sc-scenario 0.43.4", "random", ] @@ -1769,15 +1858,15 @@ name = "kitty-ownership-meta" version = "0.0.0" dependencies = [ "kitty-ownership", - "multiversx-sc-meta", + "multiversx-sc-meta 0.43.4", ] [[package]] name = "large-storage" version = "0.0.0" dependencies = [ - "multiversx-sc", - "multiversx-sc-scenario", + "multiversx-sc 0.43.4", + "multiversx-sc-scenario 0.43.4", ] [[package]] @@ -1785,7 +1874,7 @@ name = "large-storage-meta" version = "0.0.0" dependencies = [ "large-storage", - "multiversx-sc-meta", + "multiversx-sc-meta 0.43.4", ] [[package]] @@ -1805,8 +1894,8 @@ name = "linked-list-repeat" version = "0.0.0" dependencies = [ "benchmark-common", - "multiversx-sc", - "multiversx-sc-scenario", + "multiversx-sc 0.43.4", + "multiversx-sc-scenario 0.43.4", ] [[package]] @@ -1814,7 +1903,7 @@ name = "linked-list-repeat-meta" version = "0.0.0" dependencies = [ "linked-list-repeat", - "multiversx-sc-meta", + "multiversx-sc-meta 0.43.4", ] [[package]] @@ -1827,8 +1916,8 @@ checksum = "57bcfdad1b858c2db7c38303a6d2ad4dfaf5eb53dfeb0910128b2c26d6158503" name = "local-esdt-and-nft" version = "0.0.0" dependencies = [ - "multiversx-sc", - "multiversx-sc-scenario", + "multiversx-sc 0.43.4", + "multiversx-sc-scenario 0.43.4", ] [[package]] @@ -1836,7 +1925,7 @@ name = "local-esdt-and-nft-meta" version = "0.0.0" dependencies = [ "local-esdt-and-nft", - "multiversx-sc-meta", + "multiversx-sc-meta 0.43.4", ] [[package]] @@ -1860,8 +1949,8 @@ name = "lottery-erc20" version = "0.0.0" dependencies = [ "erc20", - "multiversx-sc", - "multiversx-sc-scenario", + "multiversx-sc 0.43.4", + "multiversx-sc-scenario 0.43.4", ] [[package]] @@ -1869,15 +1958,15 @@ name = "lottery-erc20-meta" version = "0.0.0" dependencies = [ "lottery-erc20", - "multiversx-sc-meta", + "multiversx-sc-meta 0.43.4", ] [[package]] name = "lottery-esdt" version = "0.0.0" dependencies = [ - "multiversx-sc", - "multiversx-sc-scenario", + "multiversx-sc 0.43.4", + "multiversx-sc-scenario 0.43.4", ] [[package]] @@ -1885,7 +1974,7 @@ name = "lottery-esdt-meta" version = "0.0.0" dependencies = [ "lottery-esdt", - "multiversx-sc-meta", + "multiversx-sc-meta 0.43.4", ] [[package]] @@ -1893,8 +1982,8 @@ name = "managed-map-features" version = "0.0.0" dependencies = [ "esdt-system-sc-mock", - "multiversx-sc", - "multiversx-sc-scenario", + "multiversx-sc 0.43.4", + "multiversx-sc-scenario 0.43.4", ] [[package]] @@ -1902,7 +1991,7 @@ name = "managed-map-features-meta" version = "0.0.0" dependencies = [ "managed-map-features", - "multiversx-sc-meta", + "multiversx-sc-meta 0.43.4", ] [[package]] @@ -1910,8 +1999,8 @@ name = "map-repeat" version = "0.0.0" dependencies = [ "benchmark-common", - "multiversx-sc", - "multiversx-sc-scenario", + "multiversx-sc 0.43.4", + "multiversx-sc-scenario 0.43.4", ] [[package]] @@ -1919,7 +2008,7 @@ name = "map-repeat-meta" version = "0.0.0" dependencies = [ "map-repeat", - "multiversx-sc-meta", + "multiversx-sc-meta 0.43.4", ] [[package]] @@ -1950,7 +2039,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "927a765cd3fc26206e66b296465fa9d3e5ab003e651c1b3c060e7956d96b19d2" dependencies = [ "libc", - "wasi", + "wasi 0.11.0+wasi-snapshot-preview1", "windows-sys", ] @@ -1958,8 +2047,8 @@ dependencies = [ name = "multi-contract-features" version = "0.0.0" dependencies = [ - "multiversx-sc", - "multiversx-sc-scenario", + "multiversx-sc 0.43.4", + "multiversx-sc-scenario 0.43.4", ] [[package]] @@ -1967,7 +2056,7 @@ name = "multi-contract-features-meta" version = "0.0.0" dependencies = [ "multi-contract-features", - "multiversx-sc-meta", + "multiversx-sc-meta 0.43.4", ] [[package]] @@ -1977,9 +2066,9 @@ dependencies = [ "adder", "factorial", "hex", - "multiversx-sc", + "multiversx-sc 0.43.4", "multiversx-sc-modules", - "multiversx-sc-scenario", + "multiversx-sc-scenario 0.43.4", "multiversx-wegld-swap-sc", "num-bigint", "num-traits", @@ -1992,7 +2081,7 @@ dependencies = [ "clap", "multisig", "multiversx-sc-modules", - "multiversx-sc-scenario", + "multiversx-sc-scenario 0.43.4", "multiversx-sc-snippets", "serde", "toml 0.7.6", @@ -2003,7 +2092,22 @@ name = "multisig-meta" version = "0.0.0" dependencies = [ "multisig", - "multiversx-sc-meta", + "multiversx-sc-meta 0.43.4", +] + +[[package]] +name = "multiversx-chain-scenario-format" +version = "0.19.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4d2592a441608937c5aebec6732c38e6097f58de1dc9a64d7dbe98e0ab97a3c0" +dependencies = [ + "bech32", + "hex", + "num-bigint", + "num-traits", + "serde", + "serde_json", + "sha3 0.9.1", ] [[package]] @@ -2019,19 +2123,42 @@ dependencies = [ "sha3 0.9.1", ] +[[package]] +name = "multiversx-chain-vm" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "212ddb5a9199f5d94d873a30126fb24b9a80383af748911c5dea71595f39a5c7" +dependencies = [ + "bech32", + "ed25519-dalek 1.0.1", + "hex", + "itertools", + "multiversx-chain-scenario-format 0.19.1", + "multiversx-sc 0.41.3", + "multiversx-sc-meta 0.41.3", + "num-bigint", + "num-traits", + "rand 0.8.5", + "rand_seeder", + "serde", + "serde_json", + "sha2 0.10.7", + "sha3 0.10.8", +] + [[package]] name = "multiversx-chain-vm" version = "0.5.2" dependencies = [ "bitflags 1.3.2", - "ed25519-dalek", + "ed25519-dalek 2.0.0", "hex", "hex-literal", "itertools", "multiversx-chain-vm-executor", "num-bigint", "num-traits", - "rand", + "rand 0.8.5", "rand_seeder", "sha2 0.10.7", "sha3 0.10.8", @@ -2059,9 +2186,9 @@ name = "multiversx-price-aggregator-sc" version = "0.43.4" dependencies = [ "arrayvec", - "multiversx-sc", + "multiversx-sc 0.43.4", "multiversx-sc-modules", - "multiversx-sc-scenario", + "multiversx-sc-scenario 0.43.4", ] [[package]] @@ -2069,8 +2196,22 @@ name = "multiversx-price-aggregator-sc-meta" version = "0.0.0" dependencies = [ "multiversx-price-aggregator-sc", - "multiversx-sc", - "multiversx-sc-meta", + "multiversx-sc 0.43.4", + "multiversx-sc-meta 0.43.4", +] + +[[package]] +name = "multiversx-sc" +version = "0.41.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfbe80ec68fedf299dd65469f8999cf3c0f884ffa497122428f08303bcb8b884" +dependencies = [ + "bitflags 1.3.2", + "hashbrown 0.13.2", + "hex-literal", + "multiversx-sc-codec 0.17.2", + "multiversx-sc-derive 0.41.3", + "num-traits", ] [[package]] @@ -2080,20 +2221,43 @@ dependencies = [ "bitflags 1.3.2", "hashbrown 0.13.2", "hex-literal", - "multiversx-sc-codec", - "multiversx-sc-derive", + "multiversx-sc-codec 0.18.1", + "multiversx-sc-derive 0.43.4", "num-traits", ] +[[package]] +name = "multiversx-sc-codec" +version = "0.17.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "71d70ea458247d263b7e9fdfb207530b6a530546247139c162450e515c013a18" +dependencies = [ + "arrayvec", + "multiversx-sc-codec-derive 0.17.2", + "num-bigint", +] + [[package]] name = "multiversx-sc-codec" version = "0.18.1" dependencies = [ "arrayvec", - "multiversx-sc-codec-derive", + "multiversx-sc-codec-derive 0.18.1", "num-bigint", ] +[[package]] +name = "multiversx-sc-codec-derive" +version = "0.17.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ad6920f80fda67fc60fd51aaa9f83ec7e069470f60a068c81205f9da5d05a30" +dependencies = [ + "hex", + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "multiversx-sc-codec-derive" version = "0.18.1" @@ -2104,6 +2268,19 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "multiversx-sc-derive" +version = "0.41.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c2b87d817f2176bf1830bef938884f24267516c334a377e71a96bc18ebb09c1" +dependencies = [ + "hex", + "proc-macro2", + "quote", + "radix_trie", + "syn 1.0.109", +] + [[package]] name = "multiversx-sc-derive" version = "0.43.4" @@ -2115,6 +2292,27 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "multiversx-sc-meta" +version = "0.41.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a027febbf84d887b429699cf8cbe2a9d1776d26dee7359d9b7afdc3407e57da0" +dependencies = [ + "clap", + "colored", + "common-path", + "convert_case", + "hex", + "lazy_static", + "multiversx-sc 0.41.3", + "pathdiff", + "ruplacer", + "rustc_version", + "serde", + "serde_json", + "toml 0.5.11", +] + [[package]] name = "multiversx-sc-meta" version = "0.43.4" @@ -2127,7 +2325,7 @@ dependencies = [ "copy_dir", "hex", "lazy_static", - "multiversx-sc", + "multiversx-sc 0.43.4", "pathdiff", "reqwest", "ruplacer", @@ -2146,7 +2344,24 @@ dependencies = [ name = "multiversx-sc-modules" version = "0.43.4" dependencies = [ - "multiversx-sc", + "multiversx-sc 0.43.4", +] + +[[package]] +name = "multiversx-sc-scenario" +version = "0.41.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0466020f9dcceaeb5ffe293e07c1eb43d81395170267e1b77445063bf17279cc" +dependencies = [ + "colored", + "hex", + "itertools", + "multiversx-chain-vm 0.3.3", + "num-traits", + "pathdiff", + "serde", + "serde_json", + "sha2 0.10.7", ] [[package]] @@ -2160,11 +2375,11 @@ dependencies = [ "hex", "itertools", "log", - "multiversx-chain-scenario-format", - "multiversx-chain-vm", + "multiversx-chain-scenario-format 0.20.0", + "multiversx-chain-vm 0.5.2", "multiversx-chain-vm-executor", - "multiversx-sc", - "multiversx-sc-meta", + "multiversx-sc 0.43.4", + "multiversx-sc-meta 0.43.4", "multiversx-sdk", "num-bigint", "num-traits", @@ -2184,7 +2399,7 @@ dependencies = [ "futures", "hex", "log", - "multiversx-sc-scenario", + "multiversx-sc-scenario 0.43.4", "multiversx-sdk", "tokio", ] @@ -2193,7 +2408,7 @@ dependencies = [ name = "multiversx-sc-wasm-adapter" version = "0.43.4" dependencies = [ - "multiversx-sc", + "multiversx-sc 0.43.4", ] [[package]] @@ -2210,7 +2425,7 @@ dependencies = [ "itertools", "pbkdf2 0.9.0", "pem", - "rand", + "rand 0.8.5", "reqwest", "serde", "serde_json", @@ -2225,17 +2440,17 @@ dependencies = [ name = "multiversx-wegld-swap-sc" version = "0.43.4" dependencies = [ - "multiversx-sc", + "multiversx-sc 0.43.4", "multiversx-sc-modules", - "multiversx-sc-scenario", + "multiversx-sc-scenario 0.43.4", ] [[package]] name = "multiversx-wegld-swap-sc-meta" version = "0.0.0" dependencies = [ - "multiversx-sc", - "multiversx-sc-meta", + "multiversx-sc 0.43.4", + "multiversx-sc-meta 0.43.4", "multiversx-wegld-swap-sc", ] @@ -2245,7 +2460,7 @@ version = "0.0.0" dependencies = [ "bech32", "hex", - "multiversx-sc", + "multiversx-sc 0.43.4", "num-bigint", "num-traits", ] @@ -2272,15 +2487,15 @@ dependencies = [ name = "nft-minter" version = "0.0.0" dependencies = [ - "multiversx-sc", - "multiversx-sc-scenario", + "multiversx-sc 0.43.4", + "multiversx-sc-scenario 0.43.4", ] [[package]] name = "nft-minter-meta" version = "0.0.0" dependencies = [ - "multiversx-sc-meta", + "multiversx-sc-meta 0.43.4", "nft-minter", ] @@ -2288,15 +2503,15 @@ dependencies = [ name = "nft-storage-prepay" version = "0.0.0" dependencies = [ - "multiversx-sc", - "multiversx-sc-scenario", + "multiversx-sc 0.43.4", + "multiversx-sc-scenario 0.43.4", ] [[package]] name = "nft-storage-prepay-meta" version = "0.0.0" dependencies = [ - "multiversx-sc-meta", + "multiversx-sc-meta 0.43.4", "nft-storage-prepay", ] @@ -2435,23 +2650,23 @@ dependencies = [ name = "order-book-factory" version = "0.0.0" dependencies = [ - "multiversx-sc", - "multiversx-sc-scenario", + "multiversx-sc 0.43.4", + "multiversx-sc-scenario 0.43.4", ] [[package]] name = "order-book-pair" version = "0.0.0" dependencies = [ - "multiversx-sc", - "multiversx-sc-scenario", + "multiversx-sc 0.43.4", + "multiversx-sc-scenario 0.43.4", ] [[package]] name = "pair-meta" version = "0.0.0" dependencies = [ - "multiversx-sc-meta", + "multiversx-sc-meta 0.43.4", "order-book-pair", ] @@ -2459,15 +2674,15 @@ dependencies = [ name = "panic-message-features" version = "0.0.0" dependencies = [ - "multiversx-sc", - "multiversx-sc-scenario", + "multiversx-sc 0.43.4", + "multiversx-sc-scenario 0.43.4", ] [[package]] name = "panic-message-features-meta" version = "0.0.0" dependencies = [ - "multiversx-sc-meta", + "multiversx-sc-meta 0.43.4", "panic-message-features", ] @@ -2476,16 +2691,16 @@ name = "parent" version = "0.0.0" dependencies = [ "child", - "multiversx-sc", - "multiversx-sc-scenario", + "multiversx-sc 0.43.4", + "multiversx-sc-scenario 0.43.4", ] [[package]] name = "parent-meta" version = "0.0.0" dependencies = [ - "multiversx-sc", - "multiversx-sc-meta", + "multiversx-sc 0.43.4", + "multiversx-sc-meta 0.43.4", "parent", ] @@ -2519,7 +2734,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7676374caaee8a325c9e7a2ae557f216c5563a171d6997b0ef8a65af35147700" dependencies = [ "base64ct", - "rand_core", + "rand_core 0.6.4", "subtle", ] @@ -2539,15 +2754,15 @@ checksum = "8835116a5c179084a830efb3adc117ab007512b535bc1a21c991d3b32a6b44dd" name = "payable-features" version = "0.0.0" dependencies = [ - "multiversx-sc", - "multiversx-sc-scenario", + "multiversx-sc 0.43.4", + "multiversx-sc-scenario 0.43.4", ] [[package]] name = "payable-features-meta" version = "0.0.0" dependencies = [ - "multiversx-sc-meta", + "multiversx-sc-meta 0.43.4", "payable-features", ] @@ -2603,15 +2818,15 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" name = "ping-pong-egld" version = "0.0.2" dependencies = [ - "multiversx-sc", - "multiversx-sc-scenario", + "multiversx-sc 0.43.4", + "multiversx-sc-scenario 0.43.4", ] [[package]] name = "ping-pong-egld-meta" version = "0.0.0" dependencies = [ - "multiversx-sc-meta", + "multiversx-sc-meta 0.43.4", "ping-pong-egld", ] @@ -2656,8 +2871,8 @@ dependencies = [ name = "promises-features" version = "0.0.0" dependencies = [ - "multiversx-sc", - "multiversx-sc-scenario", + "multiversx-sc 0.43.4", + "multiversx-sc-scenario 0.43.4", "vault", ] @@ -2665,7 +2880,7 @@ dependencies = [ name = "promises-features-meta" version = "0.0.0" dependencies = [ - "multiversx-sc-meta", + "multiversx-sc-meta 0.43.4", "promises-features", ] @@ -2674,15 +2889,15 @@ name = "proxy-pause" version = "0.0.0" dependencies = [ "check-pause", - "multiversx-sc", - "multiversx-sc-scenario", + "multiversx-sc 0.43.4", + "multiversx-sc-scenario 0.43.4", ] [[package]] name = "proxy-pause-meta" version = "0.0.0" dependencies = [ - "multiversx-sc-meta", + "multiversx-sc-meta 0.43.4", "proxy-pause", ] @@ -2691,15 +2906,15 @@ name = "proxy-test-first" version = "0.0.0" dependencies = [ "hex-literal", - "multiversx-sc", - "multiversx-sc-scenario", + "multiversx-sc 0.43.4", + "multiversx-sc-scenario 0.43.4", ] [[package]] name = "proxy-test-first-meta" version = "0.0.0" dependencies = [ - "multiversx-sc-meta", + "multiversx-sc-meta 0.43.4", "proxy-test-first", ] @@ -2707,15 +2922,15 @@ dependencies = [ name = "proxy-test-second" version = "0.0.0" dependencies = [ - "multiversx-sc", - "multiversx-sc-scenario", + "multiversx-sc 0.43.4", + "multiversx-sc-scenario 0.43.4", ] [[package]] name = "proxy-test-second-meta" version = "0.0.0" dependencies = [ - "multiversx-sc-meta", + "multiversx-sc-meta 0.43.4", "proxy-test-second", ] @@ -2724,15 +2939,15 @@ name = "queue-repeat" version = "0.0.0" dependencies = [ "benchmark-common", - "multiversx-sc", - "multiversx-sc-scenario", + "multiversx-sc 0.43.4", + "multiversx-sc-scenario 0.43.4", ] [[package]] name = "queue-repeat-meta" version = "0.0.0" dependencies = [ - "multiversx-sc-meta", + "multiversx-sc-meta 0.43.4", "queue-repeat", ] @@ -2755,6 +2970,19 @@ dependencies = [ "nibble_vec", ] +[[package]] +name = "rand" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" +dependencies = [ + "getrandom 0.1.16", + "libc", + "rand_chacha 0.2.2", + "rand_core 0.5.1", + "rand_hc", +] + [[package]] name = "rand" version = "0.8.5" @@ -2762,8 +2990,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" dependencies = [ "libc", - "rand_chacha", - "rand_core", + "rand_chacha 0.3.1", + "rand_core 0.6.4", +] + +[[package]] +name = "rand_chacha" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" +dependencies = [ + "ppv-lite86", + "rand_core 0.5.1", ] [[package]] @@ -2773,7 +3011,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" dependencies = [ "ppv-lite86", - "rand_core", + "rand_core 0.6.4", +] + +[[package]] +name = "rand_core" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" +dependencies = [ + "getrandom 0.1.16", ] [[package]] @@ -2782,7 +3029,16 @@ version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" dependencies = [ - "getrandom", + "getrandom 0.2.10", +] + +[[package]] +name = "rand_hc" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" +dependencies = [ + "rand_core 0.5.1", ] [[package]] @@ -2791,22 +3047,22 @@ version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf2890aaef0aa82719a50e808de264f9484b74b442e1a3a0e5ee38243ac40bdb" dependencies = [ - "rand_core", + "rand_core 0.6.4", ] [[package]] name = "random" version = "0.0.0" dependencies = [ - "multiversx-sc", + "multiversx-sc 0.43.4", ] [[package]] name = "recursive-caller" version = "0.0.0" dependencies = [ - "multiversx-sc", - "multiversx-sc-scenario", + "multiversx-sc 0.43.4", + "multiversx-sc-scenario 0.43.4", "vault", ] @@ -2814,7 +3070,7 @@ dependencies = [ name = "recursive-caller-meta" version = "0.0.0" dependencies = [ - "multiversx-sc-meta", + "multiversx-sc-meta 0.43.4", "recursive-caller", ] @@ -2897,16 +3153,16 @@ dependencies = [ name = "rewards-distribution" version = "0.0.0" dependencies = [ - "multiversx-sc", + "multiversx-sc 0.43.4", "multiversx-sc-modules", - "multiversx-sc-scenario", + "multiversx-sc-scenario 0.43.4", ] [[package]] name = "rewards-distribution-meta" version = "0.0.0" dependencies = [ - "multiversx-sc-meta", + "multiversx-sc-meta 0.43.4", "rewards-distribution", ] @@ -2929,15 +3185,15 @@ dependencies = [ name = "rust-snippets-generator-test" version = "0.0.0" dependencies = [ - "multiversx-sc", - "multiversx-sc-scenario", + "multiversx-sc 0.43.4", + "multiversx-sc-scenario 0.43.4", ] [[package]] name = "rust-snippets-generator-test-meta" version = "0.0.0" dependencies = [ - "multiversx-sc-meta", + "multiversx-sc-meta 0.43.4", "rust-snippets-generator-test", ] @@ -2949,8 +3205,8 @@ dependencies = [ "basic-features", "forwarder", "hex", - "multiversx-sc", - "multiversx-sc-scenario", + "multiversx-sc 0.43.4", + "multiversx-sc-scenario 0.43.4", "num-bigint", "num-traits", "vault", @@ -2960,7 +3216,7 @@ dependencies = [ name = "rust-testing-framework-tester-meta" version = "0.0.0" dependencies = [ - "multiversx-sc-meta", + "multiversx-sc-meta 0.43.4", "rust-testing-framework-tester", ] @@ -3026,16 +3282,16 @@ checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" name = "second-contract" version = "0.0.0" dependencies = [ - "multiversx-sc", - "multiversx-sc-scenario", + "multiversx-sc 0.43.4", + "multiversx-sc-scenario 0.43.4", ] [[package]] name = "second-contract-meta" version = "0.0.0" dependencies = [ - "multiversx-sc", - "multiversx-sc-meta", + "multiversx-sc 0.43.4", + "multiversx-sc-meta 0.43.4", "second-contract", ] @@ -3066,16 +3322,16 @@ dependencies = [ name = "seed-nft-minter" version = "0.0.0" dependencies = [ - "multiversx-sc", + "multiversx-sc 0.43.4", "multiversx-sc-modules", - "multiversx-sc-scenario", + "multiversx-sc-scenario 0.43.4", ] [[package]] name = "seed-nft-minter-meta" version = "0.0.0" dependencies = [ - "multiversx-sc-meta", + "multiversx-sc-meta 0.43.4", "seed-nft-minter", ] @@ -3089,15 +3345,15 @@ checksum = "b0293b4b29daaf487284529cc2f5675b8e57c61f70167ba415a463651fd6a918" name = "send-tx-repeat" version = "0.0.0" dependencies = [ - "multiversx-sc", - "multiversx-sc-scenario", + "multiversx-sc 0.43.4", + "multiversx-sc-scenario 0.43.4", ] [[package]] name = "send-tx-repeat-meta" version = "0.0.0" dependencies = [ - "multiversx-sc-meta", + "multiversx-sc-meta 0.43.4", "send-tx-repeat", ] @@ -3170,15 +3426,15 @@ name = "set-repeat" version = "0.0.0" dependencies = [ "benchmark-common", - "multiversx-sc", - "multiversx-sc-scenario", + "multiversx-sc 0.43.4", + "multiversx-sc-scenario 0.43.4", ] [[package]] name = "set-repeat-meta" version = "0.0.0" dependencies = [ - "multiversx-sc-meta", + "multiversx-sc-meta 0.43.4", "set-repeat", ] @@ -3265,15 +3521,15 @@ name = "single-value-repeat" version = "0.0.0" dependencies = [ "benchmark-common", - "multiversx-sc", - "multiversx-sc-scenario", + "multiversx-sc 0.43.4", + "multiversx-sc-scenario 0.43.4", ] [[package]] name = "single-value-repeat-meta" version = "0.0.0" dependencies = [ - "multiversx-sc-meta", + "multiversx-sc-meta 0.43.4", "single-value-repeat", ] @@ -3326,15 +3582,15 @@ dependencies = [ name = "str-repeat" version = "0.0.0" dependencies = [ - "multiversx-sc", - "multiversx-sc-scenario", + "multiversx-sc 0.43.4", + "multiversx-sc-scenario 0.43.4", ] [[package]] name = "str-repeat-meta" version = "0.0.0" dependencies = [ - "multiversx-sc-meta", + "multiversx-sc-meta 0.43.4", "str-repeat", ] @@ -3394,6 +3650,68 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "test-adder" +version = "0.0.0" +dependencies = [ + "multiversx-sc 0.43.4", + "multiversx-sc-scenario 0.43.4", + "num-bigint", + "testapi", +] + +[[package]] +name = "test-adder-meta" +version = "0.0.0" +dependencies = [ + "multiversx-sc-meta 0.43.4", + "test-adder", +] + +[[package]] +name = "test-testapi" +version = "0.0.0" +dependencies = [ + "multiversx-sc 0.43.4", + "multiversx-sc-scenario 0.43.4", + "num-bigint", + "testapi", +] + +[[package]] +name = "test-testapi-meta" +version = "0.0.0" +dependencies = [ + "multiversx-sc-meta 0.43.4", + "test-testapi", +] + +[[package]] +name = "test_multisig" +version = "0.0.0" +dependencies = [ + "multiversx-sc 0.43.4", + "multiversx-sc-scenario 0.43.4", + "num-bigint", + "testapi", +] + +[[package]] +name = "test_multisig-meta" +version = "0.0.0" +dependencies = [ + "multiversx-sc-meta 0.43.4", + "test_multisig", +] + +[[package]] +name = "testapi" +version = "0.1.0" +dependencies = [ + "multiversx-sc 0.43.4", + "num-bigint", +] + [[package]] name = "thiserror" version = "1.0.47" @@ -3460,15 +3778,15 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" name = "token-release" version = "0.0.1" dependencies = [ - "multiversx-sc", - "multiversx-sc-scenario", + "multiversx-sc 0.43.4", + "multiversx-sc-scenario 0.43.4", ] [[package]] name = "token-release-meta" version = "0.0.0" dependencies = [ - "multiversx-sc-meta", + "multiversx-sc-meta 0.43.4", "token-release", ] @@ -3600,9 +3918,9 @@ dependencies = [ name = "transfer-role-features" version = "0.0.0" dependencies = [ - "multiversx-sc", + "multiversx-sc 0.43.4", "multiversx-sc-modules", - "multiversx-sc-scenario", + "multiversx-sc-scenario 0.43.4", "vault", ] @@ -3610,7 +3928,7 @@ dependencies = [ name = "transfer-role-features-meta" version = "0.0.0" dependencies = [ - "multiversx-sc-meta", + "multiversx-sc-meta 0.43.4", "transfer-role-features", ] @@ -3668,17 +3986,17 @@ dependencies = [ name = "use-module" version = "0.0.0" dependencies = [ - "multiversx-sc", - "multiversx-sc-meta", + "multiversx-sc 0.43.4", + "multiversx-sc-meta 0.43.4", "multiversx-sc-modules", - "multiversx-sc-scenario", + "multiversx-sc-scenario 0.43.4", ] [[package]] name = "use-module-meta" version = "0.0.0" dependencies = [ - "multiversx-sc-meta", + "multiversx-sc-meta 0.43.4", "use-module", ] @@ -3692,15 +4010,15 @@ checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" name = "vault" version = "0.0.0" dependencies = [ - "multiversx-sc", - "multiversx-sc-scenario", + "multiversx-sc 0.43.4", + "multiversx-sc-scenario 0.43.4", ] [[package]] name = "vault-meta" version = "0.0.0" dependencies = [ - "multiversx-sc-meta", + "multiversx-sc-meta 0.43.4", "vault", ] @@ -3715,15 +4033,15 @@ name = "vec-repeat" version = "0.0.0" dependencies = [ "benchmark-common", - "multiversx-sc", - "multiversx-sc-scenario", + "multiversx-sc 0.43.4", + "multiversx-sc-scenario 0.43.4", ] [[package]] name = "vec-repeat-meta" version = "0.0.0" dependencies = [ - "multiversx-sc-meta", + "multiversx-sc-meta 0.43.4", "vec-repeat", ] @@ -3752,6 +4070,12 @@ dependencies = [ "try-lock", ] +[[package]] +name = "wasi" +version = "0.9.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" + [[package]] name = "wasi" version = "0.11.0+wasi-snapshot-preview1" @@ -3975,6 +4299,20 @@ name = "zeroize" version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2a0956f1ba7c7909bfb66c2e9e4124ab6f6482560f6628b5aaeba39207c9aad9" +dependencies = [ + "zeroize_derive", +] + +[[package]] +name = "zeroize_derive" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.29", +] [[package]] name = "zip" diff --git a/Cargo.toml b/Cargo.toml index ef92a8a7b9..bf79e92d77 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,6 +11,7 @@ members = [ "framework/scenario", "framework/snippets", "framework/wasm-adapter", + "framework/testapi", "sdk/core", "sdk/scenario-format", @@ -175,4 +176,17 @@ members = [ "contracts/feature-tests/rust-testing-framework-tester/meta", "contracts/feature-tests/use-module", "contracts/feature-tests/use-module/meta", + + "contracts/foundry/addercaller", + "contracts/foundry/addercaller/meta", + "contracts/foundry/callee", + "contracts/foundry/callee/meta", + "contracts/foundry/caller", + "contracts/foundry/caller/meta", + "contracts/foundry/foundrylike", + "contracts/foundry/foundrylike/meta", + "contracts/foundry/test_multisig", + "contracts/foundry/test_multisig/meta", + "contracts/foundry/test_testapi", + "contracts/foundry/test_testapi/meta", ] diff --git a/contracts/foundry/addercaller/.gitignore b/contracts/foundry/addercaller/.gitignore new file mode 100644 index 0000000000..2c76bc983e --- /dev/null +++ b/contracts/foundry/addercaller/.gitignore @@ -0,0 +1,7 @@ +# Generated by Cargo +# will have compiled files and executables +/target/ +*/target/ + +# The mxpy output +/output*/ diff --git a/contracts/foundry/addercaller/Cargo.toml b/contracts/foundry/addercaller/Cargo.toml new file mode 100644 index 0000000000..f8a1720718 --- /dev/null +++ b/contracts/foundry/addercaller/Cargo.toml @@ -0,0 +1,18 @@ +[package] +name = "addercaller" +version = "0.0.0" +authors = [ "you",] +edition = "2018" +publish = false + +[lib] +path = "src/addercaller.rs" + +[dev-dependencies] +num-bigint = "0.4.2" + +[dependencies.multiversx-sc] +version = "0.41.1" + +[dev-dependencies.multiversx-sc-scenario] +version = "0.41.1" diff --git a/contracts/foundry/addercaller/meta/Cargo.toml b/contracts/foundry/addercaller/meta/Cargo.toml new file mode 100644 index 0000000000..e58b36087c --- /dev/null +++ b/contracts/foundry/addercaller/meta/Cargo.toml @@ -0,0 +1,14 @@ +[package] +name = "addercaller-meta" +version = "0.0.0" +edition = "2018" +publish = false +authors = [ "you",] + +[dev-dependencies] + +[dependencies.addercaller] +path = ".." + +[dependencies.multiversx-sc-meta] +version = "0.41.1" diff --git a/contracts/foundry/addercaller/meta/src/main.rs b/contracts/foundry/addercaller/meta/src/main.rs new file mode 100644 index 0000000000..6cbc3497bd --- /dev/null +++ b/contracts/foundry/addercaller/meta/src/main.rs @@ -0,0 +1,3 @@ +fn main() { + multiversx_sc_meta::cli_main::(); +} diff --git a/contracts/foundry/addercaller/multiversx.json b/contracts/foundry/addercaller/multiversx.json new file mode 100644 index 0000000000..7365539625 --- /dev/null +++ b/contracts/foundry/addercaller/multiversx.json @@ -0,0 +1,3 @@ +{ + "language": "rust" +} \ No newline at end of file diff --git a/contracts/foundry/addercaller/scenarios/addercaller.scen.json b/contracts/foundry/addercaller/scenarios/addercaller.scen.json new file mode 100644 index 0000000000..79cef24783 --- /dev/null +++ b/contracts/foundry/addercaller/scenarios/addercaller.scen.json @@ -0,0 +1,178 @@ +{ + "name": "addercaller", + "comment": "add then check", + "gasSchedule": "v3", + "steps": [ + { + "step": "setState", + "accounts": { + "address:owner": { + "nonce": "1", + "balance": "100000", + "esdt": { + "str:MYESDT": "200" + } + } + }, + "newAddresses": [ + { + "creatorAddress": "address:owner", + "creatorNonce": "1", + "newAddress": "sc:adder" + }, + { + "creatorAddress": "address:owner", + "creatorNonce": "2", + "newAddress": "sc:addercaller" + } + ] + }, + { + "step": "scDeploy", + "id": "deploy adder", + "tx": { + "from": "address:owner", + "contractCode": "file:../../myadder/output/adder.wasm", + "arguments": [ + "5" + ], + "gasLimit": "5,000,000", + "gasPrice": "0" + }, + "expect": { + "out": [], + "status": "", + "logs": "*", + "gas": "*", + "refund": "*" + } + }, + { + "step": "scDeploy", + "id": "deploy addercaller", + "tx": { + "from": "address:owner", + "contractCode": "file:../output/addercaller.wasm", + "arguments": [ + "sc:adder" + ], + "gasLimit": "5,000,000", + "gasPrice": "0" + }, + "expect": { + "out": [], + "status": "", + "logs": "*", + "gas": "*", + "refund": "*" + } + }, + { + "step": "scCall", + "id": "call adder", + "tx": { + "from": "address:owner", + "to": "sc:adder", + "function": "add", + "value": "1000", + "arguments": [ + "3" + ], + "gasLimit": "5,000,000", + "gasPrice": "0" + }, + "expect": { + "out": ["8"], + "status": "", + "logs": "*", + "gas": "*", + "refund": "*" + } + }, + { + "step": "scCall", + "id": "call addercaller egld", + "tx": { + "from": "address:owner", + "to": "sc:addercaller", + "function": "call_adder", + "value": "1000", + "arguments": [ + "4" + ], + "gasLimit": "15,000,000", + "gasPrice": "0" + }, + "expect": { + "out": ["12", "str:added"], + "status": "", + "logs": "*", + "gas": "*", + "refund": "*" + } + }, + { + "step": "scCall", + "id": "call addercaller esdt", + "tx": { + "from": "address:owner", + "to": "sc:addercaller", + "function": "call_adder_esdt", + "esdtValue": [ + { + "tokenIdentifier": "str:MYESDT", + "value": "30" + } + ], + "arguments": [ + "5" + ], + "gasLimit": "15,000,000", + "gasPrice": "0" + }, + "expect": { + "out": ["17", "str:added-esdt"], + "status": "", + "logs": "*", + "gas": "*", + "refund": "*" + } + }, + { + "step": "checkState", + "accounts": { + "address:owner": { + "nonce": "*", + "balance": "98000", + "storage": {}, + "code": "", + "esdt": { + "str:MYESDT": "170" + } + }, + "sc:adder": { + "nonce": "0", + "balance": "1030", + "storage": { + "str:sum": "17" + }, + "code": "file:../../myadder/output/adder.wasm", + "esdt": { + "str:MYESDT": "20" + } + }, + "sc:addercaller": { + "nonce": "0", + "balance": "970", + "storage": { + "str:dest": "sc:adder" + }, + "code": "file:../output/addercaller.wasm", + "esdt": { + "str:MYESDT": "10" + } + } + } + } + ] +} \ No newline at end of file diff --git a/contracts/foundry/addercaller/scenarios/addercaller_out_of_funds.scen.json b/contracts/foundry/addercaller/scenarios/addercaller_out_of_funds.scen.json new file mode 100644 index 0000000000..503fe897b9 --- /dev/null +++ b/contracts/foundry/addercaller/scenarios/addercaller_out_of_funds.scen.json @@ -0,0 +1,69 @@ +{ + "name": "addercaller", + "comment": "add then check", + "gasSchedule": "v3", + "steps": [ + { + "step": "setState", + "accounts": { + "address:owner": { + "nonce": "1", + "balance": "100000", + "esdt": { + "str:MYESDT": "200" + } + } + }, + "newAddresses": [ + { + "creatorAddress": "address:owner", + "creatorNonce": "1", + "newAddress": "sc:adder" + } + ] + }, + { + "step": "scDeploy", + "id": "deploy adder", + "tx": { + "from": "address:owner", + "contractCode": "file:../../myadder/output/adder.wasm", + "arguments": [ + "5" + ], + "gasLimit": "5,000,000", + "gasPrice": "0" + }, + "expect": { + "out": [], + "status": "", + "logs": "*", + "gas": "*", + "refund": "*" + } + }, + { + "step": "scCall", + "id": "call adder: insufficient EGLD balance", + "tx": { + "from": "address:owner", + "to": "sc:adder", + "function": "add", + "value": "1000000", + "arguments": [ + "3" + ], + "gasLimit": "5,000,000", + "gasPrice": "0" + }, + "expect": { + "out": [], + "status": "7", + "message": "*", + "logs": "*", + "gas": "*", + "refund": "*" + } + } + ] +} \ No newline at end of file diff --git a/contracts/foundry/addercaller/src/addercaller.rs b/contracts/foundry/addercaller/src/addercaller.rs new file mode 100644 index 0000000000..3738ddf592 --- /dev/null +++ b/contracts/foundry/addercaller/src/addercaller.rs @@ -0,0 +1,66 @@ +// A smart contract to test transfer & execute functions +// Initialize the contract with the address of the adder +// The endpoints `call_adder` and `call_adder_esdt` accepts +// tokens in EGLD and ESDT and performs transfer & execute +// to the adder's `add` endpoint. + +#![no_std] + +multiversx_sc::imports!(); + +/// One of the simplest smart contracts possible, +/// it holds a single variable in storage, which anyone can increment. +#[multiversx_sc::contract] +pub trait AdderCaller { + + #[storage_mapper("dest")] + fn dest(&self) -> SingleValueMapper; + + #[init] + fn init(&self, dest: &ManagedAddress) { + self.dest().set(dest); + } + + #[endpoint] + #[payable("EGLD")] + fn call_adder(&self, value: BigUint) -> ManagedBuffer { + let mut arg_buffer = ManagedArgBuffer::new(); + arg_buffer.push_arg(value); + + let result = self.send_raw().direct_egld_execute( + &self.dest().get(), + &BigUint::from(30u32), + 5000000, + &ManagedBuffer::from(b"add"), + &arg_buffer, + ); + + match result { + Result::Err(e) => sc_panic!(e), + Result::Ok(_) => ManagedBuffer::from("added") + } + } + + #[endpoint] + #[payable("MYESDT")] + fn call_adder_esdt(&self, value: BigUint) -> ManagedBuffer { + let mut arg_buffer = ManagedArgBuffer::new(); + arg_buffer.push_arg(value); + + let result = self.send_raw().transfer_esdt_execute( + &self.dest().get(), + &TokenIdentifier::from_esdt_bytes(b"MYESDT"), + &BigUint::from(20u32), + 5000000, + &ManagedBuffer::from(b"add"), + &arg_buffer, + ); + + match result { + Result::Err(e) => sc_panic!(e), + Result::Ok(_) => ManagedBuffer::from("added-esdt") + } + } +} + +// \ No newline at end of file diff --git a/contracts/foundry/addercaller/wasm/Cargo.lock b/contracts/foundry/addercaller/wasm/Cargo.lock new file mode 100644 index 0000000000..dbef86f558 --- /dev/null +++ b/contracts/foundry/addercaller/wasm/Cargo.lock @@ -0,0 +1,272 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "addercaller" +version = "0.0.0" +dependencies = [ + "multiversx-sc", +] + +[[package]] +name = "addercaller-wasm" +version = "0.0.0" +dependencies = [ + "addercaller", + "multiversx-sc-wasm-adapter", +] + +[[package]] +name = "ahash" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f" +dependencies = [ + "cfg-if 1.0.0", + "once_cell", + "version_check", +] + +[[package]] +name = "arrayvec" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" + +[[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 = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" + +[[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 = "libc" +version = "0.2.145" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc86cde3ff845662b8f4ef6cb50ea0e20c524eb3d29ae048287e06a1b3fa6a81" + +[[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.41.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "842795458f7aa56ca04191993628980987baa8558357f708a93514c1b2e9948a" +dependencies = [ + "bitflags", + "hashbrown", + "hex-literal", + "multiversx-sc-codec", + "multiversx-sc-derive", + "num-traits", +] + +[[package]] +name = "multiversx-sc-codec" +version = "0.17.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7638cb46a0e99c636fd55443ac534ff0a5fad0bd772e1037fbac9a75e04c3c9" +dependencies = [ + "arrayvec", + "multiversx-sc-codec-derive", + "wee_alloc", +] + +[[package]] +name = "multiversx-sc-codec-derive" +version = "0.17.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e976002d51367f16140929c10ee695f95dd8d34c150a45db60d3fcd1328a267a" +dependencies = [ + "hex", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "multiversx-sc-derive" +version = "0.41.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "99390a0cc0406e86993772bdf16c6be4e990117f939df94a6a6e2f89d18c4983" +dependencies = [ + "hex", + "proc-macro2", + "quote", + "radix_trie", + "syn", +] + +[[package]] +name = "multiversx-sc-wasm-adapter" +version = "0.41.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70852439508cfbbc1d92f11210f76c8c1ca2a8869fe8cbd316c2a82518c58249" +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.17.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" + +[[package]] +name = "proc-macro2" +version = "1.0.57" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4ec6d5fe0b140acb27c9a0444118cf55bfbb4e0b259739429abb4521dd67c16" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f4f29d145265ec1c483c7c654450edde0bfe043d3938d6972630663356d9500" +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.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4" + +[[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/foundry/addercaller/wasm/Cargo.toml b/contracts/foundry/addercaller/wasm/Cargo.toml new file mode 100644 index 0000000000..7ff3a911a4 --- /dev/null +++ b/contracts/foundry/addercaller/wasm/Cargo.toml @@ -0,0 +1,27 @@ +[package] +name = "addercaller-wasm" +version = "0.0.0" +edition = "2018" +publish = false +authors = [ "you",] + +[lib] +crate-type = [ "cdylib",] + +[workspace] +members = [ ".",] + +[dev-dependencies] + +[profile.release] +codegen-units = 1 +opt-level = "z" +lto = true +debug = false +panic = "abort" + +[dependencies.addercaller] +path = ".." + +[dependencies.multiversx-sc-wasm-adapter] +version = "0.41.1" diff --git a/contracts/foundry/addercaller/wasm/src/lib.rs b/contracts/foundry/addercaller/wasm/src/lib.rs new file mode 100644 index 0000000000..28c0e7e012 --- /dev/null +++ b/contracts/foundry/addercaller/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! { + addercaller + ( + call_adder + call_adder_esdt + ) +} + +multiversx_sc_wasm_adapter::empty_callback! {} diff --git a/contracts/foundry/callee/.gitignore b/contracts/foundry/callee/.gitignore new file mode 100644 index 0000000000..2c76bc983e --- /dev/null +++ b/contracts/foundry/callee/.gitignore @@ -0,0 +1,7 @@ +# Generated by Cargo +# will have compiled files and executables +/target/ +*/target/ + +# The mxpy output +/output*/ diff --git a/contracts/foundry/callee/Cargo.toml b/contracts/foundry/callee/Cargo.toml new file mode 100644 index 0000000000..e95f50054e --- /dev/null +++ b/contracts/foundry/callee/Cargo.toml @@ -0,0 +1,18 @@ +[package] +name = "callee" +version = "0.0.0" +authors = [ "you",] +edition = "2018" +publish = false + +[lib] +path = "src/callee.rs" + +[dev-dependencies] +num-bigint = "0.4.2" + +[dependencies.multiversx-sc] +version = "0.41.2" + +[dev-dependencies.multiversx-sc-scenario] +version = "0.41.2" diff --git a/contracts/foundry/callee/meta/Cargo.toml b/contracts/foundry/callee/meta/Cargo.toml new file mode 100644 index 0000000000..dcca642d5a --- /dev/null +++ b/contracts/foundry/callee/meta/Cargo.toml @@ -0,0 +1,14 @@ +[package] +name = "callee-meta" +version = "0.0.0" +edition = "2018" +publish = false +authors = [ "you",] + +[dev-dependencies] + +[dependencies.callee] +path = ".." + +[dependencies.multiversx-sc-meta] +version = "0.41.2" diff --git a/contracts/foundry/callee/meta/src/main.rs b/contracts/foundry/callee/meta/src/main.rs new file mode 100644 index 0000000000..29f7b204ed --- /dev/null +++ b/contracts/foundry/callee/meta/src/main.rs @@ -0,0 +1,3 @@ +fn main() { + multiversx_sc_meta::cli_main::(); +} diff --git a/contracts/foundry/callee/multiversx.json b/contracts/foundry/callee/multiversx.json new file mode 100644 index 0000000000..7365539625 --- /dev/null +++ b/contracts/foundry/callee/multiversx.json @@ -0,0 +1,3 @@ +{ + "language": "rust" +} \ No newline at end of file diff --git a/contracts/foundry/callee/src/callee.rs b/contracts/foundry/callee/src/callee.rs new file mode 100644 index 0000000000..5a93a14c0c --- /dev/null +++ b/contracts/foundry/callee/src/callee.rs @@ -0,0 +1,22 @@ +#![no_std] + +multiversx_sc::imports!(); + +#[multiversx_sc::contract] +pub trait CalleeContract { + #[init] + fn init(&self) {} + + #[endpoint] + #[payable("EGLD")] + fn fail_if_neg(&self, value: i64) -> ManagedBuffer { + + require!( value >= 0 , "negative" ); + + if value == 0 { + ManagedBuffer::from("zero") + } else { + ManagedBuffer::from("positive") + } + } +} diff --git a/contracts/foundry/callee/wasm/Cargo.lock b/contracts/foundry/callee/wasm/Cargo.lock new file mode 100644 index 0000000000..8686ff683f --- /dev/null +++ b/contracts/foundry/callee/wasm/Cargo.lock @@ -0,0 +1,219 @@ +# 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.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" + +[[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 = "callee" +version = "0.0.0" +dependencies = [ + "multiversx-sc", +] + +[[package]] +name = "callee-wasm" +version = "0.0.0" +dependencies = [ + "callee", + "multiversx-sc-wasm-adapter", +] + +[[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 = "multiversx-sc" +version = "0.41.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "752eed690b41c060e8766e8f6078a8e3585a01387278c652cf88599255cbc5af" +dependencies = [ + "bitflags", + "hashbrown", + "hex-literal", + "multiversx-sc-codec", + "multiversx-sc-derive", + "num-traits", +] + +[[package]] +name = "multiversx-sc-codec" +version = "0.17.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "71d70ea458247d263b7e9fdfb207530b6a530546247139c162450e515c013a18" +dependencies = [ + "arrayvec", + "multiversx-sc-codec-derive", +] + +[[package]] +name = "multiversx-sc-codec-derive" +version = "0.17.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ad6920f80fda67fc60fd51aaa9f83ec7e069470f60a068c81205f9da5d05a30" +dependencies = [ + "hex", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "multiversx-sc-derive" +version = "0.41.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "674eb1e50b8bc71898d0b476210856a7bc2a4f21758987413d1ec7837d5dd16c" +dependencies = [ + "hex", + "proc-macro2", + "quote", + "radix_trie", + "syn", +] + +[[package]] +name = "multiversx-sc-wasm-adapter" +version = "0.41.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92854d81a7cd14c7ec2389cdb4bf555b7b1bbad84b8f8f4deb5a7c0b6b2c71cc" +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/foundry/callee/wasm/Cargo.toml b/contracts/foundry/callee/wasm/Cargo.toml new file mode 100644 index 0000000000..c8c7c7e072 --- /dev/null +++ b/contracts/foundry/callee/wasm/Cargo.toml @@ -0,0 +1,27 @@ +[package] +name = "callee-wasm" +version = "0.0.0" +edition = "2018" +publish = false +authors = [ "you",] + +[lib] +crate-type = [ "cdylib",] + +[workspace] +members = [ ".",] + +[dev-dependencies] + +[profile.release] +codegen-units = 1 +opt-level = "z" +lto = true +debug = false +panic = "abort" + +[dependencies.callee] +path = ".." + +[dependencies.multiversx-sc-wasm-adapter] +version = "0.41.2" diff --git a/contracts/foundry/callee/wasm/src/lib.rs b/contracts/foundry/callee/wasm/src/lib.rs new file mode 100644 index 0000000000..37408c614d --- /dev/null +++ b/contracts/foundry/callee/wasm/src/lib.rs @@ -0,0 +1,25 @@ +// Code generated by the multiversx-sc multi-contract system. DO NOT EDIT. + +//////////////////////////////////////////////////// +////////////////// AUTO-GENERATED ////////////////// +//////////////////////////////////////////////////// + +// Init: 1 +// Endpoints: 1 +// Async Callback (empty): 1 +// Total number of exported functions: 3 + +#![no_std] +#![feature(lang_items)] + +multiversx_sc_wasm_adapter::allocator!(); +multiversx_sc_wasm_adapter::panic_handler!(); + +multiversx_sc_wasm_adapter::endpoints! { + callee + ( + fail_if_neg + ) +} + +multiversx_sc_wasm_adapter::empty_callback! {} diff --git a/contracts/foundry/caller/.gitignore b/contracts/foundry/caller/.gitignore new file mode 100644 index 0000000000..2c76bc983e --- /dev/null +++ b/contracts/foundry/caller/.gitignore @@ -0,0 +1,7 @@ +# Generated by Cargo +# will have compiled files and executables +/target/ +*/target/ + +# The mxpy output +/output*/ diff --git a/contracts/foundry/caller/Cargo.toml b/contracts/foundry/caller/Cargo.toml new file mode 100644 index 0000000000..e4f108cbd1 --- /dev/null +++ b/contracts/foundry/caller/Cargo.toml @@ -0,0 +1,18 @@ +[package] +name = "caller" +version = "0.0.0" +authors = [ "you",] +edition = "2018" +publish = false + +[lib] +path = "src/caller.rs" + +[dev-dependencies] +num-bigint = "0.4.2" + +[dependencies.multiversx-sc] +version = "0.41.2" + +[dev-dependencies.multiversx-sc-scenario] +version = "0.41.2" diff --git a/contracts/foundry/caller/meta/Cargo.toml b/contracts/foundry/caller/meta/Cargo.toml new file mode 100644 index 0000000000..f6535a1fc9 --- /dev/null +++ b/contracts/foundry/caller/meta/Cargo.toml @@ -0,0 +1,14 @@ +[package] +name = "caller-meta" +version = "0.0.0" +edition = "2018" +publish = false +authors = [ "you",] + +[dev-dependencies] + +[dependencies.caller] +path = ".." + +[dependencies.multiversx-sc-meta] +version = "0.41.2" diff --git a/contracts/foundry/caller/meta/src/main.rs b/contracts/foundry/caller/meta/src/main.rs new file mode 100644 index 0000000000..0e1f1c0a89 --- /dev/null +++ b/contracts/foundry/caller/meta/src/main.rs @@ -0,0 +1,3 @@ +fn main() { + multiversx_sc_meta::cli_main::(); +} diff --git a/contracts/foundry/caller/multiversx.json b/contracts/foundry/caller/multiversx.json new file mode 100644 index 0000000000..7365539625 --- /dev/null +++ b/contracts/foundry/caller/multiversx.json @@ -0,0 +1,3 @@ +{ + "language": "rust" +} \ No newline at end of file diff --git a/contracts/foundry/caller/scenarios/caller.scen.json b/contracts/foundry/caller/scenarios/caller.scen.json new file mode 100644 index 0000000000..a77f5616fd --- /dev/null +++ b/contracts/foundry/caller/scenarios/caller.scen.json @@ -0,0 +1,185 @@ +{ + "name": "caller", + "steps": [ + { + "step": "externalSteps", + "path": "steps/init.steps.json" + }, + { + "step": "scCall", + "id": "positive", + "comment": "send a positive number with 1k EGLD to caller", + "tx": { + "from": "address:owner", + "to": "sc:caller", + "function": "call_other", + "value": "1000", + "arguments": [ + "sc:callee", + "str:fail_if_neg", + "3", + "500" + ], + "gasLimit": "5,000,000", + "gasPrice": "0" + }, + "expect": { + "out": ["str:positive", "str:done"], + "status": "" + } + }, + { + "step": "externalSteps", + "path": "steps/check_1.steps.json" + }, + { + "step": "scCall", + "id": "negative: error message", + "comment": "owner -> caller -> callee wrong func name", + "tx": { + "from": "address:owner", + "to": "sc:caller", + "function": "call_other", + "value": "500", + "arguments": [ + "sc:callee", + "str:fail_if_negative", + "-1", + "250" + ], + "gasLimit": "5,000,000", + "gasPrice": "0" + }, + "expect": { + "status": "10", + "message": "str:invalid function (not found)", + "out": [] + } + }, + { + "step": "externalSteps", + "path": "steps/check_1.steps.json" + }, + { + "step": "scCall", + "id": "negative: error message", + "comment": "owner -> caller -> callee. callee fails and everything is reverted", + "tx": { + "from": "address:owner", + "to": "sc:caller", + "function": "call_other", + "value": "500", + "arguments": [ + "sc:callee", + "str:fail_if_neg", + "-1", + "250" + ], + "gasLimit": "5,000,000", + "gasPrice": "0" + }, + "expect": { + "status": "10", + "message": "str:error signalled by smartcontract", + "out": [] + } + }, + { + "step": "externalSteps", + "path": "steps/check_1.steps.json" + }, + { + "step": "scCall", + "id": "positive with 0 EGLD", + "comment": "send a positive number with 0 EGLD to caller", + "tx": { + "from": "address:owner", + "to": "sc:caller", + "function": "call_other", + "value": "0", + "arguments": [ + "sc:callee", + "str:fail_if_neg", + "3", + "0" + ], + "gasLimit": "5,000,000", + "gasPrice": "0" + }, + "expect": { + "out": ["str:positive", "str:done"], + "status": "" + } + }, + { + "step": "checkState", + "accounts": { + "address:owner": { + "nonce": "*", + "balance": "99000", + "storage": {}, + "code": "" + }, + "sc:caller": { + "nonce": "0", + "balance": "500", + "storage": {}, + "code": "file:../output/caller.wasm" + }, + "sc:callee": { + "nonce": "0", + "balance": "500", + "storage": {}, + "code": "file:../../callee/output/callee.wasm" + } + } + }, + { + "step": "scCall", + "id": "positive with 1 EGLD", + "comment": "send a positive number with an odd number of EGLD to caller", + "tx": { + "from": "address:owner", + "to": "sc:caller", + "function": "call_other", + "value": "1", + "arguments": [ + "sc:callee", + "str:fail_if_neg", + "3", + "0" + ], + "gasLimit": "5,000,000", + "gasPrice": "0" + }, + "expect": { + "out": ["str:positive", "str:done"], + "status": "" + } + }, + { + "step": "checkState", + "accounts": { + "address:owner": { + "nonce": "*", + "balance": "98999", + "storage": {}, + "code": "" + }, + "sc:caller": { + "nonce": "0", + "balance": "501", + "storage": {}, + "code": "file:../output/caller.wasm" + }, + "sc:callee": { + "nonce": "0", + "balance": "500", + "storage": {}, + "code": "file:../../callee/output/callee.wasm" + } + } + } + + ] +} \ No newline at end of file diff --git a/contracts/foundry/caller/scenarios/errors.scen.json b/contracts/foundry/caller/scenarios/errors.scen.json new file mode 100644 index 0000000000..097787b281 --- /dev/null +++ b/contracts/foundry/caller/scenarios/errors.scen.json @@ -0,0 +1,96 @@ +{ + "name": "caller", + "steps": [ + { + "step": "externalSteps", + "path": "steps/init.steps.json" + }, + { + "step": "externalSteps", + "path": "steps/check_init.steps.json" + }, + { + "step": "scCall", + "id": "out of funds", + "tx": { + "from": "address:owner", + "to": "sc:caller", + "function": "call_other", + "value": "1000000000", + "arguments": [ + "sc:callee", + "str:fail_if_neg", + "3", + "0" + ], + "gasLimit": "5,000,000", + "gasPrice": "0" + }, + "expect": { + "out": [], + "status": "7", + "message": "" + } + }, + { + "step": "externalSteps", + "path": "steps/check_init.steps.json" + }, + { + "step": "scCall", + "id": "out of funds - indirect", + "comment": "SC attempts to send too many tokens", + "tx": { + "from": "address:owner", + "to": "sc:caller", + "function": "call_other", + "value": "1000", + "arguments": [ + "sc:callee", + "str:fail_if_neg", + "3", + "2000" + ], + "gasLimit": "5,000,000", + "gasPrice": "0" + }, + "expect": { + "out": [], + "status": "10", + "message": "str:failed transfer (insufficient funds)" + } + }, + { + "step": "externalSteps", + "path": "steps/check_init.steps.json" + }, + { + "step": "scCall", + "id": "nonexistent account", + "comment": "indirect call to nonexistent account", + "tx": { + "from": "address:owner", + "to": "sc:caller", + "function": "call_other", + "value": "1000", + "arguments": [ + "sc:invalidaddress", + "str:fail_if_neg", + "3", + "10" + ], + "gasLimit": "5,000,000", + "gasPrice": "0" + }, + "expect": { + "out": [], + "status": "10", + "message": "*" + } + }, + { + "step": "externalSteps", + "path": "steps/check_init.steps.json" + } + ] +} \ No newline at end of file diff --git a/contracts/foundry/caller/scenarios/exec_on_dest_ctx.scen.json b/contracts/foundry/caller/scenarios/exec_on_dest_ctx.scen.json new file mode 100644 index 0000000000..2a1aee42fa --- /dev/null +++ b/contracts/foundry/caller/scenarios/exec_on_dest_ctx.scen.json @@ -0,0 +1,185 @@ +{ + "name": "caller", + "steps": [ + { + "step": "externalSteps", + "path": "steps/init.steps.json" + }, + { + "step": "scCall", + "id": "positive", + "comment": "send a positive number with 1k EGLD to caller", + "tx": { + "from": "address:owner", + "to": "sc:caller", + "function": "call_other_exec_on_dest_ctx", + "value": "1000", + "arguments": [ + "sc:callee", + "str:fail_if_neg", + "3", + "500" + ], + "gasLimit": "5,000,000", + "gasPrice": "0" + }, + "expect": { + "out": ["str:positive", "str:done"], + "status": "" + } + }, + { + "step": "externalSteps", + "path": "steps/check_1.steps.json" + }, + { + "step": "scCall", + "id": "negative: error message", + "comment": "owner -> caller -> callee wrong func name", + "tx": { + "from": "address:owner", + "to": "sc:caller", + "function": "call_other", + "value": "500", + "arguments": [ + "sc:callee", + "str:fail_if_negative", + "-1", + "250" + ], + "gasLimit": "5,000,000", + "gasPrice": "0" + }, + "expect": { + "status": "10", + "message": "str:invalid function (not found)", + "out": [] + } + }, + { + "step": "externalSteps", + "path": "steps/check_1.steps.json" + }, + { + "step": "scCall", + "id": "negative: error message", + "comment": "owner -> caller -> callee. callee fails and everything is reverted", + "tx": { + "from": "address:owner", + "to": "sc:caller", + "function": "call_other", + "value": "500", + "arguments": [ + "sc:callee", + "str:fail_if_neg", + "-1", + "250" + ], + "gasLimit": "5,000,000", + "gasPrice": "0" + }, + "expect": { + "status": "10", + "message": "str:error signalled by smartcontract", + "out": [] + } + }, + { + "step": "externalSteps", + "path": "steps/check_1.steps.json" + }, + { + "step": "scCall", + "id": "positive with 0 EGLD", + "comment": "send a positive number with 0 EGLD to caller", + "tx": { + "from": "address:owner", + "to": "sc:caller", + "function": "call_other", + "value": "0", + "arguments": [ + "sc:callee", + "str:fail_if_neg", + "3", + "0" + ], + "gasLimit": "5,000,000", + "gasPrice": "0" + }, + "expect": { + "out": ["str:positive", "str:done"], + "status": "" + } + }, + { + "step": "checkState", + "accounts": { + "address:owner": { + "nonce": "*", + "balance": "99000", + "storage": {}, + "code": "" + }, + "sc:caller": { + "nonce": "0", + "balance": "500", + "storage": {}, + "code": "file:../output/caller.wasm" + }, + "sc:callee": { + "nonce": "0", + "balance": "500", + "storage": {}, + "code": "file:../../callee/output/callee.wasm" + } + } + }, + { + "step": "scCall", + "id": "positive with 1 EGLD", + "comment": "send a positive number with an odd number of EGLD to caller", + "tx": { + "from": "address:owner", + "to": "sc:caller", + "function": "call_other", + "value": "1", + "arguments": [ + "sc:callee", + "str:fail_if_neg", + "3", + "0" + ], + "gasLimit": "5,000,000", + "gasPrice": "0" + }, + "expect": { + "out": ["str:positive", "str:done"], + "status": "" + } + }, + { + "step": "checkState", + "accounts": { + "address:owner": { + "nonce": "*", + "balance": "98999", + "storage": {}, + "code": "" + }, + "sc:caller": { + "nonce": "0", + "balance": "501", + "storage": {}, + "code": "file:../output/caller.wasm" + }, + "sc:callee": { + "nonce": "0", + "balance": "500", + "storage": {}, + "code": "file:../../callee/output/callee.wasm" + } + } + } + + ] +} \ No newline at end of file diff --git a/contracts/foundry/caller/scenarios/steps/check_1.steps.json b/contracts/foundry/caller/scenarios/steps/check_1.steps.json new file mode 100644 index 0000000000..7ed1ee3de4 --- /dev/null +++ b/contracts/foundry/caller/scenarios/steps/check_1.steps.json @@ -0,0 +1,29 @@ +{ + "name": "check after 1st call", + "steps": [ + { + "step": "checkState", + "comment": "caller should keep half of the EGLD", + "accounts": { + "address:owner": { + "nonce": "*", + "balance": "99000", + "storage": {}, + "code": "" + }, + "sc:caller": { + "nonce": "0", + "balance": "500", + "storage": {}, + "code": "file:../../output/caller.wasm" + }, + "sc:callee": { + "nonce": "0", + "balance": "500", + "storage": {}, + "code": "file:../../../callee/output/callee.wasm" + } + } + } + ] +} \ No newline at end of file diff --git a/contracts/foundry/caller/scenarios/steps/check_init.steps.json b/contracts/foundry/caller/scenarios/steps/check_init.steps.json new file mode 100644 index 0000000000..35522c8580 --- /dev/null +++ b/contracts/foundry/caller/scenarios/steps/check_init.steps.json @@ -0,0 +1,29 @@ +{ + "name": "check after 1st call", + "steps": [ + { + "step": "checkState", + "comment": "caller should keep half of the EGLD", + "accounts": { + "address:owner": { + "nonce": "*", + "balance": "100000", + "storage": {}, + "code": "" + }, + "sc:caller": { + "nonce": "0", + "balance": "0", + "storage": {}, + "code": "file:../../output/caller.wasm" + }, + "sc:callee": { + "nonce": "0", + "balance": "0", + "storage": {}, + "code": "file:../../../callee/output/callee.wasm" + } + } + } + ] +} \ No newline at end of file diff --git a/contracts/foundry/caller/scenarios/steps/init.steps.json b/contracts/foundry/caller/scenarios/steps/init.steps.json new file mode 100644 index 0000000000..9a9639ede9 --- /dev/null +++ b/contracts/foundry/caller/scenarios/steps/init.steps.json @@ -0,0 +1,57 @@ +{ + "name": "init and deploy", + "comment": "initialize the owner account and deploy caller and callee", + "steps": [ + { + "step": "setState", + "accounts": { + "address:owner": { + "nonce": "1", + "balance": "100000" + } + }, + "newAddresses": [ + { + "creatorAddress": "address:owner", + "creatorNonce": "1", + "newAddress": "sc:callee" + }, + { + "creatorAddress": "address:owner", + "creatorNonce": "2", + "newAddress": "sc:caller" + } + ] + }, + { + "step": "scDeploy", + "id": "deploy callee", + "tx": { + "from": "address:owner", + "contractCode": "file:../../../callee/output/callee.wasm", + "arguments": [], + "gasLimit": "5,000,000", + "gasPrice": "0" + }, + "expect": { + "out": [], + "status": "" + } + }, + { + "step": "scDeploy", + "id": "deploy caller", + "tx": { + "from": "address:owner", + "contractCode": "file:../../output/caller.wasm", + "arguments": [], + "gasLimit": "5,000,000", + "gasPrice": "0" + }, + "expect": { + "out": [], + "status": "" + } + } + ] +} \ No newline at end of file diff --git a/contracts/foundry/caller/src/caller.rs b/contracts/foundry/caller/src/caller.rs new file mode 100644 index 0000000000..16b8bac567 --- /dev/null +++ b/contracts/foundry/caller/src/caller.rs @@ -0,0 +1,53 @@ +#![no_std] + +multiversx_sc::imports!(); + +#[multiversx_sc::contract] +pub trait CallerContract { + + + #[init] + fn init(&self) { + } + + #[endpoint] + #[payable("EGLD")] + fn call_other(&self, dest: ManagedAddress, func: ManagedBuffer, value: i64, to_send: BigUint) -> ManagedBuffer { + + let mut arg_buffer = ManagedArgBuffer::new(); + arg_buffer.push_arg(value); + + let result = self.send_raw().direct_egld_execute( + &dest, + &to_send, + 5000000, + &func, + &arg_buffer, + ); + + match result { + Result::Err(_) => ManagedBuffer::from("failed"), + Result::Ok(_) => ManagedBuffer::from("done") + } + } + + #[endpoint] + #[payable("EGLD")] + fn call_other_exec_on_dest_ctx(&self, dest: ManagedAddress, func: ManagedBuffer, value: i64, to_send: BigUint) -> ManagedBuffer { + + let mut arg_buffer = ManagedArgBuffer::new(); + arg_buffer.push_arg(value); + + let result = self.send_raw().execute_on_dest_context_raw( + 5000000, + &dest, + &to_send, + &func, + &arg_buffer, + ); + + require!(result.len() == 1, "ExecuteOnDestContext result data is empty"); + + ManagedBuffer::from("done") + } +} diff --git a/contracts/foundry/caller/wasm/Cargo.lock b/contracts/foundry/caller/wasm/Cargo.lock new file mode 100644 index 0000000000..774a00da19 --- /dev/null +++ b/contracts/foundry/caller/wasm/Cargo.lock @@ -0,0 +1,219 @@ +# 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.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" + +[[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 = "caller" +version = "0.0.0" +dependencies = [ + "multiversx-sc", +] + +[[package]] +name = "caller-wasm" +version = "0.0.0" +dependencies = [ + "caller", + "multiversx-sc-wasm-adapter", +] + +[[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 = "multiversx-sc" +version = "0.41.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "752eed690b41c060e8766e8f6078a8e3585a01387278c652cf88599255cbc5af" +dependencies = [ + "bitflags", + "hashbrown", + "hex-literal", + "multiversx-sc-codec", + "multiversx-sc-derive", + "num-traits", +] + +[[package]] +name = "multiversx-sc-codec" +version = "0.17.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "71d70ea458247d263b7e9fdfb207530b6a530546247139c162450e515c013a18" +dependencies = [ + "arrayvec", + "multiversx-sc-codec-derive", +] + +[[package]] +name = "multiversx-sc-codec-derive" +version = "0.17.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ad6920f80fda67fc60fd51aaa9f83ec7e069470f60a068c81205f9da5d05a30" +dependencies = [ + "hex", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "multiversx-sc-derive" +version = "0.41.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "674eb1e50b8bc71898d0b476210856a7bc2a4f21758987413d1ec7837d5dd16c" +dependencies = [ + "hex", + "proc-macro2", + "quote", + "radix_trie", + "syn", +] + +[[package]] +name = "multiversx-sc-wasm-adapter" +version = "0.41.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92854d81a7cd14c7ec2389cdb4bf555b7b1bbad84b8f8f4deb5a7c0b6b2c71cc" +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/foundry/caller/wasm/Cargo.toml b/contracts/foundry/caller/wasm/Cargo.toml new file mode 100644 index 0000000000..72b5ca9c06 --- /dev/null +++ b/contracts/foundry/caller/wasm/Cargo.toml @@ -0,0 +1,27 @@ +[package] +name = "caller-wasm" +version = "0.0.0" +edition = "2018" +publish = false +authors = [ "you",] + +[lib] +crate-type = [ "cdylib",] + +[workspace] +members = [ ".",] + +[dev-dependencies] + +[profile.release] +codegen-units = 1 +opt-level = "z" +lto = true +debug = false +panic = "abort" + +[dependencies.caller] +path = ".." + +[dependencies.multiversx-sc-wasm-adapter] +version = "0.41.2" diff --git a/contracts/foundry/caller/wasm/src/lib.rs b/contracts/foundry/caller/wasm/src/lib.rs new file mode 100644 index 0000000000..d6bf842ddd --- /dev/null +++ b/contracts/foundry/caller/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! { + caller + ( + call_other + call_other_exec_on_dest_ctx + ) +} + +multiversx_sc_wasm_adapter::empty_callback! {} diff --git a/contracts/foundry/foundrylike/.gitignore b/contracts/foundry/foundrylike/.gitignore new file mode 100644 index 0000000000..2c76bc983e --- /dev/null +++ b/contracts/foundry/foundrylike/.gitignore @@ -0,0 +1,7 @@ +# Generated by Cargo +# will have compiled files and executables +/target/ +*/target/ + +# The mxpy output +/output*/ diff --git a/contracts/foundry/foundrylike/Cargo.toml b/contracts/foundry/foundrylike/Cargo.toml new file mode 100644 index 0000000000..85f3828560 --- /dev/null +++ b/contracts/foundry/foundrylike/Cargo.toml @@ -0,0 +1,23 @@ +[package] +name = "test-adder" +version = "0.0.0" +authors = [ "you",] +edition = "2018" +publish = false + +[lib] +path = "src/test_adder.rs" + +[dev-dependencies] +num-bigint = "0.4.2" + +[dependencies.multiversx-sc] +version = "0.43.4" +path = "../../../framework/base" + +[dev-dependencies.multiversx-sc-scenario] +version = "0.43.4" +path = "../../../framework/scenario" + +[dependencies] +testapi = { version = "0.1.0", path = "../../../framework/testapi" } diff --git a/contracts/foundry/foundrylike/foundry.json b/contracts/foundry/foundrylike/foundry.json new file mode 100644 index 0000000000..00b7434da3 --- /dev/null +++ b/contracts/foundry/foundrylike/foundry.json @@ -0,0 +1,5 @@ +{ + "contract_paths": [ + "../../../deps/mx-sdk-rs/contracts/examples/adder/output/adder.wasm" + ] +} \ No newline at end of file diff --git a/contracts/foundry/foundrylike/meta/Cargo.toml b/contracts/foundry/foundrylike/meta/Cargo.toml new file mode 100644 index 0000000000..289f12ff38 --- /dev/null +++ b/contracts/foundry/foundrylike/meta/Cargo.toml @@ -0,0 +1,15 @@ +[package] +name = "test-adder-meta" +version = "0.0.0" +edition = "2018" +publish = false +authors = [ "you",] + +[dev-dependencies] + +[dependencies.test-adder] +path = ".." + +[dependencies.multiversx-sc-meta] +version = "0.43.4" +path = "../../../../framework/meta" diff --git a/contracts/foundry/foundrylike/meta/src/main.rs b/contracts/foundry/foundrylike/meta/src/main.rs new file mode 100644 index 0000000000..d99af9305d --- /dev/null +++ b/contracts/foundry/foundrylike/meta/src/main.rs @@ -0,0 +1,3 @@ +fn main() { + multiversx_sc_meta::cli_main::(); +} diff --git a/contracts/foundry/foundrylike/multiversx.json b/contracts/foundry/foundrylike/multiversx.json new file mode 100644 index 0000000000..7365539625 --- /dev/null +++ b/contracts/foundry/foundrylike/multiversx.json @@ -0,0 +1,3 @@ +{ + "language": "rust" +} \ No newline at end of file diff --git a/contracts/foundry/foundrylike/scenarios/test-adder.scen.json b/contracts/foundry/foundrylike/scenarios/test-adder.scen.json new file mode 100644 index 0000000000..3219956f1c --- /dev/null +++ b/contracts/foundry/foundrylike/scenarios/test-adder.scen.json @@ -0,0 +1,71 @@ +{ + "name": "test-adder", + "comment": "run foundry-like test for Adder", + "gasSchedule": "v3", + "steps": [ + { + "step": "setState", + "accounts": { + "address:k": { + "nonce": "1", + "balance": "100000" + } + }, + "newAddresses": [ + { + "creatorAddress": "address:k", + "creatorNonce": "1", + "newAddress": "sc:k-test" + } + ] + }, + { + "step": "fetchWasmSource", + "wasmPath": "file:../../../../deps/mx-sdk-rs/contracts/examples/adder/output/adder.wasm" + }, + { + "step": "scDeploy", + "id": "deploy test", + "comment": "deploy the test contract", + "tx": { + "from": "address:k", + "contractCode": "file:../output/test-adder.wasm", + "arguments": [ + "file:../../../../deps/mx-sdk-rs/contracts/examples/adder/output/adder.wasm" + ], + "gasLimit": "5,000,000,000,000", + "gasPrice": "0" + }, + "expect": { + "out": [], + "status": "", + "logs": "*", + "gas": "*", + "refund": "*" + } + }, + { + "step": "scCall", + "id": "call test", + "comment": "call the parametric test endpoint with a concrete value", + "tx": { + "from": "address:k", + "to": "sc:k-test", + "function": "test_call_add", + "value": "0", + "arguments": [ + "3" + ], + "gasLimit": "5,000,000", + "gasPrice": "0" + }, + "expect": { + "out": [], + "status": "", + "logs": "*", + "gas": "*", + "refund": "*" + } + } + ] +} \ No newline at end of file diff --git a/contracts/foundry/foundrylike/src/test_adder.rs b/contracts/foundry/foundrylike/src/test_adder.rs new file mode 100644 index 0000000000..b9e136ea69 --- /dev/null +++ b/contracts/foundry/foundrylike/src/test_adder.rs @@ -0,0 +1,113 @@ +#![no_std] + +use testapi; + +multiversx_sc::imports!(); + +static INIT_SUM : u32 = 5u32; +#[multiversx_sc::contract] +pub trait TestAdder { + + #[storage_mapper("ownerAddress")] + fn owner_address(&self) -> SingleValueMapper; + + #[storage_mapper("adderAddress")] + fn adder_address(&self) -> SingleValueMapper; + + /// Create the owner account and deploy adder + #[init] + fn init(&self, code_path: ManagedBuffer) { + + // create the owner account + let owner = ManagedAddress::from(b"owner___________________________"); + self.owner_address().set(&owner); + + testapi::create_account(&owner, 1, &BigUint::from(0u64)); + + // register an address for the contract to be deployed + let adder = ManagedAddress::from(b"adder___________________________"); + testapi::register_new_address(&owner, 1, &adder, ); + + // deploy the adder contract + let mut adder_init_args = ManagedArgBuffer::new(); + adder_init_args.push_arg(INIT_SUM); // initial sum + + // deploy a contract from `owner` + let adder = testapi::deploy_contract( + &owner, + 5000000000000, + &BigUint::zero(), + &code_path, + &adder_init_args, + ); + + // save the deployed contract's address + self.adder_address().set(&adder); + + // check the initial sum value + let sum_as_bytes = testapi::get_storage(&adder, &ManagedBuffer::from(b"sum")); + let sum = BigUint::from(sum_as_bytes); + testapi::assert( sum == INIT_SUM ); + + } + + // Make a call from 'owner' to 'adder' and check the sum value + #[endpoint(test_call_add)] + fn test_call_add(&self, value: BigUint) { + + testapi::assume(value <= 100u32); + + let adder = self.adder_address().get(); + + self.call_add(&value); + + // check the sum value + let sum_as_bytes = testapi::get_storage(&adder, &ManagedBuffer::from(b"sum")); + let sum = BigUint::from(sum_as_bytes); + testapi::assert( sum == (value + INIT_SUM) ); + + } + + #[endpoint(test_call_add_twice)] + fn test_call_add_twice(&self, value1: BigUint, value2: BigUint) { + + testapi::assume(value1 <= 100u32); + testapi::assume(value2 <= 100u32); + + let adder = self.adder_address().get(); + + self.call_add(&value1); + self.call_add(&value2); + + // check the sum value + let sum_as_bytes = testapi::get_storage(&adder, &ManagedBuffer::from(b"sum")); + let sum = BigUint::from(sum_as_bytes); + testapi::assert( sum == (value1 + value2 + INIT_SUM) ); + + } + + fn call_add(&self, value: &BigUint) { + let owner = self.owner_address().get(); + let adder = self.adder_address().get(); + + let mut adder_init_args = ManagedArgBuffer::new(); + adder_init_args.push_arg(&value); // initial sum + + // start a prank and call 'adder' from 'owner' + testapi::start_prank(&owner); + let res = self.send_raw().direct_egld_execute( + &adder, + &BigUint::from(0u32), + 5000000, + &ManagedBuffer::from(b"add"), + &adder_init_args, + ); + testapi::stop_prank(); + + match res { + Result::Err(_) => panic!("call failed"), + Result::Ok(_) => () + }; + + } +} diff --git a/contracts/foundry/foundrylike/wasm/Cargo.lock b/contracts/foundry/foundrylike/wasm/Cargo.lock new file mode 100644 index 0000000000..a04dc0cf4f --- /dev/null +++ b/contracts/foundry/foundrylike/wasm/Cargo.lock @@ -0,0 +1,227 @@ +# 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 = "multiversx-sc" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c22c2d1e82a357b6f397f87d475314628473b8a88882aa407234197f596786aa" +dependencies = [ + "bitflags", + "hashbrown", + "hex-literal", + "multiversx-sc-codec", + "multiversx-sc-derive", + "num-traits", +] + +[[package]] +name = "multiversx-sc-codec" +version = "0.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e9c97dc9e9f34f836de6a56386ddbe1b9e87e20916ff86b1ea728c08e1871ac2" +dependencies = [ + "arrayvec", + "multiversx-sc-codec-derive", +] + +[[package]] +name = "multiversx-sc-codec-derive" +version = "0.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12ab795364fcf0452a953e33eae7e0c22d1a6374ffeb0724d24a42727e099c6e" +dependencies = [ + "hex", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "multiversx-sc-derive" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6d77a125ea6985b2fa5cf1a297cdb9202c5a528eebb22652cc68ab1a9305e11" +dependencies = [ + "hex", + "proc-macro2", + "quote", + "radix_trie", + "syn", +] + +[[package]] +name = "multiversx-sc-wasm-adapter" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "951b0137614c8412554ccd086967c565af38b91b77a66b5d9f433801ff24e501" +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 = "test-adder" +version = "0.0.0" +dependencies = [ + "multiversx-sc", + "testapi", +] + +[[package]] +name = "test-adder-wasm" +version = "0.0.0" +dependencies = [ + "multiversx-sc-wasm-adapter", + "test-adder", +] + +[[package]] +name = "testapi" +version = "0.1.0" +dependencies = [ + "multiversx-sc", +] + +[[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/foundry/foundrylike/wasm/Cargo.toml b/contracts/foundry/foundrylike/wasm/Cargo.toml new file mode 100644 index 0000000000..ccdd503fe7 --- /dev/null +++ b/contracts/foundry/foundrylike/wasm/Cargo.toml @@ -0,0 +1,28 @@ +[package] +name = "test-adder-wasm" +version = "0.0.0" +edition = "2018" +publish = false +authors = [ "you",] + +[lib] +crate-type = [ "cdylib",] + +[workspace] +members = [ ".",] + +[dev-dependencies] + +[profile.release] +codegen-units = 1 +opt-level = "z" +lto = true +debug = false +panic = "abort" + +[dependencies.test-adder] +path = ".." + +[dependencies.multiversx-sc-wasm-adapter] +version = "0.43.4" +path = "../../../framework/base" diff --git a/contracts/foundry/foundrylike/wasm/src/lib.rs b/contracts/foundry/foundrylike/wasm/src/lib.rs new file mode 100644 index 0000000000..0e65aa0fab --- /dev/null +++ b/contracts/foundry/foundrylike/wasm/src/lib.rs @@ -0,0 +1,27 @@ +// 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! { + test_adder + ( + init => init + test_call_add => test_call_add + test_call_add_twice => test_call_add_twice + ) +} + +multiversx_sc_wasm_adapter::async_callback_empty! {} diff --git a/contracts/foundry/test_multisig/.gitignore b/contracts/foundry/test_multisig/.gitignore new file mode 100644 index 0000000000..2c76bc983e --- /dev/null +++ b/contracts/foundry/test_multisig/.gitignore @@ -0,0 +1,7 @@ +# Generated by Cargo +# will have compiled files and executables +/target/ +*/target/ + +# The mxpy output +/output*/ diff --git a/contracts/foundry/test_multisig/Cargo.toml b/contracts/foundry/test_multisig/Cargo.toml new file mode 100644 index 0000000000..c715db34f2 --- /dev/null +++ b/contracts/foundry/test_multisig/Cargo.toml @@ -0,0 +1,23 @@ +[package] +name = "test_multisig" +version = "0.0.0" +authors = [ "you",] +edition = "2018" +publish = false + +[lib] +path = "src/test_multisig.rs" + +[dev-dependencies] +num-bigint = "0.4.2" + +[dependencies.multiversx-sc] +version = "0.43.4" +path = "../../../framework/base" + +[dev-dependencies.multiversx-sc-scenario] +version = "0.43.4" +path = "../../../framework/scenario" + +[dependencies] +testapi = { version = "0.1.0", path = "../../../framework/testapi" } diff --git a/contracts/foundry/test_multisig/foundry.json b/contracts/foundry/test_multisig/foundry.json new file mode 100644 index 0000000000..eac6b162bc --- /dev/null +++ b/contracts/foundry/test_multisig/foundry.json @@ -0,0 +1,5 @@ +{ + "contract_paths": [ + "../../../deps/mx-sdk-rs/contracts/examples/multisig/output/multisig.wasm" + ] +} \ No newline at end of file diff --git a/contracts/foundry/test_multisig/meta/Cargo.toml b/contracts/foundry/test_multisig/meta/Cargo.toml new file mode 100644 index 0000000000..6a73e4c794 --- /dev/null +++ b/contracts/foundry/test_multisig/meta/Cargo.toml @@ -0,0 +1,15 @@ +[package] +name = "test_multisig-meta" +version = "0.0.0" +edition = "2018" +publish = false +authors = [ "you",] + +[dev-dependencies] + +[dependencies.test_multisig] +path = ".." + +[dependencies.multiversx-sc-meta] +version = "0.43.4" +path = "../../../../framework/meta" diff --git a/contracts/foundry/test_multisig/meta/src/main.rs b/contracts/foundry/test_multisig/meta/src/main.rs new file mode 100644 index 0000000000..3c6c55534f --- /dev/null +++ b/contracts/foundry/test_multisig/meta/src/main.rs @@ -0,0 +1,3 @@ +fn main() { + multiversx_sc_meta::cli_main::(); +} diff --git a/contracts/foundry/test_multisig/multiversx.json b/contracts/foundry/test_multisig/multiversx.json new file mode 100644 index 0000000000..7365539625 --- /dev/null +++ b/contracts/foundry/test_multisig/multiversx.json @@ -0,0 +1,3 @@ +{ + "language": "rust" +} \ No newline at end of file diff --git a/contracts/foundry/test_multisig/src/test_multisig.rs b/contracts/foundry/test_multisig/src/test_multisig.rs new file mode 100644 index 0000000000..1dc19d9a51 --- /dev/null +++ b/contracts/foundry/test_multisig/src/test_multisig.rs @@ -0,0 +1,134 @@ +#![no_std] + +use testapi; + +multiversx_sc::imports!(); + +static OWNER : &[u8; 32] = b"owner___________________________"; +static ALICE : &[u8; 32] = b"alice___________________________"; +static BOB : &[u8; 32] = b"bob_____________________________"; +static CHARLIE : &[u8; 32] = b"charlie_________________________"; +static MULTISIG : &[u8; 32] = b"multisig________________________"; + +#[multiversx_sc::contract] +pub trait TestMultisigContract { + + #[init] + fn init(&self, code_path: ManagedBuffer) { + + self.init_accounts(); + self.deploy(&code_path); + + } + + + fn init_accounts(&self) { + let owner = ManagedAddress::from(OWNER); + testapi::create_account(&owner, 0, &BigUint::from(0u64)); + testapi::create_account(&ManagedAddress::from(ALICE), 0, &BigUint::from(0u64)); + testapi::create_account(&ManagedAddress::from(BOB), 0, &BigUint::from(0u64)); + testapi::create_account(&ManagedAddress::from(CHARLIE), 0, &BigUint::from(0u64)); + + let multisig = ManagedAddress::from(MULTISIG); + testapi::register_new_address(&owner, 0, &multisig); + + } + + fn deploy(&self, code_path: &ManagedBuffer) { + + let mut init_args = ManagedArgBuffer::new(); + init_args.push_arg(2); // quorum = 2 + init_args.push_arg(ManagedAddress::from(ALICE)); // board members = alice, bob, charlie + init_args.push_arg(ManagedAddress::from(BOB)); + init_args.push_arg(ManagedAddress::from(CHARLIE)); + + let multisig = testapi::deploy_contract( + &ManagedAddress::from(OWNER), + 5000000000000, + &BigUint::zero(), + code_path, + &init_args, + ); + + testapi::assert( self.get_quorum(&multisig) == 2u32 ); + testapi::assert( self.get_num_board_members(&multisig) == 3u32 ); + + } + + fn get_quorum(&self, multisig: &ManagedAddress) -> BigUint { + let bs = testapi::get_storage(&multisig, &ManagedBuffer::from(b"quorum")); + BigUint::from(bs) + } + + fn get_num_board_members(&self, multisig: &ManagedAddress) -> BigUint { + let bs = testapi::get_storage(&multisig, &ManagedBuffer::from(b"num_board_members")); + BigUint::from(bs) + } + + #[endpoint(test_change_quorum)] + fn test_change_quorum(&self, value: BigUint) { + let multisig = ManagedAddress::from(MULTISIG); + let alice = ManagedAddress::from(ALICE); + let bob = ManagedAddress::from(BOB); + + // make assumptions + testapi::assume(value <= self.get_num_board_members(&multisig)); + + + self.change_quorum_propose(&multisig, &alice, &value); + self.change_quorum_sign(&multisig, &bob); + self.perform_action(&multisig, &alice); + + // check the final quorum + testapi::assert(value == self.get_quorum(&multisig)); + } + + fn change_quorum_propose(&self, multisig: &ManagedAddress, proposer: &ManagedAddress, value: &BigUint) { + let mut args = ManagedArgBuffer::new(); + args.push_arg(value); + + testapi::start_prank(&proposer); + let _ = self.send_raw().direct_egld_execute( + &multisig, + &BigUint::from(0u32), + 5000000, + &ManagedBuffer::from(b"proposeChangeQuorum"), + &args, + ); + testapi::stop_prank(); + + } + + fn change_quorum_sign(&self, multisig: &ManagedAddress, signer: &ManagedAddress) { + let mut args = ManagedArgBuffer::new(); + args.push_arg(1u32); + + testapi::start_prank(signer); + let _ = self.send_raw().direct_egld_execute( + &multisig, + &BigUint::from(0u32), + 5000000, + &ManagedBuffer::from(b"sign"), + &args, + ); + testapi::stop_prank(); + + } + + fn perform_action(&self, multisig: &ManagedAddress, performer: &ManagedAddress) { + let mut args = ManagedArgBuffer::new(); + args.push_arg(1u32); + + testapi::start_prank(performer); + let _ = self.send_raw().direct_egld_execute( + &multisig, + &BigUint::from(0u32), + 5000000, + &ManagedBuffer::from(b"performAction"), + &args, + ); + testapi::stop_prank(); + + } + +} diff --git a/contracts/foundry/test_multisig/wasm/Cargo.lock b/contracts/foundry/test_multisig/wasm/Cargo.lock new file mode 100644 index 0000000000..db2c563131 --- /dev/null +++ b/contracts/foundry/test_multisig/wasm/Cargo.lock @@ -0,0 +1,227 @@ +# 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 = "multiversx-sc" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c22c2d1e82a357b6f397f87d475314628473b8a88882aa407234197f596786aa" +dependencies = [ + "bitflags", + "hashbrown", + "hex-literal", + "multiversx-sc-codec", + "multiversx-sc-derive", + "num-traits", +] + +[[package]] +name = "multiversx-sc-codec" +version = "0.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e9c97dc9e9f34f836de6a56386ddbe1b9e87e20916ff86b1ea728c08e1871ac2" +dependencies = [ + "arrayvec", + "multiversx-sc-codec-derive", +] + +[[package]] +name = "multiversx-sc-codec-derive" +version = "0.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12ab795364fcf0452a953e33eae7e0c22d1a6374ffeb0724d24a42727e099c6e" +dependencies = [ + "hex", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "multiversx-sc-derive" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6d77a125ea6985b2fa5cf1a297cdb9202c5a528eebb22652cc68ab1a9305e11" +dependencies = [ + "hex", + "proc-macro2", + "quote", + "radix_trie", + "syn", +] + +[[package]] +name = "multiversx-sc-wasm-adapter" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "951b0137614c8412554ccd086967c565af38b91b77a66b5d9f433801ff24e501" +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.64" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78803b62cbf1f46fde80d7c0e803111524b9877184cfe7c3033659490ac7a7da" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "573015e8ab27661678357f27dc26460738fd2b6c86e46f386fde94cb5d913105" +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.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62bb4feee49fdd9f707ef802e22365a35de4b7b299de4763d44bfea899442ff9" + +[[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 = "test_multisig" +version = "0.0.0" +dependencies = [ + "multiversx-sc", + "testapi", +] + +[[package]] +name = "test_multisig-wasm" +version = "0.0.0" +dependencies = [ + "multiversx-sc-wasm-adapter", + "test_multisig", +] + +[[package]] +name = "testapi" +version = "0.1.0" +dependencies = [ + "multiversx-sc", +] + +[[package]] +name = "unicode-ident" +version = "1.0.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22049a19f4a68748a168c0fc439f9516686aa045927ff767eca0a85101fb6e73" + +[[package]] +name = "version_check" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" diff --git a/contracts/foundry/test_multisig/wasm/Cargo.toml b/contracts/foundry/test_multisig/wasm/Cargo.toml new file mode 100644 index 0000000000..e74a954e83 --- /dev/null +++ b/contracts/foundry/test_multisig/wasm/Cargo.toml @@ -0,0 +1,28 @@ +[package] +name = "test_multisig-wasm" +version = "0.0.0" +edition = "2018" +publish = false +authors = [ "you",] + +[lib] +crate-type = [ "cdylib",] + +[workspace] +members = [ ".",] + +[dev-dependencies] + +[profile.release] +codegen-units = 1 +opt-level = "z" +lto = true +debug = false +panic = "abort" + +[dependencies.test_multisig] +path = ".." + +[dependencies.multiversx-sc-wasm-adapter] +version = "0.43.4" +path = "../../../framework/base" diff --git a/contracts/foundry/test_multisig/wasm/src/lib.rs b/contracts/foundry/test_multisig/wasm/src/lib.rs new file mode 100644 index 0000000000..4f7e4a1599 --- /dev/null +++ b/contracts/foundry/test_multisig/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: 1 +// Async Callback (empty): 1 +// Total number of exported functions: 3 + +#![no_std] +#![feature(lang_items)] + +multiversx_sc_wasm_adapter::allocator!(); +multiversx_sc_wasm_adapter::panic_handler!(); + +multiversx_sc_wasm_adapter::endpoints! { + test_multisig + ( + init => init + test_change_quorum => test_change_quorum + ) +} + +multiversx_sc_wasm_adapter::async_callback_empty! {} diff --git a/contracts/foundry/test_testapi/.gitignore b/contracts/foundry/test_testapi/.gitignore new file mode 100644 index 0000000000..2c76bc983e --- /dev/null +++ b/contracts/foundry/test_testapi/.gitignore @@ -0,0 +1,7 @@ +# Generated by Cargo +# will have compiled files and executables +/target/ +*/target/ + +# The mxpy output +/output*/ diff --git a/contracts/foundry/test_testapi/Cargo.toml b/contracts/foundry/test_testapi/Cargo.toml new file mode 100644 index 0000000000..0ca9eaae39 --- /dev/null +++ b/contracts/foundry/test_testapi/Cargo.toml @@ -0,0 +1,23 @@ +[package] +name = "test-testapi" +version = "0.0.0" +authors = [ "you",] +edition = "2018" +publish = false + +[lib] +path = "src/test_testapi.rs" + +[dev-dependencies] +num-bigint = "0.4.2" + +[dependencies.multiversx-sc] +version = "0.43.4" +path = "../../../framework/base" + +[dev-dependencies.multiversx-sc-scenario] +version = "0.43.4" +path = "../../../framework/scenario" + +[dependencies] +testapi = { version = "0.1.0", path = "../../../framework/testapi" } diff --git a/contracts/foundry/test_testapi/foundry.json b/contracts/foundry/test_testapi/foundry.json new file mode 100644 index 0000000000..5a61e45e68 --- /dev/null +++ b/contracts/foundry/test_testapi/foundry.json @@ -0,0 +1,3 @@ +{ + "contract_paths": [] +} \ No newline at end of file diff --git a/contracts/foundry/test_testapi/meta/Cargo.toml b/contracts/foundry/test_testapi/meta/Cargo.toml new file mode 100644 index 0000000000..7e03bfe984 --- /dev/null +++ b/contracts/foundry/test_testapi/meta/Cargo.toml @@ -0,0 +1,15 @@ +[package] +name = "test-testapi-meta" +version = "0.0.0" +edition = "2018" +publish = false +authors = [ "you",] + +[dev-dependencies] + +[dependencies.test-testapi] +path = ".." + +[dependencies.multiversx-sc-meta] +version = "0.43.4" +path = "../../../../framework/meta" diff --git a/contracts/foundry/test_testapi/meta/src/main.rs b/contracts/foundry/test_testapi/meta/src/main.rs new file mode 100644 index 0000000000..4ce9753347 --- /dev/null +++ b/contracts/foundry/test_testapi/meta/src/main.rs @@ -0,0 +1,3 @@ +fn main() { + multiversx_sc_meta::cli_main::(); +} diff --git a/contracts/foundry/test_testapi/multiversx.json b/contracts/foundry/test_testapi/multiversx.json new file mode 100644 index 0000000000..7365539625 --- /dev/null +++ b/contracts/foundry/test_testapi/multiversx.json @@ -0,0 +1,3 @@ +{ + "language": "rust" +} \ No newline at end of file diff --git a/contracts/foundry/test_testapi/src/test_testapi.rs b/contracts/foundry/test_testapi/src/test_testapi.rs new file mode 100644 index 0000000000..d9d231a457 --- /dev/null +++ b/contracts/foundry/test_testapi/src/test_testapi.rs @@ -0,0 +1,77 @@ +#![no_std] + +use testapi; + +multiversx_sc::imports!(); + +#[multiversx_sc::contract] +pub trait TestTestapi { + + #[init] + fn init(&self) { + let alice = ManagedAddress::from(b"alice___________________________"); + testapi::create_account(&alice, 1, &BigUint::from(0u64)); + + self.test_set_balance(&alice); + self.test_set_esdt_balance(&alice); + self.test_set_timestamp(); + self.test_set_get_storage(&alice); + } + + fn test_set_balance(&self, addr: &ManagedAddress) { + // Given + let value = BigUint::from(100000000u64); + + // When + testapi::set_balance(addr, &value); + + // Expect + let actual = self.blockchain() + .get_balance(addr); + + require!(value == actual, "Actual balance does not match the given value"); + } + + fn test_set_esdt_balance(&self, addr: &ManagedAddress) { + // Given + let value = BigUint::from(100000000u64); + let token = TokenIdentifier::from("MY_ESDT_TOKEN"); + + // When + testapi::set_esdt_balance(addr, &token, &value); + + // Expect + let actual = self.blockchain() + .get_esdt_balance(addr, &token, 0u64); + + require!(value == actual, "Actual esdt balance does not match the given value"); + } + + fn test_set_timestamp(&self) { + // Given + let value = 1234567890u64; + + // When + testapi::set_block_timestamp(value); + + // Expect + require!( + value == self.blockchain().get_block_timestamp(), + "Actual timestamp does not match the given value" + ); + } + + fn test_set_get_storage(&self, addr: &ManagedAddress) { + // Given + let key = ManagedBuffer::from(b"a_storage_key"); + let value = ManagedBuffer::from(b"a storage value"); + + // When + testapi::set_storage(addr, &key, &value); + + // Expect + let actual = testapi::get_storage(addr, &key); + require!(actual == value, "Actual storage does not match the given value"); + } + +} diff --git a/contracts/foundry/test_testapi/wasm/Cargo.lock b/contracts/foundry/test_testapi/wasm/Cargo.lock new file mode 100644 index 0000000000..9326ca243f --- /dev/null +++ b/contracts/foundry/test_testapi/wasm/Cargo.lock @@ -0,0 +1,227 @@ +# 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 = "multiversx-sc" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c22c2d1e82a357b6f397f87d475314628473b8a88882aa407234197f596786aa" +dependencies = [ + "bitflags", + "hashbrown", + "hex-literal", + "multiversx-sc-codec", + "multiversx-sc-derive", + "num-traits", +] + +[[package]] +name = "multiversx-sc-codec" +version = "0.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e9c97dc9e9f34f836de6a56386ddbe1b9e87e20916ff86b1ea728c08e1871ac2" +dependencies = [ + "arrayvec", + "multiversx-sc-codec-derive", +] + +[[package]] +name = "multiversx-sc-codec-derive" +version = "0.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12ab795364fcf0452a953e33eae7e0c22d1a6374ffeb0724d24a42727e099c6e" +dependencies = [ + "hex", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "multiversx-sc-derive" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6d77a125ea6985b2fa5cf1a297cdb9202c5a528eebb22652cc68ab1a9305e11" +dependencies = [ + "hex", + "proc-macro2", + "quote", + "radix_trie", + "syn", +] + +[[package]] +name = "multiversx-sc-wasm-adapter" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "951b0137614c8412554ccd086967c565af38b91b77a66b5d9f433801ff24e501" +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.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f30b0abd723be7e2ffca1272140fac1a2f084c77ec3e123c192b66af1ee9e6c2" +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.67" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d433d9f1a3e8c1263d9456598b16fec66f4acc9a74dacffd35c7bb09b3a1328" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" +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.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "942b4a808e05215192e39f4ab80813e599068285906cc91aa64f923db842bd5a" + +[[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 = "test-testapi" +version = "0.0.0" +dependencies = [ + "multiversx-sc", + "testapi", +] + +[[package]] +name = "test-testapi-wasm" +version = "0.0.0" +dependencies = [ + "multiversx-sc-wasm-adapter", + "test-testapi", +] + +[[package]] +name = "testapi" +version = "0.1.0" +dependencies = [ + "multiversx-sc", +] + +[[package]] +name = "unicode-ident" +version = "1.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" + +[[package]] +name = "version_check" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" diff --git a/contracts/foundry/test_testapi/wasm/Cargo.toml b/contracts/foundry/test_testapi/wasm/Cargo.toml new file mode 100644 index 0000000000..440e739c91 --- /dev/null +++ b/contracts/foundry/test_testapi/wasm/Cargo.toml @@ -0,0 +1,28 @@ +[package] +name = "test-testapi-wasm" +version = "0.0.0" +edition = "2018" +publish = false +authors = [ "you",] + +[lib] +crate-type = [ "cdylib",] + +[workspace] +members = [ ".",] + +[dev-dependencies] + +[profile.release] +codegen-units = 1 +opt-level = "z" +lto = true +debug = false +panic = "abort" + +[dependencies.test-testapi] +path = ".." + +[dependencies.multiversx-sc-wasm-adapter] +version = "0.43.4" +path = "../../../framework/base" diff --git a/contracts/foundry/test_testapi/wasm/src/lib.rs b/contracts/foundry/test_testapi/wasm/src/lib.rs new file mode 100644 index 0000000000..b612766780 --- /dev/null +++ b/contracts/foundry/test_testapi/wasm/src/lib.rs @@ -0,0 +1,25 @@ +// Code generated by the multiversx-sc multi-contract system. DO NOT EDIT. + +//////////////////////////////////////////////////// +////////////////// AUTO-GENERATED ////////////////// +//////////////////////////////////////////////////// + +// Init: 1 +// Endpoints: 0 +// Async Callback (empty): 1 +// Total number of exported functions: 2 + +#![no_std] +#![feature(lang_items)] + +multiversx_sc_wasm_adapter::allocator!(); +multiversx_sc_wasm_adapter::panic_handler!(); + +multiversx_sc_wasm_adapter::endpoints! { + test_testapi + ( + init => init + ) +} + +multiversx_sc_wasm_adapter::async_callback_empty! {} diff --git a/framework/testapi/Cargo.toml b/framework/testapi/Cargo.toml new file mode 100644 index 0000000000..ecb045916b --- /dev/null +++ b/framework/testapi/Cargo.toml @@ -0,0 +1,16 @@ +[package] +name = "testapi" +version = "0.1.0" +edition = "2021" + +[dependencies] + +[dev-dependencies] +num-bigint = "0.4.2" + +[dependencies.multiversx-sc] +version = "0.43.4" +path = "../base" + +[lib] +path = "src/testapi.rs" diff --git a/framework/testapi/src/testapi.rs b/framework/testapi/src/testapi.rs new file mode 100644 index 0000000000..c955e35d9b --- /dev/null +++ b/framework/testapi/src/testapi.rs @@ -0,0 +1,220 @@ +#![no_std] + +multiversx_sc::imports!(); +multiversx_sc::derive_imports!(); + +#[allow(unused)] +extern "C" { + + fn createAccount( + addressHandle: i32, + nonce: i64, + balanceHandle: i32, + ); + + fn registerNewAddress( + ownerHandle: i32, + nonce: i64, + newAddressHandle: i32, + ); + + fn deployContract( + ownerHandle: i32, + gasLimit: i64, + valueHandle: i32, + codePathHandle: i32, + argumentsHandle: i32, + resultAddressHandle: i32, + ); + + fn setStorage( + addressHandle: i32, + keyHandle: i32, + valueHandle: i32, + ); + + fn getStorage( + addressHandle: i32, + keyHandle: i32, + dstHandle: i32, + ); + + fn assumeBool(p: bool); + fn assertBool(p: bool); + + fn startPrank(addressHandle: i32); + fn stopPrank(); + + fn setBlockTimestamp(timestamp: i64); + + fn setExternalBalance( + addressHandle: i32, + valueHandle: i32, + ); + + fn setESDTExternalBalance( + addressHandle: i32, + tokenIdHandle: i32, + valueHandle: i32, + ); +} + + +#[allow(unused)] +pub fn create_account( + address: &ManagedAddress, + nonce: u64, + balance: &BigUint, +) { + unsafe { + createAccount( + address.get_raw_handle(), + nonce as i64, + balance.get_raw_handle(), + ); + } +} + +#[allow(unused)] +pub fn register_new_address( + owner: &ManagedAddress, + nonce: u64, + new_address: &ManagedAddress, +) { + unsafe { + registerNewAddress( + owner.get_raw_handle(), + nonce as i64, + new_address.get_raw_handle(), + ); + } +} + +// Deploy a contract whose code was previously fetched using "fetchWasmSource" in Mandos. +#[allow(unused)] +pub fn deploy_contract( + owner: &ManagedAddress, + gas_limit: u64, + value: &BigUint, + code_path: &ManagedBuffer, + arguments: &ManagedArgBuffer, +) -> ManagedAddress { + unsafe { + let mut dest = ManagedAddress::zero(); + + deployContract( + owner.get_raw_handle(), + gas_limit as i64, + value.get_raw_handle(), + code_path.get_raw_handle(), + arguments.get_raw_handle(), + dest.get_raw_handle(), + ); + + dest + } + +} + +// Set storage of any account +#[allow(unused)] +pub fn set_storage( + address: &ManagedAddress, + key: &ManagedBuffer, + value: &ManagedBuffer, +) { + unsafe { + setStorage( + address.get_raw_handle(), + key.get_raw_handle(), + value.get_raw_handle(), + ); + } +} + + +// Get storage of any account +#[allow(unused)] +pub fn get_storage( + address: &ManagedAddress, + key: &ManagedBuffer, +) -> ManagedBuffer { + unsafe { + let mut dest = ManagedBuffer::new(); + + getStorage( + address.get_raw_handle(), + key.get_raw_handle(), + dest.get_raw_handle(), + ); + + dest + } +} + + +// Start a prank: set the caller address for contract calls until stop_prank +#[allow(unused)] +pub fn start_prank(address: &ManagedAddress) { + unsafe { + startPrank(address.get_raw_handle()); + } +} + +// Stop a prank: reset the caller address +#[allow(unused)] +pub fn stop_prank() { + unsafe { + stopPrank(); + } +} + +#[allow(unused)] +pub fn assume(p: bool) { + unsafe { + assumeBool(p); + } +} + +#[allow(unused)] +pub fn assert(p: bool) { + unsafe { + assertBool(p); + } +} + +#[allow(unused)] +pub fn set_block_timestamp(timestamp: u64) { + unsafe { + setBlockTimestamp(timestamp as i64); + } +} + +#[allow(unused)] +pub fn set_balance( + address: &ManagedAddress, + value: &BigUint, +) { + unsafe { + setExternalBalance( + address.get_raw_handle(), + value.get_raw_handle(), + ); + } +} + + +#[allow(unused)] +pub fn set_esdt_balance( + address: &ManagedAddress, + token_id: &TokenIdentifier, + value: &BigUint, +) { + unsafe { + setESDTExternalBalance( + address.get_raw_handle(), + token_id.get_raw_handle(), + value.get_raw_handle(), + ); + } +} From ceb6179867000d70343258e6a086ee89f396f524 Mon Sep 17 00:00:00 2001 From: Andrei Marinica Date: Sun, 8 Oct 2023 18:40:26 +0300 Subject: [PATCH 02/20] test api integrated in SC api --- Cargo.lock | 11 - Cargo.toml | 1 - contracts/foundry/foundrylike/Cargo.toml | 2 - .../foundry/foundrylike/src/test_adder.rs | 30 ++- contracts/foundry/test_multisig/Cargo.toml | 2 - .../test_multisig/src/test_multisig.rs | 38 ++- contracts/foundry/test_testapi/Cargo.toml | 2 - .../foundry/test_testapi/src/test_testapi.rs | 14 +- framework/base/src/api.rs | 2 + .../base/src/api/external_view/ev_wrapper.rs | 13 +- framework/base/src/api/test_api.rs | 104 +++++++++ framework/base/src/api/uncallable.rs | 1 + .../src/api/uncallable/test_api_uncallable.rs | 13 ++ framework/base/src/api/vm_api.rs | 3 +- .../src/contract_base/contract_base_trait.rs | 7 +- framework/base/src/contract_base/wrappers.rs | 2 + .../wrappers/test_raw_wrapper.rs | 129 ++++++++++ framework/scenario/src/api/core_api_vh.rs | 1 + .../src/api/core_api_vh/test_api_vh.rs | 13 ++ framework/testapi/Cargo.toml | 16 -- framework/testapi/src/testapi.rs | 220 ------------------ .../wasm-adapter/src/{api/mod.rs => api.rs} | 1 + .../wasm-adapter/src/api/test_api_node.rs | 170 ++++++++++++++ 23 files changed, 494 insertions(+), 301 deletions(-) create mode 100644 framework/base/src/api/test_api.rs create mode 100644 framework/base/src/api/uncallable/test_api_uncallable.rs create mode 100644 framework/base/src/contract_base/wrappers/test_raw_wrapper.rs create mode 100644 framework/scenario/src/api/core_api_vh/test_api_vh.rs delete mode 100644 framework/testapi/Cargo.toml delete mode 100644 framework/testapi/src/testapi.rs rename framework/wasm-adapter/src/{api/mod.rs => api.rs} (94%) create mode 100644 framework/wasm-adapter/src/api/test_api_node.rs diff --git a/Cargo.lock b/Cargo.lock index caad4adf86..e8bee9eb9d 100755 --- a/Cargo.lock +++ b/Cargo.lock @@ -3657,7 +3657,6 @@ dependencies = [ "multiversx-sc 0.43.4", "multiversx-sc-scenario 0.43.4", "num-bigint", - "testapi", ] [[package]] @@ -3675,7 +3674,6 @@ dependencies = [ "multiversx-sc 0.43.4", "multiversx-sc-scenario 0.43.4", "num-bigint", - "testapi", ] [[package]] @@ -3693,7 +3691,6 @@ dependencies = [ "multiversx-sc 0.43.4", "multiversx-sc-scenario 0.43.4", "num-bigint", - "testapi", ] [[package]] @@ -3704,14 +3701,6 @@ dependencies = [ "test_multisig", ] -[[package]] -name = "testapi" -version = "0.1.0" -dependencies = [ - "multiversx-sc 0.43.4", - "num-bigint", -] - [[package]] name = "thiserror" version = "1.0.47" diff --git a/Cargo.toml b/Cargo.toml index bf79e92d77..7c3e5928d0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,7 +11,6 @@ members = [ "framework/scenario", "framework/snippets", "framework/wasm-adapter", - "framework/testapi", "sdk/core", "sdk/scenario-format", diff --git a/contracts/foundry/foundrylike/Cargo.toml b/contracts/foundry/foundrylike/Cargo.toml index 85f3828560..cc5fb1a3eb 100644 --- a/contracts/foundry/foundrylike/Cargo.toml +++ b/contracts/foundry/foundrylike/Cargo.toml @@ -19,5 +19,3 @@ path = "../../../framework/base" version = "0.43.4" path = "../../../framework/scenario" -[dependencies] -testapi = { version = "0.1.0", path = "../../../framework/testapi" } diff --git a/contracts/foundry/foundrylike/src/test_adder.rs b/contracts/foundry/foundrylike/src/test_adder.rs index b9e136ea69..1448b1465c 100644 --- a/contracts/foundry/foundrylike/src/test_adder.rs +++ b/contracts/foundry/foundrylike/src/test_adder.rs @@ -1,7 +1,5 @@ #![no_std] -use testapi; - multiversx_sc::imports!(); static INIT_SUM : u32 = 5u32; @@ -22,18 +20,18 @@ pub trait TestAdder { let owner = ManagedAddress::from(b"owner___________________________"); self.owner_address().set(&owner); - testapi::create_account(&owner, 1, &BigUint::from(0u64)); + self.test_raw().create_account(&owner, 1, &BigUint::from(0u64)); // register an address for the contract to be deployed let adder = ManagedAddress::from(b"adder___________________________"); - testapi::register_new_address(&owner, 1, &adder, ); + self.test_raw().register_new_address(&owner, 1, &adder, ); // deploy the adder contract let mut adder_init_args = ManagedArgBuffer::new(); adder_init_args.push_arg(INIT_SUM); // initial sum // deploy a contract from `owner` - let adder = testapi::deploy_contract( + let adder = self.test_raw().deploy_contract( &owner, 5000000000000, &BigUint::zero(), @@ -45,9 +43,9 @@ pub trait TestAdder { self.adder_address().set(&adder); // check the initial sum value - let sum_as_bytes = testapi::get_storage(&adder, &ManagedBuffer::from(b"sum")); + let sum_as_bytes = self.test_raw().get_storage(&adder, &ManagedBuffer::from(b"sum")); let sum = BigUint::from(sum_as_bytes); - testapi::assert( sum == INIT_SUM ); + self.test_raw().assert( sum == INIT_SUM ); } @@ -55,24 +53,24 @@ pub trait TestAdder { #[endpoint(test_call_add)] fn test_call_add(&self, value: BigUint) { - testapi::assume(value <= 100u32); + self.test_raw().assume(value <= 100u32); let adder = self.adder_address().get(); self.call_add(&value); // check the sum value - let sum_as_bytes = testapi::get_storage(&adder, &ManagedBuffer::from(b"sum")); + let sum_as_bytes = self.test_raw().get_storage(&adder, &ManagedBuffer::from(b"sum")); let sum = BigUint::from(sum_as_bytes); - testapi::assert( sum == (value + INIT_SUM) ); + self.test_raw().assert( sum == (value + INIT_SUM) ); } #[endpoint(test_call_add_twice)] fn test_call_add_twice(&self, value1: BigUint, value2: BigUint) { - testapi::assume(value1 <= 100u32); - testapi::assume(value2 <= 100u32); + self.test_raw().assume(value1 <= 100u32); + self.test_raw().assume(value2 <= 100u32); let adder = self.adder_address().get(); @@ -80,9 +78,9 @@ pub trait TestAdder { self.call_add(&value2); // check the sum value - let sum_as_bytes = testapi::get_storage(&adder, &ManagedBuffer::from(b"sum")); + let sum_as_bytes = self.test_raw().get_storage(&adder, &ManagedBuffer::from(b"sum")); let sum = BigUint::from(sum_as_bytes); - testapi::assert( sum == (value1 + value2 + INIT_SUM) ); + self.test_raw().assert( sum == (value1 + value2 + INIT_SUM) ); } @@ -94,7 +92,7 @@ pub trait TestAdder { adder_init_args.push_arg(&value); // initial sum // start a prank and call 'adder' from 'owner' - testapi::start_prank(&owner); + self.test_raw().start_prank(&owner); let res = self.send_raw().direct_egld_execute( &adder, &BigUint::from(0u32), @@ -102,7 +100,7 @@ pub trait TestAdder { &ManagedBuffer::from(b"add"), &adder_init_args, ); - testapi::stop_prank(); + self.test_raw().stop_prank(); match res { Result::Err(_) => panic!("call failed"), diff --git a/contracts/foundry/test_multisig/Cargo.toml b/contracts/foundry/test_multisig/Cargo.toml index c715db34f2..8228080223 100644 --- a/contracts/foundry/test_multisig/Cargo.toml +++ b/contracts/foundry/test_multisig/Cargo.toml @@ -19,5 +19,3 @@ path = "../../../framework/base" version = "0.43.4" path = "../../../framework/scenario" -[dependencies] -testapi = { version = "0.1.0", path = "../../../framework/testapi" } diff --git a/contracts/foundry/test_multisig/src/test_multisig.rs b/contracts/foundry/test_multisig/src/test_multisig.rs index 1dc19d9a51..434750d443 100644 --- a/contracts/foundry/test_multisig/src/test_multisig.rs +++ b/contracts/foundry/test_multisig/src/test_multisig.rs @@ -1,7 +1,5 @@ #![no_std] -use testapi; - multiversx_sc::imports!(); static OWNER : &[u8; 32] = b"owner___________________________"; @@ -24,13 +22,13 @@ pub trait TestMultisigContract { fn init_accounts(&self) { let owner = ManagedAddress::from(OWNER); - testapi::create_account(&owner, 0, &BigUint::from(0u64)); - testapi::create_account(&ManagedAddress::from(ALICE), 0, &BigUint::from(0u64)); - testapi::create_account(&ManagedAddress::from(BOB), 0, &BigUint::from(0u64)); - testapi::create_account(&ManagedAddress::from(CHARLIE), 0, &BigUint::from(0u64)); + self.test_raw().create_account(&owner, 0, &BigUint::from(0u64)); + self.test_raw().create_account(&ManagedAddress::from(ALICE), 0, &BigUint::from(0u64)); + self.test_raw().create_account(&ManagedAddress::from(BOB), 0, &BigUint::from(0u64)); + self.test_raw().create_account(&ManagedAddress::from(CHARLIE), 0, &BigUint::from(0u64)); let multisig = ManagedAddress::from(MULTISIG); - testapi::register_new_address(&owner, 0, &multisig); + self.test_raw().register_new_address(&owner, 0, &multisig); } @@ -42,7 +40,7 @@ pub trait TestMultisigContract { init_args.push_arg(ManagedAddress::from(BOB)); init_args.push_arg(ManagedAddress::from(CHARLIE)); - let multisig = testapi::deploy_contract( + let multisig = self.test_raw().deploy_contract( &ManagedAddress::from(OWNER), 5000000000000, &BigUint::zero(), @@ -50,18 +48,18 @@ pub trait TestMultisigContract { &init_args, ); - testapi::assert( self.get_quorum(&multisig) == 2u32 ); - testapi::assert( self.get_num_board_members(&multisig) == 3u32 ); + self.test_raw().assert( self.get_quorum(&multisig) == 2u32 ); + self.test_raw().assert( self.get_num_board_members(&multisig) == 3u32 ); } fn get_quorum(&self, multisig: &ManagedAddress) -> BigUint { - let bs = testapi::get_storage(&multisig, &ManagedBuffer::from(b"quorum")); + let bs = self.test_raw().get_storage(&multisig, &ManagedBuffer::from(b"quorum")); BigUint::from(bs) } fn get_num_board_members(&self, multisig: &ManagedAddress) -> BigUint { - let bs = testapi::get_storage(&multisig, &ManagedBuffer::from(b"num_board_members")); + let bs = self.test_raw().get_storage(&multisig, &ManagedBuffer::from(b"num_board_members")); BigUint::from(bs) } @@ -72,7 +70,7 @@ pub trait TestMultisigContract { let bob = ManagedAddress::from(BOB); // make assumptions - testapi::assume(value <= self.get_num_board_members(&multisig)); + self.test_raw().assume(value <= self.get_num_board_members(&multisig)); self.change_quorum_propose(&multisig, &alice, &value); @@ -80,14 +78,14 @@ pub trait TestMultisigContract { self.perform_action(&multisig, &alice); // check the final quorum - testapi::assert(value == self.get_quorum(&multisig)); + self.test_raw().assert(value == self.get_quorum(&multisig)); } fn change_quorum_propose(&self, multisig: &ManagedAddress, proposer: &ManagedAddress, value: &BigUint) { let mut args = ManagedArgBuffer::new(); args.push_arg(value); - testapi::start_prank(&proposer); + self.test_raw().start_prank(&proposer); let _ = self.send_raw().direct_egld_execute( &multisig, &BigUint::from(0u32), @@ -95,7 +93,7 @@ pub trait TestMultisigContract { &ManagedBuffer::from(b"proposeChangeQuorum"), &args, ); - testapi::stop_prank(); + self.test_raw().stop_prank(); } @@ -103,7 +101,7 @@ pub trait TestMultisigContract { let mut args = ManagedArgBuffer::new(); args.push_arg(1u32); - testapi::start_prank(signer); + self.test_raw().start_prank(signer); let _ = self.send_raw().direct_egld_execute( &multisig, &BigUint::from(0u32), @@ -111,7 +109,7 @@ pub trait TestMultisigContract { &ManagedBuffer::from(b"sign"), &args, ); - testapi::stop_prank(); + self.test_raw().stop_prank(); } @@ -119,7 +117,7 @@ pub trait TestMultisigContract { let mut args = ManagedArgBuffer::new(); args.push_arg(1u32); - testapi::start_prank(performer); + self.test_raw().start_prank(performer); let _ = self.send_raw().direct_egld_execute( &multisig, &BigUint::from(0u32), @@ -127,7 +125,7 @@ pub trait TestMultisigContract { &ManagedBuffer::from(b"performAction"), &args, ); - testapi::stop_prank(); + self.test_raw().stop_prank(); } diff --git a/contracts/foundry/test_testapi/Cargo.toml b/contracts/foundry/test_testapi/Cargo.toml index 0ca9eaae39..7d9f0b0ed3 100644 --- a/contracts/foundry/test_testapi/Cargo.toml +++ b/contracts/foundry/test_testapi/Cargo.toml @@ -19,5 +19,3 @@ path = "../../../framework/base" version = "0.43.4" path = "../../../framework/scenario" -[dependencies] -testapi = { version = "0.1.0", path = "../../../framework/testapi" } diff --git a/contracts/foundry/test_testapi/src/test_testapi.rs b/contracts/foundry/test_testapi/src/test_testapi.rs index d9d231a457..599eaab605 100644 --- a/contracts/foundry/test_testapi/src/test_testapi.rs +++ b/contracts/foundry/test_testapi/src/test_testapi.rs @@ -1,7 +1,5 @@ #![no_std] -use testapi; - multiversx_sc::imports!(); #[multiversx_sc::contract] @@ -10,7 +8,7 @@ pub trait TestTestapi { #[init] fn init(&self) { let alice = ManagedAddress::from(b"alice___________________________"); - testapi::create_account(&alice, 1, &BigUint::from(0u64)); + self.test_raw().create_account(&alice, 1, &BigUint::from(0u64)); self.test_set_balance(&alice); self.test_set_esdt_balance(&alice); @@ -23,7 +21,7 @@ pub trait TestTestapi { let value = BigUint::from(100000000u64); // When - testapi::set_balance(addr, &value); + self.test_raw().set_balance(addr, &value); // Expect let actual = self.blockchain() @@ -38,7 +36,7 @@ pub trait TestTestapi { let token = TokenIdentifier::from("MY_ESDT_TOKEN"); // When - testapi::set_esdt_balance(addr, &token, &value); + self.test_raw().set_esdt_balance(addr, &token, &value); // Expect let actual = self.blockchain() @@ -52,7 +50,7 @@ pub trait TestTestapi { let value = 1234567890u64; // When - testapi::set_block_timestamp(value); + self.test_raw().set_block_timestamp(value); // Expect require!( @@ -67,10 +65,10 @@ pub trait TestTestapi { let value = ManagedBuffer::from(b"a storage value"); // When - testapi::set_storage(addr, &key, &value); + self.test_raw().set_storage(addr, &key, &value); // Expect - let actual = testapi::get_storage(addr, &key); + let actual = self.test_raw().get_storage(addr, &key); require!(actual == value, "Actual storage does not match the given value"); } diff --git a/framework/base/src/api.rs b/framework/base/src/api.rs index d59a15931d..04bd8702e2 100644 --- a/framework/base/src/api.rs +++ b/framework/base/src/api.rs @@ -12,6 +12,7 @@ mod managed_types; mod print_api; mod send_api; mod storage_api; +mod test_api; pub mod uncallable; mod vm_api; @@ -29,4 +30,5 @@ pub use managed_types::*; pub use print_api::*; pub use send_api::*; pub use storage_api::*; +pub use test_api::*; pub use vm_api::VMApi; diff --git a/framework/base/src/api/external_view/ev_wrapper.rs b/framework/base/src/api/external_view/ev_wrapper.rs index 6b88231e5b..a484a6c5cc 100644 --- a/framework/base/src/api/external_view/ev_wrapper.rs +++ b/framework/base/src/api/external_view/ev_wrapper.rs @@ -3,7 +3,7 @@ use core::marker::PhantomData; use crate::api::{ BlockchainApi, CallTypeApi, CallValueApi, CryptoApi, EndpointArgumentApi, EndpointFinishApi, ErrorApi, HandleTypeInfo, LogApi, ManagedTypeApi, PrintApi, SendApi, StaticVarApi, - StorageMapperApi, StorageWriteApi, VMApi, + StorageMapperApi, StorageWriteApi, TestApi, VMApi, }; #[derive(Clone)] @@ -170,6 +170,17 @@ impl CallTypeApi for ExternalViewApi where A: VMApi {} impl StorageMapperApi for ExternalViewApi where A: VMApi {} +impl TestApi for ExternalViewApi +where + A: VMApi, +{ + type TestApiImpl = A::TestApiImpl; + + fn test_api_impl() -> Self::TestApiImpl { + A::test_api_impl() + } +} + impl VMApi for ExternalViewApi where A: VMApi, diff --git a/framework/base/src/api/test_api.rs b/framework/base/src/api/test_api.rs new file mode 100644 index 0000000000..46d76a86c5 --- /dev/null +++ b/framework/base/src/api/test_api.rs @@ -0,0 +1,104 @@ +use super::{ErrorApi, ErrorApiImpl, HandleTypeInfo, ManagedTypeApi}; + +const TEST_API_ERROR_MSG: &str = "cannot call the test API in this context"; + +pub trait TestApi: ManagedTypeApi + ErrorApi { + type TestApiImpl: TestApiImpl + + HandleTypeInfo< + ManagedBufferHandle = Self::ManagedBufferHandle, + BigIntHandle = Self::BigIntHandle, + BigFloatHandle = Self::BigFloatHandle, + EllipticCurveHandle = Self::EllipticCurveHandle, + >; + + fn test_api_impl() -> Self::TestApiImpl; +} + +#[allow(unused_variables)] +pub trait TestApiImpl: HandleTypeInfo + ErrorApi { + fn create_account( + &self, + address: Self::ManagedBufferHandle, + nonce: u64, + balance: Self::BigIntHandle, + ) { + Self::error_api_impl().signal_error(TEST_API_ERROR_MSG.as_bytes()); + } + + fn register_new_address( + &self, + owner: Self::ManagedBufferHandle, + nonce: u64, + new_address: Self::ManagedBufferHandle, + ) { + Self::error_api_impl().signal_error(TEST_API_ERROR_MSG.as_bytes()); + } + + // Deploy a contract whose code was previously fetched using "fetchWasmSource" in Mandos. + fn deploy_contract( + &self, + owner: Self::ManagedBufferHandle, + gas_limit: u64, + value: Self::BigIntHandle, + code_path: Self::ManagedBufferHandle, + arguments: Self::ManagedBufferHandle, + result_address_handle: Self::ManagedBufferHandle, + ) { + Self::error_api_impl().signal_error(TEST_API_ERROR_MSG.as_bytes()); + } + + // Set storage of any account + fn set_storage( + &self, + address: Self::ManagedBufferHandle, + key: Self::ManagedBufferHandle, + value: Self::ManagedBufferHandle, + ) { + Self::error_api_impl().signal_error(TEST_API_ERROR_MSG.as_bytes()); + } + + // Get storage of any account + fn get_storage( + &self, + address: Self::ManagedBufferHandle, + key: Self::ManagedBufferHandle, + result_value: Self::ManagedBufferHandle, + ) { + Self::error_api_impl().signal_error(TEST_API_ERROR_MSG.as_bytes()); + } + + // Start a prank: set the caller address for contract calls until stop_prank + fn start_prank(&self, address: Self::ManagedBufferHandle) { + Self::error_api_impl().signal_error(TEST_API_ERROR_MSG.as_bytes()); + } + + // Stop a prank: reset the caller address + fn stop_prank(&self) { + Self::error_api_impl().signal_error(TEST_API_ERROR_MSG.as_bytes()); + } + + fn assume(&self, p: bool) { + Self::error_api_impl().signal_error(TEST_API_ERROR_MSG.as_bytes()); + } + + fn assert(&self, p: bool) { + Self::error_api_impl().signal_error(TEST_API_ERROR_MSG.as_bytes()); + } + + fn set_block_timestamp(&self, timestamp: u64) { + Self::error_api_impl().signal_error(TEST_API_ERROR_MSG.as_bytes()); + } + + fn set_balance(&self, address: Self::ManagedBufferHandle, value: Self::BigIntHandle) { + Self::error_api_impl().signal_error(TEST_API_ERROR_MSG.as_bytes()); + } + + fn set_esdt_balance( + &self, + address: Self::ManagedBufferHandle, + token_id: Self::ManagedBufferHandle, + value: Self::BigIntHandle, + ) { + Self::error_api_impl().signal_error(TEST_API_ERROR_MSG.as_bytes()); + } +} diff --git a/framework/base/src/api/uncallable.rs b/framework/base/src/api/uncallable.rs index f666edc4db..2fa8a95523 100644 --- a/framework/base/src/api/uncallable.rs +++ b/framework/base/src/api/uncallable.rs @@ -17,6 +17,7 @@ mod print_api_uncallable; mod send_api_uncallable; mod static_var_api_uncallable; mod storage_api_uncallable; +mod test_api_uncallable; mod vm_api_uncallable; /// Dummy type with no implementation. diff --git a/framework/base/src/api/uncallable/test_api_uncallable.rs b/framework/base/src/api/uncallable/test_api_uncallable.rs new file mode 100644 index 0000000000..563c27e423 --- /dev/null +++ b/framework/base/src/api/uncallable/test_api_uncallable.rs @@ -0,0 +1,13 @@ +use crate::api::{TestApi, TestApiImpl}; + +use super::UncallableApi; + +impl TestApi for UncallableApi { + type TestApiImpl = Self; + + fn test_api_impl() -> Self::TestApiImpl { + unreachable!() + } +} + +impl TestApiImpl for UncallableApi {} diff --git a/framework/base/src/api/vm_api.rs b/framework/base/src/api/vm_api.rs index c7cac0daa2..7a39c24ee2 100644 --- a/framework/base/src/api/vm_api.rs +++ b/framework/base/src/api/vm_api.rs @@ -1,7 +1,7 @@ use super::{ BlockchainApi, CallTypeApi, CallValueApi, CryptoApi, EndpointArgumentApi, EndpointFinishApi, ErrorApi, LogApi, ManagedTypeApi, PrintApi, SendApi, StorageMapperApi, StorageReadApi, - StorageReadApiImpl, StorageWriteApi, + StorageReadApiImpl, StorageWriteApi, TestApi, }; pub trait VMApi: @@ -19,6 +19,7 @@ pub trait VMApi: + PrintApi + CallTypeApi + StorageMapperApi + + TestApi + Clone // TODO: remove + PartialEq // for helping derive PartialEq for managed types + Eq diff --git a/framework/base/src/contract_base/contract_base_trait.rs b/framework/base/src/contract_base/contract_base_trait.rs index cec45dfa0f..77088ae0fe 100644 --- a/framework/base/src/contract_base/contract_base_trait.rs +++ b/framework/base/src/contract_base/contract_base_trait.rs @@ -1,6 +1,6 @@ use super::{ BlockchainWrapper, CallValueWrapper, CryptoWrapper, ErrorHelper, ManagedSerializer, - SendRawWrapper, SendWrapper, StorageRawWrapper, + SendRawWrapper, SendWrapper, StorageRawWrapper, TestRawWrapper, }; use crate::api::VMApi; @@ -62,4 +62,9 @@ pub trait ContractBase: Sized { fn storage_raw(&self) -> StorageRawWrapper { StorageRawWrapper::new() } + + #[inline] + fn test_raw(&self) -> TestRawWrapper { + TestRawWrapper::new() + } } diff --git a/framework/base/src/contract_base/wrappers.rs b/framework/base/src/contract_base/wrappers.rs index 4a32bf0a7b..64a044f09b 100644 --- a/framework/base/src/contract_base/wrappers.rs +++ b/framework/base/src/contract_base/wrappers.rs @@ -7,6 +7,7 @@ mod send_raw_wrapper; mod send_wrapper; mod serializer; mod storage_raw_wrapper; +mod test_raw_wrapper; pub use blockchain_wrapper::BlockchainWrapper; pub use call_value_wrapper::CallValueWrapper; @@ -17,3 +18,4 @@ pub use send_raw_wrapper::SendRawWrapper; pub use send_wrapper::SendWrapper; pub use serializer::{ExitCodecErrorHandler, ManagedSerializer}; pub use storage_raw_wrapper::StorageRawWrapper; +pub use test_raw_wrapper::TestRawWrapper; diff --git a/framework/base/src/contract_base/wrappers/test_raw_wrapper.rs b/framework/base/src/contract_base/wrappers/test_raw_wrapper.rs new file mode 100644 index 0000000000..d3d0e58580 --- /dev/null +++ b/framework/base/src/contract_base/wrappers/test_raw_wrapper.rs @@ -0,0 +1,129 @@ +use core::marker::PhantomData; + +use crate::{ + api::{TestApi, TestApiImpl}, + types::{ + BigUint, ManagedAddress, ManagedArgBuffer, ManagedBuffer, ManagedType, TokenIdentifier, + }, +}; + +#[derive(Default)] +pub struct TestRawWrapper +where + A: TestApi, +{ + _phantom: PhantomData, +} + +impl TestRawWrapper +where + A: TestApi, +{ + pub fn new() -> Self { + TestRawWrapper { + _phantom: PhantomData, + } + } + + pub fn create_account(&self, address: &ManagedAddress, nonce: u64, balance: &BigUint) { + A::test_api_impl().create_account(address.get_handle(), nonce, balance.get_handle()); + } + + pub fn register_new_address( + self, + owner: &ManagedAddress, + nonce: u64, + new_address: &ManagedAddress, + ) { + A::test_api_impl().register_new_address( + owner.get_handle(), + nonce, + new_address.get_handle(), + ); + } + + // Deploy a contract whose code was previously fetched using "fetchWasmSource" in Mandos. + pub fn deploy_contract( + self, + owner: &ManagedAddress, + gas_limit: u64, + value: &BigUint, + code_path: &ManagedBuffer, + arguments: &ManagedArgBuffer, + ) -> ManagedAddress { + let dest = ManagedAddress::zero(); + + A::test_api_impl().deploy_contract( + owner.get_handle(), + gas_limit, + value.get_handle(), + code_path.get_handle(), + arguments.get_handle(), + dest.get_handle(), + ); + + dest + } + + // Set storage of any account + pub fn set_storage( + self, + address: &ManagedAddress, + key: &ManagedBuffer, + value: &ManagedBuffer, + ) { + A::test_api_impl().set_storage(address.get_handle(), key.get_handle(), value.get_handle()); + } + + // Get storage of any account + pub fn get_storage( + self, + address: &ManagedAddress, + key: &ManagedBuffer, + ) -> ManagedBuffer { + let dest = ManagedBuffer::new(); + + A::test_api_impl().get_storage(address.get_handle(), key.get_handle(), dest.get_handle()); + + dest + } + + // Start a prank: set the caller address for contract calls until stop_prank + pub fn start_prank(self, address: &ManagedAddress) { + A::test_api_impl().start_prank(address.get_handle()); + } + + // Stop a prank: reset the caller address + pub fn stop_prank(self) { + A::test_api_impl().stop_prank(); + } + + pub fn assume(self, p: bool) { + A::test_api_impl().assume(p); + } + + pub fn assert(self, p: bool) { + A::test_api_impl().assert(p); + } + + pub fn set_block_timestamp(self, timestamp: u64) { + A::test_api_impl().set_block_timestamp(timestamp); + } + + pub fn set_balance(self, address: &ManagedAddress, value: &BigUint) { + A::test_api_impl().set_balance(address.get_handle(), value.get_handle()); + } + + pub fn set_esdt_balance( + self, + address: &ManagedAddress, + token_id: &TokenIdentifier, + value: &BigUint, + ) { + A::test_api_impl().set_esdt_balance( + address.get_handle(), + token_id.get_handle(), + value.get_handle(), + ); + } +} diff --git a/framework/scenario/src/api/core_api_vh.rs b/framework/scenario/src/api/core_api_vh.rs index e6012be410..4a34aa381a 100644 --- a/framework/scenario/src/api/core_api_vh.rs +++ b/framework/scenario/src/api/core_api_vh.rs @@ -7,3 +7,4 @@ mod error_api_vh; mod log_api_vh; mod send_api_vh; mod storage_api_vh; +mod test_api_vh; diff --git a/framework/scenario/src/api/core_api_vh/test_api_vh.rs b/framework/scenario/src/api/core_api_vh/test_api_vh.rs new file mode 100644 index 0000000000..b613b61722 --- /dev/null +++ b/framework/scenario/src/api/core_api_vh/test_api_vh.rs @@ -0,0 +1,13 @@ +use multiversx_sc::api::{TestApi, TestApiImpl}; + +use crate::api::{VMHooksApi, VMHooksApiBackend}; + +impl TestApi for VMHooksApi { + type TestApiImpl = Self; + + fn test_api_impl() -> Self::TestApiImpl { + Self::api_impl() + } +} + +impl TestApiImpl for VMHooksApi {} diff --git a/framework/testapi/Cargo.toml b/framework/testapi/Cargo.toml deleted file mode 100644 index ecb045916b..0000000000 --- a/framework/testapi/Cargo.toml +++ /dev/null @@ -1,16 +0,0 @@ -[package] -name = "testapi" -version = "0.1.0" -edition = "2021" - -[dependencies] - -[dev-dependencies] -num-bigint = "0.4.2" - -[dependencies.multiversx-sc] -version = "0.43.4" -path = "../base" - -[lib] -path = "src/testapi.rs" diff --git a/framework/testapi/src/testapi.rs b/framework/testapi/src/testapi.rs deleted file mode 100644 index c955e35d9b..0000000000 --- a/framework/testapi/src/testapi.rs +++ /dev/null @@ -1,220 +0,0 @@ -#![no_std] - -multiversx_sc::imports!(); -multiversx_sc::derive_imports!(); - -#[allow(unused)] -extern "C" { - - fn createAccount( - addressHandle: i32, - nonce: i64, - balanceHandle: i32, - ); - - fn registerNewAddress( - ownerHandle: i32, - nonce: i64, - newAddressHandle: i32, - ); - - fn deployContract( - ownerHandle: i32, - gasLimit: i64, - valueHandle: i32, - codePathHandle: i32, - argumentsHandle: i32, - resultAddressHandle: i32, - ); - - fn setStorage( - addressHandle: i32, - keyHandle: i32, - valueHandle: i32, - ); - - fn getStorage( - addressHandle: i32, - keyHandle: i32, - dstHandle: i32, - ); - - fn assumeBool(p: bool); - fn assertBool(p: bool); - - fn startPrank(addressHandle: i32); - fn stopPrank(); - - fn setBlockTimestamp(timestamp: i64); - - fn setExternalBalance( - addressHandle: i32, - valueHandle: i32, - ); - - fn setESDTExternalBalance( - addressHandle: i32, - tokenIdHandle: i32, - valueHandle: i32, - ); -} - - -#[allow(unused)] -pub fn create_account( - address: &ManagedAddress, - nonce: u64, - balance: &BigUint, -) { - unsafe { - createAccount( - address.get_raw_handle(), - nonce as i64, - balance.get_raw_handle(), - ); - } -} - -#[allow(unused)] -pub fn register_new_address( - owner: &ManagedAddress, - nonce: u64, - new_address: &ManagedAddress, -) { - unsafe { - registerNewAddress( - owner.get_raw_handle(), - nonce as i64, - new_address.get_raw_handle(), - ); - } -} - -// Deploy a contract whose code was previously fetched using "fetchWasmSource" in Mandos. -#[allow(unused)] -pub fn deploy_contract( - owner: &ManagedAddress, - gas_limit: u64, - value: &BigUint, - code_path: &ManagedBuffer, - arguments: &ManagedArgBuffer, -) -> ManagedAddress { - unsafe { - let mut dest = ManagedAddress::zero(); - - deployContract( - owner.get_raw_handle(), - gas_limit as i64, - value.get_raw_handle(), - code_path.get_raw_handle(), - arguments.get_raw_handle(), - dest.get_raw_handle(), - ); - - dest - } - -} - -// Set storage of any account -#[allow(unused)] -pub fn set_storage( - address: &ManagedAddress, - key: &ManagedBuffer, - value: &ManagedBuffer, -) { - unsafe { - setStorage( - address.get_raw_handle(), - key.get_raw_handle(), - value.get_raw_handle(), - ); - } -} - - -// Get storage of any account -#[allow(unused)] -pub fn get_storage( - address: &ManagedAddress, - key: &ManagedBuffer, -) -> ManagedBuffer { - unsafe { - let mut dest = ManagedBuffer::new(); - - getStorage( - address.get_raw_handle(), - key.get_raw_handle(), - dest.get_raw_handle(), - ); - - dest - } -} - - -// Start a prank: set the caller address for contract calls until stop_prank -#[allow(unused)] -pub fn start_prank(address: &ManagedAddress) { - unsafe { - startPrank(address.get_raw_handle()); - } -} - -// Stop a prank: reset the caller address -#[allow(unused)] -pub fn stop_prank() { - unsafe { - stopPrank(); - } -} - -#[allow(unused)] -pub fn assume(p: bool) { - unsafe { - assumeBool(p); - } -} - -#[allow(unused)] -pub fn assert(p: bool) { - unsafe { - assertBool(p); - } -} - -#[allow(unused)] -pub fn set_block_timestamp(timestamp: u64) { - unsafe { - setBlockTimestamp(timestamp as i64); - } -} - -#[allow(unused)] -pub fn set_balance( - address: &ManagedAddress, - value: &BigUint, -) { - unsafe { - setExternalBalance( - address.get_raw_handle(), - value.get_raw_handle(), - ); - } -} - - -#[allow(unused)] -pub fn set_esdt_balance( - address: &ManagedAddress, - token_id: &TokenIdentifier, - value: &BigUint, -) { - unsafe { - setESDTExternalBalance( - address.get_raw_handle(), - token_id.get_raw_handle(), - value.get_raw_handle(), - ); - } -} diff --git a/framework/wasm-adapter/src/api/mod.rs b/framework/wasm-adapter/src/api.rs similarity index 94% rename from framework/wasm-adapter/src/api/mod.rs rename to framework/wasm-adapter/src/api.rs index cde7d89e6b..f4fde42cef 100644 --- a/framework/wasm-adapter/src/api/mod.rs +++ b/framework/wasm-adapter/src/api.rs @@ -9,6 +9,7 @@ mod managed_types; mod print_api_node; mod send_api_node; mod storage_api_node; +mod test_api_node; mod unsafe_buffer; mod vm_api_node; diff --git a/framework/wasm-adapter/src/api/test_api_node.rs b/framework/wasm-adapter/src/api/test_api_node.rs new file mode 100644 index 0000000000..f8c007854b --- /dev/null +++ b/framework/wasm-adapter/src/api/test_api_node.rs @@ -0,0 +1,170 @@ +use super::VmApiImpl; +use multiversx_sc::api::{TestApi, TestApiImpl}; + +extern "C" { + + fn createAccount(addressHandle: i32, nonce: i64, balanceHandle: i32); + + fn registerNewAddress(ownerHandle: i32, nonce: i64, newAddressHandle: i32); + + fn deployContract( + ownerHandle: i32, + gasLimit: i64, + valueHandle: i32, + codePathHandle: i32, + argumentsHandle: i32, + resultAddressHandle: i32, + ); + + fn setStorage(addressHandle: i32, keyHandle: i32, valueHandle: i32); + + fn getStorage(addressHandle: i32, keyHandle: i32, dstHandle: i32); + + fn assumeBool(p: bool); + fn assertBool(p: bool); + + fn startPrank(addressHandle: i32); + fn stopPrank(); + + fn setBlockTimestamp(timestamp: i64); + + fn setExternalBalance(addressHandle: i32, valueHandle: i32); + + fn setESDTExternalBalance(addressHandle: i32, tokenIdHandle: i32, valueHandle: i32); +} + +impl TestApi for VmApiImpl { + type TestApiImpl = VmApiImpl; + + #[inline] + fn test_api_impl() -> Self::TestApiImpl { + VmApiImpl {} + } +} + +impl TestApiImpl for VmApiImpl { + fn create_account( + &self, + address: Self::ManagedBufferHandle, + nonce: u64, + balance: Self::BigIntHandle, + ) { + unsafe { + createAccount(address, nonce as i64, balance); + } + } + + fn register_new_address( + &self, + owner: Self::ManagedBufferHandle, + nonce: u64, + new_address: Self::ManagedBufferHandle, + ) { + unsafe { + registerNewAddress(owner, nonce as i64, new_address); + } + } + + // Deploy a contract whose code was previously fetched using "fetchWasmSource" in Mandos. + fn deploy_contract( + &self, + owner: Self::ManagedBufferHandle, + gas_limit: u64, + value: Self::BigIntHandle, + code_path: Self::ManagedBufferHandle, + arguments: Self::ManagedBufferHandle, + result_address_handle: Self::ManagedBufferHandle, + ) { + unsafe { + // let mut dest = ManagedAddress::zero(); + + deployContract( + owner, + gas_limit as i64, + value, + code_path, + arguments, + result_address_handle, + ); + + // dest + } + } + + // Set storage of any account + fn set_storage( + &self, + address: Self::ManagedBufferHandle, + key: Self::ManagedBufferHandle, + value: Self::ManagedBufferHandle, + ) { + unsafe { + setStorage(address, key, value); + } + } + + // Get storage of any account + fn get_storage( + &self, + address: Self::ManagedBufferHandle, + key: Self::ManagedBufferHandle, + result_value: Self::ManagedBufferHandle, + ) { + unsafe { + // let mut dest = ManagedBuffer::new(); + + getStorage(address, key, result_value); + + // dest + } + } + + // Start a prank: set the caller address for contract calls until stop_prank + fn start_prank(&self, address: Self::ManagedBufferHandle) { + unsafe { + startPrank(address); + } + } + + // Stop a prank: reset the caller address + fn stop_prank(&self) { + unsafe { + stopPrank(); + } + } + + fn assume(&self, p: bool) { + unsafe { + assumeBool(p); + } + } + + fn assert(&self, p: bool) { + unsafe { + assertBool(p); + } + } + + fn set_block_timestamp(&self, timestamp: u64) { + unsafe { + setBlockTimestamp(timestamp as i64); + } + } + + fn set_balance(&self, address: Self::ManagedBufferHandle, value: Self::BigIntHandle) { + unsafe { + setExternalBalance(address, value); + } + } + + fn set_esdt_balance( + &self, + address: Self::ManagedBufferHandle, + token_id: Self::ManagedBufferHandle, + value: Self::BigIntHandle, + ) { + unsafe { + setESDTExternalBalance(address, token_id, value); + } + } +} From 0dbfea2d444b9fceaa4cb2c24da0ae094a7f2b01 Mon Sep 17 00:00:00 2001 From: Andrei Marinica Date: Sun, 8 Oct 2023 18:40:31 +0300 Subject: [PATCH 03/20] fmt --- .../foundry/addercaller/src/addercaller.rs | 13 ++- contracts/foundry/callee/src/callee.rs | 3 +- contracts/foundry/caller/src/caller.rs | 42 +++++---- .../foundry/foundrylike/src/test_adder.rs | 57 ++++++------- .../test_multisig/src/test_multisig.rs | 85 ++++++++++--------- .../foundry/test_testapi/src/test_testapi.rs | 50 ++++++----- 6 files changed, 131 insertions(+), 119 deletions(-) diff --git a/contracts/foundry/addercaller/src/addercaller.rs b/contracts/foundry/addercaller/src/addercaller.rs index 3738ddf592..058cbcc71a 100644 --- a/contracts/foundry/addercaller/src/addercaller.rs +++ b/contracts/foundry/addercaller/src/addercaller.rs @@ -1,6 +1,6 @@ // A smart contract to test transfer & execute functions // Initialize the contract with the address of the adder -// The endpoints `call_adder` and `call_adder_esdt` accepts +// The endpoints `call_adder` and `call_adder_esdt` accepts // tokens in EGLD and ESDT and performs transfer & execute // to the adder's `add` endpoint. @@ -12,7 +12,6 @@ multiversx_sc::imports!(); /// it holds a single variable in storage, which anyone can increment. #[multiversx_sc::contract] pub trait AdderCaller { - #[storage_mapper("dest")] fn dest(&self) -> SingleValueMapper; @@ -23,7 +22,7 @@ pub trait AdderCaller { #[endpoint] #[payable("EGLD")] - fn call_adder(&self, value: BigUint) -> ManagedBuffer { + fn call_adder(&self, value: BigUint) -> ManagedBuffer { let mut arg_buffer = ManagedArgBuffer::new(); arg_buffer.push_arg(value); @@ -37,13 +36,13 @@ pub trait AdderCaller { match result { Result::Err(e) => sc_panic!(e), - Result::Ok(_) => ManagedBuffer::from("added") + Result::Ok(_) => ManagedBuffer::from("added"), } } #[endpoint] #[payable("MYESDT")] - fn call_adder_esdt(&self, value: BigUint) -> ManagedBuffer { + fn call_adder_esdt(&self, value: BigUint) -> ManagedBuffer { let mut arg_buffer = ManagedArgBuffer::new(); arg_buffer.push_arg(value); @@ -58,9 +57,9 @@ pub trait AdderCaller { match result { Result::Err(e) => sc_panic!(e), - Result::Ok(_) => ManagedBuffer::from("added-esdt") + Result::Ok(_) => ManagedBuffer::from("added-esdt"), } } } -// \ No newline at end of file +// diff --git a/contracts/foundry/callee/src/callee.rs b/contracts/foundry/callee/src/callee.rs index 5a93a14c0c..784f1755cf 100644 --- a/contracts/foundry/callee/src/callee.rs +++ b/contracts/foundry/callee/src/callee.rs @@ -10,8 +10,7 @@ pub trait CalleeContract { #[endpoint] #[payable("EGLD")] fn fail_if_neg(&self, value: i64) -> ManagedBuffer { - - require!( value >= 0 , "negative" ); + require!(value >= 0, "negative"); if value == 0 { ManagedBuffer::from("zero") diff --git a/contracts/foundry/caller/src/caller.rs b/contracts/foundry/caller/src/caller.rs index 16b8bac567..264c578b37 100644 --- a/contracts/foundry/caller/src/caller.rs +++ b/contracts/foundry/caller/src/caller.rs @@ -4,37 +4,40 @@ multiversx_sc::imports!(); #[multiversx_sc::contract] pub trait CallerContract { - - #[init] - fn init(&self) { - } + fn init(&self) {} #[endpoint] #[payable("EGLD")] - fn call_other(&self, dest: ManagedAddress, func: ManagedBuffer, value: i64, to_send: BigUint) -> ManagedBuffer { - + fn call_other( + &self, + dest: ManagedAddress, + func: ManagedBuffer, + value: i64, + to_send: BigUint, + ) -> ManagedBuffer { let mut arg_buffer = ManagedArgBuffer::new(); arg_buffer.push_arg(value); - let result = self.send_raw().direct_egld_execute( - &dest, - &to_send, - 5000000, - &func, - &arg_buffer, - ); + let result = + self.send_raw() + .direct_egld_execute(&dest, &to_send, 5000000, &func, &arg_buffer); match result { Result::Err(_) => ManagedBuffer::from("failed"), - Result::Ok(_) => ManagedBuffer::from("done") + Result::Ok(_) => ManagedBuffer::from("done"), } } #[endpoint] #[payable("EGLD")] - fn call_other_exec_on_dest_ctx(&self, dest: ManagedAddress, func: ManagedBuffer, value: i64, to_send: BigUint) -> ManagedBuffer { - + fn call_other_exec_on_dest_ctx( + &self, + dest: ManagedAddress, + func: ManagedBuffer, + value: i64, + to_send: BigUint, + ) -> ManagedBuffer { let mut arg_buffer = ManagedArgBuffer::new(); arg_buffer.push_arg(value); @@ -45,8 +48,11 @@ pub trait CallerContract { &func, &arg_buffer, ); - - require!(result.len() == 1, "ExecuteOnDestContext result data is empty"); + + require!( + result.len() == 1, + "ExecuteOnDestContext result data is empty" + ); ManagedBuffer::from("done") } diff --git a/contracts/foundry/foundrylike/src/test_adder.rs b/contracts/foundry/foundrylike/src/test_adder.rs index 1448b1465c..48cfb1b82d 100644 --- a/contracts/foundry/foundrylike/src/test_adder.rs +++ b/contracts/foundry/foundrylike/src/test_adder.rs @@ -2,10 +2,9 @@ multiversx_sc::imports!(); -static INIT_SUM : u32 = 5u32; +static INIT_SUM: u32 = 5u32; #[multiversx_sc::contract] pub trait TestAdder { - #[storage_mapper("ownerAddress")] fn owner_address(&self) -> SingleValueMapper; @@ -15,16 +14,16 @@ pub trait TestAdder { /// Create the owner account and deploy adder #[init] fn init(&self, code_path: ManagedBuffer) { - // create the owner account let owner = ManagedAddress::from(b"owner___________________________"); self.owner_address().set(&owner); - - self.test_raw().create_account(&owner, 1, &BigUint::from(0u64)); - + + self.test_raw() + .create_account(&owner, 1, &BigUint::from(0u64)); + // register an address for the contract to be deployed let adder = ManagedAddress::from(b"adder___________________________"); - self.test_raw().register_new_address(&owner, 1, &adder, ); + self.test_raw().register_new_address(&owner, 1, &adder); // deploy the adder contract let mut adder_init_args = ManagedArgBuffer::new(); @@ -32,27 +31,27 @@ pub trait TestAdder { // deploy a contract from `owner` let adder = self.test_raw().deploy_contract( - &owner, - 5000000000000, - &BigUint::zero(), - &code_path, - &adder_init_args, - ); + &owner, + 5000000000000, + &BigUint::zero(), + &code_path, + &adder_init_args, + ); // save the deployed contract's address self.adder_address().set(&adder); // check the initial sum value - let sum_as_bytes = self.test_raw().get_storage(&adder, &ManagedBuffer::from(b"sum")); + let sum_as_bytes = self + .test_raw() + .get_storage(&adder, &ManagedBuffer::from(b"sum")); let sum = BigUint::from(sum_as_bytes); - self.test_raw().assert( sum == INIT_SUM ); - + self.test_raw().assert(sum == INIT_SUM); } // Make a call from 'owner' to 'adder' and check the sum value #[endpoint(test_call_add)] fn test_call_add(&self, value: BigUint) { - self.test_raw().assume(value <= 100u32); let adder = self.adder_address().get(); @@ -60,15 +59,15 @@ pub trait TestAdder { self.call_add(&value); // check the sum value - let sum_as_bytes = self.test_raw().get_storage(&adder, &ManagedBuffer::from(b"sum")); + let sum_as_bytes = self + .test_raw() + .get_storage(&adder, &ManagedBuffer::from(b"sum")); let sum = BigUint::from(sum_as_bytes); - self.test_raw().assert( sum == (value + INIT_SUM) ); - + self.test_raw().assert(sum == (value + INIT_SUM)); } #[endpoint(test_call_add_twice)] fn test_call_add_twice(&self, value1: BigUint, value2: BigUint) { - self.test_raw().assume(value1 <= 100u32); self.test_raw().assume(value2 <= 100u32); @@ -78,10 +77,11 @@ pub trait TestAdder { self.call_add(&value2); // check the sum value - let sum_as_bytes = self.test_raw().get_storage(&adder, &ManagedBuffer::from(b"sum")); + let sum_as_bytes = self + .test_raw() + .get_storage(&adder, &ManagedBuffer::from(b"sum")); let sum = BigUint::from(sum_as_bytes); - self.test_raw().assert( sum == (value1 + value2 + INIT_SUM) ); - + self.test_raw().assert(sum == (value1 + value2 + INIT_SUM)); } fn call_add(&self, value: &BigUint) { @@ -94,9 +94,9 @@ pub trait TestAdder { // start a prank and call 'adder' from 'owner' self.test_raw().start_prank(&owner); let res = self.send_raw().direct_egld_execute( - &adder, - &BigUint::from(0u32), - 5000000, + &adder, + &BigUint::from(0u32), + 5000000, &ManagedBuffer::from(b"add"), &adder_init_args, ); @@ -104,8 +104,7 @@ pub trait TestAdder { match res { Result::Err(_) => panic!("call failed"), - Result::Ok(_) => () + Result::Ok(_) => (), }; - } } diff --git a/contracts/foundry/test_multisig/src/test_multisig.rs b/contracts/foundry/test_multisig/src/test_multisig.rs index 434750d443..0baf5eb0c8 100644 --- a/contracts/foundry/test_multisig/src/test_multisig.rs +++ b/contracts/foundry/test_multisig/src/test_multisig.rs @@ -2,44 +2,42 @@ multiversx_sc::imports!(); -static OWNER : &[u8; 32] = b"owner___________________________"; -static ALICE : &[u8; 32] = b"alice___________________________"; -static BOB : &[u8; 32] = b"bob_____________________________"; -static CHARLIE : &[u8; 32] = b"charlie_________________________"; -static MULTISIG : &[u8; 32] = b"multisig________________________"; +static OWNER: &[u8; 32] = b"owner___________________________"; +static ALICE: &[u8; 32] = b"alice___________________________"; +static BOB: &[u8; 32] = b"bob_____________________________"; +static CHARLIE: &[u8; 32] = b"charlie_________________________"; +static MULTISIG: &[u8; 32] = b"multisig________________________"; #[multiversx_sc::contract] pub trait TestMultisigContract { - #[init] fn init(&self, code_path: ManagedBuffer) { - self.init_accounts(); self.deploy(&code_path); - } - fn init_accounts(&self) { let owner = ManagedAddress::from(OWNER); - self.test_raw().create_account(&owner, 0, &BigUint::from(0u64)); - self.test_raw().create_account(&ManagedAddress::from(ALICE), 0, &BigUint::from(0u64)); - self.test_raw().create_account(&ManagedAddress::from(BOB), 0, &BigUint::from(0u64)); - self.test_raw().create_account(&ManagedAddress::from(CHARLIE), 0, &BigUint::from(0u64)); - + self.test_raw() + .create_account(&owner, 0, &BigUint::from(0u64)); + self.test_raw() + .create_account(&ManagedAddress::from(ALICE), 0, &BigUint::from(0u64)); + self.test_raw() + .create_account(&ManagedAddress::from(BOB), 0, &BigUint::from(0u64)); + self.test_raw() + .create_account(&ManagedAddress::from(CHARLIE), 0, &BigUint::from(0u64)); + let multisig = ManagedAddress::from(MULTISIG); self.test_raw().register_new_address(&owner, 0, &multisig); - } fn deploy(&self, code_path: &ManagedBuffer) { - let mut init_args = ManagedArgBuffer::new(); - init_args.push_arg(2); // quorum = 2 - init_args.push_arg(ManagedAddress::from(ALICE)); // board members = alice, bob, charlie + init_args.push_arg(2); // quorum = 2 + init_args.push_arg(ManagedAddress::from(ALICE)); // board members = alice, bob, charlie init_args.push_arg(ManagedAddress::from(BOB)); init_args.push_arg(ManagedAddress::from(CHARLIE)); - + let multisig = self.test_raw().deploy_contract( &ManagedAddress::from(OWNER), 5000000000000, @@ -48,18 +46,22 @@ pub trait TestMultisigContract { &init_args, ); - self.test_raw().assert( self.get_quorum(&multisig) == 2u32 ); - self.test_raw().assert( self.get_num_board_members(&multisig) == 3u32 ); - + self.test_raw().assert(self.get_quorum(&multisig) == 2u32); + self.test_raw() + .assert(self.get_num_board_members(&multisig) == 3u32); } fn get_quorum(&self, multisig: &ManagedAddress) -> BigUint { - let bs = self.test_raw().get_storage(&multisig, &ManagedBuffer::from(b"quorum")); + let bs = self + .test_raw() + .get_storage(&multisig, &ManagedBuffer::from(b"quorum")); BigUint::from(bs) } fn get_num_board_members(&self, multisig: &ManagedAddress) -> BigUint { - let bs = self.test_raw().get_storage(&multisig, &ManagedBuffer::from(b"num_board_members")); + let bs = self + .test_raw() + .get_storage(&multisig, &ManagedBuffer::from(b"num_board_members")); BigUint::from(bs) } @@ -68,33 +70,37 @@ pub trait TestMultisigContract { let multisig = ManagedAddress::from(MULTISIG); let alice = ManagedAddress::from(ALICE); let bob = ManagedAddress::from(BOB); - + // make assumptions - self.test_raw().assume(value <= self.get_num_board_members(&multisig)); - + self.test_raw() + .assume(value <= self.get_num_board_members(&multisig)); self.change_quorum_propose(&multisig, &alice, &value); self.change_quorum_sign(&multisig, &bob); self.perform_action(&multisig, &alice); - + // check the final quorum self.test_raw().assert(value == self.get_quorum(&multisig)); } - fn change_quorum_propose(&self, multisig: &ManagedAddress, proposer: &ManagedAddress, value: &BigUint) { + fn change_quorum_propose( + &self, + multisig: &ManagedAddress, + proposer: &ManagedAddress, + value: &BigUint, + ) { let mut args = ManagedArgBuffer::new(); args.push_arg(value); self.test_raw().start_prank(&proposer); let _ = self.send_raw().direct_egld_execute( - &multisig, - &BigUint::from(0u32), - 5000000, + &multisig, + &BigUint::from(0u32), + 5000000, &ManagedBuffer::from(b"proposeChangeQuorum"), &args, ); self.test_raw().stop_prank(); - } fn change_quorum_sign(&self, multisig: &ManagedAddress, signer: &ManagedAddress) { @@ -103,14 +109,13 @@ pub trait TestMultisigContract { self.test_raw().start_prank(signer); let _ = self.send_raw().direct_egld_execute( - &multisig, - &BigUint::from(0u32), - 5000000, + &multisig, + &BigUint::from(0u32), + 5000000, &ManagedBuffer::from(b"sign"), &args, ); self.test_raw().stop_prank(); - } fn perform_action(&self, multisig: &ManagedAddress, performer: &ManagedAddress) { @@ -120,13 +125,11 @@ pub trait TestMultisigContract { self.test_raw().start_prank(performer); let _ = self.send_raw().direct_egld_execute( &multisig, - &BigUint::from(0u32), - 5000000, + &BigUint::from(0u32), + 5000000, &ManagedBuffer::from(b"performAction"), &args, ); self.test_raw().stop_prank(); - } - } diff --git a/contracts/foundry/test_testapi/src/test_testapi.rs b/contracts/foundry/test_testapi/src/test_testapi.rs index 599eaab605..64a34ae44c 100644 --- a/contracts/foundry/test_testapi/src/test_testapi.rs +++ b/contracts/foundry/test_testapi/src/test_testapi.rs @@ -4,12 +4,12 @@ multiversx_sc::imports!(); #[multiversx_sc::contract] pub trait TestTestapi { - #[init] fn init(&self) { let alice = ManagedAddress::from(b"alice___________________________"); - self.test_raw().create_account(&alice, 1, &BigUint::from(0u64)); - + self.test_raw() + .create_account(&alice, 1, &BigUint::from(0u64)); + self.test_set_balance(&alice); self.test_set_esdt_balance(&alice); self.test_set_timestamp(); @@ -24,10 +24,12 @@ pub trait TestTestapi { self.test_raw().set_balance(addr, &value); // Expect - let actual = self.blockchain() - .get_balance(addr); + let actual = self.blockchain().get_balance(addr); - require!(value == actual, "Actual balance does not match the given value"); + require!( + value == actual, + "Actual balance does not match the given value" + ); } fn test_set_esdt_balance(&self, addr: &ManagedAddress) { @@ -39,10 +41,12 @@ pub trait TestTestapi { self.test_raw().set_esdt_balance(addr, &token, &value); // Expect - let actual = self.blockchain() - .get_esdt_balance(addr, &token, 0u64); + let actual = self.blockchain().get_esdt_balance(addr, &token, 0u64); - require!(value == actual, "Actual esdt balance does not match the given value"); + require!( + value == actual, + "Actual esdt balance does not match the given value" + ); } fn test_set_timestamp(&self) { @@ -54,22 +58,24 @@ pub trait TestTestapi { // Expect require!( - value == self.blockchain().get_block_timestamp(), - "Actual timestamp does not match the given value" + value == self.blockchain().get_block_timestamp(), + "Actual timestamp does not match the given value" ); } fn test_set_get_storage(&self, addr: &ManagedAddress) { - // Given - let key = ManagedBuffer::from(b"a_storage_key"); - let value = ManagedBuffer::from(b"a storage value"); - - // When - self.test_raw().set_storage(addr, &key, &value); - - // Expect - let actual = self.test_raw().get_storage(addr, &key); - require!(actual == value, "Actual storage does not match the given value"); + // Given + let key = ManagedBuffer::from(b"a_storage_key"); + let value = ManagedBuffer::from(b"a storage value"); + + // When + self.test_raw().set_storage(addr, &key, &value); + + // Expect + let actual = self.test_raw().get_storage(addr, &key); + require!( + actual == value, + "Actual storage does not match the given value" + ); } - } From 0023a8ae89fd4a0801cc7b627ef974aefb5001cb Mon Sep 17 00:00:00 2001 From: Andrei Marinica Date: Sun, 8 Oct 2023 18:46:50 +0300 Subject: [PATCH 04/20] cargo update --- Cargo.lock | 343 ++++++++++++++++++++++++++++------------------------- 1 file changed, 181 insertions(+), 162 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e8bee9eb9d..a1930f29a5 100755 --- a/Cargo.lock +++ b/Cargo.lock @@ -45,7 +45,7 @@ dependencies = [ "clap", "multiversx-sc-snippets", "serde", - "toml 0.7.6", + "toml 0.7.8", ] [[package]] @@ -112,9 +112,9 @@ dependencies = [ [[package]] name = "aho-corasick" -version = "1.0.4" +version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6748e8def348ed4d14996fa801f4122cd763fff530258cdc03f64b25f89d3a5a" +checksum = "ea5d730647d4fadd988536d06fecce94b7b4f2a7efdae548f1cf4b63205518ab" dependencies = [ "memchr", ] @@ -138,9 +138,9 @@ dependencies = [ [[package]] name = "anstream" -version = "0.5.0" +version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1f58811cfac344940f1a400b6e6231ce35171f614f26439e80f8c1465c5cc0c" +checksum = "2ab91ebe16eb252986481c5b62f6098f3b698a45e34b5b98200cf20dd2484a44" dependencies = [ "anstyle", "anstyle-parse", @@ -152,15 +152,15 @@ dependencies = [ [[package]] name = "anstyle" -version = "1.0.2" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15c4c2c83f81532e5845a733998b6971faca23490340a418e9b72a3ec9de12ea" +checksum = "7079075b41f533b8c61d2a4d073c4676e1f8b249ff94a393b0595db304e0dd87" [[package]] name = "anstyle-parse" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "938874ff5980b03a87c5524b3ae5b59cf99b1d6bc836848df7bc5ada9643c333" +checksum = "317b9a89c1868f5ea6ff1d9539a69f45dffc21ce321ac1fd1160dfa48c8e2140" dependencies = [ "utf8parse", ] @@ -176,9 +176,9 @@ dependencies = [ [[package]] name = "anstyle-wincon" -version = "2.1.0" +version = "3.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58f54d10c6dfa51283a066ceab3ec1ab78d13fae00aa49243a45e4571fb79dfd" +checksum = "f0699d10d2f4d628a98ee7b57b289abbc98ff3bad977cb3152709d4bf2330628" dependencies = [ "anstyle", "windows-sys", @@ -236,9 +236,9 @@ checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" [[package]] name = "base64" -version = "0.21.2" +version = "0.21.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "604178f6c5c21f02dc555784810edfb88d34ac2c73b2eae109655649ee73ce3d" +checksum = "9ba43ea6f343b788c8764558649e08df62f86c6ef251fdaeb1ffd010a9ae50a2" [[package]] name = "base64ct" @@ -264,7 +264,7 @@ dependencies = [ "clap", "multiversx-sc-snippets", "serde", - "toml 0.7.6", + "toml 0.7.8", ] [[package]] @@ -381,9 +381,9 @@ dependencies = [ [[package]] name = "bstr" -version = "1.6.0" +version = "1.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6798148dccfbff0fae41c7574d2fa8f1ef3492fba0face179de5d8d447d67b05" +checksum = "4c2f7349907b712260e64b0afe2f84692af14a454be26187d9df565c7f69266a" dependencies = [ "memchr", "serde", @@ -407,21 +407,21 @@ dependencies = [ [[package]] name = "bumpalo" -version = "3.13.0" +version = "3.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3e2c3daef883ecc1b5d58c15adae93470a91d425f3532ba1695849656af3fc1" +checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec" [[package]] name = "byteorder" -version = "1.4.3" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "bytes" -version = "1.4.0" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89b2fd2a0dcf38d7971e2194b6b6eebab45ae01067456a7fd93d5547a61b70be" +checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223" [[package]] name = "bzip2" @@ -541,38 +541,36 @@ dependencies = [ [[package]] name = "clap" -version = "4.4.0" +version = "4.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d5f1946157a96594eb2d2c10eb7ad9a2b27518cb3000209dec700c35df9197d" +checksum = "d04704f56c2cde07f43e8e2c154b43f216dc5c92fc98ada720177362f953b956" dependencies = [ "clap_builder", "clap_derive", - "once_cell", ] [[package]] name = "clap_builder" -version = "4.4.0" +version = "4.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78116e32a042dd73c2901f0dc30790d20ff3447f3e3472fad359e8c3d282bcd6" +checksum = "0e231faeaca65ebd1ea3c737966bf858971cd38c3849107aa3ea7de90a804e45" dependencies = [ "anstream", "anstyle", "clap_lex", - "once_cell", "strsim", ] [[package]] name = "clap_derive" -version = "4.4.0" +version = "4.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9fd1a5729c4548118d7d70ff234a44868d00489a4b6597b0b020918a0e91a1a" +checksum = "0862016ff20d69b84ef8247369fabf5c008a7417002411897d40ee1f4532b873" dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.29", + "syn 2.0.38", ] [[package]] @@ -796,9 +794,9 @@ dependencies = [ [[package]] name = "curve25519-dalek" -version = "4.0.0" +version = "4.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f711ade317dd348950a9910f81c5947e3d8907ebd2b83f76203ff1807e6a2bc2" +checksum = "e89b8c6a2e4b1f45971ad09761aafb85514a84744b67a95e32c3cc1352d1f65c" dependencies = [ "cfg-if", "cpufeatures", @@ -819,7 +817,7 @@ checksum = "83fdaf97f4804dcebfa5862639bc9ce4121e82140bec2a987ac5140294865b5b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.29", + "syn 2.0.38", ] [[package]] @@ -842,7 +840,7 @@ dependencies = [ "ident_case", "proc-macro2", "quote", - "syn 2.0.29", + "syn 2.0.38", ] [[package]] @@ -853,7 +851,7 @@ checksum = "836a9bbc7ad63342d6d6e7b815ccab164bc77a2d95d84bc3117a8c0d5c98e2d5" dependencies = [ "darling_core", "quote", - "syn 2.0.29", + "syn 2.0.38", ] [[package]] @@ -947,10 +945,10 @@ version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7277392b266383ef8396db7fdeb1e77b6c52fed775f5df15bb24f35b72156980" dependencies = [ - "curve25519-dalek 4.0.0", + "curve25519-dalek 4.1.1", "ed25519 2.2.2", "serde", - "sha2 0.10.7", + "sha2 0.10.8", "zeroize", ] @@ -1010,7 +1008,7 @@ dependencies = [ "darling", "proc-macro2", "quote", - "syn 2.0.29", + "syn 2.0.38", ] [[package]] @@ -1116,9 +1114,9 @@ dependencies = [ [[package]] name = "errno" -version = "0.3.2" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b30f669a7961ef1631673d2766cc92f52d64f7ef354d4fe0ddfd30ed52f0f4f" +checksum = "add4f07d43996f76ef320709726a556a9d4f965d9410d8d0271132d2f8293480" dependencies = [ "errno-dragonfly", "libc", @@ -1203,15 +1201,15 @@ dependencies = [ [[package]] name = "fastrand" -version = "2.0.0" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6999dc1837253364c2ebb0704ba97994bd874e8f195d665c50b7548f6ea92764" +checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5" [[package]] name = "fiat-crypto" -version = "0.1.20" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e825f6987101665dea6ec934c09ec6d721de7bc1bf92248e1d5810c8cd636b77" +checksum = "d0870c84016d4b481be5c9f323c24f65e31e901ae618f0e80f4308fb00de1d2d" [[package]] name = "first-contract" @@ -1410,7 +1408,7 @@ checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72" dependencies = [ "proc-macro2", "quote", - "syn 2.0.29", + "syn 2.0.38", ] [[package]] @@ -1530,9 +1528,9 @@ dependencies = [ [[package]] name = "hashbrown" -version = "0.14.0" +version = "0.14.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c6201b9ff9fd90a5a3bac2e56a830d0caa509576f0e503818ee82c181b3437a" +checksum = "7dfda62a12f55daeae5015f81b0baea145391cb4520f86c248fc615d72640d12" [[package]] name = "heck" @@ -1551,9 +1549,9 @@ dependencies = [ [[package]] name = "hermit-abi" -version = "0.3.2" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "443144c8cdadd93ebf52ddb4056d257f5b52c04d3c804e657d19eb73fc33668b" +checksum = "d77f7ec81a6d05a3abb01ab6eb7590f6083d08449fe5a1c8b1e620283546ccb7" [[package]] name = "hex" @@ -1708,12 +1706,12 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.0.0" +version = "2.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d5477fe2230a79769d8dc68e0eabf5437907c0457a5614a9e8dddb67f65eb65d" +checksum = "8adf3ddd720272c6ea8bf59463c04e0f93d0bbf7c5439b691bca2987e0270897" dependencies = [ "equivalent", - "hashbrown 0.14.0", + "hashbrown 0.14.1", ] [[package]] @@ -1735,7 +1733,7 @@ dependencies = [ "multiversx-sc-snippets", "promises-features", "serde", - "toml 0.7.6", + "toml 0.7.8", "vault", ] @@ -1751,7 +1749,7 @@ version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b" dependencies = [ - "hermit-abi 0.3.2", + "hermit-abi 0.3.3", "rustix", "windows-sys", ] @@ -1885,9 +1883,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.147" +version = "0.2.149" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3" +checksum = "a08173bc88b7955d1b3145aa561539096c421ac8debde8cbc3612ec635fee29b" [[package]] name = "linked-list-repeat" @@ -1908,9 +1906,9 @@ dependencies = [ [[package]] name = "linux-raw-sys" -version = "0.4.5" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57bcfdad1b858c2db7c38303a6d2ad4dfaf5eb53dfeb0910128b2c26d6158503" +checksum = "45786cec4d5e54a224b15cb9f06751883103a27c19c93eda09b0b4f5f08fefac" [[package]] name = "local-esdt-and-nft" @@ -2013,9 +2011,9 @@ dependencies = [ [[package]] name = "memchr" -version = "2.5.0" +version = "2.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" +checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167" [[package]] name = "mime" @@ -2084,7 +2082,7 @@ dependencies = [ "multiversx-sc-scenario 0.43.4", "multiversx-sc-snippets", "serde", - "toml 0.7.6", + "toml 0.7.8", ] [[package]] @@ -2142,7 +2140,7 @@ dependencies = [ "rand_seeder", "serde", "serde_json", - "sha2 0.10.7", + "sha2 0.10.8", "sha3 0.10.8", ] @@ -2160,7 +2158,7 @@ dependencies = [ "num-traits", "rand 0.8.5", "rand_seeder", - "sha2 0.10.7", + "sha2 0.10.8", "sha3 0.10.8", ] @@ -2361,7 +2359,7 @@ dependencies = [ "pathdiff", "serde", "serde_json", - "sha2 0.10.7", + "sha2 0.10.8", ] [[package]] @@ -2386,7 +2384,7 @@ dependencies = [ "pathdiff", "serde", "serde_json", - "sha2 0.10.7", + "sha2 0.10.8", "tokio", ] @@ -2519,16 +2517,16 @@ dependencies = [ name = "nft-subscription" version = "0.0.0" dependencies = [ - "multiversx-sc", + "multiversx-sc 0.43.4", "multiversx-sc-modules", - "multiversx-sc-scenario", + "multiversx-sc-scenario 0.43.4", ] [[package]] name = "nft-subscription-meta" version = "0.0.0" dependencies = [ - "multiversx-sc-meta", + "multiversx-sc-meta 0.43.4", "nft-subscription", ] @@ -2564,9 +2562,9 @@ dependencies = [ [[package]] name = "num-traits" -version = "0.2.16" +version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f30b0abd723be7e2ffca1272140fac1a2f084c77ec3e123c192b66af1ee9e6c2" +checksum = "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c" dependencies = [ "autocfg", ] @@ -2577,15 +2575,15 @@ version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" dependencies = [ - "hermit-abi 0.3.2", + "hermit-abi 0.3.3", "libc", ] [[package]] name = "object" -version = "0.32.0" +version = "0.32.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77ac5bbd07aea88c60a577a1ce218075ffd59208b2d7ca97adf9bfc5aeb21ebe" +checksum = "9cf5f9dd3933bd50a9e1f149ec995f39ae2c496d31fd772c1fd45ebc27e902b0" dependencies = [ "memchr", ] @@ -2604,11 +2602,11 @@ checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" [[package]] name = "openssl" -version = "0.10.56" +version = "0.10.57" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "729b745ad4a5575dd06a3e1af1414bd330ee561c01b3899eb584baeaa8def17e" +checksum = "bac25ee399abb46215765b1cb35bc0212377e58a061560d8b29b024fd0430e7c" dependencies = [ - "bitflags 1.3.2", + "bitflags 2.4.0", "cfg-if", "foreign-types", "libc", @@ -2625,7 +2623,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.29", + "syn 2.0.38", ] [[package]] @@ -2636,9 +2634,9 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" [[package]] name = "openssl-sys" -version = "0.9.91" +version = "0.9.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "866b5f16f90776b9bb8dc1e1802ac6f0513de3a7a7465867bfbc563dc737faac" +checksum = "db4d56a4c0478783083cfafcc42493dd4a981d41669da64b4572a2a089b51b1d" dependencies = [ "cc", "libc", @@ -2784,7 +2782,7 @@ dependencies = [ "digest 0.10.7", "hmac 0.12.1", "password-hash", - "sha2 0.10.7", + "sha2 0.10.8", ] [[package]] @@ -2804,9 +2802,9 @@ checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94" [[package]] name = "pin-project-lite" -version = "0.2.12" +version = "0.2.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12cc1b0bf1727a77a54b6654e7b5f1af8604923edc8b81885f8ec92f9e3f0a05" +checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58" [[package]] name = "pin-utils" @@ -2848,9 +2846,9 @@ checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964" [[package]] name = "platforms" -version = "3.0.2" +version = "3.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3d7ddaed09e0eb771a79ab0fd64609ba0afb0a8366421957936ad14cbd13630" +checksum = "4503fa043bf02cee09a9582e9554b4c6403b2ef55e4612e96561d294419429f8" [[package]] name = "ppv-lite86" @@ -2860,9 +2858,9 @@ checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" [[package]] name = "proc-macro2" -version = "1.0.66" +version = "1.0.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18fb31db3f9bddb2ea821cde30a9f70117e3f119938b5ee630b7403aa6e2ead9" +checksum = "5b1106fec09662ec6dd98ccac0f81cef56984d0b49f75c92d8cbad76e20c005c" dependencies = [ "unicode-ident", ] @@ -3085,9 +3083,9 @@ dependencies = [ [[package]] name = "regex" -version = "1.9.3" +version = "1.9.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81bc1d4caf89fac26a70747fe603c130093b53c773888797a6329091246d651a" +checksum = "ebee201405406dbf528b8b672104ae6d6d63e6d118cb10e4d51abbc7b58044ff" dependencies = [ "aho-corasick", "memchr", @@ -3097,9 +3095,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.3.6" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fed1ceff11a1dddaee50c9dc8e4938bd106e9d89ae372f192311e7da498e3b69" +checksum = "59b23e92ee4318893fa3fe3e6fb365258efbfe6ac6ab30f090cdcbb7aa37efa9" dependencies = [ "aho-corasick", "memchr", @@ -3108,17 +3106,17 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.7.4" +version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5ea92a5b6195c6ef2a0295ea818b312502c6fc94dde986c5553242e18fd4ce2" +checksum = "dbb5fb1acd8a1a18b3dd5be62d25485eb770e05afb408a9627d14d451bae12da" [[package]] name = "reqwest" -version = "0.11.20" +version = "0.11.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e9ad3fe7488d7e34558a2033d45a0c90b72d97b4f80705666fea71472e2e6a1" +checksum = "046cd98826c46c2ac8ddecae268eb5c2e58628688a5fc7a2643704a73faba95b" dependencies = [ - "base64 0.21.2", + "base64 0.21.4", "bytes", "encoding_rs", "futures-core", @@ -3139,6 +3137,7 @@ dependencies = [ "serde", "serde_json", "serde_urlencoded", + "system-configuration", "tokio", "tokio-native-tls", "tower-service", @@ -3168,13 +3167,12 @@ dependencies = [ [[package]] name = "ruplacer" -version = "0.8.1" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1001b63b19333d7a462006c7d281a43ce5c1b3c44cd2a9696ab54b8e9aa7e388" +checksum = "58a26a1b15ff113d31d139357f7422708312978ed69cd5dd47e36d1b80b7eaf3" dependencies = [ "Inflector", "anyhow", - "atty", "clap", "colored", "ignore", @@ -3237,9 +3235,9 @@ dependencies = [ [[package]] name = "rustix" -version = "0.38.8" +version = "0.38.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19ed4fa021d81c8392ce04db050a3da9a60299050b7ae1cf482d862b54a7218f" +checksum = "f25469e9ae0f3d0047ca8b93fc56843f38e6774f0914a107ff8b41be8be8e0b7" dependencies = [ "bitflags 2.4.0", "errno", @@ -3337,9 +3335,9 @@ dependencies = [ [[package]] name = "semver" -version = "1.0.18" +version = "1.0.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0293b4b29daaf487284529cc2f5675b8e57c61f70167ba415a463651fd6a918" +checksum = "ad977052201c6de01a8ef2aa3378c4bd23217a056337d1d6da40468d267a4fb0" [[package]] name = "send-tx-repeat" @@ -3359,31 +3357,31 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.186" +version = "1.0.188" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f5db24220c009de9bd45e69fb2938f4b6d2df856aa9304ce377b3180f83b7c1" +checksum = "cf9e0fcba69a370eed61bcf2b728575f726b50b55cba78064753d708ddc7549e" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.186" +version = "1.0.188" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ad697f7e0b65af4983a4ce8f56ed5b357e8d3c36651bf6a7e13639c17b8e670" +checksum = "4eca7ac642d82aa35b60049a6eccb4be6be75e599bd2e9adb5f875a737654af2" dependencies = [ "proc-macro2", "quote", - "syn 2.0.29", + "syn 2.0.38", ] [[package]] name = "serde_json" -version = "1.0.105" +version = "1.0.107" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "693151e1ac27563d6dbcec9dee9fbd5da8539b20fa14ad3752b2e6d363ace360" +checksum = "6b420ce6e3d8bd882e9b243c6eed35dbc9a6110c9769e74b584e0d68d1f20c65" dependencies = [ - "indexmap 2.0.0", + "indexmap 2.0.2", "itoa", "ryu", "serde", @@ -3397,7 +3395,7 @@ checksum = "8725e1dfadb3a50f7e5ce0b1a540466f6ed3fe7a0fca2ac2b8b831d31316bd00" dependencies = [ "proc-macro2", "quote", - "syn 2.0.29", + "syn 2.0.38", ] [[package]] @@ -3440,9 +3438,9 @@ dependencies = [ [[package]] name = "sha1" -version = "0.10.5" +version = "0.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f04293dc80c3993519f2d7f6f511707ee7094fe0c6d3406feb330cdb3540eba3" +checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba" dependencies = [ "cfg-if", "cpufeatures", @@ -3464,9 +3462,9 @@ dependencies = [ [[package]] name = "sha2" -version = "0.10.7" +version = "0.10.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "479fb9d862239e610720565ca91403019f2f00410f1864c5aa7479b950a76ed8" +checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" dependencies = [ "cfg-if", "cpufeatures", @@ -3544,9 +3542,9 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.11.0" +version = "1.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62bb4feee49fdd9f707ef802e22365a35de4b7b299de4763d44bfea899442ff9" +checksum = "942b4a808e05215192e39f4ab80813e599068285906cc91aa64f923db842bd5a" [[package]] name = "socket2" @@ -3560,9 +3558,9 @@ dependencies = [ [[package]] name = "socket2" -version = "0.5.3" +version = "0.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2538b18701741680e0322a2302176d3253a35388e2e62f172f64f4f16605f877" +checksum = "4031e820eb552adee9295814c0ced9e5cf38ddf1e8b7d566d6de8e2538ea989e" dependencies = [ "libc", "windows-sys", @@ -3619,15 +3617,36 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.29" +version = "2.0.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c324c494eba9d92503e6f1ef2e6df781e78f6a7705a0202d9801b198807d518a" +checksum = "e96b79aaa137db8f61e26363a0c9b47d8b4ec75da28b7d1d614c2303e232408b" dependencies = [ "proc-macro2", "quote", "unicode-ident", ] +[[package]] +name = "system-configuration" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba3a3adc5c275d719af8cb4272ea1c4a6d668a777f37e115f6d11ddbc1c8e0e7" +dependencies = [ + "bitflags 1.3.2", + "core-foundation", + "system-configuration-sys", +] + +[[package]] +name = "system-configuration-sys" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a75fb188eb626b924683e3b95e3a48e63551fcfb51949de2f06a9d91dbee93c9" +dependencies = [ + "core-foundation-sys", + "libc", +] + [[package]] name = "tempfile" version = "3.8.0" @@ -3643,9 +3662,9 @@ dependencies = [ [[package]] name = "termcolor" -version = "1.2.0" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be55cf8942feac5c765c2c993422806843c9a9a45d4d5c407ad6dd2ea95eb9b6" +checksum = "6093bad37da69aab9d123a8091e4be0aa4a03e4d601ec641c327398315f62b64" dependencies = [ "winapi-util", ] @@ -3703,22 +3722,22 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.47" +version = "1.0.49" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97a802ec30afc17eee47b2855fc72e0c4cd62be9b4efe6591edde0ec5bd68d8f" +checksum = "1177e8c6d7ede7afde3585fd2513e611227efd6481bd78d2e82ba1ce16557ed4" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.47" +version = "1.0.49" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6bb623b56e39ab7dcd4b1b98bb6c8f8d907ed255b18de254088016b27a8ee19b" +checksum = "10712f02019e9288794769fba95cd6847df9874d49d871d062172f9dd41bc4cc" dependencies = [ "proc-macro2", "quote", - "syn 2.0.29", + "syn 2.0.38", ] [[package]] @@ -3733,9 +3752,9 @@ dependencies = [ [[package]] name = "time" -version = "0.3.27" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0bb39ee79a6d8de55f48f2293a830e040392f1c5f16e336bdd1788cd0aadce07" +checksum = "426f806f4089c493dcac0d24c29c01e2c38baf8e30f1b716ee37e83d200b18fe" dependencies = [ "deranged", "serde", @@ -3744,9 +3763,9 @@ dependencies = [ [[package]] name = "time-core" -version = "0.1.1" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7300fbefb4dadc1af235a9cef3737cea692a9d97e1b9cbcd4ebdae6f8868e6fb" +checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" [[package]] name = "tinyvec" @@ -3793,7 +3812,7 @@ dependencies = [ "parking_lot", "pin-project-lite", "signal-hook-registry", - "socket2 0.5.3", + "socket2 0.5.4", "tokio-macros", "windows-sys", ] @@ -3806,7 +3825,7 @@ checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.29", + "syn 2.0.38", ] [[package]] @@ -3821,9 +3840,9 @@ dependencies = [ [[package]] name = "tokio-util" -version = "0.7.8" +version = "0.7.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "806fe8c2c87eccc8b3267cbae29ed3ab2d0bd37fca70ab622e46aaa9375ddb7d" +checksum = "1d68074620f57a0b21594d9735eb2e98ab38b17f80d3fcb189fca266771ca60d" dependencies = [ "bytes", "futures-core", @@ -3845,9 +3864,9 @@ dependencies = [ [[package]] name = "toml" -version = "0.7.6" +version = "0.7.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c17e963a819c331dcacd7ab957d80bc2b9a9c1e71c804826d2f283dd65306542" +checksum = "dd79e69d3b627db300ff956027cc6c3798cef26d22526befdfcd12feeb6d2257" dependencies = [ "serde", "serde_spanned", @@ -3866,11 +3885,11 @@ dependencies = [ [[package]] name = "toml_edit" -version = "0.19.14" +version = "0.19.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8123f27e969974a3dfba720fdb560be359f57b44302d280ba72e76a74480e8a" +checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" dependencies = [ - "indexmap 2.0.0", + "indexmap 2.0.2", "serde", "serde_spanned", "toml_datetime", @@ -3929,9 +3948,9 @@ checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed" [[package]] name = "typenum" -version = "1.16.0" +version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba" +checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" [[package]] name = "unicode-bidi" @@ -3941,9 +3960,9 @@ checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460" [[package]] name = "unicode-ident" -version = "1.0.11" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "301abaae475aa91687eb82514b328ab47a211a533026cb25fc3e519b86adfc3c" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" [[package]] name = "unicode-normalization" @@ -3962,9 +3981,9 @@ checksum = "1dd624098567895118886609431a7c3b8f516e41d30e0643f03d94592a147e36" [[package]] name = "url" -version = "2.4.0" +version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50bff7831e19200a85b17131d085c25d7811bc4e186efdaf54bbd132994a88cb" +checksum = "143b538f18257fac9cad154828a57c6bf5157e1aa604d4816b5995bf6de87ae5" dependencies = [ "form_urlencoded", "idna", @@ -4042,9 +4061,9 @@ checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" [[package]] name = "walkdir" -version = "2.3.3" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36df944cda56c7d8d8b7496af378e6b16de9284591917d307c9b4d313c44e698" +checksum = "d71d857dc86794ca4c280d616f7da00d2dbfd8cd788846559a6813e6aa4b54ee" dependencies = [ "same-file", "winapi-util", @@ -4092,7 +4111,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.29", + "syn 2.0.38", "wasm-bindgen-shared", ] @@ -4126,7 +4145,7 @@ checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.29", + "syn 2.0.38", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -4139,19 +4158,19 @@ checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1" [[package]] name = "wasmparser" -version = "0.113.2" +version = "0.113.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fd0d44fab0bd78404e352f3399324eef76516a4580b52bc9031c60f064e98f3" +checksum = "286049849b5a5bd09a8773171be96824afabffc7cc3df6caaf33a38db6cd07ae" dependencies = [ - "indexmap 2.0.0", + "indexmap 2.0.2", "semver", ] [[package]] name = "wasmprinter" -version = "0.2.67" +version = "0.2.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6615a5587149e753bf4b93f90fa3c3f41c88597a7a2da72879afcabeda9648f" +checksum = "537030718ce76e985896e91fe2cac77c1913c8dccd46eaf8ab1a4cd56d824cc3" dependencies = [ "anyhow", "wasmparser", @@ -4185,9 +4204,9 @@ checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" [[package]] name = "winapi-util" -version = "0.1.5" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" +checksum = "f29e6f9198ba0d26b4c9f07dbe6f9ed633e1f3d5b8b414090084349e46a52596" dependencies = [ "winapi", ] @@ -4266,9 +4285,9 @@ checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" [[package]] name = "winnow" -version = "0.5.15" +version = "0.5.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c2e3184b9c4e92ad5167ca73039d0c42476302ab603e2fec4487511f38ccefc" +checksum = "037711d82167854aff2018dfd193aa0fef5370f456732f0d5a0c59b0f1b4b907" dependencies = [ "memchr", ] @@ -4300,7 +4319,7 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.29", + "syn 2.0.38", ] [[package]] From dcf8cae8e42fd5a8ab4cfabe3b1097a3cfca27f0 Mon Sep 17 00:00:00 2001 From: Andrei Marinica Date: Mon, 9 Oct 2023 09:53:31 +0300 Subject: [PATCH 05/20] dependency fix --- contracts/foundry/foundrylike/wasm/Cargo.lock | 36 +++++-------------- contracts/foundry/foundrylike/wasm/Cargo.toml | 2 +- contracts/foundry/foundrylike/wasm/src/lib.rs | 3 ++ .../foundry/test_multisig/wasm/Cargo.lock | 36 +++++-------------- .../foundry/test_multisig/wasm/Cargo.toml | 2 +- .../foundry/test_multisig/wasm/src/lib.rs | 3 ++ .../foundry/test_testapi/wasm/Cargo.lock | 28 +++------------ .../foundry/test_testapi/wasm/Cargo.toml | 2 +- .../foundry/test_testapi/wasm/src/lib.rs | 3 ++ 9 files changed, 35 insertions(+), 80 deletions(-) diff --git a/contracts/foundry/foundrylike/wasm/Cargo.lock b/contracts/foundry/foundrylike/wasm/Cargo.lock index a04dc0cf4f..7c28617de8 100644 --- a/contracts/foundry/foundrylike/wasm/Cargo.lock +++ b/contracts/foundry/foundrylike/wasm/Cargo.lock @@ -66,9 +66,7 @@ checksum = "7ebdb29d2ea9ed0083cd8cece49bbd968021bd99b0849edb4a9a7ee0fdf6a4e0" [[package]] name = "multiversx-sc" -version = "0.42.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c22c2d1e82a357b6f397f87d475314628473b8a88882aa407234197f596786aa" +version = "0.43.4" dependencies = [ "bitflags", "hashbrown", @@ -80,9 +78,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.18.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e9c97dc9e9f34f836de6a56386ddbe1b9e87e20916ff86b1ea728c08e1871ac2" +version = "0.18.1" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -90,9 +86,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.18.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12ab795364fcf0452a953e33eae7e0c22d1a6374ffeb0724d24a42727e099c6e" +version = "0.18.1" dependencies = [ "hex", "proc-macro2", @@ -102,9 +96,7 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.42.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6d77a125ea6985b2fa5cf1a297cdb9202c5a528eebb22652cc68ab1a9305e11" +version = "0.43.4" dependencies = [ "hex", "proc-macro2", @@ -115,9 +107,7 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.42.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "951b0137614c8412554ccd086967c565af38b91b77a66b5d9f433801ff24e501" +version = "0.43.4" dependencies = [ "multiversx-sc", ] @@ -148,18 +138,18 @@ checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" [[package]] name = "proc-macro2" -version = "1.0.60" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dec2b086b7a862cf4de201096214fa870344cf922b2b30c167badb3af3195406" +checksum = "134c189feb4956b20f6f547d2cf727d4c0fe06722b20a0eec87ed445a97f92da" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.28" +version = "1.0.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488" +checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" dependencies = [ "proc-macro2", ] @@ -196,7 +186,6 @@ name = "test-adder" version = "0.0.0" dependencies = [ "multiversx-sc", - "testapi", ] [[package]] @@ -207,13 +196,6 @@ dependencies = [ "test-adder", ] -[[package]] -name = "testapi" -version = "0.1.0" -dependencies = [ - "multiversx-sc", -] - [[package]] name = "unicode-ident" version = "1.0.9" diff --git a/contracts/foundry/foundrylike/wasm/Cargo.toml b/contracts/foundry/foundrylike/wasm/Cargo.toml index ccdd503fe7..eb2916adba 100644 --- a/contracts/foundry/foundrylike/wasm/Cargo.toml +++ b/contracts/foundry/foundrylike/wasm/Cargo.toml @@ -25,4 +25,4 @@ path = ".." [dependencies.multiversx-sc-wasm-adapter] version = "0.43.4" -path = "../../../framework/base" +path = "../../../../framework/wasm-adapter" diff --git a/contracts/foundry/foundrylike/wasm/src/lib.rs b/contracts/foundry/foundrylike/wasm/src/lib.rs index 0e65aa0fab..73bef855f2 100644 --- a/contracts/foundry/foundrylike/wasm/src/lib.rs +++ b/contracts/foundry/foundrylike/wasm/src/lib.rs @@ -10,6 +10,9 @@ // Total number of exported functions: 4 #![no_std] + +// Configuration that works with rustc < 1.73.0. +// TODO: Recommended rustc version: 1.73.0 or newer. #![feature(lang_items)] multiversx_sc_wasm_adapter::allocator!(); diff --git a/contracts/foundry/test_multisig/wasm/Cargo.lock b/contracts/foundry/test_multisig/wasm/Cargo.lock index db2c563131..d2a8373d9e 100644 --- a/contracts/foundry/test_multisig/wasm/Cargo.lock +++ b/contracts/foundry/test_multisig/wasm/Cargo.lock @@ -66,9 +66,7 @@ checksum = "7ebdb29d2ea9ed0083cd8cece49bbd968021bd99b0849edb4a9a7ee0fdf6a4e0" [[package]] name = "multiversx-sc" -version = "0.42.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c22c2d1e82a357b6f397f87d475314628473b8a88882aa407234197f596786aa" +version = "0.43.4" dependencies = [ "bitflags", "hashbrown", @@ -80,9 +78,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.18.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e9c97dc9e9f34f836de6a56386ddbe1b9e87e20916ff86b1ea728c08e1871ac2" +version = "0.18.1" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -90,9 +86,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.18.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12ab795364fcf0452a953e33eae7e0c22d1a6374ffeb0724d24a42727e099c6e" +version = "0.18.1" dependencies = [ "hex", "proc-macro2", @@ -102,9 +96,7 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.42.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6d77a125ea6985b2fa5cf1a297cdb9202c5a528eebb22652cc68ab1a9305e11" +version = "0.43.4" dependencies = [ "hex", "proc-macro2", @@ -115,9 +107,7 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.42.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "951b0137614c8412554ccd086967c565af38b91b77a66b5d9f433801ff24e501" +version = "0.43.4" dependencies = [ "multiversx-sc", ] @@ -148,18 +138,18 @@ checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" [[package]] name = "proc-macro2" -version = "1.0.64" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78803b62cbf1f46fde80d7c0e803111524b9877184cfe7c3033659490ac7a7da" +checksum = "134c189feb4956b20f6f547d2cf727d4c0fe06722b20a0eec87ed445a97f92da" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.29" +version = "1.0.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "573015e8ab27661678357f27dc26460738fd2b6c86e46f386fde94cb5d913105" +checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" dependencies = [ "proc-macro2", ] @@ -196,7 +186,6 @@ name = "test_multisig" version = "0.0.0" dependencies = [ "multiversx-sc", - "testapi", ] [[package]] @@ -207,13 +196,6 @@ dependencies = [ "test_multisig", ] -[[package]] -name = "testapi" -version = "0.1.0" -dependencies = [ - "multiversx-sc", -] - [[package]] name = "unicode-ident" version = "1.0.10" diff --git a/contracts/foundry/test_multisig/wasm/Cargo.toml b/contracts/foundry/test_multisig/wasm/Cargo.toml index e74a954e83..d7b7de9490 100644 --- a/contracts/foundry/test_multisig/wasm/Cargo.toml +++ b/contracts/foundry/test_multisig/wasm/Cargo.toml @@ -25,4 +25,4 @@ path = ".." [dependencies.multiversx-sc-wasm-adapter] version = "0.43.4" -path = "../../../framework/base" +path = "../../../../framework/wasm-adapter" diff --git a/contracts/foundry/test_multisig/wasm/src/lib.rs b/contracts/foundry/test_multisig/wasm/src/lib.rs index 4f7e4a1599..0424b5c058 100644 --- a/contracts/foundry/test_multisig/wasm/src/lib.rs +++ b/contracts/foundry/test_multisig/wasm/src/lib.rs @@ -10,6 +10,9 @@ // Total number of exported functions: 3 #![no_std] + +// Configuration that works with rustc < 1.73.0. +// TODO: Recommended rustc version: 1.73.0 or newer. #![feature(lang_items)] multiversx_sc_wasm_adapter::allocator!(); diff --git a/contracts/foundry/test_testapi/wasm/Cargo.lock b/contracts/foundry/test_testapi/wasm/Cargo.lock index 9326ca243f..11182740a4 100644 --- a/contracts/foundry/test_testapi/wasm/Cargo.lock +++ b/contracts/foundry/test_testapi/wasm/Cargo.lock @@ -66,9 +66,7 @@ checksum = "7ebdb29d2ea9ed0083cd8cece49bbd968021bd99b0849edb4a9a7ee0fdf6a4e0" [[package]] name = "multiversx-sc" -version = "0.42.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c22c2d1e82a357b6f397f87d475314628473b8a88882aa407234197f596786aa" +version = "0.43.4" dependencies = [ "bitflags", "hashbrown", @@ -80,9 +78,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.18.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e9c97dc9e9f34f836de6a56386ddbe1b9e87e20916ff86b1ea728c08e1871ac2" +version = "0.18.1" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -90,9 +86,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.18.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12ab795364fcf0452a953e33eae7e0c22d1a6374ffeb0724d24a42727e099c6e" +version = "0.18.1" dependencies = [ "hex", "proc-macro2", @@ -102,9 +96,7 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.42.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6d77a125ea6985b2fa5cf1a297cdb9202c5a528eebb22652cc68ab1a9305e11" +version = "0.43.4" dependencies = [ "hex", "proc-macro2", @@ -115,9 +107,7 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.42.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "951b0137614c8412554ccd086967c565af38b91b77a66b5d9f433801ff24e501" +version = "0.43.4" dependencies = [ "multiversx-sc", ] @@ -196,7 +186,6 @@ name = "test-testapi" version = "0.0.0" dependencies = [ "multiversx-sc", - "testapi", ] [[package]] @@ -207,13 +196,6 @@ dependencies = [ "test-testapi", ] -[[package]] -name = "testapi" -version = "0.1.0" -dependencies = [ - "multiversx-sc", -] - [[package]] name = "unicode-ident" version = "1.0.12" diff --git a/contracts/foundry/test_testapi/wasm/Cargo.toml b/contracts/foundry/test_testapi/wasm/Cargo.toml index 440e739c91..f9913c9aff 100644 --- a/contracts/foundry/test_testapi/wasm/Cargo.toml +++ b/contracts/foundry/test_testapi/wasm/Cargo.toml @@ -25,4 +25,4 @@ path = ".." [dependencies.multiversx-sc-wasm-adapter] version = "0.43.4" -path = "../../../framework/base" +path = "../../../../framework/wasm-adapter" diff --git a/contracts/foundry/test_testapi/wasm/src/lib.rs b/contracts/foundry/test_testapi/wasm/src/lib.rs index b612766780..4ddd0648f4 100644 --- a/contracts/foundry/test_testapi/wasm/src/lib.rs +++ b/contracts/foundry/test_testapi/wasm/src/lib.rs @@ -10,6 +10,9 @@ // Total number of exported functions: 2 #![no_std] + +// Configuration that works with rustc < 1.73.0. +// TODO: Recommended rustc version: 1.73.0 or newer. #![feature(lang_items)] multiversx_sc_wasm_adapter::allocator!(); From e3335499ea7178ecbe77a8b52522a3f774cf78d8 Mon Sep 17 00:00:00 2001 From: Andrei Marinica Date: Mon, 9 Oct 2023 18:55:04 +0300 Subject: [PATCH 06/20] sc-meta prettier print --- framework/meta/src/print_util.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/framework/meta/src/print_util.rs b/framework/meta/src/print_util.rs index e6fd7053d1..94b6cf1d4a 100644 --- a/framework/meta/src/print_util.rs +++ b/framework/meta/src/print_util.rs @@ -76,7 +76,7 @@ pub fn print_call_wasm2wat(wasm_path: &str, wat_path: &str) { } pub fn print_pack_mxsc_file(output_mxsc_path: &str) { - println!("{}", format!("Packing {output_mxsc_path} ...").green(),); + println!("{}", format!("\nPacking {output_mxsc_path} ...").green(),); } pub fn print_contract_size(size: usize) { @@ -107,7 +107,7 @@ pub fn print_invalid_vm_hook(import_name: &str, ei_version: &str) { } pub fn print_check_ei_ok() { - println!("{}", " OK".green(),); + print!("{}", " OK".green(),); } pub fn print_ignore_ei_check() { From e3359885dde96e7b761062ed17edbad786aedc56 Mon Sep 17 00:00:00 2001 From: Andrei Marinica Date: Tue, 10 Oct 2023 08:25:10 +0300 Subject: [PATCH 07/20] clippy fix --- contracts/foundry/foundrylike/src/test_adder.rs | 9 ++++----- contracts/foundry/test_multisig/src/test_multisig.rs | 12 ++++++------ vm/src/mem_conv.rs | 1 - 3 files changed, 10 insertions(+), 12 deletions(-) diff --git a/contracts/foundry/foundrylike/src/test_adder.rs b/contracts/foundry/foundrylike/src/test_adder.rs index 48cfb1b82d..499a07aacc 100644 --- a/contracts/foundry/foundrylike/src/test_adder.rs +++ b/contracts/foundry/foundrylike/src/test_adder.rs @@ -89,7 +89,7 @@ pub trait TestAdder { let adder = self.adder_address().get(); let mut adder_init_args = ManagedArgBuffer::new(); - adder_init_args.push_arg(&value); // initial sum + adder_init_args.push_arg(value); // initial sum // start a prank and call 'adder' from 'owner' self.test_raw().start_prank(&owner); @@ -102,9 +102,8 @@ pub trait TestAdder { ); self.test_raw().stop_prank(); - match res { - Result::Err(_) => panic!("call failed"), - Result::Ok(_) => (), - }; + if res.is_err() { + panic!("call failed"); + } } } diff --git a/contracts/foundry/test_multisig/src/test_multisig.rs b/contracts/foundry/test_multisig/src/test_multisig.rs index 0baf5eb0c8..87f58e22fe 100644 --- a/contracts/foundry/test_multisig/src/test_multisig.rs +++ b/contracts/foundry/test_multisig/src/test_multisig.rs @@ -54,14 +54,14 @@ pub trait TestMultisigContract { fn get_quorum(&self, multisig: &ManagedAddress) -> BigUint { let bs = self .test_raw() - .get_storage(&multisig, &ManagedBuffer::from(b"quorum")); + .get_storage(multisig, &ManagedBuffer::from(b"quorum")); BigUint::from(bs) } fn get_num_board_members(&self, multisig: &ManagedAddress) -> BigUint { let bs = self .test_raw() - .get_storage(&multisig, &ManagedBuffer::from(b"num_board_members")); + .get_storage(multisig, &ManagedBuffer::from(b"num_board_members")); BigUint::from(bs) } @@ -92,9 +92,9 @@ pub trait TestMultisigContract { let mut args = ManagedArgBuffer::new(); args.push_arg(value); - self.test_raw().start_prank(&proposer); + self.test_raw().start_prank(proposer); let _ = self.send_raw().direct_egld_execute( - &multisig, + multisig, &BigUint::from(0u32), 5000000, &ManagedBuffer::from(b"proposeChangeQuorum"), @@ -109,7 +109,7 @@ pub trait TestMultisigContract { self.test_raw().start_prank(signer); let _ = self.send_raw().direct_egld_execute( - &multisig, + multisig, &BigUint::from(0u32), 5000000, &ManagedBuffer::from(b"sign"), @@ -124,7 +124,7 @@ pub trait TestMultisigContract { self.test_raw().start_prank(performer); let _ = self.send_raw().direct_egld_execute( - &multisig, + multisig, &BigUint::from(0u32), 5000000, &ManagedBuffer::from(b"performAction"), diff --git a/vm/src/mem_conv.rs b/vm/src/mem_conv.rs index d292dfbd10..eb8c46de59 100644 --- a/vm/src/mem_conv.rs +++ b/vm/src/mem_conv.rs @@ -7,7 +7,6 @@ where f(bytes.as_ptr() as MemPtr, bytes.len() as MemLength) } -#[allow(clippy::needless_pass_by_ref_mut)] pub fn with_mem_ptr_mut(bytes: &mut [u8], f: F) -> R where F: FnOnce(MemPtr, MemLength) -> R, From c1f213c319280e4b9617caf75162afeb0199be78 Mon Sep 17 00:00:00 2001 From: Andrei Marinica Date: Tue, 23 Apr 2024 10:22:46 +0300 Subject: [PATCH 08/20] fix after merge --- Cargo.lock | 295 ++++++++---------- contracts/foundry/addercaller/Cargo.toml | 4 +- contracts/foundry/addercaller/meta/Cargo.toml | 2 +- contracts/foundry/addercaller/wasm/Cargo.lock | 152 ++------- contracts/foundry/addercaller/wasm/Cargo.toml | 20 +- contracts/foundry/addercaller/wasm/src/lib.rs | 10 +- contracts/foundry/callee/Cargo.toml | 4 +- contracts/foundry/callee/meta/Cargo.toml | 2 +- contracts/foundry/callee/wasm/Cargo.lock | 99 ++---- contracts/foundry/callee/wasm/Cargo.toml | 20 +- contracts/foundry/callee/wasm/src/lib.rs | 8 +- contracts/foundry/caller/Cargo.toml | 4 +- contracts/foundry/caller/meta/Cargo.toml | 2 +- contracts/foundry/caller/wasm/Cargo.lock | 99 ++---- contracts/foundry/caller/wasm/Cargo.toml | 20 +- contracts/foundry/caller/wasm/src/lib.rs | 10 +- contracts/foundry/foundrylike/wasm/Cargo.lock | 85 ++--- contracts/foundry/foundrylike/wasm/Cargo.toml | 18 +- contracts/foundry/foundrylike/wasm/src/lib.rs | 6 +- .../foundry/test_multisig/wasm/Cargo.lock | 85 ++--- .../foundry/test_multisig/wasm/Cargo.toml | 18 +- .../foundry/test_multisig/wasm/src/lib.rs | 6 +- .../foundry/test_testapi/wasm/Cargo.lock | 81 ++--- .../foundry/test_testapi/wasm/Cargo.toml | 18 +- .../foundry/test_testapi/wasm/src/lib.rs | 6 +- 25 files changed, 388 insertions(+), 686 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e9c06c41a9..f4c6eec068 100755 --- a/Cargo.lock +++ b/Cargo.lock @@ -49,8 +49,8 @@ dependencies = [ name = "addercaller" version = "0.0.0" dependencies = [ - "multiversx-sc 0.41.3", - "multiversx-sc-scenario 0.41.3", + "multiversx-sc 0.49.0-alpha.3 (registry+https://github.com/rust-lang/crates.io-index)", + "multiversx-sc-scenario 0.49.0-alpha.3 (registry+https://github.com/rust-lang/crates.io-index)", "num-bigint", ] @@ -59,7 +59,7 @@ name = "addercaller-meta" version = "0.0.0" dependencies = [ "addercaller", - "multiversx-sc-meta 0.41.3", + "multiversx-sc-meta 0.49.0-alpha.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -77,17 +77,6 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" -[[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 = "aho-corasick" version = "1.1.1" @@ -225,7 +214,7 @@ dependencies = [ "clap", "multiversx-sc-snippets", "serde", - "toml 0.8.12", + "toml", ] [[package]] @@ -244,7 +233,7 @@ dependencies = [ "clap", "multiversx-sc-snippets", "serde", - "toml 0.8.12", + "toml", ] [[package]] @@ -315,7 +304,6 @@ version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" dependencies = [ - "block-padding", "generic-array", ] @@ -328,12 +316,6 @@ dependencies = [ "generic-array", ] -[[package]] -name = "block-padding" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d696c370c750c948ada61c69a0ee2cbbb9c50b1019ddb86d9317157a99c2cae" - [[package]] name = "bonding-curve-contract" version = "0.0.0" @@ -399,8 +381,8 @@ checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223" name = "callee" version = "0.0.0" dependencies = [ - "multiversx-sc 0.41.3", - "multiversx-sc-scenario 0.41.3", + "multiversx-sc 0.49.0-alpha.3 (registry+https://github.com/rust-lang/crates.io-index)", + "multiversx-sc-scenario 0.49.0-alpha.3 (registry+https://github.com/rust-lang/crates.io-index)", "num-bigint", ] @@ -409,15 +391,15 @@ name = "callee-meta" version = "0.0.0" dependencies = [ "callee", - "multiversx-sc-meta 0.41.3", + "multiversx-sc-meta 0.49.0-alpha.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "caller" version = "0.0.0" dependencies = [ - "multiversx-sc 0.41.3", - "multiversx-sc-scenario 0.41.3", + "multiversx-sc 0.49.0-alpha.3 (registry+https://github.com/rust-lang/crates.io-index)", + "multiversx-sc-scenario 0.49.0-alpha.3 (registry+https://github.com/rust-lang/crates.io-index)", "num-bigint", ] @@ -426,7 +408,7 @@ name = "caller-meta" version = "0.0.0" dependencies = [ "caller", - "multiversx-sc-meta 0.41.3", + "multiversx-sc-meta 0.49.0-alpha.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -510,7 +492,7 @@ dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.48", + "syn", ] [[package]] @@ -1241,7 +1223,7 @@ checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn", ] [[package]] @@ -1352,15 +1334,6 @@ version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" -[[package]] -name = "hashbrown" -version = "0.13.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" -dependencies = [ - "ahash", -] - [[package]] name = "hashbrown" version = "0.14.1" @@ -1385,12 +1358,6 @@ 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 = "hex-literal" version = "0.4.1" @@ -1540,7 +1507,7 @@ dependencies = [ "multiversx-sc-snippets", "promises-features", "serde", - "toml 0.8.12", + "toml", "vault", ] @@ -1550,15 +1517,6 @@ version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "28b29a3cd74f0f4598934efe3aeba42bae0eb4680554128851ebbecb02af14e6" -[[package]] -name = "itertools" -version = "0.10.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" -dependencies = [ - "either", -] - [[package]] name = "itertools" version = "0.12.1" @@ -1878,7 +1836,7 @@ dependencies = [ "multiversx-sc-scenario 0.49.0-alpha.3", "multiversx-sc-snippets", "serde", - "toml 0.8.12", + "toml", ] [[package]] @@ -1891,9 +1849,7 @@ dependencies = [ [[package]] name = "multiversx-chain-scenario-format" -version = "0.19.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d2592a441608937c5aebec6732c38e6097f58de1dc9a64d7dbe98e0ab97a3c0" +version = "0.22.2" dependencies = [ "bech32", "hex", @@ -1901,12 +1857,14 @@ dependencies = [ "num-traits", "serde", "serde_json", - "sha3 0.9.1", + "sha3", ] [[package]] name = "multiversx-chain-scenario-format" version = "0.22.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a9190bdd56300e801e7793fc4ee7dc0c76c1149aac019da8c71cc58254966fe" dependencies = [ "bech32", "hex", @@ -1914,49 +1872,47 @@ dependencies = [ "num-traits", "serde", "serde_json", - "sha3 0.10.8", + "sha3", ] [[package]] name = "multiversx-chain-vm" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "212ddb5a9199f5d94d873a30126fb24b9a80383af748911c5dea71595f39a5c7" +version = "0.8.3" dependencies = [ - "bech32", + "bitflags 2.4.2", + "colored", "ed25519-dalek", "hex", - "itertools 0.10.5", - "multiversx-chain-scenario-format 0.19.1", - "multiversx-sc 0.41.3", - "multiversx-sc-meta 0.41.3", + "hex-literal", + "itertools", + "multiversx-chain-vm-executor", "num-bigint", "num-traits", "rand 0.8.5", "rand_seeder", - "serde", - "serde_json", "sha2 0.10.8", - "sha3 0.10.8", + "sha3", ] [[package]] name = "multiversx-chain-vm" version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a363734a77774f4095fad6f49c6772b82edd833ed47a7c1ca87db18f68ccfffd" dependencies = [ "bitflags 2.4.2", "colored", "ed25519-dalek", "hex", - "hex-literal 0.4.1", - "itertools 0.12.1", + "hex-literal", + "itertools", "multiversx-chain-vm-executor", "num-bigint", "num-traits", "rand 0.8.5", "rand_seeder", "sha2 0.10.8", - "sha3 0.10.8", + "sha3", ] [[package]] @@ -1988,119 +1944,125 @@ dependencies = [ [[package]] name = "multiversx-sc" -version = "0.41.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfbe80ec68fedf299dd65469f8999cf3c0f884ffa497122428f08303bcb8b884" +version = "0.49.0-alpha.3" dependencies = [ - "bitflags 1.3.2", - "hashbrown 0.13.2", - "hex-literal 0.3.4", - "multiversx-sc-codec 0.17.2", - "multiversx-sc-derive 0.41.3", + "bitflags 2.4.2", + "hex-literal", + "multiversx-sc-codec 0.18.6", + "multiversx-sc-derive 0.49.0-alpha.3", "num-traits", ] [[package]] name = "multiversx-sc" version = "0.49.0-alpha.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3294c0d990001b56d4b6a9fdecbc5a9bc0f9c49f9b5650c0ebc7535ed1949f3f" dependencies = [ "bitflags 2.4.2", - "hex-literal 0.4.1", - "multiversx-sc-codec 0.18.6", - "multiversx-sc-derive 0.49.0-alpha.3", + "hex-literal", + "multiversx-sc-codec 0.18.6 (registry+https://github.com/rust-lang/crates.io-index)", + "multiversx-sc-derive 0.49.0-alpha.3 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits", ] [[package]] name = "multiversx-sc-codec" -version = "0.17.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71d70ea458247d263b7e9fdfb207530b6a530546247139c162450e515c013a18" +version = "0.18.6" dependencies = [ "arrayvec", - "multiversx-sc-codec-derive 0.17.2", + "multiversx-sc-codec-derive 0.18.6", "num-bigint", ] [[package]] name = "multiversx-sc-codec" version = "0.18.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1da6db65170105c9495848c5e4ba388abb1f9201ff2ca362056c9328f36b7760" dependencies = [ "arrayvec", - "multiversx-sc-codec-derive 0.18.6", + "multiversx-sc-codec-derive 0.18.6 (registry+https://github.com/rust-lang/crates.io-index)", "num-bigint", ] [[package]] name = "multiversx-sc-codec-derive" -version = "0.17.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ad6920f80fda67fc60fd51aaa9f83ec7e069470f60a068c81205f9da5d05a30" +version = "0.18.6" dependencies = [ "hex", "proc-macro2", "quote", - "syn 1.0.109", + "syn", ] [[package]] name = "multiversx-sc-codec-derive" version = "0.18.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "631c4d4b37fc94659c8d6cf559c21b68c68899095201de2e1b779fccad7b0b03" dependencies = [ "hex", "proc-macro2", "quote", - "syn 2.0.48", + "syn", ] [[package]] name = "multiversx-sc-derive" -version = "0.41.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c2b87d817f2176bf1830bef938884f24267516c334a377e71a96bc18ebb09c1" +version = "0.49.0-alpha.3" dependencies = [ "hex", "proc-macro2", "quote", "radix_trie", - "syn 1.0.109", + "syn", ] [[package]] name = "multiversx-sc-derive" version = "0.49.0-alpha.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "74c63eebab4c614574ec02fb380da77edf49c8af01881f0d7543fb4b56dc6ef6" dependencies = [ "hex", "proc-macro2", "quote", "radix_trie", - "syn 2.0.48", + "syn", ] [[package]] name = "multiversx-sc-meta" -version = "0.41.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a027febbf84d887b429699cf8cbe2a9d1776d26dee7359d9b7afdc3407e57da0" +version = "0.49.0-alpha.3" dependencies = [ "clap", "colored", "common-path", "convert_case", + "copy_dir", "hex", "lazy_static", - "multiversx-sc 0.41.3", + "multiversx-sc 0.49.0-alpha.3", + "multiversx-sc-meta 0.49.0-alpha.3", "pathdiff", + "reqwest", "ruplacer", "rustc_version", + "semver", "serde", "serde_json", - "toml 0.5.11", + "toml", + "wasmparser", + "wasmprinter", + "zip", ] [[package]] name = "multiversx-sc-meta" version = "0.49.0-alpha.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e9a23a7ad8f945474ecce36641cbbe20baa6945ee281dafa467b75495206c4f" dependencies = [ "clap", "colored", @@ -2109,8 +2071,7 @@ dependencies = [ "copy_dir", "hex", "lazy_static", - "multiversx-sc 0.49.0-alpha.3", - "multiversx-sc-meta 0.49.0-alpha.3", + "multiversx-sc 0.49.0-alpha.3 (registry+https://github.com/rust-lang/crates.io-index)", "pathdiff", "reqwest", "ruplacer", @@ -2118,7 +2079,7 @@ dependencies = [ "semver", "serde", "serde_json", - "toml 0.8.12", + "toml", "wasmparser", "wasmprinter", "zip", @@ -2133,38 +2094,49 @@ dependencies = [ [[package]] name = "multiversx-sc-scenario" -version = "0.41.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0466020f9dcceaeb5ffe293e07c1eb43d81395170267e1b77445063bf17279cc" +version = "0.49.0-alpha.3" dependencies = [ + "base64 0.21.7", + "bech32", + "clap", "colored", "hex", - "itertools 0.10.5", - "multiversx-chain-vm 0.3.3", + "itertools", + "log", + "multiversx-chain-scenario-format 0.22.2", + "multiversx-chain-vm 0.8.3", + "multiversx-chain-vm-executor", + "multiversx-sc 0.49.0-alpha.3", + "multiversx-sc-meta 0.49.0-alpha.3", + "multiversx-sdk 0.3.2", + "num-bigint", "num-traits", "pathdiff", "serde", "serde_json", "sha2 0.10.8", + "tokio", ] [[package]] name = "multiversx-sc-scenario" version = "0.49.0-alpha.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9acdd0442fa078d6374f65e04a1eaa2d29bf5ef601972384ba3399689eb6173" dependencies = [ "base64 0.21.7", "bech32", "clap", "colored", "hex", - "itertools 0.12.1", + "itertools", "log", - "multiversx-chain-scenario-format 0.22.2", - "multiversx-chain-vm 0.8.3", + "multiversx-chain-scenario-format 0.22.2 (registry+https://github.com/rust-lang/crates.io-index)", + "multiversx-chain-vm 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)", "multiversx-chain-vm-executor", - "multiversx-sc 0.49.0-alpha.3", - "multiversx-sc-meta 0.49.0-alpha.3", - "multiversx-sdk", + "multiversx-sc 0.49.0-alpha.3 (registry+https://github.com/rust-lang/crates.io-index)", + "multiversx-sc-meta 0.49.0-alpha.3 (registry+https://github.com/rust-lang/crates.io-index)", + "multiversx-sdk 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "num-bigint", "num-traits", "pathdiff", @@ -2184,7 +2156,7 @@ dependencies = [ "hex", "log", "multiversx-sc-scenario 0.49.0-alpha.3", - "multiversx-sdk", + "multiversx-sdk 0.3.2", "rand 0.8.5", "tokio", ] @@ -2206,7 +2178,7 @@ dependencies = [ "bip39", "hex", "hmac", - "itertools 0.12.1", + "itertools", "pbkdf2", "pem", "rand 0.8.5", @@ -2215,7 +2187,33 @@ dependencies = [ "serde_json", "serde_repr", "sha2 0.10.8", - "sha3 0.10.8", + "sha3", + "tokio", + "zeroize", +] + +[[package]] +name = "multiversx-sdk" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46d709ddf46c50a407ce4b90ff487e854926d47f80de6abfe4a4adca3eaa7964" +dependencies = [ + "anyhow", + "base64 0.21.7", + "bech32", + "bip39", + "hex", + "hmac", + "itertools", + "pbkdf2", + "pem", + "rand 0.8.5", + "reqwest", + "serde", + "serde_json", + "serde_repr", + "sha2 0.10.8", + "sha3", "tokio", "zeroize", ] @@ -2409,7 +2407,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn", ] [[package]] @@ -2642,7 +2640,7 @@ dependencies = [ name = "proxy-test-first" version = "0.0.0" dependencies = [ - "hex-literal 0.4.1", + "hex-literal", "multiversx-sc 0.49.0-alpha.3", "multiversx-sc-scenario 0.49.0-alpha.3", ] @@ -3127,7 +3125,7 @@ checksum = "4eca7ac642d82aa35b60049a6eccb4be6be75e599bd2e9adb5f875a737654af2" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn", ] [[package]] @@ -3150,7 +3148,7 @@ checksum = "8725e1dfadb3a50f7e5ce0b1a540466f6ed3fe7a0fca2ac2b8b831d31316bd00" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn", ] [[package]] @@ -3215,18 +3213,6 @@ dependencies = [ "digest 0.10.7", ] -[[package]] -name = "sha3" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f81199417d4e5de3f04b1e871023acea7389672c4135918f05aa9cbf2f2fa809" -dependencies = [ - "block-buffer 0.9.0", - "digest 0.9.0", - "keccak", - "opaque-debug", -] - [[package]] name = "sha3" version = "0.10.8" @@ -3332,17 +3318,6 @@ version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" -[[package]] -name = "syn" -version = "1.0.109" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - [[package]] name = "syn" version = "2.0.48" @@ -3507,7 +3482,7 @@ checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn", ] [[package]] @@ -3534,16 +3509,6 @@ dependencies = [ "tracing", ] -[[package]] -name = "toml" -version = "0.5.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4f7f0dd8d50a853a531c426359045b1998f04219d88799810762cd4ad314234" -dependencies = [ - "indexmap 1.9.3", - "serde", -] - [[package]] name = "toml" version = "0.8.12" @@ -3794,7 +3759,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.48", + "syn", "wasm-bindgen-shared", ] @@ -3828,7 +3793,7 @@ checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -4003,7 +3968,7 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn", ] [[package]] diff --git a/contracts/foundry/addercaller/Cargo.toml b/contracts/foundry/addercaller/Cargo.toml index f8a1720718..6ca7c3ecc3 100644 --- a/contracts/foundry/addercaller/Cargo.toml +++ b/contracts/foundry/addercaller/Cargo.toml @@ -12,7 +12,7 @@ path = "src/addercaller.rs" num-bigint = "0.4.2" [dependencies.multiversx-sc] -version = "0.41.1" +version = "0.49.0-alpha.3" [dev-dependencies.multiversx-sc-scenario] -version = "0.41.1" +version = "0.49.0-alpha.3" diff --git a/contracts/foundry/addercaller/meta/Cargo.toml b/contracts/foundry/addercaller/meta/Cargo.toml index e58b36087c..0b3a343d67 100644 --- a/contracts/foundry/addercaller/meta/Cargo.toml +++ b/contracts/foundry/addercaller/meta/Cargo.toml @@ -11,4 +11,4 @@ authors = [ "you",] path = ".." [dependencies.multiversx-sc-meta] -version = "0.41.1" +version = "0.49.0-alpha.3" diff --git a/contracts/foundry/addercaller/wasm/Cargo.lock b/contracts/foundry/addercaller/wasm/Cargo.lock index dbef86f558..358c2b199f 100644 --- a/contracts/foundry/addercaller/wasm/Cargo.lock +++ b/contracts/foundry/addercaller/wasm/Cargo.lock @@ -17,46 +17,23 @@ dependencies = [ "multiversx-sc-wasm-adapter", ] -[[package]] -name = "ahash" -version = "0.8.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f" -dependencies = [ - "cfg-if 1.0.0", - "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" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" +checksum = "f1fdabc7756949593fe60f30ec81974b613357de856987752631dea1e3394c80" [[package]] name = "bitflags" -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" +version = "2.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" +checksum = "ed570934406eb16438a4e976b1b4500774099c13b8cb96eec99f620f05090ddf" [[package]] name = "endian-type" @@ -64,15 +41,6 @@ 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" @@ -81,30 +49,17 @@ checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" [[package]] name = "hex-literal" -version = "0.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ebdb29d2ea9ed0083cd8cece49bbd968021bd99b0849edb4a9a7ee0fdf6a4e0" - -[[package]] -name = "libc" -version = "0.2.145" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc86cde3ff845662b8f4ef6cb50ea0e20c524eb3d29ae048287e06a1b3fa6a81" - -[[package]] -name = "memory_units" -version = "0.4.0" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8452105ba047068f40ff7093dd1d9da90898e63dd61736462e9cdda6a90ad3c3" +checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" [[package]] name = "multiversx-sc" -version = "0.41.1" +version = "0.49.0-alpha.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "842795458f7aa56ca04191993628980987baa8558357f708a93514c1b2e9948a" +checksum = "3294c0d990001b56d4b6a9fdecbc5a9bc0f9c49f9b5650c0ebc7535ed1949f3f" dependencies = [ "bitflags", - "hashbrown", "hex-literal", "multiversx-sc-codec", "multiversx-sc-derive", @@ -113,20 +68,19 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.17.1" +version = "0.18.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7638cb46a0e99c636fd55443ac534ff0a5fad0bd772e1037fbac9a75e04c3c9" +checksum = "1da6db65170105c9495848c5e4ba388abb1f9201ff2ca362056c9328f36b7760" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", - "wee_alloc", ] [[package]] name = "multiversx-sc-codec-derive" -version = "0.17.1" +version = "0.18.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e976002d51367f16140929c10ee695f95dd8d34c150a45db60d3fcd1328a267a" +checksum = "631c4d4b37fc94659c8d6cf559c21b68c68899095201de2e1b779fccad7b0b03" dependencies = [ "hex", "proc-macro2", @@ -136,9 +90,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.41.1" +version = "0.49.0-alpha.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99390a0cc0406e86993772bdf16c6be4e990117f939df94a6a6e2f89d18c4983" +checksum = "74c63eebab4c614574ec02fb380da77edf49c8af01881f0d7543fb4b56dc6ef6" dependencies = [ "hex", "proc-macro2", @@ -149,9 +103,9 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.41.1" +version = "0.49.0-alpha.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70852439508cfbbc1d92f11210f76c8c1ca2a8869fe8cbd316c2a82518c58249" +checksum = "4c5022b0818e3c16fc76d5c812fca70a46f2fcec4b581600010b2c8cddac7342" dependencies = [ "multiversx-sc", ] @@ -167,33 +121,27 @@ dependencies = [ [[package]] name = "num-traits" -version = "0.2.15" +version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd" +checksum = "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c" dependencies = [ "autocfg", ] -[[package]] -name = "once_cell" -version = "1.17.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" - [[package]] name = "proc-macro2" -version = "1.0.57" +version = "1.0.78" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4ec6d5fe0b140acb27c9a0444118cf55bfbb4e0b259739429abb4521dd67c16" +checksum = "e2422ad645d89c99f8f3e6b88a9fdeca7fabeac836b1002371c4367c8f984aae" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.27" +version = "1.0.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f4f29d145265ec1c483c7c654450edde0bfe043d3938d6972630663356d9500" +checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef" dependencies = [ "proc-macro2", ] @@ -210,15 +158,15 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.10.0" +version = "1.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0" +checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "syn" -version = "1.0.109" +version = "2.0.48" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +checksum = "0f3531638e407dfc0814761abb7c00a5b54992b849452a0646b7f65c9f770f3f" dependencies = [ "proc-macro2", "quote", @@ -227,46 +175,6 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4" - -[[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" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" diff --git a/contracts/foundry/addercaller/wasm/Cargo.toml b/contracts/foundry/addercaller/wasm/Cargo.toml index 7ff3a911a4..2601cd6d0b 100644 --- a/contracts/foundry/addercaller/wasm/Cargo.toml +++ b/contracts/foundry/addercaller/wasm/Cargo.toml @@ -1,17 +1,17 @@ +# Code generated by the multiversx-sc build system. DO NOT EDIT. + +# ########################################## +# ############## AUTO-GENERATED ############# +# ########################################## + [package] name = "addercaller-wasm" version = "0.0.0" edition = "2018" publish = false -authors = [ "you",] [lib] -crate-type = [ "cdylib",] - -[workspace] -members = [ ".",] - -[dev-dependencies] +crate-type = ["cdylib"] [profile.release] codegen-units = 1 @@ -19,9 +19,13 @@ opt-level = "z" lto = true debug = false panic = "abort" +overflow-checks = false [dependencies.addercaller] path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.41.1" +version = "0.49.0-alpha.3" + +[workspace] +members = ["."] diff --git a/contracts/foundry/addercaller/wasm/src/lib.rs b/contracts/foundry/addercaller/wasm/src/lib.rs index 28c0e7e012..af4941cacd 100644 --- a/contracts/foundry/addercaller/wasm/src/lib.rs +++ b/contracts/foundry/addercaller/wasm/src/lib.rs @@ -1,4 +1,4 @@ -// Code generated by the multiversx-sc multi-contract system. DO NOT EDIT. +// Code generated by the multiversx-sc build system. DO NOT EDIT. //////////////////////////////////////////////////// ////////////////// AUTO-GENERATED ////////////////// @@ -10,6 +10,7 @@ // Total number of exported functions: 4 #![no_std] +#![allow(internal_features)] #![feature(lang_items)] multiversx_sc_wasm_adapter::allocator!(); @@ -18,9 +19,10 @@ multiversx_sc_wasm_adapter::panic_handler!(); multiversx_sc_wasm_adapter::endpoints! { addercaller ( - call_adder - call_adder_esdt + init => init + call_adder => call_adder + call_adder_esdt => call_adder_esdt ) } -multiversx_sc_wasm_adapter::empty_callback! {} +multiversx_sc_wasm_adapter::async_callback_empty! {} diff --git a/contracts/foundry/callee/Cargo.toml b/contracts/foundry/callee/Cargo.toml index e95f50054e..70d14186a1 100644 --- a/contracts/foundry/callee/Cargo.toml +++ b/contracts/foundry/callee/Cargo.toml @@ -12,7 +12,7 @@ path = "src/callee.rs" num-bigint = "0.4.2" [dependencies.multiversx-sc] -version = "0.41.2" +version = "0.49.0-alpha.3" [dev-dependencies.multiversx-sc-scenario] -version = "0.41.2" +version = "0.49.0-alpha.3" diff --git a/contracts/foundry/callee/meta/Cargo.toml b/contracts/foundry/callee/meta/Cargo.toml index dcca642d5a..b2f23a93bf 100644 --- a/contracts/foundry/callee/meta/Cargo.toml +++ b/contracts/foundry/callee/meta/Cargo.toml @@ -11,4 +11,4 @@ authors = [ "you",] path = ".." [dependencies.multiversx-sc-meta] -version = "0.41.2" +version = "0.49.0-alpha.3" diff --git a/contracts/foundry/callee/wasm/Cargo.lock b/contracts/foundry/callee/wasm/Cargo.lock index 8686ff683f..9689a4b831 100644 --- a/contracts/foundry/callee/wasm/Cargo.lock +++ b/contracts/foundry/callee/wasm/Cargo.lock @@ -2,34 +2,23 @@ # 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.2" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" +checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" [[package]] name = "autocfg" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" +checksum = "f1fdabc7756949593fe60f30ec81974b613357de856987752631dea1e3394c80" [[package]] name = "bitflags" -version = "1.3.2" +version = "2.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" +checksum = "ed570934406eb16438a4e976b1b4500774099c13b8cb96eec99f620f05090ddf" [[package]] name = "callee" @@ -46,27 +35,12 @@ dependencies = [ "multiversx-sc-wasm-adapter", ] -[[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" @@ -75,18 +49,17 @@ checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" [[package]] name = "hex-literal" -version = "0.3.4" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ebdb29d2ea9ed0083cd8cece49bbd968021bd99b0849edb4a9a7ee0fdf6a4e0" +checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" [[package]] name = "multiversx-sc" -version = "0.41.2" +version = "0.49.0-alpha.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "752eed690b41c060e8766e8f6078a8e3585a01387278c652cf88599255cbc5af" +checksum = "3294c0d990001b56d4b6a9fdecbc5a9bc0f9c49f9b5650c0ebc7535ed1949f3f" dependencies = [ "bitflags", - "hashbrown", "hex-literal", "multiversx-sc-codec", "multiversx-sc-derive", @@ -95,9 +68,9 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.17.2" +version = "0.18.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71d70ea458247d263b7e9fdfb207530b6a530546247139c162450e515c013a18" +checksum = "1da6db65170105c9495848c5e4ba388abb1f9201ff2ca362056c9328f36b7760" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -105,9 +78,9 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.17.2" +version = "0.18.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ad6920f80fda67fc60fd51aaa9f83ec7e069470f60a068c81205f9da5d05a30" +checksum = "631c4d4b37fc94659c8d6cf559c21b68c68899095201de2e1b779fccad7b0b03" dependencies = [ "hex", "proc-macro2", @@ -117,9 +90,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.41.2" +version = "0.49.0-alpha.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "674eb1e50b8bc71898d0b476210856a7bc2a4f21758987413d1ec7837d5dd16c" +checksum = "74c63eebab4c614574ec02fb380da77edf49c8af01881f0d7543fb4b56dc6ef6" dependencies = [ "hex", "proc-macro2", @@ -130,9 +103,9 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.41.2" +version = "0.49.0-alpha.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92854d81a7cd14c7ec2389cdb4bf555b7b1bbad84b8f8f4deb5a7c0b6b2c71cc" +checksum = "4c5022b0818e3c16fc76d5c812fca70a46f2fcec4b581600010b2c8cddac7342" dependencies = [ "multiversx-sc", ] @@ -148,33 +121,27 @@ dependencies = [ [[package]] name = "num-traits" -version = "0.2.15" +version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd" +checksum = "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c" 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" +version = "1.0.78" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dec2b086b7a862cf4de201096214fa870344cf922b2b30c167badb3af3195406" +checksum = "e2422ad645d89c99f8f3e6b88a9fdeca7fabeac836b1002371c4367c8f984aae" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.28" +version = "1.0.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488" +checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef" dependencies = [ "proc-macro2", ] @@ -191,15 +158,15 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.10.0" +version = "1.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0" +checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "syn" -version = "1.0.109" +version = "2.0.48" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +checksum = "0f3531638e407dfc0814761abb7c00a5b54992b849452a0646b7f65c9f770f3f" dependencies = [ "proc-macro2", "quote", @@ -208,12 +175,6 @@ dependencies = [ [[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" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" diff --git a/contracts/foundry/callee/wasm/Cargo.toml b/contracts/foundry/callee/wasm/Cargo.toml index c8c7c7e072..356a2a7fbe 100644 --- a/contracts/foundry/callee/wasm/Cargo.toml +++ b/contracts/foundry/callee/wasm/Cargo.toml @@ -1,17 +1,17 @@ +# Code generated by the multiversx-sc build system. DO NOT EDIT. + +# ########################################## +# ############## AUTO-GENERATED ############# +# ########################################## + [package] name = "callee-wasm" version = "0.0.0" edition = "2018" publish = false -authors = [ "you",] [lib] -crate-type = [ "cdylib",] - -[workspace] -members = [ ".",] - -[dev-dependencies] +crate-type = ["cdylib"] [profile.release] codegen-units = 1 @@ -19,9 +19,13 @@ opt-level = "z" lto = true debug = false panic = "abort" +overflow-checks = false [dependencies.callee] path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.41.2" +version = "0.49.0-alpha.3" + +[workspace] +members = ["."] diff --git a/contracts/foundry/callee/wasm/src/lib.rs b/contracts/foundry/callee/wasm/src/lib.rs index 37408c614d..5be8e5b926 100644 --- a/contracts/foundry/callee/wasm/src/lib.rs +++ b/contracts/foundry/callee/wasm/src/lib.rs @@ -1,4 +1,4 @@ -// Code generated by the multiversx-sc multi-contract system. DO NOT EDIT. +// Code generated by the multiversx-sc build system. DO NOT EDIT. //////////////////////////////////////////////////// ////////////////// AUTO-GENERATED ////////////////// @@ -10,6 +10,7 @@ // Total number of exported functions: 3 #![no_std] +#![allow(internal_features)] #![feature(lang_items)] multiversx_sc_wasm_adapter::allocator!(); @@ -18,8 +19,9 @@ multiversx_sc_wasm_adapter::panic_handler!(); multiversx_sc_wasm_adapter::endpoints! { callee ( - fail_if_neg + init => init + fail_if_neg => fail_if_neg ) } -multiversx_sc_wasm_adapter::empty_callback! {} +multiversx_sc_wasm_adapter::async_callback_empty! {} diff --git a/contracts/foundry/caller/Cargo.toml b/contracts/foundry/caller/Cargo.toml index e4f108cbd1..4b31dd0ac9 100644 --- a/contracts/foundry/caller/Cargo.toml +++ b/contracts/foundry/caller/Cargo.toml @@ -12,7 +12,7 @@ path = "src/caller.rs" num-bigint = "0.4.2" [dependencies.multiversx-sc] -version = "0.41.2" +version = "0.49.0-alpha.3" [dev-dependencies.multiversx-sc-scenario] -version = "0.41.2" +version = "0.49.0-alpha.3" diff --git a/contracts/foundry/caller/meta/Cargo.toml b/contracts/foundry/caller/meta/Cargo.toml index f6535a1fc9..ff91655b54 100644 --- a/contracts/foundry/caller/meta/Cargo.toml +++ b/contracts/foundry/caller/meta/Cargo.toml @@ -11,4 +11,4 @@ authors = [ "you",] path = ".." [dependencies.multiversx-sc-meta] -version = "0.41.2" +version = "0.49.0-alpha.3" diff --git a/contracts/foundry/caller/wasm/Cargo.lock b/contracts/foundry/caller/wasm/Cargo.lock index 774a00da19..b1654f13e8 100644 --- a/contracts/foundry/caller/wasm/Cargo.lock +++ b/contracts/foundry/caller/wasm/Cargo.lock @@ -2,34 +2,23 @@ # 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.2" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" +checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" [[package]] name = "autocfg" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" +checksum = "f1fdabc7756949593fe60f30ec81974b613357de856987752631dea1e3394c80" [[package]] name = "bitflags" -version = "1.3.2" +version = "2.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" +checksum = "ed570934406eb16438a4e976b1b4500774099c13b8cb96eec99f620f05090ddf" [[package]] name = "caller" @@ -46,27 +35,12 @@ dependencies = [ "multiversx-sc-wasm-adapter", ] -[[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" @@ -75,18 +49,17 @@ checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" [[package]] name = "hex-literal" -version = "0.3.4" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ebdb29d2ea9ed0083cd8cece49bbd968021bd99b0849edb4a9a7ee0fdf6a4e0" +checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" [[package]] name = "multiversx-sc" -version = "0.41.2" +version = "0.49.0-alpha.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "752eed690b41c060e8766e8f6078a8e3585a01387278c652cf88599255cbc5af" +checksum = "3294c0d990001b56d4b6a9fdecbc5a9bc0f9c49f9b5650c0ebc7535ed1949f3f" dependencies = [ "bitflags", - "hashbrown", "hex-literal", "multiversx-sc-codec", "multiversx-sc-derive", @@ -95,9 +68,9 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.17.2" +version = "0.18.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71d70ea458247d263b7e9fdfb207530b6a530546247139c162450e515c013a18" +checksum = "1da6db65170105c9495848c5e4ba388abb1f9201ff2ca362056c9328f36b7760" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -105,9 +78,9 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.17.2" +version = "0.18.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ad6920f80fda67fc60fd51aaa9f83ec7e069470f60a068c81205f9da5d05a30" +checksum = "631c4d4b37fc94659c8d6cf559c21b68c68899095201de2e1b779fccad7b0b03" dependencies = [ "hex", "proc-macro2", @@ -117,9 +90,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.41.2" +version = "0.49.0-alpha.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "674eb1e50b8bc71898d0b476210856a7bc2a4f21758987413d1ec7837d5dd16c" +checksum = "74c63eebab4c614574ec02fb380da77edf49c8af01881f0d7543fb4b56dc6ef6" dependencies = [ "hex", "proc-macro2", @@ -130,9 +103,9 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.41.2" +version = "0.49.0-alpha.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92854d81a7cd14c7ec2389cdb4bf555b7b1bbad84b8f8f4deb5a7c0b6b2c71cc" +checksum = "4c5022b0818e3c16fc76d5c812fca70a46f2fcec4b581600010b2c8cddac7342" dependencies = [ "multiversx-sc", ] @@ -148,33 +121,27 @@ dependencies = [ [[package]] name = "num-traits" -version = "0.2.15" +version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd" +checksum = "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c" 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" +version = "1.0.78" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dec2b086b7a862cf4de201096214fa870344cf922b2b30c167badb3af3195406" +checksum = "e2422ad645d89c99f8f3e6b88a9fdeca7fabeac836b1002371c4367c8f984aae" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.28" +version = "1.0.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488" +checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef" dependencies = [ "proc-macro2", ] @@ -191,15 +158,15 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.10.0" +version = "1.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0" +checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "syn" -version = "1.0.109" +version = "2.0.48" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +checksum = "0f3531638e407dfc0814761abb7c00a5b54992b849452a0646b7f65c9f770f3f" dependencies = [ "proc-macro2", "quote", @@ -208,12 +175,6 @@ dependencies = [ [[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" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" diff --git a/contracts/foundry/caller/wasm/Cargo.toml b/contracts/foundry/caller/wasm/Cargo.toml index 72b5ca9c06..9e68c4ca50 100644 --- a/contracts/foundry/caller/wasm/Cargo.toml +++ b/contracts/foundry/caller/wasm/Cargo.toml @@ -1,17 +1,17 @@ +# Code generated by the multiversx-sc build system. DO NOT EDIT. + +# ########################################## +# ############## AUTO-GENERATED ############# +# ########################################## + [package] name = "caller-wasm" version = "0.0.0" edition = "2018" publish = false -authors = [ "you",] [lib] -crate-type = [ "cdylib",] - -[workspace] -members = [ ".",] - -[dev-dependencies] +crate-type = ["cdylib"] [profile.release] codegen-units = 1 @@ -19,9 +19,13 @@ opt-level = "z" lto = true debug = false panic = "abort" +overflow-checks = false [dependencies.caller] path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.41.2" +version = "0.49.0-alpha.3" + +[workspace] +members = ["."] diff --git a/contracts/foundry/caller/wasm/src/lib.rs b/contracts/foundry/caller/wasm/src/lib.rs index d6bf842ddd..7c2566d6c3 100644 --- a/contracts/foundry/caller/wasm/src/lib.rs +++ b/contracts/foundry/caller/wasm/src/lib.rs @@ -1,4 +1,4 @@ -// Code generated by the multiversx-sc multi-contract system. DO NOT EDIT. +// Code generated by the multiversx-sc build system. DO NOT EDIT. //////////////////////////////////////////////////// ////////////////// AUTO-GENERATED ////////////////// @@ -10,6 +10,7 @@ // Total number of exported functions: 4 #![no_std] +#![allow(internal_features)] #![feature(lang_items)] multiversx_sc_wasm_adapter::allocator!(); @@ -18,9 +19,10 @@ multiversx_sc_wasm_adapter::panic_handler!(); multiversx_sc_wasm_adapter::endpoints! { caller ( - call_other - call_other_exec_on_dest_ctx + init => init + call_other => call_other + call_other_exec_on_dest_ctx => call_other_exec_on_dest_ctx ) } -multiversx_sc_wasm_adapter::empty_callback! {} +multiversx_sc_wasm_adapter::async_callback_empty! {} diff --git a/contracts/foundry/foundrylike/wasm/Cargo.lock b/contracts/foundry/foundrylike/wasm/Cargo.lock index 7c28617de8..a68acd443c 100644 --- a/contracts/foundry/foundrylike/wasm/Cargo.lock +++ b/contracts/foundry/foundrylike/wasm/Cargo.lock @@ -2,17 +2,6 @@ # 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" @@ -21,21 +10,15 @@ checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" [[package]] name = "autocfg" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" +checksum = "f1fdabc7756949593fe60f30ec81974b613357de856987752631dea1e3394c80" [[package]] name = "bitflags" -version = "1.3.2" +version = "2.4.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" +checksum = "ed570934406eb16438a4e976b1b4500774099c13b8cb96eec99f620f05090ddf" [[package]] name = "endian-type" @@ -43,15 +26,6 @@ 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" @@ -60,16 +34,15 @@ checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" [[package]] name = "hex-literal" -version = "0.3.4" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ebdb29d2ea9ed0083cd8cece49bbd968021bd99b0849edb4a9a7ee0fdf6a4e0" +checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" [[package]] name = "multiversx-sc" -version = "0.43.4" +version = "0.49.0-alpha.3" dependencies = [ "bitflags", - "hashbrown", "hex-literal", "multiversx-sc-codec", "multiversx-sc-derive", @@ -78,7 +51,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.18.1" +version = "0.18.6" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -86,7 +59,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.18.1" +version = "0.18.6" dependencies = [ "hex", "proc-macro2", @@ -96,7 +69,7 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.43.4" +version = "0.49.0-alpha.3" dependencies = [ "hex", "proc-macro2", @@ -107,7 +80,7 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.43.4" +version = "0.49.0-alpha.3" dependencies = [ "multiversx-sc", ] @@ -123,33 +96,27 @@ dependencies = [ [[package]] name = "num-traits" -version = "0.2.15" +version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd" +checksum = "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c" 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.69" +version = "1.0.78" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "134c189feb4956b20f6f547d2cf727d4c0fe06722b20a0eec87ed445a97f92da" +checksum = "e2422ad645d89c99f8f3e6b88a9fdeca7fabeac836b1002371c4367c8f984aae" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.33" +version = "1.0.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" +checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef" dependencies = [ "proc-macro2", ] @@ -166,15 +133,15 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.10.0" +version = "1.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0" +checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "syn" -version = "1.0.109" +version = "2.0.48" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +checksum = "0f3531638e407dfc0814761abb7c00a5b54992b849452a0646b7f65c9f770f3f" dependencies = [ "proc-macro2", "quote", @@ -198,12 +165,6 @@ dependencies = [ [[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" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" diff --git a/contracts/foundry/foundrylike/wasm/Cargo.toml b/contracts/foundry/foundrylike/wasm/Cargo.toml index 0f2a5705a9..931a19b36a 100644 --- a/contracts/foundry/foundrylike/wasm/Cargo.toml +++ b/contracts/foundry/foundrylike/wasm/Cargo.toml @@ -1,17 +1,17 @@ +# Code generated by the multiversx-sc build system. DO NOT EDIT. + +# ########################################## +# ############## AUTO-GENERATED ############# +# ########################################## + [package] name = "test-adder-wasm" version = "0.0.0" edition = "2018" publish = false -authors = [ "you",] [lib] -crate-type = [ "cdylib",] - -[workspace] -members = [ ".",] - -[dev-dependencies] +crate-type = ["cdylib"] [profile.release] codegen-units = 1 @@ -19,6 +19,7 @@ opt-level = "z" lto = true debug = false panic = "abort" +overflow-checks = false [dependencies.test-adder] path = ".." @@ -26,3 +27,6 @@ path = ".." [dependencies.multiversx-sc-wasm-adapter] version = "0.49.0-alpha.3" path = "../../../../framework/wasm-adapter" + +[workspace] +members = ["."] diff --git a/contracts/foundry/foundrylike/wasm/src/lib.rs b/contracts/foundry/foundrylike/wasm/src/lib.rs index 73bef855f2..724443eac1 100644 --- a/contracts/foundry/foundrylike/wasm/src/lib.rs +++ b/contracts/foundry/foundrylike/wasm/src/lib.rs @@ -1,4 +1,4 @@ -// Code generated by the multiversx-sc multi-contract system. DO NOT EDIT. +// Code generated by the multiversx-sc build system. DO NOT EDIT. //////////////////////////////////////////////////// ////////////////// AUTO-GENERATED ////////////////// @@ -10,9 +10,7 @@ // Total number of exported functions: 4 #![no_std] - -// Configuration that works with rustc < 1.73.0. -// TODO: Recommended rustc version: 1.73.0 or newer. +#![allow(internal_features)] #![feature(lang_items)] multiversx_sc_wasm_adapter::allocator!(); diff --git a/contracts/foundry/test_multisig/wasm/Cargo.lock b/contracts/foundry/test_multisig/wasm/Cargo.lock index d2a8373d9e..4930af323f 100644 --- a/contracts/foundry/test_multisig/wasm/Cargo.lock +++ b/contracts/foundry/test_multisig/wasm/Cargo.lock @@ -2,17 +2,6 @@ # 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" @@ -21,21 +10,15 @@ checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" [[package]] name = "autocfg" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" +checksum = "f1fdabc7756949593fe60f30ec81974b613357de856987752631dea1e3394c80" [[package]] name = "bitflags" -version = "1.3.2" +version = "2.4.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" +checksum = "ed570934406eb16438a4e976b1b4500774099c13b8cb96eec99f620f05090ddf" [[package]] name = "endian-type" @@ -43,15 +26,6 @@ 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" @@ -60,16 +34,15 @@ checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" [[package]] name = "hex-literal" -version = "0.3.4" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ebdb29d2ea9ed0083cd8cece49bbd968021bd99b0849edb4a9a7ee0fdf6a4e0" +checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" [[package]] name = "multiversx-sc" -version = "0.43.4" +version = "0.49.0-alpha.3" dependencies = [ "bitflags", - "hashbrown", "hex-literal", "multiversx-sc-codec", "multiversx-sc-derive", @@ -78,7 +51,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.18.1" +version = "0.18.6" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -86,7 +59,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.18.1" +version = "0.18.6" dependencies = [ "hex", "proc-macro2", @@ -96,7 +69,7 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.43.4" +version = "0.49.0-alpha.3" dependencies = [ "hex", "proc-macro2", @@ -107,7 +80,7 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.43.4" +version = "0.49.0-alpha.3" dependencies = [ "multiversx-sc", ] @@ -123,33 +96,27 @@ dependencies = [ [[package]] name = "num-traits" -version = "0.2.15" +version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd" +checksum = "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c" 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.69" +version = "1.0.78" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "134c189feb4956b20f6f547d2cf727d4c0fe06722b20a0eec87ed445a97f92da" +checksum = "e2422ad645d89c99f8f3e6b88a9fdeca7fabeac836b1002371c4367c8f984aae" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.33" +version = "1.0.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" +checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef" dependencies = [ "proc-macro2", ] @@ -166,15 +133,15 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.11.0" +version = "1.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62bb4feee49fdd9f707ef802e22365a35de4b7b299de4763d44bfea899442ff9" +checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "syn" -version = "1.0.109" +version = "2.0.48" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +checksum = "0f3531638e407dfc0814761abb7c00a5b54992b849452a0646b7f65c9f770f3f" dependencies = [ "proc-macro2", "quote", @@ -198,12 +165,6 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22049a19f4a68748a168c0fc439f9516686aa045927ff767eca0a85101fb6e73" - -[[package]] -name = "version_check" -version = "0.9.4" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" diff --git a/contracts/foundry/test_multisig/wasm/Cargo.toml b/contracts/foundry/test_multisig/wasm/Cargo.toml index fe73f3eb45..de02caa7b3 100644 --- a/contracts/foundry/test_multisig/wasm/Cargo.toml +++ b/contracts/foundry/test_multisig/wasm/Cargo.toml @@ -1,17 +1,17 @@ +# Code generated by the multiversx-sc build system. DO NOT EDIT. + +# ########################################## +# ############## AUTO-GENERATED ############# +# ########################################## + [package] name = "test_multisig-wasm" version = "0.0.0" edition = "2018" publish = false -authors = [ "you",] [lib] -crate-type = [ "cdylib",] - -[workspace] -members = [ ".",] - -[dev-dependencies] +crate-type = ["cdylib"] [profile.release] codegen-units = 1 @@ -19,6 +19,7 @@ opt-level = "z" lto = true debug = false panic = "abort" +overflow-checks = false [dependencies.test_multisig] path = ".." @@ -26,3 +27,6 @@ path = ".." [dependencies.multiversx-sc-wasm-adapter] version = "0.49.0-alpha.3" path = "../../../../framework/wasm-adapter" + +[workspace] +members = ["."] diff --git a/contracts/foundry/test_multisig/wasm/src/lib.rs b/contracts/foundry/test_multisig/wasm/src/lib.rs index 0424b5c058..2ad0b3b381 100644 --- a/contracts/foundry/test_multisig/wasm/src/lib.rs +++ b/contracts/foundry/test_multisig/wasm/src/lib.rs @@ -1,4 +1,4 @@ -// Code generated by the multiversx-sc multi-contract system. DO NOT EDIT. +// Code generated by the multiversx-sc build system. DO NOT EDIT. //////////////////////////////////////////////////// ////////////////// AUTO-GENERATED ////////////////// @@ -10,9 +10,7 @@ // Total number of exported functions: 3 #![no_std] - -// Configuration that works with rustc < 1.73.0. -// TODO: Recommended rustc version: 1.73.0 or newer. +#![allow(internal_features)] #![feature(lang_items)] multiversx_sc_wasm_adapter::allocator!(); diff --git a/contracts/foundry/test_testapi/wasm/Cargo.lock b/contracts/foundry/test_testapi/wasm/Cargo.lock index 11182740a4..b07468dd35 100644 --- a/contracts/foundry/test_testapi/wasm/Cargo.lock +++ b/contracts/foundry/test_testapi/wasm/Cargo.lock @@ -2,17 +2,6 @@ # 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" @@ -21,21 +10,15 @@ checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" [[package]] name = "autocfg" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" +checksum = "f1fdabc7756949593fe60f30ec81974b613357de856987752631dea1e3394c80" [[package]] name = "bitflags" -version = "1.3.2" +version = "2.4.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" +checksum = "ed570934406eb16438a4e976b1b4500774099c13b8cb96eec99f620f05090ddf" [[package]] name = "endian-type" @@ -43,15 +26,6 @@ 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" @@ -60,16 +34,15 @@ checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" [[package]] name = "hex-literal" -version = "0.3.4" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ebdb29d2ea9ed0083cd8cece49bbd968021bd99b0849edb4a9a7ee0fdf6a4e0" +checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" [[package]] name = "multiversx-sc" -version = "0.43.4" +version = "0.49.0-alpha.3" dependencies = [ "bitflags", - "hashbrown", "hex-literal", "multiversx-sc-codec", "multiversx-sc-derive", @@ -78,7 +51,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.18.1" +version = "0.18.6" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -86,7 +59,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.18.1" +version = "0.18.6" dependencies = [ "hex", "proc-macro2", @@ -96,7 +69,7 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.43.4" +version = "0.49.0-alpha.3" dependencies = [ "hex", "proc-macro2", @@ -107,7 +80,7 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.43.4" +version = "0.49.0-alpha.3" dependencies = [ "multiversx-sc", ] @@ -123,33 +96,27 @@ dependencies = [ [[package]] name = "num-traits" -version = "0.2.16" +version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f30b0abd723be7e2ffca1272140fac1a2f084c77ec3e123c192b66af1ee9e6c2" +checksum = "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c" 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.67" +version = "1.0.78" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d433d9f1a3e8c1263d9456598b16fec66f4acc9a74dacffd35c7bb09b3a1328" +checksum = "e2422ad645d89c99f8f3e6b88a9fdeca7fabeac836b1002371c4367c8f984aae" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.33" +version = "1.0.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" +checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef" dependencies = [ "proc-macro2", ] @@ -166,15 +133,15 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.11.1" +version = "1.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "942b4a808e05215192e39f4ab80813e599068285906cc91aa64f923db842bd5a" +checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "syn" -version = "1.0.109" +version = "2.0.48" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +checksum = "0f3531638e407dfc0814761abb7c00a5b54992b849452a0646b7f65c9f770f3f" dependencies = [ "proc-macro2", "quote", @@ -201,9 +168,3 @@ name = "unicode-ident" version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" - -[[package]] -name = "version_check" -version = "0.9.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" diff --git a/contracts/foundry/test_testapi/wasm/Cargo.toml b/contracts/foundry/test_testapi/wasm/Cargo.toml index cad5113d69..dd5b91ab41 100644 --- a/contracts/foundry/test_testapi/wasm/Cargo.toml +++ b/contracts/foundry/test_testapi/wasm/Cargo.toml @@ -1,17 +1,17 @@ +# Code generated by the multiversx-sc build system. DO NOT EDIT. + +# ########################################## +# ############## AUTO-GENERATED ############# +# ########################################## + [package] name = "test-testapi-wasm" version = "0.0.0" edition = "2018" publish = false -authors = [ "you",] [lib] -crate-type = [ "cdylib",] - -[workspace] -members = [ ".",] - -[dev-dependencies] +crate-type = ["cdylib"] [profile.release] codegen-units = 1 @@ -19,6 +19,7 @@ opt-level = "z" lto = true debug = false panic = "abort" +overflow-checks = false [dependencies.test-testapi] path = ".." @@ -26,3 +27,6 @@ path = ".." [dependencies.multiversx-sc-wasm-adapter] version = "0.49.0-alpha.3" path = "../../../../framework/wasm-adapter" + +[workspace] +members = ["."] diff --git a/contracts/foundry/test_testapi/wasm/src/lib.rs b/contracts/foundry/test_testapi/wasm/src/lib.rs index 4ddd0648f4..abb8966db7 100644 --- a/contracts/foundry/test_testapi/wasm/src/lib.rs +++ b/contracts/foundry/test_testapi/wasm/src/lib.rs @@ -1,4 +1,4 @@ -// Code generated by the multiversx-sc multi-contract system. DO NOT EDIT. +// Code generated by the multiversx-sc build system. DO NOT EDIT. //////////////////////////////////////////////////// ////////////////// AUTO-GENERATED ////////////////// @@ -10,9 +10,7 @@ // Total number of exported functions: 2 #![no_std] - -// Configuration that works with rustc < 1.73.0. -// TODO: Recommended rustc version: 1.73.0 or newer. +#![allow(internal_features)] #![feature(lang_items)] multiversx_sc_wasm_adapter::allocator!(); From 33d971aee7dad2d0b037c2802ce573002ba34afa Mon Sep 17 00:00:00 2001 From: Andrei Marinica Date: Tue, 23 Apr 2024 18:54:11 +0300 Subject: [PATCH 09/20] parametric tests rename --- Cargo.lock | 68 +++++++++---------- Cargo.toml | 24 +++---- .../foundry/foundrylike/meta/src/main.rs | 3 - .../foundry/test_multisig/meta/src/main.rs | 3 - .../adder-pt}/.gitignore | 0 .../adder-pt}/Cargo.toml | 4 +- .../adder-pt}/foundry.json | 0 .../adder-pt}/meta/Cargo.toml | 4 +- .../adder-pt/meta/src/main.rs | 3 + .../adder-pt}/multiversx.json | 0 .../adder-pt}/scenarios/test-adder.scen.json | 0 .../adder-pt/src/adder_pt.rs} | 0 .../adder-pt}/wasm/Cargo.lock | 30 ++++---- .../adder-pt}/wasm/Cargo.toml | 4 +- .../adder-pt}/wasm/src/lib.rs | 2 +- .../addercaller}/.gitignore | 0 .../addercaller/Cargo.toml | 0 .../addercaller/meta/Cargo.toml | 0 .../addercaller/meta/src/main.rs | 0 .../addercaller}/multiversx.json | 0 .../scenarios/addercaller.scen.json | 0 .../addercaller_out_of_funds.scen.json | 0 .../addercaller/src/addercaller.rs | 0 .../addercaller/wasm/Cargo.lock | 18 ++--- .../addercaller/wasm/Cargo.toml | 4 +- .../addercaller/wasm/src/lib.rs | 2 +- .../callee}/.gitignore | 0 .../callee/Cargo.toml | 0 .../callee/meta/Cargo.toml | 0 .../callee/meta/src/main.rs | 0 .../callee}/multiversx.json | 0 .../callee/src/callee.rs | 0 .../callee/wasm/Cargo.lock | 12 ++-- .../callee/wasm/Cargo.toml | 0 .../callee/wasm/src/lib.rs | 0 .../caller}/.gitignore | 0 .../caller/Cargo.toml | 0 .../caller/meta/Cargo.toml | 0 .../caller/meta/src/main.rs | 0 .../caller}/multiversx.json | 0 .../caller/scenarios/caller.scen.json | 0 .../caller/scenarios/errors.scen.json | 0 .../scenarios/exec_on_dest_ctx.scen.json | 0 .../caller/scenarios/steps/check_1.steps.json | 0 .../scenarios/steps/check_init.steps.json | 0 .../caller/scenarios/steps/init.steps.json | 0 .../caller/src/caller.rs | 0 .../caller/wasm/Cargo.lock | 12 ++-- .../caller/wasm/Cargo.toml | 0 .../caller/wasm/src/lib.rs | 0 .../multisig-pt}/.gitignore | 0 .../multisig-pt}/Cargo.toml | 4 +- .../multisig-pt}/foundry.json | 0 .../multisig-pt}/meta/Cargo.toml | 4 +- .../multisig-pt/meta/src/main.rs | 3 + .../multisig-pt}/multiversx.json | 0 .../multisig-pt/src/multisig_pt.rs} | 0 .../multisig-pt}/wasm/Cargo.lock | 30 ++++---- .../multisig-pt}/wasm/Cargo.toml | 4 +- .../multisig-pt}/wasm/src/lib.rs | 2 +- .../testapi-pt}/.gitignore | 0 .../testapi-pt}/Cargo.toml | 2 +- .../testapi-pt}/foundry.json | 0 .../testapi-pt}/meta/Cargo.toml | 0 .../testapi-pt}/meta/src/main.rs | 0 .../testapi-pt}/multiversx.json | 0 .../testapi-pt/src/testapi_pt.rs} | 0 .../testapi-pt}/wasm/Cargo.lock | 0 .../testapi-pt}/wasm/Cargo.toml | 0 .../testapi-pt}/wasm/src/lib.rs | 0 70 files changed, 121 insertions(+), 121 deletions(-) delete mode 100644 contracts/foundry/foundrylike/meta/src/main.rs delete mode 100644 contracts/foundry/test_multisig/meta/src/main.rs rename contracts/{foundry/addercaller => parametric-tests/adder-pt}/.gitignore (100%) rename contracts/{foundry/foundrylike => parametric-tests/adder-pt}/Cargo.toml (87%) rename contracts/{foundry/foundrylike => parametric-tests/adder-pt}/foundry.json (100%) rename contracts/{foundry/foundrylike => parametric-tests/adder-pt}/meta/Cargo.toml (80%) create mode 100644 contracts/parametric-tests/adder-pt/meta/src/main.rs rename contracts/{foundry/addercaller => parametric-tests/adder-pt}/multiversx.json (100%) rename contracts/{foundry/foundrylike => parametric-tests/adder-pt}/scenarios/test-adder.scen.json (100%) rename contracts/{foundry/foundrylike/src/test_adder.rs => parametric-tests/adder-pt/src/adder_pt.rs} (100%) rename contracts/{foundry/foundrylike => parametric-tests/adder-pt}/wasm/Cargo.lock (98%) rename contracts/{foundry/foundrylike => parametric-tests/adder-pt}/wasm/Cargo.toml (91%) rename contracts/{foundry/foundrylike => parametric-tests/adder-pt}/wasm/src/lib.rs (98%) rename contracts/{foundry/callee => parametric-tests/addercaller}/.gitignore (100%) rename contracts/{foundry => parametric-tests}/addercaller/Cargo.toml (100%) rename contracts/{foundry => parametric-tests}/addercaller/meta/Cargo.toml (100%) rename contracts/{foundry => parametric-tests}/addercaller/meta/src/main.rs (100%) rename contracts/{foundry/callee => parametric-tests/addercaller}/multiversx.json (100%) rename contracts/{foundry => parametric-tests}/addercaller/scenarios/addercaller.scen.json (100%) rename contracts/{foundry => parametric-tests}/addercaller/scenarios/addercaller_out_of_funds.scen.json (100%) rename contracts/{foundry => parametric-tests}/addercaller/src/addercaller.rs (100%) rename contracts/{foundry => parametric-tests}/addercaller/wasm/Cargo.lock (91%) rename contracts/{foundry => parametric-tests}/addercaller/wasm/Cargo.toml (89%) rename contracts/{foundry => parametric-tests}/addercaller/wasm/src/lib.rs (97%) rename contracts/{foundry/caller => parametric-tests/callee}/.gitignore (100%) rename contracts/{foundry => parametric-tests}/callee/Cargo.toml (100%) rename contracts/{foundry => parametric-tests}/callee/meta/Cargo.toml (100%) rename contracts/{foundry => parametric-tests}/callee/meta/src/main.rs (100%) rename contracts/{foundry/caller => parametric-tests/callee}/multiversx.json (100%) rename contracts/{foundry => parametric-tests}/callee/src/callee.rs (100%) rename contracts/{foundry => parametric-tests}/callee/wasm/Cargo.lock (93%) rename contracts/{foundry => parametric-tests}/callee/wasm/Cargo.toml (100%) rename contracts/{foundry => parametric-tests}/callee/wasm/src/lib.rs (100%) rename contracts/{foundry/foundrylike => parametric-tests/caller}/.gitignore (100%) rename contracts/{foundry => parametric-tests}/caller/Cargo.toml (100%) rename contracts/{foundry => parametric-tests}/caller/meta/Cargo.toml (100%) rename contracts/{foundry => parametric-tests}/caller/meta/src/main.rs (100%) rename contracts/{foundry/foundrylike => parametric-tests/caller}/multiversx.json (100%) rename contracts/{foundry => parametric-tests}/caller/scenarios/caller.scen.json (100%) rename contracts/{foundry => parametric-tests}/caller/scenarios/errors.scen.json (100%) rename contracts/{foundry => parametric-tests}/caller/scenarios/exec_on_dest_ctx.scen.json (100%) rename contracts/{foundry => parametric-tests}/caller/scenarios/steps/check_1.steps.json (100%) rename contracts/{foundry => parametric-tests}/caller/scenarios/steps/check_init.steps.json (100%) rename contracts/{foundry => parametric-tests}/caller/scenarios/steps/init.steps.json (100%) rename contracts/{foundry => parametric-tests}/caller/src/caller.rs (100%) rename contracts/{foundry => parametric-tests}/caller/wasm/Cargo.lock (93%) rename contracts/{foundry => parametric-tests}/caller/wasm/Cargo.toml (100%) rename contracts/{foundry => parametric-tests}/caller/wasm/src/lib.rs (100%) rename contracts/{foundry/test_multisig => parametric-tests/multisig-pt}/.gitignore (100%) rename contracts/{foundry/test_multisig => parametric-tests/multisig-pt}/Cargo.toml (86%) rename contracts/{foundry/test_multisig => parametric-tests/multisig-pt}/foundry.json (100%) rename contracts/{foundry/test_multisig => parametric-tests/multisig-pt}/meta/Cargo.toml (78%) create mode 100644 contracts/parametric-tests/multisig-pt/meta/src/main.rs rename contracts/{foundry/test_multisig => parametric-tests/multisig-pt}/multiversx.json (100%) rename contracts/{foundry/test_multisig/src/test_multisig.rs => parametric-tests/multisig-pt/src/multisig_pt.rs} (100%) rename contracts/{foundry/test_multisig => parametric-tests/multisig-pt}/wasm/Cargo.lock (98%) rename contracts/{foundry/test_multisig => parametric-tests/multisig-pt}/wasm/Cargo.toml (90%) rename contracts/{foundry/test_multisig => parametric-tests/multisig-pt}/wasm/src/lib.rs (97%) rename contracts/{foundry/test_testapi => parametric-tests/testapi-pt}/.gitignore (100%) rename contracts/{foundry/test_testapi => parametric-tests/testapi-pt}/Cargo.toml (92%) rename contracts/{foundry/test_testapi => parametric-tests/testapi-pt}/foundry.json (100%) rename contracts/{foundry/test_testapi => parametric-tests/testapi-pt}/meta/Cargo.toml (100%) rename contracts/{foundry/test_testapi => parametric-tests/testapi-pt}/meta/src/main.rs (100%) rename contracts/{foundry/test_testapi => parametric-tests/testapi-pt}/multiversx.json (100%) rename contracts/{foundry/test_testapi/src/test_testapi.rs => parametric-tests/testapi-pt/src/testapi_pt.rs} (100%) rename contracts/{foundry/test_testapi => parametric-tests/testapi-pt}/wasm/Cargo.lock (100%) rename contracts/{foundry/test_testapi => parametric-tests/testapi-pt}/wasm/Cargo.toml (100%) rename contracts/{foundry/test_testapi => parametric-tests/testapi-pt}/wasm/src/lib.rs (100%) diff --git a/Cargo.lock b/Cargo.lock index f4c6eec068..a52175ac0b 100755 --- a/Cargo.lock +++ b/Cargo.lock @@ -45,6 +45,23 @@ dependencies = [ "multiversx-sc-meta 0.49.0-alpha.3", ] +[[package]] +name = "adder-pt" +version = "0.0.0" +dependencies = [ + "multiversx-sc 0.49.0-alpha.3", + "multiversx-sc-scenario 0.49.0-alpha.3", + "num-bigint", +] + +[[package]] +name = "adder-pt-meta" +version = "0.0.0" +dependencies = [ + "adder-pt", + "multiversx-sc-meta 0.49.0-alpha.3", +] + [[package]] name = "addercaller" version = "0.0.0" @@ -1847,6 +1864,23 @@ dependencies = [ "multiversx-sc-meta 0.49.0-alpha.3", ] +[[package]] +name = "multisig-pt" +version = "0.0.0" +dependencies = [ + "multiversx-sc 0.49.0-alpha.3", + "multiversx-sc-scenario 0.49.0-alpha.3", + "num-bigint", +] + +[[package]] +name = "multisig-pt-meta" +version = "0.0.0" +dependencies = [ + "multisig-pt", + "multiversx-sc-meta 0.49.0-alpha.3", +] + [[package]] name = "multiversx-chain-scenario-format" version = "0.22.2" @@ -3363,23 +3397,6 @@ dependencies = [ "windows-sys", ] -[[package]] -name = "test-adder" -version = "0.0.0" -dependencies = [ - "multiversx-sc 0.49.0-alpha.3", - "multiversx-sc-scenario 0.49.0-alpha.3", - "num-bigint", -] - -[[package]] -name = "test-adder-meta" -version = "0.0.0" -dependencies = [ - "multiversx-sc-meta 0.49.0-alpha.3", - "test-adder", -] - [[package]] name = "test-testapi" version = "0.0.0" @@ -3397,23 +3414,6 @@ dependencies = [ "test-testapi", ] -[[package]] -name = "test_multisig" -version = "0.0.0" -dependencies = [ - "multiversx-sc 0.49.0-alpha.3", - "multiversx-sc-scenario 0.49.0-alpha.3", - "num-bigint", -] - -[[package]] -name = "test_multisig-meta" -version = "0.0.0" -dependencies = [ - "multiversx-sc-meta 0.49.0-alpha.3", - "test_multisig", -] - [[package]] name = "thread_local" version = "1.1.7" diff --git a/Cargo.toml b/Cargo.toml index 2bdb120672..e73741f401 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -182,16 +182,16 @@ members = [ "contracts/feature-tests/use-module", "contracts/feature-tests/use-module/meta", - "contracts/foundry/addercaller", - "contracts/foundry/addercaller/meta", - "contracts/foundry/callee", - "contracts/foundry/callee/meta", - "contracts/foundry/caller", - "contracts/foundry/caller/meta", - "contracts/foundry/foundrylike", - "contracts/foundry/foundrylike/meta", - "contracts/foundry/test_multisig", - "contracts/foundry/test_multisig/meta", - "contracts/foundry/test_testapi", - "contracts/foundry/test_testapi/meta", + "contracts/parametric-tests/adder-pt", + "contracts/parametric-tests/adder-pt/meta", + "contracts/parametric-tests/addercaller", + "contracts/parametric-tests/addercaller/meta", + "contracts/parametric-tests/callee", + "contracts/parametric-tests/callee/meta", + "contracts/parametric-tests/caller", + "contracts/parametric-tests/caller/meta", + "contracts/parametric-tests/multisig-pt", + "contracts/parametric-tests/multisig-pt/meta", + "contracts/parametric-tests/testapi-pt", + "contracts/parametric-tests/testapi-pt/meta", ] diff --git a/contracts/foundry/foundrylike/meta/src/main.rs b/contracts/foundry/foundrylike/meta/src/main.rs deleted file mode 100644 index d99af9305d..0000000000 --- a/contracts/foundry/foundrylike/meta/src/main.rs +++ /dev/null @@ -1,3 +0,0 @@ -fn main() { - multiversx_sc_meta::cli_main::(); -} diff --git a/contracts/foundry/test_multisig/meta/src/main.rs b/contracts/foundry/test_multisig/meta/src/main.rs deleted file mode 100644 index 3c6c55534f..0000000000 --- a/contracts/foundry/test_multisig/meta/src/main.rs +++ /dev/null @@ -1,3 +0,0 @@ -fn main() { - multiversx_sc_meta::cli_main::(); -} diff --git a/contracts/foundry/addercaller/.gitignore b/contracts/parametric-tests/adder-pt/.gitignore similarity index 100% rename from contracts/foundry/addercaller/.gitignore rename to contracts/parametric-tests/adder-pt/.gitignore diff --git a/contracts/foundry/foundrylike/Cargo.toml b/contracts/parametric-tests/adder-pt/Cargo.toml similarity index 87% rename from contracts/foundry/foundrylike/Cargo.toml rename to contracts/parametric-tests/adder-pt/Cargo.toml index 0d09a0da3e..798f5dccdf 100644 --- a/contracts/foundry/foundrylike/Cargo.toml +++ b/contracts/parametric-tests/adder-pt/Cargo.toml @@ -1,12 +1,12 @@ [package] -name = "test-adder" +name = "adder-pt" version = "0.0.0" authors = [ "you",] edition = "2018" publish = false [lib] -path = "src/test_adder.rs" +path = "src/adder_pt.rs" [dev-dependencies] num-bigint = "0.4.2" diff --git a/contracts/foundry/foundrylike/foundry.json b/contracts/parametric-tests/adder-pt/foundry.json similarity index 100% rename from contracts/foundry/foundrylike/foundry.json rename to contracts/parametric-tests/adder-pt/foundry.json diff --git a/contracts/foundry/foundrylike/meta/Cargo.toml b/contracts/parametric-tests/adder-pt/meta/Cargo.toml similarity index 80% rename from contracts/foundry/foundrylike/meta/Cargo.toml rename to contracts/parametric-tests/adder-pt/meta/Cargo.toml index d0c7e39b56..a1b27044be 100644 --- a/contracts/foundry/foundrylike/meta/Cargo.toml +++ b/contracts/parametric-tests/adder-pt/meta/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "test-adder-meta" +name = "adder-pt-meta" version = "0.0.0" edition = "2018" publish = false @@ -7,7 +7,7 @@ authors = [ "you",] [dev-dependencies] -[dependencies.test-adder] +[dependencies.adder-pt] path = ".." [dependencies.multiversx-sc-meta] diff --git a/contracts/parametric-tests/adder-pt/meta/src/main.rs b/contracts/parametric-tests/adder-pt/meta/src/main.rs new file mode 100644 index 0000000000..aedb6bcc7e --- /dev/null +++ b/contracts/parametric-tests/adder-pt/meta/src/main.rs @@ -0,0 +1,3 @@ +fn main() { + multiversx_sc_meta::cli_main::(); +} diff --git a/contracts/foundry/addercaller/multiversx.json b/contracts/parametric-tests/adder-pt/multiversx.json similarity index 100% rename from contracts/foundry/addercaller/multiversx.json rename to contracts/parametric-tests/adder-pt/multiversx.json diff --git a/contracts/foundry/foundrylike/scenarios/test-adder.scen.json b/contracts/parametric-tests/adder-pt/scenarios/test-adder.scen.json similarity index 100% rename from contracts/foundry/foundrylike/scenarios/test-adder.scen.json rename to contracts/parametric-tests/adder-pt/scenarios/test-adder.scen.json diff --git a/contracts/foundry/foundrylike/src/test_adder.rs b/contracts/parametric-tests/adder-pt/src/adder_pt.rs similarity index 100% rename from contracts/foundry/foundrylike/src/test_adder.rs rename to contracts/parametric-tests/adder-pt/src/adder_pt.rs diff --git a/contracts/foundry/foundrylike/wasm/Cargo.lock b/contracts/parametric-tests/adder-pt/wasm/Cargo.lock similarity index 98% rename from contracts/foundry/foundrylike/wasm/Cargo.lock rename to contracts/parametric-tests/adder-pt/wasm/Cargo.lock index a68acd443c..e834e7cd07 100644 --- a/contracts/foundry/foundrylike/wasm/Cargo.lock +++ b/contracts/parametric-tests/adder-pt/wasm/Cargo.lock @@ -2,6 +2,21 @@ # It is not intended for manual editing. version = 3 +[[package]] +name = "adder-pt" +version = "0.0.0" +dependencies = [ + "multiversx-sc", +] + +[[package]] +name = "adder-pt-wasm" +version = "0.0.0" +dependencies = [ + "adder-pt", + "multiversx-sc-wasm-adapter", +] + [[package]] name = "arrayvec" version = "0.7.4" @@ -148,21 +163,6 @@ dependencies = [ "unicode-ident", ] -[[package]] -name = "test-adder" -version = "0.0.0" -dependencies = [ - "multiversx-sc", -] - -[[package]] -name = "test-adder-wasm" -version = "0.0.0" -dependencies = [ - "multiversx-sc-wasm-adapter", - "test-adder", -] - [[package]] name = "unicode-ident" version = "1.0.12" diff --git a/contracts/foundry/foundrylike/wasm/Cargo.toml b/contracts/parametric-tests/adder-pt/wasm/Cargo.toml similarity index 91% rename from contracts/foundry/foundrylike/wasm/Cargo.toml rename to contracts/parametric-tests/adder-pt/wasm/Cargo.toml index 931a19b36a..84472dc90b 100644 --- a/contracts/foundry/foundrylike/wasm/Cargo.toml +++ b/contracts/parametric-tests/adder-pt/wasm/Cargo.toml @@ -5,7 +5,7 @@ # ########################################## [package] -name = "test-adder-wasm" +name = "adder-pt-wasm" version = "0.0.0" edition = "2018" publish = false @@ -21,7 +21,7 @@ debug = false panic = "abort" overflow-checks = false -[dependencies.test-adder] +[dependencies.adder-pt] path = ".." [dependencies.multiversx-sc-wasm-adapter] diff --git a/contracts/foundry/foundrylike/wasm/src/lib.rs b/contracts/parametric-tests/adder-pt/wasm/src/lib.rs similarity index 98% rename from contracts/foundry/foundrylike/wasm/src/lib.rs rename to contracts/parametric-tests/adder-pt/wasm/src/lib.rs index 724443eac1..e5b5f0f806 100644 --- a/contracts/foundry/foundrylike/wasm/src/lib.rs +++ b/contracts/parametric-tests/adder-pt/wasm/src/lib.rs @@ -17,7 +17,7 @@ multiversx_sc_wasm_adapter::allocator!(); multiversx_sc_wasm_adapter::panic_handler!(); multiversx_sc_wasm_adapter::endpoints! { - test_adder + adder_pt ( init => init test_call_add => test_call_add diff --git a/contracts/foundry/callee/.gitignore b/contracts/parametric-tests/addercaller/.gitignore similarity index 100% rename from contracts/foundry/callee/.gitignore rename to contracts/parametric-tests/addercaller/.gitignore diff --git a/contracts/foundry/addercaller/Cargo.toml b/contracts/parametric-tests/addercaller/Cargo.toml similarity index 100% rename from contracts/foundry/addercaller/Cargo.toml rename to contracts/parametric-tests/addercaller/Cargo.toml diff --git a/contracts/foundry/addercaller/meta/Cargo.toml b/contracts/parametric-tests/addercaller/meta/Cargo.toml similarity index 100% rename from contracts/foundry/addercaller/meta/Cargo.toml rename to contracts/parametric-tests/addercaller/meta/Cargo.toml diff --git a/contracts/foundry/addercaller/meta/src/main.rs b/contracts/parametric-tests/addercaller/meta/src/main.rs similarity index 100% rename from contracts/foundry/addercaller/meta/src/main.rs rename to contracts/parametric-tests/addercaller/meta/src/main.rs diff --git a/contracts/foundry/callee/multiversx.json b/contracts/parametric-tests/addercaller/multiversx.json similarity index 100% rename from contracts/foundry/callee/multiversx.json rename to contracts/parametric-tests/addercaller/multiversx.json diff --git a/contracts/foundry/addercaller/scenarios/addercaller.scen.json b/contracts/parametric-tests/addercaller/scenarios/addercaller.scen.json similarity index 100% rename from contracts/foundry/addercaller/scenarios/addercaller.scen.json rename to contracts/parametric-tests/addercaller/scenarios/addercaller.scen.json diff --git a/contracts/foundry/addercaller/scenarios/addercaller_out_of_funds.scen.json b/contracts/parametric-tests/addercaller/scenarios/addercaller_out_of_funds.scen.json similarity index 100% rename from contracts/foundry/addercaller/scenarios/addercaller_out_of_funds.scen.json rename to contracts/parametric-tests/addercaller/scenarios/addercaller_out_of_funds.scen.json diff --git a/contracts/foundry/addercaller/src/addercaller.rs b/contracts/parametric-tests/addercaller/src/addercaller.rs similarity index 100% rename from contracts/foundry/addercaller/src/addercaller.rs rename to contracts/parametric-tests/addercaller/src/addercaller.rs diff --git a/contracts/foundry/addercaller/wasm/Cargo.lock b/contracts/parametric-tests/addercaller/wasm/Cargo.lock similarity index 91% rename from contracts/foundry/addercaller/wasm/Cargo.lock rename to contracts/parametric-tests/addercaller/wasm/Cargo.lock index 358c2b199f..3a3ef632b9 100644 --- a/contracts/foundry/addercaller/wasm/Cargo.lock +++ b/contracts/parametric-tests/addercaller/wasm/Cargo.lock @@ -3,17 +3,17 @@ version = 3 [[package]] -name = "addercaller" +name = "adder-caller-pt" version = "0.0.0" dependencies = [ "multiversx-sc", ] [[package]] -name = "addercaller-wasm" +name = "adder-caller-pt-wasm" version = "0.0.0" dependencies = [ - "addercaller", + "adder-caller-pt", "multiversx-sc-wasm-adapter", ] @@ -55,9 +55,9 @@ checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" [[package]] name = "multiversx-sc" -version = "0.49.0-alpha.3" +version = "0.49.0-alpha.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3294c0d990001b56d4b6a9fdecbc5a9bc0f9c49f9b5650c0ebc7535ed1949f3f" +checksum = "c86c9822909c32b10ad50f376d2a710ff465b806aa710874c0417053fdc16530" dependencies = [ "bitflags", "hex-literal", @@ -90,9 +90,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.49.0-alpha.3" +version = "0.49.0-alpha.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74c63eebab4c614574ec02fb380da77edf49c8af01881f0d7543fb4b56dc6ef6" +checksum = "bc4fe5b47d3d7e51b8c2ed6a7c6d656885875cd3d41931193c364fe8ec7814d8" dependencies = [ "hex", "proc-macro2", @@ -103,9 +103,9 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.49.0-alpha.3" +version = "0.49.0-alpha.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c5022b0818e3c16fc76d5c812fca70a46f2fcec4b581600010b2c8cddac7342" +checksum = "af6a8a42294b3fb2d6ca4020fb297364833cc5316248a1f1254318b36abbbe5e" dependencies = [ "multiversx-sc", ] diff --git a/contracts/foundry/addercaller/wasm/Cargo.toml b/contracts/parametric-tests/addercaller/wasm/Cargo.toml similarity index 89% rename from contracts/foundry/addercaller/wasm/Cargo.toml rename to contracts/parametric-tests/addercaller/wasm/Cargo.toml index 2601cd6d0b..876637bd8b 100644 --- a/contracts/foundry/addercaller/wasm/Cargo.toml +++ b/contracts/parametric-tests/addercaller/wasm/Cargo.toml @@ -5,7 +5,7 @@ # ########################################## [package] -name = "addercaller-wasm" +name = "adder-caller-pt-wasm" version = "0.0.0" edition = "2018" publish = false @@ -21,7 +21,7 @@ debug = false panic = "abort" overflow-checks = false -[dependencies.addercaller] +[dependencies.adder-caller-pt] path = ".." [dependencies.multiversx-sc-wasm-adapter] diff --git a/contracts/foundry/addercaller/wasm/src/lib.rs b/contracts/parametric-tests/addercaller/wasm/src/lib.rs similarity index 97% rename from contracts/foundry/addercaller/wasm/src/lib.rs rename to contracts/parametric-tests/addercaller/wasm/src/lib.rs index af4941cacd..594f9869c1 100644 --- a/contracts/foundry/addercaller/wasm/src/lib.rs +++ b/contracts/parametric-tests/addercaller/wasm/src/lib.rs @@ -17,7 +17,7 @@ multiversx_sc_wasm_adapter::allocator!(); multiversx_sc_wasm_adapter::panic_handler!(); multiversx_sc_wasm_adapter::endpoints! { - addercaller + adder_caller_pt ( init => init call_adder => call_adder diff --git a/contracts/foundry/caller/.gitignore b/contracts/parametric-tests/callee/.gitignore similarity index 100% rename from contracts/foundry/caller/.gitignore rename to contracts/parametric-tests/callee/.gitignore diff --git a/contracts/foundry/callee/Cargo.toml b/contracts/parametric-tests/callee/Cargo.toml similarity index 100% rename from contracts/foundry/callee/Cargo.toml rename to contracts/parametric-tests/callee/Cargo.toml diff --git a/contracts/foundry/callee/meta/Cargo.toml b/contracts/parametric-tests/callee/meta/Cargo.toml similarity index 100% rename from contracts/foundry/callee/meta/Cargo.toml rename to contracts/parametric-tests/callee/meta/Cargo.toml diff --git a/contracts/foundry/callee/meta/src/main.rs b/contracts/parametric-tests/callee/meta/src/main.rs similarity index 100% rename from contracts/foundry/callee/meta/src/main.rs rename to contracts/parametric-tests/callee/meta/src/main.rs diff --git a/contracts/foundry/caller/multiversx.json b/contracts/parametric-tests/callee/multiversx.json similarity index 100% rename from contracts/foundry/caller/multiversx.json rename to contracts/parametric-tests/callee/multiversx.json diff --git a/contracts/foundry/callee/src/callee.rs b/contracts/parametric-tests/callee/src/callee.rs similarity index 100% rename from contracts/foundry/callee/src/callee.rs rename to contracts/parametric-tests/callee/src/callee.rs diff --git a/contracts/foundry/callee/wasm/Cargo.lock b/contracts/parametric-tests/callee/wasm/Cargo.lock similarity index 93% rename from contracts/foundry/callee/wasm/Cargo.lock rename to contracts/parametric-tests/callee/wasm/Cargo.lock index 9689a4b831..91e2b4f45e 100644 --- a/contracts/foundry/callee/wasm/Cargo.lock +++ b/contracts/parametric-tests/callee/wasm/Cargo.lock @@ -55,9 +55,9 @@ checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" [[package]] name = "multiversx-sc" -version = "0.49.0-alpha.3" +version = "0.49.0-alpha.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3294c0d990001b56d4b6a9fdecbc5a9bc0f9c49f9b5650c0ebc7535ed1949f3f" +checksum = "c86c9822909c32b10ad50f376d2a710ff465b806aa710874c0417053fdc16530" dependencies = [ "bitflags", "hex-literal", @@ -90,9 +90,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.49.0-alpha.3" +version = "0.49.0-alpha.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74c63eebab4c614574ec02fb380da77edf49c8af01881f0d7543fb4b56dc6ef6" +checksum = "bc4fe5b47d3d7e51b8c2ed6a7c6d656885875cd3d41931193c364fe8ec7814d8" dependencies = [ "hex", "proc-macro2", @@ -103,9 +103,9 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.49.0-alpha.3" +version = "0.49.0-alpha.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c5022b0818e3c16fc76d5c812fca70a46f2fcec4b581600010b2c8cddac7342" +checksum = "af6a8a42294b3fb2d6ca4020fb297364833cc5316248a1f1254318b36abbbe5e" dependencies = [ "multiversx-sc", ] diff --git a/contracts/foundry/callee/wasm/Cargo.toml b/contracts/parametric-tests/callee/wasm/Cargo.toml similarity index 100% rename from contracts/foundry/callee/wasm/Cargo.toml rename to contracts/parametric-tests/callee/wasm/Cargo.toml diff --git a/contracts/foundry/callee/wasm/src/lib.rs b/contracts/parametric-tests/callee/wasm/src/lib.rs similarity index 100% rename from contracts/foundry/callee/wasm/src/lib.rs rename to contracts/parametric-tests/callee/wasm/src/lib.rs diff --git a/contracts/foundry/foundrylike/.gitignore b/contracts/parametric-tests/caller/.gitignore similarity index 100% rename from contracts/foundry/foundrylike/.gitignore rename to contracts/parametric-tests/caller/.gitignore diff --git a/contracts/foundry/caller/Cargo.toml b/contracts/parametric-tests/caller/Cargo.toml similarity index 100% rename from contracts/foundry/caller/Cargo.toml rename to contracts/parametric-tests/caller/Cargo.toml diff --git a/contracts/foundry/caller/meta/Cargo.toml b/contracts/parametric-tests/caller/meta/Cargo.toml similarity index 100% rename from contracts/foundry/caller/meta/Cargo.toml rename to contracts/parametric-tests/caller/meta/Cargo.toml diff --git a/contracts/foundry/caller/meta/src/main.rs b/contracts/parametric-tests/caller/meta/src/main.rs similarity index 100% rename from contracts/foundry/caller/meta/src/main.rs rename to contracts/parametric-tests/caller/meta/src/main.rs diff --git a/contracts/foundry/foundrylike/multiversx.json b/contracts/parametric-tests/caller/multiversx.json similarity index 100% rename from contracts/foundry/foundrylike/multiversx.json rename to contracts/parametric-tests/caller/multiversx.json diff --git a/contracts/foundry/caller/scenarios/caller.scen.json b/contracts/parametric-tests/caller/scenarios/caller.scen.json similarity index 100% rename from contracts/foundry/caller/scenarios/caller.scen.json rename to contracts/parametric-tests/caller/scenarios/caller.scen.json diff --git a/contracts/foundry/caller/scenarios/errors.scen.json b/contracts/parametric-tests/caller/scenarios/errors.scen.json similarity index 100% rename from contracts/foundry/caller/scenarios/errors.scen.json rename to contracts/parametric-tests/caller/scenarios/errors.scen.json diff --git a/contracts/foundry/caller/scenarios/exec_on_dest_ctx.scen.json b/contracts/parametric-tests/caller/scenarios/exec_on_dest_ctx.scen.json similarity index 100% rename from contracts/foundry/caller/scenarios/exec_on_dest_ctx.scen.json rename to contracts/parametric-tests/caller/scenarios/exec_on_dest_ctx.scen.json diff --git a/contracts/foundry/caller/scenarios/steps/check_1.steps.json b/contracts/parametric-tests/caller/scenarios/steps/check_1.steps.json similarity index 100% rename from contracts/foundry/caller/scenarios/steps/check_1.steps.json rename to contracts/parametric-tests/caller/scenarios/steps/check_1.steps.json diff --git a/contracts/foundry/caller/scenarios/steps/check_init.steps.json b/contracts/parametric-tests/caller/scenarios/steps/check_init.steps.json similarity index 100% rename from contracts/foundry/caller/scenarios/steps/check_init.steps.json rename to contracts/parametric-tests/caller/scenarios/steps/check_init.steps.json diff --git a/contracts/foundry/caller/scenarios/steps/init.steps.json b/contracts/parametric-tests/caller/scenarios/steps/init.steps.json similarity index 100% rename from contracts/foundry/caller/scenarios/steps/init.steps.json rename to contracts/parametric-tests/caller/scenarios/steps/init.steps.json diff --git a/contracts/foundry/caller/src/caller.rs b/contracts/parametric-tests/caller/src/caller.rs similarity index 100% rename from contracts/foundry/caller/src/caller.rs rename to contracts/parametric-tests/caller/src/caller.rs diff --git a/contracts/foundry/caller/wasm/Cargo.lock b/contracts/parametric-tests/caller/wasm/Cargo.lock similarity index 93% rename from contracts/foundry/caller/wasm/Cargo.lock rename to contracts/parametric-tests/caller/wasm/Cargo.lock index b1654f13e8..b6ebe3fde6 100644 --- a/contracts/foundry/caller/wasm/Cargo.lock +++ b/contracts/parametric-tests/caller/wasm/Cargo.lock @@ -55,9 +55,9 @@ checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" [[package]] name = "multiversx-sc" -version = "0.49.0-alpha.3" +version = "0.49.0-alpha.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3294c0d990001b56d4b6a9fdecbc5a9bc0f9c49f9b5650c0ebc7535ed1949f3f" +checksum = "c86c9822909c32b10ad50f376d2a710ff465b806aa710874c0417053fdc16530" dependencies = [ "bitflags", "hex-literal", @@ -90,9 +90,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.49.0-alpha.3" +version = "0.49.0-alpha.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74c63eebab4c614574ec02fb380da77edf49c8af01881f0d7543fb4b56dc6ef6" +checksum = "bc4fe5b47d3d7e51b8c2ed6a7c6d656885875cd3d41931193c364fe8ec7814d8" dependencies = [ "hex", "proc-macro2", @@ -103,9 +103,9 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.49.0-alpha.3" +version = "0.49.0-alpha.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c5022b0818e3c16fc76d5c812fca70a46f2fcec4b581600010b2c8cddac7342" +checksum = "af6a8a42294b3fb2d6ca4020fb297364833cc5316248a1f1254318b36abbbe5e" dependencies = [ "multiversx-sc", ] diff --git a/contracts/foundry/caller/wasm/Cargo.toml b/contracts/parametric-tests/caller/wasm/Cargo.toml similarity index 100% rename from contracts/foundry/caller/wasm/Cargo.toml rename to contracts/parametric-tests/caller/wasm/Cargo.toml diff --git a/contracts/foundry/caller/wasm/src/lib.rs b/contracts/parametric-tests/caller/wasm/src/lib.rs similarity index 100% rename from contracts/foundry/caller/wasm/src/lib.rs rename to contracts/parametric-tests/caller/wasm/src/lib.rs diff --git a/contracts/foundry/test_multisig/.gitignore b/contracts/parametric-tests/multisig-pt/.gitignore similarity index 100% rename from contracts/foundry/test_multisig/.gitignore rename to contracts/parametric-tests/multisig-pt/.gitignore diff --git a/contracts/foundry/test_multisig/Cargo.toml b/contracts/parametric-tests/multisig-pt/Cargo.toml similarity index 86% rename from contracts/foundry/test_multisig/Cargo.toml rename to contracts/parametric-tests/multisig-pt/Cargo.toml index cd6b864645..366cf52119 100644 --- a/contracts/foundry/test_multisig/Cargo.toml +++ b/contracts/parametric-tests/multisig-pt/Cargo.toml @@ -1,12 +1,12 @@ [package] -name = "test_multisig" +name = "multisig-pt" version = "0.0.0" authors = [ "you",] edition = "2018" publish = false [lib] -path = "src/test_multisig.rs" +path = "src/multisig_pt.rs" [dev-dependencies] num-bigint = "0.4.2" diff --git a/contracts/foundry/test_multisig/foundry.json b/contracts/parametric-tests/multisig-pt/foundry.json similarity index 100% rename from contracts/foundry/test_multisig/foundry.json rename to contracts/parametric-tests/multisig-pt/foundry.json diff --git a/contracts/foundry/test_multisig/meta/Cargo.toml b/contracts/parametric-tests/multisig-pt/meta/Cargo.toml similarity index 78% rename from contracts/foundry/test_multisig/meta/Cargo.toml rename to contracts/parametric-tests/multisig-pt/meta/Cargo.toml index f0ff1dd388..4f92894409 100644 --- a/contracts/foundry/test_multisig/meta/Cargo.toml +++ b/contracts/parametric-tests/multisig-pt/meta/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "test_multisig-meta" +name = "multisig-pt-meta" version = "0.0.0" edition = "2018" publish = false @@ -7,7 +7,7 @@ authors = [ "you",] [dev-dependencies] -[dependencies.test_multisig] +[dependencies.multisig-pt] path = ".." [dependencies.multiversx-sc-meta] diff --git a/contracts/parametric-tests/multisig-pt/meta/src/main.rs b/contracts/parametric-tests/multisig-pt/meta/src/main.rs new file mode 100644 index 0000000000..53506c1477 --- /dev/null +++ b/contracts/parametric-tests/multisig-pt/meta/src/main.rs @@ -0,0 +1,3 @@ +fn main() { + multiversx_sc_meta::cli_main::(); +} diff --git a/contracts/foundry/test_multisig/multiversx.json b/contracts/parametric-tests/multisig-pt/multiversx.json similarity index 100% rename from contracts/foundry/test_multisig/multiversx.json rename to contracts/parametric-tests/multisig-pt/multiversx.json diff --git a/contracts/foundry/test_multisig/src/test_multisig.rs b/contracts/parametric-tests/multisig-pt/src/multisig_pt.rs similarity index 100% rename from contracts/foundry/test_multisig/src/test_multisig.rs rename to contracts/parametric-tests/multisig-pt/src/multisig_pt.rs diff --git a/contracts/foundry/test_multisig/wasm/Cargo.lock b/contracts/parametric-tests/multisig-pt/wasm/Cargo.lock similarity index 98% rename from contracts/foundry/test_multisig/wasm/Cargo.lock rename to contracts/parametric-tests/multisig-pt/wasm/Cargo.lock index 4930af323f..4b78a31b89 100644 --- a/contracts/foundry/test_multisig/wasm/Cargo.lock +++ b/contracts/parametric-tests/multisig-pt/wasm/Cargo.lock @@ -38,6 +38,21 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" +[[package]] +name = "multisig-pt" +version = "0.0.0" +dependencies = [ + "multiversx-sc", +] + +[[package]] +name = "multisig-pt-wasm" +version = "0.0.0" +dependencies = [ + "multisig-pt", + "multiversx-sc-wasm-adapter", +] + [[package]] name = "multiversx-sc" version = "0.49.0-alpha.3" @@ -148,21 +163,6 @@ dependencies = [ "unicode-ident", ] -[[package]] -name = "test_multisig" -version = "0.0.0" -dependencies = [ - "multiversx-sc", -] - -[[package]] -name = "test_multisig-wasm" -version = "0.0.0" -dependencies = [ - "multiversx-sc-wasm-adapter", - "test_multisig", -] - [[package]] name = "unicode-ident" version = "1.0.12" diff --git a/contracts/foundry/test_multisig/wasm/Cargo.toml b/contracts/parametric-tests/multisig-pt/wasm/Cargo.toml similarity index 90% rename from contracts/foundry/test_multisig/wasm/Cargo.toml rename to contracts/parametric-tests/multisig-pt/wasm/Cargo.toml index de02caa7b3..e6f4bea6aa 100644 --- a/contracts/foundry/test_multisig/wasm/Cargo.toml +++ b/contracts/parametric-tests/multisig-pt/wasm/Cargo.toml @@ -5,7 +5,7 @@ # ########################################## [package] -name = "test_multisig-wasm" +name = "multisig-pt-wasm" version = "0.0.0" edition = "2018" publish = false @@ -21,7 +21,7 @@ debug = false panic = "abort" overflow-checks = false -[dependencies.test_multisig] +[dependencies.multisig-pt] path = ".." [dependencies.multiversx-sc-wasm-adapter] diff --git a/contracts/foundry/test_multisig/wasm/src/lib.rs b/contracts/parametric-tests/multisig-pt/wasm/src/lib.rs similarity index 97% rename from contracts/foundry/test_multisig/wasm/src/lib.rs rename to contracts/parametric-tests/multisig-pt/wasm/src/lib.rs index 2ad0b3b381..3da4edfadf 100644 --- a/contracts/foundry/test_multisig/wasm/src/lib.rs +++ b/contracts/parametric-tests/multisig-pt/wasm/src/lib.rs @@ -17,7 +17,7 @@ multiversx_sc_wasm_adapter::allocator!(); multiversx_sc_wasm_adapter::panic_handler!(); multiversx_sc_wasm_adapter::endpoints! { - test_multisig + multisig_pt ( init => init test_change_quorum => test_change_quorum diff --git a/contracts/foundry/test_testapi/.gitignore b/contracts/parametric-tests/testapi-pt/.gitignore similarity index 100% rename from contracts/foundry/test_testapi/.gitignore rename to contracts/parametric-tests/testapi-pt/.gitignore diff --git a/contracts/foundry/test_testapi/Cargo.toml b/contracts/parametric-tests/testapi-pt/Cargo.toml similarity index 92% rename from contracts/foundry/test_testapi/Cargo.toml rename to contracts/parametric-tests/testapi-pt/Cargo.toml index f6d96d9afa..bce6f3202d 100644 --- a/contracts/foundry/test_testapi/Cargo.toml +++ b/contracts/parametric-tests/testapi-pt/Cargo.toml @@ -6,7 +6,7 @@ edition = "2018" publish = false [lib] -path = "src/test_testapi.rs" +path = "src/testapi_pt.rs" [dev-dependencies] num-bigint = "0.4.2" diff --git a/contracts/foundry/test_testapi/foundry.json b/contracts/parametric-tests/testapi-pt/foundry.json similarity index 100% rename from contracts/foundry/test_testapi/foundry.json rename to contracts/parametric-tests/testapi-pt/foundry.json diff --git a/contracts/foundry/test_testapi/meta/Cargo.toml b/contracts/parametric-tests/testapi-pt/meta/Cargo.toml similarity index 100% rename from contracts/foundry/test_testapi/meta/Cargo.toml rename to contracts/parametric-tests/testapi-pt/meta/Cargo.toml diff --git a/contracts/foundry/test_testapi/meta/src/main.rs b/contracts/parametric-tests/testapi-pt/meta/src/main.rs similarity index 100% rename from contracts/foundry/test_testapi/meta/src/main.rs rename to contracts/parametric-tests/testapi-pt/meta/src/main.rs diff --git a/contracts/foundry/test_testapi/multiversx.json b/contracts/parametric-tests/testapi-pt/multiversx.json similarity index 100% rename from contracts/foundry/test_testapi/multiversx.json rename to contracts/parametric-tests/testapi-pt/multiversx.json diff --git a/contracts/foundry/test_testapi/src/test_testapi.rs b/contracts/parametric-tests/testapi-pt/src/testapi_pt.rs similarity index 100% rename from contracts/foundry/test_testapi/src/test_testapi.rs rename to contracts/parametric-tests/testapi-pt/src/testapi_pt.rs diff --git a/contracts/foundry/test_testapi/wasm/Cargo.lock b/contracts/parametric-tests/testapi-pt/wasm/Cargo.lock similarity index 100% rename from contracts/foundry/test_testapi/wasm/Cargo.lock rename to contracts/parametric-tests/testapi-pt/wasm/Cargo.lock diff --git a/contracts/foundry/test_testapi/wasm/Cargo.toml b/contracts/parametric-tests/testapi-pt/wasm/Cargo.toml similarity index 100% rename from contracts/foundry/test_testapi/wasm/Cargo.toml rename to contracts/parametric-tests/testapi-pt/wasm/Cargo.toml diff --git a/contracts/foundry/test_testapi/wasm/src/lib.rs b/contracts/parametric-tests/testapi-pt/wasm/src/lib.rs similarity index 100% rename from contracts/foundry/test_testapi/wasm/src/lib.rs rename to contracts/parametric-tests/testapi-pt/wasm/src/lib.rs From 243c7fcaf75af99ce49a04de76a813ed14eb5023 Mon Sep 17 00:00:00 2001 From: Andrei Marinica Date: Thu, 2 May 2024 15:43:29 +0300 Subject: [PATCH 10/20] param tests - unified call syntax --- contracts/examples/adder/sc-config.toml | 3 + .../adder-pt/src/adder_proxy.rs | 110 ++++++++++++++++++ .../parametric-tests/adder-pt/src/adder_pt.rs | 26 ++--- .../base/src/types/interaction/tx_exec.rs | 1 + .../interaction/tx_exec/tx_exec_test_call.rs | 33 ++++++ 5 files changed, 157 insertions(+), 16 deletions(-) create mode 100644 contracts/parametric-tests/adder-pt/src/adder_proxy.rs create mode 100644 framework/base/src/types/interaction/tx_exec/tx_exec_test_call.rs diff --git a/contracts/examples/adder/sc-config.toml b/contracts/examples/adder/sc-config.toml index b56f82b429..6e37a3a481 100644 --- a/contracts/examples/adder/sc-config.toml +++ b/contracts/examples/adder/sc-config.toml @@ -2,3 +2,6 @@ [[proxy]] path = "src/adder_proxy.rs" + +[[proxy]] +path = "../../parametric-tests/adder-pt/src/adder_proxy.rs" \ No newline at end of file diff --git a/contracts/parametric-tests/adder-pt/src/adder_proxy.rs b/contracts/parametric-tests/adder-pt/src/adder_proxy.rs new file mode 100644 index 0000000000..0b1b663669 --- /dev/null +++ b/contracts/parametric-tests/adder-pt/src/adder_proxy.rs @@ -0,0 +1,110 @@ +// Code generated by the multiversx-sc proxy generator. DO NOT EDIT. + +//////////////////////////////////////////////////// +////////////////// AUTO-GENERATED ////////////////// +//////////////////////////////////////////////////// + +#![allow(dead_code)] +#![allow(clippy::all)] + +use multiversx_sc::proxy_imports::*; + +pub struct AdderProxy; + +impl TxProxyTrait for AdderProxy +where + Env: TxEnv, + From: TxFrom, + To: TxTo, + Gas: TxGas, +{ + type TxProxyMethods = AdderProxyMethods; + + fn proxy_methods(self, tx: Tx) -> Self::TxProxyMethods { + AdderProxyMethods { wrapped_tx: tx } + } +} + +pub struct AdderProxyMethods +where + Env: TxEnv, + From: TxFrom, + To: TxTo, + Gas: TxGas, +{ + wrapped_tx: Tx, +} + +#[rustfmt::skip] +impl AdderProxyMethods +where + Env: TxEnv, + Env::Api: VMApi, + From: TxFrom, + Gas: TxGas, +{ + pub fn init< + Arg0: CodecInto>, + >( + self, + initial_value: Arg0, + ) -> TxProxyDeploy { + self.wrapped_tx + .raw_deploy() + .argument(&initial_value) + .original_result() + } +} + +#[rustfmt::skip] +impl AdderProxyMethods +where + Env: TxEnv, + Env::Api: VMApi, + From: TxFrom, + To: TxTo, + Gas: TxGas, +{ + pub fn upgrade< + Arg0: CodecInto>, + >( + self, + initial_value: Arg0, + ) -> TxProxyUpgrade { + self.wrapped_tx + .raw_upgrade() + .argument(&initial_value) + .original_result() + } +} + +#[rustfmt::skip] +impl AdderProxyMethods +where + Env: TxEnv, + Env::Api: VMApi, + From: TxFrom, + To: TxTo, + Gas: TxGas, +{ + pub fn sum( + self, + ) -> TxProxyCall> { + self.wrapped_tx + .raw_call("getSum") + .original_result() + } + + /// Add desired amount to the storage variable. + pub fn add< + Arg0: CodecInto>, + >( + self, + value: Arg0, + ) -> TxProxyCall { + self.wrapped_tx + .raw_call("add") + .argument(&value) + .original_result() + } +} diff --git a/contracts/parametric-tests/adder-pt/src/adder_pt.rs b/contracts/parametric-tests/adder-pt/src/adder_pt.rs index 499a07aacc..2647a6b255 100644 --- a/contracts/parametric-tests/adder-pt/src/adder_pt.rs +++ b/contracts/parametric-tests/adder-pt/src/adder_pt.rs @@ -1,8 +1,11 @@ #![no_std] +mod adder_proxy; + multiversx_sc::imports!(); static INIT_SUM: u32 = 5u32; + #[multiversx_sc::contract] pub trait TestAdder { #[storage_mapper("ownerAddress")] @@ -88,22 +91,13 @@ pub trait TestAdder { let owner = self.owner_address().get(); let adder = self.adder_address().get(); - let mut adder_init_args = ManagedArgBuffer::new(); - adder_init_args.push_arg(value); // initial sum - // start a prank and call 'adder' from 'owner' - self.test_raw().start_prank(&owner); - let res = self.send_raw().direct_egld_execute( - &adder, - &BigUint::from(0u32), - 5000000, - &ManagedBuffer::from(b"add"), - &adder_init_args, - ); - self.test_raw().stop_prank(); - - if res.is_err() { - panic!("call failed"); - } + self.tx() + .from(owner) + .to(adder) + .typed(adder_proxy::AdderProxy) + .add(value) + .gas(5000000) + .test_call(); } } diff --git a/framework/base/src/types/interaction/tx_exec.rs b/framework/base/src/types/interaction/tx_exec.rs index 0c200df330..5a691f2bbf 100644 --- a/framework/base/src/types/interaction/tx_exec.rs +++ b/framework/base/src/types/interaction/tx_exec.rs @@ -4,6 +4,7 @@ mod tx_exec_async_promises; mod tx_exec_deploy; mod tx_exec_sync; mod tx_exec_te; +mod tx_exec_test_call; mod tx_exec_upgrade; pub use tx_env_sc::*; diff --git a/framework/base/src/types/interaction/tx_exec/tx_exec_test_call.rs b/framework/base/src/types/interaction/tx_exec/tx_exec_test_call.rs new file mode 100644 index 0000000000..93f7f9331a --- /dev/null +++ b/framework/base/src/types/interaction/tx_exec/tx_exec_test_call.rs @@ -0,0 +1,33 @@ +use crate::api::{CallTypeApi, TestApi}; + +use crate::{ + contract_base::TestRawWrapper, + proxy_imports::TxFromSpecified, + types::{ + FunctionCall, Tx, TxData, TxEmptyResultHandler, TxGas, TxPayment, TxScEnv, TxToSpecified, + }, +}; + +impl Tx, From, To, Payment, Gas, FC, RH> +where + Api: CallTypeApi + TestApi, + From: TxFromSpecified>, + To: TxToSpecified>, + Payment: TxPayment>, + Gas: TxGas>, + FC: TxData> + Into>, + RH: TxEmptyResultHandler>, +{ + pub fn test_call(self) { + self.from.with_value_ref(&self.env, |from| { + TestRawWrapper::::new().start_prank(from); + }); + + let gas_limit = self.gas.gas_value(&self.env); + self.to.with_value_ref(&self.env, |to| { + self.payment + .perform_transfer_execute(&self.env, to, gas_limit, self.data.into()); + }); + TestRawWrapper::::new().stop_prank(); + } +} From 8c5628168e89273f0a6f43226b305708996045b9 Mon Sep 17 00:00:00 2001 From: Andrei Marinica Date: Tue, 4 Jun 2024 02:09:29 +0300 Subject: [PATCH 11/20] pretty print --- framework/meta/src/cmd/contract/sc_config/wasm_build.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/framework/meta/src/cmd/contract/sc_config/wasm_build.rs b/framework/meta/src/cmd/contract/sc_config/wasm_build.rs index bfe0539738..5b6f09659a 100644 --- a/framework/meta/src/cmd/contract/sc_config/wasm_build.rs +++ b/framework/meta/src/cmd/contract/sc_config/wasm_build.rs @@ -175,11 +175,17 @@ fn print_ei_check(wasm_data: &WasmInfo, check_ei: &Option) { return; } + let mut has_warning = false; for import_name in &wasm_data.imports { if !ei.contains_vm_hook(import_name.as_str()) { + has_warning = true; print_invalid_vm_hook(import_name.as_str(), ei.name()); } } + + if has_warning { + println!(); + } } else { print_ignore_ei_check(); } From 1666391b270e7c5905bdf49ec3189231ce800a38 Mon Sep 17 00:00:00 2001 From: Andrei Marinica Date: Tue, 4 Jun 2024 02:16:28 +0300 Subject: [PATCH 12/20] rebuild, kasmer config fix --- .../parametric-tests/adder-pt/foundry.json | 5 -- .../parametric-tests/adder-pt/kasmer.json | 5 ++ .../adder-pt/src/adder_proxy.rs | 18 ++++--- .../parametric-tests/adder-pt/wasm/Cargo.lock | 38 +++++++------ .../parametric-tests/adder-pt/wasm/Cargo.toml | 3 ++ .../parametric-tests/adder-pt/wasm/src/lib.rs | 2 - .../addercaller/wasm/Cargo.lock | 54 +++++++++++-------- .../addercaller/wasm/Cargo.toml | 7 ++- .../addercaller/wasm/src/lib.rs | 4 +- .../parametric-tests/callee/wasm/Cargo.lock | 48 ++++++++++------- .../parametric-tests/callee/wasm/Cargo.toml | 3 ++ .../parametric-tests/callee/wasm/src/lib.rs | 2 - .../parametric-tests/caller/wasm/Cargo.lock | 48 ++++++++++------- .../parametric-tests/caller/wasm/Cargo.toml | 3 ++ .../parametric-tests/caller/wasm/src/lib.rs | 2 - .../multisig-pt/wasm/Cargo.lock | 38 +++++++------ .../multisig-pt/wasm/Cargo.toml | 3 ++ .../multisig-pt/wasm/src/lib.rs | 2 - .../testapi-pt/wasm/Cargo.lock | 38 +++++++------ .../testapi-pt/wasm/Cargo.toml | 3 ++ .../testapi-pt/wasm/src/lib.rs | 2 - 21 files changed, 193 insertions(+), 135 deletions(-) delete mode 100644 contracts/parametric-tests/adder-pt/foundry.json create mode 100644 contracts/parametric-tests/adder-pt/kasmer.json diff --git a/contracts/parametric-tests/adder-pt/foundry.json b/contracts/parametric-tests/adder-pt/foundry.json deleted file mode 100644 index 00b7434da3..0000000000 --- a/contracts/parametric-tests/adder-pt/foundry.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "contract_paths": [ - "../../../deps/mx-sdk-rs/contracts/examples/adder/output/adder.wasm" - ] -} \ No newline at end of file diff --git a/contracts/parametric-tests/adder-pt/kasmer.json b/contracts/parametric-tests/adder-pt/kasmer.json new file mode 100644 index 0000000000..67d0583c45 --- /dev/null +++ b/contracts/parametric-tests/adder-pt/kasmer.json @@ -0,0 +1,5 @@ +{ + "contract_paths": [ + "../../examples/adder/output/adder.wasm" + ] +} \ No newline at end of file diff --git a/contracts/parametric-tests/adder-pt/src/adder_proxy.rs b/contracts/parametric-tests/adder-pt/src/adder_proxy.rs index 0b1b663669..fd79b14ac8 100644 --- a/contracts/parametric-tests/adder-pt/src/adder_proxy.rs +++ b/contracts/parametric-tests/adder-pt/src/adder_proxy.rs @@ -44,12 +44,13 @@ where Gas: TxGas, { pub fn init< - Arg0: CodecInto>, + Arg0: ProxyArg>, >( self, initial_value: Arg0, - ) -> TxProxyDeploy { + ) -> TxTypedDeploy { self.wrapped_tx + .payment(NotPayable) .raw_deploy() .argument(&initial_value) .original_result() @@ -66,12 +67,13 @@ where Gas: TxGas, { pub fn upgrade< - Arg0: CodecInto>, + Arg0: ProxyArg>, >( self, initial_value: Arg0, - ) -> TxProxyUpgrade { + ) -> TxTypedUpgrade { self.wrapped_tx + .payment(NotPayable) .raw_upgrade() .argument(&initial_value) .original_result() @@ -89,20 +91,22 @@ where { pub fn sum( self, - ) -> TxProxyCall> { + ) -> TxTypedCall> { self.wrapped_tx + .payment(NotPayable) .raw_call("getSum") .original_result() } /// Add desired amount to the storage variable. pub fn add< - Arg0: CodecInto>, + Arg0: ProxyArg>, >( self, value: Arg0, - ) -> TxProxyCall { + ) -> TxTypedCall { self.wrapped_tx + .payment(NotPayable) .raw_call("add") .argument(&value) .original_result() diff --git a/contracts/parametric-tests/adder-pt/wasm/Cargo.lock b/contracts/parametric-tests/adder-pt/wasm/Cargo.lock index e834e7cd07..4c43f90065 100644 --- a/contracts/parametric-tests/adder-pt/wasm/Cargo.lock +++ b/contracts/parametric-tests/adder-pt/wasm/Cargo.lock @@ -31,9 +31,9 @@ checksum = "f1fdabc7756949593fe60f30ec81974b613357de856987752631dea1e3394c80" [[package]] name = "bitflags" -version = "2.4.2" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed570934406eb16438a4e976b1b4500774099c13b8cb96eec99f620f05090ddf" +checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1" [[package]] name = "endian-type" @@ -55,26 +55,28 @@ checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" [[package]] name = "multiversx-sc" -version = "0.49.0-alpha.3" +version = "0.50.3" dependencies = [ "bitflags", "hex-literal", "multiversx-sc-codec", "multiversx-sc-derive", "num-traits", + "unwrap-infallible", ] [[package]] name = "multiversx-sc-codec" -version = "0.18.6" +version = "0.19.0" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", + "unwrap-infallible", ] [[package]] name = "multiversx-sc-codec-derive" -version = "0.18.6" +version = "0.19.0" dependencies = [ "hex", "proc-macro2", @@ -84,7 +86,7 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.49.0-alpha.3" +version = "0.50.3" dependencies = [ "hex", "proc-macro2", @@ -95,7 +97,7 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.49.0-alpha.3" +version = "0.50.3" dependencies = [ "multiversx-sc", ] @@ -111,27 +113,27 @@ dependencies = [ [[package]] name = "num-traits" -version = "0.2.17" +version = "0.2.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" dependencies = [ "autocfg", ] [[package]] name = "proc-macro2" -version = "1.0.78" +version = "1.0.82" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2422ad645d89c99f8f3e6b88a9fdeca7fabeac836b1002371c4367c8f984aae" +checksum = "8ad3d49ab951a01fbaafe34f2ec74122942fe18a3f9814c3268f1bb72042131b" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.35" +version = "1.0.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef" +checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" dependencies = [ "proc-macro2", ] @@ -154,9 +156,9 @@ checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "syn" -version = "2.0.48" +version = "2.0.61" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f3531638e407dfc0814761abb7c00a5b54992b849452a0646b7f65c9f770f3f" +checksum = "c993ed8ccba56ae856363b1845da7266a7cb78e1d146c8a32d54b45a8b831fc9" dependencies = [ "proc-macro2", "quote", @@ -168,3 +170,9 @@ name = "unicode-ident" version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" + +[[package]] +name = "unwrap-infallible" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "151ac09978d3c2862c4e39b557f4eceee2cc72150bc4cb4f16abf061b6e381fb" diff --git a/contracts/parametric-tests/adder-pt/wasm/Cargo.toml b/contracts/parametric-tests/adder-pt/wasm/Cargo.toml index be1234a4cf..cb592d5393 100644 --- a/contracts/parametric-tests/adder-pt/wasm/Cargo.toml +++ b/contracts/parametric-tests/adder-pt/wasm/Cargo.toml @@ -21,6 +21,9 @@ debug = false panic = "abort" overflow-checks = false +[profile.dev] +panic = "abort" + [dependencies.adder-pt] path = ".." diff --git a/contracts/parametric-tests/adder-pt/wasm/src/lib.rs b/contracts/parametric-tests/adder-pt/wasm/src/lib.rs index e5b5f0f806..f8cbe2534c 100644 --- a/contracts/parametric-tests/adder-pt/wasm/src/lib.rs +++ b/contracts/parametric-tests/adder-pt/wasm/src/lib.rs @@ -10,8 +10,6 @@ // Total number of exported functions: 4 #![no_std] -#![allow(internal_features)] -#![feature(lang_items)] multiversx_sc_wasm_adapter::allocator!(); multiversx_sc_wasm_adapter::panic_handler!(); diff --git a/contracts/parametric-tests/addercaller/wasm/Cargo.lock b/contracts/parametric-tests/addercaller/wasm/Cargo.lock index 3a3ef632b9..ece2603700 100644 --- a/contracts/parametric-tests/addercaller/wasm/Cargo.lock +++ b/contracts/parametric-tests/addercaller/wasm/Cargo.lock @@ -3,17 +3,17 @@ version = 3 [[package]] -name = "adder-caller-pt" +name = "addercaller" version = "0.0.0" dependencies = [ "multiversx-sc", ] [[package]] -name = "adder-caller-pt-wasm" +name = "addercaller-wasm" version = "0.0.0" dependencies = [ - "adder-caller-pt", + "addercaller", "multiversx-sc-wasm-adapter", ] @@ -31,9 +31,9 @@ checksum = "f1fdabc7756949593fe60f30ec81974b613357de856987752631dea1e3394c80" [[package]] name = "bitflags" -version = "2.4.2" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed570934406eb16438a4e976b1b4500774099c13b8cb96eec99f620f05090ddf" +checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1" [[package]] name = "endian-type" @@ -55,32 +55,34 @@ checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" [[package]] name = "multiversx-sc" -version = "0.49.0-alpha.4" +version = "0.50.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c86c9822909c32b10ad50f376d2a710ff465b806aa710874c0417053fdc16530" +checksum = "1d79d1cea2d23e8f2545749c9b31952305b54c415af88b224b985784d3d6529d" dependencies = [ "bitflags", "hex-literal", "multiversx-sc-codec", "multiversx-sc-derive", "num-traits", + "unwrap-infallible", ] [[package]] name = "multiversx-sc-codec" -version = "0.18.6" +version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1da6db65170105c9495848c5e4ba388abb1f9201ff2ca362056c9328f36b7760" +checksum = "35c94397b2fba14e40edfa55905b3f453ed57aa06c9b1960ad6a0ca6bfb7a236" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", + "unwrap-infallible", ] [[package]] name = "multiversx-sc-codec-derive" -version = "0.18.6" +version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "631c4d4b37fc94659c8d6cf559c21b68c68899095201de2e1b779fccad7b0b03" +checksum = "cf72a8042da0bc19da0b8f0d4f61b4c66ae853560fefc69cd8fea87bf1aa8c14" dependencies = [ "hex", "proc-macro2", @@ -90,9 +92,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.49.0-alpha.4" +version = "0.50.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc4fe5b47d3d7e51b8c2ed6a7c6d656885875cd3d41931193c364fe8ec7814d8" +checksum = "54e6926e181f6306b69aa805b8d24aa33084497e38ac03e37df457456b6757cc" dependencies = [ "hex", "proc-macro2", @@ -103,9 +105,9 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.49.0-alpha.4" +version = "0.50.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af6a8a42294b3fb2d6ca4020fb297364833cc5316248a1f1254318b36abbbe5e" +checksum = "4350e286afce68bb2448d30572f68dd344b2e98e160404dd7f7d13f185e7acfd" dependencies = [ "multiversx-sc", ] @@ -121,27 +123,27 @@ dependencies = [ [[package]] name = "num-traits" -version = "0.2.17" +version = "0.2.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" dependencies = [ "autocfg", ] [[package]] name = "proc-macro2" -version = "1.0.78" +version = "1.0.82" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2422ad645d89c99f8f3e6b88a9fdeca7fabeac836b1002371c4367c8f984aae" +checksum = "8ad3d49ab951a01fbaafe34f2ec74122942fe18a3f9814c3268f1bb72042131b" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.35" +version = "1.0.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef" +checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" dependencies = [ "proc-macro2", ] @@ -164,9 +166,9 @@ checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "syn" -version = "2.0.48" +version = "2.0.61" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f3531638e407dfc0814761abb7c00a5b54992b849452a0646b7f65c9f770f3f" +checksum = "c993ed8ccba56ae856363b1845da7266a7cb78e1d146c8a32d54b45a8b831fc9" dependencies = [ "proc-macro2", "quote", @@ -178,3 +180,9 @@ name = "unicode-ident" version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" + +[[package]] +name = "unwrap-infallible" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "151ac09978d3c2862c4e39b557f4eceee2cc72150bc4cb4f16abf061b6e381fb" diff --git a/contracts/parametric-tests/addercaller/wasm/Cargo.toml b/contracts/parametric-tests/addercaller/wasm/Cargo.toml index f916878fed..a70b306911 100644 --- a/contracts/parametric-tests/addercaller/wasm/Cargo.toml +++ b/contracts/parametric-tests/addercaller/wasm/Cargo.toml @@ -5,7 +5,7 @@ # ########################################## [package] -name = "adder-caller-pt-wasm" +name = "addercaller-wasm" version = "0.0.0" edition = "2018" publish = false @@ -21,7 +21,10 @@ debug = false panic = "abort" overflow-checks = false -[dependencies.adder-caller-pt] +[profile.dev] +panic = "abort" + +[dependencies.addercaller] path = ".." [dependencies.multiversx-sc-wasm-adapter] diff --git a/contracts/parametric-tests/addercaller/wasm/src/lib.rs b/contracts/parametric-tests/addercaller/wasm/src/lib.rs index 594f9869c1..250d1bf3fb 100644 --- a/contracts/parametric-tests/addercaller/wasm/src/lib.rs +++ b/contracts/parametric-tests/addercaller/wasm/src/lib.rs @@ -10,14 +10,12 @@ // Total number of exported functions: 4 #![no_std] -#![allow(internal_features)] -#![feature(lang_items)] multiversx_sc_wasm_adapter::allocator!(); multiversx_sc_wasm_adapter::panic_handler!(); multiversx_sc_wasm_adapter::endpoints! { - adder_caller_pt + addercaller ( init => init call_adder => call_adder diff --git a/contracts/parametric-tests/callee/wasm/Cargo.lock b/contracts/parametric-tests/callee/wasm/Cargo.lock index 91e2b4f45e..676bdab054 100644 --- a/contracts/parametric-tests/callee/wasm/Cargo.lock +++ b/contracts/parametric-tests/callee/wasm/Cargo.lock @@ -16,9 +16,9 @@ checksum = "f1fdabc7756949593fe60f30ec81974b613357de856987752631dea1e3394c80" [[package]] name = "bitflags" -version = "2.4.2" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed570934406eb16438a4e976b1b4500774099c13b8cb96eec99f620f05090ddf" +checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1" [[package]] name = "callee" @@ -55,32 +55,34 @@ checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" [[package]] name = "multiversx-sc" -version = "0.49.0-alpha.4" +version = "0.50.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c86c9822909c32b10ad50f376d2a710ff465b806aa710874c0417053fdc16530" +checksum = "1d79d1cea2d23e8f2545749c9b31952305b54c415af88b224b985784d3d6529d" dependencies = [ "bitflags", "hex-literal", "multiversx-sc-codec", "multiversx-sc-derive", "num-traits", + "unwrap-infallible", ] [[package]] name = "multiversx-sc-codec" -version = "0.18.6" +version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1da6db65170105c9495848c5e4ba388abb1f9201ff2ca362056c9328f36b7760" +checksum = "35c94397b2fba14e40edfa55905b3f453ed57aa06c9b1960ad6a0ca6bfb7a236" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", + "unwrap-infallible", ] [[package]] name = "multiversx-sc-codec-derive" -version = "0.18.6" +version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "631c4d4b37fc94659c8d6cf559c21b68c68899095201de2e1b779fccad7b0b03" +checksum = "cf72a8042da0bc19da0b8f0d4f61b4c66ae853560fefc69cd8fea87bf1aa8c14" dependencies = [ "hex", "proc-macro2", @@ -90,9 +92,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.49.0-alpha.4" +version = "0.50.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc4fe5b47d3d7e51b8c2ed6a7c6d656885875cd3d41931193c364fe8ec7814d8" +checksum = "54e6926e181f6306b69aa805b8d24aa33084497e38ac03e37df457456b6757cc" dependencies = [ "hex", "proc-macro2", @@ -103,9 +105,9 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.49.0-alpha.4" +version = "0.50.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af6a8a42294b3fb2d6ca4020fb297364833cc5316248a1f1254318b36abbbe5e" +checksum = "4350e286afce68bb2448d30572f68dd344b2e98e160404dd7f7d13f185e7acfd" dependencies = [ "multiversx-sc", ] @@ -121,27 +123,27 @@ dependencies = [ [[package]] name = "num-traits" -version = "0.2.17" +version = "0.2.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" dependencies = [ "autocfg", ] [[package]] name = "proc-macro2" -version = "1.0.78" +version = "1.0.82" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2422ad645d89c99f8f3e6b88a9fdeca7fabeac836b1002371c4367c8f984aae" +checksum = "8ad3d49ab951a01fbaafe34f2ec74122942fe18a3f9814c3268f1bb72042131b" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.35" +version = "1.0.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef" +checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" dependencies = [ "proc-macro2", ] @@ -164,9 +166,9 @@ checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "syn" -version = "2.0.48" +version = "2.0.61" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f3531638e407dfc0814761abb7c00a5b54992b849452a0646b7f65c9f770f3f" +checksum = "c993ed8ccba56ae856363b1845da7266a7cb78e1d146c8a32d54b45a8b831fc9" dependencies = [ "proc-macro2", "quote", @@ -178,3 +180,9 @@ name = "unicode-ident" version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" + +[[package]] +name = "unwrap-infallible" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "151ac09978d3c2862c4e39b557f4eceee2cc72150bc4cb4f16abf061b6e381fb" diff --git a/contracts/parametric-tests/callee/wasm/Cargo.toml b/contracts/parametric-tests/callee/wasm/Cargo.toml index 49343daf80..b02c242821 100644 --- a/contracts/parametric-tests/callee/wasm/Cargo.toml +++ b/contracts/parametric-tests/callee/wasm/Cargo.toml @@ -21,6 +21,9 @@ debug = false panic = "abort" overflow-checks = false +[profile.dev] +panic = "abort" + [dependencies.callee] path = ".." diff --git a/contracts/parametric-tests/callee/wasm/src/lib.rs b/contracts/parametric-tests/callee/wasm/src/lib.rs index 5be8e5b926..c45d95e9d1 100644 --- a/contracts/parametric-tests/callee/wasm/src/lib.rs +++ b/contracts/parametric-tests/callee/wasm/src/lib.rs @@ -10,8 +10,6 @@ // Total number of exported functions: 3 #![no_std] -#![allow(internal_features)] -#![feature(lang_items)] multiversx_sc_wasm_adapter::allocator!(); multiversx_sc_wasm_adapter::panic_handler!(); diff --git a/contracts/parametric-tests/caller/wasm/Cargo.lock b/contracts/parametric-tests/caller/wasm/Cargo.lock index b6ebe3fde6..9196d6ec53 100644 --- a/contracts/parametric-tests/caller/wasm/Cargo.lock +++ b/contracts/parametric-tests/caller/wasm/Cargo.lock @@ -16,9 +16,9 @@ checksum = "f1fdabc7756949593fe60f30ec81974b613357de856987752631dea1e3394c80" [[package]] name = "bitflags" -version = "2.4.2" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed570934406eb16438a4e976b1b4500774099c13b8cb96eec99f620f05090ddf" +checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1" [[package]] name = "caller" @@ -55,32 +55,34 @@ checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" [[package]] name = "multiversx-sc" -version = "0.49.0-alpha.4" +version = "0.50.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c86c9822909c32b10ad50f376d2a710ff465b806aa710874c0417053fdc16530" +checksum = "1d79d1cea2d23e8f2545749c9b31952305b54c415af88b224b985784d3d6529d" dependencies = [ "bitflags", "hex-literal", "multiversx-sc-codec", "multiversx-sc-derive", "num-traits", + "unwrap-infallible", ] [[package]] name = "multiversx-sc-codec" -version = "0.18.6" +version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1da6db65170105c9495848c5e4ba388abb1f9201ff2ca362056c9328f36b7760" +checksum = "35c94397b2fba14e40edfa55905b3f453ed57aa06c9b1960ad6a0ca6bfb7a236" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", + "unwrap-infallible", ] [[package]] name = "multiversx-sc-codec-derive" -version = "0.18.6" +version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "631c4d4b37fc94659c8d6cf559c21b68c68899095201de2e1b779fccad7b0b03" +checksum = "cf72a8042da0bc19da0b8f0d4f61b4c66ae853560fefc69cd8fea87bf1aa8c14" dependencies = [ "hex", "proc-macro2", @@ -90,9 +92,9 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.49.0-alpha.4" +version = "0.50.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc4fe5b47d3d7e51b8c2ed6a7c6d656885875cd3d41931193c364fe8ec7814d8" +checksum = "54e6926e181f6306b69aa805b8d24aa33084497e38ac03e37df457456b6757cc" dependencies = [ "hex", "proc-macro2", @@ -103,9 +105,9 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.49.0-alpha.4" +version = "0.50.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af6a8a42294b3fb2d6ca4020fb297364833cc5316248a1f1254318b36abbbe5e" +checksum = "4350e286afce68bb2448d30572f68dd344b2e98e160404dd7f7d13f185e7acfd" dependencies = [ "multiversx-sc", ] @@ -121,27 +123,27 @@ dependencies = [ [[package]] name = "num-traits" -version = "0.2.17" +version = "0.2.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" dependencies = [ "autocfg", ] [[package]] name = "proc-macro2" -version = "1.0.78" +version = "1.0.82" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2422ad645d89c99f8f3e6b88a9fdeca7fabeac836b1002371c4367c8f984aae" +checksum = "8ad3d49ab951a01fbaafe34f2ec74122942fe18a3f9814c3268f1bb72042131b" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.35" +version = "1.0.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef" +checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" dependencies = [ "proc-macro2", ] @@ -164,9 +166,9 @@ checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "syn" -version = "2.0.48" +version = "2.0.61" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f3531638e407dfc0814761abb7c00a5b54992b849452a0646b7f65c9f770f3f" +checksum = "c993ed8ccba56ae856363b1845da7266a7cb78e1d146c8a32d54b45a8b831fc9" dependencies = [ "proc-macro2", "quote", @@ -178,3 +180,9 @@ name = "unicode-ident" version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" + +[[package]] +name = "unwrap-infallible" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "151ac09978d3c2862c4e39b557f4eceee2cc72150bc4cb4f16abf061b6e381fb" diff --git a/contracts/parametric-tests/caller/wasm/Cargo.toml b/contracts/parametric-tests/caller/wasm/Cargo.toml index 20a7dd205e..1811bbbb65 100644 --- a/contracts/parametric-tests/caller/wasm/Cargo.toml +++ b/contracts/parametric-tests/caller/wasm/Cargo.toml @@ -21,6 +21,9 @@ debug = false panic = "abort" overflow-checks = false +[profile.dev] +panic = "abort" + [dependencies.caller] path = ".." diff --git a/contracts/parametric-tests/caller/wasm/src/lib.rs b/contracts/parametric-tests/caller/wasm/src/lib.rs index 7c2566d6c3..6a9cda55d7 100644 --- a/contracts/parametric-tests/caller/wasm/src/lib.rs +++ b/contracts/parametric-tests/caller/wasm/src/lib.rs @@ -10,8 +10,6 @@ // Total number of exported functions: 4 #![no_std] -#![allow(internal_features)] -#![feature(lang_items)] multiversx_sc_wasm_adapter::allocator!(); multiversx_sc_wasm_adapter::panic_handler!(); diff --git a/contracts/parametric-tests/multisig-pt/wasm/Cargo.lock b/contracts/parametric-tests/multisig-pt/wasm/Cargo.lock index 4b78a31b89..bdfe4a4488 100644 --- a/contracts/parametric-tests/multisig-pt/wasm/Cargo.lock +++ b/contracts/parametric-tests/multisig-pt/wasm/Cargo.lock @@ -16,9 +16,9 @@ checksum = "f1fdabc7756949593fe60f30ec81974b613357de856987752631dea1e3394c80" [[package]] name = "bitflags" -version = "2.4.2" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed570934406eb16438a4e976b1b4500774099c13b8cb96eec99f620f05090ddf" +checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1" [[package]] name = "endian-type" @@ -55,26 +55,28 @@ dependencies = [ [[package]] name = "multiversx-sc" -version = "0.49.0-alpha.3" +version = "0.50.3" dependencies = [ "bitflags", "hex-literal", "multiversx-sc-codec", "multiversx-sc-derive", "num-traits", + "unwrap-infallible", ] [[package]] name = "multiversx-sc-codec" -version = "0.18.6" +version = "0.19.0" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", + "unwrap-infallible", ] [[package]] name = "multiversx-sc-codec-derive" -version = "0.18.6" +version = "0.19.0" dependencies = [ "hex", "proc-macro2", @@ -84,7 +86,7 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.49.0-alpha.3" +version = "0.50.3" dependencies = [ "hex", "proc-macro2", @@ -95,7 +97,7 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.49.0-alpha.3" +version = "0.50.3" dependencies = [ "multiversx-sc", ] @@ -111,27 +113,27 @@ dependencies = [ [[package]] name = "num-traits" -version = "0.2.17" +version = "0.2.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" dependencies = [ "autocfg", ] [[package]] name = "proc-macro2" -version = "1.0.78" +version = "1.0.82" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2422ad645d89c99f8f3e6b88a9fdeca7fabeac836b1002371c4367c8f984aae" +checksum = "8ad3d49ab951a01fbaafe34f2ec74122942fe18a3f9814c3268f1bb72042131b" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.35" +version = "1.0.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef" +checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" dependencies = [ "proc-macro2", ] @@ -154,9 +156,9 @@ checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "syn" -version = "2.0.48" +version = "2.0.61" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f3531638e407dfc0814761abb7c00a5b54992b849452a0646b7f65c9f770f3f" +checksum = "c993ed8ccba56ae856363b1845da7266a7cb78e1d146c8a32d54b45a8b831fc9" dependencies = [ "proc-macro2", "quote", @@ -168,3 +170,9 @@ name = "unicode-ident" version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" + +[[package]] +name = "unwrap-infallible" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "151ac09978d3c2862c4e39b557f4eceee2cc72150bc4cb4f16abf061b6e381fb" diff --git a/contracts/parametric-tests/multisig-pt/wasm/Cargo.toml b/contracts/parametric-tests/multisig-pt/wasm/Cargo.toml index 4fc7a4f72b..5839357e14 100644 --- a/contracts/parametric-tests/multisig-pt/wasm/Cargo.toml +++ b/contracts/parametric-tests/multisig-pt/wasm/Cargo.toml @@ -21,6 +21,9 @@ debug = false panic = "abort" overflow-checks = false +[profile.dev] +panic = "abort" + [dependencies.multisig-pt] path = ".." diff --git a/contracts/parametric-tests/multisig-pt/wasm/src/lib.rs b/contracts/parametric-tests/multisig-pt/wasm/src/lib.rs index 3da4edfadf..044a2573fe 100644 --- a/contracts/parametric-tests/multisig-pt/wasm/src/lib.rs +++ b/contracts/parametric-tests/multisig-pt/wasm/src/lib.rs @@ -10,8 +10,6 @@ // Total number of exported functions: 3 #![no_std] -#![allow(internal_features)] -#![feature(lang_items)] multiversx_sc_wasm_adapter::allocator!(); multiversx_sc_wasm_adapter::panic_handler!(); diff --git a/contracts/parametric-tests/testapi-pt/wasm/Cargo.lock b/contracts/parametric-tests/testapi-pt/wasm/Cargo.lock index b07468dd35..9416b3a3ec 100644 --- a/contracts/parametric-tests/testapi-pt/wasm/Cargo.lock +++ b/contracts/parametric-tests/testapi-pt/wasm/Cargo.lock @@ -16,9 +16,9 @@ checksum = "f1fdabc7756949593fe60f30ec81974b613357de856987752631dea1e3394c80" [[package]] name = "bitflags" -version = "2.4.2" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed570934406eb16438a4e976b1b4500774099c13b8cb96eec99f620f05090ddf" +checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1" [[package]] name = "endian-type" @@ -40,26 +40,28 @@ checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" [[package]] name = "multiversx-sc" -version = "0.49.0-alpha.3" +version = "0.50.3" dependencies = [ "bitflags", "hex-literal", "multiversx-sc-codec", "multiversx-sc-derive", "num-traits", + "unwrap-infallible", ] [[package]] name = "multiversx-sc-codec" -version = "0.18.6" +version = "0.19.0" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", + "unwrap-infallible", ] [[package]] name = "multiversx-sc-codec-derive" -version = "0.18.6" +version = "0.19.0" dependencies = [ "hex", "proc-macro2", @@ -69,7 +71,7 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.49.0-alpha.3" +version = "0.50.3" dependencies = [ "hex", "proc-macro2", @@ -80,7 +82,7 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.49.0-alpha.3" +version = "0.50.3" dependencies = [ "multiversx-sc", ] @@ -96,27 +98,27 @@ dependencies = [ [[package]] name = "num-traits" -version = "0.2.17" +version = "0.2.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" dependencies = [ "autocfg", ] [[package]] name = "proc-macro2" -version = "1.0.78" +version = "1.0.82" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2422ad645d89c99f8f3e6b88a9fdeca7fabeac836b1002371c4367c8f984aae" +checksum = "8ad3d49ab951a01fbaafe34f2ec74122942fe18a3f9814c3268f1bb72042131b" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.35" +version = "1.0.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef" +checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" dependencies = [ "proc-macro2", ] @@ -139,9 +141,9 @@ checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "syn" -version = "2.0.48" +version = "2.0.61" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f3531638e407dfc0814761abb7c00a5b54992b849452a0646b7f65c9f770f3f" +checksum = "c993ed8ccba56ae856363b1845da7266a7cb78e1d146c8a32d54b45a8b831fc9" dependencies = [ "proc-macro2", "quote", @@ -168,3 +170,9 @@ name = "unicode-ident" version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" + +[[package]] +name = "unwrap-infallible" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "151ac09978d3c2862c4e39b557f4eceee2cc72150bc4cb4f16abf061b6e381fb" diff --git a/contracts/parametric-tests/testapi-pt/wasm/Cargo.toml b/contracts/parametric-tests/testapi-pt/wasm/Cargo.toml index 9c5aec94cb..21ef12dd9f 100644 --- a/contracts/parametric-tests/testapi-pt/wasm/Cargo.toml +++ b/contracts/parametric-tests/testapi-pt/wasm/Cargo.toml @@ -21,6 +21,9 @@ debug = false panic = "abort" overflow-checks = false +[profile.dev] +panic = "abort" + [dependencies.test-testapi] path = ".." diff --git a/contracts/parametric-tests/testapi-pt/wasm/src/lib.rs b/contracts/parametric-tests/testapi-pt/wasm/src/lib.rs index abb8966db7..d9f43452ba 100644 --- a/contracts/parametric-tests/testapi-pt/wasm/src/lib.rs +++ b/contracts/parametric-tests/testapi-pt/wasm/src/lib.rs @@ -10,8 +10,6 @@ // Total number of exported functions: 2 #![no_std] -#![allow(internal_features)] -#![feature(lang_items)] multiversx_sc_wasm_adapter::allocator!(); multiversx_sc_wasm_adapter::panic_handler!(); From e2b889e68c8ad5fe0f824a1757d171c7c3202ec5 Mon Sep 17 00:00:00 2001 From: Andrei Marinica Date: Tue, 4 Jun 2024 02:27:30 +0300 Subject: [PATCH 13/20] param tests - use regular read from address --- .../parametric-tests/adder-pt/src/adder_pt.rs | 15 +++------------ .../parametric-tests/multisig-pt/kasmer.json | 5 +++++ .../multisig-pt/src/multisig_pt.rs | 10 ++-------- 3 files changed, 10 insertions(+), 20 deletions(-) create mode 100644 contracts/parametric-tests/multisig-pt/kasmer.json diff --git a/contracts/parametric-tests/adder-pt/src/adder_pt.rs b/contracts/parametric-tests/adder-pt/src/adder_pt.rs index 2647a6b255..40cb87f897 100644 --- a/contracts/parametric-tests/adder-pt/src/adder_pt.rs +++ b/contracts/parametric-tests/adder-pt/src/adder_pt.rs @@ -45,10 +45,7 @@ pub trait TestAdder { self.adder_address().set(&adder); // check the initial sum value - let sum_as_bytes = self - .test_raw() - .get_storage(&adder, &ManagedBuffer::from(b"sum")); - let sum = BigUint::from(sum_as_bytes); + let sum: BigUint = self.storage_raw().read_from_address(&adder, "sum"); self.test_raw().assert(sum == INIT_SUM); } @@ -62,10 +59,7 @@ pub trait TestAdder { self.call_add(&value); // check the sum value - let sum_as_bytes = self - .test_raw() - .get_storage(&adder, &ManagedBuffer::from(b"sum")); - let sum = BigUint::from(sum_as_bytes); + let sum: BigUint = self.storage_raw().read_from_address(&adder, "sum"); self.test_raw().assert(sum == (value + INIT_SUM)); } @@ -80,10 +74,7 @@ pub trait TestAdder { self.call_add(&value2); // check the sum value - let sum_as_bytes = self - .test_raw() - .get_storage(&adder, &ManagedBuffer::from(b"sum")); - let sum = BigUint::from(sum_as_bytes); + let sum: BigUint = self.storage_raw().read_from_address(&adder, "sum"); self.test_raw().assert(sum == (value1 + value2 + INIT_SUM)); } diff --git a/contracts/parametric-tests/multisig-pt/kasmer.json b/contracts/parametric-tests/multisig-pt/kasmer.json new file mode 100644 index 0000000000..cc5a270dd6 --- /dev/null +++ b/contracts/parametric-tests/multisig-pt/kasmer.json @@ -0,0 +1,5 @@ +{ + "contract_paths": [ + "../../examples/multisig/output/multisig-full.wasm" + ] +} \ No newline at end of file diff --git a/contracts/parametric-tests/multisig-pt/src/multisig_pt.rs b/contracts/parametric-tests/multisig-pt/src/multisig_pt.rs index 87f58e22fe..5749f91fe7 100644 --- a/contracts/parametric-tests/multisig-pt/src/multisig_pt.rs +++ b/contracts/parametric-tests/multisig-pt/src/multisig_pt.rs @@ -52,17 +52,11 @@ pub trait TestMultisigContract { } fn get_quorum(&self, multisig: &ManagedAddress) -> BigUint { - let bs = self - .test_raw() - .get_storage(multisig, &ManagedBuffer::from(b"quorum")); - BigUint::from(bs) + self.storage_raw().read_from_address(multisig, "quorum") } fn get_num_board_members(&self, multisig: &ManagedAddress) -> BigUint { - let bs = self - .test_raw() - .get_storage(multisig, &ManagedBuffer::from(b"num_board_members")); - BigUint::from(bs) + self.storage_raw().read_from_address(multisig, "num_board_members") } #[endpoint(test_change_quorum)] From 03bc4463b165abd93aa13a491e63fa783565a807 Mon Sep 17 00:00:00 2001 From: Andrei Marinica Date: Tue, 4 Jun 2024 16:00:17 +0300 Subject: [PATCH 14/20] param tests - deploy unified syntax --- .../parametric-tests/adder-pt/src/adder_pt.rs | 21 +++---- framework/base/src/types/interaction/tx.rs | 23 ++++++- .../interaction/tx_data/tx_code_source.rs | 30 +++++++++ .../interaction/tx_exec/tx_exec_test_call.rs | 63 ++++++++++++++++++- 4 files changed, 120 insertions(+), 17 deletions(-) diff --git a/contracts/parametric-tests/adder-pt/src/adder_pt.rs b/contracts/parametric-tests/adder-pt/src/adder_pt.rs index 40cb87f897..7239963b4f 100644 --- a/contracts/parametric-tests/adder-pt/src/adder_pt.rs +++ b/contracts/parametric-tests/adder-pt/src/adder_pt.rs @@ -28,18 +28,15 @@ pub trait TestAdder { let adder = ManagedAddress::from(b"adder___________________________"); self.test_raw().register_new_address(&owner, 1, &adder); - // deploy the adder contract - let mut adder_init_args = ManagedArgBuffer::new(); - adder_init_args.push_arg(INIT_SUM); // initial sum - - // deploy a contract from `owner` - let adder = self.test_raw().deploy_contract( - &owner, - 5000000000000, - &BigUint::zero(), - &code_path, - &adder_init_args, - ); + let adder = self + .tx() + .from(&owner) + .typed(adder_proxy::AdderProxy) + .init(INIT_SUM) + .code_path(code_path) + .gas(5000000000000) + .returns(ReturnsNewManagedAddress) + .test_deploy(); // save the deployed contract's address self.adder_address().set(&adder); diff --git a/framework/base/src/types/interaction/tx.rs b/framework/base/src/types/interaction/tx.rs index 905b9af8fc..db0fcb9c5b 100644 --- a/framework/base/src/types/interaction/tx.rs +++ b/framework/base/src/types/interaction/tx.rs @@ -11,10 +11,10 @@ use crate::{ use multiversx_sc_codec::TopEncodeMulti; use super::{ - AnnotatedValue, Code, ContractCallBase, ContractCallNoPayment, ContractCallWithEgld, + AnnotatedValue, Code, CodePath, ContractCallBase, ContractCallNoPayment, ContractCallWithEgld, ContractDeploy, DeployCall, Egld, EgldPayment, ExplicitGas, FromSource, FunctionCall, ManagedArgBuffer, OriginalResultMarker, RHList, RHListAppendNoRet, RHListAppendRet, RHListItem, - TxCodeSource, TxCodeValue, TxData, TxDataFunctionCall, TxEgldValue, TxEnv, + TxCodePathValue, TxCodeSource, TxCodeValue, TxData, TxDataFunctionCall, TxEgldValue, TxEnv, TxEnvMockDeployAddress, TxEnvWithTxHash, TxFrom, TxFromSourceValue, TxFromSpecified, TxGas, TxGasValue, TxPayment, TxPaymentEgldOnly, TxProxyTrait, TxResultHandler, TxScEnv, TxTo, TxToSpecified, UpgradeCall, UNSPECIFIED_GAS_LIMIT, @@ -784,6 +784,25 @@ where result_handler: self.result_handler, } } + + /// Sets the path to the code file. Only works in parametric tests. + pub fn code_path( + self, + code: CodePathValue, + ) -> Tx>, RH> + where + CodePathValue: TxCodePathValue, + { + Tx { + env: self.env, + from: self.from, + to: self.to, + payment: self.payment, + gas: self.gas, + data: self.data.code_source(CodePath(code)), + result_handler: self.result_handler, + } + } } impl diff --git a/framework/base/src/types/interaction/tx_data/tx_code_source.rs b/framework/base/src/types/interaction/tx_data/tx_code_source.rs index 0d3c180e16..0b8e23fb48 100644 --- a/framework/base/src/types/interaction/tx_data/tx_code_source.rs +++ b/framework/base/src/types/interaction/tx_data/tx_code_source.rs @@ -73,3 +73,33 @@ where FromSourceValue: TxFromSourceValue, { } + +#[diagnostic::on_unimplemented( + message = "Type `{Self}` cannot be used as code path (does not implement `TxCodePathValue<{Env}>`)", + label = "not a valid smart contract code path", + note = "there are multiple ways to specify SC code path, but `{Self}` is not one of them" +)] +pub trait TxCodePathValue: AnnotatedValue> +where + Env: TxEnv, +{ +} + +impl TxCodePathValue for ManagedBuffer where Env: TxEnv {} + +/// Contains code for a deploy or upgrade. +pub struct CodePath(pub CodePathValue); + +impl TxCodeSource for CodePath +where + Env: TxEnv, + CodePathValue: TxCodePathValue, +{ +} + +impl TxCodeSourceSpecified for CodePath +where + Env: TxEnv, + CodePathValue: TxCodePathValue, +{ +} diff --git a/framework/base/src/types/interaction/tx_exec/tx_exec_test_call.rs b/framework/base/src/types/interaction/tx_exec/tx_exec_test_call.rs index 93f7f9331a..2159729ae8 100644 --- a/framework/base/src/types/interaction/tx_exec/tx_exec_test_call.rs +++ b/framework/base/src/types/interaction/tx_exec/tx_exec_test_call.rs @@ -1,13 +1,16 @@ use crate::api::{CallTypeApi, TestApi}; - +use crate::tuple_util::NestedTupleFlatten; use crate::{ contract_base::TestRawWrapper, - proxy_imports::TxFromSpecified, types::{ - FunctionCall, Tx, TxData, TxEmptyResultHandler, TxGas, TxPayment, TxScEnv, TxToSpecified, + CodePath, DeployCall, FunctionCall, ManagedAddress, ManagedVec, RHListExec, Tx, + TxCodePathValue, TxData, TxEmptyResultHandler, TxFromSpecified, TxGas, TxPayment, + TxPaymentEgldOnly, TxResultHandler, TxScEnv, TxToSpecified, }, }; +use super::DeployRawResult; + impl Tx, From, To, Payment, Gas, FC, RH> where Api: CallTypeApi + TestApi, @@ -31,3 +34,57 @@ where TestRawWrapper::::new().stop_prank(); } } + +impl + Tx, From, (), Payment, Gas, DeployCall, CodePath>, RH> +where + Api: CallTypeApi + TestApi, + From: TxFromSpecified>, + Payment: TxPaymentEgldOnly>, + Gas: TxGas>, + CodePathValue: TxCodePathValue>, + RH: TxResultHandler>, +{ + fn execute_test_deploy_raw(self) -> (ManagedAddress, RH) { + let gas_limit = self.gas.gas_value(&self.env); + let new_address = self.from.with_value_ref(&self.env, |from| { + self.payment.with_egld_value(&self.env, |egld_value| { + TestRawWrapper::::new().deploy_contract( + from, + gas_limit, + egld_value, + &self.data.code_source.0.into_value(&self.env), + &self.data.arg_buffer, + ) + }) + }); + (new_address, self.result_handler) + } +} + +impl + Tx, From, (), Payment, Gas, DeployCall, CodePath>, RH> +where + Api: CallTypeApi + TestApi, + From: TxFromSpecified>, + Payment: TxPaymentEgldOnly>, + Gas: TxGas>, + CodePathValue: TxCodePathValue>, + RH: RHListExec, TxScEnv>, + RH::ListReturns: NestedTupleFlatten, +{ + /// Synchronously deploys a contract. + pub fn test_deploy(self) -> ::Unpacked { + let (new_address, result_handler) = self.execute_test_deploy_raw(); + + // TODO: results currently not retrieved + let raw_results = ManagedVec::new(); + + let deploy_raw_result = DeployRawResult { + new_address, + raw_results, + }; + let tuple_result = result_handler.list_process_result(&deploy_raw_result); + tuple_result.flatten_unpack() + } +} From 9dcb53aabc215236695b1ad2dbc96d3d902d38c1 Mon Sep 17 00:00:00 2001 From: Andrei Marinica Date: Tue, 4 Jun 2024 17:18:27 +0300 Subject: [PATCH 15/20] param tests - multisig-pt unified syntax --- contracts/examples/multisig/sc-config.toml | 3 + .../multisig-pt/src/multisig_proxy.rs | 580 ++++++++++++++++++ .../multisig-pt/src/multisig_pt.rs | 93 ++- .../annotated_impl_managed_buffer.rs | 27 + .../interaction/tx_data/tx_code_source.rs | 1 + 5 files changed, 654 insertions(+), 50 deletions(-) create mode 100644 contracts/parametric-tests/multisig-pt/src/multisig_proxy.rs diff --git a/contracts/examples/multisig/sc-config.toml b/contracts/examples/multisig/sc-config.toml index 79c3aeaa20..ebfaac4177 100644 --- a/contracts/examples/multisig/sc-config.toml +++ b/contracts/examples/multisig/sc-config.toml @@ -17,3 +17,6 @@ add-labels = ["multisig-external-view"] [[proxy]] path = "src/multisig_proxy.rs" + +[[proxy]] +path = "../../parametric-tests/multisig-pt/src/multisig_proxy.rs" diff --git a/contracts/parametric-tests/multisig-pt/src/multisig_proxy.rs b/contracts/parametric-tests/multisig-pt/src/multisig_proxy.rs new file mode 100644 index 0000000000..d3a3e32e0e --- /dev/null +++ b/contracts/parametric-tests/multisig-pt/src/multisig_proxy.rs @@ -0,0 +1,580 @@ +// Code generated by the multiversx-sc proxy generator. DO NOT EDIT. + +//////////////////////////////////////////////////// +////////////////// AUTO-GENERATED ////////////////// +//////////////////////////////////////////////////// + +#![allow(dead_code)] +#![allow(clippy::all)] + +use multiversx_sc::proxy_imports::*; + +pub struct MultisigProxy; + +impl TxProxyTrait for MultisigProxy +where + Env: TxEnv, + From: TxFrom, + To: TxTo, + Gas: TxGas, +{ + type TxProxyMethods = MultisigProxyMethods; + + fn proxy_methods(self, tx: Tx) -> Self::TxProxyMethods { + MultisigProxyMethods { wrapped_tx: tx } + } +} + +pub struct MultisigProxyMethods +where + Env: TxEnv, + From: TxFrom, + To: TxTo, + Gas: TxGas, +{ + wrapped_tx: Tx, +} + +#[rustfmt::skip] +impl MultisigProxyMethods +where + Env: TxEnv, + Env::Api: VMApi, + From: TxFrom, + Gas: TxGas, +{ + pub fn init< + Arg0: ProxyArg, + Arg1: ProxyArg>>, + >( + self, + quorum: Arg0, + board: Arg1, + ) -> TxTypedDeploy { + self.wrapped_tx + .payment(NotPayable) + .raw_deploy() + .argument(&quorum) + .argument(&board) + .original_result() + } +} + +#[rustfmt::skip] +impl MultisigProxyMethods +where + Env: TxEnv, + Env::Api: VMApi, + From: TxFrom, + To: TxTo, + Gas: TxGas, +{ + pub fn upgrade< + Arg0: ProxyArg, + Arg1: ProxyArg>>, + >( + self, + quorum: Arg0, + board: Arg1, + ) -> TxTypedUpgrade { + self.wrapped_tx + .payment(NotPayable) + .raw_upgrade() + .argument(&quorum) + .argument(&board) + .original_result() + } +} + +#[rustfmt::skip] +impl MultisigProxyMethods +where + Env: TxEnv, + Env::Api: VMApi, + From: TxFrom, + To: TxTo, + Gas: TxGas, +{ + /// Allows the contract to receive funds even if it is marked as unpayable in the protocol. + pub fn deposit( + self, + ) -> TxTypedCall { + self.wrapped_tx + .raw_call("deposit") + .original_result() + } + + /// Iterates through all actions and retrieves those that are still pending. + /// Serialized full action data: + /// - the action id + /// - the serialized action data + /// - (number of signers followed by) list of signer addresses. + pub fn get_pending_action_full_info( + self, + ) -> TxTypedCall>> { + self.wrapped_tx + .payment(NotPayable) + .raw_call("getPendingActionFullInfo") + .original_result() + } + + /// Returns `true` (`1`) if the user has signed the action. + /// Does not check whether or not the user is still a board member and the signature valid. + pub fn signed< + Arg0: ProxyArg>, + Arg1: ProxyArg, + >( + self, + user: Arg0, + action_id: Arg1, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("signed") + .argument(&user) + .argument(&action_id) + .original_result() + } + + /// Indicates user rights. + /// `0` = no rights, + /// `1` = can propose, but not sign, + /// `2` = can propose and sign. + pub fn user_role< + Arg0: ProxyArg>, + >( + self, + user: Arg0, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("userRole") + .argument(&user) + .original_result() + } + + /// Lists all users that can sign actions. + pub fn get_all_board_members( + self, + ) -> TxTypedCall>> { + self.wrapped_tx + .payment(NotPayable) + .raw_call("getAllBoardMembers") + .original_result() + } + + /// Lists all proposers that are not board members. + pub fn get_all_proposers( + self, + ) -> TxTypedCall>> { + self.wrapped_tx + .payment(NotPayable) + .raw_call("getAllProposers") + .original_result() + } + + /// Used by board members to sign actions. + pub fn sign< + Arg0: ProxyArg, + >( + self, + action_id: Arg0, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("sign") + .argument(&action_id) + .original_result() + } + + /// Board members can withdraw their signatures if they no longer desire for the action to be executed. + /// Actions that are left with no valid signatures can be then deleted to free up storage. + pub fn unsign< + Arg0: ProxyArg, + >( + self, + action_id: Arg0, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("unsign") + .argument(&action_id) + .original_result() + } + + /// Clears storage pertaining to an action that is no longer supposed to be executed. + /// Any signatures that the action received must first be removed, via `unsign`. + /// Otherwise this endpoint would be prone to abuse. + pub fn discard_action< + Arg0: ProxyArg, + >( + self, + action_id: Arg0, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("discardAction") + .argument(&action_id) + .original_result() + } + + /// Minimum number of signatures needed to perform any action. + pub fn quorum( + self, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("getQuorum") + .original_result() + } + + /// Denormalized board member count. + /// It is kept in sync with the user list by the contract. + pub fn num_board_members( + self, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("getNumBoardMembers") + .original_result() + } + + /// Denormalized proposer count. + /// It is kept in sync with the user list by the contract. + pub fn num_proposers( + self, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("getNumProposers") + .original_result() + } + + /// The index of the last proposed action. + /// 0 means that no action was ever proposed yet. + pub fn get_action_last_index( + self, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("getActionLastIndex") + .original_result() + } + + /// Serialized action data of an action with index. + pub fn get_action_data< + Arg0: ProxyArg, + >( + self, + action_id: Arg0, + ) -> TxTypedCall> { + self.wrapped_tx + .payment(NotPayable) + .raw_call("getActionData") + .argument(&action_id) + .original_result() + } + + /// Gets addresses of all users who signed an action. + /// Does not check if those users are still board members or not, + /// so the result may contain invalid signers. + pub fn get_action_signers< + Arg0: ProxyArg, + >( + self, + action_id: Arg0, + ) -> TxTypedCall>> { + self.wrapped_tx + .payment(NotPayable) + .raw_call("getActionSigners") + .argument(&action_id) + .original_result() + } + + /// Gets addresses of all users who signed an action and are still board members. + /// All these signatures are currently valid. + pub fn get_action_signer_count< + Arg0: ProxyArg, + >( + self, + action_id: Arg0, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("getActionSignerCount") + .argument(&action_id) + .original_result() + } + + /// It is possible for board members to lose their role. + /// They are not automatically removed from all actions when doing so, + /// therefore the contract needs to re-check every time when actions are performed. + /// This function is used to validate the signers before performing an action. + /// It also makes it easy to check before performing an action. + pub fn get_action_valid_signer_count< + Arg0: ProxyArg, + >( + self, + action_id: Arg0, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("getActionValidSignerCount") + .argument(&action_id) + .original_result() + } + + /// Initiates board member addition process. + /// Can also be used to promote a proposer to board member. + pub fn propose_add_board_member< + Arg0: ProxyArg>, + >( + self, + board_member_address: Arg0, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("proposeAddBoardMember") + .argument(&board_member_address) + .original_result() + } + + /// Initiates proposer addition process.. + /// Can also be used to demote a board member to proposer. + pub fn propose_add_proposer< + Arg0: ProxyArg>, + >( + self, + proposer_address: Arg0, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("proposeAddProposer") + .argument(&proposer_address) + .original_result() + } + + /// Removes user regardless of whether it is a board member or proposer. + pub fn propose_remove_user< + Arg0: ProxyArg>, + >( + self, + user_address: Arg0, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("proposeRemoveUser") + .argument(&user_address) + .original_result() + } + + pub fn propose_change_quorum< + Arg0: ProxyArg, + >( + self, + new_quorum: Arg0, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("proposeChangeQuorum") + .argument(&new_quorum) + .original_result() + } + + /// Propose a transaction in which the contract will perform a transfer-execute call. + /// Can send EGLD without calling anything. + /// Can call smart contract endpoints directly. + /// Doesn't really work with builtin functions. + pub fn propose_transfer_execute< + Arg0: ProxyArg>, + Arg1: ProxyArg>, + Arg2: ProxyArg>, + >( + self, + to: Arg0, + egld_amount: Arg1, + function_call: Arg2, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("proposeTransferExecute") + .argument(&to) + .argument(&egld_amount) + .argument(&function_call) + .original_result() + } + + /// Propose a transaction in which the contract will perform a transfer-execute call. + /// Can call smart contract endpoints directly. + /// Can use ESDTTransfer/ESDTNFTTransfer/MultiESDTTransfer to send tokens, while also optionally calling endpoints. + /// Works well with builtin functions. + /// Cannot simply send EGLD directly without calling anything. + pub fn propose_async_call< + Arg0: ProxyArg>, + Arg1: ProxyArg>, + Arg2: ProxyArg>, + >( + self, + to: Arg0, + egld_amount: Arg1, + function_call: Arg2, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("proposeAsyncCall") + .argument(&to) + .argument(&egld_amount) + .argument(&function_call) + .original_result() + } + + pub fn propose_sc_deploy_from_source< + Arg0: ProxyArg>, + Arg1: ProxyArg>, + Arg2: ProxyArg, + Arg3: ProxyArg>>, + >( + self, + amount: Arg0, + source: Arg1, + code_metadata: Arg2, + arguments: Arg3, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("proposeSCDeployFromSource") + .argument(&amount) + .argument(&source) + .argument(&code_metadata) + .argument(&arguments) + .original_result() + } + + pub fn propose_sc_upgrade_from_source< + Arg0: ProxyArg>, + Arg1: ProxyArg>, + Arg2: ProxyArg>, + Arg3: ProxyArg, + Arg4: ProxyArg>>, + >( + self, + sc_address: Arg0, + amount: Arg1, + source: Arg2, + code_metadata: Arg3, + arguments: Arg4, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("proposeSCUpgradeFromSource") + .argument(&sc_address) + .argument(&amount) + .argument(&source) + .argument(&code_metadata) + .argument(&arguments) + .original_result() + } + + /// Returns `true` (`1`) if `getActionValidSignerCount >= getQuorum`. + pub fn quorum_reached< + Arg0: ProxyArg, + >( + self, + action_id: Arg0, + ) -> TxTypedCall { + self.wrapped_tx + .payment(NotPayable) + .raw_call("quorumReached") + .argument(&action_id) + .original_result() + } + + /// Proposers and board members use this to launch signed actions. + pub fn perform_action_endpoint< + Arg0: ProxyArg, + >( + self, + action_id: Arg0, + ) -> TxTypedCall>> { + self.wrapped_tx + .payment(NotPayable) + .raw_call("performAction") + .argument(&action_id) + .original_result() + } + + pub fn dns_register< + Arg0: ProxyArg>, + Arg1: ProxyArg>, + >( + self, + dns_address: Arg0, + name: Arg1, + ) -> TxTypedCall { + self.wrapped_tx + .raw_call("dnsRegister") + .argument(&dns_address) + .argument(&name) + .original_result() + } +} + +#[type_abi] +#[derive(TopEncode)] +pub struct ActionFullInfo +where + Api: ManagedTypeApi, +{ + pub action_id: usize, + pub action_data: Action, + pub signers: ManagedVec>, +} + +#[rustfmt::skip] +#[type_abi] +#[derive(NestedEncode, NestedDecode, TopEncode, TopDecode, Clone)] +pub enum Action +where + Api: ManagedTypeApi, +{ + Nothing, + AddBoardMember(ManagedAddress), + AddProposer(ManagedAddress), + RemoveUser(ManagedAddress), + ChangeQuorum(usize), + SendTransferExecute(CallActionData), + SendAsyncCall(CallActionData), + SCDeployFromSource { + amount: BigUint, + source: ManagedAddress, + code_metadata: CodeMetadata, + arguments: ManagedVec>, + }, + SCUpgradeFromSource { + sc_address: ManagedAddress, + amount: BigUint, + source: ManagedAddress, + code_metadata: CodeMetadata, + arguments: ManagedVec>, + }, +} + +#[type_abi] +#[derive(NestedEncode, NestedDecode, Clone)] +pub struct CallActionData +where + Api: ManagedTypeApi, +{ + pub to: ManagedAddress, + pub egld_amount: BigUint, + pub endpoint_name: ManagedBuffer, + pub arguments: ManagedVec>, +} + +#[type_abi] +#[derive(TopEncode, TopDecode)] +pub enum UserRole { + None, + Proposer, + BoardMember, +} diff --git a/contracts/parametric-tests/multisig-pt/src/multisig_pt.rs b/contracts/parametric-tests/multisig-pt/src/multisig_pt.rs index 5749f91fe7..ef348c6e36 100644 --- a/contracts/parametric-tests/multisig-pt/src/multisig_pt.rs +++ b/contracts/parametric-tests/multisig-pt/src/multisig_pt.rs @@ -1,5 +1,7 @@ #![no_std] +mod multisig_proxy; + multiversx_sc::imports!(); static OWNER: &[u8; 32] = b"owner___________________________"; @@ -32,19 +34,20 @@ pub trait TestMultisigContract { } fn deploy(&self, code_path: &ManagedBuffer) { - let mut init_args = ManagedArgBuffer::new(); - init_args.push_arg(2); // quorum = 2 - init_args.push_arg(ManagedAddress::from(ALICE)); // board members = alice, bob, charlie - init_args.push_arg(ManagedAddress::from(BOB)); - init_args.push_arg(ManagedAddress::from(CHARLIE)); - - let multisig = self.test_raw().deploy_contract( - &ManagedAddress::from(OWNER), - 5000000000000, - &BigUint::zero(), - code_path, - &init_args, - ); + let mut board = MultiValueEncoded::new(); + board.push(ManagedAddress::from(ALICE)); // board members = alice, bob, charlie + board.push(ManagedAddress::from(BOB)); + board.push(ManagedAddress::from(CHARLIE)); + + let multisig = self + .tx() + .from(ManagedAddress::from(OWNER)) + .typed(multisig_proxy::MultisigProxy) + .init(2usize, board) + .code_path(code_path) + .gas(5000000000000) + .returns(ReturnsNewManagedAddress) + .test_deploy(); self.test_raw().assert(self.get_quorum(&multisig) == 2u32); self.test_raw() @@ -56,7 +59,8 @@ pub trait TestMultisigContract { } fn get_num_board_members(&self, multisig: &ManagedAddress) -> BigUint { - self.storage_raw().read_from_address(multisig, "num_board_members") + self.storage_raw() + .read_from_address(multisig, "num_board_members") } #[endpoint(test_change_quorum)] @@ -83,47 +87,36 @@ pub trait TestMultisigContract { proposer: &ManagedAddress, value: &BigUint, ) { - let mut args = ManagedArgBuffer::new(); - args.push_arg(value); - - self.test_raw().start_prank(proposer); - let _ = self.send_raw().direct_egld_execute( - multisig, - &BigUint::from(0u32), - 5000000, - &ManagedBuffer::from(b"proposeChangeQuorum"), - &args, - ); - self.test_raw().stop_prank(); + let quorum_u64 = value + .to_u64() + .unwrap_or_else(|| sc_panic!("quorum too large")); + + self.tx() + .from(proposer) + .to(multisig) + .typed(multisig_proxy::MultisigProxy) + .propose_change_quorum(quorum_u64 as usize) + .gas(5000000) + .test_call(); } fn change_quorum_sign(&self, multisig: &ManagedAddress, signer: &ManagedAddress) { - let mut args = ManagedArgBuffer::new(); - args.push_arg(1u32); - - self.test_raw().start_prank(signer); - let _ = self.send_raw().direct_egld_execute( - multisig, - &BigUint::from(0u32), - 5000000, - &ManagedBuffer::from(b"sign"), - &args, - ); - self.test_raw().stop_prank(); + self.tx() + .from(signer) + .to(multisig) + .typed(multisig_proxy::MultisigProxy) + .sign(1usize) + .gas(5000000) + .test_call(); } fn perform_action(&self, multisig: &ManagedAddress, performer: &ManagedAddress) { - let mut args = ManagedArgBuffer::new(); - args.push_arg(1u32); - - self.test_raw().start_prank(performer); - let _ = self.send_raw().direct_egld_execute( - multisig, - &BigUint::from(0u32), - 5000000, - &ManagedBuffer::from(b"performAction"), - &args, - ); - self.test_raw().stop_prank(); + self.tx() + .from(performer) + .to(multisig) + .typed(multisig_proxy::MultisigProxy) + .perform_action_endpoint(1usize) + .gas(5000000) + .test_call(); } } diff --git a/framework/base/src/types/interaction/annotated/annotated_impl_managed_buffer.rs b/framework/base/src/types/interaction/annotated/annotated_impl_managed_buffer.rs index eecaad75b5..e1a07af5b3 100644 --- a/framework/base/src/types/interaction/annotated/annotated_impl_managed_buffer.rs +++ b/framework/base/src/types/interaction/annotated/annotated_impl_managed_buffer.rs @@ -29,6 +29,33 @@ where } } +impl AnnotatedValue> for &ManagedBuffer +where + Env: TxEnv, +{ + fn annotation(&self, _env: &Env) -> ManagedBuffer { + self.hex_expr() + } + + #[inline] + fn to_value(&self, _env: &Env) -> ManagedBuffer { + (*self).clone() + } + + #[inline] + fn into_value(self, _env: &Env) -> ManagedBuffer { + self.clone() + } + + #[inline] + fn with_value_ref(&self, _env: &Env, f: F) -> R + where + F: FnOnce(&ManagedBuffer) -> R, + { + f(self) + } +} + impl AnnotatedValue> for () where Env: TxEnv, diff --git a/framework/base/src/types/interaction/tx_data/tx_code_source.rs b/framework/base/src/types/interaction/tx_data/tx_code_source.rs index 0b8e23fb48..3973fcd46e 100644 --- a/framework/base/src/types/interaction/tx_data/tx_code_source.rs +++ b/framework/base/src/types/interaction/tx_data/tx_code_source.rs @@ -86,6 +86,7 @@ where } impl TxCodePathValue for ManagedBuffer where Env: TxEnv {} +impl TxCodePathValue for &ManagedBuffer where Env: TxEnv {} /// Contains code for a deploy or upgrade. pub struct CodePath(pub CodePathValue); From 075ef0de0552c9f30cc4df6d3108da5a6518d67d Mon Sep 17 00:00:00 2001 From: Andrei Marinica Date: Wed, 5 Jun 2024 10:10:25 +0300 Subject: [PATCH 16/20] multisig-pt - quorum as usize --- .../multisig-pt/src/multisig_pt.rs | 20 ++++++++----------- 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/contracts/parametric-tests/multisig-pt/src/multisig_pt.rs b/contracts/parametric-tests/multisig-pt/src/multisig_pt.rs index ef348c6e36..b4f42ef0d2 100644 --- a/contracts/parametric-tests/multisig-pt/src/multisig_pt.rs +++ b/contracts/parametric-tests/multisig-pt/src/multisig_pt.rs @@ -49,22 +49,22 @@ pub trait TestMultisigContract { .returns(ReturnsNewManagedAddress) .test_deploy(); - self.test_raw().assert(self.get_quorum(&multisig) == 2u32); + self.test_raw().assert(self.get_quorum(&multisig) == 2usize); self.test_raw() - .assert(self.get_num_board_members(&multisig) == 3u32); + .assert(self.get_num_board_members(&multisig) == 3usize); } - fn get_quorum(&self, multisig: &ManagedAddress) -> BigUint { + fn get_quorum(&self, multisig: &ManagedAddress) -> usize { self.storage_raw().read_from_address(multisig, "quorum") } - fn get_num_board_members(&self, multisig: &ManagedAddress) -> BigUint { + fn get_num_board_members(&self, multisig: &ManagedAddress) -> usize { self.storage_raw() .read_from_address(multisig, "num_board_members") } #[endpoint(test_change_quorum)] - fn test_change_quorum(&self, value: BigUint) { + fn test_change_quorum(&self, value: usize) { let multisig = ManagedAddress::from(MULTISIG); let alice = ManagedAddress::from(ALICE); let bob = ManagedAddress::from(BOB); @@ -73,7 +73,7 @@ pub trait TestMultisigContract { self.test_raw() .assume(value <= self.get_num_board_members(&multisig)); - self.change_quorum_propose(&multisig, &alice, &value); + self.change_quorum_propose(&multisig, &alice, value); self.change_quorum_sign(&multisig, &bob); self.perform_action(&multisig, &alice); @@ -85,17 +85,13 @@ pub trait TestMultisigContract { &self, multisig: &ManagedAddress, proposer: &ManagedAddress, - value: &BigUint, + value: usize, ) { - let quorum_u64 = value - .to_u64() - .unwrap_or_else(|| sc_panic!("quorum too large")); - self.tx() .from(proposer) .to(multisig) .typed(multisig_proxy::MultisigProxy) - .propose_change_quorum(quorum_u64 as usize) + .propose_change_quorum(value) .gas(5000000) .test_call(); } From bf77c2b9e2700125357c159f3fd5d4c365e72b66 Mon Sep 17 00:00:00 2001 From: Andrei Marinica Date: Wed, 5 Jun 2024 13:41:25 +0300 Subject: [PATCH 17/20] cleanup --- contracts/examples/adder/sc-config.toml | 2 +- contracts/parametric-tests/adder-pt/kasmer.json | 2 +- contracts/parametric-tests/multisig-pt/kasmer.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/contracts/examples/adder/sc-config.toml b/contracts/examples/adder/sc-config.toml index 6e37a3a481..477c644746 100644 --- a/contracts/examples/adder/sc-config.toml +++ b/contracts/examples/adder/sc-config.toml @@ -4,4 +4,4 @@ path = "src/adder_proxy.rs" [[proxy]] -path = "../../parametric-tests/adder-pt/src/adder_proxy.rs" \ No newline at end of file +path = "../../parametric-tests/adder-pt/src/adder_proxy.rs" diff --git a/contracts/parametric-tests/adder-pt/kasmer.json b/contracts/parametric-tests/adder-pt/kasmer.json index 67d0583c45..940b2a311b 100644 --- a/contracts/parametric-tests/adder-pt/kasmer.json +++ b/contracts/parametric-tests/adder-pt/kasmer.json @@ -2,4 +2,4 @@ "contract_paths": [ "../../examples/adder/output/adder.wasm" ] -} \ No newline at end of file +} diff --git a/contracts/parametric-tests/multisig-pt/kasmer.json b/contracts/parametric-tests/multisig-pt/kasmer.json index cc5a270dd6..6fa6f97e05 100644 --- a/contracts/parametric-tests/multisig-pt/kasmer.json +++ b/contracts/parametric-tests/multisig-pt/kasmer.json @@ -2,4 +2,4 @@ "contract_paths": [ "../../examples/multisig/output/multisig-full.wasm" ] -} \ No newline at end of file +} From b56dda855c527b7d838551d0bfb71afe7e2567e6 Mon Sep 17 00:00:00 2001 From: Andrei Marinica Date: Thu, 4 Jul 2024 22:33:11 +0300 Subject: [PATCH 18/20] kasmer config for adder & multisig --- contracts/parametric-tests/adder-pt/.gitignore | 4 ++++ contracts/parametric-tests/adder-pt/kasmer.json | 4 ++-- contracts/parametric-tests/multisig-pt/.gitignore | 4 ++++ contracts/parametric-tests/multisig-pt/kasmer.json | 7 +++++-- 4 files changed, 15 insertions(+), 4 deletions(-) diff --git a/contracts/parametric-tests/adder-pt/.gitignore b/contracts/parametric-tests/adder-pt/.gitignore index 2c76bc983e..abc3e496f7 100644 --- a/contracts/parametric-tests/adder-pt/.gitignore +++ b/contracts/parametric-tests/adder-pt/.gitignore @@ -5,3 +5,7 @@ # The mxpy output /output*/ + +# Kasmer +.property +generated_claims diff --git a/contracts/parametric-tests/adder-pt/kasmer.json b/contracts/parametric-tests/adder-pt/kasmer.json index 940b2a311b..c2ad4eaea4 100644 --- a/contracts/parametric-tests/adder-pt/kasmer.json +++ b/contracts/parametric-tests/adder-pt/kasmer.json @@ -1,5 +1,5 @@ { - "contract_paths": [ - "../../examples/adder/output/adder.wasm" + "contracts": [ + "../../examples/adder" ] } diff --git a/contracts/parametric-tests/multisig-pt/.gitignore b/contracts/parametric-tests/multisig-pt/.gitignore index 2c76bc983e..abc3e496f7 100644 --- a/contracts/parametric-tests/multisig-pt/.gitignore +++ b/contracts/parametric-tests/multisig-pt/.gitignore @@ -5,3 +5,7 @@ # The mxpy output /output*/ + +# Kasmer +.property +generated_claims diff --git a/contracts/parametric-tests/multisig-pt/kasmer.json b/contracts/parametric-tests/multisig-pt/kasmer.json index 6fa6f97e05..5700dd71d1 100644 --- a/contracts/parametric-tests/multisig-pt/kasmer.json +++ b/contracts/parametric-tests/multisig-pt/kasmer.json @@ -1,5 +1,8 @@ { - "contract_paths": [ - "../../examples/multisig/output/multisig-full.wasm" + "contracts": [ + { + "path": "../../examples/multisig", + "name": "multisig" + } ] } From d4f6b59b51a6c125cace178cc868f746017b369c Mon Sep 17 00:00:00 2001 From: Andrei Marinica Date: Fri, 5 Jul 2024 12:31:57 +0300 Subject: [PATCH 19/20] kasmer readme --- contracts/parametric-tests/adder-pt/README.md | 19 +++++++++++++++++++ .../parametric-tests/multisig-pt/README.md | 17 +++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 contracts/parametric-tests/adder-pt/README.md create mode 100644 contracts/parametric-tests/multisig-pt/README.md diff --git a/contracts/parametric-tests/adder-pt/README.md b/contracts/parametric-tests/adder-pt/README.md new file mode 100644 index 0000000000..1971f3a4ac --- /dev/null +++ b/contracts/parametric-tests/adder-pt/README.md @@ -0,0 +1,19 @@ +# Parametric test example for: Adder + +This is an exampel on how to write a basic parametric test contract. + +To run fuzzing on it using Kasmer, buld the contracts and simply run + +``` +kasmer fuzz +``` + + +To run symbolic execution: + +``` +kasmer build +kasmer verify test_call_add --booster +## and / or +kasmer verify test_call_add_twice --booster +``` diff --git a/contracts/parametric-tests/multisig-pt/README.md b/contracts/parametric-tests/multisig-pt/README.md new file mode 100644 index 0000000000..5a14e01220 --- /dev/null +++ b/contracts/parametric-tests/multisig-pt/README.md @@ -0,0 +1,17 @@ +# Parametric test example for: Multisig + +This is an exampel on how to write a basic parametric test contract. + +To run fuzzing on it using Kasmer, buld the contracts and simply run + +``` +kasmer fuzz +``` + + +To run symbolic execution: + +``` +kasmer build +kasmer verify test_change_quorum --booster +``` From 45dff22299e0848bd31623c54e81b75764bf0832 Mon Sep 17 00:00:00 2001 From: Andrei Marinica Date: Fri, 5 Jul 2024 12:50:13 +0300 Subject: [PATCH 20/20] typos --- contracts/parametric-tests/adder-pt/README.md | 4 ++-- contracts/parametric-tests/multisig-pt/README.md | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/contracts/parametric-tests/adder-pt/README.md b/contracts/parametric-tests/adder-pt/README.md index 1971f3a4ac..3821f96915 100644 --- a/contracts/parametric-tests/adder-pt/README.md +++ b/contracts/parametric-tests/adder-pt/README.md @@ -1,8 +1,8 @@ # Parametric test example for: Adder -This is an exampel on how to write a basic parametric test contract. +This is an example on how to write a basic parametric test contract. -To run fuzzing on it using Kasmer, buld the contracts and simply run +To run fuzzing on it using Kasmer, build the contracts and simply run ``` kasmer fuzz diff --git a/contracts/parametric-tests/multisig-pt/README.md b/contracts/parametric-tests/multisig-pt/README.md index 5a14e01220..b50ddf6ba0 100644 --- a/contracts/parametric-tests/multisig-pt/README.md +++ b/contracts/parametric-tests/multisig-pt/README.md @@ -1,8 +1,8 @@ # Parametric test example for: Multisig -This is an exampel on how to write a basic parametric test contract. +This is an example on how to write a basic parametric test contract. -To run fuzzing on it using Kasmer, buld the contracts and simply run +To run fuzzing on it using Kasmer, build the contracts and simply run ``` kasmer fuzz