Skip to content

Conversation

@dimxy
Copy link
Collaborator

@dimxy dimxy commented Sep 23, 2025

Before this PR, the legacy swap functions were used to estimate trade fees (tx fees) for TPU swaps, so those estimations may not have been quite accurate.

This PR adds trade fee estimation functions for TPU swap steps (like send taker funding, spend taker funding, send maker payment etc).

As refactoring, a new SwapTotalFeeHelper trait is added to abstract getting fees for balance checking in swaps.

TODO: add more tests to validate taker and maker max_volume/trade_preimage estimations for TPU swap fee estimations added in this PR.

@dimxy dimxy self-assigned this Sep 23, 2025
dimxy added 2 commits October 9, 2025 13:11
* dev:
  fix(TPU): correct dexfee in check balance to prevent swap failures (#2600)
  fix(tests): fix/remove kmd rewards failing test (#2633)
  chore(ci): bump CI container image to debian bullseye-slim to match dev (#2641)
  chore(release): add changelog entries for v2.5.2-beta (#2639)
  chore(release): bump mm2 version to 2.5.2-beta (#2638)
  feat(ci): add macos universal2 build (#2628)
  fix(metrics): remove memory_db size metric (#2632)
  fix(zcoin): exact-anchor witnesses in wasm get_spendable_notes (#2629)
  fix(evm-swapv2): no mempool inclusion required for maker payment validation (#2618)
  chore(rust 1.90): make CI clippy/fmt pass
  Revert "fix(ordermatch): ignore loop-back; clear on null root; reject stale keep-alives (#2580)"
  Revert "fix(orderbook): validate roots before commit (#2605)"
@dimxy
Copy link
Collaborator Author

dimxy commented Oct 9, 2025

Conflicts resolved,
PR is ready for review

@dimxy dimxy marked this pull request as draft October 9, 2025 12:05
@dimxy
Copy link
Collaborator Author

dimxy commented Oct 9, 2025

Conflicts resolved, PR is ready for review

One important test fails. To draft for now..

… fake swap values which did not work w/o token approval first)
@dimxy
Copy link
Collaborator Author

dimxy commented Oct 10, 2025

Conflicts resolved, PR is ready for review

One important test fails. To draft for now..

Looks like tests are okay now.

I saw once failure of test_update_maker_order in a CI workflow run (which is worrying). I ran this test multiple times on my PC and a VPC but the failure never repeated itself. I noticed that when the failed test was running the RICK coin balance was unusual (so it may be some activity in the chain affected the test results).
I tried this test with different balances, including the one from the failed test, but all runs were okay.

So I am converting the PR to ready now.

@dimxy dimxy marked this pull request as ready for review October 10, 2025 08:42
@github-actions
Copy link

@shamardy
Please review it again.

@github-actions github-actions bot added the [] label Nov 30, 2025
@shamardy shamardy removed the [] label Dec 1, 2025
@github-actions
Copy link

github-actions bot commented Dec 3, 2025

@shamardy
Please review it again.

@github-actions github-actions bot added the [] label Dec 3, 2025
@github-actions
Copy link

github-actions bot commented Dec 5, 2025

@shamardy
Please review it again.

@shamardy shamardy removed the [] label Dec 9, 2025
@github-actions
Copy link

@shamardy
Please review it again.

@github-actions github-actions bot added the [] label Dec 11, 2025
@github-actions
Copy link

@shamardy
Please review it again.

8 similar comments
@github-actions
Copy link

@shamardy
Please review it again.

@github-actions
Copy link

@shamardy
Please review it again.

@github-actions
Copy link

@shamardy
Please review it again.

@github-actions
Copy link

@shamardy
Please review it again.

@github-actions
Copy link

@shamardy
Please review it again.

@github-actions
Copy link

@shamardy
Please review it again.

@github-actions
Copy link

github-actions bot commented Jan 2, 2026

@shamardy
Please review it again.

@github-actions
Copy link

github-actions bot commented Jan 6, 2026

@shamardy
Please review it again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants