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

zkApp composability, pt 2: multiple proofs #296

Merged
merged 7 commits into from
Jul 21, 2022

Conversation

mitschabaude
Copy link
Contributor

@mitschabaude mitschabaude commented Jul 20, 2022

Small PR which fixes the case of multiple independent proofs in one transaction.
This isn't composability, but a case that came up on initial testing that turned out to be broken. The PR fixes it and adds an example which combines the proofs of two smart contracts together in one transaction block

The PR also has a couple of other minor changes, to collect unrelated stuff which would deter from reviewing the bigger chunks (see next PR)

@@ -0,0 +1,249 @@
/**
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the new example!

@@ -657,8 +657,14 @@ class Party {
}

hash() {
let fields = Types.Party.toFields(toPartyUnsafe(this));
return Ledger.hashPartyFromFields(fields);
// these two ways of hashing are (and have to be) consistent / produce the same hash
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is what fixes the new example. the previous version was always returning variables, even outside the circuit

Copy link
Contributor

@MartinMinkov MartinMinkov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

// state type
Field,
// function that says how to apply an action
(state: Field, _action: Field) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dumb question but when should action be interacted with? I see that we're not doing anything with it here but I'm wondering what its use case would be

Copy link
Contributor

@MartinMinkov MartinMinkov Jul 20, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nvm, just realized that actionsHash is being passed in. I guess the use would be extra information we want to pass into the reducer function to do something specific (e.g. check the hash?)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

action is a sequence event, which can potentially store information, and you'd combine that information to a state in the reducer.

example: action is a balance change, and the state is your account balance

Base automatically changed from feature/child-parties to main July 21, 2022 18:22
@mitschabaude mitschabaude merged commit f2c3360 into main Jul 21, 2022
@mitschabaude mitschabaude deleted the feature/composability-misc branch July 21, 2022 18:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants