Skip to content

Commit

Permalink
fix: minor logic fix.
Browse files Browse the repository at this point in the history
  • Loading branch information
andysim3d committed Nov 27, 2024
1 parent bf3a0db commit a7b74af
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 38 deletions.
1 change: 0 additions & 1 deletion crates/builder/src/transaction_tracker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -806,7 +806,6 @@ mod tests {
from: Address::ZERO,
to: None,
contract_address: None,
state_root: None,
authorization_list: None,
}))
});
Expand Down
35 changes: 15 additions & 20 deletions crates/provider/src/alloy/entry_point/v0_7.rs
Original file line number Diff line number Diff line change
Expand Up @@ -538,11 +538,11 @@ 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 contract_address = authorization.address.clone();
let contract_address = authorization.address;
add_simulations_7702_override(
&mut override_7702,
contract_address,
op.sender().clone(),
op.sender(),
);
}
op.pack()
Expand All @@ -552,27 +552,22 @@ fn get_handle_ops_call<AP: AlloyProvider<T>, T: Transport + Clone>(
signature: uoa.signature,
})
.collect();
let mut txn_request: TransactionRequest;
if ops_per_aggregator.len() == 1 && ops_per_aggregator[0].aggregator == Address::ZERO {
(
entry_point
.handleOps(ops_per_aggregator.swap_remove(0).userOps, beneficiary)
.gas(gas)
.into_transaction_request()
.transaction_type(alloy_eips::eip7702::constants::EIP7702_TX_TYPE_ID)
.with_authorization_list(authorization_list),
override_7702,
)
txn_request = entry_point
.handleOps(ops_per_aggregator.swap_remove(0).userOps, beneficiary)
.gas(gas)
.into_transaction_request();
} else {
(
entry_point
.handleAggregatedOps(ops_per_aggregator, beneficiary)
.gas(gas)
.into_transaction_request()
.transaction_type(alloy_eips::eip7702::constants::EIP7702_TX_TYPE_ID)
.with_authorization_list(authorization_list),
override_7702,
)
txn_request = entry_point
.handleAggregatedOps(ops_per_aggregator, beneficiary)
.gas(gas)
.into_transaction_request();
}
if !authorization_list.is_empty() {
txn_request = txn_request.with_authorization_list(authorization_list);
}
(txn_request, override_7702)
}

fn decode_validation_revert_payload(err: ErrorPayload) -> ValidationRevert {
Expand Down
1 change: 0 additions & 1 deletion crates/rpc/src/eth/events/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,6 @@ mod tests {
from: Address::ZERO,
to: None,
contract_address: None,
state_root: None,
authorization_list: None,
}
}
Expand Down
10 changes: 6 additions & 4 deletions crates/sim/src/simulation/unsafe_sim.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,12 @@ where
None
};

if validation_result.return_info.account_sig_failed
|| validation_result.return_info.paymaster_sig_failed
{
violations.push(SimulationViolation::InvalidSignature);
if validation_result.return_info.account_sig_failed {
violations.push(SimulationViolation::InvalidAccountSignature);
}

if validation_result.return_info.paymaster_sig_failed {
violations.push(SimulationViolation::InvalidPaymasterSignature);
}

if !violations.is_empty() {
Expand Down
21 changes: 9 additions & 12 deletions crates/types/src/user_operation/v0_6.rs
Original file line number Diff line number Diff line change
Expand Up @@ -475,17 +475,14 @@ impl UserOperationOptionalGas {
super::default_if_none_or_equal(self.verification_gas_limit, max_verification_gas, 0);
let pvg = super::default_if_none_or_equal(self.pre_verification_gas, max_call_gas, 0);

let authorization_tuple = match self.contract_address {
Some(address) => Some(Authorization {
chain_id: chain_spec.id,
address: address,
nonce: 0,
y_parity: 0,
r: U256::from(0),
s: U256::from(0),
}),
None => None,
};
let authorization_tuple = self.contract_address.map(|address| Authorization {
chain_id: chain_spec.id,
address,
nonce: 0,
y_parity: 0,
r: U256::from(0),
s: U256::from(0),
});
let required = UserOperationRequiredFields {
sender: self.sender,
nonce: self.nonce,
Expand All @@ -501,7 +498,7 @@ impl UserOperationOptionalGas {
max_priority_fee_per_gas: self.max_priority_fee_per_gas.unwrap_or_default(),
};
let extended = ExtendedUserOperation {
authorization_tuple: authorization_tuple,
authorization_tuple,
};

UserOperationBuilder::new(chain_spec, required, extended)
Expand Down

0 comments on commit a7b74af

Please sign in to comment.