From ec3d2c8adc836466c7b33c2704ba94e37b0ef14c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrei=20B=C4=83ncioiu?= Date: Tue, 28 May 2024 14:50:02 +0300 Subject: [PATCH 1/4] Update Rust (stable). --- Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index bb3fd1b..4509f8f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,8 @@ FROM ubuntu:22.04 # Constants -ARG BUILDER_NAME="multiversx/sdk-rust-contract-builder:v7.0.0" -ARG VERSION_RUST="nightly-2024-05-22" +ARG BUILDER_NAME="multiversx/sdk-rust-contract-builder:v8.0.0" +ARG VERSION_RUST="1.78.0" ARG VERSION_BINARYEN="version_112" ARG DOWNLOAD_URL_BINARYEN="https://github.com/WebAssembly/binaryen/releases/download/${VERSION_BINARYEN}/binaryen-${VERSION_BINARYEN}-x86_64-linux.tar.gz" ARG VERSION_SC_META="0.50.3" From 6ade39ada792739470d959639ff519b44dcbd884 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrei=20B=C4=83ncioiu?= Date: Tue, 28 May 2024 14:58:05 +0300 Subject: [PATCH 2/4] Adjust tests. --- integration_tests/previous_builds.py | 12 ++++-------- ...project_folder_and_packaged_src_are_equivalent.py | 6 +++--- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/integration_tests/previous_builds.py b/integration_tests/previous_builds.py index e320629..1380712 100644 --- a/integration_tests/previous_builds.py +++ b/integration_tests/previous_builds.py @@ -54,17 +54,13 @@ def __init__(self, name: str, ), PreviousBuild( name="a.3", - project_archive_url="https://github.com/multiversx/mx-contracts-rs/archive/9da0c4abe7aba6ae109c167be655b2ce80ca4b08.zip", - project_relative_path_in_archive="mx-contracts-rs-9da0c4abe7aba6ae109c167be655b2ce80ca4b08", + project_archive_url="https://github.com/multiversx/mx-sovereign-sc/archive/80599388b9358842b50ea216a622d514e15df374.zip", + project_relative_path_in_archive="mx-sovereign-sc-80599388b9358842b50ea216a622d514e15df374", packaged_src_url=None, contract_name=None, expected_code_hashes={ - "adder": "384b680df7a95ebceca02ffb3e760a2fc288dea1b802685ef15df22ae88ba15b", - "multisig": "30cc24a9a8f271f27db44952a54c311ca54487f5a19533806ad213312a055ff8", - "multisig-full": "b4b9e11213e616564b2b4bd60eeee1bae295f51b14736f24fce64759e7d82295", - "multisig-view": "429a43e843a098dd3d8e5e882e0b0708a91e53ed41949017f4b732020fcb033d", - "lottery-esdt": "f53b8d157010a35e344d3c2b82606d3c38ad183faeac37e126c32d89349d3e8d", - "ping-pong-egld": "a3b146ec3d7d23101f3ab35e9a5e3d967e71709f20263d018a6af3b117cf28bf" + "esdt-safe": "08d0ba0f0931b9aa71946a543efc29da6e66d5247e911ce6595bea6a13a62cb4", + "fee-market": "e6efffc7723e1b38c9cdc41f3c2827acbcaed86c73795d09635d78b685c45576" }, docker_image="sdk-rust-contract-builder:next" ), diff --git a/integration_tests/test_project_folder_and_packaged_src_are_equivalent.py b/integration_tests/test_project_folder_and_packaged_src_are_equivalent.py index 9abdbbc..d308d2a 100644 --- a/integration_tests/test_project_folder_and_packaged_src_are_equivalent.py +++ b/integration_tests/test_project_folder_and_packaged_src_are_equivalent.py @@ -8,8 +8,8 @@ def main(cli_args: List[str]): - repository_url = "https://github.com/multiversx/mx-contracts-rs" - commit = "9da0c4abe7aba6ae109c167be655b2ce80ca4b08" + repository_url = "https://github.com/multiversx/mx-sovereign-sc" + commit = "80599388b9358842b50ea216a622d514e15df374" archve_subfolder = f"mx-contracts-rs-{commit}" project_path = download_project_repository(f"{repository_url}/archive/{commit}.zip", archve_subfolder) project_path = project_path / archve_subfolder @@ -17,7 +17,7 @@ def main(cli_args: List[str]): check_project_folder_and_packaged_src_are_equivalent( project_path=project_path, parent_output_folder=PARENT_OUTPUT_FOLDER, - contracts=["adder", "multisig", "lottery-esdt"], + contracts=["esdt-safe", "fee-market"], ) From 7f608ea44b498b61e1444fb97334821a6ff62dae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrei=20B=C4=83ncioiu?= Date: Tue, 28 May 2024 15:08:18 +0300 Subject: [PATCH 3/4] Fix tests. --- .../test_project_folder_and_packaged_src_are_equivalent.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/integration_tests/test_project_folder_and_packaged_src_are_equivalent.py b/integration_tests/test_project_folder_and_packaged_src_are_equivalent.py index d308d2a..6e1a73b 100644 --- a/integration_tests/test_project_folder_and_packaged_src_are_equivalent.py +++ b/integration_tests/test_project_folder_and_packaged_src_are_equivalent.py @@ -10,7 +10,7 @@ def main(cli_args: List[str]): repository_url = "https://github.com/multiversx/mx-sovereign-sc" commit = "80599388b9358842b50ea216a622d514e15df374" - archve_subfolder = f"mx-contracts-rs-{commit}" + archve_subfolder = f"mx-sovereign-sc-{commit}" project_path = download_project_repository(f"{repository_url}/archive/{commit}.zip", archve_subfolder) project_path = project_path / archve_subfolder From 3571372e7360c781909ef07671aface79aaa5349 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrei=20B=C4=83ncioiu?= Date: Tue, 28 May 2024 16:17:46 +0300 Subject: [PATCH 4/4] Fix tests. --- integration_tests/test_basic.py | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/integration_tests/test_basic.py b/integration_tests/test_basic.py index 7b860f9..d2e3c67 100644 --- a/integration_tests/test_basic.py +++ b/integration_tests/test_basic.py @@ -6,10 +6,14 @@ from multiversx_sdk_rust_contract_builder.packaged_source_code import \ PackagedSourceCode +DEFAULT_PROJECT_ARCHIVE_URL = "https://github.com/multiversx/mx-sovereign-sc/archive/80599388b9358842b50ea216a622d514e15df374.zip" +DEFAULT_PROJECT_ARCHIVE_PAYLOAD = "mx-sovereign-sc-80599388b9358842b50ea216a622d514e15df374" +DEFAULT_CONTRACT_NAME = "esdt-safe" + def test_with_symlinks(): - workspace_parent = download_project_repository("https://github.com/multiversx/mx-contracts-rs/archive/refs/tags/v0.45.4.zip", "test_with_symlinks") - workspace = workspace_parent / "mx-contracts-rs-0.45.4" + workspace_parent = download_project_repository(DEFAULT_PROJECT_ARCHIVE_URL, "test_with_symlinks") + workspace = workspace_parent / DEFAULT_PROJECT_ARCHIVE_PAYLOAD output_folder = PARENT_OUTPUT_FOLDER / "test_with_symlinks" shutil.rmtree(output_folder, ignore_errors=True) @@ -27,7 +31,7 @@ def test_with_symlinks(): (code, _, _) = run_docker( project_path=workspace, packaged_src_path=None, - contract_name="adder", + contract_name=DEFAULT_CONTRACT_NAME, image="sdk-rust-contract-builder:next", output_folder=output_folder ) @@ -37,8 +41,8 @@ def test_with_symlinks(): def test_has_correct_packaged_source(): - workspace_parent = download_project_repository("https://github.com/multiversx/mx-contracts-rs/archive/refs/tags/v0.45.4.zip", "test_has_correct_packaged_source") - workspace = workspace_parent / "mx-contracts-rs-0.45.4" + workspace_parent = download_project_repository(DEFAULT_PROJECT_ARCHIVE_URL, "test_has_correct_packaged_source") + workspace = workspace_parent / DEFAULT_PROJECT_ARCHIVE_PAYLOAD output_folder = PARENT_OUTPUT_FOLDER / "test_has_correct_packaged_source" shutil.rmtree(output_folder, ignore_errors=True) @@ -47,14 +51,14 @@ def test_has_correct_packaged_source(): (code, _, _) = run_docker( project_path=workspace, packaged_src_path=None, - contract_name="adder", + contract_name=DEFAULT_CONTRACT_NAME, image="sdk-rust-contract-builder:next", output_folder=output_folder ) assert code == 0 - packaged_source_code = PackagedSourceCode.from_file(output_folder / "adder" / "adder-0.0.0.source.json") + packaged_source_code = PackagedSourceCode.from_file(output_folder / DEFAULT_CONTRACT_NAME / f"{DEFAULT_CONTRACT_NAME}-0.0.0.source.json") for entry in packaged_source_code.entries: assert not str(entry.path).startswith("target"), f"Unexpected file: {entry.path}" @@ -62,20 +66,20 @@ def test_has_correct_packaged_source(): def test_fail_if_contract_cargo_lock_is_missing(): - workspace_parent = download_project_repository("https://github.com/multiversx/mx-contracts-rs/archive/refs/tags/v0.45.4.zip", "test_fail_if_contract_cargo_lock_is_missing") - workspace = workspace_parent / "mx-contracts-rs-0.45.4" + workspace_parent = download_project_repository(DEFAULT_PROJECT_ARCHIVE_URL, "test_fail_if_contract_cargo_lock_is_missing") + workspace = workspace_parent / DEFAULT_PROJECT_ARCHIVE_PAYLOAD output_folder = PARENT_OUTPUT_FOLDER / "test_fail_if_contract_cargo_lock_is_missing" shutil.rmtree(output_folder, ignore_errors=True) output_folder.mkdir(parents=True, exist_ok=True) # Remove a (required) Cargo.lock file - (workspace / "contracts" / "adder" / "wasm" / "Cargo.lock").unlink() + (workspace / DEFAULT_CONTRACT_NAME / "wasm" / "Cargo.lock").unlink() (code, _, stderr) = run_docker( project_path=workspace, packaged_src_path=None, - contract_name="adder", + contract_name=DEFAULT_CONTRACT_NAME, image="sdk-rust-contract-builder:next", output_folder=output_folder ) @@ -85,8 +89,8 @@ def test_fail_if_contract_cargo_lock_is_missing(): def test_fail_if_workspace_cargo_lock_is_missing(): - workspace_parent = download_project_repository("https://github.com/multiversx/mx-contracts-rs/archive/refs/tags/v0.45.4.zip", "test_fail_if_workspace_cargo_lock_is_missing") - workspace = workspace_parent / "mx-contracts-rs-0.45.4" + workspace_parent = download_project_repository(DEFAULT_PROJECT_ARCHIVE_URL, "test_fail_if_workspace_cargo_lock_is_missing") + workspace = workspace_parent / DEFAULT_PROJECT_ARCHIVE_PAYLOAD output_folder = PARENT_OUTPUT_FOLDER / "test_fail_if_workspace_cargo_lock_is_missing" shutil.rmtree(output_folder, ignore_errors=True) @@ -98,7 +102,7 @@ def test_fail_if_workspace_cargo_lock_is_missing(): (code, stdout, _) = run_docker( project_path=workspace, packaged_src_path=None, - contract_name="adder", + contract_name=DEFAULT_CONTRACT_NAME, image="sdk-rust-contract-builder:next", output_folder=output_folder )