(proof_asserts: &mut Assertions, random: Option<usize>)
| 1367 | let verifier_scripts = verifier_scripts.try_into().unwrap(); |
| 1368 | |
| 1369 | fn corrupt(proof_asserts: &mut Assertions, random: Option<usize>) { |
| 1370 | let mut rng = rand::thread_rng(); |
| 1371 | |
| 1372 | let mut index = rng.gen_range(0..NUM_PUBS + NUM_U256 + NUM_HASH); |
| 1373 | if random.is_some() { |
| 1374 | index = random.unwrap(); |
| 1375 | } |
| 1376 | let mut scramble: [u8; 32] = [0u8; 32]; |
| 1377 | scramble[16] = 37; |
| 1378 | let mut scramble2: [u8; BLAKE3_HASH_LENGTH] = [0u8; BLAKE3_HASH_LENGTH]; |
| 1379 | scramble2[BLAKE3_HASH_LENGTH / 2] = 37; |
| 1380 | println!("corrupted assertion at index {}", index); |
| 1381 | if index < NUM_PUBS { |
| 1382 | if index == 0 { |
| 1383 | if proof_asserts.0[0] == scramble { |
| 1384 | scramble[16] += 1; |
| 1385 | } |
| 1386 | proof_asserts.0[0] = scramble; |
| 1387 | } |
| 1388 | } else if index < NUM_PUBS + NUM_U256 { |
| 1389 | let index = index - NUM_PUBS; |
| 1390 | if proof_asserts.1[index] == scramble { |
| 1391 | scramble[16] += 1; |
| 1392 | } |
| 1393 | proof_asserts.1[index] = scramble; |
| 1394 | } else if index < NUM_PUBS + NUM_U256 + NUM_HASH { |
| 1395 | let index = index - NUM_PUBS - NUM_U256; |
| 1396 | if proof_asserts.2[index] == scramble2 { |
| 1397 | scramble2[10] += 1; |
| 1398 | } |
| 1399 | proof_asserts.2[index] = scramble2; |
| 1400 | } |
| 1401 | } |
| 1402 | |
| 1403 | let _total = NUM_PUBS + NUM_U256 + NUM_HASH; |
| 1404 | const RESERVED_SPACE: usize = 16000; // blockreservedweight=8000 + extra (8000) |
no outgoing calls