Skip to content

Commit

Permalink
fix: hasher name should not include field
Browse files Browse the repository at this point in the history
  • Loading branch information
DrPeterVanNostrand committed Mar 9, 2022
1 parent 78fd2c2 commit e769deb
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
7 changes: 5 additions & 2 deletions filecoin-hashers/src/blake2s.rs
Original file line number Diff line number Diff line change
Expand Up @@ -498,6 +498,9 @@ impl Hasher for Blake2sHasher<Fr> {
type Domain = Blake2sDomain<Fr>;
type Function = Blake2sFunction<Fr>;

// The hasher name should be the same for all fields. The hasher name is used to name the SDR
// parent-cache; graph parent generation is not affected by a hasher's field, thus the field
// name should not be included in the hasher name.
fn name() -> String {
"Blake2sHasher".into()
}
Expand All @@ -507,14 +510,14 @@ impl Hasher for Blake2sHasher<Fp> {
type Function = Blake2sFunction<Fp>;

fn name() -> String {
"Blake2sHasher_pallas".into()
"Blake2sHasher".into()
}
}
impl Hasher for Blake2sHasher<Fq> {
type Domain = Blake2sDomain<Fq>;
type Function = Blake2sFunction<Fq>;

fn name() -> String {
"Blake2sHasher_vesta".into()
"Blake2sHasher".into()
}
}
7 changes: 5 additions & 2 deletions filecoin-hashers/src/poseidon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -610,6 +610,9 @@ impl Hasher for PoseidonHasher<Fr> {
type Domain = PoseidonDomain<Fr>;
type Function = PoseidonFunction<Fr>;

// The hasher name should be the same for all fields. The hasher name is used to name the SDR
// parent-cache; graph parent generation is not affected by a hasher's field, thus the field
// name should not be included in the hasher name.
fn name() -> String {
"poseidon_hasher".into()
}
Expand All @@ -619,14 +622,14 @@ impl Hasher for PoseidonHasher<Fp> {
type Function = PoseidonFunction<Fp>;

fn name() -> String {
"poseidon_hasher_pallas".into()
"poseidon_hasher".into()
}
}
impl Hasher for PoseidonHasher<Fq> {
type Domain = PoseidonDomain<Fq>;
type Function = PoseidonFunction<Fq>;

fn name() -> String {
"poseidon_hasher_vesta".into()
"poseidon_hasher".into()
}
}
7 changes: 5 additions & 2 deletions filecoin-hashers/src/sha256.rs
Original file line number Diff line number Diff line change
Expand Up @@ -526,6 +526,9 @@ impl Hasher for Sha256Hasher<Fr> {
type Domain = Sha256Domain<Fr>;
type Function = Sha256Function<Fr>;

// The hasher name should be the same for all fields. The hasher name is used to name the SDR
// parent-cache; graph parent generation is not affected by a hasher's field, thus the field
// name should not be included in the hasher name.
fn name() -> String {
"sha256_hasher".into()
}
Expand All @@ -535,14 +538,14 @@ impl Hasher for Sha256Hasher<Fp> {
type Function = Sha256Function<Fp>;

fn name() -> String {
"sha256_hasher_pallas".into()
"sha256_hasher".into()
}
}
impl Hasher for Sha256Hasher<Fq> {
type Domain = Sha256Domain<Fq>;
type Function = Sha256Function<Fq>;

fn name() -> String {
"sha256_hasher_vesta".into()
"sha256_hasher".into()
}
}

0 comments on commit e769deb

Please sign in to comment.