diff --git a/Cargo.toml b/Cargo.toml index 6db2a89..276b2f5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -38,6 +38,7 @@ tower-cartesi = { path = "tower-cartesi" } [features] default = [] lightwalletd = ["dep:cartezcash-lightwalletd", "dep:tonic", "dep:zebra-state"] +preinitialize-halo2 = [] [workspace] members = [ "cartezcash-lightwalletd", "tiny-cash", "tower-cartesi"] diff --git a/src/main.rs b/src/main.rs index d619d30..d48ea89 100644 --- a/src/main.rs +++ b/src/main.rs @@ -12,8 +12,6 @@ use tower_cartesi::{listen_http, Request as RollAppRequest, Response}; use futures_util::future::FutureExt; -use tiny_cash::parameters::Network; - #[cfg(feature = "lightwalletd")] use cartezcash_lightwalletd::{ proto::service::compact_tx_streamer_server::CompactTxStreamerServer, @@ -25,11 +23,6 @@ type StateService = Buffer< BoxService, zebra_state::Request, >; -#[cfg(feature = "lightwalletd")] -type StateReadService = Buffer< - BoxService, - zebra_state::ReadRequest, ->; mod service; @@ -43,8 +36,6 @@ async fn main() -> Result<(), anyhow::Error> { let server_addr = env::var("ROLLUP_HTTP_SERVER_URL")?; - let _network = Network::Mainnet; - println!( "Withdraw address is: {}", UnifiedAddress::from_receivers(Some(tiny_cash::mt_doom_address()), None) @@ -53,14 +44,17 @@ async fn main() -> Result<(), anyhow::Error> { ); // TODO: Enable this when not debugging - // tracing::info!("Initializing Halo2 verifier key"); - // tiny_cash::initialize_halo2(); - // tracing::info!("Initializing Halo2 verifier key complete"); + #[cfg(feature = "preinitialize-halo2")] + { + tracing::info!("Initializing Halo2 verifier key"); + tiny_cash::initialize_halo2(); + tracing::info!("Initializing Halo2 verifier key complete"); + } #[cfg(feature = "lightwalletd")] let (state_service, state_read_service, _, _) = zebra_state::init( zebra_state::Config::ephemeral(), - network, + tiny_cash::parameters::Network::Mainnet, tiny_cash::block::Height::MAX, 0, ); diff --git a/tiny-cash/src/test.rs b/tiny-cash/src/test.rs index d399eed..9b1d839 100644 --- a/tiny-cash/src/test.rs +++ b/tiny-cash/src/test.rs @@ -63,10 +63,14 @@ async fn test_mint_txns_update_balance() { // write a bunch of blocks for _ in 0..100 { - exeucte_and_commit_block(Request::Mint { - amount: Amount::try_from(1).unwrap(), - to: recipient.create_script_from_address(), - }, &mut tinycash, &mut state_service) + exeucte_and_commit_block( + Request::Mint { + amount: Amount::try_from(1).unwrap(), + to: recipient.create_script_from_address(), + }, + &mut tinycash, + &mut state_service, + ) .await .unwrap(); }