diff --git a/Makefile b/Makefile index 4b47649a20..5f637052c4 100644 --- a/Makefile +++ b/Makefile @@ -7,7 +7,7 @@ CONFIG_FILE?=config-files/config.yaml export OPERATOR_ADDRESS ?= $(shell yq -r '.operator.address' $(CONFIG_FILE)) AGG_CONFIG_FILE?=config-files/config-aggregator.yaml -OPERATOR_VERSION=v0.15.0 +OPERATOR_VERSION=v0.15.1 EIGEN_SDK_GO_VERSION_TESTNET=v0.2.0-beta.1 EIGEN_SDK_GO_VERSION_MAINNET=v0.1.13 @@ -20,8 +20,8 @@ ifeq ($(OS),Darwin) endif ifeq ($(OS),Linux) - export LD_LIBRARY_PATH+=$(CURDIR)/operator/risc_zero/lib - OPERATOR_FFIS=$(CURDIR)/operator/risc_zero/lib + export LD_LIBRARY_PATH+=$(CURDIR)/operator/risc_zero/lib:$(CURDIR)/operator/sp1/lib + OPERATOR_FFIS=$(CURDIR)/operator/risc_zero/lib:$(CURDIR)/operator/sp1/lib endif ifeq ($(OS),Linux) diff --git a/batcher/Cargo.lock b/batcher/Cargo.lock index 0d7afdb2df..71f9d4c566 100644 --- a/batcher/Cargo.lock +++ b/batcher/Cargo.lock @@ -72,7 +72,7 @@ dependencies = [ [[package]] name = "aligned" -version = "0.15.0" +version = "0.15.1" dependencies = [ "aligned-sdk", "clap", diff --git a/batcher/aligned-batcher/src/main.rs b/batcher/aligned-batcher/src/main.rs index 089d5c0abf..4cdcad3566 100644 --- a/batcher/aligned-batcher/src/main.rs +++ b/batcher/aligned-batcher/src/main.rs @@ -10,10 +10,10 @@ use aligned_batcher::{types::errors::BatcherError, Batcher}; /// Batcher main flow: /// There are two main tasks spawned: `listen_connections` and `listen_new_blocks` /// * `listen_connections` waits for websocket connections and adds verification data sent by clients -/// to the batch. +/// to the batch. /// * `listen_new_blocks` waits for new blocks and when one is received, checks if the conditions are met -/// the current batch to be submitted. In other words, this task is the one that controls when a batch -/// is to be posted. +/// the current batch to be submitted. In other words, this task is the one that controls when a batch +/// is to be posted. #[derive(Parser)] #[command(name = "Aligned Batcher")] #[command(about = "An application with server and client subcommands", long_about = None)] diff --git a/batcher/aligned-batcher/src/types/batch_queue.rs b/batcher/aligned-batcher/src/types/batch_queue.rs index 5c2056eadb..9cf5dcbd87 100644 --- a/batcher/aligned-batcher/src/types/batch_queue.rs +++ b/batcher/aligned-batcher/src/types/batch_queue.rs @@ -152,7 +152,7 @@ pub(crate) fn calculate_batch_size(batch_queue: &BatchQueue) -> Result Result \ --public_input \ --vk \ ---batcher_url wss://batcher.alignedlayer.com \ --proof_generator_addr [proof_generator_addr] \ --batch_inclusion_data_directory_path [batch_inclusion_data_directory_path] \ --keystore_path \ @@ -229,7 +226,6 @@ aligned submit \ --proof ./scripts/test_files/gnark_plonk_bn254_script/plonk.proof \ --public_input ./scripts/test_files/gnark_plonk_bn254_script/plonk_pub_input.pub \ --vk ./scripts/test_files/gnark_plonk_bn254_script/plonk.vk \ ---batcher_url wss://batcher.alignedlayer.com \ --keystore_path ~/.aligned_keystore/keystore0 \ --network holesky \ --rpc_url https://ethereum-holesky-rpc.publicnode.com @@ -242,7 +238,6 @@ aligned submit \ --proof ./scripts/test_files/gnark_plonk_bls12_381_script/plonk.proof \ --public_input ./scripts/test_files/gnark_plonk_bls12_381_script/plonk_pub_input.pub \ --vk ./scripts/test_files/gnark_plonk_bls12_381_script/plonk.vk \ ---batcher_url wss://batcher.alignedlayer.com \ --keystore_path ~/.aligned_keystore/keystore0 \ --network holesky \ --rpc_url https://ethereum-holesky-rpc.publicnode.com @@ -255,7 +250,6 @@ aligned submit \ --proof ./scripts/test_files/gnark_groth16_bn254_infinite_script/infinite_proofs/ineq_1_groth16.proof \ --public_input ./scripts/test_files/gnark_groth16_bn254_infinite_script/infinite_proofs/ineq_1_groth16.pub \ --vk ./scripts/test_files/gnark_groth16_bn254_infinite_script/infinite_proofs/ineq_1_groth16.vk \ ---batcher_url wss://batcher.alignedlayer.com \ --keystore_path ~/.aligned_keystore/keystore0 \ --network holesky \ --rpc_url https://ethereum-holesky-rpc.publicnode.com diff --git a/docs/3_guides/1.2_SDK_api_reference.md b/docs/3_guides/1.2_SDK_api_reference.md index 5f9be2d0a1..c9622305a1 100644 --- a/docs/3_guides/1.2_SDK_api_reference.md +++ b/docs/3_guides/1.2_SDK_api_reference.md @@ -10,7 +10,7 @@ Submits a proof to the batcher to be verified and returns an aligned verificatio pub async fn submit( network: Network, verification_data: &VerificationData, - max_fee; U256, + max_fee: U256, wallet: Wallet, nonce: U256, ) -> Result @@ -54,7 +54,7 @@ Submits multiple proofs to the batcher to be verified and returns an aligned ver pub async fn submit_multiple( network: Network, verification_data: &[VerificationData], - max_fees: &[U256], + max_fee: U256, wallet: Wallet, nonce: U256, ) -> Result, errors::SubmitError> @@ -64,10 +64,9 @@ pub async fn submit_multiple( - `network` - The network on which the proof will be submitted (`devnet | holesky | mainnet`) - `verification_data` - A verification data array. -- `max_fees` - A max fee array. +- `max_fee` - The maximum fee that the submitter is willing to pay for the verification for each proof. - `wallet` - The wallet used to sign the proof. Should be using correct chain id. See `get_chain_id`. - `nonce` - The nonce of the submitter address. See `get_nonce_from_ethereum`. -- `NotAContract(address)` if you are trying to send to an address that is not a contract. This generally occurs if you have misconfigured the `environment` parameter. #### Returns @@ -88,7 +87,6 @@ pub async fn submit_multiple( - `ProofTooLarge` if the proof is too large. - `InsufficientBalance` if the sender balance is not enough or unlocked - `ProofQueueFlushed` if there is an error in the batcher and the proof queue is flushed. -- `NotAContract(address)` if you are trying to send to an address that is not a contract. This generally occurs if you have misconfigured the `environment` parameter. - `GenericError` if the error doesn't match any of the previous ones. ### `submit_and_wait_verification` @@ -235,8 +233,8 @@ pub async fn get_nonce_from_ethereum( #### Arguments - `eth_rpc_url` - The URL of the Ethereum RPC node. -- `submitter_addr` - The address of the proof submitter for which the nonce will be retrieved. -- `network` - The network on which the proof will be submitted +- `submitter_addr` - The user address for which the nonce will be retrieved. +- `network` - The network from which the nonce will be retrieved. #### Returns @@ -244,9 +242,7 @@ pub async fn get_nonce_from_ethereum( #### Errors -- `EthereumProviderError` if there is an error in the connection with the RPC provider. -- `EthereumCallError` if there is an error in the Ethereum call. -- `NotAContract(address)` if you are trying to send to an address that is not a contract. This generally occurs if you have misconfigured the `environment` parameter. +- `EthRpcError` if the batcher has an error in the Ethereum call when retrieving the nonce if not already cached. ### `get_nonce_from_batcher` @@ -263,7 +259,6 @@ pub async fn get_nonce_from_batcher( ``` #### Arguments - - `network` - The network from which the nonce will be retrieved. - `address` - The user address for which the nonce will be retrieved. @@ -277,12 +272,14 @@ pub async fn get_nonce_from_batcher( ### `get_chain_id` -Returns the chain id for a given rpc url. +Returns the chain ID for a given rpc url. -Should be used before submitting proofs to the batcher. Wallet chain id needs to be set with: +Should be used before submitting proofs to the batcher. ```rust -wallet = wallet.with_chain_id(chain_id); +pub async fn get_chain_id( + eth_rpc_url: &str +) -> Result ``` #### Arguments @@ -291,13 +288,19 @@ wallet = wallet.with_chain_id(chain_id); #### Returns -- `Result` - The nonce to use or an error. +- `Result` - The chain ID to use or an error. #### Errors - `EthereumProviderError` if there is an error in the connection with the RPC provider. - `EthereumCallError` if there is an error in the Ethereum call. +Wallet chain ID needs to be set with: + +```rust +wallet = wallet.with_chain_id(chain_id); +``` + ### `estimate_fee` Estimates the fee the user would have to pay for submitting a proof to Aligned. Depending on the @@ -313,7 +316,7 @@ pub async fn estimate_fee( #### Arguments - `eth_rpc_url` - The URL of the Ethereum RPC node. -- `estimate_type` - Enum specifying the type of price estimate: Default, Instant. Custom(usize) +- `fee_estimation_type` - Enum specifying the type of price estimate: Default, Instant. Custom(usize) #### Returns @@ -324,34 +327,34 @@ pub async fn estimate_fee( - `EthereumProviderError` if there is an error in the connection with the RPC provider. - `EthereumCallError` if there is an error in the Ethereum call. -### `fee_per_proof` +### `calculate_fee_per_proof_for_batch_of_size` -Returns the `fee_per_proof` based on the current gas price for a batch compromised of `num_proofs_per_batch` i.e. (1 / `num_proofs_per_batch`). +Returns the `fee_per_proof` based on the current gas price for a batch compromised of `num_proofs_per_batch` ```rust -pub async fn fee_per_proof( +pub async fn calculate_fee_per_proof_for_batch_of_size( eth_rpc_url: &str, - num_proofs_per_batch: usize, -) -> Result + num_proofs_in_batch: usize, +) -> Result ``` #### Arguments - `eth_rpc_url` - The URL of the users Ethereum RPC node. -- `num_proofs_per_batch` - The number of proofs within a batch. +- `num_proofs_in_batch` - number of proofs within a batch. #### Returns -- `Result` - The fee per proof of a batch of `num_proofs_per_batch` proofs as a `U256`. +- `Result` - The fee per proof of a batch as a `U256`. #### Errors -- `EthereumProviderError` if there is an error in the connection with the RPC provider. -- `EthereumCallError` if there is an error in the Ethereum call. +-`EthereumProviderError` if there is an error in the connection with the RPC provider. +-`EthereumGasPriceError` if there is an error retrieving the Ethereum gas price. ### `deposit_to_aligned` -Funds the batcher payment service in name of the signer +Funds the batcher payment service in name of the signer. ```Rust pub async fn deposit_to_aligned( @@ -400,3 +403,51 @@ pub async fn get_balance_in_aligned( - `EthereumProviderError` if there is an error in the connection with the RPC provider. - `EthereumCallError` if there is an error in the Ethereum call. + +### `get_vk_commitment` + +Returns the commitment for the verification key, taking into account the corresponding proving system. + +```rust +pub fn get_vk_commitment( + verification_key_bytes: &[u8], + proving_system: ProvingSystemId, +) -> [u8; 32] +``` + +#### Arguments + +- `verification_key_bytes` - The serialized contents of the verification key. +- `proving_system` - The corresponding proving system ID. + +#### Returns + +- `[u8; 32]` - The commitment. + +#### Errors + +- None. + +### `save_response` + +Saves AlignedVerificationData in a file. + +```rust +pub fn save_response( + batch_inclusion_data_directory_path: PathBuf, + aligned_verification_data: &AlignedVerificationData, +) -> Result<(), errors::FileError> +``` + +#### Arguments + +-`batch_inclusion_data_directory_path` - The path of the directory where the data will be saved. +-`aligned_verification_data` - The aligned verification data to be saved. + +#### Returns + +- `Result<(), errors::FileError>` - Ok if the data is saved successfully. + +#### Errors + +- `FileError` if there is an error writing the data to the file. diff --git a/docs/3_guides/1_SDK_how_to.md b/docs/3_guides/1_SDK_how_to.md index 9c1c388f86..c80bbb3e71 100644 --- a/docs/3_guides/1_SDK_how_to.md +++ b/docs/3_guides/1_SDK_how_to.md @@ -12,7 +12,7 @@ To use this SDK in your Rust project, add the following to your `Cargo.toml`: ```toml [dependencies] -aligned-sdk = { git = "https://github.com/yetanotherco/aligned_layer", tag="v0.15.0" } +aligned-sdk = { git = "https://github.com/yetanotherco/aligned_layer", tag="v0.15.1" } ``` To find the latest release tag go to [releases](https://github.com/yetanotherco/aligned_layer/releases) and copy the @@ -51,8 +51,6 @@ Or you can make a more complex call to submit a proof: (code extract from [ZKQuiz example](../3_guides/2_build_your_first_aligned_application.md#app)) ```rust -const BATCHER_URL: &str = "wss://batcher.alignedlayer.com"; - fn main() { let rpc_url = args.rpc_url.clone(); let verification_data = VerificationData { @@ -74,7 +72,6 @@ fn main() { // Call to SDK: match submit_and_wait_verification( - BATCHER_URL, &rpc_url, Network::Holesky, &verification_data, diff --git a/docs/3_guides/2_build_your_first_aligned_application.md b/docs/3_guides/2_build_your_first_aligned_application.md index 4c859fb2f2..7832c39e4a 100644 --- a/docs/3_guides/2_build_your_first_aligned_application.md +++ b/docs/3_guides/2_build_your_first_aligned_application.md @@ -277,7 +277,6 @@ let nonce = get_nonce_from_ethereum(&rpc_url, wallet.address(), NETWORK) // Submit to Aligned. let aligned_verification_data = submit_and_wait_verification( - BATCHER_URL, &rpc_url, NETWORK, &verification_data, diff --git a/docs/operator_guides/0_running_an_operator.md b/docs/operator_guides/0_running_an_operator.md index 24b1581598..1af89514d6 100644 --- a/docs/operator_guides/0_running_an_operator.md +++ b/docs/operator_guides/0_running_an_operator.md @@ -1,7 +1,7 @@ # Register as an Aligned operator in testnet > **CURRENT VERSION:** -> Aligned Operator [v0.15.0](https://github.com/yetanotherco/aligned_layer/releases/tag/v0.15.0) +> Aligned Operator [v0.15.1](https://github.com/yetanotherco/aligned_layer/releases/tag/v0.15.1) > **IMPORTANT:** > You must be [whitelisted](https://docs.google.com/forms/d/e/1FAIpQLSdH9sgfTz4v33lAvwj6BvYJGAeIshQia3FXz36PFfF-WQAWEQ/viewform) to become an Aligned operator. @@ -30,7 +30,7 @@ The list of supported strategies can be found [here](../3_guides/7_contract_addr To start with, clone the Aligned repository and move inside it ```bash -git clone https://github.com/yetanotherco/aligned_layer.git --branch v0.15.0 +git clone https://github.com/yetanotherco/aligned_layer.git --branch v0.15.1 cd aligned_layer ``` @@ -46,6 +46,7 @@ Also, you have to install the following dependencies for Linux: - pkg-config - libssl-dev +- g++ To install foundry, run: diff --git a/docs/operator_guides/2_troubleshooting.md b/docs/operator_guides/2_troubleshooting.md index 84513069a1..92fdfdf35b 100644 --- a/docs/operator_guides/2_troubleshooting.md +++ b/docs/operator_guides/2_troubleshooting.md @@ -44,3 +44,12 @@ If your operator is not showing up after 1 hour, please check the following: This error is caused by the operator not being able to get the RPC urls. Make sure you have configured the RPC correctly in the [config file](0_running_an_operator.md#step-3---update-the-configuration-for-your-specific-operator). + +### How to update Rust + +In case you have an unsupported version of Rust, you can update it following the [official page](https://www.rust-lang.org/tools/install) + + +### Compiler family detection failed due to error: ToolNotFound: failed to find tool "c++": No such file or directory (os error 2) + +Run `sudo apt update && sudo apt install g++` to install the GNU C++ compiler. diff --git a/explorer/.env.dev b/explorer/.env.dev index 4c6f2d1748..e926401f04 100644 --- a/explorer/.env.dev +++ b/explorer/.env.dev @@ -30,4 +30,4 @@ BATCH_TTL_MINUTES=5 SCHEDULED_BATCH_INTERVAL_MINUTES=10 # Latest aligned release that operators should be running -LATEST_RELEASE=v0.15.0 +LATEST_RELEASE=v0.15.1 diff --git a/explorer/.env.example b/explorer/.env.example index 408d10962a..7df20261cd 100644 --- a/explorer/.env.example +++ b/explorer/.env.example @@ -28,4 +28,4 @@ BATCH_TTL_MINUTES=5 SCHEDULED_BATCH_INTERVAL_MINUTES=360 # Latest aligned release that operators should be running -LATEST_RELEASE=v0.15.0 +LATEST_RELEASE=v0.15.1