Skip to content

Commit d0b7432

Browse files
Fix fuzzer
1 parent b590580 commit d0b7432

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

tests/fuzzer/fuzz/wrappers/fuzz_precompiles_forward/src/precompiles.rs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,21 @@ use zk_ee::reference_implementations::DecreasingNative;
1414
use zk_ee::system::errors::subsystem::SubsystemError;
1515
use zk_ee::system::base_system_functions::{Bn254AddErrors,Sha256Errors,RipeMd160Errors,Keccak256Errors,
1616
Bn254MulErrors,P256VerifyErrors,Secp256k1ECRecoverErrors,Bn254PairingCheckErrors,PointEvaluationErrors};
17+
use zk_ee::system::logger::NullLogger;
18+
19+
struct DummyOracle;
20+
21+
impl zk_ee::oracle::IOOracle for DummyOracle {
22+
type RawIterator<'a> = Box<dyn ExactSizeIterator<Item = usize> + 'static>;
23+
24+
fn raw_query<'a, I: zk_ee::oracle::usize_serialization::UsizeSerializable + zk_ee::oracle::usize_serialization::UsizeDeserializable>(
25+
&'a mut self,
26+
_query_type: u32,
27+
_input: &I,
28+
) -> Result<Self::RawIterator<'a>, zk_ee::system::errors::internal::InternalError> {
29+
unreachable!("oracle should not be consulted on native targets");
30+
}
31+
}
1732

1833
pub fn ecadd(src: &[u8], dst: &mut Vec<u8>) -> Result<(), SubsystemError<Bn254AddErrors>> {
1934
let allocator = std::alloc::Global;
@@ -54,7 +69,7 @@ pub fn p256_verify(src: &[u8], dst: &mut Vec<u8>) -> Result<(), SubsystemError<P
5469
pub fn ecrecover(src: &[u8], dst: &mut Vec<u8>) -> Result<(), SubsystemError<Secp256k1ECRecoverErrors>> {
5570
let allocator = std::alloc::Global;
5671
let mut resource = <BaseResources<DecreasingNative> as Resource>::FORMAL_INFINITE;
57-
EcRecoverImpl::execute(&src, dst, &mut resource, allocator)
72+
EcRecoverImpl::execute(&src, dst, &mut resource, &mut DummyOracle, &mut NullLogger, allocator)
5873
}
5974

6075
pub fn pairing(src: &[u8], dst: &mut Vec<u8>) -> Result<(), SubsystemError<Bn254PairingCheckErrors>> {

0 commit comments

Comments
 (0)