Skip to content

rpc/jsonrpc: close getProof's SharedDomains - #22210

Merged
awskii merged 1 commit into
mainfrom
yperbasis/getproof-close-domains
Jul 3, 2026
Merged

rpc/jsonrpc: close getProof's SharedDomains#22210
awskii merged 1 commit into
mainfrom
yperbasis/getproof-close-domains

Conversation

@yperbasis

Copy link
Copy Markdown
Member

getProof creates a SharedDomains for its proof computation and never closes it on any path, leaking the SD's mem batch and commitment trie context on every eth_getProof call. The sibling getWitness already does defer domains.Close().

Found during the review of #22198.

No red test: a missing defer Close has no practical unit-level repro (the leak only shows as memory growth across many calls), so this is a mechanical consistency fix mirroring the adjacent getWitness pattern.

@yperbasis
yperbasis requested a review from Copilot July 3, 2026 10:19
@yperbasis
yperbasis marked this pull request as ready for review July 3, 2026 10:19
@yperbasis
yperbasis requested a review from lupin012 as a code owner July 3, 2026 10:19

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Fixes a resource leak in the JSON-RPC eth_getProof implementation by ensuring the SharedDomains instance created for proof computation is always closed, matching the existing pattern used by the sibling witness path.

Changes:

  • Add defer domains.Close() in getProof after successful execctx.NewSharedDomains(...) creation to prevent per-call leaks of the mem batch and commitment context.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@awskii
awskii enabled auto-merge July 3, 2026 10:49
@awskii
awskii added this pull request to the merge queue Jul 3, 2026
Merged via the queue into main with commit 2dcdf9c Jul 3, 2026
104 of 164 checks passed
@awskii
awskii deleted the yperbasis/getproof-close-domains branch July 3, 2026 15:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants