-
Notifications
You must be signed in to change notification settings - Fork 53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added fuzzer #255
Added fuzzer #255
Conversation
@povilassl I tried to mess the code of Please show that the fuzzer actually works. |
Still doesn't work for me. Steps to reproduce: Checkout this branch. Introduce some but, something like this:
Tests doesn't pass. However the fuzzer don't find anything. |
I am not familiar with the arkworks code, and I don't know what the BLS12_381_MOD_256 constant does, but I've tried to add very simple change, inside eip_4844 C bindings: diff --git a/arkworks/src/eip_4844.rs b/arkworks/src/eip_4844.rs
index 6f1ab5e..fb78e9f 100644
--- a/arkworks/src/eip_4844.rs
+++ b/arkworks/src/eip_4844.rs
@@ -9,7 +9,7 @@ use kzg::eip_4844::{
load_trusted_setup_rust, verify_blob_kzg_proof_batch_rust, verify_blob_kzg_proof_rust,
verify_kzg_proof_rust, Blob, Bytes32, Bytes48, CKZGSettings, KZGCommitment, KZGProof,
BYTES_PER_FIELD_ELEMENT, BYTES_PER_G1, BYTES_PER_G2, C_KZG_RET, C_KZG_RET_BADARGS,
- C_KZG_RET_OK, FIELD_ELEMENTS_PER_BLOB, TRUSTED_SETUP_NUM_G1_POINTS,
+ C_KZG_RET_ERROR, C_KZG_RET_OK, FIELD_ELEMENTS_PER_BLOB, TRUSTED_SETUP_NUM_G1_POINTS,
TRUSTED_SETUP_NUM_G2_POINTS,
};
use kzg::{cfg_into_iter, Fr, G1};
@@ -153,6 +153,8 @@ pub unsafe extern "C" fn blob_to_kzg_commitment(
blob: *const Blob,
s: &CKZGSettings,
) -> C_KZG_RET {
+ return C_KZG_RET_ERROR;
+
if TRUSTED_SETUP_NUM_G1_POINTS == 0 {
// FIXME: load_trusted_setup should set this value, but if not, it fails
TRUSTED_SETUP_NUM_G1_POINTS = FIELD_ELEMENTS_PER_BLOB Running fuzzer fails quickly, with error:
Also, I've tried to mess arkworks code, by adding one generator to diff --git a/kzg/src/eip_4844.rs b/kzg/src/eip_4844.rs
index 2600949..82389d5 100644
--- a/kzg/src/eip_4844.rs
+++ b/kzg/src/eip_4844.rs
@@ -236,7 +236,7 @@ pub fn blob_to_kzg_commitment_rust<
) -> Result<TG1, String> {
let polynomial = blob_to_polynomial(blob)?;
- Ok(poly_to_kzg_commitment(&polynomial, settings))
+ Ok(poly_to_kzg_commitment(&polynomial, settings).add(&TG1::generator()))
}
pub fn compute_powers<TFr: Fr>(base: &TFr, num_powers: usize) -> Vec<TFr> { And fuzzer failed again, with error:
|
No description provided.