provable-contracts-macros
Proc macros for compile-time contract enforcement.
#[contract] Attribute
Annotates a function with a provable-contracts YAML contract reference. At compile time, verifies the contract exists (via build.rs env vars) and registers the binding for audit.
use contract;
How It Works
-
build.rs in the consuming crate reads
binding.yamland setsCONTRACT_<NAME>_<EQ>=boundenv vars for each implemented binding. -
#[contract("name", equation = "eq")]expands to aconstthat reads the corresponding env var viaenv!(). Missing env var = compile error. -
A static string in a dedicated link section registers the binding for runtime audit (when
contract-auditfeature is enabled).