Skip to content

Commit

Permalink
Apply review suggestions.
Browse files Browse the repository at this point in the history
  • Loading branch information
shaunxw committed Jul 27, 2023
1 parent 8d4f62e commit 7482e7b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
14 changes: 7 additions & 7 deletions pallets/xvm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,20 +150,20 @@ impl<T: Config> Pallet<T> {
used_weight: WeightInfoOf::<T>::evm_call_overheads(),
})?;

if skip_execution {
return Ok(CallInfo {
output: vec![],
used_weight: WeightInfoOf::<T>::evm_call_overheads(),
});
}

let value = U256::zero();
// With overheads, less weight is available.
let weight_limit = context
.weight_limit
.saturating_sub(WeightInfoOf::<T>::evm_call_overheads());
let gas_limit = U256::from(T::GasWeightMapping::weight_to_gas(weight_limit));

if skip_execution {
return Ok(CallInfo {
output: vec![],
used_weight: WeightInfoOf::<T>::evm_call_overheads(),
});
}

let transact_result = T::EthereumTransact::xvm_transact(
T::AccountMapping::into_h160(source),
CheckedEthereumTx {
Expand Down
2 changes: 2 additions & 0 deletions precompiles/xvm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ where
Err(f) => f.used_weight,
};
handle.record_cost(R::GasWeightMapping::weight_to_gas(used_weight))?;
handle
.record_external_cost(Some(used_weight.ref_time()), Some(used_weight.proof_size()))?;

match call_result {
Ok(success) => {
Expand Down

0 comments on commit 7482e7b

Please sign in to comment.