Skip to content

Commit

Permalink
Add comment about non-generic no-inline functions
Browse files Browse the repository at this point in the history
  • Loading branch information
moshababo committed Nov 2, 2023
1 parent 91b4f64 commit 28526fd
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion node/libs/crypto/src/bn254/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,10 @@ impl Ord for PublicKey {
pub struct Signature(G1);

impl Signature {
/// Verifies a signature against the provided public key
/// Verifies a signature against the provided public key.
///
/// This function is intentionally non-generic and disallow inlining to ensure that compilation optimizations can be effectively applied.
/// This optimization is needed for ensuring that tests can run within a reasonable time frame.
#[inline(never)]
pub fn verify(&self, msg: &[u8], pk: &PublicKey) -> Result<(), Error> {
let hash_point = hash::hash_to_g1(msg);
Expand Down Expand Up @@ -145,6 +148,8 @@ impl AggregateSignature {
AggregateSignature(agg)
}

/// This function is intentionally non-generic and disallow inlining to ensure that compilation optimizations can be effectively applied.
/// This optimization is needed for ensuring that tests can run within a reasonable time frame.
#[inline(never)]
fn verify_raw(&self, msgs_and_pks: &[(&[u8], &PublicKey)]) -> Result<(), Error> {
// Aggregate public keys if they are signing the same hash. Each public key aggregated
Expand Down

0 comments on commit 28526fd

Please sign in to comment.