-
Notifications
You must be signed in to change notification settings - Fork 114
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
stake trie #161
base: master
Are you sure you want to change the base?
stake trie #161
Conversation
can you separate your change from the original commit of the trie so that it's easier to see what you have changed over the original trie code? |
just do two commits
|
I have separated the change by doing two commits. Please check it. |
can you describe the purpose of the stake trie and the difference from trie? |
A stake trie is a variant of the original trie that supports two addition operations beyond insertion, lookup, and deletion: For the implementation, I add an extract variable for each trie node to store the total number of stakes rooted at the node (i.e., the number of tokens below it). More specifically, blank or stake trie node in form of [key, [value, stake]] or [[v0, stake],[v1, stake]..[v15, stake],[v, stake]]. All the above operations that modify the trie must adjust the stake information. Besides, I deleted the useless operations split() and merge() in the original trie. For the test part, I start from a random function that takes the previous block hash as the random seed and output an index I, which is larger than zero and smaller than the total number of tokens. |
The draft code for stake trie --- I start from a random function that takes the previous block hash as the random seed and output an index I, which is larger than zero and smaller than the total number of tokens. Then, I try to rewrite the trie such that this stake trie can return the owner's address efficiently.