Skip to content

Commit

Permalink
feat: remove rpc api client generation
Browse files Browse the repository at this point in the history
  • Loading branch information
TomasArrachea committed Feb 28, 2025
1 parent 977a88e commit 9879a40
Show file tree
Hide file tree
Showing 9 changed files with 50 additions and 398 deletions.
2 changes: 1 addition & 1 deletion bin/faucet/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ clap = { version = "4.5", features = ["derive", "string"] }
http = "1.1"
http-body-util = "0.1"
miden-lib = { workspace = true }
miden-node-proto = { workspace = true }
miden-node-proto = { workspace = true, features = ["rpc-client"] }
miden-node-utils = { workspace = true }
miden-objects = { workspace = true }
miden-tx = { workspace = true, features = ["concurrent"] }
Expand Down
2 changes: 1 addition & 1 deletion bin/faucet/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use miden_node_proto::generated::{
requests::{
GetAccountDetailsRequest, GetBlockHeaderByNumberRequest, SubmitProvenTransactionRequest,
},
rpc::api_client::ApiClient,
api_client::ApiClient,
};
use miden_objects::{
account::{Account, AccountFile, AccountId, AuthSecretKey},
Expand Down
3 changes: 3 additions & 0 deletions crates/proto/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ repository.workspace = true
rust-version.workspace = true
version.workspace = true

[features]
rpc-client = []

[lints]
workspace = true

Expand Down
22 changes: 21 additions & 1 deletion crates/proto/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,25 @@ fn main() -> anyhow::Result<()> {
let protos = &[
proto_dir.join("block_producer.proto"),
proto_dir.join("store.proto"),
];
let includes = &[proto_dir.clone()];
let file_descriptors = protox::compile(protos, includes)?;
fs::write(&file_descriptor_path, file_descriptors.encode_to_vec())
.context("writing file descriptors")?;

let mut prost_config = prost_build::Config::new();
prost_config.skip_debug(["AccountId", "Digest"]);

// Generate the stub of the user facing server from its proto file
tonic_build::configure()
.file_descriptor_set_path(&file_descriptor_path)
.skip_protoc_run()
.out_dir(&dst_dir)
.compile_protos_with_config(prost_config, protos, includes)
.context("compiling protobufs")?;

// Compile the proto file for all servers APIs
let protos = &[
proto_dir.join("rpc.proto"),
];
let includes = &[proto_dir];
Expand All @@ -54,9 +73,10 @@ fn main() -> anyhow::Result<()> {

let mut prost_config = prost_build::Config::new();
prost_config.skip_debug(["AccountId", "Digest"]);

// Generate the stub of the user facing server from its proto file
tonic_build::configure()
.build_client(false)
.file_descriptor_set_path(&file_descriptor_path)
.skip_protoc_run()
.out_dir(&dst_dir)
Expand Down
3 changes: 1 addition & 2 deletions crates/proto/src/generated/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ pub mod mmr;
pub mod note;
pub mod requests;
pub mod responses;
mod rpc;
pub use rpc::api_server;
pub mod rpc;
pub mod smt;
pub mod store;
pub mod transaction;
Loading

0 comments on commit 9879a40

Please sign in to comment.