Skip to content

Commit

Permalink
fix: fix parachain testcase
Browse files Browse the repository at this point in the history
  • Loading branch information
nakul1010 committed Sep 21, 2023
1 parent 1ac3e71 commit 6df4339
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion crates/btc-relay/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -905,7 +905,7 @@ impl<T: Config> Pallet<T> {
}
}

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::<T>::insert(chain_id, block_height, block_hash);
}

Expand Down
5 changes: 3 additions & 2 deletions parachain/runtime/runtime-tests/src/parachain/btc_relay.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(|| {
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 6df4339

Please sign in to comment.