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

Change finalize to only squash commits #967

Closed
herr-seppia opened this issue Jul 17, 2023 · 1 comment · Fixed by #968
Closed

Change finalize to only squash commits #967

herr-seppia opened this issue Jul 17, 2023 · 1 comment · Fixed by #968
Assignees
Labels
module:node Issues related to node module module:rusk Issues related to rusk module

Comments

@herr-seppia
Copy link
Member

Summary

Currently, if the state root returned by the finalize operation mismatch, it's impossible to revert

Possible solution design or implementation

Since accept and finalize are the same operations except for the squashing strategy, we should change the node in order to always call "accept" and, if the state hash match, call finalize to squash previous commits (if the block is finalizable).
This requires that finalize must not process transactions, but just squash commits between from and to (at the beginning, we can omit to explicitly pass those variables, since they are known by rusk)

Additional context

In addition, it would be useful to change the Accept method in order to receive the expected state root. If that is not matching the effective result, the vm should not commit

Persist block should be done only after ensure that state_root returned by accept/finalize is the same of the block header
See also #924

Originally posted by @herr-seppia in #902 (comment)

@goshawk-3
Copy link
Contributor

As the ultimate resolution, we concluded to implement a consistency_check in both the accept and finalize calls. This validation enables a caller to ensure the commitment of a VM state change only when a valid state_root is returned.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module:node Issues related to node module module:rusk Issues related to rusk module
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants