onflow / flips

Flow Improvement Proposals
25 stars 22 forks source link

FLIP 179: Staged Contract Updates #179

Closed sisyphusSmiling closed 9 months ago

sisyphusSmiling commented 12 months ago

FLIP Issue: #203

This proposal outlines a mechanism for automated and efficient contract updates to take effect at or beyond a specified block height with the goal of minimizing recovery time following breaking improvements. Included in this FLIP is a design enabling contract developers to pre-define a sequence of contract updates across an arbitrary number of contracts and accounts, and either execute these updates themselves or delegate deployment authority to some trusted party.

bjartek commented 12 months ago

@JeffreyDoyle this is very interesting for flix.

sideninja commented 11 months ago

Nice idea! 👍
The part that worries me a bit (but is not really improving or making it worse to the current state) is what happens when one contract update fails, but maybe there can be a CLI tool supporting this and it can leverage mainnet/testnet emulator simulation to dry-run the updates. This is however out of the FLIP scope but I feel related to its integration.

sisyphusSmiling commented 11 months ago

maybe there can be a CLI tool supporting this and it can leverage mainnet/testnet emulator simulation to dry-run the updates

Love this idea @sideninja! That would be really helpful to prevent failed updates.

bjartek commented 11 months ago

I would slso like to add that in order to have a stable migration path to stable-cadence we need a way to test this process. I belive @joshuahannan created an issue about adding an invalid contract to emulator, but i could not find it now.

joshuahannan commented 11 months ago

@bjartek https://github.com/onflow/flow-emulator/issues/468

franklywatson commented 11 months ago

maybe there can be a CLI tool supporting this and it can leverage mainnet/testnet emulator simulation to dry-run the updates

Love this idea @sideninja! That would be really helpful to prevent failed updates.

cc @m-Peter

sisyphusSmiling commented 11 months ago

There is a stable cadence emulator now so the suggested code snippets and repo should be updated to use stable-cadence clmpatible syntax. In particilar the entitlements on Account permissions.

Thanks for the callouts @bjartek! I've got a draft PR here: https://github.com/sisyphusSmiling/contract-updater/pull/6

It's currently in draft bc there's a bug in the CLI pre-release related to passing transaction args that prevents running through manual testing.

If we're leaning toward approving this mechanism, though, I can start working on a test suite for pre- and post-Cadence 1.0 since we'll need both versions

I would slso like to add that in order to have a stable migration path to stable-cadence we need a way to test this process. I belive @joshuahannan created an issue about adding an invalid contract to emulator, but i could not find it now.

Agreed on this. Very necessary to put together guidance on upgrade paths and ensuring devs know how to prep contracts for updates.

sisyphusSmiling commented 7 months ago

Closing the comms loop here to point to the updated Cadence 1.0 migration plan. The contract detailed in this FLIP may still be useful for the purposes of coordinated contract upgrades whether it's Flow-managed or otherwise. Deployment of this contract is deprioritized in favor of a contract supporting network migration and will be revisited post-Cadence 1.0

See the latest changes to the staging contract interface here - https://github.com/onflow/contract-updater/pull/14

Update: Forum post covering the new staging mechanism