Skip to content
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

v0.9.2 #1247

Merged
merged 10 commits into from
Oct 14, 2024
Merged

v0.9.2 #1247

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ OS := $(shell uname -s)
CONFIG_FILE?=config-files/config.yaml
AGG_CONFIG_FILE?=config-files/config-aggregator.yaml

OPERATOR_VERSION=v0.9.1
OPERATOR_VERSION=v0.9.2

ifeq ($(OS),Linux)
BUILD_ALL_FFI = $(MAKE) build_all_ffi_linux
Expand Down
2 changes: 1 addition & 1 deletion batcher/aligned/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "aligned"
version = "0.9.0"
version = "0.9.2"
edition = "2021"

[dependencies]
Expand Down
4 changes: 2 additions & 2 deletions docs/2_architecture/components/2_payment_service_contract.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
The Payment Service handles users payments to fund the verification of their proofs.

To be able to use the batcher, a user must fund its transactions.
For this, there is a simple Batcher Payment System.
For this, there is a simple Payment Service.

The Batcher has an associated Batcher Payments smart contract,
The Batcher has an associated `Batcher Payments` smart contract,
which is in charge of receiving user's payments,
and it guarantees that it can only spend these funds to send users' proofs to Aligned.

Expand Down
34 changes: 16 additions & 18 deletions docs/3_guides/0_submitting_proofs.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,33 +60,32 @@ This will create the ECDSA keystore file in `~/.aligned_keystore/keystore0`

- If you have the EigenLayer CLI installed, the keystore can be generated following [these](https://docs.eigenlayer.xyz/eigenlayer/operator-guides/operator-installation#import-keys) instructions. The key will be stored into `~/.eigenlayer/operator_keys`.

## 2. Fund the batcher
## 2. Send funds to Aligned

To be able to send proofs to Aligned using the Batcher, the user must fund its transactions. For this, there is a simple Batcher Payment System.
To send proofs to Aligned using the Batcher, the user must first deposit some funds in Aligned to pay for the verification of his proofs.

To use it, you can use the `aligned` CLI, as shown with the following example:

```bash
aligned deposit-to-batcher \
aligned deposit-to-batcher \
--rpc_url https://ethereum-holesky-rpc.publicnode.com \
--network holesky \
--keystore_path <keystore_path> \
--amount 0.1ether
```

These commands allow the usage of the following flags:
This command allows the usage of the following flags:

- `--payment_service_addr` to specify the address of the Batcher Payment Service smart contract.
- `--rpc_url` to specify the rpc url to be used.
- `--network` to specify the chain id to be used. Could be holesky or devnet.
- `--network` to specify the netowrk to be used. Can be `devnet`, `holesky-stage` or `holesky`.
- `--keystore_path` the path to the keystore.
- `--amount` the number of ethers to transfer to the Batcher.
- Note: `--amount` flag parameter must be with the shown format. The amount followed by the `ether` keyword to specify how many ethers you wish to deposit to the Batcher.
- Note: `--amount` flag parameter must be with the shown format, `XX.XXether`.

After depositing funds, you can verify the Service has correctly received them by executing the following command:

```bash
aligned get-user-balance \
aligned get-user-balance \
--rpc_url https://ethereum-holesky-rpc.publicnode.com \
--network holesky \
--user_addr <user_addr>
Expand All @@ -95,7 +94,7 @@ aligned get-user-balance \
These commands allow the usage of the following flags:

- `--rpc_url` to specify the rpc url to be used.
- `--network` to specify the chain id to be used. Could be holesky or devnet.
- `--network` to specify the netowrk to be used. Can be `devnet`, `holesky-stage` or `holesky`.
- `--user_addr` the address of the user that funded the Batcher.

## 3. Submit your proof to the batcher
Expand All @@ -109,9 +108,8 @@ Proof submission is done via the `submit` command of the Aligned CLI. The argume
* `vm_program`: When the proving system involves the execution of a program in a zkVM, this argument is associated with the compiled program or some other identifier of the program.
* `pub_input`: The path to the file with the public input associated with the proof.
* `batcher_url`: The batcher websocket URL.
* `chain` to specify the chain id to be used. Could be holesky or devnet.
* `network` to specify the netowrk to be used. Can be `devnet`, `holesky-stage` or `holesky`.
* `rpc_url`: The RPC Ethereum node URL.
* `payment_service_addr`: The Ethereum address of the Batcher Payments System contract.
* `proof_generator_addr`: An optional parameter that can be used in some applications to avoid front-running.
* `batch_inclusion_data_directory_path`: An optional parameter indicating the directory where to store the batcher response data. If not provided, the folder with the responses will be created in the current directory.

Expand All @@ -132,7 +130,7 @@ aligned submit \
--batch_inclusion_data_directory_path [batch_inclusion_data_directory_path] \
--keystore_path <path_to_ecdsa_keystore> \
--network holesky \
--rpc_url https://ethereum-holesky-rpc.publicnode.com
--rpc_url https://ethereum-holesky-rpc.publicnode.com
```

**Example**
Expand All @@ -146,7 +144,7 @@ aligned submit \
--batcher_url wss://batcher.alignedlayer.com \
--keystore_path ~/.aligned_keystore/keystore0 \
--network holesky \
--rpc_url https://ethereum-holesky-rpc.publicnode.com
--rpc_url https://ethereum-holesky-rpc.publicnode.com
```

### Risc0 proof
Expand All @@ -167,7 +165,7 @@ aligned submit \
--batch_inclusion_data_directory_path [batch_inclusion_data_directory_path] \
--keystore_path <path_to_ecdsa_keystore> \
--network holesky \
--rpc_url https://ethereum-holesky-rpc.publicnode.com
--rpc_url https://ethereum-holesky-rpc.publicnode.com
```

**NOTE**: As said above, Aligned currently supports Risc0 proofs from `risc0-zkvm` version `v1.0.1`. For generating proofs using `cargo risc-zero` please ensure you are using `v1.0.1` or your proof will not be verified.
Expand All @@ -193,7 +191,7 @@ aligned submit \
--aligned_verification_data_path ~/.aligned/aligned_verification_data \
--keystore_path ~/.aligned_keystore/keystore0 \
--network holesky \
--rpc_url https://ethereum-holesky-rpc.publicnode.com
--rpc_url https://ethereum-holesky-rpc.publicnode.com
```

### GnarkPlonkBn254, GnarkPlonkBls12_381 and Groth16Bn254
Expand All @@ -212,7 +210,7 @@ aligned submit \
--batch_inclusion_data_directory_path [batch_inclusion_data_directory_path] \
--keystore_path <path_to_ecdsa_keystore> \
--network holesky \
--rpc_url https://ethereum-holesky-rpc.publicnode.com
--rpc_url https://ethereum-holesky-rpc.publicnode.com
```

**Examples**:
Expand All @@ -227,7 +225,7 @@ aligned submit \
--batcher_url wss://batcher.alignedlayer.com \
--keystore_path ~/.aligned_keystore/keystore0 \
--network holesky \
--rpc_url https://ethereum-holesky-rpc.publicnode.com
--rpc_url https://ethereum-holesky-rpc.publicnode.com
```

```bash
Expand All @@ -240,7 +238,7 @@ aligned submit \
--batcher_url wss://batcher.alignedlayer.com \
--keystore_path ~/.aligned_keystore/keystore0 \
--network holesky \
--rpc_url https://ethereum-holesky-rpc.publicnode.com
--rpc_url https://ethereum-holesky-rpc.publicnode.com
```

```bash
Expand Down
66 changes: 59 additions & 7 deletions docs/3_guides/1.2_SDK_api_reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ Should be used before submitting proofs to the batcher. Wallet chain id needs to
wallet = wallet.with_chain_id(chain_id);
```

### Arguments
#### Arguments

- `eth_rpc_url` - The URL of the Ethereum RPC node.

Expand All @@ -303,7 +303,7 @@ wallet = wallet.with_chain_id(chain_id);
- `EthereumProviderError` if there is an error in the connection with the RPC provider.
- `EthereumCallError` if there is an error in the Ethereum call.

## `estimate_fee`
### `estimate_fee`

Estimates the fee the user would have to pay for submitting a proof to Aligned. Depending on the
priority the user wants to have in the batch, the `estimate` parameter can be set.
Expand All @@ -315,7 +315,7 @@ pub async fn estimate_fee(
) -> Result<U256, errors::MaxFeeEstimateError>
```

### Arguments
#### Arguments

- `eth_rpc_url` - The URL of the Ethereum RPC node.
- `estimate` - The parameter to set the priority for the proof to be included in the batch. It can be one
Expand All @@ -330,7 +330,7 @@ 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.

## `compute_max_fee`
### `compute_max_fee`

Computes `max_fee` for a proof based on the number of proofs in a batch (`num_proofs_per_batch`) and number of proofs (`num_proofs`) in that batch the user would pay for i.e (`num_proofs` / `num_proofs_per_batch`).

Expand All @@ -342,7 +342,7 @@ pub async fn compute_max_fee(
) -> Result<U256, errors::MaxFeeEstimateError>
```

### Arguments
#### Arguments

- `eth_rpc_url` - The URL of the Ethereum RPC node.
- `num_proofs` - The number of proofs in a batch the user would pay for.
Expand All @@ -357,7 +357,7 @@ pub async fn compute_max_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`
### `fee_per_proof`

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`).

Expand All @@ -368,7 +368,7 @@ pub async fn fee_per_proof(
) -> Result<U256, errors::MaxFeeEstimateError>
```

### Arguments
#### Arguments

- `eth_rpc_url` - The URL of the users Ethereum RPC node.
- `num_proofs_per_batch` - The number of proofs within a batch.
Expand All @@ -381,3 +381,55 @@ pub async fn fee_per_proof(

- `EthereumProviderError` if there is an error in the connection with the RPC provider.
- `EthereumCallError` if there is an error in the Ethereum call.


### `deposit_to_aligned`

Funds the batcher payment service in name of the signer

pub async fn deposit_to_aligned(
amount: U256,
signer: SignerMiddleware<Provider<Http>, LocalWallet>,
network: Network,
) -> Result<ethers::types::TransactionReceipt, errors::PaymentError> {

#### Arguments
`amount` - The amount to be paid.
`signer` - The signer middleware of the payer.
`network` - The network on which the payment will be done.

#### Returns
The receipt of the payment transaction.

#### Errors
`SendError` if there is an error sending the transaction.
`SubmitError` if there is an error submitting the transaction.
`PaymentFailed` if the payment failed.


### `get_balance_in_aligned`

Queries a User's balance that was deposited in Aligned

```rust
pub async fn get_balance_in_aligned(
user: Address,
eth_rpc_url: &str,
network: Network,
) -> Result<U256, errors::BalanceError> {
```

#### Arguments

`user` - The address of the user.
`eth_rpc_url` - The URL of the Ethereum RPC node.
`network` - The network on which the balance will be checked.

#### Returns

- `Result<U256, errors::BalanceError>` - The balance of the user in the payment service.

#### Errors

- `EthereumProviderError` if there is an error in the connection with the RPC provider.
- `EthereumCallError` if there is an error in the Ethereum call.
2 changes: 1 addition & 1 deletion docs/3_guides/1_SDK_how_to.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.9.1" }
aligned-sdk = { git = "https://github.com/yetanotherco/aligned_layer", tag="v0.9.2" }
```

To find the latest release tag go to [releases](https://github.com/yetanotherco/aligned_layer/releases) and copy the
Expand Down
2 changes: 2 additions & 0 deletions docs/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@
* [Running an operator](operator_guides/0_running_an_operator.md)
* [Operator FAQ](operator_guides/1_operator_FAQ.md)
* [Troubleshooting](operator_guides/2_troubleshooting.md)
* Upgrading Guides
* [Upgrading to v0.9.2](operator_guides/upgrading_guides/v0_9_2.md)

## Useful links

Expand Down
4 changes: 2 additions & 2 deletions docs/operator_guides/0_running_an_operator.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Register as an Aligned operator in testnet

> **CURRENT VERSION:**
> Aligned Operator [v0.9.1](https://github.com/yetanotherco/aligned_layer/releases/tag/v0.9.1)
> Aligned Operator [v0.9.2](https://github.com/yetanotherco/aligned_layer/releases/tag/v0.9.2)

> **IMPORTANT:**
> You must be [whitelisted](https://docs.google.com/forms/d/e/1FAIpQLSdH9sgfTz4v33lAvwj6BvYJGAeIshQia3FXz36PFfF-WQAWEQ/viewform) to become an Aligned operator.
Expand All @@ -26,7 +26,7 @@ Minimum hardware requirements:
To start with, clone the Aligned repository and move inside it

```bash
git clone https://github.com/yetanotherco/aligned_layer.git --branch v0.9.1
git clone https://github.com/yetanotherco/aligned_layer.git --branch v0.9.2
cd aligned_layer
```

Expand Down
59 changes: 59 additions & 0 deletions docs/operator_guides/upgrading_guides/v0_9_2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# Upgrading to v0.9.2

This guide will walk you through the process of upgrading your Aligned Operator to v0.9.2.

## Changes

### New Features

* fix: operator downtime by @MarcosNicolau in [#1073](https://github.com/yetanotherco/aligned_layer/pull/1073)
* fix: operator commands by @MarcosNicolau in [#1184](https://github.com/yetanotherco/aligned_layer/pull/1184)
* fix: operator resets channel when updating latest block file by @MarcosNicolau in [#1200](https://github.com/yetanotherco/aligned_layer/pull/1200)

## How to upgrade

### Step 1 - Update the configuration for your specific Operator

This version requires update the operator configuration file adding the following fields:

```yaml
## Operator Configurations
operator:
last_processed_batch_filepath: '<path to a file to store the last processed batch>'
```

{% hint style="warning" %}

Make sure the directory where the file is stored exists and the operator has write permissions to it.

We suggest to use absolute paths to avoid ambiguity.

{% endhint %}

### Step 2 - Update the Operator

Inside the Aligned repository, run:

```bash
make update_operator
```

This will recreate the binaries. You can then proceed to restart the operator.

### Step 3 - Check the Operator Version

To see the operator version, run:

```bash
./operator/build/aligned-operator --version
```

This will display the current version of the operator binary.

```
Aligned Layer Node Operator version v0.9.2
```

### Step 4 - Restart the Operator

Restart the operator based on your system config
2 changes: 2 additions & 0 deletions explorer/.env.dev
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,5 @@ DEBUG_ERRORS=true

# Operator version tracker API
TRACKER_API_URL=http://localhost:3030

MAX_BATCH_SIZE=268435456 # 256 MiB
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,8 @@ defmodule AlignedLayerServiceManager do
proof_hashes: nil,
fee_per_proof: BatcherPaymentServiceManager.get_fee_per_proof(%{merkle_root: created_batch.batchMerkleRoot}),
sender_address: Utils.string_to_bytes32(created_batch.senderAddress),
max_aggregator_fee: created_batch.maxAggregatorFee
max_aggregator_fee: created_batch.maxAggregatorFee,
is_valid: true # set to false later if a process determines it is invalid
}
end

Expand Down Expand Up @@ -166,7 +167,8 @@ defmodule AlignedLayerServiceManager do
fee_per_proof: unverified_batch.fee_per_proof,
proof_hashes: nil,
sender_address: unverified_batch.sender_address,
max_aggregator_fee: unverified_batch.max_aggregator_fee
max_aggregator_fee: unverified_batch.max_aggregator_fee,
is_valid: true # set to false later if a process determines it is invalid
}
end
end
Expand Down
Loading
Loading