Skip to content

CTID encoder truncates "network_id" values above "65535" #3158

Description

@RaymondSeven

Clio’s "encodeCTID" helper accepts "networkId" as "uint16_t", while the ETL network ID is stored and passed as "uint32_t".

As a result, network IDs above "65535" are silently truncated before validation. For example, network ID "70000" becomes "4464", causing Clio to emit a valid-looking but incorrect CTID.

Affected Paths

  • "account_tx"
  • Transaction WebSocket subscriptions
  • Expanded "tx" JSON responses
  • CTID lookup through the "tx" method

A CTID emitted by Clio on such a network cannot be queried back successfully because the decoded 16-bit network ID does not match the full ETL network ID.

Expected Behavior

Clio should omit the CTID when the network ID cannot fit within the CTID 16-bit network field, matching "rippled" behavior.

Suggested Fix

Change "encodeCTID" to accept "uint32_t" values and perform range validation before encoding:

std::optionalstd::string
encodeCTID(
uint32_t ledgerSeq,
uint32_t txnIndex,
uint32_t networkId
) noexcept;

Also update "toExpandedJson" to accept "std::optional<uint32_t>" instead of "std::optional<uint16_t>".

Example

For "network_id = 70000":

Expected: no CTID
Actual: CTID contains network ID 4464

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    • Status
      📋 Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions