Allow specifying the module of the imported 'gas' function (#140)

* No need for mem::replace when doing a simple assignment

* Allow specifying the module of the imported 'gas' function

This allows users to place the imported function inside a custom
module instead of the generic 'env' module.
This commit is contained in:
Alexander Theißen
2020-08-04 12:53:53 +02:00
committed by GitHub
parent b61f6dd52f
commit 409ced002a
4 changed files with 18 additions and 14 deletions
+1 -1
View File
@@ -17,7 +17,7 @@ fn main() {
let module = parity_wasm::deserialize_file(&args[1]).expect("Module deserialization to succeed");
let result = utils::inject_gas_counter(
module, &Default::default()
module, &Default::default(), "env"
).expect("Failed to inject gas. Some forbidden opcodes?");
parity_wasm::serialize_to_file(&args[2], result).expect("Module serialization to succeed")