Bump wasm-instrument (#12234)

* Bump wasm-instrument

* Fix benchmarks
This commit is contained in:
Alexander Theißen
2022-09-15 08:00:11 +02:00
committed by GitHub
parent 4a3c70ecae
commit 4a6e78b8df
6 changed files with 11 additions and 11 deletions
+2 -2
View File
@@ -11578,9 +11578,9 @@ dependencies = [
[[package]]
name = "wasm-instrument"
version = "0.2.0"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8bca81f5279342b38b17d9acbf007a46ddeb73144e2bd5f0a21bfa9fc5d4ab3e"
checksum = "aa1dafb3e60065305741e83db35c6c2584bb3725b692b5b66148a38d72ace6cd"
dependencies = [
"parity-wasm 0.45.0",
]
+1 -1
View File
@@ -17,7 +17,7 @@ targets = ["x86_64-unknown-linux-gnu"]
codec = { package = "parity-scale-codec", version = "3.0.0" }
environmental = "1.1.3"
thiserror = "1.0.30"
wasm-instrument = "0.2"
wasm-instrument = "0.3"
wasmer = { version = "2.2", features = ["singlepass"], optional = true }
wasmi = "0.13"
sc-allocator = { version = "4.1.0-dev", path = "../../allocator" }
+1 -1
View File
@@ -20,7 +20,7 @@ codec = { package = "parity-scale-codec", version = "3.0.0", default-features =
] }
scale-info = { version = "2.1.1", default-features = false, features = ["derive"] }
log = { version = "0.4", default-features = false }
wasm-instrument = { version = "0.2", default-features = false }
wasm-instrument = { version = "0.3", default-features = false }
serde = { version = "1", optional = true, features = ["derive"] }
smallvec = { version = "1", default-features = false, features = [
"const_generics",
@@ -618,11 +618,11 @@ benchmarks! {
imported_functions: vec![ImportedFunction {
module: "seal0",
name: "gas",
params: vec![ValueType::I32],
params: vec![ValueType::I64],
return_type: None,
}],
call_body: Some(body::repeated(r * API_BENCHMARK_BATCH_SIZE, &[
Instruction::I32Const(42),
Instruction::I64Const(42),
Instruction::Call(0),
])),
.. Default::default()
+1 -1
View File
@@ -525,7 +525,7 @@ impl<T: Config> Default for InstructionWeights<T> {
fn default() -> Self {
let max_pages = Limits::default().memory_pages;
Self {
version: 2,
version: 3,
i64const: cost_instr!(instr_i64const, 1),
i64load: cost_instr!(instr_i64load, 2),
i64store: cost_instr!(instr_i64store, 2),
@@ -164,7 +164,7 @@ impl<T: Into<DispatchError>> From<T> for TrapReason {
pub enum RuntimeCosts {
/// Charge the gas meter with the cost of a metering block. The charged costs are
/// the supplied cost of the block plus the overhead of the metering itself.
MeteringBlock(u32),
MeteringBlock(u64),
/// Weight charged for copying data from the sandbox.
CopyFromContract(u32),
/// Weight charged for copying data to the sandbox.
@@ -261,7 +261,7 @@ impl RuntimeCosts {
{
use self::RuntimeCosts::*;
let weight = match *self {
MeteringBlock(amount) => s.gas.saturating_add(amount.into()),
MeteringBlock(amount) => s.gas.saturating_add(amount),
CopyFromContract(len) => s.return_per_byte.saturating_mul(len.into()),
CopyToContract(len) => s.input_per_byte.saturating_mul(len.into()),
Caller => s.caller,
@@ -957,7 +957,7 @@ pub mod env {
/// This call is supposed to be called only by instrumentation injected code.
///
/// - amount: How much gas is used.
fn gas(ctx: Runtime<E>, amount: u32) -> Result<(), TrapReason> {
fn gas(ctx: Runtime<E>, amount: u64) -> Result<(), TrapReason> {
ctx.charge_gas(RuntimeCosts::MeteringBlock(amount))?;
Ok(())
}
@@ -1737,7 +1737,7 @@ pub mod env {
#[prefixed_alias]
fn gas_left(ctx: Runtime<E>, out_ptr: u32, out_len_ptr: u32) -> Result<(), TrapReason> {
ctx.charge_gas(RuntimeCosts::GasLeft)?;
let gas_left = &ctx.ext.gas_meter().gas_left().encode();
let gas_left = &ctx.ext.gas_meter().gas_left().ref_time().encode();
Ok(ctx.write_sandbox_output(out_ptr, out_len_ptr, gas_left, false, already_charged)?)
}