-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Fix test for Substrate#9898 #9907
Fix test for Substrate#9898 #9907
Conversation
roll_to(25); | ||
assert_eq!(MultiPhase::current_phase(), Phase::Unsigned((true, 25))); | ||
const BLOCK: u64 = 25; | ||
let block_plus = |delta: u64| BLOCK + delta; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is an idiom taken from the other tests in this file
// we must clear the offchain storage to ensure the offchain execution check doesn't get | ||
// in the way. | ||
let mut storage = StorageValueRef::persistent(&OFFCHAIN_LAST_BLOCK); | ||
storage.clear(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clearing the storage here appears to be irrelevant because it starts out empty
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I actually always thought it to be an overkill and wanted to remove it :p
// we don't actually care about the result of the election | ||
roll_to(26); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
afaict every call to roll_to
after the first is not relevant to the test
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks!
* dont read events in elections anymore. * Update frame/election-provider-multi-phase/src/lib.rs * Fix test for Substrate#9898 (#9907) Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com> Co-authored-by: Zeke Mostov <32168567+emostov@users.noreply.github.com>
target branch: kiz-improve-ocw-resubmit
target pr: #9898
Prior to #9898, the election OCW cleared its cached solution whenever it saw events from
do_elect
. Now, the election OCW only clears its solution when run on the first block of the unsigned phase. In this PR the relevant test is updated to try and document the change.