Skip to content

Commit

Permalink
network: use codec from mysten-infra
Browse files Browse the repository at this point in the history
  • Loading branch information
bmwill committed May 10, 2022
1 parent e403158 commit 5456518
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 84 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

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

2 changes: 2 additions & 0 deletions crates/sui-network/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,7 @@ bincode = "1.3.3"
serde = "1.0.136"
sui-types = { path = "../../sui_types" }

mysten-network = { git = "https://github.com/MystenLabs/mysten-infra", rev = "3b7daedf91fd8937dde26e905b8114cac459b866" }

[dev-dependencies]
tonic-build = { git = "https://github.com/hyperium/tonic.git", rev = "de2e4ac077c076736dc451f3415ea7da1a61a560", default-features = false, features = [ "transport" ] }
68 changes: 0 additions & 68 deletions crates/sui-network/src/codec.rs

This file was deleted.

28 changes: 14 additions & 14 deletions crates/sui-network/src/generated/sui.validator.Validator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ pub mod validator_client {
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = crate::codec::BincodeCodec::default();
let codec = mysten_network::codec::BincodeCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/sui.validator.Validator/Transaction",
);
Expand All @@ -103,7 +103,7 @@ pub mod validator_client {
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = crate::codec::BincodeCodec::default();
let codec = mysten_network::codec::BincodeCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/sui.validator.Validator/ConfirmationTransaction",
);
Expand All @@ -125,7 +125,7 @@ pub mod validator_client {
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = crate::codec::BincodeCodec::default();
let codec = mysten_network::codec::BincodeCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/sui.validator.Validator/ConsensusTransaction",
);
Expand All @@ -147,7 +147,7 @@ pub mod validator_client {
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = crate::codec::BincodeCodec::default();
let codec = mysten_network::codec::BincodeCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/sui.validator.Validator/AccountInfo",
);
Expand All @@ -169,7 +169,7 @@ pub mod validator_client {
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = crate::codec::BincodeCodec::default();
let codec = mysten_network::codec::BincodeCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/sui.validator.Validator/ObjectInfo",
);
Expand All @@ -191,7 +191,7 @@ pub mod validator_client {
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = crate::codec::BincodeCodec::default();
let codec = mysten_network::codec::BincodeCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/sui.validator.Validator/TransactionInfo",
);
Expand All @@ -215,7 +215,7 @@ pub mod validator_client {
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = crate::codec::BincodeCodec::default();
let codec = mysten_network::codec::BincodeCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/sui.validator.Validator/BatchInfo",
);
Expand Down Expand Up @@ -358,7 +358,7 @@ pub mod validator_server {
let fut = async move {
let inner = inner.0;
let method = TransactionSvc(inner);
let codec = crate::codec::BincodeCodec::default();
let codec = mysten_network::codec::BincodeCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
Expand Down Expand Up @@ -401,7 +401,7 @@ pub mod validator_server {
let fut = async move {
let inner = inner.0;
let method = ConfirmationTransactionSvc(inner);
let codec = crate::codec::BincodeCodec::default();
let codec = mysten_network::codec::BincodeCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
Expand Down Expand Up @@ -444,7 +444,7 @@ pub mod validator_server {
let fut = async move {
let inner = inner.0;
let method = ConsensusTransactionSvc(inner);
let codec = crate::codec::BincodeCodec::default();
let codec = mysten_network::codec::BincodeCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
Expand Down Expand Up @@ -487,7 +487,7 @@ pub mod validator_server {
let fut = async move {
let inner = inner.0;
let method = AccountInfoSvc(inner);
let codec = crate::codec::BincodeCodec::default();
let codec = mysten_network::codec::BincodeCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
Expand Down Expand Up @@ -527,7 +527,7 @@ pub mod validator_server {
let fut = async move {
let inner = inner.0;
let method = ObjectInfoSvc(inner);
let codec = crate::codec::BincodeCodec::default();
let codec = mysten_network::codec::BincodeCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
Expand Down Expand Up @@ -570,7 +570,7 @@ pub mod validator_server {
let fut = async move {
let inner = inner.0;
let method = TransactionInfoSvc(inner);
let codec = crate::codec::BincodeCodec::default();
let codec = mysten_network::codec::BincodeCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
Expand Down Expand Up @@ -612,7 +612,7 @@ pub mod validator_server {
let fut = async move {
let inner = inner.0;
let method = BatchInfoSvc(inner);
let codec = crate::codec::BincodeCodec::default();
let codec = mysten_network::codec::BincodeCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
Expand Down
1 change: 0 additions & 1 deletion crates/sui-network/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,5 @@
// SPDX-License-Identifier: Apache-2.0

pub mod api;
pub mod codec;

pub use tonic;
2 changes: 1 addition & 1 deletion crates/sui-network/tests/bootstrap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ fn bootstrap() {
let out_dir = PathBuf::from(std::env!("CARGO_MANIFEST_DIR"))
.join("src")
.join("generated");
let codec_path = "crate::codec::BincodeCodec";
let codec_path = "mysten_network::codec::BincodeCodec";

let validator_service = Service::builder()
.name("Validator")
Expand Down

0 comments on commit 5456518

Please sign in to comment.