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

add getActions to LocalBlockchain #327

Merged
merged 19 commits into from
Aug 25, 2022

Conversation

Trivo25
Copy link
Member

@Trivo25 Trivo25 commented Aug 4, 2022

Description

This is a follow up PR to #323 that introduces getActions (fetchSequenceEvents) to theLocalBlockchain and the reducer on smart contracts.

In order to get it working #324 is required, since it adds the needed sequenceState field to zkapp accounts. (DONE)

Under the hood

Similar to fetchEvents, emitted actions are now stored in a variable called actions and the LocalBlockchain exposes a closure 'getActions` that returns all emitted actions.

zkApp instances can now fetch sequence events (actions) as follows:

this.reducer.getActions({
    fromActionHash?: Field;
    endActionHash?: Field;
}): Field[][]

Question: getActions currently is a part of the reducer. Should it stay there or become its own method on the SmartContract class, similar to fetchEvents?

The example src/examples/state_update_rollup.ts has been extended to support multiple action rollups

closes #284

src/lib/zkapp.ts Outdated Show resolved Hide resolved
@Trivo25 Trivo25 marked this pull request as ready for review August 12, 2022 12:54
src/lib/zkapp.ts Show resolved Hide resolved
src/lib/mina.ts Outdated Show resolved Hide resolved
src/lib/mina.ts Outdated Show resolved Hide resolved
src/lib/zkapp.ts Outdated Show resolved Hide resolved
@mitschabaude
Copy link
Member

Question: getActions currently is a part of the reducer. Should it stay there or become its own method on the SmartContract class, similar to fetchEvents?

should stay part of reducer, that gives us much better typing than we have with events. I think we should change events as well at some point

@Trivo25 Trivo25 mentioned this pull request Aug 25, 2022
3 tasks
Copy link
Member

@mitschabaude mitschabaude left a comment

Choose a reason for hiding this comment

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

lgtm!

@Trivo25 Trivo25 merged commit 927bbbb into main Aug 25, 2022
@Trivo25 Trivo25 deleted the feature/localblockchain-sequencingEvents branch August 25, 2022 17:35
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.

Local blockchain implementation for fetchEvents and fetchSequenceEvents
2 participants