Repository navigation
Commit ceb52cb
test: tighten 2 CodeRabbit nitpicks on PCPS coverage tests
Addresses the 2 nitpick suggestions from CodeRabbit's latest review on
PR #670. Both are valid quality improvements that make existing
tests more deterministic / observable.
**mod.rs: trunk_query min_depth privacy-path assertion**
The previous `test_trunk_query_with_min_depth_engages_privacy_path_for_pcps`
only checked that `trunk_query` returned `Ok` — but the non-privacy
path also returns `Ok`, so a regression that silently fell back to
`calculate_chunk_depths` would still pass the test.
Tightened to:
- Use 25 keys (AVL tree depth ≥ 6) with `max_depth=4`, `min_depth=4`
— parameters where the two depth-split functions return *different*
vectors: `calculate_chunk_depths(6, 4)` → `[3, 3]` (natural even
split) vs `calculate_chunk_depths_with_minimum(6, 4, 4)` → `[4, 2]`
(front chunk clamped up to min_depth).
- Assert `result.chunk_depths ==
calculate_chunk_depths_with_minimum(tree_depth, max_depth,
min_depth)` — pins the privacy-path output as the headline check.
- Assert the non-privacy output differs — guards against
test-vacuity if a future change accidentally makes the two
functions return the same output for these inputs.
A regression where the PCPS arm in `is_provable_count_tree` is
dropped would now fail the privacy-path equality assertion.
**aggregate_count/tests.rs: narrow shape_walk_rejects_own_count_underflow**
The previous version of this test zeroed *every* `KVDigestCount` in
the proof op stream, which could trip an earlier shape error before
the verifier ever reached the `checked_sub` underflow arm — making
the test non-deterministic (the rejection message might come from
an unrelated arm).
Per CodeRabbit suggestion: iterate `ops.iter_mut().rev()` and `break`
on the first match, mutating only the *last* `KVDigestCount` op
(the deepest parent boundary node in the walk, whose children are
already on the proof stack). This makes the `checked_sub` underflow
the deterministic target of the rejection.
All 555 merk lib tests pass; cargo fmt clean.
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>1 parent 7b045cf commit ceb52cb
2 files changed
Lines changed: 58 additions & 16 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1882 | 1882 | | |
1883 | 1883 | | |
1884 | 1884 | | |
| 1885 | + | |
| 1886 | + | |
| 1887 | + | |
| 1888 | + | |
| 1889 | + | |
| 1890 | + | |
1885 | 1891 | | |
1886 | 1892 | | |
1887 | | - | |
| 1893 | + | |
| 1894 | + | |
| 1895 | + | |
| 1896 | + | |
1888 | 1897 | | |
1889 | 1898 | | |
1890 | 1899 | | |
1891 | | - | |
| 1900 | + | |
| 1901 | + | |
| 1902 | + | |
| 1903 | + | |
| 1904 | + | |
| 1905 | + | |
| 1906 | + | |
| 1907 | + | |
1892 | 1908 | | |
1893 | 1909 | | |
1894 | 1910 | | |
| |||
1903 | 1919 | | |
1904 | 1920 | | |
1905 | 1921 | | |
1906 | | - | |
1907 | | - | |
1908 | | - | |
1909 | | - | |
1910 | | - | |
1911 | | - | |
1912 | | - | |
1913 | | - | |
| 1922 | + | |
| 1923 | + | |
1914 | 1924 | | |
1915 | | - | |
| 1925 | + | |
1916 | 1926 | | |
1917 | 1927 | | |
1918 | 1928 | | |
| 1929 | + | |
| 1930 | + | |
| 1931 | + | |
| 1932 | + | |
| 1933 | + | |
| 1934 | + | |
| 1935 | + | |
| 1936 | + | |
| 1937 | + | |
| 1938 | + | |
| 1939 | + | |
| 1940 | + | |
| 1941 | + | |
| 1942 | + | |
| 1943 | + | |
| 1944 | + | |
| 1945 | + | |
| 1946 | + | |
| 1947 | + | |
| 1948 | + | |
| 1949 | + | |
| 1950 | + | |
| 1951 | + | |
| 1952 | + | |
| 1953 | + | |
| 1954 | + | |
| 1955 | + | |
1919 | 1956 | | |
1920 | 1957 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1764 | 1764 | | |
1765 | 1765 | | |
1766 | 1766 | | |
1767 | | - | |
1768 | | - | |
1769 | | - | |
1770 | | - | |
| 1767 | + | |
| 1768 | + | |
| 1769 | + | |
| 1770 | + | |
| 1771 | + | |
| 1772 | + | |
| 1773 | + | |
| 1774 | + | |
1771 | 1775 | | |
1772 | | - | |
| 1776 | + | |
1773 | 1777 | | |
1774 | 1778 | | |
1775 | 1779 | | |
| 1780 | + | |
1776 | 1781 | | |
1777 | 1782 | | |
1778 | 1783 | | |
| |||
0 commit comments