You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Disabling checks to pass incorrect tests rather than fixing the tests themselves may prevent the detection of bugs or other incorrect behavior.
Description
The function fetch_sprout_final_treestates() in zebra-state/src/service/check/anchors.rs contains a block of commented code that performs an assertion that “that roots match the fetched tree during tests”. The annotations suggest that this check was disabled due to bad test data:
- assert that roots match the fetched tree during tests
- move this CPU-intensive check to sprout_anchors_refer_to_treestates()
assert_eq!(
input_tree.root(),
joinsplit.anchor,
"anchor and fetched input tree root did not match:\n\
anchor: {anchor:?},\n\
input tree root: {input_tree_root:?},\n\
input_tree: {input_tree:?}",
anchor = joinsplit.anchor
);
*/
As is, the code suggests that a required safety check has been disabled to prevent tests from failing, which prevents the test from being run in production as well. The preferred solution would be one of:
Fix the tests such that the check can remain enabled.
Disable this code only when tests are running.
Initial discussions with the Zebra team suggested that the latter approach would be preferable. Furthermore, the comment suggests that this check should be refactored and located elsewhere in the code. A task to track this change should be documented.
Recommendation
Re-enable the check and either add a flag to disable it during tests, or update tests to correctly pass when the check is in place.
Refactor the code as recommended in the comment, or add a link to a tracked issue detailing this work item.
The text was updated successfully, but these errors were encountered:
Impact
Disabling checks to pass incorrect tests rather than fixing the tests themselves may prevent the detection of bugs or other incorrect behavior.
Description
The function
fetch_sprout_final_treestates()
in zebra-state/src/service/check/anchors.rs contains a block of commented code that performs an assertion that “that roots match the fetched tree during tests”. The annotations suggest that this check was disabled due to bad test data:zebra/zebra-state/src/service/check/anchors.rs
Lines 158 to 172 in 5a88fe7
As is, the code suggests that a required safety check has been disabled to prevent tests from failing, which prevents the test from being run in production as well. The preferred solution would be one of:
Initial discussions with the Zebra team suggested that the latter approach would be preferable. Furthermore, the comment suggests that this check should be refactored and located elsewhere in the code. A task to track this change should be documented.
Recommendation
The text was updated successfully, but these errors were encountered: