Skip to content

Commit

Permalink
Merge pull request #1918 from o1-labs/fix-list-limit
Browse files Browse the repository at this point in the history
Increase max branches in a circuit
  • Loading branch information
Trivo25 authored Dec 4, 2024
2 parents bc9435e + 18faf88 commit 5fe68ef
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 2 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
-`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
- Increased maximum supported amount of methods in a `SmartContract` or `ZkProgram` to 30. https://github.com/o1-labs/o1js/pull/1918

### Fixed

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}`
);
}

0 comments on commit 5fe68ef

Please sign in to comment.