mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-27 05:47:58 +00:00
fix tests after merge
This commit is contained in:
@@ -42,13 +42,15 @@ impl CodeExecutor for NativeExecutor {
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use codec::{KeyedVec, Slicable};
|
||||
use native_runtime::support::{one, two, Hashable};
|
||||
use runtime_std::TestExternalities;
|
||||
use codec::{KeyedVec, Slicable, Joiner};
|
||||
use native_runtime::support::{one, two, Hashable};
|
||||
use native_runtime::runtime::staking::balance;
|
||||
use state_machine::TestExternalities;
|
||||
use primitives::twox_128;
|
||||
use primitives::{twox_128, Hash, H256};
|
||||
use primitives::runtime_function::Function;
|
||||
use primitives::block::{Header, Number as BlockNumber, Block, Digest};
|
||||
use primitives::transaction::{Transaction, UncheckedTransaction};
|
||||
use ed25519::Pair;
|
||||
|
||||
const BLOATY_CODE: &[u8] = include_bytes!("../../wasm-runtime/target/wasm32-unknown-unknown/release/runtime_polkadot.wasm");
|
||||
const COMPACT_CODE: &[u8] = include_bytes!("../../wasm-runtime/target/wasm32-unknown-unknown/release/runtime_polkadot.compact.wasm");
|
||||
@@ -60,8 +62,8 @@ mod tests {
|
||||
function: Function::StakingTransfer(two(), 69),
|
||||
};
|
||||
let signature = secret_for(&transaction.signed).unwrap()
|
||||
.sign(&transaction.to_vec())
|
||||
.inner();
|
||||
.sign(&transaction.to_vec());
|
||||
|
||||
UncheckedTransaction { transaction, signature }
|
||||
}
|
||||
|
||||
@@ -147,8 +149,7 @@ mod tests {
|
||||
], }
|
||||
}
|
||||
|
||||
use primitives::ed25519::Pair;
|
||||
fn secret_for(who: &AccountID) -> Option<Pair> {
|
||||
fn secret_for(who: &::primitives::AccountId) -> Option<Pair> {
|
||||
match who {
|
||||
x if *x == one() => Some(Pair::from_seed(b"12345678901234567890123456789012")),
|
||||
x if *x == two() => Some("9d61b19deffd5a60ba844af492ec2cc44449c5697b326919703bac031cae7f60".into()),
|
||||
@@ -161,12 +162,12 @@ mod tests {
|
||||
|
||||
let transactions = txs.into_iter().map(|transaction| {
|
||||
let signature = secret_for(&transaction.signed).unwrap()
|
||||
.sign(&transaction.to_vec())
|
||||
.inner();
|
||||
.sign(&transaction.to_vec());
|
||||
|
||||
UncheckedTransaction { transaction, signature }
|
||||
}).collect::<Vec<_>>();
|
||||
|
||||
let transaction_root = ordered_trie_root(transactions.iter().map(Slicable::to_vec)).0;
|
||||
let transaction_root = H256(ordered_trie_root(transactions.iter().map(Slicable::to_vec)).0);
|
||||
|
||||
let header = Header {
|
||||
parent_hash,
|
||||
@@ -177,19 +178,18 @@ mod tests {
|
||||
};
|
||||
let hash = header.blake2_256();
|
||||
|
||||
(Block { header, transactions }.to_vec(), hash)
|
||||
(Block { header, transactions }.to_vec(), H256(hash))
|
||||
}
|
||||
|
||||
fn block1() -> (Vec<u8>, Hash) {
|
||||
construct_block(
|
||||
1,
|
||||
[69u8; 32],
|
||||
hex!("2481853da20b9f4322f34650fea5f240dcbfb266d02db94bfa0153c31f4a29db"),
|
||||
H256([69u8; 32]),
|
||||
H256(hex!("2481853da20b9f4322f34650fea5f240dcbfb266d02db94bfa0153c31f4a29db")),
|
||||
vec![Transaction {
|
||||
signed: one(),
|
||||
nonce: 0,
|
||||
function: Function::StakingTransfer,
|
||||
input_data: vec![].join(&two()).join(&69u64),
|
||||
function: Function::StakingTransfer(two(), 69),
|
||||
}]
|
||||
)
|
||||
}
|
||||
@@ -198,19 +198,17 @@ mod tests {
|
||||
construct_block(
|
||||
2,
|
||||
block1().1,
|
||||
hex!("2e69e4405a13981224078ad5355c68401bf56d0fe3f14a3536734666e6a8a047"),
|
||||
H256(hex!("2cdbbf9bd766c2286a5f4091c131fe161addd060ba6fc041b3419089f4601bda")),
|
||||
vec![
|
||||
Transaction {
|
||||
signed: two(),
|
||||
nonce: 0,
|
||||
function: Function::StakingTransfer,
|
||||
input_data: vec![].join(&one()).join(&5u64),
|
||||
function: Function::StakingTransfer(one(), 5),
|
||||
},
|
||||
Transaction {
|
||||
signed: one(),
|
||||
nonce: 1,
|
||||
function: Function::StakingTransfer,
|
||||
input_data: vec![].join(&two()).join(&15u64),
|
||||
function: Function::StakingTransfer(two(), 15),
|
||||
}
|
||||
]
|
||||
)
|
||||
|
||||
@@ -287,17 +287,17 @@ impl CodeExecutor for WasmExecutor {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
|
||||
use super::*;
|
||||
use rustc_hex::FromHex;
|
||||
use primitives::{AccountId, blake2_256, twox_128};
|
||||
use primitives::block::Header;
|
||||
use primitives::transaction::{Transaction, UncheckedTransaction};
|
||||
use codec::KeyedVec;
|
||||
use state_machine::TestExternalities;
|
||||
use runtime_std;
|
||||
use codec::{KeyedVec, Slicable, Joiner};
|
||||
use native_runtime::support::{one, two};
|
||||
use native_runtime::runtime::staking::balance;
|
||||
use state_machine::TestExternalities;
|
||||
use primitives::{twox_128, AccountId};
|
||||
use primitives::runtime_function::Function;
|
||||
use primitives::block::Header;
|
||||
use primitives::transaction::{Transaction, UncheckedTransaction};
|
||||
use runtime_std;
|
||||
use ed25519::Pair;
|
||||
|
||||
fn secret_for(who: &AccountId) -> Option<Pair> {
|
||||
@@ -309,16 +309,13 @@ mod tests {
|
||||
}
|
||||
|
||||
fn tx() -> UncheckedTransaction {
|
||||
use native_runtime::codec::Slicable;
|
||||
|
||||
let transaction = Transaction {
|
||||
signed: one(),
|
||||
nonce: 0,
|
||||
function: Function::StakingTransfer(two(), 69),
|
||||
};
|
||||
let signature = secret_for(&transaction.signed).unwrap()
|
||||
.sign(&transaction.to_vec())
|
||||
.inner();
|
||||
.sign(&transaction.to_vec());
|
||||
|
||||
UncheckedTransaction { transaction, signature }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user