-
Notifications
You must be signed in to change notification settings - Fork 1
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
Use signed amounts in RBF messages #15
Use signed amounts in RBF messages #15
Conversation
Correct me if I'm off here, but as I understand it, the current splice draft in
I'm not sure I understand why in
It seems the same way of handling removing from funding would be handled here. In other words I thought the contributions in RBF were absolute values and not deltas. |
You're totally right that the current version of the splice spec PR uses absolute values. But I wouldn't look at the current state of that PR as it isn't up-to-date with what has been learned by implementing it in eclair and cln, and from discussions during spec meetings. While it's not 100% sure yet, it looks like current implementers are now leaning more towards using deltas instead of absolute values. Based on my implementation work, where I initially started with absolute values and recently switched to using deltas, deltas have the following advantages:
Also, you can conceptually view dual funding as using a delta as well, where the previous balance was 0: once you see it that way, you don't have to make any special case in your code to distinguish dual funding attempts from splice attempts, which is nice. |
Ah got it! In that case it just seems more natural and less "patchy" to use signed values as you've proposed. |
If splicing ends up using deltas, it's a +1 from me for signed values. |
69d3954
to
30534ec
Compare
I think we're all onboard. The current version uses total amount but changing to relative cleans up some other things anyway and feels like a cleaner protocol (TM) 👍. |
While dual funding only needs unsigned funding amounts, other protocols that leverage interactive-tx may use signed funding amounts, for example to take funds out of an existing channel (splice-out). It is thus more future-proof to use signed amounts in `tx_init_rbf` and `tx_ack_rbf`.
30534ec
to
0e589c8
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. Did some basic sanity checks on the test vectors.
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.
concept ACK, i
is a no-go for me tho.
01-messaging.md
Outdated
@@ -220,9 +221,16 @@ receiver to parse individual elements from `value`. | |||
Various fundamental types are referred to in the message specifications: | |||
|
|||
* `byte`: an 8-bit byte | |||
* `i8`: an 8-bit signed integer |
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: use s
not i
, as it's better to do opposites in specs (unsigned vs signed -> u
vs s
)
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.
Done in cf62b5a
I find it a bit weird, as i32
/i64
seems to be the standard way in programming languages to refer to signed integers and I've never seen s32
/s64
anywhere, but I don't really mind!
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.
Yeah s
seems a bit strange but no big deal honestly.
While dual funding only needs unsigned funding amounts, other protocols that leverage
interactive-tx
may use signed funding amounts, for example to take funds out of an existing channel (splice-out). It is thus more future-proof to use signed amounts intx_init_rbf
andtx_ack_rbf
.An alternative would be to keep the
funding_output_contribution
tlv unchanged and define a separate tlv for negative contributions (e.g.deduce_from_funding_output
). When splicing funds into an existing channel,funding_output_contribution
would be used (which could be renamedadd_to_funding_output
for symmetry), and when splicing funds out of an existing channel,deduce_from_funding_output
would be used. This would remove the need for introducing signed amounts now, but it means we would have two mutually exclusive tlvs intx_init_rbf
andtx_ack_rbf
messages.I'm not sure which option is best and I'm hoping for feedback! @niftynei @dunxen @morehouse