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

Pathfinder returns paths with op_too_few_offers and op_over_source_max errors. #180

Open
marcinx opened this issue Sep 8, 2019 · 3 comments · Fixed by #181
Open

Pathfinder returns paths with op_too_few_offers and op_over_source_max errors. #180

marcinx opened this issue Sep 8, 2019 · 3 comments · Fixed by #181
Assignees
Labels
bug Something isn't working

Comments

@marcinx
Copy link

marcinx commented Sep 8, 2019

In some circumstances the pathfinder returns invalid paths, which trigger op_too_few_offers or op_over_source_max errors when used in path payment operations (with a 1.5% padding).

Example:

{
  findPaymentPaths(
    sourceAccountID: "GASKYWPPQ2VSO6KNIPIRVXMSSDGZLYZQ67CDTLVXOXYDG26SPZ66EDCQ",
    destinationAsset: "BTC-GATEMHCCKCY67ZUCKTROYN24ZYT5GK4EQZ65JJLDHKHRUZI3EUEKMTCH",
    destinationAmount: "0.0000010"
  ) {
    sourceAsset {
      id
    }
    destinationAsset {
      id
    }
    sourceAmount
    path {
      id
    }
  }
}

Returns a path for XLM:

      {
        "sourceAsset": {
          "id": "native"
        },
        "destinationAsset": {
          "id": "BTC-GATEMHCCKCY67ZUCKTROYN24ZYT5GK4EQZ65JJLDHKHRUZI3EUEKMTCH"
        },
        "sourceAmount": "0.1699048",
        "path": [
          {
            "id": "BTC-GAUTUYY2THLF7SGITDFMXJVYH3LHDSMGEAKSBU267M2K7A3W543CKUEF"
          }
        ]
      },

When this path is used in path payment with a sendMax parameter of 0.1725623 (sourceAmount + 1.5%) then the tx fails with op_too_few_offers.

Horizon /paths doesn't identify this path at all but returns, e.g.:

      {
        "source_asset_type": "native",
        "source_amount": "0.1718333",
        "destination_asset_type": "credit_alphanum4",
        "destination_asset_code": "BTC",
        "destination_asset_issuer": "GATEMHCCKCY67ZUCKTROYN24ZYT5GK4EQZ65JJLDHKHRUZI3EUEKMTCH",
        "destination_amount": "0.0000010",
        "path": [
          {
            "asset_type": "credit_alphanum4",
            "asset_code": "USD",
            "asset_issuer": "GDUKMGUGDZQK6YHYA5Z6AY2G4XDSZPSZ3SW5UN3ARVMO6QSRDWP5YLEX"
          },
          {
            "asset_type": "credit_alphanum4",
            "asset_code": "CNY",
            "asset_issuer": "GAREELUB43IRHWEASCFBLKHURCGMHE5IF6XSE7EXDLACYHGRHM43RFOX"
          }
        ]
      }

(https://horizon.stellar.org/paths?source_account=GASKYWPPQ2VSO6KNIPIRVXMSSDGZLYZQ67CDTLVXOXYDG26SPZ66EDCQ&destination_account=GASKYWPPQ2VSO6KNIPIRVXMSSDGZLYZQ67CDTLVXOXYDG26SPZ66EDCQ&destination_asset_type=credit_alphanum4&destination_asset_code=BTC&destination_asset_issuer=GATEMHCCKCY67ZUCKTROYN24ZYT5GK4EQZ65JJLDHKHRUZI3EUEKMTCH&destination_amount=0.0000010)

The found astro path doesn't look plausible to me because you normally lose money when going XLM -> BTC -> BTC.

Could you guys have a look? @nebolsin @charlie-wasp

@charlie-wasp
Copy link
Contributor

@marcinx definitely, I'll take a look. Thank you!

@charlie-wasp
Copy link
Contributor

@marcinx hi! I just shipped some changes, which possibly can resolve your issue, would you please check it?

@nebolsin nebolsin added the bug Something isn't working label Sep 20, 2019
@marcinx
Copy link
Author

marcinx commented Sep 23, 2019

Hey! Thanks so much, guys. I will check it out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants