Skip to main content

Phi2Certificate

Struct Phi2Certificate 

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

Precision metadata for one exact table, correlation, grid, and interpolation algorithm.

Certificates are created by exhaustive offline node comparison through Phi2Table::certify or Phi2DenseTable::certify. The certificate ID is SHA-256 over all metadata and a SHA-256 root of 128-bit SHA-256 row commitments. On-chain callers must pin an independently trusted certificate_id (normally embedded in the program) when creating a CertifiedPhi2Evaluator. This prevents an untrusted account from lowering the declared error and recomputing a new certificate for itself.

max_abs_error is measured in the crate’s SCALE (1e12). It is the sum of the largest generated-node discrepancy from GL20, the declared GL20 reference allowance, and a conservative analytic continuous-cell bilinear interpolation bound including fixed-point evaluation rounding.

Implementations§

Source§

impl Phi2Certificate

Source

pub const fn from_embedded_parts( rho: i128, grid_size: u16, max_node_abs_error: i128, interpolation_abs_error_bound: i128, reference_abs_error_allowance: i128, max_abs_error: i128, row_digests: [[u8; 16]; 129], table_digest: [u8; 32], certificate_id: [u8; 32], ) -> Self

Reconstruct certificate metadata emitted by trusted offline tooling.

This constructor intentionally does not establish trust. Evaluation still requires the independently pinned expected_certificate_id, and verifies the ID, all derived bounds, and the complete table digest.

Source

pub const fn rho(&self) -> i128

Fixed correlation at SCALE (1e12).

Source

pub const fn grid_size(&self) -> usize

Number of points on each grid axis.

Source

pub const fn interpolation(&self) -> Phi2Interpolation

Interpolation algorithm committed by the certificate.

Source

pub const fn reference(&self) -> Phi2Reference

Offline numerical reference committed by the certificate.

Source

pub const fn max_node_abs_error(&self) -> i128

Maximum table-node discrepancy from the offline GL20 reference.

Source

pub const fn interpolation_abs_error_bound(&self) -> i128

Conservative continuous-cell interpolation plus evaluator-rounding bound.

Source

pub const fn reference_abs_error_allowance(&self) -> i128

Explicit allowance for error in the GL20 reference itself.

Source

pub const fn max_abs_error(&self) -> i128

Total certified maximum absolute probability error at SCALE (1e12).

Source

pub const fn row_digests(&self) -> &[[u8; 16]; 129]

Truncated SHA-256 commitments for each row.

Once the certificate ID is independently pinned, changing a committed row requires a 128-bit second-preimage attack. The generic collision strength of a 128-bit truncated digest is 64 bits; do not use these row digests as unpinned, attacker-selected identities.

Source

pub const fn table_digest(&self) -> [u8; 32]

SHA-256 digest of the exact table and fixed grid/interpolation metadata.

Source

pub const fn certificate_id(&self) -> [u8; 32]

SHA-256 identity of the table digest plus all certificate metadata.

Trait Implementations§

Source§

impl Clone for Phi2Certificate

Source§

fn clone(&self) -> Phi2Certificate

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 Debug for Phi2Certificate

Source§

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

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

impl Eq for Phi2Certificate

Source§

impl PartialEq for Phi2Certificate

Source§

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

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

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

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Phi2Certificate

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.