Skip to content

Conversation

@tnull
Copy link
Collaborator

@tnull tnull commented Oct 17, 2025

As we're looking to move to a more async-friendly API over time (which would allow us to drop the dependency on the KVStoreSync implementation entirely), we here make a few prefactors and minor improvements that move in that direction.

Most notably, we switch to have our tests run in async contexts, which also should make them more efficient as not every node will spawn its own runtime, but rather reuse the one runtime spawned for each test case.

Moreover, we reintroduce a secondary runtime internal to VssStore in order to fix the blocking issue we recently hit in our CI. Additionally, we found that not all tests cfg-gated under vss_test were being run, so we fix these test cases and have them run in CI.

tnull added 2 commits October 17, 2025 12:59
.. as we're about to `cargo test` anyways.
.. some of the `ReadFailed` cases didn't log why they failed. Here we
fix that oversight.
@tnull tnull requested a review from joostjager October 17, 2025 11:08
@ldk-reviews-bot
Copy link

ldk-reviews-bot commented Oct 17, 2025

👋 Thanks for assigning @joostjager as a reviewer!
I'll wait for their review and will help manage the review process.
Once they submit their review, I'll check if a second reviewer would be helpful.

@tnull tnull force-pushed the 2025-10-asyncify-more-things branch 3 times, most recently from f817f78 to 141f186 Compare October 17, 2025 11:21
@ldk-reviews-bot
Copy link

🔔 1st Reminder

Hey @joostjager! This PR has been waiting for your review.
Please take a look when you have a chance. If you're unable to review, please let us know so we can find another reviewer.

@tnull tnull force-pushed the 2025-10-asyncify-more-things branch from e6e2073 to 584fff6 Compare October 21, 2025 15:11
@tnull tnull changed the title Asyncify test suite and event queue Asyncify test suite and reintroduce VSS-internal runtime Oct 21, 2025
@tnull tnull requested a review from joostjager October 21, 2025 15:17
@tnull
Copy link
Collaborator Author

tnull commented Oct 21, 2025

Now added changes reintroducing a secondary runtime internal to VssStore in order to fix the blocking issue we recently hit in our CI. Additionally, we found that not all tests cfg-gated under vss_test were being run, so we fix these test cases and have them run in CI.

@tnull tnull force-pushed the 2025-10-asyncify-more-things branch 7 times, most recently from 6d3a774 to eedfb12 Compare October 21, 2025 21:31
Copy link
Contributor

@joostjager joostjager left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR could have been split up in independent changes, but perhaps too late now.

The whole rust async situation is so painful. It really seems to get to the point - if it wasn't already there - of being a true velocity killer.

@tnull tnull force-pushed the 2025-10-asyncify-more-things branch from eedfb12 to dba502d Compare October 27, 2025 12:52
Copy link
Collaborator Author

@tnull tnull left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed remaining comments.

@tnull tnull force-pushed the 2025-10-asyncify-more-things branch 2 times, most recently from 300e9bb to 4622fb1 Compare October 27, 2025 13:08
@tnull tnull requested a review from joostjager October 27, 2025 15:02
@tnull
Copy link
Collaborator Author

tnull commented Oct 27, 2025

CI failure is unrelated: #679

@tnull
Copy link
Collaborator Author

tnull commented Oct 28, 2025

Addressed pending feedback.

@joostjager let me know if I can squash.

tnull added 5 commits October 28, 2025 10:23
Given we regularly run into issues arising from mixing sync and async
contexts, we here simplify our `EventQueue` implementation by avoiding
to use `Condvar::wait_while` (which parks the current thread) and rather
simply us `block_on` on our `next_event_async` method.
.. as LDK Node is moving towards a more `async` core, it starts to make
sense to switch our test suite over to be `async`.

This change should make our CI more efficient (as not every node will
spawn its independent runtime, but we just have one runtime per test
created) and also makes sure we won't run into any edge cases arising
from blocking test threads that are executing other async tasks.
Since it seems to make a difference to `tokio` (see
https://docs.rs/tokio/latest/tokio/time/fn.timeout.html#panics) we make
sure the futures are always put in an `async` closure.
In order to avoid the recently, discovered blocking-task-deadlock (in
which the task holding the runtime reactor got blocked and hence
stopped polling VSS write tasks), we where re-introduce an internal
runtime to the `VssStore`, on which we spawn the tasks, while still
using `block_on` of our regular runtime for async-sync conversions.

This also finally fixes our VSS CI.
.. we previously avoided running some tests which turned out to be
broken.
@tnull tnull force-pushed the 2025-10-asyncify-more-things branch from e4f3ba0 to 8cad63b Compare October 28, 2025 09:23
Copy link
Contributor

@joostjager joostjager left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remaining questions answered offline and summarized in threads. LGTM

@tnull tnull merged commit d984aca into lightningdevkit:main Oct 28, 2025
6 of 15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants