From 9fee59826d734971df25c539dcfe79c6ac7d8edf Mon Sep 17 00:00:00 2001 From: gabrielbosio Date: Thu, 26 Sep 2024 12:49:45 -0300 Subject: [PATCH 01/12] Add details on usage section --- README.md | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 3df53ad0..a810075f 100644 --- a/README.md +++ b/README.md @@ -14,24 +14,43 @@ This project is being redesigned to use [Aligned Layer](https://github.com/yetan ## Usage +### Setup + +### Mina node + +- If you want the Bridge to use Mina Devnet then use a node that runs a Devnet instance corresponding to the commit `599a76d` [of the Mina repo](https://github.com/MinaProtocol/mina/tree/599a76dd47be99183d2102d9eb93eda679dd46ec) or a newer one (e.g.: [this Docker image](https://console.cloud.google.com/gcr/images/o1labs-192920/GLOBAL/mina-daemon:3.0.1-compatible-599a76d-bullseye-devnet/details)). See [how to connect to Mina Devnet](https://docs.minaprotocol.com/node-operators/block-producer-node/connecting-to-devnet#docker) if you want to run an instance yourself. +- If you want the Bridge to use Mina Mainnet use a node that runs a Mainnet instance corresponding to the commit `65c84ad` [of the Mina repo](https://github.com/MinaProtocol/mina/tree/65c84adacd55272160d9f77c31063d94a942afb6) or a newer one (e.g.: [this Docker image](https://console.cloud.google.com/gcr/images/o1labs-192920/GLOBAL/mina-daemon:65c84ada-bullseye-mainnet/details?tab=info)). See [how to connect to Mina Mainnet](https://docs.minaprotocol.com/node-operators/block-producer-node/connecting-to-the-network#docker) if you want to run an instance yourself. + +#### Ethereum Devnet + 1. [Setup Aligned Devnet locally](https://github.com/yetanotherco/aligned_layer/blob/main/docs/guides/3_setup_aligned.md#booting-devnet-with-default-configs) 1. Setup the `core/.env` file of the bridge's core program. A template is available in `core/.env.template`. -1. In the root folder, deploy the bridge's contract with: + 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)). + +### Bridge a Mina account + +1. In the Bridge root folder, deploy the Bridge's contracts with: ```sh - make deploy_contract_anvil + make deploy_contract ``` -1. Submit a state to verify: +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): ```sh - make submit-state + make submit_state ``` + 1. Submit an account to verify: ```sh - make submit-account PUBLIC_KEY= + make submit_account PUBLIC_KEY= STATE_HASH= ``` + + 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 ## Table of Contents - [About](#about) From 6015c1959a1e6ffb9b0ccf0c8173c278bec7f0af Mon Sep 17 00:00:00 2001 From: gabrielbosio Date: Thu, 26 Sep 2024 16:08:42 -0300 Subject: [PATCH 02/12] Start adding Ethereum testnet section --- README.md | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index eed89073..b9c49e2b 100644 --- a/README.md +++ b/README.md @@ -22,6 +22,8 @@ The bridge leverages [Aligned Layer](https://github.com/yetanotherco/aligned_lay - If you want the Bridge to use Mina Devnet then use a node that runs a Devnet instance corresponding to the commit `599a76d` [of the Mina repo](https://github.com/MinaProtocol/mina/tree/599a76dd47be99183d2102d9eb93eda679dd46ec) or a newer one (e.g.: [this Docker image](https://console.cloud.google.com/gcr/images/o1labs-192920/GLOBAL/mina-daemon:3.0.1-compatible-599a76d-bullseye-devnet/details)). See [how to connect to Mina Devnet](https://docs.minaprotocol.com/node-operators/block-producer-node/connecting-to-devnet#docker) if you want to run an instance yourself. - If you want the Bridge to use Mina Mainnet use a node that runs a Mainnet instance corresponding to the commit `65c84ad` [of the Mina repo](https://github.com/MinaProtocol/mina/tree/65c84adacd55272160d9f77c31063d94a942afb6) or a newer one (e.g.: [this Docker image](https://console.cloud.google.com/gcr/images/o1labs-192920/GLOBAL/mina-daemon:65c84ada-bullseye-mainnet/details?tab=info)). See [how to connect to Mina Mainnet](https://docs.minaprotocol.com/node-operators/block-producer-node/connecting-to-the-network#docker) if you want to run an instance yourself. +You can bridge Mina accounts to Ethereum Devnet or Ethereum Testnet. The following subsections describe how to config the Bridge for each network. + #### Ethereum Devnet 1. [Setup Aligned Devnet locally](https://github.com/yetanotherco/aligned_layer/blob/main/docs/guides/3_setup_aligned.md#booting-devnet-with-default-configs) @@ -29,6 +31,14 @@ The bridge leverages [Aligned Layer](https://github.com/yetanotherco/aligned_lay 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)). +#### Ethereum Testnet + +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 + +(TODO) + ### Bridge a Mina account 1. In the root folder, deploy the Bridge's contracts with: @@ -43,7 +53,7 @@ The bridge leverages [Aligned Layer](https://github.com/yetanotherco/aligned_lay make submit_state ``` -1. Submit an account to verify: +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= STATE_HASH= From 52d03a43dae89882ec100d212204b5389cfdb306 Mon Sep 17 00:00:00 2001 From: gabrielbosio Date: Fri, 27 Sep 2024 19:35:12 -0300 Subject: [PATCH 03/12] Complete setup section --- README.md | 406 ++++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 365 insertions(+), 41 deletions(-) diff --git a/README.md b/README.md index b9c49e2b..9f52ebbb 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,6 @@ This project introduces the verification of [Mina Protocol](https://minaprotocol The bridge leverages [Aligned Layer](https://github.com/yetanotherco/aligned_layer) to verify Mina Proofs of State and Mina Proofs of Account in Ethereum. - ## Usage ### Setup @@ -37,7 +36,325 @@ Because the Bridge uses for now a forked version of Aligned, you may need to set ##### Aligned Testnet setup -(TODO) +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`). + +1. Clone the [forked Aligned repo](https://github.com/lambdaclass/aligned_layer). Checkout to the `aligned` branch. +1. Run: + + ```sh + make deps go_deps + ``` + +1. Copy the EigenLayer Holešky deployment config file into Aligned: + + ```sh + cp contracts/lib/eigenlayer-middleware/lib/eigenlayer-contracts/script/configs/holesky/Holesky_current_deployment.config.json contracts/script/output/holesky + ``` + +1. Set `contracts/script/deploy/config/holesky/aligned.holesky.config.json` to: + + ```json + { + "chainInfo": { + "chainId": 17000 + }, + "permissions": { + "owner": "", + "aggregator": "", + "upgrader": "", + "churner": "", + "ejector": "", + "deployer": "", + "initalPausedStatus": 0 + }, + "minimumStakes": [ + 1 + ], + "strategyWeights": [ + [ + { + "0_strategy": "0x80528D6e9A2BAbFc766965E0E26d5aB08D9CFaF9", + "1_multiplier": 1e+18 + } + ] + ], + "operatorSetParams": [ + { + "0_maxOperatorCount": 200, + "1_kickBIPsOfOperatorStake": 11000, + "2_kickBIPsOfTotalStake": 50 + } + ], + "uri": "" + } + ``` + +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. Set `contracts/script/output/holesky/alignedlayer_deployment_output.json` to: + + ```json + { + "addresses": { + "alignedLayerProxyAdmin": "0x715e3F1c9F58832a606cf85C328250af32d20E93", + "alignedLayerServiceManager": "0x4d879A997f422FeB8AC2f3d9Dcc749e9d8d0E4a4", + "alignedLayerServiceManagerImplementation": "0x63257B1e36B78cb8be08A5A42317B93D7127D56b", + "blsApkRegistry": "0xf1e92D804230Cdb88D95A79e8D6E5B4e3182E632", + "blsApkRegistryImplementation": "0x6d3Bf64adAd29949766417543eF2eb8670964426", + "indexRegistry": "0xd2062Fb412923bE70F4d51E361Fe17408eE4b1b0", + "indexRegistryImplementation": "0x5Ee29B5d21CDA0ac24645Cb25DcdB9759E89628B", + "operatorStateRetriever": "0x38a45de56c29a3929Bb68aFD51d4B28F158d2900", + "registryCoordinator": "0x5EA37f0FdF065c047cdC0a5Ee7b3b99aC16C2B4a", + "registryCoordinatorImplementation": "0xE3Cef87B26f1A4CA37aF548e058f660F22Ef2E76", + "serviceManagerRouter": "0x6aA8AbaC32500eab9b67D4259602535619A6B919", + "stakeRegistry": "0x1763e9cEC4137a2031985A5D813dF5dC36ED71Ff", + "stakeRegistryImplementation": "0xd4a7d36B2c049613BEb5Ade3d92Af82aFc4a12d6" + }, + "chainInfo": { + "chainId": 17000, + "deploymentBlock": 2421617 + }, + "permissions": { + "alignedLayerAggregator": "", + "alignedLayerChurner": "", + "alignedLayerEjector": "", + "alignedLayerOwner": "", + "alignedLayerUpgrader": "", + "pauserRegistry": "0x85Ef7299F8311B25642679edBF02B62FA2212F06" + } + } + ``` + +1. Create 3 EigenLayer keystores: + 1. Aggregator and operator ECDSA: + + ```sh + eigenlayer operator keys import --key-type ecdsa mina_bridge + ``` + + 1. Aggregator and operator BLS: + + ```sh + eigenlayer operator keys import --key-type bls mina_bridge + ``` + + 1. Batcher ECDSA: + + ```sh + eigenlayer operator keys import --key-type ecdsa mina_bridge.batcher + ``` + +1. Create `config-files/holesky/config.yaml` and set it to: + + ```yaml + # Common variables for all the services + # 'production' only prints info and above. 'development' also prints debug + environment: "production" + aligned_layer_deployment_config_file_path: "./contracts/script/output/holesky/alignedlayer_deployment_output.json" + eigen_layer_deployment_config_file_path: "./contracts/script/output/holesky/eigenlayer_deployment_output.json" + eth_rpc_url: "https://holesky.internal.lambdaclass.com" + eth_rpc_url_fallback: "https://holesky.internal.lambdaclass.com" + eth_ws_url: "wss://ws.holesky.internal.lambdaclass.com" + eth_ws_url_fallback: "wss://ws.holesky.internal.lambdaclass.com" + eigen_metrics_ip_port_address: "localhost:9090" + + ## ECDSA Configurations + ecdsa: + private_key_store_path: "/.eigenlayer/operator_keys/mina_bridge.ecdsa.key.json" + private_key_store_password: "" + + ## BLS Configurations + bls: + private_key_store_path: "/.eigenlayer/operator_keys/mina_bridge.bls.key.json" + private_key_store_password: "" + + ## Batcher configurations + batcher: + block_interval: 3 + batch_size_interval: 10 + max_proof_size: 67108864 # 64 MiB + max_batch_size: 268435456 # 256 MiB + eth_ws_reconnects: 99999999999999 + pre_verification_is_enabled: true + + ## Aggregator Configurations + aggregator: + server_ip_port_address: localhost:8090 + bls_public_key_compendium_address: 0x322813Fd9A801c5507c9de605d63CEA4f2CE6c44 + avs_service_manager_address: 0xc3e53F4d16Ae77Db1c982e75a937B9f60FE63690 + enable_metrics: true + metrics_ip_port_address: localhost:9091 + + ## Operator Configurations + operator: + aggregator_rpc_server_ip_port_address: localhost:8090 + address: + earnings_receiver_address: 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 + delegation_approver_address: "0x0000000000000000000000000000000000000000" + staker_opt_out_window_blocks: 0 + metadata_url: "https://yetanotherco.github.io/operator_metadata/metadata.json" + enable_metrics: true + metrics_ip_port_address: localhost:9092 + max_batch_size: 268435456 # 256 MiB + # Operators variables needed for register it in EigenLayer + el_delegation_manager_address: "0xA44151489861Fe9e3055d95adC98FbD462B948e7" + private_key_store_path: /.eigenlayer/operator_keys/mina_bridge.ecdsa.key.json + bls_private_key_store_path: /.eigenlayer/operator_keys/mina_bridge.bls.key.json + signer_type: local_keystore + chain_id: 17000 + ``` + +1. Create `config-files/holesky/config-aggregator.yaml` and set it to: + + ```yaml + # Common variables for all the services + # 'production' only prints info and above. 'development' also prints debug + environment: "production" + aligned_layer_deployment_config_file_path: "./contracts/script/output/holesky/alignedlayer_deployment_output.json" + eigen_layer_deployment_config_file_path: "./contracts/script/output/holesky/eigenlayer_deployment_output.json" + eth_rpc_url: "https://holesky.internal.lambdaclass.com" + eth_rpc_url_fallback: "https://holesky.internal.lambdaclass.com" + eth_ws_url: "wss://ws.holesky.internal.lambdaclass.com" + eth_ws_url_fallback: "wss://ws.holesky.internal.lambdaclass.com" + eigen_metrics_ip_port_address: "localhost:9090" + + ## ECDSA Configurations + ecdsa: + private_key_store_path: "/.eigenlayer/operator_keys/mina_bridge.ecdsa.key.json" + private_key_store_password: "" + + ## BLS Configurations + bls: + private_key_store_path: "/.eigenlayer/operator_keys/mina_bridge.bls.key.json" + private_key_store_password: "" + + ## Aggregator Configurations + aggregator: + server_ip_port_address: localhost:8090 + bls_public_key_compendium_address: 0x322813Fd9A801c5507c9de605d63CEA4f2CE6c44 + avs_service_manager_address: 0xc3e53F4d16Ae77Db1c982e75a937B9f60FE63690 + enable_metrics: true + metrics_ip_port_address: localhost:9091 + ``` + +1. Create `config-files/holesky/config-batcher.yaml` and set it to: + + ```yaml + # Common variables for all the services + # 'production' only prints info and above. 'development' also prints debug + environment: "production" + aligned_layer_deployment_config_file_path: "./contracts/script/output/holesky/alignedlayer_deployment_output.json" + eigen_layer_deployment_config_file_path: "./contracts/script/output/holesky/eigenlayer_deployment_output.json" + eth_rpc_url: "https://holesky.internal.lambdaclass.com" + eth_rpc_url_fallback: "https://holesky.internal.lambdaclass.com" + eth_ws_url: "wss://ws.holesky.internal.lambdaclass.com" + eth_ws_url_fallback: "wss://ws.holesky.internal.lambdaclass.com" + eigen_metrics_ip_port_address: "localhost:9090" + + ## ECDSA Configurations + ecdsa: + private_key_store_path: "/.eigenlayer/operator_keys/mina_bridge.batcher.ecdsa.key.json" + private_key_store_password: "" + + ## Batcher configurations + batcher: + block_interval: 3 + batch_size_interval: 10 + max_proof_size: 67108864 # 64 MiB + max_batch_size: 268435456 # 256 MiB + eth_ws_reconnects: 99999999999999 + pre_verification_is_enabled: true + non_paying: + address: + replacement_private_key: + ``` + +1. Start the aggregator: + + ```sh + make aggregator_start AGG_CONFIG_FILE=config-files/holesky/config-aggregator.yaml + ``` + +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= + ``` + +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": "", + "alignedLayerServiceManager": "0x4d879A997f422FeB8AC2f3d9Dcc749e9d8d0E4a4" + }, + "amounts": { + "gasForAggregator": "300000", + "gasPerProof": "21000" + }, + "permissions": { + "owner": "" + }, + "eip712": { + "noncedVerificationDataTypeHash": "41817b5c5b0c3dcda70ccb43ba175fdcd7e586f9e0484422a2c6bba678fdf4a3" + } + } + ``` + +1. Deploy Batcher payment contract: + + ```sh + make deploy_batcher_payment_service + ``` + + `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 --rpc-url https://holesky.internal.lambdaclass.com --private-key --value 1ether + ``` + +1. Deposit to batcher in the Aligned Service Manager Contract: + + ```sh + cast send 0x4d879A997f422FeB8AC2f3d9Dcc749e9d8d0E4a4 --rpc-url https://holesky.internal.lambdaclass.com --private-key --value 1ether "depositToBatcher(address)" + ``` + +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 + ``` + +#### 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= + ETH_RPC_URL= + PROOF_GENERATOR_ADDR=0x66f9664f97F2b50F62D13eA064982f936dE76657 + PRIVATE_KEY= + ALIGNED_SM_HOLESKY_ETH_ADDR=0x4d879A997f422FeB8AC2f3d9Dcc749e9d8d0E4a4 + ``` ### Bridge a Mina account @@ -46,6 +363,8 @@ Because the Bridge uses for now a forked version of Aligned, you may need to set ```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): @@ -71,16 +390,19 @@ For running the example you need to: 1. [Setup Aligned Devnet locally](https://github.com/yetanotherco/aligned_layer/blob/main/docs/guides/3_setup_aligned.md#booting-devnet-with-default-configs) 1. Deploy the bridge smart contracts by executing + ```sh make deploy_contract ``` 1. Deploy the SudokuValidity smart contract by executing + ```sh make deploy_example_contract ``` 1. Install `zkapp-cli`: + ```sh npm install -g zkapp-cli ``` @@ -90,9 +412,11 @@ For running the example you need to: 1. After deployment, set the `zkappAddress` field on `example/mina_zkapp/config.json` 1. Run the example by executing from the root folder: + ```sh make execute_example ``` + this will upload a new Sudoku, submit a solution to it and run the example Rust app that will bridge the new state of the zkApp and update the SudokuValidty smart contract on Ethereum. The zkApp will wait until both Mina transactions are included in a block, so this may take a while. Below is a diagram explaining the execution flow: @@ -100,56 +424,57 @@ For running the example you need to: ![Example diagram](/img/example_diagram.png) ## Table of Contents + - [About](#about) - [Usage](#usage) - [Example use case](#example-use-case) - [Table of Contents](#table-of-contents) - [Specification](#specification) - * [core](#core) - + [mina](#mina) - + [aligned](#aligned) - + [eth](#eth) - * [Mina Proof of State](#mina-proof-of-state) - + [Definition](#definition) - + [Serialization](#serialization) - + [Aligned’s Mina Proof of State verifier](#aligneds-mina-proof-of-state-verifier) - + [Consensus checking](#consensus-checking) - + [Transition frontier](#transition-frontier) - + [Pickles verification](#pickles-verification) - * [Mina Proof of Account](#mina-proof-of-account) - + [Definition](#definition-1) - + [Serialization](#serialization-1) - + [Aligned’s Proof of Account verification](#aligneds-proof-of-account-verifier) - * [Smart contract](#smart-contract) - + [Gas cost](#gas-cost) - * [Mina Account Validation contract](#mina-account-validation-contract) - + [Gas cost](#gas-cost-1) + - [core](#core) + - [mina](#mina) + - [aligned](#aligned) + - [eth](#eth) + - [Mina Proof of State](#mina-proof-of-state) + - [Definition](#definition) + - [Serialization](#serialization) + - [Aligned’s Mina Proof of State verifier](#aligneds-mina-proof-of-state-verifier) + - [Consensus checking](#consensus-checking) + - [Transition frontier](#transition-frontier) + - [Pickles verification](#pickles-verification) + - [Mina Proof of Account](#mina-proof-of-account) + - [Definition](#definition-1) + - [Serialization](#serialization-1) + - [Aligned’s Proof of Account verification](#aligneds-proof-of-account-verifier) + - [Smart contract](#smart-contract) + - [Gas cost](#gas-cost) + - [Mina Account Validation contract](#mina-account-validation-contract) + - [Gas cost](#gas-cost-1) - [Kimchi proving system](#kimchi-proving-system) - * [Proof Construction & Verification](#proof-construction---verification) - + [Secuence diagram linked to ``proof-systems/kimchi/src/verifier.rs``](#secuence-diagram-linked-to---proof-systems-kimchi-src-verifierrs--) - * [Pickles - Mina’s inductive zk-SNARK composition system](#pickles---mina-s-inductive-zk-snark-composition-system) - + [Accumulator](#accumulator) - + [Analysis of the Induction (recursion) method applied in Pickles](#analysis-of-the-induction--recursion--method-applied-in-pickles) - + [Pickles Technical Diagrams](#pickles-technical-diagrams) - * [Consensus](#consensus) - + [Chain selection rules](#chain-selection-rules) + - [Proof Construction & Verification](#proof-construction---verification) + - [Secuence diagram linked to ``proof-systems/kimchi/src/verifier.rs``](#secuence-diagram-linked-to---proof-systems-kimchi-src-verifierrs--) + - [Pickles - Mina’s inductive zk-SNARK composition system](#pickles---mina-s-inductive-zk-snark-composition-system) + - [Accumulator](#accumulator) + - [Analysis of the Induction (recursion) method applied in Pickles](#analysis-of-the-induction--recursion--method-applied-in-pickles) + - [Pickles Technical Diagrams](#pickles-technical-diagrams) + - [Consensus](#consensus) + - [Chain selection rules](#chain-selection-rules) - [Short-range fork rule](#short-range-fork-rule) - [Long-range fork rule](#long-range-fork-rule) - + [Decentralized checkpointing](#decentralized-checkpointing) - + [Short-range fork check](#short-range-fork-check) - + [Sliding window density](#sliding-window-density) + - [Decentralized checkpointing](#decentralized-checkpointing) + - [Short-range fork check](#short-range-fork-check) + - [Sliding window density](#sliding-window-density) - [Nomenclature](#nomenclature) - [Window structure](#window-structure) - [Minimum window density](#minimum-window-density) - [Ring-shift](#ring-shift) - [Projected window](#projected-window) - * [Genesis window](#genesis-window) - * [Relative minimum window density](#relative-minimum-window-density) - * [Protocol](#protocol) - + [Initialize consensus](#initialize-consensus) - + [Select chain](#select-chain) - + [Maintaining the k-th predecessor epoch ledger](#maintaining-the-k-th-predecessor-epoch-ledger) - + [Getting the tip](#getting-the-tip) + - [Genesis window](#genesis-window) + - [Relative minimum window density](#relative-minimum-window-density) + - [Protocol](#protocol) + - [Initialize consensus](#initialize-consensus) + - [Select chain](#select-chain) + - [Maintaining the k-th predecessor epoch ledger](#maintaining-the-k-th-predecessor-epoch-ledger) + - [Getting the tip](#getting-the-tip) # Specification @@ -249,7 +574,6 @@ The first step of the verifier is to check that the public inputs correspond to - that the chain ledger hashes are the hashes of the ledgers (stored in the states) in the proof - that the states form a chain (by hashing together the **state hash** of a state `n` and the **state body hash** of state `n+1`, we retrieve the **state hash** of the state `n+1`, so the states form a chain if we can hash from the root all the way until arriving to the tip state hash. - ### Consensus checking The second step of the verifier is to execute consensus checks, specific to the [Ouroboros Samasika consensus mechanism](https://github.com/MinaProtocol/mina/blob/develop/docs/specs/consensus/README.md) that the Mina Protocol uses. The checks are comparisons of state data between the candidate tip state and the bridge tip state. @@ -279,7 +603,7 @@ After validating the candidate tip state, because in a previous step we verified After a Mina Proof of State was verified, it’s possible to verify a Proof of Account of some Mina account in the verified state. -Verifying that some account and its state is valid in a bridged Mina state is one of the basic components of a Mina to Ethereum bridge, as it not only allows to validate account data but also the state of a [zkApp](https://docs.minaprotocol.com/zkapps/writing-a-zkapp) tracked by this account (see [zkApp Account](https://docs.minaprotocol.com/glossary#zkapp-account)), which leverages zk-SNARKs to verify (optionally private) off-chain computation on the Mina blockchain. +Verifying that some account and its state is valid in a bridged Mina state is one of the basic components of a Mina to Ethereum bridge, as it not only allows to validate account data but also the state of a [zkApp](https://docs.minaprotocol.com/zkapps/writing-a-zkapp) tracked by this account (see [zkApp Account](https://docs.minaprotocol.com/glossary#zkapp-account)), which leverages zk-SNARKs to verify (optionally private) off-chain computation on the Mina blockchain. Account verification (paired with state verification) essentially allows to verify off-chain computation on Ethereum, after it has been validated by Mina. From 3799ffeba938c8d1075e78ce0f46d478f8b9c0be Mon Sep 17 00:00:00 2001 From: gabrielbosio Date: Mon, 30 Sep 2024 18:35:08 -0300 Subject: [PATCH 04/12] Fix Mainnet image link --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 9f52ebbb..a7cf93b7 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ The bridge leverages [Aligned Layer](https://github.com/yetanotherco/aligned_lay ### Mina node - If you want the Bridge to use Mina Devnet then use a node that runs a Devnet instance corresponding to the commit `599a76d` [of the Mina repo](https://github.com/MinaProtocol/mina/tree/599a76dd47be99183d2102d9eb93eda679dd46ec) or a newer one (e.g.: [this Docker image](https://console.cloud.google.com/gcr/images/o1labs-192920/GLOBAL/mina-daemon:3.0.1-compatible-599a76d-bullseye-devnet/details)). See [how to connect to Mina Devnet](https://docs.minaprotocol.com/node-operators/block-producer-node/connecting-to-devnet#docker) if you want to run an instance yourself. -- If you want the Bridge to use Mina Mainnet use a node that runs a Mainnet instance corresponding to the commit `65c84ad` [of the Mina repo](https://github.com/MinaProtocol/mina/tree/65c84adacd55272160d9f77c31063d94a942afb6) or a newer one (e.g.: [this Docker image](https://console.cloud.google.com/gcr/images/o1labs-192920/GLOBAL/mina-daemon:65c84ada-bullseye-mainnet/details?tab=info)). See [how to connect to Mina Mainnet](https://docs.minaprotocol.com/node-operators/block-producer-node/connecting-to-the-network#docker) if you want to run an instance yourself. +- If you want the Bridge to use Mina Mainnet use a node that runs a Mainnet instance corresponding to the commit `65c84ad` [of the Mina repo](https://github.com/MinaProtocol/mina/tree/65c84adacd55272160d9f77c31063d94a942afb6) or a newer one (e.g.: [this Docker image](http://gcr.io/o1labs-192920/mina-daemon:3.0.1-beta1-sai-query-snarked-ledger-c439ce5-bullseye-mainnet)). See [how to connect to Mina Mainnet](https://docs.minaprotocol.com/node-operators/block-producer-node/connecting-to-the-network#docker) if you want to run an instance yourself. You can bridge Mina accounts to Ethereum Devnet or Ethereum Testnet. The following subsections describe how to config the Bridge for each network. From 40040d8b1684d932705fa1d64962cde8246d927f Mon Sep 17 00:00:00 2001 From: gabrielbosio Date: Tue, 1 Oct 2024 11:29:53 -0300 Subject: [PATCH 05/12] Fix Aligned fork branch --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a7cf93b7..fae56a5c 100644 --- a/README.md +++ b/README.md @@ -38,7 +38,7 @@ Because the Bridge uses for now a forked version of Aligned, you may need to set 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`). -1. Clone the [forked Aligned repo](https://github.com/lambdaclass/aligned_layer). Checkout to the `aligned` branch. +1. Clone the [forked Aligned repo](https://github.com/lambdaclass/aligned_layer). Checkout to the `mina` branch. 1. Run: ```sh From 81f0583ca493ecb8386fdabf7a3596d12d2e18a0 Mon Sep 17 00:00:00 2001 From: gabrielbosio Date: Tue, 1 Oct 2024 13:03:17 -0300 Subject: [PATCH 06/12] Add staking step in Testnet setup --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index fae56a5c..26885907 100644 --- a/README.md +++ b/README.md @@ -286,6 +286,8 @@ You will need two Ethereum accounts: One to fund the Aligned operator (`operator make operator_whitelist OPERATOR_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 From 85857cfcb8ca930e9f8e86f98623a8029cf4cbd4 Mon Sep 17 00:00:00 2001 From: gabrielbosio Date: Wed, 2 Oct 2024 11:16:04 -0300 Subject: [PATCH 07/12] Complete Aligned Testnet setup --- README.md | 92 +++++++++++++++++++++---------------------------------- 1 file changed, 35 insertions(+), 57 deletions(-) diff --git a/README.md b/README.md index 26885907..559028f3 100644 --- a/README.md +++ b/README.md @@ -90,40 +90,14 @@ 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. Set `contracts/script/output/holesky/alignedlayer_deployment_output.json` to: +1. Deploy Aligned contracts: - ```json - { - "addresses": { - "alignedLayerProxyAdmin": "0x715e3F1c9F58832a606cf85C328250af32d20E93", - "alignedLayerServiceManager": "0x4d879A997f422FeB8AC2f3d9Dcc749e9d8d0E4a4", - "alignedLayerServiceManagerImplementation": "0x63257B1e36B78cb8be08A5A42317B93D7127D56b", - "blsApkRegistry": "0xf1e92D804230Cdb88D95A79e8D6E5B4e3182E632", - "blsApkRegistryImplementation": "0x6d3Bf64adAd29949766417543eF2eb8670964426", - "indexRegistry": "0xd2062Fb412923bE70F4d51E361Fe17408eE4b1b0", - "indexRegistryImplementation": "0x5Ee29B5d21CDA0ac24645Cb25DcdB9759E89628B", - "operatorStateRetriever": "0x38a45de56c29a3929Bb68aFD51d4B28F158d2900", - "registryCoordinator": "0x5EA37f0FdF065c047cdC0a5Ee7b3b99aC16C2B4a", - "registryCoordinatorImplementation": "0xE3Cef87B26f1A4CA37aF548e058f660F22Ef2E76", - "serviceManagerRouter": "0x6aA8AbaC32500eab9b67D4259602535619A6B919", - "stakeRegistry": "0x1763e9cEC4137a2031985A5D813dF5dC36ED71Ff", - "stakeRegistryImplementation": "0xd4a7d36B2c049613BEb5Ade3d92Af82aFc4a12d6" - }, - "chainInfo": { - "chainId": 17000, - "deploymentBlock": 2421617 - }, - "permissions": { - "alignedLayerAggregator": "", - "alignedLayerChurner": "", - "alignedLayerEjector": "", - "alignedLayerOwner": "", - "alignedLayerUpgrader": "", - "pauserRegistry": "0x85Ef7299F8311B25642679edBF02B62FA2212F06" - } - } + ```sh + make deploy_aligned_contracts ``` + This will create `contracts/script/output/holesky/alignedlayer_deployment_output.json`. + 1. Create 3 EigenLayer keystores: 1. Aggregator and operator ECDSA: @@ -151,21 +125,21 @@ You will need two Ethereum accounts: One to fund the Aligned operator (`operator environment: "production" aligned_layer_deployment_config_file_path: "./contracts/script/output/holesky/alignedlayer_deployment_output.json" eigen_layer_deployment_config_file_path: "./contracts/script/output/holesky/eigenlayer_deployment_output.json" - eth_rpc_url: "https://holesky.internal.lambdaclass.com" - eth_rpc_url_fallback: "https://holesky.internal.lambdaclass.com" - eth_ws_url: "wss://ws.holesky.internal.lambdaclass.com" - eth_ws_url_fallback: "wss://ws.holesky.internal.lambdaclass.com" + eth_rpc_url: "" + eth_rpc_url_fallback: "" + eth_ws_url: "" + eth_ws_url_fallback: "" eigen_metrics_ip_port_address: "localhost:9090" ## ECDSA Configurations ecdsa: private_key_store_path: "/.eigenlayer/operator_keys/mina_bridge.ecdsa.key.json" - private_key_store_password: "" + private_key_store_password: ## BLS Configurations bls: private_key_store_path: "/.eigenlayer/operator_keys/mina_bridge.bls.key.json" - private_key_store_password: "" + private_key_store_password: ## Batcher configurations batcher: @@ -211,21 +185,21 @@ You will need two Ethereum accounts: One to fund the Aligned operator (`operator environment: "production" aligned_layer_deployment_config_file_path: "./contracts/script/output/holesky/alignedlayer_deployment_output.json" eigen_layer_deployment_config_file_path: "./contracts/script/output/holesky/eigenlayer_deployment_output.json" - eth_rpc_url: "https://holesky.internal.lambdaclass.com" - eth_rpc_url_fallback: "https://holesky.internal.lambdaclass.com" - eth_ws_url: "wss://ws.holesky.internal.lambdaclass.com" - eth_ws_url_fallback: "wss://ws.holesky.internal.lambdaclass.com" + eth_rpc_url: "" + eth_rpc_url_fallback: "" + eth_ws_url: "" + eth_ws_url_fallback: "" eigen_metrics_ip_port_address: "localhost:9090" ## ECDSA Configurations ecdsa: private_key_store_path: "/.eigenlayer/operator_keys/mina_bridge.ecdsa.key.json" - private_key_store_password: "" + private_key_store_password: ## BLS Configurations bls: private_key_store_path: "/.eigenlayer/operator_keys/mina_bridge.bls.key.json" - private_key_store_password: "" + private_key_store_password: ## Aggregator Configurations aggregator: @@ -239,21 +213,19 @@ You will need two Ethereum accounts: One to fund the Aligned operator (`operator 1. Create `config-files/holesky/config-batcher.yaml` and set it to: ```yaml - # Common variables for all the services - # 'production' only prints info and above. 'development' also prints debug environment: "production" aligned_layer_deployment_config_file_path: "./contracts/script/output/holesky/alignedlayer_deployment_output.json" eigen_layer_deployment_config_file_path: "./contracts/script/output/holesky/eigenlayer_deployment_output.json" - eth_rpc_url: "https://holesky.internal.lambdaclass.com" - eth_rpc_url_fallback: "https://holesky.internal.lambdaclass.com" - eth_ws_url: "wss://ws.holesky.internal.lambdaclass.com" - eth_ws_url_fallback: "wss://ws.holesky.internal.lambdaclass.com" + eth_rpc_url: "" + eth_rpc_url_fallback: "" + eth_ws_url: "" + eth_ws_url_fallback: "" eigen_metrics_ip_port_address: "localhost:9090" ## ECDSA Configurations ecdsa: private_key_store_path: "/.eigenlayer/operator_keys/mina_bridge.batcher.ecdsa.key.json" - private_key_store_password: "" + private_key_store_password: ## Batcher configurations batcher: @@ -300,7 +272,7 @@ You will need two Ethereum accounts: One to fund the Aligned operator (`operator { "address": { "batcherWallet": "", - "alignedLayerServiceManager": "0x4d879A997f422FeB8AC2f3d9Dcc749e9d8d0E4a4" + "alignedLayerServiceManager": "" }, "amounts": { "gasForAggregator": "300000", @@ -326,19 +298,25 @@ You will need two Ethereum accounts: One to fund the Aligned operator (`operator 1. Pay the batcher: ```sh - cast send --rpc-url https://holesky.internal.lambdaclass.com --private-key --value 1ether + cast send --rpc-url --private-key --value 1ether ``` 1. Deposit to batcher in the Aligned Service Manager Contract: ```sh - cast send 0x4d879A997f422FeB8AC2f3d9Dcc749e9d8d0E4a4 --rpc-url https://holesky.internal.lambdaclass.com --private-key --value 1ether "depositToBatcher(address)" + cast send --rpc-url --private-key --value 1ether "depositToBatcher(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 + 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 @@ -351,11 +329,11 @@ In the Mina Bridge repo, setup the `.env` file. A template is available in `.env ```sh BATCHER_ADDR="ws://localhost:8080" - BATCHER_ETH_ADDR= + BATCHER_ETH_ADDR= ETH_RPC_URL= PROOF_GENERATOR_ADDR=0x66f9664f97F2b50F62D13eA064982f936dE76657 - PRIVATE_KEY= - ALIGNED_SM_HOLESKY_ETH_ADDR=0x4d879A997f422FeB8AC2f3d9Dcc749e9d8d0E4a4 + PRIVATE_KEY= + ALIGNED_SM_HOLESKY_ETH_ADDR= ``` ### Bridge a Mina account From 2f68a5d9a8a472dd9e6a74399d202b9b785fd680 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Est=C3=A9fano=20Bargas?= Date: Wed, 2 Oct 2024 12:45:30 -0300 Subject: [PATCH 08/12] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 00f9a683..6261c19a 100644 --- a/README.md +++ b/README.md @@ -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)). @@ -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`). From 1a37d7f33bb78e947c44c13bf3a0e3c2256e459b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Est=C3=A9fano=20Bargas?= Date: Wed, 2 Oct 2024 12:46:03 -0300 Subject: [PATCH 09/12] Revert "Update README.md" This reverts commit 2f68a5d9a8a472dd9e6a74399d202b9b785fd680. --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 6261c19a..00f9a683 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ You can bridge Mina accounts to Ethereum Devnet or Ethereum Testnet. The followi #### Ethereum Devnet -1. [Setup Aligned (Devnet) infrastructure locally](https://docs.alignedlayer.com/guides/6_setup_aligned) +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 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)). @@ -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. -##### Setup Aligned Testnet infrastructure locally +##### Aligned Testnet setup 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`). From b6e357e100034445aed990eb3392c818284b26e4 Mon Sep 17 00:00:00 2001 From: gabrielbosio Date: Wed, 2 Oct 2024 15:51:51 -0300 Subject: [PATCH 10/12] Update submit state command --- README.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/README.md b/README.md index 00f9a683..d5f3e71f 100644 --- a/README.md +++ b/README.md @@ -348,9 +348,7 @@ In the Mina Bridge repo, setup the `.env` file. A template is available in `.env 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): - ```sh - make submit_state - ``` + - 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): From ee853ea3353d5cf67890b4a6aa6e2ce0b7a1c2d1 Mon Sep 17 00:00:00 2001 From: gabrielbosio Date: Wed, 2 Oct 2024 15:56:13 -0300 Subject: [PATCH 11/12] Fix Testnet setup ordered list --- README.md | 422 +++++++++++++++++++++++++++--------------------------- 1 file changed, 211 insertions(+), 211 deletions(-) diff --git a/README.md b/README.md index d5f3e71f..26e4114c 100644 --- a/README.md +++ b/README.md @@ -41,283 +41,283 @@ You will need two Ethereum accounts: One to fund the Aligned operator (`operator 1. Clone the [forked Aligned repo](https://github.com/lambdaclass/aligned_layer). Checkout to the `mina` branch. 1. Run: - ```sh - make deps go_deps - ``` + ```sh + make deps go_deps + ``` 1. Copy the EigenLayer Holešky deployment config file into Aligned: - ```sh - cp contracts/lib/eigenlayer-middleware/lib/eigenlayer-contracts/script/configs/holesky/Holesky_current_deployment.config.json contracts/script/output/holesky - ``` + ```sh + cp contracts/lib/eigenlayer-middleware/lib/eigenlayer-contracts/script/configs/holesky/Holesky_current_deployment.config.json contracts/script/output/holesky + ``` 1. Set `contracts/script/deploy/config/holesky/aligned.holesky.config.json` to: - ```json - { - "chainInfo": { - "chainId": 17000 - }, - "permissions": { - "owner": "", - "aggregator": "", - "upgrader": "", - "churner": "", - "ejector": "", - "deployer": "", - "initalPausedStatus": 0 - }, - "minimumStakes": [ - 1 - ], - "strategyWeights": [ - [ + ```json + { + "chainInfo": { + "chainId": 17000 + }, + "permissions": { + "owner": "", + "aggregator": "", + "upgrader": "", + "churner": "", + "ejector": "", + "deployer": "", + "initalPausedStatus": 0 + }, + "minimumStakes": [ + 1 + ], + "strategyWeights": [ + [ + { + "0_strategy": "0x80528D6e9A2BAbFc766965E0E26d5aB08D9CFaF9", + "1_multiplier": 1e+18 + } + ] + ], + "operatorSetParams": [ { - "0_strategy": "0x80528D6e9A2BAbFc766965E0E26d5aB08D9CFaF9", - "1_multiplier": 1e+18 + "0_maxOperatorCount": 200, + "1_kickBIPsOfOperatorStake": 11000, + "2_kickBIPsOfTotalStake": 50 } - ] - ], - "operatorSetParams": [ - { - "0_maxOperatorCount": 200, - "1_kickBIPsOfOperatorStake": 11000, - "2_kickBIPsOfTotalStake": 50 - } - ], - "uri": "" - } - ``` + ], + "uri": "" + } + ``` 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 - ``` + ```sh + make deploy_aligned_contracts + ``` - This will create `contracts/script/output/holesky/alignedlayer_deployment_output.json`. + This will create `contracts/script/output/holesky/alignedlayer_deployment_output.json`. 1. Create 3 EigenLayer keystores: 1. Aggregator and operator ECDSA: - ```sh - eigenlayer operator keys import --key-type ecdsa mina_bridge - ``` + ```sh + eigenlayer operator keys import --key-type ecdsa mina_bridge + ``` 1. Aggregator and operator BLS: - ```sh - eigenlayer operator keys import --key-type bls mina_bridge - ``` + ```sh + eigenlayer operator keys import --key-type bls mina_bridge + ``` 1. Batcher ECDSA: - ```sh - eigenlayer operator keys import --key-type ecdsa mina_bridge.batcher - ``` + ```sh + eigenlayer operator keys import --key-type ecdsa mina_bridge.batcher + ``` 1. Create `config-files/holesky/config.yaml` and set it to: - ```yaml - # Common variables for all the services - # 'production' only prints info and above. 'development' also prints debug - environment: "production" - aligned_layer_deployment_config_file_path: "./contracts/script/output/holesky/alignedlayer_deployment_output.json" - eigen_layer_deployment_config_file_path: "./contracts/script/output/holesky/eigenlayer_deployment_output.json" - eth_rpc_url: "" - eth_rpc_url_fallback: "" - eth_ws_url: "" - eth_ws_url_fallback: "" - eigen_metrics_ip_port_address: "localhost:9090" - - ## ECDSA Configurations - ecdsa: - private_key_store_path: "/.eigenlayer/operator_keys/mina_bridge.ecdsa.key.json" - private_key_store_password: - - ## BLS Configurations - bls: - private_key_store_path: "/.eigenlayer/operator_keys/mina_bridge.bls.key.json" - private_key_store_password: - - ## Batcher configurations - batcher: - block_interval: 3 - batch_size_interval: 10 - max_proof_size: 67108864 # 64 MiB - max_batch_size: 268435456 # 256 MiB - eth_ws_reconnects: 99999999999999 - pre_verification_is_enabled: true - - ## Aggregator Configurations - aggregator: - server_ip_port_address: localhost:8090 - bls_public_key_compendium_address: 0x322813Fd9A801c5507c9de605d63CEA4f2CE6c44 - avs_service_manager_address: 0xc3e53F4d16Ae77Db1c982e75a937B9f60FE63690 - enable_metrics: true - metrics_ip_port_address: localhost:9091 - - ## Operator Configurations - operator: - aggregator_rpc_server_ip_port_address: localhost:8090 - address: - earnings_receiver_address: 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 - delegation_approver_address: "0x0000000000000000000000000000000000000000" - staker_opt_out_window_blocks: 0 - metadata_url: "https://yetanotherco.github.io/operator_metadata/metadata.json" - enable_metrics: true - metrics_ip_port_address: localhost:9092 - max_batch_size: 268435456 # 256 MiB - # Operators variables needed for register it in EigenLayer - el_delegation_manager_address: "0xA44151489861Fe9e3055d95adC98FbD462B948e7" - private_key_store_path: /.eigenlayer/operator_keys/mina_bridge.ecdsa.key.json - bls_private_key_store_path: /.eigenlayer/operator_keys/mina_bridge.bls.key.json - signer_type: local_keystore - chain_id: 17000 - ``` + ```yaml + # Common variables for all the services + # 'production' only prints info and above. 'development' also prints debug + environment: "production" + aligned_layer_deployment_config_file_path: "./contracts/script/output/holesky/alignedlayer_deployment_output.json" + eigen_layer_deployment_config_file_path: "./contracts/script/output/holesky/eigenlayer_deployment_output.json" + eth_rpc_url: "" + eth_rpc_url_fallback: "" + eth_ws_url: "" + eth_ws_url_fallback: "" + eigen_metrics_ip_port_address: "localhost:9090" + + ## ECDSA Configurations + ecdsa: + private_key_store_path: "/.eigenlayer/operator_keys/mina_bridge.ecdsa.key.json" + private_key_store_password: + + ## BLS Configurations + bls: + private_key_store_path: "/.eigenlayer/operator_keys/mina_bridge.bls.key.json" + private_key_store_password: + + ## Batcher configurations + batcher: + block_interval: 3 + batch_size_interval: 10 + max_proof_size: 67108864 # 64 MiB + max_batch_size: 268435456 # 256 MiB + eth_ws_reconnects: 99999999999999 + pre_verification_is_enabled: true + + ## Aggregator Configurations + aggregator: + server_ip_port_address: localhost:8090 + bls_public_key_compendium_address: 0x322813Fd9A801c5507c9de605d63CEA4f2CE6c44 + avs_service_manager_address: 0xc3e53F4d16Ae77Db1c982e75a937B9f60FE63690 + enable_metrics: true + metrics_ip_port_address: localhost:9091 + + ## Operator Configurations + operator: + aggregator_rpc_server_ip_port_address: localhost:8090 + address: + earnings_receiver_address: 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 + delegation_approver_address: "0x0000000000000000000000000000000000000000" + staker_opt_out_window_blocks: 0 + metadata_url: "https://yetanotherco.github.io/operator_metadata/metadata.json" + enable_metrics: true + metrics_ip_port_address: localhost:9092 + max_batch_size: 268435456 # 256 MiB + # Operators variables needed for register it in EigenLayer + el_delegation_manager_address: "0xA44151489861Fe9e3055d95adC98FbD462B948e7" + private_key_store_path: /.eigenlayer/operator_keys/mina_bridge.ecdsa.key.json + bls_private_key_store_path: /.eigenlayer/operator_keys/mina_bridge.bls.key.json + signer_type: local_keystore + chain_id: 17000 + ``` 1. Create `config-files/holesky/config-aggregator.yaml` and set it to: - ```yaml - # Common variables for all the services - # 'production' only prints info and above. 'development' also prints debug - environment: "production" - aligned_layer_deployment_config_file_path: "./contracts/script/output/holesky/alignedlayer_deployment_output.json" - eigen_layer_deployment_config_file_path: "./contracts/script/output/holesky/eigenlayer_deployment_output.json" - eth_rpc_url: "" - eth_rpc_url_fallback: "" - eth_ws_url: "" - eth_ws_url_fallback: "" - eigen_metrics_ip_port_address: "localhost:9090" - - ## ECDSA Configurations - ecdsa: - private_key_store_path: "/.eigenlayer/operator_keys/mina_bridge.ecdsa.key.json" - private_key_store_password: - - ## BLS Configurations - bls: - private_key_store_path: "/.eigenlayer/operator_keys/mina_bridge.bls.key.json" - private_key_store_password: - - ## Aggregator Configurations - aggregator: - server_ip_port_address: localhost:8090 - bls_public_key_compendium_address: 0x322813Fd9A801c5507c9de605d63CEA4f2CE6c44 - avs_service_manager_address: 0xc3e53F4d16Ae77Db1c982e75a937B9f60FE63690 - enable_metrics: true - metrics_ip_port_address: localhost:9091 - ``` + ```yaml + # Common variables for all the services + # 'production' only prints info and above. 'development' also prints debug + environment: "production" + aligned_layer_deployment_config_file_path: "./contracts/script/output/holesky/alignedlayer_deployment_output.json" + eigen_layer_deployment_config_file_path: "./contracts/script/output/holesky/eigenlayer_deployment_output.json" + eth_rpc_url: "" + eth_rpc_url_fallback: "" + eth_ws_url: "" + eth_ws_url_fallback: "" + eigen_metrics_ip_port_address: "localhost:9090" + + ## ECDSA Configurations + ecdsa: + private_key_store_path: "/.eigenlayer/operator_keys/mina_bridge.ecdsa.key.json" + private_key_store_password: + + ## BLS Configurations + bls: + private_key_store_path: "/.eigenlayer/operator_keys/mina_bridge.bls.key.json" + private_key_store_password: + + ## Aggregator Configurations + aggregator: + server_ip_port_address: localhost:8090 + bls_public_key_compendium_address: 0x322813Fd9A801c5507c9de605d63CEA4f2CE6c44 + avs_service_manager_address: 0xc3e53F4d16Ae77Db1c982e75a937B9f60FE63690 + enable_metrics: true + metrics_ip_port_address: localhost:9091 + ``` 1. Create `config-files/holesky/config-batcher.yaml` and set it to: - ```yaml - environment: "production" - aligned_layer_deployment_config_file_path: "./contracts/script/output/holesky/alignedlayer_deployment_output.json" - eigen_layer_deployment_config_file_path: "./contracts/script/output/holesky/eigenlayer_deployment_output.json" - eth_rpc_url: "" - eth_rpc_url_fallback: "" - eth_ws_url: "" - eth_ws_url_fallback: "" - eigen_metrics_ip_port_address: "localhost:9090" - - ## ECDSA Configurations - ecdsa: - private_key_store_path: "/.eigenlayer/operator_keys/mina_bridge.batcher.ecdsa.key.json" - private_key_store_password: - - ## Batcher configurations - batcher: - block_interval: 3 - batch_size_interval: 10 - max_proof_size: 67108864 # 64 MiB - max_batch_size: 268435456 # 256 MiB - eth_ws_reconnects: 99999999999999 - pre_verification_is_enabled: true - non_paying: - address: - replacement_private_key: - ``` + ```yaml + environment: "production" + aligned_layer_deployment_config_file_path: "./contracts/script/output/holesky/alignedlayer_deployment_output.json" + eigen_layer_deployment_config_file_path: "./contracts/script/output/holesky/eigenlayer_deployment_output.json" + eth_rpc_url: "" + eth_rpc_url_fallback: "" + eth_ws_url: "" + eth_ws_url_fallback: "" + eigen_metrics_ip_port_address: "localhost:9090" + + ## ECDSA Configurations + ecdsa: + private_key_store_path: "/.eigenlayer/operator_keys/mina_bridge.batcher.ecdsa.key.json" + private_key_store_password: + + ## Batcher configurations + batcher: + block_interval: 3 + batch_size_interval: 10 + max_proof_size: 67108864 # 64 MiB + max_batch_size: 268435456 # 256 MiB + eth_ws_reconnects: 99999999999999 + pre_verification_is_enabled: true + non_paying: + address: + replacement_private_key: + ``` 1. Start the aggregator: - ```sh - make aggregator_start AGG_CONFIG_FILE=config-files/holesky/config-aggregator.yaml - ``` + ```sh + make aggregator_start AGG_CONFIG_FILE=config-files/holesky/config-aggregator.yaml + ``` 1. Open a new terminal and register the operator: - ```sh - eigenlayer operator register config-files/holesky/config.yaml - ``` + ```sh + eigenlayer operator register config-files/holesky/config.yaml + ``` 1. Whitelist the registered operator: - ```sh - make operator_whitelist OPERATOR_ADDRESS= - ``` + ```sh + make operator_whitelist OPERATOR_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 - ``` + ```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": "", - "alignedLayerServiceManager": "" - }, - "amounts": { - "gasForAggregator": "300000", - "gasPerProof": "21000" - }, - "permissions": { - "owner": "" - }, - "eip712": { - "noncedVerificationDataTypeHash": "41817b5c5b0c3dcda70ccb43ba175fdcd7e586f9e0484422a2c6bba678fdf4a3" + ```json + { + "address": { + "batcherWallet": "", + "alignedLayerServiceManager": "" + }, + "amounts": { + "gasForAggregator": "300000", + "gasPerProof": "21000" + }, + "permissions": { + "owner": "" + }, + "eip712": { + "noncedVerificationDataTypeHash": "41817b5c5b0c3dcda70ccb43ba175fdcd7e586f9e0484422a2c6bba678fdf4a3" + } } - } - ``` + ``` 1. Deploy Batcher payment contract: - ```sh - make deploy_batcher_payment_service - ``` + ```sh + make deploy_batcher_payment_service + ``` - `contracts/script/output/holesky/alignedlayer_deployment_output.json` will have two new fields: `addresses.batcherPaymentService` and `addresses.batcherPaymentServiceImplementation`. + `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 --rpc-url --private-key --value 1ether - ``` + ```sh + cast send --rpc-url --private-key --value 1ether + ``` 1. Deposit to batcher in the Aligned Service Manager Contract: - ```sh - cast send --rpc-url --private-key --value 1ether "depositToBatcher(address)" - ``` + ```sh + cast send --rpc-url --private-key --value 1ether "depositToBatcher(address)" + ``` 1. Setup local storage for the batcher: - ```sh - make run_storage - ``` + ```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 - ``` + ```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 From b8fd7963010252759286d41254f09f882bf59b08 Mon Sep 17 00:00:00 2001 From: gabrielbosio Date: Wed, 2 Oct 2024 15:57:05 -0300 Subject: [PATCH 12/12] Update batcher deployment result paragraph --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 26e4114c..efd75b0a 100644 --- a/README.md +++ b/README.md @@ -293,7 +293,7 @@ You will need two Ethereum accounts: One to fund the Aligned operator (`operator make deploy_batcher_payment_service ``` - `contracts/script/output/holesky/alignedlayer_deployment_output.json` will have two new fields: `addresses.batcherPaymentService` and `addresses.batcherPaymentServiceImplementation`. + The file `contracts/script/output/holesky/alignedlayer_deployment_output.json` will have two new fields: `addresses.batcherPaymentService` and `addresses.batcherPaymentServiceImplementation`. 1. Pay the batcher: