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

getTreeNameFromConstructorFn does not work for registered trees #286

Closed
rootulp opened this issue Jan 30, 2024 · 0 comments · Fixed by #287
Closed

getTreeNameFromConstructorFn does not work for registered trees #286

rootulp opened this issue Jan 30, 2024 · 0 comments · Fixed by #287
Assignees

Comments

@rootulp
Copy link
Collaborator

rootulp commented Jan 30, 2024

Context

#277 introduced a breaking change that requires users of this library to register trees via RegisterTree. Trees are later fetched from a global map of trees based on their treeConstructor (a.k.a. treeCreatorFn).

Problem

This line does not evaluate to true when I expect it to.

rsmt2d/tree.go

Line 77 in bb5e119

if reflect.DeepEqual(reflect.ValueOf(treeFn), reflect.ValueOf(treeConstructor)) {

For example, in celestiaorg/celestia-app#3065 I'm registering a tree for the square size 1. Then I run TestMinDataAvailabilityHeader which fails because the pointer inside treeFn doesn't match the pointer inside treeConstructor.

Screenshot

Screenshot 2024-01-30 at 2 10 18 PM

Proposal

  1. Revert fix!: UnmarshalJSON is limited to the default Tree bug #277
  2. Explore refactor! Change ComputeExtendedDataSquare argument from TreeConstructorFn to string #278
@rootulp rootulp self-assigned this Jan 30, 2024
rootulp added a commit that referenced this issue Feb 2, 2024
Closes #286 by deleting
`getTreeNameFromConstructorFn`.
Closes #288,
#289 by fixing those tests.
Inspired by #278
Includes two breaking changes:
1. `ComputeExtendedDataSquare` now accepts a parameter `treeName:
string`
2. `ImportExtendedDataSquare` now accepts a parameter `treeName: string`

---------

Co-authored-by: sontrinh16 <[email protected]>
0xchainlover pushed a commit to celestia-org/rsmt2d that referenced this issue Aug 1, 2024
Closes celestiaorg/rsmt2d#286 by deleting
`getTreeNameFromConstructorFn`.
Closes celestiaorg/rsmt2d#288,
celestiaorg/rsmt2d#289 by fixing those tests.
Inspired by celestiaorg/rsmt2d#278
Includes two breaking changes:
1. `ComputeExtendedDataSquare` now accepts a parameter `treeName:
string`
2. `ImportExtendedDataSquare` now accepts a parameter `treeName: string`

---------

Co-authored-by: sontrinh16 <[email protected]>
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 a pull request may close this issue.

1 participant