Skip to content

fix: name the missing CounterpartySignature when a LoanSet is submitted without it - #1060

Open
kuan121 wants to merge 1 commit into
mainfrom
fix/dge-8439-loanset-missing-counterparty-signature
Open

kuan121 wants to merge 1 commit into
mainfrom
fix/dge-8439-loanset-missing-counterparty-signature

Conversation

@kuan121

@kuan121 kuan121 commented Oct 8, 2026

Copy link
Copy Markdown
Collaborator

High Level Overview of Change

submit, and therefore submit_and_wait and sign_and_submit, now raises a clear XRPLException when a LoanSet is submitted without the counterparty's signature, instead of passing on rippled's unrelated temBAD_SIGNER message.

Jira: DGE-8439

Context of Change

A LoanSet is signed twice: first by the Account, then by the counterparty through sign_loan_set_by_counterparty. A developer who forgets the second step and submits gets temBAD_SIGNER with rippled's generic text, No signer may duplicate account or other signers, which points at duplicate signers that don't exist. rippled returns it from LoanSet::preflight when CounterpartySignature is missing outside a Batch (LoanSet.cpp:94-97).

submit now raises before sending anything:

LoanSet requires the counterparty's signature (CounterpartySignature). Use sign_loan_set_by_counterparty before submitting.

The condition mirrors rippled's: a top-level LoanSet with no CounterpartySignature and without tfInnerBatchTxn. Inner transactions of a Batch are not checked, since rippled lets an inner LoanSet omit the field. Model validation and sign are unchanged, because the Account signs before the counterparty does.

The same change for xrpl.js is XRPLF/xrpl.js#3532.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)

For this input, submit used to return a response with engine_result: temBAD_SIGNER, and it now raises without sending anything. rippled rejects such a LoanSet in every case, so no working code path changes.

Did you update CHANGELOG.md?

  • Yes

Test Plan

  • Unit tests in the new tests/unit/asyn/transaction/test_submit.py, with the client stubbed:
    • A LoanSet signed only by the Account raises the new error and is never sent.
    • A LoanSet signed by the counterparty is sent.
    • A Batch whose inner LoanSet has no CounterpartySignature is sent.
  • Integration tests: no new ones. The lending and Batch integration suites (16 tests) pass against rippleci/xrpld:develop --standalone (xrpld 3.4.0-rc1).
  • Other tests:
    • The error test fails on main and passes with the fix.
    • The full unit suite, flake8 and mypy --strict pass.

🤖 Generated with Claude Code

…ed without it

rippled rejects a LoanSet without CounterpartySignature in preflight with
temBAD_SIGNER, whose message ("No signer may duplicate account or other
signers") points at the wrong problem. submit now raises an XRPLException
that names CounterpartySignature and sign_loan_set_by_counterparty
instead. A LoanSet flagged tfInnerBatchTxn is exempt, matching rippled.

DGE-8439

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: XRPLF/xrpl-py/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: ed1a7585-c2f4-4d5e-9193-0072a48efd55
📥 Commits

Reviewing files that changed from the base of the PR and between 7a81134 and b907c92.

📒 Files selected for processing (3)
  • CHANGELOG.md
  • tests/unit/asyn/transaction/test_submit.py
  • xrpl/asyncio/transaction/main.py

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 0 remain after this review.


Walkthrough

Async submit now raises XRPLException before sending a LoanSet without a counterparty signature, except for inner batch transactions. Tests cover these cases, and the changelog documents the behavior.

Changes

LoanSet Signature Validation

Layer / File(s) Summary
Submission validation and coverage
xrpl/asyncio/transaction/main.py, tests/unit/asyn/transaction/test_submit.py, CHANGELOG.md
submit checks for a missing counterparty signature on eligible LoanSet transactions. Tests cover rejection, successful submission after counterparty signing, and the inner-batch exception. The changelog describes the error and exception.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Low

Suggested reviewers: pdp2121

Merge Risk: ⚪ Minimal · up to b907c

The intended submission checks appear consistent with the transaction models. No merge-blocking issue was identified.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 42.86% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 7 functions across 2 files. (1 skipped: 1… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description check ✅ Passed The description covers the change, context, bug-fix classification, changelog update, affected APIs, implementation behavior, and test plan. It also includes the relevant Jira issue and reported test …
Title check ✅ Passed The title clearly identifies the primary change: naming the missing CounterpartySignature when submitting a LoanSet without it. It is specific and concise.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 42.86% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 7 functions across 2 files. (1 skipped: 1 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Clean, well-scoped fix: submit now raises a clear XRPLException when a top-level LoanSet lacks CounterpartySignature, mirroring rippled's preflight check and correctly excluding inner Batch transactions via the TF_INNER_BATCH_TXN flag. The added unit tests cover the three relevant cases (missing signature raises, present signature submits, inner Batch LoanSet submits). No correctness, security, or consistency issues found in the changed lines.

This branch has not been deployed

No deployments
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.

1 participant