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 HASH opcode #20

Open
s1na opened this issue Sep 6, 2019 · 1 comment
Open

Add HASH opcode #20

s1na opened this issue Sep 6, 2019 · 1 comment

Comments

@s1na
Copy link
Collaborator

s1na commented Sep 6, 2019

Right now rebuild returns the root Node. In order to compute the root hash, the partial trie has to be walked down and up once. To improve the efficiency of verifiers we could either add a new opcode or change the semantic of the existing ones to allow the verifier to produce the correct hash once every instruction has been processed.

LEAF and EXTENSION opcodes could be modified to directly hash the node and push the hash on the stack. HASHER just reads in a hash from the sequence and doesn't need to be modified. The only question is how to handle branches, because it's not exactly clear when all the children have been added to the branch. One simple option is to introduce a HASH opcode which expects a branch node on top of stack and hashes it. There are other options too.

@s1na
Copy link
Collaborator Author

s1na commented Sep 26, 2019

We discussed this offline and realized another opcode is not needed. I prototyped the approach we discussed here: ewasm/biturbo#2

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

No branches or pull requests

1 participant