1

I've seen some websites display the estimated time remaining for the current session/epoch. Is there a Rust call for this? Is there a sample of that code?

1

1 Answer 1

1

This entirely depends on the configuration of pallet_session.

First, this pallet itself does not enforce when sessions change. This is configured via ShoulEndSession.

Second, there is also EstimateNextSessionRotation which you can always call to estimate when the next session would rotate. This might be accurate or an estimate based on the former configuration.

For each trait, look at the list of implementors to see what options you have.

For example, if pallet-babe is used as the former, then latter becomes an estimate, because babe uses a time-based session length, and if blocks are missed, then the session is essentially shortened in therms of block numbers.

Contrary, if PeriodicSession is used, the session length is fixed in terms of block numbers and the estimate you get is also constant.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.