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
11 changes: 11 additions & 0 deletions ledger/src/account/account.rs
Original file line number Diff line number Diff line change
Expand Up @@ -683,10 +683,21 @@ pub struct MutableFp {
fp: Arc<std::sync::Mutex<Option<Fp>>>,
}

// We skip some hashing during fuzzing to speedup things, but we still need to catch potential in transaction application.
// The fuzzer will call apply_transactions with GLOBAL_SKIP_PARTIAL_EQ disabled and enable it for everything else.
#[cfg(feature = "fuzzing")]
pub static GLOBAL_SKIP_PARTIAL_EQ: Lazy<std::sync::RwLock<bool>> =
Lazy::new(|| std::sync::RwLock::new(false));

impl Eq for MutableFp {}

impl PartialEq for MutableFp {
fn eq(&self, other: &Self) -> bool {
#[cfg(feature = "fuzzing")]
if *GLOBAL_SKIP_PARTIAL_EQ.read().unwrap() {
return true;
}

self.get().unwrap() == other.get().unwrap()
}
}
Expand Down
3 changes: 1 addition & 2 deletions ledger/src/scan_state/transaction_logic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3163,8 +3163,7 @@ pub mod zkapp_command {

impl<AccUpdate: Clone + AccountUpdateRef + PartialEq> PartialEq for WithStackHash<AccUpdate> {
fn eq(&self, other: &Self) -> bool {
self.elt == other.elt
&& self.stack_hash.get().unwrap() == other.stack_hash.get().unwrap()
self.elt == other.elt && self.stack_hash == other.stack_hash
}
}

Expand Down
Loading
Loading