-
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
Open
randygrok
wants to merge
11
commits into
main
Choose a base branch
from
ev-deployer-part1-core
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
11 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 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
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,134 @@ | ||
| # 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" | ||
|
|
||
| [contracts.fee_vault] | ||
| address = "0x000000000000000000000000000000000000FE00" | ||
| owner = "0x000000000000000000000000000000000000Ad00" | ||
| destination_domain = 0 | ||
| recipient_address = "0x0000000000000000000000000000000000000000000000000000000000000000" | ||
| minimum_amount = 0 | ||
| call_fee = 0 | ||
| bridge_share_bps = 10000 | ||
| other_recipient = "0x0000000000000000000000000000000000000000" | ||
| hyp_native_minter = "0x0000000000000000000000000000000000000000" | ||
| ``` | ||
|
|
||
| Both contracts are optional — include only the sections you need. | ||
|
|
||
| ### 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) | | ||
|
|
||
| #### `[contracts.fee_vault]` | ||
|
|
||
| | Field | Type | Default | Description | | ||
| |----------------------|---------|---------|------------------------------------------------| | ||
| | `address` | address | — | Address to deploy at | | ||
| | `owner` | address | — | Owner (must not be zero) | | ||
| | `destination_domain` | u32 | 0 | Hyperlane destination domain | | ||
| | `recipient_address` | bytes32 | 0x0…0 | Hyperlane recipient | | ||
| | `minimum_amount` | u64 | 0 | Minimum amount for bridging | | ||
| | `call_fee` | u64 | 0 | Fee for sendToCelestia | | ||
| | `bridge_share_bps` | u64 | 0 | Bridge share in basis points (0–10000). 0 maps to 10000 | | ||
| | `other_recipient` | address | 0x0…0 | Split accounting recipient | | ||
| | `hyp_native_minter` | address | 0x0…0 | HypNativeMinter address | | ||
|
|
||
| ## 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", | ||
| "fee_vault": "0x000000000000000000000000000000000000FE00" | ||
| } | ||
| ``` | ||
|
|
||
| ### 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 | | ||
| | `fee_vault` | Fee vault with Hyperlane bridge integration | | ||
|
|
||
| Runtime bytecodes are embedded in the binary — no external toolchain is needed at deploy time. | ||
|
|
||
| ## Testing | ||
|
|
||
| ```bash | ||
| just test-deployer | ||
| ``` |
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.