Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix tests part2 #1670

Open
wants to merge 27 commits into
base: dev_2-0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
9acc3cf
added sync status api
Oscar-Pepper Feb 19, 2025
5caf385
improve scan range json object and add sync start height to status
Oscar-Pepper Feb 19, 2025
3bf6144
fix spaces in json objects
Oscar-Pepper Feb 19, 2025
4bb92fe
add sync start to json
Oscar-Pepper Feb 19, 2025
d1faaba
print updates true for sync command
Oscar-Pepper Feb 20, 2025
e5a5ade
implemented sync modes for pausing
Oscar-Pepper Feb 20, 2025
b38508d
change to sync api where lightclient stores a sync handle to allow ba…
Oscar-Pepper Feb 22, 2025
87d0617
Merge branch 'dev_2-0' into sync_api
Oscar-Pepper Feb 22, 2025
f9b688a
implemented new sync command except sub-command
Oscar-Pepper Feb 22, 2025
10d5aa4
implemented sync poll sub command
Oscar-Pepper Feb 22, 2025
76ba04e
updating zingo cli to sync in background
Oscar-Pepper Feb 22, 2025
b717fa7
cleaned up and implemented rescan with correct error handling and no …
Oscar-Pepper Feb 24, 2025
300c0b8
remove print updates as it's not useful in tests and only used in zin…
Oscar-Pepper Feb 24, 2025
ad8c34d
fix scenarios
Oscar-Pepper Feb 24, 2025
8061a38
complete wallet tx debug impl
Oscar-Pepper Feb 24, 2025
c203a03
fixed some chain generic framework
Oscar-Pepper Feb 24, 2025
da65a1a
fixed lightclient send tests
Oscar-Pepper Feb 24, 2025
ec2e083
removed kruft and deprecations features
Oscar-Pepper Feb 24, 2025
8377c80
fixed all chain generic fixtures
Oscar-Pepper Feb 24, 2025
dce09cc
fixded darkside tests
Oscar-Pepper Feb 24, 2025
5ee99f2
cleanup more kruft
Oscar-Pepper Feb 24, 2025
f994b12
fixing more concrete tests
Oscar-Pepper Feb 25, 2025
2db4c11
fixing concrete tests cont.
Oscar-Pepper Feb 25, 2025
297c5f3
fix all remaining zingo2 fixmes or comment with reason why it should …
Oscar-Pepper Feb 25, 2025
b2c50bc
fix concrete test missed due to no FIXME
Oscar-Pepper Feb 26, 2025
f003174
fix wallet test error
Oscar-Pepper Feb 26, 2025
adbc0db
cargo fmt
Oscar-Pepper Feb 26, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions darkside-tests/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -724,13 +724,13 @@ pub mod scenarios {
pub fn get_regtest_network(&self) -> &RegtestNetwork {
&self.regtest_network
}
pub fn get_faucet(&self) -> &LightClient {
pub fn get_faucet(&mut self) -> &mut LightClient {
self.faucet
.as_ref()
.as_mut()
.expect("scenario should have a faucet lightclient")
}
pub fn get_lightclient(&self, lightclient_index: u64) -> &LightClient {
&self.lightclients[lightclient_index as usize]
pub fn get_lightclient(&mut self, lightclient_index: u64) -> &mut LightClient {
&mut self.lightclients[lightclient_index as usize]
}
pub fn get_staged_blockheight(&self) -> &BlockHeight {
&self.staged_blockheight
Expand Down
142 changes: 74 additions & 68 deletions darkside-tests/tests/advanced_reorg_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,17 @@ async fn reorg_changes_incoming_tx_height() {
.await
.unwrap();

let light_client = ClientBuilder::new(server_id.clone(), darkside_handler.darkside_dir.clone())
.build_client(
ADVANCED_REORG_TESTS_USER_WALLET.to_string(),
202,
true,
RegtestNetwork::all_upgrades_active(),
)
.await;

light_client.do_sync(true).await.unwrap();
let mut light_client =
ClientBuilder::new(server_id.clone(), darkside_handler.darkside_dir.clone())
.build_client(
ADVANCED_REORG_TESTS_USER_WALLET.to_string(),
202,
true,
RegtestNetwork::all_upgrades_active(),
)
.await;

light_client.sync_and_await().await.unwrap();
assert_eq!(
light_client.do_balance().await,
PoolBalances {
Expand Down Expand Up @@ -71,7 +72,7 @@ async fn reorg_changes_incoming_tx_height() {
.await
.unwrap();

let reorg_sync_result = light_client.do_sync(true).await;
let reorg_sync_result = light_client.sync_and_await().await;

match reorg_sync_result {
Ok(value) => println!("{}", value),
Expand Down Expand Up @@ -190,16 +191,17 @@ async fn reorg_changes_incoming_tx_index() {
.await
.unwrap();

let light_client = ClientBuilder::new(server_id.clone(), darkside_handler.darkside_dir.clone())
.build_client(
ADVANCED_REORG_TESTS_USER_WALLET.to_string(),
202,
true,
RegtestNetwork::all_upgrades_active(),
)
.await;

light_client.do_sync(true).await.unwrap();
let mut light_client =
ClientBuilder::new(server_id.clone(), darkside_handler.darkside_dir.clone())
.build_client(
ADVANCED_REORG_TESTS_USER_WALLET.to_string(),
202,
true,
RegtestNetwork::all_upgrades_active(),
)
.await;

light_client.sync_and_await().await.unwrap();
assert_eq!(
light_client.do_balance().await,
PoolBalances {
Expand Down Expand Up @@ -227,7 +229,7 @@ async fn reorg_changes_incoming_tx_index() {
.await
.unwrap();

let reorg_sync_result = light_client.do_sync(true).await;
let reorg_sync_result = light_client.sync_and_await().await;

match reorg_sync_result {
Ok(value) => println!("{}", value),
Expand Down Expand Up @@ -345,16 +347,17 @@ async fn reorg_expires_incoming_tx() {
.await
.unwrap();

let light_client = ClientBuilder::new(server_id.clone(), darkside_handler.darkside_dir.clone())
.build_client(
ADVANCED_REORG_TESTS_USER_WALLET.to_string(),
202,
true,
RegtestNetwork::all_upgrades_active(),
)
.await;

light_client.do_sync(true).await.unwrap();
let mut light_client =
ClientBuilder::new(server_id.clone(), darkside_handler.darkside_dir.clone())
.build_client(
ADVANCED_REORG_TESTS_USER_WALLET.to_string(),
202,
true,
RegtestNetwork::all_upgrades_active(),
)
.await;

light_client.sync_and_await().await.unwrap();
assert_eq!(
light_client.do_balance().await,
PoolBalances {
Expand Down Expand Up @@ -382,7 +385,7 @@ async fn reorg_expires_incoming_tx() {
.await
.unwrap();

let reorg_sync_result = light_client.do_sync(true).await;
let reorg_sync_result = light_client.sync_and_await().await;

match reorg_sync_result {
Ok(value) => println!("{}", value),
Expand Down Expand Up @@ -523,16 +526,17 @@ async fn reorg_changes_outgoing_tx_height() {
.await
.unwrap();

let light_client = ClientBuilder::new(server_id.clone(), darkside_handler.darkside_dir.clone())
.build_client(
ADVANCED_REORG_TESTS_USER_WALLET.to_string(),
202,
true,
RegtestNetwork::all_upgrades_active(),
)
.await;

light_client.do_sync(true).await.unwrap();
let mut light_client =
ClientBuilder::new(server_id.clone(), darkside_handler.darkside_dir.clone())
.build_client(
ADVANCED_REORG_TESTS_USER_WALLET.to_string(),
202,
true,
RegtestNetwork::all_upgrades_active(),
)
.await;

light_client.sync_and_await().await.unwrap();
assert_eq!(
light_client.do_balance().await,
PoolBalances {
Expand Down Expand Up @@ -579,7 +583,7 @@ async fn reorg_changes_outgoing_tx_height() {
let sent_tx_height: i32 = 205;
_ = connector.apply_staged(sent_tx_height).await;

light_client.do_sync(true).await.unwrap();
light_client.sync_and_await().await.unwrap();

let expected_after_send_balance = PoolBalances {
sapling_balance: Some(0),
Expand Down Expand Up @@ -637,7 +641,7 @@ async fn reorg_changes_outgoing_tx_height() {

_ = connector.apply_staged(211).await;

let reorg_sync_result = light_client.do_sync(true).await;
let reorg_sync_result = light_client.sync_and_await().await;

match reorg_sync_result {
Ok(value) => println!("{}", value),
Expand Down Expand Up @@ -763,14 +767,15 @@ async fn reorg_expires_outgoing_tx_height() {
.await
.unwrap();

let light_client = ClientBuilder::new(server_id.clone(), darkside_handler.darkside_dir.clone())
.build_client(
ADVANCED_REORG_TESTS_USER_WALLET.to_string(),
202,
true,
RegtestNetwork::all_upgrades_active(),
)
.await;
let mut light_client =
ClientBuilder::new(server_id.clone(), darkside_handler.darkside_dir.clone())
.build_client(
ADVANCED_REORG_TESTS_USER_WALLET.to_string(),
202,
true,
RegtestNetwork::all_upgrades_active(),
)
.await;

let expected_initial_balance = PoolBalances {
sapling_balance: Some(0),
Expand All @@ -784,7 +789,7 @@ async fn reorg_expires_outgoing_tx_height() {
transparent_balance: Some(0),
};

light_client.do_sync(true).await.unwrap();
light_client.sync_and_await().await.unwrap();
assert_eq!(light_client.do_balance().await, expected_initial_balance);

let before_reorg_transactions = light_client.sorted_value_transfers(true).await;
Expand All @@ -811,7 +816,7 @@ async fn reorg_expires_outgoing_tx_height() {
let sent_tx_height: i32 = 205;
_ = connector.apply_staged(sent_tx_height).await;

light_client.do_sync(true).await.unwrap();
light_client.sync_and_await().await.unwrap();

let expected_after_send_balance = PoolBalances {
sapling_balance: Some(0),
Expand Down Expand Up @@ -862,7 +867,7 @@ async fn reorg_expires_outgoing_tx_height() {
// this will remove the submitted transaction from our view of the blockchain
_ = connector.apply_staged(245).await;

let reorg_sync_result = light_client.do_sync(true).await;
let reorg_sync_result = light_client.sync_and_await().await;

match reorg_sync_result {
Ok(value) => println!("{}", value),
Expand Down Expand Up @@ -940,16 +945,17 @@ async fn reorg_changes_outgoing_tx_index() {
.await
.unwrap();

let light_client = ClientBuilder::new(server_id.clone(), darkside_handler.darkside_dir.clone())
.build_client(
ADVANCED_REORG_TESTS_USER_WALLET.to_string(),
202,
true,
RegtestNetwork::all_upgrades_active(),
)
.await;

light_client.do_sync(true).await.unwrap();
let mut light_client =
ClientBuilder::new(server_id.clone(), darkside_handler.darkside_dir.clone())
.build_client(
ADVANCED_REORG_TESTS_USER_WALLET.to_string(),
202,
true,
RegtestNetwork::all_upgrades_active(),
)
.await;

light_client.sync_and_await().await.unwrap();
assert_eq!(
light_client.do_balance().await,
PoolBalances {
Expand Down Expand Up @@ -996,7 +1002,7 @@ async fn reorg_changes_outgoing_tx_index() {
let sent_tx_height: i32 = 205;
_ = connector.apply_staged(sent_tx_height).await;

light_client.do_sync(true).await.unwrap();
light_client.sync_and_await().await.unwrap();

let expected_after_send_balance = PoolBalances {
sapling_balance: Some(0),
Expand Down Expand Up @@ -1063,7 +1069,7 @@ async fn reorg_changes_outgoing_tx_index() {

_ = connector.apply_staged(312).await;

let reorg_sync_result = light_client.do_sync(true).await;
let reorg_sync_result = light_client.sync_and_await().await;

match reorg_sync_result {
Ok(value) => println!("{}", value),
Expand Down
Loading
Loading