Skip to content

Commit

Permalink
Usage and setup changes (#354)
Browse files Browse the repository at this point in the history
* Add details on usage section

* Start adding Ethereum testnet section

* Complete setup section

* Add step to deploy contracts

* Fix Mainnet image link

* Fix Aligned fork branch

* Add staking step in Testnet setup

* Complete Aligned Testnet setup

* Update README.md

* Revert "Update README.md"

This reverts commit 2f68a5d.

* Update README.md

* Update submit state command

* Fix Testnet setup ordered list

* Update batcher deployment result paragraph

---------

Co-authored-by: gabrielbosio <[email protected]>
  • Loading branch information
xqft and gabrielbosio authored Oct 3, 2024
1 parent 16bc6df commit 2c601a0
Showing 1 changed file with 138 additions and 9 deletions.
147 changes: 138 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ You can bridge Mina accounts to Ethereum Devnet or Ethereum Testnet. The followi

#### Ethereum Devnet

1. [Setup Aligned Devnet locally](https://github.com/yetanotherco/aligned_layer/blob/staging/docs/3_guides/6_setup_aligned.md#booting-devnet-with-default-configs)
1. [Setup Aligned (Devnet) infrastructure locally](https://docs.alignedlayer.com/guides/6_setup_aligned)
1. Setup the `.env` file of the Bridge. A template is available in `.env.template`.
1. Set `ETH_CHAIN` to `devnet`.
1. Set `MINA_RPC_URL` to the URL of the Mina node GraphQL API (See [Mina node section](#mina-node)).
Expand All @@ -34,7 +34,7 @@ You can bridge Mina accounts to Ethereum Devnet or Ethereum Testnet. The followi

Because the Bridge uses for now a forked version of Aligned, you may need to setup a local instance of Aligned to verify Mina proofs.

##### Aligned Testnet setup
##### Setup Aligned Testnet infrastructure locally

You will need two Ethereum accounts: One to fund the Aligned operator (`operator_account_address`) and another to fund the Aligned batcher (`batcher_account_address`).

Expand Down Expand Up @@ -90,13 +90,28 @@ You will need two Ethereum accounts: One to fund the Aligned operator (`operator
```

1. Setup the `contracts/scripts/.env` file. A template is available in `contracts/scripts/.env.example.holesky`. Set `PRIVATE_KEY` to the private key of the account you chose to fund the operator (the one with address `operator_account_address`).
1. Deploy Aligned contracts:

```sh
make deploy_aligned_contracts
```

This will create `contracts/script/output/holesky/alignedlayer_deployment_output.json`.
1. Deploy the contracts with `make deploy_aligned_contracts`.

`contracts/script/output/holesky/alignedlayer_deployment_output.json` should have been updated or created if it didn't exist before. Set the `permissions` field on that file:
```json
{
"addresses": {
// ...
},
"chainInfo": {
// ...
},
"permissions": {
"alignedLayerAggregator": "<operator_account_address>",
"alignedLayerChurner": "<operator_account_address>",
"alignedLayerEjector": "<operator_account_address>",
"alignedLayerOwner": "<operator_account_address>",
"alignedLayerUpgrader": "<operator_account_address>",
"pauserRegistry": "0x85Ef7299F8311B25642679edBF02B62FA2212F06"
}
}
```
1. Create 3 EigenLayer keystores:
1. Aggregator and operator ECDSA:
Expand Down Expand Up @@ -338,6 +353,120 @@ In the Mina Bridge repo, setup the `.env` file. A template is available in `.env
### Bridge a Mina account
1. In the root folder, deploy the Bridge's contracts with:

```sh
make deploy_contract
```

In the `.env` file, set `STATE_SETTLEMENT_ETH_ADDR` and `ACCOUNT_VALIDATION_ETH_ADDR` to the corresponding deployed contract addresses.

1. Submit a Mina state proof to verify (**NOTE:** Because of the Aligned minimum batch size, you may need to submit two proofs to make Aligned Devnet verify them):

- Run `make submit_devnet_state` if you are using Mina Devnet or `make submit_mainnet_state` if you are using Mina Mainnet.

1. Submit an account to verify (**NOTE:** Because of the Aligned minimum batch size, you may need to submit two proofs to make Aligned Devnet verify them):

```sh
make submit_account PUBLIC_KEY=<string> STATE_HASH=<string>
```

Where:
- `PUBLIC_KEY` is the public key of the Mina account you want to verify
- `STATE_HASH` is the hash of a Mina state that was verified in Ethereum

1. Open a new terminal and register the operator:

```sh
eigenlayer operator register config-files/holesky/config.yaml
```

1. Whitelist the registered operator:

```sh
make operator_whitelist OPERATOR_ADDRESS=<operator_account_address>
```

1. Deposit Strategy tokens for the operator. Follow [this section from the AlignedLayer docs](https://docs.alignedlayer.com/operators/0_running_an_operator#step-4-deposit-strategy-tokens).

1. Start operator:

```sh
make operator_start CONFIG_FILE=config-files/holesky/config.yaml
```

1. Set `contracts/script/deploy/config/holesky/batcher-payment-service.holesky.config.json` to:

```json
{
"address": {
"batcherWallet": "<batcher_account_address>",
"alignedLayerServiceManager": "<aligned_service_manager_address>"
},
"amounts": {
"gasForAggregator": "300000",
"gasPerProof": "21000"
},
"permissions": {
"owner": "<operator_account_address>"
},
"eip712": {
"noncedVerificationDataTypeHash": "41817b5c5b0c3dcda70ccb43ba175fdcd7e586f9e0484422a2c6bba678fdf4a3"
}
}
```

1. Deploy Batcher payment contract:

```sh
make deploy_batcher_payment_service
```

The file `contracts/script/output/holesky/alignedlayer_deployment_output.json` will have two new fields: `addresses.batcherPaymentService` and `addresses.batcherPaymentServiceImplementation`.

1. Pay the batcher:

```sh
cast send <batcher_payment_service_address> --rpc-url <eth_rpc_url> --private-key <bridge_account_private_key> --value 1ether
```

1. Deposit to batcher in the Aligned Service Manager Contract:

```sh
cast send <aligned_service_manager_address> --rpc-url <eth_rpc_url> --private-key <bridge_account_private_key> --value 1ether "depositToBatcher(address)" <batcher_payment_service_address>
```

1. Setup local storage for the batcher:

```sh
make run_storage
```

1. Start the batcher:

```sh
cargo run --manifest-path ./batcher/aligned-batcher/Cargo.toml --release -- --config ./config-files/holesky/config-batcher.yaml --env-file ./batcher/aligned-batcher/.env.dev
```

#### Bridge environment setup

In the Mina Bridge repo, setup the `.env` file. A template is available in `.env.template`.

1. Set `ETH_CHAIN` to `holesky`.
1. Set `MINA_RPC_URL` to the URL of the Mina node GraphQL API (See [Mina node section](#mina-node)).
1. Set the rest of the env vars to:

```sh
BATCHER_ADDR="ws://localhost:8080"
BATCHER_ETH_ADDR=<batcher_payment_service_address>
ETH_RPC_URL=<url>
PROOF_GENERATOR_ADDR=0x66f9664f97F2b50F62D13eA064982f936dE76657
PRIVATE_KEY=<bridge_account_private_key>
ALIGNED_SM_HOLESKY_ETH_ADDR=<aligned_service_manager_address>
```

### Bridge a Mina account

1. In the root folder, deploy the Bridge's contracts with:
```sh
Expand Down

0 comments on commit 2c601a0

Please sign in to comment.