Repository navigation
feat: Support Lending Protocol V1_1 #3456
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
f6d5a69
2ba705a
01b86e9
f18643c
3e3e051
42c3df1
ca1bddb
17d8d5c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,6 +12,8 @@ import { | |
| validateOptionalField, | ||
| isAccount, | ||
| isNumber, | ||
| validateCredentialsList, | ||
| MAX_AUTHORIZED_CREDENTIALS, | ||
| } from './common' | ||
|
|
||
| /** | ||
|
|
@@ -41,6 +43,12 @@ export interface LoanBrokerCoverWithdraw extends BaseTransaction { | |
| * Arbitrary tag identifying the reason for the withdrawal to the destination. | ||
| */ | ||
| DestinationTag?: number | ||
|
|
||
| /** | ||
| * The credentials to authorize the withdrawal when the destination is gated | ||
| * by a permissioned domain (XLS-70). | ||
| */ | ||
| CredentialIDs?: string[] | ||
| } | ||
|
|
||
| /** | ||
|
|
@@ -59,6 +67,13 @@ export function validateLoanBrokerCoverWithdraw( | |
| validateOptionalField(tx, 'Destination', isAccount) | ||
| validateOptionalField(tx, 'DestinationTag', isNumber) | ||
|
|
||
| validateCredentialsList( | ||
| tx.CredentialIDs, | ||
| tx.TransactionType, | ||
| true, | ||
| MAX_AUTHORIZED_CREDENTIALS, | ||
| ) | ||
|
Comment on lines
+70
to
+75
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win 🔎 Supported by static analysis🏁 Script executed: #!/bin/bash
set -euo pipefail
rg -n -C 5 \
'function validateCredentialsList|CredentialIDs|class Vector256|static from\(.*Vector256' \
packages
# Verify that each CredentialIDs caller rejects a non-64-character or non-hex ID
# before binary serialization.Repository: XRPLF/xrpl.js Length of output: 50369 🏁 Script executed: #!/bin/bash
set -euo pipefail
printf '%s\n' '--- repository conventions and learnings ---'
find /tmp/coderabbit-repo-knowledge/xrplf-xrpl-js-b940f79e -type f -name '*.md' -maxdepth 3 -print
printf '%s\n' '--- changed transaction and exact validator ---'
sed -n '1,110p' packages/xrpl/src/models/transactions/loanBrokerCoverWithdraw.ts
sed -n '1090,1165p' packages/xrpl/src/models/transactions/common.ts
printf '%s\n' '--- Vector256 implementation and codec dispatch ---'
sed -n '1,180p' packages/ripple-binary-codec/src/types/vector-256.ts
rg -n -C 4 'Vector256|vector-256|fromHex|parseHex|Hash256' packages/ripple-binary-codec/srcRepository: XRPLF/xrpl.js Length of output: 50369 🏁 Script executed: #!/bin/bash
set -euo pipefail
printf '%s\n' '--- applicable repository conventions ---'
cat /tmp/coderabbit-repo-knowledge/xrplf-xrpl-js-b940f79e/learnings/packages-xrpl-src-models-transactions.md
printf '%s\n' '--- Hash256 contract ---'
sed -n '1,150p' packages/ripple-binary-codec/src/types/hash-256.ts
printf '%s\n' '--- CredentialIDs field definition ---'
sed -n '3698,3722p' packages/ripple-binary-codec/src/enums/definitions.json
printf '%s\n' '--- serialization dispatch ---'
rg -n -C 8 'typeForField|Vector256|serializeObject|serialize.*field|field.*type' packages/ripple-binary-codec/src/binary.ts packages/ripple-binary-codec/src/*.ts packages/ripple-binary-codec/src/typesRepository: XRPLF/xrpl.js Length of output: 33411 🏁 Script executed: #!/bin/bash
set -euo pipefail
printf '%s\n' '--- Hash.from and hex validation ---'
sed -n '1,220p' packages/ripple-binary-codec/src/types/hash.ts
printf '%s\n' '--- field type association and write path ---'
sed -n '1,90p' packages/ripple-binary-codec/src/types/index.ts
sed -n '80,115p' packages/ripple-binary-codec/src/binary.ts
rg -n -C 5 'writeFieldAndValue|associatedType|from\\(value' packages/ripple-binary-codec/src/serdes packages/ripple-binary-codec/src/enums packages/ripple-binary-codec/src/types/serialized-type.tsRepository: XRPLF/xrpl.js Length of output: 5169 Validate each credential ID as a 256-bit hexadecimal value.
🤖 Prompt for AI AgentsSource: Linters/SAST tools
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is the shared validator used by 9+ existing transactions, and malformed IDs are still rejected downstream by
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
A shared model-level validation change should update all You are interacting with an AI system. |
||
|
|
||
| if (!isLedgerEntryId(tx.LoanBrokerID)) { | ||
| throw new ValidationError( | ||
| `LoanBrokerCoverWithdraw: LoanBrokerID must be 64 characters hexadecimal string`, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this change be for 2.12.0 or later?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The definitions for LP1.1 has already been included in the release for codec 2.11.0 and already mentioned in HISTORY so we just need to remove this line