@@ -5,7 +5,7 @@ pragma solidity ^0.8.28;
5
5
6
6
import "account-abstraction-v8/interfaces/IAccount.sol " ;
7
7
import "account-abstraction-v8/interfaces/IAccountExecute.sol " ;
8
- import "account-abstraction-v8/interfaces /IEntryPoint.sol " ;
8
+ import ". /IEntryPoint.sol " ;
9
9
import "account-abstraction-v8/interfaces/IPaymaster.sol " ;
10
10
11
11
import "account-abstraction-v8/core/UserOperationLib.sol " ;
@@ -17,15 +17,14 @@ import "./Eip7702Support.sol";
17
17
import "account-abstraction-v8/utils/Exec.sol " ;
18
18
19
19
import "@openzeppelin/contracts-51/utils/ReentrancyGuardTransient.sol " ;
20
- import "@openzeppelin/contracts-51/utils/introspection/ERC165.sol " ;
21
20
import "@openzeppelin/contracts-51/utils/cryptography/EIP712.sol " ;
22
21
23
22
/**
24
23
* Account-Abstraction (EIP-4337) singleton EntryPoint v0.8 implementation.
25
24
* Only one instance required on each chain.
26
25
* @custom:security-contact https://bounty.ethereum.org
27
26
*/
28
- contract EntryPoint is IEntryPoint , StakeManager , NonceManager , ReentrancyGuardTransient , ERC165 , EIP712 {
27
+ contract EntryPoint is IEntryPoint , StakeManager , NonceManager , ReentrancyGuardTransient , EIP712 {
29
28
using UserOperationLib for PackedUserOperation;
30
29
31
30
/**
@@ -52,110 +51,19 @@ contract EntryPoint is IEntryPoint, StakeManager, NonceManager, ReentrancyGuardT
52
51
53
52
constructor () EIP712 (DOMAIN_NAME, DOMAIN_VERSION) {}
54
53
55
- /// @inheritdoc IEntryPoint
56
- function handleOps (PackedUserOperation[] calldata ops , address payable beneficiary ) external nonReentrant {
57
- uint256 opslen = ops.length ;
58
- UserOpInfo[] memory opInfos = new UserOpInfo [](opslen);
59
- unchecked {
60
- _iterateValidationPhase (ops, opInfos, address (0 ), 0 );
61
-
62
- uint256 collected = 0 ;
63
- emit BeforeExecution ();
64
-
65
- for (uint256 i = 0 ; i < opslen; i++ ) {
66
- uint256 paymasterPostOpGasLimit;
67
- uint256 _collected;
68
- (_collected, paymasterPostOpGasLimit) = _executeUserOp (i, ops[i], opInfos[i]);
69
- collected += _collected;
70
- }
71
-
72
- _compensate (beneficiary, collected);
73
- }
74
- }
75
-
76
- /// @inheritdoc IEntryPoint
77
- function handleAggregatedOps (UserOpsPerAggregator[] calldata opsPerAggregator , address payable beneficiary )
78
- external
79
- nonReentrant
80
- {
81
- unchecked {
82
- uint256 opasLen = opsPerAggregator.length ;
83
- uint256 totalOps = 0 ;
84
- for (uint256 i = 0 ; i < opasLen; i++ ) {
85
- UserOpsPerAggregator calldata opa = opsPerAggregator[i];
86
- PackedUserOperation[] calldata ops = opa.userOps;
87
- IAggregator aggregator = opa.aggregator;
88
-
89
- // address(1) is special marker of "signature error"
90
- require (address (aggregator) != address (1 ), SignatureValidationFailed (address (aggregator)));
91
-
92
- if (address (aggregator) != address (0 )) {
93
- // solhint-disable-next-line no-empty-blocks
94
- try aggregator.validateSignatures (ops, opa.signature) {}
95
- catch {
96
- revert SignatureValidationFailed (address (aggregator));
97
- }
98
- }
99
-
100
- totalOps += ops.length ;
101
- }
102
-
103
- UserOpInfo[] memory opInfos = new UserOpInfo [](totalOps);
104
-
105
- uint256 opIndex = 0 ;
106
- for (uint256 a = 0 ; a < opasLen; a++ ) {
107
- UserOpsPerAggregator calldata opa = opsPerAggregator[a];
108
- PackedUserOperation[] calldata ops = opa.userOps;
109
- IAggregator aggregator = opa.aggregator;
110
-
111
- opIndex += _iterateValidationPhase (ops, opInfos, address (aggregator), opIndex);
112
- }
113
-
114
- emit BeforeExecution ();
115
-
116
- uint256 collected = 0 ;
117
- opIndex = 0 ;
118
- for (uint256 a = 0 ; a < opasLen; a++ ) {
119
- UserOpsPerAggregator calldata opa = opsPerAggregator[a];
120
- emit SignatureAggregatorChanged (address (opa.aggregator));
121
- PackedUserOperation[] calldata ops = opa.userOps;
122
- uint256 opslen = ops.length ;
123
-
124
- for (uint256 i = 0 ; i < opslen; i++ ) {
125
- uint256 paymasterPostOpGasLimit;
126
- uint256 _collected;
127
- (_collected, paymasterPostOpGasLimit) = _executeUserOp (opIndex, ops[i], opInfos[opIndex]);
128
- collected += _collected;
129
- opIndex++ ;
130
- }
131
- }
132
-
133
- _compensate (beneficiary, collected);
134
- }
135
- }
136
-
137
54
/// @inheritdoc IEntryPoint
138
55
function getUserOpHash (PackedUserOperation calldata userOp ) public view returns (bytes32 ) {
139
56
bytes32 overrideInitCodeHash = Eip7702Support._getEip7702InitCodeHashOverride (userOp);
140
57
return MessageHashUtils.toTypedDataHash (getDomainSeparatorV4 (), userOp.hash (overrideInitCodeHash));
141
58
}
142
59
143
- /// @inheritdoc IEntryPoint
144
- function getSenderAddress (bytes calldata initCode ) external {
145
- address sender = senderCreator ().createSender (initCode);
146
- revert SenderAddressResult (sender);
147
- }
148
-
149
60
/// @inheritdoc IEntryPoint
150
61
function senderCreator () public view virtual returns (ISenderCreator) {
151
62
return _senderCreator;
152
63
}
153
64
154
65
/// @inheritdoc IEntryPoint
155
- function delegateAndRevert (address target , bytes calldata data ) external {
156
- (bool success , bytes memory ret ) = target.delegatecall (data);
157
- revert DelegateAndRevert (success, ret);
158
- }
66
+ function delegateAndRevert (address target , bytes calldata data ) external {}
159
67
160
68
function getPackedUserOpTypeHash () external pure returns (bytes32 ) {
161
69
return UserOperationLib.PACKED_USEROP_TYPEHASH;
@@ -165,26 +73,6 @@ contract EntryPoint is IEntryPoint, StakeManager, NonceManager, ReentrancyGuardT
165
73
return _domainSeparatorV4 ();
166
74
}
167
75
168
- /// @inheritdoc IERC165
169
- function supportsInterface (bytes4 interfaceId ) public view virtual override returns (bool ) {
170
- // note: solidity "type(IEntryPoint).interfaceId" is without inherited methods but we want to check everything
171
- return interfaceId
172
- == (type (IEntryPoint).interfaceId ^ type (IStakeManager).interfaceId ^ type (INonceManager).interfaceId)
173
- || interfaceId == type (IEntryPoint).interfaceId || interfaceId == type (IStakeManager).interfaceId
174
- || interfaceId == type (INonceManager).interfaceId || super .supportsInterface (interfaceId);
175
- }
176
-
177
- /**
178
- * Compensate the caller's beneficiary address with the collected fees of all UserOperations.
179
- * @param beneficiary - The address to receive the fees.
180
- * @param amount - Amount to transfer.
181
- */
182
- function _compensate (address payable beneficiary , uint256 amount ) internal virtual {
183
- require (beneficiary != address (0 ), "AA90 invalid beneficiary " );
184
- (bool success ,) = beneficiary.call {value: amount}("" );
185
- require (success, "AA91 failed send to beneficiary " );
186
- }
187
-
188
76
/**
189
77
* Execute a user operation.
190
78
* @param opIndex - Index into the opInfo array.
@@ -251,35 +139,6 @@ contract EntryPoint is IEntryPoint, StakeManager, NonceManager, ReentrancyGuardT
251
139
emit UserOperationPrefundTooLow (opInfo.userOpHash, opInfo.mUserOp.sender, opInfo.mUserOp.nonce);
252
140
}
253
141
254
- /**
255
- * Iterate over calldata PackedUserOperation array and perform account and paymaster validation.
256
- * @notice UserOpInfo is a global array of all UserOps while PackedUserOperation is grouped per aggregator.
257
- *
258
- * @param ops - an array of UserOps to be validated
259
- * @param opInfos - an array of UserOp metadata being read and filled in during this function's execution
260
- * @param expectedAggregator - an address of the aggregator specified for a given UserOp if any, or address(0)
261
- * @param opIndexOffset - an offset for the index between 'ops' and 'opInfos' arrays, see the notice.
262
- * @return opsLen - processed UserOps (length of "ops" array)
263
- */
264
- function _iterateValidationPhase (
265
- PackedUserOperation[] calldata ops ,
266
- UserOpInfo[] memory opInfos ,
267
- address expectedAggregator ,
268
- uint256 opIndexOffset
269
- ) internal returns (uint256 opsLen ) {
270
- unchecked {
271
- opsLen = ops.length ;
272
- for (uint256 i = 0 ; i < opsLen; i++ ) {
273
- UserOpInfo memory opInfo = opInfos[opIndexOffset + i];
274
- (uint256 validationData , uint256 pmValidationData ,) =
275
- _validatePrepayment (opIndexOffset + i, ops[i], opInfo);
276
- _validateAccountAndPaymasterValidationData (
277
- opIndexOffset + i, validationData, pmValidationData, expectedAggregator
278
- );
279
- }
280
- }
281
- }
282
-
283
142
/**
284
143
* A memory copy of UserOp static fields only.
285
144
* Excluding: callData, initCode and signature. Replacing paymasterAndData with paymaster.
0 commit comments