-
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
Peer storage #2888
Peer storage #2888
Conversation
ca82dbc
to
1408152
Compare
1408152
to
26118a7
Compare
26118a7
to
ed48cb0
Compare
abaacc2
to
3f0a426
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.
I thought this was an easy PR, but as I dived into it I think there are many subtle aspects that have a big impact on scenarios where users restore from seed. That's why I have multiple comments that aren't trivial, for which we need to decide how we'd like eclair to behave.
eclair-core/src/main/scala/fr/acinq/eclair/db/pg/PgPeersDb.scala
Outdated
Show resolved
Hide resolved
eclair-core/src/main/scala/fr/acinq/eclair/db/pg/PgPeersDb.scala
Outdated
Show resolved
Hide resolved
eclair-core/src/main/scala/fr/acinq/eclair/db/pg/PgPeersDb.scala
Outdated
Show resolved
Hide resolved
eclair-core/src/main/scala/fr/acinq/eclair/wire/protocol/LightningMessageTypes.scala
Outdated
Show resolved
Hide resolved
Codecov ReportAttention: Patch coverage is
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## master #2888 +/- ##
==========================================
- Coverage 86.19% 86.03% -0.16%
==========================================
Files 224 227 +3
Lines 20074 20276 +202
Branches 813 826 +13
==========================================
+ Hits 17302 17445 +143
- Misses 2772 2831 +59
|
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 a bit afraid of the DoS risks associated with this feature: our node will be a very likely target (everyone will want to store some data with us), so we must be very careful that this cannot be exploited.
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 for the back and forth, it all looks safe to me now (after the couple of changes from my follow-up PR).
What's the status for the other implementations? Can you check and test basic cross-compatibility (by sending a peer_storage_store
message from a modified eclair
and verifying whether it's correctly returned to us on reconnection)? We'd need to check this before merging it since the spec PR hasn't been merged yet. I'll ping the other implementers during the next spec meeting to see if we can merge.
eclair-core/src/main/scala/fr/acinq/eclair/db/sqlite/SqlitePeersDb.scala
Outdated
Show resolved
Hide resolved
eclair-core/src/main/scala/fr/acinq/eclair/db/sqlite/SqlitePeersDb.scala
Outdated
Show resolved
Hide resolved
Thanks, I've added your fixes. I'll look at the other implementations and do some compat tests. |
I've found pending PRs to implement it in LND (lightningnetwork/lnd#8490) and LDK (lightningdevkit/rust-lightning#2943) but they don't seem to be ready yet. |
Indeed, that doesn't seem to be ready at all! But IIRC |
@thomash-acinq I asked during the spec meeting, and |
The confusion between SQL timestamps and long resulted in always removing storage regardless of the `peerRemovedBefore` parameter.
Added to the peer storage configuration section of `eclair.conf`.
Instead of defining new events. We also keep a set of active channels to ensure that duplicate events don't mess up our state (even though this shouldn't happen, it feels safer).
b00a95c
to
ca2c7f2
Compare
There doesn't seem to be any progress with LND or LDK but it works with CLN (they just send their blob too early but I'm assuming it's just to test, and they store our blob well). |
What do you mean exactly here, when do they send it? Is it worth opening an issue on their repository? |
I've opened an issue on their repository: ElementsProject/lightning#7931 |
Thanks, let's wait for the result of that discussion before merging. I'll raise it during the next spec meeting as well. |
I've changed a bit our behavior to accept peer storage updates from peers without an active channel but not persist it. If a channel becomes active, we then persist it. |
but only persist it to DB when there is an active channel.
14d1885
to
df24044
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.
Good idea, with that change I believe we can merge right now to our master
branch. We'll wait for the spec PR to be merged to the BOLTs before merging the lightning-kmp
PR though, because at that point we would be screwed if we shipped Phoenix using this and the spec changed afterwards, but I hope the spec shouldn't take too long to be added to the BOLTs now that we have cross-compatibility with cln
.
Implements lightning/bolts#1110