erc6900 / resources

19 stars 4 forks source link

[Improvement] Hook Simplification Proposal #25

Closed fangting-alchemy closed 8 months ago

fangting-alchemy commented 8 months ago

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:

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

fangting-alchemy commented 8 months ago

Other simplification effort: https://github.com/erc6900/resources/issues/22

huaweigu commented 8 months ago

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.