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

[Improvement] Hook Simplification Proposal #25

Closed
fangting-alchemy opened this issue Jan 11, 2024 · 2 comments · Fixed by erc6900/reference-implementation#29
Closed
Labels
simplification Simplification of standard standards improvement

Comments

@fangting-alchemy
Copy link

The intention of hook functions is to allow extra custom logic/checks to run around both Execution function and Validation function.

The current standard treats Hooks as one of the three primary functions. This not only necessitates account builders to support various potential use cases of Hooks, but also exposes plugin builders to the possibility of abusive scenarios where these Hooks are used by other plugins. The situation becomes particularly precarious, especially in cases involving state-changing Hooks.

Proposed Simplification to Hooks

The main proposal is to make Hooks a secondary citizen in the standard compare to first tier citizens like Execution and Validation functions.

Hooks are always associated with Execution and Validation functions. They supply extra logic to those functions, it is a natural transition to move Hooks to be only associated with those functions. Translating to the specification changes:

  • Disable dependency Hooks. Hooks are created to be installed on specific Execution or Validation functions. A plugin can no longer use hooks from other plugins to be added on Execution and/or Validation function selectors in its own manifest. This would be especially beneficial to state changing hooks. However, if a plugin desires to use other plugins’ Hooks, it can still do so by calling the other plugins in its own name fixed functions with its own (the calling plugin’s) context rather than the account’s context.
    • Duplicated Hooks are effectively eliminated under this.
  • Hooks are always run when its primary function (Execution or Validation) is run. Plugins who depend on other plugins’ Execution and Validation functions no longer need to explicitly specify Hooks for them.

It would significantly simplify logic in accounts and also empower plugin builders to use and build hooks with greater confidence.

@fangting-alchemy
Copy link
Author

Other simplification effort: #22

@huaweigu
Copy link

Thanks @fangting-alchemy! During our own development, we did feel disabling dependency hook would make the plugins less convoluted, thus boosting security confidence and simplifying the core protocol.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
simplification Simplification of standard standards improvement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants