Skip to content

Commit 8a3233f

Browse files
authored
feat: remove paymaster during call gas estimation (#1130)
1 parent c72709b commit 8a3233f

File tree

4 files changed

+17
-0
lines changed

4 files changed

+17
-0
lines changed

crates/sim/src/estimation/v0_6.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -433,6 +433,7 @@ impl CallGasEstimatorSpecialization for CallGasEstimatorSpecializationV06 {
433433

434434
fn get_op_with_no_call_gas(&self, op: Self::UO) -> Self::UO {
435435
UserOperationBuilder::from_uo(op, &self.chain_spec)
436+
.clear_paymaster()
436437
.call_gas_limit(0)
437438
.max_fee_per_gas(0)
438439
.build()

crates/sim/src/estimation/v0_7.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -508,6 +508,7 @@ impl CallGasEstimatorSpecialization for CallGasEstimatorSpecializationV07 {
508508

509509
fn get_op_with_no_call_gas(&self, op: Self::UO) -> Self::UO {
510510
UserOperationBuilder::from_uo(op, &self.chain_spec)
511+
.clear_paymaster()
511512
.call_gas_limit(0)
512513
.max_fee_per_gas(0)
513514
.build()

crates/types/src/user_operation/v0_6.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -884,6 +884,12 @@ impl<'a> UserOperationBuilder<'a> {
884884
self
885885
}
886886

887+
/// Clears the paymaster and data
888+
pub fn clear_paymaster(mut self) -> Self {
889+
self.required.paymaster_and_data = Bytes::new();
890+
self
891+
}
892+
887893
/// Build the user operation
888894
pub fn build(self) -> UserOperation {
889895
let mut uo = UserOperation {

crates/types/src/user_operation/v0_7.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -900,6 +900,15 @@ impl<'a> UserOperationBuilder<'a> {
900900
self
901901
}
902902

903+
/// Clears the paymaster and associated fields
904+
pub fn clear_paymaster(mut self) -> Self {
905+
self.paymaster = None;
906+
self.paymaster_verification_gas_limit = 0;
907+
self.paymaster_post_op_gas_limit = 0;
908+
self.paymaster_data = Bytes::new();
909+
self
910+
}
911+
903912
/// Sets the pre-verification gas
904913
pub fn pre_verification_gas(mut self, pre_verification_gas: u128) -> Self {
905914
self.required.pre_verification_gas = pre_verification_gas;

0 commit comments

Comments
 (0)