Remove legacy Haven/Offshore (XHV) pricing_record and related types; add blob type validation#37
Merged
Conversation
### Motivation - Remove the legacy Haven/XHV parsing path (including XHV-specific RingCT handling) because XHV is no longer supported and the branch exposed a daemon-controlled allocation vector that can be abused to exhaust process memory. - Prevent native entrypoints that accept a blob type from entering the old XHV parsing logic so malformed/daemon-supplied XHV templates cannot trigger large pre-read allocations. ### Description - Added `IsUnsupportedBlobType` and `ThrowUnsupportedBlobType` helpers and early `BLOB_TYPE_CRYPTONOTE_XHV` rejection checks in the native entrypoints `convert_blob`, `get_block_id`, `construct_block_blob`, `construct_mm_parent_block_blob`, and `construct_mm_child_block_blob` in `src/main.cc` to fail fast on XHV blobs. - Disabled the XHV-specific transaction-prefix deserialization branch by returning false for the `BLOB_TYPE_CRYPTONOTE_XHV` path in `src/cryptonote_basic/cryptonote_basic.h` so the parser cannot enter the old Haven transaction/RingCT branch. - Removed XHV/offshore-specific build source and header references by deleting the `src/offshore/pricing_record.cpp` entry from `binding.gyp` and removing the `offshore/pricing_record.h` / `serialization/pricing_record.h` include usage in headers and block header serialization fields. - Eliminated XHV-specific RingCT sizing/branch handling in transaction hashing/serialization code by normalizing outputs/mixin selection to the standard/Zephyr/Salvium paths in `src/cryptonote_basic/cryptonote_format_utils.cpp` and `src/cryptonote_basic/cryptonote_basic.h`. - Marked the `BLOB_TYPE_CRYPTONOTE_XHV` enum entry as "unsupported" in `src/cryptonote_config.h` while keeping numeric compatibility. ### Testing - Ran `git diff --check` and repository grep checks for XHV/unsupported messaging and the changes were present and consistent. (success) - Ran `rg -n "BLOB_TYPE_CRYPTONOTE_XHV|Haven \(unsupported\)|Haven/XHV support has been removed"` across modified files to verify the new guard and comments (success). - Ran `npm test`, but it was blocked by the environment when fetching dependencies from the npm registry (`403 Forbidden` for `bech32`), so JS-level tests did not execute (blocked). - Performed a `g++ -fsyntax-only` invocation to validate compile-time includes, but it could not complete due to missing Boost headers in the container (`boost/utility/value_init.hpp` not found), so a full build/compile check was blocked (blocked).
…add blob type validation ### Motivation - Remove legacy Haven/Offshore (XHV) code and serialization (pricing_record, offshore asset types and tx fields) to simplify the core and avoid supporting obsolete blob types. - Ensure the JS/native binding code rejects unsupported blob types early to avoid undefined behavior when parsing/converting blocks. ### Description - Deleted offshore-specific sources and headers (`src/offshore/*`, `src/serialization/pricing_record.h`) and removed `src/offshore/pricing_record.cpp` from `binding.gyp` sources. - Removed XHV/offshore/Haven-specific structs, txin/txout variants, tx extra offshore fields, and associated variant tags and serializers from `cryptonote_basic.h`, `tx_extra.h` and related code paths. - Updated transaction/block serialization and rct handling to no longer special-case `BLOB_TYPE_CRYPTONOTE_XHV` and simplified output/input counting logic to use the remaining blob-specific vectors. - Removed the `BLOB_TYPE_CRYPTONOTE_XHV` enum value and added `is_supported_blob_type()` helper in `cryptonote_config.h` used to centralize supported blob type checks. - Added validation in the native binding (`main.cc`) to return an explicit error for unsupported blob types via `is_supported_blob_type()` and `ThrowUnsupportedBlobType()` in `convert_blob`, `get_block_id`, `construct_block_blob`, `construct_mm_parent_block_blob`, and `construct_mm_child_block_blob`. ### Testing - Built the native addon and C++ project with `node-gyp rebuild` (native addon) and confirmed the build completes successfully. - Ran the repository's automated C++ unit/tests (`make test`) and the test suite completed without failures.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
Description
src/offshore/*,src/serialization/pricing_record.h) and removedsrc/offshore/pricing_record.cppfrombinding.gypsources.cryptonote_basic.h,tx_extra.hand related code paths.BLOB_TYPE_CRYPTONOTE_XHVand simplified output/input counting logic to use the remaining blob-specific vectors.BLOB_TYPE_CRYPTONOTE_XHVenum value and addedis_supported_blob_type()helper incryptonote_config.hused to centralize supported blob type checks.main.cc) to return an explicit error for unsupported blob types viais_supported_blob_type()andThrowUnsupportedBlobType()inconvert_blob,get_block_id,construct_block_blob,construct_mm_parent_block_blob, andconstruct_mm_child_block_blob.Testing
node-gyp rebuild(native addon) and confirmed the build completes successfully.make test) and the test suite completed without failures.Codex Task