Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,10 @@ rand = "0.8.5"
rayon = "1.10.0"
sha2 = "0.10.7"
sha3 = "0.10.8"
thiserror = "2.0.12"
zerocopy = "0.8"
zeroize = "1.8.1"


# Un-comment below for latest arkworks libraries.
# [patch.crates-io]
# ark-std = { git = "https://github.com/arkworks-rs/utils" }
Expand Down
2 changes: 1 addition & 1 deletion spongefish-pow/src/blake3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ impl Blake3PoW {

#[cfg(test)]
mod tests {
use spongefish::{DefaultHash, DomainSeparator};
use spongefish::DefaultHash;

use super::*;
use crate::{
Expand Down
6 changes: 3 additions & 3 deletions spongefish-pow/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@ where
Self: BytesToUnitSerialize + UnitToBytes,
{
fn challenge_pow<S: PowStrategy>(&mut self, bits: f64) -> ProofResult<()> {
let challenge = self.challenge_bytes()?;
let challenge = self.challenge_bytes();
let nonce = S::new(challenge, bits)
.solve()
.ok_or(ProofError::InvalidProof)?;
self.add_bytes(&nonce.to_be_bytes())?;
self.add_bytes(&nonce.to_be_bytes());
Ok(())
}
}
Expand All @@ -61,7 +61,7 @@ where
Self: BytesToUnitDeserialize + UnitToBytes,
{
fn challenge_pow<S: PowStrategy>(&mut self, bits: f64) -> ProofResult<()> {
let challenge = self.challenge_bytes()?;
let challenge = self.challenge_bytes();
let nonce = u64::from_be_bytes(self.next_bytes()?);
if S::new(challenge, bits).check(nonce) {
Ok(())
Expand Down
3 changes: 3 additions & 0 deletions spongefish/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ license = "BSD-3-Clause"
workspace = true

[dependencies]
zerocopy = { workspace = true }
zeroize = { workspace = true, features = ["zeroize_derive"] }
rand = { workspace = true, features = ["getrandom"] }
digest = { workspace = true }
Expand All @@ -24,6 +25,8 @@ ark-ec = { workspace = true, optional = true }
ark-serialize = { workspace = true, features = ["std"], optional = true }
group = { workspace = true, optional = true }
hex = { workspace = true }
thiserror.workspace = true
sha3.workspace = true

[features]
default = []
Expand Down
11 changes: 6 additions & 5 deletions spongefish/src/codecs/arkworks_algebra/deserialize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use ark_ec::{
CurveGroup,
};
use ark_ff::{Field, Fp, FpConfig};
use ark_serialize::CanonicalDeserialize;
use ark_serialize::{CanonicalDeserialize, SerializationError};

use super::{FieldToUnitDeserialize, GroupToUnitDeserialize};
use crate::{
Expand Down Expand Up @@ -67,7 +67,7 @@ where
for o in output.iter_mut() {
let o_affine = EdwardsAffine::deserialize_compressed(&mut self.narg_string)?;
*o = o_affine.into();
self.public_units(&[o.x, o.y])?;
self.public_units(&[o.x, o.y]);
}
Ok(())
}
Expand All @@ -83,13 +83,14 @@ where
for o in output.iter_mut() {
let o_affine = SWAffine::deserialize_compressed(&mut self.narg_string)?;
*o = o_affine.into();
self.public_units(&[o.x, o.y])?;
self.public_units(&[o.x, o.y]);
}
Ok(())
}
}

#[cfg(test)]
#[cfg(feature = "disable")]
mod tests {
use ark_bls12_381::G1Projective;
use ark_curve25519::EdwardsProjective;
Expand All @@ -99,8 +100,8 @@ mod tests {

use super::*;
use crate::{
codecs::arkworks_algebra::{FieldDomainSeparator, GroupDomainSeparator},
DefaultHash, DomainSeparator,
codecs::arkworks_algebra::{FieldPattern, GroupPattern},
DefaultHash,
};

/// Custom field for testing: BabyBear
Expand Down
Loading
Loading