multiversx-sdk-rust-contract-builder


Namemultiversx-sdk-rust-contract-builder JSON
Version 4.1.1 PyPI version JSON
download
home_page
SummaryMultiversX: utility package for building Rust contracts (reproducible builds).
upload_time2023-02-01 09:24:49
maintainer
docs_urlNone
authorMultiversX
requires_python>=3.8
license
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # mx-sdk-rust-contract-builder

Docker image (and wrappers) for reproducible contract builds (Rust). See [docs.multiversx.com](https://docs.multiversx.com/developers/reproducible-contract-builds/).

## Build the Docker image

We use `docker buildx` to build the image:

```
docker buildx build --output type=docker --no-cache . -t sdk-rust-contract-builder:next -f ./Dockerfile
```

Maintainers can publish the image as follows:

```
docker buildx create --name multiarch --use

docker buildx build --no-cache --push --platform=linux/amd64,linux/arm64 . -t multiversx/sdk-rust-contract-builder:next -f ./Dockerfile

docker buildx rm multiarch
```

For the above to work properly, make sure to install `tonistiigi/binfmt` beforehand. Please follow the official Docker documentation [here](https://docs.docker.com/build/building/multi-platform/).

Though, note that currently (January 2023) we recommend against using the `linux/arm64` image for performing reproducible contract builds. This is because, in some (possibly rare) circumstances, a WASM binary generated on the `linux/amd64` image _might_ differ (at the bytecode level) from one generated on the `linux/arm64` image - probably due to distinct (unfortunate) bytecode-emitting logic in the Rust compiler.

## Build contract using the wrapper

If you are using a Mac with ARM64, we _recommend_ setting the following variable beforehand (contract builds will be slower, but this eliminates the risk of not being able to reproduce the build on Linux):

```
export DOCKER_DEFAULT_PLATFORM=linux/amd64
```

Building from a project folder:

```
python3 ./build_with_docker.py --image=sdk-rust-contract-builder:next \
    --project=~/contracts/example \
    --output=~/contracts/output-from-docker
```

Building from a packaged source code:

```
python3 ./build_with_docker.py --image=sdk-rust-contract-builder:next \
    --packaged-src=~/contracts/example-0.0.0.source.json \
    --output=~/contracts/output-from-docker
```

## Run unit tests (without Docker)

```
export PATH=${HOME}/multiversx-sdk/vendor-rust/bin:${HOME}/multiversx-sdk/wabt/latest/bin:${PATH}
export RUSTUP_HOME=${HOME}/multiversx-sdk/vendor-rust
export CARGO_HOME=${HOME}/multiversx-sdk/vendor-rust

pytest .
```

## Run integration tests (with Docker)

```
python3 ./integration_tests/test_previous_builds_are_reproducible.py --selected-builds "a.1" [...]
python3 ./integration_tests/test_project_folder_and_packaged_src_are_equivalent.py
```

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "multiversx-sdk-rust-contract-builder",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "",
    "keywords": "",
    "author": "MultiversX",
    "author_email": "",
    "download_url": "https://files.pythonhosted.org/packages/4b/03/59579ea1c49fde60a03b4cb3cd800641c5a790debb40be0be581995e4971/multiversx_sdk_rust_contract_builder-4.1.1.tar.gz",
    "platform": null,
    "description": "# mx-sdk-rust-contract-builder\n\nDocker image (and wrappers) for reproducible contract builds (Rust). See [docs.multiversx.com](https://docs.multiversx.com/developers/reproducible-contract-builds/).\n\n## Build the Docker image\n\nWe use `docker buildx` to build the image:\n\n```\ndocker buildx build --output type=docker --no-cache . -t sdk-rust-contract-builder:next -f ./Dockerfile\n```\n\nMaintainers can publish the image as follows:\n\n```\ndocker buildx create --name multiarch --use\n\ndocker buildx build --no-cache --push --platform=linux/amd64,linux/arm64 . -t multiversx/sdk-rust-contract-builder:next -f ./Dockerfile\n\ndocker buildx rm multiarch\n```\n\nFor the above to work properly, make sure to install `tonistiigi/binfmt` beforehand. Please follow the official Docker documentation [here](https://docs.docker.com/build/building/multi-platform/).\n\nThough, note that currently (January 2023) we recommend against using the `linux/arm64` image for performing reproducible contract builds. This is because, in some (possibly rare) circumstances, a WASM binary generated on the `linux/amd64` image _might_ differ (at the bytecode level) from one generated on the `linux/arm64` image - probably due to distinct (unfortunate) bytecode-emitting logic in the Rust compiler.\n\n## Build contract using the wrapper\n\nIf you are using a Mac with ARM64, we _recommend_ setting the following variable beforehand (contract builds will be slower, but this eliminates the risk of not being able to reproduce the build on Linux):\n\n```\nexport DOCKER_DEFAULT_PLATFORM=linux/amd64\n```\n\nBuilding from a project folder:\n\n```\npython3 ./build_with_docker.py --image=sdk-rust-contract-builder:next \\\n    --project=~/contracts/example \\\n    --output=~/contracts/output-from-docker\n```\n\nBuilding from a packaged source code:\n\n```\npython3 ./build_with_docker.py --image=sdk-rust-contract-builder:next \\\n    --packaged-src=~/contracts/example-0.0.0.source.json \\\n    --output=~/contracts/output-from-docker\n```\n\n## Run unit tests (without Docker)\n\n```\nexport PATH=${HOME}/multiversx-sdk/vendor-rust/bin:${HOME}/multiversx-sdk/wabt/latest/bin:${PATH}\nexport RUSTUP_HOME=${HOME}/multiversx-sdk/vendor-rust\nexport CARGO_HOME=${HOME}/multiversx-sdk/vendor-rust\n\npytest .\n```\n\n## Run integration tests (with Docker)\n\n```\npython3 ./integration_tests/test_previous_builds_are_reproducible.py --selected-builds \"a.1\" [...]\npython3 ./integration_tests/test_project_folder_and_packaged_src_are_equivalent.py\n```\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "MultiversX: utility package for building Rust contracts (reproducible builds).",
    "version": "4.1.1",
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "1eee9f24c691cf018b8b02fc4184f382597cb3ef73994b8545f6e8dda6618247",
                "md5": "b61d5ce29d2213b8ac6eb121b321c1ba",
                "sha256": "499e140010a78f1ce7f6c4a96af1ece41170d2e1558cabbae287b1a41fa17500"
            },
            "downloads": -1,
            "filename": "multiversx_sdk_rust_contract_builder-4.1.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "b61d5ce29d2213b8ac6eb121b321c1ba",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 15770,
            "upload_time": "2023-02-01T09:24:48",
            "upload_time_iso_8601": "2023-02-01T09:24:48.247593Z",
            "url": "https://files.pythonhosted.org/packages/1e/ee/9f24c691cf018b8b02fc4184f382597cb3ef73994b8545f6e8dda6618247/multiversx_sdk_rust_contract_builder-4.1.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "4b0359579ea1c49fde60a03b4cb3cd800641c5a790debb40be0be581995e4971",
                "md5": "ace3fefaae9b2033e14c19a0d78e754a",
                "sha256": "177483f05d90ca90947430ec4d4b24e7dc14086ae25c0a5617612ec5f86e0f7e"
            },
            "downloads": -1,
            "filename": "multiversx_sdk_rust_contract_builder-4.1.1.tar.gz",
            "has_sig": false,
            "md5_digest": "ace3fefaae9b2033e14c19a0d78e754a",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 14191,
            "upload_time": "2023-02-01T09:24:49",
            "upload_time_iso_8601": "2023-02-01T09:24:49.793039Z",
            "url": "https://files.pythonhosted.org/packages/4b/03/59579ea1c49fde60a03b4cb3cd800641c5a790debb40be0be581995e4971/multiversx_sdk_rust_contract_builder-4.1.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-02-01 09:24:49",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "lcname": "multiversx-sdk-rust-contract-builder"
}
        
Elapsed time: 0.03365s