Skip to content

Commit

Permalink
kernel_to_outputs: Audit preloaded data
Browse files Browse the repository at this point in the history
Adds ~30 % to the processor table row count. Adds a specialed structure
for the memory-part of the witness data, as the row-count increase was
over 1000 % when the original witness-data was audited.

Cf. #190.
  • Loading branch information
Sword-Smith committed Sep 30, 2024
1 parent 3562b6b commit c446e7e
Show file tree
Hide file tree
Showing 5 changed files with 94 additions and 59 deletions.
10 changes: 5 additions & 5 deletions benchmarks/KernelToOutputs-2in-2out.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
{
"name": "KernelToOutputs-2in-2out",
"benchmark_result": {
"clock_cycle_count": 989,
"hash_table_height": 496,
"u32_table_height": 214,
"op_stack_table_height": 808,
"ram_table_height": 145
"clock_cycle_count": 1303,
"hash_table_height": 694,
"u32_table_height": 283,
"op_stack_table_height": 1018,
"ram_table_height": 161
},
"case": "CommonCase"
}
Expand Down
10 changes: 5 additions & 5 deletions benchmarks/KernelToOutputs-4in-4out.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
{
"name": "KernelToOutputs-4in-4out",
"benchmark_result": {
"clock_cycle_count": 1429,
"hash_table_height": 588,
"u32_table_height": 227,
"op_stack_table_height": 1180,
"ram_table_height": 267
"clock_cycle_count": 1973,
"hash_table_height": 786,
"u32_table_height": 327,
"op_stack_table_height": 1542,
"ram_table_height": 295
},
"case": "CommonCase"
}
Expand Down
47 changes: 25 additions & 22 deletions profiles/KernelToOutputs-2in-2out.profile
Original file line number Diff line number Diff line change
@@ -1,23 +1,26 @@
KernelToOutputs-2in-2out:
| Subroutine | Processor | Op Stack | RAM | Hash | U32 |
|:-----------------------------------------------------------------|---------------------:|---------------------:|---------------------:|---------------------:|---------------------:|
| tasmlib_list_new___digest | 32 ( 3.2%) | 25 ( 3.1%) | 3 ( 2.1%) | 0 ( 0.0%) | 32 ( 15.0%) |
| ··tasmlib_memory_dyn_malloc | 25 ( 2.5%) | 21 ( 2.6%) | 2 ( 1.4%) | 0 ( 0.0%) | 32 ( 15.0%) |
| ····tasmlib_memory_dyn_malloc_initialize | 4 ( 0.4%) | 2 ( 0.2%) | 0 ( 0.0%) | 0 ( 0.0%) | 0 ( 0.0%) |
| kernel_to_outputs_calculate_canonical_commitments | 416 ( 42.1%) | 356 ( 44.1%) | 72 ( 49.7%) | 62 ( 12.5%) | 20 ( 9.3%) |
| ··tasmlib_list_get_element___digest | 28 ( 2.8%) | 30 ( 3.7%) | 10 ( 6.9%) | 0 ( 0.0%) | 9 ( 4.2%) |
| ··tasmlib_hashing_algebraic_hasher_hash_varlen | 312 ( 31.5%) | 234 ( 29.0%) | 38 ( 26.2%) | 38 ( 7.7%) | 11 ( 5.1%) |
| ····tasmlib_hashing_absorb_multiple | 284 ( 28.7%) | 204 ( 25.2%) | 38 ( 26.2%) | 24 ( 4.8%) | 11 ( 5.1%) |
| ······tasmlib_hashing_absorb_multiple_hash_all_full_chunks | 24 ( 2.4%) | 16 ( 2.0%) | 20 ( 13.8%) | 12 ( 2.4%) | 0 ( 0.0%) |
| ······tasmlib_hashing_absorb_multiple_pad_varnum_zeros | 12 ( 1.2%) | 8 ( 1.0%) | 0 ( 0.0%) | 0 ( 0.0%) | 0 ( 0.0%) |
| ······tasmlib_hashing_absorb_multiple_read_remainder | 174 ( 17.6%) | 98 ( 12.1%) | 18 ( 12.4%) | 0 ( 0.0%) | 0 ( 0.0%) |
| ··tasmlib_neptune_mutator_set_commit | 8 ( 0.8%) | 20 ( 2.5%) | 0 ( 0.0%) | 24 ( 4.8%) | 0 ( 0.0%) |
| tasmlib_hashing_algebraic_hasher_hash_varlen | 354 ( 35.8%) | 270 ( 33.4%) | 56 ( 38.6%) | 56 ( 11.3%) | 22 ( 10.3%) |
| ··tasmlib_hashing_absorb_multiple | 326 ( 33.0%) | 240 ( 29.7%) | 56 ( 38.6%) | 42 ( 8.5%) | 22 ( 10.3%) |
| ····tasmlib_hashing_absorb_multiple_hash_all_full_chunks | 42 ( 4.2%) | 28 ( 3.5%) | 50 ( 34.5%) | 30 ( 6.0%) | 0 ( 0.0%) |
| ····tasmlib_hashing_absorb_multiple_pad_varnum_zeros | 144 ( 14.6%) | 92 ( 11.4%) | 0 ( 0.0%) | 0 ( 0.0%) | 0 ( 0.0%) |
| ····tasmlib_hashing_absorb_multiple_read_remainder | 66 ( 6.7%) | 38 ( 4.7%) | 6 ( 4.1%) | 0 ( 0.0%) | 0 ( 0.0%) |
| tasmlib_hashing_merkle_verify | 36 ( 3.6%) | 26 ( 3.2%) | 0 ( 0.0%) | 18 ( 3.6%) | 20 ( 9.3%) |
| ··tasmlib_hashing_merkle_verify_tree_height_is_not_zero | 12 ( 1.2%) | 2 ( 0.2%) | 0 ( 0.0%) | 18 ( 3.6%) | 12 ( 5.6%) |
| ····tasmlib_hashing_merkle_verify_traverse_tree | 7 ( 0.7%) | 0 ( 0.0%) | 0 ( 0.0%) | 18 ( 3.6%) | 12 ( 5.6%) |
| Total | 989 (100.0%) | 808 (100.0%) | 145 (100.0%) | 496 (100.0%) | 214 (100.0%) |
| Subroutine | Processor | Op Stack | RAM | Hash | U32 |
|:----------------------------------------------------------------------------------|---------------------:|---------------------:|---------------------:|---------------------:|---------------------:|
| tasmlib_structure_verify_nd_si_integrity___KernelToOutputsWitnessMemory | 339 ( 26.0%) | 226 ( 22.2%) | 19 ( 11.8%) | 0 ( 0.0%) | 189 ( 66.8%) |
| ··tasmlib_structure_tasmobject_verify_size_indicators_dyn_elem_sizes___Utxo | 236 ( 18.1%) | 156 ( 15.3%) | 12 ( 7.5%) | 0 ( 0.0%) | 90 ( 31.8%) |
| ····tasmlib_structure_tasmobject_verify_size_indicators_dyn_elem_sizes___Coin | 118 ( 9.1%) | 80 ( 7.9%) | 6 ( 3.7%) | 0 ( 0.0%) | 30 ( 10.6%) |
| tasmlib_list_new___digest | 32 ( 2.5%) | 25 ( 2.5%) | 3 ( 1.9%) | 0 ( 0.0%) | 32 ( 11.3%) |
| ··tasmlib_memory_dyn_malloc | 25 ( 1.9%) | 21 ( 2.1%) | 2 ( 1.2%) | 0 ( 0.0%) | 32 ( 11.3%) |
| ····tasmlib_memory_dyn_malloc_initialize | 4 ( 0.3%) | 2 ( 0.2%) | 0 ( 0.0%) | 0 ( 0.0%) | 0 ( 0.0%) |
| kernel_to_outputs_calculate_canonical_commitments | 416 ( 31.9%) | 356 ( 35.0%) | 72 ( 44.7%) | 62 ( 8.9%) | 20 ( 7.1%) |
| ··tasmlib_list_get_element___digest | 28 ( 2.1%) | 30 ( 2.9%) | 10 ( 6.2%) | 0 ( 0.0%) | 9 ( 3.2%) |
| ··tasmlib_hashing_algebraic_hasher_hash_varlen | 312 ( 23.9%) | 234 ( 23.0%) | 38 ( 23.6%) | 38 ( 5.5%) | 11 ( 3.9%) |
| ····tasmlib_hashing_absorb_multiple | 284 ( 21.8%) | 204 ( 20.0%) | 38 ( 23.6%) | 24 ( 3.5%) | 11 ( 3.9%) |
| ······tasmlib_hashing_absorb_multiple_hash_all_full_chunks | 24 ( 1.8%) | 16 ( 1.6%) | 20 ( 12.4%) | 12 ( 1.7%) | 0 ( 0.0%) |
| ······tasmlib_hashing_absorb_multiple_pad_varnum_zeros | 12 ( 0.9%) | 8 ( 0.8%) | 0 ( 0.0%) | 0 ( 0.0%) | 0 ( 0.0%) |
| ······tasmlib_hashing_absorb_multiple_read_remainder | 174 ( 13.4%) | 98 ( 9.6%) | 18 ( 11.2%) | 0 ( 0.0%) | 0 ( 0.0%) |
| ··tasmlib_neptune_mutator_set_commit | 8 ( 0.6%) | 20 ( 2.0%) | 0 ( 0.0%) | 24 ( 3.5%) | 0 ( 0.0%) |
| tasmlib_hashing_algebraic_hasher_hash_varlen | 354 ( 27.2%) | 270 ( 26.5%) | 56 ( 34.8%) | 56 ( 8.1%) | 22 ( 7.8%) |
| ··tasmlib_hashing_absorb_multiple | 326 ( 25.0%) | 240 ( 23.6%) | 56 ( 34.8%) | 42 ( 6.1%) | 22 ( 7.8%) |
| ····tasmlib_hashing_absorb_multiple_hash_all_full_chunks | 42 ( 3.2%) | 28 ( 2.8%) | 50 ( 31.1%) | 30 ( 4.3%) | 0 ( 0.0%) |
| ····tasmlib_hashing_absorb_multiple_pad_varnum_zeros | 144 ( 11.1%) | 92 ( 9.0%) | 0 ( 0.0%) | 0 ( 0.0%) | 0 ( 0.0%) |
| ····tasmlib_hashing_absorb_multiple_read_remainder | 66 ( 5.1%) | 38 ( 3.7%) | 6 ( 3.7%) | 0 ( 0.0%) | 0 ( 0.0%) |
| tasmlib_hashing_merkle_verify | 36 ( 2.8%) | 26 ( 2.6%) | 0 ( 0.0%) | 18 ( 2.6%) | 20 ( 7.1%) |
| ··tasmlib_hashing_merkle_verify_tree_height_is_not_zero | 12 ( 0.9%) | 2 ( 0.2%) | 0 ( 0.0%) | 18 ( 2.6%) | 12 ( 4.2%) |
| ····tasmlib_hashing_merkle_verify_traverse_tree | 7 ( 0.5%) | 0 ( 0.0%) | 0 ( 0.0%) | 18 ( 2.6%) | 12 ( 4.2%) |
| Total | 1303 (100.0%) | 1018 (100.0%) | 161 (100.0%) | 694 (100.0%) | 283 (100.0%) |
47 changes: 25 additions & 22 deletions profiles/KernelToOutputs-4in-4out.profile
Original file line number Diff line number Diff line change
@@ -1,23 +1,26 @@
KernelToOutputs-4in-4out:
| Subroutine | Processor | Op Stack | RAM | Hash | U32 |
|:-----------------------------------------------------------------|---------------------:|---------------------:|---------------------:|---------------------:|---------------------:|
| tasmlib_list_new___digest | 32 ( 2.2%) | 25 ( 2.1%) | 3 ( 1.1%) | 0 ( 0.0%) | 32 ( 14.1%) |
| ··tasmlib_memory_dyn_malloc | 25 ( 1.7%) | 21 ( 1.8%) | 2 ( 0.7%) | 0 ( 0.0%) | 32 ( 14.1%) |
| ····tasmlib_memory_dyn_malloc_initialize | 4 ( 0.3%) | 2 ( 0.2%) | 0 ( 0.0%) | 0 ( 0.0%) | 0 ( 0.0%) |
| kernel_to_outputs_calculate_canonical_commitments | 826 ( 57.8%) | 708 ( 60.0%) | 144 ( 53.9%) | 124 ( 21.1%) | 31 ( 13.7%) |
| ··tasmlib_list_get_element___digest | 56 ( 3.9%) | 60 ( 5.1%) | 20 ( 7.5%) | 0 ( 0.0%) | 20 ( 8.8%) |
| ··tasmlib_hashing_algebraic_hasher_hash_varlen | 624 ( 43.7%) | 468 ( 39.7%) | 76 ( 28.5%) | 76 ( 12.9%) | 11 ( 4.8%) |
| ····tasmlib_hashing_absorb_multiple | 568 ( 39.7%) | 408 ( 34.6%) | 76 ( 28.5%) | 48 ( 8.2%) | 11 ( 4.8%) |
| ······tasmlib_hashing_absorb_multiple_hash_all_full_chunks | 48 ( 3.4%) | 32 ( 2.7%) | 40 ( 15.0%) | 24 ( 4.1%) | 0 ( 0.0%) |
| ······tasmlib_hashing_absorb_multiple_pad_varnum_zeros | 24 ( 1.7%) | 16 ( 1.4%) | 0 ( 0.0%) | 0 ( 0.0%) | 0 ( 0.0%) |
| ······tasmlib_hashing_absorb_multiple_read_remainder | 348 ( 24.4%) | 196 ( 16.6%) | 36 ( 13.5%) | 0 ( 0.0%) | 0 ( 0.0%) |
| ··tasmlib_neptune_mutator_set_commit | 16 ( 1.1%) | 40 ( 3.4%) | 0 ( 0.0%) | 48 ( 8.2%) | 0 ( 0.0%) |
| tasmlib_hashing_algebraic_hasher_hash_varlen | 384 ( 26.9%) | 290 ( 24.6%) | 106 ( 39.7%) | 86 ( 14.6%) | 24 ( 10.6%) |
| ··tasmlib_hashing_absorb_multiple | 356 ( 24.9%) | 260 ( 22.0%) | 106 ( 39.7%) | 72 ( 12.2%) | 24 ( 10.6%) |
| ····tasmlib_hashing_absorb_multiple_hash_all_full_chunks | 72 ( 5.0%) | 48 ( 4.1%) | 100 ( 37.5%) | 60 ( 10.2%) | 0 ( 0.0%) |
| ····tasmlib_hashing_absorb_multiple_pad_varnum_zeros | 144 ( 10.1%) | 92 ( 7.8%) | 0 ( 0.0%) | 0 ( 0.0%) | 0 ( 0.0%) |
| ····tasmlib_hashing_absorb_multiple_read_remainder | 66 ( 4.6%) | 38 ( 3.2%) | 6 ( 2.2%) | 0 ( 0.0%) | 0 ( 0.0%) |
| tasmlib_hashing_merkle_verify | 36 ( 2.5%) | 26 ( 2.2%) | 0 ( 0.0%) | 18 ( 3.1%) | 20 ( 8.8%) |
| ··tasmlib_hashing_merkle_verify_tree_height_is_not_zero | 12 ( 0.8%) | 2 ( 0.2%) | 0 ( 0.0%) | 18 ( 3.1%) | 12 ( 5.3%) |
| ····tasmlib_hashing_merkle_verify_traverse_tree | 7 ( 0.5%) | 0 ( 0.0%) | 0 ( 0.0%) | 18 ( 3.1%) | 12 ( 5.3%) |
| Total | 1429 (100.0%) | 1180 (100.0%) | 267 (100.0%) | 588 (100.0%) | 227 (100.0%) |
| Subroutine | Processor | Op Stack | RAM | Hash | U32 |
|:----------------------------------------------------------------------------------|---------------------:|---------------------:|---------------------:|---------------------:|---------------------:|
| tasmlib_structure_verify_nd_si_integrity___KernelToOutputsWitnessMemory | 569 ( 28.8%) | 378 ( 24.5%) | 31 ( 10.5%) | 0 ( 0.0%) | 220 ( 67.3%) |
| ··tasmlib_structure_tasmobject_verify_size_indicators_dyn_elem_sizes___Utxo | 466 ( 23.6%) | 308 ( 20.0%) | 24 ( 8.1%) | 0 ( 0.0%) | 120 ( 36.7%) |
| ····tasmlib_structure_tasmobject_verify_size_indicators_dyn_elem_sizes___Coin | 236 ( 12.0%) | 160 ( 10.4%) | 12 ( 4.1%) | 0 ( 0.0%) | 60 ( 18.3%) |
| tasmlib_list_new___digest | 32 ( 1.6%) | 25 ( 1.6%) | 3 ( 1.0%) | 0 ( 0.0%) | 32 ( 9.8%) |
| ··tasmlib_memory_dyn_malloc | 25 ( 1.3%) | 21 ( 1.4%) | 2 ( 0.7%) | 0 ( 0.0%) | 32 ( 9.8%) |
| ····tasmlib_memory_dyn_malloc_initialize | 4 ( 0.2%) | 2 ( 0.1%) | 0 ( 0.0%) | 0 ( 0.0%) | 0 ( 0.0%) |
| kernel_to_outputs_calculate_canonical_commitments | 826 ( 41.9%) | 708 ( 45.9%) | 144 ( 48.8%) | 124 ( 15.8%) | 31 ( 9.5%) |
| ··tasmlib_list_get_element___digest | 56 ( 2.8%) | 60 ( 3.9%) | 20 ( 6.8%) | 0 ( 0.0%) | 20 ( 6.1%) |
| ··tasmlib_hashing_algebraic_hasher_hash_varlen | 624 ( 31.6%) | 468 ( 30.4%) | 76 ( 25.8%) | 76 ( 9.7%) | 11 ( 3.4%) |
| ····tasmlib_hashing_absorb_multiple | 568 ( 28.8%) | 408 ( 26.5%) | 76 ( 25.8%) | 48 ( 6.1%) | 11 ( 3.4%) |
| ······tasmlib_hashing_absorb_multiple_hash_all_full_chunks | 48 ( 2.4%) | 32 ( 2.1%) | 40 ( 13.6%) | 24 ( 3.1%) | 0 ( 0.0%) |
| ······tasmlib_hashing_absorb_multiple_pad_varnum_zeros | 24 ( 1.2%) | 16 ( 1.0%) | 0 ( 0.0%) | 0 ( 0.0%) | 0 ( 0.0%) |
| ······tasmlib_hashing_absorb_multiple_read_remainder | 348 ( 17.6%) | 196 ( 12.7%) | 36 ( 12.2%) | 0 ( 0.0%) | 0 ( 0.0%) |
| ··tasmlib_neptune_mutator_set_commit | 16 ( 0.8%) | 40 ( 2.6%) | 0 ( 0.0%) | 48 ( 6.1%) | 0 ( 0.0%) |
| tasmlib_hashing_algebraic_hasher_hash_varlen | 384 ( 19.5%) | 290 ( 18.8%) | 106 ( 35.9%) | 86 ( 10.9%) | 24 ( 7.3%) |
| ··tasmlib_hashing_absorb_multiple | 356 ( 18.0%) | 260 ( 16.9%) | 106 ( 35.9%) | 72 ( 9.2%) | 24 ( 7.3%) |
| ····tasmlib_hashing_absorb_multiple_hash_all_full_chunks | 72 ( 3.6%) | 48 ( 3.1%) | 100 ( 33.9%) | 60 ( 7.6%) | 0 ( 0.0%) |
| ····tasmlib_hashing_absorb_multiple_pad_varnum_zeros | 144 ( 7.3%) | 92 ( 6.0%) | 0 ( 0.0%) | 0 ( 0.0%) | 0 ( 0.0%) |
| ····tasmlib_hashing_absorb_multiple_read_remainder | 66 ( 3.3%) | 38 ( 2.5%) | 6 ( 2.0%) | 0 ( 0.0%) | 0 ( 0.0%) |
| tasmlib_hashing_merkle_verify | 36 ( 1.8%) | 26 ( 1.7%) | 0 ( 0.0%) | 18 ( 2.3%) | 20 ( 6.1%) |
| ··tasmlib_hashing_merkle_verify_tree_height_is_not_zero | 12 ( 0.6%) | 2 ( 0.1%) | 0 ( 0.0%) | 18 ( 2.3%) | 12 ( 3.7%) |
| ····tasmlib_hashing_merkle_verify_traverse_tree | 7 ( 0.4%) | 0 ( 0.0%) | 0 ( 0.0%) | 18 ( 2.3%) | 12 ( 3.7%) |
| Total | 1973 (100.0%) | 1542 (100.0%) | 295 (100.0%) | 786 (100.0%) | 327 (100.0%) |
Loading

0 comments on commit c446e7e

Please sign in to comment.