diff --git a/.github/workflows/actions-nightly.yml b/.github/workflows/actions-nightly.yml index 355a53883c..2539363ff9 100644 --- a/.github/workflows/actions-nightly.yml +++ b/.github/workflows/actions-nightly.yml @@ -14,7 +14,7 @@ permissions: jobs: contracts: name: Contracts (nightly) - uses: multiversx/mx-sc-actions/.github/workflows/contracts.yml@v3.2.0 + uses: multiversx/mx-sc-actions/.github/workflows/contracts.yml@v3.3.1 with: rust-toolchain: nightly-2024-05-22 path-to-sc-meta: framework/meta diff --git a/.github/workflows/actions.yml b/.github/workflows/actions.yml index dc0bcc8596..58ea9e80c6 100644 --- a/.github/workflows/actions.yml +++ b/.github/workflows/actions.yml @@ -14,11 +14,23 @@ permissions: jobs: contracts: name: Contracts - uses: multiversx/mx-sc-actions/.github/workflows/contracts.yml@v3.1.0 + uses: multiversx/mx-sc-actions/.github/workflows/contracts.yml@4ec1f927bd99ed90a816ded805daa75fd2040258 with: rust-toolchain: stable path-to-sc-meta: framework/meta mx-scenario-go-version: v2.1.0-alpha coverage-args: --ignore-filename-regex='meta/src' --ignore-filename-regex='wasm-adapter' --ignore-filename-regex='benchmarks/' --ignore-filename-regex='tests/' --output ./coverage.md secrets: - token: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file + token: ${{ secrets.GITHUB_TOKEN }} + + formatting: + name: cargo fmt + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + # Ensure rustfmt is installed and setup problem matcher + - uses: actions-rust-lang/setup-rust-toolchain@v1 + with: + components: rustfmt + - name: Rustfmt Check + uses: actions-rust-lang/rustfmt@v1 diff --git a/.github/workflows/lldb-formatter-tests.yml b/.github/workflows/lldb-formatter-tests.yml index 9aaba9eadd..257476c191 100644 --- a/.github/workflows/lldb-formatter-tests.yml +++ b/.github/workflows/lldb-formatter-tests.yml @@ -22,14 +22,14 @@ jobs: uses: robinraju/release-downloader@v1.5 with: repository: vadimcn/vscode-lldb - latest: true - fileName: codelldb-x86_64-linux.vsix + tag: v1.11.0 + fileName: codelldb-linux-x64.vsix - name: Setup vscode-lldb run: | - unzip codelldb-x86_64-linux.vsix -d vscode-lldb - mkdir -p $HOME/.vscode/extensions/vadimcn.vscode-lldb-x.x.x/ - mv vscode-lldb/extension/* $HOME/.vscode/extensions/vadimcn.vscode-lldb-x.x.x/ + unzip codelldb-linux-x64.vsix -d vscode-lldb + mkdir -p $HOME/.vscode/extensions/vadimcn.vscode-lldb-1.11.0/ + mv vscode-lldb/extension/* $HOME/.vscode/extensions/vadimcn.vscode-lldb-1.11.0/ - name: Run the rust tests run: | diff --git a/.github/workflows/plotter-test.yml b/.github/workflows/plotter-test.yml new file mode 100644 index 0000000000..d509759003 --- /dev/null +++ b/.github/workflows/plotter-test.yml @@ -0,0 +1,30 @@ +name: CI + +on: + push: + branches: + - master + pull_request: + +permissions: + checks: write + pull-requests: write + +jobs: + template_test_current: + name: Plotter tests + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Install rust + uses: actions-rust-lang/setup-rust-toolchain@v1 + with: + toolchain: stable + target: wasm32-unknown-unknown + + - name: Run plotter tests + run: | + cd tools/plotter + cargo test diff --git a/.gitignore b/.gitignore index 8295450d89..00a4be02e9 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ # Generated by Cargo # will have compiled files and executables **/target/** +**/dist # Remove Cargo.lock from the framework, but not from the wasm contracts. # In contracts it helps with tracing builds. diff --git a/CHANGELOG.md b/CHANGELOG.md index 16cf669c27..9d6c7ae1da 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,9 +23,107 @@ They are: - `multiversx-sc-codec`, in short `codec`, the serializer/deserializer, 2 crates: - `multiversx-sc-codec` - `multiversx-sc-codec-derive` -- `multiversx-chain-vm`, in short `vm`, a Rust VM implementation, 1 crate. +- Chain crates, in short `chain`. Formerly it was only the VM (`vm`). 2 crates: + - `multiversx-chain-core` - *a common crate for chain types, constants, flags* + - `multiversx-chain-vm` - *a Rust VM implementation* - `multiversx-chain-scenario-format`, in short `scenario-format`, scenario JSON serializer/deserializer, 1 crate. -- `multiversx-sdk`, in short `sdk`, allows communication with the chain(s), 1 crate. +- `multiversx-sdk`, in short `sdk`, allows communication with the chain(s), 3 crates: + - `multiversx-sdk` + - `multiversx-sdk-http` + - `multiversx-sdk-dapp` + +## [sc 0.54.1] - 2024-11-13 +- `sc-meta` `cs` - ChainSimulator CLI, which provides handy functionality to: + - install the chain simulator image in Docker; + - start/stop the chain simulator; + - quick testing using the `chain-simulator-tests` feature flag. +- Adder interactor cleanup, including in template. +- Interactor - `use_chain_simulator` builder method, for improved backwards compatibility. +- `MultiValueEncodedCounted` - a lazy multi-value encoding, but with known number of elements. + +## [sc 0.54.0, sdk 0.7.0, chain 0.11.0] - 2024-11-06 +- New crate, `multiversx-chain-core`, to be used in both framework and Rust VM. It contains common types, flags, and constants that refer to the protocol. +- Major SDK/interactor refactor: + - Added support for Chain Simulator in interactors: + - Added chain-simulator-specific endpoints: feed account, advance blocks + - Added a system to set up accounts in the chain simulator from the interactor; + - Support for advancing blocks in the interactor; + - Split SDK crate into: + - `multiversx-sdk` - only contains the specifications of the gateway API, without a mechanism to call the API; + - `multiversx-sdk-http` - functionality to call the gateway via reqwest; + - `multiversx-sdk-dapp` - functionality to call the gateway via wasm-bindgen, to be used in WebAssembly front-ends; + - Major improvements in the retrieving of transactions and other blockchain data fron the API, many bugs fixed; + - Support for writing integration tests for interactors, using the Chain Simulator; + - Also added support for test-related `chain-simulator-tests` feature flag in `sc-meta`; + - Interactors on the front-end: + - Interactor type made generic over the gateway API implementation, so that it can be used in both front-end and back-end, with no change in the code base; + - Support for custom random number generation for the front-end; + - Mechanism for fixing file paths in the interactor context; + - Fixed an issue with the account tool; + - Adjusted `sc-meta snippets` for the new syntax and the chain simulator support; +- Unified syntax: + - `ReturnsHandledOrError` result handler, which can gracefully deal with failed transactions; + - `ReturnsGasUsed` result handler; + - `PassValue` result handler for providing a closure-like context for multi-transaction call/deploy; + - More specific back transfer result handlers: `ReturnsBackTransfersEGLD`, `ReturnsBackTransfersMultiESDT`, `ReturnsBackTransfersSingleESDT`; + - Fixed an issue with the update functionality not being general enough; + - Deprecated `prepare_async()`, developers can now call `run()` directly, asynchronously; +- `sc-meta` improvements: + - New mechanism for detecting and warning about storage writes in readonly endpoints, integrated into the build system; + - Support for referencing the framework via git commit, branch, or tag, to make it easier to try out unreleased versions; + - Support for `default-features`; + - Better representation in console of the contract/lib folders, as well as better error messages. + - Refactoring of the dependency handling logic. +- Fixed the debugger, following changes in the Rust debug tooling. +- `ManagedVec` `set` always consumes ownership. Preparations for a profound memory management cleanup. +- ABI: + - `title` field and annotation; + - Refactoring. + +## [sc 0.53.2] - 2024-10-02 +- `StakingModule` fix. + +## [sc 0.53.1, sdk 0.6.1] - 2024-10-01 +- Interactor: + - Allow signature to be empty in TransactionOnNetwork; + - Allow return data to be empty in VMOutputApi. + +## [sc 0.53.0 codec 0.21.0, vm 0.10.0, sdk 0.6.0, scenario-format 0.23.0] - 2024-09-04 +- Unified syntax: + - Whitebox testing; + - Proxy fix for ManagedOption; + - TestTokenIdentifier syntactic sugar. +- New ResultHandler: `ReturnsLogs`. +- Interactor: + - Fix on API fetch process status; + - Fix on ReturnsNewTokenIdentifier edge cases solved; + - Fix on ESDTTransfer for transfer step; + - Support for Keystore + password. +- Framework API support: EI 1.4 crypto functions. +- `sc-meta`: + - New `wallet` command: PEM and keystore generator and conversions; + - New `report` command: + - Generate json or Markdown report based on size, path, allocator and panic messages; + - Compare reports; + - Convert reports. +- VecMapper update with index. +- Substitution list: AddressToIdMapper +- Dependencies updated. + +## [sc 0.52.3] - 2024-08-06 +- Pause module events. + +## [sc 0.52.2] - 2024-08-01 +- `ManagedBufferReadToEnd` extract data methods. + +## [sc 0.52.1] - 2024-07-31 +- `ManagedBufferReadToEnd` `TypeAbi` implementation. + +## [sc 0.52.0, codec 0.20.1] - 2024-07-31 +- ManagedBufferReadToEnd type, which flushed a nested data buffer. +- Fixed hex and binary formatters for byte slices. +- Added EI 1.4 and 1.5 configs. +- Dependency upgrades. ## [sc 0.51.1] - `sc-meta upgrade` bugfix. diff --git a/Cargo.lock b/Cargo.lock index 5a348bfd06..95a73a2974 100755 --- a/Cargo.lock +++ b/Cargo.lock @@ -47,18 +47,29 @@ dependencies = [ [[package]] name = "addr2line" -version = "0.22.0" +version = "0.24.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e4503c46a5c0c7844e948c9a4d6acd9f50cccb4de1c48eb9e291ea17470c678" +checksum = "dfbe277e56a376000877090da837660b4427aad530e3028d44e0bffe4f89a1c1" dependencies = [ "gimli", ] [[package]] -name = "adler" -version = "1.0.2" +name = "adler2" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627" + +[[package]] +name = "aes" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" +checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0" +dependencies = [ + "cfg-if", + "cipher", + "cpufeatures", +] [[package]] name = "ahash" @@ -100,9 +111,9 @@ dependencies = [ [[package]] name = "anstream" -version = "0.6.14" +version = "0.6.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "418c75fa768af9c03be99d17643f93f79bbba589895012a80e3452a19ddda15b" +checksum = "8acc5369981196006228e28809f761875c0327210a891e941f4c683b3a99529b" dependencies = [ "anstyle", "anstyle-parse", @@ -115,58 +126,64 @@ dependencies = [ [[package]] name = "anstyle" -version = "1.0.7" +version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "038dfcf04a5feb68e9c60b21c9625a54c2c0616e79b72b0fd87075a056ae1d1b" +checksum = "55cc3b69f167a1ef2e161439aa98aed94e6028e5f9a59be9a6ffb47aef1651f9" [[package]] name = "anstyle-parse" -version = "0.2.4" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c03a11a9034d92058ceb6ee011ce58af4a9bf61491aa7e1e59ecd24bd40d22d4" +checksum = "3b2d16507662817a6a20a9ea92df6652ee4f94f914589377d69f3b21bc5798a9" dependencies = [ "utf8parse", ] [[package]] name = "anstyle-query" -version = "1.1.0" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad186efb764318d35165f1758e7dcef3b10628e26d41a44bc5550652e6804391" +checksum = "79947af37f4177cfead1110013d678905c37501914fba0efea834c3fe9a8d60c" dependencies = [ - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] name = "anstyle-wincon" -version = "3.0.3" +version = "3.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61a38449feb7068f52bb06c12759005cf459ee52bb4adc1d5a7c4322d716fb19" +checksum = "2109dbce0e72be3ec00bed26e6a7479ca384ad226efdd66db8fa2e3a38c83125" dependencies = [ "anstyle", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] name = "anyhow" -version = "1.0.86" +version = "1.0.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" +checksum = "4c95c10ba0b00a02636238b814946408b1322d5ac4760326e6fb8ec956d85775" + +[[package]] +name = "anymap2" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d301b3b94cb4b2f23d7917810addbbaff90738e0ca2be692bd027e70d7e0330c" [[package]] name = "arbitrary" -version = "1.3.2" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d5a26814d8dcb93b0e5a0ff3c6d80a8843bafb21b39e8e18a6f05471870e110" +checksum = "dde20b3d026af13f561bdd0f15edf01fc734f0dafcedbaf42bba506a9517f223" dependencies = [ "derive_arbitrary", ] [[package]] name = "arrayvec" -version = "0.7.4" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" +checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" [[package]] name = "atomic-waker" @@ -176,23 +193,23 @@ checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" [[package]] name = "autocfg" -version = "1.3.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" +checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" [[package]] name = "backtrace" -version = "0.3.73" +version = "0.3.74" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5cc23269a4f8976d0a4d2e7109211a419fe30e8d88d677cd60b6bc79c5732e0a" +checksum = "8d82cb332cdfaed17ae235a638438ac4d4839913cc2af585c3c6746e8f8bee1a" dependencies = [ "addr2line", - "cc", "cfg-if", "libc", "miniz_oxide", "object", "rustc-demangle", + "windows-targets 0.52.6", ] [[package]] @@ -201,6 +218,12 @@ version = "0.22.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" +[[package]] +name = "base64ct" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" + [[package]] name = "basic-features" version = "0.0.0" @@ -219,6 +242,7 @@ dependencies = [ "clap", "multiversx-sc-snippets", "serde", + "tokio", "toml", ] @@ -231,21 +255,22 @@ dependencies = [ ] [[package]] -name = "basic-interact" +name = "basic-interactor" version = "0.0.0" dependencies = [ "adder", "clap", "multiversx-sc-snippets", "serde", + "tokio", "toml", ] [[package]] name = "bech32" -version = "0.9.1" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d86b93f97252c47b41663388e6d155714a9d0c398b99f1005cbc5f978b29f445" +checksum = "d965446196e3b7decd44aa7ee49e31d630118f90ef12f97900f262eb915c951d" [[package]] name = "benchmark-common" @@ -272,30 +297,43 @@ dependencies = [ "multiversx-sc-meta-lib", ] +[[package]] +name = "bincode" +version = "1.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad" +dependencies = [ + "serde", +] + [[package]] name = "bip39" -version = "2.0.0" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93f2635620bf0b9d4576eb7bb9a38a55df78bd1205d26fa994b25911a69f212f" +checksum = "33415e24172c1b7d6066f6d999545375ab8e1d95421d6784bdfff9496f292387" dependencies = [ "bitcoin_hashes", - "rand 0.8.5", - "rand_core 0.6.4", + "rand", + "rand_core", "serde", "unicode-normalization", ] [[package]] -name = "bitcoin_hashes" -version = "0.11.0" +name = "bitcoin-internals" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90064b8dee6815a6470d60bad07bbbaee885c0e12d04177138fa3291a01b7bc4" +checksum = "9425c3bf7089c983facbae04de54513cce73b41c7f9ff8c845b54e7bc64ebbfb" [[package]] -name = "bitflags" -version = "1.3.2" +name = "bitcoin_hashes" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" +checksum = "1930a4dabfebb8d7d9992db18ebe3ae2876f0a305fab206fd168df931ede293b" +dependencies = [ + "bitcoin-internals", + "hex-conservative", +] [[package]] name = "bitflags" @@ -303,15 +341,6 @@ version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" -[[package]] -name = "block-buffer" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" -dependencies = [ - "generic-array", -] - [[package]] name = "block-buffer" version = "0.10.4" @@ -338,11 +367,17 @@ dependencies = [ "multiversx-sc-meta-lib", ] +[[package]] +name = "boolinator" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfa8873f51c92e232f9bac4065cddef41b714152812bfc5f7672ba16d6ef8cd9" + [[package]] name = "bstr" -version = "1.9.1" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05efc5cfd9110c8416e471df0e96702d58690178e206e61b7173706673c93706" +checksum = "1a68f1f47cdf0ec8ee4b941b2eee2a80cb796db73118c0dd09ac63fbe405be22" dependencies = [ "memchr", "serde", @@ -378,15 +413,18 @@ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "bytes" -version = "1.6.1" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a12916984aab3fa6e39d655a33e09c0071eb36d6ab3aea5c2d78551f1df6d952" +checksum = "9ac0150caa2ae65ca5bd83f25c7de183dea78d4d366469f148435e2acfbad0da" [[package]] name = "cc" -version = "1.1.5" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "324c74f2155653c90b04f25b2a47a8a631360cb908f92a772695f430c7e31052" +checksum = "fd9de9f2205d5ef3fd67e685b0df337994ddd4495e2a28d185500d0e1edfea47" +dependencies = [ + "shlex", +] [[package]] name = "cfg-if" @@ -394,6 +432,12 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" +[[package]] +name = "cfg_aliases" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" + [[package]] name = "check-pause" version = "0.0.0" @@ -429,11 +473,21 @@ dependencies = [ "multiversx-sc-meta-lib", ] +[[package]] +name = "cipher" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" +dependencies = [ + "crypto-common", + "inout", +] + [[package]] name = "clap" -version = "4.5.9" +version = "4.5.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64acc1846d54c1fe936a78dc189c34e28d3f5afc348403f28ecf53660b9b8462" +checksum = "fb3b4b9e5a7c7514dfa52869339ee98b3156b0bfb4e8a77c4ff4babb64b1604f" dependencies = [ "clap_builder", "clap_derive", @@ -441,9 +495,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.9" +version = "4.5.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6fb8393d67ba2e7bfaf28a23458e4e2b543cc73a99595511eb207fdb8aede942" +checksum = "b17a95aa67cc7b5ebd32aa5370189aa0d79069ef1c64ce893bd30fb24bff20ec" dependencies = [ "anstream", "anstyle", @@ -453,27 +507,27 @@ dependencies = [ [[package]] name = "clap_derive" -version = "4.5.8" +version = "4.5.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2bac35c6dafb060fd4d275d9a4ffae97917c13a6327903a8be2153cd964f7085" +checksum = "4ac6a0c7b1a9e9a5186361f67dfa1b88213572f427fb9ab038efb2bd8c582dab" dependencies = [ "heck", "proc-macro2", "quote", - "syn", + "syn 2.0.77", ] [[package]] name = "clap_lex" -version = "0.7.1" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b82cf0babdbd58558212896d1a4272303a57bdb245c2bf1147185fb45640e70" +checksum = "afb84c814227b90d6895e01398aee0d8033c00e7466aca416fb6a8e0eb19d8a7" [[package]] name = "colorchoice" -version = "1.0.1" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b6a852b24ab71dffc585bcb46eaf7959d175cb865a7152e35b348d1b2960422" +checksum = "5b63caa9aa9397e2d9480a9b13673856c78d8ac123288526c37d7839f2a86990" [[package]] name = "colored" @@ -509,6 +563,32 @@ dependencies = [ "vault", ] +[[package]] +name = "console_error_panic_hook" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a06aeb73f470f66dcdbf7223caeebb85984942f22f1adb2a088cf9668146bbbc" +dependencies = [ + "cfg-if", + "wasm-bindgen", +] + +[[package]] +name = "console_log" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e89f72f65e8501878b8a004d5a1afb780987e2ce2b4532c562e367a72c57499f" +dependencies = [ + "log", + "web-sys", +] + +[[package]] +name = "const-oid" +version = "0.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" + [[package]] name = "convert_case" version = "0.6.0" @@ -539,15 +619,15 @@ dependencies = [ [[package]] name = "core-foundation-sys" -version = "0.8.6" +version = "0.8.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f" +checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" [[package]] name = "cpufeatures" -version = "0.2.12" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53fe5e26ff1b7aef8bca9c6080520cfb8d9333c7568e1829cef191a9723e5504" +checksum = "0ca741a962e1b0bff6d724a1a0958b686406e853bb14061f218562e1896f95e6" dependencies = [ "libc", ] @@ -664,37 +744,61 @@ dependencies = [ "multiversx-sc-meta-lib", ] +[[package]] +name = "ctr" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0369ee1ad671834580515889b80f2ea915f23b8be8d0daa4bbaf2ac5c7590835" +dependencies = [ + "cipher", +] + [[package]] name = "curve25519-dalek" -version = "3.2.0" +version = "4.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b9fdf9972b2bd6af2d913799d9ebc165ea4d2e65878e329d9c6b372c4491b61" +checksum = "97fb8b7c4503de7d6ae7b42ab72a5a59857b4c937ec27a3d4539dba95b5ab2be" dependencies = [ - "byteorder", - "digest 0.9.0", - "rand_core 0.5.1", + "cfg-if", + "cpufeatures", + "curve25519-dalek-derive", + "digest", + "fiat-crypto", + "rustc_version", "subtle", "zeroize", ] [[package]] -name = "derive_arbitrary" -version = "1.3.2" +name = "curve25519-dalek-derive" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67e77553c4162a157adbf834ebae5b415acbecbeafc7a74b0e886657506a7611" +checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.77", ] [[package]] -name = "digest" -version = "0.9.0" +name = "der" +version = "0.7.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" +checksum = "f55bf8e7b65898637379c1b74eb1551107c8294ed26d855ceb9fd1a09cfc9bc0" dependencies = [ - "generic-array", + "const-oid", + "zeroize", +] + +[[package]] +name = "derive_arbitrary" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "30542c1ad912e0e3d22a1935c290e12e8a29d704a420177a31faad4a601a0800" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.77", ] [[package]] @@ -703,7 +807,7 @@ version = "0.10.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" dependencies = [ - "block-buffer 0.10.4", + "block-buffer", "crypto-common", "subtle", ] @@ -732,29 +836,30 @@ checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.77", ] [[package]] name = "ed25519" -version = "1.5.3" +version = "2.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91cff35c70bba8a626e3185d8cd48cc11b5437e1a5bcd15b9b5fa3c64b6dfee7" +checksum = "115531babc129696a58c64a4fef0a8bf9e9698629fb97e9e40767d235cfbcd53" dependencies = [ + "pkcs8", "signature", ] [[package]] name = "ed25519-dalek" -version = "1.0.1" +version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c762bae6dcaf24c4c84667b8579785430908723d5c889f469d76a41d59cc7a9d" +checksum = "4a3daa8e81a3963a60642bcc1f90a670680bd4a77535faa384e9d1c79d620871" dependencies = [ "curve25519-dalek", "ed25519", - "rand 0.7.3", "serde", - "sha2 0.9.9", + "sha2", + "subtle", "zeroize", ] @@ -783,9 +888,9 @@ dependencies = [ [[package]] name = "encoding_rs" -version = "0.8.34" +version = "0.8.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b45de904aa0b010bce2ab45264d0631681847fa7b6f2eaa7dab7619943bc4f59" +checksum = "75030f3c4f45dafd7586dd6780965a8c7e8e285a5ecb86713e63a79c5b2766f3" dependencies = [ "cfg-if", ] @@ -798,9 +903,9 @@ checksum = "c34f04666d835ff5d62e058c3995147c06f42fe86ff053337632bca83e42702d" [[package]] name = "env_filter" -version = "0.1.0" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a009aa4810eb158359dda09d0c87378e4bbb89b5a801f016885a4707ba24f7ea" +checksum = "4f2c92ceda6ceec50f43169f9ee8424fe2db276791afde7b2cd8bc084cb376ab" dependencies = [ "log", "regex", @@ -808,9 +913,9 @@ dependencies = [ [[package]] name = "env_logger" -version = "0.11.3" +version = "0.11.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38b35839ba51819680ba087cd351788c9a3c476841207e0b8cee0b04722343b9" +checksum = "e13fa619b91fb2381732789fc5de83b45675e882f66623b7d8cb4f643017018d" dependencies = [ "anstream", "anstyle", @@ -1001,9 +1106,15 @@ dependencies = [ [[package]] name = "fastrand" -version = "2.1.0" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "486f806e73c5707928240ddc295403b1b93c96a02038563881c4a2fd84b81ac4" + +[[package]] +name = "fiat-crypto" +version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fc0510504f03c51ada170672ac806f1f105a88aa97a5281117e1ddc3368e51a" +checksum = "28dea519a9695b9977216879a3ebfddf92f1c08c05d984f8996aecd6ecdc811d" [[package]] name = "first-contract" @@ -1024,9 +1135,9 @@ dependencies = [ [[package]] name = "flate2" -version = "1.0.30" +version = "1.0.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f54427cfd1c7829e2a139fcefea601bf088ebca651d2bf53ebc600eac295dae" +checksum = "c936bfdafb507ebbf50b8074c54fa31c5be9a1e7e5f467dd659697041407d07c" dependencies = [ "crc32fast", "miniz_oxide", @@ -1163,9 +1274,9 @@ dependencies = [ [[package]] name = "futures" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "645c6916888f6cb6350d2550b80fb63e734897a8498abe35cfb732b6487804b0" +checksum = "65bc07b1a8bc7c85c5f2e110c476c7389b4554ba72af57d8445ea63a576b0876" dependencies = [ "futures-channel", "futures-core", @@ -1178,9 +1289,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78" +checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10" dependencies = [ "futures-core", "futures-sink", @@ -1188,15 +1299,15 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" +checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" [[package]] name = "futures-executor" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a576fc72ae164fca6b9db127eaa9a9dda0d61316034f33a0a0d4eda41f02b01d" +checksum = "1e28d1d997f585e54aebc3f97d39e72338912123a67330d723fdbb564d646c9f" dependencies = [ "futures-core", "futures-task", @@ -1205,38 +1316,38 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1" +checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6" [[package]] name = "futures-macro" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" +checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.77", ] [[package]] name = "futures-sink" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fb8e00e87438d937621c1c6269e53f536c14d3fbd6a042bb24879e57d474fb5" +checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7" [[package]] name = "futures-task" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004" +checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" [[package]] name = "futures-util" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48" +checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" dependencies = [ "futures-channel", "futures-core", @@ -1260,17 +1371,6 @@ 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.15" @@ -1280,21 +1380,21 @@ dependencies = [ "cfg-if", "js-sys", "libc", - "wasi 0.11.0+wasi-snapshot-preview1", + "wasi", "wasm-bindgen", ] [[package]] name = "gimli" -version = "0.29.0" +version = "0.31.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40ecd4077b5ae9fd2e9e169b102c6c330d0605168eb0e8bf79952b256dbefffd" +checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f" [[package]] name = "globset" -version = "0.4.14" +version = "0.4.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57da3b9b5b85bd66f31093f8c408b90a74431672542466497dcbdfdc02034be1" +checksum = "15f1ce686646e7f1e19bf7d5533fe443a45dbfb990e00629110797578b42fb19" dependencies = [ "aho-corasick", "bstr", @@ -1304,124 +1404,356 @@ dependencies = [ ] [[package]] -name = "h2" -version = "0.4.5" +name = "gloo" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa82e28a107a8cc405f0839610bdc9b15f1e25ec7d696aa5cf173edbcb1486ab" +checksum = "28999cda5ef6916ffd33fb4a7b87e1de633c47c0dc6d97905fee1cdaa142b94d" dependencies = [ - "atomic-waker", - "bytes", - "fnv", - "futures-core", - "futures-sink", - "http", - "indexmap", - "slab", - "tokio", - "tokio-util", - "tracing", + "gloo-console", + "gloo-dialogs", + "gloo-events", + "gloo-file", + "gloo-history", + "gloo-net 0.3.1", + "gloo-render", + "gloo-storage", + "gloo-timers", + "gloo-utils 0.1.7", + "gloo-worker", ] [[package]] -name = "hashbrown" -version = "0.14.5" +name = "gloo-console" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" +checksum = "82b7ce3c05debe147233596904981848862b068862e9ec3e34be446077190d3f" dependencies = [ - "ahash", + "gloo-utils 0.1.7", + "js-sys", "serde", + "wasm-bindgen", + "web-sys", ] [[package]] -name = "heck" -version = "0.5.0" +name = "gloo-dialogs" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" +checksum = "67062364ac72d27f08445a46cab428188e2e224ec9e37efdba48ae8c289002e6" +dependencies = [ + "wasm-bindgen", + "web-sys", +] [[package]] -name = "hermit-abi" -version = "0.3.9" +name = "gloo-events" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" +checksum = "68b107f8abed8105e4182de63845afcc7b69c098b7852a813ea7462a320992fc" +dependencies = [ + "wasm-bindgen", + "web-sys", +] [[package]] -name = "hex" -version = "0.4.3" +name = "gloo-file" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" +checksum = "a8d5564e570a38b43d78bdc063374a0c3098c4f0d64005b12f9bbe87e869b6d7" +dependencies = [ + "futures-channel", + "gloo-events", + "js-sys", + "wasm-bindgen", + "web-sys", +] [[package]] -name = "hex-literal" -version = "0.4.1" +name = "gloo-history" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" +checksum = "85725d90bf0ed47063b3930ef28e863658a7905989e9929a8708aab74a1d5e7f" +dependencies = [ + "gloo-events", + "gloo-utils 0.1.7", + "serde", + "serde-wasm-bindgen", + "serde_urlencoded", + "thiserror", + "wasm-bindgen", + "web-sys", +] [[package]] -name = "hmac" -version = "0.12.1" +name = "gloo-net" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" +checksum = "a66b4e3c7d9ed8d315fd6b97c8b1f74a7c6ecbbc2320e65ae7ed38b7068cc620" dependencies = [ - "digest 0.10.7", + "futures-channel", + "futures-core", + "futures-sink", + "gloo-utils 0.1.7", + "http 0.2.12", + "js-sys", + "pin-project", + "serde", + "serde_json", + "thiserror", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", ] [[package]] -name = "http" -version = "1.1.0" +name = "gloo-net" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21b9ddb458710bc376481b842f5da65cdf31522de232c1ca8146abce2a358258" +checksum = "c06f627b1a58ca3d42b45d6104bf1e1a03799df472df00988b6ba21accc10580" dependencies = [ - "bytes", - "fnv", - "itoa", + "futures-channel", + "futures-core", + "futures-sink", + "gloo-utils 0.2.0", + "http 1.1.0", + "js-sys", + "pin-project", + "serde", + "serde_json", + "thiserror", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", ] [[package]] -name = "http-body" -version = "1.0.1" +name = "gloo-render" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1efedce1fb8e6913f23e0c92de8e62cd5b772a67e7b3946df930a62566c93184" +checksum = "2fd9306aef67cfd4449823aadcd14e3958e0800aa2183955a309112a84ec7764" dependencies = [ - "bytes", - "http", + "wasm-bindgen", + "web-sys", ] [[package]] -name = "http-body-util" -version = "0.1.2" +name = "gloo-storage" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "793429d76616a256bcb62c2a2ec2bed781c8307e797e2598c50010f2bee2544f" +checksum = "5d6ab60bf5dbfd6f0ed1f7843da31b41010515c745735c970e821945ca91e480" dependencies = [ - "bytes", - "futures-util", - "http", - "http-body", - "pin-project-lite", + "gloo-utils 0.1.7", + "js-sys", + "serde", + "serde_json", + "thiserror", + "wasm-bindgen", + "web-sys", ] [[package]] -name = "httparse" -version = "1.9.4" +name = "gloo-timers" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fcc0b4a115bf80b728eb8ea024ad5bd707b615bfed49e0665b6e0f86fd082d9" +checksum = "9b995a66bb87bebce9a0f4a95aed01daca4872c050bfcb21653361c03bc35e5c" +dependencies = [ + "futures-channel", + "futures-core", + "js-sys", + "wasm-bindgen", +] [[package]] -name = "humantime" +name = "gloo-utils" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "037fcb07216cb3a30f7292bd0176b050b7b9a052ba830ef7d5d65f6dc64ba58e" +dependencies = [ + "js-sys", + "serde", + "serde_json", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "gloo-utils" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b5555354113b18c547c1d3a98fbf7fb32a9ff4f6fa112ce823a21641a0ba3aa" +dependencies = [ + "js-sys", + "serde", + "serde_json", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "gloo-worker" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13471584da78061a28306d1359dd0178d8d6fc1c7c80e5e35d27260346e0516a" +dependencies = [ + "anymap2", + "bincode", + "gloo-console", + "gloo-utils 0.1.7", + "js-sys", + "serde", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", +] + +[[package]] +name = "h2" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "524e8ac6999421f49a846c2d4411f337e53497d8ec55d67753beffa43c5d9205" +dependencies = [ + "atomic-waker", + "bytes", + "fnv", + "futures-core", + "futures-sink", + "http 1.1.0", + "indexmap 2.6.0", + "slab", + "tokio", + "tokio-util", + "tracing", +] + +[[package]] +name = "hashbrown" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" + +[[package]] +name = "hashbrown" +version = "0.14.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" +dependencies = [ + "ahash", + "serde", +] + +[[package]] +name = "hashbrown" +version = "0.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a9bfc1af68b1726ea47d3d5109de126281def866b33970e10fbab11b5dafab3" + +[[package]] +name = "heck" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + +[[package]] +name = "hermit-abi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" + +[[package]] +name = "hex" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" + +[[package]] +name = "hex-conservative" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "212ab92002354b4819390025006c897e8140934349e8635c9b077f47b4dcbd20" + +[[package]] +name = "hex-literal" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" + +[[package]] +name = "hmac" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" +dependencies = [ + "digest", +] + +[[package]] +name = "http" +version = "0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "601cbb57e577e2f5ef5be8e7b83f0f63994f25aa94d673e54a92d5c516d101f1" +dependencies = [ + "bytes", + "fnv", + "itoa", +] + +[[package]] +name = "http" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21b9ddb458710bc376481b842f5da65cdf31522de232c1ca8146abce2a358258" +dependencies = [ + "bytes", + "fnv", + "itoa", +] + +[[package]] +name = "http-body" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1efedce1fb8e6913f23e0c92de8e62cd5b772a67e7b3946df930a62566c93184" +dependencies = [ + "bytes", + "http 1.1.0", +] + +[[package]] +name = "http-body-util" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "793429d76616a256bcb62c2a2ec2bed781c8307e797e2598c50010f2bee2544f" +dependencies = [ + "bytes", + "futures-util", + "http 1.1.0", + "http-body", + "pin-project-lite", +] + +[[package]] +name = "httparse" +version = "1.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d71d3574edd2771538b901e6549113b4006ece66150fb69c0fb6d9a2adae946" + +[[package]] +name = "humantime" version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" [[package]] name = "hyper" -version = "1.4.1" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50dfd22e0e76d0f662d429a5f80fcaf3855009297eab6a0a9f8543834744ba05" +checksum = "bbbff0a806a4728c99295b254c8838933b5b082d75e3cb70c8dab21fdfbcfa9a" dependencies = [ "bytes", "futures-channel", "futures-util", "h2", - "http", + "http 1.1.0", "http-body", "httparse", "itoa", @@ -1433,12 +1765,12 @@ dependencies = [ [[package]] name = "hyper-rustls" -version = "0.27.2" +version = "0.27.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ee4be2c948921a1a5320b629c4193916ed787a7f7f293fd3f7f5a6c9de74155" +checksum = "08afdbb5c31130e3034af566421053ab03787c640246a446327f550d11bcb333" dependencies = [ "futures-util", - "http", + "http 1.1.0", "hyper", "hyper-util", "rustls", @@ -1446,6 +1778,7 @@ dependencies = [ "tokio", "tokio-rustls", "tower-service", + "webpki-roots", ] [[package]] @@ -1466,39 +1799,167 @@ dependencies = [ [[package]] name = "hyper-util" -version = "0.1.6" +version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ab92f4f49ee4fb4f997c784b7a2e0fa70050211e0b6a287f898c3c9785ca956" +checksum = "df2dcfbe0677734ab2f3ffa7fa7bfd4706bfdc1ef393f2ee30184aed67e631b4" dependencies = [ "bytes", "futures-channel", "futures-util", - "http", + "http 1.1.0", "http-body", "hyper", "pin-project-lite", "socket2", "tokio", - "tower", "tower-service", "tracing", ] +[[package]] +name = "icu_collections" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db2fa452206ebee18c4b5c2274dbf1de17008e874b4dc4f0aea9d01ca79e4526" +dependencies = [ + "displaydoc", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_locid" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13acbb8371917fc971be86fc8057c41a64b521c184808a698c02acc242dbf637" +dependencies = [ + "displaydoc", + "litemap", + "tinystr", + "writeable", + "zerovec", +] + +[[package]] +name = "icu_locid_transform" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "01d11ac35de8e40fdeda00d9e1e9d92525f3f9d887cdd7aa81d727596788b54e" +dependencies = [ + "displaydoc", + "icu_locid", + "icu_locid_transform_data", + "icu_provider", + "tinystr", + "zerovec", +] + +[[package]] +name = "icu_locid_transform_data" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fdc8ff3388f852bede6b579ad4e978ab004f139284d7b28715f773507b946f6e" + +[[package]] +name = "icu_normalizer" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19ce3e0da2ec68599d193c93d088142efd7f9c5d6fc9b803774855747dc6a84f" +dependencies = [ + "displaydoc", + "icu_collections", + "icu_normalizer_data", + "icu_properties", + "icu_provider", + "smallvec", + "utf16_iter", + "utf8_iter", + "write16", + "zerovec", +] + +[[package]] +name = "icu_normalizer_data" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8cafbf7aa791e9b22bec55a167906f9e1215fd475cd22adfcf660e03e989516" + +[[package]] +name = "icu_properties" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93d6020766cfc6302c15dbbc9c8778c37e62c14427cb7f6e601d849e092aeef5" +dependencies = [ + "displaydoc", + "icu_collections", + "icu_locid_transform", + "icu_properties_data", + "icu_provider", + "tinystr", + "zerovec", +] + +[[package]] +name = "icu_properties_data" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67a8effbc3dd3e4ba1afa8ad918d5684b8868b3b26500753effea8d2eed19569" + +[[package]] +name = "icu_provider" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ed421c8a8ef78d3e2dbc98a973be2f3770cb42b606e3ab18d6237c4dfde68d9" +dependencies = [ + "displaydoc", + "icu_locid", + "icu_provider_macros", + "stable_deref_trait", + "tinystr", + "writeable", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_provider_macros" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ec89e9337638ecdc08744df490b221a7399bf8d164eb52a665454e60e075ad6" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.77", +] + [[package]] name = "idna" -version = "0.5.0" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6" +checksum = "686f825264d630750a544639377bae737628043f20d38bbc029e8f29ea968a7e" dependencies = [ - "unicode-bidi", - "unicode-normalization", + "idna_adapter", + "smallvec", + "utf8_iter", +] + +[[package]] +name = "idna_adapter" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "daca1df1c957320b2cf139ac61e7bd64fed304c5040df000a745aa1de3b4ef71" +dependencies = [ + "icu_normalizer", + "icu_properties", ] [[package]] name = "ignore" -version = "0.4.22" +version = "0.4.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b46810df39e66e925525d6e38ce1e7f6e1d208f72dc39757880fcb66e2c58af1" +checksum = "6d89fd380afde86567dfba715db065673989d6253f42b88179abd3eae47bda4b" dependencies = [ "crossbeam-deque", "globset", @@ -1510,17 +1971,45 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "implicit-clone" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfd6201e7c30ccb24773cac7efa6fec1e06189d414b7439ce756a481c8bfbf53" +dependencies = [ + "indexmap 1.9.3", +] + [[package]] name = "indexmap" -version = "2.2.6" +version = "1.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" +dependencies = [ + "autocfg", + "hashbrown 0.12.3", +] + +[[package]] +name = "indexmap" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26" +checksum = "707907fe3c25f5424cce2cb7e1cbcafee6bdbe735ca90ef77c29e84591e5b9da" dependencies = [ "equivalent", - "hashbrown", + "hashbrown 0.15.1", "serde", ] +[[package]] +name = "inout" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0c10553d664a4d0bcff9f4215d0aac67a639cc68ef660840afe309b807bc9f5" +dependencies = [ + "generic-array", +] + [[package]] name = "interact" version = "0.0.0" @@ -1529,20 +2018,21 @@ dependencies = [ "multiversx-sc", "multiversx-sc-snippets", "serde", + "tokio", "toml", ] [[package]] name = "ipnet" -version = "2.9.0" +version = "2.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f518f335dce6725a761382244631d86cf0ccb2863413590b31338feb467f9c3" +checksum = "ddc24109865250148c2e0f3d25d4f0f479571723792d3802153c60922a4fb708" [[package]] name = "is_terminal_polyfill" -version = "1.70.0" +version = "1.70.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8478577c03552c21db0e2724ffb8986a5ce7af88107e6be5d2ee6e158c12800" +checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf" [[package]] name = "itertools" @@ -1561,9 +2051,9 @@ checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" [[package]] name = "js-sys" -version = "0.3.69" +version = "0.3.72" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29c15563dc2726973df627357ce0c9ddddbea194836909d655df6a75d2cf296d" +checksum = "6a88f1bda2bd75b0452a14784937d796722fdebfe50df998aeb3f0b7603019a9" dependencies = [ "wasm-bindgen", ] @@ -1662,11 +2152,17 @@ version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" +[[package]] +name = "leb128" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "884e2677b40cc8c339eaefcb701c32ef1fd2493d71118dc0ca4b6a736c93bd67" + [[package]] name = "libc" -version = "0.2.155" +version = "0.2.162" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" +checksum = "18d287de67fe55fd7e1581fe933d965a5a9477b38e949cfa9f8574ef01506398" [[package]] name = "linked-list-repeat" @@ -1691,6 +2187,12 @@ version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" +[[package]] +name = "litemap" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "643cb0b8d4fcc284004d5fd0d67ccf61dfffadb7f75e1e71bc420f4688a3a704" + [[package]] name = "local-esdt-and-nft" version = "0.0.0" @@ -1810,22 +2312,23 @@ checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" [[package]] name = "miniz_oxide" -version = "0.7.4" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8a240ddb74feaf34a79a7add65a741f3167852fba007066dcac1ca548d89c08" +checksum = "e2d80299ef12ff69b16a84bb182e3b9df68b5a91574d3d4fa6e41b65deec4df1" dependencies = [ - "adler", + "adler2", ] [[package]] name = "mio" -version = "0.8.11" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4a650543ca06a924e8b371db273b2756685faae30f8487da1b56505a8f78b0c" +checksum = "80e04d1dcff3aae0704555fe5fee3bcfaf3d1fdf8a7e521d5b9d2b42acb52cec" dependencies = [ + "hermit-abi", "libc", - "wasi 0.11.0+wasi-snapshot-preview1", - "windows-sys 0.48.0", + "wasi", + "windows-sys 0.52.0", ] [[package]] @@ -1870,6 +2373,7 @@ dependencies = [ "multiversx-sc-scenario", "multiversx-sc-snippets", "serde", + "tokio", "toml", ] @@ -1881,9 +2385,17 @@ dependencies = [ "multiversx-sc-meta-lib", ] +[[package]] +name = "multiversx-chain-core" +version = "0.11.0" +dependencies = [ + "bitflags", + "multiversx-sc-codec", +] + [[package]] name = "multiversx-chain-scenario-format" -version = "0.22.3" +version = "0.23.0" dependencies = [ "bech32", "hex", @@ -1896,38 +2408,39 @@ dependencies = [ [[package]] name = "multiversx-chain-vm" -version = "0.9.0" +version = "0.11.0" dependencies = [ - "bitflags 2.6.0", + "bitflags", "colored", "ed25519-dalek", "hex", "hex-literal", "itertools", + "multiversx-chain-core", "multiversx-chain-vm-executor", "num-bigint", "num-traits", - "rand 0.8.5", + "rand", "rand_seeder", - "sha2 0.10.8", + "sha2", "sha3", ] [[package]] name = "multiversx-chain-vm-executor" version = "0.2.0" -source = "git+https://github.com/multiversx/mx-vm-executor-rs?branch=rc/v1.7.next1#95acf80fb611fb51a8b7e20f5e7086e4aae68539" +source = "git+https://github.com/multiversx/mx-vm-executor-rs?branch=rc/v1.7.next1#009e15459c023ec3b94fcebd826b381f7706229c" [[package]] name = "multiversx-price-aggregator-sc" -version = "0.51.1" +version = "0.54.1" dependencies = [ "arrayvec", - "getrandom 0.2.15", + "getrandom", "multiversx-sc", "multiversx-sc-modules", "multiversx-sc-scenario", - "rand 0.8.5", + "rand", ] [[package]] @@ -1941,10 +2454,11 @@ dependencies = [ [[package]] name = "multiversx-sc" -version = "0.51.1" +version = "0.54.1" dependencies = [ - "bitflags 2.6.0", + "bitflags", "hex-literal", + "multiversx-chain-core", "multiversx-sc-codec", "multiversx-sc-derive", "num-traits", @@ -1953,7 +2467,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.20.0" +version = "0.21.0" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -1963,29 +2477,30 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.20.0" +version = "0.21.0" dependencies = [ "hex", "proc-macro2", "quote", - "syn", + "syn 2.0.77", ] [[package]] name = "multiversx-sc-derive" -version = "0.51.1" +version = "0.54.1" dependencies = [ "hex", "proc-macro2", "quote", "radix_trie", - "syn", + "syn 2.0.77", ] [[package]] name = "multiversx-sc-meta" -version = "0.51.1" +version = "0.54.1" dependencies = [ + "bip39", "clap", "colored", "common-path", @@ -2007,7 +2522,7 @@ dependencies = [ [[package]] name = "multiversx-sc-meta-lib" -version = "0.51.1" +version = "0.54.1" dependencies = [ "clap", "colored", @@ -2020,20 +2535,21 @@ dependencies = [ "serde", "serde_json", "toml", - "wasmparser", + "wasmparser 0.216.0", "wasmprinter", + "wat", ] [[package]] name = "multiversx-sc-modules" -version = "0.51.1" +version = "0.54.1" dependencies = [ "multiversx-sc", ] [[package]] name = "multiversx-sc-scenario" -version = "0.51.1" +version = "0.54.1" dependencies = [ "base64", "bech32", @@ -2051,14 +2567,15 @@ dependencies = [ "pathdiff", "serde", "serde_json", - "sha2 0.10.8", + "sha2", "unwrap-infallible", ] [[package]] name = "multiversx-sc-snippets" -version = "0.51.1" +version = "0.54.1" dependencies = [ + "anyhow", "base64", "env_logger", "futures", @@ -2067,45 +2584,80 @@ dependencies = [ "multiversx-chain-scenario-format", "multiversx-sc-scenario", "multiversx-sdk", + "multiversx-sdk-dapp", + "multiversx-sdk-http", "serde_json", "tokio", ] [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.51.1" +version = "0.54.1" dependencies = [ "multiversx-sc", ] [[package]] name = "multiversx-sdk" -version = "0.5.0" +version = "0.7.0" dependencies = [ + "aes", "anyhow", "base64", "bech32", "bip39", + "ctr", "hex", "hmac", "itertools", "log", + "multiversx-chain-core", "pbkdf2", "pem", - "rand 0.8.5", - "reqwest", + "rand", + "scrypt", "serde", "serde_json", "serde_repr", - "sha2 0.10.8", + "sha2", "sha3", - "tokio", + "uuid", "zeroize", ] +[[package]] +name = "multiversx-sdk-dapp" +version = "0.7.0" +dependencies = [ + "anyhow", + "getrandom", + "gloo-net 0.6.0", + "hex", + "itertools", + "js-sys", + "log", + "multiversx-sdk", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", +] + +[[package]] +name = "multiversx-sdk-http" +version = "0.7.0" +dependencies = [ + "anyhow", + "hex", + "itertools", + "log", + "multiversx-sdk", + "reqwest", + "tokio", +] + [[package]] name = "multiversx-wegld-swap-sc" -version = "0.51.1" +version = "0.54.1" dependencies = [ "multiversx-sc", "multiversx-sc-modules", @@ -2247,32 +2799,26 @@ dependencies = [ [[package]] name = "object" -version = "0.36.1" +version = "0.36.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "081b846d1d56ddfc18fdf1a922e4f6e07a11768ea1b92dec44e42b72712ccfce" +checksum = "aedf0a2d09c573ed1d8d85b30c119153926a2b36dce0ab28322c09a117a4683e" dependencies = [ "memchr", ] [[package]] name = "once_cell" -version = "1.19.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" - -[[package]] -name = "opaque-debug" -version = "0.3.1" +version = "1.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381" +checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" [[package]] name = "openssl" -version = "0.10.64" +version = "0.10.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95a0481286a310808298130d22dd1fef0fa571e05a8f44ec801801e84b216b1f" +checksum = "6174bc48f102d208783c2c84bf931bb75927a617866870de8a4ea85597f871f5" dependencies = [ - "bitflags 2.6.0", + "bitflags", "cfg-if", "foreign-types", "libc", @@ -2289,7 +2835,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.77", ] [[package]] @@ -2300,9 +2846,9 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" [[package]] name = "openssl-sys" -version = "0.9.102" +version = "0.9.104" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c597637d56fbc83893a35eb0dd04b2b8e7a50c91e64e9493e398b5df4fb45fa2" +checksum = "45abf306cbf99debc8195b66b7346498d7b10c210de50418b5ccd7ceba08c741" dependencies = [ "cc", "libc", @@ -2390,11 +2936,22 @@ dependencies = [ "windows-targets 0.52.6", ] +[[package]] +name = "password-hash" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "346f04948ba92c43e8469c1ee6736c7563d71012b17d40745260fe106aac2166" +dependencies = [ + "base64ct", + "rand_core", + "subtle", +] + [[package]] name = "pathdiff" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8835116a5c179084a830efb3adc117ab007512b535bc1a21c991d3b32a6b44dd" +checksum = "d61c5ce1153ab5b689d0c074c4e7fc613e942dfb7dd9eea5ab202d2ad91fe361" [[package]] name = "payable-features" @@ -2422,7 +2979,8 @@ version = "0.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f8ed6a7761f76e3b9f92dfb0a60a6a6477c61024b775147ff0973a02653abaf2" dependencies = [ - "digest 0.10.7", + "digest", + "hmac", ] [[package]] @@ -2443,29 +3001,29 @@ checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" [[package]] name = "pin-project" -version = "1.1.5" +version = "1.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6bf43b791c5b9e34c3d182969b4abb522f9343702850a2e57f460d00d09b4b3" +checksum = "be57f64e946e500c8ee36ef6331845d40a93055567ec57e8fae13efd33759b95" dependencies = [ "pin-project-internal", ] [[package]] name = "pin-project-internal" -version = "1.1.5" +version = "1.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" +checksum = "3c0f5fad0874fc7abcd4d750e76917eaebbecaa2c20bde22e1dbeeba8beb758c" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.77", ] [[package]] name = "pin-project-lite" -version = "0.2.14" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02" +checksum = "915a1e146535de9163f3987b8944ed8cf49a18bb0056bcebcdcece385cece4ff" [[package]] name = "pin-utils" @@ -2473,6 +3031,21 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" +[[package]] +name = "ping-pong-dapp" +version = "0.1.0" +dependencies = [ + "console_log", + "log", + "multiversx-sc-snippets", + "serde", + "serde_json", + "wasm-bindgen-futures", + "yew", + "yew-router", + "yew_icons", +] + [[package]] name = "ping-pong-egld" version = "0.0.2" @@ -2481,6 +3054,18 @@ dependencies = [ "multiversx-sc-scenario", ] +[[package]] +name = "ping-pong-egld-interact" +version = "0.0.0" +dependencies = [ + "clap", + "multiversx-sc-snippets", + "ping-pong-egld", + "serde", + "tokio", + "toml", +] + [[package]] name = "ping-pong-egld-meta" version = "0.0.0" @@ -2489,17 +3074,75 @@ dependencies = [ "ping-pong-egld", ] +[[package]] +name = "pinned" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a829027bd95e54cfe13e3e258a1ae7b645960553fb82b75ff852c29688ee595b" +dependencies = [ + "futures", + "rustversion", + "thiserror", +] + +[[package]] +name = "pkcs8" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7" +dependencies = [ + "der", + "spki", +] + [[package]] name = "pkg-config" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec" +checksum = "953ec861398dccce10c670dfeaf3ec4911ca479e9c02154b3a215178c5f566f2" [[package]] name = "ppv-lite86" -version = "0.2.17" +version = "0.2.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" +checksum = "77957b295656769bb8ad2b6a6b09d897d94f05c41b069aede1fcdaa675eaea04" +dependencies = [ + "zerocopy", +] + +[[package]] +name = "prettyplease" +version = "0.1.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c8646e95016a7a6c4adea95bafa8a16baab64b583356217f2c85db4a39d9a86" +dependencies = [ + "proc-macro2", + "syn 1.0.109", +] + +[[package]] +name = "proc-macro-error" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" +dependencies = [ + "proc-macro-error-attr", + "proc-macro2", + "quote", + "syn 1.0.109", + "version_check", +] + +[[package]] +name = "proc-macro-error-attr" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" +dependencies = [ + "proc-macro2", + "quote", + "version_check", +] [[package]] name = "proc-macro2" @@ -2510,6 +3153,23 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "prokio" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "03b55e106e5791fa5a13abd13c85d6127312e8e09098059ca2bc9b03ca4cf488" +dependencies = [ + "futures", + "gloo", + "num_cpus", + "once_cell", + "pin-project", + "pinned", + "tokio", + "tokio-stream", + "wasm-bindgen-futures", +] + [[package]] name = "promises-features" version = "0.0.0" @@ -2593,75 +3253,92 @@ dependencies = [ ] [[package]] -name = "quote" -version = "1.0.36" +name = "quinn" +version = "0.11.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" +checksum = "8c7c5fdde3cdae7203427dc4f0a68fe0ed09833edc525a03456b153b79828684" dependencies = [ - "proc-macro2", + "bytes", + "pin-project-lite", + "quinn-proto", + "quinn-udp", + "rustc-hash", + "rustls", + "socket2", + "thiserror", + "tokio", + "tracing", ] [[package]] -name = "radix_trie" -version = "0.2.1" +name = "quinn-proto" +version = "0.11.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c069c179fcdc6a2fe24d8d18305cf085fdbd4f922c041943e203685d6a1c58fd" +checksum = "fadfaed2cd7f389d0161bb73eeb07b7b78f8691047a6f3e73caaeae55310a4a6" dependencies = [ - "endian-type", - "nibble_vec", + "bytes", + "rand", + "ring", + "rustc-hash", + "rustls", + "slab", + "thiserror", + "tinyvec", + "tracing", ] [[package]] -name = "rand" -version = "0.7.3" +name = "quinn-udp" +version = "0.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" +checksum = "7d5a626c6807713b15cac82a6acaccd6043c9a5408c24baae07611fec3f243da" dependencies = [ - "getrandom 0.1.16", + "cfg_aliases", "libc", - "rand_chacha 0.2.2", - "rand_core 0.5.1", - "rand_hc", + "once_cell", + "socket2", + "tracing", + "windows-sys 0.59.0", ] [[package]] -name = "rand" -version = "0.8.5" +name = "quote" +version = "1.0.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" dependencies = [ - "libc", - "rand_chacha 0.3.1", - "rand_core 0.6.4", + "proc-macro2", ] [[package]] -name = "rand_chacha" -version = "0.2.2" +name = "radix_trie" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" +checksum = "c069c179fcdc6a2fe24d8d18305cf085fdbd4f922c041943e203685d6a1c58fd" dependencies = [ - "ppv-lite86", - "rand_core 0.5.1", + "endian-type", + "nibble_vec", ] [[package]] -name = "rand_chacha" -version = "0.3.1" +name = "rand" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" dependencies = [ - "ppv-lite86", - "rand_core 0.6.4", + "libc", + "rand_chacha", + "rand_core", ] [[package]] -name = "rand_core" -version = "0.5.1" +name = "rand_chacha" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" dependencies = [ - "getrandom 0.1.16", + "ppv-lite86", + "rand_core", ] [[package]] @@ -2670,25 +3347,16 @@ version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" dependencies = [ - "getrandom 0.2.15", -] - -[[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", + "getrandom", ] [[package]] name = "rand_seeder" -version = "0.2.3" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf2890aaef0aa82719a50e808de264f9484b74b442e1a3a0e5ee38243ac40bdb" +checksum = "4a9febe641d2842ffc76ee962668a17578767c4e01735e4802b21ed9a24b2e4e" dependencies = [ - "rand_core 0.6.4", + "rand_core", ] [[package]] @@ -2717,18 +3385,18 @@ dependencies = [ [[package]] name = "redox_syscall" -version = "0.5.3" +version = "0.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a908a6e00f1fdd0dfd9c0eb08ce85126f6d8bbda50017e74bc4a4b7d4a926a4" +checksum = "9b6dfecf2c74bce2466cabf93f6664d6998a69eb21e39f4207930065b27b771f" dependencies = [ - "bitflags 2.6.0", + "bitflags", ] [[package]] name = "regex" -version = "1.10.5" +version = "1.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b91213439dad192326a0d7c6ee3955910425f441d7038e0d6933b0aec5c4517f" +checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191" dependencies = [ "aho-corasick", "memchr", @@ -2738,9 +3406,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.7" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38caf58cc5ef2fed281f89292ef23f6365465ed9a41b7a7754eb4e26496c92df" +checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908" dependencies = [ "aho-corasick", "memchr", @@ -2749,15 +3417,15 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.8.4" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b" +checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" [[package]] name = "reqwest" -version = "0.12.5" +version = "0.12.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7d6d2a27d57148378eb5e111173f4276ad26340ecc5c49a4a2152167a2d6a37" +checksum = "a77c62af46e79de0a562e1a9849205ffcb7fc1238876e9bd743357570e04046f" dependencies = [ "base64", "bytes", @@ -2766,7 +3434,7 @@ dependencies = [ "futures-core", "futures-util", "h2", - "http", + "http 1.1.0", "http-body", "http-body-util", "hyper", @@ -2781,7 +3449,10 @@ dependencies = [ "once_cell", "percent-encoding", "pin-project-lite", + "quinn", + "rustls", "rustls-pemfile", + "rustls-pki-types", "serde", "serde_json", "serde_urlencoded", @@ -2789,12 +3460,14 @@ dependencies = [ "system-configuration", "tokio", "tokio-native-tls", + "tokio-rustls", "tower-service", "url", "wasm-bindgen", "wasm-bindgen-futures", "web-sys", - "winreg", + "webpki-roots", + "windows-registry", ] [[package]] @@ -2822,13 +3495,19 @@ checksum = "c17fa4cb658e3583423e915b9f3acc01cceaee1860e33d59ebae66adc3a2dc0d" dependencies = [ "cc", "cfg-if", - "getrandom 0.2.15", + "getrandom", "libc", "spin", "untrusted", "windows-sys 0.52.0", ] +[[package]] +name = "route-recognizer" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "afab94fb28594581f62d981211a9a4d53cc8130bbcbbb89a0440d9b8e81a7746" + [[package]] name = "ruplacer" version = "0.8.2" @@ -2888,22 +3567,28 @@ version = "0.1.24" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" +[[package]] +name = "rustc-hash" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "583034fd73374156e66797ed8e5b0d5690409c9226b22d87cb7f19821c05d152" + [[package]] name = "rustc_version" -version = "0.4.0" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" +checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" dependencies = [ "semver", ] [[package]] name = "rustix" -version = "0.38.34" +version = "0.38.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70dc5ec042f7a43c4a73241207cecc9873a06d45debb38b329f8541d85c2730f" +checksum = "99e4ea3e1cdc4b559b8e5650f9c8e5998e3e5c1343b4eaf034565f32318d63c0" dependencies = [ - "bitflags 2.6.0", + "bitflags", "errno", "libc", "linux-raw-sys", @@ -2912,11 +3597,12 @@ dependencies = [ [[package]] name = "rustls" -version = "0.23.11" +version = "0.23.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4828ea528154ae444e5a642dbb7d5623354030dc9822b83fd9bb79683c7399d0" +checksum = "eee87ff5d9b36712a58574e12e9f0ea80f915a5b0ac518d322b24a465617925e" dependencies = [ "once_cell", + "ring", "rustls-pki-types", "rustls-webpki", "subtle", @@ -2925,37 +3611,51 @@ dependencies = [ [[package]] name = "rustls-pemfile" -version = "2.1.2" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29993a25686778eb88d4189742cd713c9bce943bc54251a33509dc63cbacf73d" +checksum = "dce314e5fee3f39953d46bb63bb8a46d40c2f8fb7cc5a3b6cab2bde9721d6e50" dependencies = [ - "base64", "rustls-pki-types", ] [[package]] name = "rustls-pki-types" -version = "1.7.0" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "976295e77ce332211c0d24d92c0e83e50f5c5f046d11082cea19f3df13a3562d" +checksum = "16f1201b3c9a7ee8039bcadc17b7e605e2945b27eee7631788c1bd2b0643674b" [[package]] name = "rustls-webpki" -version = "0.102.5" +version = "0.102.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9a6fccd794a42c2c105b513a2f62bc3fd8f3ba57a4593677ceb0bd035164d78" +checksum = "64ca1bc8749bd4cf37b5ce386cc146580777b4e8572c7b97baf22c83f444bee9" dependencies = [ "ring", "rustls-pki-types", "untrusted", ] +[[package]] +name = "rustversion" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e819f2bc632f285be6d7cd36e25940d45b2391dd6d9b939e79de557f7014248" + [[package]] name = "ryu" version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" +[[package]] +name = "salsa20" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97a22f5af31f73a954c10289c93e8a50cc23d971e80ee446f1f6f7137a088213" +dependencies = [ + "cipher", +] + [[package]] name = "same-file" version = "1.0.6" @@ -2983,11 +3683,11 @@ dependencies = [ [[package]] name = "schannel" -version = "0.1.23" +version = "0.1.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbc91545643bcf3a0bbb6569265615222618bdf33ce4ffbbd13c4bbd4c093534" +checksum = "01227be5826fa0690321a2ba6c5cd57a19cf3f6a09e76973b58e61de6ab9d1c1" dependencies = [ - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -2996,6 +3696,18 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" +[[package]] +name = "scrypt" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0516a385866c09368f0b5bcd1caff3366aace790fcd46e2bb032697bb172fd1f" +dependencies = [ + "password-hash", + "pbkdf2", + "salsa20", + "sha2", +] + [[package]] name = "second-contract" version = "0.0.0" @@ -3019,7 +3731,7 @@ version = "2.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "897b2245f0b511c87893af39b033e5ca9cce68824c4d7e7630b5a1d339658d02" dependencies = [ - "bitflags 2.6.0", + "bitflags", "core-foundation", "core-foundation-sys", "libc", @@ -3028,9 +3740,9 @@ dependencies = [ [[package]] name = "security-framework-sys" -version = "2.11.1" +version = "2.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75da29fe9b9b08fe9d6b22b5b4bcbc75d8db3aa31e639aa56bb62e9d46bfceaf" +checksum = "fa39c7303dc58b5543c94d22c1766b0d31f2ee58306363ea622b10bbc075eaa2" dependencies = [ "core-foundation-sys", "libc", @@ -3077,32 +3789,44 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.204" +version = "1.0.210" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc76f558e0cbb2a839d37354c575f1dc3fdc6546b5be373ba43d95f231bf7c12" +checksum = "c8e3592472072e6e22e0a54d5904d9febf8508f65fb8552499a1abc7d1078c3a" dependencies = [ "serde_derive", ] +[[package]] +name = "serde-wasm-bindgen" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3b143e2833c57ab9ad3ea280d21fd34e285a42837aeb0ee301f4f41890fa00e" +dependencies = [ + "js-sys", + "serde", + "wasm-bindgen", +] + [[package]] name = "serde_derive" -version = "1.0.204" +version = "1.0.210" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0cd7e117be63d3c3678776753929474f3b04a43a080c744d6b0ae2a8c28e222" +checksum = "243902eda00fad750862fc144cea25caca5e20d615af0a81bee94ca738f1df1f" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.77", ] [[package]] name = "serde_json" -version = "1.0.120" +version = "1.0.132" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e0d21c9a8cae1235ad58a00c11cb40d4b1e5c784f1ef2c537876ed6ffd8b7c5" +checksum = "d726bfaff4b320266d395898905d0eba0345aae23b54aee3a737e260fd46db03" dependencies = [ - "indexmap", + "indexmap 2.6.0", "itoa", + "memchr", "ryu", "serde", ] @@ -3115,14 +3839,14 @@ checksum = "6c64451ba24fc7a6a2d60fc75dd9c83c90903b19028d4eff35e88fc1e86564e9" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.77", ] [[package]] name = "serde_spanned" -version = "0.6.6" +version = "0.6.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79e674e01f999af37c49f70a6ede167a8a60b2503e56c5599532a65baa5969a0" +checksum = "87607cb1398ed59d48732e575a4c28a7a8ebf2454b964fe3f224f2afc07909e1" dependencies = [ "serde", ] @@ -3156,19 +3880,6 @@ dependencies = [ "set-repeat", ] -[[package]] -name = "sha2" -version = "0.9.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d58a1e1bf39749807d89cf2d98ac2dfa0ff1cb3faa38fbb64dd88ac8013d800" -dependencies = [ - "block-buffer 0.9.0", - "cfg-if", - "cpufeatures", - "digest 0.9.0", - "opaque-debug", -] - [[package]] name = "sha2" version = "0.10.8" @@ -3177,7 +3888,7 @@ checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" dependencies = [ "cfg-if", "cpufeatures", - "digest 0.10.7", + "digest", ] [[package]] @@ -3186,10 +3897,16 @@ version = "0.10.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "75872d278a8f37ef87fa0ddbda7802605cb18344497949862c0d4dcb291eba60" dependencies = [ - "digest 0.10.7", + "digest", "keccak", ] +[[package]] +name = "shlex" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" + [[package]] name = "signal-hook-registry" version = "1.4.2" @@ -3201,9 +3918,12 @@ dependencies = [ [[package]] name = "signature" -version = "1.6.4" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74233d3b3b2f6d4b006dc19dee745e73e2a6bfb6f93607cd3b02bd5b00797d7c" +checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de" +dependencies = [ + "rand_core", +] [[package]] name = "simd-adler32" @@ -3259,6 +3979,22 @@ version = "0.9.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" +[[package]] +name = "spki" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d91ed6c858b01f942cd56b37a94b3e0a1798290327d1236e4d9cf4eaca44d29d" +dependencies = [ + "base64ct", + "der", +] + +[[package]] +name = "stable_deref_trait" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" + [[package]] name = "str-repeat" version = "0.0.0" @@ -3289,9 +4025,20 @@ checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" [[package]] name = "syn" -version = "2.0.68" +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.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "901fa70d88b9d6c98022e23b4136f9f3e54e4662c3bc1bd1d84a42a9a0f0c1e9" +checksum = "9f35bcdf61fd8e7be6caf75f429fdca8beb3ed76584befb503b1569faee373ed" dependencies = [ "proc-macro2", "quote", @@ -3303,38 +4050,64 @@ name = "sync_wrapper" version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a7065abeca94b6a8a577f9bd45aa0867a2238b74e8eb67cf10d492bc39351394" +dependencies = [ + "futures-core", +] + +[[package]] +name = "synstructure" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8af7666ab7b6390ab78131fb5b0fce11d6b7a6951602017c35fa82800708971" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.77", +] [[package]] name = "system-configuration" -version = "0.5.1" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba3a3adc5c275d719af8cb4272ea1c4a6d668a777f37e115f6d11ddbc1c8e0e7" +checksum = "3c879d448e9d986b661742763247d3693ed13609438cf3d006f51f5368a5ba6b" dependencies = [ - "bitflags 1.3.2", + "bitflags", "core-foundation", "system-configuration-sys", ] [[package]] name = "system-configuration-sys" -version = "0.5.0" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a75fb188eb626b924683e3b95e3a48e63551fcfb51949de2f06a9d91dbee93c9" +checksum = "8e1d1b10ced5ca923a1fcb8d03e96b8d3268065d724548c0211415ff6ac6bac4" dependencies = [ "core-foundation-sys", "libc", ] +[[package]] +name = "system-sc-interact" +version = "0.0.0" +dependencies = [ + "clap", + "multiversx-sc-snippets", + "serde", + "tokio", + "toml", +] + [[package]] name = "tempfile" -version = "3.10.1" +version = "3.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85b77fafb263dd9d05cbeac119526425676db3784113aa9295c88498cbf8bff1" +checksum = "28cce251fcbc87fac86a866eeb0d6c2d536fc16d06f184bb61aeae11aa4cee0c" dependencies = [ "cfg-if", "fastrand", + "once_cell", "rustix", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -3348,22 +4121,32 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.63" +version = "1.0.65" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0342370b38b6a11b6cc11d6a805569958d54cfa061a29969c3b5ce2ea405724" +checksum = "5d11abd9594d9b38965ef50805c5e469ca9cc6f197f883f717e0269a3057b3d5" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.63" +version = "1.0.65" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4558b58466b9ad7ca0f102865eccc95938dca1a74a856f2b57b6629050da261" +checksum = "ae71770322cbd277e69d762a16c444af02aa0575ac0d174f0b9562d3b37f8602" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.77", +] + +[[package]] +name = "tinystr" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9117f5d4db391c1cf6927e7bea3db74b9a1c1add8f7eda9ffd5364f40f57b82f" +dependencies = [ + "displaydoc", + "zerovec", ] [[package]] @@ -3399,32 +4182,31 @@ dependencies = [ [[package]] name = "tokio" -version = "1.38.1" +version = "1.41.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb2caba9f80616f438e09748d5acda951967e1ea58508ef53d9c6402485a46df" +checksum = "22cfb5bee7a6a52939ca9224d6ac897bb669134078daa8735560897f69de4d33" dependencies = [ "backtrace", "bytes", "libc", "mio", - "num_cpus", "parking_lot", "pin-project-lite", "signal-hook-registry", "socket2", "tokio-macros", - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] name = "tokio-macros" -version = "2.3.0" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f5ae998a069d4b5aba8ee9dad856af7d520c3699e6159b185c2acd48155d39a" +checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.77", ] [[package]] @@ -3448,11 +4230,22 @@ dependencies = [ "tokio", ] +[[package]] +name = "tokio-stream" +version = "0.1.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4f4e6ce100d0eb49a2734f8c0812bcd324cf357d21810932c5df6b96ef2b86f1" +dependencies = [ + "futures-core", + "pin-project-lite", + "tokio", +] + [[package]] name = "tokio-util" -version = "0.7.11" +version = "0.7.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9cf6b47b3771c49ac75ad09a6162f53ad4b8088b76ac60e8ec1455b31a189fe1" +checksum = "61e7c3654c13bcd040d4a03abee2c75b1d14a37b423cf5a813ceae1cc903ec6a" dependencies = [ "bytes", "futures-core", @@ -3463,11 +4256,11 @@ dependencies = [ [[package]] name = "toml" -version = "0.8.15" +version = "0.8.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac2caab0bf757388c6c0ae23b3293fdb463fee59434529014f85e3263b995c28" +checksum = "a1ed1f98e3fdc28d6d910e6737ae6ab1a93bf1985935a1193e68f93eeb68d24e" dependencies = [ - "indexmap", + "indexmap 2.6.0", "serde", "serde_spanned", "toml_datetime", @@ -3476,52 +4269,31 @@ dependencies = [ [[package]] name = "toml_datetime" -version = "0.6.6" +version = "0.6.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4badfd56924ae69bcc9039335b2e017639ce3f9b001c393c1b2d1ef846ce2cbf" +checksum = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41" dependencies = [ "serde", ] [[package]] name = "toml_edit" -version = "0.22.16" +version = "0.22.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "278f3d518e152219c994ce877758516bca5e118eaed6996192a774fb9fbf0788" +checksum = "4ae48d6208a266e853d946088ed816055e556cc6028c5e8e2b84d9fa5dd7c7f5" dependencies = [ - "indexmap", + "indexmap 2.6.0", "serde", "serde_spanned", "toml_datetime", "winnow", ] -[[package]] -name = "tower" -version = "0.4.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8fa9be0de6cf49e536ce1851f987bd21a43b771b09473c3549a6c853db37c1c" -dependencies = [ - "futures-core", - "futures-util", - "pin-project", - "pin-project-lite", - "tokio", - "tower-layer", - "tower-service", -] - -[[package]] -name = "tower-layer" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c20c8dbed6283a09604c3e69b4b7eeb54e298b8a600d4d5ecb5ad39de609f1d0" - [[package]] name = "tower-service" -version = "0.3.2" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" +checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" [[package]] name = "tracing" @@ -3530,9 +4302,21 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" dependencies = [ "pin-project-lite", + "tracing-attributes", "tracing-core", ] +[[package]] +name = "tracing-attributes" +version = "0.1.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.77", +] + [[package]] name = "tracing-core" version = "0.1.32" @@ -3572,17 +4356,11 @@ version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" -[[package]] -name = "unicode-bidi" -version = "0.3.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08f95100a766bf4f8f28f90d77e0a5461bbdb219042e7679bebe79004fed8d75" - [[package]] name = "unicode-ident" -version = "1.0.12" +version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" +checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" [[package]] name = "unicode-normalization" @@ -3595,9 +4373,15 @@ dependencies = [ [[package]] name = "unicode-segmentation" -version = "1.11.0" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6ccf251212114b54433ec949fd6a7841275f9ada20dddd2f29e9ceea4501493" + +[[package]] +name = "unicode-width" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4c87d22b6e3f4a18d4d40ef354e97c90fcb14dd91d7dc0aa9d8a1172ebf7202" +checksum = "1fc81956842c57dac11422a97c3b8195a1ff727f06e85c84ed2e8aa277c9a0fd" [[package]] name = "untrusted" @@ -3613,9 +4397,9 @@ checksum = "151ac09978d3c2862c4e39b557f4eceee2cc72150bc4cb4f16abf061b6e381fb" [[package]] name = "url" -version = "2.5.2" +version = "2.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22784dbdf76fdde8af1aeda5622b546b422b6fc585325248a2bf9f5e41e94d6c" +checksum = "8d157f1b96d14500ffdc1f10ba712e780825526c03d9a49b4d0324b0d9113ada" dependencies = [ "form_urlencoded", "idna", @@ -3640,12 +4424,33 @@ dependencies = [ "use-module", ] +[[package]] +name = "utf16_iter" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8232dd3cdaed5356e0f716d285e4b40b932ac434100fe9b7e0e8e935b9e6246" + +[[package]] +name = "utf8_iter" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" + [[package]] name = "utf8parse" version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" +[[package]] +name = "uuid" +version = "1.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8c5f0a0af699448548ad1a2fbf920fb4bee257eae39953ba95cb84891a0446a" +dependencies = [ + "getrandom", +] + [[package]] name = "vault" version = "0.0.0" @@ -3687,9 +4492,9 @@ dependencies = [ [[package]] name = "version_check" -version = "0.9.4" +version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" [[package]] name = "walkdir" @@ -3710,12 +4515,6 @@ 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" @@ -3724,34 +4523,35 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.92" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4be2531df63900aeb2bca0daaaddec08491ee64ceecbee5076636a3b026795a8" +checksum = "128d1e363af62632b8eb57219c8fd7877144af57558fb2ef0368d0087bddeb2e" dependencies = [ "cfg-if", + "once_cell", "wasm-bindgen-macro", ] [[package]] name = "wasm-bindgen-backend" -version = "0.2.92" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "614d787b966d3989fa7bb98a654e369c762374fd3213d212cfc0251257e747da" +checksum = "cb6dd4d3ca0ddffd1dd1c9c04f94b868c37ff5fac97c30b97cff2d74fce3a358" dependencies = [ "bumpalo", "log", "once_cell", "proc-macro2", "quote", - "syn", + "syn 2.0.77", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-futures" -version = "0.4.42" +version = "0.4.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76bc14366121efc8dbb487ab05bcc9d346b3b5ec0eaa76e46594cabbe51762c0" +checksum = "cc7ec4f8827a71586374db3e87abdb5a2bb3a15afed140221307c3ec06b1f63b" dependencies = [ "cfg-if", "js-sys", @@ -3761,9 +4561,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.92" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1f8823de937b71b9460c0c34e25f3da88250760bec0ebac694b49997550d726" +checksum = "e79384be7f8f5a9dd5d7167216f022090cf1f9ec128e6e6a482a2cb5c5422c56" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -3771,65 +4571,146 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.92" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" +checksum = "26c6ab57572f7a24a4985830b120de1594465e5d500f24afe89e16b4e833ef68" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.77", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.92" +version = "0.2.95" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65fc09f10666a9f147042251e0dda9c18f166ff7de300607007e96bdebc1068d" + +[[package]] +name = "wasm-encoder" +version = "0.220.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af190c94f2773fdb3729c55b007a722abb5384da03bc0986df4c289bf5567e96" +checksum = "ebf48234b389415b226a4daef6562933d38c7b28a8b8f64c5c4130dad1561ab7" +dependencies = [ + "leb128", + "wasmparser 0.220.0", +] [[package]] name = "wasmparser" -version = "0.212.0" +version = "0.216.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d28bc49ba1e5c5b61ffa7a2eace10820443c4b7d1c0b144109261d14570fdf8" +checksum = "bcdee6bea3619d311fb4b299721e89a986c3470f804b6d534340e412589028e3" dependencies = [ "ahash", - "bitflags 2.6.0", - "hashbrown", - "indexmap", + "bitflags", + "hashbrown 0.14.5", + "indexmap 2.6.0", "semver", "serde", ] +[[package]] +name = "wasmparser" +version = "0.220.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e246c2772ce3ebc83f89a2d4487ac5794cad6c309b2071818a88c7db7c36d87b" +dependencies = [ + "bitflags", + "indexmap 2.6.0", +] + [[package]] name = "wasmprinter" -version = "0.212.0" +version = "0.216.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfac65326cc561112af88c3028f6dfdb140acff67ede33a8e86be2dc6b8956f7" +checksum = "8f82916f3892e53620639217d6ec78fe15c678352a3fbf3f3745b6417d0bd70f" dependencies = [ "anyhow", "termcolor", - "wasmparser", + "wasmparser 0.216.0", +] + +[[package]] +name = "wast" +version = "220.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e708c8de08751fd66e70961a32bae9d71901f14a70871e181cb8461a3bb3165" +dependencies = [ + "bumpalo", + "leb128", + "memchr", + "unicode-width", + "wasm-encoder", +] + +[[package]] +name = "wat" +version = "1.220.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de4f1d7d59614ba690541360102b995c4eb1b9ed373701d5102cc1a968b1c5a3" +dependencies = [ + "wast", ] [[package]] name = "web-sys" -version = "0.3.69" +version = "0.3.72" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77afa9a11836342370f4817622a2f0f418b134426d91a82dfb48f532d2ec13ef" +checksum = "f6488b90108c040df0fe62fa815cbdee25124641df01814dd7282749234c6112" dependencies = [ "js-sys", "wasm-bindgen", ] +[[package]] +name = "webpki-roots" +version = "0.26.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "841c67bff177718f1d4dfefde8d8f0e78f9b6589319ba88312f567fc5841a958" +dependencies = [ + "rustls-pki-types", +] + [[package]] name = "winapi-util" -version = "0.1.8" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d4cc384e1e73b93bafa6fb4f1df8c41695c8a91cf9c4c64358067d15a7b6c6b" +checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" dependencies = [ - "windows-sys 0.52.0", + "windows-sys 0.59.0", +] + +[[package]] +name = "windows-registry" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e400001bb720a623c1c69032f8e3e4cf09984deec740f007dd2b03ec864804b0" +dependencies = [ + "windows-result", + "windows-strings", + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-result" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d1043d8214f791817bab27572aaa8af63732e11bf84aa21a45a78d6c317ae0e" +dependencies = [ + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-strings" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4cd9b125c486025df0eabcb585e62173c6c9eddcec5d117d3b6e8c30e2ee4d10" +dependencies = [ + "windows-result", + "windows-targets 0.52.6", ] [[package]] @@ -3850,6 +4731,15 @@ dependencies = [ "windows-targets 0.52.6", ] +[[package]] +name = "windows-sys" +version = "0.59.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" +dependencies = [ + "windows-targets 0.52.6", +] + [[package]] name = "windows-targets" version = "0.48.5" @@ -3973,21 +4863,125 @@ checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" [[package]] name = "winnow" -version = "0.6.13" +version = "0.6.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59b5e5f6c299a3c7890b876a2a587f3115162487e704907d9b6cd29473052ba1" +checksum = "36c1fec1a2bb5866f07c25f68c26e565c4c200aebb96d7e55710c19d3e8ac49b" dependencies = [ "memchr", ] [[package]] -name = "winreg" -version = "0.52.0" +name = "write16" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1890f4022759daae28ed4fe62859b1236caebfc61ede2f63ed4e695f3f6d936" + +[[package]] +name = "writeable" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e9df38ee2d2c3c5948ea468a8406ff0db0b29ae1ffde1bcf20ef305bcc95c51" + +[[package]] +name = "yew" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a277a57398d4bfa075df44f501a17cfdf8542d224f0d36095a2adc7aee4ef0a5" +checksum = "5dbecfe44343b70cc2932c3eb445425969ae21754a8ab3a0966981c1cf7af1cc" dependencies = [ - "cfg-if", - "windows-sys 0.48.0", + "console_error_panic_hook", + "futures", + "gloo", + "implicit-clone", + "indexmap 1.9.3", + "js-sys", + "prokio", + "rustversion", + "serde", + "slab", + "thiserror", + "tokio", + "tracing", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "yew-macro", +] + +[[package]] +name = "yew-macro" +version = "0.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b64c253c1d401f1ea868ca9988db63958cfa15a69f739101f338d6f05eea8301" +dependencies = [ + "boolinator", + "once_cell", + "prettyplease", + "proc-macro-error", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "yew-router" +version = "0.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "426ee0486d2572a6c5e39fbdbc48b58d59bb555f3326f54631025266cf04146e" +dependencies = [ + "gloo", + "js-sys", + "route-recognizer", + "serde", + "serde_urlencoded", + "tracing", + "wasm-bindgen", + "web-sys", + "yew", + "yew-router-macro", +] + +[[package]] +name = "yew-router-macro" +version = "0.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "89b249cdb39e0cddaf0644dedc781854524374664793479fdc01e6a65d6e6ae3" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "yew_icons" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2f01768685c7bba96996a1ba91902653a37b2bfd6e937c73cfd132201693d4b" +dependencies = [ + "yew", +] + +[[package]] +name = "yoke" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c5b1314b079b0930c31e3af543d8ee1757b1951ae1e1565ec704403a7240ca5" +dependencies = [ + "serde", + "stable_deref_trait", + "yoke-derive", + "zerofrom", +] + +[[package]] +name = "yoke-derive" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28cc31741b18cb6f1d5ff12f5b7523e3d6eb0852bbbad19d73905511d9849b95" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.77", + "synstructure", ] [[package]] @@ -3996,6 +4990,7 @@ version = "0.7.35" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" dependencies = [ + "byteorder", "zerocopy-derive", ] @@ -4007,7 +5002,28 @@ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.77", +] + +[[package]] +name = "zerofrom" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91ec111ce797d0e0784a1116d0ddcdbea84322cd79e5d5ad173daeba4f93ab55" +dependencies = [ + "zerofrom-derive", +] + +[[package]] +name = "zerofrom-derive" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ea7b4a3637ea8669cedf0f1fd5c286a17f3de97b8dd5a70a6c167a1730e63a5" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.77", + "synstructure", ] [[package]] @@ -4015,33 +5031,41 @@ name = "zeroize" version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" + +[[package]] +name = "zerovec" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa2b893d79df23bfb12d5461018d408ea19dfafe76c2c7ef6d4eba614f8ff079" dependencies = [ - "zeroize_derive", + "yoke", + "zerofrom", + "zerovec-derive", ] [[package]] -name = "zeroize_derive" -version = "1.4.2" +name = "zerovec-derive" +version = "0.10.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" +checksum = "6eafa6dfb17584ea3e2bd6e76e0cc15ad7af12b09abdd1ca55961bed9b1063c6" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.77", ] [[package]] name = "zip" -version = "2.1.3" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "775a2b471036342aa69bc5a602bc889cb0a06cda00477d0c69566757d5553d39" +checksum = "dc5e4288ea4057ae23afc69a4472434a87a2495cafce6632fd1c4ec9f5cf3494" dependencies = [ "arbitrary", "crc32fast", "crossbeam-utils", "displaydoc", "flate2", - "indexmap", + "indexmap 2.6.0", "memchr", "thiserror", "zopfli", diff --git a/Cargo.toml b/Cargo.toml index 2f599c6e03..3cc34e3bd4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,14 +13,18 @@ members = [ "framework/snippets", "framework/wasm-adapter", + "chain/core", + "chain/vm", + "sdk/core", + "sdk/dapp", + "sdk/http", "sdk/scenario-format", "tools/mxpy-snippet-generator", "tools/payload-macro-generator", # "tools/plotter", - - "vm", + "tools/interactor-system-func-calls/", "contracts/modules", @@ -51,7 +55,7 @@ members = [ "contracts/examples/adder", "contracts/examples/adder/meta", - "contracts/examples/adder/interact", + "contracts/examples/adder/interactor", "contracts/examples/esdt-transfer-with-fee", "contracts/examples/esdt-transfer-with-fee/meta", "contracts/examples/bonding-curve-contract", @@ -97,6 +101,8 @@ members = [ "contracts/examples/proxy-pause/meta", "contracts/examples/ping-pong-egld", "contracts/examples/ping-pong-egld/meta", + "contracts/examples/ping-pong-egld/interactor", + "contracts/examples/ping-pong-egld/dapp", "contracts/examples/rewards-distribution", "contracts/examples/rewards-distribution/meta", "contracts/examples/seed-nft-minter", diff --git a/Makefile b/Makefile new file mode 100644 index 0000000000..0208ab3f4a --- /dev/null +++ b/Makefile @@ -0,0 +1,4 @@ +chain-simulator: + @docker compose -f docker-compose.yml build + @docker compose -f docker-compose.yml up & sc-meta test -c + @docker compose -f docker-compose.yml down -v \ No newline at end of file diff --git a/chain/core/Cargo.toml b/chain/core/Cargo.toml new file mode 100644 index 0000000000..79387716af --- /dev/null +++ b/chain/core/Cargo.toml @@ -0,0 +1,25 @@ +[package] +name = "multiversx-chain-core" +version = "0.11.0" +edition = "2021" + +authors = [ + "Andrei Marinica ", + "MultiversX ", +] +license = "GPL-3.0-only" +readme = "README.md" +repository = "https://github.com/multiversx/mx-sdk-rs" +homepage = "https://multiversx.com/" +documentation = "https://docs.multiversx.com/" +description = "MultiversX chain interfaces, constants, and base types" +keywords = ["multiversx", "blockchain", "vm", "tools"] +categories = ["cryptography::cryptocurrencies", "development-tools::debugging"] + +[dependencies] +bitflags = "=2.6.0" + +[dependencies.multiversx-sc-codec] +version = "=0.21.0" +path = "../../data/codec" +features = ["derive"] diff --git a/chain/core/README.md b/chain/core/README.md new file mode 100644 index 0000000000..76827c0b17 --- /dev/null +++ b/chain/core/README.md @@ -0,0 +1,16 @@ +# MultiversX blockchain base types, interfaces and builtin function names + +It provides various types and contants referring to the MultiversX blockchain base implementation. + +This functionality is designed to be minimal and to be used from both smart contract code and VM implementations. + +It can be viewed as a collection of system specs, which hold for any MultiversX-related implementation. For example: +- `Address` - MultiversX adresses are 32 bytes long. This is the old SC address type, it holds the bytes on the heap. It is also used in the MultiversX Rust VM. +- `H256` - same as address, currently used for transaction hashes. +- Flags: + - Code metadata - a bitflag encoding the SC code metadta, as it is stored on the blockchain, and encoded in smart contracts; + - ESDT local roles + - as enum + - as bitflags + - ESDT token types + diff --git a/framework/base/src/types/interaction/system_proxy/builtin_func_names.rs b/chain/core/src/builtin_func_names.rs similarity index 100% rename from framework/base/src/types/interaction/system_proxy/builtin_func_names.rs rename to chain/core/src/builtin_func_names.rs diff --git a/chain/core/src/lib.rs b/chain/core/src/lib.rs new file mode 100644 index 0000000000..503f690d82 --- /dev/null +++ b/chain/core/src/lib.rs @@ -0,0 +1,9 @@ +#![no_std] + +extern crate alloc; + +pub mod builtin_func_names; +pub mod types; + +/// Re-exported for convenience. +pub use multiversx_sc_codec as codec; diff --git a/chain/core/src/types.rs b/chain/core/src/types.rs new file mode 100644 index 0000000000..6aa0159afd --- /dev/null +++ b/chain/core/src/types.rs @@ -0,0 +1,13 @@ +mod address; +mod boxed_bytes; +mod flags; +mod h256; +mod heap_address; +mod heap_h256; + +pub use address::Address; +pub use boxed_bytes::BoxedBytes; +pub use flags::*; +pub use h256::H256; +pub use heap_address::HeapAddress; +pub use heap_h256::HeapH256; diff --git a/framework/base/src/types/heap/h256_address.rs b/chain/core/src/types/address.rs similarity index 85% rename from framework/base/src/types/heap/h256_address.rs rename to chain/core/src/types/address.rs index a9fa69c2e7..0f5099fddb 100644 --- a/framework/base/src/types/heap/h256_address.rs +++ b/chain/core/src/types/address.rs @@ -1,12 +1,11 @@ -use super::h256::H256; -use crate::{ - abi::{TypeAbi, TypeAbiFrom, TypeName}, - types::heap::BoxedBytes, -}; +use super::H256; use alloc::{boxed::Box, vec::Vec}; use core::fmt::Debug; const SC_ADDRESS_NUM_LEADING_ZEROS: u8 = 8; +pub const NUM_INT_CHARACTERS_FOR_ADDRESS: usize = 10; +pub const VM_TYPE_LEN: usize = 2; +pub const DEFAULT_VM_TYPE: &[u8] = &[5, 0]; /// An Address is just a H256 with a different name. /// Has a different ABI name than H256. @@ -16,6 +15,30 @@ const SC_ADDRESS_NUM_LEADING_ZEROS: u8 = 8; #[derive(Hash, PartialEq, Eq, Clone, Debug)] pub struct Address(H256); +impl Address { + pub const fn new(bytes: [u8; 32]) -> Self { + Address(H256::new(bytes)) + } + + pub fn generate_mock_address(creator_address: &[u8], creator_nonce: u64) -> Self { + let mut result = [0x00; 32]; + + result[10] = 0x11; + result[11] = 0x11; + result[12] = 0x11; + result[13] = 0x11; + + result[14..29].copy_from_slice(&creator_address[..15]); + result[29] = creator_nonce as u8; + result[30..].copy_from_slice(&creator_address[30..]); + + let start_index = NUM_INT_CHARACTERS_FOR_ADDRESS - VM_TYPE_LEN; + result[start_index..(start_index + DEFAULT_VM_TYPE.len())].copy_from_slice(DEFAULT_VM_TYPE); + + Address::from(result) + } +} + impl From for Address { #[inline] fn from(hash: H256) -> Self { @@ -145,13 +168,6 @@ impl Address { self.0.is_zero() } - /// Transmutes self to an (in principle) variable length boxed bytes object. - /// Both BoxedBytes and H256 keep the data on the heap, so only the pointer to that data needs to be transmuted. - /// Does not reallocate or copy data, the data on the heap remains untouched. - pub fn into_boxed_bytes(self) -> BoxedBytes { - self.0.into_boxed_bytes() - } - pub fn is_smart_contract_address(&self) -> bool { self.as_bytes() .iter() @@ -202,20 +218,6 @@ impl TopDecode for Address { } } -impl TypeAbiFrom for Address {} - -impl TypeAbi for Address { - type Unmanaged = Self; - - fn type_name() -> TypeName { - "Address".into() - } - - fn type_name_rust() -> TypeName { - "Address".into() - } -} - #[cfg(test)] mod address_tests { use super::*; @@ -251,11 +253,4 @@ mod address_tests { fn test_is_zero() { assert!(Address::zero().is_zero()); } - - #[test] - fn test_size_of() { - use core::mem::size_of; - assert_eq!(size_of::
(), size_of::()); - assert_eq!(size_of::>(), size_of::()); - } } diff --git a/framework/base/src/types/heap/boxed_bytes.rs b/chain/core/src/types/boxed_bytes.rs similarity index 96% rename from framework/base/src/types/heap/boxed_bytes.rs rename to chain/core/src/types/boxed_bytes.rs index 336b0874a8..b6fbb86297 100644 --- a/framework/base/src/types/heap/boxed_bytes.rs +++ b/chain/core/src/types/boxed_bytes.rs @@ -5,14 +5,14 @@ use alloc::{ vec::Vec, }; -use crate::{ - abi::{TypeAbi, TypeAbiFrom, TypeName}, - codec::*, -}; +use crate::codec::*; /// Simple wrapper around a boxed byte slice, /// but with a lot of optimized methods for manipulating it. /// The focus is on reducing code size rather improving speed. +/// +/// Used to be used extensively in smart contracts, before the introduction of ManagedBuffer, +/// but was superseded by it. #[derive(Clone, PartialEq, Eq, Debug)] pub struct BoxedBytes(Box<[u8]>); @@ -224,20 +224,6 @@ impl TopDecode for BoxedBytes { } } -impl TypeAbiFrom for BoxedBytes {} - -impl TypeAbi for BoxedBytes { - type Unmanaged = Self; - - fn type_name() -> TypeName { - "bytes".into() - } - - fn type_name_rust() -> TypeName { - "BoxedBytes".into() - } -} - //////////////////////////////////////////////////////////////////////////////// #[cfg(test)] diff --git a/framework/base/src/types/flags/mod.rs b/chain/core/src/types/flags.rs similarity index 72% rename from framework/base/src/types/flags/mod.rs rename to chain/core/src/types/flags.rs index b24a0d4fba..6b2522c386 100644 --- a/framework/base/src/types/flags/mod.rs +++ b/chain/core/src/types/flags.rs @@ -2,8 +2,12 @@ mod code_metadata; mod esdt_local_role; mod esdt_local_role_flags; mod esdt_token_type; +mod return_code; +mod token_type; pub use code_metadata::CodeMetadata; pub use esdt_local_role::EsdtLocalRole; pub use esdt_local_role_flags::EsdtLocalRoleFlags; pub use esdt_token_type::EsdtTokenType; +pub use return_code::ReturnCode; +pub use token_type::TokenType; diff --git a/framework/base/src/types/flags/code_metadata.rs b/chain/core/src/types/flags/code_metadata.rs similarity index 69% rename from framework/base/src/types/flags/code_metadata.rs rename to chain/core/src/types/flags/code_metadata.rs index 9275e976cf..596bf9744c 100644 --- a/framework/base/src/types/flags/code_metadata.rs +++ b/chain/core/src/types/flags/code_metadata.rs @@ -1,17 +1,13 @@ #![allow(clippy::bad_bit_mask)] -use crate::{ - abi::{TypeAbi, TypeAbiFrom, TypeName}, - codec::*, - formatter::{hex_util, FormatByteReceiver, SCBinary, SCDisplay, SCLowerHex}, -}; +use crate::codec::*; use bitflags::bitflags; -const UPGRADEABLE_STRING: &[u8] = b"Upgradeable"; -const READABLE_STRING: &[u8] = b"Readable"; -const PAYABLE_STRING: &[u8] = b"Payable"; -const PAYABLE_BY_SC_STRING: &[u8] = b"PayableBySC"; -const DEFAULT_STRING: &[u8] = b"Default"; +const UPGRADEABLE_STRING: &str = "Upgradeable"; +const READABLE_STRING: &str = "Readable"; +const PAYABLE_STRING: &str = "Payable"; +const PAYABLE_BY_SC_STRING: &str = "PayableBySC"; +const DEFAULT_STRING: &str = "Default"; bitflags! { #[derive(Default, PartialEq, Debug, Clone, Copy)] @@ -45,6 +41,43 @@ impl CodeMetadata { pub fn to_byte_array(&self) -> [u8; 2] { self.bits().to_be_bytes() } + + pub fn to_vec(&self) -> Vec { + self.to_byte_array().to_vec() + } + + pub fn for_each_string_token(&self, mut f: F) { + let mut nothing_printed: bool = true; + if self.is_upgradeable() { + f(UPGRADEABLE_STRING); + nothing_printed = false; + } + if self.is_readable() { + if !nothing_printed { + f("|"); + } + f(READABLE_STRING); + nothing_printed = false; + } + if self.is_payable() { + if !nothing_printed { + f("|"); + } + f(PAYABLE_STRING); + nothing_printed = false; + } + if self.is_payable_by_sc() { + if !nothing_printed { + f("|"); + } + f(PAYABLE_BY_SC_STRING); + nothing_printed = false; + } + + if nothing_printed { + f(DEFAULT_STRING); + } + } } impl From<[u8; 2]> for CodeMetadata { @@ -61,6 +94,19 @@ impl From for CodeMetadata { } } +impl From<&[u8]> for CodeMetadata { + fn from(slice: &[u8]) -> Self { + let arr: [u8; 2] = slice.try_into().unwrap_or_default(); + CodeMetadata::from(arr) + } +} + +impl From<&Vec> for CodeMetadata { + fn from(v: &Vec) -> Self { + CodeMetadata::from(v.as_slice()) + } +} + impl NestedEncode for CodeMetadata { fn dep_encode_or_handle_err(&self, dest: &mut O, h: H) -> Result<(), H::HandledErr> where @@ -103,74 +149,6 @@ impl TopDecode for CodeMetadata { } } -impl TypeAbiFrom for CodeMetadata {} - -impl TypeAbi for CodeMetadata { - type Unmanaged = Self; - - fn type_name() -> TypeName { - "CodeMetadata".into() - } - - fn type_name_rust() -> TypeName { - "CodeMetadata".into() - } -} - -impl SCDisplay for CodeMetadata { - fn fmt(&self, f: &mut F) { - let mut nothing_printed: bool = true; - verify_metadata_and_append( - self.is_upgradeable(), - f, - UPGRADEABLE_STRING, - &mut nothing_printed, - ); - verify_metadata_and_append(self.is_readable(), f, READABLE_STRING, &mut nothing_printed); - verify_metadata_and_append(self.is_payable(), f, PAYABLE_STRING, &mut nothing_printed); - verify_metadata_and_append( - self.is_payable_by_sc(), - f, - PAYABLE_BY_SC_STRING, - &mut nothing_printed, - ); - if nothing_printed { - f.append_bytes(DEFAULT_STRING); - } - } -} - -impl SCLowerHex for CodeMetadata { - fn fmt(&self, f: &mut F) { - let num = self.bits().to_be_bytes(); - f.append_bytes(&hex_util::byte_to_hex_digits(num[0])[..]); - f.append_bytes(&hex_util::byte_to_hex_digits(num[1])[..]); - } -} - -impl SCBinary for CodeMetadata { - fn fmt(&self, f: &mut F) { - let num = self.bits().to_be_bytes(); - f.append_bytes(&hex_util::byte_to_binary_digits(num[0])[..]); - f.append_bytes(&hex_util::byte_to_binary_digits(num[1])[..]); - } -} - -fn verify_metadata_and_append( - constraint: bool, - f: &mut F, - bytes_to_append: &[u8], - nothing_printed: &mut bool, -) { - if constraint { - if !*nothing_printed { - f.append_bytes(b"|"); - } - f.append_bytes(bytes_to_append); - *nothing_printed = false; - } -} - #[cfg(test)] mod tests { use super::*; diff --git a/vm/src/types/vm_esdt_local_role.rs b/chain/core/src/types/flags/esdt_local_role.rs similarity index 92% rename from vm/src/types/vm_esdt_local_role.rs rename to chain/core/src/types/flags/esdt_local_role.rs index 40c383b869..048d3876ce 100644 --- a/vm/src/types/vm_esdt_local_role.rs +++ b/chain/core/src/types/flags/esdt_local_role.rs @@ -1,4 +1,8 @@ use super::EsdtLocalRoleFlags; +use crate::codec::{ + self, + derive::{NestedDecode, NestedEncode, TopDecode, TopEncode}, +}; const ESDT_ROLE_NONE: &str = ""; const ESDT_ROLE_LOCAL_MINT: &str = "ESDTRoleLocalMint"; @@ -10,12 +14,7 @@ const ESDT_ROLE_NFT_ADD_URI: &str = "ESDTRoleNFTAddURI"; const ESDT_ROLE_NFT_UPDATE_ATTRIBUTES: &str = "ESDTRoleNFTUpdateAttributes"; const ESDT_ROLE_TRANSFER: &str = "ESDTTransferRole"; -/// The VM implementation for EsdtLocalRole, used internally in builtin functions. -/// -/// There is another near-identical implementation in the framework, used for communicating with the VM. -/// -/// It might be a good idea to move it to some "common ground" crate, between the framework and the VM. -#[derive(Clone, PartialEq, Eq, Debug, Copy)] +#[derive(TopDecode, TopEncode, NestedDecode, NestedEncode, Clone, PartialEq, Eq, Debug, Copy)] pub enum EsdtLocalRole { None, Mint, @@ -43,6 +42,10 @@ impl EsdtLocalRole { } } + pub fn as_role_name(&self) -> &'static [u8] { + self.name().as_bytes() + } + pub fn name(&self) -> &'static str { match self { Self::None => ESDT_ROLE_NONE, diff --git a/framework/base/src/types/flags/esdt_local_role_flags.rs b/chain/core/src/types/flags/esdt_local_role_flags.rs similarity index 100% rename from framework/base/src/types/flags/esdt_local_role_flags.rs rename to chain/core/src/types/flags/esdt_local_role_flags.rs diff --git a/framework/base/src/types/flags/esdt_token_type.rs b/chain/core/src/types/flags/esdt_token_type.rs similarity index 89% rename from framework/base/src/types/flags/esdt_token_type.rs rename to chain/core/src/types/flags/esdt_token_type.rs index e80b91590d..74db07c9a6 100644 --- a/framework/base/src/types/flags/esdt_token_type.rs +++ b/chain/core/src/types/flags/esdt_token_type.rs @@ -1,4 +1,4 @@ -use multiversx_sc_derive::{type_abi, ManagedVecItem}; +// use multiversx_sc_derive::{type_abi, ManagedVecItem}; use crate::codec::{ self, @@ -11,14 +11,9 @@ const ESDT_TYPE_SEMI_FUNGIBLE: &[u8] = b"SemiFungibleESDT"; const ESDT_TYPE_META: &[u8] = b"MetaESDT"; const ESDT_TYPE_INVALID: &[u8] = &[]; -use crate as multiversx_sc; // needed by the TypeAbi generated code - // Note: In the current implementation, SemiFungible is never returned -#[type_abi] -#[derive( - TopDecode, TopEncode, NestedDecode, NestedEncode, Clone, PartialEq, Eq, Debug, ManagedVecItem, -)] +#[derive(TopDecode, TopEncode, NestedDecode, NestedEncode, Clone, PartialEq, Eq, Debug)] pub enum EsdtTokenType { Fungible, NonFungible, diff --git a/chain/core/src/types/flags/return_code.rs b/chain/core/src/types/flags/return_code.rs new file mode 100644 index 0000000000..2374d58762 --- /dev/null +++ b/chain/core/src/types/flags/return_code.rs @@ -0,0 +1,135 @@ +const MESSAGE_OK: &str = "ok"; +const MESSAGE_FUNCTION_NOT_FOUND: &str = "function not found"; +const MESSAGE_WRONG_SIGNATURE: &str = "wrong signature for function"; +const MESSAGE_CONTRACT_NOT_FOUND: &str = "contract not found"; +const MESSAGE_USER_ERROR: &str = "user error"; +const MESSAGE_OUT_OF_GAS: &str = "out of gas"; +const MESSAGE_ACCOUNT_COLLISION: &str = "account collision"; +const MESSAGE_OUT_OF_FUNDS: &str = "out of funds"; +const MESSAGE_CALL_STACK_OVERFLOW: &str = "call stack overflow"; +const MESSAGE_CONTRACT_INVALID: &str = "contract invalid"; +const MESSAGE_EXECUTION_FAILED: &str = "execution failed"; +const MESSAGE_UNKNOWN_ERROR: &str = "unknown error"; +const MESSAGE_NETWORK_TIMEOUT: &str = "network timeout"; + +#[derive(Clone, Copy, Default, PartialEq, Eq, Debug)] +pub enum ReturnCode { + /// Returned when execution was completed normally. + #[default] + Success = 0, + + /// Returned when the input specifies a function name that does not exist or is not public. + FunctionNotFound = 1, + + /// Returned when the wrong number of arguments is provided. + FunctionWrongSignature = 2, + + /// Returned when the called contract does not exist. + ContractNotFound = 3, + + /// Returned for various execution errors. + UserError = 4, + + /// Returned when VM execution runs out of gas. + OutOfGas = 5, + + /// Returned when created account already exists. + AccountCollision = 6, + + /// Returned when the caller (sender) runs out of funds. + OutOfFunds = 7, + + /// Returned when stack overflow occurs. + CallStackOverFlow = 8, + + /// Returned when the contract is invalid. + ContractInvalid = 9, + + /// Returned when the execution of the specified function has failed. + ExecutionFailed = 10, + + /// Returned when the upgrade of the contract has failed + UpgradeFailed = 11, + + /// Returned when tx simulation fails execution + SimulateFailed = 12, + + /// Only occurs in the debugger context. + DebugApiError = 100, + + // Returned when a connection timeout occurs + NetworkTimeout = 101, +} + +impl ReturnCode { + pub fn as_u64(self) -> u64 { + self as u64 + } + + pub fn is_success(self) -> bool { + self == ReturnCode::Success + } + + pub fn message(self) -> &'static str { + match self { + ReturnCode::Success => MESSAGE_OK, + ReturnCode::FunctionNotFound => MESSAGE_FUNCTION_NOT_FOUND, + ReturnCode::FunctionWrongSignature => MESSAGE_WRONG_SIGNATURE, + ReturnCode::ContractNotFound => MESSAGE_CONTRACT_NOT_FOUND, + ReturnCode::UserError => MESSAGE_USER_ERROR, + ReturnCode::OutOfGas => MESSAGE_OUT_OF_GAS, + ReturnCode::AccountCollision => MESSAGE_ACCOUNT_COLLISION, + ReturnCode::OutOfFunds => MESSAGE_OUT_OF_FUNDS, + ReturnCode::CallStackOverFlow => MESSAGE_CALL_STACK_OVERFLOW, + ReturnCode::ContractInvalid => MESSAGE_CONTRACT_INVALID, + ReturnCode::ExecutionFailed => MESSAGE_EXECUTION_FAILED, + ReturnCode::NetworkTimeout => MESSAGE_NETWORK_TIMEOUT, + _ => MESSAGE_UNKNOWN_ERROR, + } + } + + pub fn from_u64(value: u64) -> Option { + match value { + 0 => Some(ReturnCode::Success), + 1 => Some(ReturnCode::FunctionNotFound), + 2 => Some(ReturnCode::FunctionWrongSignature), + 3 => Some(ReturnCode::ContractNotFound), + 4 => Some(ReturnCode::UserError), + 5 => Some(ReturnCode::OutOfGas), + 6 => Some(ReturnCode::AccountCollision), + 7 => Some(ReturnCode::OutOfFunds), + 8 => Some(ReturnCode::CallStackOverFlow), + 9 => Some(ReturnCode::ContractInvalid), + 10 => Some(ReturnCode::ExecutionFailed), + 11 => Some(ReturnCode::UpgradeFailed), + 12 => Some(ReturnCode::SimulateFailed), + 100 => Some(ReturnCode::DebugApiError), + 101 => Some(ReturnCode::NetworkTimeout), + _ => None, + } + } + + pub fn from_message(message: &str) -> Option { + match message { + MESSAGE_OK => Some(ReturnCode::Success), + MESSAGE_FUNCTION_NOT_FOUND => Some(ReturnCode::FunctionNotFound), + MESSAGE_WRONG_SIGNATURE => Some(ReturnCode::FunctionWrongSignature), + MESSAGE_CONTRACT_NOT_FOUND => Some(ReturnCode::ContractNotFound), + MESSAGE_USER_ERROR => Some(ReturnCode::UserError), + MESSAGE_OUT_OF_GAS => Some(ReturnCode::OutOfGas), + MESSAGE_ACCOUNT_COLLISION => Some(ReturnCode::AccountCollision), + MESSAGE_OUT_OF_FUNDS => Some(ReturnCode::OutOfFunds), + MESSAGE_CALL_STACK_OVERFLOW => Some(ReturnCode::CallStackOverFlow), + MESSAGE_CONTRACT_INVALID => Some(ReturnCode::ContractInvalid), + MESSAGE_EXECUTION_FAILED => Some(ReturnCode::ExecutionFailed), + MESSAGE_NETWORK_TIMEOUT => Some(ReturnCode::NetworkTimeout), + _ => None, + } + } +} + +impl core::fmt::Display for ReturnCode { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + self.as_u64().fmt(f) + } +} diff --git a/vm/src/types/vm_token_type.rs b/chain/core/src/types/flags/token_type.rs similarity index 51% rename from vm/src/types/vm_token_type.rs rename to chain/core/src/types/flags/token_type.rs index 18670a90dc..77ff975a45 100644 --- a/vm/src/types/vm_token_type.rs +++ b/chain/core/src/types/flags/token_type.rs @@ -1,18 +1,18 @@ #[derive(Debug, Clone, Copy, PartialEq, Eq)] -pub enum VMTokenType { +pub enum TokenType { Fungible, SemiFungible, Meta, NonFungible, } -impl VMTokenType { +impl TokenType { pub fn from_system_sc_arg(raw: &[u8]) -> Self { match raw { - b"FNG" => VMTokenType::Fungible, - b"SFT" => VMTokenType::SemiFungible, - b"META" => VMTokenType::Meta, - b"NFT" => VMTokenType::NonFungible, + b"FNG" => TokenType::Fungible, + b"SFT" => TokenType::SemiFungible, + b"META" => TokenType::Meta, + b"NFT" => TokenType::NonFungible, _ => panic!("invalid token type"), } } diff --git a/chain/core/src/types/h256.rs b/chain/core/src/types/h256.rs new file mode 100644 index 0000000000..8a7b63d1a1 --- /dev/null +++ b/chain/core/src/types/h256.rs @@ -0,0 +1,223 @@ +use alloc::{boxed::Box, vec::Vec}; +use core::fmt::Debug; + +const ZERO_32: &[u8] = &[0u8; 32]; + +/// Type that holds 32 bytes of data. +/// Data is kept on the heap to keep wasm size low and avoid copies. +#[derive(Hash, PartialEq, Eq, Clone, Debug)] +pub struct H256([u8; 32]); + +impl H256 { + pub const fn new(bytes: [u8; 32]) -> Self { + H256(bytes) + } +} + +impl From<[u8; 32]> for H256 { + /// Constructs a hash type from the given bytes array of fixed length. + /// + /// # Note + /// + /// The given bytes are interpreted in big endian order. + fn from(arr: [u8; 32]) -> Self { + H256::new(arr) + } +} + +impl<'a> From<&'a [u8; 32]> for H256 { + /// Constructs a hash type from the given reference + /// to the bytes array of fixed length. + /// + /// # Note + /// + /// The given bytes are interpreted in big endian order. + #[inline] + fn from(bytes: &'a [u8; 32]) -> Self { + H256::new(*bytes) + } +} + +impl<'a> From<&'a mut [u8; 32]> for H256 { + /// Constructs a hash type from the given reference + /// to the mutable bytes array of fixed length. + /// + /// # Note + /// + /// The given bytes are interpreted in big endian order. + #[inline] + fn from(bytes: &'a mut [u8; 32]) -> Self { + H256::new(*bytes) + } +} + +impl From> for H256 { + #[inline] + fn from(bytes: Box<[u8; 32]>) -> Self { + H256::new(*bytes) + } +} + +impl H256 { + pub fn from_slice(slice: &[u8]) -> Self { + let mut arr = [0u8; 32]; + let len = core::cmp::min(slice.len(), 32); + arr[..len].copy_from_slice(&slice[..len]); + H256::new(arr) + } +} + +impl From for [u8; 32] { + fn from(s: H256) -> Self { + s.0 + } +} + +impl AsRef<[u8]> for H256 { + #[inline] + fn as_ref(&self) -> &[u8] { + self.as_bytes() + } +} + +impl AsMut<[u8]> for H256 { + #[inline] + fn as_mut(&mut self) -> &mut [u8] { + self.0.as_mut() + } +} + +impl H256 { + /// Returns a new zero-initialized fixed hash. + pub fn zero() -> Self { + H256([0u8; 32]) + } + + /// Returns the size of this hash in bytes. + #[inline] + pub fn len_bytes() -> usize { + 32 + } + + /// Extracts a byte slice containing the entire fixed hash. + #[inline] + pub fn as_bytes(&self) -> &[u8] { + self.0.as_ref() + } + + #[inline] + pub fn as_array(&self) -> &[u8; 32] { + &self.0 + } + + #[inline] + pub fn copy_to_array(&self, target: &mut [u8; 32]) { + target.copy_from_slice(&self.0[..]); + } + + #[inline] + pub fn to_vec(&self) -> Vec { + self.0[..].to_vec() + } + + /// Pointer to the data on the heap. + #[inline] + pub fn as_ptr(&self) -> *const u8 { + self.0.as_ptr() + } + + /// Returns an unsafe mutable pointer to the data on the heap. + /// Used by the API to populate data. + #[inline] + pub fn as_mut_ptr(&mut self) -> *mut u8 { + self.0.as_mut_ptr() + } + + /// True if all 32 bytes of the hash are zero. + pub fn is_zero(&self) -> bool { + self.as_bytes() == ZERO_32 + } +} + +use crate::codec::*; + +impl NestedEncode for H256 { + fn dep_encode_or_handle_err(&self, dest: &mut O, _h: H) -> Result<(), H::HandledErr> + where + O: NestedEncodeOutput, + H: EncodeErrorHandler, + { + dest.write(&self.0[..]); + Ok(()) + } +} + +impl TopEncode for H256 { + fn top_encode_or_handle_err(&self, output: O, _h: H) -> Result<(), H::HandledErr> + where + O: TopEncodeOutput, + H: EncodeErrorHandler, + { + output.set_slice_u8(&self.0[..]); + Ok(()) + } +} + +impl NestedDecode for H256 { + fn dep_decode_or_handle_err(input: &mut I, h: H) -> Result + where + I: NestedDecodeInput, + H: DecodeErrorHandler, + { + let mut res = H256::zero(); + input.read_into(res.as_mut(), h)?; + Ok(res) + } +} + +impl TopDecode for H256 { + fn top_decode_or_handle_err(input: I, h: H) -> Result + where + I: TopDecodeInput, + H: DecodeErrorHandler, + { + Ok(Self::new(<[u8; 32]>::top_decode_or_handle_err(input, h)?)) + } +} + +#[cfg(test)] +mod h256_tests { + use super::*; + use crate::codec::test_util::{check_top_encode, check_top_encode_decode}; + use alloc::vec::Vec; + + #[test] + fn test_h256_from_array() { + let addr = H256::from([4u8; 32]); + check_top_encode_decode(addr, &[4u8; 32]); + } + + #[test] + fn test_opt_h256() { + let addr = H256::from([4u8; 32]); + let mut expected: Vec = Vec::new(); + expected.push(1u8); + expected.extend_from_slice(&[4u8; 32]); + check_top_encode_decode(Some(addr), expected.as_slice()); + } + + #[test] + fn test_ser_h256_ref() { + let addr = H256::from([4u8; 32]); + let expected_bytes: &[u8] = &[4u8; 32 * 3]; + + let tuple = (&addr, &&&addr, addr.clone()); + let serialized_bytes = check_top_encode(&tuple); + assert_eq!(serialized_bytes.as_slice(), expected_bytes); + } + + #[test] + fn test_is_zero() { + assert!(H256::zero().is_zero()); + } +} diff --git a/chain/core/src/types/heap_address.rs b/chain/core/src/types/heap_address.rs new file mode 100644 index 0000000000..57e053e815 --- /dev/null +++ b/chain/core/src/types/heap_address.rs @@ -0,0 +1,243 @@ +use super::{heap_h256::HeapH256, BoxedBytes}; + +use alloc::{boxed::Box, vec::Vec}; +use core::fmt::Debug; + +const SC_ADDRESS_NUM_LEADING_ZEROS: u8 = 8; + +/// Old smart contracts were using this Address implementation, +/// which was explicitly relying on the heap, to avoid large data copies on the stack. +/// +/// It is no longer used, kept for reference. +#[derive(Hash, PartialEq, Eq, Clone, Debug)] +pub struct HeapAddress(HeapH256); + +impl From for HeapAddress { + #[inline] + fn from(hash: HeapH256) -> Self { + HeapAddress(hash) + } +} + +impl From for HeapH256 { + #[inline] + fn from(address: HeapAddress) -> Self { + address.0 + } +} + +impl<'a> From<&'a HeapAddress> for &'a HeapH256 { + #[inline] + fn from(address: &'a HeapAddress) -> Self { + &address.0 + } +} + +impl From<[u8; 32]> for HeapAddress { + #[inline] + fn from(arr: [u8; 32]) -> Self { + HeapAddress(HeapH256::from(arr)) + } +} + +impl<'a> From<&'a [u8; 32]> for HeapAddress { + #[inline] + fn from(bytes: &'a [u8; 32]) -> Self { + HeapAddress(HeapH256::from(bytes)) + } +} + +impl<'a> From<&'a mut [u8; 32]> for HeapAddress { + #[inline] + fn from(bytes: &'a mut [u8; 32]) -> Self { + HeapAddress(HeapH256::from(bytes)) + } +} + +impl From> for HeapAddress { + #[inline] + fn from(bytes: Box<[u8; 32]>) -> Self { + HeapAddress(HeapH256::from(bytes)) + } +} + +impl HeapAddress { + pub fn from_slice(slice: &[u8]) -> Self { + HeapAddress(HeapH256::from_slice(slice)) + } +} + +impl From for [u8; 32] { + #[inline] + fn from(addr: HeapAddress) -> Self { + addr.0.into() + } +} + +impl AsRef<[u8]> for HeapAddress { + #[inline] + fn as_ref(&self) -> &[u8] { + self.0.as_ref() + } +} + +impl AsMut<[u8]> for HeapAddress { + #[inline] + fn as_mut(&mut self) -> &mut [u8] { + self.0.as_mut() + } +} + +impl HeapAddress { + /// Returns a new address of 32 zeros. + /// Allocates directly in heap. + /// Minimal resulting wasm code (14 bytes if not inlined). + pub fn zero() -> Self { + HeapAddress(HeapH256::zero()) + } + + /// Returns the size of an address in bytes. + #[inline] + pub fn len_bytes() -> usize { + HeapH256::len_bytes() + } + + /// Extracts a byte slice containing the entire fixed hash. + #[inline] + pub fn as_bytes(&self) -> &[u8] { + self.0.as_bytes() + } + + #[inline] + pub fn as_array(&self) -> &[u8; 32] { + self.0.as_array() + } + + #[inline] + pub fn copy_to_array(&self, target: &mut [u8; 32]) { + self.0.copy_to_array(target) + } + + #[inline] + pub fn to_vec(&self) -> Vec { + self.0.to_vec() + } + + /// Pointer to the data on the heap. + #[inline] + pub fn as_ptr(&self) -> *const u8 { + self.0.as_ptr() + } + + /// Returns an unsafe mutable pointer to the data on the heap. + /// Used by the API to populate data. + #[inline] + pub fn as_mut_ptr(&mut self) -> *mut u8 { + self.0.as_mut_ptr() + } + + /// True if all 32 bytes of the hash are zero. + pub fn is_zero(&self) -> bool { + self.0.is_zero() + } + + /// Transmutes self to an (in principle) variable length boxed bytes object. + /// Both BoxedBytes and H256 keep the data on the heap, so only the pointer to that data needs to be transmuted. + /// Does not reallocate or copy data, the data on the heap remains untouched. + pub fn into_boxed_bytes(self) -> BoxedBytes { + self.0.into_boxed_bytes() + } + + pub fn is_smart_contract_address(&self) -> bool { + self.as_bytes() + .iter() + .take(SC_ADDRESS_NUM_LEADING_ZEROS.into()) + .all(|item| item == &0u8) + } +} + +use crate::codec::*; + +impl NestedEncode for HeapAddress { + fn dep_encode_or_handle_err(&self, dest: &mut O, h: H) -> Result<(), H::HandledErr> + where + O: NestedEncodeOutput, + H: EncodeErrorHandler, + { + self.0.dep_encode_or_handle_err(dest, h) + } +} + +impl TopEncode for HeapAddress { + fn top_encode_or_handle_err(&self, output: O, h: H) -> Result<(), H::HandledErr> + where + O: TopEncodeOutput, + H: EncodeErrorHandler, + { + self.0.top_encode_or_handle_err(output, h) + } +} + +impl NestedDecode for HeapAddress { + fn dep_decode_or_handle_err(input: &mut I, h: H) -> Result + where + I: NestedDecodeInput, + H: DecodeErrorHandler, + { + Ok(HeapAddress(HeapH256::dep_decode_or_handle_err(input, h)?)) + } +} + +impl TopDecode for HeapAddress { + fn top_decode_or_handle_err(input: I, h: H) -> Result + where + I: TopDecodeInput, + H: DecodeErrorHandler, + { + Ok(HeapAddress(HeapH256::top_decode_or_handle_err(input, h)?)) + } +} + +#[cfg(test)] +mod address_tests { + use super::*; + use crate::codec::test_util::{check_top_encode, check_top_encode_decode}; + use alloc::vec::Vec; + + #[test] + fn test_address() { + let addr = HeapAddress::from([4u8; 32]); + check_top_encode_decode(addr, &[4u8; 32]); + } + + #[test] + fn test_opt_address() { + let addr = HeapAddress::from([4u8; 32]); + let mut expected: Vec = Vec::new(); + expected.push(1u8); + expected.extend_from_slice(&[4u8; 32]); + check_top_encode_decode(Some(addr), expected.as_slice()); + } + + #[test] + fn test_ser_address_ref() { + let addr = HeapAddress::from([4u8; 32]); + let expected_bytes: &[u8] = &[4u8; 32 * 3]; + + let tuple = (&addr, &&&addr, addr.clone()); + let serialized_bytes = check_top_encode(&tuple); + assert_eq!(serialized_bytes.as_slice(), expected_bytes); + } + + #[test] + fn test_is_zero() { + assert!(HeapAddress::zero().is_zero()); + } + + #[test] + fn test_size_of() { + use core::mem::size_of; + assert_eq!(size_of::(), size_of::()); + assert_eq!(size_of::>(), size_of::()); + } +} diff --git a/framework/base/src/types/heap/h256.rs b/chain/core/src/types/heap_h256.rs similarity index 80% rename from framework/base/src/types/heap/h256.rs rename to chain/core/src/types/heap_h256.rs index f440765d00..80f5a54f67 100644 --- a/framework/base/src/types/heap/h256.rs +++ b/chain/core/src/types/heap_h256.rs @@ -1,19 +1,17 @@ -use crate::{ - abi::{TypeAbi, TypeAbiFrom, TypeName}, - types::heap::BoxedBytes, -}; use alloc::{boxed::Box, vec::Vec}; use core::fmt::Debug; const ERR_BAD_H256_LENGTH: &str = "bad H256 length"; const ZERO_32: &[u8] = &[0u8; 32]; -/// Type that holds 32 bytes of data. -/// Data is kept on the heap to keep wasm size low and avoid copies. +/// Old smart contracts were using this H256 implementation, +/// which was explicitly relying on the heap, to avoid large data copies on the stack. +/// +/// It is no longer used, kept for reference. #[derive(Hash, PartialEq, Eq, Clone, Debug)] -pub struct H256(Box<[u8; 32]>); +pub struct HeapH256(Box<[u8; 32]>); -impl From<[u8; 32]> for H256 { +impl From<[u8; 32]> for HeapH256 { /// Constructs a hash type from the given bytes array of fixed length. /// /// # Note @@ -21,11 +19,11 @@ impl From<[u8; 32]> for H256 { /// The given bytes are interpreted in big endian order. #[inline] fn from(arr: [u8; 32]) -> Self { - H256(Box::new(arr)) + HeapH256(Box::new(arr)) } } -impl<'a> From<&'a [u8; 32]> for H256 { +impl<'a> From<&'a [u8; 32]> for HeapH256 { /// Constructs a hash type from the given reference /// to the bytes array of fixed length. /// @@ -34,11 +32,11 @@ impl<'a> From<&'a [u8; 32]> for H256 { /// The given bytes are interpreted in big endian order. #[inline] fn from(bytes: &'a [u8; 32]) -> Self { - H256(Box::new(*bytes)) + HeapH256(Box::new(*bytes)) } } -impl<'a> From<&'a mut [u8; 32]> for H256 { +impl<'a> From<&'a mut [u8; 32]> for HeapH256 { /// Constructs a hash type from the given reference /// to the mutable bytes array of fixed length. /// @@ -47,48 +45,48 @@ impl<'a> From<&'a mut [u8; 32]> for H256 { /// The given bytes are interpreted in big endian order. #[inline] fn from(bytes: &'a mut [u8; 32]) -> Self { - H256(Box::new(*bytes)) + HeapH256(Box::new(*bytes)) } } -impl From> for H256 { +impl From> for HeapH256 { #[inline] fn from(bytes: Box<[u8; 32]>) -> Self { - H256(bytes) + HeapH256(bytes) } } -impl H256 { +impl HeapH256 { pub fn from_slice(slice: &[u8]) -> Self { let mut arr = [0u8; 32]; let len = core::cmp::min(slice.len(), 32); arr[..len].copy_from_slice(&slice[..len]); - H256(Box::new(arr)) + HeapH256(Box::new(arr)) } } -impl From for [u8; 32] { +impl From for [u8; 32] { #[inline] - fn from(s: H256) -> Self { + fn from(s: HeapH256) -> Self { *(s.0) } } -impl AsRef<[u8]> for H256 { +impl AsRef<[u8]> for HeapH256 { #[inline] fn as_ref(&self) -> &[u8] { self.as_bytes() } } -impl AsMut<[u8]> for H256 { +impl AsMut<[u8]> for HeapH256 { #[inline] fn as_mut(&mut self) -> &mut [u8] { self.0.as_mut() } } -impl H256 { +impl HeapH256 { /// Returns a new zero-initialized fixed hash. /// Allocates directly in heap. /// Minimal resulting wasm code (14 bytes if not inlined). @@ -96,7 +94,7 @@ impl H256 { use alloc::alloc::{alloc_zeroed, Layout}; unsafe { let ptr = alloc_zeroed(Layout::new::<[u8; 32]>()) as *mut [u8; 32]; - H256(Box::from_raw(ptr)) + HeapH256(Box::from_raw(ptr)) } } @@ -159,7 +157,9 @@ impl H256 { use crate::codec::*; -impl NestedEncode for H256 { +use super::BoxedBytes; + +impl NestedEncode for HeapH256 { fn dep_encode_or_handle_err(&self, dest: &mut O, _h: H) -> Result<(), H::HandledErr> where O: NestedEncodeOutput, @@ -170,7 +170,7 @@ impl NestedEncode for H256 { } } -impl TopEncode for H256 { +impl TopEncode for HeapH256 { fn top_encode_or_handle_err(&self, output: O, _h: H) -> Result<(), H::HandledErr> where O: TopEncodeOutput, @@ -181,19 +181,19 @@ impl TopEncode for H256 { } } -impl NestedDecode for H256 { +impl NestedDecode for HeapH256 { fn dep_decode_or_handle_err(input: &mut I, h: H) -> Result where I: NestedDecodeInput, H: DecodeErrorHandler, { - let mut res = H256::zero(); + let mut res = HeapH256::zero(); input.read_into(res.as_mut(), h)?; Ok(res) } } -impl H256 { +impl HeapH256 { // Transmutes directly from a (variable-sized) boxed byte slice. // Will exit early if the input length is not 32. // Designed to be used especially in deserializer implementations. @@ -207,14 +207,14 @@ impl H256 { if input.len() == 32 { let raw = Box::into_raw(input); let array_box = unsafe { Box::<[u8; 32]>::from_raw(raw as *mut [u8; 32]) }; - Ok(H256(array_box)) + Ok(HeapH256(array_box)) } else { Err(h.handle_error(DecodeError::from(ERR_BAD_H256_LENGTH))) } } } -impl TopDecode for H256 { +impl TopDecode for HeapH256 { fn top_decode_or_handle_err(input: I, h: H) -> Result where I: TopDecodeInput, @@ -224,20 +224,6 @@ impl TopDecode for H256 { } } -impl TypeAbiFrom for H256 {} - -impl TypeAbi for H256 { - type Unmanaged = Self; - - fn type_name() -> TypeName { - "H256".into() - } - - fn type_name_rust() -> TypeName { - "H256".into() - } -} - #[cfg(test)] mod h256_tests { use super::*; @@ -246,13 +232,13 @@ mod h256_tests { #[test] fn test_h256_from_array() { - let addr = H256::from([4u8; 32]); + let addr = HeapH256::from([4u8; 32]); check_top_encode_decode(addr, &[4u8; 32]); } #[test] fn test_opt_h256() { - let addr = H256::from([4u8; 32]); + let addr = HeapH256::from([4u8; 32]); let mut expected: Vec = Vec::new(); expected.push(1u8); expected.extend_from_slice(&[4u8; 32]); @@ -261,7 +247,7 @@ mod h256_tests { #[test] fn test_ser_h256_ref() { - let addr = H256::from([4u8; 32]); + let addr = HeapH256::from([4u8; 32]); let expected_bytes: &[u8] = &[4u8; 32 * 3]; let tuple = (&addr, &&&addr, addr.clone()); @@ -271,20 +257,20 @@ mod h256_tests { #[test] fn test_is_zero() { - assert!(H256::zero().is_zero()); + assert!(HeapH256::zero().is_zero()); } #[test] fn test_size_of() { use core::mem::size_of; - assert_eq!(size_of::(), size_of::()); - assert_eq!(size_of::>(), size_of::()); + assert_eq!(size_of::(), size_of::()); + assert_eq!(size_of::>(), size_of::()); } #[test] fn test_into_boxed_bytes() { let array = b"32_bytes________________________"; - let h256 = H256::from(array); + let h256 = HeapH256::from(array); let bb = h256.into_boxed_bytes(); assert_eq!(bb.as_slice(), &array[..]); } diff --git a/vm/Cargo.toml b/chain/vm/Cargo.toml similarity index 83% rename from vm/Cargo.toml rename to chain/vm/Cargo.toml index 2da432d240..e412a709af 100644 --- a/vm/Cargo.toml +++ b/chain/vm/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "multiversx-chain-vm" -version = "0.9.0" +version = "0.11.0" edition = "2021" authors = [ @@ -18,7 +18,7 @@ categories = ["cryptography::cryptocurrencies", "development-tools::debugging"] [features] # not supported when compiling to wasm -wasm-incopatible = ["rand", "rand_seeder", "ed25519-dalek"] +wasm-incompatible = ["rand"] [dependencies] num-bigint = "0.4" @@ -31,8 +31,12 @@ hex-literal = "=0.4.1" bitflags = "=2.6.0" colored = "2.1.0" rand = { version= "0.8.5", optional = true } -rand_seeder = { version= "0.2.2", optional = true } -ed25519-dalek = { version = "1.0.1" , optional = true } +rand_seeder = "0.3.0" +ed25519-dalek = "2.1.0" + +[dependencies.multiversx-chain-core] +version = "=0.11.0" +path = "../core" [dependencies.multiversx-chain-vm-executor] # version = "0.2.0" diff --git a/vm/README.md b/chain/vm/README.md similarity index 100% rename from vm/README.md rename to chain/vm/README.md diff --git a/chain/vm/src/crypto_functions.rs b/chain/vm/src/crypto_functions.rs new file mode 100644 index 0000000000..3dae63aad7 --- /dev/null +++ b/chain/vm/src/crypto_functions.rs @@ -0,0 +1,44 @@ +use sha2::Sha256; +use sha3::{Digest, Keccak256}; + +pub const SHA256_RESULT_LEN: usize = 32; +pub const KECCAK256_RESULT_LEN: usize = 32; + +pub fn sha256(data: &[u8]) -> [u8; SHA256_RESULT_LEN] { + let mut hasher = Sha256::new(); + hasher.update(data); + hasher.finalize().into() +} + +pub fn keccak256(data: &[u8]) -> [u8; KECCAK256_RESULT_LEN] { + let mut hasher = Keccak256::new(); + hasher.update(data); + hasher.finalize().into() +} + +pub fn verify_ed25519(key: &[u8], message: &[u8], signature: &[u8]) -> bool { + use ed25519_dalek::{Signature, Verifier, VerifyingKey}; + + let key_32: [u8; 32] = if let Ok(key_32) = key.try_into() { + key_32 + } else { + return false; + }; + let signature_64: [u8; 64] = if let Ok(signature_64) = signature.try_into() { + signature_64 + } else { + return false; + }; + + let verifying_key_result = VerifyingKey::from_bytes(&key_32); + let verifying_key = if let Ok(verifying_key) = verifying_key_result { + verifying_key + } else { + return false; + }; + + let sig = Signature::from_bytes(&signature_64); + + let result = verifying_key.verify(message, &sig); + result.is_ok() +} diff --git a/vm/src/display_util.rs b/chain/vm/src/display_util.rs similarity index 100% rename from vm/src/display_util.rs rename to chain/vm/src/display_util.rs diff --git a/vm/src/lib.rs b/chain/vm/src/lib.rs similarity index 80% rename from vm/src/lib.rs rename to chain/vm/src/lib.rs index 48f9c288e1..51e8931642 100644 --- a/vm/src/lib.rs +++ b/chain/vm/src/lib.rs @@ -14,5 +14,8 @@ pub use world_mock::BlockchainMock; // Re-exporting the executor, for convenience. pub use multiversx_chain_vm_executor as executor; +// Re-exporting the VM-core, for convenience. +pub use multiversx_chain_core as chain_core; + #[macro_use] extern crate alloc; diff --git a/vm/src/mem_conv.rs b/chain/vm/src/mem_conv.rs similarity index 100% rename from vm/src/mem_conv.rs rename to chain/vm/src/mem_conv.rs diff --git a/vm/src/tx_execution.rs b/chain/vm/src/tx_execution.rs similarity index 100% rename from vm/src/tx_execution.rs rename to chain/vm/src/tx_execution.rs diff --git a/vm/src/tx_execution/blockchain_vm.rs b/chain/vm/src/tx_execution/blockchain_vm.rs similarity index 100% rename from vm/src/tx_execution/blockchain_vm.rs rename to chain/vm/src/tx_execution/blockchain_vm.rs diff --git a/vm/src/tx_execution/builtin_function_mocks.rs b/chain/vm/src/tx_execution/builtin_function_mocks.rs similarity index 70% rename from vm/src/tx_execution/builtin_function_mocks.rs rename to chain/vm/src/tx_execution/builtin_function_mocks.rs index dff42101cc..d50044d0c1 100644 --- a/vm/src/tx_execution/builtin_function_mocks.rs +++ b/chain/vm/src/tx_execution/builtin_function_mocks.rs @@ -3,8 +3,6 @@ mod builtin_func_trait; mod esdt_nft; mod general; mod transfer; -pub mod vm_builtin_function_names; pub use builtin_func_container::BuiltinFunctionContainer; pub use builtin_func_trait::{BuiltinFunction, BuiltinFunctionEsdtTransferInfo}; -pub use vm_builtin_function_names as builtin_function_names; diff --git a/vm/src/tx_execution/builtin_function_mocks/builtin_func_container.rs b/chain/vm/src/tx_execution/builtin_function_mocks/builtin_func_container.rs similarity index 99% rename from vm/src/tx_execution/builtin_function_mocks/builtin_func_container.rs rename to chain/vm/src/tx_execution/builtin_function_mocks/builtin_func_container.rs index 8b5a302377..39220d9722 100644 --- a/vm/src/tx_execution/builtin_function_mocks/builtin_func_container.rs +++ b/chain/vm/src/tx_execution/builtin_function_mocks/builtin_func_container.rs @@ -1,6 +1,5 @@ use super::{ builtin_func_trait::BuiltinFunction, - builtin_function_names::*, esdt_nft::{ ESDTLocalBurn, ESDTLocalMint, ESDTNftAddQuantity, ESDTNftAddUri, ESDTNftBurn, ESDTNftCreate, ESDTNftUpdateAttributes, @@ -9,12 +8,15 @@ use super::{ transfer::{ESDTMultiTransfer, ESDTNftTransfer, ESDTTransfer}, BuiltinFunctionEsdtTransferInfo, }; + use crate::{ tx_execution::BlockchainVMRef, tx_mock::{BlockchainUpdate, TxCache, TxInput, TxResult}, types::EsdtLocalRole, }; +use crate::chain_core::builtin_func_names::*; + /// Container for builtin function logic. /// /// Currently has no data, but could conceivably be configurable in the future. diff --git a/vm/src/tx_execution/builtin_function_mocks/builtin_func_trait.rs b/chain/vm/src/tx_execution/builtin_function_mocks/builtin_func_trait.rs similarity index 100% rename from vm/src/tx_execution/builtin_function_mocks/builtin_func_trait.rs rename to chain/vm/src/tx_execution/builtin_function_mocks/builtin_func_trait.rs diff --git a/vm/src/tx_execution/builtin_function_mocks/esdt_nft/esdt_local_burn.rs b/chain/vm/src/tx_execution/builtin_function_mocks/esdt_nft/esdt_local_burn.rs similarity index 88% rename from vm/src/tx_execution/builtin_function_mocks/esdt_nft/esdt_local_burn.rs rename to chain/vm/src/tx_execution/builtin_function_mocks/esdt_nft/esdt_local_burn.rs index 88d84f5681..f87af9f766 100644 --- a/vm/src/tx_execution/builtin_function_mocks/esdt_nft/esdt_local_burn.rs +++ b/chain/vm/src/tx_execution/builtin_function_mocks/esdt_nft/esdt_local_burn.rs @@ -1,7 +1,9 @@ +use multiversx_chain_core::types::ReturnCode; use num_bigint::BigUint; use crate::{ - tx_execution::{builtin_function_names::ESDT_LOCAL_BURN_FUNC_NAME, BlockchainVMRef}, + chain_core::builtin_func_names::ESDT_LOCAL_BURN_FUNC_NAME, + tx_execution::BlockchainVMRef, tx_mock::{BlockchainUpdate, TxCache, TxInput, TxLog, TxResult}, }; @@ -46,7 +48,7 @@ impl BuiltinFunction for ESDTLocalBurn { }; let tx_result = TxResult { - result_status: 0, + result_status: ReturnCode::Success, result_logs: vec![esdt_nft_create_log], ..Default::default() }; diff --git a/vm/src/tx_execution/builtin_function_mocks/esdt_nft/esdt_local_mint.rs b/chain/vm/src/tx_execution/builtin_function_mocks/esdt_nft/esdt_local_mint.rs similarity index 88% rename from vm/src/tx_execution/builtin_function_mocks/esdt_nft/esdt_local_mint.rs rename to chain/vm/src/tx_execution/builtin_function_mocks/esdt_nft/esdt_local_mint.rs index 73f35aef69..b82c7ca8b4 100644 --- a/vm/src/tx_execution/builtin_function_mocks/esdt_nft/esdt_local_mint.rs +++ b/chain/vm/src/tx_execution/builtin_function_mocks/esdt_nft/esdt_local_mint.rs @@ -1,8 +1,9 @@ +use multiversx_chain_core::types::ReturnCode; use num_bigint::BigUint; -use crate::tx_execution::{builtin_function_names::ESDT_LOCAL_MINT_FUNC_NAME, BlockchainVMRef}; - use crate::{ + chain_core::builtin_func_names::ESDT_LOCAL_MINT_FUNC_NAME, + tx_execution::BlockchainVMRef, tx_mock::{BlockchainUpdate, TxCache, TxInput, TxLog, TxResult}, world_mock::EsdtInstanceMetadata, }; @@ -50,7 +51,7 @@ impl BuiltinFunction for ESDTLocalMint { }; let tx_result = TxResult { - result_status: 0, + result_status: ReturnCode::Success, result_logs: vec![esdt_nft_create_log], ..Default::default() }; diff --git a/vm/src/tx_execution/builtin_function_mocks/esdt_nft/esdt_nft_add_quantity_mock.rs b/chain/vm/src/tx_execution/builtin_function_mocks/esdt_nft/esdt_nft_add_quantity_mock.rs similarity index 91% rename from vm/src/tx_execution/builtin_function_mocks/esdt_nft/esdt_nft_add_quantity_mock.rs rename to chain/vm/src/tx_execution/builtin_function_mocks/esdt_nft/esdt_nft_add_quantity_mock.rs index f462d64ef3..c773ee80bc 100644 --- a/vm/src/tx_execution/builtin_function_mocks/esdt_nft/esdt_nft_add_quantity_mock.rs +++ b/chain/vm/src/tx_execution/builtin_function_mocks/esdt_nft/esdt_nft_add_quantity_mock.rs @@ -1,13 +1,11 @@ +use multiversx_chain_core::types::ReturnCode; use num_bigint::BigUint; use crate::{ + chain_core::builtin_func_names::ESDT_NFT_ADD_QUANTITY_FUNC_NAME, tx_execution::BlockchainVMRef, - types::{top_decode_u64, top_encode_u64}, -}; - -use crate::{ - tx_execution::builtin_function_names::ESDT_NFT_ADD_QUANTITY_FUNC_NAME, tx_mock::{BlockchainUpdate, TxCache, TxInput, TxLog, TxResult}, + types::{top_decode_u64, top_encode_u64}, world_mock::EsdtInstanceMetadata, }; @@ -59,7 +57,7 @@ impl BuiltinFunction for ESDTNftAddQuantity { }; let tx_result = TxResult { - result_status: 0, + result_status: ReturnCode::Success, result_logs: vec![esdt_nft_create_log], ..Default::default() }; diff --git a/vm/src/tx_execution/builtin_function_mocks/esdt_nft/esdt_nft_add_uri_mock.rs b/chain/vm/src/tx_execution/builtin_function_mocks/esdt_nft/esdt_nft_add_uri_mock.rs similarity index 89% rename from vm/src/tx_execution/builtin_function_mocks/esdt_nft/esdt_nft_add_uri_mock.rs rename to chain/vm/src/tx_execution/builtin_function_mocks/esdt_nft/esdt_nft_add_uri_mock.rs index 19966902b4..9685063fc9 100644 --- a/vm/src/tx_execution/builtin_function_mocks/esdt_nft/esdt_nft_add_uri_mock.rs +++ b/chain/vm/src/tx_execution/builtin_function_mocks/esdt_nft/esdt_nft_add_uri_mock.rs @@ -1,5 +1,8 @@ +use multiversx_chain_core::types::ReturnCode; + use crate::{ - tx_execution::{builtin_function_names::ESDT_NFT_ADD_URI_FUNC_NAME, BlockchainVMRef}, + chain_core::builtin_func_names::ESDT_NFT_ADD_URI_FUNC_NAME, + tx_execution::BlockchainVMRef, tx_mock::{BlockchainUpdate, TxCache, TxInput, TxLog, TxResult}, types::{top_decode_u64, top_encode_u64}, }; @@ -52,7 +55,7 @@ impl BuiltinFunction for ESDTNftAddUri { }; let tx_result = TxResult { - result_status: 0, + result_status: ReturnCode::Success, result_logs: vec![esdt_nft_create_log], ..Default::default() }; diff --git a/vm/src/tx_execution/builtin_function_mocks/esdt_nft/esdt_nft_burn_mock.rs b/chain/vm/src/tx_execution/builtin_function_mocks/esdt_nft/esdt_nft_burn_mock.rs similarity index 90% rename from vm/src/tx_execution/builtin_function_mocks/esdt_nft/esdt_nft_burn_mock.rs rename to chain/vm/src/tx_execution/builtin_function_mocks/esdt_nft/esdt_nft_burn_mock.rs index 26ffe468a6..f92d89efbd 100644 --- a/vm/src/tx_execution/builtin_function_mocks/esdt_nft/esdt_nft_burn_mock.rs +++ b/chain/vm/src/tx_execution/builtin_function_mocks/esdt_nft/esdt_nft_burn_mock.rs @@ -1,7 +1,9 @@ +use multiversx_chain_core::types::ReturnCode; use num_bigint::BigUint; use crate::{ - tx_execution::{builtin_function_names::ESDT_NFT_BURN_FUNC_NAME, BlockchainVMRef}, + chain_core::builtin_func_names::ESDT_NFT_BURN_FUNC_NAME, + tx_execution::BlockchainVMRef, tx_mock::{BlockchainUpdate, TxCache, TxInput, TxLog, TxResult}, types::{top_decode_u64, top_encode_u64}, }; @@ -52,7 +54,7 @@ impl BuiltinFunction for ESDTNftBurn { }; let tx_result = TxResult { - result_status: 0, + result_status: ReturnCode::Success, result_logs: vec![esdt_nft_create_log], ..Default::default() }; diff --git a/vm/src/tx_execution/builtin_function_mocks/esdt_nft/esdt_nft_create_mock.rs b/chain/vm/src/tx_execution/builtin_function_mocks/esdt_nft/esdt_nft_create_mock.rs similarity index 93% rename from vm/src/tx_execution/builtin_function_mocks/esdt_nft/esdt_nft_create_mock.rs rename to chain/vm/src/tx_execution/builtin_function_mocks/esdt_nft/esdt_nft_create_mock.rs index 2f538c9e67..5966330213 100644 --- a/vm/src/tx_execution/builtin_function_mocks/esdt_nft/esdt_nft_create_mock.rs +++ b/chain/vm/src/tx_execution/builtin_function_mocks/esdt_nft/esdt_nft_create_mock.rs @@ -1,7 +1,9 @@ +use multiversx_chain_core::types::ReturnCode; use num_bigint::BigUint; use crate::{ - tx_execution::{builtin_function_names::ESDT_NFT_CREATE_FUNC_NAME, BlockchainVMRef}, + chain_core::builtin_func_names::ESDT_NFT_CREATE_FUNC_NAME, + tx_execution::BlockchainVMRef, tx_mock::{BlockchainUpdate, TxCache, TxInput, TxLog, TxResult}, types::{top_decode_u64, top_encode_u64}, world_mock::{EsdtInstance, EsdtInstanceMetadata}, @@ -78,7 +80,7 @@ impl BuiltinFunction for ESDTNftCreate { }; let tx_result = TxResult { - result_status: 0, + result_status: ReturnCode::Success, result_values: vec![top_encode_u64(new_nonce)], result_logs: vec![esdt_nft_create_log], ..Default::default() diff --git a/vm/src/tx_execution/builtin_function_mocks/esdt_nft/esdt_nft_update_attriutes_mock.rs b/chain/vm/src/tx_execution/builtin_function_mocks/esdt_nft/esdt_nft_update_attriutes_mock.rs similarity index 89% rename from vm/src/tx_execution/builtin_function_mocks/esdt_nft/esdt_nft_update_attriutes_mock.rs rename to chain/vm/src/tx_execution/builtin_function_mocks/esdt_nft/esdt_nft_update_attriutes_mock.rs index 49c2629cfb..42a6f965ae 100644 --- a/vm/src/tx_execution/builtin_function_mocks/esdt_nft/esdt_nft_update_attriutes_mock.rs +++ b/chain/vm/src/tx_execution/builtin_function_mocks/esdt_nft/esdt_nft_update_attriutes_mock.rs @@ -1,5 +1,8 @@ +use multiversx_chain_core::types::ReturnCode; + use crate::{ - tx_execution::{builtin_function_names::ESDT_NFT_UPDATE_ATTRIBUTES_FUNC_NAME, BlockchainVMRef}, + chain_core::builtin_func_names::ESDT_NFT_UPDATE_ATTRIBUTES_FUNC_NAME, + tx_execution::BlockchainVMRef, tx_mock::{BlockchainUpdate, TxCache, TxInput, TxLog, TxResult}, types::{top_decode_u64, top_encode_u64}, }; @@ -51,7 +54,7 @@ impl BuiltinFunction for ESDTNftUpdateAttributes { }; let tx_result = TxResult { - result_status: 0, + result_status: ReturnCode::Success, result_logs: vec![esdt_nft_create_log], ..Default::default() }; diff --git a/vm/src/tx_execution/builtin_function_mocks/esdt_nft/mod.rs b/chain/vm/src/tx_execution/builtin_function_mocks/esdt_nft/mod.rs similarity index 100% rename from vm/src/tx_execution/builtin_function_mocks/esdt_nft/mod.rs rename to chain/vm/src/tx_execution/builtin_function_mocks/esdt_nft/mod.rs diff --git a/vm/src/tx_execution/builtin_function_mocks/general.rs b/chain/vm/src/tx_execution/builtin_function_mocks/general.rs similarity index 100% rename from vm/src/tx_execution/builtin_function_mocks/general.rs rename to chain/vm/src/tx_execution/builtin_function_mocks/general.rs diff --git a/vm/src/tx_execution/builtin_function_mocks/general/change_owner_mock.rs b/chain/vm/src/tx_execution/builtin_function_mocks/general/change_owner_mock.rs similarity index 90% rename from vm/src/tx_execution/builtin_function_mocks/general/change_owner_mock.rs rename to chain/vm/src/tx_execution/builtin_function_mocks/general/change_owner_mock.rs index 8352b606cd..17d168a4cd 100644 --- a/vm/src/tx_execution/builtin_function_mocks/general/change_owner_mock.rs +++ b/chain/vm/src/tx_execution/builtin_function_mocks/general/change_owner_mock.rs @@ -1,8 +1,6 @@ -use crate::tx_execution::{ - builtin_function_names::CHANGE_OWNER_BUILTIN_FUNC_NAME, BlockchainVMRef, -}; - use crate::{ + chain_core::builtin_func_names::CHANGE_OWNER_BUILTIN_FUNC_NAME, + tx_execution::BlockchainVMRef, tx_mock::{BlockchainUpdate, TxCache, TxInput, TxResult}, types::VMAddress, }; diff --git a/vm/src/tx_execution/builtin_function_mocks/general/claim_developer_rewards_mock.rs b/chain/vm/src/tx_execution/builtin_function_mocks/general/claim_developer_rewards_mock.rs similarity index 89% rename from vm/src/tx_execution/builtin_function_mocks/general/claim_developer_rewards_mock.rs rename to chain/vm/src/tx_execution/builtin_function_mocks/general/claim_developer_rewards_mock.rs index 0b7e9c694f..3d705959f1 100644 --- a/vm/src/tx_execution/builtin_function_mocks/general/claim_developer_rewards_mock.rs +++ b/chain/vm/src/tx_execution/builtin_function_mocks/general/claim_developer_rewards_mock.rs @@ -1,10 +1,11 @@ -use crate::tx_execution::{ - builtin_function_names::CLAIM_DEVELOPER_REWARDS_FUNC_NAME, BlockchainVMRef, -}; use num_bigint::BigUint; use num_traits::Zero; -use crate::tx_mock::{BlockchainUpdate, TxCache, TxInput, TxResult}; +use crate::{ + chain_core::builtin_func_names::CLAIM_DEVELOPER_REWARDS_FUNC_NAME, + tx_execution::BlockchainVMRef, + tx_mock::{BlockchainUpdate, TxCache, TxInput, TxResult}, +}; use super::super::builtin_func_trait::BuiltinFunction; diff --git a/vm/src/tx_execution/builtin_function_mocks/general/delete_username_mock.rs b/chain/vm/src/tx_execution/builtin_function_mocks/general/delete_username_mock.rs similarity index 82% rename from vm/src/tx_execution/builtin_function_mocks/general/delete_username_mock.rs rename to chain/vm/src/tx_execution/builtin_function_mocks/general/delete_username_mock.rs index c697f76859..719454c20a 100644 --- a/vm/src/tx_execution/builtin_function_mocks/general/delete_username_mock.rs +++ b/chain/vm/src/tx_execution/builtin_function_mocks/general/delete_username_mock.rs @@ -1,6 +1,8 @@ -use crate::tx_execution::{builtin_function_names::DELETE_USERNAME_FUNC_NAME, BlockchainVMRef}; - -use crate::tx_mock::{BlockchainUpdate, TxCache, TxInput, TxResult}; +use crate::{ + chain_core::builtin_func_names::DELETE_USERNAME_FUNC_NAME, + tx_execution::BlockchainVMRef, + tx_mock::{BlockchainUpdate, TxCache, TxInput, TxResult}, +}; use super::super::builtin_func_trait::BuiltinFunction; diff --git a/vm/src/tx_execution/builtin_function_mocks/general/migrate_username_mock.rs b/chain/vm/src/tx_execution/builtin_function_mocks/general/migrate_username_mock.rs similarity index 93% rename from vm/src/tx_execution/builtin_function_mocks/general/migrate_username_mock.rs rename to chain/vm/src/tx_execution/builtin_function_mocks/general/migrate_username_mock.rs index ea7c5ec57a..8674aed324 100644 --- a/vm/src/tx_execution/builtin_function_mocks/general/migrate_username_mock.rs +++ b/chain/vm/src/tx_execution/builtin_function_mocks/general/migrate_username_mock.rs @@ -1,5 +1,5 @@ -use crate::tx_execution::{builtin_function_names::MIGRATE_USERNAME_FUNC_NAME, BlockchainVMRef}; - +use crate::chain_core::builtin_func_names::MIGRATE_USERNAME_FUNC_NAME; +use crate::tx_execution::BlockchainVMRef; use crate::tx_mock::{BlockchainUpdate, TxCache, TxInput, TxResult}; use super::super::builtin_func_trait::BuiltinFunction; diff --git a/vm/src/tx_execution/builtin_function_mocks/general/set_username_mock.rs b/chain/vm/src/tx_execution/builtin_function_mocks/general/set_username_mock.rs similarity index 91% rename from vm/src/tx_execution/builtin_function_mocks/general/set_username_mock.rs rename to chain/vm/src/tx_execution/builtin_function_mocks/general/set_username_mock.rs index 8df9d6316d..65e1c95f1e 100644 --- a/vm/src/tx_execution/builtin_function_mocks/general/set_username_mock.rs +++ b/chain/vm/src/tx_execution/builtin_function_mocks/general/set_username_mock.rs @@ -1,5 +1,5 @@ -use crate::tx_execution::{builtin_function_names::SET_USERNAME_FUNC_NAME, BlockchainVMRef}; - +use crate::chain_core::builtin_func_names::SET_USERNAME_FUNC_NAME; +use crate::tx_execution::BlockchainVMRef; use crate::tx_mock::{BlockchainUpdate, TxCache, TxInput, TxResult}; use super::super::builtin_func_trait::BuiltinFunction; diff --git a/vm/src/tx_execution/builtin_function_mocks/general/upgrade_contract.rs b/chain/vm/src/tx_execution/builtin_function_mocks/general/upgrade_contract.rs similarity index 94% rename from vm/src/tx_execution/builtin_function_mocks/general/upgrade_contract.rs rename to chain/vm/src/tx_execution/builtin_function_mocks/general/upgrade_contract.rs index 7de2032273..18ed1783ec 100644 --- a/vm/src/tx_execution/builtin_function_mocks/general/upgrade_contract.rs +++ b/chain/vm/src/tx_execution/builtin_function_mocks/general/upgrade_contract.rs @@ -1,8 +1,6 @@ -use crate::tx_execution::{ - builtin_function_names::UPGRADE_CONTRACT_FUNC_NAME, create_transfer_value_log, BlockchainVMRef, -}; - use crate::{ + chain_core::builtin_func_names::UPGRADE_CONTRACT_FUNC_NAME, + tx_execution::{create_transfer_value_log, BlockchainVMRef}, tx_mock::{BlockchainUpdate, CallType, TxCache, TxFunctionName, TxInput, TxResult}, types::VMCodeMetadata, }; diff --git a/vm/src/tx_execution/builtin_function_mocks/transfer/esdt_multi_transfer_mock.rs b/chain/vm/src/tx_execution/builtin_function_mocks/transfer/esdt_multi_transfer_mock.rs similarity index 97% rename from vm/src/tx_execution/builtin_function_mocks/transfer/esdt_multi_transfer_mock.rs rename to chain/vm/src/tx_execution/builtin_function_mocks/transfer/esdt_multi_transfer_mock.rs index 183819f372..0235d68f9e 100644 --- a/vm/src/tx_execution/builtin_function_mocks/transfer/esdt_multi_transfer_mock.rs +++ b/chain/vm/src/tx_execution/builtin_function_mocks/transfer/esdt_multi_transfer_mock.rs @@ -1,5 +1,6 @@ use crate::{ - tx_execution::{builtin_function_names::ESDT_MULTI_TRANSFER_FUNC_NAME, BlockchainVMRef}, + chain_core::builtin_func_names::ESDT_MULTI_TRANSFER_FUNC_NAME, + tx_execution::BlockchainVMRef, tx_mock::TxLog, types::{top_decode_u64, top_encode_u64}, }; diff --git a/vm/src/tx_execution/builtin_function_mocks/transfer/esdt_nft_transfer_mock.rs b/chain/vm/src/tx_execution/builtin_function_mocks/transfer/esdt_nft_transfer_mock.rs similarity index 95% rename from vm/src/tx_execution/builtin_function_mocks/transfer/esdt_nft_transfer_mock.rs rename to chain/vm/src/tx_execution/builtin_function_mocks/transfer/esdt_nft_transfer_mock.rs index 24d5925662..39bbe7f1cb 100644 --- a/vm/src/tx_execution/builtin_function_mocks/transfer/esdt_nft_transfer_mock.rs +++ b/chain/vm/src/tx_execution/builtin_function_mocks/transfer/esdt_nft_transfer_mock.rs @@ -1,8 +1,6 @@ use crate::{ - tx_execution::{ - builtin_function_names::ESDT_NFT_TRANSFER_FUNC_NAME, BlockchainVMRef, - BuiltinFunctionEsdtTransferInfo, - }, + chain_core::builtin_func_names::ESDT_NFT_TRANSFER_FUNC_NAME, + tx_execution::{BlockchainVMRef, BuiltinFunctionEsdtTransferInfo}, tx_mock::{BlockchainUpdate, TxCache, TxInput, TxLog, TxResult}, types::VMAddress, }; diff --git a/vm/src/tx_execution/builtin_function_mocks/transfer/esdt_transfer_mock.rs b/chain/vm/src/tx_execution/builtin_function_mocks/transfer/esdt_transfer_mock.rs similarity index 95% rename from vm/src/tx_execution/builtin_function_mocks/transfer/esdt_transfer_mock.rs rename to chain/vm/src/tx_execution/builtin_function_mocks/transfer/esdt_transfer_mock.rs index 8f5a912a2a..4d8bd08b2e 100644 --- a/vm/src/tx_execution/builtin_function_mocks/transfer/esdt_transfer_mock.rs +++ b/chain/vm/src/tx_execution/builtin_function_mocks/transfer/esdt_transfer_mock.rs @@ -1,8 +1,6 @@ use crate::{ - tx_execution::{ - builtin_function_names::ESDT_TRANSFER_FUNC_NAME, BlockchainVMRef, - BuiltinFunctionEsdtTransferInfo, - }, + chain_core::builtin_func_names::ESDT_TRANSFER_FUNC_NAME, + tx_execution::{BlockchainVMRef, BuiltinFunctionEsdtTransferInfo}, tx_mock::{BlockchainUpdate, TxCache, TxInput, TxLog, TxResult}, }; diff --git a/vm/src/tx_execution/builtin_function_mocks/transfer/mod.rs b/chain/vm/src/tx_execution/builtin_function_mocks/transfer/mod.rs similarity index 100% rename from vm/src/tx_execution/builtin_function_mocks/transfer/mod.rs rename to chain/vm/src/tx_execution/builtin_function_mocks/transfer/mod.rs diff --git a/vm/src/tx_execution/builtin_function_mocks/transfer/transfer_common.rs b/chain/vm/src/tx_execution/builtin_function_mocks/transfer/transfer_common.rs similarity index 100% rename from vm/src/tx_execution/builtin_function_mocks/transfer/transfer_common.rs rename to chain/vm/src/tx_execution/builtin_function_mocks/transfer/transfer_common.rs diff --git a/vm/src/tx_execution/exec_call.rs b/chain/vm/src/tx_execution/exec_call.rs similarity index 98% rename from vm/src/tx_execution/exec_call.rs rename to chain/vm/src/tx_execution/exec_call.rs index ffc48e12ae..1b8e50b855 100644 --- a/vm/src/tx_execution/exec_call.rs +++ b/chain/vm/src/tx_execution/exec_call.rs @@ -92,7 +92,7 @@ impl BlockchainVMRef { self.execute_builtin_function_or_default(tx_input, tx_cache, f) }); - if tx_result.result_status == 0 { + if tx_result.result_status.is_success() { blockchain_updates.apply(state); } @@ -155,7 +155,7 @@ impl BlockchainVMRef { // legacy async call // the async call also gets reset - if tx_result.result_status == 0 { + if tx_result.result_status.is_success() { if let Some(async_data) = pending_calls.async_call { let (async_result, callback_result) = self.execute_async_call_and_callback(async_data, state); diff --git a/vm/src/tx_execution/exec_contract_endpoint.rs b/chain/vm/src/tx_execution/exec_contract_endpoint.rs similarity index 100% rename from vm/src/tx_execution/exec_contract_endpoint.rs rename to chain/vm/src/tx_execution/exec_contract_endpoint.rs diff --git a/vm/src/tx_execution/exec_create.rs b/chain/vm/src/tx_execution/exec_create.rs similarity index 100% rename from vm/src/tx_execution/exec_create.rs rename to chain/vm/src/tx_execution/exec_create.rs diff --git a/vm/src/tx_execution/exec_general_tx.rs b/chain/vm/src/tx_execution/exec_general_tx.rs similarity index 100% rename from vm/src/tx_execution/exec_general_tx.rs rename to chain/vm/src/tx_execution/exec_general_tx.rs diff --git a/vm/src/tx_execution/system_sc.rs b/chain/vm/src/tx_execution/system_sc.rs similarity index 100% rename from vm/src/tx_execution/system_sc.rs rename to chain/vm/src/tx_execution/system_sc.rs diff --git a/vm/src/tx_execution/system_sc/system_sc_issue.rs b/chain/vm/src/tx_execution/system_sc/system_sc_issue.rs similarity index 100% rename from vm/src/tx_execution/system_sc/system_sc_issue.rs rename to chain/vm/src/tx_execution/system_sc/system_sc_issue.rs diff --git a/vm/src/tx_execution/system_sc/system_sc_special_roles.rs b/chain/vm/src/tx_execution/system_sc/system_sc_special_roles.rs similarity index 100% rename from vm/src/tx_execution/system_sc/system_sc_special_roles.rs rename to chain/vm/src/tx_execution/system_sc/system_sc_special_roles.rs diff --git a/vm/src/tx_execution/system_sc/system_sc_unimplemented.rs b/chain/vm/src/tx_execution/system_sc/system_sc_unimplemented.rs similarity index 100% rename from vm/src/tx_execution/system_sc/system_sc_unimplemented.rs rename to chain/vm/src/tx_execution/system_sc/system_sc_unimplemented.rs diff --git a/vm/src/tx_mock.rs b/chain/vm/src/tx_mock.rs similarity index 86% rename from vm/src/tx_mock.rs rename to chain/vm/src/tx_mock.rs index bd508d569e..ce63ddfe7a 100644 --- a/vm/src/tx_mock.rs +++ b/chain/vm/src/tx_mock.rs @@ -37,12 +37,12 @@ pub use tx_panic::*; pub use tx_result::*; pub use tx_result_calls::*; -#[cfg(feature = "wasm-incopatible")] +#[cfg(feature = "wasm-incompatible")] mod blockchain_rng; -#[cfg(feature = "wasm-incopatible")] +#[cfg(feature = "wasm-incompatible")] pub use blockchain_rng::BlockchainRng; -#[cfg(not(feature = "wasm-incopatible"))] +#[cfg(not(feature = "wasm-incompatible"))] mod blockchain_rng_unsupported; -#[cfg(not(feature = "wasm-incopatible"))] +#[cfg(not(feature = "wasm-incompatible"))] pub use blockchain_rng_unsupported::BlockchainRng; diff --git a/vm/src/tx_mock/blockchain_rng.rs b/chain/vm/src/tx_mock/blockchain_rng.rs similarity index 100% rename from vm/src/tx_mock/blockchain_rng.rs rename to chain/vm/src/tx_mock/blockchain_rng.rs diff --git a/vm/src/tx_mock/blockchain_rng_unsupported.rs b/chain/vm/src/tx_mock/blockchain_rng_unsupported.rs similarity index 87% rename from vm/src/tx_mock/blockchain_rng_unsupported.rs rename to chain/vm/src/tx_mock/blockchain_rng_unsupported.rs index 698be4ac11..6339cbaffc 100644 --- a/vm/src/tx_mock/blockchain_rng_unsupported.rs +++ b/chain/vm/src/tx_mock/blockchain_rng_unsupported.rs @@ -9,6 +9,6 @@ impl BlockchainRng { } pub fn next_bytes(&mut self, _length: usize) -> Vec { - panic!("BlockchainRng not supported for wasm builds, feature `wasm-incopatible` needs to be enabled") + panic!("BlockchainRng not supported for wasm builds, feature `wasm-incompatible` needs to be enabled") } } diff --git a/vm/src/tx_mock/blockchain_update.rs b/chain/vm/src/tx_mock/blockchain_update.rs similarity index 100% rename from vm/src/tx_mock/blockchain_update.rs rename to chain/vm/src/tx_mock/blockchain_update.rs diff --git a/vm/src/tx_mock/tx_async_call_data.rs b/chain/vm/src/tx_mock/tx_async_call_data.rs similarity index 95% rename from vm/src/tx_mock/tx_async_call_data.rs rename to chain/vm/src/tx_mock/tx_async_call_data.rs index 45cbce639c..ab1b744a3b 100644 --- a/vm/src/tx_mock/tx_async_call_data.rs +++ b/chain/vm/src/tx_mock/tx_async_call_data.rs @@ -56,8 +56,8 @@ pub fn async_callback_tx_input( async_result: &TxResult, builtin_functions: &BuiltinFunctionContainer, ) -> TxInput { - let mut args: Vec> = vec![result_status_bytes(async_result.result_status)]; - if async_result.result_status == 0 { + let mut args: Vec> = vec![result_status_bytes(async_result.result_status.as_u64())]; + if async_result.result_status.is_success() { args.extend_from_slice(async_result.result_values.as_slice()); } else { args.push(async_result.result_message.clone().into_bytes()); @@ -108,7 +108,7 @@ pub fn async_promise_callback_tx_input( async_result: &TxResult, builtin_functions: &BuiltinFunctionContainer, ) -> TxInput { - let callback_name = if async_result.result_status == 0 { + let callback_name = if async_result.result_status.is_success() { promise.success_callback.clone() } else { promise.error_callback.clone() @@ -122,7 +122,7 @@ pub fn async_promise_callback_tx_input( } pub fn merge_results(mut original: TxResult, mut new: TxResult) -> TxResult { - if original.result_status == 0 { + if original.result_status.is_success() { original.result_values.append(&mut new.result_values); original.result_logs.append(&mut new.result_logs); original.result_message = new.result_message; diff --git a/vm/src/tx_mock/tx_async_promise.rs b/chain/vm/src/tx_mock/tx_async_promise.rs similarity index 100% rename from vm/src/tx_mock/tx_async_promise.rs rename to chain/vm/src/tx_mock/tx_async_promise.rs diff --git a/vm/src/tx_mock/tx_back_transfers.rs b/chain/vm/src/tx_mock/tx_back_transfers.rs similarity index 100% rename from vm/src/tx_mock/tx_back_transfers.rs rename to chain/vm/src/tx_mock/tx_back_transfers.rs diff --git a/vm/src/tx_mock/tx_cache.rs b/chain/vm/src/tx_mock/tx_cache.rs similarity index 100% rename from vm/src/tx_mock/tx_cache.rs rename to chain/vm/src/tx_mock/tx_cache.rs diff --git a/vm/src/tx_mock/tx_cache_balance_util.rs b/chain/vm/src/tx_mock/tx_cache_balance_util.rs similarity index 100% rename from vm/src/tx_mock/tx_cache_balance_util.rs rename to chain/vm/src/tx_mock/tx_cache_balance_util.rs diff --git a/vm/src/tx_mock/tx_cache_source.rs b/chain/vm/src/tx_mock/tx_cache_source.rs similarity index 100% rename from vm/src/tx_mock/tx_cache_source.rs rename to chain/vm/src/tx_mock/tx_cache_source.rs diff --git a/vm/src/tx_mock/tx_context.rs b/chain/vm/src/tx_mock/tx_context.rs similarity index 100% rename from vm/src/tx_mock/tx_context.rs rename to chain/vm/src/tx_mock/tx_context.rs diff --git a/vm/src/tx_mock/tx_context_ref.rs b/chain/vm/src/tx_mock/tx_context_ref.rs similarity index 100% rename from vm/src/tx_mock/tx_context_ref.rs rename to chain/vm/src/tx_mock/tx_context_ref.rs diff --git a/vm/src/tx_mock/tx_context_stack.rs b/chain/vm/src/tx_mock/tx_context_stack.rs similarity index 100% rename from vm/src/tx_mock/tx_context_stack.rs rename to chain/vm/src/tx_mock/tx_context_stack.rs diff --git a/vm/src/tx_mock/tx_input.rs b/chain/vm/src/tx_mock/tx_input.rs similarity index 100% rename from vm/src/tx_mock/tx_input.rs rename to chain/vm/src/tx_mock/tx_input.rs diff --git a/vm/src/tx_mock/tx_input_call_type.rs b/chain/vm/src/tx_mock/tx_input_call_type.rs similarity index 100% rename from vm/src/tx_mock/tx_input_call_type.rs rename to chain/vm/src/tx_mock/tx_input_call_type.rs diff --git a/vm/src/tx_mock/tx_input_function.rs b/chain/vm/src/tx_mock/tx_input_function.rs similarity index 100% rename from vm/src/tx_mock/tx_input_function.rs rename to chain/vm/src/tx_mock/tx_input_function.rs diff --git a/vm/src/tx_mock/tx_log.rs b/chain/vm/src/tx_mock/tx_log.rs similarity index 100% rename from vm/src/tx_mock/tx_log.rs rename to chain/vm/src/tx_mock/tx_log.rs diff --git a/vm/src/tx_mock/tx_managed_types.rs b/chain/vm/src/tx_mock/tx_managed_types.rs similarity index 100% rename from vm/src/tx_mock/tx_managed_types.rs rename to chain/vm/src/tx_mock/tx_managed_types.rs diff --git a/vm/src/tx_mock/tx_managed_types/handle_map.rs b/chain/vm/src/tx_mock/tx_managed_types/handle_map.rs similarity index 100% rename from vm/src/tx_mock/tx_managed_types/handle_map.rs rename to chain/vm/src/tx_mock/tx_managed_types/handle_map.rs diff --git a/vm/src/tx_mock/tx_managed_types/tx_big_float.rs b/chain/vm/src/tx_mock/tx_managed_types/tx_big_float.rs similarity index 100% rename from vm/src/tx_mock/tx_managed_types/tx_big_float.rs rename to chain/vm/src/tx_mock/tx_managed_types/tx_big_float.rs diff --git a/vm/src/tx_mock/tx_managed_types/tx_big_int.rs b/chain/vm/src/tx_mock/tx_managed_types/tx_big_int.rs similarity index 100% rename from vm/src/tx_mock/tx_managed_types/tx_big_int.rs rename to chain/vm/src/tx_mock/tx_managed_types/tx_big_int.rs diff --git a/vm/src/tx_mock/tx_managed_types/tx_managed_buffer.rs b/chain/vm/src/tx_mock/tx_managed_types/tx_managed_buffer.rs similarity index 100% rename from vm/src/tx_mock/tx_managed_types/tx_managed_buffer.rs rename to chain/vm/src/tx_mock/tx_managed_types/tx_managed_buffer.rs diff --git a/vm/src/tx_mock/tx_managed_types/tx_managed_map.rs b/chain/vm/src/tx_mock/tx_managed_types/tx_managed_map.rs similarity index 100% rename from vm/src/tx_mock/tx_managed_types/tx_managed_map.rs rename to chain/vm/src/tx_mock/tx_managed_types/tx_managed_map.rs diff --git a/vm/src/tx_mock/tx_panic.rs b/chain/vm/src/tx_mock/tx_panic.rs similarity index 54% rename from vm/src/tx_mock/tx_panic.rs rename to chain/vm/src/tx_mock/tx_panic.rs index 63d1154558..86875f765f 100644 --- a/vm/src/tx_mock/tx_panic.rs +++ b/chain/vm/src/tx_mock/tx_panic.rs @@ -1,11 +1,13 @@ +use multiversx_chain_core::types::ReturnCode; + #[derive(Debug, Clone)] pub struct TxPanic { - pub status: u64, + pub status: ReturnCode, pub message: String, } impl TxPanic { - pub fn new(status: u64, message: &str) -> Self { + pub fn new(status: ReturnCode, message: &str) -> Self { Self { status, message: message.to_string(), @@ -13,10 +15,10 @@ impl TxPanic { } pub fn user_error(message: &str) -> TxPanic { - TxPanic::new(4, message) + TxPanic::new(ReturnCode::UserError, message) } pub fn vm_error(message: &str) -> TxPanic { - TxPanic::new(10, message) + TxPanic::new(ReturnCode::ExecutionFailed, message) } } diff --git a/vm/src/tx_mock/tx_result.rs b/chain/vm/src/tx_mock/tx_result.rs similarity index 90% rename from vm/src/tx_mock/tx_result.rs rename to chain/vm/src/tx_mock/tx_result.rs index 4234f3a207..68a5319948 100644 --- a/vm/src/tx_mock/tx_result.rs +++ b/chain/vm/src/tx_mock/tx_result.rs @@ -1,11 +1,13 @@ use std::fmt; +use multiversx_chain_core::types::ReturnCode; + use super::{AsyncCallTxData, TxLog, TxPanic, TxResultCalls}; #[derive(Clone, Debug)] #[must_use] pub struct TxResult { - pub result_status: u64, + pub result_status: ReturnCode, pub result_message: String, pub result_values: Vec>, pub result_logs: Vec, @@ -24,7 +26,7 @@ pub struct TxResult { impl Default for TxResult { fn default() -> Self { TxResult { - result_status: 0, + result_status: ReturnCode::Success, result_message: String::new(), result_values: Vec::new(), result_logs: Vec::new(), @@ -55,7 +57,7 @@ impl TxResult { pub fn from_panic_string(s: &str) -> Self { TxResult { - result_status: 4, + result_status: ReturnCode::UserError, result_message: s.to_string(), result_values: Vec::new(), result_logs: Vec::new(), @@ -72,7 +74,7 @@ impl TxResult { S: Into, { TxResult { - result_status: 10, + result_status: ReturnCode::ExecutionFailed, result_message: result_message.into(), ..Default::default() } @@ -94,7 +96,7 @@ impl TxResult { pub fn assert_ok(&self) { assert!( - self.result_status == 0, + self.result_status.is_success(), "Tx success expected, but failed. Status: {}, message: \"{}\"", self.result_status, self.result_message.as_str() @@ -111,7 +113,7 @@ impl TxResult { self.result_message.as_str() ); assert!( - self.result_status == expected_status, + self.result_status.as_u64() == expected_status, "Tx error status mismatch. Want status {}, message \"{}\". Have status {}, message \"{}\"", expected_status, expected_message, @@ -121,7 +123,7 @@ impl TxResult { } pub fn assert_user_error(&self, expected_message: &str) { - self.assert_error(4, expected_message); + self.assert_error(ReturnCode::UserError.as_u64(), expected_message); } } diff --git a/vm/src/tx_mock/tx_result_calls.rs b/chain/vm/src/tx_mock/tx_result_calls.rs similarity index 100% rename from vm/src/tx_mock/tx_result_calls.rs rename to chain/vm/src/tx_mock/tx_result_calls.rs diff --git a/vm/src/types.rs b/chain/vm/src/types.rs similarity index 55% rename from vm/src/types.rs rename to chain/vm/src/types.rs index d1ada0c0f6..9ab80284a5 100644 --- a/vm/src/types.rs +++ b/chain/vm/src/types.rs @@ -1,20 +1,14 @@ -mod vm_address; -mod vm_code_metadata; -mod vm_esdt_local_role; -mod vm_esdt_local_role_flags; -mod vm_h256; -mod vm_token_type; +pub use crate::chain_core::types::Address as VMAddress; +pub use crate::chain_core::types::CodeMetadata as VMCodeMetadata; +pub use crate::chain_core::types::EsdtLocalRole; +pub use crate::chain_core::types::EsdtLocalRoleFlags; +pub use crate::chain_core::types::TokenType as VMTokenType; +pub use crate::chain_core::types::H256; + +pub type RawHandle = i32; use num_bigint::BigUint; use num_traits::Zero; -pub use vm_address::VMAddress; -pub use vm_code_metadata::VMCodeMetadata; -pub use vm_esdt_local_role::EsdtLocalRole; -pub use vm_esdt_local_role_flags::EsdtLocalRoleFlags; -pub use vm_h256::H256; -pub use vm_token_type::VMTokenType; - -pub type RawHandle = i32; pub(crate) fn top_encode_u64(value: u64) -> Vec { top_encode_big_uint(&BigUint::from(value)) diff --git a/vm/src/vm_err_msg.rs b/chain/vm/src/vm_err_msg.rs similarity index 100% rename from vm/src/vm_err_msg.rs rename to chain/vm/src/vm_err_msg.rs diff --git a/vm/src/vm_hooks.rs b/chain/vm/src/vm_hooks.rs similarity index 100% rename from vm/src/vm_hooks.rs rename to chain/vm/src/vm_hooks.rs diff --git a/vm/src/vm_hooks/vh_dispatcher.rs b/chain/vm/src/vm_hooks/vh_dispatcher.rs similarity index 99% rename from vm/src/vm_hooks/vh_dispatcher.rs rename to chain/vm/src/vm_hooks/vh_dispatcher.rs index 46c5153819..1af9bfbb6a 100644 --- a/vm/src/vm_hooks/vh_dispatcher.rs +++ b/chain/vm/src/vm_hooks/vh_dispatcher.rs @@ -1883,7 +1883,7 @@ impl VMHooks for VMHooksDispatcher { ) -> i32 { panic!("Unavailable: managed_multi_transfer_esdt_nft_execute_by_user") } - + fn managed_verify_secp256r1( &self, key_handle: i32, diff --git a/vm/src/vm_hooks/vh_handler.rs b/chain/vm/src/vm_hooks/vh_handler.rs similarity index 100% rename from vm/src/vm_hooks/vh_handler.rs rename to chain/vm/src/vm_hooks/vh_handler.rs diff --git a/vm/src/vm_hooks/vh_handler/vh_blockchain.rs b/chain/vm/src/vm_hooks/vh_handler/vh_blockchain.rs similarity index 99% rename from vm/src/vm_hooks/vh_handler/vh_blockchain.rs rename to chain/vm/src/vm_hooks/vh_handler/vh_blockchain.rs index 43940d4a57..5dcd5e7c0d 100644 --- a/vm/src/vm_hooks/vh_handler/vh_blockchain.rs +++ b/chain/vm/src/vm_hooks/vh_handler/vh_blockchain.rs @@ -1,5 +1,5 @@ use crate::{ - tx_execution::vm_builtin_function_names::*, + chain_core::builtin_func_names::*, types::{EsdtLocalRole, EsdtLocalRoleFlags, RawHandle, VMAddress}, vm_hooks::VMHooksHandlerSource, world_mock::{EsdtData, EsdtInstance}, diff --git a/vm/src/vm_hooks/vh_handler/vh_call_value.rs b/chain/vm/src/vm_hooks/vh_handler/vh_call_value.rs similarity index 100% rename from vm/src/vm_hooks/vh_handler/vh_call_value.rs rename to chain/vm/src/vm_hooks/vh_handler/vh_call_value.rs diff --git a/vm/src/vm_hooks/vh_handler/vh_crypto.rs b/chain/vm/src/vm_hooks/vh_handler/vh_crypto.rs similarity index 100% rename from vm/src/vm_hooks/vh_handler/vh_crypto.rs rename to chain/vm/src/vm_hooks/vh_handler/vh_crypto.rs diff --git a/vm/src/vm_hooks/vh_handler/vh_endpoint_arg.rs b/chain/vm/src/vm_hooks/vh_handler/vh_endpoint_arg.rs similarity index 100% rename from vm/src/vm_hooks/vh_handler/vh_endpoint_arg.rs rename to chain/vm/src/vm_hooks/vh_handler/vh_endpoint_arg.rs diff --git a/vm/src/vm_hooks/vh_handler/vh_endpoint_finish.rs b/chain/vm/src/vm_hooks/vh_handler/vh_endpoint_finish.rs similarity index 100% rename from vm/src/vm_hooks/vh_handler/vh_endpoint_finish.rs rename to chain/vm/src/vm_hooks/vh_handler/vh_endpoint_finish.rs diff --git a/vm/src/vm_hooks/vh_handler/vh_error.rs b/chain/vm/src/vm_hooks/vh_handler/vh_error.rs similarity index 81% rename from vm/src/vm_hooks/vh_handler/vh_error.rs rename to chain/vm/src/vm_hooks/vh_handler/vh_error.rs index ac1b4b4448..9b72740c94 100644 --- a/vm/src/vm_hooks/vh_handler/vh_error.rs +++ b/chain/vm/src/vm_hooks/vh_handler/vh_error.rs @@ -1,3 +1,5 @@ +use multiversx_chain_core::types::ReturnCode; + use crate::{types::RawHandle, vm_hooks::VMHooksHandlerSource}; use super::VMHooksManagedTypes; @@ -8,7 +10,7 @@ pub trait VMHooksError: VMHooksHandlerSource { // run `clear & cargo test -- --nocapture` to see the output println!("{}", std::str::from_utf8(message).unwrap()); - self.halt_with_error(4, std::str::from_utf8(message).unwrap()) + self.halt_with_error(ReturnCode::UserError, std::str::from_utf8(message).unwrap()) } } diff --git a/vm/src/vm_hooks/vh_handler/vh_log.rs b/chain/vm/src/vm_hooks/vh_handler/vh_log.rs similarity index 100% rename from vm/src/vm_hooks/vh_handler/vh_log.rs rename to chain/vm/src/vm_hooks/vh_handler/vh_log.rs diff --git a/vm/src/vm_hooks/vh_handler/vh_managed_types.rs b/chain/vm/src/vm_hooks/vh_handler/vh_managed_types.rs similarity index 100% rename from vm/src/vm_hooks/vh_handler/vh_managed_types.rs rename to chain/vm/src/vm_hooks/vh_handler/vh_managed_types.rs diff --git a/vm/src/vm_hooks/vh_handler/vh_managed_types/vh_big_float.rs b/chain/vm/src/vm_hooks/vh_handler/vh_managed_types/vh_big_float.rs similarity index 100% rename from vm/src/vm_hooks/vh_handler/vh_managed_types/vh_big_float.rs rename to chain/vm/src/vm_hooks/vh_handler/vh_managed_types/vh_big_float.rs diff --git a/vm/src/vm_hooks/vh_handler/vh_managed_types/vh_big_int.rs b/chain/vm/src/vm_hooks/vh_handler/vh_managed_types/vh_big_int.rs similarity index 100% rename from vm/src/vm_hooks/vh_handler/vh_managed_types/vh_big_int.rs rename to chain/vm/src/vm_hooks/vh_handler/vh_managed_types/vh_big_int.rs diff --git a/vm/src/vm_hooks/vh_handler/vh_managed_types/vh_managed_buffer.rs b/chain/vm/src/vm_hooks/vh_handler/vh_managed_types/vh_managed_buffer.rs similarity index 100% rename from vm/src/vm_hooks/vh_handler/vh_managed_types/vh_managed_buffer.rs rename to chain/vm/src/vm_hooks/vh_handler/vh_managed_types/vh_managed_buffer.rs diff --git a/vm/src/vm_hooks/vh_handler/vh_managed_types/vh_managed_map.rs b/chain/vm/src/vm_hooks/vh_handler/vh_managed_types/vh_managed_map.rs similarity index 100% rename from vm/src/vm_hooks/vh_handler/vh_managed_types/vh_managed_map.rs rename to chain/vm/src/vm_hooks/vh_handler/vh_managed_types/vh_managed_map.rs diff --git a/vm/src/vm_hooks/vh_handler/vh_send.rs b/chain/vm/src/vm_hooks/vh_handler/vh_send.rs similarity index 99% rename from vm/src/vm_hooks/vh_handler/vh_send.rs rename to chain/vm/src/vm_hooks/vh_handler/vh_send.rs index 4d0584586b..67d590f772 100644 --- a/vm/src/vm_hooks/vh_handler/vh_send.rs +++ b/chain/vm/src/vm_hooks/vh_handler/vh_send.rs @@ -1,5 +1,5 @@ use crate::{ - tx_execution::builtin_function_names::{ + chain_core::builtin_func_names::{ ESDT_MULTI_TRANSFER_FUNC_NAME, ESDT_NFT_TRANSFER_FUNC_NAME, ESDT_TRANSFER_FUNC_NAME, UPGRADE_CONTRACT_FUNC_NAME, }, diff --git a/vm/src/vm_hooks/vh_handler/vh_storage.rs b/chain/vm/src/vm_hooks/vh_handler/vh_storage.rs similarity index 100% rename from vm/src/vm_hooks/vh_handler/vh_storage.rs rename to chain/vm/src/vm_hooks/vh_handler/vh_storage.rs diff --git a/vm/src/vm_hooks/vh_impl.rs b/chain/vm/src/vm_hooks/vh_impl.rs similarity index 100% rename from vm/src/vm_hooks/vh_impl.rs rename to chain/vm/src/vm_hooks/vh_impl.rs diff --git a/vm/src/vm_hooks/vh_impl/vh_debug_api.rs b/chain/vm/src/vm_hooks/vh_impl/vh_debug_api.rs similarity index 93% rename from vm/src/vm_hooks/vh_impl/vh_debug_api.rs rename to chain/vm/src/vm_hooks/vh_impl/vh_debug_api.rs index 618788d966..20ba8d20b3 100644 --- a/vm/src/vm_hooks/vh_impl/vh_debug_api.rs +++ b/chain/vm/src/vm_hooks/vh_impl/vh_debug_api.rs @@ -1,5 +1,6 @@ use std::sync::{Arc, MutexGuard}; +use multiversx_chain_core::types::ReturnCode; use multiversx_chain_vm_executor::BreakpointValue; use crate::{ @@ -36,10 +37,10 @@ impl VMHooksHandlerSource for DebugApiVMHooksHandler { self.0.m_types_lock() } - fn halt_with_error(&self, status: u64, message: &str) -> ! { + fn halt_with_error(&self, status: ReturnCode, message: &str) -> ! { *self.0.result_lock() = TxResult::from_panic_obj(&TxPanic::new(status, message)); let breakpoint = match status { - 4 => BreakpointValue::SignalError, + ReturnCode::UserError => BreakpointValue::SignalError, _ => BreakpointValue::ExecutionFailed, }; std::panic::panic_any(breakpoint); @@ -127,7 +128,7 @@ impl VMHooksHandlerSource for DebugApiVMHooksHandler { execute_current_tx_context_input, ); - if tx_result.result_status == 0 { + if tx_result.result_status.is_success() { self.sync_call_post_processing(tx_result, blockchain_updates) } else { // also kill current execution @@ -168,11 +169,11 @@ impl VMHooksHandlerSource for DebugApiVMHooksHandler { ); match tx_result.result_status { - 0 => ( + ReturnCode::Success => ( new_address, self.sync_call_post_processing(tx_result, blockchain_updates), ), - 10 => self.vm_error(&tx_result.result_message), // TODO: not sure it's the right condition, it catches insufficient funds + ReturnCode::ExecutionFailed => self.vm_error(&tx_result.result_message), // TODO: not sure it's the right condition, it catches insufficient funds _ => self.vm_error(vm_err_msg::ERROR_SIGNALLED_BY_SMARTCONTRACT), } } @@ -198,12 +199,12 @@ impl VMHooksHandlerSource for DebugApiVMHooksHandler { ); match tx_result.result_status { - 0 => { + ReturnCode::Success => { self.0.result_lock().all_calls.push(async_call_data); let _ = self.sync_call_post_processing(tx_result, blockchain_updates); }, - 10 => self.vm_error(&tx_result.result_message), // TODO: not sure it's the right condition, it catches insufficient funds + ReturnCode::ExecutionFailed => self.vm_error(&tx_result.result_message), // TODO: not sure it's the right condition, it catches insufficient funds _ => self.vm_error(vm_err_msg::ERROR_SIGNALLED_BY_SMARTCONTRACT), } } diff --git a/vm/src/vm_hooks/vh_impl/vh_single_tx_api.rs b/chain/vm/src/vm_hooks/vh_impl/vh_single_tx_api.rs similarity index 97% rename from vm/src/vm_hooks/vh_impl/vh_single_tx_api.rs rename to chain/vm/src/vm_hooks/vh_impl/vh_single_tx_api.rs index 27fa484a4a..d29eb20ef4 100644 --- a/vm/src/vm_hooks/vh_impl/vh_single_tx_api.rs +++ b/chain/vm/src/vm_hooks/vh_impl/vh_single_tx_api.rs @@ -3,6 +3,8 @@ use std::{ sync::{Arc, Mutex, MutexGuard}, }; +use multiversx_chain_core::types::ReturnCode; + use crate::{ tx_mock::{BackTransfers, TxFunctionName, TxInput, TxManagedTypes, TxResult}, types::{VMAddress, VMCodeMetadata}, @@ -57,7 +59,7 @@ impl VMHooksHandlerSource for SingleTxApiVMHooksHandler { self.0.managed_types.lock().unwrap() } - fn halt_with_error(&self, status: u64, message: &str) -> ! { + fn halt_with_error(&self, status: ReturnCode, message: &str) -> ! { panic!("VM error occured, status: {status}, message: {message}") } diff --git a/vm/src/vm_hooks/vh_impl/vh_static_api.rs b/chain/vm/src/vm_hooks/vh_impl/vh_static_api.rs similarity index 97% rename from vm/src/vm_hooks/vh_impl/vh_static_api.rs rename to chain/vm/src/vm_hooks/vh_impl/vh_static_api.rs index aba07908e0..9f9a445b37 100644 --- a/vm/src/vm_hooks/vh_impl/vh_static_api.rs +++ b/chain/vm/src/vm_hooks/vh_impl/vh_static_api.rs @@ -1,5 +1,7 @@ use std::sync::{Mutex, MutexGuard}; +use multiversx_chain_core::types::ReturnCode; + use crate::{ tx_mock::{BackTransfers, TxFunctionName, TxInput, TxLog, TxManagedTypes, TxResult}, types::{VMAddress, VMCodeMetadata}, @@ -28,7 +30,7 @@ impl VMHooksHandlerSource for StaticApiVMHooksHandler { self.0.lock().unwrap() } - fn halt_with_error(&self, status: u64, message: &str) -> ! { + fn halt_with_error(&self, status: ReturnCode, message: &str) -> ! { panic!("VM error occured, status: {status}, message: {message}") } diff --git a/vm/src/vm_hooks/vh_source.rs b/chain/vm/src/vm_hooks/vh_source.rs similarity index 93% rename from vm/src/vm_hooks/vh_source.rs rename to chain/vm/src/vm_hooks/vh_source.rs index 0ad2e59e2a..7370c09e87 100644 --- a/vm/src/vm_hooks/vh_source.rs +++ b/chain/vm/src/vm_hooks/vh_source.rs @@ -1,5 +1,7 @@ use std::{fmt::Debug, sync::MutexGuard}; +use multiversx_chain_core::types::ReturnCode; + use crate::{ tx_mock::{BackTransfers, TxFunctionName, TxInput, TxLog, TxManagedTypes, TxResult}, types::{VMAddress, VMCodeMetadata, H256}, @@ -10,10 +12,10 @@ use crate::{ pub trait VMHooksHandlerSource: Debug { fn m_types_lock(&self) -> MutexGuard; - fn halt_with_error(&self, status: u64, message: &str) -> !; + fn halt_with_error(&self, status: ReturnCode, message: &str) -> !; fn vm_error(&self, message: &str) -> ! { - self.halt_with_error(10, message) + self.halt_with_error(ReturnCode::ExecutionFailed, message) } fn input_ref(&self) -> &TxInput; diff --git a/vm/src/with_shared.rs b/chain/vm/src/with_shared.rs similarity index 100% rename from vm/src/with_shared.rs rename to chain/vm/src/with_shared.rs diff --git a/vm/src/with_shared/shareable.rs b/chain/vm/src/with_shared/shareable.rs similarity index 100% rename from vm/src/with_shared/shareable.rs rename to chain/vm/src/with_shared/shareable.rs diff --git a/vm/src/with_shared/with_shared_mut_ref.rs b/chain/vm/src/with_shared/with_shared_mut_ref.rs similarity index 100% rename from vm/src/with_shared/with_shared_mut_ref.rs rename to chain/vm/src/with_shared/with_shared_mut_ref.rs diff --git a/vm/src/world_mock.rs b/chain/vm/src/world_mock.rs similarity index 100% rename from vm/src/world_mock.rs rename to chain/vm/src/world_mock.rs diff --git a/vm/src/world_mock/account_data.rs b/chain/vm/src/world_mock/account_data.rs similarity index 100% rename from vm/src/world_mock/account_data.rs rename to chain/vm/src/world_mock/account_data.rs diff --git a/vm/src/world_mock/block_info.rs b/chain/vm/src/world_mock/block_info.rs similarity index 100% rename from vm/src/world_mock/block_info.rs rename to chain/vm/src/world_mock/block_info.rs diff --git a/vm/src/world_mock/blockchain_mock.rs b/chain/vm/src/world_mock/blockchain_mock.rs similarity index 100% rename from vm/src/world_mock/blockchain_mock.rs rename to chain/vm/src/world_mock/blockchain_mock.rs diff --git a/vm/src/world_mock/blockchain_mock_account_util.rs b/chain/vm/src/world_mock/blockchain_mock_account_util.rs similarity index 100% rename from vm/src/world_mock/blockchain_mock_account_util.rs rename to chain/vm/src/world_mock/blockchain_mock_account_util.rs diff --git a/vm/src/world_mock/blockchain_state.rs b/chain/vm/src/world_mock/blockchain_state.rs similarity index 100% rename from vm/src/world_mock/blockchain_state.rs rename to chain/vm/src/world_mock/blockchain_state.rs diff --git a/vm/src/world_mock/esdt_data.rs b/chain/vm/src/world_mock/esdt_data.rs similarity index 100% rename from vm/src/world_mock/esdt_data.rs rename to chain/vm/src/world_mock/esdt_data.rs diff --git a/vm/src/world_mock/esdt_instance.rs b/chain/vm/src/world_mock/esdt_instance.rs similarity index 100% rename from vm/src/world_mock/esdt_instance.rs rename to chain/vm/src/world_mock/esdt_instance.rs diff --git a/vm/src/world_mock/esdt_instance_metadata.rs b/chain/vm/src/world_mock/esdt_instance_metadata.rs similarity index 100% rename from vm/src/world_mock/esdt_instance_metadata.rs rename to chain/vm/src/world_mock/esdt_instance_metadata.rs diff --git a/vm/src/world_mock/esdt_instances.rs b/chain/vm/src/world_mock/esdt_instances.rs similarity index 100% rename from vm/src/world_mock/esdt_instances.rs rename to chain/vm/src/world_mock/esdt_instances.rs diff --git a/vm/src/world_mock/esdt_roles.rs b/chain/vm/src/world_mock/esdt_roles.rs similarity index 100% rename from vm/src/world_mock/esdt_roles.rs rename to chain/vm/src/world_mock/esdt_roles.rs diff --git a/vm/src/world_mock/failing_executor.rs b/chain/vm/src/world_mock/failing_executor.rs similarity index 100% rename from vm/src/world_mock/failing_executor.rs rename to chain/vm/src/world_mock/failing_executor.rs diff --git a/vm/src/world_mock/reserved.rs b/chain/vm/src/world_mock/reserved.rs similarity index 100% rename from vm/src/world_mock/reserved.rs rename to chain/vm/src/world_mock/reserved.rs diff --git a/vm/tests/test_crypto.rs b/chain/vm/tests/test_crypto.rs similarity index 100% rename from vm/tests/test_crypto.rs rename to chain/vm/tests/test_crypto.rs diff --git a/contracts/benchmarks/large-storage/Cargo.toml b/contracts/benchmarks/large-storage/Cargo.toml index f1e1b7b64e..3839cb0cce 100644 --- a/contracts/benchmarks/large-storage/Cargo.toml +++ b/contracts/benchmarks/large-storage/Cargo.toml @@ -9,9 +9,9 @@ publish = false path = "src/large_storage.rs" [dependencies.multiversx-sc] -version = "0.51.1" +version = "0.54.1" path = "../../../framework/base" [dev-dependencies.multiversx-sc-scenario] -version = "0.51.1" +version = "0.54.1" path = "../../../framework/scenario" diff --git a/contracts/benchmarks/large-storage/meta/Cargo.toml b/contracts/benchmarks/large-storage/meta/Cargo.toml index a6a8d9e7aa..a49565f5dc 100644 --- a/contracts/benchmarks/large-storage/meta/Cargo.toml +++ b/contracts/benchmarks/large-storage/meta/Cargo.toml @@ -8,6 +8,6 @@ publish = false path = ".." [dependencies.multiversx-sc-meta-lib] -version = "0.51.1" +version = "0.54.1" path = "../../../../framework/meta-lib" default-features = false diff --git a/contracts/benchmarks/large-storage/tests/large_storage_scenario_rs_test.rs b/contracts/benchmarks/large-storage/tests/large_storage_scenario_rs_test.rs index 4a74775c67..38297fd2f2 100644 --- a/contracts/benchmarks/large-storage/tests/large_storage_scenario_rs_test.rs +++ b/contracts/benchmarks/large-storage/tests/large_storage_scenario_rs_test.rs @@ -2,6 +2,7 @@ use multiversx_sc_scenario::*; fn world() -> ScenarioWorld { let mut blockchain = ScenarioWorld::new(); + blockchain.set_current_dir_from_workspace("contracts/benchmarks/large-storage"); blockchain.register_contract( "mxsc:output/large-storage.mxsc.json", large_storage::ContractBuilder, diff --git a/contracts/benchmarks/large-storage/wasm/Cargo.lock b/contracts/benchmarks/large-storage/wasm/Cargo.lock index 289ec8cd46..cc64c94b71 100755 --- a/contracts/benchmarks/large-storage/wasm/Cargo.lock +++ b/contracts/benchmarks/large-storage/wasm/Cargo.lock @@ -4,15 +4,15 @@ version = 3 [[package]] name = "arrayvec" -version = "0.7.4" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" +checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" [[package]] name = "autocfg" -version = "1.3.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" +checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" [[package]] name = "bitflags" @@ -53,12 +53,21 @@ dependencies = [ "multiversx-sc-wasm-adapter", ] +[[package]] +name = "multiversx-chain-core" +version = "0.11.0" +dependencies = [ + "bitflags", + "multiversx-sc-codec", +] + [[package]] name = "multiversx-sc" -version = "0.51.1" +version = "0.54.1" dependencies = [ "bitflags", "hex-literal", + "multiversx-chain-core", "multiversx-sc-codec", "multiversx-sc-derive", "num-traits", @@ -67,7 +76,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.20.0" +version = "0.21.0" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -76,7 +85,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.20.0" +version = "0.21.0" dependencies = [ "hex", "proc-macro2", @@ -86,7 +95,7 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.51.1" +version = "0.54.1" dependencies = [ "hex", "proc-macro2", @@ -97,7 +106,7 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.51.1" +version = "0.54.1" dependencies = [ "multiversx-sc", ] @@ -131,9 +140,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.36" +version = "1.0.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" +checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" dependencies = [ "proc-macro2", ] @@ -156,9 +165,9 @@ checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "syn" -version = "2.0.68" +version = "2.0.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "901fa70d88b9d6c98022e23b4136f9f3e54e4662c3bc1bd1d84a42a9a0f0c1e9" +checksum = "9f35bcdf61fd8e7be6caf75f429fdca8beb3ed76584befb503b1569faee373ed" dependencies = [ "proc-macro2", "quote", @@ -167,9 +176,9 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.12" +version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" +checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" [[package]] name = "unwrap-infallible" diff --git a/contracts/benchmarks/large-storage/wasm/Cargo.toml b/contracts/benchmarks/large-storage/wasm/Cargo.toml index c481293914..232c4e755a 100644 --- a/contracts/benchmarks/large-storage/wasm/Cargo.toml +++ b/contracts/benchmarks/large-storage/wasm/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.51.1" +version = "0.54.1" path = "../../../../framework/wasm-adapter" [workspace] diff --git a/contracts/benchmarks/mappers/benchmark-common/Cargo.toml b/contracts/benchmarks/mappers/benchmark-common/Cargo.toml index e3fcca37fc..9d4937e5bd 100644 --- a/contracts/benchmarks/mappers/benchmark-common/Cargo.toml +++ b/contracts/benchmarks/mappers/benchmark-common/Cargo.toml @@ -9,9 +9,9 @@ publish = false path = "src/lib.rs" [dependencies.multiversx-sc] -version = "0.51.1" +version = "0.54.1" path = "../../../../framework/base" [dev-dependencies.multiversx-sc-scenario] -version = "0.51.1" +version = "0.54.1" path = "../../../../framework/scenario" diff --git a/contracts/benchmarks/mappers/linked-list-repeat/Cargo.toml b/contracts/benchmarks/mappers/linked-list-repeat/Cargo.toml index 1f18cd76d5..01ec3a47a0 100644 --- a/contracts/benchmarks/mappers/linked-list-repeat/Cargo.toml +++ b/contracts/benchmarks/mappers/linked-list-repeat/Cargo.toml @@ -13,9 +13,9 @@ path = "../benchmark-common" [dependencies.multiversx-sc] -version = "0.51.1" +version = "0.54.1" path = "../../../../framework/base" [dev-dependencies.multiversx-sc-scenario] -version = "0.51.1" +version = "0.54.1" path = "../../../../framework/scenario" diff --git a/contracts/benchmarks/mappers/linked-list-repeat/meta/Cargo.toml b/contracts/benchmarks/mappers/linked-list-repeat/meta/Cargo.toml index ab3f7debd9..08d13ad501 100644 --- a/contracts/benchmarks/mappers/linked-list-repeat/meta/Cargo.toml +++ b/contracts/benchmarks/mappers/linked-list-repeat/meta/Cargo.toml @@ -9,6 +9,6 @@ publish = false path = ".." [dependencies.multiversx-sc-meta-lib] -version = "0.51.1" +version = "0.54.1" path = "../../../../../framework/meta-lib" default-features = false diff --git a/contracts/benchmarks/mappers/linked-list-repeat/tests/linked_list_repeat_blackbox_test.rs b/contracts/benchmarks/mappers/linked-list-repeat/tests/linked_list_repeat_blackbox_test.rs index aa2edf237f..65f2b9c8af 100644 --- a/contracts/benchmarks/mappers/linked-list-repeat/tests/linked_list_repeat_blackbox_test.rs +++ b/contracts/benchmarks/mappers/linked-list-repeat/tests/linked_list_repeat_blackbox_test.rs @@ -8,6 +8,7 @@ const OWNER_ADDRESS: TestAddress = TestAddress::new("owner"); fn world() -> ScenarioWorld { let mut blockchain = ScenarioWorld::new(); + blockchain.set_current_dir_from_workspace("contracts/benchmarks/mappers/linked-list-repeat"); blockchain.register_contract(WASM_PATH, linked_list_repeat::ContractBuilder); blockchain diff --git a/contracts/benchmarks/mappers/linked-list-repeat/tests/scenario_rs_test.rs b/contracts/benchmarks/mappers/linked-list-repeat/tests/scenario_rs_test.rs index 442754a06b..c7b91be79e 100644 --- a/contracts/benchmarks/mappers/linked-list-repeat/tests/scenario_rs_test.rs +++ b/contracts/benchmarks/mappers/linked-list-repeat/tests/scenario_rs_test.rs @@ -2,6 +2,7 @@ use multiversx_sc_scenario::*; fn world() -> ScenarioWorld { let mut blockchain = ScenarioWorld::new(); + blockchain.set_current_dir_from_workspace("contracts/benchmarks/mappers/linked-list-repeat"); blockchain.register_contract( "mxsc:output/linked-list-repeat.mxsc.json", diff --git a/contracts/benchmarks/mappers/linked-list-repeat/wasm/Cargo.lock b/contracts/benchmarks/mappers/linked-list-repeat/wasm/Cargo.lock index c5198ccc73..a0400bf725 100644 --- a/contracts/benchmarks/mappers/linked-list-repeat/wasm/Cargo.lock +++ b/contracts/benchmarks/mappers/linked-list-repeat/wasm/Cargo.lock @@ -4,15 +4,15 @@ version = 3 [[package]] name = "arrayvec" -version = "0.7.4" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" +checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" [[package]] name = "autocfg" -version = "1.3.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" +checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" [[package]] name = "benchmark-common" @@ -61,12 +61,21 @@ dependencies = [ "multiversx-sc-wasm-adapter", ] +[[package]] +name = "multiversx-chain-core" +version = "0.11.0" +dependencies = [ + "bitflags", + "multiversx-sc-codec", +] + [[package]] name = "multiversx-sc" -version = "0.51.1" +version = "0.54.1" dependencies = [ "bitflags", "hex-literal", + "multiversx-chain-core", "multiversx-sc-codec", "multiversx-sc-derive", "num-traits", @@ -75,7 +84,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.20.0" +version = "0.21.0" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -84,7 +93,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.20.0" +version = "0.21.0" dependencies = [ "hex", "proc-macro2", @@ -94,7 +103,7 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.51.1" +version = "0.54.1" dependencies = [ "hex", "proc-macro2", @@ -105,7 +114,7 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.51.1" +version = "0.54.1" dependencies = [ "multiversx-sc", ] @@ -139,9 +148,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.36" +version = "1.0.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" +checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" dependencies = [ "proc-macro2", ] @@ -164,9 +173,9 @@ checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "syn" -version = "2.0.68" +version = "2.0.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "901fa70d88b9d6c98022e23b4136f9f3e54e4662c3bc1bd1d84a42a9a0f0c1e9" +checksum = "9f35bcdf61fd8e7be6caf75f429fdca8beb3ed76584befb503b1569faee373ed" dependencies = [ "proc-macro2", "quote", @@ -175,9 +184,9 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.12" +version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" +checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" [[package]] name = "unwrap-infallible" diff --git a/contracts/benchmarks/mappers/linked-list-repeat/wasm/Cargo.toml b/contracts/benchmarks/mappers/linked-list-repeat/wasm/Cargo.toml index 7e1c03fd7c..66fedeaf66 100644 --- a/contracts/benchmarks/mappers/linked-list-repeat/wasm/Cargo.toml +++ b/contracts/benchmarks/mappers/linked-list-repeat/wasm/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.51.1" +version = "0.54.1" path = "../../../../../framework/wasm-adapter" [workspace] diff --git a/contracts/benchmarks/mappers/map-repeat/Cargo.toml b/contracts/benchmarks/mappers/map-repeat/Cargo.toml index 530bd65318..e76ee51f18 100644 --- a/contracts/benchmarks/mappers/map-repeat/Cargo.toml +++ b/contracts/benchmarks/mappers/map-repeat/Cargo.toml @@ -13,9 +13,9 @@ path = "../benchmark-common" [dependencies.multiversx-sc] -version = "0.51.1" +version = "0.54.1" path = "../../../../framework/base" [dev-dependencies.multiversx-sc-scenario] -version = "0.51.1" +version = "0.54.1" path = "../../../../framework/scenario" diff --git a/contracts/benchmarks/mappers/map-repeat/meta/Cargo.toml b/contracts/benchmarks/mappers/map-repeat/meta/Cargo.toml index b723dc821a..ffb99d9ea0 100644 --- a/contracts/benchmarks/mappers/map-repeat/meta/Cargo.toml +++ b/contracts/benchmarks/mappers/map-repeat/meta/Cargo.toml @@ -9,6 +9,6 @@ publish = false path = ".." [dependencies.multiversx-sc-meta-lib] -version = "0.51.1" +version = "0.54.1" path = "../../../../../framework/meta-lib" default-features = false diff --git a/contracts/benchmarks/mappers/map-repeat/tests/scenario_rs_test.rs b/contracts/benchmarks/mappers/map-repeat/tests/scenario_rs_test.rs index ce7eabb8eb..8ae30eaf45 100644 --- a/contracts/benchmarks/mappers/map-repeat/tests/scenario_rs_test.rs +++ b/contracts/benchmarks/mappers/map-repeat/tests/scenario_rs_test.rs @@ -2,6 +2,7 @@ use multiversx_sc_scenario::*; fn world() -> ScenarioWorld { let mut blockchain = ScenarioWorld::new(); + blockchain.set_current_dir_from_workspace("contracts/benchmarks/mappers/map-repeat"); blockchain.register_contract( "mxsc:output/map-repeat.mxsc.json", diff --git a/contracts/benchmarks/mappers/map-repeat/wasm/Cargo.lock b/contracts/benchmarks/mappers/map-repeat/wasm/Cargo.lock index af149a9b16..3367ef1e2b 100644 --- a/contracts/benchmarks/mappers/map-repeat/wasm/Cargo.lock +++ b/contracts/benchmarks/mappers/map-repeat/wasm/Cargo.lock @@ -4,15 +4,15 @@ version = 3 [[package]] name = "arrayvec" -version = "0.7.4" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" +checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" [[package]] name = "autocfg" -version = "1.3.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" +checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" [[package]] name = "benchmark-common" @@ -61,12 +61,21 @@ dependencies = [ "multiversx-sc-wasm-adapter", ] +[[package]] +name = "multiversx-chain-core" +version = "0.11.0" +dependencies = [ + "bitflags", + "multiversx-sc-codec", +] + [[package]] name = "multiversx-sc" -version = "0.51.1" +version = "0.54.1" dependencies = [ "bitflags", "hex-literal", + "multiversx-chain-core", "multiversx-sc-codec", "multiversx-sc-derive", "num-traits", @@ -75,7 +84,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.20.0" +version = "0.21.0" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -84,7 +93,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.20.0" +version = "0.21.0" dependencies = [ "hex", "proc-macro2", @@ -94,7 +103,7 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.51.1" +version = "0.54.1" dependencies = [ "hex", "proc-macro2", @@ -105,7 +114,7 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.51.1" +version = "0.54.1" dependencies = [ "multiversx-sc", ] @@ -139,9 +148,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.36" +version = "1.0.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" +checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" dependencies = [ "proc-macro2", ] @@ -164,9 +173,9 @@ checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "syn" -version = "2.0.68" +version = "2.0.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "901fa70d88b9d6c98022e23b4136f9f3e54e4662c3bc1bd1d84a42a9a0f0c1e9" +checksum = "9f35bcdf61fd8e7be6caf75f429fdca8beb3ed76584befb503b1569faee373ed" dependencies = [ "proc-macro2", "quote", @@ -175,9 +184,9 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.12" +version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" +checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" [[package]] name = "unwrap-infallible" diff --git a/contracts/benchmarks/mappers/map-repeat/wasm/Cargo.toml b/contracts/benchmarks/mappers/map-repeat/wasm/Cargo.toml index f6bd495169..4d2f7008da 100644 --- a/contracts/benchmarks/mappers/map-repeat/wasm/Cargo.toml +++ b/contracts/benchmarks/mappers/map-repeat/wasm/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.51.1" +version = "0.54.1" path = "../../../../../framework/wasm-adapter" [workspace] diff --git a/contracts/benchmarks/mappers/queue-repeat/Cargo.toml b/contracts/benchmarks/mappers/queue-repeat/Cargo.toml index 674e0d5032..935fae99e0 100644 --- a/contracts/benchmarks/mappers/queue-repeat/Cargo.toml +++ b/contracts/benchmarks/mappers/queue-repeat/Cargo.toml @@ -13,9 +13,9 @@ path = "../benchmark-common" [dependencies.multiversx-sc] -version = "0.51.1" +version = "0.54.1" path = "../../../../framework/base" [dev-dependencies.multiversx-sc-scenario] -version = "0.51.1" +version = "0.54.1" path = "../../../../framework/scenario" diff --git a/contracts/benchmarks/mappers/queue-repeat/meta/Cargo.toml b/contracts/benchmarks/mappers/queue-repeat/meta/Cargo.toml index 61b83fa4ea..2ec3ba763a 100644 --- a/contracts/benchmarks/mappers/queue-repeat/meta/Cargo.toml +++ b/contracts/benchmarks/mappers/queue-repeat/meta/Cargo.toml @@ -9,6 +9,6 @@ publish = false path = ".." [dependencies.multiversx-sc-meta-lib] -version = "0.51.1" +version = "0.54.1" path = "../../../../../framework/meta-lib" default-features = false diff --git a/contracts/benchmarks/mappers/queue-repeat/tests/scenario_rs_test.rs b/contracts/benchmarks/mappers/queue-repeat/tests/scenario_rs_test.rs index 9f4596ae21..4e7ac9ba66 100644 --- a/contracts/benchmarks/mappers/queue-repeat/tests/scenario_rs_test.rs +++ b/contracts/benchmarks/mappers/queue-repeat/tests/scenario_rs_test.rs @@ -2,6 +2,7 @@ use multiversx_sc_scenario::*; fn world() -> ScenarioWorld { let mut blockchain = ScenarioWorld::new(); + blockchain.set_current_dir_from_workspace("contracts/benchmarks/mappers/queue-repeat"); blockchain.register_contract( "mxsc:output/queue-repeat.mxsc.json", diff --git a/contracts/benchmarks/mappers/queue-repeat/wasm/Cargo.lock b/contracts/benchmarks/mappers/queue-repeat/wasm/Cargo.lock index 149c26607d..3d64b5317b 100644 --- a/contracts/benchmarks/mappers/queue-repeat/wasm/Cargo.lock +++ b/contracts/benchmarks/mappers/queue-repeat/wasm/Cargo.lock @@ -4,15 +4,15 @@ version = 3 [[package]] name = "arrayvec" -version = "0.7.4" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" +checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" [[package]] name = "autocfg" -version = "1.3.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" +checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" [[package]] name = "benchmark-common" @@ -45,12 +45,21 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" +[[package]] +name = "multiversx-chain-core" +version = "0.11.0" +dependencies = [ + "bitflags", + "multiversx-sc-codec", +] + [[package]] name = "multiversx-sc" -version = "0.51.1" +version = "0.54.1" dependencies = [ "bitflags", "hex-literal", + "multiversx-chain-core", "multiversx-sc-codec", "multiversx-sc-derive", "num-traits", @@ -59,7 +68,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.20.0" +version = "0.21.0" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -68,7 +77,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.20.0" +version = "0.21.0" dependencies = [ "hex", "proc-macro2", @@ -78,7 +87,7 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.51.1" +version = "0.54.1" dependencies = [ "hex", "proc-macro2", @@ -89,7 +98,7 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.51.1" +version = "0.54.1" dependencies = [ "multiversx-sc", ] @@ -139,9 +148,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.36" +version = "1.0.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" +checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" dependencies = [ "proc-macro2", ] @@ -164,9 +173,9 @@ checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "syn" -version = "2.0.68" +version = "2.0.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "901fa70d88b9d6c98022e23b4136f9f3e54e4662c3bc1bd1d84a42a9a0f0c1e9" +checksum = "9f35bcdf61fd8e7be6caf75f429fdca8beb3ed76584befb503b1569faee373ed" dependencies = [ "proc-macro2", "quote", @@ -175,9 +184,9 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.12" +version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" +checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" [[package]] name = "unwrap-infallible" diff --git a/contracts/benchmarks/mappers/queue-repeat/wasm/Cargo.toml b/contracts/benchmarks/mappers/queue-repeat/wasm/Cargo.toml index 4a40181bb3..807fcae425 100644 --- a/contracts/benchmarks/mappers/queue-repeat/wasm/Cargo.toml +++ b/contracts/benchmarks/mappers/queue-repeat/wasm/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.51.1" +version = "0.54.1" path = "../../../../../framework/wasm-adapter" [workspace] diff --git a/contracts/benchmarks/mappers/set-repeat/Cargo.toml b/contracts/benchmarks/mappers/set-repeat/Cargo.toml index 9b1c9851aa..0cacb9c436 100644 --- a/contracts/benchmarks/mappers/set-repeat/Cargo.toml +++ b/contracts/benchmarks/mappers/set-repeat/Cargo.toml @@ -13,9 +13,9 @@ path = "../benchmark-common" [dependencies.multiversx-sc] -version = "0.51.1" +version = "0.54.1" path = "../../../../framework/base" [dev-dependencies.multiversx-sc-scenario] -version = "0.51.1" +version = "0.54.1" path = "../../../../framework/scenario" diff --git a/contracts/benchmarks/mappers/set-repeat/meta/Cargo.toml b/contracts/benchmarks/mappers/set-repeat/meta/Cargo.toml index a5f334cbcc..3823304a70 100644 --- a/contracts/benchmarks/mappers/set-repeat/meta/Cargo.toml +++ b/contracts/benchmarks/mappers/set-repeat/meta/Cargo.toml @@ -9,6 +9,6 @@ publish = false path = ".." [dependencies.multiversx-sc-meta-lib] -version = "0.51.1" +version = "0.54.1" path = "../../../../../framework/meta-lib" default-features = false diff --git a/contracts/benchmarks/mappers/set-repeat/tests/scenario_rs_test.rs b/contracts/benchmarks/mappers/set-repeat/tests/scenario_rs_test.rs index ec2352ec65..ba9fda4f46 100644 --- a/contracts/benchmarks/mappers/set-repeat/tests/scenario_rs_test.rs +++ b/contracts/benchmarks/mappers/set-repeat/tests/scenario_rs_test.rs @@ -2,6 +2,7 @@ use multiversx_sc_scenario::*; fn world() -> ScenarioWorld { let mut blockchain = ScenarioWorld::new(); + blockchain.set_current_dir_from_workspace("contracts/benchmarks/mappers/set-repeat"); blockchain.register_contract( "mxsc:output/set-repeat.mxsc.json", diff --git a/contracts/benchmarks/mappers/set-repeat/wasm/Cargo.lock b/contracts/benchmarks/mappers/set-repeat/wasm/Cargo.lock index 17ba237632..e621aaf1a0 100644 --- a/contracts/benchmarks/mappers/set-repeat/wasm/Cargo.lock +++ b/contracts/benchmarks/mappers/set-repeat/wasm/Cargo.lock @@ -4,15 +4,15 @@ version = 3 [[package]] name = "arrayvec" -version = "0.7.4" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" +checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" [[package]] name = "autocfg" -version = "1.3.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" +checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" [[package]] name = "benchmark-common" @@ -45,12 +45,21 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" +[[package]] +name = "multiversx-chain-core" +version = "0.11.0" +dependencies = [ + "bitflags", + "multiversx-sc-codec", +] + [[package]] name = "multiversx-sc" -version = "0.51.1" +version = "0.54.1" dependencies = [ "bitflags", "hex-literal", + "multiversx-chain-core", "multiversx-sc-codec", "multiversx-sc-derive", "num-traits", @@ -59,7 +68,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.20.0" +version = "0.21.0" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -68,7 +77,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.20.0" +version = "0.21.0" dependencies = [ "hex", "proc-macro2", @@ -78,7 +87,7 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.51.1" +version = "0.54.1" dependencies = [ "hex", "proc-macro2", @@ -89,7 +98,7 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.51.1" +version = "0.54.1" dependencies = [ "multiversx-sc", ] @@ -123,9 +132,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.36" +version = "1.0.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" +checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" dependencies = [ "proc-macro2", ] @@ -164,9 +173,9 @@ checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "syn" -version = "2.0.68" +version = "2.0.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "901fa70d88b9d6c98022e23b4136f9f3e54e4662c3bc1bd1d84a42a9a0f0c1e9" +checksum = "9f35bcdf61fd8e7be6caf75f429fdca8beb3ed76584befb503b1569faee373ed" dependencies = [ "proc-macro2", "quote", @@ -175,9 +184,9 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.12" +version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" +checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" [[package]] name = "unwrap-infallible" diff --git a/contracts/benchmarks/mappers/set-repeat/wasm/Cargo.toml b/contracts/benchmarks/mappers/set-repeat/wasm/Cargo.toml index 80b6514c8e..cf5d232be7 100644 --- a/contracts/benchmarks/mappers/set-repeat/wasm/Cargo.toml +++ b/contracts/benchmarks/mappers/set-repeat/wasm/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.51.1" +version = "0.54.1" path = "../../../../../framework/wasm-adapter" [workspace] diff --git a/contracts/benchmarks/mappers/single-value-repeat/Cargo.toml b/contracts/benchmarks/mappers/single-value-repeat/Cargo.toml index 42c91c2682..24dde257ef 100644 --- a/contracts/benchmarks/mappers/single-value-repeat/Cargo.toml +++ b/contracts/benchmarks/mappers/single-value-repeat/Cargo.toml @@ -13,9 +13,9 @@ path = "../benchmark-common" [dependencies.multiversx-sc] -version = "0.51.1" +version = "0.54.1" path = "../../../../framework/base" [dev-dependencies.multiversx-sc-scenario] -version = "0.51.1" +version = "0.54.1" path = "../../../../framework/scenario" diff --git a/contracts/benchmarks/mappers/single-value-repeat/meta/Cargo.toml b/contracts/benchmarks/mappers/single-value-repeat/meta/Cargo.toml index 883187759a..73c19632a3 100644 --- a/contracts/benchmarks/mappers/single-value-repeat/meta/Cargo.toml +++ b/contracts/benchmarks/mappers/single-value-repeat/meta/Cargo.toml @@ -9,6 +9,6 @@ publish = false path = ".." [dependencies.multiversx-sc-meta-lib] -version = "0.51.1" +version = "0.54.1" path = "../../../../../framework/meta-lib" default-features = false diff --git a/contracts/benchmarks/mappers/single-value-repeat/tests/scenario_rs_test.rs b/contracts/benchmarks/mappers/single-value-repeat/tests/scenario_rs_test.rs index d235f08b2e..cf43c6d95f 100644 --- a/contracts/benchmarks/mappers/single-value-repeat/tests/scenario_rs_test.rs +++ b/contracts/benchmarks/mappers/single-value-repeat/tests/scenario_rs_test.rs @@ -2,6 +2,7 @@ use multiversx_sc_scenario::*; fn world() -> ScenarioWorld { let mut blockchain = ScenarioWorld::new(); + blockchain.set_current_dir_from_workspace("contracts/benchmarks/mappers/single-value-repeat"); blockchain.register_contract( "mxsc:output/single-value-repeat.mxsc.json", diff --git a/contracts/benchmarks/mappers/single-value-repeat/wasm/Cargo.lock b/contracts/benchmarks/mappers/single-value-repeat/wasm/Cargo.lock index 28d2099883..514a14413e 100644 --- a/contracts/benchmarks/mappers/single-value-repeat/wasm/Cargo.lock +++ b/contracts/benchmarks/mappers/single-value-repeat/wasm/Cargo.lock @@ -4,15 +4,15 @@ version = 3 [[package]] name = "arrayvec" -version = "0.7.4" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" +checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" [[package]] name = "autocfg" -version = "1.3.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" +checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" [[package]] name = "benchmark-common" @@ -45,12 +45,21 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" +[[package]] +name = "multiversx-chain-core" +version = "0.11.0" +dependencies = [ + "bitflags", + "multiversx-sc-codec", +] + [[package]] name = "multiversx-sc" -version = "0.51.1" +version = "0.54.1" dependencies = [ "bitflags", "hex-literal", + "multiversx-chain-core", "multiversx-sc-codec", "multiversx-sc-derive", "num-traits", @@ -59,7 +68,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.20.0" +version = "0.21.0" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -68,7 +77,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.20.0" +version = "0.21.0" dependencies = [ "hex", "proc-macro2", @@ -78,7 +87,7 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.51.1" +version = "0.54.1" dependencies = [ "hex", "proc-macro2", @@ -89,7 +98,7 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.51.1" +version = "0.54.1" dependencies = [ "multiversx-sc", ] @@ -123,9 +132,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.36" +version = "1.0.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" +checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" dependencies = [ "proc-macro2", ] @@ -164,9 +173,9 @@ checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "syn" -version = "2.0.68" +version = "2.0.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "901fa70d88b9d6c98022e23b4136f9f3e54e4662c3bc1bd1d84a42a9a0f0c1e9" +checksum = "9f35bcdf61fd8e7be6caf75f429fdca8beb3ed76584befb503b1569faee373ed" dependencies = [ "proc-macro2", "quote", @@ -175,9 +184,9 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.12" +version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" +checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" [[package]] name = "unwrap-infallible" diff --git a/contracts/benchmarks/mappers/single-value-repeat/wasm/Cargo.toml b/contracts/benchmarks/mappers/single-value-repeat/wasm/Cargo.toml index d2bf4ef9d7..0c5708859f 100644 --- a/contracts/benchmarks/mappers/single-value-repeat/wasm/Cargo.toml +++ b/contracts/benchmarks/mappers/single-value-repeat/wasm/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.51.1" +version = "0.54.1" path = "../../../../../framework/wasm-adapter" [workspace] diff --git a/contracts/benchmarks/mappers/vec-repeat/Cargo.toml b/contracts/benchmarks/mappers/vec-repeat/Cargo.toml index 636d2f04b9..7f9427e635 100644 --- a/contracts/benchmarks/mappers/vec-repeat/Cargo.toml +++ b/contracts/benchmarks/mappers/vec-repeat/Cargo.toml @@ -13,9 +13,9 @@ path = "../benchmark-common" [dependencies.multiversx-sc] -version = "0.51.1" +version = "0.54.1" path = "../../../../framework/base" [dev-dependencies.multiversx-sc-scenario] -version = "0.51.1" +version = "0.54.1" path = "../../../../framework/scenario" diff --git a/contracts/benchmarks/mappers/vec-repeat/meta/Cargo.toml b/contracts/benchmarks/mappers/vec-repeat/meta/Cargo.toml index 33c72948de..5ac8d750e6 100644 --- a/contracts/benchmarks/mappers/vec-repeat/meta/Cargo.toml +++ b/contracts/benchmarks/mappers/vec-repeat/meta/Cargo.toml @@ -8,6 +8,6 @@ publish = false path = ".." [dependencies.multiversx-sc-meta-lib] -version = "0.51.1" +version = "0.54.1" path = "../../../../../framework/meta-lib" default-features = false diff --git a/contracts/benchmarks/mappers/vec-repeat/tests/scenario_rs_test.rs b/contracts/benchmarks/mappers/vec-repeat/tests/scenario_rs_test.rs index d47d38ec79..49407163df 100644 --- a/contracts/benchmarks/mappers/vec-repeat/tests/scenario_rs_test.rs +++ b/contracts/benchmarks/mappers/vec-repeat/tests/scenario_rs_test.rs @@ -2,6 +2,7 @@ use multiversx_sc_scenario::*; fn world() -> ScenarioWorld { let mut blockchain = ScenarioWorld::new(); + blockchain.set_current_dir_from_workspace("contracts/benchmarks/mappers/vec-repeat"); blockchain.register_contract( "mxsc:output/vec-repeat.mxsc.json", diff --git a/contracts/benchmarks/mappers/vec-repeat/wasm/Cargo.lock b/contracts/benchmarks/mappers/vec-repeat/wasm/Cargo.lock index 5266d763ec..1d1ae4dbbf 100644 --- a/contracts/benchmarks/mappers/vec-repeat/wasm/Cargo.lock +++ b/contracts/benchmarks/mappers/vec-repeat/wasm/Cargo.lock @@ -4,15 +4,15 @@ version = 3 [[package]] name = "arrayvec" -version = "0.7.4" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" +checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" [[package]] name = "autocfg" -version = "1.3.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" +checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" [[package]] name = "benchmark-common" @@ -45,12 +45,21 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" +[[package]] +name = "multiversx-chain-core" +version = "0.11.0" +dependencies = [ + "bitflags", + "multiversx-sc-codec", +] + [[package]] name = "multiversx-sc" -version = "0.51.1" +version = "0.54.1" dependencies = [ "bitflags", "hex-literal", + "multiversx-chain-core", "multiversx-sc-codec", "multiversx-sc-derive", "num-traits", @@ -59,7 +68,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.20.0" +version = "0.21.0" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -68,7 +77,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.20.0" +version = "0.21.0" dependencies = [ "hex", "proc-macro2", @@ -78,7 +87,7 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.51.1" +version = "0.54.1" dependencies = [ "hex", "proc-macro2", @@ -89,7 +98,7 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.51.1" +version = "0.54.1" dependencies = [ "multiversx-sc", ] @@ -123,9 +132,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.36" +version = "1.0.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" +checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" dependencies = [ "proc-macro2", ] @@ -148,9 +157,9 @@ checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "syn" -version = "2.0.68" +version = "2.0.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "901fa70d88b9d6c98022e23b4136f9f3e54e4662c3bc1bd1d84a42a9a0f0c1e9" +checksum = "9f35bcdf61fd8e7be6caf75f429fdca8beb3ed76584befb503b1569faee373ed" dependencies = [ "proc-macro2", "quote", @@ -159,9 +168,9 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.12" +version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" +checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" [[package]] name = "unwrap-infallible" diff --git a/contracts/benchmarks/mappers/vec-repeat/wasm/Cargo.toml b/contracts/benchmarks/mappers/vec-repeat/wasm/Cargo.toml index f1fdaee1f8..92d7578542 100644 --- a/contracts/benchmarks/mappers/vec-repeat/wasm/Cargo.toml +++ b/contracts/benchmarks/mappers/vec-repeat/wasm/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.51.1" +version = "0.54.1" path = "../../../../../framework/wasm-adapter" [workspace] diff --git a/contracts/benchmarks/send-tx-repeat/Cargo.toml b/contracts/benchmarks/send-tx-repeat/Cargo.toml index fc5b8026b9..f07988b264 100644 --- a/contracts/benchmarks/send-tx-repeat/Cargo.toml +++ b/contracts/benchmarks/send-tx-repeat/Cargo.toml @@ -9,9 +9,9 @@ publish = false path = "src/send_tx_repeat.rs" [dependencies.multiversx-sc] -version = "0.51.1" +version = "0.54.1" path = "../../../framework/base" [dev-dependencies.multiversx-sc-scenario] -version = "0.51.1" +version = "0.54.1" path = "../../../framework/scenario" diff --git a/contracts/benchmarks/send-tx-repeat/meta/Cargo.toml b/contracts/benchmarks/send-tx-repeat/meta/Cargo.toml index 482926723c..e0ec605e1d 100644 --- a/contracts/benchmarks/send-tx-repeat/meta/Cargo.toml +++ b/contracts/benchmarks/send-tx-repeat/meta/Cargo.toml @@ -8,6 +8,6 @@ publish = false path = ".." [dependencies.multiversx-sc-meta-lib] -version = "0.51.1" +version = "0.54.1" path = "../../../../framework/meta-lib" default-features = false diff --git a/contracts/benchmarks/send-tx-repeat/tests/scenario_rs_test.rs b/contracts/benchmarks/send-tx-repeat/tests/scenario_rs_test.rs index cccbea31c1..96aec299cd 100644 --- a/contracts/benchmarks/send-tx-repeat/tests/scenario_rs_test.rs +++ b/contracts/benchmarks/send-tx-repeat/tests/scenario_rs_test.rs @@ -2,6 +2,7 @@ use multiversx_sc_scenario::*; fn world() -> ScenarioWorld { let mut blockchain = ScenarioWorld::new(); + blockchain.set_current_dir_from_workspace("contracts/benchmarks/send-tx-repeat"); blockchain.register_contract( "mxsc:output/send-tx-repeat.mxsc.json", send_tx_repeat::ContractBuilder, diff --git a/contracts/benchmarks/send-tx-repeat/wasm/Cargo.lock b/contracts/benchmarks/send-tx-repeat/wasm/Cargo.lock index b001662f23..635335e8fd 100755 --- a/contracts/benchmarks/send-tx-repeat/wasm/Cargo.lock +++ b/contracts/benchmarks/send-tx-repeat/wasm/Cargo.lock @@ -4,15 +4,15 @@ version = 3 [[package]] name = "arrayvec" -version = "0.7.4" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" +checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" [[package]] name = "autocfg" -version = "1.3.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" +checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" [[package]] name = "bitflags" @@ -38,12 +38,21 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" +[[package]] +name = "multiversx-chain-core" +version = "0.11.0" +dependencies = [ + "bitflags", + "multiversx-sc-codec", +] + [[package]] name = "multiversx-sc" -version = "0.51.1" +version = "0.54.1" dependencies = [ "bitflags", "hex-literal", + "multiversx-chain-core", "multiversx-sc-codec", "multiversx-sc-derive", "num-traits", @@ -52,7 +61,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.20.0" +version = "0.21.0" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -61,7 +70,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.20.0" +version = "0.21.0" dependencies = [ "hex", "proc-macro2", @@ -71,7 +80,7 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.51.1" +version = "0.54.1" dependencies = [ "hex", "proc-macro2", @@ -82,7 +91,7 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.51.1" +version = "0.54.1" dependencies = [ "multiversx-sc", ] @@ -116,9 +125,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.36" +version = "1.0.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" +checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" dependencies = [ "proc-macro2", ] @@ -156,9 +165,9 @@ checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "syn" -version = "2.0.68" +version = "2.0.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "901fa70d88b9d6c98022e23b4136f9f3e54e4662c3bc1bd1d84a42a9a0f0c1e9" +checksum = "9f35bcdf61fd8e7be6caf75f429fdca8beb3ed76584befb503b1569faee373ed" dependencies = [ "proc-macro2", "quote", @@ -167,9 +176,9 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.12" +version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" +checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" [[package]] name = "unwrap-infallible" diff --git a/contracts/benchmarks/send-tx-repeat/wasm/Cargo.toml b/contracts/benchmarks/send-tx-repeat/wasm/Cargo.toml index 5fd9d6efee..d1ebce52f9 100644 --- a/contracts/benchmarks/send-tx-repeat/wasm/Cargo.toml +++ b/contracts/benchmarks/send-tx-repeat/wasm/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.51.1" +version = "0.54.1" path = "../../../../framework/wasm-adapter" [workspace] diff --git a/contracts/benchmarks/str-repeat/Cargo.toml b/contracts/benchmarks/str-repeat/Cargo.toml index be9ea096bb..da419475b2 100644 --- a/contracts/benchmarks/str-repeat/Cargo.toml +++ b/contracts/benchmarks/str-repeat/Cargo.toml @@ -12,10 +12,10 @@ path = "src/str_repeat.rs" managed-buffer-builder-cached = ["multiversx-sc/managed-buffer-builder-cached"] [dependencies.multiversx-sc] -version = "0.51.1" +version = "0.54.1" path = "../../../framework/base" features = ["alloc"] [dev-dependencies.multiversx-sc-scenario] -version = "0.51.1" +version = "0.54.1" path = "../../../framework/scenario" diff --git a/contracts/benchmarks/str-repeat/meta/Cargo.toml b/contracts/benchmarks/str-repeat/meta/Cargo.toml index 99e41cff30..f954b6930e 100644 --- a/contracts/benchmarks/str-repeat/meta/Cargo.toml +++ b/contracts/benchmarks/str-repeat/meta/Cargo.toml @@ -8,6 +8,6 @@ publish = false path = ".." [dependencies.multiversx-sc-meta-lib] -version = "0.51.1" +version = "0.54.1" path = "../../../../framework/meta-lib" default-features = false diff --git a/contracts/benchmarks/str-repeat/tests/scenario_rs_test.rs b/contracts/benchmarks/str-repeat/tests/scenario_rs_test.rs index 4fcef41480..92ec5d245a 100644 --- a/contracts/benchmarks/str-repeat/tests/scenario_rs_test.rs +++ b/contracts/benchmarks/str-repeat/tests/scenario_rs_test.rs @@ -2,6 +2,7 @@ use multiversx_sc_scenario::*; fn world() -> ScenarioWorld { let mut blockchain = ScenarioWorld::new(); + blockchain.set_current_dir_from_workspace("contracts/benchmarks/str-repeat"); blockchain.register_contract( "mxsc:output/str-repeat.mxsc.json", str_repeat::ContractBuilder, diff --git a/contracts/benchmarks/str-repeat/wasm-str-repeat-mb-builder-basic/Cargo.lock b/contracts/benchmarks/str-repeat/wasm-str-repeat-mb-builder-basic/Cargo.lock index 7364f1bf68..ed7ae42723 100644 --- a/contracts/benchmarks/str-repeat/wasm-str-repeat-mb-builder-basic/Cargo.lock +++ b/contracts/benchmarks/str-repeat/wasm-str-repeat-mb-builder-basic/Cargo.lock @@ -4,15 +4,15 @@ version = 3 [[package]] name = "arrayvec" -version = "0.7.4" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" +checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" [[package]] name = "autocfg" -version = "1.3.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" +checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" [[package]] name = "bitflags" @@ -38,12 +38,21 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" +[[package]] +name = "multiversx-chain-core" +version = "0.11.0" +dependencies = [ + "bitflags", + "multiversx-sc-codec", +] + [[package]] name = "multiversx-sc" -version = "0.51.1" +version = "0.54.1" dependencies = [ "bitflags", "hex-literal", + "multiversx-chain-core", "multiversx-sc-codec", "multiversx-sc-derive", "num-traits", @@ -52,7 +61,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.20.0" +version = "0.21.0" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -61,7 +70,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.20.0" +version = "0.21.0" dependencies = [ "hex", "proc-macro2", @@ -71,7 +80,7 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.51.1" +version = "0.54.1" dependencies = [ "hex", "proc-macro2", @@ -82,7 +91,7 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.51.1" +version = "0.54.1" dependencies = [ "multiversx-sc", ] @@ -116,9 +125,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.36" +version = "1.0.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" +checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" dependencies = [ "proc-macro2", ] @@ -156,9 +165,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.68" +version = "2.0.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "901fa70d88b9d6c98022e23b4136f9f3e54e4662c3bc1bd1d84a42a9a0f0c1e9" +checksum = "9f35bcdf61fd8e7be6caf75f429fdca8beb3ed76584befb503b1569faee373ed" dependencies = [ "proc-macro2", "quote", @@ -167,9 +176,9 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.12" +version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" +checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" [[package]] name = "unwrap-infallible" diff --git a/contracts/benchmarks/str-repeat/wasm-str-repeat-mb-builder-basic/Cargo.toml b/contracts/benchmarks/str-repeat/wasm-str-repeat-mb-builder-basic/Cargo.toml index 84b2816ed0..7d0711a217 100644 --- a/contracts/benchmarks/str-repeat/wasm-str-repeat-mb-builder-basic/Cargo.toml +++ b/contracts/benchmarks/str-repeat/wasm-str-repeat-mb-builder-basic/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.51.1" +version = "0.54.1" path = "../../../../framework/wasm-adapter" [workspace] diff --git a/contracts/benchmarks/str-repeat/wasm-str-repeat-mb-builder-cached/Cargo.lock b/contracts/benchmarks/str-repeat/wasm-str-repeat-mb-builder-cached/Cargo.lock index c26f218b0e..40d776c7af 100644 --- a/contracts/benchmarks/str-repeat/wasm-str-repeat-mb-builder-cached/Cargo.lock +++ b/contracts/benchmarks/str-repeat/wasm-str-repeat-mb-builder-cached/Cargo.lock @@ -4,15 +4,15 @@ version = 3 [[package]] name = "arrayvec" -version = "0.7.4" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" +checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" [[package]] name = "autocfg" -version = "1.3.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" +checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" [[package]] name = "bitflags" @@ -38,12 +38,21 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" +[[package]] +name = "multiversx-chain-core" +version = "0.11.0" +dependencies = [ + "bitflags", + "multiversx-sc-codec", +] + [[package]] name = "multiversx-sc" -version = "0.51.1" +version = "0.54.1" dependencies = [ "bitflags", "hex-literal", + "multiversx-chain-core", "multiversx-sc-codec", "multiversx-sc-derive", "num-traits", @@ -52,7 +61,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.20.0" +version = "0.21.0" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -61,7 +70,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.20.0" +version = "0.21.0" dependencies = [ "hex", "proc-macro2", @@ -71,7 +80,7 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.51.1" +version = "0.54.1" dependencies = [ "hex", "proc-macro2", @@ -82,7 +91,7 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.51.1" +version = "0.54.1" dependencies = [ "multiversx-sc", ] @@ -116,9 +125,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.36" +version = "1.0.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" +checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" dependencies = [ "proc-macro2", ] @@ -156,9 +165,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.68" +version = "2.0.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "901fa70d88b9d6c98022e23b4136f9f3e54e4662c3bc1bd1d84a42a9a0f0c1e9" +checksum = "9f35bcdf61fd8e7be6caf75f429fdca8beb3ed76584befb503b1569faee373ed" dependencies = [ "proc-macro2", "quote", @@ -167,9 +176,9 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.12" +version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" +checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" [[package]] name = "unwrap-infallible" diff --git a/contracts/benchmarks/str-repeat/wasm-str-repeat-mb-builder-cached/Cargo.toml b/contracts/benchmarks/str-repeat/wasm-str-repeat-mb-builder-cached/Cargo.toml index 880de0fd63..5dcf036922 100644 --- a/contracts/benchmarks/str-repeat/wasm-str-repeat-mb-builder-cached/Cargo.toml +++ b/contracts/benchmarks/str-repeat/wasm-str-repeat-mb-builder-cached/Cargo.toml @@ -29,7 +29,7 @@ path = ".." features = ["managed-buffer-builder-cached"] [dependencies.multiversx-sc-wasm-adapter] -version = "0.51.1" +version = "0.54.1" path = "../../../../framework/wasm-adapter" [workspace] diff --git a/contracts/benchmarks/str-repeat/wasm/Cargo.lock b/contracts/benchmarks/str-repeat/wasm/Cargo.lock index fa214167b3..a1257120a6 100755 --- a/contracts/benchmarks/str-repeat/wasm/Cargo.lock +++ b/contracts/benchmarks/str-repeat/wasm/Cargo.lock @@ -4,15 +4,15 @@ version = 3 [[package]] name = "arrayvec" -version = "0.7.4" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" +checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" [[package]] name = "autocfg" -version = "1.3.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" +checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" [[package]] name = "bitflags" @@ -38,12 +38,21 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" +[[package]] +name = "multiversx-chain-core" +version = "0.11.0" +dependencies = [ + "bitflags", + "multiversx-sc-codec", +] + [[package]] name = "multiversx-sc" -version = "0.51.1" +version = "0.54.1" dependencies = [ "bitflags", "hex-literal", + "multiversx-chain-core", "multiversx-sc-codec", "multiversx-sc-derive", "num-traits", @@ -52,7 +61,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.20.0" +version = "0.21.0" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -61,7 +70,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.20.0" +version = "0.21.0" dependencies = [ "hex", "proc-macro2", @@ -71,7 +80,7 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.51.1" +version = "0.54.1" dependencies = [ "hex", "proc-macro2", @@ -82,7 +91,7 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.51.1" +version = "0.54.1" dependencies = [ "multiversx-sc", ] @@ -116,9 +125,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.36" +version = "1.0.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" +checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" dependencies = [ "proc-macro2", ] @@ -156,9 +165,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.68" +version = "2.0.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "901fa70d88b9d6c98022e23b4136f9f3e54e4662c3bc1bd1d84a42a9a0f0c1e9" +checksum = "9f35bcdf61fd8e7be6caf75f429fdca8beb3ed76584befb503b1569faee373ed" dependencies = [ "proc-macro2", "quote", @@ -167,9 +176,9 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.12" +version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" +checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" [[package]] name = "unwrap-infallible" diff --git a/contracts/benchmarks/str-repeat/wasm/Cargo.toml b/contracts/benchmarks/str-repeat/wasm/Cargo.toml index 7a887af1de..0fe0913be3 100644 --- a/contracts/benchmarks/str-repeat/wasm/Cargo.toml +++ b/contracts/benchmarks/str-repeat/wasm/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.51.1" +version = "0.54.1" path = "../../../../framework/wasm-adapter" [workspace] diff --git a/contracts/core/price-aggregator/Cargo.toml b/contracts/core/price-aggregator/Cargo.toml index 2d9856ad84..c110868ad9 100644 --- a/contracts/core/price-aggregator/Cargo.toml +++ b/contracts/core/price-aggregator/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "multiversx-price-aggregator-sc" -version = "0.51.1" +version = "0.54.1" authors = [ "Claudiu-Marcel Bruda ", "MultiversX ", @@ -19,15 +19,15 @@ edition = "2021" path = "src/lib.rs" [dependencies.multiversx-sc] -version = "0.51.1" +version = "0.54.1" path = "../../../framework/base" [dependencies.multiversx-sc-modules] -version = "0.51.1" +version = "0.54.1" path = "../../../contracts/modules" [dev-dependencies.multiversx-sc-scenario] -version = "0.51.1" +version = "0.54.1" path = "../../../framework/scenario" [dependencies] diff --git a/contracts/core/price-aggregator/meta/Cargo.toml b/contracts/core/price-aggregator/meta/Cargo.toml index df8b0fd27d..f83ec4c141 100644 --- a/contracts/core/price-aggregator/meta/Cargo.toml +++ b/contracts/core/price-aggregator/meta/Cargo.toml @@ -8,10 +8,10 @@ publish = false path = ".." [dependencies.multiversx-sc] -version = "0.51.1" +version = "0.54.1" path = "../../../../framework/base" [dependencies.multiversx-sc-meta-lib] -version = "0.51.1" +version = "0.54.1" path = "../../../../framework/meta-lib" default-features = false diff --git a/contracts/core/price-aggregator/src/events.rs b/contracts/core/price-aggregator/src/events.rs index d485e622db..ee80b25594 100644 --- a/contracts/core/price-aggregator/src/events.rs +++ b/contracts/core/price-aggregator/src/events.rs @@ -2,15 +2,28 @@ multiversx_sc::imports!(); multiversx_sc::derive_imports!(); use crate::price_aggregator_data::{TimestampedPrice, TokenPair}; +pub type RoundId = u32; +pub type Round = usize; +pub type Block = u64; +pub type Epoch = u64; +pub type Timestamp = u64; #[type_abi] #[derive(TopEncode)] pub struct NewRoundEvent { price: BigUint, - timestamp: u64, + timestamp: Timestamp, decimals: u8, - block: u64, - epoch: u64, + block: Block, + epoch: Epoch, +} + +#[type_abi] +#[derive(TopEncode)] +pub struct DiscardSubmissionEvent { + submission_timestamp: Timestamp, + first_submission_timestamp: Timestamp, + has_caller_already_submitted: bool, } #[multiversx_sc::module] @@ -18,13 +31,14 @@ pub trait EventsModule { fn emit_new_round_event( &self, token_pair: &TokenPair, + round: Round, price_feed: &TimestampedPrice, ) { let epoch = self.blockchain().get_block_epoch(); self.new_round_event( &token_pair.from.clone(), &token_pair.to.clone(), - epoch, + round, &NewRoundEvent { price: price_feed.price.clone(), timestamp: price_feed.timestamp, @@ -40,7 +54,53 @@ pub trait EventsModule { &self, #[indexed] from: &ManagedBuffer, #[indexed] to: &ManagedBuffer, - #[indexed] epoch: u64, + #[indexed] round: Round, new_round_event: &NewRoundEvent, ); + + fn emit_discard_submission_event( + &self, + token_pair: &TokenPair, + round: Round, + submission_timestamp: Timestamp, + first_submission_timestamp: Timestamp, + has_caller_already_submitted: bool, + ) { + self.discard_submission_event( + &token_pair.from.clone(), + &token_pair.to.clone(), + round, + &DiscardSubmissionEvent { + submission_timestamp, + first_submission_timestamp, + has_caller_already_submitted, + }, + ) + } + + #[event("discard_submission")] + fn discard_submission_event( + &self, + #[indexed] from: &ManagedBuffer, + #[indexed] to: &ManagedBuffer, + #[indexed] round: Round, + discard_submission_event: &DiscardSubmissionEvent, + ); + + #[event("discard_round")] + fn discard_round_event( + &self, + #[indexed] from: &ManagedBuffer, + #[indexed] to: &ManagedBuffer, + #[indexed] round: Round, + ); + + #[event("add_submission")] + fn add_submission_event( + &self, + #[indexed] from: &ManagedBuffer, + #[indexed] to: &ManagedBuffer, + #[indexed] round: Round, + price: &BigUint, + ); } diff --git a/contracts/core/price-aggregator/src/lib.rs b/contracts/core/price-aggregator/src/lib.rs index 1dbed54848..39f6eb5484 100644 --- a/contracts/core/price-aggregator/src/lib.rs +++ b/contracts/core/price-aggregator/src/lib.rs @@ -6,6 +6,7 @@ mod events; pub mod median; pub mod price_aggregator_data; +use events::{Round, Timestamp}; use multiversx_sc_modules::staking; use price_aggregator_data::{OracleStatus, PriceFeed, TimestampedPrice, TokenPair}; @@ -47,6 +48,11 @@ pub trait PriceAggregator: self.set_paused(true); } + #[upgrade] + fn upgrade(&self) { + self.set_paused(true); + } + #[only_owner] #[endpoint(changeAmounts)] fn change_amounts(&self, staking_amount: BigUint, slash_amount: BigUint) { @@ -118,29 +124,24 @@ pub trait PriceAggregator: &self, from: ManagedBuffer, to: ManagedBuffer, - submission_timestamp: u64, + submission_timestamp: Timestamp, price: BigUint, decimals: u8, ) { self.require_not_paused(); self.require_is_oracle(); - let current_timestamp = self.blockchain().get_block_timestamp(); - require!( - submission_timestamp <= current_timestamp, - "Timestamp is from the future" - ); + self.require_valid_submission_timestamp(submission_timestamp); self.check_decimals(&from, &to, decimals); - self.submit_unchecked(from, to, submission_timestamp, price, decimals); + self.submit_unchecked(from, to, price, decimals); } fn submit_unchecked( &self, from: ManagedBuffer, to: ManagedBuffer, - submission_timestamp: u64, price: BigUint, decimals: u8, ) { @@ -154,11 +155,15 @@ pub trait PriceAggregator: let first_sub_time_mapper = self.first_submission_timestamp(&token_pair); let last_sub_time_mapper = self.last_submission_timestamp(&token_pair); + let mut round_id = 0; + let wrapped_rounds = self.rounds().get(&token_pair); + if wrapped_rounds.is_some() { + round_id = wrapped_rounds.unwrap().len() + 1; + } + let current_timestamp = self.blockchain().get_block_timestamp(); let mut is_first_submission = false; let mut first_submission_timestamp = if submissions.is_empty() { - self.require_valid_first_submission(submission_timestamp, current_timestamp); - first_sub_time_mapper.set(current_timestamp); is_first_submission = true; @@ -169,24 +174,38 @@ pub trait PriceAggregator: // round was not completed in time, so it's discarded if current_timestamp > first_submission_timestamp + MAX_ROUND_DURATION_SECONDS { - self.require_valid_first_submission(submission_timestamp, current_timestamp); - submissions.clear(); first_sub_time_mapper.set(current_timestamp); last_sub_time_mapper.set(current_timestamp); first_submission_timestamp = current_timestamp; is_first_submission = true; + self.discard_round_event(&token_pair.from.clone(), &token_pair.to.clone(), round_id) } let caller = self.blockchain().get_caller(); - let accepted = !submissions.contains_key(&caller) - && (is_first_submission || submission_timestamp >= first_submission_timestamp); + let has_caller_already_submitted = submissions.contains_key(&caller); + let accepted = !has_caller_already_submitted + && (is_first_submission || current_timestamp >= first_submission_timestamp); if accepted { - submissions.insert(caller, price); + submissions.insert(caller.clone(), price.clone()); last_sub_time_mapper.set(current_timestamp); - self.create_new_round(token_pair, submissions, decimals); + self.create_new_round(token_pair.clone(), round_id, submissions, decimals); + self.add_submission_event( + &token_pair.from.clone(), + &token_pair.to.clone(), + round_id, + &price, + ); + } else { + self.emit_discard_submission_event( + &token_pair, + round_id, + current_timestamp, + first_submission_timestamp, + has_caller_already_submitted, + ); } self.oracle_status() @@ -197,7 +216,12 @@ pub trait PriceAggregator: }); } - fn require_valid_first_submission(&self, submission_timestamp: u64, current_timestamp: u64) { + fn require_valid_submission_timestamp(&self, submission_timestamp: u64) { + let current_timestamp = self.blockchain().get_block_timestamp(); + require!( + submission_timestamp <= current_timestamp, + "Timestamp is from the future" + ); require!( current_timestamp - submission_timestamp <= FIRST_SUBMISSION_TIMESTAMP_MAX_DIFF_SECONDS, "First submission too old" @@ -207,24 +231,22 @@ pub trait PriceAggregator: #[endpoint(submitBatch)] fn submit_batch( &self, - submissions: MultiValueEncoded>, + submissions: MultiValueEncoded< + MultiValue5, + >, ) { self.require_not_paused(); self.require_is_oracle(); - let current_timestamp = self.blockchain().get_block_timestamp(); for (from, to, submission_timestamp, price, decimals) in submissions .into_iter() .map(|submission| submission.into_tuple()) { - require!( - submission_timestamp <= current_timestamp, - "Timestamp is from the future" - ); + self.require_valid_submission_timestamp(submission_timestamp); self.check_decimals(&from, &to, decimals); - self.submit_unchecked(from, to, submission_timestamp, price, decimals); + self.submit_unchecked(from, to, price, decimals); } } @@ -248,6 +270,7 @@ pub trait PriceAggregator: fn create_new_round( &self, token_pair: TokenPair, + round: Round, mut submissions: MapMapper, decimals: u8, ) { @@ -281,7 +304,7 @@ pub trait PriceAggregator: .or_default() .get() .push(&price_feed); - self.emit_new_round_event(&token_pair, &price_feed); + self.emit_new_round_event(&token_pair, round, &price_feed); } } @@ -358,6 +381,7 @@ pub trait PriceAggregator: } #[view(getOracles)] + #[title("oracles")] fn get_oracles(&self) -> MultiValueEncoded { let mut result = MultiValueEncoded::new(); for key in self.oracle_status().keys() { @@ -377,9 +401,11 @@ pub trait PriceAggregator: #[only_owner] #[endpoint(setPairDecimals)] fn set_pair_decimals(&self, from: ManagedBuffer, to: ManagedBuffer, decimals: u8) { - self.require_paused(); - - self.pair_decimals(&from, &to).set(Some(decimals)); + let pair_decimals_mapper = self.pair_decimals(&from, &to); + if !pair_decimals_mapper.is_empty() { + self.require_paused(); + } + pair_decimals_mapper.set(Some(decimals)); let pair = TokenPair { from, to }; self.clear_submissions(&pair); } @@ -422,13 +448,13 @@ pub trait PriceAggregator: fn first_submission_timestamp( &self, token_pair: &TokenPair, - ) -> SingleValueMapper; + ) -> SingleValueMapper; #[storage_mapper("last_submission_timestamp")] fn last_submission_timestamp( &self, token_pair: &TokenPair, - ) -> SingleValueMapper; + ) -> SingleValueMapper; #[storage_mapper("submissions")] fn submissions( diff --git a/contracts/core/price-aggregator/src/median.rs b/contracts/core/price-aggregator/src/median.rs index 714acf9632..53227bc9d7 100644 --- a/contracts/core/price-aggregator/src/median.rs +++ b/contracts/core/price-aggregator/src/median.rs @@ -1,5 +1,4 @@ multiversx_sc::imports!(); -multiversx_sc::derive_imports!(); /// Returns the sorted middle, or the average of the two middle indexed items if the /// vector has an even number of elements. diff --git a/contracts/core/price-aggregator/src/price_aggregator_data.rs b/contracts/core/price-aggregator/src/price_aggregator_data.rs index c348b67d22..e5fd64d4eb 100644 --- a/contracts/core/price-aggregator/src/price_aggregator_data.rs +++ b/contracts/core/price-aggregator/src/price_aggregator_data.rs @@ -1,3 +1,5 @@ +use crate::events::{RoundId, Timestamp}; + multiversx_sc::imports!(); multiversx_sc::derive_imports!(); @@ -11,10 +13,10 @@ pub struct TokenPair { #[type_abi] #[derive(NestedEncode, NestedDecode, TopEncode, TopDecode)] pub struct PriceFeed { - pub round_id: u32, + pub round_id: RoundId, pub from: ManagedBuffer, pub to: ManagedBuffer, - pub timestamp: u64, + pub timestamp: Timestamp, pub price: BigUint, pub decimals: u8, } @@ -23,7 +25,7 @@ pub struct PriceFeed { #[derive(TopEncode, TopDecode, Debug, PartialEq, Eq)] pub struct TimestampedPrice { pub price: BigUint, - pub timestamp: u64, + pub timestamp: Timestamp, pub decimals: u8, } diff --git a/contracts/core/price-aggregator/tests/price_aggregator_blackbox_test.rs b/contracts/core/price-aggregator/tests/price_aggregator_blackbox_test.rs index b0e1f54455..c9af71568a 100644 --- a/contracts/core/price-aggregator/tests/price_aggregator_blackbox_test.rs +++ b/contracts/core/price-aggregator/tests/price_aggregator_blackbox_test.rs @@ -1,6 +1,6 @@ use multiversx_price_aggregator_sc::{ price_aggregator_data::{OracleStatus, TimestampedPrice, TokenPair}, - ContractObj, PriceAggregator, MAX_ROUND_DURATION_SECONDS, + PriceAggregator, MAX_ROUND_DURATION_SECONDS, }; use multiversx_sc_scenario::imports::*; @@ -24,6 +24,7 @@ const PRICE_AGGREGATOR_PATH: MxscPath = fn world() -> ScenarioWorld { let mut blockchain = ScenarioWorld::new(); + blockchain.set_current_dir_from_workspace("contracts/core/price-aggregator"); blockchain.register_contract( PRICE_AGGREGATOR_PATH, multiversx_price_aggregator_sc::ContractBuilder, @@ -35,7 +36,6 @@ fn world() -> ScenarioWorld { struct PriceAggregatorTestState { world: ScenarioWorld, oracles: Vec, - price_aggregator_whitebox: WhiteboxContract>, } impl PriceAggregatorTestState { @@ -57,16 +57,7 @@ impl PriceAggregatorTestState { oracles.push(address_value); } - let price_aggregator_whitebox = WhiteboxContract::new( - PRICE_AGGREGATOR_ADDRESS, - multiversx_price_aggregator_sc::contract_obj, - ); - - Self { - world, - oracles, - price_aggregator_whitebox, - } + Self { world, oracles } } fn deploy(&mut self) -> &mut Self { @@ -203,9 +194,10 @@ fn test_price_aggregator_submit() { state.submit(&state.oracles[0].clone(), 95, 100); let current_timestamp = 100; - state - .world - .whitebox_query(&state.price_aggregator_whitebox, |sc| { + + state.world.query().to(PRICE_AGGREGATOR_ADDRESS).whitebox( + multiversx_price_aggregator_sc::contract_obj, + |sc| { let token_pair = TokenPair { from: managed_buffer!(EGLD_TICKER), to: managed_buffer!(USD_TICKER), @@ -237,14 +229,15 @@ fn test_price_aggregator_submit() { accepted_submissions: 1 } ); - }); + }, + ); // first oracle submit again - submission not accepted state.submit(&state.oracles[0].clone(), 95, 100); - state - .world - .whitebox_query(&state.price_aggregator_whitebox, |sc| { + state.world.query().to(PRICE_AGGREGATOR_ADDRESS).whitebox( + multiversx_price_aggregator_sc::contract_obj, + |sc| { assert_eq!( sc.oracle_status() .get(&managed_address!(&state.oracles[0].to_address())) @@ -254,7 +247,8 @@ fn test_price_aggregator_submit() { accepted_submissions: 1 } ); - }); + }, + ); } #[test] @@ -283,9 +277,9 @@ fn test_price_aggregator_submit_round_ok() { // submit third state.submit(&state.oracles[2].clone(), 105, 12_000); - state - .world - .whitebox_query(&state.price_aggregator_whitebox, |sc| { + state.world.query().to(PRICE_AGGREGATOR_ADDRESS).whitebox( + multiversx_price_aggregator_sc::contract_obj, + |sc| { let result = sc.latest_price_feed(managed_buffer!(EGLD_TICKER), managed_buffer!(USD_TICKER)); @@ -312,7 +306,8 @@ fn test_price_aggregator_submit_round_ok() { decimals } ); - }); + }, + ); } #[test] @@ -338,9 +333,9 @@ fn test_price_aggregator_discarded_round() { // submit second - this will discard the previous submission state.submit(&state.oracles[1].clone(), current_timestamp - 1, 11_000); - state - .world - .whitebox_query(&state.price_aggregator_whitebox, |sc| { + state.world.query().to(PRICE_AGGREGATOR_ADDRESS).whitebox( + multiversx_price_aggregator_sc::contract_obj, + |sc| { let token_pair = TokenPair { from: managed_buffer!(EGLD_TICKER), to: managed_buffer!(USD_TICKER), @@ -353,7 +348,8 @@ fn test_price_aggregator_discarded_round() { .unwrap(), managed_biguint!(11_000) ); - }); + }, + ); } #[test] diff --git a/contracts/core/price-aggregator/tests/price_aggregator_proxy.rs b/contracts/core/price-aggregator/tests/price_aggregator_proxy.rs index e96244d668..7a7e2aaa74 100644 --- a/contracts/core/price-aggregator/tests/price_aggregator_proxy.rs +++ b/contracts/core/price-aggregator/tests/price_aggregator_proxy.rs @@ -72,6 +72,25 @@ where } } +#[rustfmt::skip] +impl PriceAggregatorProxyMethods +where + Env: TxEnv, + Env::Api: VMApi, + From: TxFrom, + To: TxTo, + Gas: TxGas, +{ + pub fn upgrade( + self, + ) -> TxTypedUpgrade { + self.wrapped_tx + .payment(NotPayable) + .raw_upgrade() + .original_result() + } +} + #[rustfmt::skip] impl PriceAggregatorProxyMethods where @@ -387,3 +406,11 @@ where pub block: u64, pub epoch: u64, } + +#[type_abi] +#[derive(TopEncode)] +pub struct DiscardSubmissionEvent { + pub submission_timestamp: u64, + pub first_submission_timestamp: u64, + pub has_caller_already_submitted: bool, +} diff --git a/contracts/core/price-aggregator/tests/price_aggregator_stress_blackbox.rs b/contracts/core/price-aggregator/tests/price_aggregator_stress_blackbox.rs index 660bbf1dda..e46ab22e58 100644 --- a/contracts/core/price-aggregator/tests/price_aggregator_stress_blackbox.rs +++ b/contracts/core/price-aggregator/tests/price_aggregator_stress_blackbox.rs @@ -1,6 +1,6 @@ use multiversx_price_aggregator_sc::{ price_aggregator_data::{OracleStatus, TokenPair}, - ContractObj, PriceAggregator, + PriceAggregator, }; use multiversx_sc_scenario::imports::*; @@ -23,6 +23,7 @@ mod price_aggregator_proxy; fn world() -> ScenarioWorld { let mut blockchain = ScenarioWorld::new(); + blockchain.set_current_dir_from_workspace("contracts/core/price-aggregator"); blockchain.register_contract( PRICE_AGGREGATOR_PATH, multiversx_price_aggregator_sc::ContractBuilder, @@ -34,7 +35,6 @@ fn world() -> ScenarioWorld { struct PriceAggregatorTestState { world: ScenarioWorld, oracles: Vec, - price_aggregator_whitebox: WhiteboxContract>, } impl PriceAggregatorTestState { @@ -60,16 +60,7 @@ impl PriceAggregatorTestState { oracles.push(address_value); } - let price_aggregator_whitebox = WhiteboxContract::new( - PRICE_AGGREGATOR_ADDRESS, - multiversx_price_aggregator_sc::contract_obj, - ); - - Self { - world, - oracles, - price_aggregator_whitebox, - } + Self { world, oracles } } fn deploy(&mut self) -> &mut Self { @@ -170,9 +161,9 @@ fn test_price_aggregator_submit() { } let current_timestamp = 100; - state - .world - .whitebox_query(&state.price_aggregator_whitebox, |sc| { + state.world.query().to(PRICE_AGGREGATOR_ADDRESS).whitebox( + multiversx_price_aggregator_sc::contract_obj, + |sc| { let blockchain_timestamp = sc.blockchain().get_block_timestamp(); let token_pair = TokenPair { @@ -207,7 +198,8 @@ fn test_price_aggregator_submit() { } ); } - }); + }, + ); // submit last that resets the round state.submit( diff --git a/contracts/core/price-aggregator/tests/price_aggregator_whitebox_test.rs b/contracts/core/price-aggregator/tests/price_aggregator_whitebox_test.rs index 180301b610..f44d9f76fc 100644 --- a/contracts/core/price-aggregator/tests/price_aggregator_whitebox_test.rs +++ b/contracts/core/price-aggregator/tests/price_aggregator_whitebox_test.rs @@ -4,7 +4,7 @@ use multiversx_price_aggregator_sc::{ }; use multiversx_sc_modules::{ pause::EndpointWrappers as PauseEndpointWrappers, - staking::EndpointWrappers as StakingEndpointWrappers, + staking::{EndpointWrappers as StakingEndpointWrappers, StakingModule}, }; use multiversx_sc_scenario::imports::*; @@ -17,13 +17,15 @@ pub const STAKE_AMOUNT: u64 = 20; pub const SUBMISSION_COUNT: usize = 3; pub const USD_TICKER: &[u8] = b"USDC"; -const OWNER_ADDRESS_EXPR: &str = "address:owner"; -const PRICE_AGGREGATOR_ADDRESS_EXPR: &str = "sc:price-aggregator"; -const PRICE_AGGREGATOR_PATH_EXPR: &str = "mxsc:output/multiversx-price-aggregator-sc.mxsc.json"; +const OWNER_ADDRESS: TestAddress = TestAddress::new("owner"); +const PRICE_AGGREGATOR_ADDRESS: TestSCAddress = TestSCAddress::new("price-aggregator"); +const PRICE_AGGREGATOR_PATH_EXPR: MxscPath = + MxscPath::new("mxsc:output/multiversx-price-aggregator-sc.mxsc.json"); fn world() -> ScenarioWorld { let mut blockchain = ScenarioWorld::new(); + blockchain.set_current_dir_from_workspace("contracts/core/price-aggregator"); blockchain.register_contract( PRICE_AGGREGATOR_PATH_EXPR, multiversx_price_aggregator_sc::ContractBuilder, @@ -35,31 +37,27 @@ fn world() -> ScenarioWorld { #[test] fn test_price_aggregator_submit() { let (mut world, oracles) = setup(); - let price_aggregator_whitebox = WhiteboxContract::new( - PRICE_AGGREGATOR_ADDRESS_EXPR, - multiversx_price_aggregator_sc::contract_obj, - ); // configure the number of decimals - world.whitebox_call( - &price_aggregator_whitebox, - ScCallStep::new().from(OWNER_ADDRESS_EXPR), - |sc| { + world + .tx() + .from(OWNER_ADDRESS) + .to(PRICE_AGGREGATOR_ADDRESS) + .whitebox(multiversx_price_aggregator_sc::contract_obj, |sc| { sc.set_pair_decimals( managed_buffer!(EGLD_TICKER), managed_buffer!(USD_TICKER), DECIMALS, ) - }, - ); + }); // try submit while paused - world.whitebox_call_check( - &price_aggregator_whitebox, - ScCallStep::new() - .from(&oracles[0]) - .expect(TxExpect::user_error("str:Contract is paused")), - |sc| { + world + .tx() + .from(&oracles[0]) + .to(PRICE_AGGREGATOR_ADDRESS) + .returns(ExpectError(4u64, "Contract is paused")) + .whitebox(multiversx_price_aggregator_sc::contract_obj, |sc| { sc.submit( managed_buffer!(EGLD_TICKER), managed_buffer!(USD_TICKER), @@ -67,22 +65,24 @@ fn test_price_aggregator_submit() { managed_biguint!(100), DECIMALS, ) - }, - |r| r.assert_user_error("Contract is paused"), - ); + }); // unpause - world.whitebox_call( - &price_aggregator_whitebox, - ScCallStep::new().from(OWNER_ADDRESS_EXPR), - |sc| sc.call_unpause_endpoint(), - ); + world + .tx() + .from(OWNER_ADDRESS) + .to(PRICE_AGGREGATOR_ADDRESS) + .whitebox(multiversx_price_aggregator_sc::contract_obj, |sc| { + sc.call_unpause_endpoint(); + }); // submit first timestamp too old - world.whitebox_call_check( - &price_aggregator_whitebox, - ScCallStep::new().from(&oracles[0]).no_expect(), - |sc| { + world + .tx() + .from(&oracles[0]) + .to(PRICE_AGGREGATOR_ADDRESS) + .returns(ExpectError(4u64, "First submission too old")) + .whitebox(multiversx_price_aggregator_sc::contract_obj, |sc| { sc.submit( managed_buffer!(EGLD_TICKER), managed_buffer!(USD_TICKER), @@ -90,17 +90,14 @@ fn test_price_aggregator_submit() { managed_biguint!(100), DECIMALS, ) - }, - |r| { - r.assert_user_error("First submission too old"); - }, - ); + }); // submit ok - world.whitebox_call( - &price_aggregator_whitebox, - ScCallStep::new().from(&oracles[0]), - |sc| { + world + .tx() + .from(&oracles[0]) + .to(PRICE_AGGREGATOR_ADDRESS) + .whitebox(multiversx_price_aggregator_sc::contract_obj, |sc| { sc.submit( managed_buffer!(EGLD_TICKER), managed_buffer!(USD_TICKER), @@ -108,49 +105,50 @@ fn test_price_aggregator_submit() { managed_biguint!(100), DECIMALS, ) - }, - ); + }); let current_timestamp = 100; - world.whitebox_query(&price_aggregator_whitebox, |sc| { - let token_pair = TokenPair { - from: managed_buffer!(EGLD_TICKER), - to: managed_buffer!(USD_TICKER), - }; - assert_eq!( - sc.first_submission_timestamp(&token_pair).get(), - current_timestamp - ); - assert_eq!( - sc.last_submission_timestamp(&token_pair).get(), - current_timestamp - ); - - let submissions = sc.submissions().get(&token_pair).unwrap(); - assert_eq!(submissions.len(), 1); - assert_eq!( - submissions - .get(&managed_address!(&oracles[0].to_address())) - .unwrap(), - managed_biguint!(100) - ); - - assert_eq!( - sc.oracle_status() - .get(&managed_address!(&oracles[0].to_address())) - .unwrap(), - OracleStatus { - total_submissions: 1, - accepted_submissions: 1 - } - ); - }); + world.query().to(PRICE_AGGREGATOR_ADDRESS).whitebox( + multiversx_price_aggregator_sc::contract_obj, + |sc| { + let token_pair = TokenPair { + from: managed_buffer!(EGLD_TICKER), + to: managed_buffer!(USD_TICKER), + }; + assert_eq!( + sc.first_submission_timestamp(&token_pair).get(), + current_timestamp + ); + assert_eq!( + sc.last_submission_timestamp(&token_pair).get(), + current_timestamp + ); + + let submissions = sc.submissions().get(&token_pair).unwrap(); + assert_eq!(submissions.len(), 1); + assert_eq!( + submissions.get(&ManagedAddress::from(&oracles[0])).unwrap(), + managed_biguint!(100) + ); + + assert_eq!( + sc.oracle_status() + .get(&ManagedAddress::from(&oracles[0])) + .unwrap(), + OracleStatus { + total_submissions: 1, + accepted_submissions: 1 + } + ); + }, + ); // first oracle submit again - submission not accepted - world.whitebox_call( - &price_aggregator_whitebox, - ScCallStep::new().from(&oracles[0]), - |sc| { + world + .tx() + .from(&oracles[0]) + .to(PRICE_AGGREGATOR_ADDRESS) + .whitebox(multiversx_price_aggregator_sc::contract_obj, |sc| { sc.submit( managed_buffer!(EGLD_TICKER), managed_buffer!(USD_TICKER), @@ -158,55 +156,56 @@ fn test_price_aggregator_submit() { managed_biguint!(100), DECIMALS, ) + }); + + world.query().to(PRICE_AGGREGATOR_ADDRESS).whitebox( + multiversx_price_aggregator_sc::contract_obj, + |sc| { + assert_eq!( + sc.oracle_status() + .get(&ManagedAddress::from(&oracles[0])) + .unwrap(), + OracleStatus { + total_submissions: 2, + accepted_submissions: 1 + } + ); }, ); - - world.whitebox_query(&price_aggregator_whitebox, |sc| { - assert_eq!( - sc.oracle_status() - .get(&managed_address!(&oracles[0].to_address())) - .unwrap(), - OracleStatus { - total_submissions: 2, - accepted_submissions: 1 - } - ); - }); } #[test] fn test_price_aggregator_submit_round_ok() { let (mut world, oracles) = setup(); - let price_aggregator_whitebox = WhiteboxContract::new( - PRICE_AGGREGATOR_ADDRESS_EXPR, - multiversx_price_aggregator_sc::contract_obj, - ); // configure the number of decimals - world.whitebox_call( - &price_aggregator_whitebox, - ScCallStep::new().from(OWNER_ADDRESS_EXPR), - |sc| { + world + .tx() + .from(OWNER_ADDRESS) + .to(PRICE_AGGREGATOR_ADDRESS) + .whitebox(multiversx_price_aggregator_sc::contract_obj, |sc| { sc.set_pair_decimals( managed_buffer!(EGLD_TICKER), managed_buffer!(USD_TICKER), DECIMALS, ) - }, - ); + }); // unpause - world.whitebox_call( - &price_aggregator_whitebox, - ScCallStep::new().from(OWNER_ADDRESS_EXPR), - |sc| sc.call_unpause_endpoint(), - ); + world + .tx() + .from(OWNER_ADDRESS) + .to(PRICE_AGGREGATOR_ADDRESS) + .whitebox(multiversx_price_aggregator_sc::contract_obj, |sc| { + sc.call_unpause_endpoint(); + }); // submit first - world.whitebox_call( - &price_aggregator_whitebox, - ScCallStep::new().from(&oracles[0]), - |sc| { + world + .tx() + .from(&oracles[0]) + .to(PRICE_AGGREGATOR_ADDRESS) + .whitebox(multiversx_price_aggregator_sc::contract_obj, |sc| { sc.submit( managed_buffer!(EGLD_TICKER), managed_buffer!(USD_TICKER), @@ -214,17 +213,17 @@ fn test_price_aggregator_submit_round_ok() { managed_biguint!(10_000), DECIMALS, ) - }, - ); + }); let current_timestamp = 110; - world.set_state_step(SetStateStep::new().block_timestamp(current_timestamp)); + world.current_block().block_timestamp(current_timestamp); // submit second - world.whitebox_call( - &price_aggregator_whitebox, - ScCallStep::new().from(&oracles[1]), - |sc| { + world + .tx() + .from(&oracles[1]) + .to(PRICE_AGGREGATOR_ADDRESS) + .whitebox(multiversx_price_aggregator_sc::contract_obj, |sc| { sc.submit( managed_buffer!(EGLD_TICKER), managed_buffer!(USD_TICKER), @@ -232,14 +231,14 @@ fn test_price_aggregator_submit_round_ok() { managed_biguint!(11_000), DECIMALS, ) - }, - ); + }); // submit third - world.whitebox_call( - &price_aggregator_whitebox, - ScCallStep::new().from(&oracles[2]), - |sc| { + world + .tx() + .from(&oracles[2]) + .to(PRICE_AGGREGATOR_ADDRESS) + .whitebox(multiversx_price_aggregator_sc::contract_obj, |sc| { sc.submit( managed_buffer!(EGLD_TICKER), managed_buffer!(USD_TICKER), @@ -247,72 +246,73 @@ fn test_price_aggregator_submit_round_ok() { managed_biguint!(12_000), DECIMALS, ) + }); + + world.query().to(PRICE_AGGREGATOR_ADDRESS).whitebox( + multiversx_price_aggregator_sc::contract_obj, + |sc| { + let result = + sc.latest_price_feed(managed_buffer!(EGLD_TICKER), managed_buffer!(USD_TICKER)); + + let (round_id, from, to, timestamp, price, decimals) = result.into_tuple(); + assert_eq!(round_id, 1); + assert_eq!(from, managed_buffer!(EGLD_TICKER)); + assert_eq!(to, managed_buffer!(USD_TICKER)); + assert_eq!(timestamp, current_timestamp); + assert_eq!(price, managed_biguint!(11_000)); + assert_eq!(decimals, DECIMALS); + + // submissions are deleted after round is created + let token_pair = TokenPair { from, to }; + let submissions = sc.submissions().get(&token_pair).unwrap(); + assert_eq!(submissions.len(), 0); + + let rounds = sc.rounds().get(&token_pair).unwrap(); + assert_eq!(rounds.len(), 1); + assert_eq!( + rounds.get(1), + TimestampedPrice { + timestamp, + price, + decimals + } + ); }, ); - - world.whitebox_query(&price_aggregator_whitebox, |sc| { - let result = - sc.latest_price_feed(managed_buffer!(EGLD_TICKER), managed_buffer!(USD_TICKER)); - - let (round_id, from, to, timestamp, price, decimals) = result.into_tuple(); - assert_eq!(round_id, 1); - assert_eq!(from, managed_buffer!(EGLD_TICKER)); - assert_eq!(to, managed_buffer!(USD_TICKER)); - assert_eq!(timestamp, current_timestamp); - assert_eq!(price, managed_biguint!(11_000)); - assert_eq!(decimals, DECIMALS); - - // submissions are deleted after round is created - let token_pair = TokenPair { from, to }; - let submissions = sc.submissions().get(&token_pair).unwrap(); - assert_eq!(submissions.len(), 0); - - let rounds = sc.rounds().get(&token_pair).unwrap(); - assert_eq!(rounds.len(), 1); - assert_eq!( - rounds.get(1), - TimestampedPrice { - timestamp, - price, - decimals - } - ); - }); } #[test] fn test_price_aggregator_discarded_round() { let (mut world, oracles) = setup(); - let price_aggregator_whitebox = WhiteboxContract::new( - PRICE_AGGREGATOR_ADDRESS_EXPR, - multiversx_price_aggregator_sc::contract_obj, - ); // configure the number of decimals - world.whitebox_call( - &price_aggregator_whitebox, - ScCallStep::new().from(OWNER_ADDRESS_EXPR), - |sc| { + world + .tx() + .from(OWNER_ADDRESS) + .to(PRICE_AGGREGATOR_ADDRESS) + .whitebox(multiversx_price_aggregator_sc::contract_obj, |sc| { sc.set_pair_decimals( managed_buffer!(EGLD_TICKER), managed_buffer!(USD_TICKER), DECIMALS, ) - }, - ); + }); // unpause - world.whitebox_call( - &price_aggregator_whitebox, - ScCallStep::new().from(OWNER_ADDRESS_EXPR), - |sc| sc.call_unpause_endpoint(), - ); + world + .tx() + .from(OWNER_ADDRESS) + .to(PRICE_AGGREGATOR_ADDRESS) + .whitebox(multiversx_price_aggregator_sc::contract_obj, |sc| { + sc.call_unpause_endpoint(); + }); // submit first - world.whitebox_call( - &price_aggregator_whitebox, - ScCallStep::new().from(&oracles[0]), - |sc| { + world + .tx() + .from(&oracles[0]) + .to(PRICE_AGGREGATOR_ADDRESS) + .whitebox(multiversx_price_aggregator_sc::contract_obj, |sc| { sc.submit( managed_buffer!(EGLD_TICKER), managed_buffer!(USD_TICKER), @@ -320,17 +320,17 @@ fn test_price_aggregator_discarded_round() { managed_biguint!(10_000), DECIMALS, ) - }, - ); + }); let current_timestamp = 100 + MAX_ROUND_DURATION_SECONDS + 1; - world.set_state_step(SetStateStep::new().block_timestamp(current_timestamp)); + world.current_block().block_timestamp(current_timestamp); // submit second - this will discard the previous submission - world.whitebox_call( - &price_aggregator_whitebox, - ScCallStep::new().from(&oracles[1]), - |sc| { + world + .tx() + .from(&oracles[1]) + .to(PRICE_AGGREGATOR_ADDRESS) + .whitebox(multiversx_price_aggregator_sc::contract_obj, |sc| { sc.submit( managed_buffer!(EGLD_TICKER), managed_buffer!(USD_TICKER), @@ -338,77 +338,100 @@ fn test_price_aggregator_discarded_round() { managed_biguint!(11_000), DECIMALS, ) + }); + + world.query().to(PRICE_AGGREGATOR_ADDRESS).whitebox( + multiversx_price_aggregator_sc::contract_obj, + |sc| { + let token_pair = TokenPair { + from: managed_buffer!(EGLD_TICKER), + to: managed_buffer!(USD_TICKER), + }; + let submissions = sc.submissions().get(&token_pair).unwrap(); + assert_eq!(submissions.len(), 1); + assert_eq!( + submissions.get(&managed_address!(&oracles[1])).unwrap(), + managed_biguint!(11_000) + ); }, ); - - world.whitebox_query(&price_aggregator_whitebox, |sc| { - let token_pair = TokenPair { - from: managed_buffer!(EGLD_TICKER), - to: managed_buffer!(USD_TICKER), - }; - let submissions = sc.submissions().get(&token_pair).unwrap(); - assert_eq!(submissions.len(), 1); - assert_eq!( - submissions - .get(&managed_address!(&oracles[1].to_address())) - .unwrap(), - managed_biguint!(11_000) - ); - }); } #[test] fn test_price_aggregator_slashing() { let (mut world, oracles) = setup(); - let price_aggregator_whitebox = WhiteboxContract::new( - PRICE_AGGREGATOR_ADDRESS_EXPR, - multiversx_price_aggregator_sc::contract_obj, - ); - // unpause - world.whitebox_call( - &price_aggregator_whitebox, - ScCallStep::new().from(OWNER_ADDRESS_EXPR), - |sc| sc.call_unpause_endpoint(), - ); - - world.whitebox_call( - &price_aggregator_whitebox, - ScCallStep::new() - .from(&oracles[0]) - .argument(BytesValue::from(oracles[1].to_address().as_bytes())), - |sc| sc.call_vote_slash_member(), - ); - - world.whitebox_call( - &price_aggregator_whitebox, - ScCallStep::new() - .from(&oracles[2]) - .argument(BytesValue::from(oracles[1].to_address().as_bytes())), - |sc| sc.call_vote_slash_member(), - ); + // configure the number of decimals + world + .tx() + .from(OWNER_ADDRESS) + .to(PRICE_AGGREGATOR_ADDRESS) + .whitebox(multiversx_price_aggregator_sc::contract_obj, |sc| { + sc.set_pair_decimals( + managed_buffer!(EGLD_TICKER), + managed_buffer!(USD_TICKER), + DECIMALS, + ) + }); - world.whitebox_call( - &price_aggregator_whitebox, - ScCallStep::new() - .from(&oracles[3]) - .argument(BytesValue::from(oracles[1].to_address().as_bytes())), - |sc| sc.call_vote_slash_member(), + // unpause + world + .tx() + .from(OWNER_ADDRESS) + .to(PRICE_AGGREGATOR_ADDRESS) + .whitebox(multiversx_price_aggregator_sc::contract_obj, |sc| { + sc.call_unpause_endpoint(); + }); + + world + .tx() + .from(&oracles[0]) + .to(PRICE_AGGREGATOR_ADDRESS) + .whitebox(multiversx_price_aggregator_sc::contract_obj, |sc| { + sc.vote_slash_member(ManagedAddress::from(&oracles[1])); + }); + + world + .tx() + .from(&oracles[2]) + .to(PRICE_AGGREGATOR_ADDRESS) + .whitebox(multiversx_price_aggregator_sc::contract_obj, |sc| { + sc.vote_slash_member(ManagedAddress::from(&oracles[1])) + }); + + world + .tx() + .from(&oracles[3]) + .to(PRICE_AGGREGATOR_ADDRESS) + .whitebox(multiversx_price_aggregator_sc::contract_obj, |sc| { + sc.vote_slash_member(ManagedAddress::from(&oracles[1])); + }); + + world.query().to(PRICE_AGGREGATOR_ADDRESS).whitebox( + multiversx_price_aggregator_sc::contract_obj, + |sc| { + let list = sc.slashing_proposal_voters(&ManagedAddress::from(&oracles[1])); + assert!(list.contains(&ManagedAddress::from(&oracles[0]))); + assert!(list.contains(&ManagedAddress::from(&oracles[2]))); + assert!(list.contains(&ManagedAddress::from(&oracles[3]))); + }, ); - world.whitebox_call( - &price_aggregator_whitebox, - ScCallStep::new() - .from(&oracles[0]) - .argument(BytesValue::from(oracles[1].to_address().as_bytes())), - |sc| sc.call_slash_member(), - ); + world + .tx() + .from(&oracles[0]) + .to(PRICE_AGGREGATOR_ADDRESS) + .whitebox(multiversx_price_aggregator_sc::contract_obj, |sc| { + sc.slash_member(ManagedAddress::from(&oracles[1])); + }); // oracle 1 try submit after slashing - world.whitebox_call_check( - &price_aggregator_whitebox, - ScCallStep::new().from(&oracles[1]).no_expect(), - |sc| { + world + .tx() + .from(&oracles[1]) + .to(PRICE_AGGREGATOR_ADDRESS) + .returns(ExpectError(4u64, "only oracles allowed")) + .whitebox(multiversx_price_aggregator_sc::contract_obj, |sc| { sc.submit( managed_buffer!(EGLD_TICKER), managed_buffer!(USD_TICKER), @@ -416,49 +439,37 @@ fn test_price_aggregator_slashing() { managed_biguint!(10_000), DECIMALS, ) - }, - |r| { - r.assert_user_error("only oracles allowed"); - }, - ); + }); } -fn setup() -> (ScenarioWorld, Vec) { +fn setup() -> (ScenarioWorld, Vec
) { // setup let mut world = world(); - let price_aggregator_whitebox = WhiteboxContract::new( - PRICE_AGGREGATOR_ADDRESS_EXPR, - multiversx_price_aggregator_sc::contract_obj, - ); - let price_aggregator_code = world.code_expression(PRICE_AGGREGATOR_PATH_EXPR); - let mut set_state_step = SetStateStep::new() - .put_account(OWNER_ADDRESS_EXPR, Account::new().nonce(1)) - .new_address(OWNER_ADDRESS_EXPR, 1, PRICE_AGGREGATOR_ADDRESS_EXPR) - .block_timestamp(100); + world.account(OWNER_ADDRESS).nonce(1); + world.current_block().block_timestamp(100); let mut oracles = Vec::new(); for i in 1..=NR_ORACLES { - let oracle_address_expr = format!("address:oracle{i}"); - let oracle_address = AddressValue::from(oracle_address_expr.as_str()); - - set_state_step = set_state_step.put_account( - oracle_address_expr.as_str(), - Account::new().nonce(1).balance(STAKE_AMOUNT), - ); - oracles.push(oracle_address); + let oracle_address_expr = format!("oracle{i}"); + let oracle_address = TestAddress::new(&oracle_address_expr); + + world.account(oracle_address).nonce(1).balance(STAKE_AMOUNT); + + oracles.push(oracle_address.to_address()); } // init price aggregator - world.set_state_step(set_state_step).whitebox_deploy( - &price_aggregator_whitebox, - ScDeployStep::new() - .from(OWNER_ADDRESS_EXPR) - .code(price_aggregator_code), - |sc| { + world + .tx() + .from(OWNER_ADDRESS) + .raw_deploy() + .code(PRICE_AGGREGATOR_PATH_EXPR) + .new_address(PRICE_AGGREGATOR_ADDRESS) + .whitebox(multiversx_price_aggregator_sc::contract_obj, |sc| { let mut oracle_args = MultiValueEncoded::new(); for oracle_address in &oracles { - oracle_args.push(managed_address!(&oracle_address.to_address())); + oracle_args.push(ManagedAddress::from(oracle_address)); } sc.init( @@ -469,17 +480,17 @@ fn setup() -> (ScenarioWorld, Vec) { SUBMISSION_COUNT, oracle_args, ) - }, - ); + }); for oracle_address in &oracles { - world.whitebox_call( - &price_aggregator_whitebox, - ScCallStep::new() - .from(oracle_address) - .egld_value(STAKE_AMOUNT), - |sc| sc.call_stake(), - ); + world + .tx() + .from(oracle_address) + .to(PRICE_AGGREGATOR_ADDRESS) + .egld(STAKE_AMOUNT) + .whitebox(multiversx_price_aggregator_sc::contract_obj, |sc| { + sc.call_stake(); + }); } (world, oracles) diff --git a/contracts/core/price-aggregator/wasm/Cargo.lock b/contracts/core/price-aggregator/wasm/Cargo.lock index 83b9347247..ceeb62370c 100644 --- a/contracts/core/price-aggregator/wasm/Cargo.lock +++ b/contracts/core/price-aggregator/wasm/Cargo.lock @@ -4,15 +4,15 @@ version = 3 [[package]] name = "arrayvec" -version = "0.7.4" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" +checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" [[package]] name = "autocfg" -version = "1.3.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" +checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" [[package]] name = "bitflags" @@ -26,6 +26,12 @@ version = "3.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" +[[package]] +name = "byteorder" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" + [[package]] name = "cfg-if" version = "1.0.0" @@ -65,18 +71,18 @@ checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" [[package]] name = "js-sys" -version = "0.3.69" +version = "0.3.72" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29c15563dc2726973df627357ce0c9ddddbea194836909d655df6a75d2cf296d" +checksum = "6a88f1bda2bd75b0452a14784937d796722fdebfe50df998aeb3f0b7603019a9" dependencies = [ "wasm-bindgen", ] [[package]] name = "libc" -version = "0.2.155" +version = "0.2.162" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" +checksum = "18d287de67fe55fd7e1581fe933d965a5a9477b38e949cfa9f8574ef01506398" [[package]] name = "log" @@ -84,9 +90,17 @@ version = "0.4.22" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" +[[package]] +name = "multiversx-chain-core" +version = "0.11.0" +dependencies = [ + "bitflags", + "multiversx-sc-codec", +] + [[package]] name = "multiversx-price-aggregator-sc" -version = "0.51.1" +version = "0.54.1" dependencies = [ "arrayvec", "getrandom", @@ -105,10 +119,11 @@ dependencies = [ [[package]] name = "multiversx-sc" -version = "0.51.1" +version = "0.54.1" dependencies = [ "bitflags", "hex-literal", + "multiversx-chain-core", "multiversx-sc-codec", "multiversx-sc-derive", "num-traits", @@ -117,7 +132,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.20.0" +version = "0.21.0" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -126,7 +141,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.20.0" +version = "0.21.0" dependencies = [ "hex", "proc-macro2", @@ -136,7 +151,7 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.51.1" +version = "0.54.1" dependencies = [ "hex", "proc-macro2", @@ -147,14 +162,14 @@ dependencies = [ [[package]] name = "multiversx-sc-modules" -version = "0.51.1" +version = "0.54.1" dependencies = [ "multiversx-sc", ] [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.51.1" +version = "0.54.1" dependencies = [ "multiversx-sc", ] @@ -179,15 +194,18 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.19.0" +version = "1.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" +checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" [[package]] name = "ppv-lite86" -version = "0.2.17" +version = "0.2.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" +checksum = "77957b295656769bb8ad2b6a6b09d897d94f05c41b069aede1fcdaa675eaea04" +dependencies = [ + "zerocopy", +] [[package]] name = "proc-macro2" @@ -200,9 +218,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.36" +version = "1.0.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" +checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" dependencies = [ "proc-macro2", ] @@ -255,9 +273,9 @@ checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "syn" -version = "2.0.68" +version = "2.0.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "901fa70d88b9d6c98022e23b4136f9f3e54e4662c3bc1bd1d84a42a9a0f0c1e9" +checksum = "9f35bcdf61fd8e7be6caf75f429fdca8beb3ed76584befb503b1569faee373ed" dependencies = [ "proc-macro2", "quote", @@ -266,9 +284,9 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.12" +version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" +checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" [[package]] name = "unwrap-infallible" @@ -284,19 +302,20 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.92" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4be2531df63900aeb2bca0daaaddec08491ee64ceecbee5076636a3b026795a8" +checksum = "128d1e363af62632b8eb57219c8fd7877144af57558fb2ef0368d0087bddeb2e" dependencies = [ "cfg-if", + "once_cell", "wasm-bindgen-macro", ] [[package]] name = "wasm-bindgen-backend" -version = "0.2.92" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "614d787b966d3989fa7bb98a654e369c762374fd3213d212cfc0251257e747da" +checksum = "cb6dd4d3ca0ddffd1dd1c9c04f94b868c37ff5fac97c30b97cff2d74fce3a358" dependencies = [ "bumpalo", "log", @@ -309,9 +328,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.92" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1f8823de937b71b9460c0c34e25f3da88250760bec0ebac694b49997550d726" +checksum = "e79384be7f8f5a9dd5d7167216f022090cf1f9ec128e6e6a482a2cb5c5422c56" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -319,9 +338,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.92" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" +checksum = "26c6ab57572f7a24a4985830b120de1594465e5d500f24afe89e16b4e833ef68" dependencies = [ "proc-macro2", "quote", @@ -332,6 +351,27 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.92" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af190c94f2773fdb3729c55b007a722abb5384da03bc0986df4c289bf5567e96" +checksum = "65fc09f10666a9f147042251e0dda9c18f166ff7de300607007e96bdebc1068d" + +[[package]] +name = "zerocopy" +version = "0.7.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" +dependencies = [ + "byteorder", + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.7.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] diff --git a/contracts/core/price-aggregator/wasm/Cargo.toml b/contracts/core/price-aggregator/wasm/Cargo.toml index bd3972ce4b..73fa57078e 100644 --- a/contracts/core/price-aggregator/wasm/Cargo.toml +++ b/contracts/core/price-aggregator/wasm/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.51.1" +version = "0.54.1" path = "../../../../framework/wasm-adapter" [workspace] diff --git a/contracts/core/price-aggregator/wasm/src/lib.rs b/contracts/core/price-aggregator/wasm/src/lib.rs index 667c425afd..a8e75f4942 100644 --- a/contracts/core/price-aggregator/wasm/src/lib.rs +++ b/contracts/core/price-aggregator/wasm/src/lib.rs @@ -5,9 +5,10 @@ //////////////////////////////////////////////////// // Init: 1 +// Upgrade: 1 // Endpoints: 21 // Async Callback (empty): 1 -// Total number of exported functions: 23 +// Total number of exported functions: 24 #![no_std] @@ -18,6 +19,7 @@ multiversx_sc_wasm_adapter::endpoints! { multiversx_price_aggregator_sc ( init => init + upgrade => upgrade changeAmounts => change_amounts addOracles => add_oracles removeOracles => remove_oracles diff --git a/contracts/core/wegld-swap/Cargo.toml b/contracts/core/wegld-swap/Cargo.toml index da24ab3218..3e7aafeb5d 100644 --- a/contracts/core/wegld-swap/Cargo.toml +++ b/contracts/core/wegld-swap/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "multiversx-wegld-swap-sc" -version = "0.51.1" +version = "0.54.1" authors = [ "Dorin Iancu ", @@ -20,13 +20,13 @@ edition = "2021" path = "src/wegld.rs" [dependencies.multiversx-sc] -version = "0.51.1" +version = "0.54.1" path = "../../../framework/base" [dependencies.multiversx-sc-modules] -version = "0.51.1" +version = "0.54.1" path = "../../../contracts/modules" [dev-dependencies.multiversx-sc-scenario] -version = "0.51.1" +version = "0.54.1" path = "../../../framework/scenario" diff --git a/contracts/core/wegld-swap/meta/Cargo.toml b/contracts/core/wegld-swap/meta/Cargo.toml index 5412bdceca..b062cfd9df 100644 --- a/contracts/core/wegld-swap/meta/Cargo.toml +++ b/contracts/core/wegld-swap/meta/Cargo.toml @@ -11,10 +11,10 @@ publish = false path = ".." [dependencies.multiversx-sc] -version = "0.51.1" +version = "0.54.1" path = "../../../../framework/base" [dependencies.multiversx-sc-meta-lib] -version = "0.51.1" +version = "0.54.1" path = "../../../../framework/meta-lib" default-features = false diff --git a/contracts/core/wegld-swap/src/wegld.rs b/contracts/core/wegld-swap/src/wegld.rs index 4a38cab09e..23a4493494 100644 --- a/contracts/core/wegld-swap/src/wegld.rs +++ b/contracts/core/wegld-swap/src/wegld.rs @@ -55,12 +55,14 @@ pub trait EgldEsdtSwap: multiversx_sc_modules::pause::PauseModule { } #[view(getLockedEgldBalance)] + #[title("lockedEgldBalance")] fn get_locked_egld_balance(&self) -> BigUint { self.blockchain() .get_sc_balance(&EgldOrEsdtTokenIdentifier::egld(), 0) } #[view(getWrappedEgldTokenId)] + #[title("wrappedEgldTokenId")] #[storage_mapper("wrappedEgldTokenId")] fn wrapped_egld_token_id(&self) -> SingleValueMapper; } diff --git a/contracts/core/wegld-swap/tests/wegld_swap_scenario_rs_test.rs b/contracts/core/wegld-swap/tests/wegld_swap_scenario_rs_test.rs index a93bedb10f..01770e4b2e 100644 --- a/contracts/core/wegld-swap/tests/wegld_swap_scenario_rs_test.rs +++ b/contracts/core/wegld-swap/tests/wegld_swap_scenario_rs_test.rs @@ -2,6 +2,7 @@ use multiversx_sc_scenario::*; fn world() -> ScenarioWorld { let mut blockchain = ScenarioWorld::new(); + blockchain.set_current_dir_from_workspace("contracts/core/wegld-swap"); blockchain.register_contract( "mxsc:output/multiversx-wegld-swap-sc.mxsc.json", diff --git a/contracts/core/wegld-swap/wasm/Cargo.toml b/contracts/core/wegld-swap/wasm/Cargo.toml index 36108d6fbe..0895bbae9e 100644 --- a/contracts/core/wegld-swap/wasm/Cargo.toml +++ b/contracts/core/wegld-swap/wasm/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.51.1" +version = "0.54.1" path = "../../../../framework/wasm-adapter" [workspace] diff --git a/contracts/examples/adder/Cargo.toml b/contracts/examples/adder/Cargo.toml index 0f3fdd5743..fbe8a8ff88 100644 --- a/contracts/examples/adder/Cargo.toml +++ b/contracts/examples/adder/Cargo.toml @@ -9,9 +9,9 @@ publish = false path = "src/adder.rs" [dependencies.multiversx-sc] -version = "0.51.1" +version = "0.54.1" path = "../../../framework/base" [dev-dependencies.multiversx-sc-scenario] -version = "0.51.1" -path = "../../../framework/scenario" +version = "0.54.1" +path = "../../../framework/scenario" \ No newline at end of file diff --git a/contracts/examples/adder/interact/adder-owner.pem b/contracts/examples/adder/interact/adder-owner.pem deleted file mode 100644 index 66f04c2160..0000000000 --- a/contracts/examples/adder/interact/adder-owner.pem +++ /dev/null @@ -1,5 +0,0 @@ ------BEGIN PRIVATE KEY for erd1s0a83vp2wmsvgphplkn8amkn8tnfd777zlut3e2lazgdzdu6z46qpgx3vz----- -MWIyYTQ3ZmIzMzcxODUxZTE3Njk5N2M0NTNmZDY1ODFkM2U5NjlhYmM1ODMzMTI0 -MjNkYzAyNGI3YzZlNmVlNjgzZmE3OGIwMmE3NmUwYzQwNmUxZmRhNjdlZWVkMzNh -ZTY5NmZiZGUxN2Y4YjhlNTVmZTg5MGQxMzc5YTE1NzQ= ------END PRIVATE KEY for erd1s0a83vp2wmsvgphplkn8amkn8tnfd777zlut3e2lazgdzdu6z46qpgx3vz----- \ No newline at end of file diff --git a/contracts/examples/adder/interact/config.toml b/contracts/examples/adder/interact/config.toml deleted file mode 100644 index 61ac8dbf87..0000000000 --- a/contracts/examples/adder/interact/config.toml +++ /dev/null @@ -1 +0,0 @@ -gateway = 'https://devnet-gateway.multiversx.com' diff --git a/contracts/examples/adder/interact/src/basic_interact.rs b/contracts/examples/adder/interact/src/basic_interact.rs deleted file mode 100644 index 262eb13631..0000000000 --- a/contracts/examples/adder/interact/src/basic_interact.rs +++ /dev/null @@ -1,245 +0,0 @@ -mod basic_interact_cli; -mod basic_interact_config; -mod basic_interact_state; - -use adder::adder_proxy; -use basic_interact_config::Config; -use basic_interact_state::State; -use clap::Parser; - -use multiversx_sc_snippets::imports::*; - -const INTERACTOR_SCENARIO_TRACE_PATH: &str = "interactor_trace.scen.json"; - -const ADDER_CODE_PATH: MxscPath = MxscPath::new("../output/adder.mxsc.json"); - -#[tokio::main] -async fn main() { - env_logger::init(); - - let mut basic_interact = AdderInteract::init().await; - - let cli = basic_interact_cli::InteractCli::parse(); - match &cli.command { - Some(basic_interact_cli::InteractCliCommand::Add(args)) => { - if args.count == 1 { - basic_interact.add(args.value).await; - } else { - basic_interact.multi_add(args.value, args.count).await; - } - }, - Some(basic_interact_cli::InteractCliCommand::Deploy) => { - basic_interact.deploy().await; - }, - Some(basic_interact_cli::InteractCliCommand::Feed) => { - basic_interact.feed_contract_egld().await; - }, - Some(basic_interact_cli::InteractCliCommand::MultiDeploy(args)) => { - basic_interact.multi_deploy(args.count).await; - }, - Some(basic_interact_cli::InteractCliCommand::Sum) => { - basic_interact.print_sum().await; - }, - Some(basic_interact_cli::InteractCliCommand::Upgrade(args)) => { - basic_interact.upgrade(args.value).await - }, - None => {}, - } -} - -#[allow(unused)] -struct AdderInteract { - interactor: Interactor, - adder_owner_address: Bech32Address, - wallet_address: Bech32Address, - state: State, -} - -impl AdderInteract { - async fn init() -> Self { - let config = Config::load_config(); - let mut interactor = Interactor::new(config.gateway()) - .await - .with_tracer(INTERACTOR_SCENARIO_TRACE_PATH) - .await; - - let adder_owner_address = - interactor.register_wallet(Wallet::from_pem_file("adder-owner.pem").unwrap()); - let wallet_address = interactor.register_wallet(test_wallets::mike()); - - Self { - interactor, - adder_owner_address: adder_owner_address.into(), - wallet_address: wallet_address.into(), - state: State::load_state(), - } - } - - async fn set_state(&mut self) { - println!("wallet address: {}", self.wallet_address); - self.interactor - .retrieve_account(&self.adder_owner_address) - .await; - self.interactor.retrieve_account(&self.wallet_address).await; - } - - async fn deploy(&mut self) { - // warning: multi deploy not yet fully supported - // only works with last deployed address - - self.set_state().await; - - let new_address = self - .interactor - .tx() - .from(&self.adder_owner_address) - .gas(3_000_000) - .typed(adder_proxy::AdderProxy) - .init(0u32) - .code(ADDER_CODE_PATH) - .code_metadata(CodeMetadata::UPGRADEABLE) - .returns(ReturnsNewBech32Address) - .prepare_async() - .run() - .await; - - println!("new address: {new_address}"); - self.state.set_adder_address(new_address); - } - - async fn multi_deploy(&mut self, count: usize) { - if count == 0 { - println!("count must be greater than 0"); - return; - } - - self.set_state().await; - println!("deploying {count} contracts..."); - - let mut buffer = self.interactor.homogenous_call_buffer(); - for _ in 0..count { - buffer.push_tx(|tx| { - tx.from(&self.wallet_address) - .typed(adder_proxy::AdderProxy) - .init(0u32) - .code(ADDER_CODE_PATH) - .gas(3_000_000) - .returns(ReturnsNewBech32Address) - }); - } - - let results = buffer.run().await; - - // warning: multi deploy not yet fully supported - // only works with last deployed address - - for new_address in results { - println!("new address: {new_address}"); - - self.state.set_adder_address(new_address); - } - } - - async fn multi_add(&mut self, value: u32, count: usize) { - self.set_state().await; - println!("calling contract {count} times..."); - - let mut buffer = self.interactor.homogenous_call_buffer(); - for _ in 0..count { - buffer.push_tx(|tx| { - tx.from(&self.wallet_address) - .to(self.state.current_adder_address()) - .typed(adder_proxy::AdderProxy) - .add(value) - .gas(3_000_000) - }); - } - - let _ = buffer.run().await; - - println!("successfully performed add {count} times"); - } - - async fn feed_contract_egld(&mut self) { - self.interactor - .tx() - .from(&self.wallet_address) - .to(self.state.current_adder_address()) - .egld(NumExpr("0,050000000000000000")) - .prepare_async() - .run() - .await; - } - - async fn add(&mut self, value: u32) { - self.interactor - .tx() - .from(&self.wallet_address) - .to(self.state.current_adder_address()) - .gas(3_000_000) - .typed(adder_proxy::AdderProxy) - .add(value) - .prepare_async() - .run() - .await; - - println!("successfully performed add"); - } - - async fn print_sum(&mut self) { - let sum = self - .interactor - .query() - .to(self.state.current_adder_address()) - .typed(adder_proxy::AdderProxy) - .sum() - .returns(ReturnsResultUnmanaged) - .prepare_async() - .run() - .await; - - println!("sum: {sum}"); - } - - async fn upgrade(&mut self, new_value: u32) { - let response = self - .interactor - .tx() - .from(&self.wallet_address) - .to(self.state.current_adder_address()) - .gas(3_000_000) - .typed(adder_proxy::AdderProxy) - .upgrade(BigUint::from(new_value)) - .code_metadata(CodeMetadata::UPGRADEABLE) - .code(ADDER_CODE_PATH) - .returns(ReturnsResultUnmanaged) - .prepare_async() - .run() - .await; - - let sum = self - .interactor - .query() - .to(self.state.current_adder_address()) - .typed(adder_proxy::AdderProxy) - .sum() - .returns(ReturnsResultUnmanaged) - .prepare_async() - .run() - .await; - assert_eq!(sum, RustBigUint::from(new_value)); - - println!("response: {response:?}"); - } -} - -#[tokio::test] -#[ignore = "run on demand"] -async fn test() { - let mut basic_interact = AdderInteract::init().await; - - basic_interact.deploy().await; - basic_interact.add(1u32).await; - - basic_interact.upgrade(7u32).await; -} diff --git a/contracts/examples/adder/interact/src/basic_interact_config.rs b/contracts/examples/adder/interact/src/basic_interact_config.rs deleted file mode 100644 index e17d0cbe65..0000000000 --- a/contracts/examples/adder/interact/src/basic_interact_config.rs +++ /dev/null @@ -1,26 +0,0 @@ -use serde::Deserialize; -use std::io::Read; - -/// Config file -const CONFIG_FILE: &str = "config.toml"; - -/// Adder Interact configuration -#[derive(Debug, Deserialize)] -pub struct Config { - gateway: String, -} - -impl Config { - // Deserializes config from file - pub fn load_config() -> Self { - let mut file = std::fs::File::open(CONFIG_FILE).unwrap(); - let mut content = String::new(); - file.read_to_string(&mut content).unwrap(); - toml::from_str(&content).unwrap() - } - - // Returns the gateway - pub fn gateway(&self) -> &str { - &self.gateway - } -} diff --git a/contracts/examples/adder/interactor/.gitignore b/contracts/examples/adder/interactor/.gitignore new file mode 100644 index 0000000000..88af50ac47 --- /dev/null +++ b/contracts/examples/adder/interactor/.gitignore @@ -0,0 +1,5 @@ +# Pem files are used for interactions, but shouldn't be committed +*.pem + +# Temporary storage of deployed contract address, so we can preserve the context between executions. +state.toml diff --git a/contracts/examples/adder/interact/Cargo.toml b/contracts/examples/adder/interactor/Cargo.toml similarity index 54% rename from contracts/examples/adder/interact/Cargo.toml rename to contracts/examples/adder/interactor/Cargo.toml index e862b03ba6..30db735223 100644 --- a/contracts/examples/adder/interact/Cargo.toml +++ b/contracts/examples/adder/interactor/Cargo.toml @@ -1,22 +1,29 @@ [package] -name = "basic-interact" +name = "basic-interactor" version = "0.0.0" -authors = ["Ovidiu Stinga "] +authors = ["MultiversX "] edition = "2021" publish = false [[bin]] -name = "basic-interact" -path = "src/basic_interact.rs" +name = "basic-interactor" +path = "src/basic_interactor_main.rs" -[dependencies] -clap = { version = "4.4.7", features = ["derive"] } -serde = { version = "1.0", features = ["derive"] } -toml = "0.8.6" +[lib] +path = "src/basic_interactor.rs" [dependencies.adder] path = ".." [dependencies.multiversx-sc-snippets] -version = "0.51.1" +version = "0.54.1" path = "../../../../framework/snippets" + +[dependencies] +clap = { version = "4.4.7", features = ["derive"] } +serde = { version = "1.0", features = ["derive"] } +toml = "0.8.6" +tokio = { version = "1.24" } + +[features] +chain-simulator-tests = [] diff --git a/contracts/examples/adder/interactor/config.toml b/contracts/examples/adder/interactor/config.toml new file mode 100644 index 0000000000..97acd5a5c6 --- /dev/null +++ b/contracts/examples/adder/interactor/config.toml @@ -0,0 +1,7 @@ + +# chain_type = 'simulator' +# gateway_uri = 'http://localhost:8085' + +chain_type = 'real' +gateway_uri = 'https://devnet-gateway.multiversx.com' + diff --git a/contracts/examples/adder/interactor/src/basic_interactor.rs b/contracts/examples/adder/interactor/src/basic_interactor.rs new file mode 100644 index 0000000000..63d71de11a --- /dev/null +++ b/contracts/examples/adder/interactor/src/basic_interactor.rs @@ -0,0 +1,137 @@ +mod basic_interactor_cli; +mod basic_interactor_config; +mod basic_interactor_state; + +use adder::adder_proxy; +pub use basic_interactor_config::Config; +use basic_interactor_state::State; +use clap::Parser; + +use multiversx_sc_snippets::imports::*; + +const ADDER_CODE_PATH: MxscPath = MxscPath::new("../output/adder.mxsc.json"); + +pub async fn adder_cli() { + env_logger::init(); + + let config = Config::load_config(); + + let mut basic_interact = AdderInteract::new(config).await; + + let cli = basic_interactor_cli::InteractCli::parse(); + match &cli.command { + Some(basic_interactor_cli::InteractCliCommand::Deploy) => { + basic_interact.deploy().await; + }, + Some(basic_interactor_cli::InteractCliCommand::Upgrade(args)) => { + let owner_address = basic_interact.adder_owner_address.clone(); + basic_interact + .upgrade(args.value, &owner_address, None) + .await + }, + Some(basic_interactor_cli::InteractCliCommand::Add(args)) => { + basic_interact.add(args.value).await; + }, + Some(basic_interactor_cli::InteractCliCommand::Sum) => { + let sum = basic_interact.get_sum().await; + println!("sum: {sum}"); + }, + None => {}, + } +} + +pub struct AdderInteract { + pub interactor: Interactor, + pub adder_owner_address: Bech32Address, + pub wallet_address: Bech32Address, + pub state: State, +} + +impl AdderInteract { + pub async fn new(config: Config) -> Self { + let mut interactor = Interactor::new(config.gateway_uri()) + .await + .use_chain_simulator(config.use_chain_simulator()); + interactor.set_current_dir_from_workspace("contracts/examples/adder/interactor"); + + let adder_owner_address = interactor.register_wallet(test_wallets::heidi()).await; + let wallet_address = interactor.register_wallet(test_wallets::ivan()).await; + + interactor.generate_blocks_until_epoch(1).await.unwrap(); + + AdderInteract { + interactor, + adder_owner_address: adder_owner_address.into(), + wallet_address: wallet_address.into(), + state: State::load_state(), + } + } + + pub async fn deploy(&mut self) { + let new_address = self + .interactor + .tx() + .from(&self.adder_owner_address.clone()) + .gas(6_000_000) + .typed(adder_proxy::AdderProxy) + .init(0u64) + .code(ADDER_CODE_PATH) + .returns(ReturnsNewBech32Address) + .run() + .await; + + println!("new address: {new_address}"); + self.state.set_adder_address(new_address); + } + + pub async fn upgrade(&mut self, new_value: u32, sender: &Bech32Address, err: Option<&str>) { + let response = self + .interactor + .tx() + .from(sender) + .to(self.state.current_adder_address()) + .gas(6_000_000) + .typed(adder_proxy::AdderProxy) + .upgrade(new_value) + .code(ADDER_CODE_PATH) + .code_metadata(CodeMetadata::UPGRADEABLE) + .returns(ReturnsHandledOrError::new()) + .run() + .await; + + match response { + Ok(_) => { + println!("Contract successfully upgraded."); + }, + Err(tx_err) => { + println!("Contract failed upgrade with error: {}", tx_err.message); + assert_eq!(tx_err.message, err.unwrap_or_default()); + }, + } + } + + pub async fn add(&mut self, value: u32) { + self.interactor + .tx() + .from(&self.wallet_address) + .to(self.state.current_adder_address()) + .gas(6_000_000u64) + .typed(adder_proxy::AdderProxy) + .add(value) + .run() + .await; + + println!("Successfully performed add"); + } + + pub async fn get_sum(&mut self) -> RustBigUint { + self.interactor + .query() + .to(self.state.current_adder_address()) + .typed(adder_proxy::AdderProxy) + .sum() + .returns(ReturnsResultUnmanaged) + .run() + .await + } +} diff --git a/contracts/examples/adder/interact/src/basic_interact_cli.rs b/contracts/examples/adder/interactor/src/basic_interactor_cli.rs similarity index 79% rename from contracts/examples/adder/interact/src/basic_interact_cli.rs rename to contracts/examples/adder/interactor/src/basic_interactor_cli.rs index 6766981802..3a4a98e502 100644 --- a/contracts/examples/adder/interact/src/basic_interact_cli.rs +++ b/contracts/examples/adder/interactor/src/basic_interactor_cli.rs @@ -12,18 +12,14 @@ pub struct InteractCli { /// Adder Interact CLI Commands #[derive(Clone, PartialEq, Eq, Debug, Subcommand)] pub enum InteractCliCommand { - #[command(name = "add", about = "Add value")] - Add(AddArgs), #[command(name = "deploy", about = "Deploy contract")] Deploy, - #[command(name = "feed", about = "Feed contract EGLD")] - Feed, - #[command(name = "multi-deploy", about = "Multiple deploy contracts")] - MultiDeploy(MultiDeployArgs), - #[command(name = "sum", about = "Print sum")] - Sum, #[command(name = "upgrade", about = "Upgrade contract")] Upgrade(UpgradeArgs), + #[command(name = "sum", about = "Print sum")] + Sum, + #[command(name = "add", about = "Add value")] + Add(AddArgs), } #[derive(Default, Clone, PartialEq, Eq, Debug, Args)] @@ -31,10 +27,6 @@ pub struct AddArgs { /// The value to add #[arg(short = 'v', long = "value")] pub value: u32, - - /// Repeat this number of times - #[arg(short = 'c', long = "count", default_value = "1")] - pub count: usize, } #[derive(Default, Clone, PartialEq, Eq, Debug, Args)] diff --git a/contracts/examples/adder/interactor/src/basic_interactor_config.rs b/contracts/examples/adder/interactor/src/basic_interactor_config.rs new file mode 100644 index 0000000000..bd19da629d --- /dev/null +++ b/contracts/examples/adder/interactor/src/basic_interactor_config.rs @@ -0,0 +1,49 @@ +use serde::Deserialize; +use std::io::Read; + +/// Config file +const CONFIG_FILE: &str = "config.toml"; + +#[derive(Debug, Deserialize)] +#[serde(rename_all = "lowercase")] +pub enum ChainType { + Real, + Simulator, +} + +/// Adder Interact configuration +#[derive(Debug, Deserialize)] +pub struct Config { + pub gateway_uri: String, + pub chain_type: ChainType, +} + +impl Config { + // Deserializes config from file + pub fn load_config() -> Self { + let mut file = std::fs::File::open(CONFIG_FILE).unwrap(); + let mut content = String::new(); + file.read_to_string(&mut content).unwrap(); + toml::from_str(&content).unwrap() + } + + pub fn chain_simulator_config() -> Self { + Config { + gateway_uri: "http://localhost:8085".to_owned(), + chain_type: ChainType::Simulator, + } + } + + // Returns the gateway URI + pub fn gateway_uri(&self) -> &str { + &self.gateway_uri + } + + // Returns if chain type is chain simulator + pub fn use_chain_simulator(&self) -> bool { + match self.chain_type { + ChainType::Real => false, + ChainType::Simulator => true, + } + } +} diff --git a/contracts/examples/adder/interactor/src/basic_interactor_main.rs b/contracts/examples/adder/interactor/src/basic_interactor_main.rs new file mode 100644 index 0000000000..72c8291332 --- /dev/null +++ b/contracts/examples/adder/interactor/src/basic_interactor_main.rs @@ -0,0 +1,6 @@ +extern crate basic_interactor; + +#[tokio::main] +pub async fn main() { + basic_interactor::adder_cli().await; +} diff --git a/contracts/examples/adder/interact/src/basic_interact_state.rs b/contracts/examples/adder/interactor/src/basic_interactor_state.rs similarity index 97% rename from contracts/examples/adder/interact/src/basic_interact_state.rs rename to contracts/examples/adder/interactor/src/basic_interactor_state.rs index 41453e36fd..bcab774134 100644 --- a/contracts/examples/adder/interact/src/basic_interact_state.rs +++ b/contracts/examples/adder/interactor/src/basic_interactor_state.rs @@ -8,7 +8,7 @@ use std::{ /// State file const STATE_FILE: &str = "state.toml"; -/// Multisig Interact state +/// Adder Interact state #[derive(Debug, Default, Serialize, Deserialize)] pub struct State { adder_address: Option, diff --git a/contracts/examples/adder/interactor/tests/basic_interactor_cs_test.rs b/contracts/examples/adder/interactor/tests/basic_interactor_cs_test.rs new file mode 100644 index 0000000000..1f07ee4c87 --- /dev/null +++ b/contracts/examples/adder/interactor/tests/basic_interactor_cs_test.rs @@ -0,0 +1,35 @@ +use basic_interactor::{AdderInteract, Config}; + +#[tokio::test] +#[cfg_attr(not(feature = "chain-simulator-tests"), ignore)] +async fn simulator_upgrade_test() { + let mut basic_interact = AdderInteract::new(Config::chain_simulator_config()).await; + + basic_interact.deploy().await; + basic_interact.add(1u32).await; + + // Sum will be 1 + let sum = basic_interact.get_sum().await; + assert_eq!(sum, 1u32.into()); + + basic_interact + .upgrade(7u32, &basic_interact.adder_owner_address.clone(), None) + .await; + + // Sum will be the updated value of 7 + let sum = basic_interact.get_sum().await; + assert_eq!(sum, 7u32.into()); + + // Upgrade fails + basic_interact + .upgrade( + 10u32, + &basic_interact.wallet_address.clone(), + Some("upgrade is allowed only for owner"), + ) + .await; + + // Sum will remain 7 + let sum = basic_interact.get_sum().await; + assert_eq!(sum, 7u32.into()); +} diff --git a/contracts/examples/adder/meta/Cargo.toml b/contracts/examples/adder/meta/Cargo.toml index b847ab37dc..24e88b2311 100644 --- a/contracts/examples/adder/meta/Cargo.toml +++ b/contracts/examples/adder/meta/Cargo.toml @@ -8,6 +8,6 @@ publish = false path = ".." [dependencies.multiversx-sc-meta-lib] -version = "0.51.1" +version = "0.54.1" path = "../../../../framework/meta-lib" default-features = false diff --git a/contracts/examples/adder/mxsc-template.toml b/contracts/examples/adder/mxsc-template.toml index 490557cc50..f6a6bb7815 100644 --- a/contracts/examples/adder/mxsc-template.toml +++ b/contracts/examples/adder/mxsc-template.toml @@ -16,9 +16,10 @@ files_include = [ "README.md", "sc-config.toml", "multiversx.json", - "interact/Cargo.toml", - "interact/config.toml", - "interact/.gitignore", - "interact/src", + "interactor/Cargo.toml", + "interactor/config.toml", + "interactor/.gitignore", + "interactor/src", + "interactor/tests", ] has_interactor = true diff --git a/contracts/examples/adder/tests/adder_blackbox_test.rs b/contracts/examples/adder/tests/adder_blackbox_test.rs index 9f155c4e3a..fe28fa8e4b 100644 --- a/contracts/examples/adder/tests/adder_blackbox_test.rs +++ b/contracts/examples/adder/tests/adder_blackbox_test.rs @@ -9,6 +9,7 @@ const CODE_PATH: MxscPath = MxscPath::new("output/adder.mxsc.json"); fn world() -> ScenarioWorld { let mut blockchain = ScenarioWorld::new(); + blockchain.set_current_dir_from_workspace("contracts/examples/adder"); blockchain.register_contract(CODE_PATH, adder::ContractBuilder); blockchain } diff --git a/contracts/examples/adder/tests/adder_scenario_rs_test.rs b/contracts/examples/adder/tests/adder_scenario_rs_test.rs index f9ee7a3a1c..6c123e4da5 100644 --- a/contracts/examples/adder/tests/adder_scenario_rs_test.rs +++ b/contracts/examples/adder/tests/adder_scenario_rs_test.rs @@ -3,6 +3,7 @@ use multiversx_sc_scenario::*; fn world() -> ScenarioWorld { let mut blockchain = ScenarioWorld::new(); + blockchain.set_current_dir_from_workspace("contracts/examples/adder"); blockchain.register_contract("mxsc:output/adder.mxsc.json", adder::ContractBuilder); blockchain } diff --git a/contracts/examples/adder/tests/adder_whitebox_test.rs b/contracts/examples/adder/tests/adder_whitebox_test.rs index 9e7abe4a51..f582b26b81 100644 --- a/contracts/examples/adder/tests/adder_whitebox_test.rs +++ b/contracts/examples/adder/tests/adder_whitebox_test.rs @@ -1,49 +1,51 @@ use adder::*; use multiversx_sc_scenario::imports::*; -const ADDER_PATH_EXPR: &str = "mxsc:output/adder.mxsc.json"; +const OWNER: TestAddress = TestAddress::new("owner"); +const ADDER_ADDRESS: TestSCAddress = TestSCAddress::new("adder"); +const CODE_PATH: MxscPath = MxscPath::new("mxsc:output/adder.mxsc.json"); fn world() -> ScenarioWorld { let mut blockchain = ScenarioWorld::new(); - blockchain.register_contract("mxsc:output/adder.mxsc.json", adder::ContractBuilder); + blockchain.set_current_dir_from_workspace("contracts/examples/adder"); + blockchain.register_contract(CODE_PATH, adder::ContractBuilder); blockchain } #[test] fn adder_whitebox() { let mut world = world(); - let adder_whitebox = WhiteboxContract::new("sc:adder", adder::contract_obj); - let adder_code = world.code_expression(ADDER_PATH_EXPR); + + world.account(OWNER).nonce(1); + + let new_address = world + .tx() + .from(OWNER) + .raw_deploy() + .code(CODE_PATH) + .new_address(ADDER_ADDRESS) + .returns(ReturnsNewBech32Address) + .whitebox(adder::contract_obj, |sc| { + sc.init(BigUint::from(3u64)); + }); + + assert_eq!(new_address, ADDER_ADDRESS.to_address().into()); world - .set_state_step( - SetStateStep::new() - .put_account("address:owner", Account::new().nonce(1)) - .new_address("address:owner", 1, "sc:adder"), - ) - .whitebox_deploy( - &adder_whitebox, - ScDeployStep::new().from("address:owner").code(adder_code), - |sc| { - sc.init(5u32.into()); - }, - ) - .whitebox_query(&adder_whitebox, |sc| { - let sum_value = sc.sum(); - assert_eq!(sum_value.get(), 5u32); - }) - .whitebox_call( - &adder_whitebox, - ScCallStep::new().from("address:owner"), - |sc| sc.add(3u32.into()), - ) - .check_state_step( - CheckStateStep::new() - .put_account("address:owner", CheckAccount::new()) - .put_account( - "sc:adder", - CheckAccount::new().check_storage("str:sum", "8"), - ), - ); + .tx() + .from(OWNER) + .to(ADDER_ADDRESS) + .whitebox(adder::contract_obj, |sc| { + sc.add(BigUint::from(5u64)); + }); + + let _raw_response = world + .query() + .to(ADDER_ADDRESS) + .returns(ReturnsRawResult) + .whitebox(adder::contract_obj, |sc| { + let sum = sc.sum().get(); + assert_eq!(sum, BigUint::from(8u64)); + }); } diff --git a/contracts/examples/adder/wasm/Cargo.lock b/contracts/examples/adder/wasm/Cargo.lock index c044098158..4f993f79ea 100755 --- a/contracts/examples/adder/wasm/Cargo.lock +++ b/contracts/examples/adder/wasm/Cargo.lock @@ -19,15 +19,15 @@ dependencies = [ [[package]] name = "arrayvec" -version = "0.7.4" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" +checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" [[package]] name = "autocfg" -version = "1.3.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" +checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" [[package]] name = "bitflags" @@ -53,12 +53,21 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" +[[package]] +name = "multiversx-chain-core" +version = "0.11.0" +dependencies = [ + "bitflags", + "multiversx-sc-codec", +] + [[package]] name = "multiversx-sc" -version = "0.51.1" +version = "0.54.1" dependencies = [ "bitflags", "hex-literal", + "multiversx-chain-core", "multiversx-sc-codec", "multiversx-sc-derive", "num-traits", @@ -67,7 +76,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.20.0" +version = "0.21.0" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -76,7 +85,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.20.0" +version = "0.21.0" dependencies = [ "hex", "proc-macro2", @@ -86,7 +95,7 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.51.1" +version = "0.54.1" dependencies = [ "hex", "proc-macro2", @@ -97,7 +106,7 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.51.1" +version = "0.54.1" dependencies = [ "multiversx-sc", ] @@ -131,9 +140,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.36" +version = "1.0.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" +checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" dependencies = [ "proc-macro2", ] @@ -156,9 +165,9 @@ checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "syn" -version = "2.0.68" +version = "2.0.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "901fa70d88b9d6c98022e23b4136f9f3e54e4662c3bc1bd1d84a42a9a0f0c1e9" +checksum = "9f35bcdf61fd8e7be6caf75f429fdca8beb3ed76584befb503b1569faee373ed" dependencies = [ "proc-macro2", "quote", @@ -167,9 +176,9 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.12" +version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" +checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" [[package]] name = "unwrap-infallible" diff --git a/contracts/examples/adder/wasm/Cargo.toml b/contracts/examples/adder/wasm/Cargo.toml index 5ee83722de..7d1f358b83 100644 --- a/contracts/examples/adder/wasm/Cargo.toml +++ b/contracts/examples/adder/wasm/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.51.1" +version = "0.54.1" path = "../../../../framework/wasm-adapter" [workspace] diff --git a/contracts/examples/bonding-curve-contract/Cargo.toml b/contracts/examples/bonding-curve-contract/Cargo.toml index 983e393373..bd5067fa5a 100644 --- a/contracts/examples/bonding-curve-contract/Cargo.toml +++ b/contracts/examples/bonding-curve-contract/Cargo.toml @@ -9,14 +9,14 @@ publish = false path = "src/bonding_curve_contract.rs" [dependencies.multiversx-sc] -version = "0.51.1" +version = "0.54.1" path = "../../../framework/base" [dependencies.multiversx-sc-modules] -version = "0.51.1" +version = "0.54.1" path = "../../../contracts/modules" [dev-dependencies.multiversx-sc-scenario] -version = "0.51.1" +version = "0.54.1" path = "../../../framework/scenario" diff --git a/contracts/examples/bonding-curve-contract/meta/Cargo.toml b/contracts/examples/bonding-curve-contract/meta/Cargo.toml index a0de3197f2..abd12aced4 100644 --- a/contracts/examples/bonding-curve-contract/meta/Cargo.toml +++ b/contracts/examples/bonding-curve-contract/meta/Cargo.toml @@ -9,6 +9,6 @@ publish = false path = ".." [dependencies.multiversx-sc-meta-lib] -version = "0.51.1" +version = "0.54.1" path = "../../../../framework/meta-lib" default-features = false diff --git a/contracts/examples/bonding-curve-contract/tests/bonding_curve_scenario_rs_test.rs b/contracts/examples/bonding-curve-contract/tests/bonding_curve_scenario_rs_test.rs index 81a143734b..20cc3e77bc 100644 --- a/contracts/examples/bonding-curve-contract/tests/bonding_curve_scenario_rs_test.rs +++ b/contracts/examples/bonding-curve-contract/tests/bonding_curve_scenario_rs_test.rs @@ -2,6 +2,7 @@ use multiversx_sc_scenario::*; fn world() -> ScenarioWorld { let mut blockchain = ScenarioWorld::new(); + blockchain.set_current_dir_from_workspace("contracts/examples/bonding-curve-contract"); blockchain.register_contract( "mxsc:output/bonding-curve-contract.mxsc.json", bonding_curve_contract::ContractBuilder, diff --git a/contracts/examples/bonding-curve-contract/wasm/Cargo.lock b/contracts/examples/bonding-curve-contract/wasm/Cargo.lock index 72019eb4d6..17079cb44b 100644 --- a/contracts/examples/bonding-curve-contract/wasm/Cargo.lock +++ b/contracts/examples/bonding-curve-contract/wasm/Cargo.lock @@ -4,15 +4,15 @@ version = 3 [[package]] name = "arrayvec" -version = "0.7.4" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" +checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" [[package]] name = "autocfg" -version = "1.3.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" +checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" [[package]] name = "bitflags" @@ -54,12 +54,21 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" +[[package]] +name = "multiversx-chain-core" +version = "0.11.0" +dependencies = [ + "bitflags", + "multiversx-sc-codec", +] + [[package]] name = "multiversx-sc" -version = "0.51.1" +version = "0.54.1" dependencies = [ "bitflags", "hex-literal", + "multiversx-chain-core", "multiversx-sc-codec", "multiversx-sc-derive", "num-traits", @@ -68,7 +77,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.20.0" +version = "0.21.0" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -77,7 +86,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.20.0" +version = "0.21.0" dependencies = [ "hex", "proc-macro2", @@ -87,7 +96,7 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.51.1" +version = "0.54.1" dependencies = [ "hex", "proc-macro2", @@ -98,14 +107,14 @@ dependencies = [ [[package]] name = "multiversx-sc-modules" -version = "0.51.1" +version = "0.54.1" dependencies = [ "multiversx-sc", ] [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.51.1" +version = "0.54.1" dependencies = [ "multiversx-sc", ] @@ -139,9 +148,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.36" +version = "1.0.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" +checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" dependencies = [ "proc-macro2", ] @@ -164,9 +173,9 @@ checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "syn" -version = "2.0.68" +version = "2.0.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "901fa70d88b9d6c98022e23b4136f9f3e54e4662c3bc1bd1d84a42a9a0f0c1e9" +checksum = "9f35bcdf61fd8e7be6caf75f429fdca8beb3ed76584befb503b1569faee373ed" dependencies = [ "proc-macro2", "quote", @@ -175,9 +184,9 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.12" +version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" +checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" [[package]] name = "unwrap-infallible" diff --git a/contracts/examples/bonding-curve-contract/wasm/Cargo.toml b/contracts/examples/bonding-curve-contract/wasm/Cargo.toml index 341cb263d2..c8b1a0ad3d 100644 --- a/contracts/examples/bonding-curve-contract/wasm/Cargo.toml +++ b/contracts/examples/bonding-curve-contract/wasm/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.51.1" +version = "0.54.1" path = "../../../../framework/wasm-adapter" [workspace] diff --git a/contracts/examples/check-pause/Cargo.toml b/contracts/examples/check-pause/Cargo.toml index 30c5dd163e..9245f979ff 100644 --- a/contracts/examples/check-pause/Cargo.toml +++ b/contracts/examples/check-pause/Cargo.toml @@ -12,14 +12,14 @@ path = "src/check_pause.rs" num-bigint = "0.4" [dependencies.multiversx-sc] -version = "0.51.1" +version = "0.54.1" path = "../../../framework/base" [dependencies.multiversx-sc-modules] -version = "0.51.1" +version = "0.54.1" path = "../../../contracts/modules" [dev-dependencies.multiversx-sc-scenario] -version = "0.51.1" +version = "0.54.1" path = "../../../framework/scenario" diff --git a/contracts/examples/check-pause/meta/Cargo.toml b/contracts/examples/check-pause/meta/Cargo.toml index 7e379211bd..ebb1bce610 100644 --- a/contracts/examples/check-pause/meta/Cargo.toml +++ b/contracts/examples/check-pause/meta/Cargo.toml @@ -9,6 +9,6 @@ authors = ["Alin Cruceat "] path = ".." [dependencies.multiversx-sc-meta-lib] -version = "0.51.1" +version = "0.54.1" path = "../../../../framework/meta-lib" default-features = false diff --git a/contracts/examples/check-pause/wasm/Cargo.lock b/contracts/examples/check-pause/wasm/Cargo.lock index 65d730f928..cfab94c784 100644 --- a/contracts/examples/check-pause/wasm/Cargo.lock +++ b/contracts/examples/check-pause/wasm/Cargo.lock @@ -4,15 +4,15 @@ version = 3 [[package]] name = "arrayvec" -version = "0.7.4" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" +checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" [[package]] name = "autocfg" -version = "1.3.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" +checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" [[package]] name = "bitflags" @@ -54,12 +54,21 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" +[[package]] +name = "multiversx-chain-core" +version = "0.11.0" +dependencies = [ + "bitflags", + "multiversx-sc-codec", +] + [[package]] name = "multiversx-sc" -version = "0.51.1" +version = "0.54.1" dependencies = [ "bitflags", "hex-literal", + "multiversx-chain-core", "multiversx-sc-codec", "multiversx-sc-derive", "num-traits", @@ -68,7 +77,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.20.0" +version = "0.21.0" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -77,7 +86,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.20.0" +version = "0.21.0" dependencies = [ "hex", "proc-macro2", @@ -87,7 +96,7 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.51.1" +version = "0.54.1" dependencies = [ "hex", "proc-macro2", @@ -98,14 +107,14 @@ dependencies = [ [[package]] name = "multiversx-sc-modules" -version = "0.51.1" +version = "0.54.1" dependencies = [ "multiversx-sc", ] [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.51.1" +version = "0.54.1" dependencies = [ "multiversx-sc", ] @@ -139,9 +148,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.36" +version = "1.0.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" +checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" dependencies = [ "proc-macro2", ] @@ -164,9 +173,9 @@ checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "syn" -version = "2.0.68" +version = "2.0.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "901fa70d88b9d6c98022e23b4136f9f3e54e4662c3bc1bd1d84a42a9a0f0c1e9" +checksum = "9f35bcdf61fd8e7be6caf75f429fdca8beb3ed76584befb503b1569faee373ed" dependencies = [ "proc-macro2", "quote", @@ -175,9 +184,9 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.12" +version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" +checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" [[package]] name = "unwrap-infallible" diff --git a/contracts/examples/check-pause/wasm/Cargo.toml b/contracts/examples/check-pause/wasm/Cargo.toml index 796acc533b..a0858d0ce0 100644 --- a/contracts/examples/check-pause/wasm/Cargo.toml +++ b/contracts/examples/check-pause/wasm/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.51.1" +version = "0.54.1" path = "../../../../framework/wasm-adapter" [workspace] diff --git a/contracts/examples/crowdfunding-esdt/Cargo.toml b/contracts/examples/crowdfunding-esdt/Cargo.toml index 3b873fb7b5..0ea82a5d97 100644 --- a/contracts/examples/crowdfunding-esdt/Cargo.toml +++ b/contracts/examples/crowdfunding-esdt/Cargo.toml @@ -9,11 +9,11 @@ publish = false path = "src/crowdfunding_esdt.rs" [dependencies.multiversx-sc] -version = "0.51.1" +version = "0.54.1" path = "../../../framework/base" [dev-dependencies.multiversx-sc-scenario] -version = "0.51.1" +version = "0.54.1" path = "../../../framework/scenario" [dev-dependencies] diff --git a/contracts/examples/crowdfunding-esdt/meta/Cargo.toml b/contracts/examples/crowdfunding-esdt/meta/Cargo.toml index 53c8fc854c..71d4f41eb2 100644 --- a/contracts/examples/crowdfunding-esdt/meta/Cargo.toml +++ b/contracts/examples/crowdfunding-esdt/meta/Cargo.toml @@ -9,6 +9,6 @@ publish = false path = ".." [dependencies.multiversx-sc-meta-lib] -version = "0.51.1" +version = "0.54.1" path = "../../../../framework/meta-lib" default-features = false diff --git a/contracts/examples/crowdfunding-esdt/src/crowdfunding_esdt.rs b/contracts/examples/crowdfunding-esdt/src/crowdfunding_esdt.rs index 1dea493562..d47e256f08 100644 --- a/contracts/examples/crowdfunding-esdt/src/crowdfunding_esdt.rs +++ b/contracts/examples/crowdfunding-esdt/src/crowdfunding_esdt.rs @@ -55,6 +55,7 @@ pub trait Crowdfunding { } #[view(getCurrentFunds)] + #[title("currentFunds")] fn get_current_funds(&self) -> BigUint { let token = self.cf_token_identifier().get(); @@ -106,18 +107,22 @@ pub trait Crowdfunding { // storage #[view(getTarget)] + #[title("target")] #[storage_mapper("target")] fn target(&self) -> SingleValueMapper; #[view(getDeadline)] + #[title("deadline")] #[storage_mapper("deadline")] fn deadline(&self) -> SingleValueMapper; #[view(getDeposit)] + #[title("deposit")] #[storage_mapper("deposit")] fn deposit(&self, donor: &ManagedAddress) -> SingleValueMapper; #[view(getCrowdfundingTokenIdentifier)] + #[title("tokenIdentifier")] #[storage_mapper("tokenIdentifier")] fn cf_token_identifier(&self) -> SingleValueMapper; } diff --git a/contracts/examples/crowdfunding-esdt/tests/crowdfunding_esdt_blackbox_test.rs b/contracts/examples/crowdfunding-esdt/tests/crowdfunding_esdt_blackbox_test.rs index d00e263607..052964adcd 100644 --- a/contracts/examples/crowdfunding-esdt/tests/crowdfunding_esdt_blackbox_test.rs +++ b/contracts/examples/crowdfunding-esdt/tests/crowdfunding_esdt_blackbox_test.rs @@ -13,6 +13,7 @@ const CROWDFUNDING_ADDRESS: TestSCAddress = TestSCAddress::new("crowdfunding-esd fn world() -> ScenarioWorld { let mut blockchain = ScenarioWorld::new(); + blockchain.set_current_dir_from_workspace("contracts/examples/crowdfunding-esdt"); blockchain.register_contract(CODE_PATH, crowdfunding_esdt::ContractBuilder); blockchain } diff --git a/contracts/examples/crowdfunding-esdt/tests/crowdfunding_esdt_scenario_rs_test.rs b/contracts/examples/crowdfunding-esdt/tests/crowdfunding_esdt_scenario_rs_test.rs index 64a88906b2..6fcde9a71c 100644 --- a/contracts/examples/crowdfunding-esdt/tests/crowdfunding_esdt_scenario_rs_test.rs +++ b/contracts/examples/crowdfunding-esdt/tests/crowdfunding_esdt_scenario_rs_test.rs @@ -3,6 +3,7 @@ use multiversx_sc_scenario::*; fn world() -> ScenarioWorld { let mut blockchain = ScenarioWorld::new(); + blockchain.set_current_dir_from_workspace("contracts/examples/crowdfunding-esdt"); blockchain.register_contract( "mxsc:output/crowdfunding-esdt.mxsc.json", crowdfunding_esdt::ContractBuilder, diff --git a/contracts/examples/crowdfunding-esdt/wasm/Cargo.lock b/contracts/examples/crowdfunding-esdt/wasm/Cargo.lock index e9b1cc12e6..e5e8ec324d 100644 --- a/contracts/examples/crowdfunding-esdt/wasm/Cargo.lock +++ b/contracts/examples/crowdfunding-esdt/wasm/Cargo.lock @@ -4,15 +4,15 @@ version = 3 [[package]] name = "arrayvec" -version = "0.7.4" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" +checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" [[package]] name = "autocfg" -version = "1.3.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" +checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" [[package]] name = "bitflags" @@ -53,12 +53,21 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" +[[package]] +name = "multiversx-chain-core" +version = "0.11.0" +dependencies = [ + "bitflags", + "multiversx-sc-codec", +] + [[package]] name = "multiversx-sc" -version = "0.51.1" +version = "0.54.1" dependencies = [ "bitflags", "hex-literal", + "multiversx-chain-core", "multiversx-sc-codec", "multiversx-sc-derive", "num-traits", @@ -67,7 +76,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.20.0" +version = "0.21.0" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -76,7 +85,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.20.0" +version = "0.21.0" dependencies = [ "hex", "proc-macro2", @@ -86,7 +95,7 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.51.1" +version = "0.54.1" dependencies = [ "hex", "proc-macro2", @@ -97,7 +106,7 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.51.1" +version = "0.54.1" dependencies = [ "multiversx-sc", ] @@ -131,9 +140,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.36" +version = "1.0.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" +checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" dependencies = [ "proc-macro2", ] @@ -156,9 +165,9 @@ checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "syn" -version = "2.0.68" +version = "2.0.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "901fa70d88b9d6c98022e23b4136f9f3e54e4662c3bc1bd1d84a42a9a0f0c1e9" +checksum = "9f35bcdf61fd8e7be6caf75f429fdca8beb3ed76584befb503b1569faee373ed" dependencies = [ "proc-macro2", "quote", @@ -167,9 +176,9 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.12" +version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" +checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" [[package]] name = "unwrap-infallible" diff --git a/contracts/examples/crowdfunding-esdt/wasm/Cargo.toml b/contracts/examples/crowdfunding-esdt/wasm/Cargo.toml index d1a35db239..894fdf9af5 100644 --- a/contracts/examples/crowdfunding-esdt/wasm/Cargo.toml +++ b/contracts/examples/crowdfunding-esdt/wasm/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.51.1" +version = "0.54.1" path = "../../../../framework/wasm-adapter" [workspace] diff --git a/contracts/examples/crypto-bubbles/Cargo.toml b/contracts/examples/crypto-bubbles/Cargo.toml index 428963a491..d171564522 100644 --- a/contracts/examples/crypto-bubbles/Cargo.toml +++ b/contracts/examples/crypto-bubbles/Cargo.toml @@ -9,9 +9,9 @@ publish = false path = "src/crypto_bubbles.rs" [dependencies.multiversx-sc] -version = "0.51.1" +version = "0.54.1" path = "../../../framework/base" [dev-dependencies.multiversx-sc-scenario] -version = "0.51.1" +version = "0.54.1" path = "../../../framework/scenario" diff --git a/contracts/examples/crypto-bubbles/meta/Cargo.toml b/contracts/examples/crypto-bubbles/meta/Cargo.toml index b07f462d78..9de4249d3e 100644 --- a/contracts/examples/crypto-bubbles/meta/Cargo.toml +++ b/contracts/examples/crypto-bubbles/meta/Cargo.toml @@ -9,6 +9,6 @@ publish = false path = ".." [dependencies.multiversx-sc-meta-lib] -version = "0.51.1" +version = "0.54.1" path = "../../../../framework/meta-lib" default-features = false diff --git a/contracts/examples/crypto-bubbles/tests/crypto_bubbles_scenario_rs_test.rs b/contracts/examples/crypto-bubbles/tests/crypto_bubbles_scenario_rs_test.rs index 134133a68b..d9d846b6a8 100644 --- a/contracts/examples/crypto-bubbles/tests/crypto_bubbles_scenario_rs_test.rs +++ b/contracts/examples/crypto-bubbles/tests/crypto_bubbles_scenario_rs_test.rs @@ -3,6 +3,7 @@ use multiversx_sc_scenario::*; fn world() -> ScenarioWorld { let mut blockchain = ScenarioWorld::new(); + blockchain.set_current_dir_from_workspace("contracts/examples/crypto-bubbles"); blockchain.register_contract( "mxsc:output/crypto-bubbles.mxsc.json", crypto_bubbles::ContractBuilder, diff --git a/contracts/examples/crypto-bubbles/wasm/Cargo.lock b/contracts/examples/crypto-bubbles/wasm/Cargo.lock index e8d054972a..350a7656e6 100755 --- a/contracts/examples/crypto-bubbles/wasm/Cargo.lock +++ b/contracts/examples/crypto-bubbles/wasm/Cargo.lock @@ -4,15 +4,15 @@ version = 3 [[package]] name = "arrayvec" -version = "0.7.4" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" +checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" [[package]] name = "autocfg" -version = "1.3.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" +checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" [[package]] name = "bitflags" @@ -53,12 +53,21 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" +[[package]] +name = "multiversx-chain-core" +version = "0.11.0" +dependencies = [ + "bitflags", + "multiversx-sc-codec", +] + [[package]] name = "multiversx-sc" -version = "0.51.1" +version = "0.54.1" dependencies = [ "bitflags", "hex-literal", + "multiversx-chain-core", "multiversx-sc-codec", "multiversx-sc-derive", "num-traits", @@ -67,7 +76,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.20.0" +version = "0.21.0" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -76,7 +85,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.20.0" +version = "0.21.0" dependencies = [ "hex", "proc-macro2", @@ -86,7 +95,7 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.51.1" +version = "0.54.1" dependencies = [ "hex", "proc-macro2", @@ -97,7 +106,7 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.51.1" +version = "0.54.1" dependencies = [ "multiversx-sc", ] @@ -131,9 +140,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.36" +version = "1.0.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" +checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" dependencies = [ "proc-macro2", ] @@ -156,9 +165,9 @@ checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "syn" -version = "2.0.68" +version = "2.0.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "901fa70d88b9d6c98022e23b4136f9f3e54e4662c3bc1bd1d84a42a9a0f0c1e9" +checksum = "9f35bcdf61fd8e7be6caf75f429fdca8beb3ed76584befb503b1569faee373ed" dependencies = [ "proc-macro2", "quote", @@ -167,9 +176,9 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.12" +version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" +checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" [[package]] name = "unwrap-infallible" diff --git a/contracts/examples/crypto-bubbles/wasm/Cargo.toml b/contracts/examples/crypto-bubbles/wasm/Cargo.toml index d94fe29e5d..fdf9b80eee 100644 --- a/contracts/examples/crypto-bubbles/wasm/Cargo.toml +++ b/contracts/examples/crypto-bubbles/wasm/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.51.1" +version = "0.54.1" path = "../../../../framework/wasm-adapter" [workspace] diff --git a/contracts/examples/crypto-kitties/common/kitty/Cargo.toml b/contracts/examples/crypto-kitties/common/kitty/Cargo.toml index 7fb6db9cc4..c18416ea12 100644 --- a/contracts/examples/crypto-kitties/common/kitty/Cargo.toml +++ b/contracts/examples/crypto-kitties/common/kitty/Cargo.toml @@ -9,7 +9,7 @@ publish = false path = "src/lib.rs" [dependencies.multiversx-sc] -version = "0.51.1" +version = "0.54.1" path = "../../../../../framework/base" [dependencies.random] diff --git a/contracts/examples/crypto-kitties/common/random/Cargo.toml b/contracts/examples/crypto-kitties/common/random/Cargo.toml index 4223338861..4ad217b878 100644 --- a/contracts/examples/crypto-kitties/common/random/Cargo.toml +++ b/contracts/examples/crypto-kitties/common/random/Cargo.toml @@ -8,5 +8,5 @@ edition = "2021" path = "src/lib.rs" [dependencies.multiversx-sc] -version = "0.51.1" +version = "0.54.1" path = "../../../../../framework/base" diff --git a/contracts/examples/crypto-kitties/kitty-auction/Cargo.toml b/contracts/examples/crypto-kitties/kitty-auction/Cargo.toml index a245b2db45..92c17cc505 100644 --- a/contracts/examples/crypto-kitties/kitty-auction/Cargo.toml +++ b/contracts/examples/crypto-kitties/kitty-auction/Cargo.toml @@ -17,9 +17,9 @@ version = "0.0.0" path = "../kitty-ownership" [dependencies.multiversx-sc] -version = "0.51.1" +version = "0.54.1" path = "../../../../framework/base" [dev-dependencies.multiversx-sc-scenario] -version = "0.51.1" +version = "0.54.1" path = "../../../../framework/scenario" diff --git a/contracts/examples/crypto-kitties/kitty-auction/meta/Cargo.toml b/contracts/examples/crypto-kitties/kitty-auction/meta/Cargo.toml index 816c4b0017..8aec2c2349 100644 --- a/contracts/examples/crypto-kitties/kitty-auction/meta/Cargo.toml +++ b/contracts/examples/crypto-kitties/kitty-auction/meta/Cargo.toml @@ -8,6 +8,6 @@ publish = false path = ".." [dependencies.multiversx-sc-meta-lib] -version = "0.51.1" +version = "0.54.1" path = "../../../../../framework/meta-lib" default-features = false diff --git a/contracts/examples/crypto-kitties/kitty-auction/tests/kitty_auction_scenario_rs_test.rs b/contracts/examples/crypto-kitties/kitty-auction/tests/kitty_auction_scenario_rs_test.rs index e7fce12ce1..84af643926 100644 --- a/contracts/examples/crypto-kitties/kitty-auction/tests/kitty_auction_scenario_rs_test.rs +++ b/contracts/examples/crypto-kitties/kitty-auction/tests/kitty_auction_scenario_rs_test.rs @@ -3,6 +3,7 @@ use multiversx_sc_scenario::*; fn world() -> ScenarioWorld { let mut blockchain = ScenarioWorld::new(); + blockchain.set_current_dir_from_workspace("contracts/examples/crypto-kitties/kitty-auction"); blockchain.register_contract( "mxsc:../kitty-ownership/output/kitty-ownership.mxsc.json", kitty_ownership::ContractBuilder, diff --git a/contracts/examples/crypto-kitties/kitty-auction/wasm/Cargo.lock b/contracts/examples/crypto-kitties/kitty-auction/wasm/Cargo.lock index d94014f05b..88f0c2210d 100755 --- a/contracts/examples/crypto-kitties/kitty-auction/wasm/Cargo.lock +++ b/contracts/examples/crypto-kitties/kitty-auction/wasm/Cargo.lock @@ -4,15 +4,15 @@ version = 3 [[package]] name = "arrayvec" -version = "0.7.4" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" +checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" [[package]] name = "autocfg" -version = "1.3.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" +checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" [[package]] name = "bitflags" @@ -82,12 +82,21 @@ dependencies = [ "random", ] +[[package]] +name = "multiversx-chain-core" +version = "0.11.0" +dependencies = [ + "bitflags", + "multiversx-sc-codec", +] + [[package]] name = "multiversx-sc" -version = "0.51.1" +version = "0.54.1" dependencies = [ "bitflags", "hex-literal", + "multiversx-chain-core", "multiversx-sc-codec", "multiversx-sc-derive", "num-traits", @@ -96,7 +105,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.20.0" +version = "0.21.0" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -105,7 +114,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.20.0" +version = "0.21.0" dependencies = [ "hex", "proc-macro2", @@ -115,7 +124,7 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.51.1" +version = "0.54.1" dependencies = [ "hex", "proc-macro2", @@ -126,7 +135,7 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.51.1" +version = "0.54.1" dependencies = [ "multiversx-sc", ] @@ -160,9 +169,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.36" +version = "1.0.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" +checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" dependencies = [ "proc-macro2", ] @@ -192,9 +201,9 @@ checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "syn" -version = "2.0.68" +version = "2.0.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "901fa70d88b9d6c98022e23b4136f9f3e54e4662c3bc1bd1d84a42a9a0f0c1e9" +checksum = "9f35bcdf61fd8e7be6caf75f429fdca8beb3ed76584befb503b1569faee373ed" dependencies = [ "proc-macro2", "quote", @@ -203,9 +212,9 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.12" +version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" +checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" [[package]] name = "unwrap-infallible" diff --git a/contracts/examples/crypto-kitties/kitty-auction/wasm/Cargo.toml b/contracts/examples/crypto-kitties/kitty-auction/wasm/Cargo.toml index d9190f9070..ad8ecb4b16 100644 --- a/contracts/examples/crypto-kitties/kitty-auction/wasm/Cargo.toml +++ b/contracts/examples/crypto-kitties/kitty-auction/wasm/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.51.1" +version = "0.54.1" path = "../../../../../framework/wasm-adapter" [workspace] diff --git a/contracts/examples/crypto-kitties/kitty-genetic-alg/Cargo.toml b/contracts/examples/crypto-kitties/kitty-genetic-alg/Cargo.toml index 11026a4a53..2c778818f5 100644 --- a/contracts/examples/crypto-kitties/kitty-genetic-alg/Cargo.toml +++ b/contracts/examples/crypto-kitties/kitty-genetic-alg/Cargo.toml @@ -18,9 +18,9 @@ version = "0.0.0" path = "../common/random" [dependencies.multiversx-sc] -version = "0.51.1" +version = "0.54.1" path = "../../../../framework/base" [dev-dependencies.multiversx-sc-scenario] -version = "0.51.1" +version = "0.54.1" path = "../../../../framework/scenario" diff --git a/contracts/examples/crypto-kitties/kitty-genetic-alg/meta/Cargo.toml b/contracts/examples/crypto-kitties/kitty-genetic-alg/meta/Cargo.toml index 2c2522d4d8..3079b3e430 100644 --- a/contracts/examples/crypto-kitties/kitty-genetic-alg/meta/Cargo.toml +++ b/contracts/examples/crypto-kitties/kitty-genetic-alg/meta/Cargo.toml @@ -8,6 +8,6 @@ publish = false path = ".." [dependencies.multiversx-sc-meta-lib] -version = "0.51.1" +version = "0.54.1" path = "../../../../../framework/meta-lib" default-features = false diff --git a/contracts/examples/crypto-kitties/kitty-genetic-alg/tests/kitty_genetic_alg_scenario_rs_test.rs b/contracts/examples/crypto-kitties/kitty-genetic-alg/tests/kitty_genetic_alg_scenario_rs_test.rs index 08672d2f0c..bdaed552c7 100644 --- a/contracts/examples/crypto-kitties/kitty-genetic-alg/tests/kitty_genetic_alg_scenario_rs_test.rs +++ b/contracts/examples/crypto-kitties/kitty-genetic-alg/tests/kitty_genetic_alg_scenario_rs_test.rs @@ -2,6 +2,8 @@ use multiversx_sc_scenario::*; fn world() -> ScenarioWorld { let mut blockchain = ScenarioWorld::new(); + blockchain + .set_current_dir_from_workspace("contracts/examples/crypto-kitties/kitty-genetic-alg"); blockchain.register_contract( "mxsc:output/kitty-genetic-alg.mxsc.json", kitty_genetic_alg::ContractBuilder, diff --git a/contracts/examples/crypto-kitties/kitty-genetic-alg/wasm/Cargo.lock b/contracts/examples/crypto-kitties/kitty-genetic-alg/wasm/Cargo.lock index e24409f268..3fa6ff49fd 100755 --- a/contracts/examples/crypto-kitties/kitty-genetic-alg/wasm/Cargo.lock +++ b/contracts/examples/crypto-kitties/kitty-genetic-alg/wasm/Cargo.lock @@ -4,15 +4,15 @@ version = 3 [[package]] name = "arrayvec" -version = "0.7.4" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" +checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" [[package]] name = "autocfg" -version = "1.3.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" +checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" [[package]] name = "bitflags" @@ -63,12 +63,21 @@ dependencies = [ "multiversx-sc-wasm-adapter", ] +[[package]] +name = "multiversx-chain-core" +version = "0.11.0" +dependencies = [ + "bitflags", + "multiversx-sc-codec", +] + [[package]] name = "multiversx-sc" -version = "0.51.1" +version = "0.54.1" dependencies = [ "bitflags", "hex-literal", + "multiversx-chain-core", "multiversx-sc-codec", "multiversx-sc-derive", "num-traits", @@ -77,7 +86,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.20.0" +version = "0.21.0" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -86,7 +95,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.20.0" +version = "0.21.0" dependencies = [ "hex", "proc-macro2", @@ -96,7 +105,7 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.51.1" +version = "0.54.1" dependencies = [ "hex", "proc-macro2", @@ -107,7 +116,7 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.51.1" +version = "0.54.1" dependencies = [ "multiversx-sc", ] @@ -141,9 +150,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.36" +version = "1.0.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" +checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" dependencies = [ "proc-macro2", ] @@ -173,9 +182,9 @@ checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "syn" -version = "2.0.68" +version = "2.0.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "901fa70d88b9d6c98022e23b4136f9f3e54e4662c3bc1bd1d84a42a9a0f0c1e9" +checksum = "9f35bcdf61fd8e7be6caf75f429fdca8beb3ed76584befb503b1569faee373ed" dependencies = [ "proc-macro2", "quote", @@ -184,9 +193,9 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.12" +version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" +checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" [[package]] name = "unwrap-infallible" diff --git a/contracts/examples/crypto-kitties/kitty-genetic-alg/wasm/Cargo.toml b/contracts/examples/crypto-kitties/kitty-genetic-alg/wasm/Cargo.toml index 40314286d2..096d0e5322 100644 --- a/contracts/examples/crypto-kitties/kitty-genetic-alg/wasm/Cargo.toml +++ b/contracts/examples/crypto-kitties/kitty-genetic-alg/wasm/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.51.1" +version = "0.54.1" path = "../../../../../framework/wasm-adapter" [workspace] diff --git a/contracts/examples/crypto-kitties/kitty-ownership/Cargo.toml b/contracts/examples/crypto-kitties/kitty-ownership/Cargo.toml index 21d0dd821c..da7993cdc6 100644 --- a/contracts/examples/crypto-kitties/kitty-ownership/Cargo.toml +++ b/contracts/examples/crypto-kitties/kitty-ownership/Cargo.toml @@ -21,9 +21,9 @@ version = "0.0.0" path = "../kitty-genetic-alg" [dependencies.multiversx-sc] -version = "0.51.1" +version = "0.54.1" path = "../../../../framework/base" [dev-dependencies.multiversx-sc-scenario] -version = "0.51.1" +version = "0.54.1" path = "../../../../framework/scenario" diff --git a/contracts/examples/crypto-kitties/kitty-ownership/meta/Cargo.toml b/contracts/examples/crypto-kitties/kitty-ownership/meta/Cargo.toml index 6d520d49fd..18b4e56e39 100644 --- a/contracts/examples/crypto-kitties/kitty-ownership/meta/Cargo.toml +++ b/contracts/examples/crypto-kitties/kitty-ownership/meta/Cargo.toml @@ -8,6 +8,6 @@ publish = false path = ".." [dependencies.multiversx-sc-meta-lib] -version = "0.51.1" +version = "0.54.1" path = "../../../../../framework/meta-lib" default-features = false diff --git a/contracts/examples/crypto-kitties/kitty-ownership/tests/kitty_ownership_scenario_rs_test.rs b/contracts/examples/crypto-kitties/kitty-ownership/tests/kitty_ownership_scenario_rs_test.rs index 238a3f8fce..65837675b1 100644 --- a/contracts/examples/crypto-kitties/kitty-ownership/tests/kitty_ownership_scenario_rs_test.rs +++ b/contracts/examples/crypto-kitties/kitty-ownership/tests/kitty_ownership_scenario_rs_test.rs @@ -3,6 +3,7 @@ use multiversx_sc_scenario::*; fn world() -> ScenarioWorld { let mut blockchain = ScenarioWorld::new(); + blockchain.set_current_dir_from_workspace("contracts/examples/crypto-kitties/kitty-ownership"); blockchain.register_contract( "mxsc:../kitty-genetic-alg/output/kitty-genetic-alg.mxsc.json", kitty_genetic_alg::ContractBuilder, diff --git a/contracts/examples/crypto-kitties/kitty-ownership/wasm/Cargo.lock b/contracts/examples/crypto-kitties/kitty-ownership/wasm/Cargo.lock index 95f512b3ba..d1d28ac83c 100755 --- a/contracts/examples/crypto-kitties/kitty-ownership/wasm/Cargo.lock +++ b/contracts/examples/crypto-kitties/kitty-ownership/wasm/Cargo.lock @@ -4,15 +4,15 @@ version = 3 [[package]] name = "arrayvec" -version = "0.7.4" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" +checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" [[package]] name = "autocfg" -version = "1.3.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" +checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" [[package]] name = "bitflags" @@ -73,12 +73,21 @@ dependencies = [ "multiversx-sc-wasm-adapter", ] +[[package]] +name = "multiversx-chain-core" +version = "0.11.0" +dependencies = [ + "bitflags", + "multiversx-sc-codec", +] + [[package]] name = "multiversx-sc" -version = "0.51.1" +version = "0.54.1" dependencies = [ "bitflags", "hex-literal", + "multiversx-chain-core", "multiversx-sc-codec", "multiversx-sc-derive", "num-traits", @@ -87,7 +96,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.20.0" +version = "0.21.0" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -96,7 +105,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.20.0" +version = "0.21.0" dependencies = [ "hex", "proc-macro2", @@ -106,7 +115,7 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.51.1" +version = "0.54.1" dependencies = [ "hex", "proc-macro2", @@ -117,7 +126,7 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.51.1" +version = "0.54.1" dependencies = [ "multiversx-sc", ] @@ -151,9 +160,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.36" +version = "1.0.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" +checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" dependencies = [ "proc-macro2", ] @@ -183,9 +192,9 @@ checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "syn" -version = "2.0.68" +version = "2.0.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "901fa70d88b9d6c98022e23b4136f9f3e54e4662c3bc1bd1d84a42a9a0f0c1e9" +checksum = "9f35bcdf61fd8e7be6caf75f429fdca8beb3ed76584befb503b1569faee373ed" dependencies = [ "proc-macro2", "quote", @@ -194,9 +203,9 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.12" +version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" +checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" [[package]] name = "unwrap-infallible" diff --git a/contracts/examples/crypto-kitties/kitty-ownership/wasm/Cargo.toml b/contracts/examples/crypto-kitties/kitty-ownership/wasm/Cargo.toml index cc5ccbff7f..8a8e9d6a4a 100644 --- a/contracts/examples/crypto-kitties/kitty-ownership/wasm/Cargo.toml +++ b/contracts/examples/crypto-kitties/kitty-ownership/wasm/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.51.1" +version = "0.54.1" path = "../../../../../framework/wasm-adapter" [workspace] diff --git a/contracts/examples/crypto-zombies/Cargo.toml b/contracts/examples/crypto-zombies/Cargo.toml index 0c92cf2ecb..eda1e9682f 100644 --- a/contracts/examples/crypto-zombies/Cargo.toml +++ b/contracts/examples/crypto-zombies/Cargo.toml @@ -9,9 +9,9 @@ publish = false path = "src/lib.rs" [dependencies.multiversx-sc] -version = "0.51.1" +version = "0.54.1" path = "../../../framework/base" [dev-dependencies.multiversx-sc-scenario] -version = "0.51.1" +version = "0.54.1" path = "../../../framework/scenario" diff --git a/contracts/examples/crypto-zombies/meta/Cargo.toml b/contracts/examples/crypto-zombies/meta/Cargo.toml index fc8143293e..2447653553 100644 --- a/contracts/examples/crypto-zombies/meta/Cargo.toml +++ b/contracts/examples/crypto-zombies/meta/Cargo.toml @@ -8,6 +8,6 @@ publish = false path = ".." [dependencies.multiversx-sc-meta-lib] -version = "0.51.1" +version = "0.54.1" path = "../../../../framework/meta-lib" default-features = false diff --git a/contracts/examples/crypto-zombies/wasm/Cargo.lock b/contracts/examples/crypto-zombies/wasm/Cargo.lock index 2f7faf40a1..8859f8f723 100755 --- a/contracts/examples/crypto-zombies/wasm/Cargo.lock +++ b/contracts/examples/crypto-zombies/wasm/Cargo.lock @@ -4,15 +4,15 @@ version = 3 [[package]] name = "arrayvec" -version = "0.7.4" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" +checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" [[package]] name = "autocfg" -version = "1.3.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" +checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" [[package]] name = "bitflags" @@ -53,12 +53,21 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" +[[package]] +name = "multiversx-chain-core" +version = "0.11.0" +dependencies = [ + "bitflags", + "multiversx-sc-codec", +] + [[package]] name = "multiversx-sc" -version = "0.51.1" +version = "0.54.1" dependencies = [ "bitflags", "hex-literal", + "multiversx-chain-core", "multiversx-sc-codec", "multiversx-sc-derive", "num-traits", @@ -67,7 +76,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.20.0" +version = "0.21.0" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -76,7 +85,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.20.0" +version = "0.21.0" dependencies = [ "hex", "proc-macro2", @@ -86,7 +95,7 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.51.1" +version = "0.54.1" dependencies = [ "hex", "proc-macro2", @@ -97,7 +106,7 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.51.1" +version = "0.54.1" dependencies = [ "multiversx-sc", ] @@ -131,9 +140,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.36" +version = "1.0.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" +checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" dependencies = [ "proc-macro2", ] @@ -156,9 +165,9 @@ checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "syn" -version = "2.0.68" +version = "2.0.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "901fa70d88b9d6c98022e23b4136f9f3e54e4662c3bc1bd1d84a42a9a0f0c1e9" +checksum = "9f35bcdf61fd8e7be6caf75f429fdca8beb3ed76584befb503b1569faee373ed" dependencies = [ "proc-macro2", "quote", @@ -167,9 +176,9 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.12" +version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" +checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" [[package]] name = "unwrap-infallible" diff --git a/contracts/examples/crypto-zombies/wasm/Cargo.toml b/contracts/examples/crypto-zombies/wasm/Cargo.toml index 2d7958f446..a1a5589db2 100644 --- a/contracts/examples/crypto-zombies/wasm/Cargo.toml +++ b/contracts/examples/crypto-zombies/wasm/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.51.1" +version = "0.54.1" path = "../../../../framework/wasm-adapter" [workspace] diff --git a/contracts/examples/digital-cash/Cargo.toml b/contracts/examples/digital-cash/Cargo.toml index 4c62a66396..49d30ccbe2 100644 --- a/contracts/examples/digital-cash/Cargo.toml +++ b/contracts/examples/digital-cash/Cargo.toml @@ -9,9 +9,9 @@ publish = false path = "src/digital_cash.rs" [dependencies.multiversx-sc] -version = "0.51.1" +version = "0.54.1" path = "../../../framework/base" [dev-dependencies.multiversx-sc-scenario] -version = "0.51.1" +version = "0.54.1" path = "../../../framework/scenario" diff --git a/contracts/examples/digital-cash/meta/Cargo.toml b/contracts/examples/digital-cash/meta/Cargo.toml index 4b0f9128c5..b535ba7455 100644 --- a/contracts/examples/digital-cash/meta/Cargo.toml +++ b/contracts/examples/digital-cash/meta/Cargo.toml @@ -8,6 +8,6 @@ publish = false path = ".." [dependencies.multiversx-sc-meta-lib] -version = "0.51.1" +version = "0.54.1" path = "../../../../framework/meta-lib" default-features = false diff --git a/contracts/examples/digital-cash/tests/digital_cash_scenario_rs_test.rs b/contracts/examples/digital-cash/tests/digital_cash_scenario_rs_test.rs index b210c4952a..7efe28271d 100644 --- a/contracts/examples/digital-cash/tests/digital_cash_scenario_rs_test.rs +++ b/contracts/examples/digital-cash/tests/digital_cash_scenario_rs_test.rs @@ -3,6 +3,7 @@ use multiversx_sc_scenario::*; fn world() -> ScenarioWorld { let mut blockchain = ScenarioWorld::new(); + blockchain.set_current_dir_from_workspace("contracts/examples/digital-cash"); blockchain.register_contract( "mxsc:output/digital-cash.mxsc.json", digital_cash::ContractBuilder, diff --git a/contracts/examples/digital-cash/wasm/Cargo.lock b/contracts/examples/digital-cash/wasm/Cargo.lock index 8f41169038..8211d7d54b 100644 --- a/contracts/examples/digital-cash/wasm/Cargo.lock +++ b/contracts/examples/digital-cash/wasm/Cargo.lock @@ -4,15 +4,15 @@ version = 3 [[package]] name = "arrayvec" -version = "0.7.4" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" +checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" [[package]] name = "autocfg" -version = "1.3.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" +checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" [[package]] name = "bitflags" @@ -53,12 +53,21 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" +[[package]] +name = "multiversx-chain-core" +version = "0.11.0" +dependencies = [ + "bitflags", + "multiversx-sc-codec", +] + [[package]] name = "multiversx-sc" -version = "0.51.1" +version = "0.54.1" dependencies = [ "bitflags", "hex-literal", + "multiversx-chain-core", "multiversx-sc-codec", "multiversx-sc-derive", "num-traits", @@ -67,7 +76,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.20.0" +version = "0.21.0" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -76,7 +85,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.20.0" +version = "0.21.0" dependencies = [ "hex", "proc-macro2", @@ -86,7 +95,7 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.51.1" +version = "0.54.1" dependencies = [ "hex", "proc-macro2", @@ -97,7 +106,7 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.51.1" +version = "0.54.1" dependencies = [ "multiversx-sc", ] @@ -131,9 +140,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.36" +version = "1.0.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" +checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" dependencies = [ "proc-macro2", ] @@ -156,9 +165,9 @@ checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "syn" -version = "2.0.68" +version = "2.0.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "901fa70d88b9d6c98022e23b4136f9f3e54e4662c3bc1bd1d84a42a9a0f0c1e9" +checksum = "9f35bcdf61fd8e7be6caf75f429fdca8beb3ed76584befb503b1569faee373ed" dependencies = [ "proc-macro2", "quote", @@ -167,9 +176,9 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.12" +version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" +checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" [[package]] name = "unwrap-infallible" diff --git a/contracts/examples/digital-cash/wasm/Cargo.toml b/contracts/examples/digital-cash/wasm/Cargo.toml index e368089244..1e8f50f24b 100644 --- a/contracts/examples/digital-cash/wasm/Cargo.toml +++ b/contracts/examples/digital-cash/wasm/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.51.1" +version = "0.54.1" path = "../../../../framework/wasm-adapter" [workspace] diff --git a/contracts/examples/empty/Cargo.toml b/contracts/examples/empty/Cargo.toml index cd673f0026..017050f45f 100644 --- a/contracts/examples/empty/Cargo.toml +++ b/contracts/examples/empty/Cargo.toml @@ -9,11 +9,11 @@ publish = false path = "src/empty.rs" [dependencies.multiversx-sc] -version = "0.51.1" +version = "0.54.1" path = "../../../framework/base" [dev-dependencies.multiversx-sc-scenario] -version = "0.51.1" +version = "0.54.1" path = "../../../framework/scenario" [dev-dependencies] diff --git a/contracts/examples/empty/meta/Cargo.toml b/contracts/examples/empty/meta/Cargo.toml index 8c1f6f6727..2dcac830c9 100644 --- a/contracts/examples/empty/meta/Cargo.toml +++ b/contracts/examples/empty/meta/Cargo.toml @@ -8,6 +8,6 @@ publish = false path = ".." [dependencies.multiversx-sc-meta-lib] -version = "0.51.1" +version = "0.54.1" path = "../../../../framework/meta-lib" default-features = false diff --git a/contracts/examples/empty/tests/empty_scenario_rs_test.rs b/contracts/examples/empty/tests/empty_scenario_rs_test.rs index 7f84325dbe..5845b0d771 100644 --- a/contracts/examples/empty/tests/empty_scenario_rs_test.rs +++ b/contracts/examples/empty/tests/empty_scenario_rs_test.rs @@ -3,6 +3,7 @@ use multiversx_sc_scenario::*; fn world() -> ScenarioWorld { let mut blockchain = ScenarioWorld::new(); + blockchain.set_current_dir_from_workspace("contracts/examples/empty"); blockchain.register_contract("mxsc:output/empty.mxsc.json", empty::ContractBuilder); blockchain } diff --git a/contracts/examples/empty/wasm/Cargo.lock b/contracts/examples/empty/wasm/Cargo.lock index 7cd912320b..6bb28193fa 100755 --- a/contracts/examples/empty/wasm/Cargo.lock +++ b/contracts/examples/empty/wasm/Cargo.lock @@ -4,15 +4,15 @@ version = 3 [[package]] name = "arrayvec" -version = "0.7.4" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" +checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" [[package]] name = "autocfg" -version = "1.3.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" +checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" [[package]] name = "bitflags" @@ -53,12 +53,21 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" +[[package]] +name = "multiversx-chain-core" +version = "0.11.0" +dependencies = [ + "bitflags", + "multiversx-sc-codec", +] + [[package]] name = "multiversx-sc" -version = "0.51.1" +version = "0.54.1" dependencies = [ "bitflags", "hex-literal", + "multiversx-chain-core", "multiversx-sc-codec", "multiversx-sc-derive", "num-traits", @@ -67,7 +76,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.20.0" +version = "0.21.0" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -76,7 +85,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.20.0" +version = "0.21.0" dependencies = [ "hex", "proc-macro2", @@ -86,7 +95,7 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.51.1" +version = "0.54.1" dependencies = [ "hex", "proc-macro2", @@ -97,7 +106,7 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.51.1" +version = "0.54.1" dependencies = [ "multiversx-sc", ] @@ -131,9 +140,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.36" +version = "1.0.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" +checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" dependencies = [ "proc-macro2", ] @@ -156,9 +165,9 @@ checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "syn" -version = "2.0.68" +version = "2.0.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "901fa70d88b9d6c98022e23b4136f9f3e54e4662c3bc1bd1d84a42a9a0f0c1e9" +checksum = "9f35bcdf61fd8e7be6caf75f429fdca8beb3ed76584befb503b1569faee373ed" dependencies = [ "proc-macro2", "quote", @@ -167,9 +176,9 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.12" +version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" +checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" [[package]] name = "unwrap-infallible" diff --git a/contracts/examples/empty/wasm/Cargo.toml b/contracts/examples/empty/wasm/Cargo.toml index 634af62941..f6a5ee6ee0 100644 --- a/contracts/examples/empty/wasm/Cargo.toml +++ b/contracts/examples/empty/wasm/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.51.1" +version = "0.54.1" path = "../../../../framework/wasm-adapter" [workspace] diff --git a/contracts/examples/esdt-transfer-with-fee/Cargo.toml b/contracts/examples/esdt-transfer-with-fee/Cargo.toml index ae690d99ef..f6a098db90 100644 --- a/contracts/examples/esdt-transfer-with-fee/Cargo.toml +++ b/contracts/examples/esdt-transfer-with-fee/Cargo.toml @@ -9,9 +9,9 @@ publish = false path = "src/esdt_transfer_with_fee.rs" [dependencies.multiversx-sc] -version = "0.51.1" +version = "0.54.1" path = "../../../framework/base" [dev-dependencies.multiversx-sc-scenario] -version = "0.51.1" +version = "0.54.1" path = "../../../framework/scenario" diff --git a/contracts/examples/esdt-transfer-with-fee/meta/Cargo.toml b/contracts/examples/esdt-transfer-with-fee/meta/Cargo.toml index 42c1c9316e..1e03e0402c 100644 --- a/contracts/examples/esdt-transfer-with-fee/meta/Cargo.toml +++ b/contracts/examples/esdt-transfer-with-fee/meta/Cargo.toml @@ -8,6 +8,6 @@ publish = false path = ".." [dependencies.multiversx-sc-meta-lib] -version = "0.51.1" +version = "0.54.1" path = "../../../../framework/meta-lib" default-features = false diff --git a/contracts/examples/esdt-transfer-with-fee/tests/esdt_transfer_with_fee_scenario_rs_test.rs b/contracts/examples/esdt-transfer-with-fee/tests/esdt_transfer_with_fee_scenario_rs_test.rs index 48bc41cff0..71a74e4e87 100644 --- a/contracts/examples/esdt-transfer-with-fee/tests/esdt_transfer_with_fee_scenario_rs_test.rs +++ b/contracts/examples/esdt-transfer-with-fee/tests/esdt_transfer_with_fee_scenario_rs_test.rs @@ -3,6 +3,7 @@ use multiversx_sc_scenario::*; fn world() -> ScenarioWorld { let mut blockchain = ScenarioWorld::new(); + blockchain.set_current_dir_from_workspace("contracts/examples/esdt-transfer-with-fee"); blockchain.register_contract( "mxsc:output/esdt-transfer-with-fee.mxsc.json", esdt_transfer_with_fee::ContractBuilder, diff --git a/contracts/examples/esdt-transfer-with-fee/wasm/Cargo.lock b/contracts/examples/esdt-transfer-with-fee/wasm/Cargo.lock index dc97b10736..0349df2aa0 100644 --- a/contracts/examples/esdt-transfer-with-fee/wasm/Cargo.lock +++ b/contracts/examples/esdt-transfer-with-fee/wasm/Cargo.lock @@ -4,15 +4,15 @@ version = 3 [[package]] name = "arrayvec" -version = "0.7.4" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" +checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" [[package]] name = "autocfg" -version = "1.3.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" +checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" [[package]] name = "bitflags" @@ -53,12 +53,21 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" +[[package]] +name = "multiversx-chain-core" +version = "0.11.0" +dependencies = [ + "bitflags", + "multiversx-sc-codec", +] + [[package]] name = "multiversx-sc" -version = "0.51.1" +version = "0.54.1" dependencies = [ "bitflags", "hex-literal", + "multiversx-chain-core", "multiversx-sc-codec", "multiversx-sc-derive", "num-traits", @@ -67,7 +76,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.20.0" +version = "0.21.0" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -76,7 +85,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.20.0" +version = "0.21.0" dependencies = [ "hex", "proc-macro2", @@ -86,7 +95,7 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.51.1" +version = "0.54.1" dependencies = [ "hex", "proc-macro2", @@ -97,7 +106,7 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.51.1" +version = "0.54.1" dependencies = [ "multiversx-sc", ] @@ -131,9 +140,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.36" +version = "1.0.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" +checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" dependencies = [ "proc-macro2", ] @@ -156,9 +165,9 @@ checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "syn" -version = "2.0.68" +version = "2.0.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "901fa70d88b9d6c98022e23b4136f9f3e54e4662c3bc1bd1d84a42a9a0f0c1e9" +checksum = "9f35bcdf61fd8e7be6caf75f429fdca8beb3ed76584befb503b1569faee373ed" dependencies = [ "proc-macro2", "quote", @@ -167,9 +176,9 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.12" +version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" +checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" [[package]] name = "unwrap-infallible" diff --git a/contracts/examples/esdt-transfer-with-fee/wasm/Cargo.toml b/contracts/examples/esdt-transfer-with-fee/wasm/Cargo.toml index 4a6acde6f2..c0db664037 100644 --- a/contracts/examples/esdt-transfer-with-fee/wasm/Cargo.toml +++ b/contracts/examples/esdt-transfer-with-fee/wasm/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.51.1" +version = "0.54.1" path = "../../../../framework/wasm-adapter" [workspace] diff --git a/contracts/examples/factorial/Cargo.toml b/contracts/examples/factorial/Cargo.toml index 5f513f24bf..6787661abd 100644 --- a/contracts/examples/factorial/Cargo.toml +++ b/contracts/examples/factorial/Cargo.toml @@ -9,9 +9,9 @@ publish = false path = "src/factorial.rs" [dependencies.multiversx-sc] -version = "0.51.1" +version = "0.54.1" path = "../../../framework/base" [dev-dependencies.multiversx-sc-scenario] -version = "0.51.1" +version = "0.54.1" path = "../../../framework/scenario" diff --git a/contracts/examples/factorial/meta/Cargo.toml b/contracts/examples/factorial/meta/Cargo.toml index 396aeccadf..b8f5c26e2c 100644 --- a/contracts/examples/factorial/meta/Cargo.toml +++ b/contracts/examples/factorial/meta/Cargo.toml @@ -9,6 +9,6 @@ publish = false path = ".." [dependencies.multiversx-sc-meta-lib] -version = "0.51.1" +version = "0.54.1" path = "../../../../framework/meta-lib" default-features = false diff --git a/contracts/examples/factorial/tests/factorial_scenario_rs_test.rs b/contracts/examples/factorial/tests/factorial_scenario_rs_test.rs index 679c1a2d92..5588f11668 100644 --- a/contracts/examples/factorial/tests/factorial_scenario_rs_test.rs +++ b/contracts/examples/factorial/tests/factorial_scenario_rs_test.rs @@ -3,6 +3,7 @@ use multiversx_sc_scenario::*; fn world() -> ScenarioWorld { let mut blockchain = ScenarioWorld::new(); + blockchain.set_current_dir_from_workspace("contracts/examples/factorial"); blockchain.register_contract( "mxsc:output/factorial.mxsc.json", factorial::ContractBuilder, diff --git a/contracts/examples/factorial/wasm/Cargo.lock b/contracts/examples/factorial/wasm/Cargo.lock index fd2f46732e..27da239c5c 100755 --- a/contracts/examples/factorial/wasm/Cargo.lock +++ b/contracts/examples/factorial/wasm/Cargo.lock @@ -4,15 +4,15 @@ version = 3 [[package]] name = "arrayvec" -version = "0.7.4" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" +checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" [[package]] name = "autocfg" -version = "1.3.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" +checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" [[package]] name = "bitflags" @@ -53,12 +53,21 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" +[[package]] +name = "multiversx-chain-core" +version = "0.11.0" +dependencies = [ + "bitflags", + "multiversx-sc-codec", +] + [[package]] name = "multiversx-sc" -version = "0.51.1" +version = "0.54.1" dependencies = [ "bitflags", "hex-literal", + "multiversx-chain-core", "multiversx-sc-codec", "multiversx-sc-derive", "num-traits", @@ -67,7 +76,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.20.0" +version = "0.21.0" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -76,7 +85,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.20.0" +version = "0.21.0" dependencies = [ "hex", "proc-macro2", @@ -86,7 +95,7 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.51.1" +version = "0.54.1" dependencies = [ "hex", "proc-macro2", @@ -97,7 +106,7 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.51.1" +version = "0.54.1" dependencies = [ "multiversx-sc", ] @@ -131,9 +140,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.36" +version = "1.0.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" +checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" dependencies = [ "proc-macro2", ] @@ -156,9 +165,9 @@ checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "syn" -version = "2.0.68" +version = "2.0.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "901fa70d88b9d6c98022e23b4136f9f3e54e4662c3bc1bd1d84a42a9a0f0c1e9" +checksum = "9f35bcdf61fd8e7be6caf75f429fdca8beb3ed76584befb503b1569faee373ed" dependencies = [ "proc-macro2", "quote", @@ -167,9 +176,9 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.12" +version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" +checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" [[package]] name = "unwrap-infallible" diff --git a/contracts/examples/factorial/wasm/Cargo.toml b/contracts/examples/factorial/wasm/Cargo.toml index 30f15689b4..c8f924d2fd 100644 --- a/contracts/examples/factorial/wasm/Cargo.toml +++ b/contracts/examples/factorial/wasm/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.51.1" +version = "0.54.1" path = "../../../../framework/wasm-adapter" [workspace] diff --git a/contracts/examples/fractional-nfts/Cargo.toml b/contracts/examples/fractional-nfts/Cargo.toml index 200b624a33..39f41765ff 100644 --- a/contracts/examples/fractional-nfts/Cargo.toml +++ b/contracts/examples/fractional-nfts/Cargo.toml @@ -9,13 +9,13 @@ publish = false path = "src/fractional_nfts.rs" [dependencies.multiversx-sc] -version = "0.51.1" +version = "0.54.1" path = "../../../framework/base" [dependencies.multiversx-sc-modules] -version = "0.51.1" +version = "0.54.1" path = "../../../contracts/modules" [dev-dependencies.multiversx-sc-scenario] -version = "0.51.1" +version = "0.54.1" path = "../../../framework/scenario" diff --git a/contracts/examples/fractional-nfts/meta/Cargo.toml b/contracts/examples/fractional-nfts/meta/Cargo.toml index e8c3c6ade9..9c79187c9c 100644 --- a/contracts/examples/fractional-nfts/meta/Cargo.toml +++ b/contracts/examples/fractional-nfts/meta/Cargo.toml @@ -9,6 +9,6 @@ publish = false path = ".." [dependencies.multiversx-sc-meta-lib] -version = "0.51.1" +version = "0.54.1" path = "../../../../framework/meta-lib" default-features = false diff --git a/contracts/examples/fractional-nfts/wasm/Cargo.lock b/contracts/examples/fractional-nfts/wasm/Cargo.lock index 95c1776157..10a8239e4c 100644 --- a/contracts/examples/fractional-nfts/wasm/Cargo.lock +++ b/contracts/examples/fractional-nfts/wasm/Cargo.lock @@ -4,15 +4,15 @@ version = 3 [[package]] name = "arrayvec" -version = "0.7.4" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" +checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" [[package]] name = "autocfg" -version = "1.3.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" +checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" [[package]] name = "bitflags" @@ -54,12 +54,21 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" +[[package]] +name = "multiversx-chain-core" +version = "0.11.0" +dependencies = [ + "bitflags", + "multiversx-sc-codec", +] + [[package]] name = "multiversx-sc" -version = "0.51.1" +version = "0.54.1" dependencies = [ "bitflags", "hex-literal", + "multiversx-chain-core", "multiversx-sc-codec", "multiversx-sc-derive", "num-traits", @@ -68,7 +77,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.20.0" +version = "0.21.0" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -77,7 +86,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.20.0" +version = "0.21.0" dependencies = [ "hex", "proc-macro2", @@ -87,7 +96,7 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.51.1" +version = "0.54.1" dependencies = [ "hex", "proc-macro2", @@ -98,14 +107,14 @@ dependencies = [ [[package]] name = "multiversx-sc-modules" -version = "0.51.1" +version = "0.54.1" dependencies = [ "multiversx-sc", ] [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.51.1" +version = "0.54.1" dependencies = [ "multiversx-sc", ] @@ -139,9 +148,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.36" +version = "1.0.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" +checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" dependencies = [ "proc-macro2", ] @@ -164,9 +173,9 @@ checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "syn" -version = "2.0.68" +version = "2.0.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "901fa70d88b9d6c98022e23b4136f9f3e54e4662c3bc1bd1d84a42a9a0f0c1e9" +checksum = "9f35bcdf61fd8e7be6caf75f429fdca8beb3ed76584befb503b1569faee373ed" dependencies = [ "proc-macro2", "quote", @@ -175,9 +184,9 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.12" +version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" +checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" [[package]] name = "unwrap-infallible" diff --git a/contracts/examples/fractional-nfts/wasm/Cargo.toml b/contracts/examples/fractional-nfts/wasm/Cargo.toml index 7e767d0182..b64b9aedb0 100644 --- a/contracts/examples/fractional-nfts/wasm/Cargo.toml +++ b/contracts/examples/fractional-nfts/wasm/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.51.1" +version = "0.54.1" path = "../../../../framework/wasm-adapter" [workspace] diff --git a/contracts/examples/lottery-esdt/Cargo.toml b/contracts/examples/lottery-esdt/Cargo.toml index 448dd11f8f..edb3d02f24 100644 --- a/contracts/examples/lottery-esdt/Cargo.toml +++ b/contracts/examples/lottery-esdt/Cargo.toml @@ -9,9 +9,9 @@ publish = false path = "src/lottery.rs" [dependencies.multiversx-sc] -version = "0.51.1" +version = "0.54.1" path = "../../../framework/base" [dev-dependencies.multiversx-sc-scenario] -version = "0.51.1" +version = "0.54.1" path = "../../../framework/scenario" diff --git a/contracts/examples/lottery-esdt/meta/Cargo.toml b/contracts/examples/lottery-esdt/meta/Cargo.toml index 4c5428a1b5..dc9974c180 100644 --- a/contracts/examples/lottery-esdt/meta/Cargo.toml +++ b/contracts/examples/lottery-esdt/meta/Cargo.toml @@ -9,6 +9,6 @@ publish = false path = ".." [dependencies.multiversx-sc-meta-lib] -version = "0.51.1" +version = "0.54.1" path = "../../../../framework/meta-lib" default-features = false diff --git a/contracts/examples/lottery-esdt/src/lottery_info.rs b/contracts/examples/lottery-esdt/src/lottery_info.rs index 869a3906a8..4ec2a6055f 100644 --- a/contracts/examples/lottery-esdt/src/lottery_info.rs +++ b/contracts/examples/lottery-esdt/src/lottery_info.rs @@ -5,7 +5,8 @@ use multiversx_sc::{ use multiversx_sc::derive_imports::*; -#[derive(NestedEncode, NestedDecode, TopEncode, TopDecode, TypeAbi)] +#[type_abi] +#[derive(NestedEncode, NestedDecode, TopEncode, TopDecode)] pub struct LotteryInfo { pub token_identifier: EgldOrEsdtTokenIdentifier, pub ticket_price: BigUint, diff --git a/contracts/examples/lottery-esdt/src/status.rs b/contracts/examples/lottery-esdt/src/status.rs index ba87b5bb84..6a932f2f70 100644 --- a/contracts/examples/lottery-esdt/src/status.rs +++ b/contracts/examples/lottery-esdt/src/status.rs @@ -1,6 +1,7 @@ use multiversx_sc::derive_imports::*; -#[derive(TopEncode, TopDecode, TypeAbi, PartialEq, Eq, Clone, Copy)] +#[type_abi] +#[derive(TopEncode, TopDecode, PartialEq, Eq, Clone, Copy)] pub enum Status { Inactive, Running, diff --git a/contracts/examples/lottery-esdt/tests/lottery_esdt_scenario_rs_test.rs b/contracts/examples/lottery-esdt/tests/lottery_esdt_scenario_rs_test.rs index 4d6cf07266..248324e7a3 100644 --- a/contracts/examples/lottery-esdt/tests/lottery_esdt_scenario_rs_test.rs +++ b/contracts/examples/lottery-esdt/tests/lottery_esdt_scenario_rs_test.rs @@ -3,6 +3,7 @@ use multiversx_sc_scenario::*; fn world() -> ScenarioWorld { let mut blockchain = ScenarioWorld::new(); + blockchain.set_current_dir_from_workspace("contracts/examples/lottery-esdt"); blockchain.register_contract( "mxsc:output/lottery-esdt.mxsc.json", lottery_esdt::ContractBuilder, diff --git a/contracts/examples/lottery-esdt/wasm/Cargo.lock b/contracts/examples/lottery-esdt/wasm/Cargo.lock index 99996e1c51..9723b67e53 100755 --- a/contracts/examples/lottery-esdt/wasm/Cargo.lock +++ b/contracts/examples/lottery-esdt/wasm/Cargo.lock @@ -4,15 +4,15 @@ version = 3 [[package]] name = "arrayvec" -version = "0.7.4" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" +checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" [[package]] name = "autocfg" -version = "1.3.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" +checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" [[package]] name = "bitflags" @@ -53,12 +53,21 @@ dependencies = [ "multiversx-sc-wasm-adapter", ] +[[package]] +name = "multiversx-chain-core" +version = "0.11.0" +dependencies = [ + "bitflags", + "multiversx-sc-codec", +] + [[package]] name = "multiversx-sc" -version = "0.51.1" +version = "0.54.1" dependencies = [ "bitflags", "hex-literal", + "multiversx-chain-core", "multiversx-sc-codec", "multiversx-sc-derive", "num-traits", @@ -67,7 +76,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.20.0" +version = "0.21.0" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -76,7 +85,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.20.0" +version = "0.21.0" dependencies = [ "hex", "proc-macro2", @@ -86,7 +95,7 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.51.1" +version = "0.54.1" dependencies = [ "hex", "proc-macro2", @@ -97,7 +106,7 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.51.1" +version = "0.54.1" dependencies = [ "multiversx-sc", ] @@ -131,9 +140,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.36" +version = "1.0.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" +checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" dependencies = [ "proc-macro2", ] @@ -156,9 +165,9 @@ checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "syn" -version = "2.0.68" +version = "2.0.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "901fa70d88b9d6c98022e23b4136f9f3e54e4662c3bc1bd1d84a42a9a0f0c1e9" +checksum = "9f35bcdf61fd8e7be6caf75f429fdca8beb3ed76584befb503b1569faee373ed" dependencies = [ "proc-macro2", "quote", @@ -167,9 +176,9 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.12" +version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" +checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" [[package]] name = "unwrap-infallible" diff --git a/contracts/examples/lottery-esdt/wasm/Cargo.toml b/contracts/examples/lottery-esdt/wasm/Cargo.toml index 4e433cdaec..c34677725c 100644 --- a/contracts/examples/lottery-esdt/wasm/Cargo.toml +++ b/contracts/examples/lottery-esdt/wasm/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.51.1" +version = "0.54.1" path = "../../../../framework/wasm-adapter" [workspace] diff --git a/contracts/examples/multisig/Cargo.toml b/contracts/examples/multisig/Cargo.toml index f6aa80b3ae..33282e8c11 100644 --- a/contracts/examples/multisig/Cargo.toml +++ b/contracts/examples/multisig/Cargo.toml @@ -9,15 +9,15 @@ publish = false path = "src/multisig.rs" [dependencies.multiversx-sc] -version = "0.51.1" +version = "0.54.1" path = "../../../framework/base" [dependencies.multiversx-sc-modules] -version = "0.51.1" +version = "0.54.1" path = "../../../contracts/modules" [dev-dependencies.multiversx-sc-scenario] -version = "0.51.1" +version = "0.54.1" path = "../../../framework/scenario" [dev-dependencies.adder] @@ -27,7 +27,7 @@ path = "../adder" path = "../factorial" [dev-dependencies.multiversx-wegld-swap-sc] -version = "0.51.1" +version = "0.54.1" path = "../../core/wegld-swap" [dev-dependencies] diff --git a/contracts/examples/multisig/interact/Cargo.toml b/contracts/examples/multisig/interact/Cargo.toml index acc0bf34ae..6548015f01 100644 --- a/contracts/examples/multisig/interact/Cargo.toml +++ b/contracts/examples/multisig/interact/Cargo.toml @@ -13,22 +13,23 @@ path = "src/multisig_interact.rs" clap = { version = "4.4.7", features = ["derive"] } serde = { version = "1.0", features = ["derive"] } toml = "0.8.6" +tokio = { version = "1.24" } [dependencies.multisig] path = ".." [dependencies.multiversx-sc-modules] -version = "0.51.1" +version = "0.54.1" path = "../../../../contracts/modules" [dependencies.multiversx-sc-snippets] -version = "0.51.1" +version = "0.54.1" path = "../../../../framework/snippets" [dependencies.multiversx-sc-scenario] -version = "=0.51.1" +version = "=0.54.1" path = "../../../../framework/scenario" [dependencies.multiversx-sc] -version = "=0.51.1" +version = "=0.54.1" path = "../../../../framework/base" diff --git a/contracts/examples/multisig/interact/config.toml b/contracts/examples/multisig/interact/config.toml index 029fab5ac7..148ebb5803 100644 --- a/contracts/examples/multisig/interact/config.toml +++ b/contracts/examples/multisig/interact/config.toml @@ -1,3 +1,4 @@ -gateway = 'https://devnet-gateway.multiversx.com' +chain_type = 'real' +gateway_uri = 'https://devnet-gateway.multiversx.com' quorum = 2 wegld_address = "erd1qqqqqqqqqqqqqpgqqkwzsxkjc83vlfex9dmznwm7tjvxlqqkpauqx0n782" diff --git a/contracts/examples/multisig/interact/src/multisig_interact.rs b/contracts/examples/multisig/interact/src/multisig_interact.rs index 497b6636dd..ab66377b24 100644 --- a/contracts/examples/multisig/interact/src/multisig_interact.rs +++ b/contracts/examples/multisig/interact/src/multisig_interact.rs @@ -19,7 +19,7 @@ async fn main() { env_logger::init(); let mut multisig_interact = MultisigInteract::init().await; - multisig_interact.register_wallets(); + multisig_interact.register_wallets().await; let cli = multisig_interact_cli::InteractCli::parse(); match &cli.command { @@ -86,11 +86,13 @@ struct MultisigInteract { impl MultisigInteract { async fn init() -> Self { let config = Config::load_config(); - let mut interactor = Interactor::new(&config.gateway) + let mut interactor = Interactor::new(config.gateway_uri()) .await + .use_chain_simulator(config.use_chain_simulator()) .with_tracer(INTERACTOR_SCENARIO_TRACE_PATH) .await; - let wallet_address = interactor.register_wallet(test_wallets::mike()); + interactor.set_current_dir_from_workspace("contracts/examples/multisig/interact"); + let wallet_address = interactor.register_wallet(test_wallets::mike()).await; let multisig_code = BytesValue::interpret_from( "mxsc:../output/multisig.mxsc.json", &InterpreterContext::default(), @@ -106,13 +108,13 @@ impl MultisigInteract { } } - fn register_wallets(&mut self) { + async fn register_wallets(&mut self) { let carol = test_wallets::carol(); let dan = test_wallets::dan(); let eve = test_wallets::eve(); for wallet in &[carol, dan, eve] { - self.interactor.register_wallet(*wallet); + self.interactor.register_wallet(*wallet).await; } } @@ -145,7 +147,6 @@ impl MultisigInteract { .code(&self.multisig_code) .gas(NumExpr("100,000,000")) .returns(ReturnsNewBech32Address) - .prepare_async() .run() .await; @@ -190,9 +191,9 @@ impl MultisigInteract { MultiValueVec::from([ self.wallet_address.to_address(), - carol.address().to_bytes().into(), - dan.address().to_bytes().into(), - eve.address().to_bytes().into(), + carol.to_address(), + dan.to_address(), + eve.to_address(), ]) } @@ -202,7 +203,6 @@ impl MultisigInteract { .from(&self.wallet_address) .to(self.state.current_multisig_address()) .egld(BigUint::from(50_000_000_000_000_000u64)) // 0,05 or 5 * 10^16 - .prepare_async() .run() .await; } @@ -220,7 +220,6 @@ impl MultisigInteract { .gas(gas_expr) .typed(multisig_proxy::MultisigProxy) .perform_action_endpoint(action_id) - .prepare_async() .run() .await; @@ -249,13 +248,14 @@ impl MultisigInteract { .gas(gas_expr) .typed(multisig_proxy::MultisigProxy) .perform_action_endpoint(action_id) + .returns(PassValue(action_id)) .returns(ReturnsResult) }); } - let deployed_addresses = buffer.run().await; + let result = buffer.run().await; - for (action_id, address) in deployed_addresses.iter().enumerate() { + for (action_id, address) in result { println!("successfully performed action `{action_id}`"); if address.is_some() { println!( @@ -273,7 +273,6 @@ impl MultisigInteract { .typed(multisig_proxy::MultisigProxy) .quorum_reached(action_id) .returns(ReturnsResult) - .prepare_async() .run() .await } @@ -285,7 +284,6 @@ impl MultisigInteract { .typed(multisig_proxy::MultisigProxy) .signed(signer, action_id) .returns(ReturnsResult) - .prepare_async() .run() .await } @@ -340,7 +338,6 @@ impl MultisigInteract { .gas(NumExpr("30,000,000")) .typed(multisig_proxy::MultisigProxy) .dns_register(dns_address, name) - .prepare_async() .run() .await; @@ -355,7 +352,6 @@ impl MultisigInteract { .typed(multisig_proxy::MultisigProxy) .quorum() .returns(ReturnsResult) - .prepare_async() .run() .await; @@ -370,7 +366,6 @@ impl MultisigInteract { .typed(multisig_proxy::MultisigProxy) .num_board_members() .returns(ReturnsResult) - .prepare_async() .run() .await; diff --git a/contracts/examples/multisig/interact/src/multisig_interact_config.rs b/contracts/examples/multisig/interact/src/multisig_interact_config.rs index 4aa9903cc0..c11c2c447f 100644 --- a/contracts/examples/multisig/interact/src/multisig_interact_config.rs +++ b/contracts/examples/multisig/interact/src/multisig_interact_config.rs @@ -5,10 +5,18 @@ use std::io::Read; /// Config file const CONFIG_FILE: &str = "config.toml"; +#[derive(Debug, Deserialize)] +#[serde(rename_all = "lowercase")] +pub enum ChainType { + Real, + Simulator, +} + /// Multisig Interact configuration #[derive(Debug, Deserialize)] pub struct Config { - pub gateway: String, + pub gateway_uri: String, + pub chain_type: ChainType, pub quorum: usize, pub wegld_address: Bech32Address, } @@ -21,4 +29,17 @@ impl Config { file.read_to_string(&mut content).unwrap(); toml::from_str(&content).unwrap() } + + // Returns the gateway URI + pub fn gateway_uri(&self) -> &str { + &self.gateway_uri + } + + // Returns if chain type is chain simulator + pub fn use_chain_simulator(&self) -> bool { + match self.chain_type { + ChainType::Real => false, + ChainType::Simulator => true, + } + } } diff --git a/contracts/examples/multisig/interact/src/multisig_interact_nfts.rs b/contracts/examples/multisig/interact/src/multisig_interact_nfts.rs index 2efda8e4d6..e46411e776 100644 --- a/contracts/examples/multisig/interact/src/multisig_interact_nfts.rs +++ b/contracts/examples/multisig/interact/src/multisig_interact_nfts.rs @@ -50,7 +50,6 @@ impl MultisigInteract { .argument(&0u32), ) .returns(ReturnsResult) - .prepare_async() .run() .await; @@ -75,7 +74,6 @@ impl MultisigInteract { .typed(multisig_proxy::MultisigProxy) .perform_action_endpoint(action_id) .returns(ReturnsNewTokenIdentifier) - .prepare_async() .run() .await; self.collection_token_identifier = new_token_id.to_string(); @@ -102,7 +100,6 @@ impl MultisigInteract { .argument(&COLLECTION_TICKER), ) .returns(ReturnsResult) - .prepare_async() .run() .await; @@ -127,7 +124,6 @@ impl MultisigInteract { .typed(multisig_proxy::MultisigProxy) .perform_action_endpoint(action_id) .returns(ReturnsNewTokenIdentifier) - .prepare_async() .run() .await; self.collection_token_identifier = new_token_id; @@ -156,7 +152,6 @@ impl MultisigInteract { .argument(&"ESDTRoleNFTCreate"), ) .returns(ReturnsResult) - .prepare_async() .run() .await; diff --git a/contracts/examples/multisig/interact/src/multisig_interact_wegld.rs b/contracts/examples/multisig/interact/src/multisig_interact_wegld.rs index 7774bc02d4..2ed1a93b30 100644 --- a/contracts/examples/multisig/interact/src/multisig_interact_wegld.rs +++ b/contracts/examples/multisig/interact/src/multisig_interact_wegld.rs @@ -56,7 +56,6 @@ impl MultisigInteract { .typed(multisig_proxy::MultisigProxy) .propose_async_call(&self.config.wegld_address, WRAP_AMOUNT, function_call) .returns(ReturnsResult) - .prepare_async() .run() .await; @@ -72,7 +71,6 @@ impl MultisigInteract { .typed(wegld_proxy::EgldEsdtSwapProxy) .wrapped_egld_token_id() .returns(ReturnsResult) - .prepare_async() .run() .await; @@ -104,7 +102,6 @@ impl MultisigInteract { .typed(multisig_proxy::MultisigProxy) .propose_async_call(normalized_to, 0u64, normalized_data) .returns(ReturnsResult) - .prepare_async() .run() .await; diff --git a/contracts/examples/multisig/meta/Cargo.toml b/contracts/examples/multisig/meta/Cargo.toml index 0f38bf905b..70a9ff1220 100644 --- a/contracts/examples/multisig/meta/Cargo.toml +++ b/contracts/examples/multisig/meta/Cargo.toml @@ -9,6 +9,6 @@ publish = false path = ".." [dependencies.multiversx-sc-meta-lib] -version = "0.51.1" +version = "0.54.1" path = "../../../../framework/meta-lib" default-features = false diff --git a/contracts/examples/multisig/tests/multisig_blackbox_test.rs b/contracts/examples/multisig/tests/multisig_blackbox_test.rs index e8067bb73a..7a2cff5996 100644 --- a/contracts/examples/multisig/tests/multisig_blackbox_test.rs +++ b/contracts/examples/multisig/tests/multisig_blackbox_test.rs @@ -19,6 +19,7 @@ const QUORUM_SIZE: usize = 1; fn world() -> ScenarioWorld { let mut blockchain = ScenarioWorld::new(); + blockchain.set_current_dir_from_workspace("contracts/examples/multisig"); blockchain.register_contract(MULTISIG_CODE_PATH, multisig::ContractBuilder); blockchain.register_contract(ADDER_CODE_PATH, adder::ContractBuilder); blockchain diff --git a/contracts/examples/multisig/tests/multisig_scenario_rs_test.rs b/contracts/examples/multisig/tests/multisig_scenario_rs_test.rs index 67baad4ca2..8a606bffd8 100644 --- a/contracts/examples/multisig/tests/multisig_scenario_rs_test.rs +++ b/contracts/examples/multisig/tests/multisig_scenario_rs_test.rs @@ -4,6 +4,7 @@ const WEGLD_SWAP_EXPR: &str = "0x0061736d0100000001661160000060017f0060027f7f017 fn world() -> ScenarioWorld { let mut blockchain = ScenarioWorld::new(); + blockchain.set_current_dir_from_workspace("contracts/examples/multisig"); blockchain.register_partial_contract::( "mxsc:output/multisig.mxsc.json", diff --git a/contracts/examples/multisig/tests/multisig_whitebox_test.rs b/contracts/examples/multisig/tests/multisig_whitebox_test.rs index 904a03c7e0..69877fe787 100644 --- a/contracts/examples/multisig/tests/multisig_whitebox_test.rs +++ b/contracts/examples/multisig/tests/multisig_whitebox_test.rs @@ -10,11 +10,11 @@ use multisig::{ user_role::UserRole, Multisig, }; -const OWNER_ADDRESS_EXPR: &str = "address:owner"; -const PROPOSER_ADDRESS_EXPR: &str = "address:proposer"; -const BOARD_MEMBER_ADDRESS_EXPR: &str = "address:board-member"; -const MULTISIG_ADDRESS_EXPR: &str = "sc:multisig"; -const MULTISIG_PATH_EXPR: &str = "mxsc:output/multisig.mxsc.json"; +const OWNER_ADDRESS: TestAddress = TestAddress::new("owner"); +const PROPOSER_ADDRESS: TestAddress = TestAddress::new("proposer"); +const BOARD_MEMBER_ADDRESS: TestAddress = TestAddress::new("board-member"); +const MULTISIG_ADDRESS: TestSCAddress = TestSCAddress::new("multisig"); +const MULTISIG_PATH_EXPR: MxscPath = MxscPath::new("mxsc:output/multisig.mxsc.json"); const QUORUM_SIZE: usize = 1; type RustBigUint = num_bigint::BigUint; @@ -52,6 +52,7 @@ pub struct CallActionDataRaw { fn world() -> ScenarioWorld { let mut blockchain = ScenarioWorld::new(); + blockchain.set_current_dir_from_workspace("contracts/examples/multisig"); blockchain.register_contract(MULTISIG_PATH_EXPR, multisig::ContractBuilder); blockchain } @@ -59,40 +60,28 @@ fn world() -> ScenarioWorld { fn setup() -> ScenarioWorld { // setup let mut world = world(); - let multisig_whitebox = WhiteboxContract::new(MULTISIG_ADDRESS_EXPR, multisig::contract_obj); - let multisig_code = world.code_expression(MULTISIG_PATH_EXPR); - - world.set_state_step( - SetStateStep::new() - .put_account(OWNER_ADDRESS_EXPR, Account::new().nonce(1)) - .new_address(OWNER_ADDRESS_EXPR, 1, MULTISIG_ADDRESS_EXPR) - .put_account( - PROPOSER_ADDRESS_EXPR, - Account::new().nonce(1).balance(100_000_000u64), - ) - .put_account(BOARD_MEMBER_ADDRESS_EXPR, Account::new().nonce(1)), - ); + + world.account(OWNER_ADDRESS).nonce(1); + world + .account(PROPOSER_ADDRESS) + .nonce(1) + .balance(100_000_000u64); + world.account(BOARD_MEMBER_ADDRESS).nonce(1); // init multisig - world.whitebox_deploy( - &multisig_whitebox, - ScDeployStep::new() - .from(OWNER_ADDRESS_EXPR) - .code(multisig_code), - |sc| { + world + .tx() + .from(OWNER_ADDRESS) + .raw_deploy() + .code(MULTISIG_PATH_EXPR) + .new_address(MULTISIG_ADDRESS) + .whitebox(multisig::contract_obj, |sc| { let mut board_members = ManagedVec::new(); - board_members.push(managed_address!(&address_expr_to_address( - BOARD_MEMBER_ADDRESS_EXPR - ))); + board_members.push(BOARD_MEMBER_ADDRESS.to_managed_address()); sc.init(QUORUM_SIZE, board_members.into()); - sc.change_user_role( - 0, - managed_address!(&address_expr_to_address(PROPOSER_ADDRESS_EXPR)), - UserRole::Proposer, - ); - }, - ); + sc.change_user_role(0, PROPOSER_ADDRESS.to_managed_address(), UserRole::Proposer); + }); world } @@ -119,70 +108,66 @@ fn call_propose( let mut action_id = 0; - let multisig_whitebox = WhiteboxContract::new(MULTISIG_ADDRESS_EXPR, multisig::contract_obj); - - world.whitebox_call_check( - &multisig_whitebox, - ScCallStep::new() - .from(PROPOSER_ADDRESS_EXPR) - .egld_value(amount_rust_biguint) - .no_expect(), - |sc| { - action_id = match action { - ActionRaw::_Nothing => panic!("Invalid action"), - ActionRaw::AddBoardMember(addr) => { - sc.propose_add_board_member(managed_address!(&addr)) + let mut transaction = world + .tx() + .from(PROPOSER_ADDRESS) + .to(MULTISIG_ADDRESS) + .egld(BigUint::from(egld_amount)); + + let mut transaction_with_err = match expected_message { + Some(message) => transaction.returns(ExpectError(4u64, message)), + None => transaction.returns(ExpectError(0u64, "")), + }; + + transaction_with_err.whitebox(multisig::contract_obj, |sc| { + action_id = match action { + ActionRaw::_Nothing => panic!("Invalid action"), + ActionRaw::AddBoardMember(addr) => sc.propose_add_board_member(managed_address!(&addr)), + ActionRaw::AddProposer(addr) => sc.propose_add_proposer(managed_address!(&addr)), + ActionRaw::RemoveUser(addr) => sc.propose_remove_user(managed_address!(&addr)), + ActionRaw::ChangeQuorum(new_size) => sc.propose_change_quorum(new_size), + ActionRaw::SendTransferExecute(call_data) => sc.propose_transfer_execute( + managed_address!(&call_data.to), + call_data.egld_amount.into(), + FunctionCall { + function_name: call_data.endpoint_name.into(), + arg_buffer: call_data.arguments.into(), }, - ActionRaw::AddProposer(addr) => sc.propose_add_proposer(managed_address!(&addr)), - ActionRaw::RemoveUser(addr) => sc.propose_remove_user(managed_address!(&addr)), - ActionRaw::ChangeQuorum(new_size) => sc.propose_change_quorum(new_size), - ActionRaw::SendTransferExecute(call_data) => sc.propose_transfer_execute( - managed_address!(&call_data.to), - BigUint::from_bytes_be(&call_data.egld_amount.to_bytes_be()), - FunctionCall { - function_name: call_data.endpoint_name.into(), - arg_buffer: call_data.arguments.into(), - }, - ), - ActionRaw::SendAsyncCall(call_data) => sc.propose_async_call( - managed_address!(&call_data.to), - BigUint::from_bytes_be(&call_data.egld_amount.to_bytes_be()), - FunctionCall { - function_name: call_data.endpoint_name.into(), - arg_buffer: call_data.arguments.into(), - }, - ), - ActionRaw::SCDeployFromSource { - amount, - source, - code_metadata, - arguments, - } => sc.propose_sc_deploy_from_source( - BigUint::from_bytes_be(&amount.to_bytes_be()), - managed_address!(&source), - code_metadata, - boxed_bytes_vec_to_managed(arguments).into(), - ), - ActionRaw::SCUpgradeFromSource { - sc_address, - amount, - source, - code_metadata, - arguments, - } => sc.propose_sc_upgrade_from_source( - managed_address!(&sc_address), - BigUint::from_bytes_be(&amount.to_bytes_be()), - managed_address!(&source), - code_metadata, - boxed_bytes_vec_to_managed(arguments).into(), - ), - } - }, - |r| match expected_message { - Some(msg) => r.assert_user_error(msg), - None => r.assert_ok(), - }, - ); + ), + ActionRaw::SendAsyncCall(call_data) => sc.propose_async_call( + managed_address!(&call_data.to), + call_data.egld_amount.into(), + FunctionCall { + function_name: call_data.endpoint_name.into(), + arg_buffer: call_data.arguments.into(), + }, + ), + ActionRaw::SCDeployFromSource { + amount, + source, + code_metadata, + arguments, + } => sc.propose_sc_deploy_from_source( + amount.into(), + managed_address!(&source), + code_metadata, + boxed_bytes_vec_to_managed(arguments).into(), + ), + ActionRaw::SCUpgradeFromSource { + sc_address, + amount, + source, + code_metadata, + arguments, + } => sc.propose_sc_upgrade_from_source( + managed_address!(&sc_address), + amount.into(), + managed_address!(&source), + code_metadata, + boxed_bytes_vec_to_managed(arguments).into(), + ), + } + }); action_id } @@ -190,341 +175,300 @@ fn call_propose( #[test] fn test_add_board_member() { let mut world = setup(); - let multisig_whitebox = WhiteboxContract::new(MULTISIG_ADDRESS_EXPR, multisig::contract_obj); - const NEW_BOARD_MEMBER_ADDRESS_EXPR: &str = "address:new-board-member"; - world.set_state_step( - SetStateStep::new().put_account(NEW_BOARD_MEMBER_ADDRESS_EXPR, Account::new().nonce(1)), - ); + const NEW_BOARD_MEMBER_ADDRESS: TestAddress = TestAddress::new("new-board-member"); + world.account(NEW_BOARD_MEMBER_ADDRESS).nonce(1); - world.whitebox_query(&multisig_whitebox, |sc| { - // check role before - let user_role = sc.user_role(managed_address!(&address_expr_to_address( - NEW_BOARD_MEMBER_ADDRESS_EXPR - ))); - assert_eq!(user_role, UserRole::None); - }); + world + .query() + .to(MULTISIG_ADDRESS) + .whitebox(multisig::contract_obj, |sc| { + // check role before + let user_role = sc.user_role(NEW_BOARD_MEMBER_ADDRESS.to_managed_address()); + assert_eq!(user_role, UserRole::None); + }); let action_id = call_propose( &mut world, - ActionRaw::AddBoardMember(address_expr_to_address(NEW_BOARD_MEMBER_ADDRESS_EXPR)), + ActionRaw::AddBoardMember(NEW_BOARD_MEMBER_ADDRESS.to_address()), None, ); - world.whitebox_call( - &multisig_whitebox, - ScCallStep::new().from(BOARD_MEMBER_ADDRESS_EXPR), - |sc| sc.sign(action_id), - ); + world + .tx() + .from(BOARD_MEMBER_ADDRESS) + .to(MULTISIG_ADDRESS) + .whitebox(multisig::contract_obj, |sc| sc.sign(action_id)); - world.whitebox_call( - &multisig_whitebox, - ScCallStep::new().from(BOARD_MEMBER_ADDRESS_EXPR), - |sc| { + world + .tx() + .from(BOARD_MEMBER_ADDRESS) + .to(MULTISIG_ADDRESS) + .whitebox(multisig::contract_obj, |sc| { let _ = sc.perform_action_endpoint(action_id); - }, - ); + }); - world.whitebox_query(&multisig_whitebox, |sc| { - // check role after - let user_role = sc.user_role(managed_address!(&address_expr_to_address( - NEW_BOARD_MEMBER_ADDRESS_EXPR - ))); - assert_eq!(user_role, UserRole::BoardMember); - - let board_members = sc.get_all_board_members().to_vec(); - assert_eq!( - (board_members.get(0).borrow() as &ManagedAddress).clone(), - managed_address!(&address_expr_to_address(BOARD_MEMBER_ADDRESS_EXPR)) - ); - assert_eq!( - (board_members.get(1).borrow() as &ManagedAddress).clone(), - managed_address!(&address_expr_to_address(NEW_BOARD_MEMBER_ADDRESS_EXPR)) - ); - }); + world + .query() + .to(MULTISIG_ADDRESS) + .whitebox(multisig::contract_obj, |sc| { + // check role after + let user_role = sc.user_role(NEW_BOARD_MEMBER_ADDRESS.to_managed_address()); + assert_eq!(user_role, UserRole::BoardMember); + + let board_members = sc.get_all_board_members().to_vec(); + assert_eq!(*board_members.get(0), BOARD_MEMBER_ADDRESS); + assert_eq!(*board_members.get(1), NEW_BOARD_MEMBER_ADDRESS); + }); } #[test] fn test_add_proposer() { let mut world = setup(); - let multisig_whitebox = WhiteboxContract::new(MULTISIG_ADDRESS_EXPR, multisig::contract_obj); - const NEW_PROPOSER_ADDRESS_EXPR: &str = "address:new-proposer"; - world.set_state_step( - SetStateStep::new().put_account(NEW_PROPOSER_ADDRESS_EXPR, Account::new().nonce(1)), - ); + const NEW_PROPOSER_ADDRESS: TestAddress = TestAddress::new("new-proposer"); + world.account(NEW_PROPOSER_ADDRESS).nonce(1); - world.whitebox_query(&multisig_whitebox, |sc| { - // check role before - let user_role = sc.user_role(managed_address!(&address_expr_to_address( - NEW_PROPOSER_ADDRESS_EXPR - ))); - assert_eq!(user_role, UserRole::None); - }); + world + .query() + .to(MULTISIG_ADDRESS) + .whitebox(multisig::contract_obj, |sc| { + // check role before + let user_role = sc.user_role(NEW_PROPOSER_ADDRESS.to_managed_address()); + assert_eq!(user_role, UserRole::None); + }); let action_id = call_propose( &mut world, - ActionRaw::AddProposer(address_expr_to_address(NEW_PROPOSER_ADDRESS_EXPR)), + ActionRaw::AddProposer(NEW_PROPOSER_ADDRESS.to_address()), None, ); - world.whitebox_call( - &multisig_whitebox, - ScCallStep::new().from(BOARD_MEMBER_ADDRESS_EXPR), - |sc| sc.sign(action_id), - ); + world + .tx() + .from(BOARD_MEMBER_ADDRESS) + .to(MULTISIG_ADDRESS) + .whitebox(multisig::contract_obj, |sc| sc.sign(action_id)); - world.whitebox_call( - &multisig_whitebox, - ScCallStep::new().from(BOARD_MEMBER_ADDRESS_EXPR), - |sc| { + world + .tx() + .from(BOARD_MEMBER_ADDRESS) + .to(MULTISIG_ADDRESS) + .whitebox(multisig::contract_obj, |sc| { let _ = sc.perform_action_endpoint(action_id); - }, - ); + }); - world.whitebox_query(&multisig_whitebox, |sc| { - // check role after - let user_role = sc.user_role(managed_address!(&address_expr_to_address( - NEW_PROPOSER_ADDRESS_EXPR - ))); - assert_eq!(user_role, UserRole::Proposer); - - let proposers = sc.get_all_proposers().to_vec(); - assert_eq!( - (proposers.get(0).borrow() as &ManagedAddress).clone(), - managed_address!(&address_expr_to_address(PROPOSER_ADDRESS_EXPR)) - ); - assert_eq!( - (proposers.get(1).borrow() as &ManagedAddress).clone(), - managed_address!(&address_expr_to_address(NEW_PROPOSER_ADDRESS_EXPR)) - ); - }); + world + .query() + .to(MULTISIG_ADDRESS) + .whitebox(multisig::contract_obj, |sc| { + // check role after + let user_role = sc.user_role(NEW_PROPOSER_ADDRESS.to_managed_address()); + assert_eq!(user_role, UserRole::Proposer); + + let proposers = sc.get_all_proposers().to_vec(); + assert_eq!(*proposers.get(0), PROPOSER_ADDRESS); + assert_eq!(*proposers.get(1), NEW_PROPOSER_ADDRESS); + }); } #[test] fn test_remove_proposer() { let mut world = setup(); - let multisig_whitebox = WhiteboxContract::new(MULTISIG_ADDRESS_EXPR, multisig::contract_obj); - - world.whitebox_query(&multisig_whitebox, |sc| { - // check role before - let user_role = sc.user_role(managed_address!(&address_expr_to_address( - PROPOSER_ADDRESS_EXPR - ))); - assert_eq!(user_role, UserRole::Proposer); - }); + + world + .query() + .to(MULTISIG_ADDRESS) + .whitebox(multisig::contract_obj, |sc| { + // check role before + let user_role = sc.user_role(PROPOSER_ADDRESS.to_managed_address()); + assert_eq!(user_role, UserRole::Proposer); + }); let action_id = call_propose( &mut world, - ActionRaw::RemoveUser(address_expr_to_address(PROPOSER_ADDRESS_EXPR)), + ActionRaw::RemoveUser(PROPOSER_ADDRESS.to_address()), None, ); - world.whitebox_call( - &multisig_whitebox, - ScCallStep::new().from(BOARD_MEMBER_ADDRESS_EXPR), - |sc| sc.sign(action_id), - ); + world + .tx() + .from(BOARD_MEMBER_ADDRESS) + .to(MULTISIG_ADDRESS) + .whitebox(multisig::contract_obj, |sc| sc.sign(action_id)); - world.whitebox_call( - &multisig_whitebox, - ScCallStep::new().from(BOARD_MEMBER_ADDRESS_EXPR), - |sc| { + world + .tx() + .from(BOARD_MEMBER_ADDRESS) + .to(MULTISIG_ADDRESS) + .whitebox(multisig::contract_obj, |sc| { let _ = sc.perform_action_endpoint(action_id); - }, - ); + }); - world.whitebox_query(&multisig_whitebox, |sc| { - // check role after - let user_role = sc.user_role(managed_address!(&address_expr_to_address( - PROPOSER_ADDRESS_EXPR - ))); - assert_eq!(user_role, UserRole::None); - - let proposers = sc.get_all_proposers().to_vec(); - assert!(proposers.is_empty()); - }); + world + .query() + .to(MULTISIG_ADDRESS) + .whitebox(multisig::contract_obj, |sc| { + // check role after + let user_role = sc.user_role(PROPOSER_ADDRESS.to_managed_address()); + assert_eq!(user_role, UserRole::None); + + let proposers = sc.get_all_proposers(); + assert!(proposers.is_empty()); + }); } #[test] fn test_try_remove_all_board_members() { let mut world = setup(); - let multisig_whitebox = WhiteboxContract::new(MULTISIG_ADDRESS_EXPR, multisig::contract_obj); let action_id = call_propose( &mut world, - ActionRaw::RemoveUser(address_expr_to_address(BOARD_MEMBER_ADDRESS_EXPR)), + ActionRaw::RemoveUser(BOARD_MEMBER_ADDRESS.to_address()), None, ); - world.whitebox_call( - &multisig_whitebox, - ScCallStep::new().from(BOARD_MEMBER_ADDRESS_EXPR), - |sc| sc.sign(action_id), - ); + world + .tx() + .from(BOARD_MEMBER_ADDRESS) + .to(MULTISIG_ADDRESS) + .whitebox(multisig::contract_obj, |sc| sc.sign(action_id)); - world.whitebox_call_check( - &multisig_whitebox, - ScCallStep::new() - .from(BOARD_MEMBER_ADDRESS_EXPR) - .no_expect(), - |sc| { + world + .tx() + .from(BOARD_MEMBER_ADDRESS) + .to(MULTISIG_ADDRESS) + .returns(ExpectError(4u64, "quorum cannot exceed board size")) + .whitebox(multisig::contract_obj, |sc| { let _ = sc.perform_action_endpoint(action_id); - }, - |r| { - r.assert_user_error("quorum cannot exceed board size"); - }, - ); + }); } #[test] fn test_change_quorum() { let mut world = setup(); - let multisig_whitebox = WhiteboxContract::new(MULTISIG_ADDRESS_EXPR, multisig::contract_obj); let new_quorum_size = 2; // try change quorum > board size let action_id = call_propose(&mut world, ActionRaw::ChangeQuorum(new_quorum_size), None); - world.whitebox_call( - &multisig_whitebox, - ScCallStep::new().from(BOARD_MEMBER_ADDRESS_EXPR), - |sc| sc.sign(action_id), - ); + world + .tx() + .from(BOARD_MEMBER_ADDRESS) + .to(MULTISIG_ADDRESS) + .whitebox(multisig::contract_obj, |sc| sc.sign(action_id)); - world.whitebox_call_check( - &multisig_whitebox, - ScCallStep::new() - .from(BOARD_MEMBER_ADDRESS_EXPR) - .no_expect(), - |sc| { + world + .tx() + .from(BOARD_MEMBER_ADDRESS) + .to(MULTISIG_ADDRESS) + .returns(ExpectError(4u64, "quorum cannot exceed board size")) + .whitebox(multisig::contract_obj, |sc| { let _ = sc.perform_action_endpoint(action_id); - }, - |r| { - r.assert_user_error("quorum cannot exceed board size"); - }, - ); + }); // try discard before unsigning - world.whitebox_call_check( - &multisig_whitebox, - ScCallStep::new() - .from(BOARD_MEMBER_ADDRESS_EXPR) - .no_expect(), - |sc| { - sc.discard_action(action_id); - }, - |r| { - r.assert_user_error("cannot discard action with valid signatures"); - }, - ); + world + .tx() + .from(BOARD_MEMBER_ADDRESS) + .to(MULTISIG_ADDRESS) + .returns(ExpectError( + 4u64, + "cannot discard action with valid signatures", + )) + .whitebox(multisig::contract_obj, |sc| sc.discard_action(action_id)); // unsign and discard action - world.whitebox_call( - &multisig_whitebox, - ScCallStep::new().from(BOARD_MEMBER_ADDRESS_EXPR), - |sc| sc.unsign(action_id), - ); + world + .tx() + .from(BOARD_MEMBER_ADDRESS) + .to(MULTISIG_ADDRESS) + .whitebox(multisig::contract_obj, |sc| sc.unsign(action_id)); - world.whitebox_call( - &multisig_whitebox, - ScCallStep::new().from(BOARD_MEMBER_ADDRESS_EXPR), - |sc| { - sc.discard_action(action_id); - }, - ); + world + .tx() + .from(BOARD_MEMBER_ADDRESS) + .to(MULTISIG_ADDRESS) + .whitebox(multisig::contract_obj, |sc| sc.discard_action(action_id)); // try sign discarded action - world.whitebox_call_check( - &multisig_whitebox, - ScCallStep::new() - .from(BOARD_MEMBER_ADDRESS_EXPR) - .no_expect(), - |sc| { + world + .tx() + .from(BOARD_MEMBER_ADDRESS) + .to(MULTISIG_ADDRESS) + .returns(ExpectError(4u64, "action does not exist")) + .whitebox(multisig::contract_obj, |sc| { sc.sign(action_id); - }, - |r| { - r.assert_user_error("action does not exist"); - }, - ); + }); // add another board member - const NEW_BOARD_MEMBER_ADDRESS_EXPR: &str = "address:new-board-member"; - world.set_state_step( - SetStateStep::new().put_account(NEW_BOARD_MEMBER_ADDRESS_EXPR, Account::new().nonce(1)), - ); + const NEW_BOARD_MEMBER_ADDRESS: TestAddress = TestAddress::new("new-board-member"); + world.account(NEW_BOARD_MEMBER_ADDRESS).nonce(1); let action_id = call_propose( &mut world, - ActionRaw::AddBoardMember(address_expr_to_address(NEW_BOARD_MEMBER_ADDRESS_EXPR)), + ActionRaw::AddBoardMember(NEW_BOARD_MEMBER_ADDRESS.to_address()), None, ); - world.whitebox_call( - &multisig_whitebox, - ScCallStep::new().from(BOARD_MEMBER_ADDRESS_EXPR), - |sc| sc.sign(action_id), - ); + world + .tx() + .from(BOARD_MEMBER_ADDRESS) + .to(MULTISIG_ADDRESS) + .whitebox(multisig::contract_obj, |sc| sc.sign(action_id)); - world.whitebox_call( - &multisig_whitebox, - ScCallStep::new().from(BOARD_MEMBER_ADDRESS_EXPR), - |sc| { + world + .tx() + .from(BOARD_MEMBER_ADDRESS) + .to(MULTISIG_ADDRESS) + .whitebox(multisig::contract_obj, |sc| { let _ = sc.perform_action_endpoint(action_id); - }, - ); + }); // change quorum to 2 let action_id = call_propose(&mut world, ActionRaw::ChangeQuorum(new_quorum_size), None); - world.whitebox_call( - &multisig_whitebox, - ScCallStep::new().from(BOARD_MEMBER_ADDRESS_EXPR), - |sc| sc.sign(action_id), - ); + world + .tx() + .from(BOARD_MEMBER_ADDRESS) + .to(MULTISIG_ADDRESS) + .whitebox(multisig::contract_obj, |sc| sc.sign(action_id)); - world.whitebox_call( - &multisig_whitebox, - ScCallStep::new().from(BOARD_MEMBER_ADDRESS_EXPR), - |sc| { + world + .tx() + .from(BOARD_MEMBER_ADDRESS) + .to(MULTISIG_ADDRESS) + .whitebox(multisig::contract_obj, |sc| { let _ = sc.perform_action_endpoint(action_id); - }, - ); + }); } #[test] fn test_transfer_execute_to_user() { let mut world = setup(); - let multisig_whitebox = WhiteboxContract::new(MULTISIG_ADDRESS_EXPR, multisig::contract_obj); - const NEW_USER_ADDRESS_EXPR: &str = "address:new-user"; - world.set_state_step( - SetStateStep::new().put_account(NEW_USER_ADDRESS_EXPR, Account::new().nonce(1)), - ); + const NEW_USER_ADDRESS: TestAddress = TestAddress::new("new-user"); + world.account(NEW_USER_ADDRESS).nonce(1); const EGLD_AMOUNT: u64 = 100; - world.whitebox_call( - &multisig_whitebox, - ScCallStep::new() - .from(PROPOSER_ADDRESS_EXPR) - .egld_value(EGLD_AMOUNT), - |sc| { + world + .tx() + .from(PROPOSER_ADDRESS) + .to(MULTISIG_ADDRESS) + .egld(EGLD_AMOUNT) + .whitebox(multisig::contract_obj, |sc| { sc.deposit(); - }, - ); + }); - world.check_state_step(CheckStateStep::new().put_account( - MULTISIG_ADDRESS_EXPR, - CheckAccount::new().balance(EGLD_AMOUNT.to_string().as_str()), - )); + world.check_account(MULTISIG_ADDRESS).balance(EGLD_AMOUNT); // failed attempt let action_id = call_propose( &mut world, ActionRaw::SendTransferExecute(CallActionDataRaw { - to: address_expr_to_address(NEW_USER_ADDRESS_EXPR), + to: NEW_USER_ADDRESS.to_address(), egld_amount: rust_biguint!(0), endpoint_name: BoxedBytes::empty(), arguments: Vec::new(), @@ -536,7 +480,7 @@ fn test_transfer_execute_to_user() { let action_id = call_propose( &mut world, ActionRaw::SendTransferExecute(CallActionDataRaw { - to: address_expr_to_address(NEW_USER_ADDRESS_EXPR), + to: NEW_USER_ADDRESS.to_address(), egld_amount: rust_biguint!(EGLD_AMOUNT), endpoint_name: BoxedBytes::empty(), arguments: Vec::new(), @@ -544,59 +488,48 @@ fn test_transfer_execute_to_user() { None, ); - world.whitebox_call( - &multisig_whitebox, - ScCallStep::new().from(BOARD_MEMBER_ADDRESS_EXPR), - |sc| sc.sign(action_id), - ); + world + .tx() + .from(BOARD_MEMBER_ADDRESS) + .to(MULTISIG_ADDRESS) + .whitebox(multisig::contract_obj, |sc| sc.sign(action_id)); - world.whitebox_call( - &multisig_whitebox, - ScCallStep::new().from(BOARD_MEMBER_ADDRESS_EXPR), - |sc| { + world + .tx() + .from(BOARD_MEMBER_ADDRESS) + .to(MULTISIG_ADDRESS) + .whitebox(multisig::contract_obj, |sc| { let _ = sc.perform_action_endpoint(action_id); - }, - ); + }); - world.check_state_step(CheckStateStep::new().put_account( - NEW_USER_ADDRESS_EXPR, - CheckAccount::new().balance(EGLD_AMOUNT.to_string().as_str()), - )); + world.check_account(NEW_USER_ADDRESS).balance(EGLD_AMOUNT); } #[test] fn test_transfer_execute_sc_all() { let mut world = setup(); - let multisig_whitebox = WhiteboxContract::new(MULTISIG_ADDRESS_EXPR, multisig::contract_obj); - - let adder_whitebox = WhiteboxContract::new(ADDER_ADDRESS_EXPR, adder::contract_obj); - let adder_code = world.code_expression(ADDER_PATH_EXPR); - const ADDER_OWNER_ADDRESS_EXPR: &str = "address:adder-owner"; - const ADDER_ADDRESS_EXPR: &str = "sc:adder"; - const ADDER_PATH_EXPR: &str = "mxsc:test-contracts/adder.mxsc.json"; + const ADDER_OWNER_ADDRESS: TestAddress = TestAddress::new("adder-owner"); + const ADDER_ADDRESS: TestSCAddress = TestSCAddress::new("adder"); + const ADDER_PATH_EXPR: MxscPath = MxscPath::new("mxsc:test-contracts/adder.mxsc.json"); world.register_contract(ADDER_PATH_EXPR, adder::ContractBuilder); - world.set_state_step( - SetStateStep::new() - .put_account(ADDER_OWNER_ADDRESS_EXPR, Account::new().nonce(1)) - .new_address(ADDER_OWNER_ADDRESS_EXPR, 1, ADDER_ADDRESS_EXPR), - ); + world.account(ADDER_OWNER_ADDRESS).nonce(1); - world.whitebox_deploy( - &adder_whitebox, - ScDeployStep::new() - .from(ADDER_OWNER_ADDRESS_EXPR) - .code(adder_code), - |sc| { - sc.init(managed_biguint!(5)); - }, - ); + world + .tx() + .raw_deploy() + .from(ADDER_OWNER_ADDRESS) + .code(ADDER_PATH_EXPR) + .new_address(ADDER_ADDRESS) + .whitebox(adder::contract_obj, |sc| { + sc.init(BigUint::from(5u64)); + }); let action_id = call_propose( &mut world, ActionRaw::SendTransferExecute(CallActionDataRaw { - to: address_expr_to_address(ADDER_ADDRESS_EXPR), + to: ADDER_ADDRESS.to_address(), egld_amount: 0u64.into(), endpoint_name: BoxedBytes::from(&b"add"[..]), arguments: vec![BoxedBytes::from(&[5u8][..])], @@ -604,60 +537,55 @@ fn test_transfer_execute_sc_all() { None, ); - world.whitebox_call( - &multisig_whitebox, - ScCallStep::new().from(BOARD_MEMBER_ADDRESS_EXPR), - |sc| sc.sign(action_id), - ); + world + .tx() + .from(BOARD_MEMBER_ADDRESS) + .to(MULTISIG_ADDRESS) + .whitebox(multisig::contract_obj, |sc| sc.sign(action_id)); - world.whitebox_call( - &multisig_whitebox, - ScCallStep::new().from(BOARD_MEMBER_ADDRESS_EXPR), - |sc| { + world + .tx() + .from(BOARD_MEMBER_ADDRESS) + .to(MULTISIG_ADDRESS) + .whitebox(multisig::contract_obj, |sc| { let _ = sc.perform_action_endpoint(action_id); - }, - ); + }); - world.whitebox_query(&adder_whitebox, |sc| { - let actual_sum = sc.sum().get(); - let expected_sum = managed_biguint!(10); - assert_eq!(actual_sum, expected_sum); - }); + world + .query() + .to(ADDER_ADDRESS) + .whitebox(adder::contract_obj, |sc| { + let actual_sum = sc.sum().get(); + let expected_sum = managed_biguint!(10); + assert_eq!(actual_sum, expected_sum); + }); } #[test] fn test_async_call_to_sc() { let mut world = setup(); - let multisig_whitebox = WhiteboxContract::new(MULTISIG_ADDRESS_EXPR, multisig::contract_obj); - - let adder_whitebox = WhiteboxContract::new(ADDER_ADDRESS_EXPR, adder::contract_obj); - let adder_code = world.code_expression(ADDER_PATH_EXPR); - const ADDER_OWNER_ADDRESS_EXPR: &str = "address:adder-owner"; - const ADDER_ADDRESS_EXPR: &str = "sc:adder"; - const ADDER_PATH_EXPR: &str = "mxsc:test-contracts/adder.mxsc.json"; + const ADDER_OWNER_ADDRESS: TestAddress = TestAddress::new("adder-owner"); + const ADDER_ADDRESS: TestSCAddress = TestSCAddress::new("adder"); + const ADDER_PATH_EXPR: MxscPath = MxscPath::new("mxsc:test-contracts/adder.mxsc.json"); world.register_contract(ADDER_PATH_EXPR, adder::ContractBuilder); - world.set_state_step( - SetStateStep::new() - .put_account(ADDER_OWNER_ADDRESS_EXPR, Account::new().nonce(1)) - .new_address(ADDER_OWNER_ADDRESS_EXPR, 1, ADDER_ADDRESS_EXPR), - ); + world.account(ADDER_OWNER_ADDRESS).nonce(1); - world.whitebox_deploy( - &adder_whitebox, - ScDeployStep::new() - .from(ADDER_OWNER_ADDRESS_EXPR) - .code(adder_code), - |sc| { - sc.init(managed_biguint!(5)); - }, - ); + world + .tx() + .raw_deploy() + .from(ADDER_OWNER_ADDRESS) + .code(ADDER_PATH_EXPR) + .new_address(ADDER_ADDRESS) + .whitebox(adder::contract_obj, |sc| { + sc.init(BigUint::from(5u64)); + }); let action_id = call_propose( &mut world, ActionRaw::SendAsyncCall(CallActionDataRaw { - to: address_expr_to_address(ADDER_ADDRESS_EXPR), + to: ADDER_ADDRESS.to_address(), egld_amount: 0u64.into(), endpoint_name: BoxedBytes::from(&b"add"[..]), arguments: vec![BoxedBytes::from(&[5u8][..])], @@ -665,93 +593,90 @@ fn test_async_call_to_sc() { None, ); - world.whitebox_call( - &multisig_whitebox, - ScCallStep::new().from(BOARD_MEMBER_ADDRESS_EXPR), - |sc| sc.sign(action_id), - ); + world + .tx() + .from(BOARD_MEMBER_ADDRESS) + .to(MULTISIG_ADDRESS) + .whitebox(multisig::contract_obj, |sc| sc.sign(action_id)); - world.whitebox_call( - &multisig_whitebox, - ScCallStep::new().from(BOARD_MEMBER_ADDRESS_EXPR), - |sc| { + world + .tx() + .from(BOARD_MEMBER_ADDRESS) + .to(MULTISIG_ADDRESS) + .whitebox(multisig::contract_obj, |sc| { let _ = sc.perform_action_endpoint(action_id); - }, - ); + }); - world.whitebox_query(&adder_whitebox, |sc| { - let actual_sum = sc.sum().get(); - let expected_sum = managed_biguint!(10); - assert_eq!(actual_sum, expected_sum); - }); + world + .query() + .to(ADDER_ADDRESS) + .whitebox(adder::contract_obj, |sc| { + let actual_sum = sc.sum().get(); + let expected_sum = managed_biguint!(10); + assert_eq!(actual_sum, expected_sum); + }); } #[test] fn test_deploy_and_upgrade_from_source() { let mut world = setup(); - let multisig_whitebox = WhiteboxContract::new(MULTISIG_ADDRESS_EXPR, multisig::contract_obj); + const NEW_ADDER_ADDRESS: TestSCAddress = TestSCAddress::new("new-adder"); - let adder_whitebox = WhiteboxContract::new(ADDER_ADDRESS_EXPR, adder::contract_obj); - let adder_code = world.code_expression(ADDER_PATH_EXPR); - - let new_adder_whitebox = WhiteboxContract::new(NEW_ADDER_ADDRESS_EXPR, adder::contract_obj); - - const ADDER_OWNER_ADDRESS_EXPR: &str = "address:adder-owner"; - const ADDER_ADDRESS_EXPR: &str = "sc:adder"; - const NEW_ADDER_ADDRESS_EXPR: &str = "sc:new-adder"; - const ADDER_PATH_EXPR: &str = "mxsc:test-contracts/adder.mxsc.json"; + const ADDER_OWNER_ADDRESS: TestAddress = TestAddress::new("adder-owner"); + const ADDER_ADDRESS: TestSCAddress = TestSCAddress::new("adder"); + const ADDER_PATH_EXPR: MxscPath = MxscPath::new("mxsc:test-contracts/adder.mxsc.json"); world.register_contract(ADDER_PATH_EXPR, adder::ContractBuilder); - world.set_state_step( - SetStateStep::new() - .put_account(ADDER_OWNER_ADDRESS_EXPR, Account::new().nonce(1)) - .new_address(ADDER_OWNER_ADDRESS_EXPR, 1, ADDER_ADDRESS_EXPR) - .new_address(MULTISIG_ADDRESS_EXPR, 0, NEW_ADDER_ADDRESS_EXPR), - ); + world.set_state_step(SetStateStep::new().new_address( + MULTISIG_ADDRESS.eval_to_expr().as_str(), + 0, + NEW_ADDER_ADDRESS.eval_to_expr().as_str(), + )); - world.whitebox_deploy( - &adder_whitebox, - ScDeployStep::new() - .from(ADDER_OWNER_ADDRESS_EXPR) - .code(adder_code), - |sc| { - sc.init(managed_biguint!(5)); - }, - ); + world.account(ADDER_OWNER_ADDRESS).nonce(1); + + world + .tx() + .raw_deploy() + .from(ADDER_OWNER_ADDRESS) + .code(ADDER_PATH_EXPR) + .new_address(ADDER_ADDRESS) + .whitebox(adder::contract_obj, |sc| { + sc.init(BigUint::from(5u64)); + }); let action_id = call_propose( &mut world, ActionRaw::SCDeployFromSource { amount: 0u64.into(), - source: address_expr_to_address(ADDER_ADDRESS_EXPR), + source: ADDER_ADDRESS.to_address(), code_metadata: CodeMetadata::all(), arguments: vec![BoxedBytes::from(&[5u8][..])], }, None, ); - world.whitebox_call( - &multisig_whitebox, - ScCallStep::new().from(BOARD_MEMBER_ADDRESS_EXPR), - |sc| sc.sign(action_id), - ); + world + .tx() + .from(BOARD_MEMBER_ADDRESS) + .to(MULTISIG_ADDRESS) + .whitebox(multisig::contract_obj, |sc| sc.sign(action_id)); - let mut addr = Address::zero(); - world.whitebox_call( - &multisig_whitebox, - ScCallStep::new().from(BOARD_MEMBER_ADDRESS_EXPR), - |sc| { + world + .tx() + .from(BOARD_MEMBER_ADDRESS) + .to(MULTISIG_ADDRESS) + .whitebox(multisig::contract_obj, |sc| { let opt_address = sc.perform_action_endpoint(action_id); - addr = opt_address.into_option().unwrap().to_address(); - }, - ); + let addr = opt_address.into_option().unwrap().to_address(); - assert_eq!(address_expr_to_address(NEW_ADDER_ADDRESS_EXPR), addr); + assert_eq!(NEW_ADDER_ADDRESS.to_address(), addr); + }); let action_id = call_propose( &mut world, ActionRaw::SendTransferExecute(CallActionDataRaw { - to: address_expr_to_address(NEW_ADDER_ADDRESS_EXPR), + to: NEW_ADDER_ADDRESS.to_address(), egld_amount: 0u64.into(), endpoint_name: BoxedBytes::from(&b"add"[..]), arguments: vec![BoxedBytes::from(&[5u8][..])], @@ -759,71 +684,70 @@ fn test_deploy_and_upgrade_from_source() { None, ); - world.whitebox_call( - &multisig_whitebox, - ScCallStep::new().from(BOARD_MEMBER_ADDRESS_EXPR), - |sc| sc.sign(action_id), - ); + world + .tx() + .from(BOARD_MEMBER_ADDRESS) + .to(MULTISIG_ADDRESS) + .whitebox(multisig::contract_obj, |sc| sc.sign(action_id)); - world.whitebox_call( - &multisig_whitebox, - ScCallStep::new().from(BOARD_MEMBER_ADDRESS_EXPR), - |sc| { + world + .tx() + .from(BOARD_MEMBER_ADDRESS) + .to(MULTISIG_ADDRESS) + .whitebox(multisig::contract_obj, |sc| { let _ = sc.perform_action_endpoint(action_id); - }, - ); + }); - world.whitebox_query(&new_adder_whitebox, |sc| { - let actual_sum = sc.sum().get(); - let expected_sum = managed_biguint!(10); - assert_eq!(actual_sum, expected_sum); - }); - - let factorial_code = world.code_expression(FACTORIAL_PATH_EXPR); + world + .query() + .to(NEW_ADDER_ADDRESS) + .whitebox(adder::contract_obj, |sc| { + let actual_sum = sc.sum().get(); + let expected_sum = managed_biguint!(10); + assert_eq!(actual_sum, expected_sum); + }); - const FACTORIAL_ADDRESS_EXPR: &str = "sc:factorial"; - const FACTORIAL_PATH_EXPR: &str = "mxsc:test-contracts/factorial.mxsc.json"; + const FACTORIAL_ADDRESS: TestSCAddress = TestSCAddress::new("factorial"); + const FACTORIAL_PATH_EXPR: MxscPath = MxscPath::new("mxsc:test-contracts/factorial.mxsc.json"); world.register_contract(FACTORIAL_PATH_EXPR, factorial::ContractBuilder); - world.set_state_step(SetStateStep::new().put_account( - FACTORIAL_ADDRESS_EXPR, - Account::new().nonce(1).code(factorial_code.clone()), - )); + world + .tx() + .raw_deploy() + .from(OWNER_ADDRESS) + .code(FACTORIAL_PATH_EXPR) + .new_address(FACTORIAL_ADDRESS) + .whitebox(factorial::contract_obj, |sc| { + sc.init(); + }); let action_id = call_propose( &mut world, ActionRaw::SCUpgradeFromSource { - source: address_expr_to_address(FACTORIAL_ADDRESS_EXPR), + source: FACTORIAL_ADDRESS.to_address(), amount: 0u64.into(), code_metadata: CodeMetadata::all(), arguments: Vec::new(), - sc_address: address_expr_to_address(ADDER_ADDRESS_EXPR), + sc_address: ADDER_ADDRESS.to_address(), }, None, ); - world.whitebox_call( - &multisig_whitebox, - ScCallStep::new().from(BOARD_MEMBER_ADDRESS_EXPR), - |sc| sc.sign(action_id), - ); + world + .tx() + .from(BOARD_MEMBER_ADDRESS) + .to(MULTISIG_ADDRESS) + .whitebox(multisig::contract_obj, |sc| sc.sign(action_id)); - world.whitebox_call( - &multisig_whitebox, - ScCallStep::new().from(BOARD_MEMBER_ADDRESS_EXPR), - |sc| { + world + .tx() + .from(BOARD_MEMBER_ADDRESS) + .to(MULTISIG_ADDRESS) + .whitebox(multisig::contract_obj, |sc| { let _ = sc.perform_action_endpoint(action_id); - }, - ); - - world.check_state_step( - CheckStateStep::new() - .put_account(ADDER_ADDRESS_EXPR, CheckAccount::new().code(factorial_code)), - ); -} + }); -fn address_expr_to_address(address_expr: &str) -> Address { - AddressValue::from(address_expr).to_address() + world.check_account(ADDER_ADDRESS).code(FACTORIAL_PATH_EXPR); } fn boxed_bytes_vec_to_managed( diff --git a/contracts/examples/multisig/wasm-multisig-full/Cargo.lock b/contracts/examples/multisig/wasm-multisig-full/Cargo.lock index fe4cb87bcd..92186b0bf0 100644 --- a/contracts/examples/multisig/wasm-multisig-full/Cargo.lock +++ b/contracts/examples/multisig/wasm-multisig-full/Cargo.lock @@ -4,15 +4,15 @@ version = 3 [[package]] name = "arrayvec" -version = "0.7.4" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" +checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" [[package]] name = "autocfg" -version = "1.3.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" +checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" [[package]] name = "bitflags" @@ -54,12 +54,21 @@ dependencies = [ "multiversx-sc-wasm-adapter", ] +[[package]] +name = "multiversx-chain-core" +version = "0.11.0" +dependencies = [ + "bitflags", + "multiversx-sc-codec", +] + [[package]] name = "multiversx-sc" -version = "0.51.1" +version = "0.54.1" dependencies = [ "bitflags", "hex-literal", + "multiversx-chain-core", "multiversx-sc-codec", "multiversx-sc-derive", "num-traits", @@ -68,7 +77,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.20.0" +version = "0.21.0" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -77,7 +86,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.20.0" +version = "0.21.0" dependencies = [ "hex", "proc-macro2", @@ -87,7 +96,7 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.51.1" +version = "0.54.1" dependencies = [ "hex", "proc-macro2", @@ -98,14 +107,14 @@ dependencies = [ [[package]] name = "multiversx-sc-modules" -version = "0.51.1" +version = "0.54.1" dependencies = [ "multiversx-sc", ] [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.51.1" +version = "0.54.1" dependencies = [ "multiversx-sc", ] @@ -139,9 +148,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.36" +version = "1.0.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" +checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" dependencies = [ "proc-macro2", ] @@ -164,9 +173,9 @@ checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "syn" -version = "2.0.68" +version = "2.0.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "901fa70d88b9d6c98022e23b4136f9f3e54e4662c3bc1bd1d84a42a9a0f0c1e9" +checksum = "9f35bcdf61fd8e7be6caf75f429fdca8beb3ed76584befb503b1569faee373ed" dependencies = [ "proc-macro2", "quote", @@ -175,9 +184,9 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.12" +version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" +checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" [[package]] name = "unwrap-infallible" diff --git a/contracts/examples/multisig/wasm-multisig-full/Cargo.toml b/contracts/examples/multisig/wasm-multisig-full/Cargo.toml index c6edfe4418..3893f09bc6 100644 --- a/contracts/examples/multisig/wasm-multisig-full/Cargo.toml +++ b/contracts/examples/multisig/wasm-multisig-full/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.51.1" +version = "0.54.1" path = "../../../../framework/wasm-adapter" [workspace] diff --git a/contracts/examples/multisig/wasm-multisig-view/Cargo.lock b/contracts/examples/multisig/wasm-multisig-view/Cargo.lock index 509b478684..f704df39cb 100644 --- a/contracts/examples/multisig/wasm-multisig-view/Cargo.lock +++ b/contracts/examples/multisig/wasm-multisig-view/Cargo.lock @@ -4,15 +4,15 @@ version = 3 [[package]] name = "arrayvec" -version = "0.7.4" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" +checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" [[package]] name = "autocfg" -version = "1.3.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" +checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" [[package]] name = "bitflags" @@ -54,12 +54,21 @@ dependencies = [ "multiversx-sc-wasm-adapter", ] +[[package]] +name = "multiversx-chain-core" +version = "0.11.0" +dependencies = [ + "bitflags", + "multiversx-sc-codec", +] + [[package]] name = "multiversx-sc" -version = "0.51.1" +version = "0.54.1" dependencies = [ "bitflags", "hex-literal", + "multiversx-chain-core", "multiversx-sc-codec", "multiversx-sc-derive", "num-traits", @@ -68,7 +77,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.20.0" +version = "0.21.0" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -77,7 +86,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.20.0" +version = "0.21.0" dependencies = [ "hex", "proc-macro2", @@ -87,7 +96,7 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.51.1" +version = "0.54.1" dependencies = [ "hex", "proc-macro2", @@ -98,14 +107,14 @@ dependencies = [ [[package]] name = "multiversx-sc-modules" -version = "0.51.1" +version = "0.54.1" dependencies = [ "multiversx-sc", ] [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.51.1" +version = "0.54.1" dependencies = [ "multiversx-sc", ] @@ -139,9 +148,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.36" +version = "1.0.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" +checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" dependencies = [ "proc-macro2", ] @@ -164,9 +173,9 @@ checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "syn" -version = "2.0.68" +version = "2.0.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "901fa70d88b9d6c98022e23b4136f9f3e54e4662c3bc1bd1d84a42a9a0f0c1e9" +checksum = "9f35bcdf61fd8e7be6caf75f429fdca8beb3ed76584befb503b1569faee373ed" dependencies = [ "proc-macro2", "quote", @@ -175,9 +184,9 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.12" +version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" +checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" [[package]] name = "unwrap-infallible" diff --git a/contracts/examples/multisig/wasm-multisig-view/Cargo.toml b/contracts/examples/multisig/wasm-multisig-view/Cargo.toml index a62263192b..77851b8d34 100644 --- a/contracts/examples/multisig/wasm-multisig-view/Cargo.toml +++ b/contracts/examples/multisig/wasm-multisig-view/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.51.1" +version = "0.54.1" path = "../../../../framework/wasm-adapter" [workspace] diff --git a/contracts/examples/multisig/wasm/Cargo.lock b/contracts/examples/multisig/wasm/Cargo.lock index ea949b64f6..0204985170 100755 --- a/contracts/examples/multisig/wasm/Cargo.lock +++ b/contracts/examples/multisig/wasm/Cargo.lock @@ -4,15 +4,15 @@ version = 3 [[package]] name = "arrayvec" -version = "0.7.4" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" +checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" [[package]] name = "autocfg" -version = "1.3.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" +checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" [[package]] name = "bitflags" @@ -54,12 +54,21 @@ dependencies = [ "multiversx-sc-wasm-adapter", ] +[[package]] +name = "multiversx-chain-core" +version = "0.11.0" +dependencies = [ + "bitflags", + "multiversx-sc-codec", +] + [[package]] name = "multiversx-sc" -version = "0.51.1" +version = "0.54.1" dependencies = [ "bitflags", "hex-literal", + "multiversx-chain-core", "multiversx-sc-codec", "multiversx-sc-derive", "num-traits", @@ -68,7 +77,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.20.0" +version = "0.21.0" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -77,7 +86,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.20.0" +version = "0.21.0" dependencies = [ "hex", "proc-macro2", @@ -87,7 +96,7 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.51.1" +version = "0.54.1" dependencies = [ "hex", "proc-macro2", @@ -98,14 +107,14 @@ dependencies = [ [[package]] name = "multiversx-sc-modules" -version = "0.51.1" +version = "0.54.1" dependencies = [ "multiversx-sc", ] [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.51.1" +version = "0.54.1" dependencies = [ "multiversx-sc", ] @@ -139,9 +148,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.36" +version = "1.0.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" +checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" dependencies = [ "proc-macro2", ] @@ -164,9 +173,9 @@ checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "syn" -version = "2.0.68" +version = "2.0.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "901fa70d88b9d6c98022e23b4136f9f3e54e4662c3bc1bd1d84a42a9a0f0c1e9" +checksum = "9f35bcdf61fd8e7be6caf75f429fdca8beb3ed76584befb503b1569faee373ed" dependencies = [ "proc-macro2", "quote", @@ -175,9 +184,9 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.12" +version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" +checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" [[package]] name = "unwrap-infallible" diff --git a/contracts/examples/multisig/wasm/Cargo.toml b/contracts/examples/multisig/wasm/Cargo.toml index ecaaf8c44f..f721dc0b61 100644 --- a/contracts/examples/multisig/wasm/Cargo.toml +++ b/contracts/examples/multisig/wasm/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.51.1" +version = "0.54.1" path = "../../../../framework/wasm-adapter" [workspace] diff --git a/contracts/examples/nft-minter/Cargo.toml b/contracts/examples/nft-minter/Cargo.toml index 5eec7fa050..ef76ee1515 100644 --- a/contracts/examples/nft-minter/Cargo.toml +++ b/contracts/examples/nft-minter/Cargo.toml @@ -9,9 +9,9 @@ publish = false path = "src/lib.rs" [dependencies.multiversx-sc] -version = "0.51.1" +version = "0.54.1" path = "../../../framework/base" [dev-dependencies.multiversx-sc-scenario] -version = "0.51.1" +version = "0.54.1" path = "../../../framework/scenario" diff --git a/contracts/examples/nft-minter/meta/Cargo.toml b/contracts/examples/nft-minter/meta/Cargo.toml index 9afe18081b..b332cf73b4 100644 --- a/contracts/examples/nft-minter/meta/Cargo.toml +++ b/contracts/examples/nft-minter/meta/Cargo.toml @@ -9,6 +9,6 @@ publish = false path = ".." [dependencies.multiversx-sc-meta-lib] -version = "0.51.1" +version = "0.54.1" path = "../../../../framework/meta-lib" default-features = false diff --git a/contracts/examples/nft-minter/src/nft_module.rs b/contracts/examples/nft-minter/src/nft_module.rs index da97c0d171..12f2c3b868 100644 --- a/contracts/examples/nft-minter/src/nft_module.rs +++ b/contracts/examples/nft-minter/src/nft_module.rs @@ -49,8 +49,8 @@ pub trait NftModule { self.send() .esdt_system_sc_proxy() .set_special_roles( - &self.blockchain().get_sc_address(), - &self.nft_token_id().get(), + self.blockchain().get_sc_address(), + self.nft_token_id().get(), [EsdtLocalRole::NftCreate][..].iter().cloned(), ) .async_call_and_exit() @@ -123,7 +123,7 @@ pub trait NftModule { ) { match result { ManagedAsyncCallResult::Ok(token_id) => { - self.nft_token_id().set(&token_id.unwrap_esdt()); + self.nft_token_id().set(token_id.unwrap_esdt()); }, ManagedAsyncCallResult::Err(_) => { let returned = self.call_value().egld_or_single_esdt(); diff --git a/contracts/examples/nft-minter/tests/nft_minter_scenario_rs_test.rs b/contracts/examples/nft-minter/tests/nft_minter_scenario_rs_test.rs index 1e8c9a3f43..65b2f6f28f 100644 --- a/contracts/examples/nft-minter/tests/nft_minter_scenario_rs_test.rs +++ b/contracts/examples/nft-minter/tests/nft_minter_scenario_rs_test.rs @@ -3,6 +3,7 @@ use multiversx_sc_scenario::*; fn world() -> ScenarioWorld { let mut blockchain = ScenarioWorld::new(); + blockchain.set_current_dir_from_workspace("contracts/examples/nft-minter"); blockchain.register_contract( "mxsc:output/nft-minter.mxsc.json", nft_minter::ContractBuilder, diff --git a/contracts/examples/nft-minter/wasm/Cargo.lock b/contracts/examples/nft-minter/wasm/Cargo.lock index 616b5aed2e..b46be44a8c 100644 --- a/contracts/examples/nft-minter/wasm/Cargo.lock +++ b/contracts/examples/nft-minter/wasm/Cargo.lock @@ -4,15 +4,15 @@ version = 3 [[package]] name = "arrayvec" -version = "0.7.4" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" +checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" [[package]] name = "autocfg" -version = "1.3.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" +checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" [[package]] name = "bitflags" @@ -38,12 +38,21 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" +[[package]] +name = "multiversx-chain-core" +version = "0.11.0" +dependencies = [ + "bitflags", + "multiversx-sc-codec", +] + [[package]] name = "multiversx-sc" -version = "0.51.1" +version = "0.54.1" dependencies = [ "bitflags", "hex-literal", + "multiversx-chain-core", "multiversx-sc-codec", "multiversx-sc-derive", "num-traits", @@ -52,7 +61,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.20.0" +version = "0.21.0" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -61,7 +70,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.20.0" +version = "0.21.0" dependencies = [ "hex", "proc-macro2", @@ -71,7 +80,7 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.51.1" +version = "0.54.1" dependencies = [ "hex", "proc-macro2", @@ -82,7 +91,7 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.51.1" +version = "0.54.1" dependencies = [ "multiversx-sc", ] @@ -131,9 +140,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.36" +version = "1.0.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" +checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" dependencies = [ "proc-macro2", ] @@ -156,9 +165,9 @@ checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "syn" -version = "2.0.68" +version = "2.0.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "901fa70d88b9d6c98022e23b4136f9f3e54e4662c3bc1bd1d84a42a9a0f0c1e9" +checksum = "9f35bcdf61fd8e7be6caf75f429fdca8beb3ed76584befb503b1569faee373ed" dependencies = [ "proc-macro2", "quote", @@ -167,9 +176,9 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.12" +version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" +checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" [[package]] name = "unwrap-infallible" diff --git a/contracts/examples/nft-minter/wasm/Cargo.toml b/contracts/examples/nft-minter/wasm/Cargo.toml index c32dac7eeb..97dae9ddc3 100644 --- a/contracts/examples/nft-minter/wasm/Cargo.toml +++ b/contracts/examples/nft-minter/wasm/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.51.1" +version = "0.54.1" path = "../../../../framework/wasm-adapter" [workspace] diff --git a/contracts/examples/nft-storage-prepay/Cargo.toml b/contracts/examples/nft-storage-prepay/Cargo.toml index 13ad075a6e..2d657d8236 100644 --- a/contracts/examples/nft-storage-prepay/Cargo.toml +++ b/contracts/examples/nft-storage-prepay/Cargo.toml @@ -10,9 +10,9 @@ path = "src/nft_storage_prepay.rs" [dependencies.multiversx-sc] -version = "0.51.1" +version = "0.54.1" path = "../../../framework/base" [dev-dependencies.multiversx-sc-scenario] -version = "0.51.1" +version = "0.54.1" path = "../../../framework/scenario" diff --git a/contracts/examples/nft-storage-prepay/meta/Cargo.toml b/contracts/examples/nft-storage-prepay/meta/Cargo.toml index fe604f7747..69405af90a 100644 --- a/contracts/examples/nft-storage-prepay/meta/Cargo.toml +++ b/contracts/examples/nft-storage-prepay/meta/Cargo.toml @@ -11,6 +11,6 @@ publish = false path = ".." [dependencies.multiversx-sc-meta-lib] -version = "0.51.1" +version = "0.54.1" path = "../../../../framework/meta-lib" default-features = false diff --git a/contracts/examples/nft-storage-prepay/wasm/Cargo.lock b/contracts/examples/nft-storage-prepay/wasm/Cargo.lock index e876048d71..1dea0f48ee 100755 --- a/contracts/examples/nft-storage-prepay/wasm/Cargo.lock +++ b/contracts/examples/nft-storage-prepay/wasm/Cargo.lock @@ -4,15 +4,15 @@ version = 3 [[package]] name = "arrayvec" -version = "0.7.4" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" +checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" [[package]] name = "autocfg" -version = "1.3.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" +checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" [[package]] name = "bitflags" @@ -38,12 +38,21 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" +[[package]] +name = "multiversx-chain-core" +version = "0.11.0" +dependencies = [ + "bitflags", + "multiversx-sc-codec", +] + [[package]] name = "multiversx-sc" -version = "0.51.1" +version = "0.54.1" dependencies = [ "bitflags", "hex-literal", + "multiversx-chain-core", "multiversx-sc-codec", "multiversx-sc-derive", "num-traits", @@ -52,7 +61,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.20.0" +version = "0.21.0" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -61,7 +70,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.20.0" +version = "0.21.0" dependencies = [ "hex", "proc-macro2", @@ -71,7 +80,7 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.51.1" +version = "0.54.1" dependencies = [ "hex", "proc-macro2", @@ -82,7 +91,7 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.51.1" +version = "0.54.1" dependencies = [ "multiversx-sc", ] @@ -131,9 +140,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.36" +version = "1.0.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" +checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" dependencies = [ "proc-macro2", ] @@ -156,9 +165,9 @@ checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "syn" -version = "2.0.68" +version = "2.0.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "901fa70d88b9d6c98022e23b4136f9f3e54e4662c3bc1bd1d84a42a9a0f0c1e9" +checksum = "9f35bcdf61fd8e7be6caf75f429fdca8beb3ed76584befb503b1569faee373ed" dependencies = [ "proc-macro2", "quote", @@ -167,9 +176,9 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.12" +version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" +checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" [[package]] name = "unwrap-infallible" diff --git a/contracts/examples/nft-storage-prepay/wasm/Cargo.toml b/contracts/examples/nft-storage-prepay/wasm/Cargo.toml index a220344bba..70ba8624f6 100644 --- a/contracts/examples/nft-storage-prepay/wasm/Cargo.toml +++ b/contracts/examples/nft-storage-prepay/wasm/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.51.1" +version = "0.54.1" path = "../../../../framework/wasm-adapter" [workspace] diff --git a/contracts/examples/nft-subscription/Cargo.toml b/contracts/examples/nft-subscription/Cargo.toml index 2b205ad97e..115f5e596f 100644 --- a/contracts/examples/nft-subscription/Cargo.toml +++ b/contracts/examples/nft-subscription/Cargo.toml @@ -9,13 +9,13 @@ publish = false path = "src/lib.rs" [dependencies.multiversx-sc] -version = "0.51.1" +version = "0.54.1" path = "../../../framework/base" [dependencies.multiversx-sc-modules] -version = "0.51.1" +version = "0.54.1" path = "../../../contracts/modules" [dev-dependencies.multiversx-sc-scenario] -version = "0.51.1" +version = "0.54.1" path = "../../../framework/scenario" diff --git a/contracts/examples/nft-subscription/meta/Cargo.toml b/contracts/examples/nft-subscription/meta/Cargo.toml index 592e8effc1..93d4cb9a0a 100644 --- a/contracts/examples/nft-subscription/meta/Cargo.toml +++ b/contracts/examples/nft-subscription/meta/Cargo.toml @@ -9,6 +9,6 @@ publish = false path = ".." [dependencies.multiversx-sc-meta-lib] -version = "0.51.1" +version = "0.54.1" path = "../../../../framework/meta-lib" default-features = false diff --git a/contracts/examples/nft-subscription/tests/nft_subscription_scenario_rs_test.rs b/contracts/examples/nft-subscription/tests/nft_subscription_scenario_rs_test.rs index c36191ef22..d83b734f13 100644 --- a/contracts/examples/nft-subscription/tests/nft_subscription_scenario_rs_test.rs +++ b/contracts/examples/nft-subscription/tests/nft_subscription_scenario_rs_test.rs @@ -3,6 +3,7 @@ use multiversx_sc_scenario::*; fn world() -> ScenarioWorld { let mut blockchain = ScenarioWorld::new(); + blockchain.set_current_dir_from_workspace("contracts/examples/nft-subscription"); blockchain.register_contract( "mxsc:output/nft-subscription.mxsc.json", nft_subscription::ContractBuilder, diff --git a/contracts/examples/nft-subscription/wasm/Cargo.lock b/contracts/examples/nft-subscription/wasm/Cargo.lock index e9f75e7859..a33d5ebbc8 100644 --- a/contracts/examples/nft-subscription/wasm/Cargo.lock +++ b/contracts/examples/nft-subscription/wasm/Cargo.lock @@ -4,15 +4,15 @@ version = 3 [[package]] name = "arrayvec" -version = "0.7.4" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" +checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" [[package]] name = "autocfg" -version = "1.3.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" +checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" [[package]] name = "bitflags" @@ -38,12 +38,21 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" +[[package]] +name = "multiversx-chain-core" +version = "0.11.0" +dependencies = [ + "bitflags", + "multiversx-sc-codec", +] + [[package]] name = "multiversx-sc" -version = "0.51.1" +version = "0.54.1" dependencies = [ "bitflags", "hex-literal", + "multiversx-chain-core", "multiversx-sc-codec", "multiversx-sc-derive", "num-traits", @@ -52,7 +61,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.20.0" +version = "0.21.0" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -61,7 +70,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.20.0" +version = "0.21.0" dependencies = [ "hex", "proc-macro2", @@ -71,7 +80,7 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.51.1" +version = "0.54.1" dependencies = [ "hex", "proc-macro2", @@ -82,14 +91,14 @@ dependencies = [ [[package]] name = "multiversx-sc-modules" -version = "0.51.1" +version = "0.54.1" dependencies = [ "multiversx-sc", ] [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.51.1" +version = "0.54.1" dependencies = [ "multiversx-sc", ] @@ -139,9 +148,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.36" +version = "1.0.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" +checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" dependencies = [ "proc-macro2", ] @@ -164,9 +173,9 @@ checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "syn" -version = "2.0.68" +version = "2.0.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "901fa70d88b9d6c98022e23b4136f9f3e54e4662c3bc1bd1d84a42a9a0f0c1e9" +checksum = "9f35bcdf61fd8e7be6caf75f429fdca8beb3ed76584befb503b1569faee373ed" dependencies = [ "proc-macro2", "quote", @@ -175,9 +184,9 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.12" +version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" +checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" [[package]] name = "unwrap-infallible" diff --git a/contracts/examples/nft-subscription/wasm/Cargo.toml b/contracts/examples/nft-subscription/wasm/Cargo.toml index 310c1bdaa0..edd2cf9736 100644 --- a/contracts/examples/nft-subscription/wasm/Cargo.toml +++ b/contracts/examples/nft-subscription/wasm/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.51.1" +version = "0.54.1" path = "../../../../framework/wasm-adapter" [workspace] diff --git a/contracts/examples/order-book/factory/Cargo.toml b/contracts/examples/order-book/factory/Cargo.toml index d6d16fbf04..a5a379282d 100644 --- a/contracts/examples/order-book/factory/Cargo.toml +++ b/contracts/examples/order-book/factory/Cargo.toml @@ -8,10 +8,10 @@ publish = false path = "src/lib.rs" [dependencies.multiversx-sc] -version = "0.51.1" +version = "0.54.1" path = "../../../../framework/base" [dev-dependencies.multiversx-sc-scenario] -version = "0.51.1" +version = "0.54.1" path = "../../../../framework/scenario" diff --git a/contracts/examples/order-book/factory/meta/Cargo.toml b/contracts/examples/order-book/factory/meta/Cargo.toml index 0b5af8112f..a5bc6e5536 100644 --- a/contracts/examples/order-book/factory/meta/Cargo.toml +++ b/contracts/examples/order-book/factory/meta/Cargo.toml @@ -9,6 +9,6 @@ publish = false path = ".." [dependencies.multiversx-sc-meta-lib] -version = "0.51.1" +version = "0.54.1" path = "../../../../../framework/meta-lib" default-features = false diff --git a/contracts/examples/order-book/factory/wasm/Cargo.lock b/contracts/examples/order-book/factory/wasm/Cargo.lock index b8dc4385d2..703c9ed8e4 100644 --- a/contracts/examples/order-book/factory/wasm/Cargo.lock +++ b/contracts/examples/order-book/factory/wasm/Cargo.lock @@ -4,15 +4,15 @@ version = 3 [[package]] name = "arrayvec" -version = "0.7.4" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" +checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" [[package]] name = "autocfg" -version = "1.3.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" +checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" [[package]] name = "bitflags" @@ -38,12 +38,21 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" +[[package]] +name = "multiversx-chain-core" +version = "0.11.0" +dependencies = [ + "bitflags", + "multiversx-sc-codec", +] + [[package]] name = "multiversx-sc" -version = "0.51.1" +version = "0.54.1" dependencies = [ "bitflags", "hex-literal", + "multiversx-chain-core", "multiversx-sc-codec", "multiversx-sc-derive", "num-traits", @@ -52,7 +61,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.20.0" +version = "0.21.0" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -61,7 +70,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.20.0" +version = "0.21.0" dependencies = [ "hex", "proc-macro2", @@ -71,7 +80,7 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.51.1" +version = "0.54.1" dependencies = [ "hex", "proc-macro2", @@ -82,7 +91,7 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.51.1" +version = "0.54.1" dependencies = [ "multiversx-sc", ] @@ -131,9 +140,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.36" +version = "1.0.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" +checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" dependencies = [ "proc-macro2", ] @@ -156,9 +165,9 @@ checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "syn" -version = "2.0.68" +version = "2.0.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "901fa70d88b9d6c98022e23b4136f9f3e54e4662c3bc1bd1d84a42a9a0f0c1e9" +checksum = "9f35bcdf61fd8e7be6caf75f429fdca8beb3ed76584befb503b1569faee373ed" dependencies = [ "proc-macro2", "quote", @@ -167,9 +176,9 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.12" +version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" +checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" [[package]] name = "unwrap-infallible" diff --git a/contracts/examples/order-book/factory/wasm/Cargo.toml b/contracts/examples/order-book/factory/wasm/Cargo.toml index bf4fd9c0d7..62e5c3f134 100644 --- a/contracts/examples/order-book/factory/wasm/Cargo.toml +++ b/contracts/examples/order-book/factory/wasm/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.51.1" +version = "0.54.1" path = "../../../../../framework/wasm-adapter" [workspace] diff --git a/contracts/examples/order-book/pair/Cargo.toml b/contracts/examples/order-book/pair/Cargo.toml index 9342a1c1dd..2ea1801667 100644 --- a/contracts/examples/order-book/pair/Cargo.toml +++ b/contracts/examples/order-book/pair/Cargo.toml @@ -8,9 +8,9 @@ publish = false path = "src/lib.rs" [dependencies.multiversx-sc] -version = "0.51.1" +version = "0.54.1" path = "../../../../framework/base" [dev-dependencies.multiversx-sc-scenario] -version = "0.51.1" +version = "0.54.1" path = "../../../../framework/scenario" diff --git a/contracts/examples/order-book/pair/meta/Cargo.toml b/contracts/examples/order-book/pair/meta/Cargo.toml index 85d9ddda80..70babcce04 100644 --- a/contracts/examples/order-book/pair/meta/Cargo.toml +++ b/contracts/examples/order-book/pair/meta/Cargo.toml @@ -9,6 +9,6 @@ publish = false path = ".." [dependencies.multiversx-sc-meta-lib] -version = "0.51.1" +version = "0.54.1" path = "../../../../../framework/meta-lib" default-features = false diff --git a/contracts/examples/order-book/pair/tests/pair_scenario_rs_test.rs b/contracts/examples/order-book/pair/tests/pair_scenario_rs_test.rs index cc5df5d805..4356a0e81b 100644 --- a/contracts/examples/order-book/pair/tests/pair_scenario_rs_test.rs +++ b/contracts/examples/order-book/pair/tests/pair_scenario_rs_test.rs @@ -3,6 +3,7 @@ use multiversx_sc_scenario::*; fn world() -> ScenarioWorld { let mut blockchain = ScenarioWorld::new(); + blockchain.set_current_dir_from_workspace("contracts/examples/order-book/pair"); blockchain.register_contract( "mxsc:output/order-book-pair.mxsc.json", order_book_pair::ContractBuilder, diff --git a/contracts/examples/order-book/pair/wasm/Cargo.lock b/contracts/examples/order-book/pair/wasm/Cargo.lock index c1a86a1be9..5a3a6d8a49 100644 --- a/contracts/examples/order-book/pair/wasm/Cargo.lock +++ b/contracts/examples/order-book/pair/wasm/Cargo.lock @@ -4,15 +4,15 @@ version = 3 [[package]] name = "arrayvec" -version = "0.7.4" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" +checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" [[package]] name = "autocfg" -version = "1.3.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" +checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" [[package]] name = "bitflags" @@ -38,12 +38,21 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" +[[package]] +name = "multiversx-chain-core" +version = "0.11.0" +dependencies = [ + "bitflags", + "multiversx-sc-codec", +] + [[package]] name = "multiversx-sc" -version = "0.51.1" +version = "0.54.1" dependencies = [ "bitflags", "hex-literal", + "multiversx-chain-core", "multiversx-sc-codec", "multiversx-sc-derive", "num-traits", @@ -52,7 +61,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec" -version = "0.20.0" +version = "0.21.0" dependencies = [ "arrayvec", "multiversx-sc-codec-derive", @@ -61,7 +70,7 @@ dependencies = [ [[package]] name = "multiversx-sc-codec-derive" -version = "0.20.0" +version = "0.21.0" dependencies = [ "hex", "proc-macro2", @@ -71,7 +80,7 @@ dependencies = [ [[package]] name = "multiversx-sc-derive" -version = "0.51.1" +version = "0.54.1" dependencies = [ "hex", "proc-macro2", @@ -82,7 +91,7 @@ dependencies = [ [[package]] name = "multiversx-sc-wasm-adapter" -version = "0.51.1" +version = "0.54.1" dependencies = [ "multiversx-sc", ] @@ -131,9 +140,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.36" +version = "1.0.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" +checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" dependencies = [ "proc-macro2", ] @@ -156,9 +165,9 @@ checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "syn" -version = "2.0.68" +version = "2.0.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "901fa70d88b9d6c98022e23b4136f9f3e54e4662c3bc1bd1d84a42a9a0f0c1e9" +checksum = "9f35bcdf61fd8e7be6caf75f429fdca8beb3ed76584befb503b1569faee373ed" dependencies = [ "proc-macro2", "quote", @@ -167,9 +176,9 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.12" +version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" +checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" [[package]] name = "unwrap-infallible" diff --git a/contracts/examples/order-book/pair/wasm/Cargo.toml b/contracts/examples/order-book/pair/wasm/Cargo.toml index d4bb4cf0bb..40121d1423 100644 --- a/contracts/examples/order-book/pair/wasm/Cargo.toml +++ b/contracts/examples/order-book/pair/wasm/Cargo.toml @@ -28,7 +28,7 @@ panic = "abort" path = ".." [dependencies.multiversx-sc-wasm-adapter] -version = "0.51.1" +version = "0.54.1" path = "../../../../../framework/wasm-adapter" [workspace] diff --git a/contracts/examples/ping-pong-egld/Cargo.toml b/contracts/examples/ping-pong-egld/Cargo.toml index 2e3375af52..d86137bb5e 100644 --- a/contracts/examples/ping-pong-egld/Cargo.toml +++ b/contracts/examples/ping-pong-egld/Cargo.toml @@ -9,10 +9,10 @@ publish = false path = "src/ping_pong.rs" [dependencies.multiversx-sc] -version = "0.51.1" +version = "0.54.1" path = "../../../framework/base" [dev-dependencies.multiversx-sc-scenario] -version = "0.51.1" +version = "0.54.1" path = "../../../framework/scenario" diff --git a/contracts/examples/ping-pong-egld/dapp/Cargo.toml b/contracts/examples/ping-pong-egld/dapp/Cargo.toml new file mode 100644 index 0000000000..08df48d231 --- /dev/null +++ b/contracts/examples/ping-pong-egld/dapp/Cargo.toml @@ -0,0 +1,19 @@ +[package] +name = "ping-pong-dapp" +version = "0.1.0" +edition = "2021" + +[dependencies] +console_log = "0.2" +log = "0.4" +serde = "1.0.210" +serde_json = "1.0" +wasm-bindgen-futures = "0.4" +yew = { version = "0.20.0", features = ["csr"] } +yew_icons = { version = "0.7.3", features = ["BootstrapHeartFill"] } +yew-router = { version = "0.17.0" } + +[dependencies.multiversx-sc-snippets] +path = "../../../../framework/snippets" +default-features = false +features = ["dapp"] diff --git a/contracts/examples/ping-pong-egld/dapp/index.html b/contracts/examples/ping-pong-egld/dapp/index.html new file mode 100644 index 0000000000..162a2a7a50 --- /dev/null +++ b/contracts/examples/ping-pong-egld/dapp/index.html @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/contracts/examples/ping-pong-egld/dapp/ping-pong-egld.wasm b/contracts/examples/ping-pong-egld/dapp/ping-pong-egld.wasm new file mode 100644 index 0000000000..7426d32c86 Binary files /dev/null and b/contracts/examples/ping-pong-egld/dapp/ping-pong-egld.wasm differ diff --git a/contracts/examples/ping-pong-egld/dapp/readme.md b/contracts/examples/ping-pong-egld/dapp/readme.md new file mode 100644 index 0000000000..032b2c3d29 --- /dev/null +++ b/contracts/examples/ping-pong-egld/dapp/readme.md @@ -0,0 +1,9 @@ +# Ping pong dapp example + +## Prerequisites +- trunk + +```bash +cargo install trunk +``` +Run this example locally with `trunk serve --open`. \ No newline at end of file diff --git a/contracts/examples/ping-pong-egld/dapp/src/components/button.rs b/contracts/examples/ping-pong-egld/dapp/src/components/button.rs new file mode 100644 index 0000000000..cdb898bd59 --- /dev/null +++ b/contracts/examples/ping-pong-egld/dapp/src/components/button.rs @@ -0,0 +1,18 @@ +use yew::prelude::*; + +#[derive(Properties, PartialEq)] +pub struct ButtonProps { + pub name: String, + pub class_name: String, + pub button_type: String, + pub on_click: Callback, +} + +#[function_component(Button)] +pub fn button(props: &ButtonProps) -> Html { + html! { + + } +} diff --git a/contracts/examples/ping-pong-egld/dapp/src/components/footer.rs b/contracts/examples/ping-pong-egld/dapp/src/components/footer.rs new file mode 100644 index 0000000000..e5d7066c55 --- /dev/null +++ b/contracts/examples/ping-pong-egld/dapp/src/components/footer.rs @@ -0,0 +1,15 @@ +use yew::prelude::*; +use yew_icons::{Icon, IconId}; + +#[function_component(Footer)] +pub fn footer() -> Html { + html! { +
+

+ { "Made with " } + + { " by the MultiversX team" } +

+
+ } +} diff --git a/contracts/examples/ping-pong-egld/dapp/src/components/mod.rs b/contracts/examples/ping-pong-egld/dapp/src/components/mod.rs new file mode 100644 index 0000000000..f55f57e4d0 --- /dev/null +++ b/contracts/examples/ping-pong-egld/dapp/src/components/mod.rs @@ -0,0 +1,7 @@ +pub mod button; +pub mod footer; +pub mod network_status; + +pub use button::Button; +pub use footer::Footer; +pub use network_status::NetworkStatusComponent; diff --git a/contracts/examples/ping-pong-egld/dapp/src/components/network_status.rs b/contracts/examples/ping-pong-egld/dapp/src/components/network_status.rs new file mode 100644 index 0000000000..74f085f23c --- /dev/null +++ b/contracts/examples/ping-pong-egld/dapp/src/components/network_status.rs @@ -0,0 +1,17 @@ +use yew::prelude::*; + +use crate::context::ConfigContext; + +#[function_component(NetworkStatusComponent)] +pub fn network_status() -> Html { + let context = use_context::().unwrap(); + let response = format!("{:?}", &context.network_status); + + html! { +
+

+ {&response} +

+
+ } +} diff --git a/contracts/examples/ping-pong-egld/dapp/src/context.rs b/contracts/examples/ping-pong-egld/dapp/src/context.rs new file mode 100644 index 0000000000..78f71590d8 --- /dev/null +++ b/contracts/examples/ping-pong-egld/dapp/src/context.rs @@ -0,0 +1,66 @@ +use crate::requests::query; + +use html::ChildrenProps; +use multiversx_sc_snippets::sdk::data::network_status::NetworkStatus; +use yew::prelude::*; + +#[derive(Clone, Debug, PartialEq)] +pub struct ConfigContext { + pub network_status: NetworkStatus, + pub set_network_status: Callback, +} + +pub async fn refresh_context() -> NetworkStatus { + log::info!("refreshing context"); + query::get_network_status().await.unwrap_or_default() +} + +impl Default for ConfigContext { + fn default() -> Self { + ConfigContext { + network_status: NetworkStatus::default(), + set_network_status: Callback::noop(), + } + } +} + +#[function_component(ConfigProvider)] +pub fn config_provider(props: &ChildrenProps) -> Html { + let network_status = use_state(NetworkStatus::default); + + // Clone the state here for use in the callback + let set_network_status = { + let network_status = network_status.clone(); + Callback::from(move |new_status: NetworkStatus| { + network_status.set(new_status); + }) + }; + + // Clone the callback for async usage in the effect + let set_network_status_async = set_network_status.clone(); + + // refresh context on component mount + use_effect_with_deps( + move |_| { + wasm_bindgen_futures::spawn_local(async move { + let new_status = refresh_context().await; + + // Emit the new status inside the async block + set_network_status_async.emit(new_status); + }); + || () // no cleanup fn + }, + (), // empty dependency array, run once on mount + ); + + let context = ConfigContext { + network_status: (*network_status).clone(), + set_network_status, + }; + + html! { + context={context}> + { for props.children.iter() } + > + } +} diff --git a/contracts/examples/ping-pong-egld/dapp/src/interactor.rs b/contracts/examples/ping-pong-egld/dapp/src/interactor.rs new file mode 100644 index 0000000000..843540649e --- /dev/null +++ b/contracts/examples/ping-pong-egld/dapp/src/interactor.rs @@ -0,0 +1,58 @@ +use multiversx_sc_snippets::imports::*; +use serde::{Deserialize, Serialize}; + +const GATEWAY: &str = multiversx_sc_snippets::sdk::gateway::DEVNET_GATEWAY; +const CONTRACT_ADDRESS: &str = "erd1qqqqqqqqqqqqqpgq6tqvj5f59xrgxwrtwy30elgpu7l4zrv6d8ssnjdwxq"; +const PING_PONG_CODE: &[u8] = include_bytes!("../ping-pong-egld.wasm"); + +#[derive(Debug, Default, Serialize, Deserialize)] +pub struct Config { + gateway: String, + contract_address: String, +} + +impl Config { + // Deserializes state from file + pub fn new() -> Self { + Config { + gateway: GATEWAY.to_string(), + contract_address: CONTRACT_ADDRESS.to_string(), + } + } + + /// Sets the contract address + #[allow(unused)] + pub fn set_address(&mut self, address: Bech32Address) { + self.contract_address = address.to_string() + } + + /// Returns the contract address + pub fn current_address(&self) -> &String { + &self.contract_address + } +} + +pub struct ContractInteract { + pub interactor: DappInteractor, + pub wallet_address: Address, + pub contract_code: BytesValue, + pub config: Config, +} + +impl ContractInteract { + pub async fn new() -> Self { + let config = Config::new(); + let mut interactor = DappInteractor::new(&config.gateway).await; + interactor.set_current_dir_from_workspace("contracts/examples/ping-pong-egld/dapp"); + let wallet_address = interactor.register_wallet(test_wallets::mike()).await; + + let contract_code = BytesValue::from(PING_PONG_CODE); + + ContractInteract { + interactor, + wallet_address, + contract_code, + config, + } + } +} diff --git a/contracts/examples/ping-pong-egld/dapp/src/main.rs b/contracts/examples/ping-pong-egld/dapp/src/main.rs new file mode 100644 index 0000000000..bb2b4170dc --- /dev/null +++ b/contracts/examples/ping-pong-egld/dapp/src/main.rs @@ -0,0 +1,33 @@ +mod components; +mod context; +mod interactor; +mod pages; +mod requests; +mod routes; + +use components::Footer; +use context::ConfigProvider; +use log::Level; +use routes::{switch, Route}; +use yew::prelude::*; +use yew_router::{BrowserRouter, Switch}; + +#[function_component(App)] +fn app() -> Html { + html! { + + + render={switch} /> +