Conversation
Convert mutex-protected signature cache metrics to std::atomic with memory_order_relaxed for lock-free updates on the hot path. This reduces contention in parallel signature verification by avoiding mutex acquisition for simple counter increments.
Cache xdr::xdr_size(mEnvelope) result in mCachedSize to avoid repeated XDR size calculations. The envelope is immutable after construction, so this optimization is safe and provides measurable TPS improvement.
Add static copySearchableHotArchiveBucketListSnapshot() overload that creates a deep copy from an existing snapshot. This enables efficient snapshot copying in parallel apply without re-acquiring the snapshot manager lock.
Instead of the main thread waiting idle while worker threads process all clusters, have the main thread process cluster 0 directly. This improves CPU utilization by eliminating idle time on the main thread.
Track which keys existed in the LedgerTxn before parallel apply via mOriginalLedgerTxnKeys. Use this to call createWithoutLoading() or updateWithoutLoading() instead of expensive load() calls during commit. Also clone snapshots from GlobalParallelApplyLedgerState instead of re-acquiring from the snapshot manager, ensuring consistency.
Replace xdrSha256(success) with streaming SHA256 calculation to avoid XDR re-serialization of InvokeHostFunctionSuccessPreImage. The return value and events are already available as XDR-encoded bytes, so we can hash them directly without round-trip serialization.
…nConfig Allows callers with a pre-fetched SorobanNetworkConfig to pass it directly, avoiding redundant config lookups during validation. The original overload now delegates to the new one after fetching the config.
This variable was declared but never used.
Adds parallel processing to transaction set handling: 1. Parallel TxFrame creation: Creates TxFrames from XDR envelopes in parallel during transaction set deserialization. Uses work-stealing via std::async with even distribution across available threads. 2. Parallel transaction validation: Validates transactions in parallel in txsAreValid() when there are 2+ transactions. 3. Hash precomputation: Precomputes content and full hashes before parallel operations to avoid race conditions. 4. Test coverage: Adds StreamingShaTest for InvokeHostFunctionSuccessPreImage verification. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add sizeBytes field to ContractDataMapEntryT to cache the XDR serialized size of ledger entries. This avoids repeated xdr_size() calls during state updates, reducing CPU overhead in the hot path. Also adds Tracy zone to updateState() for profiling visibility. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add verify_ed25519_signature_batch_dalek() for potential future batch signature verification. Uses ed25519_dalek's verify_batch for efficient multi-signature verification. Security: Pre-filters weak keys (small-order points) to maintain parity with the strict single-signature verification. Note: This function is not currently called from C++ but provides infrastructure for future batch verification optimizations. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Updates p25 submodule to include: - charge_direct fast path: Skips Arc lock for shadow mode budget charging - Scratch buffer reuse: Reuses Vec in get_ledger_changes() loop to avoid repeated allocations when computing old entry sizes These optimizations reduce overhead in the Soroban host during transaction execution. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Documents the following successful TPS optimizations: - 001: Main thread helps parallel apply - 002: Without-loading commit optimization - 003: Cached getSize for TransactionFrame - 005: Soroban budget charge_direct fast path - 007: Parallel TxFrame creation Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Implements the TransactionFrame override for the checkValid virtual method that accepts a pre-loaded SorobanNetworkConfig pointer, matching the implementation in FeeBumpTransactionFrame.
During ledger close, three independent operations are now parallelized: - addHotArchiveBatch (modifies mHotArchiveBucketList) - addLiveBatch (modifies mLiveBucketList) - runs on main thread - updateInMemorySorobanState (modifies mInMemorySorobanState) These operations modify completely independent data structures and can safely run concurrently. Added getInMemorySorobanStateForUpdate() to allow direct access to mInMemorySorobanState during COMMITTING phase. This reduces ledger close latency by overlapping CPU-bound operations.
- Remove RUN_STANDALONE requirement from parallelLedgerClose() - Add assertApplyOrMainThread() helper to allow APPLY thread access - Update hasLastClosedSorobanNetworkConfig() and getLastClosedSorobanNetworkConfig() to use the new helper - Enable PARALLEL_LEDGER_APPLY in max-sac-tps benchmark config This fixes a thread assertion failure when running max-sac-tps benchmarks with background ledger close enabled.
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.
Description
Resolves #X
Checklist
clang-formatv8.0.0 (viamake formator the Visual Studio extension)