Skip to content

Update holesky deployments#84

Merged
da-bao-jian merged 2 commits intomainfrom
update-holesky
May 17, 2025
Merged

Update holesky deployments#84
da-bao-jian merged 2 commits intomainfrom
update-holesky

Conversation

@will-luban
Copy link
Copy Markdown
Contributor

@will-luban will-luban commented May 16, 2025

Summary by CodeRabbit

  • New Features

    • Added support for multiple deployment networks (DEVNET, HOLESKY, HOODI) with dynamic configuration and output directories.
    • Introduced structured JSON files for storing contract addresses and operator set IDs for the Holesky network.
  • Improvements

    • Enhanced deployment and setup scripts with modularized functions and clearer network-specific logic.
    • Unified metadata URI usage across networks.
    • Reduced minimum collateral value in the deployment process.
  • Other

    • Updated .gitignore to only exclude files in the devnet output directory.

@will-luban will-luban requested a review from da-bao-jian May 16, 2025 13:59
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented May 16, 2025

Walkthrough

The changes introduce a unified network abstraction using a Network enum across deployment and setup scripts, replacing string-based network selection. Scripts are refactored for modularity, with helper functions for environment parsing, output directory management, and network-specific logic. Address and operator set management is now dynamic per network, and new configuration files for the Holesky network are added. The deployment collateral is reduced, and .gitignore is updated to only ignore devnet outputs.

Changes

File(s) Change Summary
script/Deployments.s.sol, script/SetRegistry.s.sol, script/SetupContract.s.sol Introduced a Network enum for network selection, refactored logic to use enums and helper functions for environment variable parsing, output directory management, and network-specific setup. Modularized main logic into smaller functions, and added/updated contract address management per network.
script/Deployments.s.sol Extended Holesky setup to deploy a registry and initialize addresses; added a placeholder for Hoodi network; improved output directory handling; minor formatting fixes.
script/SetRegistry.s.sol Made output directory and address retrieval dynamic per network; unified metadata URI; added revert for unsupported networks.
script/SetupContract.s.sol Refactored monolithic setup into modular internal functions; added network abstraction; improved contract address and operator set retrieval and persistence; explicit directory creation.
script/deploy.sh Reduced the minimum collateral argument from 0.1ether to 0.01ether.
script/output/.gitignore Changed to ignore only the devnet/ subdirectory instead of all files except .gitignore.
script/output/holesky/operatorSetId.json Added a new JSON file with operator set IDs for the Holesky network.
script/output/holesky/taiyiAddresses.json Added a new JSON file mapping contract names to addresses for the Holesky network.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Script
    participant Env
    participant FileSystem
    participant Contracts

    User->>Script: run()
    Script->>Env: Read NETWORK variable
    Env-->>Script: Return network string
    Script->>Script: getNetwork() -> Network enum
    Script->>Script: getOutputDir(Network)
    Script->>FileSystem: Create output directory if needed
    alt DEVNET
        Script->>Script: setupDevnetAddresses()
    else HOLESKY
        Script->>Script: setupHoleskyAddresses()
        Script->>Contracts: Deploy Registry, set addresses
        Script->>FileSystem: Write taiyiAddresses.json
    else HOODI
        Script->>Script: setupHoodiAddresses()
        Script-->>User: Revert "Hoodi is not supported yet"
    end
    Script->>FileSystem: Save outputs (e.g., operatorSetId.json)
Loading

Poem

In script and code, the networks grew,
From strings to enums—now clear and true!
Holesky shines with new address files,
Devnet’s output sorted in tidy piles.
Collateral drops, the scripts refactored neat,
A rabbit’s work—efficient, sweet!
🐇✨

Note

⚡️ AI Code Reviews for VS Code, Cursor, Windsurf

CodeRabbit now has a plugin for VS Code, Cursor and Windsurf. This brings AI code reviews directly in the code editor. Each commit is reviewed immediately, finding bugs before the PR is raised. Seamless context handoff to your AI code agent ensures that you can easily incorporate review feedback.
Learn more here.


Note

⚡️ Faster reviews with caching

CodeRabbit now supports caching for code and dependencies, helping speed up reviews. This means quicker feedback, reduced wait times, and a smoother review experience overall. Cached data is encrypted and stored securely. This feature will be automatically enabled for all accounts on May 16th. To opt out, configure Review - Disable Cache at either the organization or repository level. If you prefer to disable all data retention across your organization, simply turn off the Data Retention setting under your Organization Settings.
Enjoy the performance boost—your workflow just got faster.

✨ Finishing Touches
  • 📝 Generate Docstrings

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
🪧 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.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🔭 Outside diff range comments (2)
script/Deployments.s.sol (1)

351-356: 🛠️ Refactor suggestion

⚠️ Potential issue

Dynamic output path is hard-coded to devnet, breaking Holesky & future networks

deployImplementations() always writes to
script/output/devnet/taiyiAddresses.json, regardless of the network chosen in run().
Consequences:

  • Holesky deployments overwrite / pollute the devnet file.
  • script/SetupContract.s.sol (and any other consumer) expects the file to live under the network-specific directory returned by getOutputDir(), so a Holesky run will revert on vm.readFile(...).

Fix by deriving the path from the selected Network, e.g.:

-        vm.writeJson(finalJ, "script/output/devnet/taiyiAddresses.json");
+        string memory outPath = string.concat(
+            getOutputDir(getNetwork()), "/taiyiAddresses.json"
+        );
+        vm.writeJson(finalJ, outPath);

Because deployImplementations() is internal, it can safely call getOutputDir() / getNetwork().

script/SetupContract.s.sol (1)

198-212: 🛠️ Refactor suggestion

Serialisation overwrites itself & omits validator set

saveOperatorSetIds() builds JSON twice; the first serialisation is discarded and the second only contains the underwriter ID. Simplify to guarantee both IDs are persisted:

-        vm.serializeUint(
-            "operatorSetId", "validatorOperatorSetId", validatorOperatorSetId
-        );
-        string memory operatorSetId = vm.serializeUint(
-            "operatorSetId", "underwriterOperatorSetId", underwriterOperatorSetId
-        );
-
-        string memory output = "output";
-        vm.serializeString(output, "operatorSetId", operatorSetId);
-        string memory finalJ = vm.serializeString(output, "operatorSetId", operatorSetId);
-
-        string memory outputPath =
-            string(bytes(string.concat(outputDir, "/operatorSetId.json")));
-        vm.writeJson(finalJ, outputPath);
+        string memory json = vm.serializeUint(
+            "operatorSetId", "validatorOperatorSetId", validatorOperatorSetId
+        );
+        json = vm.serializeUint(
+            json, "underwriterOperatorSetId", underwriterOperatorSetId
+        );
+
+        string memory outputPath = string.concat(outputDir, "/operatorSetId.json");
+        vm.writeJson(json, outputPath);
🧹 Nitpick comments (4)
script/Deployments.s.sol (2)

393-419: Broadcast uses default key & TODO left behind

  1. vm.startBroadcast(); is invoked without an explicit private key.
    On test-nets this defaults to the zero-index key, which may be unfunded and differs from the deployer key used elsewhere. Pass proxyDeployerPrivateKey (already available in run()) to avoid inconsistent signers.

  2. The comment // TODO: update this suggests the Holesky addresses are provisional. Please either:

    • replace with verified addresses, or
    • leave a clear require(false, "...")/revert to prevent accidental main-net deployment with stale values.

485-509: getNetwork() silently falls back to DEVNET on typos

Returning Network.DEVNET for any unknown NETWORK env-var can mask mis-configuration and deploy to the wrong chain.
Safer pattern:

-        } else {
-            return Network.DEVNET;
+        } else if (
+            keccak256(abi.encodePacked(network)) == keccak256(abi.encodePacked("devnet"))
+        ) {
+            return Network.DEVNET;
+        } else {
+            revert("Unsupported NETWORK env var");
script/SetupContract.s.sol (2)

94-119: Hard-coded Holesky addresses—add sanity checks

The script hard-codes allocationManager and wethStrategy addresses for Holesky.
To avoid silent breakage when EigenLayer upgrades, consider asserting code-size:

require(wethStrategyAddr.code.length > 0, "WETH strategy not deployed");

or gating with a block-hash / chain-id check.


68-82: Duplicate enum / utils – consider a shared library

Both scripts define identical enum Network, getNetwork() & getOutputDir().
Extracting these into a small library (e.g., NetworkLib.sol) reduces duplication and guarantees consistent behaviour across future scripts.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
Cache: Disabled due to data retention organization setting
Knowledge Base: Disabled due to data retention organization setting

📥 Commits

Reviewing files that changed from the base of the PR and between 4926aec and 31a49e0.

📒 Files selected for processing (7)
  • script/Deployments.s.sol (5 hunks)
  • script/SetRegistry.s.sol (4 hunks)
  • script/SetupContract.s.sol (2 hunks)
  • script/deploy.sh (1 hunks)
  • script/output/.gitignore (1 hunks)
  • script/output/holesky/operatorSetId.json (1 hunks)
  • script/output/holesky/taiyiAddresses.json (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Foundry Project
🔇 Additional comments (12)
script/output/.gitignore (1)

1-1: Improved scope of ignored files

The .gitignore now only ignores the devnet/ directory contents instead of all files in the output directory. This change appropriately allows tracking of Holesky network configuration files while keeping devnet files ignored.

script/deploy.sh (1)

19-19: Reduced minimum collateral requirement

The minimum collateral value has been reduced from 0.1 ether to 0.01 ether. This aligns with the urcMinCollateral value in the Holesky configuration (10000000000000000 wei = 0.01 ETH).

script/output/holesky/operatorSetId.json (1)

1-6: New Holesky operator set configuration file

This new JSON file properly defines two operator set IDs for the Holesky network:

  • validatorOperatorSetId: 0
  • underwriterOperatorSetId: 1

These IDs correspond to the operator sets that will be managed by the AllocationManager and EigenLayerMiddleware contracts.

script/output/holesky/taiyiAddresses.json (1)

1-24: New Holesky address registry

This new configuration file provides a well-structured mapping of all the contract addresses needed for the Holesky network deployment. It includes implementation addresses, proxy addresses, and admin addresses for all the core Taiyi components.

The urcMinCollateral value of 10000000000000000 (0.01 ETH) aligns with the update in deploy.sh.

script/SetRegistry.s.sol (7)

59-64: Good network abstraction with enum

The introduction of a Network enum improves code readability and type safety when referencing different network environments.


66-80: Well-implemented network detection

The getNetwork() function correctly parses the "NETWORK" environment variable and returns the appropriate enum value. The implementation uses string comparison with proper encoding to ensure reliability.


82-90: Clear output directory mapping

The getOutputDir() function provides a clean mapping from network enum to the corresponding output directory path, supporting all defined networks.


110-118: Improved directory management

The code now correctly:

  1. Determines the network from environment variables
  2. Sets up the appropriate output path dynamically
  3. Creates the output directory if it doesn't exist

This ensures the script works consistently regardless of the pre-existing directory structure.


129-155: Network-specific address handling

The implementation correctly handles different address sources based on the network:

  • DEVNET: Reads from JSON files
  • HOLESKY: Uses hardcoded contract addresses
  • HOODI: Properly reverts with clear error message

This approach allows flexibility while maintaining clean code organization.


163-168: Updated permission controller references

The permission controller addresses are now properly referenced using the dynamically determined network-specific addresses rather than hardcoded values.


186-190: Consistent metadata URI

Using a fixed GitHub URL for the metadata URI across all networks ensures consistency in the AVS metadata.

script/SetupContract.s.sol (1)

285-293: Will crash because file path disagrees with Deployments.s.sol

outputFile is resolved with getOutputDir(network), but the deployment script currently always stores taiyiAddresses.json under the devnet folder (see previous comment).
Until that bug is fixed, vm.readFile(outputFile) reverts for Holesky.

No action required here once the deployment path is corrected, but keep an eye on pipeline failures.

Copy link
Copy Markdown
Contributor

@da-bao-jian da-bao-jian left a comment

Choose a reason for hiding this comment

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

LGTM

@da-bao-jian da-bao-jian merged commit a405079 into main May 17, 2025
2 checks passed
@da-bao-jian da-bao-jian deleted the update-holesky branch May 17, 2025 00:33
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.

3 participants