Skip to content

[Improvement] Dynamic input for multiple hooks #32

@huaweigu

Description

@huaweigu

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.

Metadata

Metadata

Assignees

Type

No type

Projects

Status

3. Spec update

Relationships

None yet

Development

No branches or pull requests

Issue actions