-
Notifications
You must be signed in to change notification settings - Fork 3.9k
[Hot State] Compute root hash for hot state #18390
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
Merged
+608
−247
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This was referenced Dec 27, 2025
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
f1dac58 to
dd9df3a
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
wqfish
added a commit
that referenced
this pull request
Jan 12, 2026
In #18390, we simply set the format of the hot state Merkle tree to `Map<StateKey, StateValue>`. This means that for `HotVacant` entries, for instance, entries that are read recently and determined to not exist in storage, we do not hash them into the tree. (And if they existed before, we remove them from the Merkle tree.) This is inaccurate. This commit introduces the `HotStateValue` struct and changes the format to `Map<StateKey, HotStateValue>`. This way, both `HotOccupied` and `HotVacant` entries are summarized into the root hash.
wqfish
added a commit
that referenced
this pull request
Jan 12, 2026
In #18390, we simply set the format of the hot state Merkle tree to `Map<StateKey, StateValue>`. This means that for `HotVacant` entries, for instance, entries that are read recently and determined to not exist in storage, we do not hash them into the tree. (And if they existed before, we remove them from the Merkle tree.) This is inaccurate. This commit introduces the `HotStateValue` struct and changes the format to `Map<StateKey, HotStateValue>`. This way, both `HotOccupied` and `HotVacant` entries are summarized into the root hash.
wqfish
added a commit
that referenced
this pull request
Jan 13, 2026
In #18390, we simply set the format of the hot state Merkle tree to `Map<StateKey, StateValue>`. This means that for `HotVacant` entries, for instance, entries that are read recently and determined to not exist in storage, we do not hash them into the tree. (And if they existed before, we remove them from the Merkle tree.) This is inaccurate. This commit introduces the `HotStateValue` struct and changes the format to `Map<StateKey, HotStateValue>`. This way, both `HotOccupied` and `HotVacant` entries are summarized into the root hash. In addition, we now check refresh interval and avoid refreshing read-only keys every block.
wqfish
added a commit
that referenced
this pull request
Jan 13, 2026
In #18390, we simply set the format of the hot state Merkle tree to `Map<StateKey, StateValue>`. This means that for `HotVacant` entries, for instance, entries that are read recently and determined to not exist in storage, we do not hash them into the tree. (And if they existed before, we remove them from the Merkle tree.) This is inaccurate. This commit introduces the `HotStateValue` struct and changes the format to `Map<StateKey, HotStateValue>`. This way, both `HotOccupied` and `HotVacant` entries are summarized into the root hash. In addition, we now check refresh interval and avoid refreshing read-only keys every block.
wqfish
added a commit
that referenced
this pull request
Jan 13, 2026
In #18390, we simply set the format of the hot state Merkle tree to `Map<StateKey, StateValue>`. This means that for `HotVacant` entries, for instance, entries that are read recently and determined to not exist in storage, we do not hash them into the tree. (And if they existed before, we remove them from the Merkle tree.) This is inaccurate. This commit introduces the `HotStateValue` struct and changes the format to `Map<StateKey, HotStateValue>`. This way, both `HotOccupied` and `HotVacant` entries are summarized into the root hash. In addition, we now check refresh interval and avoid refreshing read-only keys every block.
grao1991
approved these changes
Jan 14, 2026
lightmark
approved these changes
Jan 14, 2026
It should only be logged once instead of every time a message is received.
This commit implements the logic to compute root hashes for hot state. It's an initial version with a number of TODO items, but it's a reasonable start. Most of the logic is gated behind a flag so we are not enabling this in mainnet yet, until we run things in testnet for some time and gain more confidence. How this roughly works: - `State::update` computes the changes to hot state. They are saved in `ExecutionOutput`. - The above changes are passed to `StateSummary::update` and used to compute in-memory `SparseMerkleTree`. - The resulting Merkle trees are committed to persisted database (`hot_state_merkle_db` introduced in #18385) so the proofs can be used in turn for future `StateSummary::update`.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Contributor
✅ Forge suite
|
Contributor
✅ Forge suite
|
This comment has been minimized.
This comment has been minimized.
Contributor
✅ Forge suite
|
wqfish
added a commit
that referenced
this pull request
Jan 14, 2026
In #18390, we simply set the format of the hot state Merkle tree to `Map<StateKey, StateValue>`. This means that for `HotVacant` entries, for instance, entries that are read recently and determined to not exist in storage, we do not hash them into the tree. (And if they existed before, we remove them from the Merkle tree.) This is inaccurate. This commit introduces the `HotStateValue` struct and changes the format to `Map<StateKey, HotStateValue>`. This way, both `HotOccupied` and `HotVacant` entries are summarized into the root hash. In addition, we now check refresh interval and avoid refreshing read-only keys every block.
wqfish
added a commit
that referenced
this pull request
Jan 14, 2026
In #18390, we simply set the format of the hot state Merkle tree to `Map<StateKey, StateValue>`. This means that for `HotVacant` entries, for instance, entries that are read recently and determined to not exist in storage, we do not hash them into the tree. (And if they existed before, we remove them from the Merkle tree.) This is inaccurate. This commit introduces the `HotStateValue` struct and changes the format to `Map<StateKey, HotStateValue>`. This way, both `HotOccupied` and `HotVacant` entries are summarized into the root hash. In addition, we now check refresh interval and avoid refreshing read-only keys every block.
wqfish
added a commit
that referenced
this pull request
Jan 14, 2026
In #18390, we simply set the format of the hot state Merkle tree to `Map<StateKey, StateValue>`. This means that for `HotVacant` entries, for instance, entries that are read recently and determined to not exist in storage, we do not hash them into the tree. (And if they existed before, we remove them from the Merkle tree.) This is inaccurate. This commit introduces the `HotStateValue` struct and changes the format to `Map<StateKey, HotStateValue>`. This way, both `HotOccupied` and `HotVacant` entries are summarized into the root hash. In addition, we now check refresh interval and avoid refreshing read-only keys every block.
wqfish
added a commit
that referenced
this pull request
Jan 14, 2026
In #18390, we simply set the format of the hot state Merkle tree to `Map<StateKey, StateValue>`. This means that for `HotVacant` entries, for instance, entries that are read recently and determined to not exist in storage, we do not hash them into the tree. (And if they existed before, we remove them from the Merkle tree.) This is inaccurate. This commit introduces the `HotStateValue` struct and changes the format to `Map<StateKey, HotStateValue>`. This way, both `HotOccupied` and `HotVacant` entries are summarized into the root hash. In addition, we now check refresh interval and avoid refreshing read-only keys every block.
wqfish
added a commit
that referenced
this pull request
Jan 14, 2026
In #18390, we simply set the format of the hot state Merkle tree to `Map<StateKey, StateValue>`. This means that for `HotVacant` entries, for instance, entries that are read recently and determined to not exist in storage, we do not hash them into the tree. (And if they existed before, we remove them from the Merkle tree.) This is inaccurate. This commit introduces the `HotStateValue` struct and changes the format to `Map<StateKey, HotStateValue>`. This way, both `HotOccupied` and `HotVacant` entries are summarized into the root hash. In addition, we now check refresh interval and avoid refreshing read-only keys every block.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
CICD:run-e2e-tests
when this label is present github actions will run all land-blocking e2e tests from the PR
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 commit implements the logic to compute root hashes for hot state. It's an initial version with a number of TODO items, but it's a reasonable start. Most of the logic is gated behind a flag so we are not enabling this in mainnet yet, until we run things in testnet for some time and gain more confidence.
How this roughly works:
State::updatecomputes the changes to hot state. They are saved inExecutionOutput.StateSummary::updateand used to compute in-memorySparseMerkleTree.hot_state_merkle_dbintroduced in [Hot State] Add a separate StateMerkleDb for hot state #18385) so the proofs can be used in turn for futureStateSummary::update.Note
Implements hot state Merkle root computation and persistence, plus plumbs a new config across storage and execution.
HotStateConfig { max_items_per_shard, delete_on_restart, compute_root_hash }and replacesreset_hot_stateparam inAptosDB::open; updates all call sites and tools/testsHotStateUpdates;State::updateproduces hot-state changes;StateSummary::updatecomputes both hot/global SMTs; state checkpointing commits hot and cold JMT batches (tohot_state_merkle_dband main JMT) and validates usagecompute_root_hashdefault true but auto-disabled on Mainnet unless explicitly enabled; readonly/debug paths setdelete_on_restart=falseWritten by Cursor Bugbot for commit 389074b. This will update automatically on new commits. Configure here.