Skip to content

throw if innerHandleOp reverts #17

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 10 additions & 12 deletions src/v07/EntryPoint.sol
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,9 @@ import "account-abstraction/core/UserOperationLib.sol";
import "@openzeppelin/contracts/utils/introspection/ERC165.sol";
import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";

/*
* Account-Abstraction (EIP-4337) singleton EntryPoint implementation.
* Only one instance required on each chain.
*/

/// @custom:security-contact https://bounty.ethereum.org
contract EntryPoint is IEntryPoint, StakeManager, NonceManager, ReentrancyGuard {
// ERC165
// Custom event for bubbling up callphase reverts.
error CallPhaseReverted(bytes reason);

using UserOperationLib for PackedUserOperation;

Expand Down Expand Up @@ -289,10 +284,13 @@ contract EntryPoint is IEntryPoint, StakeManager, NonceManager, ReentrancyGuard
bool success = Exec.call(mUserOp.sender, 0, callData, callGasLimit);
if (!success) {
bytes memory result = Exec.getReturnData(REVERT_REASON_MAX_LEN);
if (result.length > 0) {
emit UserOperationRevertReason(opInfo.userOpHash, mUserOp.sender, mUserOp.nonce, result);
}
mode = IPaymaster.PostOpMode.opReverted;
revert CallPhaseReverted(result);

//bytes memory result = Exec.getReturnData(REVERT_REASON_MAX_LEN);
//if (result.length > 0) {
// emit UserOperationRevertReason(opInfo.userOpHash, mUserOp.sender, mUserOp.nonce, result);
//}
//mode = IPaymaster.PostOpMode.opReverted;
}
}

Expand Down Expand Up @@ -517,7 +515,7 @@ contract EntryPoint is IEntryPoint, StakeManager, NonceManager, ReentrancyGuard

function _accountValidation(uint256 opIndex, PackedUserOperation calldata userOp, UserOpInfo memory outOpInfo)
public
returns (uint256 validationData, uint256 paymasterValidationData, uint256 paymasterVerificationGasLimit)
returns (uint256 validationData, uint256 _paymasterValidationData, uint256 paymasterVerificationGasLimit)
{
uint256 preGas = gasleft();
MemoryUserOp memory mUserOp = outOpInfo.mUserOp;
Expand Down
18 changes: 12 additions & 6 deletions src/v08/EntryPoint.sol
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ import "@openzeppelin/contracts-51/utils/cryptography/EIP712.sol";
* @custom:security-contact https://bounty.ethereum.org
*/
contract EntryPoint is IEntryPoint, StakeManager, NonceManager, ReentrancyGuardTransient, EIP712 {
// Custom event for bubbling up callphase reverts.
error CallPhaseReverted(bytes reason);

using UserOperationLib for PackedUserOperation;

/**
Expand Down Expand Up @@ -189,13 +192,16 @@ contract EntryPoint is IEntryPoint, StakeManager, NonceManager, ReentrancyGuardT
if (callData.length > 0) {
bool success = Exec.call(mUserOp.sender, 0, callData, callGasLimit);
if (!success) {
uint256 freePtr = _getFreePtr();
bytes memory result = Exec.getReturnData(REVERT_REASON_MAX_LEN);
if (result.length > 0) {
emit UserOperationRevertReason(opInfo.userOpHash, mUserOp.sender, mUserOp.nonce, result);
}
_restoreFreePtr(freePtr);
mode = IPaymaster.PostOpMode.opReverted;
revert CallPhaseReverted(result);

//uint256 freePtr = _getFreePtr();
//bytes memory result = Exec.getReturnData(REVERT_REASON_MAX_LEN);
//if (result.length > 0) {
// emit UserOperationRevertReason(opInfo.userOpHash, mUserOp.sender, mUserOp.nonce, result);
//}
//_restoreFreePtr(freePtr);
//mode = IPaymaster.PostOpMode.opReverted;
}
}

Expand Down
Loading