celestiaorg / nmt

Namespaced Merkle Tree
Apache License 2.0
116 stars 42 forks source link

feat(proof.go): adding JSON marshal/unmarshal #214

Closed distractedm1nd closed 1 year ago

distractedm1nd commented 1 year ago

Adds json marshaling/unmarshaling to nmt.Proof.

As found elsewhere in the go stdlib, UnmarshalJSON must be defined on the pointer receiver although MarshalJSON is a value receiver.

This is needed because the fields are private. Does this need to be the case? If we make them public, JSON marshaling will work by default.

codecov[bot] commented 1 year ago

Codecov Report

Merging #214 (ae07a1c) into master (cdc88e8) will decrease coverage by 0.17%. The diff coverage is 88.23%.

@@            Coverage Diff             @@
##           master     #214      +/-   ##
==========================================
- Coverage   94.03%   93.86%   -0.17%     
==========================================
  Files           5        5              
  Lines         570      587      +17     
==========================================
+ Hits          536      551      +15     
- Misses         19       20       +1     
- Partials       15       16       +1     
Impacted Files Coverage Δ
proof.go 88.48% <88.23%> (-0.03%) :arrow_down: