From a20bb18d5748f5001e3ee490f9cf9732c332307b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrei=20B=C4=83ncioiu?= Date: Wed, 27 Dec 2023 18:37:52 +0200 Subject: [PATCH 1/4] On the wrapper script, fix "--package-whole-project-src". --- build_with_docker.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build_with_docker.py b/build_with_docker.py index a6422ca..e56da1d 100644 --- a/build_with_docker.py +++ b/build_with_docker.py @@ -20,7 +20,7 @@ def main(cli_args: List[str]): parser.add_argument("--packaged-src", type=str, help="source code packaged in a JSON file") parser.add_argument("--contract", type=str) parser.add_argument("--output", type=str, default=Path(os.getcwd()) / "output") - parser.add_argument("--package-whole-project-src", type=bool, default=False, help="include all project files in *.source.json (default: %(default)s)") + parser.add_argument("--package-whole-project-src", action="store_true", default=False, help="include all project files in *.source.json (default: %(default)s)") parser.add_argument("--cargo-target-dir", help="deprecated parameter, not used anymore") parser.add_argument("--no-wasm-opt", action="store_true", default=False, help="do not optimize wasm files after the build (default: %(default)s)") parser.add_argument("--build-root", type=str, required=False, help="root path (within container) for the build (default: %(default)s)") From a34766972927890855705be509ae9793a80e2494 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrei=20B=C4=83ncioiu?= Date: Wed, 27 Dec 2023 18:38:21 +0200 Subject: [PATCH 2/4] Add extra tests (previous builds). --- .github/workflows/run_long_integration_tests.yml | 2 +- integration_tests/previous_builds.py | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/.github/workflows/run_long_integration_tests.yml b/.github/workflows/run_long_integration_tests.yml index a230dfc..13f1198 100644 --- a/.github/workflows/run_long_integration_tests.yml +++ b/.github/workflows/run_long_integration_tests.yml @@ -22,7 +22,7 @@ jobs: - name: Build run: | export PYTHONPATH=. - python ./integration_tests/test_previous_builds_are_reproducible.py --selected-builds "a.1" "a.2" "a.3" + python ./integration_tests/test_previous_builds_are_reproducible.py --selected-builds "a.1" "a.2" "a.3" "a.4" - name: Save artifacts uses: actions/upload-artifact@v3 diff --git a/integration_tests/previous_builds.py b/integration_tests/previous_builds.py index 3f0d14c..6106521 100644 --- a/integration_tests/previous_builds.py +++ b/integration_tests/previous_builds.py @@ -60,5 +60,20 @@ def __init__(self, name: str, "safe-price-view": "b5a657445ae74423c60210c88a6fa89b0bd4bdd00d5f06e788e14495bccc34c9" }, docker_image="sdk-rust-contract-builder:next" + ), + PreviousBuild( + name="a.4", + project_archive_url="https://github.com/multiversx/mx-exchange-sc/archive/refs/heads/reproducible-v2.5.2-governance-merkle-tree.zip", + project_relative_path_in_archive="mx-exchange-sc-reproducible-v2.5.2-governance-merkle-tree", + packaged_src_url=None, + contract_name=None, + expected_code_hashes={ + "lkmex-transfer": "49809df9f07839f965f8197721083cf403c3db969ddc47b5940b4ee8b464af92", + "router": "3257d57945736298c96aa23f99ea0fba3b6da01f9d2103d81230d05cff62cb5a", + "pair": "e9f117971963cb3c24b14e2a7698d48c170335af2f5c8167774c48c3c1c654e3", + "locked-token-wrapper": "1d317cfa2bbe22ea1f878f8a32f90712d49f68a01665b86657d36910b430522f", + "safe-price-view": "b5a657445ae74423c60210c88a6fa89b0bd4bdd00d5f06e788e14495bccc34c9" + }, + docker_image="sdk-rust-contract-builder:next" ) ] From 7e6adcf98bbf450aa37c0a4566b9febb1fec1910 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrei=20B=C4=83ncioiu?= Date: Wed, 27 Dec 2023 19:00:28 +0200 Subject: [PATCH 3/4] Fix builder name. --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 518a6ec..66922b1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ FROM ubuntu:22.04 # Constants -ARG BUILDER_NAME="multiversx/sdk-rust-contract-builder:v4.2.0" +ARG BUILDER_NAME="multiversx/sdk-rust-contract-builder:v4.2.1" ARG VERSION_RUST="nightly-2022-10-16" ARG VERSION_BINARYEN="version_105" ARG DOWNLOAD_URL_BINARYEN="https://github.com/WebAssembly/binaryen/releases/download/${VERSION_BINARYEN}/binaryen-${VERSION_BINARYEN}-x86_64-linux.tar.gz" From accd4cffa836755ccfcdb654e268b6c8e40f52a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrei=20B=C4=83ncioiu?= Date: Wed, 27 Dec 2023 19:23:42 +0200 Subject: [PATCH 4/4] Optimization: build contract specified in the metadata of the packaged source. --- multiversx_sdk_rust_contract_builder/main.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/multiversx_sdk_rust_contract_builder/main.py b/multiversx_sdk_rust_contract_builder/main.py index ebd7c58..08d0dbe 100644 --- a/multiversx_sdk_rust_contract_builder/main.py +++ b/multiversx_sdk_rust_contract_builder/main.py @@ -52,6 +52,9 @@ def main(cli_args: List[str]): packaged = PackagedSourceCode.from_file(packaged_src_path) packaged.unwrap_to_filesystem(HARDCODED_UNWRAP_FOLDER) + if not specific_contract: + specific_contract = packaged.metadata.contract_name + metadata = BuildMetadata.from_env() options = BuildOptions(