Conversation
WalkthroughThe changes introduce a unified network abstraction using a Changes
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)
Poem
Note ⚡️ AI Code Reviews for VS Code, Cursor, WindsurfCodeRabbit 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. Note ⚡️ Faster reviews with cachingCodeRabbit 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 ✨ Finishing Touches
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed 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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 0
🔭 Outside diff range comments (2)
script/Deployments.s.sol (1)
351-356: 🛠️ Refactor suggestion
⚠️ Potential issueDynamic 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 inrun().
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 bygetOutputDir(), so a Holesky run will revert onvm.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()isinternal, it can safely callgetOutputDir()/getNetwork().script/SetupContract.s.sol (1)
198-212: 🛠️ Refactor suggestionSerialisation 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
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. PassproxyDeployerPrivateKey(already available inrun()) to avoid inconsistent signers.The comment
// TODO: update thissuggests the Holesky addresses are provisional. Please either:
- replace with verified addresses, or
- leave a clear
require(false, "...")/revertto prevent accidental main-net deployment with stale values.
485-509:getNetwork()silently falls back to DEVNET on typosReturning
Network.DEVNETfor any unknownNETWORKenv-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 checksThe script hard-codes
allocationManagerandwethStrategyaddresses 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 libraryBoth 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
📒 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 filesThe
.gitignorenow only ignores thedevnet/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 requirementThe minimum collateral value has been reduced from 0.1 ether to 0.01 ether. This aligns with the
urcMinCollateralvalue in the Holesky configuration (10000000000000000 wei = 0.01 ETH).script/output/holesky/operatorSetId.json (1)
1-6: New Holesky operator set configuration fileThis 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 registryThis 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
urcMinCollateralvalue of 10000000000000000 (0.01 ETH) aligns with the update indeploy.sh.script/SetRegistry.s.sol (7)
59-64: Good network abstraction with enumThe introduction of a
Networkenum improves code readability and type safety when referencing different network environments.
66-80: Well-implemented network detectionThe
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 mappingThe
getOutputDir()function provides a clean mapping from network enum to the corresponding output directory path, supporting all defined networks.
110-118: Improved directory managementThe code now correctly:
- Determines the network from environment variables
- Sets up the appropriate output path dynamically
- 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 handlingThe 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 referencesThe permission controller addresses are now properly referenced using the dynamically determined network-specific addresses rather than hardcoded values.
186-190: Consistent metadata URIUsing 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 withDeployments.s.sol
outputFileis resolved withgetOutputDir(network), but the deployment script currently always storestaiyiAddresses.jsonunder thedevnetfolder (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.
Summary by CodeRabbit
New Features
Improvements
Other