Skip to content

Commit

Permalink
proto: Add missing serde derives on Protobuf definitions (#1389)
Browse files Browse the repository at this point in the history
* Cleanup

* Add missing serde derives on some Protobuf definitions

* Remove redundant use of `num-traits::ToPrimitive` for `BlockIDFlag`

* Fix warning

* Add changelog entry
  • Loading branch information
romac committed Apr 5, 2024
1 parent f11a1be commit c90bf9c
Show file tree
Hide file tree
Showing 19 changed files with 618 additions and 399 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- `[tendermint-proto]` Remove redundant impl of `num_traits::ToPrimitive` for `BlockIDFlag`
([\#1389](https://github.com/informalsystems/tendermint-rs/pull/1389))
2 changes: 2 additions & 0 deletions .changelog/unreleased/features/1389-missing-serde-derives.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- `[tendermint-proto]` Add missing `serde` derives on Protobuf definitions
([\#1389](https://github.com/informalsystems/tendermint-rs/pull/1389))
2 changes: 0 additions & 2 deletions proto/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ bytes = { version = "1.0", default-features = false, features = ["serde"]}
serde = { version = "1.0", default-features = false, features = ["derive"] }
serde_bytes = { version = "0.11", default-features = false, features = ["alloc"] }
subtle-encoding = { version = "0.5", default-features = false, features = ["hex", "base64", "alloc"] }
num-traits = { version = "0.2", default-features = false }
num-derive = { version = "0.4", default-features = false }
time = { version = "0.3", default-features = false, features = ["macros", "parsing"] }
flex-error = { version = "0.4.4", default-features = false }
tonic = { version = "0.10", optional = true }
Expand Down
25 changes: 11 additions & 14 deletions proto/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,32 +7,29 @@

extern crate alloc;

mod prelude;

/// Built-in prost_types with slight customization to enable JSON-encoding
#[allow(warnings)]
pub mod google {
pub mod protobuf {
// custom Timeout and Duration types that have valid doctest documentation texts
include!("protobuf.rs");
}
}

mod error;
#[allow(warnings)]
mod prelude;
mod tendermint;

use bytes::{Buf, BufMut};
use core::fmt::Display;
use prost::Message;

use bytes::{Buf, BufMut};
pub use error::Error;
use prost::Message;
pub use tendermint::*;

pub mod serializers;

use prelude::*;

/// Built-in prost_types with slight customization to enable JSON-encoding
pub mod google {
pub mod protobuf {
// custom Timeout and Duration types that have valid doctest documentation texts
include!("protobuf.rs");
}
}

/// Allows for easy Google Protocol Buffers encoding and decoding of domain
/// types with validation.
///
Expand Down
5 changes: 3 additions & 2 deletions proto/src/prelude.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
// Re-export according to alloc::prelude::v1 because it is not yet stabilized
// https://doc.rust-lang.org/src/alloc/prelude/v1.rs.html

#[allow(unused_imports)]
pub use alloc::vec;
#![allow(unused_imports)]

pub use alloc::{
format,
string::{String, ToString},
vec,
vec::Vec,
};
pub use core::prelude::v1::*;
Loading

0 comments on commit c90bf9c

Please sign in to comment.