mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 17:31:03 +00:00
Implement test that executes extrinsics
This commit is contained in:
@@ -68,7 +68,25 @@ fn create_extrinsics() -> Vec<<Block as BlockT>::Extrinsic> {
|
|||||||
to: AccountKeyring::Bob.into(),
|
to: AccountKeyring::Bob.into(),
|
||||||
amount: 69,
|
amount: 69,
|
||||||
nonce: 0,
|
nonce: 0,
|
||||||
}.into_signed_tx()
|
}.into_signed_tx(),
|
||||||
|
Transfer {
|
||||||
|
from: AccountKeyring::Alice.into(),
|
||||||
|
to: AccountKeyring::Charlie.into(),
|
||||||
|
amount: 100,
|
||||||
|
nonce: 1,
|
||||||
|
}.into_signed_tx(),
|
||||||
|
Transfer {
|
||||||
|
from: AccountKeyring::Bob.into(),
|
||||||
|
to: AccountKeyring::Charlie.into(),
|
||||||
|
amount: 100,
|
||||||
|
nonce: 0,
|
||||||
|
}.into_signed_tx(),
|
||||||
|
Transfer {
|
||||||
|
from: AccountKeyring::Charlie.into(),
|
||||||
|
to: AccountKeyring::Alice.into(),
|
||||||
|
amount: 500,
|
||||||
|
nonce: 0,
|
||||||
|
}.into_signed_tx(),
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -98,7 +116,7 @@ fn build_block_with_proof(
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn validate_block_with_empty_block() {
|
fn validate_block_with_no_extrinsics() {
|
||||||
let client = create_test_client();
|
let client = create_test_client();
|
||||||
let witness_data_storage_root = *client
|
let witness_data_storage_root = *client
|
||||||
.best_block_header()
|
.best_block_header()
|
||||||
@@ -116,18 +134,21 @@ fn validate_block_with_empty_block() {
|
|||||||
call_validate_block(block_data).expect("Calls `validate_block`");
|
call_validate_block(block_data).expect("Calls `validate_block`");
|
||||||
}
|
}
|
||||||
|
|
||||||
// #[test]
|
#[test]
|
||||||
// fn validate_block_with_empty_witness_data() {
|
fn validate_block_with_extrinsics() {
|
||||||
// let prev_header = create_header();
|
let client = create_test_client();
|
||||||
|
let witness_data_storage_root = *client
|
||||||
|
.best_block_header()
|
||||||
|
.expect("Best block exists")
|
||||||
|
.state_root();
|
||||||
|
let (block, witness_data) = build_block_with_proof(&client, create_extrinsics());
|
||||||
|
let (header, extrinsics) = block.deconstruct();
|
||||||
|
|
||||||
// let block = ParachainBlock::new(create_extrinsics(), Default::default());
|
let block_data = ParachainBlockData::new(
|
||||||
// assert!(call_validate_block(block).is_err());
|
header,
|
||||||
// }
|
extrinsics,
|
||||||
|
witness_data,
|
||||||
// #[test]
|
witness_data_storage_root
|
||||||
// fn validate_block_with_witness_data() {
|
);
|
||||||
// let prev_header = create_header();
|
call_validate_block(block_data).expect("Calls `validate_block`");
|
||||||
|
}
|
||||||
// let block = ParachainBlock::new(create_extrinsics(), create_witness_data());
|
|
||||||
// call_validate_block(block).expect("`validate_block` succeeds");
|
|
||||||
// }
|
|
||||||
@@ -18,6 +18,6 @@
|
|||||||
|
|
||||||
#![cfg_attr(not(feature = "std"), no_std)]
|
#![cfg_attr(not(feature = "std"), no_std)]
|
||||||
|
|
||||||
use substrate_test_runtime::{Block, system::BlockExecutor};
|
pub use substrate_test_runtime::*;
|
||||||
|
|
||||||
runtime::register_validate_block!(Block, BlockExecutor);
|
runtime::register_validate_block!(Block, BlockExecutor);
|
||||||
Reference in New Issue
Block a user