Inconsistent debug_storageRangeAt
due to missing hash to preimage map in state migrated db
#2107
Labels
debug_storageRangeAt
due to missing hash to preimage map in state migrated db
#2107
Describe the bug
The
debug_storageRangeAt
JSON-RPC method is expected to return the key-value pairs of the entire contract storage. However, an inconsistency in the method's response has been observed, where the key is not correctly resolved from a state trie migrated database. This results in some entries having an empty string as a key. This behavior was noted by comparing responses from two different nodes:How to reproduce
The issue can be reproduced using the following curl command:
Further investigation reveals that the secure trie hash to preimage map is missing in the state trie migrated database, as demonstrated by the following proof:
Expected behavior
The
debug_storageRangeAt
method should correctly return all key-value pairs of the contract storage, including resolving keys correctly from the state trie migrated database.Attachments
N/A
Environment (please complete the following information)
$ ken version
: 1.12.1$ go version
: 1.21.6 (but not Go version dependent)Additional context
The absence of the hash -> preimage map in the state trie migrated database seems to prevent the secure trie from resolving the actual keys for the stored values. This issue does not affect typical operations (e.g.,
SLOAD
,SSTORE
), where preimage -> hash is used, but impedes the correct functioning of thedebug_storageRangeAt
method. My theory is that the mapping cache ofstatedb.SecureTrie
that stores hash -> preimage mappings is not copied during state trie migration, indicating a specific issue with the migration process and the handling of secure tries.The text was updated successfully, but these errors were encountered: