Reduce host sector hashing#447
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR reduces redundant sector hashing during RPCWriteSector handling by computing and reusing cached Merkle subtrees to derive the sector root, avoiding a second full-sector hash later in the storage pipeline.
Changes:
- Extend the
Sectors.StoreSectorinterface to accept precomputed sector subtrees. - Update
RPCWriteSectorserver handling to computeCachedSectorSubtreesonce and deriverootfrom them. - Update tests/utilities to pass the new
StoreSectorarguments and use correct roots.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| testutil/host.go | Updates the in-memory sector store to match the new StoreSector signature. |
| rhp/v4/server.go | Adds subtrees to the Sectors interface and reworks RPCWriteSector to compute root from cached subtrees. |
| rhp/v4/rpc_test.go | Adjusts account-related tests to store/verify sectors using the computed root and subtrees. |
| .changeset/reduced_host_sector_hashing_in_rpcwritesector.md | Adds a patch changeset documenting the behavior change. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
chris124567
approved these changes
Jun 22, 2026
lukechampine
approved these changes
Jun 23, 2026
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Calculating the sector root is a decent chunk of RPC write's round trip time and we currently effectively do it twice: once to calculate the root itself and another to calculate the subtrees in
hostd. This deduplicates the hashing so we're not duplicating work.