Skip to content

Conversation

carlaKC
Copy link
Contributor

@carlaKC carlaKC commented Feb 19, 2021

Need to add some unit tests.

Pull Request Checklist

  • Update release_notes.md if your PR contains major features, breaking changes or bugfixes

@carlaKC carlaKC force-pushed the autoloop-feepercentage branch from 9308efd to 79764bd Compare February 22, 2021 08:19
@carlaKC carlaKC marked this pull request as ready for review February 22, 2021 08:22
@carlaKC carlaKC changed the title WIP: flat fee percentage for autoloop liquidity: flat fee percentage for autoloop Feb 22, 2021
@carlaKC carlaKC requested review from guggero and bhandras February 22, 2021 08:24
Copy link
Contributor

@guggero guggero left a 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.

Copy link
Member

@bhandras bhandras left a 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!

MaximumRoutingFeePPM: routingFeePPM,
MaximumPrepayRoutingFeePPM: prepayFeePPM,
MaximumMinerFee: minerFee,
MaximumPrepay: prepay,
Copy link
Member

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 {
Copy link
Member

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?

Copy link
Contributor Author

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.

)

return prepayMaxFee, routeMaxFee, quote.MinerFee

Copy link
Member

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 "+
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Why not Infof?

Copy link
Contributor Author

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.

@carlaKC carlaKC force-pushed the autoloop-feepercentage branch 2 times, most recently from b6d9b7c to b877f7c Compare March 3, 2021 08:04
@carlaKC carlaKC requested review from bhandras and guggero March 3, 2021 08:26
Copy link
Member

@bhandras bhandras left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🥇

Copy link
Contributor

@guggero guggero left a 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.

@carlaKC carlaKC force-pushed the autoloop-feepercentage branch from b877f7c to 9d845dd Compare March 3, 2021 13:50
@carlaKC
Copy link
Contributor Author

carlaKC commented Mar 3, 2021

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?

Yeah planning on updating the itest with the new client version anyway, so will add to the existing test!

@carlaKC carlaKC force-pushed the autoloop-feepercentage branch from 9d845dd to 34726a4 Compare March 4, 2021 08:28
@carlaKC
Copy link
Contributor Author

carlaKC commented Mar 4, 2021

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.

Copy link
Contributor

@guggero guggero left a 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

@carlaKC carlaKC merged commit c5ee984 into lightninglabs:master Mar 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants