Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FLIP 179: Staged Contract Updates #179

Merged
merged 14 commits into from
Nov 15, 2023

Conversation

sisyphusSmiling
Copy link
Contributor

@sisyphusSmiling sisyphusSmiling commented Aug 30, 2023

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.

@sisyphusSmiling sisyphusSmiling self-assigned this Aug 30, 2023
@sisyphusSmiling sisyphusSmiling requested a review from a team August 30, 2023 22:42
@sisyphusSmiling sisyphusSmiling requested a review from a team August 30, 2023 23:22
@sisyphusSmiling sisyphusSmiling changed the title Sisyphus smiling/post spork contract migration Staged Contract Updates Aug 31, 2023
@sisyphusSmiling sisyphusSmiling marked this pull request as ready for review August 31, 2023 16:35
@sisyphusSmiling sisyphusSmiling requested a review from a team August 31, 2023 17:31
@bjartek
Copy link
Contributor

bjartek commented Aug 31, 2023

@JeffreyDoyle this is very interesting for flix.

@sisyphusSmiling sisyphusSmiling changed the title Staged Contract Updates FLIP - Staged Contract Updates Aug 31, 2023
@sideninja
Copy link
Contributor

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.

application/20230809-staged-contract-updates.md Outdated Show resolved Hide resolved
Comment on lines +377 to +378
These gaps are building opportunities beyond the scope of this design, and contributions on these fronts are very
welcome.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we saying we would want others to build this? Seems tenuous?

Without at least some of the above tooling seems like a pretty risky scenario?

Copy link
Contributor Author

@sisyphusSmiling sisyphusSmiling Sep 13, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My hope is that if implemented, there would be some integration with @onflow/flow-develop-experience-tools with things like @sideninja mentioned above.

As proposed, simulated configuration and updates will be possible with existing/planned dev tooling via Cadence 1.0 local Mainnet mirroring AFAIK. The real addition here would be 3/ as a nice to have IMHO, and, if widely adopted, could be a grant candidate that I don't see taking too long to implement - likely a simple FE + indexer with event views filtered to the authenticated Updater.

IOW I don't believe the lack of the tool is a blocker to this FLIP or any worse than the current state given adopters understand they should own their non-core dependencies.

Copy link
Member

@joshuahannan joshuahannan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really well designed and written! I hope we can have something like this

application/20230809-staged-contract-updates.md Outdated Show resolved Hide resolved
@sisyphusSmiling
Copy link
Contributor Author

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.

Copy link
Contributor

@bjartek bjartek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@bjartek
Copy link
Contributor

bjartek commented Sep 14, 2023

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
Copy link
Member

@franklywatson
Copy link
Contributor

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
Copy link
Contributor Author

sisyphusSmiling commented Sep 22, 2023

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: onflow/contract-updater#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 sisyphusSmiling changed the title FLIP - Staged Contract Updates Staged Contract Updates Sep 29, 2023
@j1010001 j1010001 added this to the OKR-23-Q4 milestone Oct 17, 2023
@j1010001 j1010001 changed the title Staged Contract Updates FLIP 179: Staged Contract Updates Oct 20, 2023
@sisyphusSmiling sisyphusSmiling merged commit f634234 into main Nov 15, 2023
@j1010001 j1010001 modified the milestones: OKR-23-Q4, C1.0-Launch-M2 Nov 15, 2023
@sisyphusSmiling sisyphusSmiling deleted the sisyphusSmiling/post-spork-contract-migration branch November 15, 2023 20:36
@sisyphusSmiling
Copy link
Contributor Author

sisyphusSmiling commented Jan 26, 2024

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 - onflow/contract-updater#14

Update: Forum post covering the new staging mechanism

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
flip: application Application FLIP
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants