penumbra_proof_setup::single::log

Trait Phase

Source
pub trait Phase {
    type CRSElements: Hashable;
    type RawContribution: Hashable;
    type Contribution: Hashable;

    // Required methods
    fn parent_hash(contribution: &Self::RawContribution) -> ContributionHash;
    fn elements(contribution: &Self::Contribution) -> &Self::CRSElements;
    fn validate(
        root: &Self::CRSElements,
        contribution: &Self::RawContribution,
    ) -> Option<Self::Contribution>;
    fn is_linked_to(
        contribution: &Self::Contribution,
        elements: &Self::CRSElements,
    ) -> bool;
}
Expand description

A trait abstracting common behavior between both setup phases.

This trait provides us with enough functionality to verify the contribution logs produced by both phases.

Required Associated Types§

Source

type CRSElements: Hashable

The type of the elements constituting this phase.

This elements will be internally valid, although possibly not correctly linked with respect to other contributions.

Source

type RawContribution: Hashable

The type of a contribution before any kind of validation.

Source

type Contribution: Hashable

A contribution after having been validated.

Required Methods§

Source

fn parent_hash(contribution: &Self::RawContribution) -> ContributionHash

The hash of the parent element for a raw contribution.

Source

fn elements(contribution: &Self::Contribution) -> &Self::CRSElements

The elements in a contribution.

Source

fn validate( root: &Self::CRSElements, contribution: &Self::RawContribution, ) -> Option<Self::Contribution>

Validate a contribution relative to some root elements.

This might fail, hence the Option.

Source

fn is_linked_to( contribution: &Self::Contribution, elements: &Self::CRSElements, ) -> bool

Check if a contribution is linked to some parent elements.

If a contribution is linked to those elements, then it builds upon those elements correctly.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§