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

Remove usages of CoreDb in Fluffy. #2152

Merged
merged 4 commits into from
Apr 25, 2024
Merged

Remove usages of CoreDb in Fluffy. #2152

merged 4 commits into from
Apr 25, 2024

Conversation

web3-developer
Copy link
Contributor

Considering that we don't need the complexity of CoreDb and will likely never need the CoreDb aristo implemention in Fluffy, lets keep it simple and use the HexaryTrie implementation when doing in memory merkle root calculations.

@web3-developer
Copy link
Contributor Author

Note that I also reviewed the usage of CoreDb in the test_state_network test but I don't yet understand the details of that test. I'll update it if possible once I've implemented more of the state network code and have a better understanding.

@kdeme
Copy link
Contributor

kdeme commented Apr 24, 2024

Note that I also reviewed the usage of CoreDb in the test_state_network test but I don't yet understand the details of that test. I'll update it if possible once I've implemented more of the state network code and have a better understanding.

Yeah that's a very old test where a JSON genesis file is read and a trie is created from that. Next all the trie nodes are stored in the database and then some retrieval test is done.

Here too that CoreDb could be replaced, but it is fine to do it in an iteration where you look into the tests.

This type of test that starts from this genesis file is however pretty useful as first starting point to start testing the state network I think.

@@ -11,7 +11,7 @@ import
stew/results,
chronos,
chronicles,
eth/[common/eth_types_rlp, rlp],
eth/[common/eth_types_rlp, rlp, trie, trie/db],
Copy link
Contributor

Choose a reason for hiding this comment

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

Can remove the db/core_db import lower?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, will do. Thanks

@@ -41,7 +41,7 @@ import
chronicles,
chronos,
confutils,
eth/[keys, rlp],
eth/[keys, rlp, trie, trie/db],
Copy link
Contributor

Choose a reason for hiding this comment

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

Can remove the ../../nimbus/db/core_db, import lower?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, will do.

@web3-developer
Copy link
Contributor Author

Note that I also reviewed the usage of CoreDb in the test_state_network test but I don't yet understand the details of that test. I'll update it if possible once I've implemented more of the state network code and have a better understanding.

Yeah that's a very old test where a JSON genesis file is read and a trie is created from that. Next all the trie nodes are stored in the database and then some retrieval test is done.

Here too that CoreDb could be replaced, but it is fine to do it in an iteration where you look into the tests.

This type of test that starts from this genesis file is however pretty useful as first starting point to start testing the state network I think.

I ran into some issues when I tried to update the test. I updated the genesisToTrie proc to this:

proc genesisToTrie(filePath: string): HexaryTrie =
  let alloc = getGenesisAlloc(filePath)
  toState(alloc)[0].HexaryTrie

and I'm getting this error:

 �[91mERR�[0m 2024-04-25 14:21:34.690+08:00 �[1mUnable to decode offered Key/Value        �[0m topics="�[93mportal_state�[0m"
none()

Basically the test breaks when I try to update it to use a trie state generated directly from the json file. No idea why this is effecting the decoding.

@kdeme kdeme merged commit d12300e into master Apr 25, 2024
10 checks passed
@kdeme kdeme deleted the remove-coredb-from-fluffy branch April 25, 2024 10:22
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.

None yet

2 participants