-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
195 additions
and
207 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,161 +1,172 @@ | ||
use super::super::LightWallet; | ||
|
||
/// as opposed to [LegacyWalletCase], which enumerates test cases compiled from the history of zingo wallt tests, this ExampleWalletNetworkCase is meant to fully organize the set of test cases. | ||
/// ExampleWalletNetworkCase sorts first by Network, then seed, then last saved version. | ||
/// It is public so that any consumer can select and load any example wallet. | ||
#[non_exhaustive] | ||
#[derive(Clone)] | ||
pub enum ExampleWalletNetworkCase { | ||
pub enum ExampleWalletNetwork { | ||
/// / | ||
Mainnet(ExampleMainnetWalletSeedCase), | ||
Regtest(ExampleRegtestWalletSeed), | ||
/// / | ||
Testnet(ExampleTestnetWalletSeedCase), | ||
Testnet(ExampleTestnetWalletSeed), | ||
/// / | ||
Regtest(ExampleRegtestWalletSeedCase), | ||
Mainnet(ExampleMainnetWalletSeed), | ||
} | ||
|
||
/// / | ||
#[non_exhaustive] | ||
#[derive(Clone)] | ||
pub enum ExampleMainnetWalletSeedCase { | ||
/// this is a mainnet seed | ||
VTFCORFBCBPCTCFUPMEGMWBP(ExampleVTFCORFBCBPCTCFUPMEGMWBPWalletVersionCase), | ||
pub enum ExampleMainnetWalletSeed { | ||
/// this is a mainnet wallet originally called missing_data_test | ||
VTFCORFBCBPCTCFUPMEGMWBP(ExampleVTFCORFBCBPCTCFUPMEGMWBPWalletVersion), | ||
} | ||
/// / | ||
#[non_exhaustive] | ||
#[derive(Clone)] | ||
pub enum ExampleVTFCORFBCBPCTCFUPMEGMWBPWalletVersionCase { | ||
pub enum ExampleVTFCORFBCBPCTCFUPMEGMWBPWalletVersion { | ||
/// wallet was last saved in this serialization version | ||
V28, | ||
} | ||
/// / | ||
#[non_exhaustive] | ||
#[derive(Clone)] | ||
pub enum ExampleTestnetWalletSeedCase { | ||
/// This is a testnet seed. | ||
MSKMGDBHOTBPETCJWCSPGOPP(ExampleMSKMGDBHOTBPETCJWCSPGOPPWalletVersionCase), | ||
pub enum ExampleTestnetWalletSeed { | ||
/// This is a testnet seed, generated by fluidvanadium at the beginning of owls (this example wallet enumeration) | ||
MSKMGDBHOTBPETCJWCSPGOPP(ExampleMSKMGDBHOTBPETCJWCSPGOPPWalletVersion), | ||
/// this testnet wallet was generated at the beginning of serialization v28 by fluidvanadium | ||
CBBHRWIILGBRABABSSHSMTPR(ExampleCBBHRWIILGBRABABSSHSMTPRWalletVersion), | ||
} | ||
/// / | ||
#[non_exhaustive] | ||
#[derive(Clone)] | ||
pub enum ExampleMSKMGDBHOTBPETCJWCSPGOPPWalletVersionCase { | ||
pub enum ExampleMSKMGDBHOTBPETCJWCSPGOPPWalletVersion { | ||
/// wallet was last saved by the code in this commit | ||
Gab72a38b, | ||
} | ||
/// A testnet wallet initiated with | ||
/// --seed "chimney better bulb horror rebuild whisper improve intact letter giraffe brave rib appear bulk aim burst snap salt hill sad merge tennis phrase raise" | ||
/// with 3 addresses containing all receivers. | ||
/// including orchard and sapling transactions | ||
#[non_exhaustive] | ||
#[derive(Clone)] | ||
pub enum ExampleCBBHRWIILGBRABABSSHSMTPRWalletVersion { | ||
/// wallet was last saved in this serialization version | ||
V26, | ||
/// wallet was last saved in this serialization version | ||
V27, | ||
/// wallet was last saved in this serialization version | ||
V28, | ||
} | ||
/// / | ||
#[non_exhaustive] | ||
#[derive(Clone)] | ||
pub enum ExampleRegtestWalletSeedCase {} | ||
|
||
/// loads test wallets | ||
impl LightWallet { | ||
/// loads any one of the test wallets included in the examples | ||
pub async fn load_example_wallet(case: ExampleWalletNetworkCase) -> Self { | ||
match case { | ||
ExampleWalletNetworkCase::Mainnet( | ||
ExampleMainnetWalletSeedCase::VTFCORFBCBPCTCFUPMEGMWBP( | ||
ExampleVTFCORFBCBPCTCFUPMEGMWBPWalletVersionCase::V28, | ||
), | ||
) => { | ||
LightWallet::unsafe_from_buffer_mainnet(include_bytes!( | ||
"examples/mainnet/vtfcorfbcbpctcfupmegmwbp/v28/zingo-wallet.dat" | ||
)) | ||
.await | ||
} | ||
ExampleWalletNetworkCase::Testnet( | ||
ExampleTestnetWalletSeedCase::MSKMGDBHOTBPETCJWCSPGOPP( | ||
ExampleMSKMGDBHOTBPETCJWCSPGOPPWalletVersionCase::Gab72a38b, | ||
), | ||
) => { | ||
LightWallet::unsafe_from_buffer_testnet(include_bytes!( | ||
"examples/testnet/mskmgdbhotbpetcjwcspgopp/Gab72a38b/zingo-wallet.dat" | ||
)) | ||
.await | ||
} | ||
_ => unimplemented!(), | ||
} | ||
} | ||
pub enum ExampleRegtestWalletSeed { | ||
/// this is a regtest wallet originally called old_wallet_reorg_test_wallet | ||
HMVASMUVWMSSVICHCARBPOCT(ExampleHMVASMUVWMSSVICHCARBPOCTWalletVersion), | ||
/// this is a regtest wallet originally called v26/sap_only | ||
AAAAAAAAAAAAAAAAAAAAAAAA(ExampleAAAAAAAAAAAAAAAAAAAAAAAAWalletVersion), | ||
} | ||
|
||
/// i do not know the difference between these wallets but i will find out soon | ||
/// what can these files do? | ||
/// / | ||
#[non_exhaustive] | ||
#[derive(Clone)] | ||
pub enum LegacyWalletCaseZingoV26 { | ||
/// / | ||
One, | ||
/// / | ||
Two, | ||
/// regtest sap only wallet | ||
RegtestSapOnly, | ||
pub enum ExampleHMVASMUVWMSSVICHCARBPOCTWalletVersion { | ||
/// wallet was last saved in this serialization version | ||
V27, | ||
} | ||
/// an enumeration of cases to test | ||
/// / | ||
#[non_exhaustive] | ||
#[derive(Clone)] | ||
pub enum LegacyWalletCase { | ||
/// at this version, legacy testing began | ||
ZingoV26(LegacyWalletCaseZingoV26), | ||
/// ? | ||
ZingoV28, | ||
/// ... | ||
OldWalletReorgTestWallet, | ||
pub enum ExampleAAAAAAAAAAAAAAAAAAAAAAAAWalletVersion { | ||
/// wallet was last saved in this serialization version | ||
V26, | ||
} | ||
|
||
/// loads test wallets | ||
impl LightWallet { | ||
/// loads test wallets | ||
/// this function can be improved by a macro. even better would be to derive directly from the enum. | ||
// this file is fuc | ||
/// loads any one of the test wallets included in the examples | ||
pub async fn load_example_wallet_legacy(case: LegacyWalletCase) -> Self { | ||
pub async fn load_example_wallet(case: ExampleWalletNetwork) -> Self { | ||
match case { | ||
LegacyWalletCase::ZingoV26(LegacyWalletCaseZingoV26::One) => { | ||
ExampleWalletNetwork::Regtest(ExampleRegtestWalletSeed::HMVASMUVWMSSVICHCARBPOCT( | ||
ExampleHMVASMUVWMSSVICHCARBPOCTWalletVersion::V27, | ||
)) => { | ||
LightWallet::unsafe_from_buffer_regtest(include_bytes!( | ||
"examples/regtest/hmvasmuvwmssvichcarbpoct/v27/zingo-wallet.dat" | ||
)) | ||
.await | ||
} | ||
ExampleWalletNetwork::Regtest(ExampleRegtestWalletSeed::AAAAAAAAAAAAAAAAAAAAAAAA( | ||
ExampleAAAAAAAAAAAAAAAAAAAAAAAAWalletVersion::V26, | ||
)) => { | ||
LightWallet::unsafe_from_buffer_regtest(include_bytes!( | ||
"examples/regtest/aaaaaaaaaaaaaaaaaaaaaaaa/v26/zingo-wallet.dat" | ||
)) | ||
.await | ||
} | ||
ExampleWalletNetwork::Testnet(ExampleTestnetWalletSeed::MSKMGDBHOTBPETCJWCSPGOPP( | ||
ExampleMSKMGDBHOTBPETCJWCSPGOPPWalletVersion::Gab72a38b, | ||
)) => { | ||
LightWallet::unsafe_from_buffer_testnet(include_bytes!( | ||
"examples/v26-1/zingo-wallet.dat" | ||
"examples/testnet/mskmgdbhotbpetcjwcspgopp/Gab72a38b/zingo-wallet.dat" | ||
)) | ||
.await | ||
} | ||
LegacyWalletCase::ZingoV26(LegacyWalletCaseZingoV26::Two) => { | ||
ExampleWalletNetwork::Testnet(ExampleTestnetWalletSeed::CBBHRWIILGBRABABSSHSMTPR( | ||
ExampleCBBHRWIILGBRABABSSHSMTPRWalletVersion::V26, | ||
)) => { | ||
LightWallet::unsafe_from_buffer_testnet(include_bytes!( | ||
"examples/v26-2/zingo-wallet.dat" | ||
"examples/testnet/cbbhrwiilgbrababsshsmtpr/v26/zingo-wallet.dat" | ||
)) | ||
.await | ||
} | ||
LegacyWalletCase::ZingoV26(LegacyWalletCaseZingoV26::RegtestSapOnly) => { | ||
LightWallet::unsafe_from_buffer_regtest(include_bytes!( | ||
"examples/v26/202302_release/regtest/sap_only/zingo-wallet.dat" | ||
ExampleWalletNetwork::Testnet(ExampleTestnetWalletSeed::CBBHRWIILGBRABABSSHSMTPR( | ||
ExampleCBBHRWIILGBRABABSSHSMTPRWalletVersion::V27, | ||
)) => { | ||
LightWallet::unsafe_from_buffer_testnet(include_bytes!( | ||
"examples/testnet/cbbhrwiilgbrababsshsmtpr/v27/zingo-wallet.dat" | ||
)) | ||
.await | ||
} | ||
LegacyWalletCase::ZingoV28 => { | ||
ExampleWalletNetwork::Testnet(ExampleTestnetWalletSeed::CBBHRWIILGBRABABSSHSMTPR( | ||
ExampleCBBHRWIILGBRABABSSHSMTPRWalletVersion::V28, | ||
)) => { | ||
LightWallet::unsafe_from_buffer_testnet(include_bytes!( | ||
"examples/zingo-wallet-v28.dat" | ||
"examples/testnet/cbbhrwiilgbrababsshsmtpr/v28/zingo-wallet.dat" | ||
)) | ||
.await | ||
} | ||
LegacyWalletCase::OldWalletReorgTestWallet => { | ||
LightWallet::unsafe_from_buffer_regtest(include_bytes!( | ||
"examples/old_wallet_reorg_test_wallet/zingo-wallet.dat" | ||
ExampleWalletNetwork::Mainnet(ExampleMainnetWalletSeed::VTFCORFBCBPCTCFUPMEGMWBP( | ||
ExampleVTFCORFBCBPCTCFUPMEGMWBPWalletVersion::V28, | ||
)) => { | ||
LightWallet::unsafe_from_buffer_mainnet(include_bytes!( | ||
"examples/mainnet/vtfcorfbcbpctcfupmegmwbp/v28/zingo-wallet.dat" | ||
)) | ||
.await | ||
} | ||
} | ||
} | ||
} | ||
|
||
/// each wallet file has a saved balance | ||
pub fn example_expected_balance(case: LegacyWalletCase) -> u64 { | ||
match case { | ||
LegacyWalletCase::ZingoV26(LegacyWalletCaseZingoV26::One) => 0, | ||
LegacyWalletCase::ZingoV26(LegacyWalletCaseZingoV26::Two) => 10177826, | ||
LegacyWalletCase::ZingoV26(LegacyWalletCaseZingoV26::RegtestSapOnly) => todo!(), | ||
LegacyWalletCase::ZingoV28 => 10342837, | ||
LegacyWalletCase::OldWalletReorgTestWallet => todo!(), | ||
} | ||
} | ||
// /// loads test wallets | ||
// impl LightWallet { | ||
// /// each wallet file has a saved balance | ||
// pub fn example_expected_balance(case: LegacyWalletCase) -> u64 { | ||
// match case { | ||
// // LegacyWalletCase::ZingoV26(LegacyWalletCaseZingoV26::One) => 0, | ||
// // LegacyWalletCase::ZingoV26(LegacyWalletCaseZingoV26::Two) => 10177826, | ||
// LegacyWalletCase::ZingoV26(LegacyWalletCaseZingoV26::RegtestSapOnly) => todo!(), | ||
// LegacyWalletCase::ZingoV28 => 10342837, | ||
// } | ||
// } | ||
|
||
/// each wallet file has a saved balance | ||
pub fn example_expected_num_addresses(case: LegacyWalletCase) -> usize { | ||
match case { | ||
LegacyWalletCase::ZingoV26(LegacyWalletCaseZingoV26::One) => 3, | ||
LegacyWalletCase::ZingoV26(LegacyWalletCaseZingoV26::Two) => 1, | ||
LegacyWalletCase::ZingoV26(LegacyWalletCaseZingoV26::RegtestSapOnly) => todo!(), | ||
LegacyWalletCase::ZingoV28 => 3, | ||
LegacyWalletCase::OldWalletReorgTestWallet => todo!(), | ||
} | ||
} | ||
} | ||
// /// each wallet file has a saved balance | ||
// pub fn example_expected_num_addresses(case: LegacyWalletCase) -> usize { | ||
// match case { | ||
// // LegacyWalletCase::ZingoV26(LegacyWalletCaseZingoV26::One) => 3, | ||
// // LegacyWalletCase::ZingoV26(LegacyWalletCaseZingoV26::Two) => 1, | ||
// LegacyWalletCase::ZingoV26(LegacyWalletCaseZingoV26::RegtestSapOnly) => todo!(), | ||
// LegacyWalletCase::ZingoV28 => 3, | ||
// } | ||
// } | ||
// } |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Oops, something went wrong.