Skip to content

Commit 752bfa0

Browse files
committed
Update to latest bip300301_enforcer
1 parent 9fd9a6a commit 752bfa0

12 files changed

Lines changed: 860 additions & 406 deletions

File tree

Cargo.lock

Lines changed: 822 additions & 359 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ ed25519-dalek = "2.1.1"
2828
educe = { version = "0.6.0", default-features = false }
2929
eframe = "0.31.0"
3030
either = "1.13.0"
31+
error-fatality = "0.1.2"
3132
fallible-iterator = "0.3.0"
3233
fatality = "0.1.1"
3334
futures = { version = "0.3.30", default-features = false }
@@ -67,9 +68,9 @@ shlex = "1.3.0"
6768
smallvec = "1.13.2"
6869
sneed = "0.0.19"
6970
strum = { version = "0.27.2", default-features = false }
70-
thiserror = "=2.0.16"
71+
thiserror = "2.0.16"
7172
tiny-bip39 = "2.0.0"
72-
tokio = { version = "1.48.0", default-features = false }
73+
tokio = { version = "1.50.0", default-features = false }
7374
tokio-stream = "0.1.15"
7475
tokio-util = "0.7.18"
7576
tonic = "0.14.3"
@@ -89,17 +90,17 @@ url = "2.5.4"
8990
utoipa = { version = "5.2.0", default-features = false }
9091
uuid = "1.13.1"
9192
x25519-dalek = "2.0.0"
92-
zeromq = "0.4.1"
93+
zeromq = "0.5.0"
9394

9495
[workspace.dependencies.bip300301_enforcer_lib]
9596
default-features = false
9697
git = "https://github.com/LayerTwo-Labs/bip300301_enforcer"
97-
rev = "9c3eb0bdcb5b9a458e6f92cafb8bdbf76a860f74"
98+
rev = "57bf4f8ace4454eddaec83dbc634dc706fc71516"
9899

99100
[workspace.dependencies.bip300301_enforcer_integration_tests]
100101
default-features = false
101102
git = "https://github.com/LayerTwo-Labs/bip300301_enforcer"
102-
rev = "9c3eb0bdcb5b9a458e6f92cafb8bdbf76a860f74"
103+
rev = "57bf4f8ace4454eddaec83dbc634dc706fc71516"
103104

104105
[workspace.dependencies.l2l-openapi]
105106
git = "https://github.com/Ash-L2L/l2l-openapi"

deny.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,6 @@ allow = [
103103
"ISC",
104104
"MIT",
105105
"MITNFA",
106-
"OpenSSL",
107106
"Unicode-3.0",
108107
"Unlicense",
109108
]
@@ -122,7 +121,7 @@ exceptions = [
122121
{ allow = ["CDLA-Permissive-2.0"], name = "webpki-roots", version = "1.0.5" },
123122
{ allow = ["LicenseRef-UFL-1.0", "OFL-1.1", "Ubuntu-font-1.0"], name = "epaint_default_fonts", version = "0.31.0" },
124123
{ allow = ["MPL-2.0"], name = "bitmaps", version = "3.2.1" },
125-
{ allow = ["MPL-2.0"], name = "imbl", version = "3.0.0" },
124+
{ allow = ["MPL-2.0"], name = "imbl", version = "7.0.0" },
126125
{ allow = ["MPL-2.0"], name = "imbl-sized-chunks", version = "0.1.3" },
127126
{ allow = ["MPL-2.0"], name = "option-ext", version = "0.2.0" },
128127
{ allow = ["MPL-2.0"], name = "webpki-roots", version = "0.25.4" },

integration_tests/ibd.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ async fn setup(
3535
res_tx: mpsc::UnboundedSender<anyhow::Result<()>>,
3636
) -> anyhow::Result<(EnforcerPostSetup, BitNamesNodes)> {
3737
let enforcer_pre_setup =
38-
EnforcerPreSetup::new(bin_paths.others, Network::Regtest)?;
38+
EnforcerPreSetup::new(&bin_paths.others, Network::Regtest)?;
3939
let mut enforcer_post_setup = {
4040
let setup_opts: EnforcerSetupOpts = Default::default();
4141
enforcer_pre_setup
@@ -44,7 +44,7 @@ async fn setup(
4444
};
4545
let sidechain_sender = PostSetup::setup(
4646
Init {
47-
bitnames_app: bin_paths.bitnames.clone(),
47+
bitnames_app: bin_paths.bitnames()?.clone(),
4848
data_dir_suffix: Some("sender".to_owned()),
4949
},
5050
&enforcer_post_setup,
@@ -54,7 +54,7 @@ async fn setup(
5454
tracing::info!("Setup BitNames send node successfully");
5555
let sidechain_syncer = PostSetup::setup(
5656
Init {
57-
bitnames_app: bin_paths.bitnames.clone(),
57+
bitnames_app: bin_paths.bitnames()?.clone(),
5858
data_dir_suffix: Some("syncer".to_owned()),
5959
},
6060
&enforcer_post_setup,

integration_tests/integration_test.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ fn deposit_withdraw_roundtrip_trial(
134134
async move {
135135
let (res_tx, _) = futures::channel::mpsc::unbounded();
136136
let pre_setup =
137-
EnforcerPreSetup::new(bin_paths.others, Network::Regtest)?;
137+
EnforcerPreSetup::new(&bin_paths.others, Network::Regtest)?;
138138
let post_setup = {
139139
let setup_opts: EnforcerSetupOpts = Default::default();
140140
pre_setup
@@ -144,7 +144,7 @@ fn deposit_withdraw_roundtrip_trial(
144144
deposit_withdraw_roundtrip(
145145
post_setup,
146146
Init {
147-
bitnames_app: bin_paths.bitnames,
147+
bitnames_app: bin_paths.bitnames()?.clone(),
148148
data_dir_suffix: None,
149149
},
150150
res_tx,

integration_tests/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ async fn main() -> anyhow::Result<std::process::ExitCode> {
101101
let failure_collector = TestFailureCollector::new();
102102
tests.extend(
103103
integration_test::tests(
104-
util::BinPaths::from_env()?,
104+
util::BinPaths::default(),
105105
file_registry,
106106
failure_collector,
107107
)

integration_tests/register_bitname.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ async fn setup(
3333
res_tx: mpsc::UnboundedSender<anyhow::Result<()>>,
3434
) -> anyhow::Result<(EnforcerPostSetup, PostSetup)> {
3535
let enforcer_pre_setup =
36-
EnforcerPreSetup::new(bin_paths.others, Network::Regtest)?;
36+
EnforcerPreSetup::new(&bin_paths.others, Network::Regtest)?;
3737
let mut enforcer_post_setup = {
3838
let setup_opts: EnforcerSetupOpts = Default::default();
3939
enforcer_pre_setup
@@ -47,7 +47,7 @@ async fn setup(
4747
let () = fund_enforcer::<PostSetup>(&mut enforcer_post_setup).await?;
4848
let mut post_setup = PostSetup::setup(
4949
Init {
50-
bitnames_app: bin_paths.bitnames,
50+
bitnames_app: bin_paths.bitnames()?.clone(),
5151
data_dir_suffix: None,
5252
},
5353
&enforcer_post_setup,

integration_tests/unknown_withdrawal.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ use crate::{
3030

3131
/// Initial setup for the test
3232
async fn setup(
33-
enforcer_bin_paths: EnforcerBinPaths,
33+
enforcer_bin_paths: &EnforcerBinPaths,
3434
res_tx: mpsc::UnboundedSender<anyhow::Result<()>>,
3535
) -> anyhow::Result<EnforcerPostSetup> {
3636
let enforcer_pre_setup =
@@ -59,10 +59,10 @@ async fn unknown_withdrawal_task(
5959
res_tx: mpsc::UnboundedSender<anyhow::Result<()>>,
6060
) -> anyhow::Result<()> {
6161
let mut enforcer_post_setup =
62-
setup(bin_paths.others, res_tx.clone()).await?;
62+
setup(&bin_paths.others, res_tx.clone()).await?;
6363
let mut sidechain_withdrawer = PostSetup::setup(
6464
Init {
65-
bitnames_app: bin_paths.bitnames.clone(),
65+
bitnames_app: bin_paths.bitnames()?.clone(),
6666
data_dir_suffix: Some("withdrawer".to_owned()),
6767
},
6868
&enforcer_post_setup,
@@ -93,7 +93,7 @@ async fn unknown_withdrawal_task(
9393
// New sidechain node, starting from scratch
9494
let mut sidechain_successor = PostSetup::setup(
9595
Init {
96-
bitnames_app: bin_paths.bitnames,
96+
bitnames_app: bin_paths.bitnames()?.clone(),
9797
data_dir_suffix: Some("successor".to_owned()),
9898
},
9999
&enforcer_post_setup,

integration_tests/util.rs

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,24 @@
11
use std::{
22
ffi::{OsStr, OsString},
33
path::PathBuf,
4+
sync::OnceLock,
45
};
56

67
use bip300301_enforcer_integration_tests::util::{
7-
AbortOnDrop, BinPaths as EnforcerBinPaths, VarError, get_env_var,
8+
AbortOnDrop, BinPaths as EnforcerBinPaths, OnceLockExt as _, VarError,
89
spawn_command_with_args,
910
};
1011
use plain_bitnames::types::Network;
1112

12-
fn load_env_var_from_string(s: &str) -> Result<(), VarError> {
13-
dotenvy::from_read_override(s.as_bytes())
14-
.map_err(|err| VarError::new(s, err))
15-
}
16-
17-
#[derive(Clone, Debug)]
13+
#[derive(Clone, Debug, Default)]
1814
pub struct BinPaths {
19-
pub bitnames: PathBuf,
15+
bitnames: OnceLock<PathBuf>,
2016
pub others: EnforcerBinPaths,
2117
}
2218

2319
impl BinPaths {
24-
/// Read from environment variables
25-
pub fn from_env() -> Result<Self, VarError> {
26-
let () = load_env_var_from_string("BITCOIN_UTIL=''")?;
27-
let () = load_env_var_from_string("SIGNET_MINER=''")?;
28-
Ok(Self {
29-
bitnames: get_env_var("BITNAMES_APP")?.into(),
30-
others: EnforcerBinPaths::from_env()?,
31-
})
20+
pub fn bitnames(&self) -> Result<&PathBuf, VarError> {
21+
self.bitnames.get_or_try_init_from_env("BITNAMES_APP")
3222
}
3323
}
3424

lib/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ clap = { workspace = true, features = ["derive"], optional = true }
2727
ed25519-bip32 = { workspace = true }
2828
ed25519-dalek = { workspace = true, features = ["hazmat"]}
2929
educe = { workspace = true, features = ["Clone", "Debug"] }
30+
error-fatality = { workspace = true }
3031
fallible-iterator = { workspace = true }
31-
fatality = { workspace = true }
3232
futures = { workspace = true, features = ["alloc"] }
3333
governor = { workspace = true, features = ["quanta", "std"] }
3434
hashlink = { workspace = true, features = ["serde_impl"] }

0 commit comments

Comments
 (0)