-
Notifications
You must be signed in to change notification settings - Fork 55
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
feat: split miden-tx-prover into miden-proving-service and miden-remote-provers #1047
feat: split miden-tx-prover into miden-proving-service and miden-remote-provers #1047
Conversation
02fb98a
to
ac627ee
Compare
ac627ee
to
62d5605
Compare
I addressed the comments and changed a bit the README s. Also rebased because it had tons of conflicts. cc @bobbinth |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you! Looks good. Not a full review, but I left some comments inline.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this file still contains the generated client code. Do we actually need it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I leave the client code here because we use it in the test placed in main.rs
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good overall, left some comments about the file structure and make target organization mostly, but other than that I think this is ready to be merged
[package] | ||
name = "miden-remote-provers" | ||
version = "0.1.0" | ||
description = "client library that provides a client for the remote provers" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Is it worth changing the name to miden-remote-prover-clients
? Maybe it's too much of a mouthful but it sounds more descriptive at a first glance (miden-remote-provers
sounds more ambiguous in comparison). cc @bobbinth since I think he suggested these names
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not a big fan of miden-remote-prover-clients
, maybe something like miden-prover-clients
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
miden-prover-client
may be fine, but also maybe miden-proving-service-client
is better? (it immediately indicates that this is a "companion" crate for miden-proving-service
crate).
Co-authored-by: igamigo <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! I left a couple more nits, but I think this is good to merge already if we can test it works well on the client.
I'm merging it in order to merge other "child" PRs on the client, I can address any further comment in a followup PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Thank you. I know this PR is merged, but I left some comments inline which I think we should address in a follow-up PR (before we can release these crates).
Also, it seems like we are doing some things in the proving service crate purely for testing reasons (e.g., building the client part of the protobuf service). I wonder if there is a better way to handle these.
async = ["miden-tx/async"] | ||
default = ["std"] | ||
std = ["miden-objects/std", "miden-tx/std", "dep:tokio", "dep:tonic-web", "dep:tokio-stream", "dep:axum", "dep:tracing", "dep:tracing-subscriber", "tonic/transport"] | ||
default = ["concurrent"] | ||
testing = ["miden-objects/testing", "miden-lib/testing", "miden-tx/testing"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's check if we still need the testing
feature.
Note that for the prover worker you might need to enable the `testing` feature in case the transactions were executed with reduced proof-of-work requirements (or otherwise, the proving process will fail). This step will also generate the necessary protobuf-related files. You can achieve that by generating the binary with: | ||
|
||
```bash | ||
make install-tx-prover-testing | ||
make install-proving-service-testing | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should no longer be needed.
| ------------ | ------------------------------------------------------------------------------------------------------------| | ||
| `std` | Enable usage of Rust's `std`, use `--no-default-features` for `no-std` support. | | ||
| `concurrent` | Enables concurrent code to speed up runtime execution. | | ||
| `async` | Enables the `RemoteTransactionProver` struct, that implements an async version of `TransactionProver` trait.| | ||
| `testing` | Enables testing utilities and reduces proof-of-work requirements to speed up tests' runtimes. | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think std
feature is no longer relevant. Also, we should be able to remove the testing
feature as mentioned in other comments.
tonic-web = { version = "0.12" } | ||
tracing = { version = "0.1" } | ||
tracing-opentelemetry = "0.28" | ||
tracing-subscriber = { version = "0.3", features = ["fmt", "json", "env-filter"] } | ||
uuid = { version = "1.11", features = ["v4"] } | ||
winter-maybe-async = { version = "0.10" } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure we need winter-maybe-async
dependency here. What is it used for? Also, let'd make sure we only have dependencies that are required.
pingora = { version = "0.4", features = [ "lb" ] } | ||
pingora-core = "0.4" | ||
pingora-proxy = "0.4" | ||
pingora-limits = "0.4" | ||
reqwest = { version = "0.11" } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the latest version of request
is now 0.12
- can we update to it?
let mut client = self | ||
.client | ||
.write() | ||
.take() | ||
.ok_or_else(|| TransactionProverError::other("client should be connected"))?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Question: why do we need to do take()
here now? (I don't think this was needed before, right?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I replaced the .take
with a .as_ref
and then cloning the client.
This change was needed because of a clippy error. We didn't ran the linter earlier because it was only enabled when using the "async" feature and it was disabled in the Makefile. Now that we have clippy for no-std, the linter is throwing an error because the MutexGuard was held through an .await
call.
/// Contains the protobuf definitions | ||
pub const PROTO_MESSAGES: &str = include_str!("../../proto/api.proto"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would change the doc comment to something like: "Protobuf definitions for the Miden proving service".
Also nit: maybe we should change the constant name to something like SERVICE_PROTO
?
@@ -0,0 +1,35 @@ | |||
extern crate alloc; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this not be more like this:
#![no_std]
#[cfg(feature = "std")]
extern crate std;
@@ -23,7 +23,7 @@ clippy: ## Runs Clippy with configs | |||
|
|||
.PHONY: clippy-no-std | |||
clippy-no-std: ## Runs Clippy with configs | |||
cargo clippy --no-default-features --target wasm32-unknown-unknown --workspace --lib -- -D warnings | |||
cargo clippy --no-default-features --target wasm32-unknown-unknown --workspace --lib --exclude miden-proving-service --features tx-prover -- -D warnings |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: could we swap --features
and --exclude
places? i.e., so that it looks like:
cargo clippy --no-default-features --target wasm32-unknown-unknown --workspace --lib --features tx-prover --exclude miden-proving-service -- -D warnings
And do the same for other commands below.
.PHONY: install-proving-service-testing | ||
install-proving-service-testing: ## Install proving service's CLI intended for testing purposes | ||
cargo install --path bin/proving-service --bin miden-proving-service --locked --features concurrent,testing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As I mentioned in one of the other comments, I don't think this will be needed any longer.
This approach uses a single protobuf file placed in
miden-remote-provers/proto/
and replaced the name ofRemoteTransactionProverError
withRemoteProverError
in order of being used by other types of provers.It uses the feature
tx-prover
to activate theRemoteTransactionProver
, this is needed because we don't want to trigger theasync
feature for the whole workspace by default.The
miden-proving-service
now only generates the file for the std version of the api, since it doesn't support WASM.