Skip to content

Commit

Permalink
chore: implement Fq add (#9354)
Browse files Browse the repository at this point in the history
This is more changes for the new address scheme.
I think it was just missing here. We need this to be able to add our
preaddress (h) to our ivsk, to compute our addressSecret.
  • Loading branch information
sklppy88 authored Oct 24, 2024
1 parent 3a1a62c commit 1711fac
Showing 1 changed file with 4 additions and 0 deletions.
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 @@ -381,6 +381,10 @@ export class Fq extends BaseField {
return new Fq((high.toBigInt() << Fq.HIGH_SHIFT) + low.toBigInt());
}

add(rhs: Fq) {
return new Fq((this.toBigInt() + rhs.toBigInt()) % Fq.MODULUS);
}

toJSON() {
return {
type: 'Fq',
Expand Down

0 comments on commit 1711fac

Please sign in to comment.