Skip to content

Commit 5fe68ef

Browse files
authored
Merge pull request #1918 from o1-labs/fix-list-limit
Increase max branches in a circuit
2 parents bc9435e + 18faf88 commit 5fe68ef

File tree

3 files changed

+35
-2
lines changed

3 files changed

+35
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
2222
-`ZkProgram` to support non-pure provable types as inputs and outputs https://github.com/o1-labs/o1js/pull/1828
2323

2424
- Add `enforceTransactionLimits` parameter on Network https://github.com/o1-labs/o1js/issues/1910
25-
2625
- Method for optional types to assert none https://github.com/o1-labs/o1js/pull/1922
26+
- Increased maximum supported amount of methods in a `SmartContract` or `ZkProgram` to 30. https://github.com/o1-labs/o1js/pull/1918
2727

2828
### Fixed
2929

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import { Field } from '../provable/wrapped.js';
2+
import { ZkProgram } from './zkprogram.js';
3+
4+
const methodCount = 30;
5+
6+
let MyProgram = ZkProgram({
7+
name: 'large-program',
8+
publicOutput: Field,
9+
methods: nMethods(methodCount),
10+
});
11+
12+
function nMethods(i: number) {
13+
let methods: Record<string, any> = {};
14+
for (let j = 0; j < i; j++) {
15+
methods['method' + j] = {
16+
privateInputs: [Field],
17+
async method(a: Field) {
18+
return {
19+
publicOutput: a.mul(1),
20+
};
21+
},
22+
};
23+
}
24+
return methods;
25+
}
26+
27+
try {
28+
await MyProgram.compile();
29+
} catch (error) {
30+
throw Error(
31+
`Could not compile zkProgram with ${methodCount} branches: ${error}`
32+
);
33+
}

0 commit comments

Comments
 (0)