Skip to content

Skip building invariant delta when no invariants are enabled. - #5289

Merged
graydon merged 1 commit into
stellar:masterfrom
dmkozh:invariant_skip
Jun 1, 2026
Merged

graydon merged 1 commit into
stellar:masterfrom
dmkozh:invariant_skip

Conversation

@dmkozh

@dmkozh dmkozh commented May 22, 2026

Copy link
Copy Markdown
Contributor

Description

Skip building invariant delta when no invariants are enabled.

The delta is only used for invariants, so also updated the naming to reflect that.

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

Copilot AI review requested due to automatic review settings May 22, 2026 17:47

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

This PR optimizes parallel Soroban transaction application by skipping construction of the ledger-entry delta used for invariant checking when no invariants are configured/enabled, and renames related APIs to make the delta’s purpose explicit.

Changes:

  • Guard delta construction in TransactionFrame::parallelApply behind a new Config::invariantsEnabled() helper.
  • Rename TxEffects/parallel-apply delta APIs to clarify they exist specifically for invariants.
  • Skip checkAllTxBundleInvariants entirely when invariants are disabled, and relocate refundable-fee meta setting accordingly.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/transactions/TransactionFrame.cpp Avoids building invariant-only deltas when invariants are disabled.
src/transactions/ParallelApplyUtils.h Renames thread-state helper to reflect invariant-specific delta.
src/transactions/ParallelApplyUtils.cpp Updates delta construction to write into invariant-specific delta storage.
src/transactions/ParallelApplyStage.h Renames TxEffects delta storage/accessors to invariant-specific names.
src/main/Config.h Adds Config::invariantsEnabled() API.
src/main/Config.cpp Implements Config::invariantsEnabled() based on INVARIANT_CHECKS.
src/ledger/LedgerManagerImpl.cpp Skips invariant checks when disabled; updates delta accessor usage; adjusts refundable-fee meta placement.

Comment thread src/transactions/ParallelApplyUtils.cpp Resolved
Comment thread src/ledger/LedgerManagerImpl.cpp Resolved
The delta is only used for invariants, so also updated the naming to reflect that.
@dmkozh
dmkozh requested a review from sisuresh May 29, 2026 17:12

@graydon graydon 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.

I'm not clear on one of the changes here, otherwise looks ok?

Comment thread src/ledger/LedgerManagerImpl.cpp Resolved
@graydon
graydon added this pull request to the merge queue Jun 1, 2026
Merged via the queue into stellar:master with commit d04bc83 Jun 1, 2026
54 checks passed
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.

3 participants