diff --git a/Cargo.lock b/Cargo.lock index cc18fbde..5ff58366 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3031,7 +3031,7 @@ dependencies = [ [[package]] name = "hotshot" version = "0.5.43" -source = "git+https://github.com/EspressoSystems/HotShot.git?tag=0.5.53#9fbb21fe45ee1dbf63c136e850cda7a520d24a39" +source = "git+https://github.com/EspressoSystems/HotShot.git?tag=0.5.54#af6e40d6157e335a7ed71c956ef37d8e820635c5" dependencies = [ "anyhow", "async-broadcast", @@ -3076,7 +3076,7 @@ dependencies = [ [[package]] name = "hotshot-builder-api" version = "0.1.7" -source = "git+https://github.com/EspressoSystems/HotShot.git?tag=0.5.53#9fbb21fe45ee1dbf63c136e850cda7a520d24a39" +source = "git+https://github.com/EspressoSystems/HotShot.git?tag=0.5.54#af6e40d6157e335a7ed71c956ef37d8e820635c5" dependencies = [ "async-trait", "clap", @@ -3094,7 +3094,7 @@ dependencies = [ [[package]] name = "hotshot-builder-core" -version = "0.1.20" +version = "0.1.21" dependencies = [ "anyhow", "async-broadcast", @@ -3123,8 +3123,8 @@ dependencies = [ [[package]] name = "hotshot-events-service" -version = "0.1.21" -source = "git+https://github.com/EspressoSystems/hotshot-events-service.git?tag=0.1.21#ae2e647b69351e06b8f59b19eee59ad54f56f837" +version = "0.1.22" +source = "git+https://github.com/EspressoSystems/hotshot-events-service.git?tag=0.1.22#0986778c44d729b94b88b3e80db58d82de7dae9e" dependencies = [ "async-broadcast", "async-compatibility-layer", @@ -3149,7 +3149,7 @@ dependencies = [ [[package]] name = "hotshot-example-types" version = "0.5.43" -source = "git+https://github.com/EspressoSystems/HotShot.git?tag=0.5.53#9fbb21fe45ee1dbf63c136e850cda7a520d24a39" +source = "git+https://github.com/EspressoSystems/HotShot.git?tag=0.5.54#af6e40d6157e335a7ed71c956ef37d8e820635c5" dependencies = [ "anyhow", "async-broadcast", @@ -3179,7 +3179,7 @@ dependencies = [ [[package]] name = "hotshot-orchestrator" version = "0.5.43" -source = "git+https://github.com/EspressoSystems/HotShot.git?tag=0.5.53#9fbb21fe45ee1dbf63c136e850cda7a520d24a39" +source = "git+https://github.com/EspressoSystems/HotShot.git?tag=0.5.54#af6e40d6157e335a7ed71c956ef37d8e820635c5" dependencies = [ "anyhow", "async-compatibility-layer", @@ -3208,7 +3208,7 @@ dependencies = [ [[package]] name = "hotshot-task" version = "0.5.43" -source = "git+https://github.com/EspressoSystems/HotShot.git?tag=0.5.53#9fbb21fe45ee1dbf63c136e850cda7a520d24a39" +source = "git+https://github.com/EspressoSystems/HotShot.git?tag=0.5.54#af6e40d6157e335a7ed71c956ef37d8e820635c5" dependencies = [ "async-broadcast", "async-compatibility-layer", @@ -3221,7 +3221,7 @@ dependencies = [ [[package]] name = "hotshot-task-impls" version = "0.5.43" -source = "git+https://github.com/EspressoSystems/HotShot.git?tag=0.5.53#9fbb21fe45ee1dbf63c136e850cda7a520d24a39" +source = "git+https://github.com/EspressoSystems/HotShot.git?tag=0.5.54#af6e40d6157e335a7ed71c956ef37d8e820635c5" dependencies = [ "anyhow", "async-broadcast", @@ -3256,7 +3256,7 @@ dependencies = [ [[package]] name = "hotshot-types" version = "0.1.11" -source = "git+https://github.com/EspressoSystems/HotShot.git?tag=0.5.53#9fbb21fe45ee1dbf63c136e850cda7a520d24a39" +source = "git+https://github.com/EspressoSystems/HotShot.git?tag=0.5.54#af6e40d6157e335a7ed71c956ef37d8e820635c5" dependencies = [ "anyhow", "ark-bls12-381", @@ -4356,7 +4356,7 @@ dependencies = [ [[package]] name = "libp2p-networking" version = "0.5.43" -source = "git+https://github.com/EspressoSystems/HotShot.git?tag=0.5.53#9fbb21fe45ee1dbf63c136e850cda7a520d24a39" +source = "git+https://github.com/EspressoSystems/HotShot.git?tag=0.5.54#af6e40d6157e335a7ed71c956ef37d8e820635c5" dependencies = [ "anyhow", "async-compatibility-layer", diff --git a/Cargo.toml b/Cargo.toml index 492e78ef..da28e7bf 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "hotshot-builder-core" -version = "0.1.20" +version = "0.1.21" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html @@ -17,10 +17,10 @@ clap = { version = "4.4", features = ["derive", "env"] } committable = "0.2" derivative = "2.2" futures = "0.3" -hotshot = { git = "https://github.com/EspressoSystems/HotShot.git", tag = "0.5.53" } -hotshot-builder-api = { git = "https://github.com/EspressoSystems/HotShot.git", tag = "0.5.53" } -hotshot-events-service = { git = "https://github.com/EspressoSystems/hotshot-events-service.git", tag = "0.1.21" } -hotshot-types = { git = "https://github.com/EspressoSystems/HotShot.git", tag = "0.5.53" } +hotshot = { git = "https://github.com/EspressoSystems/HotShot.git", tag = "0.5.54" } +hotshot-builder-api = { git = "https://github.com/EspressoSystems/HotShot.git", tag = "0.5.54" } +hotshot-events-service = { git = "https://github.com/EspressoSystems/hotshot-events-service.git", tag = "0.1.22" } +hotshot-types = { git = "https://github.com/EspressoSystems/HotShot.git", tag = "0.5.54" } serde = { version = "1.0", features = ["derive"] } sha2 = "0.10" snafu = "0.8" @@ -31,4 +31,4 @@ tracing = "0.1" vbs = "0.1" [dev-dependencies] -hotshot-example-types = { git = "https://github.com/EspressoSystems/HotShot.git", tag = "0.5.53" } +hotshot-example-types = { git = "https://github.com/EspressoSystems/HotShot.git", tag = "0.5.54" } diff --git a/src/builder_state.rs b/src/builder_state.rs index db60a632..e55358aa 100644 --- a/src/builder_state.rs +++ b/src/builder_state.rs @@ -1,5 +1,5 @@ use hotshot_types::{ - data::{DAProposal, Leaf, QuorumProposal}, + data::{DaProposal, Leaf, QuorumProposal}, message::Proposal, traits::block_contents::{BlockHeader, BlockPayload}, traits::{ @@ -56,8 +56,8 @@ pub struct DecideMessage { } /// DA Proposal Message to be put on the da proposal channel #[derive(Clone, Debug, PartialEq)] -pub struct DAProposalMessage { - pub proposal: Proposal>, +pub struct DaProposalMessage { + pub proposal: Proposal>, pub sender: TYPES::SignatureKey, pub total_nodes: usize, } @@ -130,7 +130,7 @@ pub struct BuilderState { /// da_proposal_payload_commit to (da_proposal, node_count) pub da_proposal_payload_commit_to_da_proposal: - HashMap, usize)>, + HashMap, usize)>, /// quorum_proposal_payload_commit to quorum_proposal pub quorum_proposal_payload_commit_to_quorum_proposal: @@ -193,7 +193,7 @@ pub trait BuilderProgress { fn process_hotshot_transaction(&mut self, tx: Vec); /// process the DA proposal - async fn process_da_proposal(&mut self, da_msg: DAProposalMessage); + async fn process_da_proposal(&mut self, da_msg: DaProposalMessage); /// process the quorum proposal async fn process_quorum_proposal(&mut self, qc_msg: QCMessage); @@ -204,7 +204,7 @@ pub trait BuilderProgress { /// spawn a clone of builder async fn spawn_clone( self, - da_proposal: DAProposal, + da_proposal: DaProposal, quorum_proposal: QuorumProposal, leader: TYPES::SignatureKey, num_nodes: usize, @@ -288,7 +288,7 @@ impl BuilderProgress for BuilderState { /// processing the DA proposal #[tracing::instrument(skip_all, name = "process da proposal", fields(builder_built_from_proposed_block = %self.built_from_proposed_block))] - async fn process_da_proposal(&mut self, da_msg: DAProposalMessage) { + async fn process_da_proposal(&mut self, da_msg: DaProposalMessage) { tracing::debug!( "Builder Received DA message for view {:?}", da_msg.proposal.data.view_number @@ -354,7 +354,7 @@ impl BuilderProgress for BuilderState { .da_proposal_payload_commit_to_da_proposal .entry(payload_builder_commitment.clone()) { - let da_proposal_data = DAProposal { + let da_proposal_data = DaProposal { encoded_transactions: encoded_txns.clone(), metadata: metadata.clone(), view_number, @@ -598,7 +598,7 @@ impl BuilderProgress for BuilderState { fields(builder_built_from_proposed_block = %self.built_from_proposed_block))] async fn spawn_clone( mut self, - da_proposal: DAProposal, + da_proposal: DaProposal, quorum_proposal: QuorumProposal, _leader: TYPES::SignatureKey, total_nodes: usize, @@ -888,7 +888,7 @@ impl BuilderProgress for BuilderState { da = self.da_proposal_receiver.next() => { match da { Some(da) => { - if let MessageType::DAProposalMessage(rda_msg) = da { + if let MessageType::DaProposalMessage(rda_msg) = da { tracing::debug!("Received da proposal msg in builder {:?}:\n {:?}", self.built_from_proposed_block, rda_msg.proposal.data.view_number); self.process_da_proposal(rda_msg).await; } @@ -948,7 +948,7 @@ impl BuilderProgress for BuilderState { pub enum MessageType { TransactionMessage(TransactionMessage), DecideMessage(DecideMessage), - DAProposalMessage(DAProposalMessage), + DaProposalMessage(DaProposalMessage), QCMessage(QCMessage), RequestMessage(RequestMessage), } diff --git a/src/service.rs b/src/service.rs index a5457f0d..3f424cf0 100644 --- a/src/service.rs +++ b/src/service.rs @@ -9,7 +9,7 @@ use hotshot_builder_api::{ }; use hotshot_types::{ constants::Version01, - data::{DAProposal, Leaf, QuorumProposal}, + data::{DaProposal, Leaf, QuorumProposal}, event::EventType, message::Proposal, traits::{ @@ -24,7 +24,7 @@ use hotshot_types::{ }; use crate::builder_state::{ - BuildBlockInfo, DAProposalMessage, DecideMessage, QCMessage, TransactionMessage, + BuildBlockInfo, DaProposalMessage, DecideMessage, QCMessage, TransactionMessage, TransactionSource, }; use crate::builder_state::{MessageType, RequestMessage, ResponseMessage}; @@ -779,7 +779,7 @@ pub async fn run_non_permissioned_standalone_builder_service( .await; } // DA proposal event - BuilderEventType::HotshotDAProposal { proposal, sender } => { + BuilderEventType::HotshotDaProposal { proposal, sender } => { // get the leader for current view let leader = membership.get_leader(proposal.data.view_number); // get the committee mstatked node count @@ -872,7 +872,7 @@ pub async fn run_permissioned_standalone_builder_service< .await; } // DA proposal event - EventType::DAProposal { proposal, sender } => { + EventType::DaProposal { proposal, sender } => { // get the leader for current view let leader = hotshot_handle.get_leader(proposal.data.view_number).await; // get the committee staked node count @@ -900,13 +900,13 @@ Utility functions to handle the hotshot events */ async fn handle_da_event( da_channel_sender: &BroadcastSender>, - da_proposal: Proposal>, + da_proposal: Proposal>, sender: ::SignatureKey, leader: ::SignatureKey, total_nodes: NonZeroUsize, ) { tracing::debug!( - "DAProposal: Leader: {:?} for the view: {:?}", + "DaProposal: Leader: {:?} for the view: {:?}", leader, da_proposal.data.view_number ); @@ -915,7 +915,7 @@ async fn handle_da_event( let encoded_txns_hash = Sha256::digest(&da_proposal.data.encoded_transactions); // check if the sender is the leader and the signature is valid; if yes, broadcast the DA proposal if leader == sender && sender.validate(&da_proposal.signature, &encoded_txns_hash) { - let da_msg = DAProposalMessage:: { + let da_msg = DaProposalMessage:: { proposal: da_proposal, sender: leader, total_nodes: total_nodes.into(), @@ -926,7 +926,7 @@ async fn handle_da_event( view_number ); if let Err(e) = da_channel_sender - .broadcast(MessageType::DAProposalMessage(da_msg)) + .broadcast(MessageType::DaProposalMessage(da_msg)) .await { tracing::warn!( @@ -935,7 +935,7 @@ async fn handle_da_event( ); } } else { - tracing::error!("Validation Failure on DAProposal for view {:?}: Leader for the current view: {:?} and sender: {:?}", da_proposal.data.view_number, leader, sender); + tracing::error!("Validation Failure on DaProposal for view {:?}: Leader for the current view: {:?} and sender: {:?}", da_proposal.data.view_number, leader, sender); } } diff --git a/src/testing/basic_test.rs b/src/testing/basic_test.rs index c672ac32..d1b784b4 100644 --- a/src/testing/basic_test.rs +++ b/src/testing/basic_test.rs @@ -1,6 +1,6 @@ pub use hotshot::traits::election::static_committee::GeneralStaticCommittee; pub use hotshot_types::{ - data::{DAProposal, Leaf, QuorumProposal, ViewNumber}, + data::{DaProposal, Leaf, QuorumProposal, ViewNumber}, message::Proposal, signature_key::{BLSPrivKey, BLSPubKey}, simple_certificate::{QuorumCertificate, SimpleCertificate, SuccessThreshold}, @@ -37,7 +37,7 @@ mod tests { }; use crate::builder_state::{ - BuiltFromProposedBlock, DAProposalMessage, DecideMessage, QCMessage, RequestMessage, + BuiltFromProposedBlock, DaProposalMessage, DecideMessage, QCMessage, RequestMessage, TransactionMessage, TransactionSource, }; use crate::service::GlobalState; @@ -115,7 +115,7 @@ mod tests { // to store all the sent messages let mut stx_msgs: Vec> = Vec::new(); let mut sdecide_msgs: Vec> = Vec::new(); - let mut sda_msgs: Vec> = Vec::new(); + let mut sda_msgs: Vec> = Vec::new(); let mut sqc_msgs: Vec> = Vec::new(); #[allow(clippy::type_complexity)] let mut sreq_msgs: Vec<( @@ -139,7 +139,7 @@ mod tests { }; // Prepare the DA proposal message - let da_proposal = DAProposal { + let da_proposal = DaProposal { encoded_transactions: encoded_transactions.clone().into(), metadata: TestMetadata, view_number: ViewNumber::new(i as u64), @@ -154,7 +154,7 @@ mod tests { ) .expect("Failed to sign encoded tx hash while preparing da proposal"); - let sda_msg = DAProposalMessage:: { + let sda_msg = DaProposalMessage:: { proposal: Proposal { data: da_proposal, signature: da_signature.clone(), @@ -298,7 +298,7 @@ mod tests { .await .unwrap(); da_sender - .broadcast(MessageType::DAProposalMessage(sda_msg.clone())) + .broadcast(MessageType::DaProposalMessage(sda_msg.clone())) .await .unwrap(); qc_sender