-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
821 additions
and
134 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
diff a/src/builder_state.rs b/src/builder_state.rs (rejected hunks) | ||
@@ -65,9 +68,8 @@ pub struct QCMessage<TYPES: NodeType> { | ||
} | ||
/// Request Message to be put on the request channel | ||
#[derive(Clone, Debug)] | ||
-pub struct RequestMessage { | ||
- pub requested_vid_commitment: VidCommitment, | ||
- pub requested_view_number: u64, | ||
+pub struct RequestMessageTYPES: NodeType> { | ||
+ pub state_id: BuilderStateIdTYPES>, | ||
pub response_channel: UnboundedSender<ResponseMessage>, | ||
} | ||
pub enum TriggerStatus { | ||
@@ -555,46 +561,39 @@ impl<TYPES: NodeType> BuilderState<TYPES> { | ||
} | ||
} | ||
|
||
- async fn process_block_request(&mut self, req: RequestMessage) { | ||
- let requested_vid_commitment = req.requested_vid_commitment; | ||
- let requested_view_number = | ||
- <<TYPES as NodeType>::Time as ConsensusTime>::new(req.requested_view_number); | ||
+ async fn process_block_request(&mut self, req: RequestMessage<TYPES>) { | ||
// If a spawned clone is active then it will handle the request, otherwise the highest view num builder will handle | ||
- if (requested_vid_commitment == self.built_from_proposed_block.vid_commitment | ||
- && requested_view_number == self.built_from_proposed_block.view_number) | ||
+ if (req.state_id.parent_commitment == self.built_from_proposed_block.vid_commitment | ||
+ && req.state_id.view == self.built_from_proposed_block.view_number) | ||
|| (self.built_from_proposed_block.view_number.u64() | ||
== self | ||
.global_state | ||
.read_arc() | ||
.await | ||
.highest_view_num_builder_id | ||
- .1 | ||
+ .view | ||
.u64()) | ||
{ | ||
tracing::info!( | ||
- "Request handled by builder with view {:?} for (parent {:?}, view_num: {:?})", | ||
+ "Request for parent {} handled by builder with view {:?}", | ||
+ req.state_id, | ||
self.built_from_proposed_block.view_number, | ||
- requested_vid_commitment, | ||
- requested_view_number | ||
); | ||
- let response = self | ||
- .build_block(requested_vid_commitment, requested_view_number) | ||
- .await; | ||
+ let response = self.build_block(req.state_id.clone()).await; | ||
|
||
match response { | ||
Some(response) => { | ||
// form the response message | ||
let response_msg = ResponseMessage { | ||
- builder_hash: response.builder_hash.clone(), | ||
+ builder_hash: response.id.hash.clone(), | ||
block_size: response.block_size, | ||
offered_fee: response.offered_fee, | ||
}; | ||
|
||
- let builder_hash = response.builder_hash.clone(); | ||
+ let builder_hash = response.id.hash.clone(); | ||
self.global_state.write_arc().await.update_global_state( | ||
+ req.state_id.clone(), | ||
response, | ||
- requested_vid_commitment, | ||
- requested_view_number, | ||
response_msg.clone(), | ||
); | ||
|
||
@@ -736,7 +735,7 @@ pub enum MessageType<TYPES: NodeType> { | ||
DecideMessage(DecideMessage<TYPES>), | ||
DaProposalMessage(DaProposalMessage<TYPES>), | ||
QCMessage(QCMessage<TYPES>), | ||
- RequestMessage(RequestMessage), | ||
+ RequestMessage(RequestMessage<TYPES>), | ||
} | ||
|
||
#[allow(clippy::too_many_arguments)] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.