XRPLF / rippled

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

Negative LPTokenValue following AMMWithdraw transaction #5015

Open donovanhide opened 1 month ago

donovanhide commented 1 month ago
 rippled -q json amm_info '{"asset":{"currency":"XRP"},"asset2":{"currency":"446F676500000000000000000000000000000000","issuer":"rKRXaQi8wQrYNs3MRHdyFpf3zWRV62xmPa"}}'
{
   "result" : {
      "amm" : {
         "account" : "rGzyAVXRUoHR6UWB2GbSeJ55B4Wa1JHFB4",
         "amount" : "0",
         "amount2" : {
            "currency" : "446F676500000000000000000000000000000000",
            "issuer" : "rKRXaQi8wQrYNs3MRHdyFpf3zWRV62xmPa",
            "value" : "0"
         },
         "asset2_frozen" : false,
         "auction_slot" : {
            "account" : "rMFyohsvH6zNvyjEiZCDXfPmpdpy4KPkhX",
            "discounted_fee" : 5,
            "expiration" : "2024-04-22T22:00:12+0000",
            "price" : {
               "currency" : "0349194ECF9F5CBC59BF04CB08D85FF6651055DC",
               "issuer" : "rGzyAVXRUoHR6UWB2GbSeJ55B4Wa1JHFB4",
               "value" : "0"
            },
            "time_interval" : 20
         },
         "lp_token" : {
            "currency" : "0349194ECF9F5CBC59BF04CB08D85FF6651055DC",
            "issuer" : "rGzyAVXRUoHR6UWB2GbSeJ55B4Wa1JHFB4",
            "value" : "-0.000001"
         },
         "trading_fee" : 50,
         "vote_slots" : [
            {
               "account" : "rMFyohsvH6zNvyjEiZCDXfPmpdpy4KPkhX",
               "trading_fee" : 50,
               "vote_weight" : 100000
            }
         ]
      },
      "ledger_current_index" : 87898741,
      "status" : "success",
      "validated" : false
   }
}

as a result of this AMMWithdraw transaction: https://livenet.xrpl.org/transactions/846057F4E027590A502653BBAFD524C1D72D01EAA71233065E0A58D0CF3DCEEF/raw

donovanhide commented 1 month ago

Possibly this needs to be less than or equal to zero, or the rounding and/or floating point backwards and forwards needs to be fixed: https://github.com/XRPLF/rippled/blob/f4da2e31d93e921f1742a6c7c2120409cba4810e/src/ripple/app/tx/impl/AMMWithdraw.cpp#L385