diff --git a/.github/workflows/rust.yaml b/.github/workflows/rust.yaml index a1156380..3a032edb 100644 --- a/.github/workflows/rust.yaml +++ b/.github/workflows/rust.yaml @@ -107,7 +107,7 @@ jobs: RUST_BACKTRACE: 1 - name: RGB Test Init - run: cargo test --locked --features server --test init -- init --nocapture --test-threads 1 + run: cargo test --locked --features server --test _init -- _init --nocapture --test-threads 1 - name: RGB Tests run: cargo test --locked --features server --test rgb -- rgb --nocapture --test-threads 1 diff --git a/Cargo.lock b/Cargo.lock index 8e929897..f9597f0f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -111,7 +111,7 @@ dependencies = [ "serde_json", "serde_yaml", "stringly_conversions", - "toml 0.8.8", + "toml", "wasm-bindgen", ] @@ -724,7 +724,7 @@ dependencies = [ "strict_types", "thiserror", "tokio", - "toml 0.7.8", + "toml", "tower-http", "walkdir", "wasm-bindgen", @@ -3606,7 +3606,7 @@ dependencies = [ "serde_yaml", "sha2 0.10.8", "strict_encoding", - "toml 0.8.8", + "toml", ] [[package]] @@ -3857,29 +3857,17 @@ dependencies = [ "tracing", ] -[[package]] -name = "toml" -version = "0.7.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd79e69d3b627db300ff956027cc6c3798cef26d22526befdfcd12feeb6d2257" -dependencies = [ - "indexmap 2.1.0", - "serde", - "serde_spanned", - "toml_datetime", - "toml_edit 0.19.15", -] - [[package]] name = "toml" version = "0.8.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a1a195ec8c9da26928f773888e0742ca3ca1040c6cd859c919c9f59c1954ab35" dependencies = [ + "indexmap 2.1.0", "serde", "serde_spanned", "toml_datetime", - "toml_edit 0.21.0", + "toml_edit", ] [[package]] @@ -3891,19 +3879,6 @@ dependencies = [ "serde", ] -[[package]] -name = "toml_edit" -version = "0.19.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" -dependencies = [ - "indexmap 2.1.0", - "serde", - "serde_spanned", - "toml_datetime", - "winnow", -] - [[package]] name = "toml_edit" version = "0.21.0" diff --git a/Cargo.toml b/Cargo.toml index e00acc9c..23936193 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -135,7 +135,7 @@ anyhow = "1.0.71" blake3 = "1.4.1" rgb-std = { version = "0.10.2" } serde = "1.0.189" -toml = { version = "0.7.8", features = ["preserve_order"] } +toml = { version = "0.8.0", features = ["preserve_order"] } [patch.crates-io] # Remove after merge and release https://github.com/BP-WG/bitcoin_foundation/pull/20 diff --git a/build.rs b/build.rs index 5b5cfa4e..02684273 100644 --- a/build.rs +++ b/build.rs @@ -1,4 +1,4 @@ -use std::{collections::BTreeMap, fs}; +use std::{collections::BTreeMap, env, fs, path}; use anyhow::Result; use rgbstd::{ @@ -54,6 +54,14 @@ const MARKETPLACE_OFFERS: &str = "bitmask-marketplace_public_offers.c15"; const MARKETPLACE_BIDS: &str = "bitmask-marketplace_public_bids.c15"; const NETWORK: &str = "bitcoin"; // Only mainnet is tracked, no monetary incentive to upgrade testnet assets +pub fn init_fs() -> Result<()> { + let dir = env::var("CARBONADO_DIR").unwrap_or("/tmp/bitmaskd/carbonado".to_owned()); + let dir = path::Path::new(&dir); + fs::create_dir_all(dir)?; + + Ok(()) +} + fn main() -> Result<()> { // lib ids const BMC_VERSION: &str = env!("CARGO_PKG_VERSION"); @@ -158,5 +166,7 @@ fn main() -> Result<()> { fs::write(FILE_HASHES_FILE, toml)?; + init_fs()?; + Ok(()) } diff --git a/src/regtest.rs b/src/regtest.rs index d5d390f3..e460f610 100644 --- a/src/regtest.rs +++ b/src/regtest.rs @@ -1,16 +1,15 @@ #![cfg(not(target_arch = "wasm32"))] use std::{ - env, path, + env, fs, path, process::{Command, Stdio}, }; use anyhow::Result; -use tokio::fs; -pub async fn init_fs() -> Result<()> { +pub fn init_fs() -> Result<()> { let dir = env::var("CARBONADO_DIR").unwrap_or("/tmp/bitmaskd/carbonado".to_owned()); let dir = path::Path::new(&dir); - fs::create_dir_all(dir).await?; + fs::create_dir_all(dir)?; Ok(()) } diff --git a/tests/init.rs b/tests/_init.rs similarity index 59% rename from tests/init.rs rename to tests/_init.rs index 035b7bc6..04f403d3 100644 --- a/tests/init.rs +++ b/tests/_init.rs @@ -3,9 +3,9 @@ use anyhow::Result; use bitmask_core::regtest::init_fs; -#[tokio::test] -pub async fn init() -> Result<()> { - init_fs().await?; +#[test] +pub fn _init() -> Result<()> { + init_fs()?; Ok(()) }