-
Notifications
You must be signed in to change notification settings - Fork 385
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
Add a simple test of upgrading from LDK 0.1 and correct in_flight_monitor_updates
on upgrade
#3584
base: main
Are you sure you want to change the base?
Add a simple test of upgrading from LDK 0.1 and correct in_flight_monitor_updates
on upgrade
#3584
Conversation
708a5cc
to
a237be2
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.
Would it make sense to have this live in a dedicated tests crate or in the integration tests (tests
) folder? This would also allow us to keep our testing script untouched, IIUC?
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.
Hmmmm, yea, we definitely could. I'm kinda on the fence. On the one hand, you're right, we'd be able to do cargo -p lightning
which is really nice, on the other hand we wouldn't run the upgrade tests with cargo test
, which kinda sucks (and means yet more cases of things passing trivially but failing in CI). Do you have a strong opinion here?
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.
we wouldn't run the upgrade tests with
cargo test
, which kinda sucks (and means yet more cases of things passing trivially but failing in CI).
Huh, but integration tests are run via cargo test
, just after normal unit tests are run?
Do you have a strong opinion here?
Yeah, kinda tbh, I'd prefer to not interweave yet another layer of complexity into CI & dependency scripts. I agree we should see that tests are always run in CI and easy to run locally, but would prefer to have them live separately from the code and unit tests.
Note we could either have integration tests live as lightning/tests
, or, especially if we think that we'd want to add more cross-crate tests there over time, could add them as a new member crate to the workspace at /lightning-tests
. While the former is a bit more focused on lightning
, the latter would open the door for moving some of the tests in lightning-background-processor
there, which currently acts as the defacto place for integration tests as it's the only place in the dependency tree that allows for accessing all the necessary objects.
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.
Huh, but integration tests are run via cargo test, just after normal unit tests are run?
Note we could either have integration tests live as lightning/tests
I don't see a way to add a separate dependency to the normal rust integration test files. We'd have to do it as a proper crate with a proper Cargo.toml
, which I assume wouldn't get run like integration tests would.
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.
Hmm, that's true. Then IMO it might be preferable to just add a lightning-tests
crate to the workspace? Yes, it wouldn't get run by cargo test
, but by the ci-tests.sh
, which we already need to run anyways to cover all feature variants, etc?
LGTM after @tnull's feedback is resolved (and it looks like this need rebase). Nice to have this testing infra! |
In e8854f9 we changed the type of `ChannelManager::in_flight_monitor_updates`, writing a legacy version and reading the new version as a new TLV field. Sadly, we spuriously marked the new TLV as `required`, breaking upgrade from 0.1. Here we fix the oversight by simply marking it `option`al.
The code was a bit too long to begin with, and rustfmt made a total mess of it, so instead we should be building with more intermediate variables.
The signer we use in tests tracks the state of the channel and refuses to sign when the channel attempts an invalid state transition. In the next commit, however, we'll add an upgrade test which will fail these checks as the the state won't get copied from previous versions of LDK to this version. Thus, here, we add the ability to disable all state-based checks in the signer.
a237be2
to
44e1a54
Compare
Rebased. I pinged @tnull offline but dunno when/if he'll respond, there's also no rush. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3584 +/- ##
==========================================
- Coverage 89.22% 89.17% -0.06%
==========================================
Files 155 156 +1
Lines 118973 119029 +56
Branches 118973 119029 +56
==========================================
- Hits 106154 106139 -15
- Misses 10239 10291 +52
- Partials 2580 2599 +19 ☔ View full report in Codecov by Sentry. |
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.
44e1a54
to
b099963
Compare
CI is still sad |
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 canuse in tests.
Here we add a simple initial test of upgrading from LDK 0.1 while
there's a pending payment to be claimed.