-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: update bundler spec tests, update debug send bundle, aa51
- Loading branch information
Showing
10 changed files
with
102 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
crates/mempool/src/validate/simulation/verification_extra_gas.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
use crate::{ | ||
validate::{SimulationCheck, SimulationHelper}, | ||
SimulationError, | ||
}; | ||
use silius_contracts::entry_point::SimulateValidationResult; | ||
use silius_primitives::{constants::validation::simulation::MIN_EXTRA_GAS, UserOperation}; | ||
|
||
#[derive(Clone)] | ||
pub struct VerificationExtraGas; | ||
|
||
impl SimulationCheck for VerificationExtraGas { | ||
/// The [check_user_operation] method implementation validates the needed extra gas. | ||
/// | ||
/// # Arguments | ||
/// `uo` - Not used in this check | ||
/// `helper` - The [SimulationHelper](crate::validate::SimulationHelper) | ||
/// | ||
/// # Returns | ||
/// None if the check passes, otherwise a [SimulationError] error. | ||
fn check_user_operation( | ||
&self, | ||
uo: &UserOperation, | ||
helper: &mut SimulationHelper, | ||
) -> Result<(), SimulationError> { | ||
let pre_op_gas = match helper.simulate_validation_result { | ||
SimulateValidationResult::ValidationResult(res) => res.return_info.0, | ||
SimulateValidationResult::ValidationResultWithAggregation(res) => res.return_info.0, | ||
}; | ||
|
||
let extra_gas = uo.verification_gas_limit - (pre_op_gas - uo.pre_verification_gas); | ||
|
||
if extra_gas.as_u64() < MIN_EXTRA_GAS { | ||
return Err(SimulationError::Validation { | ||
inner: "Verification gas should have extra 2000 gas (has ${extra_gas})".into(), | ||
}); | ||
} | ||
|
||
Ok(()) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters