Skip to main content

Crate jam_pvm_builder

Crate jam_pvm_builder 

Source
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-prefix directives 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 into file!() strings and embedded debuginfo. Sufficient to make builds byte-identical across different machines running the same host OS (tested on Linux).

  • RUSTC_WRAPPER forwarding (build_pvm_blob). The inner cargo invocation does env_clear() and then selectively forwards a few env vars; RUSTC_WRAPPER is 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 -Cmetadata to a host-independent value. Wrapper lives at scripts/rustc-wrapper-fixed-metadata.sh in this repository; see its header for details. Set it like:

    RUSTC_WRAPPER=$(pwd)/scripts/rustc-wrapper-fixed-metadata.sh cargo build -p polkajam-fuzz

    Default builds (no RUSTC_WRAPPER exported) 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§

BlobType
Program blob type.
ProfileType

Functions§

build_authorizer
Build the authorizer crate in crate_dir for PVM.
build_corevm_guest
Build the CoreVM guest program crate in crate_dir for PVM.
build_pvm_blob
Build the PVM crate in crate_dir for the RISCV target.
build_service
Build the service crate in crate_dir for PVM.
code_hash
Returns the hash of the code blob.