-
Notifications
You must be signed in to change notification settings - Fork 134
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 endActionState and fromActionState to fetchActions #828
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mostly looks good, although I would change the 'actionHash' terminology to 'actionState', and make sure the local and remote Mina interfaces are consistent.
A general comment is that we don't have good test coverage for getActions
. Ideally, there'd be a unit test which confirms expected behavior on LocalBlockchain (for cases like multiple actions in an account update / in a block / computing action states from multiple blocks with actions). Plus a manual test which confirms it with an archive node, for the time being where the Berkeley test doesn't work in CI
Description
🔗 Resolves #802
This PR introduces
fromActionState
andendActionState
parameters to thefetchActions
function in SnarkyJS. This enhancement allows us to fetch only the necessary actions to compute the latest actions state, instead of retrieving the entire actions history of a zkApp as done previously.With these improvements, we no longer need to start from an empty action state and apply hashes to derive the current action state by analyzing each block from the beginning of a zkApp's history. Instead, we can utilize the new
actionStateTwo
field returned by the Archive Node API. AsactionStateTwo
represents the second latest action state calculated, it serves as a safe starting point for deriving the most recent action state. We can now apply AccountUpdates to theactionStateTwo
value to compute the current action state.Furthermore, users can now provide a
fromActionState
parameter to the Archive Node API, which will return actions only after the specified action state. This feature offers a filtering option in SnarkyJS that was previously unavailable.Please note that this PR relies on o1-labs/Archive-Node-API#71.