Trait Authorizer

Source
pub trait Authorizer {
    // Required method
    fn is_authorized(
        param: AuthParam,
        package: WorkPackage,
        core_index: CoreIndex,
    ) -> AuthOutput;
}
Expand description

The invocation trait for a JAM authorizer.

The declare_authorizer macro requires that its parameter implement this trait.

Required Methods§

Source

fn is_authorized( param: AuthParam, package: WorkPackage, core_index: CoreIndex, ) -> AuthOutput

The single entry-point of this PVM module, this determines whether a given Work Package should be authorized to run on a given core.

  • param: The authorizer-parameter which parameterizes this logic in some way. (This can also be found in the Work Package itself, but it provided here for convenience.)
  • package: The Work Package to be authorized. It is guaranteed that the package.authorizer.code_hash identifies this Authorizer logic. The Work Package includes the authorization field which is freely settable by the Work Package builder in order to authorize the package against this (parameterized) authorizer.
  • core_index: The index of the core on which the Work Package will be executed.

Returns the authorization output, an opaque blob which will be passed into both Refine and Accumulate for all Work Items in package. If package is not authorized, then this should panic instead.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§