Session¶
Calls¶
purge_keys¶
Removes any session key(s) of the function caller.
This doesn't take effect until the next session.
The dispatch origin of this function must be Signed and the account must be either be convertible to a validator ID using the chain's typical addressing system (this usually means being a controller account) or directly convertible into a validator ID (which usually means being a stash account).
## Complexity
- O(1)
in number of key types. Actual cost depends on the number of length of
T::Keys::key_ids()
which is fixed.
Attributes¶
No attributes
Python¶
call = substrate.compose_call(
'Session', 'purge_keys', {}
)
set_keys¶
Sets the session key(s) of the function caller to keys
.
Allows an account to set its session key prior to becoming a validator.
This doesn't take effect until the next session.
The dispatch origin of this function must be signed.
## Complexity
- O(1)
. Actual cost depends on the number of length of T::Keys::key_ids()
which is
fixed.
Attributes¶
Name | Type |
---|---|
keys | T::Keys |
proof | Vec<u8> |
Python¶
call = substrate.compose_call(
'Session', 'set_keys', {
'keys': {
'aura': '[u8; 32]',
'nimbus': '[u8; 32]',
'vrf': '[u8; 32]',
},
'proof': 'Bytes',
}
)
Events¶
NewSession¶
New session has happened. Note that the argument is the session index, not the block number as the type might suggest.
Attributes¶
Name | Type | Composition |
---|---|---|
session_index | SessionIndex |
u32 |
Storage functions¶
CurrentIndex¶
Current index of the session.
Python¶
result = substrate.query(
'Session', 'CurrentIndex', []
)
Return value¶
'u32'
DisabledValidators¶
Indices of disabled validators.
The vec is always kept sorted so that we can find whether a given validator is
disabled using binary search. It gets cleared when on_session_ending
returns
a new set of identities.
Python¶
result = substrate.query(
'Session', 'DisabledValidators', []
)
Return value¶
['u32']
KeyOwner¶
The owner of a key. The key is the KeyTypeId
+ the encoded key.
Python¶
result = substrate.query(
'Session', 'KeyOwner', [('[u8; 4]', 'Bytes')]
)
Return value¶
'AccountId'
NextKeys¶
The next session keys for a validator.
Python¶
result = substrate.query(
'Session', 'NextKeys', ['AccountId']
)
Return value¶
{'aura': '[u8; 32]', 'nimbus': '[u8; 32]', 'vrf': '[u8; 32]'}
QueuedChanged¶
True if the underlying economic identities or weighting behind the validators has changed in the queued validator set.
Python¶
result = substrate.query(
'Session', 'QueuedChanged', []
)
Return value¶
'bool'
QueuedKeys¶
The queued keys for the next session. When the next session begins, these keys will be used to determine the validator's session keys.
Python¶
result = substrate.query(
'Session', 'QueuedKeys', []
)
Return value¶
[('AccountId', {'aura': '[u8; 32]', 'nimbus': '[u8; 32]', 'vrf': '[u8; 32]'})]
Validators¶
The current set of validators.
Python¶
result = substrate.query(
'Session', 'Validators', []
)
Return value¶
['AccountId']
Errors¶
DuplicatedKey¶
Registered duplicate key.
InvalidProof¶
Invalid ownership proof.
NoAccount¶
Key setting account is not live, so it's impossible to associate keys.
NoAssociatedValidatorId¶
No associated validator ID for account.
NoKeys¶
No keys are associated with this account.