-
Notifications
You must be signed in to change notification settings - Fork 421
Store and check channel data in channel monitors #4218
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
base: main
Are you sure you want to change the base?
Store and check channel data in channel monitors #4218
Conversation
|
👋 I see @valentinewallace was un-assigned. |
dda4c5c to
b00ff03
Compare
c3771b6 to
f387f90
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4218 +/- ##
==========================================
- Coverage 89.33% 89.27% -0.06%
==========================================
Files 180 180
Lines 138680 138786 +106
Branches 138680 138786 +106
==========================================
+ Hits 123888 123906 +18
- Misses 12172 12258 +86
- Partials 2620 2622 +2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
00a95f1 to
a82719b
Compare
safe_channels feature flag that gates in-development work toward persisting channel monitors and channels atomically, preventing them from desynchronizing and causing force closures. This commit begins that transition by storing both pieces together and adding consistency checks during writes. These checks mirror what the channel manager currently validates only on reload, but performing them earlier increases coverage and surfaces inconsistencies sooner.
safe_channels feature flag that gates in-development work toward persisting channel monitors and channels atomically, preventing them from desynchronizing and causing force closures. This commit begins that transition by storing both pieces together and adding consistency checks during writes. These checks mirror what the channel manager currently validates only on reload, but performing them earlier increases coverage and surfaces inconsistencies sooner.a82719b to
d4d0879
Compare
|
|
||
| /// The encoded channel data associated with this ChannelMonitor, if any. | ||
| #[cfg(feature = "safe_channels")] | ||
| pub encoded_channel: Option<Vec<u8>>, |
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.
Continuing discussion here @valentinewallace #4151 (comment)
Did you explore encoding the FundedChannel itself rather than a bag of bytes? I guess it would require propagating the signer trait parameter, which is kind of annoying?
I think it is possible, but with a few workarounds. The advantage would be that we have a clear target struct to strip all the data off that is redundant for channel monitor.
We do need to allow cloning of the channel to get a copy to store inside the monitor and monitor update. Also equality needs to be implemented. And it is the case that a channel contains a list of blocked monitor updates, that can again contain a channel copy. Not sure if we getting into something undesirable with that form of nesting.
The pending_splice field also turned out to be difficult to clone. For now, I just took the serialized version of it.
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.
Problems above have mostly been solved now
|
Tests now pass with the unencoded channel as part of Isolated repro: https://github.com/lightningdevkit/rust-lightning/compare/main...joostjager:repro-recursive-ser-issue?expand=1 |
Additional trace logs to help with debugging.
05fbe65 to
2dc7ca2
Compare
Preparation for serializing the enum. The serialization macros do not support multiple unnamed fields.
Add a new `safe_channels` feature flag that gates in-development work toward persisting channel monitors and channels atomically, preventing them from desynchronizing and causing force closures. This commit begins that transition by storing both pieces together and adding consistency checks during writes. These checks mirror what the channel manager currently validates only on reload, but performing them earlier increases coverage and surfaces inconsistencies sooner.
2dc7ca2 to
17f71b0
Compare
c11d5ec to
96dc75d
Compare
96dc75d to
44538f9
Compare
Add a new
safe_channelsfeature flag that gates in-development work toward persisting channel monitors and channels atomically, preventing them from desynchronizing and causing force closures.This commit begins that transition by storing both pieces together and adding consistency checks during writes. These checks mirror what the channel manager currently validates only on reload, but performing them earlier increases coverage and surfaces inconsistencies sooner.