Skip to content
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

hsmd: signer with splicing onchain checks for same splicing/dualfunding operations #6760

Conversation

vincenzopalazzo
Copy link
Contributor

In general, a validating signer may be under a different operational environment than the node, and therefore may have a different source of on-chain data. The signer may therefore temporarily disagree on whether a funding or splice transaction is locked (buried). We would like to ensure agreement between the signer and the node on how to progress a channel's state.

For more information about the problem see #6722

For the solution description see the commits

Fixes #6722

@vincenzopalazzo vincenzopalazzo added this to the v23.11 milestone Oct 10, 2023
@devrandom
Copy link
Contributor

if I read the code correctly, this doesn't follow the design in #6722 - it calls both the check and the lock in a single execution. the design intended to do both the check and the lock async and in different times in the negotiation flow.

I haven't evaluated the behavior of the code, just wanted to raise the difference from the design on the initial review pass.

@devrandom
Copy link
Contributor

this said, this approach is likely OK for an initial version, since the likelihood of needing to block should be relatively low.

@ksedgwic
Copy link
Collaborator

This looks good to me

@vincenzopalazzo vincenzopalazzo force-pushed the macros/remote-signer-with-splicing-onchain-checks branch 2 times, most recently from c005367 to 9289037 Compare October 12, 2023 15:02
@vincenzopalazzo
Copy link
Contributor Author

if I read the code correctly, this doesn't follow the design in #6722 - it calls both the check and the lock in a single execution. the design intended to do both the check and the lock async and in different times in the negotiation flow.

While re-reading the code I found this async execution problem too, this can happen a low with VLS or any remote signer that has a different source. I really think that we should change it to a timer base solution, but the effort is not trivial because the openingd do not have any concepts of timers so we should implement it somehow.

Before do this effort I would like to get some more review on the code.

@vincenzopalazzo vincenzopalazzo force-pushed the macros/remote-signer-with-splicing-onchain-checks branch from 9289037 to 1e19219 Compare October 12, 2023 15:10
@vincenzopalazzo vincenzopalazzo changed the title [WIP] signer with splicing onchain checks hsmd: signer with splicing onchain checks for same splicing/dualfunding operations Oct 12, 2023
@vincenzopalazzo vincenzopalazzo marked this pull request as ready for review October 12, 2023 15:10
@vincenzopalazzo vincenzopalazzo force-pushed the macros/remote-signer-with-splicing-onchain-checks branch 2 times, most recently from 1e19219 to 2a573d2 Compare October 20, 2023 07:05
@vincenzopalazzo vincenzopalazzo force-pushed the macros/remote-signer-with-splicing-onchain-checks branch 2 times, most recently from a636120 to d3b69ca Compare October 24, 2023 16:30
In general, a validating signer may be under a different operational
environment than the node, and therefore may have a different
source of on-chain data. The signer may therefore temporarily disagree
on whether a funding or splice transaction is locked (buried).

We would like to ensure agreement between the signer and the
node on how to progress a channel's state.

The following message are added to provide a solution:

- `check_outpoint(outpoint) -> bool` - check if the signer agrees that a funding candidate outpoint is buried
- `lock_outpoint(outpoint)` - change the funding/splice state to locked

Link: ElementsProject#6722
Suggested-by: @devrandom
Co-Developed-by: Ken Sedgwick <[email protected]>
Changelog-Added: hsmd protocol: Added hsmd_check_outpoint and hsmd_lock_outpoint
Signed-off-by: Vincenzo Palazzo <[email protected]>
Tihis commit is implementing a 2-phase commit between
the signer the node and the peer.

The main reason for this is that everybody must agree on the lock,
otherwise one of them will want N signatures (on the splice candidates),
and another will produce only 1 signature.

check_outpoint is the "prepare" for the signer, and lock_outpoint is the
"commit". if check_outpoint returns true, lock_outpoint must not fail.

Link: ElementsProject#6722
Suggested-by: @devrandom
Co-Developed-by: Ken Sedgwick <[email protected]>
Signed-off-by: Vincenzo Palazzo <[email protected]>
@vincenzopalazzo vincenzopalazzo force-pushed the macros/remote-signer-with-splicing-onchain-checks branch from d3b69ca to 1fc383e Compare October 24, 2023 16:52
@vincenzopalazzo vincenzopalazzo requested a review from nepet October 24, 2023 16:53
@nepet
Copy link
Collaborator

nepet commented Oct 24, 2023

ACK 1fc383e

Copy link
Contributor

@rustyrussell rustyrussell left a comment

Choose a reason for hiding this comment

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

Ack 1fc383e

It's simple, at least. Probably better to refactor this function into common/ but it's OK as is.

@rustyrussell rustyrussell merged commit 44798e2 into ElementsProject:master Oct 26, 2023
38 checks passed
@vincenzopalazzo
Copy link
Contributor Author

Probably better to refactor this function into common/ but it's OK as is.

Yeah, I agree I tried to write it but there was something not similar between the two functions. However, we iterate a lot over it so maybe now it is possible :)

I will take a look because keep just a function is also good for us

@vincenzopalazzo vincenzopalazzo deleted the macros/remote-signer-with-splicing-onchain-checks branch October 26, 2023 08:23
ksedgwic added a commit to lightning-signer/c-lightning that referenced this pull request Oct 31, 2023
This delta was meant to be part of ([ElementsProject#6760]), maybe lost in a rebase.

Changelog-None
ksedgwic added a commit to lightning-signer/c-lightning that referenced this pull request Oct 31, 2023
This delta was meant to be part of ([ElementsProject#6760]), maybe lost in a rebase.

Changelog-None
nepet pushed a commit that referenced this pull request Nov 1, 2023
This delta was meant to be part of ([#6760]), maybe lost in a rebase.

Changelog-None
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

splice: need to sync with signer on funding locked
5 participants