diff --git a/arbitrator/prover/src/kzgbn254.rs b/arbitrator/prover/src/kzgbn254.rs index d56ad8539..a488ad1a2 100644 --- a/arbitrator/prover/src/kzgbn254.rs +++ b/arbitrator/prover/src/kzgbn254.rs @@ -45,12 +45,11 @@ pub fn prove_kzg_preimage_bn254( blob.to_polynomial(PolynomialFormat::InCoefficientForm)?; let blob_commitment = kzg.commit(&blob_polynomial_evaluation_form)?; - let commitment_x_bigint: BigUint = blob_commitment.x.into(); let commitment_y_bigint: BigUint = blob_commitment.y.into(); let length_bigint: BigUint = blob.len().into(); - let mut commitment_encoded_length_bytes = Vec::with_capacity(69); + let mut commitment_encoded_length_bytes = Vec::with_capacity(68); append_left_padded_biguint_be(&mut commitment_encoded_length_bytes, &commitment_x_bigint); append_left_padded_biguint_be(&mut commitment_encoded_length_bytes, &commitment_y_bigint); append_left_padded_biguint_be(&mut commitment_encoded_length_bytes, &length_bigint); diff --git a/arbitrator/prover/src/lib.rs b/arbitrator/prover/src/lib.rs index 379dc4268..fa6c46c20 100644 --- a/arbitrator/prover/src/lib.rs +++ b/arbitrator/prover/src/lib.rs @@ -362,6 +362,14 @@ unsafe fn handle_preimage_resolution( Some(data) } +#[no_mangle] +pub unsafe extern "C" fn arbitrator_get_opcode(mach: *mut Machine) -> u16 { + match (*mach).get_next_instruction() { + Some(instruction) => return instruction.opcode.repr(), + None => panic!("Failed to get next opcode for Machine"), + } +} + #[no_mangle] #[cfg(feature = "native")] pub unsafe extern "C" fn arbitrator_set_preimage_resolver( diff --git a/arbitrator/prover/src/utils.rs b/arbitrator/prover/src/utils.rs index 68bc0ba31..7d9b6d3fb 100644 --- a/arbitrator/prover/src/utils.rs +++ b/arbitrator/prover/src/utils.rs @@ -237,10 +237,15 @@ pub fn hash_preimage(preimage: &[u8], ty: PreimageType) -> Result<[u8; 32]> { // 25 bits for length considering 32mb blobs padded to nearest power of 2 (2^25) // pad to 32 bits or 4 bytes so 68 bytes total let mut commitment_length_encoded_bytes = Vec::with_capacity(68); - append_left_padded_biguint_be(&mut commitment_length_encoded_bytes, &commitment_x_bigint); - append_left_padded_biguint_be(&mut commitment_length_encoded_bytes, &commitment_y_bigint); + append_left_padded_biguint_be( + &mut commitment_length_encoded_bytes, + &commitment_x_bigint, + ); + append_left_padded_biguint_be( + &mut commitment_length_encoded_bytes, + &commitment_y_bigint, + ); append_left_padded_biguint_be(&mut commitment_length_encoded_bytes, &length_bigint); - let mut keccak256_hasher = Keccak256::new(); keccak256_hasher.update(&commitment_length_encoded_bytes);