Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: documenting fields #7468

Merged
merged 1 commit into from
Jul 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions barretenberg/ts/src/types/fields.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ import { toBigIntBE, toBufferBE } from '../bigint-array/index.js';
import { BufferReader, uint8ArrayToHexString } from '../serialize/index.js';

// TODO(#4189): Replace with implementation in yarn-project/foundation/src/fields/fields.ts
/**
* Fr field class.
* @dev This class is used to represent elements of BN254 scalar field or elements in the base field of Grumpkin.
* (Grumpkin's scalar field corresponds to BN254's base field and vice versa.)
*/
export class Fr {
static ZERO = new Fr(0n);
static MODULUS = 0x30644e72e131a029b85045b68181585d2833e84879b9709143e1f593f0000001n;
Expand Down Expand Up @@ -57,6 +62,11 @@ export class Fr {
}
}

/**
* Fq field class.
* @dev This class is used to represent elements of BN254 base field or elements in the scalar field of Grumpkin.
* (Grumpkin's scalar field corresponds to BN254's base field and vice versa.)
*/
export class Fq {
static MODULUS = 0x30644e72e131a029b85045b68181585d97816a916871ca8d3c208c16d87cfd47n;
static MAX_VALUE = this.MODULUS - 1n;
Expand Down
4 changes: 4 additions & 0 deletions yarn-project/foundation/src/fields/fields.ts
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,8 @@ export interface Fr {

/**
* Fr field class.
* @dev This class is used to represent elements of BN254 scalar field or elements in the base field of Grumpkin.
* (Grumpkin's scalar field corresponds to BN254's base field and vice versa.)
*/
export class Fr extends BaseField {
static ZERO = new Fr(0n);
Expand Down Expand Up @@ -299,6 +301,8 @@ export interface Fq {

/**
* Fq field class.
* @dev This class is used to represent elements of BN254 base field or elements in the scalar field of Grumpkin.
* (Grumpkin's scalar field corresponds to BN254's base field and vice versa.)
*/
export class Fq extends BaseField {
static ZERO = new Fq(0n);
Expand Down
Loading