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: Split serialization from Codec into separate modules #414

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

ldiego08
Copy link

Summary of changes

This PR proposes to fragment the serialization (Codec) implementation for different primitives from codec.rs into separate modules, i.e.: amount, recoverable_signature, etc., rename some of the interfaces, and document the code more thoroughly.

⚠️ The code added so far seeks to illustrate the proposed structure. I will implement it fully if this makes sense.

Background

While implementing the Codec trait's unit tests, I noted that the code could benefit from a bit more modularity in favor of readability and making unit tests more focused.

Proposed structure

src/
├─ serialize/
│  ├─ amount
│  ├─ recoverable_signature
│  ├─ script
│  ├─ u64

Related PRs

Testing

Run tests normally via cargo make test.

Risks

None.

How were these changes tested?

The tests included produce the same results as the ones in the existing Codec trait implementations, ensuring they work the same.

What future testing should occur?

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Status: Triage
Development

Successfully merging this pull request may close these issues.

None yet

1 participant