Skip to content

Commit

Permalink
web is failing because its acquireing lock on mainthread
Browse files Browse the repository at this point in the history
  • Loading branch information
ec2 committed Sep 17, 2024
1 parent eda1f88 commit c1fc177
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 7 deletions.
4 changes: 4 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ test-message-board-web:
test-simple-web:
WASM_BINDGEN_TEST_TIMEOUT=99999 wasm-pack test --release --firefox --no-default-features --features="wasm" -Z build-std="panic_abort,std" --test simple-sync-and-send

test-batchrunner-web:
WASM_BINDGEN_TEST_TIMEOUT=99999 wasm-pack test --release --firefox --no-default-features --features="wasm" -Z build-std="panic_abort,std" --test batchrunner



## Native Examples
example-simple:
Expand Down
2 changes: 1 addition & 1 deletion tests/batchrunner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ pub fn initialize() {
}

#[wasm_bindgen_test]
async fn test_get_and_scan_range() {
async fn batchrunner() {
initialize();

let mut w = WebWallet::new("test", "https://zcash-testnet.chainsafe.dev", 1).unwrap();
Expand Down
27 changes: 21 additions & 6 deletions tests/message-board-sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ use wasm_bindgen_test::*;
wasm_bindgen_test::wasm_bindgen_test_configure!(run_in_browser);

use std::sync::Once;
use zcash_client_backend::sync::run;
use zcash_client_memory::MemBlockCache;
use webz_core::bindgen::wallet::WebWallet;
use zcash_keys::keys::UnifiedFullViewingKey;
use zcash_primitives::consensus::Network;
Expand Down Expand Up @@ -33,14 +35,27 @@ async fn test_message_board() {
let id = w.import_ufvk(&ufvk_str, Some(2477329)).await.unwrap();
tracing::info!("Created account with id: {}", id);

tracing::info!("Syncing wallet");
w.sync(&js_sys::Function::new_with_args(
"scanned_to, tip",
"console.log('Scanned: ', scanned_to, '/', tip)",
))
// tracing::info!("Syncing wallet");
// w.sync(&js_sys::Function::new_with_args(
// "scanned_to, tip",
// "console.log('Scanned: ', scanned_to, '/', tip)",
// ))
// .await
// .unwrap();
// tracing::info!("Syncing complete :)");

let db_cache = MemBlockCache::new();
let mut cpt_client = w.client().clone();

run(
&mut cpt_client,
&Network::TestNetwork,
&db_cache,
w.inner_mut().inner_mut(),
10000,
)
.await
.unwrap();
tracing::info!("Syncing complete :)");

let summary = w.get_wallet_summary().unwrap();
tracing::info!("Wallet summary: {:?}", summary);
Expand Down

0 comments on commit c1fc177

Please sign in to comment.