Skip to main content

DecodeUnchecked

Trait DecodeUnchecked 

Source
pub trait DecodeUnchecked: Sized + Decode {
    // Provided method
    fn decode_unchecked<I: Input>(input: &mut I) -> Result<Self, Error> { ... }
}
Expand description

SCALE decoding that may skip backend-specific validation (e.g. arkworks curve-point subgroup checks) for values arriving from a trusted source.

The default Decode impls for the ring types (ring::MembersSet, ring::MembersCommitment, ring::StaticChunk, ring::ProverState) validate every curve point — the right behaviour at trust boundaries (extrinsic arguments, XCM payloads, anything crossing an untrusted edge). Reading a value that was already validated on the way in repeats that work for nothing.

Implementors expose a parallel decode_unchecked entry point that reads the exact same bytes without revalidating. The supertrait Decode expresses that the two paths share the same wire format; only the validation policy differs.

The default method body just delegates to Decode::decode, which is the correct behaviour for types with no curve content. Backends override with a validation-bypassing path; see [ring::impl_common_traits].

Use only for values that were validated at their ingress point. Do not call on data that arrives from an untrusted source.

Provided Methods§

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§