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

refactor(shwap): Extract eds interface #3452

Merged
merged 11 commits into from
Jun 5, 2024

Conversation

walldiss
Copy link
Member

@walldiss walldiss commented May 31, 2024

  • Reintroduce file interface as eds interface. Change aims to allow usage of EDS interface outside of storage package and to be high level interface of EDS methods.
  • Renames of eds interface methods to align with returned shwap types names
    • Share() -> Sample
    • Data -> Row data
  • Extracts New<shwap_type_name>FromEDS functions to eds file methods
    • moves associated tests to eds pkg

Additional refactoring:

  • Change Interface Name: Realized that 'EDS' is a terrible name for an interface. Renamed eds.EDS to eds.Accessor to more accurately reflect its functionality rather than its internal content.

  • Separate Closer: Extracted Closer from Accessor. Now it is available in a new composite interface AccessorCloser.

  • Rename InMem: Renamed InMem to rsmt2d to better align with its usage.

  • Decouple NamespacedData: Separated NamespacedData from the rsmt2d implementation. It is now a standalone function.

  • Update EDS Method: Replaced the EDS() method with Flattened, similar to rsmt2d. Considered introducing two separate methods, Flattened and FlattenedODS, with the latter to be potentially added later. Proposed to park this suggestion in an issue for future consideration.

@walldiss walldiss added kind:refactor Attached to refactoring PRs shwap labels May 31, 2024
@walldiss walldiss self-assigned this May 31, 2024
@codecov-commenter
Copy link

codecov-commenter commented May 31, 2024

Codecov Report

Attention: Patch coverage is 67.64706% with 22 lines in your changes missing coverage. Please review.

Please upload report for BASE (shwap@9e82fd6). Learn more about missing BASE report.

Files Patch % Lines
share/new_eds/rsmt2d.go 62.74% 17 Missing and 2 partials ⚠️
share/new_eds/nd.go 77.77% 1 Missing and 1 partial ⚠️
share/shwap/row_namespace_data.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##             shwap    #3452   +/-   ##
========================================
  Coverage         ?   43.26%           
========================================
  Files            ?      286           
  Lines            ?    16433           
  Branches         ?        0           
========================================
  Hits             ?     7110           
  Misses           ?     8492           
  Partials         ?      831           

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

@Wondertan Wondertan marked this pull request as draft May 31, 2024 12:36
@Wondertan
Copy link
Member

Drafting until we migrate some funcs over EDS interface

@walldiss
Copy link
Member Author

walldiss commented Jun 3, 2024

I've applied review suggestions in 46daf13 and listed what changed in PR description in Additional refactoring section.

@walldiss walldiss marked this pull request as ready for review June 3, 2024 03:02
@walldiss walldiss requested review from Wondertan and cristaloleg June 3, 2024 06:14
Copy link
Contributor

@ramin ramin left a comment

Choose a reason for hiding this comment

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

had a very superficial look / review, the interfaces and methods are starting to make sense to me as a layman and someone that might need to use them 😸

One question: is share/new_eds meant to survive? I wonder if having it organized more like

share/eds/v2 or something would be better than new_eds?

@walldiss
Copy link
Member Author

walldiss commented Jun 3, 2024

To @ramin:

One question: is share/new_eds meant to survive? I wonder if having it organized more like
share/eds/v2 or something would be better than new_eds?

Not going to survive. Eventually (in the late shwap PRs) It will land into eds pkg. For now it is not there, because existing eds pkg contains a lot of code and new code would get lost there. Existing eds pkg code will be removed entirely and will be replaced with content of new_eds

extract switch
simplify AxisHalf
@walldiss walldiss merged commit 60e757e into celestiaorg:shwap Jun 5, 2024
25 checks passed
walldiss added a commit that referenced this pull request Jun 10, 2024
- Reintroduce file interface as eds interface. Change aims to allow
usage of EDS interface outside of storage package and to be high level
interface of EDS methods.
- Renames of eds interface methods to align with returned shwap types
names
    - Share() -> Sample
    - Data -> Row data
- Extracts New<shwap_type_name>FromEDS functions to eds file methods
    - moves associated tests to eds pkg
    
**Additional refactoring:**
- **Change Interface Name**: Realized that 'EDS' is a terrible name for
an interface. Renamed `eds.EDS` to `eds.Accessor` to more accurately
reflect its functionality rather than its internal content.

- **Separate Closer**: Extracted `Closer` from `Accessor`. Now it is
available in a new composite interface `AccessorCloser`.

- **Rename InMem**: Renamed `InMem` to `rsmt2d` to better align with its
usage.

- **Decouple NamespacedData**: Separated `NamespacedData` from the
`rsmt2d` implementation. It is now a standalone function.

- **Update EDS Method**: Replaced the `EDS()` method with `Flattened`,
similar to `rsmt2d`. Considered introducing two separate methods,
`Flattened` and `FlattenedODS`, with the latter to be potentially added
later. Proposed to park this suggestion in an issue for future
consideration.
walldiss added a commit that referenced this pull request Jun 10, 2024
- Reintroduce file interface as eds interface. Change aims to allow
usage of EDS interface outside of storage package and to be high level
interface of EDS methods.
- Renames of eds interface methods to align with returned shwap types
names
    - Share() -> Sample
    - Data -> Row data
- Extracts New<shwap_type_name>FromEDS functions to eds file methods
    - moves associated tests to eds pkg
    
**Additional refactoring:**
- **Change Interface Name**: Realized that 'EDS' is a terrible name for
an interface. Renamed `eds.EDS` to `eds.Accessor` to more accurately
reflect its functionality rather than its internal content.

- **Separate Closer**: Extracted `Closer` from `Accessor`. Now it is
available in a new composite interface `AccessorCloser`.

- **Rename InMem**: Renamed `InMem` to `rsmt2d` to better align with its
usage.

- **Decouple NamespacedData**: Separated `NamespacedData` from the
`rsmt2d` implementation. It is now a standalone function.

- **Update EDS Method**: Replaced the `EDS()` method with `Flattened`,
similar to `rsmt2d`. Considered introducing two separate methods,
`Flattened` and `FlattenedODS`, with the latter to be potentially added
later. Proposed to park this suggestion in an issue for future
consideration.
walldiss added a commit to walldiss/celestia-node that referenced this pull request Jul 6, 2024
- Reintroduce file interface as eds interface. Change aims to allow
usage of EDS interface outside of storage package and to be high level
interface of EDS methods.
- Renames of eds interface methods to align with returned shwap types
names
    - Share() -> Sample
    - Data -> Row data
- Extracts New<shwap_type_name>FromEDS functions to eds file methods
    - moves associated tests to eds pkg
    
**Additional refactoring:**
- **Change Interface Name**: Realized that 'EDS' is a terrible name for
an interface. Renamed `eds.EDS` to `eds.Accessor` to more accurately
reflect its functionality rather than its internal content.

- **Separate Closer**: Extracted `Closer` from `Accessor`. Now it is
available in a new composite interface `AccessorCloser`.

- **Rename InMem**: Renamed `InMem` to `rsmt2d` to better align with its
usage.

- **Decouple NamespacedData**: Separated `NamespacedData` from the
`rsmt2d` implementation. It is now a standalone function.

- **Update EDS Method**: Replaced the `EDS()` method with `Flattened`,
similar to `rsmt2d`. Considered introducing two separate methods,
`Flattened` and `FlattenedODS`, with the latter to be potentially added
later. Proposed to park this suggestion in an issue for future
consideration.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind:refactor Attached to refactoring PRs shwap
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants