Skip to content

Pathfinder returns paths with op_too_few_offers and op_over_source_max errors. #180

@marcinx

Description

@marcinx

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

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions