Skip to content

Conversation

@mkurapov
Copy link
Contributor

@mkurapov mkurapov commented Jul 2, 2025

Changes proposed in this pull request

  • Return minSendAmount in local payments when we pass in a 0 debit amount to the quote
  • Always return at least 2 as the minSendAmount in ILP payments

Context

When testing the minSendAmount feature, I found a few cases where we needed to update the logic:

  1. When we have fees for an asset, the debitAmount that we pass into the local payment getQuote will be 0. Since we still want to return the minSendAmount in those cases, make sure we calculate it, and throw it in the error.
  2. In ILP payments, when we send across the same asset, we end up getting a highEstimatedExchangeRate reciprocal calculation of something like
> Math.ceil(1000000000000 / 1000000000001);
1

Since this results in 1 minimum send amount, we return 1.

However, this will still end up causing an issue, since ILP pay will subtract at least 1 unit of value from the receiving account to make up for potential flooring loss, meaning that if we send 1 unit, we will still get 0 as the expected delivery amount:

Screenshot 2025-07-02 at 19 34 34

This means we always need to send at least 2 units of value from the sender.

Related to #3353, RAF-998

Checklist

  • Related issues linked using fixes #number
  • Tests added/updated
  • Make sure that all checks pass
  • Bruno collection updated (if necessary)
  • Documentation issue created with user-docs label (if necessary)
  • OpenAPI specs updated (if necessary)

@netlify
Copy link

netlify bot commented Jul 2, 2025

Deploy Preview for brilliant-pasca-3e80ec ready!

Name Link
🔨 Latest commit 24566f7
🔍 Latest deploy log https://app.netlify.com/projects/brilliant-pasca-3e80ec/deploys/68656e2a6f51d0000855be6a
😎 Deploy Preview https://deploy-preview-3480--brilliant-pasca-3e80ec.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@github-actions github-actions bot added type: tests Testing related pkg: backend Changes in the backend package. type: source Changes business logic labels Jul 2, 2025
@github-actions
Copy link

github-actions bot commented Jul 2, 2025

🚀 Performance Test Results

Test Configuration:

  • VUs: 4
  • Duration: 1m0s

Test Metrics:

  • Requests/s: 44.50
  • Iterations/s: 14.85
  • Failed Requests: 0.00% (0 of 2676)
📜 Logs

> performance@1.0.0 run-tests:testenv /home/runner/work/rafiki/rafiki/test/performance
> ./scripts/run-tests.sh -e test "-k" "-q" "--vus" "4" "--duration" "1m"

Cloud Nine GraphQL API is up: http://localhost:3101/graphql
Cloud Nine Wallet Address is up: http://localhost:3100/
Happy Life Bank Address is up: http://localhost:4100/
cloud-nine-wallet-test-backend already set
cloud-nine-wallet-test-auth already set
happy-life-bank-test-backend already set
happy-life-bank-test-auth already set
     data_received..................: 933 kB 16 kB/s
     data_sent......................: 1.9 MB 31 kB/s
     http_req_blocked...............: avg=6.3µs    min=2.3µs    med=5.02µs   max=503.08µs p(90)=6.46µs   p(95)=7.07µs  
     http_req_connecting............: avg=364ns    min=0s       med=0s       max=413.28µs p(90)=0s       p(95)=0s      
     http_req_duration..............: avg=89.24ms  min=9.02ms   med=72.05ms  max=580.75ms p(90)=155.85ms p(95)=181.15ms
       { expected_response:true }...: avg=89.24ms  min=9.02ms   med=72.05ms  max=580.75ms p(90)=155.85ms p(95)=181.15ms
     http_req_failed................: 0.00%  ✓ 0         ✗ 2676
     http_req_receiving.............: avg=87.02µs  min=26.47µs  med=76.12µs  max=2.26ms   p(90)=110.07µs p(95)=136.56µs
     http_req_sending...............: avg=35.4µs   min=9.16µs   med=27.29µs  max=2.01ms   p(90)=38.28µs  p(95)=52.13µs 
     http_req_tls_handshaking.......: avg=0s       min=0s       med=0s       max=0s       p(90)=0s       p(95)=0s      
     http_req_waiting...............: avg=89.12ms  min=8.87ms   med=71.96ms  max=580.65ms p(90)=155.77ms p(95)=180.97ms
     http_reqs......................: 2676   44.501474/s
     iteration_duration.............: avg=269.01ms min=159.65ms med=257.09ms max=1.07s    p(90)=332.78ms p(95)=371.7ms 
     iterations.....................: 893    14.850455/s
     vus............................: 4      min=4       max=4 
     vus_max........................: 4      min=4       max=4 

@mkurapov mkurapov requested review from BlairCurrey and cozminu July 2, 2025 17:50
@mkurapov mkurapov merged commit 33e54d5 into main Jul 2, 2025
44 checks passed
@mkurapov mkurapov deleted the max/raf-998 branch July 2, 2025 20:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pkg: backend Changes in the backend package. type: source Changes business logic type: tests Testing related

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants