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
impl Phi2Certificate
Sourcepub 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
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.
Sourcepub const fn interpolation(&self) -> Phi2Interpolation
pub const fn interpolation(&self) -> Phi2Interpolation
Interpolation algorithm committed by the certificate.
Sourcepub const fn reference(&self) -> Phi2Reference
pub const fn reference(&self) -> Phi2Reference
Offline numerical reference committed by the certificate.
Sourcepub const fn max_node_abs_error(&self) -> i128
pub const fn max_node_abs_error(&self) -> i128
Maximum table-node discrepancy from the offline GL20 reference.
Sourcepub const fn interpolation_abs_error_bound(&self) -> i128
pub const fn interpolation_abs_error_bound(&self) -> i128
Conservative continuous-cell interpolation plus evaluator-rounding bound.
Sourcepub const fn reference_abs_error_allowance(&self) -> i128
pub const fn reference_abs_error_allowance(&self) -> i128
Explicit allowance for error in the GL20 reference itself.
Sourcepub const fn max_abs_error(&self) -> i128
pub const fn max_abs_error(&self) -> i128
Total certified maximum absolute probability error at SCALE (1e12).
Sourcepub const fn row_digests(&self) -> &[[u8; 16]; 129]
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.
Sourcepub const fn table_digest(&self) -> [u8; 32]
pub const fn table_digest(&self) -> [u8; 32]
SHA-256 digest of the exact table and fixed grid/interpolation metadata.
Sourcepub const fn certificate_id(&self) -> [u8; 32]
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
impl Clone for Phi2Certificate
Source§fn clone(&self) -> Phi2Certificate
fn clone(&self) -> Phi2Certificate
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more