Skip to main content

Crate field_cat

Crate field_cat 

Source
Expand description

§field-cat

Finite field algebra for the *-cat proof-system ecosystem.

field-cat owns the Field trait, the FieldBytes transcript-serialization trait, and a small library of concrete prime fields used by downstream proof-system crates (plonkish_cat, proof_cat, and stark-cat).

Lifting Field out of plonkish-cat lets STARK-flavored downstreams depend only on the algebra they need, without inheriting the PLONKish constraint vocabulary (ConstraintSet, Expression, Wire, CopyConstraint).

§Fields

  • F101: toy field with modulus 101, useful for tests and small inspectable examples.
  • BabyBear: Mersenne prime field with modulus 2^31 - 1, used by Plonky3 and SP1.
  • BFieldElement: Goldilocks prime field with modulus 2^64 - 2^32 + 1, used by Triton VM, Risc0, and Plonky3 in its wider-field modes.

§Adding a field

Define a newtype, implement the std::ops arithmetic traits (Add, Sub, Mul, Neg), implement Field (zero, one, inv), and implement FieldBytes if the element will be absorbed into a Fiat-Shamir transcript.

Re-exports§

pub use baby_bear::BabyBear;
pub use bfield::BFieldElement;
pub use bytes::FieldBytes;
pub use error::Error;
pub use f101::F101;
pub use field::Field;

Modules§

baby_bear
The BabyBear prime field: integers modulo p = 2^31 - 1.
bfield
The BFieldElement prime field: integers modulo p = 2^64 - 2^32 + 1 (the Goldilocks prime).
bytes
Byte serialization for field elements.
error
Project-wide error type.
f101
The F101 toy field: integers modulo 101.
field
The Field trait: minimal algebraic interface for a finite field.