Skip to content

Commit f0ab9e2

Browse files
committed
Switch to new sigs-based auth in VSS integration tests
When we added the trivial sigs-based authentication scheme in VSS, we made it the default if no other authentication scheme was configured and default features are enabled. This broke our integration tests as we were expecting no authentication to be required in such a case. Here we fix this by switching to the new sigs-based auth scheme, removing `store_id`s to demonstrate client isolation while we're at it.
1 parent e88466d commit f0ab9e2

File tree

2 files changed

+12
-40
lines changed

2 files changed

+12
-40
lines changed

src/builder.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -589,7 +589,7 @@ impl NodeBuilder {
589589
///
590590
/// Uses a simple authentication scheme proving knowledge of a secret key.
591591
///
592-
/// `fixed_headers` are included as it is in all the requests made to VSS and LNURL auth server.
592+
/// `fixed_headers` are included as it is in all the requests made to VSS.
593593
///
594594
/// **Caution**: VSS support is in **alpha** and is considered experimental.
595595
/// Using VSS (or any remote persistence) may cause LDK to panic if persistence failures are

tests/integration_tests_vss.rs

Lines changed: 11 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@ async fn channel_full_cycle_with_vss_store() {
2525
builder_a.set_chain_source_esplora(esplora_url.clone(), None);
2626
let vss_base_url = std::env::var("TEST_VSS_BASE_URL").unwrap();
2727
let node_a = builder_a
28-
.build_with_vss_store_and_fixed_headers(
28+
.build_with_vss_store(
2929
config_a.node_entropy,
3030
vss_base_url.clone(),
31-
"node_1_store".to_string(),
31+
"".to_owned(),
3232
HashMap::new(),
3333
)
3434
.unwrap();
@@ -39,12 +39,7 @@ async fn channel_full_cycle_with_vss_store() {
3939
let mut builder_b = Builder::from_config(config_b.node_config);
4040
builder_b.set_chain_source_esplora(esplora_url.clone(), None);
4141
let node_b = builder_b
42-
.build_with_vss_store_and_fixed_headers(
43-
config_b.node_entropy,
44-
vss_base_url,
45-
"node_2_store".to_string(),
46-
HashMap::new(),
47-
)
42+
.build_with_vss_store(config_b.node_entropy, vss_base_url, "".to_owned(), HashMap::new())
4843
.unwrap();
4944
node_b.start().unwrap();
5045

@@ -66,11 +61,9 @@ async fn vss_v0_schema_backwards_compatibility() {
6661
let esplora_url = format!("http://{}", electrsd.esplora_url.as_ref().unwrap());
6762
let vss_base_url = std::env::var("TEST_VSS_BASE_URL").unwrap();
6863

69-
let rand_suffix: String =
70-
(0..7).map(|_| rng().sample(rand::distr::Alphanumeric) as char).collect();
71-
let store_id = format!("v0_compat_test_{}", rand_suffix);
7264
let storage_path = common::random_storage_path().to_str().unwrap().to_owned();
73-
let seed_bytes = [42u8; 64];
65+
let mut seed_bytes = [42u8; 64];
66+
rand::thread_rng().fill_bytes(&mut seed_bytes);
7467
let node_entropy = NodeEntropy::from_seed_bytes(seed_bytes);
7568

7669
// Setup a v0.6.2 `Node` persisted with the v0 scheme.
@@ -81,11 +74,7 @@ async fn vss_v0_schema_backwards_compatibility() {
8174
builder_old.set_entropy_seed_bytes(seed_bytes);
8275
builder_old.set_chain_source_esplora(esplora_url.clone(), None);
8376
let node_old = builder_old
84-
.build_with_vss_store_and_fixed_headers(
85-
vss_base_url.clone(),
86-
store_id.clone(),
87-
HashMap::new(),
88-
)
77+
.build_with_vss_store(vss_base_url.clone(), "".to_owned(), HashMap::new())
8978
.unwrap();
9079

9180
node_old.start().unwrap();
@@ -119,12 +108,7 @@ async fn vss_v0_schema_backwards_compatibility() {
119108
builder_new.set_chain_source_esplora(esplora_url, None);
120109

121110
let node_new = builder_new
122-
.build_with_vss_store_and_fixed_headers(
123-
node_entropy,
124-
vss_base_url,
125-
store_id,
126-
HashMap::new(),
127-
)
111+
.build_with_vss_store(node_entropy, vss_base_url, "".to_owned(), HashMap::new())
128112
.unwrap();
129113

130114
node_new.start().unwrap();
@@ -145,11 +129,9 @@ async fn vss_node_restart() {
145129
let esplora_url = format!("http://{}", electrsd.esplora_url.as_ref().unwrap());
146130
let vss_base_url = std::env::var("TEST_VSS_BASE_URL").unwrap();
147131

148-
let rand_suffix: String =
149-
(0..7).map(|_| rng().sample(rand::distr::Alphanumeric) as char).collect();
150-
let store_id = format!("restart_test_{}", rand_suffix);
151132
let storage_path = common::random_storage_path().to_str().unwrap().to_owned();
152-
let seed_bytes = [42u8; 64];
133+
let mut seed_bytes = [42u8; 64];
134+
rand::thread_rng().fill_bytes(&mut seed_bytes);
153135
let node_entropy = NodeEntropy::from_seed_bytes(seed_bytes);
154136

155137
// Setup initial node and fund it.
@@ -159,12 +141,7 @@ async fn vss_node_restart() {
159141
builder.set_storage_dir_path(storage_path.clone());
160142
builder.set_chain_source_esplora(esplora_url.clone(), None);
161143
let node = builder
162-
.build_with_vss_store_and_fixed_headers(
163-
node_entropy,
164-
vss_base_url.clone(),
165-
store_id.clone(),
166-
HashMap::new(),
167-
)
144+
.build_with_vss_store(node_entropy, vss_base_url.clone(), "".to_owned(), HashMap::new())
168145
.unwrap();
169146

170147
node.start().unwrap();
@@ -193,12 +170,7 @@ async fn vss_node_restart() {
193170
builder.set_chain_source_esplora(esplora_url, None);
194171

195172
let node = builder
196-
.build_with_vss_store_and_fixed_headers(
197-
node_entropy,
198-
vss_base_url,
199-
store_id,
200-
HashMap::new(),
201-
)
173+
.build_with_vss_store(node_entropy, vss_base_url, "".to_owned(), HashMap::new())
202174
.unwrap();
203175

204176
node.start().unwrap();

0 commit comments

Comments
 (0)