Skip to content

Commit

Permalink
Merge pull request #700 from EspressoSystems/hotshot/rc-0.5.75
Browse files Browse the repository at this point in the history
[WEEKLY RELEASE] HotShot - rc-0.5.75
  • Loading branch information
shenkeyao committed Sep 23, 2024
2 parents 140b30a + 267c7dc commit 426217c
Show file tree
Hide file tree
Showing 11 changed files with 117 additions and 79 deletions.
57 changes: 30 additions & 27 deletions Cargo.lock

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

12 changes: 6 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

[package]
name = "hotshot-query-service"
version = "0.1.53"
version = "0.1.60"
authors = ["Espresso Systems <[email protected]>"]
edition = "2021"
license = "GPL-3.0-or-later"
Expand Down Expand Up @@ -75,9 +75,9 @@ derivative = "2.2"
derive_more = "0.99"
either = "1.12"
futures = "0.3"
hotshot = { git = "https://github.com/EspressoSystems/HotShot.git", tag = "0.5.74" }
hotshot-testing = { git = "https://github.com/EspressoSystems/HotShot.git", tag = "0.5.74", features = ["dependency-tasks"] }
hotshot-types = { git = "https://github.com/EspressoSystems/HotShot.git", tag = "0.5.74" }
hotshot = { git = "https://github.com/EspressoSystems/HotShot.git", tag = "0.5.75" }
hotshot-testing = { git = "https://github.com/EspressoSystems/HotShot.git", tag = "0.5.75", features = ["dependency-tasks"] }
hotshot-types = { git = "https://github.com/EspressoSystems/HotShot.git", tag = "0.5.75" }
itertools = "0.12.1"
jf-merkle-tree = { version = "0.1.0", git = "https://github.com/EspressoSystems/jellyfish", tag = "0.4.5", features = [
"std",
Expand Down Expand Up @@ -119,7 +119,7 @@ tokio-postgres = { version = "0.7", optional = true, default-features = false, f

# Dependencies enabled by feature "testing".
espresso-macros = { git = "https://github.com/EspressoSystems/espresso-macros.git", tag = "0.1.0", optional = true }
hotshot-example-types = { git = "https://github.com/EspressoSystems/HotShot.git", tag = "0.5.74", optional = true }
hotshot-example-types = { git = "https://github.com/EspressoSystems/HotShot.git", tag = "0.5.75", optional = true }
portpicker = { version = "0.1", optional = true }
rand = { version = "0.8", optional = true }
spin_sleep = { version = "1.2", optional = true }
Expand All @@ -140,7 +140,7 @@ backtrace-on-stack-overflow = { version = "0.3", optional = true }
clap = { version = "4.5", features = ["derive", "env"] }
espresso-macros = { git = "https://github.com/EspressoSystems/espresso-macros.git", tag = "0.1.0" }
generic-array = "0.14"
hotshot-example-types = { git = "https://github.com/EspressoSystems/HotShot.git", tag = "0.5.74" }
hotshot-example-types = { git = "https://github.com/EspressoSystems/HotShot.git", tag = "0.5.75" }
portpicker = "0.1"
rand = "0.8"
reqwest = "0.12.3"
Expand Down
12 changes: 3 additions & 9 deletions examples/simple-server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,23 +163,19 @@ async fn init_consensus(
// Get the number of nodes with stake
let num_nodes_with_stake = NonZeroUsize::new(pub_keys.len()).unwrap();

let da_membership = MockMembership::create_election(
let da_membership = MockMembership::new(
known_nodes_with_stake.clone(),
known_nodes_with_stake.clone(),
Topic::Da,
0,
);
let non_da_membership = MockMembership::create_election(
let non_da_membership = MockMembership::new(
known_nodes_with_stake.clone(),
known_nodes_with_stake.clone(),
Topic::Global,
0,
);
let memberships = Memberships {
quorum_membership: non_da_membership.clone(),
da_membership: da_membership.clone(),
vid_membership: non_da_membership.clone(),
view_sync_membership: non_da_membership.clone(),
};

// Pick a random, unused port for the builder server
Expand All @@ -203,7 +199,6 @@ async fn init_consensus(
builder_urls: vec1::vec1![builder_url],
fixed_leader_for_gpuvid: 0,
num_nodes_with_stake,
num_nodes_without_stake: 0,
known_nodes_with_stake: known_nodes_with_stake.clone(),
known_nodes_without_stake: vec![],
start_delay: 0,
Expand All @@ -214,7 +209,6 @@ async fn init_consensus(
execution_type: ExecutionType::Continuous,
known_da_nodes: known_nodes_with_stake.clone(),
da_staked_committee_size: pub_keys.len(),
da_non_staked_committee_size: 0,
my_own_validator_config: Default::default(),
data_request_delay: Duration::from_millis(200),
view_sync_timeout: Duration::from_millis(250),
Expand Down Expand Up @@ -270,7 +264,7 @@ async fn init_consensus(
config,
memberships,
network,
HotShotInitializer::from_genesis(TestInstanceState::default())
HotShotInitializer::from_genesis::<MockVersions>(TestInstanceState::default())
.await
.unwrap(),
ConsensusMetricsValue::new(&*data_source.populate_metrics()),
Expand Down
6 changes: 5 additions & 1 deletion src/availability.rs
Original file line number Diff line number Diff line change
Expand Up @@ -851,6 +851,8 @@ mod test {

#[async_std::test]
async fn test_extensions() {
use hotshot_example_types::node_types::TestVersions;

setup_test();

let dir = TempDir::with_prefix("test_availability_extensions").unwrap();
Expand All @@ -863,7 +865,9 @@ mod test {

// mock up some consensus data.
let leaf = Leaf::<MockTypes>::genesis(&Default::default(), &Default::default()).await;
let qc = QuorumCertificate::genesis(&Default::default(), &Default::default()).await;
let qc =
QuorumCertificate::genesis::<TestVersions>(&Default::default(), &Default::default())
.await;
let leaf = LeafQueryData::new(leaf, qc).unwrap();
let block = BlockQueryData::new(leaf.header().clone(), MockPayload::genesis());

Expand Down
19 changes: 13 additions & 6 deletions src/availability/query_data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use hotshot_types::{
traits::{
self,
block_contents::{BlockHeader, GENESIS_VID_NUM_STORAGE_NODES},
node_implementation::NodeType,
node_implementation::{NodeType, Versions},
EncodeBytes,
},
vid::{vid_scheme, VidCommitment},
Expand Down Expand Up @@ -213,23 +213,27 @@ impl<Types: NodeType> LeafQueryData<Types> {
leaf: Leaf<Types>,
qc: QuorumCertificate<Types>,
) -> Result<Self, InconsistentLeafError<Types>> {
// TODO: Replace with the new `commit` function in HotShot. Add an `upgrade_lock` parameter
// and a `HsVer: Versions` bound, then call `leaf.commit(upgrade_lock).await`. This will
// require updates in callers and relevant types as well.
let leaf_commit = <Leaf<Types> as Committable>::commit(&leaf);
ensure!(
qc.data.leaf_commit == leaf.commit(),
qc.data.leaf_commit == leaf_commit,
InconsistentLeafSnafu {
leaf: leaf.commit(),
leaf: leaf_commit,
qc_leaf: qc.data.leaf_commit
}
);
Ok(Self { leaf, qc })
}

pub async fn genesis(
pub async fn genesis<HsVer: Versions>(
validated_state: &Types::ValidatedState,
instance_state: &Types::InstanceState,
) -> Self {
Self {
leaf: Leaf::genesis(validated_state, instance_state).await,
qc: QuorumCertificate::genesis(validated_state, instance_state).await,
qc: QuorumCertificate::genesis::<HsVer>(validated_state, instance_state).await,
}
}

Expand All @@ -246,7 +250,10 @@ impl<Types: NodeType> LeafQueryData<Types> {
}

pub fn hash(&self) -> LeafHash<Types> {
self.leaf.commit()
// TODO: Replace with the new `commit` function in HotShot. Add an `upgrade_lock` parameter
// and a `HsVer: Versions` bound, then call `leaf.commit(upgrade_lock).await`. This will
// require updates in callers and relevant types as well.
<Leaf<Types> as Committable>::commit(&self.leaf)
}

pub fn block_hash(&self) -> BlockHash<Types> {
Expand Down
Loading

0 comments on commit 426217c

Please sign in to comment.