Skip to content

Add upgradeability pattern to project#86

Open
eduv09 wants to merge 4 commits into
developfrom
upgradeables
Open

Add upgradeability pattern to project#86
eduv09 wants to merge 4 commits into
developfrom
upgradeables

Conversation

@eduv09
Copy link
Copy Markdown
Contributor

@eduv09 eduv09 commented May 26, 2026

Fixes #80

Copilot AI review requested due to automatic review settings May 26, 2026 15:17
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds optional Transparent Proxy upgradeability across the confidential token suite by refactoring the existing contracts into upgradeable “core” base contracts, adding proxy-friendly wrappers + deployment scripts, and introducing tests that validate initialization, access control, and upgrade behavior.

Changes:

  • Introduces *Core base contracts (upgradeable-friendly) and new contracts/upgradeable/* proxy-deployable entrypoints with initialize() + locked implementations.
  • Adds Hardhat Upgrades integration plus new upgradeable deployment scripts and proxy-admin ownership transfer/check helper.
  • Adds upgradeability-focused test coverage for proxy initialization, admin ownership, restricted calls, EIP-712 domain separator behavior, and storage persistence across upgrades; reorganizes generated docs accordingly.

Reviewed changes

Copilot reviewed 50 out of 51 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
yarn.lock Adds OZ upgradeable packages + upgrades plugin and new dev deps to lockfile.
package.json Adds OZ upgrades plugin and additional dev dependencies.
hardhat.config.ts Enables Hardhat upgrades plugin; configures Hardhat network settings for deployments/tests.
scripts/test_deploy.sh Exercises both non-upgradeable and upgradeable deployment scripts.
PLAN.md Adds an AI-agent audit plan document for this repository.
migrations/upgradeableOwnership.ts Implements ProxyAdmin ownership transfer + AccessManager admin-role checks post-deploy.
migrations/deployMintableUpgradeable.ts Deploys Mintable token behind a proxy and validates ownership/roles.
migrations/deployWrapperUpgradeable.ts Deploys Wrapper behind a proxy and validates ownership/roles.
migrations/deployMintable.ts Exports address storage + verification helpers for reuse.
migrations/deployWrapper.ts Exports address storage + verification helpers for reuse.
test/MintableConfidentialTokenUpgradeable.ts Adds proxy/upgrade tests for the mintable confidential token.
test/ConfidentialWrapperUpgradeable.ts Adds proxy/upgrade tests for the confidential wrapper.
contracts/core/ConfidentialTokenCore.sol New upgradeable-friendly base token implementation (init pattern + shared logic).
contracts/core/MintableConfidentialTokenCore.sol New base mint/burn extension built atop ConfidentialTokenCore.
contracts/core/ConfidentialWrapperCore.sol New base wrapper implementation with async wrap/unwrap flows.
contracts/upgradeable/ConfidentialTokenUpgradeable.sol New proxy entrypoint with initialize() + disabled initializers in ctor.
contracts/upgradeable/MintableConfidentialTokenUpgradeable.sol New proxy entrypoint for mintable token.
contracts/upgradeable/ConfidentialWrapperUpgradeable.sol New proxy entrypoint for wrapper.
contracts/ConfidentialToken.sol Refactors non-proxy deployment to reuse ConfidentialTokenCore initialization path.
contracts/MintableConfidentialToken.sol Refactors non-proxy mintable token to reuse MintableConfidentialTokenCore.
contracts/ConfidentialWrapper.sol Refactors non-proxy wrapper to reuse ConfidentialWrapperCore.
contracts/eip3009/EIP3009Upgradeable.sol Migrates EIP-3009 base to upgradeable OZ primitives + adds init hook.
contracts/eip3009/ConfidentialEIP3009Upgradeable.sol Migrates confidential EIP-3009 extension to upgradeable base + adds init hook.
contracts/interfaces/IConfidentialTokenUpgradeable.sol Adds initializer interface for proxy deployments.
contracts/interfaces/IMintableConfidentialTokenUpgradeable.sol Adds initializer interface for proxy deployments.
contracts/interfaces/IConfidentialWrapperUpgradeable.sol Adds initializer interface for proxy deployments.
docs/upgradeable/ConfidentialTokenUpgradeable.md Adds generated docs for upgradeable token entrypoint.
docs/upgradeable/MintableConfidentialTokenUpgradeable.md Adds generated docs for upgradeable mintable entrypoint.
docs/upgradeable/ConfidentialWrapperUpgradeable.md Adds generated docs for upgradeable wrapper entrypoint.
docs/interfaces/IConfidentialTokenUpgradeable.md Adds generated docs for upgradeable initializer interface.
docs/interfaces/IMintableConfidentialTokenUpgradeable.md Adds generated docs for upgradeable initializer interface.
docs/interfaces/IConfidentialWrapperUpgradeable.md Adds generated docs for upgradeable initializer interface.
docs/eip3009/EIP3009Upgradeable.md Renames/updates generated docs to match upgradeable contract naming/init.
docs/eip3009/ConfidentialEIP3009Upgradeable.md Renames/updates generated docs to match upgradeable contract naming/init.
docs/core/ConfidentialTokenCore.md Adds generated docs for new core base contract.
docs/core/MintableConfidentialTokenCore.md Adds generated docs for new core base contract.
docs/core/ConfidentialWrapperCore.md Adds generated docs for new core base contract.
docs/ConfidentialToken.md Removes large sections (likely moved to docs/core/*).
docs/ConfidentialWrapper.md Removes large sections (likely moved to docs/core/*).
docs/MintableConfidentialToken.md Removes mint/burn docs (likely moved to docs/core/*).
docs/types.md Deletes generated docs (now redundant/moved).
docs/Precompiled.md Deletes generated docs (now redundant/moved).
docs/lib/IERC20Internal.md Deletes generated docs (now redundant/moved).
docs/lib/EIP712Domain.md Deletes generated docs (now redundant/moved).
docs/lib/EIP712.md Deletes generated docs (now redundant/moved).
docs/lib/EIP3009.md Deletes generated docs (now redundant/moved).
docs/lib/EIP2612.md Deletes generated docs (now redundant/moved).
docs/lib/ECRecover.md Deletes generated docs (now redundant/moved).
docs/interfaces/IMintableConfidentialToken.md Deletes generated docs (superseded by core/upgradeable splits).
docs/interfaces/bite/IBiteSupplicant.md Deletes generated docs (now redundant/moved).

Comment thread package.json
Comment thread hardhat.config.ts
Comment on lines 24 to 30
]
},
networks: {
hardhat: {
allowUnlimitedContractSize: true,
},
custom: {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Not ideal but currently necessary. On SKALE chains this limit is bigger I think so no big issues. Alternatives & improvements are welcome - reducing optimizer runs is not enough

@eduv09 eduv09 marked this pull request as ready for review May 26, 2026 15:37
@eduv09 eduv09 requested a review from DimaStebaev as a code owner May 26, 2026 15:37
Copilot AI review requested due to automatic review settings May 26, 2026 15:37
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 49 out of 50 changed files in this pull request and generated 2 comments.

Comment thread migrations/deployMintableUpgradeable.ts
Comment thread migrations/deployWrapperUpgradeable.ts
@codecov
Copy link
Copy Markdown

codecov Bot commented May 26, 2026

Codecov Report

❌ Patch coverage is 95.95687% with 15 lines in your changes missing coverage. Please review.
✅ Project coverage is 96.50%. Comparing base (cd11d4c) to head (5a8d78f).

Files with missing lines Patch % Lines
contracts/core/ConfidentialTokenCore.sol 97.59% 7 Missing ⚠️
...racts/upgradeable/ConfidentialTokenUpgradeable.sol 0.00% 5 Missing ⚠️
contracts/core/ConfidentialWrapperCore.sol 96.15% 2 Missing ⚠️
contracts/ConfidentialToken.sol 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop      #86      +/-   ##
===========================================
- Coverage    97.84%   96.50%   -1.34%     
===========================================
  Files            7       13       +6     
  Lines          417      458      +41     
  Branches        95      104       +9     
===========================================
+ Hits           408      442      +34     
- Misses           9       16       +7     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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.

Add ability to deploy using transparent upgradeable proxy

2 participants