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 an update method #1

Merged
merged 2 commits into from
Jun 6, 2024
Merged

Conversation

Quantumplation
Copy link
Contributor

The update method can save two membership checks over a delete followed by an insert, because we don't need to bother calculating / verifying the intermediate root

It doesn't include off-chain code for doing updates because I got intimidated, and it's not as useful to safe computation there lol

The update method can save two membership checks over a delete followed by an insert, because we don't need to bother calculating / verifying the intermediate root
old_value: ByteArray,
new_value: ByteArray,
) {
// TODO: could we do this with a single traversal? `something(key, old_value, new_value, proof) -> (old_root, new_root)`?
Copy link
Member

Choose a reason for hiding this comment

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

I've done -- at some point -- something similar for including / excluding since only the last step in the traversal really is different. But in the end, there's an extra cost that comes from having more arguments to keep track of and you still need the same number of hashes and prefix manipulation so there's almost no visible benefits on the execution costs in doing so. And, it obfuscates the code a lot more, so I gave up on the idea eventually.

@KtorZ KtorZ merged commit 1f66101 into aiken-lang:main Jun 6, 2024
3 checks passed
@Quantumplation Quantumplation deleted the pi/update-fn branch June 7, 2024 02:21
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