Skip to content

Commit

Permalink
add deprecated_serialize_commitment
Browse files Browse the repository at this point in the history
  • Loading branch information
kevaundray committed Jan 19, 2024
1 parent b112c0e commit e05d6d6
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions ffi_interface/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
// This is just a simple interop file that we will delete later. Its only use is to
// ensure that the ffi_interface crate has not changed any behaviour from the
// java jni crate.
//
// Once the java jni crate uses the below implementation, we will remove this file.
pub mod interop;

use banderwagon::{trait_defs::*, Element};
use ipa_multipoint::committer::{Committer, DefaultCommitter};

Expand Down Expand Up @@ -123,6 +130,12 @@ pub fn hash_commitments(commitments: &[CommitmentBytes]) -> Vec<ScalarBytes> {
.collect()
}

/// This is kept so that commitRoot in the java implementation can be swapped out
/// Note: I believe we should not need to expose this method.
pub fn deprecated_serialize_commitment(commitment: CommitmentBytes) -> [u8; 32] {
Element::from_bytes_unchecked_uncompressed(commitment).to_bytes()
}

// TODO: We use big endian bytes here to be interopable with the java implementation
// TODO: we should stick to one endianness everywhere to avoid confusion
fn fr_to_be_bytes(fr: banderwagon::Fr) -> [u8; 32] {
Expand Down

0 comments on commit e05d6d6

Please sign in to comment.