mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-14 15:41:02 +00:00
Create benchmark for the system::set_code instrisic (#13373)
* Still WIP # Conflicts: # frame/system/src/weights.rs * Still WIP * Add benchmark for system::set_code intrinsic fixes #13192 * Fix format * Add missing benchmark runtime * Fix lint warning * Consume the rest of the block and add test verification after the benchmark * Rewrite set_code function * Try to fix benchmarks and tests * Remove weight tags * Update frame/system/src/tests.rs Co-authored-by: Bastian Köcher <git@kchr.de> * Register ReadRuntimeVersionExt for benches Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Fix tests * Fix deprecations * Fix deprecations * ".git/.scripts/commands/bench/bench.sh" pallet dev frame_system * Add update info and remove obsolete complexity comments. * ".git/.scripts/commands/fmt/fmt.sh" * Update frame/system/src/lib.rs Co-authored-by: Bastian Köcher <git@kchr.de> * Update frame/system/src/lib.rs Co-authored-by: Bastian Köcher <git@kchr.de> * Update frame/system/src/lib.rs Co-authored-by: Bastian Köcher <git@kchr.de> * Update frame/system/src/lib.rs Co-authored-by: Bastian Köcher <git@kchr.de> * Update frame/system/benchmarking/src/lib.rs Co-authored-by: Bastian Köcher <git@kchr.de> * ".git/.scripts/commands/fmt/fmt.sh" * Update README.md Just trigger CI rebuild * Update README.md Trigger CI --------- Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> Co-authored-by: Bastian Köcher <git@kchr.de> Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> Co-authored-by: command-bot <>
This commit is contained in:
committed by
GitHub
parent
05201c4047
commit
0eeaf7709f
@@ -19,6 +19,7 @@
|
||||
|
||||
#![cfg(test)]
|
||||
|
||||
use codec::Encode;
|
||||
use sp_runtime::traits::IdentityLookup;
|
||||
|
||||
type AccountId = u64;
|
||||
@@ -67,7 +68,29 @@ impl frame_system::Config for Test {
|
||||
|
||||
impl crate::Config for Test {}
|
||||
|
||||
struct MockedReadRuntimeVersion(Vec<u8>);
|
||||
|
||||
impl sp_core::traits::ReadRuntimeVersion for MockedReadRuntimeVersion {
|
||||
fn read_runtime_version(
|
||||
&self,
|
||||
_wasm_code: &[u8],
|
||||
_ext: &mut dyn sp_externalities::Externalities,
|
||||
) -> Result<Vec<u8>, String> {
|
||||
Ok(self.0.clone())
|
||||
}
|
||||
}
|
||||
|
||||
pub fn new_test_ext() -> sp_io::TestExternalities {
|
||||
let t = frame_system::GenesisConfig::default().build_storage::<Test>().unwrap();
|
||||
sp_io::TestExternalities::new(t)
|
||||
|
||||
let version = sp_version::RuntimeVersion {
|
||||
spec_name: "spec_name".into(),
|
||||
spec_version: 123,
|
||||
impl_version: 456,
|
||||
..Default::default()
|
||||
};
|
||||
let read_runtime_version = MockedReadRuntimeVersion(version.encode());
|
||||
let mut ext = sp_io::TestExternalities::new(t);
|
||||
ext.register_extension(sp_core::traits::ReadRuntimeVersionExt::new(read_runtime_version));
|
||||
ext
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user