mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-27 03:27:58 +00:00
Better handling of stable-only build (#6569)
* Better handling of stable-only build * Fix node template build * Fix wasm builder node-template version mismatch * Fix load_spec error * Add , in parameter * Add descrptive panic messages in tests * Add descriptive tests in node/executor benches * Fix missing compact_code_unwrap * Add missing wasm_binary_unwrap function for executor integration test * Only define import_sp_io in no_std * Small Cargo.toml styling fix * Bump wasm-builder to 2.0.0 * Fix all `with_wasm_builder_from_crates` version in Substrate * Use `with_wasm_builder_from_crates` for node-template Co-authored-by: Gavin Wood <gavin@parity.io>
This commit is contained in:
@@ -36,7 +36,10 @@ criterion_group!(benches, bench_execute_block);
|
||||
criterion_main!(benches);
|
||||
|
||||
/// The wasm runtime code.
|
||||
const COMPACT_CODE: &[u8] = node_runtime::WASM_BINARY;
|
||||
pub fn compact_code_unwrap() -> &'static [u8] {
|
||||
node_runtime::WASM_BINARY.expect("Development wasm binary is not available. \
|
||||
Testing is only supported with the flag disabled.")
|
||||
}
|
||||
|
||||
const GENESIS_HASH: [u8; 32] = [69u8; 32];
|
||||
|
||||
@@ -60,7 +63,7 @@ fn sign(xt: CheckedExtrinsic) -> UncheckedExtrinsic {
|
||||
|
||||
fn new_test_ext(genesis_config: &GenesisConfig) -> TestExternalities<BlakeTwo256> {
|
||||
let mut test_ext = TestExternalities::new_with_code(
|
||||
COMPACT_CODE,
|
||||
compact_code_unwrap(),
|
||||
genesis_config.build_storage().unwrap(),
|
||||
);
|
||||
test_ext.ext().place_storage(well_known_keys::HEAP_PAGES.to_vec(), Some(HEAP_PAGES.encode()));
|
||||
@@ -94,7 +97,7 @@ fn construct_block<E: Externalities>(
|
||||
};
|
||||
|
||||
let runtime_code = RuntimeCode {
|
||||
code_fetcher: &sp_core::traits::WrappedRuntimeCode(COMPACT_CODE.into()),
|
||||
code_fetcher: &sp_core::traits::WrappedRuntimeCode(compact_code_unwrap().into()),
|
||||
hash: vec![1, 2, 3],
|
||||
heap_pages: None,
|
||||
};
|
||||
@@ -168,7 +171,7 @@ fn bench_execute_block(c: &mut Criterion) {
|
||||
c.bench_function_over_inputs(
|
||||
"execute blocks",
|
||||
|b, strategy| {
|
||||
let genesis_config = node_testing::genesis::config(false, Some(COMPACT_CODE));
|
||||
let genesis_config = node_testing::genesis::config(false, Some(compact_code_unwrap()));
|
||||
let (use_native, wasm_method) = match strategy {
|
||||
ExecutionMethod::Native => (true, WasmExecutionMethod::Interpreted),
|
||||
ExecutionMethod::Wasm(wasm_method) => (false, *wasm_method),
|
||||
@@ -176,7 +179,7 @@ fn bench_execute_block(c: &mut Criterion) {
|
||||
|
||||
let executor = NativeExecutor::new(wasm_method, None, 8);
|
||||
let runtime_code = RuntimeCode {
|
||||
code_fetcher: &sp_core::traits::WrappedRuntimeCode(COMPACT_CODE.into()),
|
||||
code_fetcher: &sp_core::traits::WrappedRuntimeCode(compact_code_unwrap().into()),
|
||||
hash: vec![1, 2, 3],
|
||||
heap_pages: None,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user