Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR changes the fanout behavior for
Id
,Storage
andStorage Merkle
subtrees of the database, increasing the fanout, decreasing the application time of a block and decreasing the speed of querying the database.Before this PR all the these trees used a
FanOutList
that consumed 2 nibbles. It was then followed by aFanOutPage
that consumed 2 more but already introduced someSlottedArray
buffering and copying over.With this PR the
FanOutList
is replaced with a component that consumes 4 nibbles out of the path. This is done by using 64 pages as raw content (no header no nothing) that allows to store addresses of 4 nibbles = 16 * 16 * 16 * 16. To deal with COW management, a special vector (long, 64 bits) is added to mark pages as cowed or not as the pages are treated as raw.In result all the queries against
Id
,Storage
andStorage Merkle
have at least one less page to query (FanOutPage
). All the writes to these have also one less page to write through. It's worth to mention that forId
s, that represent accounts with some storage (contracts), this might allow to have a lookup of depth of 1 or 2 only.