Skip to content

fix: Reject non-Vault ledger entries in getVault#1320

Merged
ckeshava merged 3 commits into
ripple:mainfrom
ckeshava:fixGetVault
May 4, 2026
Merged

fix: Reject non-Vault ledger entries in getVault#1320
ckeshava merged 3 commits into
ripple:mainfrom
ckeshava:fixGetVault

Conversation

@ckeshava

Copy link
Copy Markdown
Contributor

High Level Overview of Change

The existing implementation of several get<LedgerObject> methods in the Explorer do not validate the type of ledger-objects. This has led to cases where user specifies the hash of a PermissonedDomain object however they are redirected to a Vault page incorrectly.

This bug was discovered with the input EF98FDBA404CBEB4F746DA1026B859E260BBB459D111268F6A26BBC7C4811A04 on the XRPL Devnet. This value points to a PermissionedDomain, however users are incorrectly directly to the Vault Page.

Note: other rippled-related methods have not been updated in this PR because they have not exhibited a strong need for a strong response type-check. This also enables a nimble bug-fix PR.

Solution proposed in this PR:

  • Add a LedgerEntryType === 'Vault' guard in getVault. Any other
    ledger entry type now rejects with Error('Not a Vault', 404).
  • Add src/rippled/lib/test/rippled.test.ts with unit-test coverage
    for getVault's success path and every error branch.

This PR is deployed in the dev environment of the Explorer: https://devnet.dev.ripplex.io/. Typing the above hash in the SearchBar should show a message akin to "No txn/nft/vault found for this hash"/

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
  • Translation Updates
  • Release

Test Plan

A new unit test file has been introduced.

  getVault returned any ledger object at the given index, so a hash
  that resolves to (e.g.) a PermissionedDomain on devnet was surfaced
  as a Vault by the search bar and Vault page. Guard on
  LedgerEntryType === 'Vault' and add unit tests covering the new
  case plus the existing error branches.
throw new Error(resp.error_message, 500)
}

if (resp.node?.LedgerEntryType !== 'Vault') {

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.

I think PR is not deployed on Dev environment. This give SAV page instead of 404 - https://devnet.dev.ripplex.io/vault/EF98FDBA404CBEB4F746DA1026B859E260BBB459D111268F6A26BBC7C4811A04

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Yea I think the deployment failed if you check github actions

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, the deployment failed due to an unspecified reason. Please take another look, it should be working now. https://devnet.dev.ripplex.io/search/EF98FDBA404CBEB4F746DA1026B859E260BBB459D111268F6A26BBC7C4811A04

@ckeshava ckeshava requested review from Patel-Raj11 and pdp2121 April 28, 2026 17:37
Patel-Raj11
Patel-Raj11 previously approved these changes Apr 28, 2026

@cybele-ripple cybele-ripple Apr 28, 2026

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.

Approved with 1 note: should we create a new issue to add in unit test coverage for the other functions in rippled.ts?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@cybele-ripple cybele-ripple self-requested a review April 28, 2026 18:03
cybele-ripple
cybele-ripple previously approved these changes Apr 28, 2026
…L, getMPTIssuance, getLoanBroker. This commit also adds unit tests
@ckeshava ckeshava dismissed stale reviews from cybele-ripple and Patel-Raj11 via fc33034 April 28, 2026 18:26
@ckeshava ckeshava merged commit 7909df7 into ripple:main May 4, 2026
6 checks passed
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.

4 participants