-
Notifications
You must be signed in to change notification settings - Fork 52
bLIP-0052: Add ongoing proportional fees #63
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
base: master
Are you sure you want to change the base?
bLIP-0052: Add ongoing proportional fees #63
Conversation
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.
The concept of ongoing fees has been requested multiple times now, so we could def. consider to support it, but it would need to be a purely backwards compatible change.
blip-0052.md
Outdated
@@ -224,6 +224,7 @@ Example `lsps2.get_info` result: | |||
{ | |||
"min_fee_msat": "546000", | |||
"proportional": 1200, | |||
"ongoing_proportional": 1000, |
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.
You can't just add a field here as it would render all historical promises invalid. If we want to make such a change, it needs to be backwards compatible (read: additive), e.g., you could add a flag to the get_info
result that would indicate that the agreed upon fees will be withheld on every forward, and then the service would need to reject any buy requests that have that field unset (i.e., if they don't know it).
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.
Makes sense. Pushed new commit that moved it to a flag outside of the params instead.
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.
Actually, as I went to implement this in ldk and ldk-node I realized that it's tough to avoid rendering historical promises invalid. Even if we move ongoing_proportional
outside the opening_fee_params
then we still would ideally want to include it in the generation of the promise
.
If we do not include it in the promise then the LSP has no way to know what value it gave out as a response to a get_info
request and cannot validate the value provided in the buy
request.
The alternatives would be:
-
Store a mapping from
promise
toongoing_proportional
for each promise given out. This seems like not a great idea as the whole point of the promise is for the LSP to remain stateless when handling get_info requests. -
Use a static
ongoing_proportional
value across all requests. This is less flexible but maybe acceptable (if it's the only option)? Seems like it might run into issues should the LSP ever want to change it as someone who received a get_info request with the old value will run into unexpected behavior should they issue a buy request after the new value is set by the LSP. Even if you require the client to send the value they received to the user, the LSP cannot trust it because it's not included in the promise.
Any thoughts?
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.
I had made a PR before that allows making backward compatible changes to the calculation of the promise
for the opening_fee_params
. It was discussed then that if we want to add fields to the opening_fee_params
, that would be a good time to revisit. This is the PR in question: BitcoinAndLightningLayerSpecs/lsp#111
Let me know if that helps your case.
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.
One comment, otherwise the spec change should look good, if we agree that we want to go this way. I think we'd also want to hold off merging this until we have at least one reference implementation in-place.
an ongoing proportional fee as specified in the `proportional` field from | ||
the `opening_fee_params` used to open the channel. | ||
|
||
The ongoing fee for each payment is computed as: |
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.
I don't think we should repeat the computation here, but rather just refer to the other parts of the spec.
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.
The only potential confusion is that in the 'computing the fee' section that is for the opening fee which includes the min_fee portion. The ongoing_fee as defined only includes the proportional component of the fee.
Adds support for ongoing proportional fees to the bLIP-0052 flow.
This allows the LSP to charge ongoing proportional fees taken from all subsequent payments forwarded over the channel after open. The fees are paid for by the recipient just like the opening fee is by skimming it from the HTLCs forwarded.
Ongoing fees allow the LSP to distribute the costs across the lifetime of the channel instead of charging for it all up front.