Skip to content

Commit 176bbd8

Browse files
vedhavyasnazar-pc
authored andcommitted
update reorg test and remove unused imports
1 parent 107f756 commit 176bbd8

File tree

3 files changed

+30
-20
lines changed

3 files changed

+30
-20
lines changed

crates/pallet-runtime-configs/src/benchmarking.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ use frame_benchmarking::v2::*;
66
mod benchmarks {
77
use crate::{Call, Config, Pallet};
88
use frame_system::RawOrigin;
9-
use sp_std::vec;
109

1110
#[benchmark]
1211
fn set_enable_domains() {

crates/pallet-subspace/src/benchmarking.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ mod benchmarks {
1919
use sp_core::Get;
2020
use sp_runtime::traits::{Block, Header};
2121
use sp_std::boxed::Box;
22-
use sp_std::vec;
2322
use sp_std::vec::Vec;
2423
use subspace_core_primitives::{
2524
ArchivedBlockProgress, Blake3Hash, LastArchivedBlock, PotOutput, SegmentHeader,

domains/client/domain-operator/src/tests.rs

Lines changed: 30 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3460,7 +3460,7 @@ async fn test_multiple_consensus_blocks_derive_similar_domain_block() {
34603460
);
34613461

34623462
// Run Alice (a evm domain authority node)
3463-
let alice = domain_test_service::DomainNodeBuilder::new(
3463+
let mut alice = domain_test_service::DomainNodeBuilder::new(
34643464
tokio_handle.clone(),
34653465
Alice,
34663466
BasePath::new(directory.path().join("alice")),
@@ -3477,29 +3477,45 @@ async fn test_multiple_consensus_blocks_derive_similar_domain_block() {
34773477
.into()
34783478
};
34793479

3480-
// Fork A
3480+
// submit a remark from alice
3481+
let alice_account_nonce = alice.account_nonce();
3482+
let tx = alice.construct_extrinsic(
3483+
alice_account_nonce,
3484+
frame_system::Call::remark {
3485+
remark: vec![0u8; 8],
3486+
},
3487+
);
3488+
alice
3489+
.send_extrinsic(tx)
3490+
.await
3491+
.expect("Failed to send extrinsic");
3492+
3493+
// Fork A with bundle that contains above transaction
34813494
let (slot, bundle) = ferdie.produce_slot_and_wait_for_bundle_submission().await;
3482-
// Include one more extrinsic in fork A such that we can have a different consensus block
3483-
let remark_tx = subspace_test_runtime::UncheckedExtrinsic::new_unsigned(
3484-
frame_system::Call::remark { remark: vec![0; 8] }.into(),
3485-
)
3486-
.into();
34873495
let consensus_block_hash_fork_a = ferdie
34883496
.produce_block_with_slot_at(
34893497
slot,
34903498
common_block_hash,
3491-
Some(vec![bundle_to_tx(bundle.clone().unwrap()), remark_tx]),
3499+
Some(vec![bundle_to_tx(bundle.clone().unwrap())]),
34923500
)
34933501
.await
34943502
.unwrap();
34953503

34963504
// Fork B
3505+
let bundle = {
3506+
let mut opaque_bundle = bundle.unwrap();
3507+
opaque_bundle.extrinsics = vec![];
3508+
opaque_bundle.sealed_header.header.bundle_extrinsics_root =
3509+
sp_domains::EMPTY_EXTRINSIC_ROOT;
3510+
opaque_bundle.sealed_header.signature = Sr25519Keyring::Alice
3511+
.pair()
3512+
.sign(opaque_bundle.sealed_header.pre_hash().as_ref())
3513+
.into();
3514+
opaque_bundle
3515+
};
3516+
34973517
let consensus_block_hash_fork_b = ferdie
3498-
.produce_block_with_slot_at(
3499-
slot,
3500-
common_block_hash,
3501-
Some(vec![bundle_to_tx(bundle.unwrap())]),
3502-
)
3518+
.produce_block_with_slot_at(slot, common_block_hash, Some(vec![bundle_to_tx(bundle)]))
35033519
.await
35043520
.unwrap();
35053521
// Produce one more consensus block to make fork B the best fork and trigger processing
@@ -3547,16 +3563,12 @@ async fn test_multiple_consensus_blocks_derive_similar_domain_block() {
35473563
consensus_block_hash_fork_b
35483564
);
35493565

3550-
// The domain block headers should have the same `parent_hash` and `extrinsics_root`
3566+
// The domain block headers should have the same `parent_hash`
35513567
// but different digest and `state_root` (because digest is stored on chain)
35523568
assert_eq!(
35533569
domain_block_header_fork_a.parent_hash(),
35543570
domain_block_header_fork_b.parent_hash()
35553571
);
3556-
assert_eq!(
3557-
domain_block_header_fork_a.extrinsics_root(),
3558-
domain_block_header_fork_b.extrinsics_root()
3559-
);
35603572
assert_ne!(
35613573
domain_block_header_fork_a.digest(),
35623574
domain_block_header_fork_b.digest()

0 commit comments

Comments
 (0)