-
Notifications
You must be signed in to change notification settings - Fork 137
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
Allow removal of enum declarations from contract interfaces for C1.0 upgrade #3197
Conversation
Cadence Benchstat comparisonThis branch with compared with the base branch onflow:master commit ae127d3 Collapsed results for better readability
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #3197 +/- ##
==========================================
+ Coverage 80.66% 80.68% +0.02%
==========================================
Files 380 380
Lines 93155 93179 +24
==========================================
+ Hits 75141 75181 +40
+ Misses 15306 15292 -14
+ Partials 2708 2706 -2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
Could you please also add or check we already have a test that it is not possible to add a new enum declaration?
runtime/stdlib/cadence_v0.42_to_v1_contract_upgrade_validation_test.go
Outdated
Show resolved
Hide resolved
…_test.go Co-authored-by: Supun Setunga <supun.setunga@gmail.com>
Why should this not be possible? This should be allowed even by the regular validator. |
We can only allow the removal if we also forbid the addition, otherwise an incompatible declaration could be reintroduced, circumventing the update checking rules for enums. I should have been maybe more specific, but I meant enum declarations added to interfaces in particular. I guess type checking on its own already rejects concrete type declarations (like e.g. structs, and enums) for in interfaces for all but events? (event declarations in interfaces are a particular exception (https://github.com/onflow/flips/blob/main/cadence/20230711-remove-type-requirements.md#defining-concrete-events-in-interfaces) |
Oh, yes in that case the new type checking will prevent enums from being added to interfaces implicitly; those contracts won't type check so there's no need to forbid it in the validator. |
Closes #3182
This allows enum declarations to be removed from contract interfaces as part of the Cadence 1.0 upgrade. While in general this is not a safe operation to permit, analysis of mainnet contracts indicates that there are a small number of existing declarations of this kind, none of which are used in fields that themselves cannot be easily removed.
master
branchFiles changed
in the Github PR explorer