mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 22:11:02 +00:00
Snowbridge Ethereum Deneb fork preparation (#3029)
- Prepares for the Deneb hardfork on Sepolia testnet on 31 January (needs to be deployed to Rococo before then) - Removes `beacon-minimal-spec` flag for simpler config - Adds test comments --------- Co-authored-by: Ron <yrong1997@gmail.com> Co-authored-by: claravanstaden <Cats 4 life!> Co-authored-by: Alistair Singh <alistair.singh7@gmail.com>
This commit is contained in:
@@ -33,7 +33,7 @@ use polkadot_parachain_primitives::primitives::{
|
||||
HeadData, HrmpChannelId, RelayChainBlockNumber, XcmpMessageFormat,
|
||||
};
|
||||
use sp_consensus_aura::{SlotDuration, AURA_ENGINE_ID};
|
||||
use sp_core::Encode;
|
||||
use sp_core::{Encode, U256};
|
||||
use sp_runtime::{traits::Header, BuildStorage, Digest, DigestItem};
|
||||
use xcm::{
|
||||
latest::{Asset, Location, XcmContext, XcmHash},
|
||||
@@ -300,6 +300,10 @@ where
|
||||
<Runtime as frame_system::Config>::RuntimeOrigin::root()
|
||||
}
|
||||
|
||||
pub fn block_number() -> U256 {
|
||||
frame_system::Pallet::<Runtime>::block_number().into()
|
||||
}
|
||||
|
||||
pub fn origin_of(
|
||||
account_id: AccountIdOf<Runtime>,
|
||||
) -> <Runtime as frame_system::Config>::RuntimeOrigin {
|
||||
|
||||
@@ -91,3 +91,55 @@ pub fn change_storage_constant_by_governance_works<Runtime, StorageConstant, Sto
|
||||
);
|
||||
})
|
||||
}
|
||||
|
||||
/// Test-case makes sure that `Runtime` can change storage constant via governance-like call
|
||||
pub fn set_storage_keys_by_governance_works<Runtime>(
|
||||
collator_session_key: CollatorSessionKeys<Runtime>,
|
||||
runtime_para_id: u32,
|
||||
runtime_call_encode: Box<dyn Fn(frame_system::Call<Runtime>) -> Vec<u8>>,
|
||||
storage_items: Vec<(Vec<u8>, Vec<u8>)>,
|
||||
initialize_storage: impl FnOnce() -> (),
|
||||
assert_storage: impl FnOnce() -> (),
|
||||
) where
|
||||
Runtime: frame_system::Config
|
||||
+ pallet_balances::Config
|
||||
+ pallet_session::Config
|
||||
+ pallet_xcm::Config
|
||||
+ parachain_info::Config
|
||||
+ pallet_collator_selection::Config
|
||||
+ cumulus_pallet_parachain_system::Config,
|
||||
ValidatorIdOf<Runtime>: From<AccountIdOf<Runtime>>,
|
||||
{
|
||||
let mut runtime = ExtBuilder::<Runtime>::default()
|
||||
.with_collators(collator_session_key.collators())
|
||||
.with_session_keys(collator_session_key.session_keys())
|
||||
.with_para_id(runtime_para_id.into())
|
||||
.with_tracing()
|
||||
.build();
|
||||
runtime.execute_with(|| {
|
||||
initialize_storage();
|
||||
});
|
||||
runtime.execute_with(|| {
|
||||
// encode `kill_storage` call
|
||||
let kill_storage_call = runtime_call_encode(frame_system::Call::<Runtime>::set_storage {
|
||||
items: storage_items.clone(),
|
||||
});
|
||||
|
||||
// estimate - storing just 1 value
|
||||
use frame_system::WeightInfo;
|
||||
let require_weight_at_most =
|
||||
<Runtime as frame_system::Config>::SystemWeightInfo::set_storage(
|
||||
storage_items.len().try_into().unwrap(),
|
||||
);
|
||||
|
||||
// execute XCM with Transact to `set_storage` as governance does
|
||||
assert_ok!(RuntimeHelper::<Runtime>::execute_as_governance(
|
||||
kill_storage_call,
|
||||
require_weight_at_most
|
||||
)
|
||||
.ensure_complete());
|
||||
});
|
||||
runtime.execute_with(|| {
|
||||
assert_storage();
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user