Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
ss-es committed Oct 21, 2024
1 parent 7f9bd13 commit cef83ff
Show file tree
Hide file tree
Showing 8 changed files with 57 additions and 56 deletions.
16 changes: 8 additions & 8 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 @@ -3,12 +3,12 @@ resolver = "2"
members = ["crates/*"]

[workspace.dependencies]
hotshot = { git = "https://github.com/EspressoSystems/HotShot.git", branch = "bump/rc-0.5.78" }
hotshot-builder-api = { git = "https://github.com/EspressoSystems/HotShot.git", branch = "bump/rc-0.5.78" }
hotshot-events-service = { git = "https://github.com/EspressoSystems/hotshot-events-service.git", branch = "bump/rc-0.5.78" }
hotshot-task-impls = { git = "https://github.com/EspressoSystems/HotShot.git", branch = "bump/rc-0.5.78" }
hotshot-types = { git = "https://github.com/EspressoSystems/HotShot.git", branch = "bump/rc-0.5.78" }
hotshot-example-types = { git = "https://github.com/EspressoSystems/HotShot.git", branch = "bump/rc-0.5.78" }
hotshot = { git = "https://github.com/EspressoSystems/HotShot.git", tag = "0.5.78" }
hotshot-builder-api = { git = "https://github.com/EspressoSystems/HotShot.git", tag = "0.5.78" }
hotshot-events-service = { git = "https://github.com/EspressoSystems/hotshot-events-service.git", tag = "0.1.50" }
hotshot-task-impls = { git = "https://github.com/EspressoSystems/HotShot.git", tag = "0.5.78" }
hotshot-types = { git = "https://github.com/EspressoSystems/HotShot.git", tag = "0.5.78" }
hotshot-example-types = { git = "https://github.com/EspressoSystems/HotShot.git", tag = "0.5.78" }

anyhow = "1"
async-broadcast = "0.7"
Expand Down
14 changes: 7 additions & 7 deletions crates/legacy/src/builder_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ pub enum TransactionSource {
/// Decide Message to be put on the decide channel
#[derive(Clone, Debug)]
pub struct DecideMessage<Types: NodeType> {
pub latest_decide_view_number: Types::Time,
pub latest_decide_view_number: Types::View,
}
/// DA Proposal Message to be put on the da proposal channel
#[derive(Clone, Debug, PartialEq)]
Expand Down Expand Up @@ -108,7 +108,7 @@ pub enum Status {

#[derive(Debug, Clone, PartialEq)]
pub struct DAProposalInfo<Types: NodeType> {
pub view_number: Types::Time,
pub view_number: Types::View,
pub proposal: Arc<Proposal<Types, DaProposal<Types>>>,
pub num_nodes: usize,
}
Expand Down Expand Up @@ -141,12 +141,12 @@ pub struct BuilderState<Types: NodeType> {
/// `da_proposal_payload_commit` to (`da_proposal`, `node_count`)
#[allow(clippy::type_complexity)]
pub da_proposal_payload_commit_to_da_proposal:
HashMap<(BuilderCommitment, Types::Time), DAProposalInfo<Types>>,
HashMap<(BuilderCommitment, Types::View), DAProposalInfo<Types>>,

/// `quorum_proposal_payload_commit` to `quorum_proposal`
#[allow(clippy::type_complexity)]
pub quorum_proposal_payload_commit_to_quorum_proposal:
HashMap<(BuilderCommitment, Types::Time), Arc<Proposal<Types, QuorumProposal<Types>>>>,
HashMap<(BuilderCommitment, Types::View), Arc<Proposal<Types, QuorumProposal<Types>>>>,

/// Spawned-from references to the parent block.
pub parent_block_references: ParentBlockReferences<Types>,
Expand Down Expand Up @@ -199,7 +199,7 @@ pub struct BuilderState<Types: NodeType> {
/// a builder should stop producing empty blocks. This is done specifically
/// to allow for faster finalization of previous blocks that have had
/// transactions included in them.
pub allow_empty_block_until: Option<Types::Time>,
pub allow_empty_block_until: Option<Types::View>,
}

/// [`best_builder_states_to_extend`] is a utility function that is used to
Expand Down Expand Up @@ -678,7 +678,7 @@ impl<Types: NodeType> BuilderState<Types> {
.retain(|tx| self.txns_in_queue.contains(&tx.commit));

if !txn_commitments.is_empty() {
self.allow_empty_block_until = Some(Types::Time::new(
self.allow_empty_block_until = Some(Types::View::new(
da_proposal_info.view_number.u64() + ALLOW_EMPTY_BLOCK_PERIOD,
));
}
Expand Down Expand Up @@ -1195,7 +1195,7 @@ mod test {
// call process_da_proposal without matching quorum proposal message
// da_proposal_payload_commit_to_da_proposal should insert the message
let mut correct_da_proposal_payload_commit_to_da_proposal: HashMap<
(BuilderCommitment, <TestTypes as NodeType>::Time),
(BuilderCommitment, <TestTypes as NodeType>::View),
DAProposalInfo<TestTypes>,
> = HashMap::new();
let (payload_builder_commitment, da_proposal_info) =
Expand Down
24 changes: 12 additions & 12 deletions crates/legacy/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ pub struct GlobalState<Types: NodeType> {
pub tx_sender: BroadcastSender<Arc<ReceivedTransaction<Types>>>,

// last garbage collected view number
pub last_garbage_collected_view_num: Types::Time,
pub last_garbage_collected_view_num: Types::View,

// highest view running builder task
pub highest_view_num_builder_id: BuilderStateId<Types>,
Expand Down Expand Up @@ -217,8 +217,8 @@ impl<Types: NodeType> GlobalState<Types> {
bootstrap_sender: BroadcastSender<MessageType<Types>>,
tx_sender: BroadcastSender<Arc<ReceivedTransaction<Types>>>,
bootstrapped_builder_state_id: VidCommitment,
bootstrapped_view_num: Types::Time,
last_garbage_collected_view_num: Types::Time,
bootstrapped_view_num: Types::View,
last_garbage_collected_view_num: Types::View,
max_block_size_increment_period: Duration,
protocol_max_block_size: u64,
) -> Self {
Expand Down Expand Up @@ -351,7 +351,7 @@ impl<Types: NodeType> GlobalState<Types> {
/// target cutoff view number for tracking purposes. The value returned
/// is the cutoff view number such that the returned value indicates the
/// point before which everything was cleaned up.
pub fn remove_handles(&mut self, on_decide_view: Types::Time) -> Types::Time {
pub fn remove_handles(&mut self, on_decide_view: Types::View) -> Types::View {
// remove everything from the spawned builder states when view_num <= on_decide_view;
// if we don't have a highest view > decide, use highest view as cutoff.
let cutoff = std::cmp::min(self.highest_view_num_builder_id.parent_view, on_decide_view);
Expand All @@ -361,7 +361,7 @@ impl<Types: NodeType> GlobalState<Types> {
let cutoff_u64 = cutoff.u64();
let gc_view = if cutoff_u64 > 0 { cutoff_u64 - 1 } else { 0 };

self.last_garbage_collected_view_num = Types::Time::new(gc_view);
self.last_garbage_collected_view_num = Types::View::new(gc_view);

cutoff
}
Expand Down Expand Up @@ -407,7 +407,7 @@ impl<Types: NodeType> GlobalState<Types> {
}

// check for the existence of the builder state for a view
pub fn check_builder_state_existence_for_a_view(&self, key: &Types::Time) -> bool {
pub fn check_builder_state_existence_for_a_view(&self, key: &Types::View) -> bool {
// iterate over the spawned builder states and check if the view number exists
self.spawned_builder_states
.iter()
Expand All @@ -416,8 +416,8 @@ impl<Types: NodeType> GlobalState<Types> {

pub fn should_view_handle_other_proposals(
&self,
builder_view: &Types::Time,
proposal_view: &Types::Time,
builder_view: &Types::View,
proposal_view: &Types::View,
) -> bool {
*builder_view == self.highest_view_num_builder_id.parent_view
&& !self.check_builder_state_existence_for_a_view(proposal_view)
Expand Down Expand Up @@ -585,7 +585,7 @@ impl<Types: NodeType> ProxyGlobalState<Types> {

let state_id = BuilderStateId {
parent_commitment: *for_parent,
parent_view: Types::Time::new(view_number),
parent_view: Types::View::new(view_number),
};

// verify the signature
Expand Down Expand Up @@ -757,7 +757,7 @@ impl<Types: NodeType> ProxyGlobalState<Types> {
) -> Result<AvailableBlockData<Types>, ClaimBlockError<Types>> {
let block_id = BlockId {
hash: block_hash.clone(),
view: Types::Time::new(view_number),
view: Types::View::new(view_number),
};

tracing::info!("Received request for claiming block {block_id}",);
Expand Down Expand Up @@ -832,7 +832,7 @@ impl<Types: NodeType> ProxyGlobalState<Types> {
) -> Result<AvailableBlockHeaderInput<Types>, ClaimBlockHeaderInputError<Types>> {
let id = BlockId {
hash: block_hash.clone(),
view: Types::Time::new(view_number),
view: Types::View::new(view_number),
};

tracing::info!("Received request for claiming block header input for block {id}");
Expand Down Expand Up @@ -1312,7 +1312,7 @@ async fn handle_quorum_event_implementation<Types: NodeType>(

async fn handle_decide_event<Types: NodeType>(
decide_channel_sender: &BroadcastSender<MessageType<Types>>,
latest_decide_view_number: Types::Time,
latest_decide_view_number: Types::View,
) {
let decide_msg: DecideMessage<Types> = DecideMessage::<Types> {
latest_decide_view_number,
Expand Down
5 changes: 3 additions & 2 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, Leaf, QuorumProposal, ViewNumber},
data::{DaProposal, EpochNumber, Leaf, QuorumProposal, ViewNumber},
message::Proposal,
signature_key::BLSPubKey,
simple_certificate::{QuorumCertificate, SimpleCertificate, SuccessThreshold},
Expand Down Expand Up @@ -77,7 +77,8 @@ mod tests {
)]
struct TestTypes;
impl NodeType for TestTypes {
type Time = ViewNumber;
type View = ViewNumber;
type Epoch = EpochNumber;
type BlockHeader = TestBlockHeader;
type BlockPayload = TestBlockPayload;
type SignatureKey = BLSPubKey;
Expand Down
12 changes: 6 additions & 6 deletions crates/marketplace/src/builder_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,12 @@ pub enum TransactionSource {
/// Decide Message to be put on the decide channel
#[derive(Clone, Debug)]
pub struct DecideMessage<Types: NodeType> {
pub latest_decide_view_number: Types::Time,
pub latest_decide_view_number: Types::View,
}
/// DA Proposal Message to be put on the da proposal channel
#[derive(Debug, Clone, PartialEq)]
pub struct DaProposalMessage<Types: NodeType> {
pub view_number: Types::Time,
pub view_number: Types::View,
pub txn_commitments: Vec<Commitment<Types::Transaction>>,
pub sender: <Types as NodeType>::SignatureKey,
pub builder_commitment: BuilderCommitment,
Expand All @@ -65,7 +65,7 @@ pub struct QuorumProposalMessage<Types: NodeType> {
/// Request Message to be put on the request channel
#[derive(Clone, Debug)]
pub struct RequestMessage<Types: NodeType> {
pub requested_view_number: Types::Time,
pub requested_view_number: Types::View,
pub response_channel: UnboundedSender<ResponseMessage<Types>>,
}
pub enum TriggerStatus {
Expand Down Expand Up @@ -121,12 +121,12 @@ pub struct BuilderState<Types: NodeType> {
/// `da_proposal_payload_commit` to (`da_proposal`, `node_count`)
#[allow(clippy::type_complexity)]
pub da_proposal_payload_commit_to_da_proposal:
HashMap<(BuilderCommitment, Types::Time), Arc<DaProposalMessage<Types>>>,
HashMap<(BuilderCommitment, Types::View), Arc<DaProposalMessage<Types>>>,

/// `quorum_proposal_payload_commit` to `quorum_proposal`
#[allow(clippy::type_complexity)]
pub quorum_proposal_payload_commit_to_quorum_proposal:
HashMap<(BuilderCommitment, Types::Time), Arc<Proposal<Types, QuorumProposal<Types>>>>,
HashMap<(BuilderCommitment, Types::View), Arc<Proposal<Types, QuorumProposal<Types>>>>,

/// Spawned-from references to the parent block.
pub parent_block_references: ParentBlockReferences<Types>,
Expand Down Expand Up @@ -1153,7 +1153,7 @@ mod test {
// call process_da_proposal without matching quorum proposal message
// da_proposal_payload_commit_to_da_proposal should insert the message
let mut correct_da_proposal_payload_commit_to_da_proposal: HashMap<
(BuilderCommitment, <TestTypes as NodeType>::Time),
(BuilderCommitment, <TestTypes as NodeType>::View),
Arc<DaProposalMessage<TestTypes>>,
> = HashMap::new();

Expand Down
Loading

0 comments on commit cef83ff

Please sign in to comment.