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

Geth-statediff doesn't save storage if value is empty #57

Closed
ramilexe opened this issue Mar 23, 2021 · 6 comments
Closed

Geth-statediff doesn't save storage if value is empty #57

ramilexe opened this issue Mar 23, 2021 · 6 comments

Comments

@ramilexe
Copy link

System information

Geth
Version: 1.10.1-statediff-0.0.15
Git Commit: daa2cdd
Git Commit Date: 20210313
Architecture: amd64
Go Version: go1.15.5
Operating System: linux

Expected behaviour

In storage_cids table should be row with non-empty storage_leaf_key and mhKey should point to block table with RLP encoded empty string

Actual behaviour

In storage_cids table there is a row with empty storage_leaf_key and mhKey points to block table with empty data field

Steps to reproduce the behaviour

@ramilexe
Copy link
Author

Here JSON-RPC request to verify against geth leveldb:

> curl -H "Content-Type: application/json" -X POST --data '{"jsonrpc":"2.0", "method": "eth_getStorageAt", "params": ["0xafD0849Ee466Ef3232896DB4D41871566Fc7d028", "0x0", "pending"], "id": 1}' localhost:8545

{"jsonrpc":"2.0","id":1,"result":"0x0000000000000000000000000000000000000000000000000000000000000000"}

Replace 0xafD0849Ee466Ef3232896DB4D41871566Fc7d028 with your address of deployed contract

@ramilexe
Copy link
Author

Related to vulcanize/ipld-eth-indexer#72

@i-norden
Copy link
Collaborator

i-norden commented Mar 24, 2021

Per out conversation in slack: zeroed values aren't stored in the trie, the real issue is that we are not correctly signifying when a zero-value node at a specific leaf key is pruned away (due to not including the leaf_key for the removed node in the row representing it)

To fix we should include the leaf key in the removed-node-type entries. mhKey should still be empty since there is technically no node at that path that we should be referencing, we are just signifying that a node has been removed.

@i-norden
Copy link
Collaborator

We also need to a script to update the current entries in our db0

@i-norden
Copy link
Collaborator

Fixed in #58 , although I will open a separate issue to track the separate script for repairing the current db.

@i-norden
Copy link
Collaborator

Also of note, the fix is for both state and storage tries

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

2 participants