-
Notifications
You must be signed in to change notification settings - Fork 0
feat: refactor domain objects deserialization #34
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This pull request refactors the domain object deserialization logic by replacing calls to domain::create with domain::create_old and updating the associated deserialization methods. In addition, legacy inline deserialization templates and macros have been removed and updated across various database modules, and the catch2 dependency version in conanfile.py was bumped.
- Replaced domain::create with domain::create_old in tests and database source/header files.
- Removed obsolete conditional macros and inline legacy deserialization methods.
- Updated dependency versions in conanfile.py.
Reviewed Changes
Copilot reviewed 19 out of 19 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| test/internal_database.cpp | Updated calls to domain::create_old for block, output, transaction_entry, header, and point. |
| src/databases/*.cpp | Updated deserialization calls to use domain::create_old instead of domain::create. |
| include/kth/database/databases/*.hpp | Removed legacy, commented-out deserialization template overloads and updated declarations to use expect<…>. |
| conanfile.py | Bumped catch2 dependency from 3.6.0 to 3.7.1. |
Comments suppressed due to low confidence (3)
include/kth/database/databases/header_abla_entry.cpp:36
- Consider adding explanatory comments detailing why a default tuple with zero values is returned when block_size (or subsequent values) fails to read, to clarify the error handling logic.
auto const block_size = reader.read_little_endian<uint64_t>();
include/kth/database/databases/utxo_entry.hpp:36
- Consider removing the commented-out legacy deserialization overloads to reduce clutter and improve code maintainability.
bool from_data(const data_chunk& data);
include/kth/database/databases/transaction_unconfirmed_entry.hpp:41
- Remove the commented-out legacy deserialization methods to avoid confusion and keep the interface focused on the updated 'expect<…>' based approach.
bool from_data(const data_chunk& data);
627083d to
d57e9db
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR refactors the deserialization logic across several domain objects by switching from domain::create to domain::create_old and migrating from custom from_data overloads to a unified expect‐based API. In addition, it removes conditional compilation branches for serialization/deserialization, and updates dependency versions in the conanfile.
- Switched deserialization calls to use domain::create_old consistently.
- Replaced legacy from_data implementations with new expect-based static functions.
- Updated Catch2 dependency to v3.7.1.
Reviewed Changes
Copilot reviewed 20 out of 20 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| test/internal_database.cpp | Updated deserialization calls for block, output, header, and transaction entries. |
| src/databases/utxo_entry.cpp | Introduced an expect-based deserialization for utxo_entry. |
| src/databases/transaction_unconfirmed_entry.cpp | Refactored deserialization and removed conditional compilation flags for serialization. |
| src/databases/transaction_entry.cpp | Refactored deserialization to use expect-based API. |
| src/databases/history_entry.cpp | Updated history_entry deserialization to use expect-based API. |
| src/databases/header_abla_entry.cpp | Modified header/abla state deserialization to use a unified API. |
| include/kth/database/databases/*.hpp & .ipp | Updated header and inline implementations in databases to match the new deserialization API and naming conventions. |
| conanfile.py | Updated Catch2 version dependency. |
Comments suppressed due to low confidence (2)
test/internal_database.cpp:45
- [nitpick] The use of 'create_old' instead of 'create' may be ambiguous. Consider adding documentation to clarify the differences between these functions.
return domain::create_old<domain::chain::block>(data);
src/databases/transaction_unconfirmed_entry.cpp:48
- Removing the conditional compilation branches that passed extra boolean flags changes the serialization behavior. Verify that always calling tx.to_data(sink, false) aligns with the intended design and does not affect expected serialization output.
return tx.serialized_size(false);
No description provided.