-
Notifications
You must be signed in to change notification settings - Fork 687
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
add postOp param (gasPrice) #395
Conversation
saves TokenPaymaster 731 gas (it currently required to pass maxFeePerGas and maxPriorityFee as context params) add "plain postOp" (which ignores this param) 24 gas.
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.
Makes sense, let's do it.
contracts/core/BasePaymaster.sol
Outdated
@@ -54,10 +54,11 @@ abstract contract BasePaymaster is IPaymaster, Ownable { | |||
function postOp( | |||
PostOpMode mode, | |||
bytes calldata context, | |||
uint256 actualGasCost | |||
uint256 actualGasCost, | |||
uint gasPrice |
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.
This name is highly confusing. The postOp
method can actually call tx.gasprice
and developers will be confused with the fact they are not the same thing. We should name it actualUserOpFeePerGas
or something like that, so that the name "screams" that this is not tx.gasprice
.
Also, please, use uint256
for both params - makes no sense to use two different ways in one line.
@@ -102,11 +102,11 @@ contract LegacyTokenPaymaster is BasePaymaster, ERC20 { | |||
* the user's TX , back to the state it was before the transaction started (before the validatePaymasterUserOp), | |||
* and the transaction should succeed there. | |||
*/ | |||
function _postOp(PostOpMode mode, bytes calldata context, uint256 actualGasCost) internal override { | |||
function _postOp(PostOpMode mode, bytes calldata context, uint256 actualGasCost, uint gasPrice) internal override { |
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.
Unrelated - why do we keep this old code around? Can we remove it?
address userOpSender | ||
) = abi.decode(context, (uint256, uint256, uint256, address)); | ||
uint256 gasPrice = getGasPrice(maxFeePerGas, maxPriorityFeePerGas); | ||
) = abi.decode(context, (uint256, address)); |
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.
This means the entire getGasPrice
function is no longer needed - please remove.
so we don't confuse userop-specific gasPrice with tx.gasprice
3e567aa
to
8faf84a
Compare
saves TokenPaymaster 731 gas (it currently required to pass maxFeePerGas and maxPriorityFee as context params)
add "plain postOp" (which ignores this param) 24 gas.