pub trait Witness:
Default
+ Serialize
+ DeserializeOwned {
// Required methods
fn add_hint<T: BorshSerialize>(&self, hint: T);
fn get_hint<T: BorshDeserialize>(&self) -> T;
fn merge(&self, rhs: &Self);
}
Expand description
A witness is a value produced during native execution that is then used by the zkVM circuit to produce proofs.
Witnesses are typically used to abstract away storage access from inside the
zkVM. For every read operation performed by the native code, a hint can be
added and the zkVM circuit can then read the same hint. Hints are replayed
to Witness::get_hint
in the same order
they were added via Witness::add_hint
.
Required Methods§
Sourcefn add_hint<T: BorshSerialize>(&self, hint: T)
fn add_hint<T: BorshSerialize>(&self, hint: T)
Adds a serializable “hint” to the witness value, which can be later read by the zkVM circuit.
This method SHOULD only be called from the native execution environment.
Sourcefn get_hint<T: BorshDeserialize>(&self) -> T
fn get_hint<T: BorshDeserialize>(&self) -> T
Retrieves a “hint” from the witness value.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.