Skip to main content

Overview

TrustedAdvice<T> is a wrapper type that marks guest program inputs as trusted advice. Trusted advice values are assumed to be correct and do not require verification within the zkVM. This is useful for inputs that are inherently verifiable or when the correctness of the input is guaranteed by external means.

Type Definition

T
The wrapped value provided as trusted advice

Methods

new

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

Trait Implementations

From<T>

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

Deref

Provides automatic dereferencing to access the wrapped value.
Example:

Usage Example

When to Use

Use TrustedAdvice<T> when:
  • The input is guaranteed to be correct by external verification
  • The correctness of the input can be verified through other computations in your program
  • You want to reduce proof generation overhead by not verifying certain inputs
Improperly using TrustedAdvice can compromise the security of your zkVM program. Only use it for values whose correctness is guaranteed or will be verified elsewhere in your computation.

See Also