referrerpolicy=no-referrer-when-downgrade
sp_consensus_sassafras::vrf

Type Alias RingContext

Source
pub type RingContext = RingContext<RING_SIZE>;
Expand description

Bandersnatch VRF RingContext specialization for Sassafras using RING_SIZE.

Aliased Type§

struct RingContext(/* private fields */);

Implementations

§

impl<const R: usize> RingContext<R>

pub fn new_testing() -> RingContext<R>

Build an dummy instance for testing purposes.

pub fn max_keyset_size(&self) -> usize

Get the keyset max size.

pub fn prover( &self, public_keys: &[CryptoBytes<sp_core::::bandersnatch::Public::{constant#0}, (PublicTag, BandersnatchTag)>], public_idx: usize, ) -> RingProver<<<BandersnatchSha512Ell2 as Suite>::Affine as AffineRepr>::BaseField, KZG<<BandersnatchSha512Ell2 as RingSuite>::Pairing>, <<BandersnatchSha512Ell2 as Suite>::Affine as AffineRepr>::Config>

Get ring prover for the key at index public_idx in the public_keys set.

pub fn verifier( &self, public_keys: &[CryptoBytes<sp_core::::bandersnatch::Public::{constant#0}, (PublicTag, BandersnatchTag)>], ) -> RingVerifier<<<BandersnatchSha512Ell2 as Suite>::Affine as AffineRepr>::BaseField, KZG<<BandersnatchSha512Ell2 as RingSuite>::Pairing>, <<BandersnatchSha512Ell2 as Suite>::Affine as AffineRepr>::Config>

Get ring verifier for the public_keys set.

pub fn verifier_key( &self, public_keys: &[CryptoBytes<sp_core::::bandersnatch::Public::{constant#0}, (PublicTag, BandersnatchTag)>], ) -> RingVerifierKey

Build RingVerifierKey for lazy RingVerifier construction.

pub fn verifier_no_context( verifier_key: RingVerifierKey, ) -> RingVerifier<<<BandersnatchSha512Ell2 as Suite>::Affine as AffineRepr>::BaseField, KZG<<BandersnatchSha512Ell2 as RingSuite>::Pairing>, <<BandersnatchSha512Ell2 as Suite>::Affine as AffineRepr>::Config>

Constructs a RingVerifier from a VerifierKey without a RingContext instance.

While this approach is computationally slightly less efficient than using a pre-constructed RingContext, as some parameters need to be computed on-the-fly, it is beneficial in memory or storage constrained environments. This avoids the need to retain the full RingContext for ring signature verification. Instead, the VerifierKey contains only the essential information needed to verify ring proofs.

Trait Implementations

§

impl<const R: usize> Clone for RingContext<R>

§

fn clone(&self) -> RingContext<R>

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
§

impl<const R: usize> Decode for RingContext<R>

§

fn decode<I>(input: &mut I) -> Result<RingContext<R>, Error>
where I: Input,

Attempt to deserialise the value from input.
§

fn decode_into<I>( input: &mut I, dst: &mut MaybeUninit<Self>, ) -> Result<DecodeFinished, Error>
where I: Input,

Attempt to deserialize the value from input into a pre-allocated piece of memory. Read more
§

fn skip<I>(input: &mut I) -> Result<(), Error>
where I: Input,

Attempt to skip the encoded value from input. Read more
§

fn encoded_fixed_size() -> Option<usize>

Returns the fixed encoded size of the type. Read more
§

impl<const R: usize> Encode for RingContext<R>

§

fn encode(&self) -> Vec<u8>

Convert self to an owned vector.
§

fn size_hint(&self) -> usize

If possible give a hint of expected size of the encoding. Read more
§

fn encode_to<T>(&self, dest: &mut T)
where T: Output + ?Sized,

Convert self to a slice and append it to the destination.
§

fn using_encoded<R, F>(&self, f: F) -> R
where F: FnOnce(&[u8]) -> R,

Convert self to a slice and then invoke the given closure with it.
§

fn encoded_size(&self) -> usize

Calculates the encoded size. Read more
§

impl<const R: usize> MaxEncodedLen for RingContext<R>

§

fn max_encoded_len() -> usize

Upper bound, in bytes, of the maximum encoded size of this item.
§

impl<const R: usize> TypeInfo for RingContext<R>

§

type Identity = RingContext<R>

The type identifying for which type info is provided. Read more
§

fn type_info() -> Type

Returns the static type identifier for Self.
§

impl<const R: usize> EncodeLike for RingContext<R>