Skip to content

Commit

Permalink
Rename field for consistency
Browse files Browse the repository at this point in the history
  • Loading branch information
romac committed May 30, 2024
1 parent a572cbc commit 9dd8c69
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 15 deletions.
4 changes: 3 additions & 1 deletion code/actors/src/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,11 +163,13 @@ where
match msg {
Msg::Start => {
let part_store = util::value_builder::test::PartStore::default();

self.proposal_builder
.cast(crate::proposal_builder::Msg::Init {
gossip_actor: self.consensus.clone(),
consensus: self.consensus.clone(),
part_store,
})?;

self.mempool.cast(crate::mempool::Msg::Start)?
}
}
Expand Down
28 changes: 14 additions & 14 deletions code/actors/src/proposal_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use ractor::{async_trait, Actor, ActorProcessingErr, ActorRef, RpcReplyPort};
use malachite_common::{Context, Round};
use malachite_driver::Validity;

use crate::consensus::Msg as ConsensusMsg;
use crate::util::value_builder::test::PartStore;
use crate::util::ValueBuilder;

Expand All @@ -31,7 +32,7 @@ pub struct ReceivedProposedValue<Ctx: Context> {
pub enum Msg<Ctx: Context> {
// Initialize the builder state with the gossip actor
Init {
gossip_actor: ActorRef<crate::consensus::Msg<Ctx>>,
consensus: ActorRef<ConsensusMsg<Ctx>>,
part_store: PartStore,
},

Expand All @@ -56,7 +57,7 @@ pub enum Msg<Ctx: Context> {
}

pub struct State<Ctx: Context> {
gossip_actor: Option<ActorRef<crate::consensus::Msg<Ctx>>>,
consensus: Option<ActorRef<ConsensusMsg<Ctx>>>,
part_store: PartStore,
}

Expand Down Expand Up @@ -92,7 +93,7 @@ where
round: Round,
timeout_duration: Duration,
address: Ctx::Address,
gossip_actor: Option<ActorRef<crate::consensus::Msg<Ctx>>>,
gossip_actor: Option<ActorRef<ConsensusMsg<Ctx>>>,
part_store: &mut PartStore,
) -> Result<LocallyProposedValue<Ctx>, ActorProcessingErr> {
let value = self
Expand Down Expand Up @@ -124,12 +125,11 @@ where
.value_builder
.build_value_from_block_parts(block_part, part_store)
.await;
if value.is_some() {
info!(
"Value Builder received all parts, produced value {:?} for proposal",
value
);

if let Some(value) = &value {
info!("Value Builder received all parts, produced value for proposal: {value:?}",);
}

Ok(value)
}
}
Expand All @@ -146,7 +146,7 @@ impl<Ctx: Context + std::fmt::Debug> Actor for ProposalBuilder<Ctx> {
_: Self::Arguments,
) -> Result<Self::State, ActorProcessingErr> {
Ok(State {
gossip_actor: None,
consensus: None,
part_store: PartStore::new(),
})
}
Expand All @@ -159,10 +159,10 @@ impl<Ctx: Context + std::fmt::Debug> Actor for ProposalBuilder<Ctx> {
) -> Result<(), ActorProcessingErr> {
match msg {
Msg::Init {
gossip_actor,
consensus,
part_store,
} => {
state.gossip_actor = Some(gossip_actor);
state.consensus = Some(consensus);
state.part_store = part_store
}

Expand All @@ -179,7 +179,7 @@ impl<Ctx: Context + std::fmt::Debug> Actor for ProposalBuilder<Ctx> {
round,
timeout_duration,
address,
state.gossip_actor.clone(),
state.consensus.clone(),
&mut state.part_store,
)
.await?;
Expand All @@ -191,10 +191,10 @@ impl<Ctx: Context + std::fmt::Debug> Actor for ProposalBuilder<Ctx> {
// Send the proposed value (from blockparts) to consensus/ Driver
if let Some(value_assembled) = maybe_block {
state
.gossip_actor
.consensus
.as_ref()
.unwrap()
.cast(crate::consensus::Msg::<Ctx>::BlockReceived(value_assembled))
.cast(ConsensusMsg::<Ctx>::BlockReceived(value_assembled))
.unwrap();
}
}
Expand Down

0 comments on commit 9dd8c69

Please sign in to comment.