Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make IntervalDigest jsonable #35

Merged
merged 2 commits into from
May 10, 2021
Merged

Conversation

evan-forbes
Copy link
Member

Some tests in lazyledger-core require DataAvailabilityHeader to be encoded via json, this PR exports the fields of IntervalDigest, along with adding appropriate json tags.

This PR, or another alternative, should be merged before #312 can be merged.

closes #34

@evan-forbes evan-forbes self-assigned this May 10, 2021
@codecov
Copy link

codecov bot commented May 10, 2021

Codecov Report

Merging #35 (505be91) into master (20d1181) will decrease coverage by 0.03%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #35      +/-   ##
==========================================
- Coverage   94.77%   94.73%   -0.04%     
==========================================
  Files           7        7              
  Lines         306      304       -2     
==========================================
- Hits          290      288       -2     
  Misses         11       11              
  Partials        5        5              
Impacted Files Coverage Δ
namespace/digest.go 100.00% <100.00%> (ø)
proof.go 97.05% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 20d1181...505be91. Read the comment docs.

namespace/digest.go Outdated Show resolved Hide resolved
Co-authored-by: Ismail Khoffi <Ismail.Khoffi@gmail.com>
Comment on lines 8 to 12
type IntervalDigest struct {
min ID
max ID
digest []byte
Min ID `json:"min"`
Max ID `json:"max"`
Digest []byte `json:"digest"`
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm wondering if we should not get rid of this struct entirely and instead store this as raw bytes min||max||digest instead. For instance, when using this with ipfs, the CID will essentially be this plus some overhead bytes that stem from the multihash standard.
We can merge this as is to unblock celestiaorg/celestia-core#312 but we should track this somewhere.

Copy link
Member

@liamsi liamsi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍🏼

@evan-forbes
Copy link
Member Author

evan-forbes commented May 10, 2021

will merge after #317 CI passes, then I'll update that PR to use nmt v0.3.2 v0.4.0

@evan-forbes evan-forbes merged commit 6dc97cc into master May 10, 2021
@liamsi liamsi deleted the evan/jsonify-intervaldigest branch May 10, 2021 23:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make IntervalDigest json encodable
2 participants