arkworks-rs / snark

Interfaces for Relations and SNARKs for these relations
https://www.arkworks.rs
Apache License 2.0
770 stars 207 forks source link

Use a `tracing`-based API for debugging and profiling constraints #270

Closed Pratyush closed 3 years ago

Pratyush commented 3 years ago

Blocked on #186

PR #186 improved the ergonomics of writing constraints and gadgets, but regressed the ergonomics of profiling and debugging constraints. This PR attempts to rectify that by moving to an API based on the tracing crate. To enter a namespace, simply annotate the relevant function with the tracing::instrument attribute, with target = "r1cs":

#[tracing::instrument(target = "r1cs")]
fn some_gadget(...) -> Something {
    ///...
}

See r1cs_std for examples.

Closes #250