Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(proto): add sign_digest() to commit and vote extension #20

Merged
merged 12 commits into from
Apr 17, 2023
4 changes: 3 additions & 1 deletion abci/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,11 @@ name = "echo_socket"
required-features = ["server"]

[dependencies]
tenderdash-proto = { version = "0.12.0-dev.1", path = "../proto", default-features = false, features = [
"crypto",
] }
bytes = { version = "1.0" }
prost = { version = "0.11" }
tenderdash-proto = { version = "0.12.0-dev.1", default-features = false, path = "../proto" }
tracing = { version = "0.1", default-features = false }
tracing-subscriber = { version = "0.3", optional = true, default-features = false }
thiserror = "1.0.39"
Expand Down
12 changes: 11 additions & 1 deletion proto-compiler/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,20 @@ pub fn proto_compile() {
&commitish,
); // This panics if it fails.

// We need all files in proto/tendermint/abci, plus .../types/canonical.proto
// for signature verification
let proto_paths = vec![tenderdash_dir.join("proto").join("tendermint").join("abci")];
let proto_includes_paths = vec![tenderdash_dir.join("proto"), thirdparty_dir];
// List available proto files
let protos = find_proto_files(proto_paths);
let mut protos = find_proto_files(proto_paths);
// On top of that, we add canonical.proto, required to verify signatures
protos.push(
tenderdash_dir
.join("proto")
.join("tendermint")
.join("types")
.join("canonical.proto"),
);

let mut pb = prost_build::Config::new();

Expand Down
8 changes: 8 additions & 0 deletions proto/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,16 @@ time = { version = "0.3", default-features = false, features = [
flex-error = { version = "0.4.4", default-features = false }
chrono = { version = "0.4.24", default-features = false }
derive_more = { version = "0.99.17" }
lhash = { version = "1.0.1", features = ["sha256"], optional = true }

[dev-dependencies]
serde_json = { version = "1.0", default-features = false, features = ["alloc"] }
hex = { version = "0.4" }

[build-dependencies]
tenderdash-proto-compiler = { path = "../proto-compiler" }


[features]
default = ["crypto"]
crypto = ["dep:lhash"]
5 changes: 5 additions & 0 deletions proto/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ define_error! {
ParseLength
[ DisplayOnly<TryFromIntError> ]
| _ | { "error parsing encoded length" },

CreateCanonical
[ DisplayOnly<String> ]
| _ | { "cannot prepare canonical form: {}" },

}
}

Expand Down
4 changes: 3 additions & 1 deletion proto/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,10 @@ pub use tenderdash::*;

pub mod serializers;

use prelude::*;
#[cfg(feature = "crypto")]
pub mod signatures;

use prelude::*;
pub use tenderdash::meta::ABCI_VERSION;

/// Allows for easy Google Protocol Buffers encoding and decoding of domain
Expand Down
Loading