diff --git a/code/actors/src/node.rs b/code/actors/src/node.rs index 32d735c3e..6c8ef7dfe 100644 --- a/code/actors/src/node.rs +++ b/code/actors/src/node.rs @@ -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)? } } diff --git a/code/actors/src/proposal_builder.rs b/code/actors/src/proposal_builder.rs index e2fb8a3fd..f53f46eb5 100644 --- a/code/actors/src/proposal_builder.rs +++ b/code/actors/src/proposal_builder.rs @@ -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; @@ -31,7 +32,7 @@ pub struct ReceivedProposedValue { pub enum Msg { // Initialize the builder state with the gossip actor Init { - gossip_actor: ActorRef>, + consensus: ActorRef>, part_store: PartStore, }, @@ -56,7 +57,7 @@ pub enum Msg { } pub struct State { - gossip_actor: Option>>, + consensus: Option>>, part_store: PartStore, } @@ -92,7 +93,7 @@ where round: Round, timeout_duration: Duration, address: Ctx::Address, - gossip_actor: Option>>, + gossip_actor: Option>>, part_store: &mut PartStore, ) -> Result, ActorProcessingErr> { let value = self @@ -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) } } @@ -146,7 +146,7 @@ impl Actor for ProposalBuilder { _: Self::Arguments, ) -> Result { Ok(State { - gossip_actor: None, + consensus: None, part_store: PartStore::new(), }) } @@ -159,10 +159,10 @@ impl Actor for ProposalBuilder { ) -> 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 } @@ -179,7 +179,7 @@ impl Actor for ProposalBuilder { round, timeout_duration, address, - state.gossip_actor.clone(), + state.consensus.clone(), &mut state.part_store, ) .await?; @@ -191,10 +191,10 @@ impl Actor for ProposalBuilder { // 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::::BlockReceived(value_assembled)) + .cast(ConsensusMsg::::BlockReceived(value_assembled)) .unwrap(); } }