Skip to content
  • Peter Goodspeed-Niklaus's avatar
    Multi-phase elections solution resubmission (#8290) · de5d0b23
    Peter Goodspeed-Niklaus authored
    
    
    * not climate
    
    * explain the intent of the bool in the unsigned phase
    
    * remove glob imports from unsigned.rs
    
    * add OffchainRepeat parameter to ElectionProviderMultiPhase
    
    * migrate core logic from #7976
    
    This is a much smaller diff than that PR contained, but I think
    it contains all the essentials.
    
    * improve formatting
    
    * fix test build failures
    
    * cause test to pass
    
    * Apply suggestions from code review
    
    Co-authored-by: default avatarKian Paimani <[email protected]>
    
    * collapse imports
    
    * threshold acquired directly within try_acquire_offchain_lock
    
    * add test of resubmission after interval
    
    * add test that ocw can regenerate a failed cache when resubmitting
    
    * ensure that OCW solutions are of the correct round
    
    This should help prevent stale cached solutions from persisting
    past the election for which they are intended.
    
    * add test of pre-dispatch round check
    
    * use `RawSolution.round` instead of redundantly externally
    
    * unpack imports
    
    Co-authored-by: default avatarKian Paimani <[email protected]>
    
    * rename `OFFCHAIN_HEAD_DB` -> `OFFCHAIN_LOCK`
    
    * rename `mine_call` -> `mine_checked_call`
    
    * eliminate extraneous comma
    
    * check cached call is current before submitting
    
    * remove unused consts introduced by bad merge.
    
    Co-authored-by: default avatarGuillaume Thiolliere <[email protected]>
    
    * resubmit when our solution beats queued solution
    
    * clear call cache if solution fails to submit
    
    * use local storage; clear on ElectionFinalized
    
    * Revert "use local storage; clear on ElectionFinalized"
    
    This reverts commit 4b46a9388532d0c09b337dc7c7edf76044a6cee8.
    
    * BROKEN: try to filter local events in OCW
    
    * use local storage; simplify score fetching
    
    * fix event filter
    
    * mutate storage instead of setting it
    
    * StorageValueRef::local isn't actually implemented yet
    
    * add logging for some events of interest in OCW miner
    
    * rename kill_solution -> kill_ocw_solution to avoid ambiguity
    
    * defensive err instead of unreachable given unreachable code
    
    * doc punctuation
    
    Co-authored-by: default avatarKian Paimani <[email protected]>
    
    * distinguish miner errors between "out of date" and "call invalid"
    
    * downgrade info logs -> debug
    
    * ensure encoded call decodes as a call
    
    * fix semantics of validation of pre-dispatch failure for wrong round
    
    * move score check within `and_then`
    
    * add test that offchain workers clear their cache after election
    
    * ensure that bad ocw submissions are not retained for resubmission
    
    * simplify fn ocw_solution_exists
    
    * add feasibility check when restoring cached solution
    
    should address https://github.com/paritytech/substrate/pull/8290/files#r617533358
    
    
    
    restructures how the checks are sequenced, which simplifies legibility.
    
    * simplify checks again
    
    Co-authored-by: default avatarKian Paimani <[email protected]>
    Co-authored-by: default avatarGuillaume Thiolliere <[email protected]>
    de5d0b23