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

1706 improve versioning for the light client contract #1800

Merged

Conversation

alysiahuggins
Copy link
Contributor

@alysiahuggins alysiahuggins commented Jul 30, 2024

Closes #1706

This PR:

This PR does not:

  • write explicit tests for common bugs in upgradeable contracts such as storage collisions

Key places to review:

  • changes to the LightClient contract
  • how extending a struct is handled in the LightClientV2 contract

How to test this PR:

forge test --match-contract LightClientUpgradeToV2Test
just sol-test

Things tested

  • adding a new field works
  • adding an extended struct for handling of new struct elements

To Do

  • ensure deployment works with openzeppelin defender to make sure other security checks pass

@alysiahuggins alysiahuggins changed the title DRAFT PR | 1706 improve versioning for the light client contract 1706 improve versioning for the light client contract Aug 7, 2024
@alysiahuggins alysiahuggins requested a review from Sneh1999 August 7, 2024 20:51
);
}

// that the data remains the same after upgrading the implementation
Copy link
Contributor

@Sneh1999 Sneh1999 Aug 12, 2024

Choose a reason for hiding this comment

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

nit: test that the data remains the same after upgrading the implementation

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sorted here 7c3569c

assertEq(lcV1Proxy.frozenThreshold(), stateV1.threshold);
}

// that the data remains the same after upgrading the implementation
Copy link
Contributor

@Sneh1999 Sneh1999 Aug 12, 2024

Choose a reason for hiding this comment

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

nit: test that the data remains the same after upgrading the implementation

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sorted here 7c3569c

@@ -0,0 +1,194 @@
# Smart Contract Upgrades

Code on the EVM is immutable but via proxies, smart contracts can be “upgraded”. A proxy contract acts as an
Copy link
Contributor

Choose a reason for hiding this comment

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

I think the documentation should be little more specific to our contracts - the _Example:_ section should have an example of how one should proceed if they need to upgrade LightClient.sol. Otherwise I think, this becomes general documentation about smart contract upgradeability which can be found online. What are your thoughts on the same?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fair point, i'll add more info specific to LightClient.sol

Copy link
Contributor Author

@alysiahuggins alysiahuggins Aug 20, 2024

Choose a reason for hiding this comment

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

sorted in this commit and previous commits 105e26a

@alysiahuggins alysiahuggins requested a review from Sneh1999 August 20, 2024 16:46
Copy link
Contributor

@Sneh1999 Sneh1999 left a comment

Choose a reason for hiding this comment

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

LGTM!

@alysiahuggins alysiahuggins merged commit 462583d into main Aug 21, 2024
15 checks passed
@alysiahuggins alysiahuggins deleted the 1706-improve-versioning-for-the-light-client-contract branch August 21, 2024 12:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

improve versioning for the light client contract
2 participants