Skip to content

Commit

Permalink
Fix clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
boundless-forest committed Nov 3, 2023
1 parent 03fbe8e commit 6db59d1
Showing 1 changed file with 20 additions and 21 deletions.
41 changes: 20 additions & 21 deletions frame/evm/src/runner/stack.rs
Original file line number Diff line number Diff line change
Expand Up @@ -982,18 +982,18 @@ where
.try_record_proof_size_or_fail(ACCOUNT_CODES_METADATA_PROOF_SIZE)?;
if let Some(meta) = <AccountCodesMetadata<T>>::get(address) {
weight_info.try_record_proof_size_or_fail(meta.size)?;
} else {
if let Some(remaining_proof_size) = weight_info.remaining_proof_size() {
let pre_size = remaining_proof_size.min(size_limit);
weight_info.try_record_proof_size_or_fail(pre_size)?;

let actual_size = Pallet::<T>::account_code_metadata(address).size;
if actual_size > pre_size {
return Err(ExitError::OutOfGas);
}
// Refund unused proof size
weight_info.refund_proof_size(pre_size.saturating_sub(actual_size));
} else if let Some(remaining_proof_size) =
weight_info.remaining_proof_size()
{
let pre_size = remaining_proof_size.min(size_limit);
weight_info.try_record_proof_size_or_fail(pre_size)?;

let actual_size = Pallet::<T>::account_code_metadata(address).size;
if actual_size > pre_size {
return Err(ExitError::OutOfGas);
}
// Refund unused proof size
weight_info.refund_proof_size(pre_size.saturating_sub(actual_size));
}
recorded.account_codes.push(address);
}
Expand Down Expand Up @@ -1062,19 +1062,18 @@ where

if let Some(meta) = <AccountCodesMetadata<T>>::get(address) {
weight_info.try_record_proof_size_or_fail(meta.size)?;
} else {
if let Some(remaining_proof_size) = weight_info.remaining_proof_size() {
let pre_size = remaining_proof_size.min(size_limit);
weight_info.try_record_proof_size_or_fail(pre_size)?;
} else if let Some(remaining_proof_size) = weight_info.remaining_proof_size() {
let pre_size = remaining_proof_size.min(size_limit);
weight_info.try_record_proof_size_or_fail(pre_size)?;

let actual_size = Pallet::<T>::account_code_metadata(address).size;
if actual_size > pre_size {
return Err(ExitError::OutOfGas);
}
// Refund unused proof size
weight_info.refund_proof_size(pre_size.saturating_sub(actual_size));
let actual_size = Pallet::<T>::account_code_metadata(address).size;
if actual_size > pre_size {
return Err(ExitError::OutOfGas);
}
// Refund unused proof size
weight_info.refund_proof_size(pre_size.saturating_sub(actual_size));
}

Ok(())
};

Expand Down

0 comments on commit 6db59d1

Please sign in to comment.