rust-lightning icon indicating copy to clipboard operation
rust-lightning copied to clipboard

Add a simple test of upgrading from LDK 0.1 and correct `in_flight_monitor_updates` on upgrade

Open TheBlueMatt opened this issue 11 months ago • 6 comments

One major hole in our test coverage historically has been tests covering upgrades or downgrades across LDK versions. Luckily, these aren't particularly hard to write as cargo lets us depend on previous versions of the lightning crate directly, which we can use in tests.

Here we add a simple initial test of upgrading from LDK 0.1 while there's a pending payment to be claimed.

TheBlueMatt avatar Feb 02 '25 17:02 TheBlueMatt

LGTM after @tnull's feedback is resolved (and it looks like this need rebase). Nice to have this testing infra!

valentinewallace avatar Feb 10 '25 18:02 valentinewallace

Rebased. I pinged @tnull offline but dunno when/if he'll respond, there's also no rush.

TheBlueMatt avatar Mar 04 '25 19:03 TheBlueMatt

Codecov Report

Attention: Patch coverage is 87.25490% with 13 lines in your changes missing coverage. Please review.

Project coverage is 90.99%. Comparing base (df68774) to head (f9fb216). Report is 68 commits behind head on main.

Files with missing lines Patch % Lines
lightning/src/util/test_channel_signer.rs 76.47% 11 Missing and 1 partial :warning:
lightning/src/ln/channelmanager.rs 50.00% 0 Missing and 1 partial :warning:
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3584      +/-   ##
==========================================
+ Coverage   89.22%   90.99%   +1.77%     
==========================================
  Files         155      157       +2     
  Lines      118973   134041   +15068     
  Branches   118973   134041   +15068     
==========================================
+ Hits       106154   121975   +15821     
+ Misses      10239     9675     -564     
+ Partials     2580     2391     -189     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

codecov[bot] avatar Mar 04 '25 19:03 codecov[bot]

CI is still sad

wpaulino avatar Mar 05 '25 15:03 wpaulino

error: package ID specification `lightning-test` did not match any packages

	Did you mean `lightning-tests`?

wpaulino avatar Mar 10 '25 17:03 wpaulino

cargo doc -p lightning-tests --document-private-items seems to cause issues, we don't really need docs there anyway

wpaulino avatar Mar 11 '25 22:03 wpaulino

Ooookayyyyyy. We discussed offline and it seems many folks who work on LDK do use cargo test -p lightning so moved the tests into a non-workspace crate entirely. Note that clippy is failing but that'll be fixed by #3782. Also went ahead and rebased and squashed since its been so long since this was put up.

TheBlueMatt avatar May 16 '25 14:05 TheBlueMatt

Squash pushed a quick Cargo.toml simplification:

$ git diff-tree -U1 c3f8144222 86c661a5e6
diff --git a/lightning-tests/Cargo.toml b/lightning-tests/Cargo.toml
index 01ad635580..75c68e03f5 100644
--- a/lightning-tests/Cargo.toml
+++ b/lightning-tests/Cargo.toml
@@ -12,6 +12,6 @@ edition = "2021"
 [dependencies]
-lightning-types = { version = "0.3.0", path = "../lightning-types", features = ["_test_utils"] }
-lightning-invoice = { version = "0.34.0", path = "../lightning-invoice", default-features = false }
-lightning-macros = { version = "0.2", path = "../lightning-macros" }
-lightning = { version = "0.2", path = "../lightning", features = ["_test_utils"] }
+lightning-types = { path = "../lightning-types", features = ["_test_utils"] }
+lightning-invoice = { path = "../lightning-invoice", default-features = false }
+lightning-macros = { path = "../lightning-macros" }
+lightning = { path = "../lightning", features = ["_test_utils"] }
 lightning_0_1 = { package = "lightning", version = "0.1.1", features = ["_test_utils"] }

TheBlueMatt avatar May 21 '25 15:05 TheBlueMatt

@tnull already said "LGTM" and the one remaining question was addressed, landing since i want to base more PRs on this.

TheBlueMatt avatar May 21 '25 17:05 TheBlueMatt

Partially backported in https://github.com/lightningdevkit/rust-lightning/pull/3794

TheBlueMatt avatar May 23 '25 14:05 TheBlueMatt