seal: Add benchmarks for dispatchables (#6715)

* seal: Fix syntax that confuses rust-analyzer

* seal: Add benchmarks for Dispatchables

These are only the benchmarks for the dispatchables of
the pallet. Those are not listed in the Schedule because
we do not want to pull the Schedule from storage before
dispatching.

This OK because those costs are not related to actual contract
execution. Those costs (instruction costs, ext_* costs) will
be benchmarked seperatly and entered into the default Schedule.

* seal: Add a maximum code size

* Fix comments from review

* Removed SEED constant
This commit is contained in:
Alexander Theißen
2020-07-29 12:32:27 +02:00
committed by GitHub
parent e7d8040af8
commit a2163420f4
10 changed files with 315 additions and 23 deletions
+2 -6
View File
@@ -269,16 +269,12 @@ impl ExtBuilder {
/// The fixture files are located under the `fixtures/` directory.
fn compile_module<T>(
fixture_name: &str,
) -> Result<(Vec<u8>, <T::Hashing as Hash>::Output), wabt::Error>
) -> wat::Result<(Vec<u8>, <T::Hashing as Hash>::Output)>
where
T: frame_system::Trait,
{
use std::fs;
let fixture_path = ["fixtures/", fixture_name, ".wat"].concat();
let module_wat_source =
fs::read_to_string(&fixture_path).expect(&format!("Unable to find {} fixture", fixture_name));
let wasm_binary = wabt::wat2wasm(module_wat_source)?;
let wasm_binary = wat::parse_file(fixture_path)?;
let code_hash = T::Hashing::hash(&wasm_binary);
Ok((wasm_binary, code_hash))
}