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

Feature/pathfinder integration #3157

Closed

Conversation

nicscl
Copy link

@nicscl nicscl commented Dec 11, 2024

Integrating Pathfinder Route Discovery (Step 1)

This PR implements Step 1 of the Pathfinder integration: adding the core route discovery functionality. The changes include:

Changes Made

  1. Added new module pathfinder.rs in crates/solver/src/interactions/ with:

    • Data structures for deserializing JSON responses
    • fetch_transfer_steps function for querying the pathfinder API
    • Comprehensive validation and error handling
  2. Updated dependencies in Cargo.toml:

    • Added reqwest with JSON features
    • Added httpmock for testing
  3. Added unit tests covering:

    • Successful route discovery
    • Empty route handling
    • Insufficient flow validation

Implementation Details

The implementation follows JSON-RPC standards and includes:

  • Type-safe deserialization of responses
  • Proper error handling and validation
  • Comprehensive test coverage using mock HTTP server

Testing

All tests are passing:

running 3 tests
test interactions::pathfinder::tests::test_fetch_transfer_steps_no_steps ... ok
test interactions::pathfinder::tests::test_fetch_transfer_steps_insufficient_flow ... ok
test interactions::pathfinder::tests::test_fetch_transfer_steps_success ... ok

Next Steps

This PR sets up the foundation for:

  1. Integration with circle_ubi.rs for settlement transaction generation
  2. Handling scenarios where no route is available
  3. Adding configuration for pathfinder endpoint URLs

Notes

  • The endpoint URL will need to be configured based on the deployment environment
  • Error handling follows the codebase's conventions using anyhow
  • All new code is documented with rustdoc comments

@nicscl nicscl requested a review from a team as a code owner December 11, 2024 03:51
Copy link

CLA Assistant Lite bot:
Thank you for your submission, we really appreciate it. Like many open-source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution. You can sign the CLA by just posting a Pull Request Comment same as the below format.


I have read the CLA Document and I hereby sign the CLA


You can retrigger this bot by commenting recheck in this Pull Request

@nicscl nicscl closed this Dec 11, 2024
@nicscl nicscl deleted the feature/pathfinder-integration branch December 11, 2024 03:52
@github-actions github-actions bot locked and limited conversation to collaborators Dec 11, 2024
@nicscl nicscl restored the feature/pathfinder-integration branch December 11, 2024 03:53
@nicscl nicscl deleted the feature/pathfinder-integration branch December 11, 2024 03:53
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant