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

feat!: removes the Tree method from the NMT wrapper and introduces the ProveRange API #1438

Merged
merged 3 commits into from
Mar 3, 2023

Conversation

staheri14
Copy link
Contributor

@staheri14 staheri14 commented Mar 2, 2023

Overview

While reviewing the NMT wrapper implementation and attempting to write its specs, came across a contradiction in the wrapper's design. On one hand, the wrapper is intended to encapsulate an instance of NMT and re-define/modify some of its APIs, specifically the Push method. On the other hand, the wrapper also exposes the Tree() method, which returns a pointer to the underlying NMT tree and thus allows direct access to the tree and enables arbitrary manipulation of the underlying tree outside of the intended control of the wrapper. For instance, one can bypass the NMT wrapper Push method and directly call the Push method of the underlying tree using .Tree().Push(). This not only widens the error surface but also violates the initial objective of the wrapper.

To address this issue, the Tree() API has been removed, and all necessary methods of the underlying NMT are now exposed through the wrapper directly.

Checklist

  • New and updated code has appropriate documentation
  • New and updated code has new and/or updated testing
  • Required CI checks are passing
  • Visual proof for any user facing features like CLI or documentation updates
  • Linked issues closed with keywords

@staheri14 staheri14 self-assigned this Mar 2, 2023
@MSevey MSevey requested review from a team and rootulp and removed request for a team March 2, 2023 00:21
@MSevey MSevey requested a review from a team March 2, 2023 00:26
@codecov-commenter
Copy link

Codecov Report

Merging #1438 (523fac5) into main (651b1cf) will decrease coverage by 0.05%.
The diff coverage is 33.33%.

@@            Coverage Diff             @@
##             main    #1438      +/-   ##
==========================================
- Coverage   49.22%   49.18%   -0.05%     
==========================================
  Files          79       79              
  Lines        4477     4477              
==========================================
- Hits         2204     2202       -2     
- Misses       2089     2091       +2     
  Partials      184      184              
Impacted Files Coverage Δ
pkg/wrapper/nmt_wrapper.go 77.50% <0.00%> (-5.00%) ⬇️
pkg/proof/proof.go 67.46% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

Copy link
Collaborator

@rootulp rootulp left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Member

@evan-forbes evan-forbes left a comment

Choose a reason for hiding this comment

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

hmmm I couldn't find anywhere where this is used, and I don't remember why this was added in the first place, so it makes sense to remove it to me!

good find!

@staheri14
Copy link
Contributor Author

hmmm I couldn't find anywhere where this is used, and I don't remember why this was added in the first place, so it makes sense to remove it to me!

Indeed! there was no significant use case for it. It was only utilized here to invoke the ProveRange method of the underlying NMT. However, it could have been defined directly as a method for the NMT wrapper, which has been implemented as part of this pull request.

@staheri14 staheri14 merged commit 4ee939b into main Mar 3, 2023
@staheri14 staheri14 deleted the cleans-nmt-wrapper-api branch March 3, 2023 19:41
staheri14 added a commit that referenced this pull request Mar 8, 2023
## Overview
This PR addresses issue #1296 by adding the specification for the NMT
wrapper. The specification is based on the state of implementation after
the inclusion of the changes made in pull request #1438.

## Checklist

- [x] New and updated code has appropriate documentation
- [x] New and updated code has new and/or updated testing
- [x] Required CI checks are passing
- [x] Visual proof for any user facing features like CLI or
documentation updates
- [x] Linked issues closed with keywords
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.

None yet

4 participants