Skip to content
This repository has been archived by the owner on Dec 4, 2024. It is now read-only.

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 subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant