diff --git a/.gitignore b/.gitignore index 1e7caa9..abc3f23 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ Cargo.lock target/ +src/proto/proof.rs diff --git a/.travis.yml b/.travis.yml index 1b4c6b2..8a9db40 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,9 @@ language: rust -cache: cargo # https://docs.travis-ci.com/user/caching/#Rust-Cargo-cache +cache: + directories: + - $HOME/protobuf + - $HOME/.cargo + - $TRAVIS_BUILD_DIR/target rust: - stable @@ -15,12 +19,23 @@ matrix: include: - env: NAME='nightly' rust: nightly - - env: NAME='rustfmt' + - env: + - NAME='rustfmt' + - PROTOBUF_CODEGEN_VERSION=2.0.0 + - PATH=$PATH:$HOME/.cargo/bin:$HOME/protobuf/bin rust: nightly before_script: - rustup component add rustfmt-preview + # Protoc plugin needed to generate proof.rs from proof.proto + - cargo install protobuf-codegen --version $PROTOBUF_CODEGEN_VERSION || echo "protobuf-codegen already installed" + # TODO: see if we can avoid installing protobuf-codegen and generating + # proof.rs in this build by using rustfmt options (see + # https://github.com/SpinResearch/merkle.rs/pull/38#issuecomment-391336829, + # paragraph 2). + - protoc --version + - protoc --rust_out src/proto/ protobuf/proof.proto script: - - cargo fmt --all -- --write-mode=diff + - cargo fmt --all -- --check - env: NAME='kcov' sudo: required # travis-ci/travis-ci#9061 before_script: @@ -57,3 +72,7 @@ script: - cargo build --verbose --all-features - cargo test --verbose --all-features - cargo doc --verbose --all-features --no-deps + +before_install: + - export PATH=$PATH:$HOME/protobuf/bin + - bash install_protobuf.sh diff --git a/Cargo.toml b/Cargo.toml index eed73cc..ece70a0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -19,15 +19,18 @@ categories = ["data-structures", "cryptography"] [dependencies] ring = "^0.12.0" -protobuf = { version = "^1.6.0", optional = true } +protobuf = { version = "1.7.1", optional = true } serde = { version = "^1.0.55", optional = true } serde_derive = { version = "^1.0.55", optional = true } +[build-dependencies] +protoc-rust = { version = "1.7.1", optional = true } + [dev-dependencies] serde_json = "1.0.17" [features] -serialization-protobuf = [ "protobuf" ] +serialization-protobuf = [ "protobuf", "protoc-rust" ] serialization-serde = [ "serde", "serde_derive" ] [package.metadata.release] diff --git a/build.rs b/build.rs new file mode 100644 index 0000000..85a2548 --- /dev/null +++ b/build.rs @@ -0,0 +1,41 @@ +#[cfg(feature = "serialization-protobuf")] +extern crate protoc_rust; + +#[cfg(feature = "serialization-protobuf")] +fn assert_protobuf_version(version: &str) { + use std::process::{Command, Stdio}; + let protoc = Command::new("protoc") + .stdin(Stdio::null()) + .stdout(Stdio::piped()) + .stderr(Stdio::piped()) + .args(&["--version"]) + .spawn() + .unwrap(); + let version_output = protoc.wait_with_output().unwrap(); + assert!(version_output.status.success()); + assert_eq!( + String::from_utf8(version_output.stdout).unwrap().trim(), + version + ); +} + +#[cfg(feature = "serialization-protobuf")] +fn build_protobuf(out_dir: &str, input: &[&str], includes: &[&str]) { + use self::protoc_rust::{run, Args}; + run(Args { + out_dir, + input, + includes, + }).expect("protoc"); +} + +#[cfg(feature = "serialization-protobuf")] +fn build_protobuf_schemata() { + assert_protobuf_version("libprotoc 3.5.1"); + build_protobuf("src/proto", &["protobuf/proof.proto"], &[]); +} + +fn main() { + #[cfg(feature = "serialization-protobuf")] + build_protobuf_schemata(); +} diff --git a/install_protobuf.sh b/install_protobuf.sh new file mode 100644 index 0000000..0a1432a --- /dev/null +++ b/install_protobuf.sh @@ -0,0 +1,22 @@ +#!/usr/bin/bash +set -e + +check_protoc_version () { + version="libprotoc $1" + PROTOC="$HOME/protobuf/bin/protoc" + if [ -f $PROTOC ]; then + this_version=`$PROTOC --version` + return `[ "$version" = "$this_version" ]` + else + return 1 + fi +} + +if check_protoc_version '3.5.1'; then + echo protoc version 3.5.1 detected. + exit +fi + +wget https://github.com/google/protobuf/archive/v3.5.1.tar.gz +tar -xzvf v3.5.1.tar.gz +cd protobuf-3.5.1 && ./autogen.sh && ./configure --prefix=$HOME/protobuf && make && make install diff --git a/rustfmt.toml b/rustfmt.toml new file mode 100644 index 0000000..1e05b32 --- /dev/null +++ b/rustfmt.toml @@ -0,0 +1,3 @@ +ignore = [ + "src/proto/proof.rs", +] diff --git a/src/merkletree.rs b/src/merkletree.rs index 6967fbd..c2e3b00 100644 --- a/src/merkletree.rs +++ b/src/merkletree.rs @@ -28,7 +28,9 @@ pub struct MerkleTree { impl PartialEq for MerkleTree { #[allow(trivial_casts)] fn eq(&self, other: &MerkleTree) -> bool { - self.root == other.root && self.height == other.height && self.count == other.count + self.root == other.root + && self.height == other.height + && self.count == other.count && (self.algorithm as *const Algorithm) == (other.algorithm as *const Algorithm) } } diff --git a/src/proto/proof.rs b/src/proto/proof.rs deleted file mode 100644 index ead127b..0000000 --- a/src/proto/proof.rs +++ /dev/null @@ -1,709 +0,0 @@ -// This file is generated by rust-protobuf 1.6.0. Do not edit -// @generated - -// https://github.com/Manishearth/rust-clippy/issues/702 -#![allow(unknown_lints)] -#![allow(clippy)] - -#![cfg_attr(rustfmt, rustfmt_skip)] - -#![allow(box_pointers)] -#![allow(dead_code)] -#![allow(missing_docs)] -#![allow(non_camel_case_types)] -#![allow(non_snake_case)] -#![allow(non_upper_case_globals)] -#![allow(trivial_casts)] -#![allow(unsafe_code)] -#![allow(unused_imports)] -#![allow(unused_results)] - -use protobuf::Message as Message_imported_for_functions; -use protobuf::ProtobufEnum as ProtobufEnum_imported_for_functions; - -#[derive(PartialEq,Clone,Default)] -pub struct ProofProto { - // message fields - pub root_hash: ::std::vec::Vec, - pub lemma: ::protobuf::SingularPtrField, - pub value: ::std::vec::Vec, - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -impl ProofProto { - pub fn new() -> ProofProto { - ::std::default::Default::default() - } - - // bytes root_hash = 1; - - pub fn clear_root_hash(&mut self) { - self.root_hash.clear(); - } - - // Param is passed by value, moved - pub fn set_root_hash(&mut self, v: ::std::vec::Vec) { - self.root_hash = v; - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_root_hash(&mut self) -> &mut ::std::vec::Vec { - &mut self.root_hash - } - - // Take field - pub fn take_root_hash(&mut self) -> ::std::vec::Vec { - ::std::mem::replace(&mut self.root_hash, ::std::vec::Vec::new()) - } - - pub fn get_root_hash(&self) -> &[u8] { - &self.root_hash - } - - // .LemmaProto lemma = 2; - - pub fn clear_lemma(&mut self) { - self.lemma.clear(); - } - - pub fn has_lemma(&self) -> bool { - self.lemma.is_some() - } - - // Param is passed by value, moved - pub fn set_lemma(&mut self, v: LemmaProto) { - self.lemma = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_lemma(&mut self) -> &mut LemmaProto { - if self.lemma.is_none() { - self.lemma.set_default(); - } - self.lemma.as_mut().unwrap() - } - - // Take field - pub fn take_lemma(&mut self) -> LemmaProto { - self.lemma.take().unwrap_or_else(|| LemmaProto::new()) - } - - pub fn get_lemma(&self) -> &LemmaProto { - self.lemma.as_ref().unwrap_or_else(|| LemmaProto::default_instance()) - } - - // bytes value = 3; - - pub fn clear_value(&mut self) { - self.value.clear(); - } - - // Param is passed by value, moved - pub fn set_value(&mut self, v: ::std::vec::Vec) { - self.value = v; - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_value(&mut self) -> &mut ::std::vec::Vec { - &mut self.value - } - - // Take field - pub fn take_value(&mut self) -> ::std::vec::Vec { - ::std::mem::replace(&mut self.value, ::std::vec::Vec::new()) - } - - pub fn get_value(&self) -> &[u8] { - &self.value - } -} - -impl ::protobuf::Message for ProofProto { - fn is_initialized(&self) -> bool { - for v in &self.lemma { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_singular_proto3_bytes_into(wire_type, is, &mut self.root_hash)?; - }, - 2 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.lemma)?; - }, - 3 => { - ::protobuf::rt::read_singular_proto3_bytes_into(wire_type, is, &mut self.value)?; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if !self.root_hash.is_empty() { - my_size += ::protobuf::rt::bytes_size(1, &self.root_hash); - } - if let Some(ref v) = self.lemma.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - if !self.value.is_empty() { - my_size += ::protobuf::rt::bytes_size(3, &self.value); - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if !self.root_hash.is_empty() { - os.write_bytes(1, &self.root_hash)?; - } - if let Some(ref v) = self.lemma.as_ref() { - os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - if !self.value.is_empty() { - os.write_bytes(3, &self.value)?; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - Self::descriptor_static() - } - - fn new() -> ProofProto { - ProofProto::new() - } - - fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( - "root_hash", - |m: &ProofProto| { &m.root_hash }, - |m: &mut ProofProto| { &mut m.root_hash }, - )); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "lemma", - |m: &ProofProto| { &m.lemma }, - |m: &mut ProofProto| { &mut m.lemma }, - )); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( - "value", - |m: &ProofProto| { &m.value }, - |m: &mut ProofProto| { &mut m.value }, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "ProofProto", - fields, - file_descriptor_proto() - ) - }) - } - } - - fn default_instance() -> &'static ProofProto { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ProofProto, - }; - unsafe { - instance.get(ProofProto::new) - } - } -} - -impl ::protobuf::Clear for ProofProto { - fn clear(&mut self) { - self.clear_root_hash(); - self.clear_lemma(); - self.clear_value(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for ProofProto { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for ProofProto { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct LemmaProto { - // message fields - pub node_hash: ::std::vec::Vec, - pub sub_lemma: ::protobuf::SingularPtrField, - // message oneof groups - pub sibling_hash: ::std::option::Option, - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -#[derive(Clone,Debug,PartialEq)] -pub enum LemmaProto_oneof_sibling_hash { - left_sibling_hash(::std::vec::Vec), - right_sibling_hash(::std::vec::Vec), -} - -impl LemmaProto { - pub fn new() -> LemmaProto { - ::std::default::Default::default() - } - - // bytes node_hash = 1; - - pub fn clear_node_hash(&mut self) { - self.node_hash.clear(); - } - - // Param is passed by value, moved - pub fn set_node_hash(&mut self, v: ::std::vec::Vec) { - self.node_hash = v; - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_node_hash(&mut self) -> &mut ::std::vec::Vec { - &mut self.node_hash - } - - // Take field - pub fn take_node_hash(&mut self) -> ::std::vec::Vec { - ::std::mem::replace(&mut self.node_hash, ::std::vec::Vec::new()) - } - - pub fn get_node_hash(&self) -> &[u8] { - &self.node_hash - } - - // .LemmaProto sub_lemma = 2; - - pub fn clear_sub_lemma(&mut self) { - self.sub_lemma.clear(); - } - - pub fn has_sub_lemma(&self) -> bool { - self.sub_lemma.is_some() - } - - // Param is passed by value, moved - pub fn set_sub_lemma(&mut self, v: LemmaProto) { - self.sub_lemma = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_sub_lemma(&mut self) -> &mut LemmaProto { - if self.sub_lemma.is_none() { - self.sub_lemma.set_default(); - } - self.sub_lemma.as_mut().unwrap() - } - - // Take field - pub fn take_sub_lemma(&mut self) -> LemmaProto { - self.sub_lemma.take().unwrap_or_else(|| LemmaProto::new()) - } - - pub fn get_sub_lemma(&self) -> &LemmaProto { - self.sub_lemma.as_ref().unwrap_or_else(|| LemmaProto::default_instance()) - } - - // bytes left_sibling_hash = 3; - - pub fn clear_left_sibling_hash(&mut self) { - self.sibling_hash = ::std::option::Option::None; - } - - pub fn has_left_sibling_hash(&self) -> bool { - match self.sibling_hash { - ::std::option::Option::Some(LemmaProto_oneof_sibling_hash::left_sibling_hash(..)) => true, - _ => false, - } - } - - // Param is passed by value, moved - pub fn set_left_sibling_hash(&mut self, v: ::std::vec::Vec) { - self.sibling_hash = ::std::option::Option::Some(LemmaProto_oneof_sibling_hash::left_sibling_hash(v)) - } - - // Mutable pointer to the field. - pub fn mut_left_sibling_hash(&mut self) -> &mut ::std::vec::Vec { - if let ::std::option::Option::Some(LemmaProto_oneof_sibling_hash::left_sibling_hash(_)) = self.sibling_hash { - } else { - self.sibling_hash = ::std::option::Option::Some(LemmaProto_oneof_sibling_hash::left_sibling_hash(::std::vec::Vec::new())); - } - match self.sibling_hash { - ::std::option::Option::Some(LemmaProto_oneof_sibling_hash::left_sibling_hash(ref mut v)) => v, - _ => panic!(), - } - } - - // Take field - pub fn take_left_sibling_hash(&mut self) -> ::std::vec::Vec { - if self.has_left_sibling_hash() { - match self.sibling_hash.take() { - ::std::option::Option::Some(LemmaProto_oneof_sibling_hash::left_sibling_hash(v)) => v, - _ => panic!(), - } - } else { - ::std::vec::Vec::new() - } - } - - pub fn get_left_sibling_hash(&self) -> &[u8] { - match self.sibling_hash { - ::std::option::Option::Some(LemmaProto_oneof_sibling_hash::left_sibling_hash(ref v)) => v, - _ => &[], - } - } - - // bytes right_sibling_hash = 4; - - pub fn clear_right_sibling_hash(&mut self) { - self.sibling_hash = ::std::option::Option::None; - } - - pub fn has_right_sibling_hash(&self) -> bool { - match self.sibling_hash { - ::std::option::Option::Some(LemmaProto_oneof_sibling_hash::right_sibling_hash(..)) => true, - _ => false, - } - } - - // Param is passed by value, moved - pub fn set_right_sibling_hash(&mut self, v: ::std::vec::Vec) { - self.sibling_hash = ::std::option::Option::Some(LemmaProto_oneof_sibling_hash::right_sibling_hash(v)) - } - - // Mutable pointer to the field. - pub fn mut_right_sibling_hash(&mut self) -> &mut ::std::vec::Vec { - if let ::std::option::Option::Some(LemmaProto_oneof_sibling_hash::right_sibling_hash(_)) = self.sibling_hash { - } else { - self.sibling_hash = ::std::option::Option::Some(LemmaProto_oneof_sibling_hash::right_sibling_hash(::std::vec::Vec::new())); - } - match self.sibling_hash { - ::std::option::Option::Some(LemmaProto_oneof_sibling_hash::right_sibling_hash(ref mut v)) => v, - _ => panic!(), - } - } - - // Take field - pub fn take_right_sibling_hash(&mut self) -> ::std::vec::Vec { - if self.has_right_sibling_hash() { - match self.sibling_hash.take() { - ::std::option::Option::Some(LemmaProto_oneof_sibling_hash::right_sibling_hash(v)) => v, - _ => panic!(), - } - } else { - ::std::vec::Vec::new() - } - } - - pub fn get_right_sibling_hash(&self) -> &[u8] { - match self.sibling_hash { - ::std::option::Option::Some(LemmaProto_oneof_sibling_hash::right_sibling_hash(ref v)) => v, - _ => &[], - } - } -} - -impl ::protobuf::Message for LemmaProto { - fn is_initialized(&self) -> bool { - for v in &self.sub_lemma { - if !v.is_initialized() { - return false; - } - }; - true - } - - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_singular_proto3_bytes_into(wire_type, is, &mut self.node_hash)?; - }, - 2 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.sub_lemma)?; - }, - 3 => { - if wire_type != ::protobuf::wire_format::WireTypeLengthDelimited { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - self.sibling_hash = ::std::option::Option::Some(LemmaProto_oneof_sibling_hash::left_sibling_hash(is.read_bytes()?)); - }, - 4 => { - if wire_type != ::protobuf::wire_format::WireTypeLengthDelimited { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - self.sibling_hash = ::std::option::Option::Some(LemmaProto_oneof_sibling_hash::right_sibling_hash(is.read_bytes()?)); - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; - } - ::std::result::Result::Ok(()) - } - - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if !self.node_hash.is_empty() { - my_size += ::protobuf::rt::bytes_size(1, &self.node_hash); - } - if let Some(ref v) = self.sub_lemma.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - if let ::std::option::Option::Some(ref v) = self.sibling_hash { - match v { - &LemmaProto_oneof_sibling_hash::left_sibling_hash(ref v) => { - my_size += ::protobuf::rt::bytes_size(3, &v); - }, - &LemmaProto_oneof_sibling_hash::right_sibling_hash(ref v) => { - my_size += ::protobuf::rt::bytes_size(4, &v); - }, - }; - } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { - if !self.node_hash.is_empty() { - os.write_bytes(1, &self.node_hash)?; - } - if let Some(ref v) = self.sub_lemma.as_ref() { - os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - if let ::std::option::Option::Some(ref v) = self.sibling_hash { - match v { - &LemmaProto_oneof_sibling_hash::left_sibling_hash(ref v) => { - os.write_bytes(3, v)?; - }, - &LemmaProto_oneof_sibling_hash::right_sibling_hash(ref v) => { - os.write_bytes(4, v)?; - }, - }; - } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) - } - - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - Self::descriptor_static() - } - - fn new() -> LemmaProto { - LemmaProto::new() - } - - fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( - "node_hash", - |m: &LemmaProto| { &m.node_hash }, - |m: &mut LemmaProto| { &mut m.node_hash }, - )); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "sub_lemma", - |m: &LemmaProto| { &m.sub_lemma }, - |m: &mut LemmaProto| { &mut m.sub_lemma }, - )); - fields.push(::protobuf::reflect::accessor::make_singular_bytes_accessor::<_>( - "left_sibling_hash", - LemmaProto::has_left_sibling_hash, - LemmaProto::get_left_sibling_hash, - )); - fields.push(::protobuf::reflect::accessor::make_singular_bytes_accessor::<_>( - "right_sibling_hash", - LemmaProto::has_right_sibling_hash, - LemmaProto::get_right_sibling_hash, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "LemmaProto", - fields, - file_descriptor_proto() - ) - }) - } - } - - fn default_instance() -> &'static LemmaProto { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const LemmaProto, - }; - unsafe { - instance.get(LemmaProto::new) - } - } -} - -impl ::protobuf::Clear for LemmaProto { - fn clear(&mut self) { - self.clear_node_hash(); - self.clear_sub_lemma(); - self.clear_left_sibling_hash(); - self.clear_right_sibling_hash(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for LemmaProto { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for LemmaProto { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -static file_descriptor_proto_data: &'static [u8] = b"\ - \n\x0bproof.proto\"b\n\nProofProto\x12\x1b\n\troot_hash\x18\x01\x20\x01(\ - \x0cR\x08rootHash\x12!\n\x05lemma\x18\x02\x20\x01(\x0b2\x0b.LemmaProtoR\ - \x05lemma\x12\x14\n\x05value\x18\x03\x20\x01(\x0cR\x05value\"\xc1\x01\n\ - \nLemmaProto\x12\x1b\n\tnode_hash\x18\x01\x20\x01(\x0cR\x08nodeHash\x12(\ - \n\tsub_lemma\x18\x02\x20\x01(\x0b2\x0b.LemmaProtoR\x08subLemma\x12,\n\ - \x11left_sibling_hash\x18\x03\x20\x01(\x0cH\0R\x0fleftSiblingHash\x12.\n\ - \x12right_sibling_hash\x18\x04\x20\x01(\x0cH\0R\x10rightSiblingHashB\x0e\ - \n\x0csibling_hashJ\xaa\x04\n\x06\x12\x04\x01\0\x12\x01\n\x08\n\x01\x0c\ - \x12\x03\x01\0\x12\n\n\n\x02\x04\0\x12\x04\x03\0\x07\x01\n\n\n\x03\x04\0\ - \x01\x12\x03\x03\x08\x12\n\x0b\n\x04\x04\0\x02\0\x12\x03\x04\x02\x16\n\r\ - \n\x05\x04\0\x02\0\x04\x12\x04\x04\x02\x03\x14\n\x0c\n\x05\x04\0\x02\0\ - \x05\x12\x03\x04\x02\x07\n\x0c\n\x05\x04\0\x02\0\x01\x12\x03\x04\x08\x11\ - \n\x0c\n\x05\x04\0\x02\0\x03\x12\x03\x04\x14\x15\n\x0b\n\x04\x04\0\x02\ - \x01\x12\x03\x05\x02\x17\n\r\n\x05\x04\0\x02\x01\x04\x12\x04\x05\x02\x04\ - \x16\n\x0c\n\x05\x04\0\x02\x01\x06\x12\x03\x05\x02\x0c\n\x0c\n\x05\x04\0\ - \x02\x01\x01\x12\x03\x05\r\x12\n\x0c\n\x05\x04\0\x02\x01\x03\x12\x03\x05\ - \x15\x16\n\x0b\n\x04\x04\0\x02\x02\x12\x03\x06\x02\x12\n\r\n\x05\x04\0\ - \x02\x02\x04\x12\x04\x06\x02\x05\x17\n\x0c\n\x05\x04\0\x02\x02\x05\x12\ - \x03\x06\x02\x07\n\x0c\n\x05\x04\0\x02\x02\x01\x12\x03\x06\x08\r\n\x0c\n\ - \x05\x04\0\x02\x02\x03\x12\x03\x06\x10\x11\n\n\n\x02\x04\x01\x12\x04\t\0\ - \x12\x01\n\n\n\x03\x04\x01\x01\x12\x03\t\x08\x12\n\x0b\n\x04\x04\x01\x02\ - \0\x12\x03\n\x02\x16\n\r\n\x05\x04\x01\x02\0\x04\x12\x04\n\x02\t\x14\n\ - \x0c\n\x05\x04\x01\x02\0\x05\x12\x03\n\x02\x07\n\x0c\n\x05\x04\x01\x02\0\ - \x01\x12\x03\n\x08\x11\n\x0c\n\x05\x04\x01\x02\0\x03\x12\x03\n\x14\x15\n\ - \x0b\n\x04\x04\x01\x02\x01\x12\x03\x0b\x02\x1b\n\r\n\x05\x04\x01\x02\x01\ - \x04\x12\x04\x0b\x02\n\x16\n\x0c\n\x05\x04\x01\x02\x01\x06\x12\x03\x0b\ - \x02\x0c\n\x0c\n\x05\x04\x01\x02\x01\x01\x12\x03\x0b\r\x16\n\x0c\n\x05\ - \x04\x01\x02\x01\x03\x12\x03\x0b\x19\x1a\n\x0c\n\x04\x04\x01\x08\0\x12\ - \x04\r\x02\x10\x03\n\x0c\n\x05\x04\x01\x08\0\x01\x12\x03\r\x08\x14\n\x0b\ - \n\x04\x04\x01\x02\x02\x12\x03\x0e\x04\x20\n\x0c\n\x05\x04\x01\x02\x02\ - \x05\x12\x03\x0e\x04\t\n\x0c\n\x05\x04\x01\x02\x02\x01\x12\x03\x0e\n\x1b\ - \n\x0c\n\x05\x04\x01\x02\x02\x03\x12\x03\x0e\x1e\x1f\n\x0b\n\x04\x04\x01\ - \x02\x03\x12\x03\x0f\x04!\n\x0c\n\x05\x04\x01\x02\x03\x05\x12\x03\x0f\ - \x04\t\n\x0c\n\x05\x04\x01\x02\x03\x01\x12\x03\x0f\n\x1c\n\x0c\n\x05\x04\ - \x01\x02\x03\x03\x12\x03\x0f\x1f\x20b\x06proto3\ -"; - -static mut file_descriptor_proto_lazy: ::protobuf::lazy::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::descriptor::FileDescriptorProto, -}; - -fn parse_descriptor_proto() -> ::protobuf::descriptor::FileDescriptorProto { - ::protobuf::parse_from_bytes(file_descriptor_proto_data).unwrap() -} - -pub fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto { - unsafe { - file_descriptor_proto_lazy.get(|| { - parse_descriptor_proto() - }) - } -}