starknet-hardhat-plugin
starknet-hardhat-plugin copied to clipboard
Make OpenZeppelin account contracts deployed by hardhat Upgradable
Since to migrating to cairo v1 after the starknet regenesis, we will need the account contract to be upgradable.
I'd love to fix this issue😊
We've implemented a Cairo v0.11 proxy which uses replace_class to make the proxy itself upgradable to Cairo 1.0.
We're unsure how to proceed and have a couple of questions:
- How should we implement tests? Right now, this seems impossible because v0.11 is not live yet.
- Should the proxy implementation reside in an MIT licensed repo at our organization such that only the compilation artifacts are kept in this repo?
- The currently used OZ account contract version is 0.5.1. Should this be upgraded to v0.6.1 at this opportunity?
Actually, anything which helps to pinpoint the scope of this issue is much appreciated😊
@TsBauer
We've implemented a Cairo v0.11 proxy which uses
replace_classto make the proxy itself upgradable to Cairo 1.0.
When you say you've implemented it, do you mean that you've written a smart contract yourself? Or reused something from the OpenZeppelin repo?
- How should we implement tests? Right now, this seems impossible because v0.11 is not live yet.
I'm ok with you creating a complete PR only when starknet 0.11 becomes live. Perhaps for now it can be a draft PR which instead of testing on starknet-devnet or testing on alpha-goerli (https://alpha4.starknet.io/) tests on the integration network (https://external.integration.starknet.io/). But I'm also ok with temporarily pausing this issue.
- Should the proxy implementation reside in an MIT licensed repo at our organization such that only the compilation artifacts are kept in this repo?
I'm ok with this approach if you don't think there is a better way.
- The currently used OZ account contract version is 0.5.1. Should this be upgraded to v0.6.1 at this opportunity?
Yes, you can upgrade to OZ v0.6.1
@FabijanC
When you say you've implemented it, do you mean that you've written a smart contract yourself? Or reused something from the OpenZeppelin repo?
We reused the OpenZeppelin proxy and merely added an upgrade function which allows to upgrade the proxy itself with the replace_class syscall.
@TsBauer
We reused the OpenZeppelin proxy and merely added an
upgradefunction which allows to upgrade the proxy itself with thereplace_classsyscall.
Surely OpenZeppelin isn't already working on this functionality? Maybe this: https://github.com/OpenZeppelin/cairo-contracts/pull/583
A problem with writing our own account classes is that we (or someone) will have to declare them on all testnets and mainnets.
@FabijanC
We reused the OpenZeppelin proxy and merely added an
upgradefunction which allows to upgrade the proxy itself with thereplace_classsyscall.Surely OpenZeppelin isn't already working on this functionality? Maybe this: OpenZeppelin/cairo-contracts#583
A problem with writing our own account classes is that we (or someone) will have to declare them on all testnets and mainnets.
I overlooked this PR when doing my research. Thanks for making me aware of this. You're certainly right. That's the way to go.
I'll use the integration network for testing and open a draft PR in the upcoming days.