-
Notifications
You must be signed in to change notification settings - Fork 113
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: add associated types as tx hooks args #1225
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This commit introduces associated types to the `TxHooks` trait, enhancing its ability to define custom interactions between the trait and its implementing modules. The associated types allow for greater flexibility in the implementation of `TxHooks`, enabling diverse use cases beyond the current `Accounts` module. The current `Accounts` implementation of `TxHooks` serves the purpose of extracting a public key from a transaction and mapping it to a rollup address, creating an execution context. This functionality is achieved through the `pre_dispatch_tx_hook` signature which returns a `C::Address`. However, this tight coupling with the `accounts` module restricts future expansions of `TxHooks`. With this modification, hooks gain increased versatility and modules are free to implement them as per their requirements. Additionally, runtimes can consume these implementations, utilizing them as essential building blocks, while the banks module is empowered to enforce a gas cap on the pre-dispatch hook.
Codecov Report
Additional details and impacted files
|
bkolad
reviewed
Dec 15, 2023
bkolad
reviewed
Dec 15, 2023
bkolad
approved these changes
Dec 18, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This commit introduces associated types to the
TxHooks
trait, enhancing its ability to define custom interactions between the trait and its implementing modules. The associated types allow for greater flexibility in the implementation ofTxHooks
, enabling diverse use cases beyond the currentAccounts
module.The current
Accounts
implementation ofTxHooks
serves the purpose of extracting a public key from a transaction and mapping it to a rollup address, creating an execution context. This functionality is achieved through thepre_dispatch_tx_hook
signature which returns aC::Address
. However, this tight coupling with theaccounts
module restricts future expansions ofTxHooks
.With this modification, hooks gain increased versatility and modules are free to implement them as per their requirements. Additionally, runtimes can consume these implementations, utilizing them as essential building blocks, while the banks module is empowered to enforce a gas cap on the pre-dispatch hook.