cya
cya copied to clipboard
[Cadence 1.0] Add `ProtocolStateVersionUpgrade` service event
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 inflow-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
- This, combined with the limitations of upgrading contracts, makes adding