Skip to content

Commit

Permalink
Merge branch 'main' into fix-list-limit
Browse files Browse the repository at this point in the history
  • Loading branch information
Trivo25 committed Dec 4, 2024
2 parents fc9a389 + bc9435e commit 900b22f
Show file tree
Hide file tree
Showing 16 changed files with 428 additions and 56 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/benchmarks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
workflow_dispatch: {}

concurrency:
group: ${{ github.ref }}
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
Expand Down
14 changes: 13 additions & 1 deletion .github/workflows/build-action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:
workflow_dispatch: {}

concurrency:
group: ${{ github.ref }}
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
Expand Down Expand Up @@ -301,13 +301,25 @@ jobs:
run: |
npm ci
npm run prepublishOnly
- name: Publish to NPM if version has changed
id: publish
uses: JS-DevTools/npm-publish@v3
with:
token: ${{ secrets.NPM_TOKEN }}
strategy: upgrade
env:
INPUT_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Tag new version
if: ${{ steps.publish.outputs.type }} # https://github.com/JS-DevTools/npm-publish?tab=readme-ov-file#action-output
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RELEASED_VERSION: ${{ steps.publish.outputs.version }}
run: |
git tag $RELEASED_VERSION
git push origin $RELEASED_VERSION
Release-mina-signer-on-NPM:
if: github.ref == 'refs/heads/main'
Expand Down
21 changes: 16 additions & 5 deletions .github/workflows/build-bindings.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Purpose: We want to build the o1js bindings in CI so that people in the
# Purpose: We want to build the o1js bindings in CI so that people in the
# community can change them without being scared of breaking things, or
# needing to do the complicated (without nix) build setup.

Expand All @@ -7,19 +7,30 @@ name: Build o1js bindings
on:
pull_request:

jobs:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
nix-build:
name: build-bindings-ubuntu
runs-on: [sdk-self-hosted-linux-amd64-build-system]
steps:
- name: Set up Nix
run: echo "PATH=$PATH:/nix/var/nix/profiles/default/bin" >> $GITHUB_ENV
- name: Disable smudging
run: echo "GIT_LFS_SKIP_SMUDGE=1" >> $GITHUB_ENV
- uses: actions/checkout@v4
with:
submodules: recursive
- run: |
- name: Build the o1js bindings
run: |
set -Eeu
# Until we restart the runner and the PATH gets updated from /etc/bash.bashrc
export PATH="$PATH":/nix/var/nix/profiles/default/bin
./pin.sh
nix develop o1js --command bash -c "npm run build:update-bindings"
- name: Cleanup the Nix store
run: |
nix-env --delete-generations old
nix-collect-garbage -d --quiet
nix-store --gc --print-dead
nix-store --optimise
4 changes: 4 additions & 0 deletions .github/workflows/doc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ on:
branches:
- main

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
Build-Doc:
runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/live-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ on:
workflow_dispatch: {}

concurrency:
group: ${{ github.ref }}
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
Expand Down
7 changes: 0 additions & 7 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,6 @@ jobs:
git add CHANGELOG.md
git commit -m "Update CHANGELOG for new version $NEW_VERSION"
- name: Delete existing release tag
run: |
if git rev-parse $NEW_VERSION >/dev/null 2>&1; then
git tag -d $NEW_VERSION
git push origin :refs/tags/$NEW_VERSION
fi
- name: Delete existing release branch
run: |
if git ls-remote --heads origin release/${NEW_VERSION} | grep release/${NEW_VERSION}; then
Expand Down
9 changes: 6 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,19 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm

### Added

- Increased maximum supported amount of methods in a `SmartContract` or `ZkProgram` to 30. https://github.com/o1-labs/o1js/pull/1918
-`ZkProgram` to support non-pure provable types as inputs and outputs https://github.com/o1-labs/o1js/pull/1828

- Add `enforceTransactionLimits` parameter on Network https://github.com/o1-labs/o1js/issues/1910

- Method for optional types to assert none https://github.com/o1-labs/o1js/pull/1922

### Fixed

- Compiling stuck in the browser for recursive zkprograms https://github.com/o1-labs/o1js/pull/1906
- Error message in `rangeCheck16` gadget https://github.com/o1-labs/o1js/pull/1920

## [2.1.0](https://github.com/o1-labs/o1js/compare/b04520d...e1bac02) - 2024-11-13

### Added

- Support secp256r1 in elliptic curve and ECDSA gadgets https://github.com/o1-labs/o1js/pull/1885

### Fixed
Expand Down
62 changes: 62 additions & 0 deletions src/examples/zkprogram/program-with-non-pure-input.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
import { Field, Struct, ZkProgram, assert } from 'o1js';

class MyStruct extends Struct({
label: String,
value: Field,
}) {}

let NonPureIOprogram = ZkProgram({
name: 'example-with-non-pure-io',
publicInput: MyStruct,
publicOutput: MyStruct,

methods: {
baseCase: {
privateInputs: [],
async method(input: MyStruct) {
//update input in circuit
input.label = 'in-circuit';
return {
publicOutput: input,
};
},
},
},
});

let NonPureOutputProgram = ZkProgram({
name: 'example-with-non-pure-output',
publicOutput: MyStruct,

methods: {
baseCase: {
privateInputs: [],
async method() {
return {
publicOutput: new MyStruct({ label: 'output', value: Field(5) }),
};
},
},
},
});

console.log('compiling NonPureIOprogram...');
await NonPureIOprogram.compile();
console.log('compile done');
let input = new MyStruct({ label: 'input', value: Field(5) });
let proof;
({ proof } = await NonPureIOprogram.baseCase(input));
let isProof1Valid = await NonPureIOprogram.verify(proof);
assert(isProof1Valid, 'proof not valid!');
assert(proof.publicOutput.label === 'in-circuit');
console.log('i/o proof', proof);

console.log('compiling NonPureOutputProgram...');
await NonPureOutputProgram.compile();
console.log('compile done');

({ proof } = await NonPureOutputProgram.baseCase());
let isProof2Valid = await NonPureOutputProgram.verify(proof);
assert(isProof2Valid, 'proof not valid!');
assert(proof.publicOutput.label === 'output');
console.log('output proof', proof);
Loading

0 comments on commit 900b22f

Please sign in to comment.