From 3e7ab7eaede043afbe470c2d224645b367edf438 Mon Sep 17 00:00:00 2001 From: Ding Xiang Fei Date: Sun, 20 May 2018 22:47:00 +0800 Subject: [PATCH 01/11] automatically build protobuf on travis-ci --- .travis.yml | 12 +- Cargo.toml | 5 +- build.rs | 15 + install_protobuf.sh | 8 + src/proto/proof.rs | 709 -------------------------------------------- 5 files changed, 37 insertions(+), 712 deletions(-) create mode 100644 build.rs create mode 100644 install_protobuf.sh delete mode 100644 src/proto/proof.rs diff --git a/.travis.yml b/.travis.yml index 1b4c6b2..1613aff 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 @@ -20,7 +24,7 @@ matrix: before_script: - rustup component add rustfmt-preview 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 +61,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..c45d5b1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -19,10 +19,13 @@ 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 = "1.7.1" + [dev-dependencies] serde_json = "1.0.17" diff --git a/build.rs b/build.rs new file mode 100644 index 0000000..7d3c457 --- /dev/null +++ b/build.rs @@ -0,0 +1,15 @@ +extern crate protoc_rust; + +fn build_protobuf<'a>(out_dir: &'a str, input: &'a [&'a str], includes: &'a [&'a str]) { + use self::protoc_rust::{run, Args}; + run(Args { + out_dir, + input, + includes, + }).expect("protoc"); +} + +fn main() { + #[cfg(feature = "serialization-protobuf")] + build_protobuf("src/proto", &["protobuf/proof.proto"], &[]); +} diff --git a/install_protobuf.sh b/install_protobuf.sh new file mode 100644 index 0000000..5491ce8 --- /dev/null +++ b/install_protobuf.sh @@ -0,0 +1,8 @@ +#!/usr/bin/bash +set -e + +if [ ! -d "$HOME/protobuf/lib" ]; then + 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 +fi 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() - }) - } -} From c9b380162aee8c24725cb79c290d2f3089283cb0 Mon Sep 17 00:00:00 2001 From: Ding Xiang Fei Date: Mon, 21 May 2018 14:07:30 +0800 Subject: [PATCH 02/11] allow rustfmt to fail --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 1613aff..3909871 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,6 +16,7 @@ matrix: allow_failures: - env: NAME='nightly' - env: NAME='kcov' + - env: NAME='rustfmt' # temporarily allow rustfmt to fail until it can recognise conditional cfgs properly include: - env: NAME='nightly' rust: nightly From e0af34702291a31722f77f62e620f6b38d29d789 Mon Sep 17 00:00:00 2001 From: Ding Xiang Fei Date: Wed, 23 May 2018 15:32:57 +0800 Subject: [PATCH 03/11] pin protoc to 3.5.1 --- install_protobuf.sh | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/install_protobuf.sh b/install_protobuf.sh index 5491ce8..0a1432a 100644 --- a/install_protobuf.sh +++ b/install_protobuf.sh @@ -1,8 +1,22 @@ #!/usr/bin/bash set -e -if [ ! -d "$HOME/protobuf/lib" ]; then - 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 +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 From ae9aeefc4e41000abdbe4b04e724597da77d5b5c Mon Sep 17 00:00:00 2001 From: Ding Xiang Fei Date: Wed, 23 May 2018 18:25:48 +0800 Subject: [PATCH 04/11] Assert protoc version while building with `cargo` --- Cargo.toml | 4 ++-- build.rs | 30 ++++++++++++++++++++++++++++-- 2 files changed, 30 insertions(+), 4 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index c45d5b1..ece70a0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -24,13 +24,13 @@ serde = { version = "^1.0.55", optional = true } serde_derive = { version = "^1.0.55", optional = true } [build-dependencies] -protoc-rust = "1.7.1" +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 index 7d3c457..85a2548 100644 --- a/build.rs +++ b/build.rs @@ -1,6 +1,26 @@ +#[cfg(feature = "serialization-protobuf")] extern crate protoc_rust; -fn build_protobuf<'a>(out_dir: &'a str, input: &'a [&'a str], includes: &'a [&'a str]) { +#[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, @@ -9,7 +29,13 @@ fn build_protobuf<'a>(out_dir: &'a str, input: &'a [&'a str], includes: &'a [&'a }).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("src/proto", &["protobuf/proof.proto"], &[]); + build_protobuf_schemata(); } From 7fb53158fe1154aa4d8ac72fad516e44470bb602 Mon Sep 17 00:00:00 2001 From: Ding Xiang Fei Date: Wed, 23 May 2018 18:29:18 +0800 Subject: [PATCH 05/11] Let `rustfmt` fail --- .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 3909871..1613aff 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,7 +16,6 @@ matrix: allow_failures: - env: NAME='nightly' - env: NAME='kcov' - - env: NAME='rustfmt' # temporarily allow rustfmt to fail until it can recognise conditional cfgs properly include: - env: NAME='nightly' rust: nightly From 830b4015c5fcb9d9193db56ec33321c02ac27999 Mon Sep 17 00:00:00 2001 From: Ding Xiang Fei Date: Thu, 24 May 2018 13:32:29 +0800 Subject: [PATCH 06/11] Ignore protobuf schema when `rustfmt` is invoked --- .gitignore | 1 + Cargo.toml | 1 + src/lib.rs | 37 ++++++++++++++++++++----------------- src/proof.rs | 6 ++---- src/proto/mod.rs | 6 +++++- 5 files changed, 29 insertions(+), 22 deletions(-) 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/Cargo.toml b/Cargo.toml index ece70a0..5e76a05 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -18,6 +18,7 @@ categories = ["data-structures", "cryptography"] [dependencies] +cfg-if = "0.1.3" ring = "^0.12.0" protobuf = { version = "1.7.1", optional = true } serde = { version = "^1.0.55", optional = true } diff --git a/src/lib.rs b/src/lib.rs index 3c99fe6..ca7598a 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,21 +1,28 @@ -#![deny( - missing_docs, unused_qualifications, missing_debug_implementations, - missing_copy_implementations, trivial_casts, trivial_numeric_casts, unsafe_code, - unstable_features, unused_import_braces -)] +#![deny(missing_docs, unused_qualifications, missing_debug_implementations, + missing_copy_implementations, trivial_casts, trivial_numeric_casts, unsafe_code, + unstable_features, unused_import_braces)] //! *merkle* implements a Merkle Tree in Rust. +#[macro_use] +extern crate cfg_if; extern crate ring; -#[cfg(feature = "serialization-protobuf")] -extern crate protobuf; - -#[cfg(feature = "serialization-serde")] -extern crate serde; -#[cfg(feature = "serialization-serde")] -#[macro_use] -extern crate serde_derive; +cfg_if! { + if #[cfg(feature = "serialization-protobuf")] { + extern crate protobuf; + #[allow(unused_qualifications)] + mod proto; + } +} + +cfg_if! { + if #[cfg(feature = "serialization-serde")] { + extern crate serde; + #[macro_use] + extern crate serde_derive; + } +} mod merkletree; pub use merkletree::MerkleTree; @@ -29,9 +36,5 @@ pub use hashutils::Hashable; mod tree; pub use tree::{LeavesIntoIterator, LeavesIterator}; -#[cfg(feature = "serialization-protobuf")] -#[allow(unused_qualifications)] -mod proto; - #[cfg(test)] mod tests; diff --git a/src/proof.rs b/src/proof.rs index 854e849..dcde4d9 100644 --- a/src/proof.rs +++ b/src/proof.rs @@ -52,10 +52,8 @@ mod algorithm_serde { mod test { use super::*; - use ring::digest::{ - SHA1 as sha1, SHA256 as sha256, SHA384 as sha384, SHA512 as sha512, - SHA512_256 as sha512_256, - }; + use ring::digest::{SHA1 as sha1, SHA256 as sha256, SHA384 as sha384, SHA512 as sha512, + SHA512_256 as sha512_256}; static SHA1: &Algorithm = &sha1; static SHA256: &Algorithm = &sha256; diff --git a/src/proto/mod.rs b/src/proto/mod.rs index cac5c49..2ac4f01 100644 --- a/src/proto/mod.rs +++ b/src/proto/mod.rs @@ -1,4 +1,8 @@ -mod proof; +cfg_if! { + if #[cfg(not(rustfmt))] { + mod proof; + } +} use ring::digest::Algorithm; From e96ffcf9917ed60341af6402e0269452343b9abc Mon Sep 17 00:00:00 2001 From: Ding Xiang Fei Date: Thu, 24 May 2018 13:37:59 +0800 Subject: [PATCH 07/11] fix formatting according to rustfmt --- src/lib.rs | 8 +++++--- src/merkletree.rs | 4 +++- src/proof.rs | 6 ++++-- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index ca7598a..e56ceda 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,6 +1,8 @@ -#![deny(missing_docs, unused_qualifications, missing_debug_implementations, - missing_copy_implementations, trivial_casts, trivial_numeric_casts, unsafe_code, - unstable_features, unused_import_braces)] +#![deny( + missing_docs, unused_qualifications, missing_debug_implementations, + missing_copy_implementations, trivial_casts, trivial_numeric_casts, unsafe_code, + unstable_features, unused_import_braces +)] //! *merkle* implements a Merkle Tree in Rust. 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/proof.rs b/src/proof.rs index dcde4d9..854e849 100644 --- a/src/proof.rs +++ b/src/proof.rs @@ -52,8 +52,10 @@ mod algorithm_serde { mod test { use super::*; - use ring::digest::{SHA1 as sha1, SHA256 as sha256, SHA384 as sha384, SHA512 as sha512, - SHA512_256 as sha512_256}; + use ring::digest::{ + SHA1 as sha1, SHA256 as sha256, SHA384 as sha384, SHA512 as sha512, + SHA512_256 as sha512_256, + }; static SHA1: &Algorithm = &sha1; static SHA256: &Algorithm = &sha256; From c08d9e2185398b16e553339ca6410ee2ef86c67e Mon Sep 17 00:00:00 2001 From: Ding Xiang Fei Date: Fri, 25 May 2018 14:04:09 +0800 Subject: [PATCH 08/11] revert 830b401 except changes in .gitignore, and generate the schema before running rustfmt --- .travis.yml | 1 + Cargo.toml | 1 - src/lib.rs | 29 ++++++++++++----------------- src/proto/mod.rs | 6 +----- 4 files changed, 14 insertions(+), 23 deletions(-) diff --git a/.travis.yml b/.travis.yml index 1613aff..874f6d5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -24,6 +24,7 @@ matrix: before_script: - rustup component add rustfmt-preview script: + - protoc --rust-out src/proto/ protobuf/proof.proto - cargo fmt --all -- --check - env: NAME='kcov' sudo: required # travis-ci/travis-ci#9061 diff --git a/Cargo.toml b/Cargo.toml index 5e76a05..ece70a0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -18,7 +18,6 @@ categories = ["data-structures", "cryptography"] [dependencies] -cfg-if = "0.1.3" ring = "^0.12.0" protobuf = { version = "1.7.1", optional = true } serde = { version = "^1.0.55", optional = true } diff --git a/src/lib.rs b/src/lib.rs index e56ceda..3c99fe6 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -6,25 +6,16 @@ //! *merkle* implements a Merkle Tree in Rust. -#[macro_use] -extern crate cfg_if; extern crate ring; -cfg_if! { - if #[cfg(feature = "serialization-protobuf")] { - extern crate protobuf; - #[allow(unused_qualifications)] - mod proto; - } -} - -cfg_if! { - if #[cfg(feature = "serialization-serde")] { - extern crate serde; - #[macro_use] - extern crate serde_derive; - } -} +#[cfg(feature = "serialization-protobuf")] +extern crate protobuf; + +#[cfg(feature = "serialization-serde")] +extern crate serde; +#[cfg(feature = "serialization-serde")] +#[macro_use] +extern crate serde_derive; mod merkletree; pub use merkletree::MerkleTree; @@ -38,5 +29,9 @@ pub use hashutils::Hashable; mod tree; pub use tree::{LeavesIntoIterator, LeavesIterator}; +#[cfg(feature = "serialization-protobuf")] +#[allow(unused_qualifications)] +mod proto; + #[cfg(test)] mod tests; diff --git a/src/proto/mod.rs b/src/proto/mod.rs index 2ac4f01..cac5c49 100644 --- a/src/proto/mod.rs +++ b/src/proto/mod.rs @@ -1,8 +1,4 @@ -cfg_if! { - if #[cfg(not(rustfmt))] { - mod proof; - } -} +mod proof; use ring::digest::Algorithm; From ddf6b936078632ba3a4d3e7ddbd688871940edd4 Mon Sep 17 00:00:00 2001 From: Ding Xiang Fei Date: Fri, 25 May 2018 00:17:31 +0800 Subject: [PATCH 09/11] check in rustfmt.toml, so that generated protobuf schemata are ignored by rustfmt --- .travis.yml | 2 +- rustfmt.toml | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 rustfmt.toml diff --git a/.travis.yml b/.travis.yml index 874f6d5..d846bf4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -24,7 +24,7 @@ matrix: before_script: - rustup component add rustfmt-preview script: - - protoc --rust-out src/proto/ protobuf/proof.proto + - protoc --rust_out src/proto/ protobuf/proof.proto - cargo fmt --all -- --check - env: NAME='kcov' sudo: required # travis-ci/travis-ci#9061 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", +] From 3dc1ec2f689ddf04b73e4b2b37eeda3c88fa94a8 Mon Sep 17 00:00:00 2001 From: Ding Xiang Fei Date: Fri, 25 May 2018 16:59:44 +0800 Subject: [PATCH 10/11] let travis ci to handle protobuf schema generation in rustfmt target --- .travis.yml | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index d846bf4..752ce4d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -19,12 +19,21 @@ matrix: include: - env: NAME='nightly' rust: nightly - - env: NAME='rustfmt' + - env: + - NAME='rustfmt' + - PROTOBUF_CODEGEN_VERSION=2.0.0 + - PATH=$PATH:$HOME/.cargo/bin rust: nightly before_script: - rustup component add rustfmt-preview - script: + # 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 --rust_out src/proto/ protobuf/proof.proto + script: - cargo fmt --all -- --check - env: NAME='kcov' sudo: required # travis-ci/travis-ci#9061 From 3715d51a4813657d42e6d206d0adfbd2f34ee628 Mon Sep 17 00:00:00 2001 From: Ding Xiang Fei Date: Mon, 18 Jun 2018 14:08:29 +0800 Subject: [PATCH 11/11] try to identify the travis build errors --- .travis.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 752ce4d..8a9db40 100644 --- a/.travis.yml +++ b/.travis.yml @@ -22,7 +22,7 @@ matrix: - env: - NAME='rustfmt' - PROTOBUF_CODEGEN_VERSION=2.0.0 - - PATH=$PATH:$HOME/.cargo/bin + - PATH=$PATH:$HOME/.cargo/bin:$HOME/protobuf/bin rust: nightly before_script: - rustup component add rustfmt-preview @@ -32,6 +32,7 @@ matrix: # 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 -- --check