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 authored and GitHub committed 2020-08-04 13:53:53 +03:00
1 parent b61f6dd52f
commit 409ced002a
4 files changed
+18 -14

No files matched your search

+2 -1
View File
@@ -110,7 +110,8 @@ mod gas {
let rules = utils::rules::Set::default();
let module = elements::deserialize_buffer(input).expect("Failed to deserialize");
let instrumented = utils::inject_gas_counter(module, &rules).expect("Failed to instrument with gas metering");
let instrumented = utils::inject_gas_counter(module, &rules, "env")
.expect("Failed to instrument with gas metering");
elements::serialize(instrumented).expect("Failed to serialize")
});
}