-
Notifications
You must be signed in to change notification settings - Fork 670
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
AA-184: Remove second postOp retry #311
Changes from all commits
ebbf21a
64cbdf6
d43bc94
105d122
3a6b0a5
66688cb
b56ef7b
74ed53b
649daf8
aa20d5d
e3111fe
10f0502
6a5ce09
8116f81
74a3c37
f96de6c
4b76a32
8903ae1
ce519f6
9bd5263
a218f79
318a7ac
0f24290
83cb4e2
53eda99
ba64217
30d24ac
ea127b7
3f93724
d140003
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -100,7 +100,7 @@ contract EntryPoint is IEntryPoint, StakeManager, NonceManager, ReentrancyGuard, | |
} | ||
|
||
uint256 actualGas = preGas - gasleft() + opInfo.preOpGas; | ||
collected = _handlePostOp( | ||
collected = _postExecution( | ||
opIndex, | ||
IPaymaster.PostOpMode.postOpReverted, | ||
opInfo, | ||
|
@@ -290,7 +290,7 @@ contract EntryPoint is IEntryPoint, StakeManager, NonceManager, ReentrancyGuard, | |
unchecked { | ||
uint256 actualGas = preGas - gasleft() + opInfo.preOpGas; | ||
// Note: opIndex is ignored (relevant only if mode==postOpReverted, which is only possible outside of innerHandleOp) | ||
return _handlePostOp(0, mode, opInfo, context, actualGas); | ||
return _postExecution(0, mode, opInfo, context, actualGas); | ||
} | ||
} | ||
|
||
|
@@ -340,7 +340,7 @@ contract EntryPoint is IEntryPoint, StakeManager, NonceManager, ReentrancyGuard, | |
unchecked { | ||
// When using a Paymaster, the verificationGasLimit is used also to as a limit for the postOp call. | ||
// Our security model might call postOp eventually twice. | ||
uint256 mul = mUserOp.paymaster != address(0) ? 3 : 1; | ||
uint256 mul = mUserOp.paymaster != address(0) ? 2 : 1; | ||
uint256 requiredGas = mUserOp.callGasLimit + | ||
mUserOp.verificationGasLimit * | ||
mul + | ||
|
@@ -640,7 +640,7 @@ contract EntryPoint is IEntryPoint, StakeManager, NonceManager, ReentrancyGuard, | |
* @param context - The context returned in validatePaymasterUserOp. | ||
* @param actualGas - The gas used so far by this user operation. | ||
*/ | ||
function _handlePostOp( | ||
function _postExecution( | ||
uint256 opIndex, | ||
IPaymaster.PostOpMode mode, | ||
UserOpInfo memory opInfo, | ||
|
@@ -664,20 +664,6 @@ contract EntryPoint is IEntryPoint, StakeManager, NonceManager, ReentrancyGuard, | |
IPaymaster(paymaster).postOp{ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. in case the PostOp reverts, the "outer" postExecution will report the error (success=false), but there is no indication that it was a paymaster (postOp) that reverted, instead of user-code that reverted. |
||
gas: mUserOp.verificationGasLimit | ||
}(mode, context, actualGasCost); | ||
} else { | ||
try | ||
IPaymaster(paymaster).postOp{ | ||
gas: mUserOp.verificationGasLimit | ||
}(mode, context, actualGasCost) | ||
// solhint-disable-next-line no-empty-blocks | ||
{} catch Error(string memory reason) { | ||
revert FailedOp( | ||
opIndex, | ||
string.concat("AA50 postOp reverted: ", reason) | ||
); | ||
} catch { | ||
revert FailedOp(opIndex, "AA50 postOp revert"); | ||
} | ||
} | ||
} | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -150,10 +150,9 @@ contract TokenPaymaster is BasePaymaster, UniswapHelper, OracleHelper { | |
|
||
/// @notice Performs post-operation tasks, such as updating the token price and refunding excess tokens. | ||
/// @dev This function is called after a user operation has been executed or reverted. | ||
/// @param mode The post-operation mode (either successful or reverted). | ||
/// @param context The context containing the token amount and user sender address. | ||
/// @param actualGasCost The actual gas cost of the transaction. | ||
function _postOp(PostOpMode mode, bytes calldata context, uint256 actualGasCost) internal override { | ||
function _postOp(PostOpMode, bytes calldata context, uint256 actualGasCost) internal override { | ||
unchecked { | ||
uint256 priceMarkup = tokenPaymasterConfig.priceMarkup; | ||
( | ||
|
@@ -163,11 +162,6 @@ contract TokenPaymaster is BasePaymaster, UniswapHelper, OracleHelper { | |
address userOpSender | ||
) = abi.decode(context, (uint256, uint256, uint256, address)); | ||
uint256 gasPrice = getGasPrice(maxFeePerGas, maxPriorityFeePerGas); | ||
if (mode == PostOpMode.postOpReverted) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe change |
||
emit PostOpReverted(userOpSender, preCharge); | ||
// Do nothing here to not revert the whole bundle and harm reputation | ||
return; | ||
} | ||
uint256 _cachedPrice = updateCachedPrice(false); | ||
// note: as price is in ether-per-token and we want more tokens increasing it means dividing it by markup | ||
uint256 cachedPriceWithMarkup = _cachedPrice * PRICE_DENOMINATOR / priceMarkup; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we still need
mode
here?