feat(ev-deployer): add live chain deployment via CREATE2#200
feat(ev-deployer): add live chain deployment via CREATE2#200randygrok wants to merge 13 commits intoev-deployer-part3-permit2from
Conversation
Prepares for the deploy subcommand where addresses are determined by CREATE2, not by user config. Genesis mode validates addresses are present.
Embeds creation bytecodes alongside existing runtime bytecodes. Extracts expected_runtime_bytecode for Permit2 verification.
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
|
Claude finished @randygrok's task —— View job Code Review for ev-deployer Live Chain DeploymentReviewing the PR for live chain deployment functionality via CREATE2. I'll analyze code quality, security, performance, and potential issues. Todo List
Review SummaryThis PR adds excellent live chain deployment functionality to ✅ StrengthsArchitecture & Design
Security
Error Handling
Test Coverage
🔍 Areas for Consideration1. AdminProxy Support (Minor)The state management only handles Permit2 currently. While AdminProxy config exists, the pipeline and state tracking don't include it: // bin/ev-deployer/src/deploy/state.rs:37-40
pub(crate) struct ContractStates {
pub permit2: Option<ContractState>,
// Missing: pub admin_proxy: Option<ContractState>,
}Impact: Low - AdminProxy deployment isn't implemented yet 2. Gas Estimation (Enhancement)The deployment doesn't include gas estimation or custom gas limits: // bin/ev-deployer/src/deploy/deployer.rs:71-73
let tx = TransactionRequest::default()
.to(DETERMINISTIC_DEPLOYER)
.input(calldata.into());Impact: Low - Default gas estimation usually works 3. Transaction Confirmation (Minor)The code waits for transaction receipt but doesn't specify confirmation count: // bin/ev-deployer/src/deploy/deployer.rs:75-76
let pending = self.provider.send_transaction(tx).await?;
let receipt = pending.get_receipt().await?;Impact: Low - Single confirmation is usually sufficient for deployment 🚀 Performance
🏗️ Code Quality
🧪 Testing AssessmentExcellent test coverage across all modules:
Notable testing patterns:
📋 Recommendations
🎯 VerdictThis is a high-quality implementation that demonstrates excellent Rust practices, security awareness, and thoughtful design. The code is production-ready with:
The CREATE2 deployment functionality will be a valuable addition to the ev-deployer toolkit. |
AdminProxy has an empty constructor and sets owner via genesis storage slot 0, making it incompatible with live CREATE2 deployment where the owner would remain address(0). Restrict AdminProxy to genesis-only mode.
Write to a .tmp file first, then rename into place. Prevents state file corruption if the process crashes mid-write.
Summary
Adds a
deploysubcommand toev-deployerfor deploying AdminProxy and Permit2 contracts to a live chain via CREATE2 using the deterministic deployer factory.Previously,
ev-deployercould only generate genesis alloc JSON for pre-genesis deployment. This PR adds the ability to deploy the same contracts to an already-running chain, with deterministic addresses, state persistence, and idempotent resume.Key changes
addressis nowOption<Address>in contract configs. Required forgenesismode (validated at runtime), ignored indeploymode where CREATE2 determines the address.0x4e59b44847b379578588920ca78fbf26c0b4956c).pending→deployed→verified). Immutability checks prevent config drift between runs.get_code,deploy_create2).LiveDeployerimplements it with alloy provider + signer.Usage
The state file is created on first run and reused on subsequent runs for resumability. If a deploy is interrupted, re-running the same command picks up where it left off.