flow-go icon indicating copy to clipboard operation
flow-go copied to clipboard

Handle unsealed invalid service events

Open jordanschalm opened this issue 2 years ago • 1 comments

This PR improves handling of unsealed invalid service events. Currently, observation of an invalid service event triggers epoch fallback upon insertion of the block where the service event takes effect, even if that block is not yet finalized. With this change, processing an invalid service event instead marks an un-finalized fork's EpochStatus as "tentatively triggering epoch fallback". Only when the fork is finalized, is epoch fallback globally triggered.

Changes

  • Adds InvalidServiceEventIncorporated flag to EpochStatus, which is set when an invalid service event is processed on this fork
  • Modifies epoch fallback triggering logic
    • Removes all cases where block insertion can trigger epoch fallback
    • When finalizing a block, additionally checks whether the InvalidServiceEventIncorporated flag is set, and if so triggers epoch fallback
    • Modifies behaviour of out-of-order service events to be consistent. Previously processing an EpochCommit before an EpochSetup would return an error, rather than triggering epoch fallback, as desired. Now all cases trigger epoch fallback.
  • Refactors invalid service event tests
    • All blocks are now finalized, so all tests use a separate state instance

jordanschalm avatar Aug 12 '22 19:08 jordanschalm

Codecov Report

Merging #2969 (d6ee585) into feature/active-pacemaker (8bc1222) will decrease coverage by 0.22%. The diff coverage is 53.57%.

@@                     Coverage Diff                      @@
##           feature/active-pacemaker    #2969      +/-   ##
============================================================
- Coverage                     55.54%   55.32%   -0.23%     
============================================================
  Files                           749      702      -47     
  Lines                         69513    67001    -2512     
============================================================
- Hits                          38614    37071    -1543     
+ Misses                        27765    26857     -908     
+ Partials                       3134     3073      -61     
Flag Coverage Δ
unittests 55.32% <53.57%> (-0.23%) :arrow_down:

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
model/flow/epoch.go 48.45% <ø> (ø)
state/protocol/badger/state.go 53.30% <ø> (ø)
storage/badger/operation/epoch.go 45.16% <ø> (ø)
utils/unittest/protocol_state.go 0.00% <0.00%> (ø)
state/protocol/badger/mutator.go 64.15% <61.22%> (-0.94%) :arrow_down:
fvm/environment/contract_updater.go 66.54% <0.00%> (-0.72%) :arrow_down:
admin/command_runner.go 79.88% <0.00%> (ø)
network/queue/queueWorker.go
network/p2p/compressed/mockStream.go
... and 46 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

codecov-commenter avatar Aug 12 '22 23:08 codecov-commenter