Skip to content

Commit 4d6b933

Browse files
ymekuriashimkiv
andauthored
Release 0.19.0 (#606)
Co-authored-by: Serhii Shymkiv <sergey@shimkiv.com>
1 parent 1f2e2dd commit 4d6b933

File tree

18 files changed

+1879
-6518
lines changed

18 files changed

+1879
-6518
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
1717

1818
## Unreleased
1919

20+
## [0.19.0](https://github.com/o1-labs/zkapp-cli/compare/v18.0...v19.0) - 2024-03-06
21+
22+
### Breaking changes
23+
24+
- The CLI, templates, and examples have been updated to be compatible with the latest version `0.18.0` of `o1js` that was released to be compatible with the `Devnet` upgrade. This includes updating all code with async circuits, and removing all deprecated APIs. [#606](https://github.com/o1-labs/zkapp-cli/pull/606)
25+
2026
### Changed
2127

2228
- Add support to deploy smart contracts that verify ZkProgram proofs. [#547](https://github.com/o1-labs/zkapp-cli/pull/547)

examples/sudoku/ts/src/run.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@ const zkApp = new SudokuZkApp(zkAppAddress);
2626

2727
console.log('Deploying and initializing Sudoku...');
2828
await SudokuZkApp.compile();
29-
let tx = await Mina.transaction(sender, () => {
29+
let tx = await Mina.transaction(sender, async () => {
3030
AccountUpdate.fundNewAccount(sender);
31-
zkApp.deploy();
32-
zkApp.update(Sudoku.from(sudoku));
31+
await zkApp.deploy();
32+
await zkApp.update(Sudoku.from(sudoku));
3333
});
3434
await tx.prove();
3535
/**
@@ -52,8 +52,8 @@ noSolution[0][0] = (noSolution[0][0] % 9) + 1;
5252

5353
console.log('Submitting wrong solution...');
5454
try {
55-
let tx = await Mina.transaction(sender, () => {
56-
zkApp.submitSolution(Sudoku.from(sudoku), Sudoku.from(noSolution));
55+
let tx = await Mina.transaction(sender, async () => {
56+
await zkApp.submitSolution(Sudoku.from(sudoku), Sudoku.from(noSolution));
5757
});
5858
await tx.prove();
5959
await tx.sign([senderKey]).send();
@@ -65,8 +65,8 @@ console.log('Is the sudoku solved?', zkApp.isSolved.get().toBoolean());
6565

6666
// submit the actual solution
6767
console.log('Submitting solution...');
68-
tx = await Mina.transaction(sender, () => {
69-
zkApp.submitSolution(Sudoku.from(sudoku), Sudoku.from(solution!));
68+
tx = await Mina.transaction(sender, async () => {
69+
await zkApp.submitSolution(Sudoku.from(sudoku), Sudoku.from(solution!));
7070
});
7171
await tx.prove();
7272
await tx.sign([senderKey]).send();

examples/sudoku/ts/src/sudoku.test.ts

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ describe('sudoku', () => {
2929

3030
let solution = solveSudoku(sudoku);
3131
if (solution === undefined) throw Error('cannot happen');
32-
let tx = await Mina.transaction(sender, () => {
32+
let tx = await Mina.transaction(sender, async () => {
3333
let zkApp = new SudokuZkApp(zkAppAddress);
34-
zkApp.submitSolution(Sudoku.from(sudoku), Sudoku.from(solution!));
34+
await zkApp.submitSolution(Sudoku.from(sudoku), Sudoku.from(solution!));
3535
});
3636
await tx.prove();
3737
await tx.sign([senderKey]).send();
@@ -50,9 +50,12 @@ describe('sudoku', () => {
5050
noSolution[0][0] = (noSolution[0][0] % 9) + 1;
5151

5252
await expect(async () => {
53-
let tx = await Mina.transaction(sender, () => {
53+
let tx = await Mina.transaction(sender, async () => {
5454
let zkApp = new SudokuZkApp(zkAppAddress);
55-
zkApp.submitSolution(Sudoku.from(sudoku), Sudoku.from(noSolution));
55+
await zkApp.submitSolution(
56+
Sudoku.from(sudoku),
57+
Sudoku.from(noSolution)
58+
);
5659
});
5760
await tx.prove();
5861
await tx.sign([senderKey]).send();
@@ -70,10 +73,10 @@ async function deploy(
7073
sender: PublicKey,
7174
senderKey: PrivateKey
7275
) {
73-
let tx = await Mina.transaction(sender, () => {
76+
let tx = await Mina.transaction(sender, async () => {
7477
AccountUpdate.fundNewAccount(sender);
75-
zkApp.deploy();
76-
zkApp.update(Sudoku.from(sudoku));
78+
await zkApp.deploy();
79+
await zkApp.update(Sudoku.from(sudoku));
7780
});
7881
await tx.prove();
7982
// this tx needs .sign(), because `deploy()` adds an account update that requires signature authorization

examples/sudoku/ts/src/sudoku.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,16 +34,19 @@ class SudokuZkApp extends SmartContract {
3434
* to ensure the entire state is overwritten.
3535
* however, it's good to have an example which tests the CLI's ability to handle init() decorated with `@method`.
3636
*/
37-
@method init() {
37+
@method async init() {
3838
super.init();
3939
}
4040

41-
@method update(sudokuInstance: Sudoku) {
41+
@method async update(sudokuInstance: Sudoku) {
4242
this.sudokuHash.set(sudokuInstance.hash());
4343
this.isSolved.set(Bool(false));
4444
}
4545

46-
@method submitSolution(sudokuInstance: Sudoku, solutionInstance: Sudoku) {
46+
@method async submitSolution(
47+
sudokuInstance: Sudoku,
48+
solutionInstance: Sudoku
49+
) {
4750
let sudoku = sudokuInstance.value;
4851
let solution = solutionInstance.value;
4952

examples/tictactoe/ts/src/run.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@ const zkApp = new TicTacToe(zkAppPublicKey);
3333

3434
// Create a new instance of the contract
3535
console.log('\n\n====== DEPLOYING ======\n\n');
36-
const txn = await Mina.transaction(player1, () => {
36+
const txn = await Mina.transaction(player1, async () => {
3737
AccountUpdate.fundNewAccount(player1);
38-
zkApp.deploy();
39-
zkApp.startGame(player1, player2);
38+
await zkApp.deploy();
39+
await zkApp.startGame(player1, player2);
4040
});
4141
await txn.prove();
4242
/**
@@ -115,7 +115,7 @@ async function makeMove(
115115
const [x, y] = [Field(x0), Field(y0)];
116116
const txn = await Mina.transaction(currentPlayer, async () => {
117117
const signature = Signature.create(currentPlayerKey, [x, y]);
118-
zkApp.play(currentPlayer, signature, x, y);
118+
await zkApp.play(currentPlayer, signature, x, y);
119119
});
120120
await txn.prove();
121121
await txn.sign([currentPlayerKey]).send();

examples/tictactoe/ts/src/tictactoe.test.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ describe('tictactoe', () => {
2727

2828
it('generates and deploys tictactoe', async () => {
2929
const zkApp = new TicTacToe(zkAppAddress);
30-
const txn = await Mina.transaction(player1, () => {
30+
const txn = await Mina.transaction(player1, async () => {
3131
AccountUpdate.fundNewAccount(player1);
32-
zkApp.deploy();
33-
zkApp.startGame(player1, player2);
32+
await zkApp.deploy();
33+
await zkApp.startGame(player1, player2);
3434
});
3535
await txn.prove();
3636
await txn.sign([zkAppPrivateKey, player1Key]).send();
@@ -42,10 +42,10 @@ describe('tictactoe', () => {
4242
const zkApp = new TicTacToe(zkAppAddress);
4343

4444
// deploy
45-
let txn = await Mina.transaction(player1, () => {
45+
let txn = await Mina.transaction(player1, async () => {
4646
AccountUpdate.fundNewAccount(player1);
47-
zkApp.deploy();
48-
zkApp.startGame(player1, player2);
47+
await zkApp.deploy();
48+
await zkApp.startGame(player1, player2);
4949
});
5050
await txn.prove();
5151
await txn.sign([zkAppPrivateKey, player1Key]).send();

examples/tictactoe/ts/src/tictactoe.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ class TicTacToe extends SmartContract {
157157
this.player2.set(PublicKey.empty());
158158
}
159159

160-
@method startGame(player1: PublicKey, player2: PublicKey) {
160+
@method async startGame(player1: PublicKey, player2: PublicKey) {
161161
// you can only start a new game if the current game is done
162162
this.gameDone.requireEquals(Bool(true));
163163
this.gameDone.set(Bool(false));
@@ -176,7 +176,12 @@ class TicTacToe extends SmartContract {
176176
// 0 | x x x
177177
// 1 | x x x
178178
// 2 | x x x
179-
@method play(pubkey: PublicKey, signature: Signature, x: Field, y: Field) {
179+
@method async play(
180+
pubkey: PublicKey,
181+
signature: Signature,
182+
x: Field,
183+
y: Field
184+
) {
180185
// 1. if the game is already finished, abort.
181186
this.gameDone.requireEquals(Bool(false)); // precondition on this.gameDone
182187

0 commit comments

Comments
 (0)