-
Notifications
You must be signed in to change notification settings - Fork 7
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
Changes from 12 commits
89eccaa
0c8f54e
2ba2b80
a540858
b9e2670
18ed817
f7d0e71
e5f4eb9
be1b241
7e19222
aeffc0d
e8a39f8
089ef22
6b85563
93b3eaa
70111fd
fa0e71f
1acd3c8
65bbf9e
08c9eb4
98a4600
6da798a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| 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.
| 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", | ||
|
|
||
| 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 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,105 @@ | ||
| # 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 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 | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. are these optional to deploy?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think I am gonna move them into ev-deployer directly. |
||
|
|
||
| | 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 | ||
| ``` | ||
| 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" |
Uh oh!
There was an error while loading. Please reload this page.