You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The coinswap fee calculation is weird (broken) and it came from the legacy code. Which makes it very complex to expose to the users.
There are two fee_rate variables in PPB, which is hard for non-dev users to grasp. The same calculation could be easily converted to % feerate. These two fee rates are also exposed in the config variables, and changing them to 0 (if the user wants to disable it) creates arithmetic overflow inside calculate_coinswap_fee function.
The time_relative_fee_ppb rate is intended to be the extra tax maker charges because of how much time their funds get locked in case of a refund. If the time is large, they charge larger fees. This variable is set by the Taker (Currently hardcoded at 48 blocks), and adding a fee there incentivizes the market to choose a quicker refund timeout.
But this is not what the impl does. Instead, the current impl multiplies the fee rate with no. of conf required for funding tx. Which doesn't make any sense.
We need some fixes to make these fee rates configurable by the users.
Proposed Solution.
Hardcode the feerates for now. Move from PPB to % representation.
Find suitable default values for both rates.
Modify the calculate_coinswap_fee to not have overflow bugs if any of the rate is set to 0. That would mean just disabling that rate.
Explain clearly how the new fee rate calculation works.
Decide later whether to expose this to the users. And expose the refund timelock for taker users.
I am working on this. PR landing soon.
The text was updated successfully, but these errors were encountered:
The Problem
The coinswap fee calculation is weird (broken) and it came from the legacy code. Which makes it very complex to expose to the users.
There are two fee_rate variables in PPB, which is hard for non-dev users to grasp. The same calculation could be easily converted to % feerate. These two fee rates are also exposed in the config variables, and changing them to 0 (if the user wants to disable it) creates arithmetic overflow inside
calculate_coinswap_fee
function.The
time_relative_fee_ppb
rate is intended to be the extra tax maker charges because of how much time their funds get locked in case of a refund. If the time is large, they charge larger fees. This variable is set by the Taker (Currently hardcoded at 48 blocks), and adding a fee there incentivizes the market to choose a quicker refund timeout.But this is not what the impl does. Instead, the current impl multiplies the fee rate with no. of conf required for funding tx. Which doesn't make any sense.
We need some fixes to make these fee rates configurable by the users.
Proposed Solution.
calculate_coinswap_fee
to not have overflow bugs if any of the rate is set to 0. That would mean just disabling that rate.I am working on this. PR landing soon.
The text was updated successfully, but these errors were encountered: