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

fix!: UnmarshalJSON is limited to the default Tree bug #277

Merged
merged 37 commits into from
Jan 30, 2024

Conversation

sontrinh16
Copy link
Contributor

@sontrinh16 sontrinh16 commented Dec 13, 2023

Overview

Closed: #275

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

@sontrinh16 sontrinh16 changed the title [fix] UnmarshalJSON is limited to the default Tree Bug [fix] UnmarshalJSON is limited to the default Tree bug Dec 13, 2023
@rootulp rootulp changed the title [fix] UnmarshalJSON is limited to the default Tree bug fix: UnmarshalJSON is limited to the default Tree bug Dec 13, 2023
@sontrinh16 sontrinh16 marked this pull request as draft December 13, 2023 16:39
@rootulp
Copy link
Collaborator

rootulp commented Dec 13, 2023

@sontrinh16 test fails here

@sontrinh16
Copy link
Contributor Author

yeah i have to move to draft to fix this

@sontrinh16 sontrinh16 marked this pull request as ready for review December 13, 2023 17:20
@sontrinh16
Copy link
Contributor Author

alright seem all test pass now, sorry for the inconvenience guys

@Wondertan
Copy link
Member

Thanks for fixing this! Committing to review this tmrw

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.

Thanks for the contribution! Excited to see this land

tree.go Outdated Show resolved Hide resolved
tree.go Outdated Show resolved Hide resolved
tree.go Outdated Show resolved Hide resolved
tree.go Outdated Show resolved Hide resolved
extendeddatasquare.go Show resolved Hide resolved
extendeddatacrossword_test.go Outdated Show resolved Hide resolved
@sontrinh16 sontrinh16 changed the title fix: UnmarshalJSON is limited to the default Tree bug fix!: UnmarshalJSON is limited to the default Tree bug Dec 13, 2023
Copy link

codecov bot commented Dec 13, 2023

Codecov Report

Attention: 12 lines in your changes are missing coverage. Please review.

Comparison is base (35d7798) 80.76% compared to head (c988b3d) 80.89%.
Report is 1 commits behind head on main.

Files Patch % Lines
extendeddatasquare.go 58.33% 6 Missing and 4 partials ⚠️
default_tree.go 90.00% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #277      +/-   ##
==========================================
+ Coverage   80.76%   80.89%   +0.12%     
==========================================
  Files           7        8       +1     
  Lines         806      869      +63     
==========================================
+ Hits          651      703      +52     
- Misses        112      119       +7     
- Partials       43       47       +4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

extendeddatasquare.go Outdated Show resolved Hide resolved
extendeddatasquare.go Outdated Show resolved Hide resolved
tree.go Show resolved Hide resolved
tree.go Outdated Show resolved Hide resolved
tree.go Outdated Show resolved Hide resolved
staheri14
staheri14 previously approved these changes Jan 5, 2024
Copy link
Contributor

@staheri14 staheri14 left a comment

Choose a reason for hiding this comment

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

LGTM!

tree_test.go Outdated Show resolved Hide resolved
tree_test.go Show resolved Hide resolved
tree.go Show resolved Hide resolved
Co-authored-by: Sanaz Taheri <35961250+staheri14@users.noreply.github.com>
@sontrinh16 sontrinh16 dismissed stale reviews from staheri14 and rootulp via b53cf8c January 5, 2024 20:18
staheri14
staheri14 previously approved these changes Jan 8, 2024
Copy link
Contributor

@staheri14 staheri14 left a comment

Choose a reason for hiding this comment

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

Thanks for addressing the comments. LGTM!

extendeddatasquare.go Show resolved Hide resolved
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.

I have a few comments about the tests that were added. Also one question about what happens if UnmarshalJSON is invoked on a tree that doesn't contain the Tree field. Do we want a test case for that scenario? I assume it should unmarshal with the default tree.

tree_test.go Outdated Show resolved Hide resolved
tree_test.go Outdated Show resolved Hide resolved
tree_test.go Outdated Show resolved Hide resolved
tree_test.go Outdated Show resolved Hide resolved
tree_test.go Outdated Show resolved Hide resolved
tree_test.go Outdated Show resolved Hide resolved
tree_test.go Outdated Show resolved Hide resolved
tree_test.go Outdated Show resolved Hide resolved
tree_test.go Outdated Show resolved Hide resolved
tree_test.go Outdated Show resolved Hide resolved
@sontrinh16
Copy link
Contributor Author

I have a few comments about the tests that were added. Also one question about what happens if UnmarshalJSON is invoked on a tree that doesn't contain the Tree field. Do we want a test case for that scenario? I assume it should unmarshal with the default tree.

hmmmmm yeah i think we could add default tree as a fallback when Tree field is missing

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.

Overall LGTM. A few nits before we merge this. Thanks for all your hard work!

tree_test.go Outdated Show resolved Hide resolved
tree_test.go Outdated Show resolved Hide resolved
tree_test.go Outdated Show resolved Hide resolved
tree_test.go Outdated Show resolved Hide resolved
tree_test.go Outdated Show resolved Hide resolved
extendeddatasquare_test.go Outdated Show resolved Hide resolved
extendeddatasquare_test.go Outdated Show resolved Hide resolved
@sontrinh16
Copy link
Contributor Author

Overall LGTM. A few nits before we merge this. Thanks for all your hard work!

thanks for persevering through all the typo errors guys

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.

:shipit: fantastic work

@evan-forbes
Copy link
Member

approving as I don't want to block, but we should have @Wondertan review things again to ensure this is exactly what they wanted

meaning, we could merge and just not release until one last approval or wait for that approval

thanks a lot tho @sontrinh16 this took a lot

Copy link
Member

@Wondertan Wondertan left a comment

Choose a reason for hiding this comment

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

We wanted JSONUnmarshal to work with the correct tree builder, and we got it here without breaking anything, so approve ;)

@evan-forbes evan-forbes merged commit bb5e119 into celestiaorg:main Jan 30, 2024
5 checks passed
rootulp added a commit to rootulp/rsmt2d that referenced this pull request Feb 3, 2024
rootulp added a commit that referenced this pull request Feb 7, 2024
While attempting to bump celestia-app to the v0.12.0-rc2, I noticed that
the `RegisterTree` design leaks an implementation detail to
celestia-app: the registering and managing of `treeName`s. Celestia-app
has two categories of of trees:
1. erasured namespaced merkle tree in
[nmt_wrapper.go](https://github.com/celestiaorg/celestia-app/blob/main/pkg/wrapper/nmt_wrapper.go)
2. EDS subtree root cacher
[nmt_caching.go](https://github.com/celestiaorg/celestia-app/blob/main/pkg/inclusion/nmt_caching.go)

Each of those categories has trees based on square size and NMT options.
Celestia-app needs to be careful to register all the appropriate trees
once (and only once) before they are used (via `Compute` or `Import`).
I'd like to explore a less breaking option to get celestia-node the
original desired feature which was
#275. In the meantime, I
think we should revert the two big breaking changes so that main can
remain release-able.

Revert #277
Revert #287
Closes #295 because no longer
relevant if we merge this.
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.

UnmarshalJSON is limited to the default Tree
5 participants