Skip to content

Commit 200bd7d

Browse files
author
Daniel Kuehr
committed
tx fuzzer: update mutator to work with latest ledger changes
1 parent 066a848 commit 200bd7d

File tree

4 files changed

+32
-12
lines changed

4 files changed

+32
-12
lines changed

.github/workflows/ci.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,24 @@ jobs:
4343
cd ledger
4444
cargo test --release -- -Z unstable-options --report-time
4545
46+
tx-fuzzer-check:
47+
runs-on: ubuntu-20.04
48+
steps:
49+
- name: Git checkout
50+
uses: actions/checkout@v4
51+
- name: Setup build dependencies
52+
run: |
53+
sudo apt update
54+
sudo apt install -y protobuf-compiler
55+
- name: Setup Rust
56+
run: |
57+
rustup install nightly
58+
rustup override set nightly
59+
- name: Check for compilation errors in transaction fuzzer
60+
run: |
61+
cd tools/fuzzing
62+
cargo check
63+
4664
p2p-tests:
4765
runs-on: ubuntu-20.04
4866
steps:

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tools/fuzzing/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ edition = "2021"
66

77
[dependencies]
88
ark-serialize = "0.4.2"
9+
poseidon = { workspace = true }
910
mina-hasher = { workspace = true }
1011
mina-signer = { workspace = true }
1112
mina-curves = { workspace = true }

tools/fuzzing/src/transaction_fuzzer/mutator.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ use crate::transaction_fuzzer::generator::gen_curve_point;
99
use ark_ff::Zero;
1010
use ledger::{
1111
generators::zkapp_command_builder::get_transaction_commitments,
12-
hash_with_kimchi,
1312
scan_state::{
1413
currency::{Amount, Balance, Fee, MinMax, Nonce, Signed, Slot},
1514
transaction_logic::{
@@ -40,6 +39,7 @@ use mina_p2p_messages::{
4039
},
4140
};
4241
use mina_signer::{CompressedPubKey, NetworkId, Signature, Signer};
42+
use poseidon::hash::{hash_with_kimchi, params::MINA_ACCOUNT_UPDATE_CONS};
4343
use rand::{seq::SliceRandom, Rng};
4444

4545
#[coverage(off)]
@@ -321,15 +321,13 @@ impl MutatorFromAccount<Timing> for FuzzerCtx {
321321
_ => unimplemented!(),
322322
}
323323
}
324-
} else {
325-
if self.gen.rng.gen_bool(0.5) {
326-
*t = Timing::Timed {
327-
initial_minimum_balance: self.gen(),
328-
cliff_time: self.gen(),
329-
cliff_amount: self.gen(),
330-
vesting_period: self.gen(),
331-
vesting_increment: self.gen(),
332-
}
324+
} else if self.gen.rng.gen_bool(0.5) {
325+
*t = Timing::Timed {
326+
initial_minimum_balance: self.gen(),
327+
cliff_time: self.gen(),
328+
cliff_amount: self.gen(),
329+
vesting_period: self.gen(),
330+
vesting_increment: self.gen(),
333331
}
334332
}
335333
}
@@ -708,8 +706,10 @@ impl Mutator<zkapp_command::CallForest<AccountUpdate>> for FuzzerCtx {
708706
Fp::zero()
709707
};
710708

711-
t.0[i].stack_hash =
712-
MutableFp::new(hash_with_kimchi("MinaAcctUpdateCons", &[tree_digest, h_tl]));
709+
t.0[i].stack_hash = MutableFp::new(hash_with_kimchi(
710+
&MINA_ACCOUNT_UPDATE_CONS,
711+
&[tree_digest, h_tl],
712+
));
713713
}
714714
}
715715
}

0 commit comments

Comments
 (0)