cya icon indicating copy to clipboard operation
cya copied to clipboard

[Cadence 1.0] Add `ProtocolStateVersionUpgrade` service event

Open jordanschalm opened this issue 10 months ago • 0 comments

This PR adds a minimal version of a service event to upgrade the protocol state version (see also https://github.com/onflow/flow-go/pull/5428). This is a Cadence 1.0 compatible port of https://github.com/onflow/flow-core-contracts/pull/411.

There is an integration test validating the new service event is processed in https://github.com/onflow/flow-go/pull/5477.

Context

The plan is to deploy this changes alongside EFM Recovery (see branch

Outstanding TODOs

  • [x] Alongside https://github.com/onflow/flow-go/issues/5828, remove storage-then-emit-on-heartbeat logic
  • [ ] Re-enable TestProtocolVersionUpgrade integration test in flow-go before merging.

For now, I have added this service event to the NodeVersionBeacon contract, which has some benefits and drawbacks:

  • Conceptually ProtocolStateVersionUpgrade does something similar to the existing Version Beacon, so it makes sense for their logic to be together
  • The Version Beacon contract already has a Heartbeat resource hooked up to the system chunk, which is necessary to emit service events
  • The existing version beacon code is written in a way that suggests the version it is operating on is global, rather than specifically scoped to the Execution State Machine
    • This, combined with the limitations of upgrading contracts, makes adding ProtocolStateVersionUpgrade cleanly difficult

jordanschalm avatar Apr 08 '24 12:04 jordanschalm