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

Reject indirect incompatible updates to composite declarations #772

Merged
merged 2 commits into from
Apr 7, 2021

Conversation

SupunS
Copy link
Member

@SupunS SupunS commented Apr 6, 2021

Closes #771

Description

Currently, doing incompatible changes to a composite type (like changing field types, adding new fields, etc) is not allowed. However, it is possible to remove an existing composite type, and add another composite type with the same name, but with a different structure, which has the same effect as doing an incompatible change.

This PR rejects such indirect changes to a struct. With this,

  • Removing any existing composite type declaration is not allowed
  • Adding new composite type declarations is allowed

For contributor use:

  • Targeted PR against master branch
  • Linked to Github issue with discussion and accepted design OR link to spec that describes this work
  • Code follows the standards mentioned here
  • Updated relevant documentation
  • Re-reviewed Files changed in the Github PR explorer
  • Added appropriate labels

@SupunS SupunS requested a review from turbolent as a code owner April 6, 2021 10:40
@SupunS SupunS self-assigned this Apr 6, 2021
@SupunS SupunS force-pushed the supun/composite-update-validation branch from cb78cac to a129859 Compare April 6, 2021 10:52
Copy link
Member

@turbolent turbolent left a comment

Choose a reason for hiding this comment

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

This is great! Good catch 👍

runtime/errors.go Outdated Show resolved Hide resolved
Co-authored-by: Bastian Müller <bastian@axiomzen.co>
@SupunS SupunS force-pushed the supun/composite-update-validation branch from e1564b2 to a9d8e1d Compare April 7, 2021 02:56
@SupunS SupunS merged commit b12213c into master Apr 7, 2021
@SupunS SupunS deleted the supun/composite-update-validation branch April 7, 2021 03:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Reject indirect changes to composite types during contract updates
2 participants