Skip to content

Commit

Permalink
Full test
Browse files Browse the repository at this point in the history
  • Loading branch information
cmester0 committed Mar 13, 2024
1 parent 9297f11 commit 971717b
Show file tree
Hide file tree
Showing 5 changed files with 212 additions and 208 deletions.
3 changes: 3 additions & 0 deletions bip-340/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ ff = "0.13"
subtle = "*"
rand_core = "0.6"

hacspec-concordium = { path = "../concordium" } # 4d4b024b547a1f120f6d6951cbc409c94f8f146a
hacspec-concordium-derive = { path = "../concordium-derive" } # 4d4b024b547a1f120f6d6951cbc409c94f8f146a

[dev-dependencies]
quickcheck = "1"
quickcheck_macros = "1"
Expand Down
24 changes: 24 additions & 0 deletions bip-340/src/bip-340.rs
Original file line number Diff line number Diff line change
Expand Up @@ -783,4 +783,28 @@ pub mod GroupTrait {
finite(*self).unwrap()
}
}


use hacspec_concordium::*;
use hacspec_concordium_derive::*;

impl hacspec_concordium::Deserial for Scalar {
// TODO:
fn deserial<R: Read>(_source: &mut R) -> ParseResult<Self> {
let buffer: &mut [u8] = &mut [];
let _ = _source.read(buffer)?;

Ok(Scalar::from_public_byte_seq_be(Seq::<u8>::from_native_slice(buffer)))
}
}

impl hacspec_concordium::Serial for Scalar {
// TODO:
fn serial<W: Write>(&self, _out: &mut W) -> Result<(), W::Err> {
_out.write(self.to_public_byte_seq_be().native_slice());
Ok(())
}
}

}

1 change: 1 addition & 0 deletions ovn/src/ovn_zk_secp256k1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ pub use crate::ovn_zkgroup::*;

use hacspec_bip_340::{GroupTrait::*, Point, *};


impl MGroup for Point {
fn pow (p: Self,exp: Self::Scalar) -> Self {
point_mul(exp,p)
Expand Down
2 changes: 1 addition & 1 deletion ovn/src/ovn_zkgroup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ where
Ok((A::accept(), cast_vote_state_ret))
}

#[derive(SchemaType)]
#[derive(Serialize, SchemaType)]
pub struct TallyParameter {}

#[hax::receive(contract = "OVN", name = "tally", parameter = "TallyParameter")]
Expand Down
Loading

0 comments on commit 971717b

Please sign in to comment.