From 9930c363cc7d793d6235e06a676e9d79b8bf09fb Mon Sep 17 00:00:00 2001 From: Santiago Pittella <87827390+SantiagoPittella@users.noreply.github.com> Date: Tue, 28 Jan 2025 02:27:01 -0300 Subject: [PATCH] chore: restructure proving service clients crate (#1102) --- CHANGELOG.md | 1 + crates/miden-proving-service-client/build.rs | 2 +- crates/miden-proving-service-client/src/lib.rs | 7 +------ .../src/{ => tx_prover}/generated/mod.rs | 0 .../src/{ => tx_prover}/generated/nostd/api.rs | 0 .../src/{ => tx_prover}/generated/nostd/mod.rs | 0 .../src/{ => tx_prover}/generated/std/api.rs | 0 .../src/{ => tx_prover}/generated/std/mod.rs | 0 .../src/{prover.rs => tx_prover/mod.rs} | 7 +++++-- 9 files changed, 8 insertions(+), 9 deletions(-) rename crates/miden-proving-service-client/src/{ => tx_prover}/generated/mod.rs (100%) rename crates/miden-proving-service-client/src/{ => tx_prover}/generated/nostd/api.rs (100%) rename crates/miden-proving-service-client/src/{ => tx_prover}/generated/nostd/mod.rs (100%) rename crates/miden-proving-service-client/src/{ => tx_prover}/generated/std/api.rs (100%) rename crates/miden-proving-service-client/src/{ => tx_prover}/generated/std/mod.rs (100%) rename crates/miden-proving-service-client/src/{prover.rs => tx_prover/mod.rs} (95%) diff --git a/CHANGELOG.md b/CHANGELOG.md index 318987fa8..ca180f898 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ ### 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). ## 0.7.1 (2025-01-24) - `miden-objects` crate only diff --git a/crates/miden-proving-service-client/build.rs b/crates/miden-proving-service-client/build.rs index ad10d95b7..e5167ad51 100644 --- a/crates/miden-proving-service-client/build.rs +++ b/crates/miden-proving-service-client/build.rs @@ -49,7 +49,7 @@ fn copy_proto_files() -> miette::Result<()> { fn compile_tonic_client_proto() -> miette::Result<()> { let crate_root = PathBuf::from(env::var("CARGO_MANIFEST_DIR").expect("CARGO_MANIFEST_DIR should be set")); - let dst_dir = crate_root.join("src").join("generated"); + let dst_dir = crate_root.join("src").join("tx_prover").join("generated"); // Remove `api.rs` if it exists. fs::remove_file(dst_dir.join("api.rs")).into_diagnostic().ok(); diff --git a/crates/miden-proving-service-client/src/lib.rs b/crates/miden-proving-service-client/src/lib.rs index a12fd0251..221c029a3 100644 --- a/crates/miden-proving-service-client/src/lib.rs +++ b/crates/miden-proving-service-client/src/lib.rs @@ -13,12 +13,7 @@ extern crate std; use thiserror::Error; #[cfg(feature = "tx-prover")] -pub mod generated; - -#[cfg(feature = "tx-prover")] -mod prover; -#[cfg(feature = "tx-prover")] -pub use prover::RemoteTransactionProver; +pub mod tx_prover; /// Protobuf definition for the Miden proving service pub const SERVICE_PROTO: &str = include_str!("../proto/api.proto"); diff --git a/crates/miden-proving-service-client/src/generated/mod.rs b/crates/miden-proving-service-client/src/tx_prover/generated/mod.rs similarity index 100% rename from crates/miden-proving-service-client/src/generated/mod.rs rename to crates/miden-proving-service-client/src/tx_prover/generated/mod.rs diff --git a/crates/miden-proving-service-client/src/generated/nostd/api.rs b/crates/miden-proving-service-client/src/tx_prover/generated/nostd/api.rs similarity index 100% rename from crates/miden-proving-service-client/src/generated/nostd/api.rs rename to crates/miden-proving-service-client/src/tx_prover/generated/nostd/api.rs diff --git a/crates/miden-proving-service-client/src/generated/nostd/mod.rs b/crates/miden-proving-service-client/src/tx_prover/generated/nostd/mod.rs similarity index 100% rename from crates/miden-proving-service-client/src/generated/nostd/mod.rs rename to crates/miden-proving-service-client/src/tx_prover/generated/nostd/mod.rs diff --git a/crates/miden-proving-service-client/src/generated/std/api.rs b/crates/miden-proving-service-client/src/tx_prover/generated/std/api.rs similarity index 100% rename from crates/miden-proving-service-client/src/generated/std/api.rs rename to crates/miden-proving-service-client/src/tx_prover/generated/std/api.rs diff --git a/crates/miden-proving-service-client/src/generated/std/mod.rs b/crates/miden-proving-service-client/src/tx_prover/generated/std/mod.rs similarity index 100% rename from crates/miden-proving-service-client/src/generated/std/mod.rs rename to crates/miden-proving-service-client/src/tx_prover/generated/std/mod.rs diff --git a/crates/miden-proving-service-client/src/prover.rs b/crates/miden-proving-service-client/src/tx_prover/mod.rs similarity index 95% rename from crates/miden-proving-service-client/src/prover.rs rename to crates/miden-proving-service-client/src/tx_prover/mod.rs index 58385cbda..b96bdb4ad 100644 --- a/crates/miden-proving-service-client/src/prover.rs +++ b/crates/miden-proving-service-client/src/tx_prover/mod.rs @@ -1,12 +1,15 @@ +pub mod generated; + use alloc::{ boxed::Box, string::{String, ToString}, }; +use generated::api_client::ApiClient; use miden_objects::transaction::{ProvenTransaction, TransactionWitness}; use miden_tx::{utils::sync::RwLock, TransactionProver, TransactionProverError}; -use crate::{generated::api_client::ApiClient, RemoteProverError}; +use crate::RemoteProverError; // REMOTE TRANSACTION PROVER // ================================================================================================ @@ -84,7 +87,7 @@ impl TransactionProver for RemoteTransactionProver { .ok_or_else(|| TransactionProverError::other("client should be connected"))? .clone(); - let request = tonic::Request::new(crate::generated::ProveTransactionRequest { + let request = tonic::Request::new(generated::ProveTransactionRequest { transaction_witness: tx_witness.to_bytes(), });