What problem does it solve?
This Skill documents how to perform safe, atomic upgrades of Cairo smart contracts on Starknet by replacing contract class hashes, integrating OpenZeppelin's UpgradeableComponent, and ensuring storage and access-control compatibility so upgrades do not corrupt state or enable unauthorized code replacement.
Core Features & Use Cases
- UpgradeableComponent integration: Guidance for declaring and wiring OpenZeppelin's UpgradeableComponent alongside an access control component and exposing an upgrade entrypoint that calls replace_class_syscall.
- Access control best practices: Recommendations to guard upgrade functions with Ownable, RBAC, multisig, or governance to prevent unauthorized upgrades.
- Storage compatibility and safety: Rules for preserving storage names and types, using substorage conventions, and avoiding major-version upgrades without review.
- Testing upgrade paths: Steps to deploy V1/V2 on a local devnet, migrate state, run validation checks, and verify event emission and API compatibility.
Quick Start
Declare and deploy the new class hash on-chain, guard an external upgrade function with your access control, call the upgrade to replace the class hash, and validate state and behavior on a local devnet.