Assessment reports>Gasp Node and Monorepo>Discussion>Mixed-endian usage could cause unintended behavior

Mixed-endian usage could cause unintended behavior

We found that crypto/bn254.rs from avs-finalizer mixes big and little endian encodings.

impl From<BlsKeypair> for Option<G1Point> {
    fn from(val: BlsKeypair) -> Self {
        if let Some((x, y)) = val.public.xy() {
            Some(G1Point {
                x: U256::from_big_endian(&x.into_bigint().to_bytes_le()),
                y: U256::from_little_endian(&y.into_bigint().to_bytes_le()),
            })
        } else {
            None
        }
    }
}

Such usage is inconsistent with other functions (which use little endian exclusively) and could cause unintended behavior. The function appears to be currently unused.

We suggest to correct this so that little endian is used consistently.

The Gasp team fixed this function in commit .

Zellic © 2025Back to top ↑