Minor rust bindings cleanup (#75)
* Minor rust bindings cleanup * Use g2_bytes variable
This commit is contained in:
parent
9fbe40a5eb
commit
ac3c829727
|
@ -122,7 +122,6 @@ impl Deref for KZGProof {
|
|||
}
|
||||
}
|
||||
|
||||
pub const FIAT_SHAMIR_PROTOCOL_DOMAIN: &[u8; 16usize] = b"FSBLOBVERIFY_V1_";
|
||||
type g1_t = blst_p1;
|
||||
type g2_t = blst_p2;
|
||||
type fr_t = blst_fr;
|
||||
|
@ -186,7 +185,6 @@ unsafe impl Sync for KZGSettings {}
|
|||
unsafe impl Send for KZGSettings {}
|
||||
|
||||
extern "C" {
|
||||
#[doc = " Interface functions"]
|
||||
pub fn load_trusted_setup(
|
||||
out: *mut KZGSettings,
|
||||
g1_bytes: *const u8, /* n1 * 48 bytes */
|
||||
|
@ -194,22 +192,18 @@ extern "C" {
|
|||
g2_bytes: *const u8, /* n2 * 96 bytes */
|
||||
n2: usize,
|
||||
) -> C_KZG_RET;
|
||||
}
|
||||
extern "C" {
|
||||
|
||||
pub fn load_trusted_setup_file(out: *mut KZGSettings, in_: *mut FILE) -> C_KZG_RET;
|
||||
}
|
||||
extern "C" {
|
||||
|
||||
pub fn free_trusted_setup(s: *mut KZGSettings);
|
||||
}
|
||||
extern "C" {
|
||||
|
||||
pub fn compute_aggregate_kzg_proof(
|
||||
out: *mut KZGProof,
|
||||
blobs: *const Blob,
|
||||
n: usize,
|
||||
s: *const KZGSettings,
|
||||
) -> C_KZG_RET;
|
||||
}
|
||||
extern "C" {
|
||||
|
||||
pub fn verify_aggregate_kzg_proof(
|
||||
out: *mut bool,
|
||||
blobs: *const Blob,
|
||||
|
@ -218,15 +212,13 @@ extern "C" {
|
|||
kzg_aggregated_proof: *const KZGProof,
|
||||
s: *const KZGSettings,
|
||||
) -> C_KZG_RET;
|
||||
}
|
||||
extern "C" {
|
||||
|
||||
pub fn blob_to_kzg_commitment(
|
||||
out: *mut KZGCommitment,
|
||||
blob: *const Blob,
|
||||
s: *const KZGSettings,
|
||||
) -> C_KZG_RET;
|
||||
}
|
||||
extern "C" {
|
||||
|
||||
pub fn verify_kzg_proof(
|
||||
out: *mut bool,
|
||||
polynomial_kzg: *const KZGCommitment,
|
||||
|
|
|
@ -55,15 +55,12 @@ impl KZGSettings {
|
|||
}
|
||||
let mut kzg_settings = MaybeUninit::<KZGSettings>::uninit();
|
||||
unsafe {
|
||||
let n1 = g1_bytes.len();
|
||||
let n2 = g2_bytes.len();
|
||||
|
||||
let res = load_trusted_setup(
|
||||
kzg_settings.as_mut_ptr(),
|
||||
g1_bytes.as_ptr() as *const u8,
|
||||
n1,
|
||||
g1_bytes.len(),
|
||||
g2_bytes.as_ptr() as *const u8,
|
||||
n2,
|
||||
g2_bytes.len(),
|
||||
);
|
||||
if let C_KZG_RET::C_KZG_OK = res {
|
||||
Ok(kzg_settings.assume_init())
|
||||
|
|
Loading…
Reference in New Issue