Skip to content

Commit

Permalink
perf(verify_mmr_successor): Use new algorithm
Browse files Browse the repository at this point in the history
Rewrite the snippet to use the new algorithm introduced in
`twenty-first` v0.44.1.

Also:
- document & sign-off on the snippet
- add additional negative test cases
  • Loading branch information
jan-ferdinand committed Jan 10, 2025
1 parent a8be202 commit 94fb493
Show file tree
Hide file tree
Showing 4 changed files with 485 additions and 525 deletions.
2 changes: 1 addition & 1 deletion tasm-lib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ serde = { version = "1", features = ["derive"] }
serde_json = "1"
strum = { version = "0.26", features = ["derive"] }
tasm-object-derive.workspace = true
triton-vm = { version = "0.44.0", default-features = false }
triton-vm = { version = "0.44.1", default-features = false }

[dev-dependencies.cargo-husky]
version = "1"
Expand Down
20 changes: 10 additions & 10 deletions tasm-lib/benchmarks/tasm_lib_mmr_verify_mmr_successor.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,22 @@
{
"name": "tasm_lib_mmr_verify_mmr_successor",
"benchmark_result": {
"clock_cycle_count": 21555,
"hash_table_height": 3738,
"u32_table_height": 9291,
"op_stack_table_height": 12832,
"ram_table_height": 473
"clock_cycle_count": 1578,
"hash_table_height": 696,
"u32_table_height": 1552,
"op_stack_table_height": 918,
"ram_table_height": 176
},
"case": "CommonCase"
},
{
"name": "tasm_lib_mmr_verify_mmr_successor",
"benchmark_result": {
"clock_cycle_count": 63263,
"hash_table_height": 12288,
"u32_table_height": 17851,
"op_stack_table_height": 35990,
"ram_table_height": 893
"clock_cycle_count": 2658,
"hash_table_height": 876,
"u32_table_height": 1875,
"op_stack_table_height": 1518,
"ram_table_height": 326
},
"case": "WorstCase"
}
Expand Down
2 changes: 1 addition & 1 deletion tasm-lib/src/mmr/leaf_index_to_mt_index_and_peak_index.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ use crate::traits::basic_snippet::SignOffFingerprint;
/// - all output arguments are properly [`BFieldCodec`] encoded
///
/// [rust]: twenty_first::util_types::mmr::shared_basic::leaf_index_to_mt_index_and_peak_index
#[derive(Debug, Clone, Copy, Eq, PartialEq, Hash)]
#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)]
pub struct MmrLeafIndexToMtIndexAndPeakIndex;

impl MmrLeafIndexToMtIndexAndPeakIndex {
Expand Down
Loading

0 comments on commit 94fb493

Please sign in to comment.