Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions .github/workflows/vss-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: VSS Tests

on: [push, pull_request]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build-and-test:
runs-on: ubuntu-latest

services:
postgres:
image: postgres:latest
ports:
- 5432:5432
env:
POSTGRES_DB: postgres
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
path: rust-lightning
- name: Checkout VSS
uses: actions/checkout@v4
with:
repository: lightningdevkit/vss-server
path: vss-server

- name: Build and Deploy VSS Server
run: |
cd vss-server/rust
cargo run server/vss-server-config.toml > /tmp/vss-server.log 2>&1 &
until curl -sf http://localhost:8080/vss > /dev/null; do sleep 1; done
- name: Run VSS tests
run: |
cd rust-lightning/lightning-persister
export TEST_VSS_BASE_URL="http://localhost:8080/vss"
RUSTFLAGS="--cfg vss_test" cargo test --features vss vss_store
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,5 @@ check-cfg = [
"cfg(simple_close)",
"cfg(peer_storage)",
"cfg(tor)",
"cfg(vss_test)",
]
5 changes: 5 additions & 0 deletions lightning-persister/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,15 @@ rustdoc-args = ["--cfg", "docsrs"]

[features]
tokio = ["dep:tokio"]
vss = ["dep:vss-client", "dep:tokio", "dep:getrandom", "dep:lightning-macros"]

[dependencies]
bitcoin = "0.32.2"
lightning = { version = "0.3.0", path = "../lightning" }
lightning-macros = { version = "0.2.0", path = "../lightning-macros", optional = true }
tokio = { version = "1.35", optional = true, default-features = false, features = ["rt-multi-thread"] }
Copy link
Collaborator

Choose a reason for hiding this comment

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

Bug: The code uses tokio::sync::Mutex extensively (7+ call sites in vss_store.rs), but the tokio dependency only declares features = ["rt-multi-thread"]. The sync feature is required for tokio::sync::Mutex to be available.

This likely compiles today only because vss-client-ng transitively enables tokio/sync. If that crate ever changes its tokio feature requirements, this will break.

Suggested change
tokio = { version = "1.35", optional = true, default-features = false, features = ["rt-multi-thread"] }
tokio = { version = "1.35", optional = true, default-features = false, features = ["rt-multi-thread", "sync"] }

vss-client = { package = "vss-client-ng", version = "0.5", optional = true }
getrandom = { version = "0.3", optional = true }

[target.'cfg(windows)'.dependencies]
windows-sys = { version = "0.48.0", default-features = false, features = ["Win32_Storage_FileSystem", "Win32_Foundation"] }
Expand All @@ -32,6 +36,7 @@ criterion = { version = "0.4", optional = true, default-features = false }
[dev-dependencies]
lightning = { version = "0.3.0", path = "../lightning", features = ["_test_utils"] }
bitcoin = { version = "0.32.2", default-features = false }
rand = { version = "0.9.2", default-features = false, features = ["thread_rng"] }
tokio = { version = "1.35", default-features = false, features = ["macros"] }

[lints]
Expand Down
6 changes: 6 additions & 0 deletions lightning-persister/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ extern crate criterion;

pub mod fs_store;

#[cfg(feature = "vss")]
pub mod vss_store;

#[cfg(feature = "vss")]
pub use vss_client;

mod utils;

#[cfg(test)]
Expand Down
Loading
Loading