feat(state): Intercept Database creation#283
Conversation
|
In
There's a few things going on here. Firewood does replace the
These return the This doesn't work with Firewood for a lot of reasons: this relies on a two-tier trie structure (each account has a storage trie), Firewood doesn't expose intermediate nodes, and Firewood "automatically" hashes the trie on insertion. Because of this, we need to replace the |
Database creation
ARR4N
left a comment
There was a problem hiding this comment.
Note
You're right that the comment is out of date. Can you please do some archaeology to determine when the comment was added and what happened to the function it references? If it's completely gone (probably moved to the ephemeral package in avalanchego) then all good otherwise please add the change to this PR and DM me to take a look if you think further review is necessary.
It was removed in #238, just as you described. I'll update all other comments to accurately reflect use patterns |
Why this should be merged
For Firewood, there's many places in libevm where it uses these methods to construct a
state.Database, but we need a different implementation. Since this is separate from theStateDBinterfaces (I don't want to have to register for each test, but rather in a singleinitfunction), I made it a separate registration for simplicity.The ultimate goal is for ava-labs/avalancheg#5314, so if this approach is not correct to enable that, this PR should not be merged.
How this works
Intercept each creation with the possibility of wrapping the state cache if it is registered.
How this was tested
Added some no-op unit tests.