Skip to content

Commit

Permalink
Update Hotshot to 0.5.55 (#1484)
Browse files Browse the repository at this point in the history
Closes #<ISSUE_NUMBER>
<!-- If there is no issue number make sure to describe clearly *why*
this PR is necessary. -->
<!-- Mention open questions, remaining TODOs, if any -->

### This PR:
<!-- Describe what this PR adds to this repo and why -->
<!-- E.g. -->
<!-- * Implements feature 1 -->
<!-- * Fixes bug 3 -->

### This PR does not:
<!-- Describe what is out of scope for this PR, if applicable. Leave
this section blank if it's not applicable -->
<!-- This section helps avoid the reviewer having to needlessly point
out missing parts -->
<!-- * Implement feature 3 because that feature is blocked by Issue 4
-->
<!-- * Implement xyz because that is tracked in issue #123. -->
<!-- * Address xzy for which I opened issue #456 -->

### Key places to review:
<!-- Describe key places for reviewers to pay close attention to -->
<!-- * file.rs, `add_integers` function -->
<!-- Or directly comment on those files/lines to make it easier for the
reviewers -->

<!-- ### How to test this PR:  -->
<!-- Optional, uncomment the above line if this is relevant to your PR
-->
<!-- If your PR is fully tested through CI there is no need to add this
section -->
<!-- * E.g. `just test` -->

<!-- ### Things tested -->
<!-- Anything that was manually tested (that it is not tested in CI).
-->
<!-- E.g. building/running of docker containers. Changes to docker demo,
... -->
<!-- Especially mention anything untested, with reasoning and link an
issue to resolve this. -->

<!-- Complete the following items before creating this PR -->
<!-- [ ] Issue linked or PR description mentions why this change is
necessary. -->
<!-- [ ] PR description is clear enough for reviewers. -->
<!-- [ ] If this is a draft it is marked as "draft".  -->

<!-- To make changes to this template edit
https://github.com/EspressoSystems/.github/blob/main/PULL_REQUEST_TEMPLATE.md
-->
  • Loading branch information
bfish713 authored May 17, 2024
2 parents 2943a51 + a1856a5 commit b69ca39
Show file tree
Hide file tree
Showing 18 changed files with 163 additions and 186 deletions.
31 changes: 16 additions & 15 deletions Cargo.lock

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

20 changes: 10 additions & 10 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,18 +46,18 @@ dotenvy = "0.15"
ethers = { version = "2.0", features = ["solc"] }
futures = "0.3"

hotshot = { git = "https://github.com/EspressoSystems/hotshot", tag = "0.5.54" }
hotshot = { git = "https://github.com/EspressoSystems/hotshot", tag = "0.5.55" }
# Hotshot imports
hotshot-builder-api = { git = "https://github.com/EspressoSystems/HotShot.git", tag = "0.5.54" }
hotshot-builder-core = { git = "https://github.com/EspressoSystems/hotshot-builder-core", tag = "0.1.21" }
hotshot-events-service = { git = "https://github.com/EspressoSystems/hotshot-events-service.git", tag = "0.1.22" }
hotshot-orchestrator = { git = "https://github.com/EspressoSystems/hotshot", tag = "0.5.54" }
hotshot-query-service = { git = "https://github.com/EspressoSystems/hotshot-query-service", tag = "0.1.24" }
hotshot-stake-table = { git = "https://github.com/EspressoSystems/hotshot", tag = "0.5.54" }
hotshot-builder-api = { git = "https://github.com/EspressoSystems/HotShot.git", tag = "0.5.55" }
hotshot-builder-core = { git = "https://github.com/EspressoSystems/hotshot-builder-core", tag = "0.1.22" }
hotshot-events-service = { git = "https://github.com/EspressoSystems/hotshot-events-service.git", tag = "0.1.23" }
hotshot-orchestrator = { git = "https://github.com/EspressoSystems/hotshot", tag = "0.5.55" }
hotshot-query-service = { git = "https://github.com/EspressoSystems/hotshot-query-service", tag = "0.1.25" }
hotshot-stake-table = { git = "https://github.com/EspressoSystems/hotshot", tag = "0.5.55" }
hotshot-state-prover = { version = "0.1.0", path = "hotshot-state-prover" }
hotshot-task = { git = "https://github.com/EspressoSystems/hotshot", tag = "0.5.54" }
hotshot-testing = { git = "https://github.com/EspressoSystems/hotshot", tag = "0.5.54" }
hotshot-types = { git = "https://github.com/EspressoSystems/hotshot", tag = "0.5.54" }
hotshot-task = { git = "https://github.com/EspressoSystems/hotshot", tag = "0.5.55" }
hotshot-testing = { git = "https://github.com/EspressoSystems/hotshot", tag = "0.5.55" }
hotshot-types = { git = "https://github.com/EspressoSystems/hotshot", tag = "0.5.55" }

# Push CDN imports
cdn-broker = { git = "https://github.com/EspressoSystems/Push-CDN", features = [
Expand Down
22 changes: 10 additions & 12 deletions builder/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ pub mod testing {
// Only pass the pub keys to the hotshot config
let known_nodes_without_stake_pub_keys = known_nodes_without_stake
.iter()
.map(|x| <BLSPubKey as SignatureKey>::get_public_key(&x.stake_table_entry))
.map(|x| <BLSPubKey as SignatureKey>::public_key(&x.stake_table_entry))
.collect::<Vec<_>>();

let master_map = MasterMap::new();
Expand Down Expand Up @@ -261,7 +261,7 @@ pub mod testing {
.iter()
.zip(&state_key_pairs)
.map(|(pub_key, state_key_pair)| PeerConfig::<PubKey> {
stake_table_entry: pub_key.get_stake_table_entry(stake_value),
stake_table_entry: pub_key.stake_table_entry(stake_value),
state_ver_key: state_key_pair.ver_key(),
})
.collect::<Vec<_>>();
Expand Down Expand Up @@ -466,7 +466,7 @@ pub mod testing {
// send the events to the event streaming state
async_spawn({
async move {
let mut hotshot_event_stream = hotshot_context_handle.get_event_stream();
let mut hotshot_event_stream = hotshot_context_handle.event_stream();
loop {
let event = hotshot_event_stream.next().await.unwrap();
tracing::debug!("Before writing in event streamer: {event:?}");
Expand Down Expand Up @@ -494,12 +494,12 @@ pub mod testing {
if let Decide { leaf_chain, .. } = event.event {
if let Some(height) = leaf_chain.iter().find_map(|LeafInfo { leaf, .. }| {
if leaf
.get_block_payload()
.block_payload()
.as_ref()?
.transaction_commitments(leaf.get_block_header().metadata())
.transaction_commitments(leaf.block_header().metadata())
.contains(&commitment)
{
Some(leaf.get_block_header().block_number())
Some(leaf.block_header().block_number())
} else {
None
}
Expand Down Expand Up @@ -664,7 +664,7 @@ mod test {
use hotshot_builder_core::service::GlobalState;
use hotshot_types::event::LeafInfo;
use hotshot_types::traits::block_contents::{
vid_commitment, BlockHeader, BlockPayload, GENESIS_VID_NUM_STORAGE_NODES,
vid_commitment, BlockHeader, BlockPayload, EncodeBytes, GENESIS_VID_NUM_STORAGE_NODES,
};
use hotshot_types::utils::BuilderCommitment;
use sequencer::block::payload::Payload;
Expand Down Expand Up @@ -695,7 +695,7 @@ mod test {
let total_nodes = HotShotTestConfig::total_nodes();

// try to listen on non-voting node handle as it is the last handle
let mut events = handles[total_nodes - 1].0.get_event_stream();
let mut events = handles[total_nodes - 1].0.event_stream();
for (handle, ..) in handles.iter() {
handle.hotshot.start_consensus().await;
}
Expand All @@ -709,9 +709,7 @@ mod test {
let builder_commitment = genesis_payload.builder_commitment(&genesis_ns_table);
let genesis_commitment = {
// TODO we should not need to collect payload bytes just to compute vid_commitment
let payload_bytes = genesis_payload
.encode()
.expect("unable to encode genesis payload");
let payload_bytes = genesis_payload.encode();
vid_commitment(&payload_bytes, GENESIS_VID_NUM_STORAGE_NODES)
};
Header::genesis(
Expand All @@ -733,7 +731,7 @@ mod test {
// Check that each successive header satisfies invariants relative to its parent: all
// the fields which should be monotonic are.
for LeafInfo { leaf, .. } in leaf_chain.iter().rev() {
let header = leaf.get_block_header().clone();
let header = leaf.block_header().clone();
if header.height == 0 {
parent = header;
continue;
Expand Down
5 changes: 2 additions & 3 deletions builder/src/non_permissioned.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ use hotshot_types::{
traits::{
block_contents::{vid_commitment, GENESIS_VID_NUM_STORAGE_NODES},
node_implementation::{ConsensusTime, NodeType},
EncodeBytes,
},
utils::BuilderCommitment,
};
Expand Down Expand Up @@ -119,9 +120,7 @@ impl BuilderConfig {
let builder_commitment = genesis_payload.builder_commitment(&genesis_ns_table);

let vid_commitment = {
let payload_bytes = genesis_payload
.encode()
.expect("unable to encode genesis payload");
let payload_bytes = genesis_payload.encode();
vid_commitment(&payload_bytes, GENESIS_VID_NUM_STORAGE_NODES)
};

Expand Down
6 changes: 2 additions & 4 deletions builder/src/permissioned.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ use hotshot_types::{
event::Event,
light_client::StateKeyPair,
signature_key::{BLSPrivKey, BLSPubKey},
traits::{election::Membership, metrics::Metrics},
traits::{election::Membership, metrics::Metrics, EncodeBytes},
utils::BuilderCommitment,
HotShotConfig, PeerConfig, ValidatorConfig,
};
Expand Down Expand Up @@ -407,9 +407,7 @@ impl<N: network::Type, P: SequencerPersistence, Ver: StaticVersionType + 'static

let vid_commitment = {
// TODO we should not need to collect payload bytes just to compute vid_commitment
let payload_bytes = genesis_payload
.encode()
.expect("unable to encode genesis payload");
let payload_bytes = genesis_payload.encode();
vid_commitment(&payload_bytes, GENESIS_VID_NUM_STORAGE_NODES)
};

Expand Down
4 changes: 2 additions & 2 deletions hotshot-state-prover/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,8 @@ async fn init_stake_table_from_orchestrator(
.into_iter()
.for_each(|config| {
st.register(
*config.stake_table_entry.get_key(),
config.stake_table_entry.get_stake(),
*config.stake_table_entry.key(),
config.stake_table_entry.stake(),
config.state_ver_key,
)
.expect("Key registration shouldn't fail.");
Expand Down
Loading

0 comments on commit b69ca39

Please sign in to comment.