-
Notifications
You must be signed in to change notification settings - Fork 122
liquidity: flat fee percentage for autoloop #340
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
Conversation
9308efd
to
79764bd
Compare
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.
tACK, this is a great simplification for the user!
The only thing I ran into when testing this on regtest is that the check of the m.params.SweepFeeRateLimit
complained when I only set the --autoloop
param and left everything else at the defaults. Not sure if it would make sense to bypass that check if we're using the proportional fees? Since we look at the miner fees there too.
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.
Super nice addition, only a few nits and ready!
liquidity/fees.go
Outdated
MaximumRoutingFeePPM: routingFeePPM, | ||
MaximumPrepayRoutingFeePPM: prepayFeePPM, | ||
MaximumMinerFee: minerFee, | ||
MaximumPrepay: prepay, |
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.
style/nit: could be in the same order as defined in the struct
|
||
// FeePortion is a fee limitation which limits fees to a set portion of | ||
// the swap amount. | ||
type FeePortion struct { |
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.
Why not simply type FeePortionPPM int
?
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.
Just personal style preference, I think that f.PartsPerMillion
is more readable than *f
when we're using the value in various funcs.
liquidity/fees.go
Outdated
) | ||
|
||
return prepayMaxFee, routeMaxFee, quote.MinerFee | ||
|
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.
nit: extra nl
} | ||
|
||
if quote.SwapFee > feeLimit { | ||
log.Debugf("swap fee: %v greater than fee limit: %v, at "+ |
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.
nit: Why not Infof
?
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.
This was debated in a previous PR and debug was decided on. I wanted info at the time, but now that we have reasons surfaced to the user, I think it's ok to leave "additional info" on a lower debug level.
b6d9b7c
to
b877f7c
Compare
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.
LGTM 🥇
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.
LGTM, very nice 🚀
If you have any spare cycles left, maybe it would be nice to add a simple test case to the itests after this is merged? Something like: set low PPM, try small loop out, expect failure, try larger loop, expect success.
b877f7c
to
9d845dd
Compare
Yeah planning on updating the itest with the new client version anyway, so will add to the existing test! |
9d845dd
to
34726a4
Compare
Tried this out on testnet and realized that we need to pad max miner fee so that we'll continue with swaps even if fees spike after initiating. Relatively small diff, but just wanted to make reviewers aware @guggero @bhandras. This should be addressed when we figure out a better way of dealing with the max miner issue, current approach is just to do as we do for regular swaps. |
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.
Re-ACK, looks good to me. Even if it might be a bit harder to explain to the user why the percentage needs to be high-ish, it's better than forfeiting swaps because of the miner fee
Need to add some unit tests.
Pull Request Checklist
release_notes.md
if your PR contains major features, breaking changes or bugfixes