Skip to content

Commit

Permalink
tidy main
Browse files Browse the repository at this point in the history
  • Loading branch information
willemolding committed Apr 12, 2024
1 parent a46673d commit 6b0bd21
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 17 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down
20 changes: 7 additions & 13 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -25,11 +23,6 @@ type StateService = Buffer<
BoxService<zebra_state::Request, zebra_state::Response, zebra_state::BoxError>,
zebra_state::Request,
>;
#[cfg(feature = "lightwalletd")]
type StateReadService = Buffer<
BoxService<zebra_state::ReadRequest, zebra_state::ReadResponse, zebra_state::BoxError>,
zebra_state::ReadRequest,
>;

mod service;

Expand All @@ -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)
Expand All @@ -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,
);
Expand Down
12 changes: 8 additions & 4 deletions tiny-cash/src/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down

0 comments on commit 6b0bd21

Please sign in to comment.