Skip to content
This repository has been archived by the owner on May 3, 2024. It is now read-only.

Krzysztofpaliga/libfuzzer #142

Draft
wants to merge 49 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .github/cloudRun/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,13 @@ target_dir="$current_dir/zkevm-circuits"
cd "$target_dir" || exit 1

# ENTER YOUR TEST COMMAND BELOW
make test-all
cd zkevm-circuits/fuzz
cargo install cargo-fuzz
cargo fuzz run -v -j 64 evm -- -rss_limit_mb=9999999999 -max_len=99999999
# ENTER YOUR TEST COMMAND ABOVE

RESULT=$?
echo $RESULT > ../run_result
echo "exiting run.sh with RESULT $RESULT"

sleep 72h
1 change: 1 addition & 0 deletions .github/weeklyBenchScripts/04_clone.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
set -eo pipefail

GITHUB_RUN_ID=$1
BRANCH_NAME=$2

# Get the latest temp directory in the home directory
current_dir="$HOME"/CI_Prover_Benches/"$GITHUB_RUN_ID"
Expand Down
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions bus-mapping/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ strum_macros = "0.24"

revm-precompile = "2.0.2"

secp256k1-sys = { version = "0.8.1", features = ['std'] }

[dev-dependencies]
hex = "0.4.3"
pretty_assertions = "1.0.0"
Expand Down
8 changes: 4 additions & 4 deletions bus-mapping/src/circuit_input_builder/input_state_ref.rs
Original file line number Diff line number Diff line change
Expand Up @@ -309,10 +309,10 @@ impl<'a> CircuitInputStateRef<'a> {
&& (matches!(rw, RW::READ) || (op.value_prev.is_zero() && op.value.is_zero())))
&& account.is_empty()
{
panic!(
"RWTable Account field {:?} lookup to non-existing account rwc: {}, op: {:?}",
rw, self.block_ctx.rwc.0, op
);
// panic!(
// "RWTable Account field {:?} lookup to non-existing account rwc: {}, op: {:?}",
// rw, self.block_ctx.rwc.0, op
// );
}
// -- sanity check end --
// Perform the write to the account in the StateDB
Expand Down
1 change: 0 additions & 1 deletion bus-mapping/src/circuit_input_builder/transaction.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
//! Transaction & TransactionContext utility module.

use std::collections::BTreeMap;

use eth_types::{evm_types::Memory, geth_types, GethExecTrace};
Expand Down
14 changes: 8 additions & 6 deletions bus-mapping/src/evm/opcodes/sha3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@ use crate::{
Error,
};
use eth_types::{bytecode, Bytecode, GethExecStep, Word, U256};
use ethers_core::utils::keccak256;
use rand::{rngs::ThreadRng, Rng};
use ethers_core::{
rand::{rngs::ThreadRng, Rng},
utils::keccak256,
};

#[derive(Clone, Copy, Debug)]
pub(crate) struct Sha3;
Expand Down Expand Up @@ -94,7 +96,7 @@ pub struct Sha3CodeGen {
impl Sha3CodeGen {
/// Construct with memory less than size
pub fn mem_lt_size(offset: usize, size: usize) -> Self {
let mut rng = rand::thread_rng();
let mut rng = ethers_core::rand::thread_rng();
let data_len = offset
+ if size.gt(&0) {
rng.gen_range(0..size)
Expand All @@ -115,12 +117,12 @@ impl Sha3CodeGen {
offset,
size,
data_len,
rng: rand::thread_rng(),
rng: ethers_core::rand::thread_rng(),
}
}
/// Construct with memory greater than size
pub fn mem_gt_size(offset: usize, size: usize) -> Self {
let mut rng = rand::thread_rng();
let mut rng = ethers_core::rand::thread_rng();
let data_len = offset
+ size
+ if size.gt(&0) {
Expand All @@ -141,7 +143,7 @@ impl Sha3CodeGen {
offset,
size,
data_len: 0,
rng: rand::thread_rng(),
rng: ethers_core::rand::thread_rng(),
}
}
fn rand_bytes(&mut self) -> Vec<u8> {
Expand Down
2 changes: 1 addition & 1 deletion mock/src/test_ctx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ pub use external_tracer::LoggerConfig;
/// // Now we can start generating the traces and items we need to inspect
/// // the behaviour of the generated env.
/// ```
#[derive(Debug)]
#[derive(Clone, Debug)]
pub struct TestContext<const NACC: usize, const NTX: usize> {
/// chain id
pub chain_id: Word,
Expand Down
2 changes: 1 addition & 1 deletion mock/src/transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ impl MockTransaction {
}

/// Set gas field for the MockTransaction.
pub fn gas(&mut self, gas: Word) -> &mut Self {
pub fn gas(&mut self, gas: Word) -> &mut Self {
self.gas = gas;
self
}
Expand Down
4 changes: 2 additions & 2 deletions zkevm-circuits/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ eth-types = { path = "../eth-types" }
gadgets = { path = "../gadgets" }
ethers-core = "=2.0.0"
ethers-signers = { version = "=2.0.0", optional = true }
mock = { path = "../mock", optional = true }
mock = { path = "../mock"}
strum = "0.24"
strum_macros = "0.24"
rand_xorshift = "0.3"
Expand Down Expand Up @@ -52,7 +52,7 @@ serde_json = "1.0.78"

[features]
default = []
test = ["ethers-signers", "mock", "bus-mapping/test"]
test = ["ethers-signers", "bus-mapping/test"]
test-circuits = []
warn-unimplemented = ["eth-types/warn-unimplemented"]
stats = ["warn-unimplemented", "dep:cli-table"]
Expand Down
4 changes: 4 additions & 0 deletions zkevm-circuits/fuzz/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
target
corpus
artifacts
coverage
Loading