mirror of
https://github.com/pezkuwichain/wasm-instrument.git
synced 2026-05-30 18:11:05 +00:00
take module as ref in is_deterministic
This commit is contained in:
@@ -17,7 +17,7 @@ fn main() {
|
|||||||
// Loading module
|
// Loading module
|
||||||
let module = parity_wasm::deserialize_file(&args[1]).expect("Module deserialization to succeed");
|
let module = parity_wasm::deserialize_file(&args[1]).expect("Module deserialization to succeed");
|
||||||
|
|
||||||
if wasm_utils::is_deterministic(module) {
|
if wasm_utils::is_deterministic(&module) {
|
||||||
println!("Module is deterministic");
|
println!("Module is deterministic");
|
||||||
} else {
|
} else {
|
||||||
println!("Module is not deterministic");
|
println!("Module is not deterministic");
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ fn have_nondeterministic_opcodes (opcodes: &[Opcode]) -> bool {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
pub fn is_deterministic(module: elements::Module) -> bool {
|
pub fn is_deterministic(module: &elements::Module) -> bool {
|
||||||
for section in module.sections() {
|
for section in module.sections() {
|
||||||
match *section {
|
match *section {
|
||||||
Section::Code(ref cs) => {
|
Section::Code(ref cs) => {
|
||||||
@@ -114,7 +114,7 @@ mod tests {
|
|||||||
.build()
|
.build()
|
||||||
.build()
|
.build()
|
||||||
.build();
|
.build();
|
||||||
assert_eq!(false, is_deterministic(module));
|
assert_eq!(false, is_deterministic(&module));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@@ -133,6 +133,6 @@ mod tests {
|
|||||||
.build()
|
.build()
|
||||||
.build()
|
.build()
|
||||||
.build();
|
.build();
|
||||||
assert_eq!(true, is_deterministic(module));
|
assert_eq!(true, is_deterministic(&module));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user