Skip to content
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

The ledger command does not include "delivered_amount" field in transaction metadata #3431

Open
carlhua opened this issue Jun 3, 2020 · 7 comments
Assignees
Labels
API Change Bug Good First Issue Great issue for a new contributor Potential Bounty Idea RIPD Export Exported from legacy JIRA issue tracking

Comments

@carlhua
Copy link
Contributor

carlhua commented Jun 3, 2020

Issue Description

The ledger RPC command has a different format for metadata than the tx RPC command. In the ledger command's response, metaData (not meta) is found. DeliveredAmount (not delivered_amount) is found. It is also missing validated field. This should be fixed to match tx command's response.

Steps to Reproduce

  1. Go to https://xrpl.org/websocket-api-tool.html#ledger

  2. Choose full history server and send the following request
    { "id": 1, "command": "ledger", "ledger_index": 36527098, "full": false, "expand": true, "transactions": true, "accounts": false }

  3. Search the output for BFC631D4C12229F6F2BD14203349100356DFB72F4FD4067B9C7A4EFAB9850770. Note you'll find "metaData" (not "meta"), that contains "DeliveredAmount" (not "delivered_amount") and no "validated" field.

  4. Go to https://xrpl.org/websocket-api-tool.html#tx

  5. Post
    { "id": 1, "command": "tx", "transaction": "BFC631D4C12229F6F2BD14203349100356DFB72F4FD4067B9C7A4EFAB9850770" }

  6. You'll find "meta", "delivered_amount" and "validated".

Expected Result

Actual Result

Environment

Supporting Files

sample outputs are included.
ledger.txt
tx.txt

Exported from RIPD-1599

@carlhua carlhua added Bug RIPD Export Exported from legacy JIRA issue tracking labels Jun 3, 2020
@intelliot
Copy link
Collaborator

intelliot commented Jun 3, 2020

This is related: https://github.com/ripple/rippled/issues/2599

[Sorry for closing -- accidental click.]

@intelliot intelliot reopened this Jun 3, 2020
@cjcobb23
Copy link
Contributor

cjcobb23 commented Jun 3, 2020

I looked into this. The "meta" vs "metaData" issue is because of here: https://github.com/ripple/rippled/blob/f43aeda49c5362dc83c66507cae2ec71cfa7bfdf/src/ripple/app/ledger/impl/LedgerToJson.cpp#L133 We even will use "meta" if you request binary data, but "metaData" otherwise. Definitely should fix that.

"validated" is not a field of each transaction, but applies to all of the returned data. Either all of the data is validated, or none is. If you scroll all the way to the bottom, you will find "validated" : true. So, this output is as expected, and is not a bug.

I did not see "DeliveredAmount" in the output. I only saw "delivered_amount". I traced the code as well and could not find how "DeliveredAmount" could possibly end up in the output. This is the code that populates the delivered amount field: https://github.com/ripple/rippled/blob/f43aeda49c5362dc83c66507cae2ec71cfa7bfdf/src/ripple/rpc/impl/DeliveredAmount.cpp#L154

@cjcobb23 cjcobb23 added the Good First Issue Great issue for a new contributor label Jun 3, 2020
@cjcobb23
Copy link
Contributor

cjcobb23 commented Jun 3, 2020

I reran this with the exact request that you specified and was able to see "DeliveredAmount". I saw a "DeliveredAmount" field as well as a "delivered_amount" field. Previously I had tried with a different ledger, and there was only "delivered_amount".

@mDuo13
Copy link
Collaborator

mDuo13 commented Jun 9, 2020

DeliveredAmount is a raw data field that is included in the canonical metadata format (including in binary) and contributes to the hash of the ledger. We cannot remove or change it without an amendment.

delivered_amount is a synthetic field that is added by the API. It covers some cases that DeliveredAmount doesn't (e.g. cases with a fixed payment amount) so that you can always use delivered_amount instead of sometimes using the Amount from the payment. This is documented in the Transaction Metadata page.

Also, the meta vs. metaData thing is part of a much bigger problem thoroughly described in XRPLF/clio#722 as @intelliot mentioned above.

@Neyromancer
Copy link

Hi I could try to fix it.

@mDuo13 mDuo13 changed the title delivered_amount vs DeliveredAmount (Version: 1.5.0) The ledger command does not include "delivered_amount" field in transaction metadata Mar 15, 2021
@intelliot intelliot added this to the 1.14 milestone Aug 2, 2023
@giorgosHadji
Copy link

Is this being worked by someone? I can also pick it.

@intelliot
Copy link
Collaborator

@giorgosHadji - I do not think anyone is working on this. You can pick it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API Change Bug Good First Issue Great issue for a new contributor Potential Bounty Idea RIPD Export Exported from legacy JIRA issue tracking
Projects
Status: 📋 Backlog
Development

No branches or pull requests

6 participants