Skip to content

Remove legacy Haven/Offshore (XHV) pricing_record and related types; add blob type validation#37

Merged
MoneroOcean merged 2 commits into
masterfrom
codex/remove-xhv-support-from-project
Jun 3, 2026
Merged

Remove legacy Haven/Offshore (XHV) pricing_record and related types; add blob type validation#37
MoneroOcean merged 2 commits into
masterfrom
codex/remove-xhv-support-from-project

Conversation

@MoneroOcean
Copy link
Copy Markdown
Owner

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.

Codex Task

### 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.
@MoneroOcean MoneroOcean merged commit 3bcf9f1 into master Jun 3, 2026
3 checks passed
@MoneroOcean MoneroOcean deleted the codex/remove-xhv-support-from-project branch June 3, 2026 18:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant