Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/target
/node/testing/res/
.DS_Store
*.profraw
17 changes: 15 additions & 2 deletions tools/fuzzing/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ pub mod transaction_fuzzer {
stats::Stats,
};
use ledger::{
scan_state::transaction_logic::UserCommand, sparse_ledger::LedgerIntf, Account, BaseLedger,
scan_state::transaction_logic::{zkapp_command::ZkAppCommand, Transaction, UserCommand},
sparse_ledger::LedgerIntf,
Account, BaseLedger,
};
use mina_hasher::Fp;
use mina_p2p_messages::bigint::BigInt;
Expand Down Expand Up @@ -201,7 +203,7 @@ pub mod transaction_fuzzer {
let mut ctx = FuzzerCtxBuilder::new()
.seed(seed)
.minimum_fee(minimum_fee)
.initial_accounts(10)
.initial_accounts(1000)
.fuzzcases_path(env::var("FUZZCASES_PATH").unwrap_or("/tmp/".to_string()))
.build();

Expand Down Expand Up @@ -245,6 +247,17 @@ pub mod transaction_fuzzer {
{
println!("!!! {error}");

// Diff generated command form serialized version (detect hash inconsitencies)
if let Transaction::Command(ocaml_user_command) =
ocaml_apply_result.apply_result[0].transaction().data
{
if let UserCommand::ZkAppCommand(command) = &ocaml_user_command {
command.account_updates.ensure_hashed();
}

println!("{}", ctx.diagnostic(&user_command, &ocaml_user_command));
}

let ocaml_accounts = ocaml_get_accounts(stdin, stdout);
let rust_accounts = ledger.to_list();

Expand Down
2 changes: 1 addition & 1 deletion tools/fuzzing/src/transaction_fuzzer/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ impl FuzzerCtx {
account.nonce = GeneratorRange32::gen_range(self, 0..=u32::MAX);
account.timing = Timing::Untimed;

let permission_model = self.gen();
let permission_model = PermissionModel::Any; //self.gen();
self.state
.potential_senders
.push((keypair, permission_model));
Expand Down
7 changes: 6 additions & 1 deletion tools/fuzzing/src/transaction_fuzzer/coverage/reports.rs
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,12 @@ impl fmt::Display for CoverageReport {
impl CoverageReport {
#[coverage(off)]
pub fn write_files(&self, report_prefix: String) {
let sources_path = env::var("REPORTS_PATH").unwrap_or("/tmp/".to_string());
let mut sources_path = env::var("REPORTS_PATH").unwrap_or("/tmp/".to_string());

if !sources_path.ends_with('/') {
sources_path.push('/');
}

let report_file_vec: Vec<(String, &FileCoverage)> = self
.0
.iter()
Expand Down
Loading
Loading