Expand description
Builder logic for creating PVM code blobs for execution on the JAM PVM instances (service code and authorizer code).
§Reproducibility
Two pieces here drive cross-machine reproducibility of the produced blob:
-
Path remapping (
build_encoded_rustflags). Adds--remap-path-prefixdirectives that rewrite$HOME,$RUSTUP_HOME,$CARGO_HOME, and each workspace-member path to stable roots (~/,~/.rustup,~/.cargo,/crate/<name>). This prevents the user’s actual home, cargo cache, and workspace location from leaking intofile!()strings and embedded debuginfo. Sufficient to make builds byte-identical across different machines running the same host OS (tested on Linux). -
RUSTC_WRAPPERforwarding (build_pvm_blob). The inner cargo invocation doesenv_clear()and then selectively forwards a few env vars;RUSTC_WRAPPERis one of them when the caller sets it. Used to additionally normalise cross-OS (Linux vs macOS) blob output via a custom wrapper that rewrites cargo’s per-crate-Cmetadatato a host-independent value. Wrapper lives atscripts/rustc-wrapper-fixed-metadata.shin this repository; see its header for details. Set it like:RUSTC_WRAPPER=$(pwd)/scripts/rustc-wrapper-fixed-metadata.sh cargo build -p polkajam-fuzzDefault builds (no
RUSTC_WRAPPERexported) only get the path-remap form of reproducibility — that’s the same-OS guarantee.
Macros§
- pvm_
binary - Returns the resulting blob as a byte slice.
- pvm_
binary_ hash - Returns the resulting blob hash as a byte slice.
Enums§
- Blob
Type - Program blob type.
- Profile
Type
Functions§
- build_
authorizer - Build the authorizer crate in
crate_dirfor PVM. - build_
corevm_ guest - Build the CoreVM guest program crate in
crate_dirfor PVM. - build_
pvm_ blob - Build the PVM crate in
crate_dirfor the RISCV target. - build_
service - Build the service crate in
crate_dirfor PVM. - code_
hash - Returns the hash of the code blob.