Skip to content

Ai test - #1

Open
SirTyson wants to merge 21 commits into
masterfrom
ai-test
Open

Ai test#1
SirTyson wants to merge 21 commits into
masterfrom
ai-test

Conversation

@SirTyson

@SirTyson SirTyson commented Feb 2, 2026

Copy link
Copy Markdown
Owner

Description

Resolves #X

Checklist

  • Reviewed the contributing document
  • Rebased on top of master (no merge commits)
  • Ran clang-format v8.0.0 (via make format or the Visual Studio extension)
  • Compiles
  • Ran all tests
  • If change impacts performance, include supporting evidence per the performance document

SirTyson and others added 15 commits February 2, 2026 14:27
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.
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.

2 participants