Skip to content

x/roles — Roles module

The x/roles module implements protocol-wide RBAC: named roles with defined capabilities, assignable to accounts, checked by other modules before privileged operations execute. Auditor rights, administrative operations, and specialized marketplace capabilities all resolve through role checks.

Centralizing authorization means access decisions are consistent, queryable, and governable — a role grant is a transaction, not a configuration file on someone’s server.

  • One permission model for every module. Roles bundle capabilities once; each module runs the same capability check before a privileged message executes — no check, no execution.
  • Grants are chain state. MsgAssignRole and MsgRevokeRole move grants on and off accounts, and the results are queryable by account (AccountRoles), by role (RoleMembers), and per check (HasRole).
  • Accounts carry recorded state. MsgSetAccountState updates the state tracked for an account (AccountState), alongside the accounts granted roles at genesis (GenesisAccounts).
  • Grants can be hardened. Role grants can be conditioned on verified identity through x/veidregistry and on stronger authentication through x/mfa.

Two dozen modules each inventing its own permission model would be unauditable. One RBAC module gives the protocol a single, inspectable answer to “who may do what” — and one governance surface to change it.

ConceptDefinition
RoleA named bundle of capabilities assignable to accounts and checked by modules.
Capability checkThe authorization gate a module runs before executing a privileged message.
  1. Define — Capabilities bundle into roles. Auditor rights, administrative operations, marketplace capabilities — named, bounded, documented.
  2. Grant — Accounts receive roles. Grants are transactions: public, queryable, and optionally conditioned on verified identity.
  3. Check — Modules gate on roles. Privileged messages run capability checks before executing — no check, no execution.
  4. Harden — Identity and factors attach. Sensitive grants can require VEID-verified identity or stronger MFA authentication.
MessagePurpose
MsgAssignRoleGrants a named role to an account.
MsgRevokeRoleRemoves a role from an account.
MsgNominateAdminNominates an account as an administrator.
MsgSetAccountStateSets the state tracked for an account.
MsgUpdateParamsGovernance-only update of module parameters.
QueryPurpose
AccountRolesAll roles held by an account.
RoleMembersThe accounts holding a given role.
HasRoleWhether an account holds a specific role.
AccountStateThe recorded state for an account.
GenesisAccountsAccounts granted roles at genesis.
ParamsCurrent module parameters.
ModuleHow they interact
x/auditAuditor status is a role that authorizes signing provider attributes.
x/configConfiguration changes require appropriately-roled accounts.
x/mfaPrivileged roles can be required to carry stronger authentication.
x/veidregistryRole grants can be conditioned on verified identity.

Why not let each module manage permissions?

Section titled “Why not let each module manage permissions?”

Two dozen bespoke permission models would be unauditable. One RBAC module keeps authorization consistent, queryable, and governable across the protocol.

The authorization gate a module runs before executing a privileged message — the runtime enforcement of the role model.

Yes. Auditor status authorizes signing provider attributes, with grants that can carry identity conditions and MFA requirements. See the x/audit module.