mx-sdk-rust-contract-builder
Docker image (and wrappers) for reproducible contract builds (Rust). See docs.multiversx.com.
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.
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
Release files for multiversx-sdk-rust-contract-builder 4.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| multiversx_sdk_rust_contract_builder-4.1.1.tar.gz | 14.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| multiversx_sdk_rust_contract_builder-4.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 30.0 kB
Release files / multiversx_sdk_rust_contract_builder-4.1.1.tar.gz
| Download URL | multiversx_sdk_rust_contract_builder-4.1.1.tar.gz |
|---|---|
| Size | 14.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
177483f05d90ca90947430ec4d4b24e7dc14086ae25c0a5617612ec5f86e0f7e
|
|
BLAKE2b-256 checksum How to use checksums |
4b0359579ea1c49fde60a03b4cb3cd800641c5a790debb40be0be581995e4971
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.16
|
Release files / multiversx_sdk_rust_contract_builder-4.1.1-py3-none-any.whl
| Download URL | multiversx_sdk_rust_contract_builder-4.1.1-py3-none-any.whl |
|---|---|
| Size | 15.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
499e140010a78f1ce7f6c4a96af1ece41170d2e1558cabbae287b1a41fa17500
|
|
BLAKE2b-256 checksum How to use checksums |
1eee9f24c691cf018b8b02fc4184f382597cb3ef73994b8545f6e8dda6618247
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.16
|