Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prepare v8 (Rust stable 1.78.0) #66

Merged
merged 5 commits into from
May 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
12 changes: 4 additions & 8 deletions integration_tests/previous_builds.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
),
Expand Down
32 changes: 18 additions & 14 deletions integration_tests/test_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
)
Expand All @@ -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)
Expand All @@ -47,35 +51,35 @@ 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}"
assert entry.is_test_file == ("test" in str(entry.path)), f"Unexpected is_test_file marker for: {entry.path}"


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
)
Expand All @@ -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)
Expand All @@ -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
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@


def main(cli_args: List[str]):
repository_url = "https://github.com/multiversx/mx-contracts-rs"
commit = "9da0c4abe7aba6ae109c167be655b2ce80ca4b08"
archve_subfolder = f"mx-contracts-rs-{commit}"
repository_url = "https://github.com/multiversx/mx-sovereign-sc"
commit = "80599388b9358842b50ea216a622d514e15df374"
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

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"],
)


Expand Down
Loading