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

refactor(example): enhance example for public inputs validation #1195

Closed
wants to merge 23 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
4948d71
feat: add sp1 to the example of validating public input
IAvecilla Oct 7, 2024
f8746d6
chore: add n as public input in risc0 example
IAvecilla Oct 7, 2024
a3ae2a3
feat: generate network from string
IAvecilla Oct 7, 2024
ae2f106
feat: update fibonacci validator to work with the new example
IAvecilla Oct 7, 2024
8674fdb
feat: update aligned integration to work with both verifiers
IAvecilla Oct 7, 2024
10ee5ce
chore: update lock files
IAvecilla Oct 7, 2024
48ea17a
chore: add docs to run example locally
IAvecilla Oct 7, 2024
7f5c784
feat: update docs for the new example
IAvecilla Oct 7, 2024
6d53937
feat: update makefile with new targets to make example easier to run
IAvecilla Oct 7, 2024
4c8e83c
feat: add bash script to test batch inclusion easily
IAvecilla Oct 7, 2024
334468f
chore: fix toml EOL
IAvecilla Oct 7, 2024
20b8aae
chore: address review comments
IAvecilla Oct 9, 2024
d46cc30
chore: add output examples for each command to be easier to follow
IAvecilla Oct 9, 2024
66977b5
docs: add disclaimer when sending proofs to actually seal the batch
IAvecilla Oct 9, 2024
4478256
Pull fixes from testnet (#1231)
MauroToscano Oct 13, 2024
ba04f04
Add observability batcher (#1226)
uri-99 Oct 13, 2024
73e0481
docs: update version to v0.9.1 (#1233)
JuArce Oct 13, 2024
e28d97e
Merge branch 'staging' into 1132-add-public-input-example
uri-99 Oct 14, 2024
f6b1dec
fix: remove duplicated import
uri-99 Oct 14, 2024
bc2fe08
fix: update cargo.lock
uri-99 Oct 14, 2024
8f73d97
fix: update cargo.lock
uri-99 Oct 14, 2024
55a931e
feat: better revert if invalid ELF, and updated risc0 elf
uri-99 Oct 14, 2024
6dfc1c6
chore: add error code
uri-99 Oct 14, 2024
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.0
OPERATOR_VERSION=v0.9.1

ifeq ($(OS),Linux)
BUILD_ALL_FFI = $(MAKE) build_all_ffi_linux
Expand Down
154 changes: 148 additions & 6 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
Loading