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

90 upgradable contracts #100

Merged
merged 8 commits into from
Nov 27, 2022
Merged

90 upgradable contracts #100

merged 8 commits into from
Nov 27, 2022

Conversation

bal7hazar
Copy link
Contributor

@bal7hazar bal7hazar commented Nov 23, 2022

Fix #90 #94

@bal7hazar bal7hazar marked this pull request as ready for review November 24, 2022 13:04
tekkac
tekkac previously approved these changes Nov 24, 2022
Copy link
Member

@tekkac tekkac left a comment

Choose a reason for hiding this comment

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

LGTM 👍

src/project/project.cairo Show resolved Hide resolved
Copy link
Contributor

@cloudvenger cloudvenger left a comment

Choose a reason for hiding this comment

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

huge job !
Look good for me into src, protostar upgrade and good initiative to insert testnet-2.
In addition, I like the rework of the test/integrations because there is less code duplication event if it creates a library file huge.

I approve of the PR because I have no complaints about the src section and the script and uprgade. Thus, in view of the structuring changes, this must be merged in order not to create a conflict for the other PRs.

However, here is an important note that I would like to discuss in this thread:

In the tests (unit like integrations), I did not find any trace of tests of the upgrade function
(from offseter, yielder, minter, project SC) in order to test the proper functioning and implementation of the Proxy pattern.

Maybe, we should create a directory tests/integrations/migration or tests/integrations/upgradable or tests/integrations/sc-management where we are testing :

  • upgradable of smart-contract
  • changing of ownership
  • try to access/execute contracts without going through the proxy

What do you think @bal7hazar ?
I think, if we are agree to do this, put it in another PR because it only impacts the tests.

@bal7hazar
Copy link
Contributor Author

There is not point to unit test the proxy since we didn't implemented any logic for this.
We are just relying on OZ features (check proxy.cairo), it would make sense if we add additional logic in a proxy/library.cairo lib, but there is no need.
So basically we trust in OZ unit tests (as we do for ERC721) and we don't do the exact same tests from our side.

@bal7hazar
Copy link
Contributor Author

It can make sense to add some more integration tests such as upgrade a contract or change he admin.

However if a contract is deployed as an implementation through a proxy we cannot access it directly since there is no real contract. Since we want them upgradable, I don't think we need to e2e test them without proxy.

@cloudvenger
Copy link
Contributor

Agreed about the non-necessity to redo unit tests in this specific case, because it would be, as you say, reimplement the OZ tests.

Understood about the impossibility of accessing a contract without going through the proxy.

Indeed, I was not talking about testing them without going through the proxy, but about making sure that the proxy is the owner of the contracts and that we cannot do anything with the contracts without going through the Proxy.

As I said in my preview comment, for me, we can merge in the PR state.
And we can discuss how to do these integration tests (upgrade, change of ownership).

@bal7hazar bal7hazar merged commit 4bff86a into Carbonable:main Nov 27, 2022
@bal7hazar bal7hazar deleted the 90-upgradable-contracts branch November 27, 2022 13:49
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.

Upgradable contracts
3 participants