pub(crate) fn create_summary_payload(
    subnet_id: SubnetId,
    registry_client: &dyn RegistryClient,
    _crypto: &dyn ConsensusCrypto,
    pool_reader: &PoolReader<'_>,
    _state_manager: &dyn StateManager<State = ReplicatedState>,
    _context: &ValidationContext,
    parent_block: &Block,
    log: ReplicaLogger,
) -> Result<ecdsa::Summary, EcdsaPayloadError> {
    let height = parent_block.height().increment();
    if !ecdsa_feature_is_enabled(subnet_id, registry_client, pool_reader, height)? {
        return Ok(None);
    }
    match &parent_block.payload.as_ref().as_data().ecdsa {
        None => Ok(None),
        Some(payload) => {
            // Produce summary payload from the previous batch payload and summary block.
            let previous_summary_block = pool_reader
                .dkg_summary_block(parent_block)
                .ok_or_else(|| {
                    warn!(
                        log,
                        "Fail to find the summary block that governs height {}. This should not happen!",
                        parent_block.height()
                    );
                    EcdsaPayloadError::DkgSummaryBlockNotFound(parent_block.height())
                })?;
            let previous_summary = previous_summary_block
                .payload
                .as_ref()
                .as_summary()
                .ecdsa
                .as_ref()
                .unwrap_or_else(|| {
                    panic!("ECDSA payload exists but previous summary is not found")
                });
            let summary = ecdsa::EcdsaSummaryPayload {
                current_ecdsa_transcript: previous_summary.next_ecdsa_transcript.clone(),
                next_ecdsa_transcript: None,
                ongoing_signatures: payload.ongoing_signatures.clone(),
                // TODO: carrying over available_quadruples is assuming unchanged
                // membership. This problem has to be addressed when membership changes.
                available_quadruples: payload.available_quadruples.clone(),
                next_unused_transcript_id: payload.next_unused_transcript_id,
            };
            Ok(Some(summary))
        }
    }
}
/// Creates a threshold ECDSA summary payload.
Creates a threshold ECDSA summary payload.
Creates a threshold ECDSA summary payload .
pub(crate) fn create_summary_payload(
    subnet_id: SubnetId,
    registry_client: &dyn RegistryClient,
    _crypto: &dyn ConsensusCrypto,
    pool_reader: &PoolReader<'_>,
    _state_manager: &dyn StateManager<State = ReplicatedState>,
    _context: &ValidationContext,
    parent_block: &Block,
    log: ReplicaLogger,
) -> Result<ecdsa::Summary, EcdsaPayloadError> {
    let height = parent_block.height().increment();
    if !ecdsa_feature_is_enabled(subnet_id, registry_client, pool_reader, height)? {
        return Ok(None);
    }
    match &parent_block.payload.as_ref().as_data().ecdsa {
        None => Ok(None),
        Some(payload) => {
            // Produce summary payload from the previous batch payload and summary block.
            let previous_summary_block = pool_reader
                .dkg_summary_block(parent_block)
                .ok_or_else(|| {
                    warn!(
                        log,
                        "Fail to find the summary block that governs height {}. This should not happen!",
                        parent_block.height()
                    );
                    EcdsaPayloadError::DkgSummaryBlockNotFound(parent_block.height())
                })?;
            let previous_summary = previous_summary_block
                .payload
                .as_ref()
                .as_summary()
                .ecdsa
                .as_ref()
                .unwrap_or_else(|| {
                    panic!("ECDSA payload exists but previous summary is not found")
                });
            let summary = ecdsa::EcdsaSummaryPayload {
                current_ecdsa_transcript: previous_summary.next_ecdsa_transcript.clone(),
                next_ecdsa_transcript: None,
                ongoing_signatures: payload.ongoing_signatures.clone(),
                // TODO: carrying over available_quadruples is assuming unchanged
                // membership. This problem has to be addressed when membership changes.
                available_quadruples: payload.available_quadruples.clone(),
                next_unused_transcript_id: payload.next_unused_transcript_id,
            };
            Ok(Some(summary))
        }
    }
}
pub ( crate ) fn create_summary_payload ( subnet_id : SubnetId , registry_client : & dyn RegistryClient , _crypto : & dyn ConsensusCrypto , pool_reader : & PoolReader < ' _ > , _state_manager : & dyn StateManager < State = ReplicatedState > , _context : & ValidationContext , parent_block : & Block , log : ReplicaLogger , ) -> Result < ecdsa :: Summary , EcdsaPayloadError > { let height = parent_block . height ( ) . increment ( ) ; if ! ecdsa_feature_is_enabled ( subnet_id , registry_client , pool_reader , height ) ? { return Ok ( None ) ; } match & parent_block . payload . as_ref ( ) . as_data ( ) . ecdsa { None => Ok ( None ) , Some ( payload ) => { // Produce summary payload from the previous batch payload and summary block. let previous_summary_block = pool_reader . dkg_summary_block ( parent_block ) . ok_or_else ( | | { warn ! ( log " " parent_block height ( ) ) ; EcdsaPayloadError :: DkgSummaryBlockNotFound ( parent_block . height ( ) ) } ) ? ; let previous_summary = previous_summary_block . payload . as_ref ( ) . as_summary ( ) . ecdsa . as_ref ( ) . unwrap_or_else ( | | { panic ! ( " " ) } ) ; let summary = ecdsa :: EcdsaSummaryPayload { current_ecdsa_transcript : previous_summary . next_ecdsa_transcript . clone ( ) , next_ecdsa_transcript : None , ongoing_signatures : payload . ongoing_signatures . clone ( ) , // TODO: carrying over available_quadruples is assuming unchanged // membership. This problem has to be addressed when membership changes. available_quadruples : payload . available_quadruples . clone ( ) , next_unused_transcript_id : payload . next_unused_transcript_id , } ; Ok ( Some ( summary ) ) } } }
Creates a threshold ECDSA summary payload.
Creates a threshold ECDSA summary payload .
subnet_id
SubnetId
registry_client
&dyn RegistryClient
_crypto
&dyn ConsensusCrypto
pool_reader
&PoolReader<'_>
_state_manager
&dyn StateManager<State = ReplicatedState>
_context
&ValidationContext
parent_block
&Block
log
ReplicaLogger
subnet_id
SubnetId
registry_client
&dyn RegistryClient
_crypto
&dyn ConsensusCrypto
pool_reader
&PoolReader<'_>
_state_manager
&dyn StateManager<State = ReplicatedState>
_context
&ValidationContext
parent_block
&Block
log
ReplicaLogger