Skip to content

Commit 5569d6c

Browse files
psiveselyromac
authored andcommitted
Update to support rust-protobuf v1.6.0
* Updated `proto/proof.rs` using the latest stable protoc (3.5.1) and protoc-gen-rust plugin (1.6.0). * I had to make a tiny manual modification to `proto/proof.rs`. On line 298 I added derivation of `Debug` in order to satisfy the lint directive in `lib.rs`. * `bytes` protobuf fields are empty if the message doesn't contain the corresponding element, so since methods are no longer provided to directly check, we use `is_empty()` on the corresponding struct fields.
1 parent bb2991d commit 5569d6c

File tree

3 files changed

+205
-275
lines changed

3 files changed

+205
-275
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ categories = ["data-structures", "cryptography"]
1919

2020
[dependencies]
2121
ring = "^0.12.0"
22-
protobuf = { version = "^1.4.0", optional = true }
22+
protobuf = { version = "^1.6.0", optional = true }
2323

2424
[features]
2525
serialization-protobuf = [ "protobuf" ]

src/proto/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ pub use self::proof::{ProofProto, LemmaProto};
88

99
use protobuf::Message;
1010
use protobuf::error::ProtobufResult;
11-
use protobuf::core::parse_from_bytes;
11+
use protobuf::parse_from_bytes;
1212

1313
impl<T> Proof<T> {
1414
/// Constructs a `Proof` struct from its Protobuf representation.
@@ -80,7 +80,7 @@ impl ProofProto {
8080
T: From<Vec<u8>>,
8181
{
8282

83-
if !self.has_root_hash() || !self.has_lemma() {
83+
if self.root_hash.is_empty() || !self.has_lemma() {
8484
return None;
8585
}
8686

@@ -125,7 +125,7 @@ impl LemmaProto {
125125
}
126126

127127
pub fn into_lemma(mut self) -> Option<Lemma> {
128-
if !self.has_node_hash() {
128+
if self.node_hash.is_empty() {
129129
return None;
130130
}
131131

0 commit comments

Comments
 (0)