Skip to content

Commit 5cd5af1

Browse files
committed
provision: default to fake provision dns name
1 parent b7d5502 commit 5cd5af1

File tree

4 files changed

+12
-14
lines changed

4 files changed

+12
-14
lines changed

common/src/cli.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ pub struct ProvisionArgs {
209209

210210
/// the DNS name the node enclave should include in its remote attestation
211211
/// certificate and the client will expect in its connection
212-
#[argh(option, default = "String::from(\"localhost\")")]
212+
#[argh(option, default = "String::from(\"provision.lexe.tech\")")]
213213
pub node_dns_name: String,
214214

215215
/// protocol://host:port of the node backend.
@@ -231,7 +231,7 @@ impl Default for ProvisionArgs {
231231
Self {
232232
user_pk: UserPk::from_i64(1), // Test user
233233
machine_id: enclave::machine_id(),
234-
node_dns_name: "localhost".to_owned(),
234+
node_dns_name: "provision.lexe.tech".to_owned(),
235235
port: None,
236236
backend_url: DEFAULT_BACKEND_URL.to_owned(),
237237
runner_url: DEFAULT_RUNNER_URL.to_owned(),

common/src/root_seed.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,9 +115,7 @@ impl RootSeed {
115115
.ckd_priv(&secp_ctx, child_number)
116116
.expect("should never fail")
117117
.private_key;
118-
let node_key_pair = KeyPair::from_secret_key(&secp_ctx, node_sk);
119-
120-
node_key_pair
118+
KeyPair::from_secret_key(&secp_ctx, node_sk)
121119
}
122120

123121
#[cfg(test)]

node/src/lexe/persister.rs

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ use lightning::routing::scoring::{
1919
};
2020
use lightning::util::persist::Persister;
2121
use lightning::util::ser::{ReadableArgs, Writeable};
22-
use once_cell::sync::{Lazy, OnceCell};
22+
use once_cell::sync::Lazy;
2323
use tokio::runtime::{Builder, Handle, Runtime};
2424
use tracing::{debug, error};
2525

@@ -321,14 +321,13 @@ impl InnerPersister {
321321

322322
/// A Tokio runtime which can be used to run async closures in sync fns
323323
/// downstream of thread::spawn()
324-
static PERSISTER_RUNTIME: Lazy<OnceCell<Runtime>> = Lazy::new(|| {
324+
static PERSISTER_RUNTIME: Lazy<Runtime> = Lazy::new(|| {
325325
Builder::new_current_thread()
326326
.enable_io()
327327
// Because our reqwest::Client has a configured timeout
328328
.enable_time()
329329
.build()
330330
.unwrap()
331-
.into()
332331
});
333332

334333
/// This trait is defined in lightning::util::Persist.
@@ -369,8 +368,6 @@ impl<'a>
369368

370369
// Run an async fn inside a sync fn downstream of thread::spawn()
371370
PERSISTER_RUNTIME
372-
.get()
373-
.unwrap()
374371
.block_on(async move { self.api.upsert_file(cm_file).await })
375372
.map(|_| ())
376373
.map_err(|api_err| {
@@ -397,8 +394,6 @@ impl<'a>
397394

398395
// Run an async fn inside a sync fn downstream of thread::spawn()
399396
PERSISTER_RUNTIME
400-
.get()
401-
.unwrap()
402397
.block_on(async move { self.api.upsert_file(file).await })
403398
.map(|_| ())
404399
.map_err(|api_err| {
@@ -428,7 +423,7 @@ impl<'a>
428423
)
429424
};
430425

431-
PERSISTER_RUNTIME.get().unwrap().block_on(async move {
426+
PERSISTER_RUNTIME.block_on(async move {
432427
self.api
433428
.upsert_file(scorer_file)
434429
.await

node/src/provision.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,12 @@ mod test {
366366
async fn test_provision() {
367367
logger::init_for_testing();
368368

369-
let args = ProvisionArgs::default();
369+
let args = ProvisionArgs {
370+
// we're not going through a proxy and can't change DNS resolution
371+
// here (yet), so just bind cert to "localhost".
372+
node_dns_name: "localhost".to_owned(),
373+
..ProvisionArgs::default()
374+
};
370375
let user_pk = args.user_pk;
371376

372377
let mut rng = SysRng::new();

0 commit comments

Comments
 (0)