Closed JssDWt closed 7 months ago
Note that the proposed change makes the actual buy request a human unreadable message and also introduces additional complexity and asymmetry in the sense that the client now wouldn't just mirror back the object it receives.
Could you elaborate what you mean by this? In my view the complexity is in passing back the human-readable/deserializable message back to the LSP.
Could you elaborate what you mean by this? In my view the complexity is in passing back the human-readable/deserializable message back to the LSP.
Well you still need to keep the human-readable message around to calculate the fee, validate the LSP didn't withhold more than we expect it to, and show to the user which of the opening fee params was picked. As the client still won't to know how to deal with any new fields when the LSP upgrades, in my view nothing about the 'problem' is actually resolved, but we now reply with a human-unreadable message that is different, i.e., needs to be implemented as yet another object for serialization, where previously we could just reuse the one from GetInfoResponse
(granted, not a lot additional complexity).
In any case, while I'm still a bit dubious if this gains us much, I definitely won't block this PR as it also doesn't have a lot of drawbacks. Happy to ACK if others think this is beneficial.
I reviewed the changes and I agree with tnull's comment https://github.com/BitcoinAndLightningLayerSpecs/lsp/pull/111#pullrequestreview-1993877624. The changes look good but I am unsure if necessary. Because we're already working on the successor of this spec (LSPS4), I am inclined to error on simplicity and hope that there will be no breaking change in LSPS2. On the other hand, I don't mind acking this if Jesse think this is necessary.
So TLDR: I have no strong opinion either way.
It was discussed in the LSP spec group call that
opening_fee_params
fields would have effects on fee calculation for clients, so backward compatible changes are 'hard' anyway.opening_fee_params
object, we can decide to encode the fields into the promise then. This still makes the LSP backwards compatible. So we don't have to break anything now.So I'm closing this PR.
This PR makes the
opening_fee_params
objects extensible for future backward compatible upgrades. Fixes https://github.com/BitcoinAndLightningLayerSpecs/lsp/issues/94The problem
If this spec ever decides to add an additional field in the
opening_fee_params
object, this upgrade path is impossible to roll out in the current spec, without placing too much logic on the client side.LSP is upgraded, client is not
opening_fee_params
object, containing the new field. Commits to the object in thepromise
.Note that it would be possible for the client to send back the
opening_fee_params
object using exactly the bytes it received from the LSP. But this is a 'hard' constraint, because this would force the client to pass to the UI layer the deserialized object plus an additional field containing the rawopening_fee_params
bytes.The solution
Encode all fields into the promise itself. This way, the promise alone is enough for the LSP to retrieve what it committed to. And the client really only needs to send back the
promise
to the LSP.LSP is upgraded, client is not
opening_fee_params
object, containing the new field. Commits to the object in thepromise
.promise
to the LSP, this promise contains the new field encoded.Notes
opening_fee_params
object, because the LSP could commit to any data unknown to the client, even outside of these communications. SO I don't think it adds much value to have this constraint in the spec.invalid_opening_fee_params
error toinvalid_promise
, keeping the same error number