You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
In the Session SMRL we change (rotate) each Session at the end of the final block of the current Session Length using the on_finalise method https://github.com/paritytech/substrate/blob/master/srml/session/src/lib.rs#L112 (that is called by either an origin or internally from another SRML at the end of each block) that calls check_rotate_session. At the start of the next session we allocated it with a Session Index and record the timestamp when it started.
Lastly we iterate through each of current set of Validator Account IDs by index and check if a Session Key was created for it with set_key in the previous session, and if so we call set_authorityhttps://github.com/paritytech/substrate/blob/master/srml/consensus/src/lib.rs#L266 of the Consensus SRML where we check if the Session Key of this current authority matches the Session Key (if any) stored under their index in the AuthorityStorageVec mapping, and if not we store their index to Session Key and we call save_original_authoritieshttps://github.com/paritytech/substrate/blob/master/srml/consensus/src/lib.rs#L269 with an argument None. Then if there are authorities already saved in OriginalAuthorities we return, otherwise we try to update OriginalAuthorities with a value of None.
Is it necessary for us to have to set the value of OriginalAuthorities to a value of None multiple times?
next_session should be called after this in order to update the session keys to the next validator set.
set_validators also calls set_authority of the Consensus SRML, but instead of passing None, it passes a set of Session Keys (which it gets from the provided list of Account IDs of the new validators that are to be set that each map to a corresponding Session Key).
And there isn't a next_session function like the comment suggests. I assume it means rotate_session, which is called by the on_finalise method that is called at the end of each block and which calls check_rotate_session each time, and where check_rotate_session calls rotate_session.
Uh oh!
There was an error while loading. Please reload this page.
In the Session SMRL we change (rotate) each Session at the end of the final block of the current Session Length using the
on_finalise
method https://github.com/paritytech/substrate/blob/master/srml/session/src/lib.rs#L112 (that is called by either an origin or internally from another SRML at the end of each block) that callscheck_rotate_session
. At the start of the next session we allocated it with a Session Index and record the timestamp when it started.Lastly we iterate through each of current set of Validator Account IDs by index and check if a Session Key was created for it with
set_key
in the previous session, and if so we callset_authority
https://github.com/paritytech/substrate/blob/master/srml/consensus/src/lib.rs#L266 of the Consensus SRML where we check if the Session Key of this current authority matches the Session Key (if any) stored under their index in theAuthorityStorageVec
mapping, and if not we store their index to Session Key and we callsave_original_authorities
https://github.com/paritytech/substrate/blob/master/srml/consensus/src/lib.rs#L269 with an argumentNone
. Then if there are authorities already saved inOriginalAuthorities
we return, otherwise we try to updateOriginalAuthorities
with a value ofNone
.Is it necessary for us to have to set the value of
OriginalAuthorities
to a value ofNone
multiple times?Additionally, there is a comment above the
set_validators
method of SRML Sessionhttps://github.com/paritytech/substrate/blob/master/srml/session/src/lib.rs#L171, which is used to set the current set of validators. It says:
set_validators
also callsset_authority
of the Consensus SRML, but instead of passingNone
, it passes a set of Session Keys (which it gets from the provided list of Account IDs of the new validators that are to be set that each map to a corresponding Session Key).And there isn't a
next_session
function like the comment suggests. I assume it meansrotate_session
, which is called by theon_finalise
method that is called at the end of each block and which callscheck_rotate_session
each time, and wherecheck_rotate_session
callsrotate_session
.Reference: https://hackmd.io/nr6kPD2sR4urmljtvHs0CQ?view#Session-Module
The text was updated successfully, but these errors were encountered: