From 5e0f2880c37cbd1cf1273afbbcca3b9018b90316 Mon Sep 17 00:00:00 2001 From: Matt Van Horn <455140+mvanhorn@users.noreply.github.com> Date: Wed, 24 Jun 2026 01:57:36 -0700 Subject: [PATCH] Display program size for each import during leo build --- crates/leo/src/cli/commands/build.rs | 3 +++ tests/expectations/cli/multiple_leo_deps/STDOUT | 3 +++ tests/expectations/cli/test_external_program_submodule/STDOUT | 1 + tests/expectations/cli/test_external_toplevel_closure/STDOUT | 1 + tests/expectations/cli/test_failure_exit_code/STDOUT | 1 + tests/expectations/cli/test_lib_program_test/STDOUT | 1 + tests/expectations/cli/test_library_submodule_access/STDOUT | 1 + tests/expectations/cli/test_simple_test/STDOUT | 1 + tests/expectations/cli/test_storage_from_unit_test/STDOUT | 1 + tests/expectations/cli/test_with_record/STDOUT | 1 + tests/expectations/cli/test_workspace_deploy/STDOUT | 1 + 11 files changed, 15 insertions(+) diff --git a/crates/leo/src/cli/commands/build.rs b/crates/leo/src/cli/commands/build.rs index bb27eec3ec..ad304149a9 100644 --- a/crates/leo/src/cli/commands/build.rs +++ b/crates/leo/src/cli/commands/build.rs @@ -656,6 +656,9 @@ fn compile_leo_source_directory( }; tracing::info!(" Import '{}': checksum = '[{dep_checksum}]'", import.name); + let import_size = import.bytecode.len(); + let (size_kb, max_kb, _warning) = format_program_size(import_size, MAX_PROGRAM_SIZE); + tracing::info!(" Import '{}': program size: {size_kb:.2} KB / {max_kb:.2} KB", import.name); } Ok(compiled) diff --git a/tests/expectations/cli/multiple_leo_deps/STDOUT b/tests/expectations/cli/multiple_leo_deps/STDOUT index 8889937e99..be72bed177 100644 --- a/tests/expectations/cli/multiple_leo_deps/STDOUT +++ b/tests/expectations/cli/multiple_leo_deps/STDOUT @@ -5,6 +5,9 @@ Leo Program size: 0.29 KB / 2000.00 KB Leo ✅ Compiled 'parent.aleo' into Aleo instructions. Leo Import 'grandchild.aleo': checksum = '[174u8, 187u8, 41u8, 199u8, 29u8, 93u8, 47u8, 173u8, 98u8, 32u8, 73u8, 250u8, 151u8, 53u8, 73u8, 94u8, 242u8, 95u8, 71u8, 74u8, 121u8, 121u8, 133u8, 66u8, 113u8, 125u8, 133u8, 149u8, 137u8, 234u8, 137u8, 134u8]' + Leo Import 'grandchild.aleo': program size: 0.18 KB / 2000.00 KB Leo Import 'child1.aleo': checksum = '[138u8, 68u8, 23u8, 17u8, 147u8, 202u8, 54u8, 131u8, 68u8, 191u8, 115u8, 122u8, 104u8, 93u8, 82u8, 133u8, 237u8, 116u8, 228u8, 7u8, 183u8, 28u8, 164u8, 4u8, 200u8, 189u8, 94u8, 146u8, 227u8, 27u8, 196u8, 215u8]' + Leo Import 'child1.aleo': program size: 0.26 KB / 2000.00 KB Leo Import 'child2.aleo': checksum = '[23u8, 157u8, 69u8, 176u8, 63u8, 187u8, 23u8, 101u8, 134u8, 214u8, 248u8, 221u8, 72u8, 152u8, 104u8, 120u8, 22u8, 40u8, 157u8, 249u8, 73u8, 22u8, 38u8, 208u8, 53u8, 79u8, 137u8, 191u8, 121u8, 50u8, 88u8, 15u8]' + Leo Import 'child2.aleo': program size: 0.26 KB / 2000.00 KB Leo ✅ Generated ABI for program 'parent.aleo'. diff --git a/tests/expectations/cli/test_external_program_submodule/STDOUT b/tests/expectations/cli/test_external_program_submodule/STDOUT index 7e238c82b2..e93feab1b7 100644 --- a/tests/expectations/cli/test_external_program_submodule/STDOUT +++ b/tests/expectations/cli/test_external_program_submodule/STDOUT @@ -13,4 +13,5 @@ Leo Program size: 1.69 KB / 2000.00 KB Leo ✅ Compiled 'consumer.aleo' into Aleo instructions. Leo Import 'provider.aleo': checksum = '[65u8, 143u8, 101u8, 10u8, 122u8, 113u8, 65u8, 0u8, 200u8, 13u8, 10u8, 147u8, 182u8, 18u8, 16u8, 101u8, 135u8, 136u8, 47u8, 202u8, 209u8, 17u8, 150u8, 249u8, 134u8, 116u8, 3u8, 5u8, 53u8, 167u8, 16u8, 6u8]' + Leo Import 'provider.aleo': program size: 0.48 KB / 2000.00 KB Leo ✅ Generated ABI for program 'consumer.aleo'. diff --git a/tests/expectations/cli/test_external_toplevel_closure/STDOUT b/tests/expectations/cli/test_external_toplevel_closure/STDOUT index ec773cca7a..e1e3db0bde 100644 --- a/tests/expectations/cli/test_external_toplevel_closure/STDOUT +++ b/tests/expectations/cli/test_external_toplevel_closure/STDOUT @@ -6,4 +6,5 @@ Leo Program size: 0.13 KB / 2000.00 KB Leo ✅ Compiled 'parent.aleo' into Aleo instructions. Leo Import 'child.aleo': checksum = '[13u8, 159u8, 189u8, 165u8, 153u8, 228u8, 68u8, 149u8, 32u8, 212u8, 198u8, 89u8, 84u8, 99u8, 168u8, 177u8, 75u8, 40u8, 177u8, 103u8, 64u8, 157u8, 149u8, 3u8, 244u8, 170u8, 16u8, 188u8, 1u8, 23u8, 203u8, 193u8]' + Leo Import 'child.aleo': program size: 0.18 KB / 2000.00 KB Leo ✅ Generated ABI for program 'parent.aleo'. diff --git a/tests/expectations/cli/test_failure_exit_code/STDOUT b/tests/expectations/cli/test_failure_exit_code/STDOUT index 6a46f8f967..681a155216 100644 --- a/tests/expectations/cli/test_failure_exit_code/STDOUT +++ b/tests/expectations/cli/test_failure_exit_code/STDOUT @@ -10,6 +10,7 @@ Leo Program size: 0.17 KB / 2000.00 KB Leo ✅ Compiled 'test_test_failure_exit_code.aleo' into Aleo instructions. Leo Import 'test_failure_exit_code.aleo': checksum = '[221u8, 98u8, 184u8, 91u8, 106u8, 23u8, 100u8, 225u8, 172u8, 241u8, 136u8, 60u8, 210u8, 232u8, 121u8, 251u8, 30u8, 86u8, 109u8, 166u8, 1u8, 21u8, 133u8, 255u8, 216u8, 171u8, 227u8, 187u8, 160u8, 103u8, 226u8, 24u8]' + Leo Import 'test_failure_exit_code.aleo': program size: 0.20 KB / 2000.00 KB Leo Loading the ledger from storage... 0 / 1 tests passed. FAILED: test_test_failure_exit_code.aleo/test_deliberate_failure | none -- "Failed to extract output: Process authorization failed: Stack authorization failed: Stack execution failed: Instruction (assert.eq 1u8 2u8;) at index 0 failed: Failed to execute: Constraint unsatisfied: (0 * 1) != 1" diff --git a/tests/expectations/cli/test_lib_program_test/STDOUT b/tests/expectations/cli/test_lib_program_test/STDOUT index c5a90c6b32..984c44c59c 100644 --- a/tests/expectations/cli/test_lib_program_test/STDOUT +++ b/tests/expectations/cli/test_lib_program_test/STDOUT @@ -11,6 +11,7 @@ Leo Program size: 0.48 KB / 2000.00 KB Leo ✅ Compiled 'test_my_program.aleo' into Aleo instructions. Leo Import 'my_program.aleo': checksum = '[106u8, 110u8, 195u8, 22u8, 179u8, 122u8, 162u8, 160u8, 221u8, 236u8, 9u8, 111u8, 202u8, 246u8, 155u8, 195u8, 105u8, 115u8, 23u8, 190u8, 127u8, 125u8, 146u8, 111u8, 253u8, 158u8, 178u8, 185u8, 206u8, 163u8, 205u8, 126u8]' + Leo Import 'my_program.aleo': program size: 0.50 KB / 2000.00 KB Leo Loading the ledger from storage... Leo Loading the ledger from storage... Leo Loading the ledger from storage... diff --git a/tests/expectations/cli/test_library_submodule_access/STDOUT b/tests/expectations/cli/test_library_submodule_access/STDOUT index f778611a8d..dd7d81b4d4 100644 --- a/tests/expectations/cli/test_library_submodule_access/STDOUT +++ b/tests/expectations/cli/test_library_submodule_access/STDOUT @@ -13,6 +13,7 @@ Leo Program size: 0.64 KB / 2000.00 KB Leo ✅ Compiled 'test_my_app.aleo' into Aleo instructions. Leo Import 'my_app.aleo': checksum = '[93u8, 245u8, 51u8, 127u8, 99u8, 181u8, 136u8, 128u8, 74u8, 171u8, 76u8, 239u8, 117u8, 174u8, 196u8, 73u8, 60u8, 16u8, 72u8, 68u8, 36u8, 48u8, 229u8, 148u8, 64u8, 232u8, 195u8, 46u8, 166u8, 177u8, 77u8, 7u8]' + Leo Import 'my_app.aleo': program size: 1.05 KB / 2000.00 KB Leo Loading the ledger from storage... Leo Loading the ledger from storage... Leo Loading the ledger from storage... diff --git a/tests/expectations/cli/test_simple_test/STDOUT b/tests/expectations/cli/test_simple_test/STDOUT index 189014b38c..d81bea14b7 100644 --- a/tests/expectations/cli/test_simple_test/STDOUT +++ b/tests/expectations/cli/test_simple_test/STDOUT @@ -10,6 +10,7 @@ Leo Program size: 0.33 KB / 2000.00 KB Leo ✅ Compiled 'test_some_sample_leo_program.aleo' into Aleo instructions. Leo Import 'some_sample_leo_program.aleo': checksum = '[95u8, 99u8, 136u8, 243u8, 82u8, 169u8, 200u8, 72u8, 133u8, 227u8, 122u8, 161u8, 195u8, 178u8, 69u8, 37u8, 167u8, 114u8, 104u8, 192u8, 161u8, 175u8, 195u8, 180u8, 120u8, 4u8, 192u8, 16u8, 86u8, 199u8, 76u8, 235u8]' + Leo Import 'some_sample_leo_program.aleo': program size: 0.20 KB / 2000.00 KB Leo Loading the ledger from storage... Leo Loading the ledger from storage... 2 / 2 tests passed. diff --git a/tests/expectations/cli/test_storage_from_unit_test/STDOUT b/tests/expectations/cli/test_storage_from_unit_test/STDOUT index 60c4437691..45aaf66201 100644 --- a/tests/expectations/cli/test_storage_from_unit_test/STDOUT +++ b/tests/expectations/cli/test_storage_from_unit_test/STDOUT @@ -10,6 +10,7 @@ Leo Program size: 20.35 KB / 2000.00 KB Leo ✅ Compiled 'test_storage_demo.aleo' into Aleo instructions. Leo Import 'storage_demo.aleo': checksum = '[226u8, 104u8, 115u8, 137u8, 3u8, 83u8, 131u8, 89u8, 56u8, 167u8, 125u8, 100u8, 155u8, 220u8, 210u8, 53u8, 15u8, 25u8, 15u8, 152u8, 34u8, 88u8, 82u8, 31u8, 208u8, 157u8, 23u8, 145u8, 128u8, 36u8, 118u8, 40u8]' + Leo Import 'storage_demo.aleo': program size: 5.43 KB / 2000.00 KB Leo Loading the ledger from storage... Leo Loading the ledger from storage... Leo Loading the ledger from storage... diff --git a/tests/expectations/cli/test_with_record/STDOUT b/tests/expectations/cli/test_with_record/STDOUT index 31e94d5bc4..0f4142cfaa 100644 --- a/tests/expectations/cli/test_with_record/STDOUT +++ b/tests/expectations/cli/test_with_record/STDOUT @@ -11,6 +11,7 @@ Leo Program size: 0.27 KB / 2000.00 KB Leo ✅ Compiled 'test_my_program.aleo' into Aleo instructions. Leo Import 'my_program.aleo': checksum = '[248u8, 185u8, 83u8, 218u8, 45u8, 99u8, 133u8, 143u8, 142u8, 20u8, 130u8, 182u8, 223u8, 58u8, 198u8, 216u8, 21u8, 134u8, 26u8, 61u8, 1u8, 68u8, 18u8, 235u8, 248u8, 3u8, 169u8, 211u8, 40u8, 8u8, 225u8, 98u8]' + Leo Import 'my_program.aleo': program size: 0.39 KB / 2000.00 KB Leo Loading the ledger from storage... 1 / 1 tests passed. PASSED: test_my_program.aleo/test_double_amount diff --git a/tests/expectations/cli/test_workspace_deploy/STDOUT b/tests/expectations/cli/test_workspace_deploy/STDOUT index 3d8983f524..38212f1199 100644 --- a/tests/expectations/cli/test_workspace_deploy/STDOUT +++ b/tests/expectations/cli/test_workspace_deploy/STDOUT @@ -12,6 +12,7 @@ Leo Program size: 0.23 KB / 2000.00 KB Leo ✅ Compiled 'swap.aleo' into Aleo instructions. Leo Import 'token.aleo': checksum = '[3u8, 95u8, 196u8, 87u8, 201u8, 25u8, 21u8, 148u8, 199u8, 65u8, 183u8, 183u8, 245u8, 253u8, 162u8, 121u8, 112u8, 233u8, 65u8, 132u8, 7u8, 239u8, 243u8, 9u8, 88u8, 169u8, 25u8, 111u8, 5u8, 98u8, 6u8, 94u8]' + Leo Import 'token.aleo': program size: 0.17 KB / 2000.00 KB Leo ✅ Generated ABI for program 'swap.aleo'. 📢 Using the following consensus heights: 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15