Expand description

Anagolay blockchain

This is the support pallet for the anagolay blockchain. It factors common types and behaviors used in all other Anagolay pallets, which are:

  • operations - Exposes the extrinsics for creation, management and approval of Operations
  • workflows - Exposes the extrinsics for creation, management and approval of Workflows

Versions

Each entity on Anagolay blockchain is versioned. It means that upon creation, a check is performed to prevent creation of multiple versions of the same entity and to verify that the initial version that will be created is consistent

Weights

Since creation of entities is costly, the call is required to be signed and to spend a certain amount of tokens for the extrinsic call to succeed. This prevents overcharging the chain. Weights of each call are generated by benchmark tests

Code structure

Each pallet presents the following modules:

  • lib - The entry point of the pallet, defines configuration, events, errors and extrinsics
  • benchmarking - Runner of the benchmarking
  • functions - Private behaviour of the pallet, the lib entry points delegate to this module
  • mock - Prepares the mocks for unit tests, only used in test configuration
  • types - Collects the types and the data model used by the pallet

Features of the support crate

The factored common types are:

  • Identifiers - Every entity has their own (OperationId, WorkflowId, etc.) but they are all aliases of a private struct GenericId that deals with validation and (de)serialization
  • Characters - Offers an interface to deal with strings in nostd
  • AnagolayStructure - Provides a pattern struct with an id, some data nad an optional extra. The id is guaranteed to be computed from the data.
  • AnagolayVersion - Another pattern struct used by all entity to deal with their published artifacts and incremental versions on the blockchain
  • AnagolayRecord - Pattern struct used to store the entities on the chain along with the caller and the block number

Structs

Operation Version artifact

Info, this is what gets stored. The Generic A is usally the AccountId and B is BlockNumber

Generic structure representing an Anagolay entity

Version data. It contains all the needed parameters which define the entity Version and is hashed to produce the Version id

Extra information (non hashed) for an entity Version

NewType pattern to handle strings. It conveniently allows concatenation and deals with (de)serialization as well.

Enums

List of equipment that needs workflows generated

WASM artifacts commonly produced for a published entity. The subtype should be passed as parameter of the entity-defined artifact type enumeration, like in the example:

Traits

The trait for the data field of an Anagolay entity.

The trait for the extra field of an Anagolay entity

Trait used as type parameter in [AnagolayPackageStructure], allowing different structures to define the enumeration of possible artifact types depending on the specific case:

Type Definitions

The type of the values in the ArtifactsByArtifactId storage

All published artifacts will appear here. Note that this list will be quite large, be aware of querying this without proper limits!

Placeholder for SSI and DID

Type alias to Pallet, to be used by construct_runtime.

The type used for an Operation ID

The type used for any entity Version ID

The type used for a Workflow ID