mirror of
https://github.com/logos-blockchain/lez-fuzzing.git
synced 2026-06-17 00:19:29 +00:00
fix: sync with latest LEZ
This commit is contained in:
parent
4f06e820d5
commit
1e166125dd
@ -33,10 +33,9 @@ fuzz_props::fuzz_entry!(|data: &[u8]| {
|
||||
let base = wrap.0;
|
||||
|
||||
let signing_key = PrivateKey::try_new(DUMMY_KEY_BYTES).expect("constant key is valid");
|
||||
let bedrock = [0u8; 32];
|
||||
|
||||
// Compute the canonical hash for the base input.
|
||||
let block = base.clone().into_pending_block(&signing_key, bedrock);
|
||||
let block = base.clone().into_pending_block(&signing_key);
|
||||
let hash_base = block.header.hash;
|
||||
|
||||
// ── INVARIANT 1: HashableBlockData::from(Block) is lossless ──────────────────
|
||||
@ -51,7 +50,7 @@ fuzz_props::fuzz_entry!(|data: &[u8]| {
|
||||
{
|
||||
let roundtrip_hashable = HashableBlockData::from(block);
|
||||
let hash_roundtrip = roundtrip_hashable
|
||||
.into_pending_block(&signing_key, bedrock)
|
||||
.into_pending_block(&signing_key)
|
||||
.header
|
||||
.hash;
|
||||
assert_eq!(
|
||||
@ -67,7 +66,7 @@ fuzz_props::fuzz_entry!(|data: &[u8]| {
|
||||
{
|
||||
let mut m = base.clone();
|
||||
m.block_id = m.block_id.wrapping_add(1);
|
||||
let hash_m = m.into_pending_block(&signing_key, bedrock).header.hash;
|
||||
let hash_m = m.into_pending_block(&signing_key).header.hash;
|
||||
assert_ne!(
|
||||
hash_base,
|
||||
hash_m,
|
||||
@ -81,7 +80,7 @@ fuzz_props::fuzz_entry!(|data: &[u8]| {
|
||||
{
|
||||
let mut m = base.clone();
|
||||
m.prev_block_hash.0[0] ^= 0xFF;
|
||||
let hash_m = m.into_pending_block(&signing_key, bedrock).header.hash;
|
||||
let hash_m = m.into_pending_block(&signing_key).header.hash;
|
||||
assert_ne!(
|
||||
hash_base,
|
||||
hash_m,
|
||||
@ -95,7 +94,7 @@ fuzz_props::fuzz_entry!(|data: &[u8]| {
|
||||
{
|
||||
let mut m = base.clone();
|
||||
m.timestamp = m.timestamp.wrapping_add(1);
|
||||
let hash_m = m.into_pending_block(&signing_key, bedrock).header.hash;
|
||||
let hash_m = m.into_pending_block(&signing_key).header.hash;
|
||||
assert_ne!(
|
||||
hash_base,
|
||||
hash_m,
|
||||
@ -121,7 +120,7 @@ fuzz_props::fuzz_entry!(|data: &[u8]| {
|
||||
if first != last {
|
||||
let mut reordered = base.clone();
|
||||
reordered.transactions.reverse();
|
||||
let hash_reordered = reordered.into_pending_block(&signing_key, bedrock).header.hash;
|
||||
let hash_reordered = reordered.into_pending_block(&signing_key).header.hash;
|
||||
assert_ne!(
|
||||
hash_base,
|
||||
hash_reordered,
|
||||
|
||||
@ -107,20 +107,16 @@ fuzz_props::fuzz_entry!(|data: &[u8]| {
|
||||
);
|
||||
}
|
||||
|
||||
// ── INVARIANT [LengthMatchAccepted] ───────────────────────────────────────
|
||||
// When public_keys.len() == ciphertexts.len() == 0, `try_from_circuit_output`
|
||||
// must succeed.
|
||||
//
|
||||
// Original check: `if public_keys.len() != output.ciphertexts.len() { Err }`
|
||||
// With mutation `!=` → `==`: `if 0 == 0` → `true` → Err is returned.
|
||||
// Our assertion that the call SUCCEEDS catches the mutation.
|
||||
// ── INVARIANT [CircuitOutputAccepted] ─────────────────────────────────────
|
||||
// `try_from_circuit_output` must succeed for a well-formed (empty) circuit
|
||||
// output, mapping the output fields onto the resulting `Message`.
|
||||
{
|
||||
let empty_output = PrivacyPreservingCircuitOutput {
|
||||
public_pre_states: vec![],
|
||||
public_post_states: vec![],
|
||||
new_commitments: vec![],
|
||||
new_nullifiers: vec![],
|
||||
ciphertexts: vec![],
|
||||
encrypted_private_post_states: vec![],
|
||||
block_validity_window: BlockValidityWindow::new_unbounded(),
|
||||
timestamp_validity_window: TimestampValidityWindow::new_unbounded(),
|
||||
};
|
||||
@ -128,15 +124,13 @@ fuzz_props::fuzz_entry!(|data: &[u8]| {
|
||||
let result = PPMessage::try_from_circuit_output(
|
||||
vec![], // public_account_ids
|
||||
vec![], // nonces
|
||||
vec![], // public_keys (0 entries)
|
||||
empty_output,
|
||||
);
|
||||
assert!(
|
||||
result.is_ok(),
|
||||
"INVARIANT VIOLATION [LengthMatchAccepted]: \
|
||||
try_from_circuit_output must accept when keys(0) == ciphertexts(0), \
|
||||
got: {:?} — \
|
||||
possible mutation: != changed to == in the length check",
|
||||
"INVARIANT VIOLATION [CircuitOutputAccepted]: \
|
||||
try_from_circuit_output must accept a well-formed empty output, \
|
||||
got: {:?}",
|
||||
result.err(),
|
||||
);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user