Skip to content
This repository has been archived by the owner on Feb 5, 2025. It is now read-only.

Update hotshot: 0.5.83 #284

Merged
merged 8 commits into from
Jan 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,328 changes: 646 additions & 682 deletions Cargo.lock

Large diffs are not rendered by default.

18 changes: 9 additions & 9 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@ resolver = "2"
members = ["crates/*"]

[workspace.package]
version = "0.1.58"
version = "0.1.59"
edition = "2021"

[workspace.dependencies]
hotshot = { git = "https://github.com/EspressoSystems/HotShot.git", tag = "0.5.82" }
hotshot-builder-api = { git = "https://github.com/EspressoSystems/HotShot.git", tag = "0.5.82" }
hotshot-events-service = { git = "https://github.com/EspressoSystems/hotshot-events-service.git", tag = "0.1.56" }
hotshot-macros = { git = "https://github.com/EspressoSystems/HotShot.git", tag = "0.5.82" }
hotshot-task-impls = { git = "https://github.com/EspressoSystems/HotShot.git", tag = "0.5.82" }
hotshot-testing = { git = "https://github.com/EspressoSystems/HotShot.git", tag = "0.5.82" }
hotshot-types = { git = "https://github.com/EspressoSystems/HotShot.git", tag = "0.5.82" }
hotshot-example-types = { git = "https://github.com/EspressoSystems/HotShot.git", tag = "0.5.82" }
hotshot = { git = "https://github.com/EspressoSystems/HotShot.git", tag = "0.5.83" }
hotshot-builder-api = { git = "https://github.com/EspressoSystems/HotShot.git", tag = "0.5.83" }
hotshot-events-service = { git = "https://github.com/EspressoSystems/hotshot-events-service.git", tag = "0.1.57" }
hotshot-macros = { git = "https://github.com/EspressoSystems/HotShot.git", tag = "0.5.83" }
hotshot-task-impls = { git = "https://github.com/EspressoSystems/HotShot.git", tag = "0.5.83" }
hotshot-testing = { git = "https://github.com/EspressoSystems/HotShot.git", tag = "0.5.83" }
hotshot-types = { git = "https://github.com/EspressoSystems/HotShot.git", tag = "0.5.83" }
hotshot-example-types = { git = "https://github.com/EspressoSystems/HotShot.git", tag = "0.5.83" }

anyhow = "1"
async-broadcast = "0.7"
Expand Down
6 changes: 3 additions & 3 deletions crates/legacy/src/builder_state.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use hotshot_types::{
data::{DaProposal, Leaf2, QuorumProposal2},
data::{DaProposal2, Leaf2, QuorumProposal2},
message::Proposal,
traits::{
block_contents::{precompute_vid_commitment, BlockHeader, BlockPayload},
Expand Down Expand Up @@ -55,7 +55,7 @@ pub struct DecideMessage<Types: NodeType> {
/// DA Proposal Message to be put on the da proposal channel
#[derive(Clone, Debug, PartialEq)]
pub struct DaProposalMessage<Types: NodeType> {
pub proposal: Arc<Proposal<Types, DaProposal<Types>>>,
pub proposal: Arc<Proposal<Types, DaProposal2<Types>>>,
pub sender: Types::SignatureKey,
}
/// Quorum proposal message to be put on the quorum proposal channel
Expand Down Expand Up @@ -108,7 +108,7 @@ pub enum Status {
#[derive(Debug, Clone, PartialEq)]
pub struct DAProposalInfo<Types: NodeType> {
pub view_number: Types::View,
pub proposal: Arc<Proposal<Types, DaProposal<Types>>>,
pub proposal: Arc<Proposal<Types, DaProposal2<Types>>>,
}

/// [`ALLOW_EMPTY_BLOCK_PERIOD`] is a constant that is used to determine the
Expand Down
36 changes: 21 additions & 15 deletions crates/legacy/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use hotshot_builder_api::{
v0_2::builder::TransactionStatus,
};
use hotshot_types::{
data::{DaProposal, Leaf2, QuorumProposal2},
data::{DaProposal2, Leaf2, QuorumProposal2},
event::EventType,
message::Proposal,
traits::{
Expand Down Expand Up @@ -1287,7 +1287,7 @@ enum HandleDaEventError<Types: NodeType> {
/// still open.
async fn handle_da_event<Types: NodeType>(
da_channel_sender: &BroadcastSender<MessageType<Types>>,
da_proposal: Arc<Proposal<Types, DaProposal<Types>>>,
da_proposal: Arc<Proposal<Types, DaProposal2<Types>>>,
sender: <Types as NodeType>::SignatureKey,
) {
// We're explicitly not inspecting this error, as this function is not
Expand All @@ -1309,7 +1309,7 @@ async fn handle_da_event<Types: NodeType>(
/// This function is the implementation for [`handle_da_event`].
async fn handle_da_event_implementation<Types: NodeType>(
da_channel_sender: &BroadcastSender<MessageType<Types>>,
da_proposal: Arc<Proposal<Types, DaProposal<Types>>>,
da_proposal: Arc<Proposal<Types, DaProposal2<Types>>>,
sender: <Types as NodeType>::SignatureKey,
) -> Result<(), HandleDaEventError<Types>> {
tracing::debug!(
Expand Down Expand Up @@ -1642,13 +1642,13 @@ mod test {
node_types::{TestTypes, TestVersions},
state_types::{TestInstanceState, TestValidatedState},
};
use hotshot_types::data::DaProposal2;
use hotshot_types::data::EpochNumber;
use hotshot_types::data::Leaf2;
use hotshot_types::data::QuorumProposal2;
use hotshot_types::drb::INITIAL_DRB_RESULT;
use hotshot_types::drb::INITIAL_DRB_SEED_INPUT;
use hotshot_types::traits::block_contents::Transaction;
use hotshot_types::{
data::{DaProposal, Leaf, ViewNumber},
data::{Leaf, ViewNumber},
message::Proposal,
simple_certificate::QuorumCertificate,
traits::{
Expand Down Expand Up @@ -4140,13 +4140,15 @@ mod test {
<BLSPubKey as BuilderSignatureKey>::generated_from_seed_indexed([0; 32], 1);
let (da_channel_sender, _) = async_broadcast::broadcast(10);
let view_number = ViewNumber::new(10);
let epoch = EpochNumber::new(1);

let da_proposal = DaProposal::<TestTypes> {
let da_proposal = DaProposal2::<TestTypes> {
encoded_transactions: Arc::new([1, 2, 3, 4, 5, 6]),
metadata: TestMetadata {
num_transactions: 1,
}, // arbitrary
view_number,
epoch,
};

let encoded_txns_hash = Sha256::digest(&da_proposal.encoded_transactions);
Expand Down Expand Up @@ -4196,13 +4198,15 @@ mod test {
};

let view_number = ViewNumber::new(10);
let epoch = EpochNumber::new(1);

let da_proposal = DaProposal::<TestTypes> {
let da_proposal = DaProposal2::<TestTypes> {
encoded_transactions: Arc::new([1, 2, 3, 4, 5, 6]),
metadata: TestMetadata {
num_transactions: 1,
}, // arbitrary
view_number,
epoch,
};

let encoded_txns_hash = Sha256::digest(&da_proposal.encoded_transactions);
Expand Down Expand Up @@ -4243,13 +4247,15 @@ mod test {
<BLSPubKey as BuilderSignatureKey>::generated_from_seed_indexed([0; 32], 0);
let (da_channel_sender, da_channel_receiver) = async_broadcast::broadcast(10);
let view_number = ViewNumber::new(10);
let epoch = EpochNumber::new(1);

let da_proposal = DaProposal::<TestTypes> {
let da_proposal = DaProposal2::<TestTypes> {
encoded_transactions: Arc::new([1, 2, 3, 4, 5, 6]),
metadata: TestMetadata {
num_transactions: 1,
}, // arbitrary
view_number,
epoch,
};

let encoded_txns_hash = Sha256::digest(&da_proposal.encoded_transactions);
Expand Down Expand Up @@ -4328,8 +4334,8 @@ mod test {
.to_qc2(),
upgrade_certificate: None,
view_change_evidence: None,
drb_seed: INITIAL_DRB_SEED_INPUT,
drb_result: INITIAL_DRB_RESULT,
next_epoch_justify_qc: None,
next_drb_result: None,
}
};

Expand Down Expand Up @@ -4401,8 +4407,8 @@ mod test {
.to_qc2(),
upgrade_certificate: None,
view_change_evidence: None,
drb_seed: INITIAL_DRB_SEED_INPUT,
drb_result: INITIAL_DRB_RESULT,
next_epoch_justify_qc: None,
next_drb_result: None,
}
};

Expand Down Expand Up @@ -4465,8 +4471,8 @@ mod test {
.to_qc2(),
upgrade_certificate: None,
view_change_evidence: None,
drb_seed: INITIAL_DRB_SEED_INPUT,
drb_result: INITIAL_DRB_RESULT,
next_epoch_justify_qc: None,
next_drb_result: None,
}
};

Expand Down
17 changes: 9 additions & 8 deletions crates/legacy/src/testing/basic_test.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
pub use hotshot::traits::election::static_committee::StaticCommittee;
pub use hotshot_types::{
data::{DaProposal, EpochNumber, Leaf, ViewNumber},
data::{EpochNumber, Leaf, ViewNumber},
message::Proposal,
signature_key::BLSPubKey,
simple_certificate::{QuorumCertificate, SimpleCertificate, SuccessThreshold},
Expand All @@ -23,8 +23,7 @@ mod tests {
use hotshot_builder_api::v0_2::data_source::BuilderDataSource;
use hotshot_example_types::auction_results_provider_types::TestAuctionResult;
use hotshot_example_types::node_types::TestVersions;
use hotshot_types::data::{Leaf2, QuorumProposal2};
use hotshot_types::drb::{INITIAL_DRB_RESULT, INITIAL_DRB_SEED_INPUT};
use hotshot_types::data::{DaProposal2, Leaf2, QuorumProposal2};
use hotshot_types::simple_vote::QuorumData2;
use hotshot_types::{
signature_key::BuilderKey,
Expand Down Expand Up @@ -190,8 +189,8 @@ mod tests {
justify_qc: previous_jc.clone(),
upgrade_certificate: None,
view_change_evidence: None,
drb_seed: INITIAL_DRB_SEED_INPUT,
drb_result: INITIAL_DRB_RESULT,
next_epoch_justify_qc: None,
next_drb_result: None,
}
};

Expand Down Expand Up @@ -290,12 +289,13 @@ mod tests {

// Prepare the DA proposal message
let da_proposal_message = {
let da_proposal = DaProposal {
let da_proposal = DaProposal2 {
encoded_transactions: encoded_transactions.clone().into(),
metadata: TestMetadata {
num_transactions: encoded_transactions.len() as u64,
},
view_number: ViewNumber::new(round as u64),
epoch: EpochNumber::genesis(), // TODO: check if this is okay
};
let encoded_transactions_hash = Sha256::digest(&encoded_transactions);
let seed = [round as u8; 32];
Expand Down Expand Up @@ -363,6 +363,7 @@ mod tests {

let q_data = QuorumData2::<TestTypes> {
leaf_commit: leaf.commit(),
epoch: EpochNumber::genesis(), // TODO: check if this is okay
};

let previous_quorum_view_number =
Expand Down Expand Up @@ -392,8 +393,8 @@ mod tests {
justify_qc: justify_qc.clone(),
upgrade_certificate: None,
view_change_evidence: None,
drb_seed: INITIAL_DRB_SEED_INPUT,
drb_result: INITIAL_DRB_RESULT,
next_epoch_justify_qc: None,
next_drb_result: None,
};

let payload_vid_commitment =
Expand Down
10 changes: 5 additions & 5 deletions crates/legacy/src/testing/finalization_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ use hotshot_example_types::{
state_types::{TestInstanceState, TestValidatedState},
};
use hotshot_types::{
data::{DaProposal, QuorumProposal2, ViewNumber},
drb::{INITIAL_DRB_RESULT, INITIAL_DRB_SEED_INPUT},
data::{DaProposal2, EpochNumber, QuorumProposal2, ViewNumber},
message::Proposal,
simple_certificate::QuorumCertificate,
traits::{
Expand Down Expand Up @@ -278,10 +277,11 @@ async fn progress_round_with_transactions(
da_proposal_sender
.broadcast(MessageType::DaProposalMessage(DaProposalMessage {
proposal: Arc::new(Proposal {
data: DaProposal::<TestTypes> {
data: DaProposal2::<TestTypes> {
encoded_transactions: encoded_transactions.clone().into(),
metadata,
view_number: next_view,
epoch: EpochNumber::genesis(), // TODO
},
signature: da_signature,
_pd: Default::default(),
Expand Down Expand Up @@ -328,8 +328,8 @@ async fn progress_round_with_transactions(
.to_qc2(),
upgrade_certificate: None,
view_change_evidence: None,
drb_seed: INITIAL_DRB_SEED_INPUT,
drb_result: INITIAL_DRB_RESULT,
next_epoch_justify_qc: None,
next_drb_result: None,
};

let payload_vid_commitment =
Expand Down
11 changes: 6 additions & 5 deletions crates/legacy/src/testing/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ use hotshot::{
types::{BLSPubKey, SignatureKey},
};
use hotshot_types::{
data::{DaProposal, Leaf2, QuorumProposal2, ViewNumber},
drb::{INITIAL_DRB_RESULT, INITIAL_DRB_SEED_INPUT},
data::{DaProposal2, EpochNumber, Leaf2, QuorumProposal2, ViewNumber},
message::Proposal,
simple_certificate::{QuorumCertificate, SimpleCertificate, SuccessThreshold},
simple_vote::QuorumData2,
Expand Down Expand Up @@ -139,12 +138,13 @@ pub async fn calc_proposal_msg(

// Prepare the DA proposal message
let da_proposal_message: DaProposalMessage<TestTypes> = {
let da_proposal = DaProposal {
let da_proposal = DaProposal2 {
encoded_transactions: encoded_transactions.clone().into(),
metadata: TestMetadata {
num_transactions: encoded_transactions.len() as u64,
},
view_number: ViewNumber::new(round as u64),
epoch: EpochNumber::new(1),
};
let encoded_transactions_hash = Sha256::digest(&encoded_transactions);
let da_signature =
Expand Down Expand Up @@ -184,6 +184,7 @@ pub async fn calc_proposal_msg(
let prev_justify_qc = &prev_proposal.justify_qc;
let quorum_data = QuorumData2::<TestTypes> {
leaf_commit: Leaf2::from_quorum_proposal(prev_proposal).commit(),
epoch: EpochNumber::new(1),
};

// form a justify qc
Expand All @@ -205,8 +206,8 @@ pub async fn calc_proposal_msg(
justify_qc: justify_qc.clone(),
upgrade_certificate: None,
view_change_evidence: None,
drb_seed: INITIAL_DRB_SEED_INPUT,
drb_result: INITIAL_DRB_RESULT,
next_epoch_justify_qc: None,
next_drb_result: None,
};

let quorum_signature =
Expand Down
5 changes: 2 additions & 3 deletions crates/legacy_refactored/src/testing/basic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ use hotshot_example_types::block_types::{TestBlockHeader, TestMetadata, TestTran
use hotshot_example_types::node_types::{TestTypes, TestVersions};
use hotshot_example_types::state_types::{TestInstanceState, TestValidatedState};
use hotshot_types::data::{Leaf2, QuorumProposal2, ViewNumber};
use hotshot_types::drb::{INITIAL_DRB_RESULT, INITIAL_DRB_SEED_INPUT};
use hotshot_types::event::LeafInfo;
use hotshot_types::simple_certificate::QuorumCertificate;
use hotshot_types::traits::block_contents::BlockHeader;
Expand Down Expand Up @@ -203,8 +202,8 @@ async fn test_pruning() {
justify_qc: mock_qc.clone(),
upgrade_certificate: None,
view_change_evidence: None,
drb_seed: INITIAL_DRB_SEED_INPUT,
drb_result: INITIAL_DRB_RESULT,
next_epoch_justify_qc: None,
next_drb_result: None,
});
event_stream_sender
.broadcast(hotshot::types::Event {
Expand Down
2 changes: 2 additions & 0 deletions crates/legacy_refactored/src/testing/integration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ mod tests {
num_failed_views: 5,
..Default::default()
},
epoch_height: 0,
..TestDescription::default()
},
BuilderValidationConfig {
Expand Down Expand Up @@ -191,6 +192,7 @@ mod tests {
duration: Duration::from_secs(120),
},
),
epoch_height: 0,
overall_safety_properties: OverallSafetyPropertiesDescription {
num_successful_views: 50,
num_failed_views: 5,
Expand Down
2 changes: 2 additions & 0 deletions crates/marketplace/src/testing/integration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ mod tests {
num_failed_views: 5,
..Default::default()
},
epoch_height: 0,
..TestDescription::default()
},
BuilderValidationConfig {
Expand Down Expand Up @@ -188,6 +189,7 @@ mod tests {
duration: Duration::from_secs(120),
},
),
epoch_height: 0,
overall_safety_properties: OverallSafetyPropertiesDescription {
num_successful_views: 50,
num_failed_views: 5,
Expand Down
Loading
Loading