Skip to content

Commit cc938b1

Browse files
committed
WIP
1 parent bfedfb4 commit cc938b1

File tree

37 files changed

+915
-491
lines changed

37 files changed

+915
-491
lines changed

src/vit-testing/integration-tests/src/common/mainnet_wallet_ext.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::common::MainnetWallet;
1+
use crate::common::CardanoWallet;
22
use snapshot_lib::VoterHIR;
33
use vitup::config::Block0Initial;
44

@@ -7,7 +7,7 @@ pub trait MainnetWalletExtension {
77
fn as_voter_hir(&self, group: &str) -> VoterHIR;
88
}
99

10-
impl MainnetWalletExtension for MainnetWallet {
10+
impl MainnetWalletExtension for CardanoWallet {
1111
fn as_initial_entry(&self) -> Block0Initial {
1212
Block0Initial::External {
1313
address: self.catalyst_address().to_string(),

src/vit-testing/integration-tests/src/common/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ mod wallet;
1212
pub use reps::{empty_assigner, RepsVoterAssignerSource};
1313

1414
pub use assert::*;
15-
pub use mainnet_lib::MainnetWallet;
15+
pub use mainnet_lib::CardanoWallet;
1616
pub use rewards::{funded_proposals, VotesRegistry};
1717
pub use snapshot_filter::SnapshotFilter;
1818
pub use static_data::SnapshotExtensions;

src/vit-testing/integration-tests/src/common/snapshot/mock.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
use crate::common::get_available_port;
22
use crate::common::snapshot::SnapshotServiceStarter;
33
use assert_fs::TempDir;
4-
use mainnet_lib::InMemoryDbSync;
4+
use mainnet_lib::{JsonBasedBdSyncError, JsonBasedDbSync};
55
use snapshot_trigger_service::client::SnapshotResult;
66
use snapshot_trigger_service::config::{
77
ConfigurationBuilder, JobParameters, NetworkType, VotingToolsParams,
88
};
99

1010
pub fn do_snapshot(
11-
db_sync_instance: &InMemoryDbSync,
11+
db_sync_instance: &JsonBasedDbSync,
1212
job_parameters: JobParameters,
1313
testing_directory: &TempDir,
1414
) -> Result<SnapshotResult, Error> {
@@ -44,7 +44,7 @@ pub fn do_snapshot(
4444
#[derive(thiserror::Error, Debug)]
4545
pub enum Error {
4646
#[error(transparent)]
47-
DbSync(#[from] mainnet_lib::InMemoryDbSyncError),
47+
DbSync(#[from] JsonBasedBdSyncError),
4848
#[error(transparent)]
4949
SnapshotIntegration(#[from] crate::common::snapshot::Error),
5050
#[error(transparent)]

src/vit-testing/integration-tests/src/common/wallet.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
use crate::common::MainnetWallet;
1+
use crate::common::CardanoWallet;
22
use std::path::Path;
33
use vitup::mode::standard::WalletProxyController;
44

55
pub fn iapyx_from_mainnet(
6-
wallet: &MainnetWallet,
6+
wallet: &CardanoWallet,
77
proxy: &WalletProxyController,
88
) -> Result<iapyx::Controller, iapyx::ControllerBuilderError> {
99
iapyx::ControllerBuilder::default()

src/vit-testing/integration-tests/src/component/backend/cip_36_support.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use crate::common::RepsVoterAssignerSource;
44
use assert_fs::TempDir;
55
use chain_addr::Discrimination;
66
use fraction::Fraction;
7-
use mainnet_lib::MainnetWallet;
7+
use mainnet_lib::CardanoWallet;
88
use mainnet_lib::{MainnetNetworkBuilder, MainnetWalletStateBuilder};
99
use snapshot_trigger_service::config::JobParameters;
1010
use vit_servicing_station_tests::common::data::ArbitraryValidVotingTemplateGenerator;
@@ -25,17 +25,17 @@ pub fn cip_36_support() {
2525
tag: tag.clone(),
2626
};
2727

28-
let alice = MainnetWallet::new(1_000);
29-
let bob = MainnetWallet::new(1_000);
30-
let clarice = MainnetWallet::new(1_000);
31-
let dave = MainnetWallet::new(1_000);
28+
let alice = CardanoWallet::new(1_000);
29+
let bob = CardanoWallet::new(1_000);
30+
let clarice = CardanoWallet::new(1_000);
31+
let dave = CardanoWallet::new(1_000);
3232

33-
let (db_sync, reps) = MainnetNetworkBuilder::default()
33+
let (db_sync, _node, reps) = MainnetNetworkBuilder::default()
3434
.with(alice.as_direct_voter())
3535
.with(bob.as_representative())
3636
.with(clarice.as_representative())
3737
.with(dave.as_delegator(vec![(&bob, 1u8), (&clarice, 1u8)]))
38-
.build(&testing_directory);
38+
.as_json(&testing_directory);
3939

4040
let snapshot_result = mock::do_snapshot(&db_sync, job_param, &testing_directory).unwrap();
4141

src/vit-testing/integration-tests/src/component/snapshot/local.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use crate::common::mainnet_wallet_ext::MainnetWalletExtension;
22
use crate::common::snapshot::mock;
33
use crate::common::snapshot_filter::SnapshotFilterSource;
4-
use crate::common::MainnetWallet;
4+
use crate::common::CardanoWallet;
55
use assert_fs::TempDir;
66
use mainnet_lib::{MainnetNetworkBuilder, MainnetWalletStateBuilder};
77
use snapshot_lib::VoterHIR;
@@ -13,22 +13,22 @@ pub fn mixed_registration_transactions() {
1313
let testing_directory = TempDir::new().unwrap().into_persistent();
1414
let stake = 10_000;
1515

16-
let alice = MainnetWallet::new(stake);
17-
let bob = MainnetWallet::new(stake);
18-
let clarice = MainnetWallet::new(stake);
16+
let alice = CardanoWallet::new(stake);
17+
let bob = CardanoWallet::new(stake);
18+
let clarice = CardanoWallet::new(stake);
1919

20-
let david = MainnetWallet::new(500);
21-
let edgar = MainnetWallet::new(1_000);
22-
let fred = MainnetWallet::new(8_000);
20+
let david = CardanoWallet::new(500);
21+
let edgar = CardanoWallet::new(1_000);
22+
let fred = CardanoWallet::new(8_000);
2323

24-
let (db_sync, reps) = MainnetNetworkBuilder::default()
24+
let (db_sync, _node, reps) = MainnetNetworkBuilder::default()
2525
.with(alice.as_direct_voter())
2626
.with(bob.as_delegator(vec![(&david, 1)]))
2727
.with(clarice.as_delegator(vec![(&david, 1), (&edgar, 1)]))
2828
.with(david.as_representative())
2929
.with(edgar.as_representative())
3030
.with(fred.as_representative())
31-
.build(&testing_directory);
31+
.as_json(&testing_directory);
3232

3333
let voters_hir = mock::do_snapshot(&db_sync, JobParameters::fund("fund9"), &testing_directory)
3434
.unwrap()

src/vit-testing/integration-tests/src/e2e/local/active_voters_rewards.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use crate::common::iapyx_from_mainnet;
55
use crate::common::mainnet_wallet_ext::MainnetWalletExtension;
66
use crate::common::snapshot::mock;
77
use crate::common::snapshot_filter::SnapshotFilterSource;
8-
use crate::common::MainnetWallet;
8+
use crate::common::CardanoWallet;
99
use assert_fs::TempDir;
1010
use catalyst_toolbox::rewards::voters::calc_voter_rewards;
1111
use catalyst_toolbox::rewards::Threshold;
@@ -27,15 +27,15 @@ pub fn voters_with_at_least_one_vote() {
2727

2828
let stake = 10_000;
2929

30-
let alice_wallet = MainnetWallet::new(stake);
31-
let bob_wallet = MainnetWallet::new(stake);
32-
let clarice_wallet = MainnetWallet::new(stake);
30+
let alice_wallet = CardanoWallet::new(stake);
31+
let bob_wallet = CardanoWallet::new(stake);
32+
let clarice_wallet = CardanoWallet::new(stake);
3333

34-
let (db_sync, _) = MainnetNetworkBuilder::default()
34+
let (db_sync, _node, _reps) = MainnetNetworkBuilder::default()
3535
.with(alice_wallet.as_direct_voter())
3636
.with(bob_wallet.as_direct_voter())
3737
.with(clarice_wallet.as_direct_voter())
38-
.build(&testing_directory);
38+
.as_json(&testing_directory);
3939

4040
let snapshot = mock::do_snapshot(&db_sync, JobParameters::fund("fund9"), &testing_directory)
4141
.unwrap()

src/vit-testing/integration-tests/src/integration/from_snapshot_to_catalyst_toolbox.rs

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use crate::common::snapshot::mock;
22
use crate::common::snapshot_filter::SnapshotFilterSource;
3-
use crate::common::{MainnetWallet, RepsVoterAssignerSource};
3+
use crate::common::{CardanoWallet, RepsVoterAssignerSource};
44
use assert_fs::TempDir;
55
use fraction::Fraction;
66
use mainnet_lib::{MainnetNetworkBuilder, MainnetWalletStateBuilder};
@@ -14,19 +14,19 @@ pub fn cip36_mixed_delegation() {
1414

1515
let stake = 10_000;
1616

17-
let alice = MainnetWallet::new(stake);
18-
let bob = MainnetWallet::new(stake);
19-
let clarice = MainnetWallet::new(stake);
17+
let alice = CardanoWallet::new(stake);
18+
let bob = CardanoWallet::new(stake);
19+
let clarice = CardanoWallet::new(stake);
2020

21-
let david = MainnetWallet::new(0);
22-
let edgar = MainnetWallet::new(0);
23-
let fred = MainnetWallet::new(0);
21+
let david = CardanoWallet::new(0);
22+
let edgar = CardanoWallet::new(0);
23+
let fred = CardanoWallet::new(0);
2424

25-
let (db_sync, reps) = MainnetNetworkBuilder::default()
25+
let (db_sync, _node, reps) = MainnetNetworkBuilder::default()
2626
.with(alice.as_direct_voter())
2727
.with(bob.as_delegator(vec![(&david, 1)]))
2828
.with(clarice.as_delegator(vec![(&david, 1), (&edgar, 1)]))
29-
.build(&testing_directory);
29+
.as_json(&testing_directory);
3030

3131
let voter_hir = mock::do_snapshot(&db_sync, JobParameters::fund("fund9"), &testing_directory)
3232
.unwrap()
@@ -62,19 +62,19 @@ pub fn cip36_mixed_delegation() {
6262
pub fn voting_power_cap_for_reps() {
6363
let testing_directory = TempDir::new().unwrap().into_persistent();
6464

65-
let alice = MainnetWallet::new(1_000);
66-
let bob = MainnetWallet::new(1_000);
67-
let clarice = MainnetWallet::new(10_000);
65+
let alice = CardanoWallet::new(1_000);
66+
let bob = CardanoWallet::new(1_000);
67+
let clarice = CardanoWallet::new(10_000);
6868

69-
let david = MainnetWallet::new(0);
70-
let edgar = MainnetWallet::new(0);
71-
let fred = MainnetWallet::new(0);
69+
let david = CardanoWallet::new(0);
70+
let edgar = CardanoWallet::new(0);
71+
let fred = CardanoWallet::new(0);
7272

73-
let (db_sync, reps) = MainnetNetworkBuilder::default()
73+
let (db_sync, _node, reps) = MainnetNetworkBuilder::default()
7474
.with(alice.as_delegator(vec![(&david, 1)]))
7575
.with(bob.as_delegator(vec![(&edgar, 1)]))
7676
.with(clarice.as_delegator(vec![(&fred, 1)]))
77-
.build(&testing_directory);
77+
.as_json(&testing_directory);
7878

7979
let reps_circle_size = reps.len();
8080

@@ -98,15 +98,15 @@ pub fn voting_power_cap_for_reps() {
9898
pub fn voting_power_cap_for_direct() {
9999
let testing_directory = TempDir::new().unwrap().into_persistent();
100100

101-
let alice = MainnetWallet::new(10_000);
102-
let bob = MainnetWallet::new(10_000);
103-
let clarice = MainnetWallet::new(1_000);
101+
let alice = CardanoWallet::new(10_000);
102+
let bob = CardanoWallet::new(10_000);
103+
let clarice = CardanoWallet::new(1_000);
104104

105-
let (db_sync, reps) = MainnetNetworkBuilder::default()
105+
let (db_sync, _node, reps) = MainnetNetworkBuilder::default()
106106
.with(alice.as_direct_voter())
107107
.with(bob.as_direct_voter())
108108
.with(clarice.as_direct_voter())
109-
.build(&testing_directory);
109+
.as_json(&testing_directory);
110110

111111
let voter_hir = mock::do_snapshot(&db_sync, JobParameters::fund("fund9"), &testing_directory)
112112
.unwrap()
@@ -128,17 +128,17 @@ pub fn voting_power_cap_for_direct() {
128128
pub fn voting_power_cap_for_mix() {
129129
let testing_directory = TempDir::new().unwrap().into_persistent();
130130

131-
let alice = MainnetWallet::new(10_000);
132-
let bob = MainnetWallet::new(1_000);
133-
let clarice = MainnetWallet::new(10_000);
131+
let alice = CardanoWallet::new(10_000);
132+
let bob = CardanoWallet::new(1_000);
133+
let clarice = CardanoWallet::new(10_000);
134134

135-
let david = MainnetWallet::new(0);
135+
let david = CardanoWallet::new(0);
136136

137-
let (db_sync, reps) = MainnetNetworkBuilder::default()
137+
let (db_sync, _node, reps) = MainnetNetworkBuilder::default()
138138
.with(alice.as_direct_voter())
139139
.with(bob.as_direct_voter())
140140
.with(clarice.as_delegator(vec![(&david, 1)]))
141-
.build(&testing_directory);
141+
.as_json(&testing_directory);
142142

143143
let voter_hir = mock::do_snapshot(&db_sync, JobParameters::fund("fund9"), &testing_directory)
144144
.unwrap()

src/vit-testing/integration-tests/src/integration/from_snapshot_to_merge.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use crate::common::iapyx_from_mainnet;
22
use crate::common::snapshot::mock;
33
use crate::common::snapshot_filter::SnapshotFilterSource;
4-
use crate::common::MainnetWallet;
4+
use crate::common::CardanoWallet;
55
use assert_fs::fixture::PathChild;
66
use assert_fs::TempDir;
77
use chain_impl_mockchain::block::BlockDate;
@@ -26,19 +26,19 @@ pub fn cip36_and_voting_group_merge() {
2626
let stake = 10_000;
2727
let yes_vote = chain_impl_mockchain::vote::Choice::new(0);
2828

29-
let alice = MainnetWallet::new(stake);
30-
let bob = MainnetWallet::new(stake);
31-
let clarice = MainnetWallet::new(stake);
29+
let alice = CardanoWallet::new(stake);
30+
let bob = CardanoWallet::new(stake);
31+
let clarice = CardanoWallet::new(stake);
3232

33-
let david = MainnetWallet::new(500);
34-
let edgar = MainnetWallet::new(1_000);
35-
let _fred = MainnetWallet::new(8_000);
33+
let david = CardanoWallet::new(500);
34+
let edgar = CardanoWallet::new(1_000);
35+
let _fred = CardanoWallet::new(8_000);
3636

37-
let (db_sync, reps) = MainnetNetworkBuilder::default()
37+
let (db_sync, _node, reps) = MainnetNetworkBuilder::default()
3838
.with(alice.as_direct_voter())
3939
.with(bob.as_delegator(vec![(&david, 1)]))
4040
.with(clarice.as_delegator(vec![(&david, 1), (&edgar, 1)]))
41-
.build(&testing_directory);
41+
.as_json(&testing_directory);
4242

4343
let voter_hir = mock::do_snapshot(&db_sync, JobParameters::fund("fund9"), &testing_directory)
4444
.unwrap()

src/vit-testing/integration-tests/src/integration/from_snapshot_to_vit_servicing_station.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use crate::common::mainnet_wallet_ext::MainnetWalletExtension;
22
use crate::common::snapshot::mock;
3-
use crate::common::MainnetWallet;
3+
use crate::common::CardanoWallet;
44
use assert_fs::TempDir;
55
use mainnet_lib::{MainnetNetworkBuilder, MainnetWalletStateBuilder};
66
use snapshot_lib::SnapshotInfo;
@@ -17,15 +17,15 @@ use vitup::testing::vitup_setup;
1717
pub fn put_raw_snapshot() {
1818
let testing_directory = TempDir::new().unwrap().into_persistent();
1919
let stake = 10_000;
20-
let alice_wallet = MainnetWallet::new(stake);
21-
let bob_wallet = MainnetWallet::new(stake);
22-
let clarice_wallet = MainnetWallet::new(stake);
20+
let alice_wallet = CardanoWallet::new(stake);
21+
let bob_wallet = CardanoWallet::new(stake);
22+
let clarice_wallet = CardanoWallet::new(stake);
2323

24-
let (db_sync, _reps) = MainnetNetworkBuilder::default()
24+
let (db_sync, _node, _reps) = MainnetNetworkBuilder::default()
2525
.with(alice_wallet.as_direct_voter())
2626
.with(bob_wallet.as_direct_voter())
2727
.with(clarice_wallet.as_direct_voter())
28-
.build(&testing_directory);
28+
.as_json(&testing_directory);
2929

3030
let job_params = JobParameters::fund("fund9");
3131
let snapshot_result =

0 commit comments

Comments
 (0)