Skip to main content

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

T
The wrapped value provided as untrusted advice

Methods

new

Creates a new UntrustedAdvice wrapper around a value.
T
required
The value to wrap as untrusted advice
Returns: A new UntrustedAdvice<T> instance Example:

Trait Implementations

From<T>

Allows automatic conversion from any value T into UntrustedAdvice<T>.
Example:

Deref

Provides automatic dereferencing to access the wrapped value.
Example:

Usage Example

When to Use

Use UntrustedAdvice<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 holds
  • check_advice_eq!(left, right) - Asserts that two values are equal
See the check_advice! macro documentation for more details.

See Also