Skip to content

Commit

Permalink
v0.9.1 (#1232)
Browse files Browse the repository at this point in the history
Co-authored-by: Uriel Mihura <[email protected]>
Co-authored-by: IAvecilla <[email protected]>
Co-authored-by: Julian Arce <[email protected]>
  • Loading branch information
4 people authored Oct 13, 2024
1 parent 7679154 commit 1608fc3
Show file tree
Hide file tree
Showing 11 changed files with 1,495 additions and 585 deletions.
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.0
OPERATOR_VERSION=v0.9.1

ifeq ($(OS),Linux)
BUILD_ALL_FFI = $(MAKE) build_all_ffi_linux
Expand Down
152 changes: 147 additions & 5 deletions batcher/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions batcher/aligned-batcher/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,7 @@ bincode = "1.3.3"
aligned-sdk = { path = "../aligned-sdk" }
ciborium = "=0.2.2"
priority-queue = "2.1.0"

once_cell = "1.20.2"
warp = "0.3.7"
prometheus = { version = "0.13.4", features = ["process"] }
8 changes: 8 additions & 0 deletions batcher/aligned-batcher/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ mod config;
mod connection;
mod eth;
pub mod gnark;
pub mod metrics;
pub mod risc_zero;
pub mod s3;
pub mod sp1;
Expand Down Expand Up @@ -212,6 +213,7 @@ impl Batcher {

// Let's spawn the handling of each connection in a separate task.
while let Ok((stream, addr)) = listener.accept().await {
metrics::OPEN_CONNECTIONS.inc();
let batcher = self.clone();
tokio::spawn(batcher.handle_connection(stream, addr));
}
Expand Down Expand Up @@ -294,6 +296,7 @@ impl Batcher {
Ok(_) => info!("{} disconnected", &addr),
}

metrics::OPEN_CONNECTIONS.dec();
Ok(())
}

Expand All @@ -313,6 +316,7 @@ impl Batcher {
};
let msg_nonce = client_msg.verification_data.nonce;
debug!("Received message with nonce: {msg_nonce:?}",);
metrics::RECEIVED_PROOFS.inc();

// * ---------------------------------------------------*
// * Perform validations over the message *
Expand Down Expand Up @@ -1012,6 +1016,8 @@ impl Batcher {

let proof_submitters = finalized_batch.iter().map(|entry| entry.sender).collect();

metrics::GAS_PRICE_USED_ON_LATEST_BATCH.set(gas_price.as_u64() as i64);

match self
.create_new_task(
*batch_merkle_root,
Expand All @@ -1023,6 +1029,7 @@ impl Batcher {
{
Ok(_) => {
info!("Batch verification task created on Aligned contract");
metrics::SENT_BATCHES.inc();
Ok(())
}
Err(e) => {
Expand All @@ -1031,6 +1038,7 @@ impl Batcher {
e
);

metrics::REVERTED_BATCHES.inc();
Err(e)
}
}
Expand Down
12 changes: 12 additions & 0 deletions batcher/aligned-batcher/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ use std::sync::Arc;
use clap::Parser;
use env_logger::Env;

use aligned_batcher::metrics;
use aligned_batcher::{types::errors::BatcherError, Batcher};
use warp::Filter;

/// Batcher main flow:
/// There are two main tasks spawned: `listen_connections` and `listen_new_blocks`
Expand Down Expand Up @@ -38,6 +40,14 @@ async fn main() -> Result<(), BatcherError> {

env_logger::Builder::from_env(Env::default().default_filter_or("info")).init();

// Endpoint for Prometheus
metrics::init_variables();
let metrics_route = warp::path!("metrics").and_then(metrics::metrics_handler);
println!("Starting Batcher metrics on port 9093");
tokio::task::spawn(async move {
warp::serve(metrics_route).run(([0, 0, 0, 0], 9093)).await;
}); //TODO read from config

let batcher = Batcher::new(cli.config).await;
let batcher = Arc::new(batcher);

Expand All @@ -53,6 +63,8 @@ async fn main() -> Result<(), BatcherError> {
}
});

metrics::batcher_started();

batcher.listen_connections(&addr).await?;

Ok(())
Expand Down
Loading

0 comments on commit 1608fc3

Please sign in to comment.