Skip to content

Commit

Permalink
cargo fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
scf0220 committed Jul 11, 2023
1 parent 664cd04 commit 0331829
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 10 deletions.
14 changes: 7 additions & 7 deletions packages/vm/src/calls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -606,7 +606,7 @@ mod tests {
call_instantiate::<_, _, _, Empty>(&mut instance, &mock_env(), &info, msg)
.unwrap()
.unwrap();
assert_eq!(instance.get_gas_left(),494235049729);
assert_eq!(instance.get_gas_left(), 494235049729);
}

#[test]
Expand All @@ -626,7 +626,7 @@ mod tests {
call_execute::<_, _, _, Empty>(&mut instance, &mock_env(), &info, msg)
.unwrap()
.unwrap();
assert_eq!(instance.get_gas_left(),485686146123);
assert_eq!(instance.get_gas_left(), 485686146123);
}

#[test]
Expand All @@ -645,7 +645,7 @@ mod tests {
let err =
call_execute::<_, _, _, Empty>(&mut instance, &mock_env(), &info, msg).unwrap_err();
assert!(matches!(err, VmError::GasDepletion {}));
assert_eq!(instance.get_gas_left(),0);
assert_eq!(instance.get_gas_left(), 0);
}

#[test]
Expand All @@ -670,7 +670,7 @@ mod tests {
}
err => panic!("Unexpected error: {err:?}"),
}
assert_eq!(instance.get_gas_left(),493100600000);
assert_eq!(instance.get_gas_left(), 493100600000);
}

#[test]
Expand All @@ -693,7 +693,7 @@ mod tests {
}
err => panic!("Unexpected error: {err:?}"),
}
assert_eq!(instance.get_gas_left(),493655750000);
assert_eq!(instance.get_gas_left(), 493655750000);
}

#[test]
Expand All @@ -719,7 +719,7 @@ mod tests {
query_response.as_slice(),
b"{\"verifier\":\"someone else\"}"
);
assert_eq!(instance.get_gas_left(),485028949541);
assert_eq!(instance.get_gas_left(), 485028949541);
}

#[test]
Expand All @@ -738,7 +738,7 @@ mod tests {
let contract_result = call_query(&mut instance, &mock_env(), msg).unwrap();
let query_response = contract_result.unwrap();
assert_eq!(query_response.as_slice(), b"{\"verifier\":\"verifies\"}");
assert_eq!(instance.get_gas_left(),489741349723);
assert_eq!(instance.get_gas_left(), 489741349723);
}

#[cfg(feature = "stargate")]
Expand Down
13 changes: 10 additions & 3 deletions packages/vm/src/instance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -271,9 +271,16 @@ where
env.memory = Some(memory);
env.set_wasmer_instance(Some(instance_ptr));
env.set_gas_left(&mut store, gas_limit);
let remaining_points=wasmer_instance.exports.get_global("wasmer_metering_remaining_points");
let points_exhausted=wasmer_instance.exports.get_global("wasmer_metering_points_exhausted");
env.set_global(remaining_points.unwrap().clone(),points_exhausted.unwrap().clone());
let remaining_points = wasmer_instance
.exports
.get_global("wasmer_metering_remaining_points");
let points_exhausted = wasmer_instance
.exports
.get_global("wasmer_metering_points_exhausted");
env.set_global(
remaining_points.unwrap().clone(),
points_exhausted.unwrap().clone(),
);
env.move_in(backend.storage, backend.querier);
}

Expand Down

0 comments on commit 0331829

Please sign in to comment.