Crate pallet_msa

source ·
Expand description

Message Source Account Management

MSA Pallet

The MSA Pallet provides functionality for handling Message Source Accounts.

Summary

The Message Source Account (MSA) is the primary user account system on Frequency for Messages and Stateful Storage. All users on Frequency must have an MSA in order to:

  1. Acquire a User Handle
  2. Delegate tasks to Providers (defining specific tasks for specific providers)
  3. Become a Provider so they may do Provider level tasks on their own behalf
  4. Have Message or Stateful Storage data

MSA Id and Keys

Once a user creates an MSA, they are assigned an MSA Id, a unique number the time of creation with one or more keys attached for control. (A control key may only be attached to ONE MSA at any single point in time.)

Actions

The MSA pallet provides for:

  • Creating, reading, updating, and deleting operations for MSAs.
  • Managing delegation relationships for MSAs.
  • Managing keys associated with MSAs.

Interactions

Extrinsics

Name/DescriptionCallerPaymentKey EventsRuntime Added
add_public_key_to_msa
Add MSA control key
MSA Control Key or Provider with SignatureCapacity or TokensPublicKeyAdded1
create
Create new MSA
Token AccountTokensMsaCreated1
create_provider
Convert an MSA into a Provider
Testnet: Provider or Mainnet: GovernanceTokensProviderCreated1
create_provider_via_governance
Convert an MSA into a Provider
Frequency CouncilTokensProviderCreated12
create_sponsored_account_with_delegation
Create new MSA via Provider with a Delegation
ProviderCapacity or TokensMsaCreated, DelegationGranted1
delete_msa_public_key
Remove MSA control key
DelegatorFreePublicKeyDeleted1
grant_delegation
Create or alter a delegation
Provider with SignatureCapacityDelegationGranted1
propose_to_be_provider
Request the council to convert an MSA to a Provider
Token AccountTokensProposed12
retire_msa
Remove all keys and mark the MSA as retired
DelegatorFreePublicKeyDeleted, MsaRetired18
revoke_delegation_by_delegator
Remove delegation
DelegatorFreeDelegationRevoked1
revoke_delegation_by_provider
Remove delegation
ProviderFreeDelegationRevoked1

See Rust Docs for more details.

State Queries

NameDescriptionQueryRuntime Added
Get MSA IdReturns the MSA Id connected to the given control keypublicKeyToMsaId1
Get Current Maximum MSA IdReturns the maximum MSA Id in existencecurrentMsaIdentifierMaximum1
Get Current Delegator to ProviderReturns the current relationship between the specified Delegator and specified Provider at the given block numberdelegatorAndProviderToDelegation1
Get Public Key Count for MSA IdReturns the number of public keys for the given MSA IdpublicKeyCountforMsaId1

See the Rust Docs for additional state queries and details.

RPCs

Note: May be restricted based on node settings and configuration.

NameDescriptionCallNode Version
Check DelegationsTest a list of MSAs to see if they have delegated to the provider MSAcheckDelegationsv1.0.0+
Delegation Schema GrantsFetch the list of Schema Ids that a delegator has granted to a providergrantedSchemaIdsByMsaIdv1.0.0+
Get Control Keys by MSA Id*Fetch the list of current control keys for an MSA from the off-chain indexgetKeysByMsaIdv1.10.0+
Get All Delegations by MSA IdRetreives all delegations and schemas, active and inactive, for an MSA ID‘getAllGrantedDelegationsByMsaId’v1.13.0+

* Must be enabled with off-chain indexing

See Rust Docs for more details.

Implementations

Assumptions

  • Total MSA keys should be less than the constant Config::MSA::MaxPublicKeysPerMsa.
  • Maximum schemas, for which any single provider has publishing rights on behalf of a single user, must be less than Config::MSA::MaxSchemaGrantsPerDelegation

Re-exports

Modules

  • Offchain storage for MSA pallet
  • The pallet module in each FRAME pallet hosts the most important items needed to construct this pallet.
  • Types for the MSA Pallet
  • Autogenerated weights for pallet_msa

Structs

  • The SignedExtension trait is implemented on CheckFreeExtrinsicUse to validate that a provider has not already been revoked if the calling extrinsic is revoking a provider to an MSA. The purpose of this is to ensure that the revoke_delegation_by_delegator extrinsic cannot be repeatedly called and flood the network.

Enums

  • Errors related to the validity of the CheckFreeExtrinsicUse signed extension.

Traits

  • A behavior that allows for retrieving a Handle for a given MessageSourceAccount

Functions

  • Wraps PREFIX and POSTFIX around a Vec<u8> Returns PREFIX ++ data ++ POSTFIX

Type Aliases

  • Message Source Id or msaId is the unique identifier for Message Source Accounts