You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Simplify the ledger view hierarchy and interfaces. - #5461
CheckValidLedgerViewWrapper is gone. It was used only for test compatibility, which is is unnecessary. It was also used outside of tx validation quite a bit, which made it even more confusing.
LedgerTxnReadOnly is renamed to LedgerTxnView for clarity, and now it's used more generally anywhere we need an adapter from LTX to ledger view
executeWithMaybeInnerSnapshot is gone. We only need the hacky pre-p8 logic in 2 places, and now it's used there explicitly (with LedgerTxnView on the child transaction)
All views now provide network config with getSorobanNetworkConfig consistently. We don't use it too broadly at the moment, but it makes sense for views to be able to expose the config (in the same way as it makes sense for them to expose the ledger header).
SorobanNetworkConfig is now loaded using a closure in order to avoid a weird circular dependency that the previous step would introduce (as we used to load the config from an AbstractLedgerView)
ImmutableLedgerData now always automatically loads the network config, which reduces awkwardness around creating a throw-away view (another symptom of the circular dependency weirdness above)
Concrete copyImmutableLedgerView() is only exposed to tests. I still dislike the name (as it's unclear which state does the view represent), but I kept it as is for now to reduce the change amount a bit. All the production users can get by with the new getLCLView() that returns an instance of an abstract ledger view of LCL. Also renamed maybeUpdateImmutableLedgerView to syncWithLCLView for clarity. Consumers also use abstract view, which ties the above changes together.
ledgerView.mSkipSeqNumCheck is gone, we just check the overlay-only mode flag directly.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
LCL synchronization can replace the required in-memory-ledger view with an empty BucketList-backed view.
Get a fresh assessment by requesting another Copilot review.
Review details
Suppressed comments (1)
src/overlay/OverlayManager.h:218
This contract is now stale: getOverlayThreadSnapshot() calls syncWithLCLView() internally on every access, so callers are no longer responsible for refreshing it. Document the automatic refresh to prevent callers from looking for a synchronization API that is no longer exposed here.
// Get a snapshot of ledger state for use by the overlay thread only. Caller
// is responsible for updating the snapshot as needed.
virtual AbstractLedgerView const& getOverlayThreadSnapshot() = 0;
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
LCL synchronization can replace an in-memory-ledger view with an empty BucketList-backed snapshot.
Get a fresh assessment by requesting another Copilot review.
Review details
Suppressed comments (1)
src/ledger/LedgerManagerImpl.cpp:2473
In test builds this bypasses the MODE_USES_IN_MEMORY_LEDGER handling in getLCLView(): the first sync (or any stale sync) installs an ImmutableLedgerView, even though the BucketList is explicitly not populated in that mode. An overlay-thread snapshot then sees missing accounts/config instead of the state held by the root LedgerTxn. Please make synchronization recreate the same owned-LTX-backed view used by getLCLView() for in-memory mode (while accounting for the existing child view's lifetime).
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
The broad refactor touches consensus-critical transaction validation, ledger snapshots, Soroban configuration, and concurrency contracts, with one documentation contract needing correction.
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
It broadly changes consensus-critical ledger access, transaction validation, snapshot ownership, and concurrency boundaries despite no confirmed defect in the reviewed code.
headerMatchesExpected() now duplicates seqMatchesExpected() and no longer checks the header at all, so the stress test cannot detect a mismatch between the view's cached sequence and getLedgerHeader(). Keep this assertion on the header sequence as before.
- CheckValidLedgerViewWrapper is gone. It was used only for test compatibility, which is is unnecessary. It was also used outside of tx validation quite a bit, which made it even more confusing.
- LedgerTxnReadOnly is renamed to LedgerTxnView for clarity, and now it's used more generally anywhere we need an adapter from LTX to ledger view. Moreover, LTX views are now guaranteed to be over immutable LTX via runtime enforcement.
- executeWithMaybeInnerSnapshot is gone. We only need the hacky pre-p8 logic in 2 places, and now it's used there explicitly (with LedgerTxnView on the child transaction)
- All views now provide network config with `getSorobanNetworkConfig` consistently. We don't use it too broadly at the moment, but it makes sense for views to be able to expose the config (in the same way as it makes sense for them to expose the ledger header).
- SorobanNetworkConfig is now loaded using a closure in order to avoid a weird circular dependency that the previous step would introduce (as we used to load the config from an AbstractLedgerView)
- ImmutableLedgerData now always automatically loads the network config, which reduces awkwardness around creating a throw-away view (another symptom of the circular dependency weirdness above)
- Concrete `copyImmutableLedgerView()` is only exposed to tests. I still dislike the name (as it's unclear which state does the view represent), but I kept it as is for now to reduce the change amount a bit. All the production users can get by with the new `getLCLView()` that returns an instance of an abstract ledger view of LCL. Also renamed `maybeUpdateImmutableLedgerView` to `syncWithLCLView` for clarity. Consumers also use abstract view, which ties the above changes together.
- `ledgerView.mSkipSeqNumCheck` is gone, we just check the overlay-only mode flag directly.
- Misc minor cleanups and comment updates.
Brings overlay-v2-shared up to date with master. The previous master
merge (b90d48e, stellar#5428) was recorded with master's tip 100cc38 missing
from its parents, so this merge used 100cc38 as its base (temporary
graft of b90d48e, removed afterwards).
Notable master changes brought in:
- Protocol 30: CURRENT_LEDGER_PROTOCOL_VERSION follows
MAX_SUPPORTED_PROTOCOL_VERSION; CAP-0084 and CAP-0087 ungated, p29 and
p30 Soroban hosts (stellar#5472, stellar#5478, stellar#5484, stellar#5483).
- Millisecond-resolution close times at protocol 30 (stellar#5423):
ConsensusTime/ApplyTime types, STELLAR_VALUE_SIGNED_MS and
STELLAR_VALUE_EMPTY_TX_SET_MS.
- Tx set validity hardening (stellar#5481), lower max message size in protocol
29 (stellar#733), sub-second ledger edge-case fixes.
- Simplified ledger view hierarchy (stellar#5461); the overlay-only-mode
sequence number skip now lives in TransactionFrame::checkValid.
- Banned accounts deprecated (CAP-0077 is active).
- Apply-path performance work (stellar#5402, stellar#5411, stellar#5414, stellar#5415, stellar#5418, stellar#5421,
stellar#5436, stellar#5286), apply-load tx set construction mode (stellar#5448), --check-lcm
(stellar#5435), v29.0.0 release merge.
Conflict resolution:
- Files overlay-v2-shared deleted and master modified (the C++ overlay,
TransactionQueue, TransactionQueueTests, UpgradesTests, private/Horizon/RPC
workflows): kept deleted. Master's changes to them are C++ overlay
peer/flow-control logic, tx queue admission and tests for those.
- Herder: kept the Rust-overlay submission path (recvTransaction returns
TxSubmitStatus) and dropped the deprecated `force` parameter as master did.
triggerNextLedger keeps the prepared/built tx set path from the Rust
mempool, now with ConsensusTime close times and master's apply-time
close-time offset. The early tx set preparation path (prepareTxSet,
buildTxSet, setupTriggerNextLedger) takes ConsensusTime. Kept master's
mNominatedTxSetOverride test hook (applied before the tx set is cached in
the Rust overlay) and the herder.txset.build timer (now timing
buildTxSet). Dropped the banned-accounts setup and tx queue maintenance.
- AppConnector: dropped both ov2's maybeUpdateImmutableLedgerView and
master's C++-overlay getOverlayThreadSnapshot.
- LoadGenerator: master's CachedTestAccountPtr with ov2's TxSubmitStatus.
- Tests: kept ov2's removal of tests that need the C++ overlay, standalone
mode or the tx queue (standalone, manualclose, flooding, tx queue limits,
far-future slot cleanup, herderExternalizesValuesWithProtocol, MAX_SAC_TPS,
custom token, soroswap and noisy binary search apply-load tests). Added
master's ms close time HerderTests and the non-canonical empty tx set test
on ov2's Rust-overlay topologies. The tx set size test checks against
overlay-v2's own tx set allowance. The sub-second
getUpperBoundCloseTimeOffset test checks the offset directly, since there
is no C++ tx queue admission. Tests that used CheckValidLedgerViewWrapper
now use getLCLView().
- Cargo.lock: master's lockfile plus the overlay crate's packages,
regenerated by cargo; semver-compatible duplicates take the newer
version.
- Build: Makefile.am keeps the Rust overlay rules and adds tracy
import-chrome; ci-build.sh keeps ASAN off and takes master's -g1.
- Needed to compile: PendingEnvelopes.cpp includes LedgerManager.h
(master got it through the C++ OverlayManager.h); ov2's early-nomination
and checkpoint-slot tests use ConsensusTime/ApplyTimeOffset; OverlayIPC
tests take ledger views from the LedgerManager.
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
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.
Description
getSorobanNetworkConfigconsistently. We don't use it too broadly at the moment, but it makes sense for views to be able to expose the config (in the same way as it makes sense for them to expose the ledger header).copyImmutableLedgerView()is only exposed to tests. I still dislike the name (as it's unclear which state does the view represent), but I kept it as is for now to reduce the change amount a bit. All the production users can get by with the newgetLCLView()that returns an instance of an abstract ledger view of LCL. Also renamedmaybeUpdateImmutableLedgerViewtosyncWithLCLViewfor clarity. Consumers also use abstract view, which ties the above changes together.ledgerView.mSkipSeqNumCheckis gone, we just check the overlay-only mode flag directly.Checklist
clang-formatv8.0.0 (viamake formator the Visual Studio extension)