From 6df43394ca2c24ab1aaed2d80daf190ca9851df0 Mon Sep 17 00:00:00 2001 From: nakul1010 Date: Thu, 21 Sep 2023 18:36:30 +0530 Subject: [PATCH] fix: fix parachain testcase --- crates/btc-relay/src/lib.rs | 2 +- parachain/runtime/runtime-tests/src/parachain/btc_relay.rs | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/crates/btc-relay/src/lib.rs b/crates/btc-relay/src/lib.rs index 5d159ef544..7fa3a8c2ed 100644 --- a/crates/btc-relay/src/lib.rs +++ b/crates/btc-relay/src/lib.rs @@ -905,7 +905,7 @@ impl Pallet { } } - fn insert_block_hash(chain_id: u32, block_height: u32, block_hash: H256Le) { + pub fn insert_block_hash(chain_id: u32, block_height: u32, block_hash: H256Le) { ChainsHashes::::insert(chain_id, block_height, block_hash); } diff --git a/parachain/runtime/runtime-tests/src/parachain/btc_relay.rs b/parachain/runtime/runtime-tests/src/parachain/btc_relay.rs index 56fd6617c0..0e42c852f2 100644 --- a/parachain/runtime/runtime-tests/src/parachain/btc_relay.rs +++ b/parachain/runtime/runtime-tests/src/parachain/btc_relay.rs @@ -126,7 +126,6 @@ fn integration_test_submit_block_headers_and_verify_transaction_inclusion() { }) } -//ToDo: Test failing #[test] fn integration_test_submit_fork_headers() { ExtBuilder::build().execute_without_relay_init(|| { @@ -166,11 +165,13 @@ fn integration_test_submit_fork_headers() { assert_store_main_chain_header_event(index as u32, header.hash, account_of(ALICE)); } + BTCRelayPallet::insert_block_hash(0, DIFFICULTY_ADJUSTMENT_INTERVAL, genesis_header.hash); + BTCRelayPallet::insert_block_hash(FORK_ID, DIFFICULTY_ADJUSTMENT_INTERVAL, test_data[1].hash); + // submit future main chain without genesis for (index, header) in test_data.iter().enumerate().skip(1 + NUM_FORK_HEADERS as usize) { SecurityPallet::set_active_block_number(index as u32); let height: u32 = index as u32 - NUM_FORK_HEADERS; - assert_ok!(BTCRelayPallet::_store_block_header(&account_of(ALICE), header.clone())); // depending on the height and header, we expect different events and chain state