Skip to content

Commit

Permalink
fix: remove override for handle_ops call.
Browse files Browse the repository at this point in the history
  • Loading branch information
andysim3d committed Dec 13, 2024
1 parent bf62c97 commit 54af9bb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 36 deletions.
22 changes: 5 additions & 17 deletions crates/provider/src/alloy/entry_point/v0_6.rs
Original file line number Diff line number Diff line change
Expand Up @@ -235,18 +235,13 @@ where
gas_limit: Option<u64>,
) -> ProviderResult<HandleOpsOut> {
let gas_limit = gas_limit.unwrap_or(self.max_simulate_handle_op_gas);
let (tx, override_7702) = get_handle_ops_call(
let tx = get_handle_ops_call(
&self.i_entry_point,
ops_per_aggregator,
beneficiary,
gas_limit,
);
let res = self
.i_entry_point
.provider()
.call(&tx)
.overrides(&override_7702)
.await;
let res = self.i_entry_point.provider().call(&tx).await;

match res {
Ok(_) => return Ok(HandleOpsOut::Success),
Expand Down Expand Up @@ -304,7 +299,7 @@ where
gas_limit: u64,
gas_fees: GasFees,
) -> TransactionRequest {
let (tx, _) = get_handle_ops_call(
let tx = get_handle_ops_call(
&self.i_entry_point,
ops_per_aggregator,
beneficiary,
Expand Down Expand Up @@ -534,8 +529,7 @@ fn get_handle_ops_call<AP: AlloyProvider<T>, T: Transport + Clone>(
ops_per_aggregator: Vec<UserOpsPerAggregator<UserOperation>>,
beneficiary: Address,
gas: u64,
) -> (TransactionRequest, StateOverride) {
let mut override_7702 = StateOverride::default();
) -> TransactionRequest {
let mut authorization_list: Vec<SignedAuthorization> = vec![];
let mut ops_per_aggregator: Vec<UserOpsPerAggregatorV0_6> = ops_per_aggregator
.into_iter()
Expand All @@ -546,12 +540,6 @@ fn get_handle_ops_call<AP: AlloyProvider<T>, T: Transport + Clone>(
.map(|op| {
if let Some(authorization) = &op.authorization_tuple {
authorization_list.push(SignedAuthorization::from(authorization.clone()));
let authorization_contract = authorization.address;
authorization_utils::apply_7702_overrides(
&mut override_7702,
op.sender(),
authorization_contract,
);
}
op.into()
})
Expand All @@ -576,7 +564,7 @@ fn get_handle_ops_call<AP: AlloyProvider<T>, T: Transport + Clone>(
if !authorization_list.is_empty() {
txn_request = txn_request.with_authorization_list(authorization_list);
}
(txn_request, override_7702)
txn_request
}

impl TryFrom<ExecutionResultV0_6> for ExecutionResult {
Expand Down
24 changes: 5 additions & 19 deletions crates/provider/src/alloy/entry_point/v0_7.rs
Original file line number Diff line number Diff line change
Expand Up @@ -245,19 +245,13 @@ where
gas_limit: Option<u64>,
) -> ProviderResult<HandleOpsOut> {
let gas_limit = gas_limit.unwrap_or(self.max_simulate_handle_ops_gas);
let (tx, override_7702) = get_handle_ops_call(
let tx = get_handle_ops_call(
&self.i_entry_point,
ops_per_aggregator,
beneficiary,
gas_limit,
);

let res = self
.i_entry_point
.provider()
.call(&tx)
.overrides(&override_7702)
.await;
let res = self.i_entry_point.provider().call(&tx).await;

match res {
Ok(_) => return Ok(HandleOpsOut::Success),
Expand Down Expand Up @@ -299,8 +293,7 @@ where
gas: u64,
gas_fees: GasFees,
) -> TransactionRequest {
let (tx, _) =
get_handle_ops_call(&self.i_entry_point, ops_per_aggregator, beneficiary, gas);
let tx = get_handle_ops_call(&self.i_entry_point, ops_per_aggregator, beneficiary, gas);
tx.max_fee_per_gas(gas_fees.max_fee_per_gas)
.max_priority_fee_per_gas(gas_fees.max_priority_fee_per_gas)
}
Expand Down Expand Up @@ -511,8 +504,7 @@ fn get_handle_ops_call<AP: AlloyProvider<T>, T: Transport + Clone>(
ops_per_aggregator: Vec<UserOpsPerAggregator<UserOperation>>,
beneficiary: Address,
gas: u64,
) -> (TransactionRequest, StateOverride) {
let mut override_7702 = StateOverride::default();
) -> TransactionRequest {
let mut authorization_list: Vec<SignedAuthorization> = vec![];
let mut ops_per_aggregator: Vec<UserOpsPerAggregatorV0_7> = ops_per_aggregator
.into_iter()
Expand All @@ -523,12 +515,6 @@ fn get_handle_ops_call<AP: AlloyProvider<T>, T: Transport + Clone>(
.map(|op| {
if let Some(authorization) = &op.authorization_tuple {
authorization_list.push(SignedAuthorization::from(authorization.clone()));
let authorization_contract = authorization.address;
authorization_utils::apply_7702_overrides(
&mut override_7702,
op.sender(),
authorization_contract,
);
}
op.pack()
})
Expand All @@ -552,7 +538,7 @@ fn get_handle_ops_call<AP: AlloyProvider<T>, T: Transport + Clone>(
if !authorization_list.is_empty() {
txn_request = txn_request.with_authorization_list(authorization_list);
}
(txn_request, override_7702)
txn_request
}

fn decode_validation_revert_payload(err: ErrorPayload) -> ValidationRevert {
Expand Down

0 comments on commit 54af9bb

Please sign in to comment.