Crate pallet_msa
source ·Expand description
Message Source Account Management
Quick Links
- Configuration:
Config
- Extrinsics:
Call
- Runtime API:
MsaRuntimeApi
- Custom RPC API:
MsaApiServer
- Event Enum:
Event
- Error Enum:
Error
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:
- Acquire a User Handle
- Delegate tasks to Providers (defining specific tasks for specific providers)
- Become a Provider so they may do Provider level tasks on their own behalf
- 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/Description | Caller | Payment | Key Events | Runtime Added |
---|---|---|---|---|
add_public_key_to_msa Add MSA control key | MSA Control Key or Provider with Signature | Capacity or Tokens | PublicKeyAdded | 1 |
create Create new MSA | Token Account | Tokens | MsaCreated | 1 |
create_provider Convert an MSA into a Provider | Testnet: Provider or Mainnet: Governance | Tokens | ProviderCreated | 1 |
create_provider_via_governance Convert an MSA into a Provider | Frequency Council | Tokens | ProviderCreated | 12 |
create_sponsored_account_with_delegation Create new MSA via Provider with a Delegation | Provider | Capacity or Tokens | MsaCreated , DelegationGranted | 1 |
delete_msa_public_key Remove MSA control key | Delegator | Free | PublicKeyDeleted | 1 |
grant_delegation Create or alter a delegation | Provider with Signature | Capacity | DelegationGranted | 1 |
propose_to_be_provider Request the council to convert an MSA to a Provider | Token Account | Tokens | Proposed | 12 |
retire_msa Remove all keys and mark the MSA as retired | Delegator | Free | PublicKeyDeleted , MsaRetired | 18 |
revoke_delegation_by_delegator Remove delegation | Delegator | Free | DelegationRevoked | 1 |
revoke_delegation_by_provider Remove delegation | Provider | Free | DelegationRevoked | 1 |
See Rust Docs for more details.
State Queries
Name | Description | Query | Runtime Added |
---|---|---|---|
Get MSA Id | Returns the MSA Id connected to the given control key | publicKeyToMsaId | 1 |
Get Current Maximum MSA Id | Returns the maximum MSA Id in existence | currentMsaIdentifierMaximum | 1 |
Get Current Delegator to Provider | Returns the current relationship between the specified Delegator and specified Provider at the given block number | delegatorAndProviderToDelegation | 1 |
Get Public Key Count for MSA Id | Returns the number of public keys for the given MSA Id | publicKeyCountforMsaId | 1 |
See the Rust Docs for additional state queries and details.
RPCs
Note: May be restricted based on node settings and configuration.
Name | Description | Call | Node Version |
---|---|---|---|
Check Delegations | Test a list of MSAs to see if they have delegated to the provider MSA | checkDelegations | v1.0.0+ |
Delegation Schema Grants | Fetch the list of Schema Ids that a delegator has granted to a provider | grantedSchemaIdsByMsaId | v1.0.0+ |
Get Control Keys by MSA Id* | Fetch the list of current control keys for an MSA from the off-chain index | getKeysByMsaId | v1.10.0+ |
Get All Delegations by MSA Id | Retreives 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
MsaLookup
: Functions for accessing MSAs.MsaValidator
: Functions for validating MSAs.ProviderLookup
: Functions for accessing Provider info.DelegationValidator
: Functions for validating delegations.SchemaGrantValidator
: Functions for validating schema grants.
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
pub use types::AddKeyData;
pub use types::AddProvider;
pub use types::PermittedDelegationSchemas;
pub use types::EMPTY_FUNCTION;
pub use pallet::*;
pub use weights::*;
pub use offchain_storage::*;
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 givenMessageSourceAccount
Functions
- Wraps
PREFIX
andPOSTFIX
around aVec<u8>
ReturnsPREFIX
++data
++POSTFIX
Type Aliases
- Message Source Id or msaId is the unique identifier for Message Source Accounts