Skip to content

feat: deploy transparent proxy contracts [skip-line-limit]#987

Merged
ryardley merged 8 commits into
devfrom
feat/upgrade-contracts
Nov 11, 2025
Merged

feat: deploy transparent proxy contracts [skip-line-limit]#987
ryardley merged 8 commits into
devfrom
feat/upgrade-contracts

Conversation

@hmzakhalid

@hmzakhalid hmzakhalid commented Nov 9, 2025

Copy link
Copy Markdown
Collaborator

The reason for skipping the line limit is that many of the changes are updated contract addresses in the JSON files/Comments/File Header fixes.

Summary by CodeRabbit

  • Refactor

    • Core contracts switched to an upgradeable proxy deployment pattern (implementation + proxy) to enable on-chain upgrades.
  • Chores

    • Updated sample and test configuration addresses and deployment metadata to reference proxy and implementation addresses.
    • Expanded build pipeline to include proxy-related contracts.
    • Added upgrade/proxy utilities and upgrade scripts.
  • Tests

    • Adjusted tests and fixtures to operate against proxy-deployed contracts.
  • Style

    • Added license header and minor formatting updates.

@vercel

vercel Bot commented Nov 9, 2025

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

2 Skipped Deployments
Project Deployment Preview Comments Updated (UTC)
crisp Skipped Skipped Nov 10, 2025 1:22pm
enclave-docs Skipped Skipped Nov 10, 2025 1:22pm

@coderabbitai

coderabbitai Bot commented Nov 9, 2025

Copy link
Copy Markdown
Contributor

Walkthrough

Switches Enclave, BondingRegistry, and CiphernodeRegistryOwnable to an upgradeable proxy pattern: constructors now disable initializers, initialization is performed via initialize(), ignition/deploy scripts deploy implementations plus TransparentUpgradeableProxy with encoded init data, added proxy utilities and upgrade/upgrade-scripts, and updated example/config deployment addresses and artifacts.

Changes

Cohort / File(s) Summary
Contract constructors & initialization
packages/enclave-contracts/contracts/Enclave.sol, packages/enclave-contracts/contracts/registry/BondingRegistry.sol, packages/enclave-contracts/contracts/registry/CiphernodeRegistryOwnable.sol
Replaced parameterized constructors with parameterless constructors calling _disableInitializers(); moved constructor logic into initialize(); BondingRegistry removed in-file default for licenseActiveBps and sets it during initialize().
Ignition deployment modules
packages/enclave-contracts/ignition/modules/enclave.ts, packages/enclave-contracts/ignition/modules/bondingRegistry.ts, packages/enclave-contracts/ignition/modules/ciphernodeRegistry.ts
Deploy implementations without ctor args, build initData (encoded initialize(...)), deploy TransparentUpgradeableProxy(impl, owner, initData), and return proxy as the primary contract reference.
Deploy & upgrade scripts
packages/enclave-contracts/scripts/deployAndSave/enclave.ts, packages/enclave-contracts/scripts/deployAndSave/bondingRegistry.ts, packages/enclave-contracts/scripts/deployAndSave/ciphernodeRegistryOwnable.ts
Deploy via proxy and persist both proxy and implementation addresses; added upgradeAndSave* functions to deploy a new implementation and call ProxyAdmin.upgradeAndCall, updating saved deployment args and logging implementation addresses.
Proxy utilities & helpers
packages/enclave-contracts/scripts/proxy.ts, packages/enclave-contracts/scripts/utils.ts
Added ERC1967_ADMIN_SLOT, getProxyAdmin(provider, proxyAddress), verifyProxyAdminOwner(proxyAdmin, expectedOwner), and extended DeploymentArgs with optional implementationAddress.
Upgrade orchestration scripts
packages/enclave-contracts/scripts/upgrade/enclave.ts, packages/enclave-contracts/scripts/upgrade/bondingRegistry.ts, packages/enclave-contracts/scripts/upgrade/ciphernodeRegistryOwnable.ts
New scripts that validate proxies on-chain, deploy new implementations, run upgrade flows, and log proxy + new implementation addresses; each exports a top-level upgrade function and executes it.
Package & build config
packages/enclave-contracts/hardhat.config.ts, templates/default/hardhat.config.ts, packages/enclave-contracts/package.json
Added OpenZeppelin proxy files (ProxyAdmin.sol, TransparentUpgradeableProxy.sol) to npmFilesToBuild; added npm scripts: upgrade:enclave, upgrade:bondingRegistry, upgrade:ciphernodeRegistryOwnable.
Deployment records & templates
examples/CRISP/*, templates/default/enclave.config.yaml, tests/integration/enclave.config.yaml, packages/enclave-contracts/deployed_contracts.json, examples/CRISP/packages/crisp-contracts/deployed_contracts.json
Updated many deployed addresses (Enclave, CiphernodeRegistry, BondingRegistry, E3 program, InputValidator) and added or updated implementationAddress and blockNumber fields in deployment JSON records and example configs.
Tests updated for proxy flow
packages/enclave-contracts/test/Enclave.spec.ts, packages/enclave-contracts/test/Registry/CiphernodeRegistryOwnable.spec.ts
Adjusted tests to connect via factories and to operate against proxy instances; updated deployment and assertion sequences for implementation+proxy + initData patterns.
Artifacts metadata
packages/enclave-contracts/artifacts/contracts/interfaces/*/*.json
buildInfoId values updated in several interface artifact JSON files (compiler/build metadata change).
Examples env/readme & small files
examples/CRISP/Readme.md, examples/CRISP/client/.env.example, examples/CRISP/server/.env.example, examples/CRISP/enclave.config.yaml, examples/CRISP/circuits/src/ciphertext_addition.nr, examples/CRISP/packages/crisp-contracts/deploy/crisp.ts
Updated illustrative/default addresses and example E3 program address; added license header to one circuit file; minor formatting and deployment-arg addition (IMAGE_ID included for CRISPProgram).

Sequence Diagram(s)

sequenceDiagram
    participant Dev as Deployer
    participant Ign as Ignition / Scripts
    participant Impl as Implementation (uninitialized)
    participant Proxy as TransparentUpgradeableProxy
    participant Admin as ProxyAdmin

    rect rgb(240,248,255)
    Note over Dev,Impl: Old direct-constructor flow
    Dev->>Ign: deploy Contract(owner, registry, ...)
    Ign->>Impl: new Contract(...constructor...)
    Impl-->>Ign: Deployed & initialized
    end

    rect rgb(255,250,240)
    Note over Dev,Proxy: New proxy + initializer flow
    Dev->>Ign: deploy implementation (no args)
    Ign->>Impl: new Contract()
    Impl-->>Ign: Implementation address
    Ign->>Ign: encode initialize(owner, registry, ...)
    Ign->>Proxy: deploy TransparentUpgradeableProxy(impl, owner, initData)
    Proxy->>Impl: delegatecall initialize(...)
    Impl-->>Proxy: initialized state via proxy
    Proxy-->>Ign: Proxy address (usable)
    end

    rect rgb(245,255,250)
    Note over Dev,Admin: Upgrade flow
    Dev->>Admin: upgradeAndCall(proxy, newImpl, 0x)
    Admin->>Proxy: change implementation pointer
    Proxy-->>Admin: success
    end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

  • Areas to focus on:
    • Correctness of _disableInitializers() usage and that initialize() fully reproduces prior constructor state.
    • Consistency and correctness of initData encoding across ignition modules, deploy scripts, and tests.
    • getProxyAdmin() reading of ERC-1967 admin slot and verifyProxyAdminOwner() behavior.
    • Upgrade scripts' validations (proxy existence, on-chain code checks), ProxyAdmin ownership assumptions, and error handling.
    • Tests adapted to proxies: ensure factories .connect() and address wiring target proxies, not implementations.

Possibly related PRs

Suggested reviewers

  • cedoor
  • ctrlc03
  • 0xjei

Poem

🐇 I hopped where proxies now stand tall,
Impl sleeps quiet, init answers the call.
Constructors hushed, upgrades take flight,
A tiny hop — deployment feels right.
Forward we bound, with a joyful bite.

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat: deploy transparent proxy contracts' accurately reflects the main change in the pull request, which introduces transparent proxy pattern deployment across multiple contracts (Enclave, BondingRegistry, CiphernodeRegistryOwnable).
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/upgrade-contracts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@vercel vercel Bot temporarily deployed to Preview – enclave-docs November 10, 2025 12:40 Inactive
@hmzakhalid hmzakhalid changed the title feat: deploy transparent proxy contracts feat: deploy transparent proxy contracts [skip-line-limit] Nov 10, 2025
@hmzakhalid hmzakhalid marked this pull request as ready for review November 10, 2025 12:44

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 11

🧹 Nitpick comments (1)
packages/enclave-contracts/scripts/deployAndSave/ciphernodeRegistryOwnable.ts (1)

179-180: Address the TODO comment for initialization data.

The upgrade flow uses a placeholder "0x" for initialization data. If the upgrade requires calling an initialization function on the new implementation, this will need to be implemented.

Do you want me to help implement the initialization data encoding, or would you like me to open a new issue to track this task?

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 418e42f and 191e0da.

📒 Files selected for processing (31)
  • examples/CRISP/Readme.md (2 hunks)
  • examples/CRISP/client/.env.example (1 hunks)
  • examples/CRISP/enclave.config.yaml (1 hunks)
  • examples/CRISP/packages/crisp-contracts/deployed_contracts.json (1 hunks)
  • examples/CRISP/packages/crisp-contracts/hardhat.config.ts (1 hunks)
  • examples/CRISP/server/.env.example (1 hunks)
  • packages/enclave-contracts/artifacts/contracts/interfaces/IBondingRegistry.sol/IBondingRegistry.json (1 hunks)
  • packages/enclave-contracts/artifacts/contracts/interfaces/ICiphernodeRegistry.sol/ICiphernodeRegistry.json (1 hunks)
  • packages/enclave-contracts/artifacts/contracts/interfaces/IEnclave.sol/IEnclave.json (1 hunks)
  • packages/enclave-contracts/contracts/Enclave.sol (1 hunks)
  • packages/enclave-contracts/contracts/registry/BondingRegistry.sol (3 hunks)
  • packages/enclave-contracts/contracts/registry/CiphernodeRegistryOwnable.sol (1 hunks)
  • packages/enclave-contracts/deployed_contracts.json (1 hunks)
  • packages/enclave-contracts/hardhat.config.ts (1 hunks)
  • packages/enclave-contracts/ignition/modules/bondingRegistry.ts (2 hunks)
  • packages/enclave-contracts/ignition/modules/ciphernodeRegistry.ts (1 hunks)
  • packages/enclave-contracts/ignition/modules/enclave.ts (1 hunks)
  • packages/enclave-contracts/package.json (1 hunks)
  • packages/enclave-contracts/scripts/deployAndSave/bondingRegistry.ts (3 hunks)
  • packages/enclave-contracts/scripts/deployAndSave/ciphernodeRegistryOwnable.ts (3 hunks)
  • packages/enclave-contracts/scripts/deployAndSave/enclave.ts (3 hunks)
  • packages/enclave-contracts/scripts/proxy.ts (1 hunks)
  • packages/enclave-contracts/scripts/upgrade/bondingRegistry.ts (1 hunks)
  • packages/enclave-contracts/scripts/upgrade/ciphernodeRegistryOwnable.ts (1 hunks)
  • packages/enclave-contracts/scripts/upgrade/enclave.ts (1 hunks)
  • packages/enclave-contracts/scripts/utils.ts (1 hunks)
  • packages/enclave-contracts/test/Enclave.spec.ts (5 hunks)
  • packages/enclave-contracts/test/Registry/CiphernodeRegistryOwnable.spec.ts (3 hunks)
  • templates/default/enclave.config.yaml (1 hunks)
  • templates/default/hardhat.config.ts (1 hunks)
  • tests/integration/enclave.config.yaml (1 hunks)
🧰 Additional context used
🧠 Learnings (13)
📓 Common learnings
Learnt from: cedoor
Repo: gnosisguild/enclave PR: 752
File: packages/enclave-contracts/contracts/Enclave.sol:15-17
Timestamp: 2025-09-19T11:16:53.825Z
Learning: The Enclave contract in the gnosisguild/enclave repository has not been deployed yet as of September 2025, so storage layout considerations for upgradeable contracts don't apply to current changes.
📚 Learning: 2025-09-19T11:16:53.825Z
Learnt from: cedoor
Repo: gnosisguild/enclave PR: 752
File: packages/enclave-contracts/contracts/Enclave.sol:15-17
Timestamp: 2025-09-19T11:16:53.825Z
Learning: The Enclave contract in the gnosisguild/enclave repository has not been deployed yet as of September 2025, so storage layout considerations for upgradeable contracts don't apply to current changes.

Applied to files:

  • packages/enclave-contracts/scripts/upgrade/ciphernodeRegistryOwnable.ts
  • packages/enclave-contracts/scripts/deployAndSave/bondingRegistry.ts
  • packages/enclave-contracts/scripts/deployAndSave/enclave.ts
  • packages/enclave-contracts/scripts/deployAndSave/ciphernodeRegistryOwnable.ts
  • packages/enclave-contracts/artifacts/contracts/interfaces/IEnclave.sol/IEnclave.json
  • examples/CRISP/packages/crisp-contracts/deployed_contracts.json
  • packages/enclave-contracts/contracts/Enclave.sol
  • examples/CRISP/enclave.config.yaml
  • templates/default/enclave.config.yaml
  • packages/enclave-contracts/test/Registry/CiphernodeRegistryOwnable.spec.ts
  • packages/enclave-contracts/ignition/modules/ciphernodeRegistry.ts
  • packages/enclave-contracts/package.json
  • packages/enclave-contracts/deployed_contracts.json
  • packages/enclave-contracts/scripts/upgrade/enclave.ts
  • tests/integration/enclave.config.yaml
  • packages/enclave-contracts/scripts/upgrade/bondingRegistry.ts
  • packages/enclave-contracts/ignition/modules/bondingRegistry.ts
  • packages/enclave-contracts/ignition/modules/enclave.ts
📚 Learning: 2025-09-11T13:02:56.353Z
Learnt from: ctrlc03
Repo: gnosisguild/enclave PR: 677
File: packages/enclave-contracts/scripts/deployAndSave/mockComputeProvider.ts:6-6
Timestamp: 2025-09-11T13:02:56.353Z
Learning: In Hardhat v3, the import path "hardhat/types/hre" may be valid for importing HardhatRuntimeEnvironment, unlike in Hardhat v2 where the standard path was "hardhat/types".

Applied to files:

  • packages/enclave-contracts/scripts/deployAndSave/enclave.ts
📚 Learning: 2025-09-11T13:02:56.353Z
Learnt from: ctrlc03
Repo: gnosisguild/enclave PR: 677
File: packages/enclave-contracts/scripts/deployAndSave/mockComputeProvider.ts:6-6
Timestamp: 2025-09-11T13:02:56.353Z
Learning: In Hardhat v3, the import path "hardhat/types/hre" is valid for importing HardhatRuntimeEnvironment, which is different from Hardhat v2 where "hardhat/types" was the standard path.

Applied to files:

  • packages/enclave-contracts/scripts/deployAndSave/enclave.ts
📚 Learning: 2025-09-11T13:02:56.353Z
Learnt from: ctrlc03
Repo: gnosisguild/enclave PR: 677
File: packages/enclave-contracts/scripts/deployAndSave/mockComputeProvider.ts:6-6
Timestamp: 2025-09-11T13:02:56.353Z
Learning: In Hardhat v3, the correct import path for HardhatRuntimeEnvironment is "hardhat/types/hre", not "hardhat/types" as it was in Hardhat v2. The import structure has changed between major versions.

Applied to files:

  • packages/enclave-contracts/scripts/deployAndSave/enclave.ts
📚 Learning: 2025-10-10T12:56:40.538Z
Learnt from: 0xjei
Repo: gnosisguild/enclave PR: 830
File: templates/default/README.md:123-128
Timestamp: 2025-10-10T12:56:40.538Z
Learning: In the Enclave repository, the hard-coded Hardhat development private key `0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80` is acceptable in template README files and documentation for local testing/interaction purposes.

Applied to files:

  • packages/enclave-contracts/scripts/deployAndSave/enclave.ts
  • examples/CRISP/client/.env.example
  • templates/default/enclave.config.yaml
  • examples/CRISP/server/.env.example
  • examples/CRISP/Readme.md
📚 Learning: 2025-09-11T13:09:03.800Z
Learnt from: ctrlc03
Repo: gnosisguild/enclave PR: 677
File: packages/enclave-contracts/scripts/deployAndSave/naiveRegistryFilter.ts:30-31
Timestamp: 2025-09-11T13:09:03.800Z
Learning: In Hardhat v3 deployment scripts, use `(await signer.provider?.getNetwork())?.name ?? "localhost"` instead of `hre.globalOptions.network` to reliably get the network name, as `hre.globalOptions.network` can be undefined in some contexts.

Applied to files:

  • packages/enclave-contracts/scripts/deployAndSave/enclave.ts
  • packages/enclave-contracts/scripts/deployAndSave/ciphernodeRegistryOwnable.ts
📚 Learning: 2024-11-05T06:48:58.177Z
Learnt from: ryardley
Repo: gnosisguild/enclave PR: 173
File: packages/ciphernode/config/src/app_config.rs:13-21
Timestamp: 2024-11-05T06:48:58.177Z
Learning: In the `packages/ciphernode/config/src/app_config.rs` file, for the `Contract` enum, the team prefers to use `String` type for `address` fields, relying on parsing to handle validation, instead of using the `Address` type.

Applied to files:

  • examples/CRISP/enclave.config.yaml
📚 Learning: 2025-10-03T08:38:36.786Z
Learnt from: ctrlc03
Repo: gnosisguild/enclave PR: 781
File: examples/CRISP/test/governanceCircuit.test.ts:15-50
Timestamp: 2025-10-03T08:38:36.786Z
Learning: Hardhat v3 supports Node.js's native test runner (node:test) including importing describe and it from 'node:test'. Tests using this interface are compatible with Hardhat v3's test task.

Applied to files:

  • packages/enclave-contracts/package.json
📚 Learning: 2024-10-23T01:59:42.967Z
Learnt from: ryardley
Repo: gnosisguild/enclave PR: 156
File: packages/ciphernode/tests/tests/test_aggregation_and_decryption.rs:274-274
Timestamp: 2024-10-23T01:59:42.967Z
Learning: In the `packages/ciphernode/tests/tests/test_aggregation_and_decryption.rs` file and other test files within this project, hardcoding `CIPHERNODE_SECRET` is acceptable for testing purposes.

Applied to files:

  • examples/CRISP/Readme.md
📚 Learning: 2024-10-23T01:59:27.215Z
Learnt from: ryardley
Repo: gnosisguild/enclave PR: 156
File: tests/basic_integration/test.sh:21-21
Timestamp: 2024-10-23T01:59:27.215Z
Learning: In `tests/basic_integration/test.sh`, the hardcoded `CIPHERNODE_SECRET` is acceptable for testing purposes and does not need to be changed.

Applied to files:

  • examples/CRISP/Readme.md
📚 Learning: 2024-10-23T02:03:02.008Z
Learnt from: ryardley
Repo: gnosisguild/enclave PR: 156
File: packages/ciphernode/keyshare/src/encryption.rs:45-45
Timestamp: 2024-10-23T02:03:02.008Z
Learning: In the `packages/ciphernode/keyshare/src/encryption.rs` file, the environment variable `CIPHERNODE_SECRET` is used for the encryption password. A secure secret management solution is not currently available, but may be considered in future iterations.

Applied to files:

  • examples/CRISP/Readme.md
📚 Learning: 2025-11-08T01:31:47.484Z
Learnt from: ryardley
Repo: gnosisguild/enclave PR: 969
File: packages/enclave-sdk/src/enclave-sdk.ts:101-103
Timestamp: 2025-11-08T01:31:47.484Z
Learning: In packages/enclave-sdk/src/enclave-sdk.ts, the TRBFV protocol parameter setup is intentionally incomplete as of PR #969. The constructor sets BFV_THRESHOLD parameters for TRBFV, but the encryption methods (encryptNumber, encryptVector, encryptNumberAndGenInputs, encryptVectorAndGenInputs) intentionally only support BFV and will throw "Protocol not supported" for TRBFV until future implementation is completed.

Applied to files:

  • packages/enclave-contracts/ignition/modules/enclave.ts
🧬 Code graph analysis (6)
packages/enclave-contracts/scripts/upgrade/ciphernodeRegistryOwnable.ts (3)
packages/enclave-contracts/scripts/deployAndSave/poseidonT3.ts (1)
  • deployAndSavePoseidonT3 (19-63)
packages/enclave-contracts/scripts/utils.ts (1)
  • readDeploymentArgs (75-89)
packages/enclave-contracts/scripts/deployAndSave/ciphernodeRegistryOwnable.ts (1)
  • upgradeAndSaveCiphernodeRegistryOwnable (123-205)
packages/enclave-contracts/scripts/deployAndSave/bondingRegistry.ts (2)
packages/enclave-contracts/scripts/utils.ts (2)
  • readDeploymentArgs (75-89)
  • storeDeploymentArgs (35-67)
packages/enclave-contracts/scripts/proxy.ts (2)
  • getProxyAdmin (22-35)
  • verifyProxyAdminOwner (43-54)
packages/enclave-contracts/scripts/deployAndSave/enclave.ts (2)
packages/enclave-contracts/scripts/utils.ts (2)
  • readDeploymentArgs (75-89)
  • storeDeploymentArgs (35-67)
packages/enclave-contracts/scripts/proxy.ts (2)
  • getProxyAdmin (22-35)
  • verifyProxyAdminOwner (43-54)
packages/enclave-contracts/scripts/deployAndSave/ciphernodeRegistryOwnable.ts (2)
packages/enclave-contracts/scripts/utils.ts (2)
  • readDeploymentArgs (75-89)
  • storeDeploymentArgs (35-67)
packages/enclave-contracts/scripts/proxy.ts (2)
  • getProxyAdmin (22-35)
  • verifyProxyAdminOwner (43-54)
packages/enclave-contracts/scripts/upgrade/enclave.ts (3)
packages/enclave-contracts/scripts/deployAndSave/poseidonT3.ts (1)
  • deployAndSavePoseidonT3 (19-63)
packages/enclave-contracts/scripts/utils.ts (1)
  • readDeploymentArgs (75-89)
packages/enclave-contracts/scripts/deployAndSave/enclave.ts (1)
  • upgradeAndSaveEnclave (137-207)
packages/enclave-contracts/scripts/upgrade/bondingRegistry.ts (2)
packages/enclave-contracts/scripts/utils.ts (1)
  • readDeploymentArgs (75-89)
packages/enclave-contracts/scripts/deployAndSave/bondingRegistry.ts (1)
  • upgradeAndSaveBondingRegistry (156-229)
🪛 dotenv-linter (4.0.0)
examples/CRISP/client/.env.example

[warning] 4-4: [UnorderedKey] The VITE_E3_PROGRAM_ADDRESS key should go before the VITE_ENCLAVE_API key

(UnorderedKey)


[warning] 4-4: [ValueWithoutQuotes] This value needs to be surrounded in quotes

(ValueWithoutQuotes)

examples/CRISP/server/.env.example

[warning] 16-16: [QuoteCharacter] The value has quote characters (', ")

(QuoteCharacter)


[warning] 17-17: [QuoteCharacter] The value has quote characters (', ")

(QuoteCharacter)


[warning] 17-17: [UnorderedKey] The CIPHERNODE_REGISTRY_ADDRESS key should go before the ENCLAVE_ADDRESS key

(UnorderedKey)


[warning] 18-18: [UnorderedKey] The E3_PROGRAM_ADDRESS key should go before the ENCLAVE_ADDRESS key

(UnorderedKey)

🪛 Gitleaks (8.28.0)
examples/CRISP/packages/crisp-contracts/deployed_contracts.json

[high] 180-180: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)

packages/enclave-contracts/deployed_contracts.json

[high] 138-138: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


[high] 156-156: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


[high] 157-157: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


[high] 184-184: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (8)
  • GitHub Check: test_enclave_init
  • GitHub Check: crisp_e2e
  • GitHub Check: Build & Push Image
  • GitHub Check: build_sdk
  • GitHub Check: integration_prebuild
  • GitHub Check: Build & Push Image
  • GitHub Check: rust_integration
  • GitHub Check: rust_unit
🔇 Additional comments (21)
packages/enclave-contracts/artifacts/contracts/interfaces/ICiphernodeRegistry.sol/ICiphernodeRegistry.json (1)

1-539: This is an auto-generated artifact file with only a buildInfoId update—no review needed.

The buildInfoId change (line 538) reflects a compiler/toolchain update and is expected during the recompilation cycle accompanying the proxy pattern migration in this PR. All functional elements (ABI, bytecode, interface definition) remain identical.

examples/CRISP/server/.env.example (1)

16-18: Updated deployment addresses reflect new proxy-based deployment pattern.

The address updates align with the introduction of transparent upgradeable proxies across the codebase. These are example addresses for local Hardhat/Anvil testing environments.

Note: The static analysis warnings about quote characters and key ordering are style preferences rather than functional issues. Both quoted and unquoted values work correctly in .env files, and key ordering doesn't affect functionality.

packages/enclave-contracts/artifacts/contracts/interfaces/IBondingRegistry.sol/IBondingRegistry.json (1)

854-854: Expected artifact regeneration from recompilation.

The buildInfoId update reflects contract recompilation as part of the upgradeable proxy changes. The interface ABI remains unchanged.

examples/CRISP/client/.env.example (1)

4-4: Updated E3 program address aligns with new proxy deployments.

The address update is consistent with the broader deployment reconfiguration for upgradeable proxies.

Note: Static analysis warnings about quotes and key ordering are stylistic preferences. Vite correctly handles both quoted and unquoted environment variable values.

templates/default/hardhat.config.ts (1)

121-122: Proxy contracts correctly added to support upgradeable pattern.

The addition of OpenZeppelin's ProxyAdmin and TransparentUpgradeableProxy contracts enables the transparent upgradeable proxy pattern introduced in this PR. These contracts are necessary for proxy-based deployments and upgrades.

packages/enclave-contracts/scripts/utils.ts (1)

16-16: Implementation address field supports proxy deployment tracking.

The optional implementationAddress field enables deployment records to store both the proxy address and the underlying implementation address, which is essential for the transparent upgradeable proxy pattern.

examples/CRISP/packages/crisp-contracts/hardhat.config.ts (1)

146-147: Proxy contracts consistently added across all Hardhat configurations.

The addition matches the same change in templates/default/hardhat.config.ts and packages/enclave-contracts/hardhat.config.ts, ensuring consistent proxy support across all contract packages.

packages/enclave-contracts/artifacts/contracts/interfaces/IEnclave.sol/IEnclave.json (1)

980-980: Expected artifact regeneration from recompilation.

The buildInfoId update reflects contract recompilation as part of the upgradeable proxy implementation. The interface ABI remains unchanged.

packages/enclave-contracts/hardhat.config.ts (1)

171-175: Build configuration updated to include required dependencies.

The addition of the npmFilesToBuild array ensures that:

  1. PoseidonT3.sol (cryptographic hash function) is compiled from the npm dependency
  2. OpenZeppelin's ProxyAdmin and TransparentUpgradeableProxy contracts are available for the upgradeable proxy pattern

This configuration is consistent with the template and example configs, ensuring all necessary contracts are built.

packages/enclave-contracts/ignition/modules/bondingRegistry.ts (1)

21-41: LGTM! Proxy deployment pattern correctly implemented.

The migration to TransparentUpgradeableProxy follows the standard pattern:

  1. Implementation deployed with no-arg constructor (disabling direct initialization)
  2. Initialization parameters encoded for delegated call via proxy
  3. Proxy deployed with implementation address, owner, and encoded init data

This enables future upgrades while preserving the proxy address.

packages/enclave-contracts/scripts/proxy.ts (2)

22-35: LGTM! Storage slot extraction correctly implemented.

The address extraction logic properly handles ERC-1967 storage layout:

  • Reads the 32-byte admin slot
  • Extracts the rightmost 20 bytes (40 hex chars)
  • Checksums via getAddress() for consistent formatting

43-54: LGTM! Ownership verification handles case sensitivity properly.

Case-insensitive comparison ensures addresses match regardless of checksum format.

examples/CRISP/enclave.config.yaml (1)

6-16: LGTM! Configuration addresses updated for proxy deployment.

The address updates align with the proxy-based deployment pattern introduced in this PR. Ensure these addresses correspond to the deployed proxy contracts (not implementation contracts) for proper runtime interaction.

templates/default/enclave.config.yaml (1)

6-16: LGTM! Template configuration synchronized with examples.

Addresses match those in examples/CRISP/enclave.config.yaml, maintaining consistency across templates and examples.

tests/integration/enclave.config.yaml (1)

9-16: LGTM! Integration test configuration updated.

The enclave, ciphernode_registry, and bonding_registry addresses align with examples and templates. Note that e3_program uses a different address, which may be intentional for the integration test environment.

packages/enclave-contracts/scripts/upgrade/enclave.ts (2)

12-54: LGTM! Upgrade script follows proper validation flow.

The script correctly:

  1. Deploys dependencies (PoseidonT3)
  2. Validates existing proxy deployment via readDeploymentArgs
  3. Verifies on-chain contract existence with getCode
  4. Executes upgrade through upgradeAndSaveEnclave
  5. Logs structured upgrade summary

The validation checks prevent upgrading non-existent deployments and provide clear error messages.


56-59: LGTM! Error handling properly exits with non-zero code.

examples/CRISP/Readme.md (2)

102-102: LGTM! Documentation updated with new proxy address.


262-263: LGTM! Environment variable examples updated for proxy deployment.

The addresses now reflect the proxy contract addresses, ensuring documentation aligns with the upgraded deployment pattern.

Based on learnings

packages/enclave-contracts/package.json (1)

149-151: LGTM! Upgrade scripts provide convenient upgrade interface.

The three new scripts enable straightforward upgrades for each proxy-deployed contract, following a consistent naming convention.

packages/enclave-contracts/test/Enclave.spec.ts (1)

242-245: LGTM!

The test correctly adapts to the proxy-based deployment pattern by connecting to the BondingRegistry through BondingRegistryFactory, ensuring tests interact with the proxy address rather than the implementation directly.

Comment thread packages/enclave-contracts/contracts/Enclave.sol
Comment thread packages/enclave-contracts/contracts/registry/BondingRegistry.sol
Comment thread packages/enclave-contracts/ignition/modules/ciphernodeRegistry.ts
Comment thread packages/enclave-contracts/ignition/modules/enclave.ts
Comment thread packages/enclave-contracts/scripts/deployAndSave/enclave.ts
Comment thread packages/enclave-contracts/scripts/upgrade/bondingRegistry.ts
@vercel vercel Bot temporarily deployed to Preview – crisp November 10, 2025 13:05 Inactive
@vercel vercel Bot temporarily deployed to Preview – enclave-docs November 10, 2025 13:05 Inactive
@vercel vercel Bot temporarily deployed to Preview – crisp November 10, 2025 13:12 Inactive
@vercel vercel Bot temporarily deployed to Preview – enclave-docs November 10, 2025 13:12 Inactive

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

♻️ Duplicate comments (2)
packages/enclave-contracts/scripts/upgrade/ciphernodeRegistryOwnable.ts (1)

12-15: Fix copy-paste error in JSDoc comment.

The comment incorrectly references "Enclave contract" when it should reference "CiphernodeRegistryOwnable contract".

Apply this diff:

 /**
- * Upgrades the Enclave contract implementation and saves the deployment arguments
+ * Upgrades the CiphernodeRegistryOwnable contract implementation and saves the deployment arguments
  * This keeps the same proxy address, only updates the implementation
  */
packages/enclave-contracts/scripts/upgrade/bondingRegistry.ts (1)

11-14: Fix copy-paste error in JSDoc comment.

The comment incorrectly references "Enclave contract" when it should reference "BondingRegistry contract".

Apply this diff:

 /**
- * Upgrades the Enclave contract implementation and saves the deployment arguments
+ * Upgrades the BondingRegistry contract implementation and saves the deployment arguments
  * This keeps the same proxy address, only updates the implementation
  */
🧹 Nitpick comments (1)
packages/enclave-contracts/scripts/upgrade/ciphernodeRegistryOwnable.ts (1)

16-69: Consider extracting common upgrade logic.

The upgrade script follows the same pattern as enclave.ts and bondingRegistry.ts. While not critical, extracting the common validation and logging logic into a shared utility function would reduce duplication and improve maintainability.

Example shared utility signature:

async function upgradeProxyContract<T>({
  contractName: string,
  deployDependencies: () => Promise<Record<string, string>>,
  upgradeFunction: (deps: any) => Promise<{ contract: T; implementationAddress: string }>,
  hre: HardhatRuntimeEnvironment
}): Promise<void>
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 09eb4b4 and 61cb42c.

📒 Files selected for processing (5)
  • examples/CRISP/circuits/src/ciphertext_addition.nr (1 hunks)
  • examples/CRISP/packages/crisp-contracts/deploy/crisp.ts (2 hunks)
  • packages/enclave-contracts/scripts/upgrade/bondingRegistry.ts (1 hunks)
  • packages/enclave-contracts/scripts/upgrade/ciphernodeRegistryOwnable.ts (1 hunks)
  • packages/enclave-contracts/scripts/upgrade/enclave.ts (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • examples/CRISP/circuits/src/ciphertext_addition.nr
🧰 Additional context used
🧠 Learnings (3)
📚 Learning: 2025-09-19T11:16:53.825Z
Learnt from: cedoor
Repo: gnosisguild/enclave PR: 752
File: packages/enclave-contracts/contracts/Enclave.sol:15-17
Timestamp: 2025-09-19T11:16:53.825Z
Learning: The Enclave contract in the gnosisguild/enclave repository has not been deployed yet as of September 2025, so storage layout considerations for upgradeable contracts don't apply to current changes.

Applied to files:

  • packages/enclave-contracts/scripts/upgrade/enclave.ts
  • packages/enclave-contracts/scripts/upgrade/bondingRegistry.ts
  • packages/enclave-contracts/scripts/upgrade/ciphernodeRegistryOwnable.ts
📚 Learning: 2025-11-05T14:12:57.814Z
Learnt from: ctrlc03
Repo: gnosisguild/enclave PR: 963
File: examples/CRISP/client/package.json:25-25
Timestamp: 2025-11-05T14:12:57.814Z
Learning: In the Enclave/CRISP codebase, `enclave-e3/sdk` and `crisp-e3/sdk` are different packages: `enclave-e3/sdk` is the general Enclave SDK, while `crisp-e3/sdk` is the CRISP-specific SDK. The CRISP client (`examples/CRISP/client`) intentionally depends on `enclave-e3/sdk`, not `crisp-e3/sdk`.

Applied to files:

  • examples/CRISP/packages/crisp-contracts/deploy/crisp.ts
📚 Learning: 2024-11-25T09:47:48.863Z
Learnt from: ryardley
Repo: gnosisguild/enclave PR: 184
File: packages/ciphernode/net/tests/entrypoint.sh:4-8
Timestamp: 2024-11-25T09:47:48.863Z
Learning: When reviewing test scripts like `packages/ciphernode/net/tests/entrypoint.sh`, avoid suggesting additional error handling and cleanup for `iptables` commands, as it may not be necessary.

Applied to files:

  • packages/enclave-contracts/scripts/upgrade/ciphernodeRegistryOwnable.ts
🧬 Code graph analysis (4)
packages/enclave-contracts/scripts/upgrade/enclave.ts (3)
packages/enclave-contracts/scripts/deployAndSave/poseidonT3.ts (1)
  • deployAndSavePoseidonT3 (19-63)
packages/enclave-contracts/scripts/utils.ts (1)
  • readDeploymentArgs (75-89)
packages/enclave-contracts/scripts/deployAndSave/enclave.ts (1)
  • upgradeAndSaveEnclave (137-207)
packages/enclave-contracts/scripts/upgrade/bondingRegistry.ts (2)
packages/enclave-contracts/scripts/utils.ts (1)
  • readDeploymentArgs (75-89)
packages/enclave-contracts/scripts/deployAndSave/bondingRegistry.ts (1)
  • upgradeAndSaveBondingRegistry (156-229)
examples/CRISP/packages/crisp-contracts/deploy/crisp.ts (1)
packages/enclave-contracts/scripts/utils.ts (2)
  • readDeploymentArgs (75-89)
  • storeDeploymentArgs (35-67)
packages/enclave-contracts/scripts/upgrade/ciphernodeRegistryOwnable.ts (3)
packages/enclave-contracts/scripts/deployAndSave/poseidonT3.ts (1)
  • deployAndSavePoseidonT3 (19-63)
packages/enclave-contracts/scripts/utils.ts (1)
  • readDeploymentArgs (75-89)
packages/enclave-contracts/scripts/deployAndSave/ciphernodeRegistryOwnable.ts (1)
  • upgradeAndSaveCiphernodeRegistryOwnable (123-205)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (10)
  • GitHub Check: build_sdk
  • GitHub Check: test_net
  • GitHub Check: build_e3_support_dev
  • GitHub Check: test_contracts
  • GitHub Check: build_enclave_cli
  • GitHub Check: integration_prebuild
  • GitHub Check: rust_integration
  • GitHub Check: rust_unit
  • GitHub Check: Build & Push Image
  • GitHub Check: Build & Push Image
🔇 Additional comments (8)
packages/enclave-contracts/scripts/upgrade/enclave.ts (3)

1-10: LGTM!

License header and imports are appropriate for this upgrade script.


12-58: LGTM!

The upgrade logic correctly validates proxy existence, deploys dependencies, and performs the upgrade with appropriate error handling and logging.


60-63: LGTM!

Immediate execution with proper error handling is standard for Hardhat upgrade scripts.

packages/enclave-contracts/scripts/upgrade/bondingRegistry.ts (1)

15-63: LGTM!

The upgrade logic correctly validates proxy existence and performs the upgrade. Note that this script appropriately omits PoseidonT3 deployment since BondingRegistry doesn't require it, unlike Enclave and CiphernodeRegistryOwnable.

examples/CRISP/packages/crisp-contracts/deploy/crisp.ts (4)

19-39: LGTM!

The deployment setup logic is well-structured:

  • Proper initialization of ethers and signers
  • Environment-based configuration for mock contracts
  • Appropriate error handling for missing Enclave deployment

119-182: LGTM!

The verifier deployment logic is well-implemented:

  • Checks for existing deployments to avoid redundant work
  • Consistent async/await patterns
  • Proper storage of deployment arguments for both mock and real verifiers

189-254: LGTM!

The input validator deployment logic is well-implemented:

  • Checks for existing deployments to avoid redundant work
  • Consistent async/await patterns
  • Proper storage of deployment arguments for both mock and real validators
  • Clear distinction between mock and production contract names

16-17: IMAGE_ID hardcoding is correct and should not be changed.

The IMAGE_ID is the RISC Zero circuit's program identifier (PROGRAM_ID in the auto-generated ImageID.sol files). It is immutable per circuit build and must match between Solidity and TypeScript layers. The deployment script correctly hardcodes this value—it is not a deployment configuration parameter like USE_MOCK_VERIFIER and USE_MOCK_INPUT_VALIDATOR which do use environment variables.

Likely an incorrect or invalid review comment.

Comment thread examples/CRISP/packages/crisp-contracts/deploy/crisp.ts
@vercel vercel Bot temporarily deployed to Preview – crisp November 10, 2025 13:22 Inactive
@vercel vercel Bot temporarily deployed to Preview – enclave-docs November 10, 2025 13:22 Inactive

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (3)
packages/enclave-contracts/contracts/Enclave.sol (1)

88-88: Consider adding storage gap for future upgradeability.

For upgradeable contracts, OpenZeppelin recommends reserving storage slots with a __gap variable to allow adding new storage variables in future upgrades without breaking the storage layout. Consider adding after line 88:

     /// @notice Mapping tracking fee payments for each E3.
     /// @dev Stores the amount paid for an E3, distributed to committee upon completion.
     mapping(uint256 e3Id => uint256 e3Payment) public e3Payments;
+
+    /// @notice Storage gap for future upgrades.
+    /// @dev Reserves storage slots to allow adding new state variables in future versions.
+    uint256[50] private __gap;
packages/enclave-contracts/scripts/upgrade/enclave.ts (2)

24-46: Consider consolidating duplicate existence checks.

The proxy existence is checked twice:

  • Lines 24-27: Check if proxy address exists in deployment records
  • Lines 40-46: Check if proxy contract exists on-chain

The on-chain check (lines 40-46) is more definitive. Consider removing the first check or clarifying why both are needed in comments.


23-23: PoseidonT3 redeployment check is redundant on upgrades—consider skipping or refactoring.

The deployAndSavePoseidonT3 function uses a deterministic address from the external "poseidon-solidity" package. Since PoseidonT3 is deployed once during initial setup and always exists at the same address, calling it unconditionally on every upgrade (line 23) is unnecessary overhead. While the function safely checks if already deployed and returns early, the on-chain code check and re-storing of deployment args happen on every upgrade.

Suggestion: Either skip the call for upgrade-only operations, or refactor to accept an optional flag to skip PoseidonT3 lookup when upgrading existing contracts.

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 61cb42c and 4386426.

📒 Files selected for processing (7)
  • packages/enclave-contracts/contracts/Enclave.sol (1 hunks)
  • packages/enclave-contracts/contracts/registry/BondingRegistry.sol (3 hunks)
  • packages/enclave-contracts/contracts/registry/CiphernodeRegistryOwnable.sol (1 hunks)
  • packages/enclave-contracts/deployed_contracts.json (1 hunks)
  • packages/enclave-contracts/scripts/upgrade/bondingRegistry.ts (1 hunks)
  • packages/enclave-contracts/scripts/upgrade/ciphernodeRegistryOwnable.ts (1 hunks)
  • packages/enclave-contracts/scripts/upgrade/enclave.ts (1 hunks)
🧰 Additional context used
🧠 Learnings (3)
📓 Common learnings
Learnt from: cedoor
Repo: gnosisguild/enclave PR: 752
File: packages/enclave-contracts/contracts/Enclave.sol:15-17
Timestamp: 2025-09-19T11:16:53.825Z
Learning: The Enclave contract in the gnosisguild/enclave repository has not been deployed yet as of September 2025, so storage layout considerations for upgradeable contracts don't apply to current changes.
📚 Learning: 2025-09-19T11:16:53.825Z
Learnt from: cedoor
Repo: gnosisguild/enclave PR: 752
File: packages/enclave-contracts/contracts/Enclave.sol:15-17
Timestamp: 2025-09-19T11:16:53.825Z
Learning: The Enclave contract in the gnosisguild/enclave repository has not been deployed yet as of September 2025, so storage layout considerations for upgradeable contracts don't apply to current changes.

Applied to files:

  • packages/enclave-contracts/scripts/upgrade/bondingRegistry.ts
  • packages/enclave-contracts/contracts/Enclave.sol
  • packages/enclave-contracts/scripts/upgrade/enclave.ts
  • packages/enclave-contracts/scripts/upgrade/ciphernodeRegistryOwnable.ts
  • packages/enclave-contracts/deployed_contracts.json
📚 Learning: 2024-11-25T09:47:48.863Z
Learnt from: ryardley
Repo: gnosisguild/enclave PR: 184
File: packages/ciphernode/net/tests/entrypoint.sh:4-8
Timestamp: 2024-11-25T09:47:48.863Z
Learning: When reviewing test scripts like `packages/ciphernode/net/tests/entrypoint.sh`, avoid suggesting additional error handling and cleanup for `iptables` commands, as it may not be necessary.

Applied to files:

  • packages/enclave-contracts/scripts/upgrade/ciphernodeRegistryOwnable.ts
🧬 Code graph analysis (3)
packages/enclave-contracts/scripts/upgrade/bondingRegistry.ts (2)
packages/enclave-contracts/scripts/utils.ts (1)
  • readDeploymentArgs (75-89)
packages/enclave-contracts/scripts/deployAndSave/bondingRegistry.ts (1)
  • upgradeAndSaveBondingRegistry (156-229)
packages/enclave-contracts/scripts/upgrade/enclave.ts (3)
packages/enclave-contracts/scripts/deployAndSave/poseidonT3.ts (1)
  • deployAndSavePoseidonT3 (19-63)
packages/enclave-contracts/scripts/utils.ts (1)
  • readDeploymentArgs (75-89)
packages/enclave-contracts/scripts/deployAndSave/enclave.ts (1)
  • upgradeAndSaveEnclave (137-207)
packages/enclave-contracts/scripts/upgrade/ciphernodeRegistryOwnable.ts (3)
packages/enclave-contracts/scripts/deployAndSave/poseidonT3.ts (1)
  • deployAndSavePoseidonT3 (19-63)
packages/enclave-contracts/scripts/utils.ts (1)
  • readDeploymentArgs (75-89)
packages/enclave-contracts/scripts/deployAndSave/ciphernodeRegistryOwnable.ts (1)
  • upgradeAndSaveCiphernodeRegistryOwnable (123-205)
🪛 Gitleaks (8.28.0)
packages/enclave-contracts/deployed_contracts.json

[high] 138-138: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


[high] 156-156: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


[high] 157-157: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


[high] 184-184: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (9)
  • GitHub Check: build_enclave_cli
  • GitHub Check: build_sdk
  • GitHub Check: integration_prebuild
  • GitHub Check: build_e3_support_risc0
  • GitHub Check: test_net
  • GitHub Check: rust_integration
  • GitHub Check: test_contracts
  • GitHub Check: rust_unit
  • GitHub Check: Build & Push Image
🔇 Additional comments (16)
packages/enclave-contracts/contracts/Enclave.sol (1)

199-204: LGTM! Previous comment has been addressed.

The constructor correctly implements the upgradeable proxy pattern by calling _disableInitializers(), and the comment now accurately describes that initialization occurs via initialize() when deployed behind a proxy.

packages/enclave-contracts/contracts/registry/CiphernodeRegistryOwnable.sol (1)

178-183: LGTM! Comment correction applied.

The constructor correctly implements the upgradeable proxy pattern by disabling initializers on the implementation contract, and the comment now accurately describes this behavior.

packages/enclave-contracts/scripts/upgrade/ciphernodeRegistryOwnable.ts (4)

12-15: LGTM! Comment correction applied.

The comment now correctly describes upgrading the CiphernodeRegistryOwnable contract instead of the Enclave contract.


16-22: LGTM!

The setup logic correctly retrieves the signer and network information with appropriate fallbacks.


23-58: LGTM!

The upgrade logic includes proper validation:

  • Verifies proxy deployment exists
  • Confirms deployment is proxy-based (lines 34-38)
  • Validates on-chain contract presence (lines 45-51)
  • Security enforced: the signer must be the ProxyAdmin owner (verified in upgradeAndSaveCiphernodeRegistryOwnable via verifyProxyAdminOwner)

60-75: LGTM!

The logging and error handling are appropriate for an upgrade script, with clear output and proper exit codes.

packages/enclave-contracts/contracts/registry/BondingRegistry.sol (2)

142-147: LGTM! Past review feedback addressed.

The constructor comment has been corrected and now accurately describes the upgradeable proxy pattern. The implementation properly disables initializers on the implementation contract.


85-85: Upgradeable pattern correctly implemented.

The migration from in-file initialization to proxy-based initialization is correctly implemented. The licenseActiveBps variable is now initialized via the setter in the initialize() function, maintaining the same default value (8,000 basis points = 80%).

Also applies to: 180-180

packages/enclave-contracts/scripts/upgrade/bondingRegistry.ts (2)

11-14: LGTM! Past review feedback addressed.

The comment now correctly references the BondingRegistry contract instead of Enclave.


19-22: Verify chain identifier consistency.

Line 19 derives the chain name from signer.provider.getNetwork().name, which is used to read deployment args on line 22. However, upgradeAndSaveBondingRegistry (called on lines 48-52) uses hre.globalOptions.network to determine the chain when saving deployment args.

If these two methods return different chain identifiers, deployment args could be read from one chain key but saved to another, causing inconsistencies in the deployments file.

Consider using a consistent chain identifier source:

- const chain = (await signer.provider?.getNetwork())?.name ?? "localhost";
+ const chain = hre.globalOptions.network;

Or verify that both methods always return the same value for your deployment environments.

Also applies to: 48-52

packages/enclave-contracts/deployed_contracts.json (2)

138-138: Static analysis false positives - safe to ignore.

The static analysis tool is flagging Ethereum contract addresses as "Generic API Key". These are legitimate blockchain addresses (0x-prefixed hex strings), not API keys or secrets. The warnings can be safely ignored.

Also applies to: 156-157, 184-184


167-167: Implementation addresses correctly added for proxy deployments.

The implementationAddress fields have been appropriately added for BondingRegistry, CiphernodeRegistryOwnable, and Enclave, indicating these contracts are now deployed using the upgradeable proxy pattern. Cross-references between contracts appear consistent.

Also applies to: 177-177, 192-192

packages/enclave-contracts/scripts/upgrade/enclave.ts (4)

1-11: LGTM!

The license header and imports are appropriate for an upgrade script.


12-22: LGTM!

The function documentation and setup are clear and follow standard patterns.


29-33: Excellent safety check!

This validation prevents accidentally attempting to upgrade a non-proxy deployment, which would fail. This is an important guard rail.


54-69: LGTM!

The logging and error handling are appropriate for an upgrade script. The output clearly shows both the proxy address (which remains unchanged) and the new implementation address.

Comment thread packages/enclave-contracts/scripts/upgrade/enclave.ts
@hmzakhalid hmzakhalid requested review from cedoor and ctrlc03 November 10, 2025 13:30

@ctrlc03 ctrlc03 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Neat work! should we add some tests for upgrades?

@cedoor cedoor left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

utACK 👍🏽

@ryardley ryardley left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

utACK

@ryardley ryardley merged commit b6f9b7b into dev Nov 11, 2025
41 of 42 checks passed
@github-actions github-actions Bot deleted the feat/upgrade-contracts branch November 18, 2025 03:19
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.

Proxy architecture for Enclave + registries Upgradeability

4 participants