-
Notifications
You must be signed in to change notification settings - Fork 267
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
Implement option_static_remotekey #1141
Conversation
Commit a1934f5 introduces a new |
@sstone There is a new |
For those interested in testing i'm running 12bf3ec on a testnet node at |
eclair-core/src/main/scala/fr/acinq/eclair/channel/Commitments.scala
Outdated
Show resolved
Hide resolved
At the current status the PR implements |
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.
Nice, this is shaping up!
Have you been able to test compatibility with LND and CL? I think they both have it on their master branch.
eclair-core/src/main/scala/fr/acinq/eclair/channel/ChannelTypes.scala
Outdated
Show resolved
Hide resolved
eclair-core/src/test/scala/fr/acinq/eclair/channel/states/StateTestsHelperMethods.scala
Outdated
Show resolved
Hide resolved
I've done some testing with @rustyrussel's node in testnet, i will repeat them with LND now that is in master branch. |
I think especially the channel reestablish case needs to be tested. From what I understood LND may be weird there, they requested us to add to the spec the requirement to keep sending a dummy but valid point in my_last_per_commitment_point so we should check they accept what we sent them. |
Are you referring to this comment? I purposely left the DLP fields in place in the |
Exactly. By looking at the code it seems like this should work, but nothing beats a real E2E test ;) |
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 but I don't know enough of the channel management part of our codebase to safely sign-off, I'll let others chime in.
@@ -30,6 +31,8 @@ trait EclairWallet { | |||
|
|||
def getFinalAddress: Future[String] | |||
|
|||
def getPubkeyForAddress(address: String): Future[PublicKey] |
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.
This should be a getFinalPubkey
or getReceivePubkey
without an address parameter otherwise it won't be consistent with the Electrum wallet.
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 prefer getReceivePubkey
as it tells that it's the receiving key/address of the wallet, i'll update getReceiveAddress
too.
932e145
to
cd4149d
Compare
Commit 58a5da0 uses |
096641c
to
58a5da0
Compare
Codecov Report
@@ Coverage Diff @@
## master #1141 +/- ##
==========================================
+ Coverage 76.6% 77.38% +0.78%
==========================================
Files 140 140
Lines 9700 10101 +401
Branches 397 401 +4
==========================================
+ Hits 7431 7817 +386
- Misses 2269 2284 +15
|
f666b31
to
166ec5a
Compare
After some offline discussion i've revived and simplified this PR 🎉 so here is a gist of the changes, their rationale and why we should merge them. Option Supporting this new option requires us to remember what features that were negotiated during channel opening (see comment) to achieve so we add a new There is a new field in the
Both options are more impactful on the code or end up doing more changes to the codecs. We now carry the Note that those changes are also preparation work to support more commitment formats in the future, i expect that we add new |
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.
Thanks, I agree that the code is actually quite simple now (the tests take much more work than the actual code, but I think that's expected since we want to replicate many existing tests to the static_remotekey case).
I think we should go forward with this. We've seen users losing backups (even very recently) and it takes a lot of time and effort to get their funds back. With this change it's really simple and we're also not "wasting" a sweep transaction (which is nice too in terms of fees). Once my comments are addressed, I think we also need @sstone to review (and we'll do interop tests with other implementations). I think it shouldn't take too long to finalize and merge this so it's worth doing. WDYT @sstone?
eclair-core/src/main/scala/fr/acinq/eclair/blockchain/electrum/ElectrumEclairWallet.scala
Show resolved
Hide resolved
eclair-core/src/main/scala/fr/acinq/eclair/channel/Helpers.scala
Outdated
Show resolved
Hide resolved
eclair-core/src/test/scala/fr/acinq/eclair/channel/states/h/ClosingStateSpec.scala
Outdated
Show resolved
Hide resolved
eclair-core/src/test/scala/fr/acinq/eclair/integration/IntegrationSpec.scala
Show resolved
Hide resolved
eclair-core/src/test/scala/fr/acinq/eclair/integration/IntegrationSpec.scala
Outdated
Show resolved
Hide resolved
eclair-core/src/test/scala/fr/acinq/eclair/integration/IntegrationSpec.scala
Outdated
Show resolved
Hide resolved
eclair-core/src/test/scala/fr/acinq/eclair/integration/IntegrationSpec.scala
Show resolved
Hide resolved
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.
Great, only a couple nit comments remaining. From the code's point of view it looks good to me, I'll need to spend time doing interop tests though.
eclair-core/src/test/scala/fr/acinq/eclair/channel/states/h/ClosingStateSpec.scala
Outdated
Show resolved
Hide resolved
dd3326f
to
233baa3
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, just waiting for another review and interop tests after that and we should be good to go!
233baa3
to
2f9ed64
Compare
2f9ed64
to
819ec93
Compare
Rebased on master |
# Conflicts: # eclair-core/src/main/scala/fr/acinq/eclair/Setup.scala # eclair-core/src/main/scala/fr/acinq/eclair/io/Peer.scala # eclair-core/src/test/scala/fr/acinq/eclair/blockchain/bitcoind/BitcoinCoreWalletSpec.scala
026d806
to
a71c0df
Compare
I've done some E2E tests with other implementations and I've simulated the upgrade from an eclair node running the latest master branch, the test were successful and no errors were encountered. Test 1: running In test 2 we want to make sure it's safe to upgrade from a node currently running master with several channels already opened or in closing states. Note for reviewers: to reproduce my tests easily here are some go-to instructions to run LND in your local machine (assumes docker + ubuntu):
|
I think it would be great to finalize this PR, maybe we can then start doing some work on anchor outputs since this is where spec efforts to fix the eclipse attacks are focusing (rust-lightning said they will always require @sstone will you have some time to review this PR? |
I did some extra E2E test with c-lightning v0.8.2.1 and eclair 0.3.4. The test with c-lightning reproduced what i did previously with LND, I opened a channel with the
The second test with an older version of eclair aimed and checking we're still backward compatible, the test comprised of opening channels, making payments and closing the channels (both as funder and fundee). This test was successful since no errors was encountered (note there isn't anything specific to Summary of interop test so far:
|
@araspitzu we should keep the "non static remote key" test vectors and and new ones with the option set instead of replacing them |
I tested with lnd and c-lightning, and checked that it can be merged and work on Android as well (static_remote_key will be disabled for now on our android apps) and everything is fine. I think that once we have both test vectors and have a second approval we're good to go! |
Great, I'll test and review today! |
Pushed last commit with both versions of test vectors being used in the tests 🚀 |
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!
I've done some E2E testing with lnd 0.10.1-beta, didn't spot anything weird.
eclair-core/src/test/scala/fr/acinq/eclair/transactions/TestVectorsSpec.scala
Outdated
Show resolved
Hide resolved
eclair-core/src/test/scala/fr/acinq/eclair/transactions/TestVectorsSpec.scala
Outdated
Show resolved
Hide resolved
🚀 Super happy about this! We're actually looking at making the feature bit start to be required in a release or so. |
Sounds good, in that case we'll probably align and at least turn it on optionally by default! |
Add support for the upcoming feature
option_static_remotekey
lightning/bolts#642