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

finalUserOp replaced with userOp for overrides proper usage #239

Merged
merged 2 commits into from
Jul 24, 2023

Conversation

talhamalik883
Copy link
Contributor

finalUserOp passed to calculateUserOpGasValues function is replaced with userOp that has overrides gas attributes

@livingrockrises livingrockrises self-requested a review July 24, 2023 12:23
@@ -113,7 +113,7 @@ export abstract class SmartAccount implements ISmartAccount {
if (!this.provider) throw new Error('Provider is not present for making rpc calls')
// if no bundler url is provided run offchain logic to assign following values of UserOp
// maxFeePerGas, maxPriorityFeePerGas, verificationGasLimit, callGasLimit, preVerificationGas
finalUserOp = await this.calculateUserOpGasValues(finalUserOp)
finalUserOp = await this.calculateUserOpGasValues(userOp)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If userOp already contains some keys here, calculateUserOpGasValues will skip local estimation and use provided key (aka override) here?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so essentially someone would have to pass overrides and skipBundlerEstimation true both in order for it to act as an override.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we make two override flags?
bundlerEstimationOverrides and overrides

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if overrides is given then assume skipBundlerEstimation to be true?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can reinstate the previous logic. If all gas attributes are provided in buildUserOp, there is no need to use off-chain logic, and we can also avoid calling the bundler for estimation.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah then overrides should be limited to only callGasLimit and verificationGasLimit.

preVerificationGas, maxFeePerGas, maxPriorityFeePerGas would need to still come from the bundler

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and if we'd need to make bundler call and use some partial values provided in overrides, these overrides directly get applied to bundler call which might mess with estimated limits again..

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there are two kinds of overrides which now requires discussion with @tomarsachin2271 and @arcticfloyd1984

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would merge this PR and then handle this differently.
current communication would be

  • send overrides and skipBundler flag true to just do the overrides
  • send overrides which will only be used for bundler estimation (for debugging some cases it helps)
  • no overrides and skip flag true which will be used to calculate values locally in the sdk
  • one can always replace keys in userop before it gets signed by paymaster (if involved) and the user

@livingrockrises livingrockrises merged commit 01f3bdd into development Jul 24, 2023
@livingrockrises livingrockrises deleted the fix/userop-gas-limit-estimations branch September 9, 2023 08:49
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.

2 participants