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

update the nmt wrapper to the new rsmt2d.Tree interface #256

Merged
merged 8 commits into from
Mar 27, 2021

Conversation

evan-forbes
Copy link
Member

@evan-forbes evan-forbes commented Mar 26, 2021

Description

This PR updates the nmt wrapper to the new rsmt2d.Tree interface. I'm leaving as a draft as I think there are somethings that still need to be updated before this can be merged. good to go.

Closes: #255

@codecov-io
Copy link

codecov-io commented Mar 26, 2021

Codecov Report

Merging #256 (e35f5ea) into master (eff282a) will increase coverage by 1.19%.
The diff coverage is 14.54%.

@@            Coverage Diff             @@
##           master     #256      +/-   ##
==========================================
+ Coverage   60.87%   62.07%   +1.19%     
==========================================
  Files         261      260       -1     
  Lines       23640    23164     -476     
==========================================
- Hits        14392    14380      -12     
+ Misses       7759     7295     -464     
  Partials     1489     1489              
Impacted Files Coverage Δ
cmd/tendermint/commands/init.go 2.22% <0.00%> (-1.78%) ⬇️
config/toml.go 60.86% <ø> (ø)
consensus/state.go 68.02% <0.00%> (-0.39%) ⬇️
node/node.go 54.77% <ø> (-3.25%) ⬇️
p2p/ipld/nmt_wrapper.go 90.00% <ø> (ø)
p2p/ipld/read.go 82.85% <ø> (ø)
proxy/client.go 0.00% <ø> (-23.08%) ⬇️
test/e2e/generator/generate.go 0.00% <ø> (ø)
types/block.go 77.02% <ø> (-0.95%) ⬇️
types/shares.go 97.40% <ø> (+1.84%) ⬆️
... and 33 more

@evan-forbes evan-forbes self-assigned this Mar 27, 2021
Comment on lines -203 to -215
var _ rsmt2d.Tree = &nmtWrapper{}

func newNmtConstructor() rsmt2d.Tree {
return &nmtWrapper{
nmt.New(sha256.New()),
}
}

// we could get rid of this wrapper and use the nmt directly if we
// make Push take in the data as one one byte array (instead of two).
type nmtWrapper struct {
*nmt.NamespacedMerkleTree
}
Copy link
Member Author

@evan-forbes evan-forbes Mar 27, 2021

Choose a reason for hiding this comment

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

This wrapper in the ipld plugin was not needed, because it was not used to generate roots.

@evan-forbes evan-forbes marked this pull request as ready for review March 27, 2021 01:25
@evan-forbes evan-forbes removed the request for review from tac0turtle March 27, 2021 01:26
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.

LGTM!
tenor

@evan-forbes evan-forbes merged commit a77b679 into master Mar 27, 2021
@evan-forbes evan-forbes deleted the evan/nmt-wrapper-update branch March 27, 2021 17:11
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.

Update nmt wrapper to accomodate new rsmt2d.Tree interface
3 participants