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

Protocol 18: Horizon path/strict-receive Bug #4014

Closed
mootz12 opened this issue Oct 18, 2021 · 8 comments · Fixed by #4018
Closed

Protocol 18: Horizon path/strict-receive Bug #4014

mootz12 opened this issue Oct 18, 2021 · 8 comments · Fixed by #4018
Labels

Comments

@mootz12
Copy link

mootz12 commented Oct 18, 2021

What version are you using?

Currently deployed Horizon API @ https://horizon-testnet.stellar.org

Time of writing: 2021-10-18T21:41:29Z

What did you do?

The paths/strict-receive endpoint is returning paths through liquidity pools that are impossible. Note: Due to the risk of the paths / offers / liquidity pools changing, I will attach the API results returned at the time of writing this to the bug.

Setup

The Testnet is currently setup with a simple price wall bot, that issues 4 assets, ETH, EURT, USDC, and BTC, that follow the Coinbase / Binance price for each asset. It does this by setting a single deep Buy/Sell wall for each asset to USDC.

We also issue a testnet version of YBX.

All of this is actively traded on and used with the YieldBlox Beta, on the testnet.

User LP Construction

Users of our Beta have been playing around with AMM's / LP. Some users have setup YBX -> ETH / EURT / USDC / BTC pools in hopes to capture users selling the testnet YBX.

https://horizon-testnet.stellar.org/liquidity_pools?reserves=YBX%3AGCIWMQHPST7LQ7V4LHAF2UP6ZSDCFRYYP7IM4BBAFSBZMVTR3BB4OQZ5&limit=200
See Response

{
  "_links": {
    "self": {
      "href": "https://horizon-testnet.stellar.org/liquidity_pools?cursor=\u0026limit=200\u0026order=asc\u0026reserves=YBX%3AGCIWMQHPST7LQ7V4LHAF2UP6ZSDCFRYYP7IM4BBAFSBZMVTR3BB4OQZ5"
    },
    "next": {
      "href": "https://horizon-testnet.stellar.org/liquidity_pools?cursor=d600a004ecf7d07b4b2305ae9a7305e402bed3e0a16375ca948177c25798a65d\u0026limit=200\u0026order=asc\u0026reserves=YBX%3AGCIWMQHPST7LQ7V4LHAF2UP6ZSDCFRYYP7IM4BBAFSBZMVTR3BB4OQZ5"
    },
    "prev": {
      "href": "https://horizon-testnet.stellar.org/liquidity_pools?cursor=1d02ef4a3485858732314f46436f66a6ca5c9b8b27ed15297838856088eee405\u0026limit=200\u0026order=desc\u0026reserves=YBX%3AGCIWMQHPST7LQ7V4LHAF2UP6ZSDCFRYYP7IM4BBAFSBZMVTR3BB4OQZ5"
    }
  },
  "_embedded": {
    "records": [
      {
        "_links": {
          "self": {
            "href": "https://horizon-testnet.stellar.org/liquidity_pools/1d02ef4a3485858732314f46436f66a6ca5c9b8b27ed15297838856088eee405"
          },
          "transactions": {
            "href": "https://horizon-testnet.stellar.org/liquidity_pools/1d02ef4a3485858732314f46436f66a6ca5c9b8b27ed15297838856088eee405/transactions{?cursor,limit,order}",
            "templated": true
          },
          "operations": {
            "href": "https://horizon-testnet.stellar.org/liquidity_pools/1d02ef4a3485858732314f46436f66a6ca5c9b8b27ed15297838856088eee405/operations{?cursor,limit,order}",
            "templated": true
          }
        },
        "id": "1d02ef4a3485858732314f46436f66a6ca5c9b8b27ed15297838856088eee405",
        "paging_token": "1d02ef4a3485858732314f46436f66a6ca5c9b8b27ed15297838856088eee405",
        "fee_bp": 30,
        "type": "constant_product",
        "total_trustlines": "1",
        "total_shares": "0.3000000",
        "reserves": [
          {
            "asset": "ETH:GATPY6X6OYTXKNRKVP6LEMUUQKFDUW5P7HL4XI3KWRCY52RAWYJ5FLMC",
            "amount": "0.0900000"
          },
          {
            "asset": "YBX:GCIWMQHPST7LQ7V4LHAF2UP6ZSDCFRYYP7IM4BBAFSBZMVTR3BB4OQZ5",
            "amount": "1.0000000"
          }
        ],
        "last_modified_ledger": 535983,
        "last_modified_time": "2021-10-17T23:53:00Z"
      },
      {
        "_links": {
          "self": {
            "href": "https://horizon-testnet.stellar.org/liquidity_pools/2597e7b5de1efefa25e3acc923ba8e1c316d725ef706ec931b2ae22f6cc5917d"
          },
          "transactions": {
            "href": "https://horizon-testnet.stellar.org/liquidity_pools/2597e7b5de1efefa25e3acc923ba8e1c316d725ef706ec931b2ae22f6cc5917d/transactions{?cursor,limit,order}",
            "templated": true
          },
          "operations": {
            "href": "https://horizon-testnet.stellar.org/liquidity_pools/2597e7b5de1efefa25e3acc923ba8e1c316d725ef706ec931b2ae22f6cc5917d/operations{?cursor,limit,order}",
            "templated": true
          }
        },
        "id": "2597e7b5de1efefa25e3acc923ba8e1c316d725ef706ec931b2ae22f6cc5917d",
        "paging_token": "2597e7b5de1efefa25e3acc923ba8e1c316d725ef706ec931b2ae22f6cc5917d",
        "fee_bp": 30,
        "type": "constant_product",
        "total_trustlines": "1",
        "total_shares": "0.3000000",
        "reserves": [
          {
            "asset": "BTC:GA2RETJWNREEUY4JHMZVXCE6EJG6MGBUEXK2QXXMNE5EYAQMG22XCXHA",
            "amount": "0.0453280"
          },
          {
            "asset": "YBX:GCIWMQHPST7LQ7V4LHAF2UP6ZSDCFRYYP7IM4BBAFSBZMVTR3BB4OQZ5",
            "amount": "1.9884933"
          }
        ],
        "last_modified_ledger": 545722,
        "last_modified_time": "2021-10-18T14:06:19Z"
      },
      {
        "_links": {
          "self": {
            "href": "https://horizon-testnet.stellar.org/liquidity_pools/8befeda8331d526bd871acb00d770b1d372df7d33342a3fb4f17041a76136d66"
          },
          "transactions": {
            "href": "https://horizon-testnet.stellar.org/liquidity_pools/8befeda8331d526bd871acb00d770b1d372df7d33342a3fb4f17041a76136d66/transactions{?cursor,limit,order}",
            "templated": true
          },
          "operations": {
            "href": "https://horizon-testnet.stellar.org/liquidity_pools/8befeda8331d526bd871acb00d770b1d372df7d33342a3fb4f17041a76136d66/operations{?cursor,limit,order}",
            "templated": true
          }
        },
        "id": "8befeda8331d526bd871acb00d770b1d372df7d33342a3fb4f17041a76136d66",
        "paging_token": "8befeda8331d526bd871acb00d770b1d372df7d33342a3fb4f17041a76136d66",
        "fee_bp": 30,
        "type": "constant_product",
        "total_trustlines": "1",
        "total_shares": "1.0000000",
        "reserves": [
          {
            "asset": "EURT:GABHG6C7YL2WA2ZJSONPD6ZBWLPAWKYDPYMK6BQRFLZXPQE7IBSTMPNN",
            "amount": "87.1648100"
          },
          {
            "asset": "YBX:GCIWMQHPST7LQ7V4LHAF2UP6ZSDCFRYYP7IM4BBAFSBZMVTR3BB4OQZ5",
            "amount": "0.0115067"
          }
        ],
        "last_modified_ledger": 545722,
        "last_modified_time": "2021-10-18T14:06:19Z"
      },
      {
        "_links": {
          "self": {
            "href": "https://horizon-testnet.stellar.org/liquidity_pools/d600a004ecf7d07b4b2305ae9a7305e402bed3e0a16375ca948177c25798a65d"
          },
          "transactions": {
            "href": "https://horizon-testnet.stellar.org/liquidity_pools/d600a004ecf7d07b4b2305ae9a7305e402bed3e0a16375ca948177c25798a65d/transactions{?cursor,limit,order}",
            "templated": true
          },
          "operations": {
            "href": "https://horizon-testnet.stellar.org/liquidity_pools/d600a004ecf7d07b4b2305ae9a7305e402bed3e0a16375ca948177c25798a65d/operations{?cursor,limit,order}",
            "templated": true
          }
        },
        "id": "d600a004ecf7d07b4b2305ae9a7305e402bed3e0a16375ca948177c25798a65d",
        "paging_token": "d600a004ecf7d07b4b2305ae9a7305e402bed3e0a16375ca948177c25798a65d",
        "fee_bp": 30,
        "type": "constant_product",
        "total_trustlines": "1",
        "total_shares": "3.1622776",
        "reserves": [
          {
            "asset": "USDC:GAEB3HSAWRVILER6T5NMX5VAPTK4PPO2BAL37HR2EOUIK567GJFEO437",
            "amount": "11.5066115"
          },
          {
            "asset": "YBX:GCIWMQHPST7LQ7V4LHAF2UP6ZSDCFRYYP7IM4BBAFSBZMVTR3BB4OQZ5",
            "amount": "0.9133346"
          }
        ],
        "last_modified_ledger": 532154,
        "last_modified_time": "2021-10-17T18:16:49Z"
      }
    ]
  }
}

Incorrect Path

A few paths appear to be broken. Here is an ETH -> USDC Path Strict Receive example that is returning an invalid path:

https://horizon-testnet.stellar.org/paths/strict-receive?source_assets=ETH%3AGATPY6X6OYTXKNRKVP6LEMUUQKFDUW5P7HL4XI3KWRCY52RAWYJ5FLMC&destination_asset_type=credit_alphanum4&destination_asset_issuer=GAEB3HSAWRVILER6T5NMX5VAPTK4PPO2BAL37HR2EOUIK567GJFEO437&destination_asset_code=USDC&destination_amount=70000
See Response

{
  "_embedded": {
    "records": [
      {
        "source_asset_type": "credit_alphanum4",
        "source_asset_code": "ETH",
        "source_asset_issuer": "GATPY6X6OYTXKNRKVP6LEMUUQKFDUW5P7HL4XI3KWRCY52RAWYJ5FLMC",
        "source_amount": "2.0400907",
        "destination_asset_type": "credit_alphanum4",
        "destination_asset_code": "USDC",
        "destination_asset_issuer": "GAEB3HSAWRVILER6T5NMX5VAPTK4PPO2BAL37HR2EOUIK567GJFEO437",
        "destination_amount": "70000.0000000",
        "path": [
          {
            "asset_type": "credit_alphanum4",
            "asset_code": "YBX",
            "asset_issuer": "GCIWMQHPST7LQ7V4LHAF2UP6ZSDCFRYYP7IM4BBAFSBZMVTR3BB4OQZ5"
          },
          {
            "asset_type": "credit_alphanum4",
            "asset_code": "BTC",
            "asset_issuer": "GA2RETJWNREEUY4JHMZVXCE6EJG6MGBUEXK2QXXMNE5EYAQMG22XCXHA"
          }
        ]
      },
      {
        "source_asset_type": "credit_alphanum4",
        "source_asset_code": "ETH",
        "source_asset_issuer": "GATPY6X6OYTXKNRKVP6LEMUUQKFDUW5P7HL4XI3KWRCY52RAWYJ5FLMC",
        "source_amount": "18.7390000",
        "destination_asset_type": "credit_alphanum4",
        "destination_asset_code": "USDC",
        "destination_asset_issuer": "GAEB3HSAWRVILER6T5NMX5VAPTK4PPO2BAL37HR2EOUIK567GJFEO437",
        "destination_amount": "70000.0000000",
        "path": []
      }
    ]
  }
}

If I attempt to submit against this path using a PathPaymentStrictReceive, it fails to submit. This transaction contains a tiny amount, to showcase the path we are taking, and then an operation for the quoted amount.

Example XDR:

AAAAAgAAAADhdUrGPilU8IQzfUz7TMYP8Q8bfw1IZ/gQwVBOf9Sp9QAAAMgAA6Y3AAAAJgAAAAEAAAAAAAAAAAAAAABhbgiXAAAAAAAAAAIAAAAAAAAAAgAAAAFFVEgAAAAAACb8ev52J3U2Kqv8sjKUgoo6W6/518ujarRFjuogthPSAAAAAACYloAAAAAA4XVKxj4pVPCEM31M+0zGD/EPG38NSGf4EMFQTn/UqfUAAAABVVNEQwAAAAAIHZ5AtGqFkj6fWsv2oHzVx73aCBe/njojqIV33zJKRwAAAAAAmJaAAAAAAgAAAAFZQlgAAAAAAJFmQO+U/rh+vFnAXVH+zIYixxh/0M4EICyDllZx2EPHAAAAAUJUQwAAAAAANRJNNmxISmOJOzNbiJ4iTeYYNCXVqF7saTpMAgw2tXEAAAAAAAAAAgAAAAFFVEgAAAAAACb8ev52J3U2Kqv8sjKUgoo6W6/518ujarRFjuogthPSAAAAAAL68IAAAAAA4XVKxj4pVPCEM31M+0zGD/EPG38NSGf4EMFQTn/UqfUAAAABVVNEQwAAAAAIHZ5AtGqFkj6fWsv2oHzVx73aCBe/njojqIV33zJKRwAAAJdXBOQAAAAAAgAAAAFZQlgAAAAAAJFmQO+U/rh+vFnAXVH+zIYixxh/0M4EICyDllZx2EPHAAAAAUJUQwAAAAAANRJNNmxISmOJOzNbiJ4iTeYYNCXVqF7saTpMAgw2tXEAAAAAAAAAAX/UqfUAAABAAVOnxn/JVgsmSsDbvaaNlx7ETKDKZbGh4NEgcyBIl7F2k/2DVqtb11oeBe50GoTCTjThcbHGu7y8XzZJ3ZjPDA==

Tx Result XDR:

AAAAAAAAAMj/////AAAAAgAAAAAAAAACAAAAAAAAAAMAAAACHQLvSjSFhYcyMU9GQ29mpspcm4sn7RUpeDiFYIju5AUAAAABWUJYAAAAAACRZkDvlP64frxZwF1R/syGIscYf9DOBCAsg5ZWcdhDxwAAAAAAABvbAAAAAUVUSAAAAAAAJvx6/nYndTYqq/yyMpSCijpbr/nXy6NqtEWO6iC2E9IAAAAAAAAChQAAAAIll+e13h7++iXjrMkjuo4cMW1yXvcG7JMbKuIvbMWRfQAAAAFCVEMAAAAAADUSTTZsSEpjiTszW4ieIk3mGDQl1ahe7Gk6TAIMNrVxAAAAAAAAAKIAAAABWUJYAAAAAACRZkDvlP64frxZwF1R/syGIscYf9DOBCAsg5ZWcdhDxwAAAAAAABvbAAAAAQAAAAAIHZ5AtGqFkj6fWsv2oHzVx73aCBe/njojqIV33zJKRwAAAAAABZ1bAAAAAVVTREMAAAAACB2eQLRqhZI+n1rL9qB81ce92ggXv546I6iFd98ySkcAAAAAAJiWgAAAAAFCVEMAAAAAADUSTTZsSEpjiTszW4ieIk3mGDQl1ahe7Gk6TAIMNrVxAAAAAAAAAKIAAAAA4XVKxj4pVPCEM31M+0zGD/EPG38NSGf4EMFQTn/UqfUAAAABVVNEQwAAAAAIHZ5AtGqFkj6fWsv2oHzVx73aCBe/njojqIV33zJKRwAAAAAAmJaAAAAAAAAAAAL////2AAAAAA==

If you check out the result XDR, the first operation succeeds and you can see the path is taking us through the liquidity pools for Testnet YBX. Then, the second operation with the same path and quoted volume from path/strict-receive is failing with too_few_offers.

I also attached the relevant offer that the path takes at the end to convert BTC -> USDC, to show that there is enough liquidity in that offer to convert the final Path Payment.

https://horizon-testnet.stellar.org/offers/368002
See Response

{
  "_links": {
    "self": {
      "href": "https://horizon-testnet.stellar.org/offers/368002"
    },
    "offer_maker": {
      "href": "https://horizon-testnet.stellar.org/accounts/GAEB3HSAWRVILER6T5NMX5VAPTK4PPO2BAL37HR2EOUIK567GJFEO437"
    }
  },
  "id": "368002",
  "paging_token": "368002",
  "seller": "GAEB3HSAWRVILER6T5NMX5VAPTK4PPO2BAL37HR2EOUIK567GJFEO437",
  "selling": {
    "asset_type": "credit_alphanum4",
    "asset_code": "USDC",
    "asset_issuer": "GAEB3HSAWRVILER6T5NMX5VAPTK4PPO2BAL37HR2EOUIK567GJFEO437"
  },
  "buying": {
    "asset_type": "credit_alphanum4",
    "asset_code": "BTC",
    "asset_issuer": "GA2RETJWNREEUY4JHMZVXCE6EJG6MGBUEXK2QXXMNE5EYAQMG22XCXHA"
  },
  "amount": "100000000.0000000",
  "price_r": {
    "n": 81,
    "d": 5000000
  },
  "price": "0.0000162",
  "last_modified_ledger": 552326,
  "last_modified_time": "2021-10-18T23:45:13Z"
}

What did you expect to see?

I expect the Path endpoints to correctly calculate possible paths through liquidity pools.

What did you see instead?

The path endpoint returned a path that we were not able to traverse.

@mootz12 mootz12 added the bug label Oct 18, 2021
@Firdausfarul
Copy link

Firdausfarul commented Oct 19, 2021

I think the algorithm accidentally swapped the pair when it's fetching the liquidity pool balance data.
Time of writing : 2021-10-19T11:22:29Z

Here is my step :

  1. Pick a pair that have it's own liquidity pool (like USDC-YBX)
  2. Fetch the USDC-YBX liquidity pool
    https://horizon-testnet.stellar.org/liquidity_pools/d600a004ecf7d07b4b2305ae9a7305e402bed3e0a16375ca948177c25798a65d

Result at my time :

USDC : 81.7596979 YBX : 0.1288722
{
  "_links": {
    "self": {
      "href": "https://horizon-testnet.stellar.org/liquidity_pools/d600a004ecf7d07b4b2305ae9a7305e402bed3e0a16375ca948177c25798a65d"
    },
    "transactions": {
      "href": "https://horizon-testnet.stellar.org/liquidity_pools/d600a004ecf7d07b4b2305ae9a7305e402bed3e0a16375ca948177c25798a65d/transactions{?cursor,limit,order}",
      "templated": true
    },
    "operations": {
      "href": "https://horizon-testnet.stellar.org/liquidity_pools/d600a004ecf7d07b4b2305ae9a7305e402bed3e0a16375ca948177c25798a65d/operations{?cursor,limit,order}",
      "templated": true
    }
  },
  "id": "d600a004ecf7d07b4b2305ae9a7305e402bed3e0a16375ca948177c25798a65d",
  "paging_token": "d600a004ecf7d07b4b2305ae9a7305e402bed3e0a16375ca948177c25798a65d",
  "fee_bp": 30,
  "type": "constant_product",
  "total_trustlines": "1",
  "total_shares": "3.1622776",
  "reserves": [
    {
      "asset": "USDC:GAEB3HSAWRVILER6T5NMX5VAPTK4PPO2BAL37HR2EOUIK567GJFEO437",
      "amount": "81.7596979"
    },
    {
      "asset": "YBX:GCIWMQHPST7LQ7V4LHAF2UP6ZSDCFRYYP7IM4BBAFSBZMVTR3BB4OQZ5",
      "amount": "0.1288722"
    }
  ],
  "last_modified_ledger": 557365,
  "last_modified_time": "2021-10-19T07:06:52Z"
}
  1. Try to find the max destination-amount by using paths/strict-receive API
    The max destination-amount also indicate the balances of the pool. For example, if a liquidity pool have 1 YBX : 10 USDC balances, you can't trade and receive more than 1 YBX or 10 USD. Using binary search, the max destination-amount I can get is
USDC : 0.1288721 YBX : 81.7596978
Fetch `paths/strict-receive` for USDC -> YBX and vice versa, look for the one without intermediary path, using binary search, this is what i found

https://horizon-testnet.stellar.org/paths/strict-receive?source_assets=USDC%3AGAEB3HSAWRVILER6T5NMX5VAPTK4PPO2BAL37HR2EOUIK567GJFEO437&destination_asset_type=credit_alphanum4&destination_asset_issuer=GCIWMQHPST7LQ7V4LHAF2UP6ZSDCFRYYP7IM4BBAFSBZMVTR3BB4OQZ5&destination_asset_code=YBX&destination_amount=81.7596978

Response
{
  "_embedded": {
    "records": [
      {
        "source_asset_type": "credit_alphanum4",
        "source_asset_code": "USDC",
        "source_asset_issuer": "GAEB3HSAWRVILER6T5NMX5VAPTK4PPO2BAL37HR2EOUIK567GJFEO437",
        "source_amount": "0.2035282",
        "destination_asset_type": "credit_alphanum4",
        "destination_asset_code": "YBX",
        "destination_asset_issuer": "GCIWMQHPST7LQ7V4LHAF2UP6ZSDCFRYYP7IM4BBAFSBZMVTR3BB4OQZ5",
        "destination_amount": "81.7596978",
        "path": [
          {
            "asset_type": "credit_alphanum4",
            "asset_code": "EURT",
            "asset_issuer": "GABHG6C7YL2WA2ZJSONPD6ZBWLPAWKYDPYMK6BQRFLZXPQE7IBSTMPNN"
          }
        ]
      },
      {
        "source_asset_type": "credit_alphanum4",
        "source_asset_code": "USDC",
        "source_asset_issuer": "GAEB3HSAWRVILER6T5NMX5VAPTK4PPO2BAL37HR2EOUIK567GJFEO437",
        "source_amount": "105682568.9751371",
        "destination_asset_type": "credit_alphanum4",
        "destination_asset_code": "YBX",
        "destination_asset_issuer": "GCIWMQHPST7LQ7V4LHAF2UP6ZSDCFRYYP7IM4BBAFSBZMVTR3BB4OQZ5",
        "destination_amount": "81.7596978",
        "path": []
      }
    ]
  }
}
and

https://horizon-testnet.stellar.org/paths/strict-receive?source_assets=YBX%3AGCIWMQHPST7LQ7V4LHAF2UP6ZSDCFRYYP7IM4BBAFSBZMVTR3BB4OQZ5&destination_asset_type=credit_alphanum4&destination_asset_issuer=GAEB3HSAWRVILER6T5NMX5VAPTK4PPO2BAL37HR2EOUIK567GJFEO437&destination_asset_code=USDC&destination_amount=0.1288721

Response
{
  "_embedded": {
    "records": [
      {
        "source_asset_type": "credit_alphanum4",
        "source_asset_code": "YBX",
        "source_asset_issuer": "GCIWMQHPST7LQ7V4LHAF2UP6ZSDCFRYYP7IM4BBAFSBZMVTR3BB4OQZ5",
        "source_amount": "0.0000001",
        "destination_asset_type": "credit_alphanum4",
        "destination_asset_code": "USDC",
        "destination_asset_issuer": "GAEB3HSAWRVILER6T5NMX5VAPTK4PPO2BAL37HR2EOUIK567GJFEO437",
        "destination_amount": "0.1288721",
        "path": [
          {
            "asset_type": "credit_alphanum4",
            "asset_code": "BTC",
            "asset_issuer": "GA2RETJWNREEUY4JHMZVXCE6EJG6MGBUEXK2QXXMNE5EYAQMG22XCXHA"
          }
        ]
      },
      {
        "source_asset_type": "credit_alphanum4",
        "source_asset_code": "YBX",
        "source_asset_issuer": "GCIWMQHPST7LQ7V4LHAF2UP6ZSDCFRYYP7IM4BBAFSBZMVTR3BB4OQZ5",
        "source_amount": "0.0000010",
        "destination_asset_type": "credit_alphanum4",
        "destination_asset_code": "USDC",
        "destination_asset_issuer": "GAEB3HSAWRVILER6T5NMX5VAPTK4PPO2BAL37HR2EOUIK567GJFEO437",
        "destination_amount": "0.1288721",
        "path": [
          {
            "asset_type": "credit_alphanum4",
            "asset_code": "ETH",
            "asset_issuer": "GATPY6X6OYTXKNRKVP6LEMUUQKFDUW5P7HL4XI3KWRCY52RAWYJ5FLMC"
          }
        ]
      },
      {
        "source_asset_type": "credit_alphanum4",
        "source_asset_code": "YBX",
        "source_asset_issuer": "GCIWMQHPST7LQ7V4LHAF2UP6ZSDCFRYYP7IM4BBAFSBZMVTR3BB4OQZ5",
        "source_amount": "0.1933082",
        "destination_asset_type": "credit_alphanum4",
        "destination_asset_code": "USDC",
        "destination_asset_issuer": "GAEB3HSAWRVILER6T5NMX5VAPTK4PPO2BAL37HR2EOUIK567GJFEO437",
        "destination_amount": "0.1288721",
        "path": [
          {
            "asset_type": "credit_alphanum4",
            "asset_code": "XLM",
            "asset_issuer": "GBYKCGLHDZBI32XPO2Z6T76CSYMN2RDZ5L25EK2CHBGWSGEJJUMQ4QKI"
          }
        ]
      },
      {
        "source_asset_type": "credit_alphanum4",
        "source_asset_code": "YBX",
        "source_asset_issuer": "GCIWMQHPST7LQ7V4LHAF2UP6ZSDCFRYYP7IM4BBAFSBZMVTR3BB4OQZ5",
        "source_amount": "105682487.0986820",
        "destination_asset_type": "credit_alphanum4",
        "destination_asset_code": "USDC",
        "destination_asset_issuer": "GAEB3HSAWRVILER6T5NMX5VAPTK4PPO2BAL37HR2EOUIK567GJFEO437",
        "destination_amount": "0.1288721",
        "path": []
      }
    ]
  }
}

Notice something weird? The Liquidity Pool balance swapped. This skew the exchange rate and avaible liquidity and fucks up the calculation.

In your request, the error compounded and resulted in a very weird response

Edit : fixing markdown

@ire-and-curses
Copy link
Member

Very clear report, thanks. We're checking this out as a matter of urgency.

@bartekn
Copy link
Contributor

bartekn commented Oct 21, 2021

Closed in #4018?

@Shaptic
Copy link
Contributor

Shaptic commented Oct 21, 2021

Hopefully! Please reopen if it's not the case.

@Shaptic Shaptic closed this as completed Oct 21, 2021
@2opremio
Copy link
Contributor

The fix for this issue will be released on Monday as part of Horizon 2.10.0 if no unexpected problems are found.

@2opremio
Copy link
Contributor

The fix has been deployed to testnet https://horizon-testnet.stellar.org/

@mootz12 @Firdausfarul could you please confirm you cannot reproduce the problem any more?

@Firdausfarul
Copy link

The fix has been deployed to testnet https://horizon-testnet.stellar.org/

@mootz12 @Firdausfarul could you please confirm you cannot reproduce the problem any more?

Confirmed, the problem cannot be reproduced anymore.

@2opremio
Copy link
Contributor

Fantastic, thanks again for the great bug report!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants