Skip to content

Commit

Permalink
Refactors gas fns arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
grarco committed Mar 22, 2023
1 parent b38c8cb commit c1b77bb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions core/src/ledger/gas.rs
Original file line number Diff line number Diff line change
Expand Up @@ -200,8 +200,8 @@ impl VpGasMeter {
}

impl VpsGas {
/// Set the gas cost from a single VP run.
pub fn set(&mut self, vp_gas_meter: &VpGasMeter) -> Result<()> {
/// Set the gas cost from a single VP run. It consumes the [`VpGasMeter`] instance which shouldn't be accessed passed this point.
pub fn set(&mut self, vp_gas_meter: VpGasMeter) -> Result<()> {
debug_assert_eq!(self.max, None);
debug_assert!(self.rest.is_empty());
self.max = Some(vp_gas_meter.current_gas);
Expand Down
2 changes: 1 addition & 1 deletion shared/src/ledger/protocol/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ where
// Returning error from here will short-circuit the VP parallel
// execution. It's important that we only short-circuit gas
// errors to get deterministic gas costs
result.gas_used.set(&gas_meter).map_err(Error::GasError)?;
result.gas_used.set(gas_meter).map_err(Error::GasError)?;
match accept {
Ok(accepted) => {
if !accepted {
Expand Down

0 comments on commit c1b77bb

Please sign in to comment.