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

Account deriver #741

Merged
merged 188 commits into from
Feb 23, 2023
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
Show all changes
188 commits
Select commit Hold shift + click to select a range
8339069
add implicit account creation fee
mitschabaude May 4, 2022
76ce986
generated types
mitschabaude Oct 20, 2022
40c963d
fix ts & replace manual types with generated ones
mitschabaude Oct 20, 2022
89356e8
put access permission on example token contracts
mitschabaude Oct 20, 2022
51ffa4c
move rejected token access example to a unit test
mitschabaude Oct 20, 2022
449b57d
update bindings
mitschabaude Oct 20, 2022
82147c7
Merge branch 'main' into feature/add-access-permission
mrmr1993 Oct 31, 2022
b9e2a82
update snarky js bindings
Nov 10, 2022
080e3ed
Merge branch 'berkeley' of ssh://github.com/o1-labs/snarkyjs into rem…
Nov 15, 2022
f39745e
Merge branch 'berkeley' into remove-timestamp
Nov 15, 2022
c08cae2
add berkeley to branches we run CI on
mitschabaude Nov 16, 2022
681f098
remove more timestamp reference
Nov 16, 2022
19b7257
Merge commit '018f2ba8169efab78e14088e68d8197c3b89f2dd' into feature/…
mrmr1993 Nov 16, 2022
c0d5811
run update-snarkyjs-bindings
Nov 17, 2022
a1852b5
Merge branch 'remove-timestamp' of ssh://github.com/o1-labs/snarkyjs …
Nov 17, 2022
ed13f59
remove global_slot_since_hard_fork
Nov 17, 2022
b70aa0e
Merge branch 'berkeley' into feature/add-access-permission
mitschabaude Nov 21, 2022
efadaec
regenerate types
mitschabaude Nov 21, 2022
182c437
Merge branch 'main' into feature/add-access-permission
mitschabaude Nov 21, 2022
bc199d2
add access permission
mitschabaude Nov 21, 2022
728d111
fix generation of test vectors
mitschabaude Nov 21, 2022
992d4cc
update bindings
mitschabaude Nov 21, 2022
bd50ed5
fix build
mitschabaude Nov 21, 2022
43bc06f
Merge pull request #581 from o1-labs/merge-main
mitschabaude Nov 21, 2022
172a606
update snarkyjs
Nov 21, 2022
dd90b14
Merge branch 'berkeley' of ssh://github.com/o1-labs/snarkyjs into rem…
Nov 21, 2022
36c99ad
Merge branch 'berkeley' into feature/add-access-permission
mitschabaude Nov 22, 2022
d05c827
fix unit tests
Nov 22, 2022
9721695
update snarkyjs bindings
Nov 30, 2022
980202e
Merge branch 'berkeley' into feature/cs-berkeley
mitschabaude Dec 1, 2022
f3bf871
Merge pull request #617 from o1-labs/feature/cs-berkeley
mitschabaude Dec 1, 2022
6dc97d0
Merge commit '980202eeed2827fec3e4d604cd9ee07d22432ba3' into feature/…
mrmr1993 Dec 1, 2022
38fc90d
update snarkyjs bindings
Dec 1, 2022
03666c1
remove permissions special casing
mitschabaude Dec 2, 2022
df90454
Merge branch 'berkeley' of ssh://github.com/o1-labs/snarkyjs into rem…
Dec 2, 2022
9d0ee52
Fixup tests
mrmr1993 Dec 2, 2022
0adcfca
Merge branch 'feature/add-access-permission' into feature/add-access-…
mrmr1993 Dec 2, 2022
a33047c
auto-generated dummy account updates
mitschabaude Dec 6, 2022
28a6837
update bindings
mitschabaude Dec 6, 2022
2005e88
fix unit tests
mitschabaude Dec 6, 2022
8de6808
Array.fill is evil - fix bug in emptyValue()
mitschabaude Dec 6, 2022
64849ca
Merge pull request #622 from o1-labs/feature/permissions-hash-input
mitschabaude Dec 6, 2022
42895ad
Merge branch 'berkeley' of ssh://github.com/o1-labs/snarkyjs into rem…
Dec 6, 2022
0941555
Merge branch 'berkeley' into merge-main-to-berkeley
mitschabaude Dec 12, 2022
5bb548d
Merge pull request #560 from o1-labs/remove-timestamp
mitschabaude Dec 12, 2022
483baff
Merge branch 'berkeley' into merge-main-to-berkeley
mitschabaude Dec 12, 2022
1e30c3b
fix ci yaml
mitschabaude Dec 12, 2022
119d5e7
Merge pull request #642 from o1-labs/merge-main-to-berkeley
mitschabaude Dec 12, 2022
884b3c7
update snarky js bindings
Dec 13, 2022
d9b7a5d
test comment
Trivo25 Dec 14, 2022
926a9fc
rm test comment
Trivo25 Dec 14, 2022
82dedc8
Build new version of OCaml bindings
MartinMinkov Dec 14, 2022
45fc102
Update SnarkyJS OCaml bindings
MartinMinkov Dec 14, 2022
b8b1f2c
Fixes snarkyjs errors
bkase Dec 14, 2022
05c0cd8
fix ci
Trivo25 Dec 15, 2022
c81eea6
Merge commit '483baff2ac71c65f757c6717754de4ef152bc6a2' into HEAD
mrmr1993 Dec 15, 2022
dc58cdc
Reformats
bkase Dec 15, 2022
1702c8f
Fixes unit test
bkase Dec 15, 2022
ed8afd3
fix getActions call outside of checked computation
Trivo25 Dec 16, 2022
a01f946
wrap circuit.asprover
Trivo25 Dec 16, 2022
0e3ba99
dirty fix unit tests
Trivo25 Dec 16, 2022
b0d37eb
minor
Trivo25 Dec 16, 2022
e9b37dc
update bindings
Trivo25 Dec 16, 2022
21925b5
fix consistency tests
Trivo25 Dec 16, 2022
aa404fd
Updates comment on sequence-events -> actions
bkase Dec 16, 2022
aa750ae
Removes unnecessary comment
bkase Dec 16, 2022
2cbb66d
regenerate types
mitschabaude Dec 19, 2022
85c236b
get it to compile
mitschabaude Dec 19, 2022
6212ff3
fix mina unit test
mitschabaude Dec 19, 2022
fee5375
get vk hash from fetched / local account
mitschabaude Dec 19, 2022
a66b898
fix hard coded a.u. in consistency test
mitschabaude Dec 19, 2022
d7a3fd8
Merge pull request #655 from o1-labs/feat/update-bindings-actions-rename
mitschabaude Dec 19, 2022
795b34c
Merge branch 'berkeley' into feature/vk-hash
mitschabaude Dec 19, 2022
aabb45c
update bindings
mitschabaude Dec 19, 2022
5e9b0a3
properly set vk hash in prover
mitschabaude Dec 20, 2022
f85d811
fix test
mitschabaude Dec 20, 2022
0aefb8d
Merge commit 'aa750aec4c862c8422dbde902dd3f0e9cec4f631' into HEAD
mrmr1993 Dec 21, 2022
d92b56a
allow vk in cached account
mitschabaude Dec 21, 2022
e04491b
Merge branch 'berkeley' into feature/add-access-permission
mitschabaude Dec 21, 2022
8086e00
update bindings
mitschabaude Dec 21, 2022
627aa65
Merge commit 'aa750aec4c862c8422dbde902dd3f0e9cec4f631' into feature/…
mrmr1993 Dec 21, 2022
7082c28
Update test vector
mrmr1993 Dec 22, 2022
ce678aa
Ah good, now we have 2 copies of everything
mrmr1993 Dec 22, 2022
56639ab
Merge branch 'berkeley' of ssh://github.com/o1-labs/snarkyjs into add…
Jan 5, 2023
2fd50f7
Merge branch 'add-valid-until' of ssh://github.com/o1-labs/snarkyjs i…
Jan 5, 2023
e7bd4ad
update snarkyjs bindings
Jan 9, 2023
1bfa606
update preconditions and account_update
Jan 10, 2023
f82e67d
Add setTiming permission
mrmr1993 Jan 11, 2023
a9d8a27
Lets just pretend that having to do this is okay for now
mrmr1993 Jan 14, 2023
2eccbfb
valid_until to valid_while
Jan 17, 2023
1dcb867
Merge commit '0aefb8db9de82556dcd15c3556cbcd507947d10b' into HEAD
mrmr1993 Jan 17, 2023
46c24dc
Use a record for call-type
mrmr1993 Jan 17, 2023
a962876
:|
mrmr1993 Jan 17, 2023
afd778e
Merge branch 'feature/implicit-account-creation-fee' into feature/add…
mitschabaude Jan 18, 2023
5a89fd3
update bindings
mitschabaude Jan 18, 2023
8511a2a
Merge commit '1dcb86738b5425f0f110685949388e9157854f3e' into HEAD
mrmr1993 Jan 18, 2023
048a039
Merge branch 'matt/i-dont-think-furious-quite-captures-it' into matt/…
mrmr1993 Jan 18, 2023
ccc5ec8
Merge commit '1dcb86738b5425f0f110685949388e9157854f3e' into HEAD
mrmr1993 Jan 18, 2023
d668868
fix integers stubs
Jan 18, 2023
d26e963
Merge pull request #500 from o1-labs/feature/add-access-permission
mitschabaude Jan 18, 2023
f7c4d72
Merge branch 'berkeley' into matt/i-dont-think-furious-quite-captures-it
mitschabaude Jan 19, 2023
1938e9a
revert some changes
mitschabaude Jan 19, 2023
d8ebbf8
move extra calltype field into account update
mitschabaude Jan 19, 2023
c89f5bb
fix account update test
mitschabaude Jan 19, 2023
bd0fc22
fixup
mitschabaude Jan 19, 2023
2dd4aad
fixup
mitschabaude Jan 19, 2023
f760406
update bindings
mitschabaude Jan 19, 2023
f873d8a
expose json constraint system (w/o proper type)
mitschabaude Jan 11, 2023
490f4d3
parse constraint system into nice js type
mitschabaude Jan 19, 2023
8f751b5
add a (not very useful) example of usage
mitschabaude Jan 19, 2023
b12b050
update bindings
mitschabaude Jan 19, 2023
790d6ca
start call type unit test
mitschabaude Jan 19, 2023
afcb2d3
roll back fancy names for now
mitschabaude Jan 19, 2023
2f13931
shutdown
mitschabaude Jan 19, 2023
e1a8dbb
add comment
mitschabaude Jan 19, 2023
e979c06
Merge pull request #703 from o1-labs/matt/i-dont-think-furious-quite-…
mitschabaude Jan 19, 2023
417e98c
Merge pull request #687 from o1-labs/feature/json-cs
mitschabaude Jan 19, 2023
792c319
Merge branch 'berkeley' of ssh://github.com/o1-labs/snarkyjs into add…
Jan 19, 2023
fcdff59
update snarky-js bindings
Jan 19, 2023
c0c844e
update snarkyjs bindings
Jan 20, 2023
9f13c29
do increment global slot
Jan 20, 2023
6a7889f
Merge pull request #649 from o1-labs/add-valid-until
nicc Jan 23, 2023
fb1ce50
Merge commit '8511a2ad325bfee7ded54348cacae49798d1fa00' into feature/…
mrmr1993 Jan 23, 2023
2293762
Merge branch 'origin/feature/setTiming-permission' into feature/setTi…
mrmr1993 Jan 23, 2023
aaf191a
Re-add useFullCommitment to hard-coded JSON
mrmr1993 Jan 23, 2023
2c80184
Update naming for better default behavior
mrmr1993 Jan 23, 2023
49b0f42
Merge commit '9f13c291c8facf25386889de723eb309bba55b36' into matt/eve…
mrmr1993 Jan 23, 2023
0285f08
Renaming in JS layout
mrmr1993 Jan 23, 2023
2c85be1
Make JSON printing not miserable, reduce scope of future merge conflicts
mrmr1993 Jan 24, 2023
ba387f7
Merge branch 'berkeley' into feature/vk-hash
mitschabaude Jan 25, 2023
32c4caa
regenerate types
mitschabaude Jan 25, 2023
97e6181
Looks up verification key if it was set
bkase Jan 25, 2023
39c44cd
fix formatting
mitschabaude Jan 25, 2023
490b78a
some fixes
mitschabaude Jan 25, 2023
3863a78
Merge commit '2c85be1359dadb9342d7fbf724a55e2b217481af' into feature/…
mrmr1993 Jan 26, 2023
18010c6
update bindings
mitschabaude Jan 26, 2023
5af29c9
Merge branch 'feature/setTiming-permission' into feature/vk-hash
mitschabaude Jan 26, 2023
225c29e
fixup dex test
mitschabaude Jan 26, 2023
cdca0b9
fix dex test up until redeem in prover
mitschabaude Jan 26, 2023
1a06285
make dex work insecurely
mitschabaude Jan 26, 2023
af1c678
Merge branch 'feature/setTiming-permission' into feature/vk-hash
mitschabaude Jan 26, 2023
ddbe9d4
update bindings
mitschabaude Jan 26, 2023
0e442bd
update bindings (2)
mitschabaude Jan 26, 2023
043056e
fix test
mitschabaude Jan 28, 2023
9c23bf9
Merge branch 'feature/setTiming-permission' into feature/vk-hash
mitschabaude Jan 28, 2023
98970da
Merge pull request #685 from o1-labs/feature/setTiming-permission
mitschabaude Jan 28, 2023
26556a1
fix consistency test
mitschabaude Jan 28, 2023
c6558f9
fix find logic
mitschabaude Jan 28, 2023
9ae919a
fix dex example
mitschabaude Jan 28, 2023
b574d61
dont mutate account updates
mitschabaude Jan 28, 2023
8142986
fix token test
mitschabaude Jan 28, 2023
1d02fc5
fix intg test
mitschabaude Feb 1, 2023
ffd3483
check mayUseToken=No on top level account updates
mitschabaude Feb 1, 2023
bfb3006
minor
mitschabaude Feb 1, 2023
8599222
fix more
mitschabaude Feb 1, 2023
01b7161
Merge pull request #658 from o1-labs/feature/vk-hash
mitschabaude Feb 2, 2023
2fb34e9
Merge branch 'main' into berkeley
mitschabaude Feb 10, 2023
1900084
fix ts build
mitschabaude Feb 10, 2023
42befb8
fix unit tests
mitschabaude Feb 10, 2023
4378df2
update bindings
mitschabaude Feb 10, 2023
52bd532
fix: use dummy vk when proofs disabled
mitschabaude Feb 10, 2023
28c692c
dump new vk hashes & changelog
mitschabaude Feb 10, 2023
c22a117
Merge pull request #724 from o1-labs/merge-main-berkeley-2
mitschabaude Feb 10, 2023
a9910f6
Update transaction hash version byte
psteckler Feb 15, 2023
f8d719b
Merge pull request #729 from o1-labs/fix/txn-hash-version-byte
psteckler Feb 15, 2023
a6f052d
fix tx hash (remove version byte)
mitschabaude Feb 16, 2023
9bbca2d
update bindings
mitschabaude Feb 16, 2023
733b769
Merge pull request #734 from o1-labs/fix/tx-hash-v1
mitschabaude Feb 16, 2023
960700c
declare token symbol shape in OCaml
mitschabaude Feb 21, 2023
8e7f682
add account deriver
mitschabaude Feb 21, 2023
f7e2996
deriver fixes
mitschabaude Feb 21, 2023
0e5e7bf
alternative getAccount, checked against existing
mitschabaude Feb 21, 2023
7466f00
use generated account type throughout
mitschabaude Feb 22, 2023
d6b4380
custom receipt chain hash deriver
mitschabaude Feb 22, 2023
a63644d
fix examples
mitschabaude Feb 22, 2023
ce1582b
update bindings
mitschabaude Feb 22, 2023
03885da
clean up
mitschabaude Feb 22, 2023
5ce5922
fix upgradability example
mitschabaude Feb 22, 2023
3f770b4
update bindings
mitschabaude Feb 22, 2023
0205134
support provedState precondition
mitschabaude Feb 22, 2023
0be70cb
update bindings
mitschabaude Feb 22, 2023
6f13b5d
changelog
mitschabaude Feb 22, 2023
75bee36
address feedback
mitschabaude Feb 22, 2023
1e4fc2d
Merge branch 'berkeley' into feature/account-deriver
mitschabaude Feb 22, 2023
f1df48f
regenerate types
mitschabaude Feb 22, 2023
dbaecce
fix build
mitschabaude Feb 22, 2023
7bb5e75
update bindings
mitschabaude Feb 22, 2023
dd4c5a3
fix account caching
mitschabaude Feb 23, 2023
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
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- BREAKING CHANGE: Modify signature algorithm used by `Signature.{create,verify}` to be compatible with mina-signer https://github.com/o1-labs/snarkyjs/pull/710
- Signatures created with mina-signer's `client.signFields()` can now be verified inside a SNARK!
- Breaks existing deployed smart contracts which use `Signature.verify()`
- BREAKING CHANGE: Change structure of `Account` type which is returned by `Mina.getAccount()` https://github.com/o1-labs/snarkyjs/pull/741
- for example, `account.appState` -> `account.zkapp.appState`
- full new type: https://github.com/o1-labs/snarkyjs/blob/0be70cb8ceb423976f348980e9d6238820758cc0/src/provable/gen/transaction.ts#L515

## [0.8.0](https://github.com/o1-labs/snarkyjs/compare/d880bd6e...c5a36207)

Expand Down
2 changes: 1 addition & 1 deletion MINA_COMMIT
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
The mina commit used to generate the backends for node and chrome is
7414f2bf44e6c6a89cdded1a022bff01f82a55be
57bfa85a626140ae86cdd27a14074f88e1ba1c60
4 changes: 2 additions & 2 deletions src/build/jsLayoutToTypes.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ ${
!isJson
? 'export { Json };\n' +
`export * from '${leavesRelPath}';\n` +
'export { provableFromLayout, toJSONEssential, Layout, TypeMap };\n'
'export { provableFromLayout, toJSONEssential, emptyValue, Layout, TypeMap };\n'
: `export * from '${leavesRelPath}';\n` + 'export { TypeMap };\n'
}

Expand Down Expand Up @@ -175,7 +175,7 @@ type CustomTypes = { ${customTypes
.map((c) => `${c.typeName}: ProvableExtended<${c.type}, ${c.jsonType}>;`)
.join(' ')} }
let customTypes: CustomTypes = { ${customTypeNames.join(', ')} };
let { provableFromLayout, toJSONEssential } = ProvableFromLayout<
let { provableFromLayout, toJSONEssential, emptyValue } = ProvableFromLayout<
TypeMap,
Json.TypeMap
>(TypeMap, customTypes);
Expand Down
78 changes: 39 additions & 39 deletions src/chrome_bindings/snarky_js_chrome.bc.js

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion src/examples/simple_zkapp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ class SimpleZkapp extends SmartContract {
}

@method update(y: Field): Field {
this.account.provedState.assertEquals(Bool(true));
mitschabaude marked this conversation as resolved.
Show resolved Hide resolved
this.emitEvent('update', y);
let x = this.x.get();
this.x.assertEquals(x);
Expand All @@ -42,6 +43,8 @@ class SimpleZkapp extends SmartContract {
* @param caller the privileged account
*/
@method payout(caller: PrivateKey) {
this.account.provedState.assertEquals(Bool(true));

// check that caller is the privileged account
let callerAddress = caller.toPublicKey();
callerAddress.assertEquals(privilegedAddress);
Expand Down Expand Up @@ -99,7 +102,7 @@ console.log('initial state: ' + zkapp.x.get());
console.log(`initial balance: ${zkapp.account.balance.get().div(1e9)} MINA`);

let account = Mina.getAccount(zkappAddress);
console.log('account is proved:', account.provedState.toBoolean());
console.log('account state is proved:', account.zkapp?.provedState.toBoolean());

console.log('update');
tx = await Mina.transaction(sender, () => {
Expand Down
4 changes: 2 additions & 2 deletions src/examples/zkapps/dex/upgradability.ts
Original file line number Diff line number Diff line change
Expand Up @@ -360,11 +360,11 @@ async function upgradeabilityTests({ withVesting }: { withVesting: boolean }) {

// Making sure that both token holder accounts have been updated with the new modified verification key
expect(
Mina.getAccount(addresses.dex, tokenX.token.id).verificationKey
Mina.getAccount(addresses.dex, tokenX.token.id).zkapp?.verificationKey?.data
).toEqual(ModifiedDexTokenHolder._verificationKey?.data);

expect(
Mina.getAccount(addresses.dex, tokenY.token.id).verificationKey
Mina.getAccount(addresses.dex, tokenY.token.id).zkapp?.verificationKey?.data
).toEqual(ModifiedDexTokenHolder._verificationKey?.data);

// this is important; we have to re-enable proof production (and verification) to make sure the proofs are valid against the newly deployed VK
Expand Down
5 changes: 0 additions & 5 deletions src/examples/zkapps/escrow/escrow.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
import {
SmartContract,
state,
State,
method,
DeployArgs,
Permissions,
UInt64,
AccountUpdate,
PrivateKey,
PublicKey,
} from 'snarkyjs';

Expand Down
11 changes: 6 additions & 5 deletions src/examples/zkapps/hello_world/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ txn = await Mina.transaction(feePayer1.publicKey, () => {
});
await txn.sign([feePayer1.privateKey, zkAppPrivateKey]).send();

const initialState = Mina.getAccount(zkAppAddress).appState?.[0].toString();
const initialState =
Mina.getAccount(zkAppAddress).zkapp?.appState?.[0].toString();

let currentState;

Expand All @@ -46,7 +47,7 @@ txn = await Mina.transaction(feePayer1.publicKey, () => {
await txn.prove();
await txn.sign([feePayer1.privateKey]).send();

currentState = Mina.getAccount(zkAppAddress).appState?.[0].toString();
currentState = Mina.getAccount(zkAppAddress).zkapp?.appState?.[0].toString();

if (currentState !== '4') {
throw Error(
Expand Down Expand Up @@ -135,7 +136,7 @@ txn2 = await Mina.transaction({ sender: feePayer2.publicKey, fee: '2' }, () => {
await txn2.prove();
await txn2.sign([feePayer2.privateKey]).send();

currentState = Mina.getAccount(zkAppAddress).appState?.[0].toString();
currentState = Mina.getAccount(zkAppAddress).zkapp?.appState?.[0].toString();

if (currentState !== '16') {
throw Error(
Expand All @@ -152,7 +153,7 @@ txn3 = await Mina.transaction({ sender: feePayer3.publicKey, fee: '1' }, () => {
await txn3.prove();
await txn3.sign([feePayer3.privateKey]).send();

currentState = Mina.getAccount(zkAppAddress).appState?.[0].toString();
currentState = Mina.getAccount(zkAppAddress).zkapp?.appState?.[0].toString();

if (currentState !== '256') {
throw Error(
Expand Down Expand Up @@ -191,7 +192,7 @@ if (!correctlyFails) {
*/

function handleError(error: any, errorMessage: string) {
currentState = Mina.getAccount(zkAppAddress).appState?.[0].toString();
currentState = Mina.getAccount(zkAppAddress).zkapp?.appState?.[0].toString();

if (error.message.includes(errorMessage)) {
correctlyFails = true;
Expand Down
Loading