MCPcopy Create free account
hub / github.com/consensus-shipyard/ipc / process_proposal

Method process_proposal

fendermint/app/src/app.rs:793–841  ·  view source on GitHub ↗

Inspect a proposal and decide whether to vote on it.

(
        &self,
        request: request::ProcessProposal,
    )

Source from the content-addressed store, hash-verified

791
792 /// Inspect a proposal and decide whether to vote on it.
793 async fn process_proposal(
794 &self,
795 request: request::ProcessProposal,
796 ) -> AbciResult<response::ProcessProposal> {
797 tracing::debug!(
798 height = request.height.value(),
799 time = request.time.to_string(),
800 "process proposal"
801 );
802 let txs: Vec<_> = request.txs.into_iter().map(|tx| tx.to_vec()).collect();
803 let size_txs = txs.iter().map(|tx| tx.len()).sum::<usize>();
804 let num_txs = txs.len();
805
806 let state = self
807 .read_only_view(Some(request.height.value()))?
808 .ok_or_else(|| anyhow!("exec state should be present"))?;
809
810 let process_decision = self
811 .messages_interpreter
812 .attest_block_messages(state, txs)
813 .await
814 .context("failed to process proposal")?;
815
816 let accept = process_decision == AttestMessagesResponse::Accept;
817
818 emit(BlockProposalReceived {
819 height: request.height.value(),
820 hash: HexEncodableBlockHash(request.hash.into()),
821 size: size_txs,
822 tx_count: num_txs,
823 validator: &request.proposer_address,
824 });
825
826 emit(BlockProposalEvaluated {
827 height: request.height.value(),
828 hash: HexEncodableBlockHash(request.hash.into()),
829 size: size_txs,
830 tx_count: num_txs,
831 validator: &request.proposer_address,
832 accept,
833 reason: None,
834 });
835
836 if accept {
837 Ok(response::ProcessProposal::Accept)
838 } else {
839 Ok(response::ProcessProposal::Reject)
840 }
841 }
842
843 /// Execute and finalize an entire block (ABCI 2.0).
844 async fn finalize_block(

Callers

nothing calls this directly

Calls 9

emitFunction · 0.85
collectMethod · 0.80
read_only_viewMethod · 0.80
contextMethod · 0.80
attest_block_messagesMethod · 0.80
iterMethod · 0.45
lenMethod · 0.45
intoMethod · 0.45

Tested by

no test coverage detected