fix: Remove extra return when init uses too much gas (#7521)

This commit is contained in:
Omid Chenane
2024-04-09 17:13:58 +03:30
committed by GitHub
parent 5efe17370f
commit e43b2f4829

View File

@ -344,7 +344,7 @@ where
};
env.tx.gas_limit = mid_gas_limit;
let ethres = self.transact(&mut db, env);
let ethres = self.transact(&mut db, env.clone());
// Exceptional case: init used too much gas, we need to increase the gas limit and try
// again
@ -354,21 +354,16 @@ where
) {
// increase the lowest gas limit
lowest_gas_limit = mid_gas_limit;
// new midpoint
mid_gas_limit = ((highest_gas_limit as u128 + lowest_gas_limit as u128) / 2) as u64;
(_, env) = ethres?;
continue
} else {
(res, env) = ethres?;
update_estimated_gas_range(
res.result,
mid_gas_limit,
&mut highest_gas_limit,
&mut lowest_gas_limit,
)?;
}
(res, env) = ethres?;
update_estimated_gas_range(
res.result,
mid_gas_limit,
&mut highest_gas_limit,
&mut lowest_gas_limit,
)?;
// new midpoint
mid_gas_limit = ((highest_gas_limit as u128 + lowest_gas_limit as u128) / 2) as u64;
}