Skip to content

Conversation

@rjl493456442
Copy link
Member

In this PR, several changes have been made:

(a) restructure the trienode history header section

Previously, the offsets of the key and value sections were recorded before encoding
data into these sections. As a result, these offsets referred to the start position of
each chunk rather than the end position.

This caused an issue where the end position of the last chunk was unknown, making
it incompatible with the freezer partial-read APIs. With this update, all offsets now
refer to the end position, and the start position of the first chunk is always 0.

(b) Enable partial freezer read for trienode data retrieval

The partial freezer read feature is now utilized in trienode data retrieval, improving
efficiency.

keyLimit := len(keySection)
if i != len(owners)-1 {
keyLimit = int(keyOffsets[i+1])
var keyStart, keyLimit uint32
Copy link
Member

Choose a reason for hiding this comment

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

We don't expect the keyStarts and Limits to exceed 2 million, right?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes.

The dirty trienodes caused by a single block should be limited by the GasLimit.

For node key, it's the node path;
For node val, it's the mix of "full node value", and "partial node value diff";

Uint32 should be sufficient for them, unless we raise the gasLimit dramatically.

Copy link
Member

@MariusVanDerWijden MariusVanDerWijden left a comment

Choose a reason for hiding this comment

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

LGTM

@rjl493456442
Copy link
Member Author

Let's merge it, making it easier for rebase work.

@rjl493456442 rjl493456442 added this to the 1.16.6 milestone Oct 25, 2025
@rjl493456442 rjl493456442 merged commit cfa3b96 into ethereum:master Oct 25, 2025
5 of 6 checks passed
rjl493456442 added a commit to rjl493456442/go-ethereum that referenced this pull request Oct 28, 2025
…thereum#32907)

In this PR, several changes have been made:

(a) restructure the trienode history header section

Previously, the offsets of the key and value sections were recorded before 
encoding data into these sections. As a result, these offsets referred to the
start position of each chunk rather than the end position.

This caused an issue where the end position of the last chunk was
unknown, making it incompatible with the freezer partial-read APIs. 
With this update, all offsets now refer to the end position, and the 
start position of the first chunk is always 0.

(b) Enable partial freezer read for trienode data retrieval

The partial freezer read feature is now utilized in trienode data
retrieval, improving efficiency.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants