Skip to content

Commit 4f18a8d

Browse files
committed
Ensure we can test spend limit without exceeding program size
1 parent 84a9a45 commit 4f18a8d

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

synthesizer/process/src/tests/test_execute.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2616,10 +2616,14 @@ fn test_max_imports() {
26162616
#[test]
26172617
fn test_program_exceeding_transaction_spend_limit() {
26182618
// Construct a finalize body whose finalize cost is excessively large.
2619-
let finalize_body = (0..<CurrentNetwork as Network>::MAX_COMMANDS)
2620-
.map(|i| format!("hash.bhp256 0field into r{i} as field;"))
2621-
.collect::<Vec<_>>()
2622-
.join("\n");
2619+
let mut finalize_body = r"
2620+
cast 0u8 0u8 0u8 0u8 0u8 0u8 0u8 0u8 0u8 0u8 0u8 0u8 0u8 0u8 0u8 0u8 into r0 as [u8; 16u32];
2621+
cast r0 r0 r0 r0 r0 r0 r0 r0 r0 r0 r0 r0 r0 r0 r0 r0 into r1 as [[u8; 16u32]; 16u32];
2622+
cast r1 r1 r1 r1 r1 r1 r1 r1 r1 r1 r1 r1 r1 r1 r1 r1 into r2 as [[[u8; 16u32]; 16u32]; 16u32];"
2623+
.to_string();
2624+
(3..500).for_each(|i| {
2625+
finalize_body.push_str(&format!("hash.bhp256 r2 into r{i} as field;\n"));
2626+
});
26232627
// Construct the program.
26242628
let program = Program::from_str(&format!(
26252629
r"program test_max_spend_limit.aleo;

0 commit comments

Comments
 (0)