Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EVM: Refund prepay gas fees for failed EVM tx #2530

Merged
merged 2 commits into from
Oct 4, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions lib/ain-evm/src/executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,10 @@ impl<'backend> AinExecutor<'backend> {
let total_gas_used = self.backend.vicinity.total_gas_used;
let block_gas_limit = self.backend.vicinity.block_gas_limit;
if !system_tx && total_gas_used + U256::from(used_gas) > block_gas_limit {
if !prepay_fee != U256::zero() {
self.backend
.refund_unused_gas_fee(signed_tx, U256::zero(), base_fee)?;
}
return Err(EVMError::BlockSizeLimit(
"Block size limit exceeded, tx cannot make it into the block".to_string(),
));
Expand Down