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

use UnknownNode in InternalNode to turn it into a stateless node #345

Merged
merged 6 commits into from
Apr 25, 2023

Conversation

gballet
Copy link
Member

@gballet gballet commented Apr 19, 2023

This is a first attempt at getting rid of StatlessNode in order to simplify the code and be able to use all the optimizations that were made recently, in a statless context.

Currently the idea is to use UnknownNode to signal that a subtree of an InternalNode is missing from the stateless view.

@gballet gballet requested a review from jsign April 19, 2023 19:33
Copy link
Collaborator

@jsign jsign left a comment

Choose a reason for hiding this comment

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

LGTM, I mainly trust you until diving into this in the future. :)

@gballet gballet force-pushed the stateless-internal-nodes branch from 9fa8c79 to 27e4e64 Compare April 20, 2023 06:51
* safety improvment: use Unknown instead of nil

* fix tests

* rename Unknown to the clearer UnknownNode

* return an error in GetProofItems and forbid calling it on incomplete trees

* remove unused functions
@gballet gballet changed the title use nil in InternalNode to turn it into a stateless node use UnknownNode in InternalNode to turn it into a stateless node Apr 24, 2023
* remove all references to stateless

* remove unused error
@gballet
Copy link
Member Author

gballet commented Apr 24, 2023

It's still missing support for stateless leaf nodes. I guess this can be achieved by using the map that was introduced in #338, assuming that it remains fast enough.

@gballet
Copy link
Member Author

gballet commented Apr 25, 2023

Note: technically using LeafNode as it is does work, the problem is that the reconstructed tree won't be able to tell if a value is missing from the stateless view or is simply not present. This should definitely be enough for now, because when re-executing the block, most misses will be detected at the root calculation level.

This is still a problem because e.g. the producer could cheat by charging full price for reading 0 values while not adding them to the witness. That's a problem left to a subsequent PR though.

proof_ipa.go Show resolved Hide resolved
@gballet gballet merged commit 1288985 into master Apr 25, 2023
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