penumbra-zone / poseidon377

An instantiation of the Poseidon hash for use with decaf377
https://protocol.penumbra.zone/main/crypto/poseidon.html
Other
28 stars 10 forks source link

cleanup crates when rust `generic_const_exprs` is stabilized #57

Open redshiftzero opened 5 months ago

redshiftzero commented 5 months ago

In #53, the crates in this workspace were rewritten to use const generics, for example the base Matrix became:

pub struct Matrix<const N_ROWS: usize, const N_COLS: usize, const N_ELEMENTS: usize> {
    /// Elements of the matrix, stored in a fixed-size array.
    ///
    pub elements: [Fq; N_ELEMENTS],
}

However, once the unstable Rust feature generic_const_exprs is stabilized, we'd be able to eliminate the N_ELEMENTS const generic parameter in favor of N_ROWS * N_COLS. Similarly for MDS matrices where we have a STATE_SIZE and STATE_SIZE_MINUS_1 parameter, we could eliminate STATE_SIZE_MINUS_1 in favor of using STATE_SIZE - 1.