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

Tracking PR for v0.8.0 release #1096

Draft
wants to merge 10 commits into
base: main
Choose a base branch
from
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# Changelog

## 0.8.0 (TBD)

### Changes

- [BREAKING] Incremented minimum supported Rust version to 1.84.
- [BREAKING] Moved `generated` module from `miden-proving-service-client` crate to `tx_prover::generated` hierarchy (#1102).
- Added an endpoint to the `miden-proving-service` to update the workers (#1107).
- Renamed the protobuf file of the transaction prover to `tx_prover.proto` (#1110).
- [BREAKING] Renamed `AccountData` to `AccountFile` (#1116).
- Implement transaction batch prover in Rust (#1112).

## 0.7.2 (2025-01-28) - `miden-objects` crate only

### Changes
Expand Down
39 changes: 33 additions & 6 deletions Cargo.lock

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

9 changes: 5 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ resolver = "2"
members = [
"bin/bench-tx",
"bin/proving-service",
"crates/miden-tx-batch-prover",
"crates/miden-lib",
"crates/miden-objects",
"crates/miden-proving-service-client",
Expand All @@ -11,7 +12,7 @@ members = [

[workspace.package]
edition = "2021"
rust-version = "1.82"
rust-version = "1.84"
license = "MIT"
authors = ["Miden contributors"]
homepage = "https://polygon.technology/polygon-miden"
Expand All @@ -36,11 +37,11 @@ lto = true
assembly = { package = "miden-assembly", version = "0.12", default-features = false }
assert_matches = { version = "1.5", default-features = false }
miden-crypto = { version = "0.13", default-features = false }
miden-lib = { path = "crates/miden-lib", version = "0.7", default-features = false }
miden-objects = { path = "crates/miden-objects", version = "0.7", default-features = false }
miden-lib = { path = "crates/miden-lib", version = "0.8", default-features = false }
miden-objects = { path = "crates/miden-objects", version = "0.8", default-features = false }
miden-prover = { version = "0.12", default-features = false }
miden-stdlib = { version = "0.12", default-features = false }
miden-tx = { path = "crates/miden-tx", version = "0.7", default-features = false }
miden-tx = { path = "crates/miden-tx", version = "0.8", default-features = false }
miden-verifier = { version = "0.12", default-features = false }
rand = { version = "0.8", default-features = false }
thiserror = { version = "2.0", default-features = false }
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
[![LICENSE](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/0xPolygonMiden/miden-base/blob/main/LICENSE)
[![test](https://github.com/0xPolygonMiden/miden-base/actions/workflows/test.yml/badge.svg)](https://github.com/0xPolygonMiden/miden-base/actions/workflows/test.yml)
[![build](https://github.com/0xPolygonMiden/miden-base/actions/workflows/build.yml/badge.svg)](https://github.com/0xPolygonMiden/miden-base/actions/workflows/build.yml)
[![RUST_VERSION](https://img.shields.io/badge/rustc-1.82+-lightgray.svg)](https://www.rust-lang.org/tools/install)
[![RUST_VERSION](https://img.shields.io/badge/rustc-1.84+-lightgray.svg)](https://www.rust-lang.org/tools/install)
[![GitHub Release](https://img.shields.io/github/release/0xPolygonMiden/miden-base)](https://github.com/0xPolygonMiden/miden-base/releases/)

Description and core structures for the Miden Rollup protocol.
Expand All @@ -23,7 +23,7 @@ If you want to join the technical discussion or learn more about the project, pl

## Status and features

Polygon Miden is currently on release v0.7. This is an early version of the protocol and its components. We expect to keep making changes (including breaking changes) to all components.
Polygon Miden is currently on release v0.8. This is an early version of the protocol and its components. We expect to keep making changes (including breaking changes) to all components.

### Feature highlights

Expand Down
6 changes: 3 additions & 3 deletions bin/proving-service/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "miden-proving-service"
version = "0.7.0"
version = "0.8.0"
description = "Miden rollup proving service"
readme = "README.md"
keywords = ["miden", "proving", "service"]
Expand All @@ -21,7 +21,7 @@ concurrent = ["miden-tx/concurrent"]

[dependencies]
async-trait = "0.1"
axum = {version = "0.7" }
axum = { version = "0.7" }
bytes = "1.0"
clap = { version = "4.5", features = ["derive"] }
figment = { version = "0.10", features = ["toml", "env"] }
Expand All @@ -45,7 +45,7 @@ tokio = { version = "1.38", features = ["full"] }
tokio-stream = { version = "0.1", features = [ "net" ]}
toml = { version = "0.8" }
thiserror = { workspace = true }
tonic = { version = "0.12", default-features = false, features = ["prost", "codegen", "transport"] }
tonic = { version = "0.12", default-features = false, features = ["codegen", "prost", "transport"] }
tonic-health = { version = "0.12" }
tonic-web = { version = "0.12" }
tracing = { version = "0.1" }
Expand Down
13 changes: 7 additions & 6 deletions bin/proving-service/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,11 @@ fn main() -> miette::Result<()> {
// HELPER FUNCTIONS
// ================================================================================================

/// Copies all api.proto file from the root proto directory to the proto directory of this crate.
/// Copies the tx_prover.proto file from the root proto directory to the proto directory of this
/// crate.
fn copy_proto_files() -> miette::Result<()> {
let src_file = format!("{REPO_PROTO_DIR}/api.proto");
let dest_file = format!("{CRATE_PROTO_DIR}/api.proto");
let src_file = format!("{REPO_PROTO_DIR}/tx_prover.proto");
let dest_file = format!("{CRATE_PROTO_DIR}/tx_prover.proto");

fs::remove_dir_all(CRATE_PROTO_DIR).into_diagnostic()?;
fs::create_dir_all(CRATE_PROTO_DIR).into_diagnostic()?;
Expand All @@ -50,14 +51,14 @@ fn compile_tonic_server_proto() -> miette::Result<()> {
PathBuf::from(env::var("CARGO_MANIFEST_DIR").expect("CARGO_MANIFEST_DIR should be set"));
let dst_dir = crate_root.join("src").join("generated");

// Remove `api.rs` if it exists.
fs::remove_file(dst_dir.join("api.rs")).into_diagnostic().ok();
// Remove `tx_prover.rs` if it exists.
fs::remove_file(dst_dir.join("tx_prover.rs")).into_diagnostic().ok();

let out_dir = env::var("OUT_DIR").into_diagnostic()?;
let file_descriptor_path = PathBuf::from(out_dir).join("file_descriptor_set.bin");

let proto_dir: PathBuf = CRATE_PROTO_DIR.into();
let protos = &[proto_dir.join("api.proto")];
let protos = &[proto_dir.join("tx_prover.proto")];
let includes = &[proto_dir];

let file_descriptors = protox::compile(protos, includes)?;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Specification of the user facing gRPC API.
syntax = "proto3";
package api;
package tx_prover;

service Api {
rpc ProveTransaction(ProveTransactionRequest) returns (ProveTransactionResponse) {}
Expand Down
3 changes: 3 additions & 0 deletions bin/proving-service/src/commands/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ pub struct ProxyConfig {
pub host: String,
/// Port of the proxy.
pub port: u16,
/// Worker update service port.
pub workers_update_port: u16,
/// Maximum time in seconds to complete the entire request.
pub timeout_secs: u64,
/// Maximum time in seconds to establish a connection.
Expand Down Expand Up @@ -61,6 +63,7 @@ impl Default for ProxyConfig {
health_check_interval_secs: 1,
prometheus_host: "127.0.0.1".into(),
prometheus_port: 6192,
workers_update_port: 8083,
}
}
}
Expand Down
13 changes: 12 additions & 1 deletion bin/proving-service/src/commands/proxy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@ use pingora::{
lb::Backend,
prelude::{background_service, Opt},
server::Server,
services::listening::Service,
};
use pingora_proxy::http_proxy_service;
use tracing::warn;

use crate::{
error::TxProverServiceError,
proxy::{LoadBalancer, LoadBalancerState},
proxy::{update_workers::LoadBalancerUpdateService, LoadBalancer, LoadBalancerState},
utils::MIDEN_PROVING_SERVICE,
};

Expand Down Expand Up @@ -58,8 +59,17 @@ impl StartProxy {
let worker_lb = LoadBalancerState::new(workers, &proxy_config).await?;

let health_check_service = background_service("health_check", worker_lb);

let worker_lb = health_check_service.task();

let updater_service = LoadBalancerUpdateService::new(worker_lb.clone());

let mut update_workers_service =
Service::new("update_workers".to_string(), updater_service);
update_workers_service.add_tcp(
format!("{}:{}", proxy_config.host, proxy_config.workers_update_port).as_str(),
);

// Set up the load balancer
let mut lb = http_proxy_service(&server.configuration, LoadBalancer(worker_lb));

Expand All @@ -84,6 +94,7 @@ impl StartProxy {

server.add_service(prometheus_service_http);
server.add_service(health_check_service);
server.add_service(update_workers_service);
server.add_service(lb);
tokio::task::spawn_blocking(|| server.run_forever())
.await
Expand Down
13 changes: 7 additions & 6 deletions bin/proving-service/src/commands/update_workers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,19 +40,17 @@ pub struct UpdateWorkers {
}

impl UpdateWorkers {
/// Makes a requests to the proxy to update the workers.
/// Makes a requests to the update workers endpoint to update the workers.
///
/// It works by sending a GET request to the proxy with the query parameters. The query
/// parameters are serialized from the struct fields.
///
/// This method will work only if the proxy is running and the user is in the same computer as
/// the proxy, since the proxy checks for the source IP address and checks that the sender is
/// localhost.
/// It will use the same host as the proxy and the workers update port from the configuration
/// file.
///
/// The request will return the new number of workers in the X-Worker-Count header.
///
/// # Errors
/// - If a tokio runtime cannot be created.
/// - If the query parameters cannot be serialized.
/// - If the request fails.
/// - If the status code is not successful.
Expand All @@ -68,7 +66,10 @@ impl UpdateWorkers {
let proxy_config = ProxyConfig::load_config_from_file()?;

// Create the full URL
let url = format!("http://{}:{}?{}", proxy_config.host, proxy_config.port, query_params);
let url = format!(
"http://{}:{}?{}",
proxy_config.host, proxy_config.workers_update_port, query_params
);

// Create an HTTP/2 client
let client = Client::builder()
Expand Down
4 changes: 2 additions & 2 deletions bin/proving-service/src/generated/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ use miden_objects::transaction::ProvenTransaction;
use miden_tx::utils::{Deserializable, DeserializationError, Serializable};

#[rustfmt::skip]
pub mod api;
pub mod tx_prover;

pub use api::*;
pub use tx_prover::*;

// CONVERSIONS
// ================================================================================================
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,12 @@ pub mod api_client {
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static("/api.Api/ProveTransaction");
let path = http::uri::PathAndQuery::from_static(
"/tx_prover.Api/ProveTransaction",
);
let mut req = request.into_request();
req.extensions_mut().insert(GrpcMethod::new("api.Api", "ProveTransaction"));
req.extensions_mut()
.insert(GrpcMethod::new("tx_prover.Api", "ProveTransaction"));
self.inner.unary(req, path, codec).await
}
}
Expand Down Expand Up @@ -220,7 +223,7 @@ pub mod api_server {
}
fn call(&mut self, req: http::Request<B>) -> Self::Future {
match req.uri().path() {
"/api.Api/ProveTransaction" => {
"/tx_prover.Api/ProveTransaction" => {
#[allow(non_camel_case_types)]
struct ProveTransactionSvc<T: Api>(pub Arc<T>);
impl<
Expand Down Expand Up @@ -298,7 +301,7 @@ pub mod api_server {
}
}
/// Generated gRPC service name
pub const SERVICE_NAME: &str = "api.Api";
pub const SERVICE_NAME: &str = "tx_prover.Api";
impl<T> tonic::server::NamedService for ApiServer<T> {
const NAME: &'static str = SERVICE_NAME;
}
Expand Down
Loading
Loading