futureversecom / trn-seed

Implementation of The Root Network node in Rust, based on the Substrate framework.

Home Page:https://www.therootnetwork.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Bug | Dex] Unable to swap between assets of differing decimals

aidan-starke opened this issue · comments

Currently on Porcini we have a couple pools that aren't working; XRP:SYLO & XRP:ASTO

Attempting to swap with either of these pools results in either InsufficientInputAmount error, or InvalidConstantProduct error.

Replicating the exact liquidity pools on a local node, these same swaps go through without issue

Note: This is a critical issue

Potential steps to resolution:

    1. This issue occurs on Porcini (testnet) and not locally (when reserves of tokens are the same); hence we need to fork the state of porcini and run/debug it on a local running seed node
    • This PR should allow us to fork porcini state and run against that: #546
      • command: cargo run -- --chain=fork.json --execution=Native --alice --tmp --unsafe-ws-external --unsafe-rpc-external --rpc-cors=all
        • where fork.json is porcini state
    1. Potentially run another local node with the same reserves of Sylo (any 18dp asset) and XRP (native gas currency - ID 2)
    1. Debug and figure out why on porcini-state-node do we get error (InsufficientInputAmount) - while on a clean node with the same reserves the error is not encountered
    • IDelaly you'd need to debug/watch the variable values and where they would deviate from the 2 running nodes

Screenshot 2023-04-18 at 5 33 30 PM

Adding same liquidity reserve on porcini state (locally running chain ends up with InvalidConstantProduct issue) and local chain works fine... Please check the attached values from debugging.. One value which is different is balance_0 and balance_0_adjusted

commented

I believe this has been resolved, can you confirm @aidan-starke @KarishmaBothara

Confirmed, this has been resolved