sbtc-developer-release
sbtc-developer-release copied to clipboard
refactor: Split serialization from `Codec` into separate modules
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
- #413
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:
- [x] My code follows the style guidelines of this project
- [x] I have performed a self-review of my code
- [x] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [x] I have added tests that prove my fix is effective or that my feature works
- [x] New and existing unit tests pass locally with my changes
- [ ] Any dependent changes have been merged and published in downstream modules