From 4f24e2083cb1c198a2bd378e3f6a620285fefc7c Mon Sep 17 00:00:00 2001 From: Himanshu Goyal Date: Thu, 11 Apr 2024 18:00:42 +0300 Subject: [PATCH] Update hotshot/Change Builder key types (#73) * update buider keys * WIP * update hotshot * update hotshot tag --- Cargo.lock | 202 ++++++++------------------------------ Cargo.toml | 14 +-- src/builder_state.rs | 1 + src/service.rs | 87 +++++++++++----- src/testing/basic_test.rs | 7 +- 5 files changed, 114 insertions(+), 197 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 2c5fe61a..4b3549f6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -577,26 +577,6 @@ dependencies = [ "pin-project-lite 0.2.13", ] -[[package]] -name = "async-compatibility-layer" -version = "1.0.0" -source = "git+https://github.com/EspressoSystems/async-compatibility-layer.git?tag=1.4.1#568122b0ef39648daee91d16546985d41c3b0b15" -dependencies = [ - "async-channel 1.9.0", - "async-lock 2.8.0", - "async-std", - "async-trait", - "color-eyre", - "console-subscriber 0.1.10", - "flume", - "futures", - "tokio", - "tokio-stream", - "tracing", - "tracing-error", - "tracing-subscriber 0.3.18", -] - [[package]] name = "async-compatibility-layer" version = "1.1.0" @@ -607,7 +587,7 @@ dependencies = [ "async-std", "async-trait", "color-eyre", - "console-subscriber 0.2.0", + "console-subscriber", "flume", "futures", "tokio", @@ -1278,7 +1258,7 @@ checksum = "8cd6604a82acf3039f1144f54b8eb34e91ffba622051189e71b781822d5ee1f5" [[package]] name = "cdn-broker" version = "0.1.0" -source = "git+https://github.com/EspressoSystems/Push-CDN?tag=0.1.23#c709b7b6f6f93534b458fcbb994c61c2cdebeadf" +source = "git+https://github.com/EspressoSystems/Push-CDN?tag=0.1.24#5e0689dd07e3a5692b272afb176be43d26002f3d" dependencies = [ "async-std", "cdn-proto", @@ -1301,7 +1281,7 @@ dependencies = [ [[package]] name = "cdn-client" version = "0.1.0" -source = "git+https://github.com/EspressoSystems/Push-CDN?tag=0.1.23#c709b7b6f6f93534b458fcbb994c61c2cdebeadf" +source = "git+https://github.com/EspressoSystems/Push-CDN?tag=0.1.24#5e0689dd07e3a5692b272afb176be43d26002f3d" dependencies = [ "async-std", "cdn-proto", @@ -1317,7 +1297,7 @@ dependencies = [ [[package]] name = "cdn-marshal" version = "0.1.0" -source = "git+https://github.com/EspressoSystems/Push-CDN?tag=0.1.23#c709b7b6f6f93534b458fcbb994c61c2cdebeadf" +source = "git+https://github.com/EspressoSystems/Push-CDN?tag=0.1.24#5e0689dd07e3a5692b272afb176be43d26002f3d" dependencies = [ "async-std", "cdn-proto", @@ -1332,7 +1312,7 @@ dependencies = [ [[package]] name = "cdn-proto" version = "0.1.0" -source = "git+https://github.com/EspressoSystems/Push-CDN?tag=0.1.23#c709b7b6f6f93534b458fcbb994c61c2cdebeadf" +source = "git+https://github.com/EspressoSystems/Push-CDN?tag=0.1.24#5e0689dd07e3a5692b272afb176be43d26002f3d" dependencies = [ "anyhow", "ark-serialize", @@ -1560,18 +1540,6 @@ dependencies = [ "yaml-rust", ] -[[package]] -name = "console-api" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2895653b4d9f1538a83970077cb01dfc77a4810524e51a110944688e916b18e" -dependencies = [ - "prost 0.11.9", - "prost-types 0.11.9", - "tonic 0.9.2", - "tracing-core", -] - [[package]] name = "console-api" version = "0.6.0" @@ -1579,55 +1547,31 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fd326812b3fd01da5bb1af7d340d0d555fd3d4b641e7f1dfcf5962a902952787" dependencies = [ "futures-core", - "prost 0.12.3", - "prost-types 0.12.3", - "tonic 0.10.2", + "prost", + "prost-types", + "tonic", "tracing-core", ] -[[package]] -name = "console-subscriber" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4cf42660ac07fcebed809cfe561dd8730bcd35b075215e6479c516bcd0d11cb" -dependencies = [ - "console-api 0.5.0", - "crossbeam-channel", - "crossbeam-utils", - "futures", - "hdrhistogram", - "humantime", - "prost-types 0.11.9", - "serde", - "serde_json", - "thread_local", - "tokio", - "tokio-stream", - "tonic 0.9.2", - "tracing", - "tracing-core", - "tracing-subscriber 0.3.18", -] - [[package]] name = "console-subscriber" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7481d4c57092cd1c19dd541b92bdce883de840df30aa5d03fd48a3935c01842e" dependencies = [ - "console-api 0.6.0", + "console-api", "crossbeam-channel", "crossbeam-utils", "futures-task", "hdrhistogram", "humantime", - "prost-types 0.12.3", + "prost-types", "serde", "serde_json", "thread_local", "tokio", "tokio-stream", - "tonic 0.10.2", + "tonic", "tracing", "tracing-core", "tracing-subscriber 0.3.18", @@ -3077,11 +3021,11 @@ dependencies = [ [[package]] name = "hotshot" version = "0.5.26" -source = "git+https://github.com/EspressoSystems/HotShot.git?tag=0.5.34#cf967c227edc56b2a88c6d38b24a10b8c8ffa90d" +source = "git+https://github.com/EspressoSystems/HotShot.git?tag=0.5.35#3db10ae62671a3a9b19a9fa035982f5283fc0d96" dependencies = [ "anyhow", "async-broadcast", - "async-compatibility-layer 1.1.0", + "async-compatibility-layer", "async-lock 2.8.0", "async-std", "async-trait", @@ -3110,6 +3054,7 @@ dependencies = [ "portpicker", "rand 0.8.5", "serde", + "sha2 0.10.8", "snafu 0.8.2", "surf-disco", "time 0.3.34", @@ -3121,7 +3066,7 @@ dependencies = [ [[package]] name = "hotshot-builder-api" version = "0.1.6" -source = "git+https://github.com/EspressoSystems/HotShot.git?tag=0.5.34#cf967c227edc56b2a88c6d38b24a10b8c8ffa90d" +source = "git+https://github.com/EspressoSystems/HotShot.git?tag=0.5.35#3db10ae62671a3a9b19a9fa035982f5283fc0d96" dependencies = [ "async-trait", "clap", @@ -3139,10 +3084,10 @@ dependencies = [ [[package]] name = "hotshot-builder-core" -version = "0.1.2" +version = "0.1.3" dependencies = [ "async-broadcast", - "async-compatibility-layer 1.0.0", + "async-compatibility-layer", "async-lock 2.8.0", "async-std", "async-trait", @@ -3166,11 +3111,11 @@ dependencies = [ [[package]] name = "hotshot-events-service" -version = "0.1.2" -source = "git+https://github.com/EspressoSystems/hotshot-events-service.git?tag=0.1.2#8c671da15877c7be853bfb13979b4ea4909a5966" +version = "0.1.3" +source = "git+https://github.com/EspressoSystems/hotshot-events-service.git?tag=0.1.3#9ab20f9bacc4a3e03109a497aaa1b5d8e8eca503" dependencies = [ "async-broadcast", - "async-compatibility-layer 1.0.0", + "async-compatibility-layer", "async-lock 2.8.0", "async-std", "async-trait", @@ -3192,11 +3137,11 @@ dependencies = [ [[package]] name = "hotshot-example-types" version = "0.5.26" -source = "git+https://github.com/EspressoSystems/HotShot.git?tag=0.5.34#cf967c227edc56b2a88c6d38b24a10b8c8ffa90d" +source = "git+https://github.com/EspressoSystems/HotShot.git?tag=0.5.35#3db10ae62671a3a9b19a9fa035982f5283fc0d96" dependencies = [ "anyhow", "async-broadcast", - "async-compatibility-layer 1.1.0", + "async-compatibility-layer", "async-lock 2.8.0", "async-std", "async-trait", @@ -3222,10 +3167,10 @@ dependencies = [ [[package]] name = "hotshot-orchestrator" version = "0.5.26" -source = "git+https://github.com/EspressoSystems/HotShot.git?tag=0.5.34#cf967c227edc56b2a88c6d38b24a10b8c8ffa90d" +source = "git+https://github.com/EspressoSystems/HotShot.git?tag=0.5.35#3db10ae62671a3a9b19a9fa035982f5283fc0d96" dependencies = [ "anyhow", - "async-compatibility-layer 1.1.0", + "async-compatibility-layer", "async-lock 2.8.0", "async-std", "bincode", @@ -3251,10 +3196,10 @@ dependencies = [ [[package]] name = "hotshot-task" version = "0.5.26" -source = "git+https://github.com/EspressoSystems/HotShot.git?tag=0.5.34#cf967c227edc56b2a88c6d38b24a10b8c8ffa90d" +source = "git+https://github.com/EspressoSystems/HotShot.git?tag=0.5.35#3db10ae62671a3a9b19a9fa035982f5283fc0d96" dependencies = [ "async-broadcast", - "async-compatibility-layer 1.1.0", + "async-compatibility-layer", "async-std", "futures", "tokio", @@ -3264,11 +3209,11 @@ dependencies = [ [[package]] name = "hotshot-task-impls" version = "0.5.26" -source = "git+https://github.com/EspressoSystems/HotShot.git?tag=0.5.34#cf967c227edc56b2a88c6d38b24a10b8c8ffa90d" +source = "git+https://github.com/EspressoSystems/HotShot.git?tag=0.5.35#3db10ae62671a3a9b19a9fa035982f5283fc0d96" dependencies = [ "anyhow", "async-broadcast", - "async-compatibility-layer 1.1.0", + "async-compatibility-layer", "async-lock 2.8.0", "async-std", "async-trait", @@ -3297,7 +3242,7 @@ dependencies = [ [[package]] name = "hotshot-types" version = "0.1.11" -source = "git+https://github.com/EspressoSystems/HotShot.git?tag=0.5.34#cf967c227edc56b2a88c6d38b24a10b8c8ffa90d" +source = "git+https://github.com/EspressoSystems/HotShot.git?tag=0.5.35#3db10ae62671a3a9b19a9fa035982f5283fc0d96" dependencies = [ "anyhow", "ark-bls12-381", @@ -3307,7 +3252,7 @@ dependencies = [ "ark-ff", "ark-serialize", "ark-std", - "async-compatibility-layer 1.1.0", + "async-compatibility-layer", "async-lock 2.8.0", "async-std", "async-trait", @@ -3347,9 +3292,9 @@ dependencies = [ [[package]] name = "hotshot-web-server" version = "0.5.26" -source = "git+https://github.com/EspressoSystems/HotShot.git?tag=0.5.34#cf967c227edc56b2a88c6d38b24a10b8c8ffa90d" +source = "git+https://github.com/EspressoSystems/HotShot.git?tag=0.5.35#3db10ae62671a3a9b19a9fa035982f5283fc0d96" dependencies = [ - "async-compatibility-layer 1.1.0", + "async-compatibility-layer", "async-lock 2.8.0", "async-std", "clap", @@ -3574,7 +3519,7 @@ dependencies = [ "iana-time-zone-haiku", "js-sys", "wasm-bindgen", - "windows-core 0.52.0", + "windows-core", ] [[package]] @@ -4427,10 +4372,10 @@ dependencies = [ [[package]] name = "libp2p-networking" version = "0.5.26" -source = "git+https://github.com/EspressoSystems/HotShot.git?tag=0.5.34#cf967c227edc56b2a88c6d38b24a10b8c8ffa90d" +source = "git+https://github.com/EspressoSystems/HotShot.git?tag=0.5.35#3db10ae62671a3a9b19a9fa035982f5283fc0d96" dependencies = [ "anyhow", - "async-compatibility-layer 1.1.0", + "async-compatibility-layer", "async-lock 2.8.0", "async-std", "async-trait", @@ -5921,16 +5866,6 @@ dependencies = [ "syn 2.0.55", ] -[[package]] -name = "prost" -version = "0.11.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b82eaa1d779e9a4bc1c3217db8ffbeabaae1dca241bf70183242128d48681cd" -dependencies = [ - "bytes", - "prost-derive 0.11.9", -] - [[package]] name = "prost" version = "0.12.3" @@ -5938,20 +5873,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "146c289cda302b98a28d40c8b3b90498d6e526dd24ac2ecea73e4e491685b94a" dependencies = [ "bytes", - "prost-derive 0.12.3", -] - -[[package]] -name = "prost-derive" -version = "0.11.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5d2d8d10f3c6ded6da8b05b5fb3b8a5082514344d56c9f871412d29b4e075b4" -dependencies = [ - "anyhow", - "itertools 0.10.5", - "proc-macro2", - "quote", - "syn 1.0.109", + "prost-derive", ] [[package]] @@ -5967,22 +5889,13 @@ dependencies = [ "syn 2.0.55", ] -[[package]] -name = "prost-types" -version = "0.11.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "213622a1460818959ac1181aaeb2dc9c7f63df720db7d788b3e24eacd1983e13" -dependencies = [ - "prost 0.11.9", -] - [[package]] name = "prost-types" version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "193898f59edcf43c26227dcd4c8427f00d99d61e95dcde58dabd49fa291d470e" dependencies = [ - "prost 0.12.3", + "prost", ] [[package]] @@ -8130,34 +8043,6 @@ dependencies = [ "winnow 0.6.5", ] -[[package]] -name = "tonic" -version = "0.9.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3082666a3a6433f7f511c7192923fa1fe07c69332d3c6a2e6bb040b569199d5a" -dependencies = [ - "async-trait", - "axum", - "base64 0.21.7", - "bytes", - "futures-core", - "futures-util", - "h2 0.3.25", - "http 0.2.12", - "http-body 0.4.6", - "hyper 0.14.28", - "hyper-timeout", - "percent-encoding", - "pin-project", - "prost 0.11.9", - "tokio", - "tokio-stream", - "tower", - "tower-layer", - "tower-service", - "tracing", -] - [[package]] name = "tonic" version = "0.10.2" @@ -8176,7 +8061,7 @@ dependencies = [ "hyper-timeout", "percent-encoding", "pin-project", - "prost 0.12.3", + "prost", "tokio", "tokio-stream", "tower", @@ -8798,7 +8683,7 @@ version = "0.51.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ca229916c5ee38c2f2bc1e9d8f04df975b4bd93f9955dc69fabb5d91270045c9" dependencies = [ - "windows-core 0.51.1", + "windows-core", "windows-targets 0.48.5", ] @@ -8811,15 +8696,6 @@ dependencies = [ "windows-targets 0.48.5", ] -[[package]] -name = "windows-core" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" -dependencies = [ - "windows-targets 0.52.4", -] - [[package]] name = "windows-sys" version = "0.48.0" diff --git a/Cargo.toml b/Cargo.toml index b46acd70..4803c588 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,12 +1,12 @@ [package] name = "hotshot-builder-core" -version = "0.1.2" +version = "0.1.3" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] async-broadcast = "0.7.0" -async-compatibility-layer = { git = "https://github.com/EspressoSystems/async-compatibility-layer.git", tag = "1.4.1", features = [ +async-compatibility-layer = { version = "1.1", default-features = false, features = [ "logging-utils", ] } async-lock = "2.8" @@ -15,10 +15,10 @@ async-trait = "0.1" clap = { version = "4.4", features = ["derive", "env"] } committable = "0.2" futures = "0.3" -hotshot = { git = "https://github.com/EspressoSystems/HotShot.git", tag = "0.5.34" } -hotshot-builder-api = { git = "https://github.com/EspressoSystems/HotShot.git", tag = "0.5.34" } -hotshot-events-service = { git = "https://github.com/EspressoSystems/hotshot-events-service.git", tag = "0.1.2" } -hotshot-types = { git = "https://github.com/EspressoSystems/HotShot.git", tag = "0.5.34" } +hotshot = { git = "https://github.com/EspressoSystems/HotShot.git", tag = "0.5.35" } +hotshot-builder-api = { git = "https://github.com/EspressoSystems/HotShot.git", tag = "0.5.35" } +hotshot-events-service = { git = "https://github.com/EspressoSystems/hotshot-events-service.git", tag = "0.1.3" } +hotshot-types = { git = "https://github.com/EspressoSystems/HotShot.git", tag = "0.5.35" } serde = { version = "1.0", features = ["derive"] } sha2 = "0.10" snafu = "0.8" @@ -29,4 +29,4 @@ tracing = "0.1" vbs = "0.1" [dev-dependencies] -hotshot-example-types = { git = "https://github.com/EspressoSystems/HotShot.git", tag = "0.5.34" } +hotshot-example-types = { git = "https://github.com/EspressoSystems/HotShot.git", tag = "0.5.35" } diff --git a/src/builder_state.rs b/src/builder_state.rs index 4dad89d4..4f7a68f5 100644 --- a/src/builder_state.rs +++ b/src/builder_state.rs @@ -304,6 +304,7 @@ impl BuilderProgress for BuilderState { self.total_nodes = NonZeroUsize::new(total_nodes).unwrap(); let payload_vid_commitment = vid_commitment(&encoded_txns, total_nodes); + tracing::debug!( "Generated payload commitment from the da proposal: {:?}", payload_vid_commitment diff --git a/src/service.rs b/src/service.rs index da4456c4..32aa3557 100644 --- a/src/service.rs +++ b/src/service.rs @@ -15,8 +15,11 @@ use hotshot_types::{ event::{EventType, LeafInfo}, message::Proposal, traits::{ - block_contents::BlockPayload, consensus_api::ConsensusApi, election::Membership, - node_implementation::NodeType, signature_key::SignatureKey, + block_contents::BlockPayload, + consensus_api::ConsensusApi, + election::Membership, + node_implementation::NodeType, + signature_key::{BuilderSignatureKey, SignatureKey}, }, utils::BuilderCommitment, vid::VidCommitment, @@ -41,8 +44,10 @@ use hotshot_events_service::{ }; use sha2::{Digest, Sha256}; use std::collections::HashMap; +use std::fmt::Display; use std::num::NonZeroUsize; use std::sync::Arc; +use tagged_base64::TaggedBase64; use tide_disco::method::ReadState; #[allow(clippy::type_complexity)] @@ -52,8 +57,8 @@ pub struct GlobalState { // May be ideal place as GlobalState interacts with hotshot apis // and then can sign on responsers as desired pub builder_keys: ( - Types::SignatureKey, // pub key - <::SignatureKey as SignatureKey>::PrivateKey, // private key + Types::BuilderSignatureKey, // pub key + <::BuilderSignatureKey as BuilderSignatureKey>::BuilderPrivateKey, // private key ), // data store for the blocks pub block_hash_to_block: HashMap< @@ -81,8 +86,8 @@ pub struct GlobalState { impl GlobalState { pub fn new( builder_keys: ( - Types::SignatureKey, - <::SignatureKey as SignatureKey>::PrivateKey, + Types::BuilderSignatureKey, + <::BuilderSignatureKey as BuilderSignatureKey>::BuilderPrivateKey, ), request_sender: BroadcastSender>, response_receiver: UnboundedReceiver, @@ -136,13 +141,24 @@ Handling Builder API responses #[async_trait] impl BuilderDataSource for GlobalState where - <::SignatureKey as SignatureKey>::PureAssembledSignatureType: - for<'a> TryFrom<&'a tagged_base64::TaggedBase64> + Into, + for<'a> <::PureAssembledSignatureType as TryFrom< + &'a TaggedBase64, + >>::Error: Display, + for<'a> >::Error: Display, { async fn get_available_blocks( &self, for_parent: &VidCommitment, + sender: Types::SignatureKey, + signature: &::PureAssembledSignatureType, ) -> Result>, BuildError> { + // verify the signatue + if !sender.validate(signature, for_parent.as_ref()) { + return Err(BuildError::Error { + message: "Signature validation failed".to_string(), + }); + } + let req_msg = RequestMessage { requested_vid_commitment: *for_parent, }; @@ -166,11 +182,12 @@ where combined_bytes.extend_from_slice(response.offered_fee.to_be_bytes().as_ref()); combined_bytes.extend_from_slice(response.builder_hash.as_ref()); - let signature_over_block_info = ::SignatureKey::sign( - &self.builder_keys.1, - combined_bytes.as_ref(), - ) - .expect("Available block info signing failed"); + let signature_over_block_info = + ::BuilderSignatureKey::sign_builder_message( + &self.builder_keys.1, + combined_bytes.as_ref(), + ) + .expect("Available block info signing failed"); // insert the block info into local hashmap let initial_block_info = AvailableBlockInfo:: { @@ -192,15 +209,25 @@ where async fn claim_block( &self, block_hash: &BuilderCommitment, - _signature: &<::SignatureKey as SignatureKey>::PureAssembledSignatureType, + sender: Types::SignatureKey, + signature: &<::SignatureKey as SignatureKey>::PureAssembledSignatureType, ) -> Result, BuildError> { - // TODO, Verify the signature over the proposer request + // verify the signatue + if !sender.validate(signature, block_hash.as_ref()) { + return Err(BuildError::Error { + message: "Signature validation failed".to_string(), + }); + } if let Some(block) = self.block_hash_to_block.get(block_hash) { // sign over the builder commitment, as the proposer can computer it based on provide block_payload // and the metata data + let response_block_hash = block.0.builder_commitment(&block.1); let signature_over_builder_commitment = - ::SignatureKey::sign(&self.builder_keys.1, block_hash.as_ref()) - .expect("Claim block signing failed"); + ::BuilderSignatureKey::sign_builder_message( + &self.builder_keys.1, + response_block_hash.as_ref(), + ) + .expect("Claim block signing failed"); let block_data = AvailableBlockData:: { block_payload: block.0.clone(), metadata: block.1.clone(), @@ -218,16 +245,24 @@ where async fn claim_block_header_input( &self, block_hash: &BuilderCommitment, - _signature: &<::SignatureKey as SignatureKey>::PureAssembledSignatureType, + sender: Types::SignatureKey, + signature: &<::SignatureKey as SignatureKey>::PureAssembledSignatureType, ) -> Result, BuildError> { + // verify the signatue + if !sender.validate(signature, block_hash.as_ref()) { + return Err(BuildError::Error { + message: "Signature validation failed".to_string(), + }); + } if let Some(block) = self.block_hash_to_block.get(block_hash) { tracing::debug!("Waiting for vid commitment for block {:?}", block_hash); let vid_commitment = block.2.write().await.get().await?; - let signature_over_vid_commitment = ::SignatureKey::sign( - &self.builder_keys.1, - vid_commitment.as_ref(), - ) - .expect("Claim block header input signing failed"); + let signature_over_vid_commitment = + ::BuilderSignatureKey::sign_builder_message( + &self.builder_keys.1, + vid_commitment.as_ref(), + ) + .expect("Claim block header input signing failed"); let reponse = AvailableBlockHeaderInput:: { vid_commitment, signature: signature_over_vid_commitment, @@ -241,7 +276,9 @@ where }) } } - async fn get_builder_address(&self) -> Result<::SignatureKey, BuildError> { + async fn get_builder_address( + &self, + ) -> Result<::BuilderSignatureKey, BuildError> { Ok(self.builder_keys.0.clone()) } } @@ -525,7 +562,7 @@ async fn handle_qc_event( qc_proposal.data.view_number ); - let leaf = Leaf::from_proposal(&qc_proposal); + let leaf = Leaf::from_quorum_proposal(&qc_proposal.data); // check if the sender is the leader and the signature is valid; if yes, broadcast the QC proposal if sender == leader && sender.validate(&qc_proposal.signature, leaf.commit().as_ref()) { diff --git a/src/testing/basic_test.rs b/src/testing/basic_test.rs index 0f73d356..210164ce 100644 --- a/src/testing/basic_test.rs +++ b/src/testing/basic_test.rs @@ -27,6 +27,7 @@ mod tests { use hotshot::types::SignatureKey; use hotshot_types::{ event::LeafInfo, + signature_key::BuilderKey, simple_vote::QuorumData, traits::block_contents::{vid_commitment, BlockHeader}, }; @@ -85,6 +86,7 @@ mod tests { type ValidatedState = TestValidatedState; type InstanceState = TestInstanceState; type Membership = GeneralStaticCommittee; + type BuilderSignatureKey = BuilderKey; } // no of test messages to send let num_test_messages = 5; @@ -206,7 +208,8 @@ mod tests { let _metadata = >::metadata( &sqc_msgs[(i - 1) as usize].proposal.data.block_header, ); - let leaf = Leaf::from_proposal(&sqc_msgs[(i - 1) as usize].proposal); + let leaf = + Leaf::from_quorum_proposal(&sqc_msgs[(i - 1) as usize].proposal.data); let q_data = QuorumData:: { leaf_commit: leaf.commit(), @@ -230,7 +233,7 @@ mod tests { vote_commitment: q_data.commit(), view_number, signatures: previous_justify_qc.signatures.clone(), - is_genesis: true, // todo setting true because we don't have signatures of QCType + is_genesis: false, _pd: PhantomData, } }