XRPLF / rippled

Decentralized cryptocurrency blockchain daemon implementing the XRP Ledger protocol in C++
https://xrpl.org
ISC License
4.52k stars 1.46k forks source link

Sign-and-submit mode doesn't autofill the correct tx fee (Version: rippled 2.1.0) #5070

Open mvadari opened 3 months ago

mvadari commented 3 months ago

Issue Description

In sign-and-submit mode, rippled does not properly autofill the transaction fee when the transaction requires a fee higher than normal (e.g. AMMCreate, EscrowFinish with a fulfillment, AccountDelete).

Steps to Reproduce

On a standalone node:

{
  command: 'submit',
  tx_json: {
    TransactionType: 'AMMCreate',
    Account: 'rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh',
    Amount: '10000',
    Amount2: {
      value: '1',
      currency: 'USD',
      issuer: 'rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh'
    },
    TradingFee: '0'
  },
  secret: 'snoPBrXtMeMyMHUVTgbuqAfg1SUTb'
}

Expected Result

I expected this transaction to succeed (well, technically it gets terNO_RIPPLE). The fee is not provided, so rippled should autofill the fee correctly. When I enter in the correct fee myself instead of expecting autofilling, I correctly get terNO_RIPPLE.

Actual Result

I get telINSUF_FEE_P, since the autofilled fee is "10".

Full output:

{
    "id": 1,
    "result": {
        "deprecated": "Signing support in the 'submit' command has been deprecated and will be removed in a future version of the server. Please migrate to a standalone signing tool.",
        "engine_result": "telINSUF_FEE_P",
        "engine_result_code": -394,
        "engine_result_message": "Fee insufficient.",
        "tx_blob": "1200231500002280000000240000000161400000000000271068400000000000000A6BD4838D7EA4C680000000000000000000000000005553440000000000B5F762798A53D543A014CAF8B297CFF8F2F937E873210330E7FC9D56BB25D6893BA3F317AE5BCF33B3291BD63DB32654A313222F7FD0207446304402203F39F1D60BEEEF52077875DA7F6E7DC31C2ABCF7086A871DCB781792ACA4C03F02204E98362E3A789C7C2D20F28014C168D2951F82FEBE96CA2388726C101A4CB29E8114B5F762798A53D543A014CAF8B297CFF8F2F937E8",
        "tx_json": {
            "Account": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
            "Amount": "10000",
            "Amount2": {
                "currency": "USD",
                "issuer": "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
                "value": "1"
            },
            "Fee": "10",
            "Flags": 2147483648,
            "Sequence": 1,
            "SigningPubKey": "0330E7FC9D56BB25D6893BA3F317AE5BCF33B3291BD63DB32654A313222F7FD020",
            "TradingFee": 0,
            "TransactionType": "AMMCreate",
            "TxnSignature": "304402203F39F1D60BEEEF52077875DA7F6E7DC31C2ABCF7086A871DCB781792ACA4C03F02204E98362E3A789C7C2D20F28014C168D2951F82FEBE96CA2388726C101A4CB29E",
            "hash": "32B702834ADA61B44E64C62DFDD017E3BA6FF4298ED0C2D2A5B2742512F567D2"
        }
    },
    "type": "response"
}
mvadari commented 3 months ago

This will likely be solved as a byproduct of #5069