Skip to content
Open
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
36 changes: 36 additions & 0 deletions .github/workflows/pkg_pr_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: pkg.pr preview release

on:
pull_request:
# Run the workflow when labels are added to a PR or when the PR is updated.
types:
- opened
- synchronize
- labeled
- reopened

permissions:
# Allow the workflow to add comments to pull requests when publishing.
pull-requests: write

jobs:
Pkg-pr-new:
# Only run this job when the pull request contains the pkg‑pr‑release label.
if: github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'pkg-pr-release')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Node.JS 20
uses: actions/setup-node@v4
with:
node-version: 20
- name: build
uses: ./.github/actions/build
- name: Build o1js and mina-signer
run: |
npm run prepublish:full
cd src/mina-signer
npm ci
npm run prepublish:full
- name: Publish o1js and mina-signer on pkg-pr-new
run: npx pkg-pr-new publish ./ ./src/mina-signer # Enable `--compact` once published to NPM with `repository` in package.json
2 changes: 1 addition & 1 deletion npmDepsHash
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sha256-ww0EdkEWiciR6XLTu2/lfqtDMbvIDBLj+gyPH+lpLTE=
sha256-xGz183aZzn46B0pSwmy9oOCNujTLDQwlDBMbVLfAodA=
9 changes: 1 addition & 8 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
},
"keywords": [
"mina",
"zkapp",

Check warning on line 16 in package.json

View workflow job for this annotation

GitHub Actions / Lint-Format-and-TypoCheck

Unknown word (zkapp)
"zk",
"smart contract",
"cryptography",
Expand Down Expand Up @@ -86,12 +86,11 @@
},
"author": "O(1) Labs",
"devDependencies": {
"@influxdata/influxdb-client": "^1.33.2",

Check warning on line 89 in package.json

View workflow job for this annotation

GitHub Actions / Lint-Format-and-TypoCheck

Unknown word (influxdata)
"@noble/curves": "1.8.1",
"@noble/hashes": "^1.3.2",
"@playwright/test": "^1.48.0",
"@types/jest": "^27.0.0",
"@types/libsodium-wrappers-sumo": "^0.7.8",

Check warning on line 93 in package.json

View workflow job for this annotation

GitHub Actions / Lint-Format-and-TypoCheck

Unknown word (libsodium)
"@types/minimist": "^1.2.5",
"@types/node": "^18.14.2",
"esbuild": "^0.25.5",
Expand All @@ -101,7 +100,7 @@
"graphql": "^16.10.0",
"husky": "^9.1.7",
"jest": "^28.1.3",
"jstat": "^1.9.6",

Check warning on line 103 in package.json

View workflow job for this annotation

GitHub Actions / Lint-Format-and-TypoCheck

Unknown word (jstat)
"minimist": "^1.2.7",
"oxlint": "^1.0.0",
"pkg-pr-new": "^0.0.9",
Expand All @@ -116,10 +115,10 @@
"typescript": "^5.4.5"
},
"dependencies": {
"@noble/hashes": "^1.7.1",
"blakejs": "1.2.1",

Check warning on line 119 in package.json

View workflow job for this annotation

GitHub Actions / Lint-Format-and-TypoCheck

Unknown word (blakejs)
"cachedir": "^2.4.0",

Check warning on line 120 in package.json

View workflow job for this annotation

GitHub Actions / Lint-Format-and-TypoCheck

Unknown word (cachedir)
"js-sha256": "^0.9.0",
"libsodium-wrappers-sumo": "^0.7.15",

Check warning on line 121 in package.json

View workflow job for this annotation

GitHub Actions / Lint-Format-and-TypoCheck

Unknown word (libsodium)
"reflect-metadata": "^0.1.13",
"stacktrace-js": "^2.0.2",
"tslib": "^2.3.0"
Expand Down
14 changes: 7 additions & 7 deletions src/lib/provable/gadgets/elliptic-curve.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import { assert } from './common.js';
import { Field3, ForeignField, split, weakBound } from './foreign-field.js';
import { l, l2, l2Mask, multiRangeCheck } from './range-check.js';
import { sha256 } from 'js-sha256';
import { sha256 } from '@noble/hashes/sha256';
import { bigIntToBytes, bytesToBigInt } from '../../../bindings/crypto/bigint-helpers.js';
import {
CurveAffine,
Expand Down Expand Up @@ -201,7 +201,7 @@

// checks whether the elliptic curve point g is in the subgroup defined by [order]g = 0
function assertInSubgroup(p: Point, Curve: CurveAffine) {
if (!Curve.hasCofactor) return;

Check warning on line 204 in src/lib/provable/gadgets/elliptic-curve.ts

View workflow job for this annotation

GitHub Actions / Lint-Format-and-TypoCheck

Unknown word (Cofactor)
scale(Field3.from(Curve.order), p, Curve, { mode: 'assert-zero' });
}

Expand Down Expand Up @@ -341,7 +341,7 @@
) {
let pk = Curve.from(publicKey);
if (Curve.equal(pk, Curve.zero)) return false;
if (Curve.hasCofactor && !Curve.isInSubgroup(pk)) return false;

Check warning on line 344 in src/lib/provable/gadgets/elliptic-curve.ts

View workflow job for this annotation

GitHub Actions / Lint-Format-and-TypoCheck

Unknown word (Cofactor)
if (r < 1n || r >= Curve.order) return false;
if (s < 1n || s >= Curve.order) return false;

Expand Down Expand Up @@ -373,7 +373,7 @@
let sum: GroupAffine = Curve.zero;
for (let i = 0; i < n; i++) {
if (useGlv) {
sum = Curve.add(sum, Curve.Endo.scale(P[i], s[i]));

Check warning on line 376 in src/lib/provable/gadgets/elliptic-curve.ts

View workflow job for this annotation

GitHub Actions / Lint-Format-and-TypoCheck

Unknown word (Endo)
} else {
sum = Curve.add(sum, Curve.scale(P[i], s[i]));
}
Expand Down Expand Up @@ -626,12 +626,12 @@
function initialAggregator(Curve: CurveAffine) {
// hash that identifies the curve
let h = sha256.create();
h.update('initial-aggregator');
h.update(bigIntToBytes(Curve.modulus));
h.update(bigIntToBytes(Curve.order));
h.update(bigIntToBytes(Curve.a));
h.update(bigIntToBytes(Curve.b));
let bytes = h.array();
h.update(new TextEncoder().encode('initial-aggregator'));
h.update(new Uint8Array(bigIntToBytes(Curve.modulus)));
h.update(new Uint8Array(bigIntToBytes(Curve.order)));
h.update(new Uint8Array(bigIntToBytes(Curve.a)));
h.update(new Uint8Array(bigIntToBytes(Curve.b)));
let bytes = h.digest();

// bytes represent a 256-bit number
// use that as x coordinate
Expand Down
9 changes: 5 additions & 4 deletions src/lib/util/base58.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { versionBytes } from '../../bindings/crypto/constants.js';
import { Binable, withVersionNumber } from '../../bindings/lib/binable.js';
import { sha256 } from 'js-sha256';
import { sha256 } from '@noble/hashes/sha256';
import { changeBase } from '../../bindings/crypto/bigint-helpers.js';

export { toBase58Check, fromBase58Check, base58, withBase58, fieldEncodings, Base58, alphabet };
Expand Down Expand Up @@ -62,11 +62,12 @@ function fromBase58(base58: string) {
}

function computeChecksum(input: number[] | Uint8Array) {
let inputBytes = input instanceof Uint8Array ? input : new Uint8Array(input);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: let inputBytes = new Uint8Array(input); should be enough

let hash1 = sha256.create();
hash1.update(input);
hash1.update(inputBytes);
let hash2 = sha256.create();
hash2.update(hash1.array());
return hash2.array().slice(0, 4);
hash2.update(hash1.digest());
return Array.from(hash2.digest().slice(0, 4));
}

type Base58<T> = {
Expand Down
21 changes: 14 additions & 7 deletions src/mina-signer/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/mina-signer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@
"README.md"
],
"dependencies": {
"blakejs": "^1.2.1",
"js-sha256": "^0.9.0"
"@noble/hashes": "^1.7.1",
"blakejs": "^1.2.1"
},
"devDependencies": {
"pkg-pr-new": "^0.0.9"
Expand Down
Loading