Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
317 changes: 246 additions & 71 deletions Cargo.lock

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,8 @@ textwrap = "0.16"
tiny-bip39 = "1"
tokio = "1"
toml = "0.8"
tonic = { version = "0.9", default-features = false }
tonic-build = "0.9"
Comment on lines +345 to +346
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Version 0.9 is the one that works with prost 0.11

url = "2"
walkdir = "2"
wasm-bindgen = "0.2"
Expand Down
2 changes: 2 additions & 0 deletions api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,12 @@ mc-sgx-dcap-types = { workspace = true }

curve25519-dalek = { workspace = true }
prost = { workspace = true }
tonic = { workspace = true, features = ["codegen", "prost"] }

[build-dependencies]
mc-util-build-grpc = { workspace = true }
mc-util-build-script = { workspace = true }
tonic-build = { workspace = true }

cargo-emit = { workspace = true }

Expand Down
24 changes: 14 additions & 10 deletions api/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,18 @@ fn main() {
.expect("Invalid UTF-8 in proto dir");
cargo_emit::pair!("PROTOS_PATH", "{}", proto_str);

mc_util_build_grpc::compile_protos_and_generate_mod_rs(
&[proto_str],
&[
"blockchain.proto",
"external.proto",
"printable.proto",
"quorum_set.proto",
"watcher.proto",
],
);
let protos = [
"blockchain.proto",
"external.proto",
"printable.proto",
"quorum_set.proto",
"watcher.proto",
];

mc_util_build_grpc::compile_protos_and_generate_mod_rs(&[proto_str], &protos);

tonic_build::configure()
.protoc_arg("--experimental_allow_proto3_optional")
.compile(&protos, &[proto_str])
.expect("Failed to compile tonic gRPC definitions!");
}
9 changes: 9 additions & 0 deletions api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,15 @@ mod autogenerated_code {
// Include the auto-generated code.
include!(concat!(env!("OUT_DIR"), "/protos-auto-gen/mod.rs"));
}

pub mod tonic {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I figure push these into a tonic namespace to avoid conflicting with the pub use crate::{autogenerated_code::* below

tonic::include_proto!("blockchain");
tonic::include_proto!("external");
tonic::include_proto!("printable");
tonic::include_proto!("quorum_set");
tonic::include_proto!("watcher");
}

mod convert;

pub mod display;
Expand Down
4 changes: 3 additions & 1 deletion attest/api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,13 @@ aead = { workspace = true }
digest = { workspace = true }
futures = { workspace = true }
grpcio = { workspace = true, features = ["prost-codec"] }
prost = { workspace = true }
prost = { workspace = true, features = ["prost-derive"] }
tonic = { workspace = true, features = ["transport", "tls", "codegen", "prost"] }

[build-dependencies]
mc-util-build-grpc = { workspace = true }
mc-util-build-script = { workspace = true }
tonic-build = { workspace = true }

cargo-emit = { workspace = true }

Expand Down
9 changes: 8 additions & 1 deletion attest/api/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,12 @@ fn main() {
.expect("Invalid UTF-8 in proto dir path")
);

mc_util_build_grpc::compile_protos_and_generate_mod_rs(&["./proto"], &["attest.proto"]);
let protos = ["attest.proto"];

mc_util_build_grpc::compile_protos_and_generate_mod_rs(&["./proto"], &protos);

tonic_build::configure()
.protoc_arg("--experimental_allow_proto3_optional")
.compile(&protos, &["./proto"])
.expect("Failed to compile tonic gRPC definitions!");
}
4 changes: 4 additions & 0 deletions attest/api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,9 @@ mod autogenerated_code {
include!(concat!(env!("OUT_DIR"), "/protos-auto-gen/mod.rs"));
}

pub mod tonic {
tonic::include_proto!("attest");
}

pub mod convert;
pub use autogenerated_code::*;
2 changes: 2 additions & 0 deletions consensus/api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,12 @@ mc-transaction-core = { workspace = true }
futures = { workspace = true }
grpcio = { workspace = true, features = ["prost-codec"] }
prost = { workspace = true }
tonic = { workspace = true, features = ["transport", "tls", "codegen", "prost"] }

[build-dependencies]
mc-util-build-grpc = { workspace = true }
mc-util-build-script = { workspace = true }
tonic-build = { workspace = true }

cargo-emit = { workspace = true }

Expand Down
22 changes: 13 additions & 9 deletions consensus/api/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,17 @@ fn main() {
.to_owned();
all_proto_dirs.extend(api_proto_path.split(':').collect::<Vec<&str>>());

mc_util_build_grpc::compile_protos_and_generate_mod_rs(
all_proto_dirs.as_slice(),
&[
"consensus_client.proto",
"consensus_common.proto",
"consensus_config.proto",
"consensus_peer.proto",
],
);
let protos = [
"consensus_client.proto",
"consensus_common.proto",
"consensus_config.proto",
"consensus_peer.proto",
];

mc_util_build_grpc::compile_protos_and_generate_mod_rs(all_proto_dirs.as_slice(), &protos);

tonic_build::configure()
.protoc_arg("--experimental_allow_proto3_optional")
.compile(&protos, all_proto_dirs.as_slice())
.expect("Failed to compile tonic gRPC definitions!");
}
8 changes: 8 additions & 0 deletions consensus/api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,14 @@ mod autogenerated_code {
}
}

pub mod tonic {
pub use mc_attest_api::tonic as attest;
tonic::include_proto!("consensus_client");
tonic::include_proto!("consensus_common");
tonic::include_proto!("consensus_config");
tonic::include_proto!("consensus_peer");
}

pub mod conversions;

pub use autogenerated_code::*;
Expand Down
2 changes: 2 additions & 0 deletions fog/api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ displaydoc = { workspace = true }
futures = { workspace = true }
grpcio = { workspace = true, features = ["prost-codec"] }
prost = { workspace = true, features = ["prost-derive"] }
tonic = { workspace = true, features = ["codegen", "prost"] }

mc-api = { workspace = true }
mc-attest-api = { workspace = true }
Expand All @@ -34,6 +35,7 @@ mc-watcher-api = { workspace = true }
[build-dependencies]
mc-util-build-grpc = { workspace = true }
mc-util-build-script = { workspace = true }
tonic-build = { workspace = true }

cargo-emit = { workspace = true }

Expand Down
28 changes: 16 additions & 12 deletions fog/api/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,20 @@ fn main() {
.to_owned();
all_proto_dirs.extend(consensus_api_proto_path.split(':').collect::<Vec<&str>>());

mc_util_build_grpc::compile_protos_and_generate_mod_rs(
all_proto_dirs.as_slice(),
&[
"fog_common.proto",
"ingest.proto",
"ingest_common.proto",
"ingest_peer.proto",
"kex_rng.proto",
"ledger.proto",
"view.proto",
],
);
let protos = [
"fog_common.proto",
"ingest.proto",
"ingest_common.proto",
"ingest_peer.proto",
"kex_rng.proto",
"ledger.proto",
"view.proto",
];

mc_util_build_grpc::compile_protos_and_generate_mod_rs(all_proto_dirs.as_slice(), &protos);

tonic_build::configure()
.protoc_arg("--experimental_allow_proto3_optional")
.compile(&protos, all_proto_dirs.as_slice())
.expect("Failed to compile tonic gRPC definitions!");
}
11 changes: 11 additions & 0 deletions fog/api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,17 @@ mod autogenerated_code {
}
}

pub mod tonic {
#![allow(non_camel_case_types)]
tonic::include_proto!("fog_common");
tonic::include_proto!("account_ingest");
tonic::include_proto!("ingest_common");
tonic::include_proto!("ingest_peer");
tonic::include_proto!("kex_rng");
tonic::include_proto!("fog_ledger");
tonic::include_proto!("fog_view");
}

pub use autogenerated_code::*;

pub mod report_parse;
Expand Down
2 changes: 2 additions & 0 deletions fog/report/api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ rust-version = { workspace = true }
futures = { workspace = true }
grpcio = { workspace = true, features = ["prost-codec"] }
prost = { workspace = true, features = ["prost-derive"] }
tonic = { workspace = true, features = ["codegen", "prost"] }

mc-api = { workspace = true }
mc-attest-api = { workspace = true }
Expand All @@ -22,6 +23,7 @@ mc-fog-report-types = { workspace = true }
[build-dependencies]
mc-util-build-grpc = { workspace = true }
mc-util-build-script = { workspace = true }
tonic-build = { workspace = true }

cargo-emit = { workspace = true }

Expand Down
12 changes: 8 additions & 4 deletions fog/report/api/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,12 @@ fn main() {
.to_owned();
all_proto_dirs.extend(consensus_api_proto_path.split(':').collect::<Vec<&str>>());

mc_util_build_grpc::compile_protos_and_generate_mod_rs(
all_proto_dirs.as_slice(),
&["report.proto"],
);
let protos = ["report.proto"];

mc_util_build_grpc::compile_protos_and_generate_mod_rs(all_proto_dirs.as_slice(), &protos);

tonic_build::configure()
.protoc_arg("--experimental_allow_proto3_optional")
.compile(&protos, all_proto_dirs.as_slice())
.expect("Failed to compile tonic gRPC definitions!");
}
4 changes: 4 additions & 0 deletions fog/report/api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ mod autogenerated_code {
}
}

pub mod tonic {
tonic::include_proto!("report");
}

use crate::fog_report::report::AttestationEvidence as ProtoAttestationEvidence;
pub use autogenerated_code::*;
use mc_attest_verifier_types::{prost, VerificationReport};
Expand Down
2 changes: 2 additions & 0 deletions mobilecoind/api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,12 @@ mc-util-uri = { workspace = true }
futures = { workspace = true }
grpcio = { workspace = true, features = ["prost-codec"] }
prost = { workspace = true, features = ["prost-derive"] }
tonic = { workspace = true, features = ["codegen", "prost"] }

[build-dependencies]
mc-util-build-grpc = { workspace = true }
mc-util-build-script = { workspace = true }
tonic-build = { workspace = true }

cargo-emit = { workspace = true }

Expand Down
12 changes: 8 additions & 4 deletions mobilecoind/api/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,12 @@ fn main() {
.to_owned();
all_proto_dirs.extend(attest_api_proto_path.split(':'));

mc_util_build_grpc::compile_protos_and_generate_mod_rs(
all_proto_dirs.as_slice(),
&["mobilecoind_api.proto"],
);
let protos = ["mobilecoind_api.proto"];

mc_util_build_grpc::compile_protos_and_generate_mod_rs(all_proto_dirs.as_slice(), &protos);

tonic_build::configure()
.protoc_arg("--experimental_allow_proto3_optional")
.compile(&protos, all_proto_dirs.as_slice())
.expect("Failed to compile tonic gRPC definitions!");
}
4 changes: 4 additions & 0 deletions mobilecoind/api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ mod autogenerated_code {
}
}

pub mod tonic {
tonic::include_proto!("mobilecoind_api");
}

pub use autogenerated_code::{mobilecoind_api::*, *};

impl OutlayV2 {
Expand Down
2 changes: 2 additions & 0 deletions t3/api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@ rust-version = { workspace = true }
futures = { workspace = true }
grpcio = { workspace = true, features = ["prost-codec"] }
prost = { workspace = true }
tonic = { workspace = true, features = ["codegen", "prost"] }

mc-util-uri = { workspace = true }

[build-dependencies]
cargo-emit = { workspace = true }
mc-util-build-grpc = { workspace = true }
mc-util-build-script = { workspace = true }
tonic-build = { workspace = true }
12 changes: 8 additions & 4 deletions t3/api/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,12 @@ fn main() {
.expect("Invalid UTF-8 in proto dir");
cargo_emit::pair!("PROTOS_PATH", "{}", proto_str);

mc_util_build_grpc::compile_protos_and_generate_mod_rs(
&[proto_str],
&["external/v1/external.proto", "t3/v1/t3.proto"],
);
let protos = ["external/v1/external.proto", "t3/v1/t3.proto"];

mc_util_build_grpc::compile_protos_and_generate_mod_rs(&[proto_str], &protos);

tonic_build::configure()
.protoc_arg("--experimental_allow_proto3_optional")
.compile(&protos, &[proto_str])
.expect("Failed to compile tonic gRPC definitions!");
}
13 changes: 13 additions & 0 deletions t3/api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,19 @@ mod autogenerated_code {
}
}

pub mod tonic {
pub mod external {
pub mod v1 {
tonic::include_proto!("external.v1");
Comment on lines +18 to +21
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure on this nesting here, may need to wait until the actual tonic implementations of gRPC is done

}
}
pub mod t3 {
pub mod v1 {
tonic::include_proto!("t3.v1");
}
}
}

pub use autogenerated_code::{t3_v1::*, *};

pub type T3Uri = Uri<T3Scheme>;
Expand Down
Loading