Skip to main content

CandidateSet

Struct CandidateSet 

Source
pub struct CandidateSet { /* private fields */ }
Expand description

How many polynomials a commitment still leaves open.

The rule: a layer charges its own draws over the whole set, then passes the set on.

A charge never shrinks the set, which the commitment fixed before anything above drew.

Unique decoding leaves one candidate, which costs a later draw nothing.

A list-decoding argument leaves a list, and each earlier draw gets one try per member.

§What this type does and does not catch

It catches a count that is not a set size.

That is the one arithmetic error here that overstates a level.

A negative count would add bits to the term it is charged over.

Being copied rather than spent is what forwarding looks like in the signature.

It does not catch a draw nobody charged.

Nor a scheme reporting an open list as unique.

Both of those overstate a level, and no type can see either one.

A component supplying no evidence leaves the report with no number to give.

Past that, a missing term is caught by the tests that name each one.

An understated list is a claim about the proximity argument, checked where it lives.

§Example

Two stacked layers, over a commitment leaving sixteen candidates open.

use p3_security::{CandidateSet, ErrorBits, SecurityTerm};

let candidates = CandidateSet::from_log2(4.0).unwrap();

// The inner layer charges its own reduction and forwards the set untouched.
let inner = SecurityTerm::new("inner", ErrorBits::from_log2(100.0)).over_candidates(candidates);
assert_eq!(inner.bits.bits(), 96.0);

// The outer layer charges its own draw over the same set, not over what is left of it.
let outer = SecurityTerm::new("outer", ErrorBits::from_log2(100.0)).over_candidates(candidates);
assert_eq!(outer.bits.bits(), 96.0);

Implementations§

Source§

impl CandidateSet

Source

pub const UNIQUE: Self

The commitment names one polynomial, so a later draw pays nothing.

Source

pub fn from_log2(log2_size: f64) -> Option<Self>

A set of that many candidates, as a base-two logarithm.

§Returns

Nothing when the argument is not a set size.

A set has at least one member and finitely many.

So a negative, infinite, or undefined argument names no set at all.

Source

pub const fn log2_size(self) -> f64

Base-two logarithm of how many candidates are left open.

Source

pub fn is_unique(self) -> bool

Whether the commitment already names one polynomial.

Source

pub fn product(self, other: Self) -> Self

The set a draw faces when two independent commitments are both still open.

A prover chooses one member of each, so the two choices multiply.

Trait Implementations§

Source§

impl Clone for CandidateSet

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Copy for CandidateSet

Source§

impl Debug for CandidateSet

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for CandidateSet

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl PartialOrd for CandidateSet

Source§

fn partial_cmp(&self, other: &Self) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 (const: unstable) · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 (const: unstable) · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 (const: unstable) · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 (const: unstable) · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl Serialize for CandidateSet

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for CandidateSet

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> Dup for T
where T: Copy + Clone,

Source§

fn dup(&self) -> T

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more