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

Remove children from AccountUpdate: RFC and Implementation #1402

Merged
merged 74 commits into from
Feb 13, 2024
Merged
Show file tree
Hide file tree
Changes from 73 commits
Commits
Show all changes
74 commits
Select commit Hold shift + click to select a range
bc68700
normalize comment
mitschabaude Feb 2, 2024
e42f0d4
Merge branch 'feature/token-contract' into refactor/account-update-trees
mitschabaude Feb 2, 2024
2c52e8b
switch over how we hash calls in the circuit
mitschabaude Feb 2, 2024
40ed27a
add hint to problem
mitschabaude Feb 2, 2024
82d34c3
Merge branch 'feature/token-contract' into refactor/account-update-trees
mitschabaude Feb 6, 2024
e344a31
Merge branch 'feature/token-contract' into refactor/account-update-trees
mitschabaude Feb 6, 2024
9a032fc
fixup not updating unfinished forest
mitschabaude Feb 6, 2024
af6956e
adapt token contract to new hashing
mitschabaude Feb 6, 2024
755e749
add more unfinished forest helpers
mitschabaude Feb 6, 2024
ba29379
fix adaptation of token contract
mitschabaude Feb 6, 2024
5f2f2d7
Merge branch 'feature/token-contract' into refactor/account-update-trees
mitschabaude Feb 6, 2024
3e533a7
minor
mitschabaude Feb 6, 2024
d69c73a
add failing unit test
mitschabaude Feb 6, 2024
118cc06
move smart contract context and start account update layout class
mitschabaude Feb 6, 2024
2bb10ac
move some of it back
mitschabaude Feb 6, 2024
996be22
minor
mitschabaude Feb 6, 2024
d2dd5fe
develop account update layout enough to fix unit test
mitschabaude Feb 6, 2024
c8d439a
continue expanding account update layout
mitschabaude Feb 6, 2024
5e2b756
fixup set children
mitschabaude Feb 7, 2024
ef4b154
change name to avoid clash with ts keywored
mitschabaude Feb 7, 2024
599caca
introduce siblings to be able to disattach
mitschabaude Feb 7, 2024
43a34d5
override `instanceof`? seriously? have I become a hard-core OO progra…
mitschabaude Feb 7, 2024
54f596f
write to au layout in zkapp calls
mitschabaude Feb 7, 2024
71a4200
get from layout in token contract
mitschabaude Feb 7, 2024
4c71d09
disattach from layout in unlink
mitschabaude Feb 7, 2024
6b6b643
remove selfCalls
mitschabaude Feb 7, 2024
3884e6e
finalize layout
mitschabaude Feb 7, 2024
1ae3d64
don't store variables in aux data
mitschabaude Feb 7, 2024
f68dfcf
use layout to process zkapp calls
mitschabaude Feb 7, 2024
3778fa2
fix token test (don't use create child account update)
mitschabaude Feb 7, 2024
756ade0
dump vks
mitschabaude Feb 7, 2024
1928e17
[no children} fromFlatArray which doesn't rely on account update nesting
mitschabaude Feb 7, 2024
0f917b1
minor fix
mitschabaude Feb 7, 2024
d5ec3fb
introduce (not yet used) layout for Mina.transaction
mitschabaude Feb 7, 2024
f3e9169
match transaction.accountUpdates everywhere
mitschabaude Feb 7, 2024
f43dc3d
throw error if layout doesn't match list length
mitschabaude Feb 7, 2024
6da02d7
remove nested account updates from tx context
mitschabaude Feb 7, 2024
5c138ee
put back some code that was premature to remove
mitschabaude Feb 7, 2024
f96e6a9
[no children] remove unnecessary logic in token contract
mitschabaude Feb 7, 2024
030646e
implement to public input w/o children
mitschabaude Feb 7, 2024
09922c0
[no children] refactor recursive diff
mitschabaude Feb 7, 2024
1cbaa48
remove AccountUpdate.children
mitschabaude Feb 7, 2024
e3a66d6
some cleanup
mitschabaude Feb 7, 2024
bfa8fc9
remove obsolete method
mitschabaude Feb 7, 2024
202116e
make unfinished tree a class
mitschabaude Feb 8, 2024
a551369
move smart contract context
mitschabaude Feb 8, 2024
a4c2216
finish moving smart contract context
mitschabaude Feb 8, 2024
70302c8
play with ensuring invariants more strongly
mitschabaude Feb 8, 2024
ef9c18c
rename calls to children
mitschabaude Feb 8, 2024
c03554b
start refactoring unfinished forest
mitschabaude Feb 8, 2024
f48955a
reorder stuff
mitschabaude Feb 8, 2024
b7a74c4
tweak remove
mitschabaude Feb 8, 2024
cbc774c
better set children logic
mitschabaude Feb 8, 2024
c4b016a
completely get rid of unconstrained array after finalizing
mitschabaude Feb 8, 2024
1e6278e
cleanup, rename
mitschabaude Feb 8, 2024
ed0423b
extract tree
mitschabaude Feb 8, 2024
acbb260
minor
mitschabaude Feb 8, 2024
d437c7e
not sure if this is a good idea yet
mitschabaude Feb 8, 2024
fa935cc
refactor unfinished tree similarly
mitschabaude Feb 12, 2024
44bf6c9
fix account update create signed outside tx
mitschabaude Feb 12, 2024
0570bfb
another test case for token contract
mitschabaude Feb 12, 2024
e62be7e
approve a whole tree
mitschabaude Feb 12, 2024
ddde1de
proper type for packed/hashed.provable
mitschabaude Feb 12, 2024
fe85eb0
struct how it should be
mitschabaude Feb 12, 2024
e12edc7
make account update tree a usable class
mitschabaude Feb 12, 2024
24f9fb7
allow approving forests and some other polish
mitschabaude Feb 12, 2024
adc23a2
calls -> children
mitschabaude Feb 12, 2024
314ab5f
more explicit name for globally accessible accout update layout
mitschabaude Feb 12, 2024
e4a8729
remove unnecessary changes
mitschabaude Feb 12, 2024
aa37ee0
some code organization
mitschabaude Feb 12, 2024
694897d
fixup examples build
mitschabaude Feb 12, 2024
1cb30fa
changelog
mitschabaude Feb 12, 2024
5e9e3fd
Merge branch 'main' into refactor/account-update-trees
mitschabaude Feb 12, 2024
24475dd
bump live tests timeout
mitschabaude Feb 13, 2024
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
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,14 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm

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

### Breaking changes

- Remove `AccountUpdate.children` and `AccountUpdate.parent` properties https://github.com/o1-labs/o1js/pull/1402
- Also removes the optional `AccountUpdatesLayout` argument to `approve()`
- Adds `AccountUpdateTree` and `AccountUpdateForest`, new classes that represent a layout of account updates explicitly
- Both of the new types are now accepted as inputs to `approve()`
- `accountUpdate.extractTree()` to obtain the tree associated with an account update in the current transaction context.

### Added

- `MerkleList<T>` to enable provable operations on a dynamically-sized list https://github.com/o1-labs/o1js/pull/1398
Expand Down
6 changes: 2 additions & 4 deletions src/examples/zkapps/token_with_proofs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,8 @@ class TokenContract extends SmartContract {
receiverAddress: PublicKey,
callback: Experimental.Callback<any>
) {
let senderAccountUpdate = this.approve(
callback,
AccountUpdate.Layout.AnyChildren
);
// TODO use token contract methods for approve
let senderAccountUpdate = this.approve(callback) as AccountUpdate;
let amount = UInt64.from(1_000);
let negativeAmount = Int64.fromObject(
senderAccountUpdate.body.balanceChange
Expand Down
1 change: 1 addition & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ export {
ZkappPublicInput,
TransactionVersion,
AccountUpdateForest,
AccountUpdateTree,
} from './lib/account_update.js';

export { TokenAccountUpdateIterator } from './lib/mina/token/forest-iterator.js';
Expand Down
Loading
Loading