-
Notifications
You must be signed in to change notification settings - Fork 1.5k
rpc/jsonrpc: keep request commitment reads off shared BranchCache #22198
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
base: main
Are you sure you want to change the base?
Changes from all commits
4abb4a9
a08d697
a094277
1514c0f
1181e4f
623668d
a986e30
fce4873
6e34782
a511c9a
b675b1d
28e650c
ef4cdc0
9f4198b
0ba6b50
ec93094
e3b0d40
a451883
4cae002
534702f
cff2222
cd71e4a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| // Copyright 2026 The Erigon Authors | ||
| // This file is part of Erigon. | ||
| // | ||
| // Erigon is free software: you can redistribute it and/or modify | ||
| // it under the terms of the GNU Lesser General Public License as published by | ||
| // the Free Software Foundation, either version 3 of the License, or | ||
| // (at your option) any later version. | ||
| // | ||
| // Erigon is distributed in the hope that it will be useful, | ||
| // but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| // GNU Lesser General Public License for more details. | ||
| // | ||
| // You should have received a copy of the GNU Lesser General Public License | ||
| // along with Erigon. If not, see <http://www.gnu.org/licenses/>. | ||
|
|
||
| package jsonrpc | ||
|
|
||
| import ( | ||
| "context" | ||
|
|
||
| "github.com/erigontech/erigon/common/log/v3" | ||
| "github.com/erigontech/erigon/db/kv" | ||
| "github.com/erigontech/erigon/db/state/execctx" | ||
| ) | ||
|
|
||
| func newSnapshotCommitmentDomains(ctx context.Context, tx kv.TemporalTx, logger log.Logger) (*execctx.SharedDomains, error) { | ||
| return execctx.NewSharedDomains(ctx, tx, logger, execctx.WithoutDeferredBranchUpdates(), execctx.WithoutSharedBranchCache(), execctx.WithSequentialCommitment()) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The leak predates this file, but the helper is now the single choke point where it can be closed: sd, err := execctx.NewSharedDomains(ctx, tx, logger, ...)
if err != nil {
if sd != nil {
sd.Close()
}
return nil, err
}
return sd, nil |
||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This rule isn't followed by two request-owned
SharedDomainsinrpc/jsonrpc/receipts:receipts_generator.go:333—calculatePostState && postState.CommitmentHistoryreceipts_generator.go:553— pre-Byzantium slow path,opts.CommitmentHistoryEnabledBoth pass
WithoutDeferredBranchUpdates(), WithSequentialCommitment()on the live RPC temporal tx — the pre-PR option pair of the four sites fixed here, minusWithoutSharedBranchCache()— sosd.branchCacheis attached atdomain_shared.go:392.SetHistoryStateReaderlands after construction, so the constructor's ownSeekCommitment(domain_shared.go:404) reads throughgetLatestMetered, which consults the cache at:1488and read-fills at:1533. An RO request tx pinned at a lagging view, serving a pre-Byzantium receipt on a node with commitment history, publishes itsKeyCommitmentStateunder its own step/txN into an aggregator-lifetime cache.The installed history reader bypasses
sdfor branch reads afterwards, so today it's the one construction-time entry — but the consume direction is the class this PR closes, and a later latest-reader on those sites brings it back whole.Scope lists only #22533 and #22211. Deliberate, or missed? Either move
newSnapshotCommitmentDomainstorpc/rpchelper(both packages already import it) and route both sites through it, or name the issue in Scope.