Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
romac committed Jun 17, 2024
1 parent cb2661f commit cd0dbd0
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 21 deletions.
15 changes: 2 additions & 13 deletions code/crates/actors/src/consensus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,6 @@ pub enum Msg<Ctx: Context> {
// The proposal builder has build a new block part, needs to be signed and gossiped by consensus
GossipBlockPart(Ctx::BlockPart),
BlockReceived(ReceivedProposedValue<Ctx>),

// FIXME: Remove
DoNothing,
}

impl<Ctx: Context> From<TimeoutElapsed> for Msg<Ctx> {
Expand Down Expand Up @@ -335,18 +332,12 @@ where

// TODO: Verify that the proposal was signed by the proposer for the height and round, drop otherwise.
self.host.call_and_forward(
|reply_to| HostMsg::<Ctx>::ReceivedBlockPart {
|reply_to| HostMsg::ReceivedBlockPart {
block_part: signed_block_part.block_part,
reply_to,
},
&myself,
|maybe_value| {
if let Some(value) = maybe_value {
Msg::<Ctx>::BlockReceived(value)
} else {
Msg::<Ctx>::DoNothing // FIXME
}
},
|value| Msg::BlockReceived(value),
None,
)?;
}
Expand Down Expand Up @@ -674,8 +665,6 @@ where
state: &mut State<Ctx>,
) -> Result<(), ractor::ActorProcessingErr> {
match msg {
Msg::DoNothing => (),

Msg::StartHeight(height) => {
self.metrics.block_start();

Expand Down
2 changes: 1 addition & 1 deletion code/crates/actors/src/host.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ pub enum HostMsg<Ctx: Context> {
/// BlockPart received <-- consensus <-- gossip
ReceivedBlockPart {
block_part: Ctx::BlockPart,
reply_to: RpcReplyPort<Option<ReceivedProposedValue<Ctx>>>,
reply_to: RpcReplyPort<ReceivedProposedValue<Ctx>>,
},

/// Retrieve a block/value for which all parts have been received
Expand Down
5 changes: 3 additions & 2 deletions code/crates/starknet-host/src/actor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -213,8 +213,9 @@ impl Actor for StarknetHost {
block_part,
reply_to,
} => {
let value = self.build_value_from_block_part(state, block_part).await;
reply_to.send(value)?;
if let Some(value) = self.build_value_from_block_part(state, block_part).await {
reply_to.send(value)?;
}

Ok(())
}
Expand Down
11 changes: 6 additions & 5 deletions code/crates/test-app/src/host.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,12 +134,13 @@ impl<Ctx: Context> Actor for Host<Ctx> {
block_part,
reply_to,
} => {
let maybe_block = self
if let Some(value) = self
.build_value(block_part, state.value_builder.as_mut())
.await?;

// Send the proposed value (from blockparts) to consensus/ Driver
reply_to.send(maybe_block)?;
.await?
{
// Send the proposed value (from blockparts) to consensus/ Driver
reply_to.send(value)?;
}
}

HostMsg::GetReceivedValue {
Expand Down

0 comments on commit cd0dbd0

Please sign in to comment.