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

Increase max branches in a circuit #1918

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm

## [Unreleased](https://github.com/o1-labs/o1js/compare/e1bac02...HEAD)

### Added

- Increased maximum supported amount of methods in a `SmartContract` or `ZkProgram` to 30. https://github.com/o1-labs/o1js/pull/1918

### Fixed

- Compiling stuck in the browser for recursive zkprograms https://github.com/o1-labs/o1js/pull/1906
Expand Down
33 changes: 33 additions & 0 deletions src/lib/proof-system/zkprogram.unit-test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { Field } from '../provable/wrapped.js';
import { ZkProgram } from './zkprogram.js';

const methodCount = 30;

let MyProgram = ZkProgram({
name: 'large-program',
publicOutput: Field,
methods: nMethods(methodCount),
});

function nMethods(i: number) {
let methods: Record<string, any> = {};
for (let j = 0; j < i; j++) {
methods['method' + j] = {
privateInputs: [Field],
async method(a: Field) {
return {
publicOutput: a.mul(1),
};
},
};
}
return methods;
}

try {
await MyProgram.compile();
} catch (error) {
throw Error(
`Could not compile zkProgram with ${methodCount} branches: ${error}`
);
}
Loading