Skip to content

Commit

Permalink
fix(rpc): fix gas estimation error decoding
Browse files Browse the repository at this point in the history
  • Loading branch information
dancoombs committed Jul 20, 2023
1 parent 0f60013 commit a40bdaf
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
4 changes: 3 additions & 1 deletion src/common/types/entry_point_like.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use crate::common::{
i_entry_point::{ExecutionResult, FailedOp, IEntryPoint, SignatureValidationFailed},
shared_types::UserOpsPerAggregator,
},
eth,
eth::{self, ContractRevertError},
gas::GasFees,
types::UserOperation,
};
Expand Down Expand Up @@ -143,6 +143,8 @@ where
Ok(Ok(result))
} else if let Ok(failed_op) = FailedOp::decode(&revert_data) {
Ok(Err(failed_op.reason))
} else if let Ok(err) = ContractRevertError::decode(&revert_data) {
Ok(Err(err.reason))
} else {
Ok(Err(String::new()))
}
Expand Down
5 changes: 3 additions & 2 deletions src/rpc/eth/estimation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ impl<P: ProviderLike, E: EntryPointLike> GasEstimator for GasEstimatorImpl<P, E>
pre_verification_gas,
verification_gas_limit: settings.max_verification_gas.into(),
call_gas_limit: settings.max_call_gas.into(),
max_fee_per_gas: 0.into(),
max_priority_fee_per_gas: 0.into(),
..op.into_user_operation(settings)
};
let verification_future = self.binary_search_verification_gas(&op, block_hash);
Expand Down Expand Up @@ -147,8 +149,7 @@ impl<P: ProviderLike, E: EntryPointLike> GasEstimatorImpl<P, E> {
let run_attempt_returning_error = |gas: u64| async move {
let op = UserOperation {
verification_gas_limit: gas.into(),
call_gas_limit: U256::zero(),
max_fee_per_gas: U256::zero(),
call_gas_limit: 0.into(),
..op.clone()
};
let error_message = self
Expand Down

0 comments on commit a40bdaf

Please sign in to comment.