Uh oh!
There was an error while loading. Please reload this page.
Fix tracking validator set in ImOnline - #3596
Conversation
| } | ||
| } | ||
| impl PartialOrd for UintAuthorityId { |
| } | ||
| } | ||
| impl Ord for UintAuthorityId { |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Co-Authored-By: Bastian Köcher <bkchr@users.noreply.github.com>
… into td-imonline-session
| }; | ||
| let signature = id.sign(&heartbeat.encode()).unwrap(); | ||
| // when |
| assert!(!ImOnline::is_online_in_current_session(0)); | ||
| // when | ||
| heartbeat(block, 2, 0, 1.into()); |
There was a problem hiding this comment.
I don't get how in block 1 session_index = 2
There was a problem hiding this comment.
(I changed the code a bit but my question still holds)
(I am aware of the buffering and that we need one extra rotate_session to write the buffered validators)
There was a problem hiding this comment.
Session rotations are independent of blocks. In regular node-runtime that would never happen though.
| assert_eq!(Session::current_index(), 2); | ||
| // TODO: hmmm... | ||
| assert_eq!(Session::validators(), vec![1, 2, 3]); |
There was a problem hiding this comment.
why? I was expecting all 6 of them to get buffered.
There was a problem hiding this comment.
The first time you call advance_session we switch to:current(vec![]), queued(vec![1, 2, 3])
second time you call advance_session we switch to:current(vec![1, 2, 3]), queued(vec![1,...6]))
Initially both current and queued are empty.
kianenigma
left a comment
There was a problem hiding this comment.
Added another small test, one should probably add a LOT more in a separate PR; looks good as-is to be merged and fix a potentially critical issue.
| advance_session(); | ||
| assert_eq!(Session::current_index(), 2); | ||
| // TODO: hmmm... |
There was a problem hiding this comment.
Was this ToDo forgotten here? If not a follow-up ticket or a better explanation would be nice.
There was a problem hiding this comment.
Removed, it was addressed by this comment: #3596 (comment)
There was a problem hiding this comment.
Yes, my bad. I should have just asked the question. Writing to TODO was maybe too much :D
tomusdrw
commented
Sep 13, 2019
Everything fixed now, should be good to go. |
* Use session::validators instead of staking::current_elected * Basic test framework. * Initialize validators, attempt to heartbeat. * Use dummy crypto for im-online testing. * Remove printlns. * Finish test, make it invalid. * Add reporting test. * Finalize the test. * Remove dumbness. * Updates. * Update AuRa * Update srml/im-online/src/tests.rs Co-Authored-By: Bastian Köcher <bkchr@users.noreply.github.com> * Derive Ord * Add some more tests. * Remove stray todo. * Bump runtime version. * Bump impl-trait-for-tuples. * Enforce new version of trait-for-tuples.
* Use session::validators instead of staking::current_elected * Basic test framework. * Initialize validators, attempt to heartbeat. * Use dummy crypto for im-online testing. * Remove printlns. * Finish test, make it invalid. * Add reporting test. * Finalize the test. * Remove dumbness. * Updates. * Update AuRa * Update srml/im-online/src/tests.rs Co-Authored-By: Bastian Köcher <bkchr@users.noreply.github.com> * Derive Ord * Add some more tests. * Remove stray todo. * Bump runtime version. * Bump impl-trait-for-tuples. * Enforce new version of trait-for-tuples.
* Use session::validators instead of staking::current_elected * Basic test framework. * Initialize validators, attempt to heartbeat. * Use dummy crypto for im-online testing. * Remove printlns. * Finish test, make it invalid. * Add reporting test. * Finalize the test. * Remove dumbness. * Updates. * Update AuRa * Update srml/im-online/src/tests.rs Co-Authored-By: Bastian Köcher <bkchr@users.noreply.github.com> * Derive Ord * Add some more tests. * Remove stray todo. * Bump runtime version. * Bump impl-trait-for-tuples. * Enforce new version of trait-for-tuples.
Resolves#3553
Currently
im-onlineis using (indirectly)staking::current_elected_setto get the validators and report those who didn't send aHeartbeat.That's incorrect, since
sessionis buffering the keys (and validator set changes). In this PR we useSession::validatorsinstead, which allows us to get rid of the extra associated type.im-onlinemodule.stakingAppKey).UintAuthorityIdmore usable in tests.Polkadot PR: #429