Skip to content

Conversation

@kevinsslin
Copy link
Collaborator

@kevinsslin kevinsslin commented Jun 21, 2025

Add TestSelfVerificationRoot Deployment Module

Summary

Adds Hardhat Ignition deployment module for TestSelfVerificationRoot contract with improved Celo network configuration.

Changes

  • New deployment module: ignition/modules/deployTestSelfVerificationRoot.ts

    • Deploys TestSelfVerificationRoot with configurable hub address and scope value
    • Uses temporary scope value (12345) with clear documentation for production replacement
    • Includes usage examples and verification commands
  • Enhanced Hardhat config:

    • Fixed Celo mainnet to use PRIVATE_KEY instead of CELO_KEY
    • Added Alfajores testnet configuration with proper Celoscan verification
    • Updated Etherscan API URLs for Celo networks
  • Minor formatting: Improved code formatting in TestSelfVerificationRoot contract

Usage

# Deploy to Alfajores
npx hardhat ignition deploy ignition/modules/deployTestSelfVerificationRoot.ts --network alfajores --verify

# Verify contract
npx hardhat verify <DEPLOYED_ADDRESS> 0x3e2487a250e2A7b56c7ef5307Fb591Cc8C83623D 12345 --network alfajores

Notes

  • Scope value 12345 is temporary - calculate actual value post-deployment and call setScopeValue()
  • Hub address defaults to current Alfajores/Celo deployment
  • Ready for immediate testing and deployment

Summary by CodeRabbit

  • New Features

    • Added a deployment module for the TestSelfVerificationRoot contract, enabling streamlined testing of self-verification functionality.
  • Chores

    • Updated network configuration for Celo and Alfajores testnets, standardizing environment variable usage and improving Etherscan verification support.
    • Removed the Celo Baklava testnet configuration.
  • Style

    • Reformatted a function signature for improved readability without changing functionality.

remicolin and others added 5 commits June 16, 2025 12:14
* remove sdk/tests (#622)

* remove sdk/tests

* chore: update yarn.lock

---------

Co-authored-by: Ayman <[email protected]>

* fix: add range check on paddedInLength of shaBytesDynamic (#623)

* fix ci (#626)

---------

Co-authored-by: Ayman <[email protected]>
Co-authored-by: Vishalkulkarni45 <[email protected]>
* remove sdk/tests (#622)

* remove sdk/tests

* chore: update yarn.lock

---------

Co-authored-by: Ayman <[email protected]>

* fix: add range check on paddedInLength of shaBytesDynamic (#623)

* fix ci (#626)

* implement self uups upgradeable (#592)

* implement self uups upgradeable

* small changes in identityVerificationHubImplV2

* delete aderyn.toml

* chore: add custom verifier

* chnage return output

* feat: use self structs and a Generic output struct

* feat: add userIdentifier, nullifier, forbiddencountries to returned output

* add root view functions from registry

* fix: build and compilation errors

* add userDefined data into selfVerificationRoot

* "resolve conflicts"

* fix compilation problem

* fix how to register verification config

* test: CustomVerifier

* fix verification root and hub integration

* add scope check in hub impl

* replace poseidon hash to ripemd+sha256

* add todo list

* feat: refactor and add test cases for generic formatter

* add performUserIdentifierCheck in basicVerification

* change how to handle additionalData and fix stack too deep

* start adding test codes

* fix dependency problems in monorepo

* fix: forbidden countries (#612)

LGTM!

* able to run test code

* pass happy path

* delete unused codes

* change error code name, add caller address validation and add scripts to run test and build in monorepo

* add all test cases in vcAndDisclose flow

* remove comment out

* chore: use actual user identifier outputs

* success in registration tests

* cover all cases

* pass contractVersion instead of circuitVersion

* fix disclose test

* chore: add natspecs for ImplHubV2, CustomVerifier and GenericFormatter

* change val name and remove unused lines

* add val name change

* remove userIdentifier from return data

* feat: use GenericDiscloseOutput struct in verfication hook  fix test cases for user identifier

* chore: change the function order for Hub Impl V2 (#625)

* fix nat specs

* add nat spec in SelfStructs

---------

Co-authored-by: Ayman <[email protected]>
Co-authored-by: Nesopie <[email protected]>

* prettier (#629)

---------

Co-authored-by: Ayman <[email protected]>
Co-authored-by: Vishalkulkarni45 <[email protected]>
Co-authored-by: nicoshark <[email protected]>
Co-authored-by: Nesopie <[email protected]>
* fix: vc_and_disclose_id test

* chore: yarn prettier
* feat: add getConfigId function in SelfVerificationRoot

* update comment

---------

Co-authored-by: motemotech <[email protected]>
…eployment module

* Change account key reference from CELO_KEY to PRIVATE_KEY in Hardhat config.
* Rename celoAlfajores to alfajores in the config.
* Add custom chain configuration for alfajores with updated API URLs.
* Introduce a new deployment module for TestSelfVerificationRoot contract, including usage and verification instructions.
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jun 21, 2025

Walkthrough

The changes introduce a new Hardhat Ignition deployment module for the TestSelfVerificationRoot contract, update network configurations in the Hardhat config (notably for Celo and Alfajores), and reformat a function signature in the TestSelfVerificationRoot contract for improved readability. No functional logic was altered.

Changes

Files/Paths Change Summary
contracts/contracts/tests/TestSelfVerificationRoot.sol Reformatted the getConfigId function signature to a multi-line parameter list; logic unchanged.
contracts/hardhat.config.ts Updated Celo network config: unified env var, renamed celoAlfajores to alfajores, removed Baklava, added Alfajores to Etherscan config, and updated customChains URLs.
contracts/ignition/modules/deployTestSelfVerificationRoot.ts Added a new Hardhat Ignition deployment module for TestSelfVerificationRoot with configurable parameters.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant IgnitionModule
    participant TestSelfVerificationRoot

    User->>IgnitionModule: Deploy module with (identityVerificationHubV2Address, scopeValue)
    IgnitionModule->>TestSelfVerificationRoot: Deploy contract with constructor args
    TestSelfVerificationRoot-->>IgnitionModule: Contract instance deployed
    IgnitionModule-->>User: Return deployed contract instance
Loading

Possibly related PRs

Poem

In the garden of code where networks grow,
A module sprouts for tests to show.
Alfajores joins with configs neat,
While function lines in Solidity meet.
The rabbit hops with joy anew—
Deploy, verify, and test right through!
🐇✨


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a9f6207 and 6e69499.

📒 Files selected for processing (3)
  • contracts/contracts/tests/TestSelfVerificationRoot.sol (1 hunks)
  • contracts/hardhat.config.ts (1 hunks)
  • contracts/ignition/modules/deployTestSelfVerificationRoot.ts (1 hunks)
🔇 Additional comments (7)
contracts/contracts/tests/TestSelfVerificationRoot.sol (1)

86-90: LGTM: Formatting improvement enhances readability.

The multi-line parameter formatting improves code readability without changing the function's behavior.

contracts/hardhat.config.ts (4)

57-57: Good: Standardized environment variable usage.

Changing from CELO_KEY to PRIVATE_KEY maintains consistency with other network configurations.


59-63: Good: Simplified network name and proper configuration.

The network name change from celoAlfajores to alfajores is cleaner and the configuration is properly set up.


70-70: Good: Added alfajores etherscan API key configuration.

This addition enables contract verification on the alfajores testnet.


77-88: Verify the updated Etherscan API URLs are correct.

The API URLs have been changed to use api.etherscan.io/v2/api?chainid=X format instead of the previous celoscan.io format. Please confirm these new endpoints are valid and functional for contract verification.

Are the Etherscan API URLs for Celo networks correct? Specifically:
- https://api.etherscan.io/v2/api?chainid=42220 for Celo mainnet
- https://api.etherscan.io/v2/api?chainid=44787 for Alfajores testnet
contracts/ignition/modules/deployTestSelfVerificationRoot.ts (2)

1-34: Excellent: Well-structured deployment module with comprehensive documentation.

This Hardhat Ignition module follows best practices with:

  • Clear parameter documentation and usage examples
  • Proper default values with override capability
  • Explicit instructions for verification
  • Clear warning about the temporary scopeValue that needs replacement

The module structure is correct and ready for deployment.


16-16: Important: Remember to replace the temporary scopeValue.

The documentation correctly emphasizes that the scopeValue of 12345 is temporary and must be calculated and updated after deployment using setScopeValue().

✨ Finishing Touches
  • 📝 Generate Docstrings

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@kevinsslin kevinsslin requested a review from remicolin June 21, 2025 16:23
@remicolin remicolin changed the base branch from main to dev June 22, 2025 10:14
@remicolin remicolin changed the base branch from dev to main June 22, 2025 10:15
@remicolin remicolin changed the base branch from main to dev June 22, 2025 16:18
@remicolin
Copy link
Collaborator

closing the PR as i cherry-picked the commit from dev branch

@remicolin remicolin closed this Jun 22, 2025
@transphorm transphorm deleted the Add-test-self-verification-root-deployment-script branch October 10, 2025 21:03
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.

5 participants