-
Notifications
You must be signed in to change notification settings - Fork 781
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
Full deletion from trie #3828
Comments
Decided to add 2nd clarification (xD) After a while, noticed this issue(rather comment) by @jochem-brouwer here This is also from trie test dir. So if we have: const { Trie, LevelDB } = require('@ethereumjs/trie')
const { Level } = require('level')
const trie = new Trie({ db: new LevelDB(new Level('MY_TRIE_DB_LOCATION')) })
async function test() {
await trie.put(Buffer.from('test'), Buffer.from('1'))
await trie.put(Buffer.from('test'), Buffer.from('2'))
await trie.put(Buffer.from('test'), Buffer.from('3'))
await trie.put(Buffer.from('test'), Buffer.from('4'))
await trie.put(Buffer.from('test'), Buffer.from('5'))
await trie.put(Buffer.from('test'), Buffer.from('6'))
// this logs 7 keys but I only want 1 key to be stored with the value 6
console.log(await trie.db._leveldb.keys().all())
}
test() How to delete states connected with 1,2,3 but have access to the current state(6) and some previous ones(for example, to have ability to rollback to state 5 and 4)? |
Hi Vlad, interesting issue! I would also advise to also join our discord if you have not yet: https://discord.gg/TNwARpR Are you also using checkpoints ( |
Hello! No, I don't use this functionality, although I was interested in it during source code research and debugging. I noticed that if I perform However, I still don't understand how this can be used to solve my problem. Do you have a solution? |
Hi folk 👋
Have a question regarding the
trie
data structure: What is the procedure of full deletion the old states ?1. For example, imagine the code:
2. The output will be
3. Now imagine I want to clean old, non-used storage (for example, to get rid of old state of
0xcccccd
account). How to do it ?useNodePruning
as pre-set value because I need rollback functionality, at least for the last N statessuper-old
states to cleanup the disk0x35c1813f
, I need only the last one with root0x6e6ff559
How to do it ? Any suggestions? Thank you in advance, hope we'll resolve it!
P.S: Code snippets would be even better from you to help. Thanks 🤝
P.P.S: I also asked because:
del()
method the trie just move to the new root with lack of access to deleted keyuseNodePrunning
was pre-set in Geth clients, so I hope the same functionality should be available here, for JS implementation to clean up old state post-factumThe text was updated successfully, but these errors were encountered: