Skip to content

fix: incorrect SField definitions for Lending Protocols and DynamicMPTs#918

Merged
pdp2121 merged 2 commits into
mainfrom
fix-lending-protocol-definitions
Mar 2, 2026
Merged

fix: incorrect SField definitions for Lending Protocols and DynamicMPTs#918
pdp2121 merged 2 commits into
mainfrom
fix-lending-protocol-definitions

Conversation

@pdp2121

@pdp2121 pdp2121 commented Mar 2, 2026

Copy link
Copy Markdown
Collaborator

High Level Overview of Change

Fix incorrect entries to binary-codec definitions.json:

  • sfMutableFlags (DynamicMPT): Defined as nth=54 instead of the correct nth=53. This causes xrpl-py to serialize MutableFlags with the field code that rippled assigns to sfStartDate, corrupting transactions on the write path.
  • sfStartDate (Lending Protocol): Entirely missing from xrpl-py's definitions. UInt32 nth=54 is incorrectly occupied by MutableFlags. Any xrpl-py application building Lending transactions (LoanSet) cannot include the sfStartDate field, and when decoding binary containing sfStartDate, the field is misidentified as "MutableFlags".
  • sfPreviousPaymentDueDate (Lending Protocol): Misspelled as PreviousPaymentDate. Code using the authoritative rippled field name will fail with field-not-found errors.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Refactor (non-breaking change that only restructures code)
  • Tests (You added tests for code that already exists, or your new feature included in this PR)
  • Documentation Updates
  • Release

Did you update CHANGELOG.md?

  • Yes
  • No, this change does not impact library users

@coderabbitai

coderabbitai Bot commented Mar 2, 2026

Copy link
Copy Markdown
Contributor

Walkthrough

Updated a single binary codec definitions JSON: added MutableFlags and StartDate fields, renamed PreviousPaymentDate to PreviousPaymentDueDate, reorganized LoanScale entries across blocks, added terNO_DELEGATE_PERMISSION error, and extended/reordered transaction type mappings (new loan-related types).

Changes

Cohort / File(s) Summary
Definitions Schema
xrpl/core/binarycodec/definitions/definitions.json
Added MutableFlags (nth 53) and StartDate (nth 54); renamed PreviousPaymentDatePreviousPaymentDueDate (nth 57); moved/added/removed LoanScale entries across loan-related blocks; added terNO_DELEGATE_PERMISSION (-85) to TRANSACTION_RESULTS; updated TRANSACTION_TYPES ordering and added loan types (LoanBrokerSet, LoanBrokerDelete, LoanBrokerCoverClawback, LoanSet).
Changelog
CHANGELOG.md
Documented mapping corrections for sfMutableFlags, sfStartDate, and sfPreviousPaymentDueDate under Unreleased Fixed section; minor formatting additions.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 I hopped through JSON fields anew,

MutableFlags and StartDate flew,
LoanScale bounced from block to block,
Errors added, types unlock,
A rabbit cheers—definitions grew!

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: fixing incorrect SField definitions for Lending Protocols and DynamicMPTs in the binary codec, matching the changeset focus on definitions.json corrections.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description check ✅ Passed The pull request description is comprehensive and well-structured, addressing all required template sections with clear details about the bug fixes, their impact, and the changes made.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix-lending-protocol-definitions

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 and usage tips.

@coderabbitai coderabbitai Bot 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.

🧹 Nitpick comments (1)
xrpl/core/binarycodec/definitions/definitions.json (1)

695-710: Document generator provenance for these definitions.json updates.

Please include which upstream source/generation step produced the Line 695–Line 710 changes so this generated artifact remains reproducible.

Based on learnings: The definitions.json file in XRPL is a generated file and should not be directly edited.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@xrpl/core/binarycodec/definitions/definitions.json` around lines 695 - 710,
The changes to definitions.json (entries around the "UInt32" nth:53 and
"StartDate" nth:54) are generated and must record their provenance rather than
being edited in-place; revert any manual edits to definitions.json and instead
update the generation pipeline: document the upstream source/commit/tag and
generation step that produced these entries (e.g., XRPL definitions repo/commit
and the generator script), add a short provenance metadata block (source repo +
commit SHA + generator command) to the build/generation artifacts or README used
by the generator, and always regenerate definitions.json via the documented
generator (referencing the "StartDate" and the adjacent "UInt32" field entries
to validate the regenerated output).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@xrpl/core/binarycodec/definitions/definitions.json`:
- Around line 695-710: The changes to definitions.json (entries around the
"UInt32" nth:53 and "StartDate" nth:54) are generated and must record their
provenance rather than being edited in-place; revert any manual edits to
definitions.json and instead update the generation pipeline: document the
upstream source/commit/tag and generation step that produced these entries
(e.g., XRPL definitions repo/commit and the generator script), add a short
provenance metadata block (source repo + commit SHA + generator command) to the
build/generation artifacts or README used by the generator, and always
regenerate definitions.json via the documented generator (referencing the
"StartDate" and the adjacent "UInt32" field entries to validate the regenerated
output).

ℹ️ Review info

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 43d0e33 and 12ac4a8.

📒 Files selected for processing (1)
  • xrpl/core/binarycodec/definitions/definitions.json

@pdp2121 pdp2121 requested review from Patel-Raj11 and ckeshava March 2, 2026 20:23

@coderabbitai coderabbitai Bot 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.

🧹 Nitpick comments (1)
CHANGELOG.md (1)

14-17: Improve phrasing and consider expanding the changelog entry.

Two observations:

  1. The phrasing "Fixed correct mapping" is redundant. Consider: "Corrected mapping of..." or "Fixed incorrect mapping of..."

  2. The AI summary indicates this PR includes additional changes beyond the three fields mentioned (e.g., LoanScale reorganization, terNO_DELEGATE_PERMISSION error code, transaction type mappings). Verify whether those changes should also be documented in the changelog for completeness.

📝 Suggested phrasing improvement
 ### Fixed
 
-- Fixed correct mapping of `sfMutableFlags`, `sfStartDate`, and `sfPreviousPaymentDueDate` fields in the binary codec `definitions.json`.
+- Corrected mapping of `sfMutableFlags`, `sfStartDate`, and `sfPreviousPaymentDueDate` fields in the binary codec `definitions.json`.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@CHANGELOG.md` around lines 14 - 17, Reword the changelog entry to remove
redundant phrasing and add any other notable changes from this PR: change "Fixed
correct mapping of `sfMutableFlags`, `sfStartDate`, and
`sfPreviousPaymentDueDate` fields in the binary codec `definitions.json`." to
something like "Corrected mapping of `sfMutableFlags`, `sfStartDate`, and
`sfPreviousPaymentDueDate` in `definitions.json`." and, if the PR also includes
the LoanScale reorganization, the new terNO_DELEGATE_PERMISSION error code, or
updates to transaction type mappings, append short bullet lines mentioning those
(e.g., "Reorganized LoanScale", "Added terNO_DELEGATE_PERMISSION error code",
"Updated transaction type mappings") so the changelog reflects all relevant
changes from this change set.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@CHANGELOG.md`:
- Around line 14-17: Reword the changelog entry to remove redundant phrasing and
add any other notable changes from this PR: change "Fixed correct mapping of
`sfMutableFlags`, `sfStartDate`, and `sfPreviousPaymentDueDate` fields in the
binary codec `definitions.json`." to something like "Corrected mapping of
`sfMutableFlags`, `sfStartDate`, and `sfPreviousPaymentDueDate` in
`definitions.json`." and, if the PR also includes the LoanScale reorganization,
the new terNO_DELEGATE_PERMISSION error code, or updates to transaction type
mappings, append short bullet lines mentioning those (e.g., "Reorganized
LoanScale", "Added terNO_DELEGATE_PERMISSION error code", "Updated transaction
type mappings") so the changelog reflects all relevant changes from this change
set.

ℹ️ Review info

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 12ac4a8 and 0d16e41.

📒 Files selected for processing (1)
  • CHANGELOG.md

@pdp2121 pdp2121 merged commit 827baa6 into main Mar 2, 2026
15 checks passed
@pdp2121 pdp2121 deleted the fix-lending-protocol-definitions branch March 2, 2026 22:29
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