Is your feature request related to a problem? Please describe.
Now we can not execute staking tx (bond, nominate, unbond, change nominee, etc) in the last quarter of the last session of the era (or while election status is open, see example query).
This is dangerous! If you issue a staking tx when election is open, that tx will fail!
https://polkadot.js.org/api/substrate/storage.html#eraelectionstatus-electionstatus
Describe the solution you'd like
We should control election status before executing any staking related tx, probably we want to inform the user about it and/or disable staking actions while it's not allowed to use them.
Additional context
Example query:
const eraElectionStatus = await api.query.staking.eraElectionStatus();
console.log('eraElectionStatus:', eraElectionStatus);
Output:
eraElectionStatus: Close
Nice Mario
Let's show a warning and disable Next
how often does this happen?
Checking in RIOT (no doc about ^^), I saw a few times the warning message displayed in Polkadot JS UI and want to confirm!
Jaco confirmed: Last 1/4 of the last session of the era. (or 15min every 6 hours)
Maybe we add custom details like that to blockV2 scheme in API (i.e: isInElection: Boolean) per network? Same way as in transaction details. That way we can control in front.
we can do dynamic disabling in the transactionMetaData query. it would return:
{
disabled: true,
disabledReason: "You can't stake while validators get elected"
}
we can do dynamic disabling in the transactionMetaData query.
we could do the same for more complicated restaking things in Cosmos:
`
{
disabled: true,
disabledReason: "You can't restake to this validator. Your restake limit is reached. Read more here: ...."
}
sounds great. don't worry about this for delivery of M1 or M2 please!
Just for reference, the warning message shown by Polkadot JS UI:

we could show this message and block txs
OR
we could let the user make the tx and send it for them in 15 minutes when the election is over and tell them we'll take care of it for them 馃く
we could let the user make the tx and send it for them in 15 minutes when the election is over and tell them we'll take care of it for them
there could be a bunch of edge cases. the user i.e. can't do any other tx in the meantime or the sequence would bust the stalled tx
so probably we should show this message and block txs
and send them a notification when the period is over 馃槃
Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
Most helpful comment
we could do the same for more complicated restaking things in Cosmos:
`
{ disabled: true, disabledReason: "You can't restake to this validator. Your restake limit is reached. Read more here: ...." }