Skip to content
This repository has been archived by the owner on Dec 3, 2024. It is now read-only.

Commit

Permalink
Updating to HotShot 0.5.28
Browse files Browse the repository at this point in the history
  • Loading branch information
nyospe committed Mar 25, 2024
1 parent 4cdf4cf commit 4bf4729
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 125 deletions.
116 changes: 15 additions & 101 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ async-trait = "0.1"
clap = { version = "4.4", features = ["derive", "env"] }
commit = { git = "https://github.com/EspressoSystems/commit.git" }
futures = "0.3"
hotshot = { git = "https://github.com/EspressoSystems/HotShot.git", tag = "0.5.27" }
hotshot-example-types = { git = "https://github.com/EspressoSystems/HotShot.git", tag = "0.5.27" }
hotshot-types = { git = "https://github.com/EspressoSystems/HotShot.git", tag = "0.5.27" }
hotshot-builder-api = { git = "https://github.com/EspressoSystems/HotShot.git", tag = "0.5.27" }
hotshot = { git = "https://github.com/EspressoSystems/HotShot.git", tag = "0.5.28" }
hotshot-example-types = { git = "https://github.com/EspressoSystems/HotShot.git", tag = "0.5.28" }
hotshot-types = { git = "https://github.com/EspressoSystems/HotShot.git", tag = "0.5.28" }
hotshot-builder-api = { git = "https://github.com/EspressoSystems/HotShot.git", tag = "0.5.28" }
sha2 = "0.10"
serde = { version = "1.0", features = ["derive"] }
tide-disco = { git = "https://github.com/EspressoSystems/tide-disco", tag = "v0.5.0" }
Expand Down
21 changes: 7 additions & 14 deletions src/builder_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -182,12 +182,7 @@ pub trait BuilderProgress<TYPES: NodeType> {
async fn process_decide_event(&mut self, decide_msg: DecideMessage<TYPES>) -> Option<Status>;

/// spawn a clone of builder
fn spawn_clone(
self,
da_proposal: DAProposal<TYPES>,
quorum_proposal: QuorumProposal<TYPES>,
leader: TYPES::SignatureKey,
);
fn spawn_clone(self, da_proposal: DAProposal<TYPES>, quorum_proposal: QuorumProposal<TYPES>);

/// build a block
fn build_block(&mut self, matching_vid: VidCommitment) -> Option<BuildBlockInfo<TYPES>>;
Expand Down Expand Up @@ -279,7 +274,8 @@ impl<TYPES: NodeType> BuilderProgress<TYPES> for BuilderState<TYPES> {
}

let da_proposal_data = da_msg.proposal.data.clone();
let sender = da_msg.sender;
// TODO: confirm signature with this...
// let sender = da_msg.sender;

// get the view number and encoded txns from the da_proposal_data
let view_number = da_proposal_data.view_number;
Expand Down Expand Up @@ -324,8 +320,7 @@ impl<TYPES: NodeType> BuilderProgress<TYPES> for BuilderState<TYPES> {
// make sure we don't clone for the bootstrapping da and qc proposals
if qc_proposal_data.view_number.get_u64() != 0 {
tracing::info!("Spawning a clone");
self.clone()
.spawn_clone(da_proposal_data, qc_proposal_data, sender);
self.clone().spawn_clone(da_proposal_data, qc_proposal_data);
} else {
tracing::info!("Not spawning a clone despite matching DA and QC proposals, as they corresponds to bootstrapping phase");
}
Expand Down Expand Up @@ -361,7 +356,8 @@ impl<TYPES: NodeType> BuilderProgress<TYPES> for BuilderState<TYPES> {
return;
}
let qc_proposal_data = qc_msg.proposal.data;
let sender = qc_msg.sender;
// TODO: confirm signature with this...
// let sender = qc_msg.sender;

let payload_vid_commitment = qc_proposal_data.block_header.payload_commitment();
tracing::debug!(
Expand All @@ -383,8 +379,7 @@ impl<TYPES: NodeType> BuilderProgress<TYPES> for BuilderState<TYPES> {
// make sure we don't clone for the bootstrapping da and qc proposals
if da_proposal_data.view_number.get_u64() != 0 {
tracing::info!("Spawning a clone");
self.clone()
.spawn_clone(da_proposal_data, qc_proposal_data, sender);
self.clone().spawn_clone(da_proposal_data, qc_proposal_data);
} else {
tracing::info!("Not spawning a clone despite matching DA and QC proposals, as they corresponds to bootstrapping phase");
}
Expand Down Expand Up @@ -476,7 +471,6 @@ impl<TYPES: NodeType> BuilderProgress<TYPES> for BuilderState<TYPES> {
mut self,
da_proposal: DAProposal<TYPES>,
quorum_proposal: QuorumProposal<TYPES>,
leader: TYPES::SignatureKey,
) {
self.built_from_view_vid_leaf.0 = quorum_proposal.view_number;
self.built_from_view_vid_leaf.1 = quorum_proposal.block_header.payload_commitment();
Expand All @@ -487,7 +481,6 @@ impl<TYPES: NodeType> BuilderProgress<TYPES> for BuilderState<TYPES> {
parent_commitment: quorum_proposal.justify_qc.get_data().leaf_commit,
block_header: quorum_proposal.block_header.clone(),
block_payload: None,
proposer_id: leader,
};
self.built_from_view_vid_leaf.2 = leaf.commit();

Expand Down
7 changes: 1 addition & 6 deletions src/testing/basic_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,6 @@ mod tests {
.block_header
.clone(),
block_payload: None,
proposer_id: sqc_msgs[(i - 1) as usize].proposal.data.proposer_id,
};

let q_data = QuorumData::<TestTypes> {
Expand Down Expand Up @@ -275,14 +274,11 @@ mod tests {
tracing::debug!("Iteration: {} justify_qc: {:?}", i, justify_qc);

let qc_proposal = QuorumProposal::<TestTypes> {
//block_header: TestBlockHeader::genesis(&TestInstanceState {}).0,
block_header: block_header,
view_number: ViewNumber::new(i as u64),
justify_qc: justify_qc.clone(),
timeout_certificate: None,
upgrade_certificate: None,
proposer_id: pub_key,
view_sync_certificate: None,
proposal_certificate: None,
};

let payload_commitment =
Expand Down Expand Up @@ -325,7 +321,6 @@ mod tests {
&qc_proposal.block_header,
),
)),
proposer_id: qc_proposal.proposer_id,
};
current_leaf
}
Expand Down

0 comments on commit 4bf4729

Please sign in to comment.