Skip to content

Commit f38aa05

Browse files
authored
Merge pull request #17 from pimlicolabs/fix/update-simulation-contract
throw if innerHandleOp reverts
2 parents aa6232e + ef2ba54 commit f38aa05

File tree

2 files changed

+22
-18
lines changed

2 files changed

+22
-18
lines changed

src/v07/EntryPoint.sol

+10-12
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,9 @@ import "account-abstraction/core/UserOperationLib.sol";
1717
import "@openzeppelin/contracts/utils/introspection/ERC165.sol";
1818
import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
1919

20-
/*
21-
* Account-Abstraction (EIP-4337) singleton EntryPoint implementation.
22-
* Only one instance required on each chain.
23-
*/
24-
25-
/// @custom:security-contact https://bounty.ethereum.org
2620
contract EntryPoint is IEntryPoint, StakeManager, NonceManager, ReentrancyGuard {
27-
// ERC165
21+
// Custom event for bubbling up callphase reverts.
22+
error CallPhaseReverted(bytes reason);
2823

2924
using UserOperationLib for PackedUserOperation;
3025

@@ -289,10 +284,13 @@ contract EntryPoint is IEntryPoint, StakeManager, NonceManager, ReentrancyGuard
289284
bool success = Exec.call(mUserOp.sender, 0, callData, callGasLimit);
290285
if (!success) {
291286
bytes memory result = Exec.getReturnData(REVERT_REASON_MAX_LEN);
292-
if (result.length > 0) {
293-
emit UserOperationRevertReason(opInfo.userOpHash, mUserOp.sender, mUserOp.nonce, result);
294-
}
295-
mode = IPaymaster.PostOpMode.opReverted;
287+
revert CallPhaseReverted(result);
288+
289+
//bytes memory result = Exec.getReturnData(REVERT_REASON_MAX_LEN);
290+
//if (result.length > 0) {
291+
// emit UserOperationRevertReason(opInfo.userOpHash, mUserOp.sender, mUserOp.nonce, result);
292+
//}
293+
//mode = IPaymaster.PostOpMode.opReverted;
296294
}
297295
}
298296

@@ -517,7 +515,7 @@ contract EntryPoint is IEntryPoint, StakeManager, NonceManager, ReentrancyGuard
517515

518516
function _accountValidation(uint256 opIndex, PackedUserOperation calldata userOp, UserOpInfo memory outOpInfo)
519517
public
520-
returns (uint256 validationData, uint256 paymasterValidationData, uint256 paymasterVerificationGasLimit)
518+
returns (uint256 validationData, uint256 _paymasterValidationData, uint256 paymasterVerificationGasLimit)
521519
{
522520
uint256 preGas = gasleft();
523521
MemoryUserOp memory mUserOp = outOpInfo.mUserOp;

src/v08/EntryPoint.sol

+12-6
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ import "@openzeppelin/contracts-51/utils/cryptography/EIP712.sol";
2525
* @custom:security-contact https://bounty.ethereum.org
2626
*/
2727
contract EntryPoint is IEntryPoint, StakeManager, NonceManager, ReentrancyGuardTransient, EIP712 {
28+
// Custom event for bubbling up callphase reverts.
29+
error CallPhaseReverted(bytes reason);
30+
2831
using UserOperationLib for PackedUserOperation;
2932

3033
/**
@@ -189,13 +192,16 @@ contract EntryPoint is IEntryPoint, StakeManager, NonceManager, ReentrancyGuardT
189192
if (callData.length > 0) {
190193
bool success = Exec.call(mUserOp.sender, 0, callData, callGasLimit);
191194
if (!success) {
192-
uint256 freePtr = _getFreePtr();
193195
bytes memory result = Exec.getReturnData(REVERT_REASON_MAX_LEN);
194-
if (result.length > 0) {
195-
emit UserOperationRevertReason(opInfo.userOpHash, mUserOp.sender, mUserOp.nonce, result);
196-
}
197-
_restoreFreePtr(freePtr);
198-
mode = IPaymaster.PostOpMode.opReverted;
196+
revert CallPhaseReverted(result);
197+
198+
//uint256 freePtr = _getFreePtr();
199+
//bytes memory result = Exec.getReturnData(REVERT_REASON_MAX_LEN);
200+
//if (result.length > 0) {
201+
// emit UserOperationRevertReason(opInfo.userOpHash, mUserOp.sender, mUserOp.nonce, result);
202+
//}
203+
//_restoreFreePtr(freePtr);
204+
//mode = IPaymaster.PostOpMode.opReverted;
199205
}
200206
}
201207

0 commit comments

Comments
 (0)