feat(store): cache account witnesses for tracked accounts - #2476
Open
sofiazcoaga wants to merge 5 commits into
Open
feat(store): cache account witnesses for tracked accounts#2476sofiazcoaga wants to merge 5 commits into
sofiazcoaga wants to merge 5 commits into
Conversation
sofiazcoaga
marked this pull request as draft
September 1, 2026 13:34
Contributor
Author
|
@igamigo the issue mentions "we should also keep account witnesses for watched accounts, which we already request anyway", but I deliberately did not add watched accounts to account witness fetching automatically. Watched accounts are only refetched during sync when they have been modified, so for an unmodified one there is no request to reuse. Automatically tracking their account witnesses would mean an RPC call for every watched account on every sync, so a client watching N accounts for observability would pay N extra requests per sync. I believe this should be a conscious decision. Let me know your thoughts on this. |
sofiazcoaga
marked this pull request as ready for review
September 1, 2026 21:35
sofiazcoaga
requested review from
TomasArrachea,
igamigo and
juan518munoz
and removed request for
igamigo and
juan518munoz
September 3, 2026 13:46
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.
Problem
Every FPI transaction fetches the foreign account's AccountWitness from the node. N transactions between two syncs cost N GetAccount requests, even against the same account at the same block.
Changes
Client::track_account_witnessregisters an account whose account witness should be kept fresh. Newaccount_witnessestable, one row per account.syncrefreshes them at the new sync height, up to four requests in flight. Each witness is validated against the synced block header's account root before it is stored.AccountInputslocally. Both fall back to the existing request when there is nothing usable.The cost moves from once per transaction to once per sync.
Closes #2443