Skip to content

fix: Disable transaction invariants#7409

Open
Tapanito wants to merge 3 commits into
developfrom
tapanito/disable-tx-invariants
Open

fix: Disable transaction invariants#7409
Tapanito wants to merge 3 commits into
developfrom
tapanito/disable-tx-invariants

Conversation

@Tapanito
Copy link
Copy Markdown
Collaborator

@Tapanito Tapanito commented Jun 5, 2026

This PR disables transaction invariants due to introduced performance regression.

The logic is commented out instead of reverting the invariant PR due to the fact that the invariant PR touches every single transaction.

A pull-request addressing the said regression can be found here: #7404

High Level Overview of Change

Context of Change

API Impact

  • Public API: New feature (new methods and/or new fields)
  • Public API: Breaking change (in general, breaking changes should only impact the next api_version)
  • libxrpl change (any change that may affect libxrpl or dependents of libxrpl)
  • Peer protocol change (must be backward compatible or bump the peer protocol version)

hasInvalidAmount runs on the per-transaction invariant-checking path
(ValidAmounts::finalize) and at preflight, walking every field of every
modified entry. The previous implementation tried a dynamic_cast chain
(STAmount, STObject, STArray) on each field, so every scalar non-amount
field paid three failed RTTI casts.

Dispatch on the serialized type tag via getSType() and a switch instead.
The object-like tags all denote STObject subclasses (STLedgerEntry, STTx),
so the downcast is sound; safeDowncast keeps a dynamic_cast validity
assert in debug builds while compiling to static_cast in release.
@Tapanito Tapanito added the Trivial Simple change with minimal effect, or already tested. Only needs one approval. label Jun 5, 2026
Copy link
Copy Markdown
Contributor

@xrplf-ai-reviewer xrplf-ai-reviewer Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Had a read through

High-severity defense-in-depth concern flagged inline — dropping checkTransactionInvariants entirely is risky; see comment at line 1188.


Review by ReviewBot 🤖

Review by Claude Sonnet 4.6 · Prompt: V15

Comment thread src/libxrpl/tx/Transactor.cpp
@codecov
Copy link
Copy Markdown

codecov Bot commented Jun 5, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 82.1%. Comparing base (6571f75) to head (1105878).
⚠️ Report is 3 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff            @@
##           develop   #7409     +/-   ##
=========================================
- Coverage     82.3%   82.1%   -0.3%     
=========================================
  Files         1011    1011             
  Lines        76913   76910      -3     
  Branches      8965    8967      +2     
=========================================
- Hits         63335   63114    -221     
- Misses       13569   13787    +218     
  Partials         9       9             
Files with missing lines Coverage Δ
src/libxrpl/protocol/STAmount.cpp 88.7% <100.0%> (+<0.1%) ⬆️
src/libxrpl/tx/Transactor.cpp 88.7% <100.0%> (-1.5%) ⬇️

... and 73 files with indirect coverage changes

Impacted file tree graph

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown
Collaborator

@gregtatcam gregtatcam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Copy Markdown
Collaborator

@ximinez ximinez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good, clear explanation.

@ximinez ximinez added this to the 3.2.0 milestone Jun 5, 2026
@Tapanito Tapanito force-pushed the tapanito/disable-tx-invariants branch from 65c620a to 1105878 Compare June 5, 2026 16:04
Copy link
Copy Markdown
Contributor

@xrplf-ai-reviewer xrplf-ai-reviewer Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Intentional temporary disable flagged — no automated guard ensures checkTransactionInvariants is restored for 3.3.0. See inline.

Review by Claude Sonnet 4.6 · Prompt: V15

Comment thread src/libxrpl/tx/Transactor.cpp
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@bthomee bthomee added the Ready to merge *PR author* thinks it's ready to merge. Has passed code review. Perf sign-off may still be required. label Jun 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Ready to merge *PR author* thinks it's ready to merge. Has passed code review. Perf sign-off may still be required. Trivial Simple change with minimal effect, or already tested. Only needs one approval.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants