Attribute Macro handler
#[handler]Expand description
A helper attribute for #[sdk_derive(...)]. It doesn’t do anyting on its own;
it only marks functions that represent a paratime method handler.
The permitted forms are:
-
#[handler(call = "my_module.MyCall")]: Marks a function that handles the “my_module.MyCall” call and can be passed to oasis_runtime_sdk::module::dispatch_call. -
#[handler(prefetch = "my_module.MyCall")]: Marks a function that handles the request to prefetch any data ahead of the “my_module.MyCall” call. Its signature should beFn( add_prefix: &mut dyn FnMut(Prefix) -> (), body: cbor::Value, auth_info: &AuthInfo, ) -> Result<(), oasis_runtime_sdk::error::RuntimeError> -
#[handler(query = "my_module.MyQuery")]: Marks a function that handles the “my_module.MyQuery” query and can be passed to oasis_runtime_sdk::module::dispatch_query. -
#[handler(message_result = "my_module.MyMR")]: Marks a function that handles the “my_module.MyMR” message result and can be passed to oasis_runtime_sdk::module::dispatch_message_result.
Query handler can also contain the expensive tag. Example:
#[handler(query = "my_module.MyQuery", expensive)].
Queries tagged expensive can be enabled/disabled are disabled by default to avoid
excessive costs to the node operator. This can be overridden in the node config.
NOTE: This attribute is parsed by the #[sdk_derive(...)] macro, which cannot
interpret the attribute name semantically. Use #[handler], not
#[oasis_runtime_sdk_macros::handler] or other paths/aliases.