Skip to content

Commit 75e2d00

Browse files
committed
remove some nonsense tests
1 parent b4e50a9 commit 75e2d00

File tree

1 file changed

+0
-154
lines changed

1 file changed

+0
-154
lines changed

tuxedo-template-runtime/src/genesis.rs

-154
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ pub fn development_genesis_transactions() -> Vec<Transaction> {
3535
// Kitty Transactions
3636
KittyData::mint(Parent::mom(), b"mother", UpForGrabs),
3737
KittyData::mint(Parent::dad(), b"father", UpForGrabs),
38-
// TODO: Initial Transactions for Existence
3938
]);
4039

4140
genesis_transactions
@@ -44,156 +43,3 @@ pub fn development_genesis_transactions() -> Vec<Transaction> {
4443
pub fn development_genesis_config() -> serde_json::Value {
4544
serde_json::json!(development_genesis_transactions())
4645
}
47-
48-
#[cfg(test)]
49-
mod tests {
50-
use super::*;
51-
52-
use crate::OuterVerifier;
53-
use parity_scale_codec::{Decode, Encode};
54-
use sp_api::HashT;
55-
use sp_core::testing::SR25519;
56-
use sp_keystore::{testing::MemoryKeystore, Keystore, KeystoreExt};
57-
use sp_runtime::traits::BlakeTwo256;
58-
use std::sync::Arc;
59-
use tuxedo_core::{
60-
dynamic_typing::{DynamicallyTypedData, UtxoData},
61-
genesis::TuxedoGenesisConfigBuilder,
62-
types::{Output, OutputRef},
63-
};
64-
65-
// other random account generated with subkey
66-
const SHAWN_PHRASE: &str =
67-
"news slush supreme milk chapter athlete soap sausage put clutch what kitten";
68-
const ANDREW_PHRASE: &str =
69-
"monkey happy total rib lumber scrap guide photo country online rose diet";
70-
71-
fn default_runtime_genesis_config() -> RuntimeGenesisConfig {
72-
let keystore = MemoryKeystore::new();
73-
74-
let shawn_pub_key_bytes = keystore
75-
.sr25519_generate_new(SR25519, Some(SHAWN_PHRASE))
76-
.unwrap()
77-
.0;
78-
79-
let andrew_pub_key_bytes = keystore
80-
.sr25519_generate_new(SR25519, Some(ANDREW_PHRASE))
81-
.unwrap()
82-
.0;
83-
84-
let signatories = vec![shawn_pub_key_bytes.into(), andrew_pub_key_bytes.into()];
85-
86-
let mut genesis_transactions = OuterConstraintChecker::genesis_transactions();
87-
genesis_transactions.extend([
88-
// Money Transactions
89-
Coin::<0>::mint(100, Sr25519Signature::new(shawn_pub_key_bytes)),
90-
Coin::<0>::mint(100, ThresholdMultiSignature::new(1, signatories)),
91-
]);
92-
93-
RuntimeGenesisConfig::new(
94-
WASM_BINARY
95-
.expect("Runtime WASM binary must exist.")
96-
.to_vec(),
97-
genesis_transactions,
98-
)
99-
}
100-
101-
fn new_test_ext() -> sp_io::TestExternalities {
102-
let keystore = MemoryKeystore::new();
103-
let mut ext = sp_io::TestExternalities::new_empty();
104-
ext.register_extension(KeystoreExt(Arc::new(keystore)));
105-
106-
ext.execute_with(|| {
107-
TuxedoGenesisConfigBuilder::build(development_genesis_transactions())
108-
.expect("Genesis Config Build Failed")
109-
});
110-
ext
111-
}
112-
113-
#[test]
114-
fn genesis_utxo_money() {
115-
new_test_ext().execute_with(|| {
116-
let keystore = MemoryKeystore::new();
117-
let shawn_pub_key = keystore
118-
.sr25519_generate_new(SR25519, Some(SHAWN_PHRASE))
119-
.unwrap();
120-
121-
// Grab genesis value from storage and assert it is correct
122-
let genesis_utxo = Output {
123-
verifier: OuterVerifier::Sr25519Signature(Sr25519Signature {
124-
owner_pubkey: shawn_pub_key.into(),
125-
}),
126-
payload: DynamicallyTypedData {
127-
data: 100u128.encode(),
128-
type_id: <money::Coin<0> as UtxoData>::TYPE_ID,
129-
},
130-
};
131-
132-
let inherents_len =
133-
OuterConstraintChecker::genesis_transactions::<OuterVerifier>().len();
134-
135-
let tx = development_genesis_transactions()
136-
.get(inherents_len)
137-
.unwrap()
138-
.clone();
139-
140-
assert_eq!(tx.outputs.first(), Some(&genesis_utxo));
141-
142-
let tx_hash = BlakeTwo256::hash_of(&tx.encode());
143-
let output_ref = OutputRef {
144-
tx_hash,
145-
index: 0_u32,
146-
};
147-
148-
let encoded_utxo =
149-
sp_io::storage::get(&output_ref.encode()).expect("Retrieve Genesis UTXO");
150-
let utxo = Output::decode(&mut &encoded_utxo[..]).expect("Can Decode UTXO correctly");
151-
assert_eq!(utxo, genesis_utxo);
152-
})
153-
}
154-
155-
#[test]
156-
fn genesis_utxo_money_multi_sig() {
157-
new_test_ext().execute_with(|| {
158-
let keystore = MemoryKeystore::new();
159-
let shawn_pub_key = keystore
160-
.sr25519_generate_new(SR25519, Some(SHAWN_PHRASE))
161-
.unwrap();
162-
let andrew_pub_key = keystore
163-
.sr25519_generate_new(SR25519, Some(ANDREW_PHRASE))
164-
.unwrap();
165-
166-
let genesis_multi_sig_utxo = Output {
167-
verifier: OuterVerifier::ThresholdMultiSignature(ThresholdMultiSignature {
168-
threshold: 1,
169-
signatories: vec![shawn_pub_key.into(), andrew_pub_key.into()],
170-
}),
171-
payload: DynamicallyTypedData {
172-
data: 100u128.encode(),
173-
type_id: <money::Coin<0> as UtxoData>::TYPE_ID,
174-
},
175-
};
176-
177-
let inherents_len =
178-
OuterConstraintChecker::genesis_transactions::<OuterVerifier>().len();
179-
180-
let tx = development_genesis_transactions()
181-
.get(1 + inherents_len)
182-
.unwrap()
183-
.clone();
184-
185-
assert_eq!(tx.outputs.first(), Some(&genesis_multi_sig_utxo));
186-
187-
let tx_hash = BlakeTwo256::hash_of(&tx.encode());
188-
let output_ref = OutputRef {
189-
tx_hash,
190-
index: 0_u32,
191-
};
192-
193-
let encoded_utxo =
194-
sp_io::storage::get(&output_ref.encode()).expect("Retrieve Genesis MultiSig UTXO");
195-
let utxo = Output::decode(&mut &encoded_utxo[..]).expect("Can Decode UTXO correctly");
196-
assert_eq!(utxo, genesis_multi_sig_utxo);
197-
})
198-
}
199-
}

0 commit comments

Comments
 (0)