Problem
src/models/requests/ledger_entry.rs — the DepositPreauth request selector's get_errors() implementation uses a single ExpectedOneOf error for two distinct invalid states:
match (&self.authorized, &self.authorized_credentials) {
(Some(_), Some(_)) | (None, None) => Err(XRPLModelException::ExpectedOneOf(
["authorized", "authorized_credentials"].as_ref(),
)),
_ => Ok(()),
}
Both the too-many-fields case (Some, Some) and the no-fields case (None, None) return the same ExpectedOneOf error. Callers that programmatically inspect the error cannot distinguish between them, which forces them to apply the wrong remediation:
(None, None) → user should add a field
(Some, Some) → user should remove a field
Expected behaviour
Return distinct error variants:
(Some, Some) → XRPLModelException::ValueEqualsValue (or a dedicated "mutually exclusive fields" variant)
(None, None) → XRPLModelException::ExpectedOneOf (correct current use)
Affected code
src/models/requests/ledger_entry.rs — DepositPreauth.get_errors()
- Same pattern exists in
src/models/ledger/objects/deposit_preauth.rs at the ledger object level
Notes
Found during code review of PR #154 (XLS-70 Credentials support). No functional regression in PR #154 — the issue pre-existed and was not introduced by that PR.
Problem
src/models/requests/ledger_entry.rs— theDepositPreauthrequest selector'sget_errors()implementation uses a singleExpectedOneOferror for two distinct invalid states:Both the too-many-fields case
(Some, Some)and the no-fields case(None, None)return the sameExpectedOneOferror. Callers that programmatically inspect the error cannot distinguish between them, which forces them to apply the wrong remediation:(None, None)→ user should add a field(Some, Some)→ user should remove a fieldExpected behaviour
Return distinct error variants:
(Some, Some)→XRPLModelException::ValueEqualsValue(or a dedicated "mutually exclusive fields" variant)(None, None)→XRPLModelException::ExpectedOneOf(correct current use)Affected code
src/models/requests/ledger_entry.rs—DepositPreauth.get_errors()src/models/ledger/objects/deposit_preauth.rsat the ledger object levelNotes
Found during code review of PR #154 (XLS-70 Credentials support). No functional regression in PR #154 — the issue pre-existed and was not introduced by that PR.