From 3b58683e69944ed1fb279553e874a1a74d428ae6 Mon Sep 17 00:00:00 2001 From: zjb0807 Date: Thu, 22 Aug 2024 13:36:08 +0800 Subject: [PATCH] fix tests --- runtime/integration-tests/src/setup.rs | 20 ++++++++++++++++++-- runtime/integration-tests/src/vesting.rs | 1 - 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/runtime/integration-tests/src/setup.rs b/runtime/integration-tests/src/setup.rs index 1da7e14c31..0c11422293 100644 --- a/runtime/integration-tests/src/setup.rs +++ b/runtime/integration-tests/src/setup.rs @@ -48,7 +48,7 @@ use sp_consensus_aura::AURA_ENGINE_ID; pub use sp_core::H160; use sp_io::hashing::keccak_256; pub use sp_runtime::{ - traits::{AccountIdConversion, BadOrigin, BlakeTwo256, Convert, Hash, Zero}, + traits::{AccountIdConversion, BadOrigin, BlakeTwo256, Convert, Hash, Header, Zero}, BuildStorage, Digest, DigestItem, DispatchError, DispatchResult, FixedPointNumber, FixedU128, MultiAddress, Perbill, Permill, }; @@ -233,7 +233,23 @@ pub fn set_relaychain_block_number(number: BlockNumber) { AuraExt::on_initialize(number); ParachainSystem::on_initialize(number); - let (relay_storage_root, proof) = RelayStateSproofBuilder::default().into_state_root_and_proof(); + let mut sproof_builder = RelayStateSproofBuilder::default(); + + let parent_head_data = { + let header = cumulus_primitives_core::relay_chain::Header::new( + number, + sp_core::H256::from_low_u64_be(0), + sp_core::H256::from_low_u64_be(0), + Default::default(), + Default::default(), + ); + cumulus_primitives_core::relay_chain::HeadData(header.encode()) + }; + + sproof_builder.para_id = ParachainInfo::get().into(); + sproof_builder.included_para_head = Some(parent_head_data.clone()); + + let (relay_storage_root, proof) = sproof_builder.into_state_root_and_proof(); assert_ok!(ParachainSystem::set_validation_data( RuntimeOrigin::none(), diff --git a/runtime/integration-tests/src/vesting.rs b/runtime/integration-tests/src/vesting.rs index b1c80f7ba1..6aa64574a4 100644 --- a/runtime/integration-tests/src/vesting.rs +++ b/runtime/integration-tests/src/vesting.rs @@ -20,7 +20,6 @@ use crate::setup::*; use orml_vesting::VestingSchedule; #[test] -#[ignore] // TODO: fix the relaychain block number proof fn test_vesting_use_relaychain_block_number() { ExtBuilder::default().build().execute_with(|| { #[cfg(feature = "with-mandala-runtime")]