testpoolswap does not consider all valid paths
What happened:
testpoolswap does not consider all valid paths
For example, the first path is valid but the other paths are considered invalid even though they would yield a higher estimate at the time of writing:
path [TSLA to DUSD, DUSD to DFI, DFI to BTC] yields 9.26410092
defi-cli testpoolswap '{"from":"dLXs788fWMpGoar1WzDnLoNCNYyZVPPozv","tokenFrom":"TSLA","amountFrom":"1000.0","to":"dLXs788fWMpGoar1WzDnLoNCNYyZVPPozv","tokenTo":"BTC"}' '[114, 17, 5]' true
{
"path": "custom",
"pools": [
"114",
"17",
"5"
],
"amount": "9.26410092@2"
}
path [TSLA to DUSD, DUSD to USDT, USDT to DFI, DFI to BTC] would yield 9.48109273
defi-cli testpoolswap '{"from":"dLXs788fWMpGoar1WzDnLoNCNYyZVPPozv","tokenFrom":"TSLA","amountFrom":"1000.0","to":"dLXs788fWMpGoar1WzDnLoNCNYyZVPPozv","tokenTo":"BTC"}' '[114, 101, 6, 5]' true
error code: -32600
error message:
Custom pool path is invalid.
path [TSLA to DUSD, DUSD to USDC, USDC to DFI, DFI to BTC] would yield 9.27572377
defi-cli testpoolswap '{"from":"dLXs788fWMpGoar1WzDnLoNCNYyZVPPozv","tokenFrom":"TSLA","amountFrom":"1000.0","to":"dLXs788fWMpGoar1WzDnLoNCNYyZVPPozv","tokenTo":"BTC"}' '[114, 102, 14, 5]' true
error code: -32600
error message:
Custom pool path is invalid.
What you expected to happen:
I expected the path that yields the highest result to be considered valid.
How to reproduce it (as minimally and precisely as possible):
You can reproduce it by providing a seemingly valid path such as the ones above.
What are your environment parameters:
Using a 2.11.1 full node on Ubuntu.
@pawn-police: Thanks for opening an issue, it is currently awaiting triage.
The triage/accepted label can be added by foundation members by writing /triage accepted in a comment.
Details
I am a bot created to help the DeFiCh developers manage community feedback and contributions. You can check out my manifest file to understand my behavior and what I can do. If you want to use this for your project, you can check out the DeFiCh/oss-governance-bot repository.
Pool swap paths under current consensus are limited to a maximum of three pools.
Thanks for the answer. I was not aware that it is limited to a maximum of three pools under the current consensus.
Do you know if this will change in the future now that swaps through 4 pools can yield a better result than swaps through 3 pools?