celestiaorg / nmt

Namespaced Merkle Tree
Apache License 2.0
112 stars 39 forks source link

feat: prepare for testing fraudulant blocks by allowing for custom hashers and the ability to add leaves without validation #211

Closed evan-forbes closed 1 year ago

evan-forbes commented 1 year ago

Overview

Currently, the hasher is not swappable, this is only problematic when trying to create fraudulent block test cases, since the standard hasher prevents such behavior.

Checklist

codecov[bot] commented 1 year ago

Codecov Report

Merging #211 (6dc07a6) into master (cdc88e8) will decrease coverage by 0.20%. The diff coverage is 88.23%.

@@            Coverage Diff             @@
##           master     #211      +/-   ##
==========================================
- Coverage   94.03%   93.83%   -0.20%     
==========================================
  Files           5        5              
  Lines         570      584      +14     
==========================================
+ Hits          536      548      +12     
- Misses         19       20       +1     
- Partials       15       16       +1     
Impacted Files Coverage Δ
proof.go 88.51% <ø> (ø)
nmt.go 96.42% <87.50%> (-0.72%) :arrow_down:
hasher.go 97.56% <100.00%> (ø)
evan-forbes commented 1 year ago

However, it will require additional time to thoroughly identify the specific issues that users may encounter without proper implementation of the Hasher interface. We may want to look into this later. As we are currently using our own implementation that should be fine.

pretty much the only reason I can think of to do this is to purposefully mess things up lolol

left a note in the godoc for the hasher interface to say just that