-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WEEKLY RELEASE] Bump HotShot #743
Changes from 5 commits
8695018
1dcab37
4974e42
d3e1397
e0887c3
a5a8292
3d694f0
faf78b9
c707270
d0d4391
5e2c984
31ab748
ab55db8
0d75e20
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,8 +13,8 @@ | |
use crate::{types::HeightIndexed, Header, Metadata, Payload, Transaction, VidCommon, VidShare}; | ||
use committable::{Commitment, Committable}; | ||
use hotshot_types::{ | ||
data::Leaf, | ||
simple_certificate::QuorumCertificate, | ||
data::{Leaf, Leaf2}, | ||
simple_certificate::{QuorumCertificate, QuorumCertificate2}, | ||
traits::{ | ||
self, | ||
block_contents::{BlockHeader, GENESIS_VID_NUM_STORAGE_NODES}, | ||
|
@@ -28,7 +28,7 @@ use serde::{de::DeserializeOwned, Deserialize, Serialize}; | |
use snafu::{ensure, Snafu}; | ||
use std::fmt::Debug; | ||
|
||
pub type LeafHash<Types> = Commitment<Leaf<Types>>; | ||
pub type LeafHash<Types> = Commitment<Leaf2<Types>>; | ||
/// A block hash is the hash of the block header. | ||
/// | ||
/// A block consists of a header and a payload. But the header itself contains a commitment to the | ||
|
@@ -190,8 +190,8 @@ pub trait QueryablePayload<Types: NodeType>: traits::BlockPayload<Types> { | |
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)] | ||
#[serde(bound = "")] | ||
pub struct LeafQueryData<Types: NodeType> { | ||
pub(crate) leaf: Leaf<Types>, | ||
pub(crate) qc: QuorumCertificate<Types>, | ||
pub(crate) leaf: Leaf2<Types>, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. hmm I am not too sure about this change. We should be inserting Leaf1 for now or migrate the exisitng leaves to Leaf2 and start inserting leaf2 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. but in the sequencer, we are inserting V1 of everything so I think we want to keep it as Leaf1? |
||
pub(crate) qc: QuorumCertificate2<Types>, | ||
} | ||
|
||
#[derive(Clone, Debug, Snafu)] | ||
|
@@ -210,13 +210,13 @@ impl<Types: NodeType> LeafQueryData<Types> { | |
/// | ||
/// Fails with an [`InconsistentLeafError`] if `qc` does not reference `leaf`. | ||
pub fn new( | ||
mut leaf: Leaf<Types>, | ||
qc: QuorumCertificate<Types>, | ||
mut leaf: Leaf2<Types>, | ||
qc: QuorumCertificate2<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); | ||
let leaf_commit = <Leaf2<Types> as Committable>::commit(&leaf); | ||
ensure!( | ||
qc.data.leaf_commit == leaf_commit, | ||
InconsistentLeafSnafu { | ||
|
@@ -237,16 +237,18 @@ impl<Types: NodeType> LeafQueryData<Types> { | |
instance_state: &Types::InstanceState, | ||
) -> Self { | ||
Self { | ||
leaf: Leaf::genesis(validated_state, instance_state).await, | ||
qc: QuorumCertificate::genesis::<HsVer>(validated_state, instance_state).await, | ||
leaf: Leaf::genesis(validated_state, instance_state).await.into(), | ||
qc: QuorumCertificate::genesis::<HsVer>(validated_state, instance_state) | ||
.await | ||
.to_qc2(), | ||
} | ||
} | ||
|
||
pub fn leaf(&self) -> &Leaf<Types> { | ||
pub fn leaf(&self) -> &Leaf2<Types> { | ||
&self.leaf | ||
} | ||
|
||
pub fn qc(&self) -> &QuorumCertificate<Types> { | ||
pub fn qc(&self) -> &QuorumCertificate2<Types> { | ||
&self.qc | ||
} | ||
|
||
|
@@ -258,7 +260,7 @@ impl<Types: NodeType> LeafQueryData<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. | ||
<Leaf<Types> as Committable>::commit(&self.leaf) | ||
<Leaf2<Types> as Committable>::commit(&self.leaf) | ||
} | ||
|
||
pub fn block_hash(&self) -> BlockHash<Types> { | ||
|
@@ -457,7 +459,9 @@ impl<Types: NodeType> VidCommonQueryData<Types> { | |
validated_state: &Types::ValidatedState, | ||
instance_state: &Types::InstanceState, | ||
) -> Self { | ||
let leaf = Leaf::<Types>::genesis(validated_state, instance_state).await; | ||
let leaf: Leaf2<Types> = Leaf::<Types>::genesis(validated_state, instance_state) | ||
.await | ||
.into(); | ||
let payload = leaf.block_payload().unwrap(); | ||
let bytes = payload.encode(); | ||
let disperse = vid_scheme(GENESIS_VID_NUM_STORAGE_NODES) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we haven't updated this in a while. The version should be 0.1.75