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

feat: aa-core smart account provider fee options to handle more systematic fee options for userops #276

Merged
merged 8 commits into from
Nov 30, 2023

Conversation

denniswon
Copy link
Contributor

@denniswon denniswon commented Nov 24, 2023

per https://app.asana.com/0/1205598840815267/1205909484815093/f

this task is a ground work for supporting more advanced ways to enable/manage gas estimates during the user operation creation from the sdk.

This PR specifically defines and implements the smart account provider behavior when populating the gas fields of the user operation, enabling more stress-free and less error-prone experience for developers.

Tested with e2e tests that used to be more flaky, but fixed to be rather consistent on the PR #243


PR-Codex overview

This PR focuses on updating the gas estimation and fee options in the Alchemy codebase.

Detailed summary:

  • Renamed estimateGas to delegateGasEstimation in withAlchemyGasManager.md
  • Removed FeeOpts type in type.ts
  • Added RequestGasAndPaymasterAndDataOverrides type in index.ts
  • Updated ClientWithAlchemyMethods type in client.ts
  • Updated log level in logger.ts
  • Added utility functions in index.ts
  • Added new types in types/index.ts
  • Updated AccountMiddlewareFn and related types in provider/types.ts
  • Updated schema in schema.ts
  • Added utility function in bigint.ts

The following files were skipped due to too many changes: packages/core/src/utils/bigint.ts, packages/alchemy/src/middleware/gas-fees.ts, packages/core/src/utils/index.ts, packages/core/src/provider/schema.ts, packages/accounts/src/light-account/e2e-tests/light-account.test.ts, packages/core/e2e-tests/simple-account.test.ts, packages/alchemy/src/provider.ts, packages/alchemy/src/middleware/gas-manager.ts, packages/alchemy/e2e-tests/simple-account.test.ts, packages/core/src/provider/base.ts

✨ Ask PR-Codex anything about this PR by commenting with /codex {your question}

Base automatically changed from denniswon/loglevel to development November 24, 2023 00:55
Copy link
Contributor

@avasisht23 avasisht23 left a comment

Choose a reason for hiding this comment

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

think it might be good to review provider/base.ts, provider/types.ts, and middleware/gas-manager.ts live as a team. left comments on everything else though.

packages/core/src/utils/schema.ts Outdated Show resolved Hide resolved
packages/core/src/utils/index.ts Outdated Show resolved Hide resolved
packages/core/src/utils/index.ts Outdated Show resolved Hide resolved
packages/core/src/provider/schema.ts Show resolved Hide resolved
packages/core/src/utils/bigint.ts Outdated Show resolved Hide resolved
packages/core/src/utils/bigint.ts Outdated Show resolved Hide resolved
packages/core/src/utils/bigint.ts Outdated Show resolved Hide resolved
packages/core/src/provider/base.ts Outdated Show resolved Hide resolved
packages/alchemy/src/middleware/gas-manager.ts Outdated Show resolved Hide resolved
@denniswon denniswon force-pushed the denniswon/feeoptions branch 5 times, most recently from 8ee6b14 to 7c5dcf4 Compare November 28, 2023 17:00
@denniswon denniswon changed the base branch from development to denniswon/drop-and-replace November 28, 2023 17:00
packages/core/src/provider/base.ts Outdated Show resolved Hide resolved
packages/core/src/provider/base.ts Outdated Show resolved Hide resolved
packages/core/src/provider/base.ts Outdated Show resolved Hide resolved
packages/alchemy/src/middleware/gas-manager.ts Outdated Show resolved Hide resolved
packages/alchemy/src/middleware/gas-manager.ts Outdated Show resolved Hide resolved
Copy link
Contributor

@avasisht23 avasisht23 left a comment

Choose a reason for hiding this comment

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

some qs/nits

* @param args a list of bigints to get the max of
* @returns the min bigint in the list
*/
export const bigIntMin = (...args: bigint[]) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

bump still don't see it used, you're welcome to keep it if you anticipate a use case.

packages/core/src/utils/index.ts Show resolved Hide resolved
packages/alchemy/e2e-tests/simple-account.test.ts Outdated Show resolved Hide resolved
packages/alchemy/e2e-tests/simple-account.test.ts Outdated Show resolved Hide resolved
packages/alchemy/src/middleware/gas-fees.ts Show resolved Hide resolved
packages/alchemy/src/middleware/gas-fees.ts Show resolved Hide resolved
packages/alchemy/src/middleware/gas-manager.ts Outdated Show resolved Hide resolved
@denniswon denniswon force-pushed the denniswon/feeoptions branch 2 times, most recently from f15e335 to fcafec7 Compare November 29, 2023 17:25
denniswon and others added 4 commits November 29, 2023 09:27
* feat: support updated overrides for alchemy request gas and paymaster and data

* feat: rebase parent where account middle func def is updated
@denniswon denniswon changed the base branch from denniswon/drop-and-replace to development November 29, 2023 17:38
Copy link
Contributor

@avasisht23 avasisht23 left a comment

Choose a reason for hiding this comment

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

few leftover comments to address?

packages/core/src/utils/index.ts Outdated Show resolved Hide resolved
packages/alchemy/e2e-tests/simple-account.test.ts Outdated Show resolved Hide resolved
packages/alchemy/e2e-tests/simple-account.test.ts Outdated Show resolved Hide resolved
@@ -325,7 +329,8 @@ export interface ISmartAccountProvider<
* Overrides the feeDataGetter middleware which is used for setting the fee fields on the UserOperation
* prior to execution.
*
* @param override - a function for overriding the default feeDataGetter middleware
* @param override - a function for overriding the default feeDataGetter middleware
Copy link
Contributor

Choose a reason for hiding this comment

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

bump?

@@ -325,7 +329,8 @@ export interface ISmartAccountProvider<
* Overrides the feeDataGetter middleware which is used for setting the fee fields on the UserOperation
* prior to execution.
*
* @param override - a function for overriding the default feeDataGetter middleware
* @param override - a function for overriding the default feeDataGetter middleware
* @param feeOptions - optional FeeDataFeeOptions to set at the global level of the provider.
Copy link
Contributor

Choose a reason for hiding this comment

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

bump?

packages/alchemy/src/middleware/gas-manager.ts Outdated Show resolved Hide resolved
packages/alchemy/src/middleware/gas-manager.ts Outdated Show resolved Hide resolved
packages/alchemy/src/middleware/gas-manager.ts Outdated Show resolved Hide resolved
packages/core/src/provider/base.ts Outdated Show resolved Hide resolved
packages/core/src/provider/base.ts Outdated Show resolved Hide resolved
packages/core/src/utils/bigint.ts Outdated Show resolved Hide resolved
packages/core/src/utils/index.ts Show resolved Hide resolved
Copy link
Collaborator

@moldy530 moldy530 left a comment

Choose a reason for hiding this comment

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

LGTM but there's still one unaddressed comment from @avasisht23 here

Copy link
Contributor

@avasisht23 avasisht23 left a comment

Choose a reason for hiding this comment

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

lgtm, one last comment to address + 1 request for follow-up :) nice work!

@denniswon denniswon merged commit a969bb5 into development Nov 30, 2023
6 checks passed
@denniswon denniswon deleted the denniswon/feeoptions branch November 30, 2023 01:43
@moldy530 moldy530 mentioned this pull request Dec 1, 2023
8 tasks
moldy530 added a commit that referenced this pull request Dec 1, 2023
…matic fee options for userops (#276)

* feat: aa-core smart account provider fee options to handle more systematic fee options for userops

* feat: remove fee options middleware and expose fee options to middleware functions

* feat: aa-alchemy ergonomic support for handling gas estimation (#243)

* feat: support updated overrides for alchemy request gas and paymaster and data

* feat: rebase parent where account middle func def is updated

* Update site/packages/aa-alchemy/middleware/withAlchemyGasManager.md

Co-authored-by: Ajay Vasisht <[email protected]>

* Update packages/core/src/utils/index.ts

Co-authored-by: Ajay Vasisht <[email protected]>

* Update packages/core/src/utils/index.ts

Co-authored-by: Ajay Vasisht <[email protected]>

* Update packages/core/src/provider/base.ts

Co-authored-by: Michael Moldoveanu <[email protected]>

* fix: alchemy gas manager 0x check for user op overrides

---------

Co-authored-by: Ajay Vasisht <[email protected]>
Co-authored-by: Michael Moldoveanu <[email protected]>
moldy530 added a commit that referenced this pull request Dec 1, 2023
…matic fee options for userops (#276)

* feat: aa-core smart account provider fee options to handle more systematic fee options for userops

* feat: remove fee options middleware and expose fee options to middleware functions

* feat: aa-alchemy ergonomic support for handling gas estimation (#243)

* feat: support updated overrides for alchemy request gas and paymaster and data

* feat: rebase parent where account middle func def is updated

* Update site/packages/aa-alchemy/middleware/withAlchemyGasManager.md

Co-authored-by: Ajay Vasisht <[email protected]>

* Update packages/core/src/utils/index.ts

Co-authored-by: Ajay Vasisht <[email protected]>

* Update packages/core/src/utils/index.ts

Co-authored-by: Ajay Vasisht <[email protected]>

* Update packages/core/src/provider/base.ts

Co-authored-by: Michael Moldoveanu <[email protected]>

* fix: alchemy gas manager 0x check for user op overrides

---------

Co-authored-by: Ajay Vasisht <[email protected]>
Co-authored-by: Michael Moldoveanu <[email protected]>
avasisht23 added a commit that referenced this pull request Dec 3, 2023
…matic fee options for userops (#276)

* feat: aa-core smart account provider fee options to handle more systematic fee options for userops

* feat: remove fee options middleware and expose fee options to middleware functions

* feat: aa-alchemy ergonomic support for handling gas estimation (#243)

* feat: support updated overrides for alchemy request gas and paymaster and data

* feat: rebase parent where account middle func def is updated

* Update site/packages/aa-alchemy/middleware/withAlchemyGasManager.md

Co-authored-by: Ajay Vasisht <[email protected]>

* Update packages/core/src/utils/index.ts

Co-authored-by: Ajay Vasisht <[email protected]>

* Update packages/core/src/utils/index.ts

Co-authored-by: Ajay Vasisht <[email protected]>

* Update packages/core/src/provider/base.ts

Co-authored-by: Michael Moldoveanu <[email protected]>

* fix: alchemy gas manager 0x check for user op overrides

---------

Co-authored-by: Ajay Vasisht <[email protected]>
Co-authored-by: Michael Moldoveanu <[email protected]>
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.

3 participants