You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
The current design of the hook system (refer to issue #320) introduces complications. The main problem lies in the fact that the hooks cannot return arbitrary types. This limitation prevents hook composition and severely restricts the overall approach.
Describe the solution you'd like
Instead of mandating that every module implements the ApplyBlobHooks & TxHooks traits, the Runtime will take charge of implementing the RuntimeCapabilities defined in the following way:
The AppTemplate will receive the concrete implementation of RuntimeCapabilities. This enables the runtime hooks to have a specific purpose, allowing us to utilize their return types in the logic of the AppTemplate.
Solution as of 2023-07-19
Hooks get stricter
post blob/tx hooks do not return result. they can only modify state and it is commited afterwards
state is always commited after pre hooks
pre hooks can change control flow and skip body (blob or tx processing)
Context builder traits introduced
For functionality when STF needs some data from modules, 2 ContexBuilders are introduced:
TxContextBuilder
It is very similar to current pre_dispatch_hook, but instead of returning Address it returns whole context.
citizen-stig
changed the title
RemoveApplyBlobHooks & TxHooks from the module-system
Remove ApplyBlobHooks & TxHooks from the module-systemJul 21, 2023
Is your feature request related to a problem? Please describe.
The current design of the hook system (refer to issue #320) introduces complications. The main problem lies in the fact that the hooks cannot return arbitrary types. This limitation prevents hook composition and severely restricts the overall approach.
Describe the solution you'd like
Instead of mandating that every module implements the
ApplyBlobHooks & TxHooks
traits, theRuntime
will take charge of implementing theRuntimeCapabilities
defined in the following way:The
AppTemplate
will receive the concrete implementation ofRuntimeCapabilities
. This enables the runtime hooks to have a specific purpose, allowing us to utilize their return types in the logic of the AppTemplate.Solution as of 2023-07-19
Hooks get stricter
Context builder traits introduced
For functionality when STF needs some data from modules, 2 ContexBuilders are introduced:
TxContextBuilder
It is very similar to current
pre_dispatch_hook
, but instead of returningAddress
it returns whole context.It does not error, it always succeeds or panics
It is called before
pre/tx hooks
state is not commited
? DoS Vector: spam state with non existing accounts? Currently we create account if it is not in database.
BlobContextBuilder
Currently not needed, so won't be implemented
SlotBuilder
Module can implement this trait, with following interface:
TBD
The text was updated successfully, but these errors were encountered: