-
Notifications
You must be signed in to change notification settings - Fork 8
feat(ev-deployer): part 1 - add ev-deployer CLI for genesis contract allocation #167
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
89eccaa
feat: add ev-deployer CLI for genesis contract allocation
randygrok 0c8f54e
test: add bytecode verification tests for ev-deployer contracts
randygrok 2ba2b80
docs: add ev-deployer README with config and usage guide
randygrok a540858
fix(ci): serialize bytecode verification tests to avoid solc race con…
randygrok b9e2670
style: apply cargo fmt to ev-deployer
randygrok 18ed817
ci(ev-deployer): split workflow into separate bytecode and unit test …
randygrok f7d0e71
style: fix fmt and clippy lint errors in ev-deployer
randygrok e5f4eb9
Merge branch 'main' into ev-deployer-part1-core
randygrok be1b241
Merge remote-tracking branch 'origin/main' into ev-deployer-part1-core
randygrok 7e19222
ci(ev-deployer): add e2e genesis test to CI workflow
randygrok aeffc0d
fix(ev-deployer): address PR review feedback
jgimeno e8a39f8
refactor(ev-deployer): remove FeeVault contract from part 1
randygrok 089ef22
refactor(ev-deployer): remove AdminProxy contract from part 1
randygrok 6b85563
Revert "refactor(ev-deployer): remove AdminProxy contract from part 1"
randygrok 93b3eaa
fix(ev-deployer): make [contracts] section optional in config
randygrok 70111fd
feat(ev-deployer): add init command to generate starter config
randygrok fa0e71f
fix(ev-deployer): clean up command ordering and stale fee_vault refer…
randygrok 1acd3c8
docs(ev-deployer): document init command in README
randygrok 65bbf9e
fix(ev-deployer): normalize alloc keys for collision detection
randygrok 08c9eb4
style(ev-deployer): fix fmt and clippy lint in genesis.rs
randygrok 98a4600
Merge branch 'main' into ev-deployer-part1-core
randygrok 6da798a
Merge branch 'main' into ev-deployer-part1-core
randygrok File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,79 @@ | ||
| name: EV Deployer CI | ||
|
|
||
| on: | ||
| push: | ||
| paths: | ||
| - 'Cargo.toml' | ||
| - 'Cargo.lock' | ||
| - '.github/workflows/ev_deployer.yml' | ||
| - 'contracts/src/**' | ||
| - 'contracts/foundry.toml' | ||
| - 'bin/ev-deployer/**' | ||
| pull_request: | ||
| paths: | ||
| - 'Cargo.toml' | ||
| - 'Cargo.lock' | ||
| - '.github/workflows/ev_deployer.yml' | ||
| - 'contracts/src/**' | ||
| - 'contracts/foundry.toml' | ||
| - 'bin/ev-deployer/**' | ||
| workflow_dispatch: | ||
|
|
||
| env: | ||
| CARGO_TERM_COLOR: always | ||
|
|
||
| jobs: | ||
| verify-bytecodes: | ||
| name: EV Deployer bytecode verification | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 10 | ||
| steps: | ||
| - uses: actions/checkout@v6 | ||
| with: | ||
| submodules: recursive | ||
|
|
||
| - uses: dtolnay/rust-toolchain@stable | ||
| - uses: Swatinem/rust-cache@v2 | ||
| with: | ||
| cache-on-failure: true | ||
|
|
||
| - name: Install Foundry | ||
| uses: foundry-rs/foundry-toolchain@v1 | ||
|
|
||
| - name: Run bytecode verification tests | ||
| run: cargo test -p ev-deployer -- --ignored --test-threads=1 | ||
|
|
||
| unit-tests: | ||
| name: EV Deployer unit tests | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 10 | ||
| steps: | ||
| - uses: actions/checkout@v6 | ||
|
|
||
| - uses: dtolnay/rust-toolchain@stable | ||
| - uses: Swatinem/rust-cache@v2 | ||
| with: | ||
| cache-on-failure: true | ||
|
|
||
| - name: Run unit tests | ||
| run: cargo test -p ev-deployer | ||
|
|
||
| e2e-genesis: | ||
| name: EV Deployer e2e genesis test | ||
| runs-on: ubuntu-24.04 | ||
| timeout-minutes: 30 | ||
| steps: | ||
| - uses: actions/checkout@v6 | ||
| with: | ||
| submodules: recursive | ||
|
|
||
| - uses: dtolnay/rust-toolchain@stable | ||
| - uses: Swatinem/rust-cache@v2 | ||
| with: | ||
| cache-on-failure: true | ||
|
|
||
| - name: Install Foundry | ||
| uses: foundry-rs/foundry-toolchain@v1 | ||
|
|
||
| - name: Run e2e genesis test | ||
| run: bash bin/ev-deployer/tests/e2e_genesis.sh | ||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,7 @@ | ||
| [workspace] | ||
| resolver = "2" | ||
| members = [ | ||
| "bin/ev-deployer", | ||
| "bin/ev-dev", | ||
| "bin/ev-reth", | ||
| "crates/common", | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| [package] | ||
| name = "ev-deployer" | ||
| version.workspace = true | ||
| edition.workspace = true | ||
| rust-version.workspace = true | ||
| license.workspace = true | ||
| homepage.workspace = true | ||
| repository.workspace = true | ||
| authors.workspace = true | ||
|
|
||
| [dependencies] | ||
| alloy-primitives = { workspace = true, features = ["serde"] } | ||
| clap = { workspace = true, features = ["derive", "env"] } | ||
| serde = { workspace = true, features = ["derive"] } | ||
| serde_json = { workspace = true } | ||
| toml = "0.8" | ||
| eyre = { workspace = true } | ||
|
|
||
| [dev-dependencies] | ||
| tempfile = { workspace = true } | ||
|
|
||
| [lints] | ||
| workspace = true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,113 @@ | ||
| # EV Deployer | ||
|
|
||
| CLI tool for generating genesis alloc entries for ev-reth contracts. It reads a declarative TOML config and produces the JSON needed to embed contracts into a chain's genesis state. | ||
|
|
||
| ## Building | ||
|
|
||
| ```bash | ||
| just build-deployer | ||
| ``` | ||
|
|
||
| The binary is output to `target/release/ev-deployer`. | ||
|
|
||
| ## Configuration | ||
|
|
||
| EV Deployer uses a TOML config file to define what contracts to include and how to configure them. See [`examples/devnet.toml`](examples/devnet.toml) for a complete example. | ||
|
|
||
| ```toml | ||
| [chain] | ||
| chain_id = 1234 | ||
|
|
||
| [contracts.admin_proxy] | ||
| address = "0x000000000000000000000000000000000000Ad00" | ||
| owner = "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266" | ||
| ``` | ||
|
|
||
| ### Config reference | ||
|
|
||
| #### `[chain]` | ||
|
|
||
| | Field | Type | Description | | ||
| |------------|------|-------------| | ||
| | `chain_id` | u64 | Chain ID | | ||
|
|
||
| #### `[contracts.admin_proxy]` | ||
|
|
||
| | Field | Type | Description | | ||
| |-----------|---------|---------------------------| | ||
| | `address` | address | Address to deploy at | | ||
| | `owner` | address | Owner (must not be zero) | | ||
|
|
||
| ## Usage | ||
|
|
||
| ### Generate a starter config | ||
|
|
||
| ```bash | ||
| ev-deployer init --output deploy.toml | ||
| ``` | ||
|
|
||
| This creates a TOML config template with all supported contracts commented out and documented. | ||
|
|
||
| ### Generate genesis alloc | ||
|
|
||
| Print alloc JSON to stdout: | ||
|
|
||
| ```bash | ||
| ev-deployer genesis --config deploy.toml | ||
| ``` | ||
|
|
||
| Write to a file: | ||
|
|
||
| ```bash | ||
| ev-deployer genesis --config deploy.toml --output alloc.json | ||
| ``` | ||
|
|
||
| ### Merge into an existing genesis file | ||
|
|
||
| Insert the generated entries into an existing `genesis.json`. The merged result is written to `--output` (or stdout if `--output` is omitted): | ||
|
|
||
| ```bash | ||
| ev-deployer genesis --config deploy.toml --merge-into genesis.json --output genesis-out.json | ||
| ``` | ||
|
|
||
| If an address already exists in the genesis, the command fails. Use `--force` to overwrite: | ||
|
|
||
| ```bash | ||
| ev-deployer genesis --config deploy.toml --merge-into genesis.json --output genesis-out.json --force | ||
| ``` | ||
|
|
||
| ### Export address manifest | ||
|
|
||
| Write a JSON mapping of contract names to their configured addresses: | ||
|
|
||
| ```bash | ||
| ev-deployer genesis --config deploy.toml --addresses-out addresses.json | ||
| ``` | ||
|
|
||
| Output: | ||
|
|
||
| ```json | ||
| { | ||
| "admin_proxy": "0x000000000000000000000000000000000000Ad00" | ||
| } | ||
| ``` | ||
|
|
||
| ### Look up a contract address | ||
|
|
||
| ```bash | ||
| ev-deployer compute-address --config deploy.toml --contract admin_proxy | ||
| ``` | ||
|
|
||
| ## Contracts | ||
|
|
||
| | Contract | Description | | ||
| |----------------|-----------------------------------------------------| | ||
| | `admin_proxy` | Proxy contract with owner-based access control | | ||
|
|
||
| Runtime bytecodes are embedded in the binary — no external toolchain is needed at deploy time. | ||
|
|
||
| ## Testing | ||
|
|
||
| ```bash | ||
| just test-deployer | ||
| ``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| [chain] | ||
| chain_id = 1234 | ||
|
|
||
| [contracts.admin_proxy] | ||
| address = "0x000000000000000000000000000000000000Ad00" | ||
| owner = "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266" |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.