Skip to content

Commit 563ee8a

Browse files
alexghrjust-mitch
andauthored
chore: pin @noble/curves (#16248)
Yarn was getting confused by all the different version of this package that it had to manage. This package does _not_ seem to follow semver! --------- Co-authored-by: Mitch <mitchell@aztecprotocol.com>
1 parent b0f6c8b commit 563ee8a

File tree

6 files changed

+54
-38
lines changed

6 files changed

+54
-38
lines changed

yarn-project/end-to-end/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
"@aztec/world-state": "workspace:^",
6262
"@iarna/toml": "^2.2.5",
6363
"@jest/globals": "^30.0.0",
64-
"@noble/curves": "^1.0.0",
64+
"@noble/curves": "=1.0.0",
6565
"@swc/core": "^1.4.11",
6666
"@swc/jest": "^0.2.36",
6767
"@types/fs-extra": "^11.0.2",

yarn-project/ethereum/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
},
4444
"devDependencies": {
4545
"@jest/globals": "^30.0.0",
46-
"@noble/curves": "^1.7.0",
46+
"@noble/curves": "=1.7.0",
4747
"@types/jest": "^30.0.0",
4848
"@types/lodash.pickby": "^4",
4949
"@types/node": "^22.15.17",

yarn-project/ethereum/src/contracts/gse.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { EthAddress } from '@aztec/foundation/eth-address';
22
import { GSEAbi } from '@aztec/l1-artifacts/GSEAbi';
33

4-
import type { WeierstrassPoint } from '@noble/curves/abstract/weierstrass';
4+
import type { ProjPointType } from '@noble/curves/abstract/weierstrass';
55
import { bn254 } from '@noble/curves/bn254';
66
import { type GetContractReturnType, type Hex, getContract } from 'viem';
77

@@ -39,17 +39,17 @@ export class GSEContract {
3939
this.gse = getContract({ address, abi: GSEAbi, client });
4040
}
4141

42-
public async getRegistrationDigest(publicKey: WeierstrassPoint<bigint>): Promise<WeierstrassPoint<bigint>> {
42+
public async getRegistrationDigest(publicKey: ProjPointType<bigint>): Promise<ProjPointType<bigint>> {
4343
const affinePublicKey = publicKey.toAffine();
4444
const g1PointDigest = await this.gse.read.getRegistrationDigest([{ x: affinePublicKey.x, y: affinePublicKey.y }]);
45-
return bn254.G1.Point.fromAffine(g1PointDigest);
45+
return bn254.G1.ProjectivePoint.fromAffine(g1PointDigest);
4646
}
4747

4848
public async makeRegistrationTuple(privateKey: bigint): Promise<RegistrationTuple> {
49-
const publicKeyG1 = bn254.G1.Point.BASE.multiply(privateKey);
49+
const publicKeyG1 = bn254.G1.ProjectivePoint.BASE.multiply(privateKey);
5050
const digest = await this.getRegistrationDigest(publicKeyG1);
5151
const signature = digest.multiply(privateKey);
52-
const publicKeyG2 = bn254.G2.Point.BASE.multiply(privateKey);
52+
const publicKeyG2 = bn254.G2.ProjectivePoint.BASE.multiply(privateKey);
5353
const publicKeyG1Affine = publicKeyG1.toAffine();
5454
const signatureAffine = signature.toAffine();
5555
const publicKeyG2Affine = publicKeyG2.toAffine();

yarn-project/ethereum/src/test/bn254_registration.test.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { bn254 } from '@noble/curves/bn254.js';
1+
import { bn254 } from '@noble/curves/bn254';
22
import { writeFile } from 'fs/promises';
33

44
// To update the test data, run "export AZTEC_GENERATE_TEST_DATA=1" in shell and run the tests again
@@ -9,21 +9,21 @@ describe('BN254 Registration', () => {
99
expect(bn254.fields.Fp.ORDER).toBe(21888242871839275222246405745257275088696311157297823662689037894645226208583n);
1010
expect(bn254.fields.Fr.ORDER).toBe(21888242871839275222246405745257275088548364400416034343698204186575808495617n);
1111

12-
const g1Base = bn254.G1.Point.BASE.toAffine();
12+
const g1Base = bn254.G1.ProjectivePoint.BASE.toAffine();
1313
expect(g1Base.x).toBe(1n);
1414
expect(g1Base.y).toBe(2n);
1515

16-
const negativeG1 = bn254.G1.Point.ZERO.subtract(bn254.G1.Point.BASE).toAffine();
16+
const negativeG1 = bn254.G1.ProjectivePoint.ZERO.subtract(bn254.G1.ProjectivePoint.BASE).toAffine();
1717
expect(negativeG1.x).toBe(1n);
1818
expect(negativeG1.y).toBe(21888242871839275222246405745257275088696311157297823662689037894645226208581n);
1919

20-
const g2Base = bn254.G2.Point.BASE.toAffine();
20+
const g2Base = bn254.G2.ProjectivePoint.BASE.toAffine();
2121
expect(g2Base.x.c0).toBe(10857046999023057135944570762232829481370756359578518086990519993285655852781n);
2222
expect(g2Base.x.c1).toBe(11559732032986387107991004021392285783925812861821192530917403151452391805634n);
2323
expect(g2Base.y.c0).toBe(8495653923123431417604973247489272438418190587263600148770280649306958101930n);
2424
expect(g2Base.y.c1).toBe(4082367875863433681332203403145435568316851327593401208105741076214120093531n);
2525

26-
const negativeG2 = bn254.G2.Point.ZERO.subtract(bn254.G2.Point.BASE).toAffine();
26+
const negativeG2 = bn254.G2.ProjectivePoint.ZERO.subtract(bn254.G2.ProjectivePoint.BASE).toAffine();
2727
expect(negativeG2.x.c0).toBe(10857046999023057135944570762232829481370756359578518086990519993285655852781n);
2828
expect(negativeG2.x.c1).toBe(11559732032986387107991004021392285783925812861821192530917403151452391805634n);
2929
expect(negativeG2.y.c0).toBe(13392588948715843804641432497768002650278120570034223513918757245338268106653n);
@@ -36,10 +36,10 @@ describe('BN254 Registration', () => {
3636
const keys = [];
3737
for (let i = 0; i < keysToGenerate; i++) {
3838
const sk = startingScalar + BigInt(i);
39-
const pk1Weierstrass = bn254.G1.Point.BASE.multiply(sk);
40-
const negativePk1Weierstrass = bn254.G1.Point.ZERO.subtract(pk1Weierstrass);
41-
const pk2Weierstrass = bn254.G2.Point.BASE.multiply(sk);
42-
const negativePk2Weierstrass = bn254.G2.Point.ZERO.subtract(pk2Weierstrass);
39+
const pk1Weierstrass = bn254.G1.ProjectivePoint.BASE.multiply(sk);
40+
const negativePk1Weierstrass = bn254.G1.ProjectivePoint.ZERO.subtract(pk1Weierstrass);
41+
const pk2Weierstrass = bn254.G2.ProjectivePoint.BASE.multiply(sk);
42+
const negativePk2Weierstrass = bn254.G2.ProjectivePoint.ZERO.subtract(pk2Weierstrass);
4343

4444
const pk1 = pk1Weierstrass.toAffine();
4545
const negativePk1 = negativePk1Weierstrass.toAffine();

yarn-project/foundation/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@
104104
"dependencies": {
105105
"@aztec/bb.js": "portal:../../barretenberg/ts",
106106
"@koa/cors": "^5.0.0",
107-
"@noble/curves": "^1.2.0",
107+
"@noble/curves": "=1.2.0",
108108
"bn.js": "^5.2.1",
109109
"colorette": "^2.0.20",
110110
"detect-node": "^2.1.0",

yarn-project/yarn.lock

Lines changed: 37 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -581,7 +581,7 @@ __metadata:
581581
"@aztec/world-state": "workspace:^"
582582
"@iarna/toml": "npm:^2.2.5"
583583
"@jest/globals": "npm:^30.0.0"
584-
"@noble/curves": "npm:^1.0.0"
584+
"@noble/curves": "npm:=1.0.0"
585585
"@swc/core": "npm:^1.4.11"
586586
"@swc/jest": "npm:^0.2.36"
587587
"@types/fs-extra": "npm:^11.0.2"
@@ -673,7 +673,7 @@ __metadata:
673673
"@aztec/foundation": "workspace:^"
674674
"@aztec/l1-artifacts": "workspace:^"
675675
"@jest/globals": "npm:^30.0.0"
676-
"@noble/curves": "npm:^1.7.0"
676+
"@noble/curves": "npm:=1.7.0"
677677
"@types/jest": "npm:^30.0.0"
678678
"@types/lodash.pickby": "npm:^4"
679679
"@types/node": "npm:^22.15.17"
@@ -700,7 +700,7 @@ __metadata:
700700
"@jest/globals": "npm:^30.0.0"
701701
"@koa/cors": "npm:^5.0.0"
702702
"@libp2p/interface": "npm:1.3.1"
703-
"@noble/curves": "npm:^1.2.0"
703+
"@noble/curves": "npm:=1.2.0"
704704
"@types/detect-node": "npm:^2.0.0"
705705
"@types/jest": "npm:^30.0.0"
706706
"@types/koa": "npm:^2.15.0"
@@ -4575,16 +4575,25 @@ __metadata:
45754575
languageName: node
45764576
linkType: hard
45774577

4578-
"@noble/curves@npm:^1.0.0, @noble/curves@npm:^1.1.0, @noble/curves@npm:^1.2.0, @noble/curves@npm:^1.4.0":
4579-
version: 1.4.0
4580-
resolution: "@noble/curves@npm:1.4.0"
4578+
"@noble/curves@npm:=1.0.0":
4579+
version: 1.0.0
4580+
resolution: "@noble/curves@npm:1.0.0"
45814581
dependencies:
4582-
"@noble/hashes": "npm:1.4.0"
4583-
checksum: 10/b21b30a36ff02bfcc0f5e6163d245cdbaf7f640511fff97ccf83fc207ee79cfd91584b4d97977374de04cb118a55eb63a7964c82596a64162bbc42bc685ae6d9
4582+
"@noble/hashes": "npm:1.3.0"
4583+
checksum: 10/6db884e03b3f6c773317bcf4611bf1d9adb8084eab0bf6158407cc998c9c5dcb0560741bdd0aaca9c4393c9e8a3dcd7592b4148a6cfd561d0a00addb77a6129f
45844584
languageName: node
45854585
linkType: hard
45864586

4587-
"@noble/curves@npm:^1.3.0":
4587+
"@noble/curves@npm:=1.2.0":
4588+
version: 1.2.0
4589+
resolution: "@noble/curves@npm:1.2.0"
4590+
dependencies:
4591+
"@noble/hashes": "npm:1.3.2"
4592+
checksum: 10/94e02e9571a9fd42a3263362451849d2f54405cb3ce9fa7c45bc6b9b36dcd7d1d20e2e1e14cfded24937a13d82f1e60eefc4d7a14982ce0bc219a9fc0f51d1f9
4593+
languageName: node
4594+
linkType: hard
4595+
4596+
"@noble/curves@npm:=1.7.0, @noble/curves@npm:^1.3.0":
45884597
version: 1.7.0
45894598
resolution: "@noble/curves@npm:1.7.0"
45904599
dependencies:
@@ -4593,12 +4602,26 @@ __metadata:
45934602
languageName: node
45944603
linkType: hard
45954604

4596-
"@noble/curves@npm:^1.7.0":
4597-
version: 1.9.5
4598-
resolution: "@noble/curves@npm:1.9.5"
4605+
"@noble/curves@npm:^1.1.0, @noble/curves@npm:^1.4.0":
4606+
version: 1.4.0
4607+
resolution: "@noble/curves@npm:1.4.0"
45994608
dependencies:
4600-
"@noble/hashes": "npm:1.8.0"
4601-
checksum: 10/58bd7215c41b9562ac12b45245cc99c36575f805a15cea9e419d5017d12037a321ad6d997e0829f55b05f18ce2338a1ba733b6d79e76fd63f379e45555e9acff
4609+
"@noble/hashes": "npm:1.4.0"
4610+
checksum: 10/b21b30a36ff02bfcc0f5e6163d245cdbaf7f640511fff97ccf83fc207ee79cfd91584b4d97977374de04cb118a55eb63a7964c82596a64162bbc42bc685ae6d9
4611+
languageName: node
4612+
linkType: hard
4613+
4614+
"@noble/hashes@npm:1.3.0":
4615+
version: 1.3.0
4616+
resolution: "@noble/hashes@npm:1.3.0"
4617+
checksum: 10/4680a71941c06ac897cc9eab9d229717d5af1147cea5e8cd4942190c817426ad3173ded750d897f58d764b869f9347d4fc3f6b3c16574541ac81906efa9ddc36
4618+
languageName: node
4619+
linkType: hard
4620+
4621+
"@noble/hashes@npm:1.3.2":
4622+
version: 1.3.2
4623+
resolution: "@noble/hashes@npm:1.3.2"
4624+
checksum: 10/685f59d2d44d88e738114b71011d343a9f7dce9dfb0a121f1489132f9247baa60bc985e5ec6f3213d114fbd1e1168e7294644e46cbd0ce2eba37994f28eeb51b
46024625
languageName: node
46034626
linkType: hard
46044627

@@ -4630,13 +4653,6 @@ __metadata:
46304653
languageName: node
46314654
linkType: hard
46324655

4633-
"@noble/hashes@npm:1.8.0":
4634-
version: 1.8.0
4635-
resolution: "@noble/hashes@npm:1.8.0"
4636-
checksum: 10/474b7f56bc6fb2d5b3a42132561e221b0ea4f91e590f4655312ca13667840896b34195e2b53b7f097ec080a1fdd3b58d902c2a8d0fbdf51d2e238b53808a177e
4637-
languageName: node
4638-
linkType: hard
4639-
46404656
"@noble/hashes@npm:^1.3.3":
46414657
version: 1.6.1
46424658
resolution: "@noble/hashes@npm:1.6.1"

0 commit comments

Comments
 (0)