/// Helper to issue a support share for a dealing. Assumes we are a receiver
/// for the dealing.
Helper to issue a support share for a dealing. Assumes we are a receiver
for the dealing.
Helper to issue a support share for a dealing . Assumes we are a receiver for the dealing .
fn crypto_create_dealing_support(
        &self,
        id: &EcdsaMessageId,
        transcript_params: &IDkgTranscriptParams,
        dealing: &EcdsaDealing,
    ) -> EcdsaChangeSet {
        if let Err(error) = IDkgProtocol::verify_dealing_private(
            &*self.crypto,
            transcript_params,
            &dealing.idkg_dealing,
        ) {
            if error.is_replicated() {
                self.metrics
                    .pre_sign_errors_inc("verify_dealing_private_permanent");
                return vec![EcdsaChangeAction::HandleInvalid(
                    id.clone(),
                    format!(
                        "Dealing private verification(permanent error): dealer = {:?},
                          height = {:?}, transcript_id = {:?}, error = {:?}",
                        dealing.idkg_dealing.dealer_id,
                        dealing.requested_height,
                        dealing.idkg_dealing.transcript_id,
                        error
                    ),
                )];
            } else {
                self.metrics
                    .pre_sign_errors_inc("verify_dealing_private_transient");
                debug!(
                    self.log,
                    "Dealing private verification(transient error): dealer = {:?},
                          height = {:?}, transcript_id = {:?}, error = {:?}",
                    dealing.idkg_dealing.dealer_id,
                    dealing.requested_height,
                    dealing.idkg_dealing.transcript_id,
                    error
                );
                return Default::default();
            }
        }
        // Generate the multi sig share
        self.crypto
            .sign(dealing, self.node_id, transcript_params.registry_version())
            .map_or_else(
                |error| {
                    debug!(
                        self.log,
                        "Dealing multi sign failed: dealer = {:?},
                          height = {:?}, transcript_id = {:?}, error = {:?}",
                        dealing.idkg_dealing.dealer_id,
                        dealing.requested_height,
                        dealing.idkg_dealing.transcript_id,
                        error
                    );
                    self.metrics
                        .pre_sign_errors_inc("dealing_support_multi_sign");
                    Default::default()
                },
                |multi_sig_share| {
                    let dealing_support = EcdsaDealingSupport {
                        content: dealing.clone(),
                        signature: multi_sig_share,
                    };
                    self.metrics.pre_sign_metrics_inc("dealing_support_sent");
                    vec![EcdsaChangeAction::AddToValidated(
                        EcdsaMessage::EcdsaDealingSupport(dealing_support),
                    )]
                },
            )
    }
fn crypto_create_dealing_support ( & self , id : & EcdsaMessageId , transcript_params : & IDkgTranscriptParams , dealing : & EcdsaDealing , ) -> EcdsaChangeSet { if let Err ( error ) = IDkgProtocol :: verify_dealing_private ( & * self . crypto , transcript_params , & dealing . idkg_dealing , ) { if error . is_replicated ( ) { self . metrics . pre_sign_errors_inc ( " " ) ; return vec ! [ EcdsaChangeAction HandleInvalid ( id clone ( ) format ( " " dealing idkg_dealing dealer_id dealing requested_height dealing idkg_dealing transcript_id error ) ) ] ; } else { self . metrics . pre_sign_errors_inc ( " " ) ; debug ! ( self log " " dealing idkg_dealing dealer_id dealing requested_height dealing idkg_dealing transcript_id error ) ; return Default :: default ( ) ; } } // Generate the multi sig share self . crypto . sign ( dealing , self . node_id , transcript_params . registry_version ( ) ) . map_or_else ( | error | { debug ! ( self log " " dealing idkg_dealing dealer_id dealing requested_height dealing idkg_dealing transcript_id error ) ; self . metrics . pre_sign_errors_inc ( " " ) ; Default :: default ( ) } , | multi_sig_share | { let dealing_support = EcdsaDealingSupport { content : dealing . clone ( ) , signature : multi_sig_share , } ; self . metrics . pre_sign_metrics_inc ( " " ) ; vec ! [ EcdsaChangeAction AddToValidated ( EcdsaMessage EcdsaDealingSupport ( dealing_support ) ) ] } , ) }
Helper to issue a support share for a dealing.
Helper to issue a support share for a dealing .
&self
id
&EcdsaMessageId
transcript_params
&IDkgTranscriptParams
dealing
&EcdsaDealing