Skip to content
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

Merged
merged 4 commits into from
Jan 9, 2024
Merged

add postOp param (gasPrice) #395

merged 4 commits into from
Jan 9, 2024

Conversation

drortirosh
Copy link
Contributor

saves TokenPaymaster 731 gas (it currently required to pass maxFeePerGas and maxPriorityFee as context params)
add "plain postOp" (which ignores this param) 24 gas.

saves TokenPaymaster 731 gas (it currently required to pass maxFeePerGas
and maxPriorityFee as context params)
add "plain postOp" (which ignores this param) 24 gas.
yoavw
yoavw previously approved these changes Jan 6, 2024
Copy link
Contributor

@yoavw yoavw left a 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.

shahafn
shahafn previously approved these changes Jan 7, 2024
@drortirosh drortirosh dismissed stale reviews from shahafn and yoavw via 49e9917 January 8, 2024 09:46
@@ -54,10 +54,11 @@ abstract contract BasePaymaster is IPaymaster, Ownable {
function postOp(
PostOpMode mode,
bytes calldata context,
uint256 actualGasCost
uint256 actualGasCost,
uint gasPrice
Copy link
Collaborator

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 {
Copy link
Collaborator

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));
Copy link
Collaborator

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
@drortirosh drortirosh merged commit 2e44018 into develop Jan 9, 2024
8 checks passed
@drortirosh drortirosh deleted the postOp-gas-price branch January 9, 2024 14:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants