Overview
UntrustedAdvice<T> is a wrapper type that marks guest program inputs as untrusted advice. Unlike trusted advice, untrusted advice values must be verified within the zkVM to ensure correctness. This is the safer option for inputs that need to be validated as part of the proof.
Type Definition
The wrapped value provided as untrusted advice
Methods
new
Creates a newUntrustedAdvice wrapper around a value.
The value to wrap as untrusted advice
UntrustedAdvice<T> instance
Example:
Trait Implementations
From<T>
Allows automatic conversion from any value T into UntrustedAdvice<T>.
Deref
Provides automatic dereferencing to access the wrapped value.Usage Example
When to Use
UseUntrustedAdvice<T> when:
- The input comes from an external source and needs verification
- You want to provide a hint or witness that will be checked within the zkVM
- You need to verify properties of the input as part of the proof
- You want to use the safer default for advice inputs
UntrustedAdvice is the recommended default for most use cases. Always verify untrusted advice using check_advice! or check_advice_eq! macros to ensure correctness.Verification Macros
When working with untrusted advice, use these macros to verify correctness:check_advice!(condition)- Asserts that a condition holdscheck_advice_eq!(left, right)- Asserts that two values are equal
See Also
- TrustedAdvice<T> - For advice that doesn’t require verification
- AdviceWriter - Writing advice data to the advice tape
- AdviceReader - Reading advice data from the advice tape
- check_advice! macro - Macro for verifying advice