-
Notifications
You must be signed in to change notification settings - Fork 29
Encode fields in opening_fee_params promise
#111
Encode fields in opening_fee_params promise
#111
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.
I'm still not entirely convinced this is entirely necessary and solves the fundamental issue, as the client would still run into issues if it doesn't know a field that influences the opening fee calculation, which is exactly what opening_fee_params are (granted, mostly by now) for. So, in my understanding, anything we would potentially add to opening_fee_params would result in a breaking change anyways and hence we might not ever want to add any more fields to it after stabilization.
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.
That said, besides my general concerns regarding the approach, the concrete changes look good, if we really want to go that way.
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 |
|
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 #111 (review). 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
So I'm closing this PR. |
This PR makes the
opening_fee_paramsobjects extensible for future backward compatible upgrades. Fixes #94The problem
If this spec ever decides to add an additional field in the
opening_fee_paramsobject, 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_paramsobject, 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_paramsobject 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_paramsbytes.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
promiseto the LSP.LSP is upgraded, client is not
opening_fee_paramsobject, containing the new field. Commits to the object in thepromise.promiseto the LSP, this promise contains the new field encoded.Notes
opening_fee_paramsobject, 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_paramserror toinvalid_promise, keeping the same error number