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] Dynamic input for multiple hooks #32

Open
huaweigu opened this issue Mar 20, 2024 · 2 comments · Fixed by erc6900/reference-implementation#66
Open

[Improvement] Dynamic input for multiple hooks #32

huaweigu opened this issue Mar 20, 2024 · 2 comments · Fixed by erc6900/reference-implementation#66

Comments

@huaweigu
Copy link

Sometimes multiple hooks need dynamic input from the calldata during the transaction time. For example, we may want to check the recipient address in a hook. A workaround would be decoding the existing transaction calldata and deducing the position of recipient address according to function selector and established knowledge of the function itself. However, this hardcoded approach might not scale well when we support new target contract.

For hooks that need dynamic input, the transaction can pack the extra information after the existing calldata and call into the existing execute, which is straightforward if only single hook requires input. However, it becomes more complicated if multiple hooks need input. We need an efficient way to unpack the calldata and route the corresponding input to each plugin correctly.

Another approach is calling a new plugin exec function if you need certain functionalities. However, this decreases the composability between plugins a little bit. Also some plugins might want to apply the check across all exec functions, but other exec functions don't really pack the additional data. So in practice, we disabled the other exec functions to make sure the check is honored by default. Maybe this particular problem can be alleviated by dynamic input or other mechanisms.

@huaweigu
Copy link
Author

@adamegyed's PR offers a promising solution to this issue, so I'm re-assigning it to him

@jaypaik jaypaik moved this from 1. Research to 2. Reference implementation in ERC-6900 v0.8 Jul 7, 2024
@adamegyed
Copy link

For tracking: this PR addresses the issue for pre-validation hooks: erc6900/reference-implementation#66

@jaypaik jaypaik moved this from 2. Reference implementation to 3. Spec update in ERC-6900 v0.8 Nov 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: 3. Spec update
Development

Successfully merging a pull request may close this issue.

3 participants