-
Notifications
You must be signed in to change notification settings - Fork 5
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
Modify findTransitiveTransfer to call the pathfinder service #165
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
juanenrisley
previously approved these changes
Mar 20, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍🏿 💯
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #164
Modify the
findTransitiveTransfer
method to make request to the pathfinder service API instead of thecircles-api
.The core constructor requires two new parameters:
pathfinderServiceEndpoint
andpathfinderType
.The format of the response of the pathfinder server has changed wrt the cli version. The pathfinder server output is:
While the cli output is:
The optional parameters for the pathfinder
compute_transfer
method have changed:hops
is not available anymore.max_transfers
is used by the pathfinder service to try to remove individual transfers to stay below the limit, even if this results in less value being transferred.Furthermore, the logic of
token.transfer
is improved by trying first a direct transfer with the token of the 'to' address, and if not possible then try with the token of the 'from' address.Moreover, we adapted the tests to work with automatic block mining enabled (
blockTime
option in ganache): adding loops to wait for the data to be available in the blockchain.The Token tests are parametrized to either deploy a core instance with the
pathfinderType
ascli
orserver
.While implementing this PR, I've found out something interesting: the
checkSendLimit
method of the core checks the sent limit of the token of the 'from' address, which is contradictory with the policy of "returning tokens to their owners". This method is only used by myxo when calculating maxFlow. I suggest we refactor the method to include the tokenOwner as param too. #168Another discussion is whether the max_steps = 52 is too large. #166
Finally there is a possible issue to explore: if we transfer all the balance of a token that was supposed to be used for paying the relayer for the tx gas, would it generate an error? #167