Am I fundamentally misunderstanding how staking handles election timings, please? I've been trying to change the number of eras in a session, to increase the number of elections for testing.
I expected that we get a validator election every era, so reducing the sessions per era should increase the frequency of elections. I found and modified this constant, which was originally 6:
pub const SessionsPerEra: sp_staking::SessionIndex = 2;
in bin/node/runtime/src/lib.rs
It's showing as changed in storage according to Polkadot.js, but I'm still getting 6 sessions per era anyway? (Chain started from genesis with this setting.)
I've also managed to create another example, where I have 6 sessionsPerEra defined in the code, but the chain is hanging after 2 sessions, with Babe complaining that there is an unexpected change of era. I've been trying 1, 2 or 6 sessions per era, trying to work out what's wrong.
sessionsPerEra
in the chain spec code block? What you mean by this?"genesis": { "runtime": { "system": { "code: {}}}}
in the chainspec that gets encoded asgenesis --> runtime --> top
when you process the chainspec to raw. However, I guess that doesn't actually make sense - the whole point of them being constant is that they don't need don't need to be read from storage.