Skip to content
This repository was archived by the owner on Nov 24, 2021. It is now read-only.
This repository was archived by the owner on Nov 24, 2021. It is now read-only.

Some objects can not be encoded, resulting in "not valid hex" error. #132

@nixer89

Description

@nixer89

I am using: "ripple-binary-codec": "^1.1.2",

I am currently trying to "encode" some ledger_data objects from rippled. There are a many objects which can not be encoded. The error is:

[2021-06-08 19:58:17] [LOG] Error: 283 is not a valid hex-string
at Function.UInt64.from (..\node_modules\ripple-binary-codec\dist\types\uint-64.js:60:23)
at ..\node_modules\ripple-binary-codec\dist\types\st-object.js:129:56
at Array.forEach ()
at Function.STObject.from (..\node_modules\ripple-binary-codec\dist\types\st-object.js:128:16)
at serializeObject (..\node_modules\ripple-binary-codec\dist\binary.js:59:32)
at Object.encode (..\node_modules\ripple-binary-codec\dist\index.js:24:12)

The above example occurs when encoding following ledger object:

{
  Balance: { currency: 'GCB', issuer: 'rrrrrrrrrrrrrrrrrrrrBZbvji', value: '0' },
  Flags: 2162688,
  HighLimit: {
    currency: 'GCB',
    issuer: 'rBfVgTnsdh8ckC19RM8aVGNuMZnpwrMP6n',
    value: '0'
  },
  HighNode: '283',
  LedgerEntryType: 'RippleState',
  LowLimit: {
    currency: 'GCB',
    issuer: 'rhRFGCy2RJTA8oxkjjtYTvofPVGqcgvXWj',
    value: '2000000'
  },
  LowNode: '0',
  PreviousTxnID: 'C0C37CE200B509E0A529880634F7841A9EF4CB65F03C12E6004CFAD9718D6694',
  PreviousTxnLgrSeq: 24695242,
  index: '0000041EFD027808D3F78C8352F97E324CB816318E00B977C74ECDDC7CD975B2'
}

There are many more objects which can actually not be encoded - mostly (a lot!) RippleState and DirectoryNode objects.
In the above example, the "HighNode" value seems to be the culprit. (same for LowNode in other objects).

An example for an error encoding a DirectoryNode is:

{
  Flags: 0,
  IndexPrevious: '2',
  Indexes: [
    'A3454ACED87177146EABD5E4A256021D836D1E3617618B1EB362D10B0D1BAC6A',
    'E1ED9E8D280BBE0B6656748FD647231851C6C650794D5E6852DFA1E35E68630F'
  ],
  LedgerEntryType: 'DirectoryNode',
  Owner: 'rHzDaMNybxQppiE3uWyt2N265KvAKdiRdP',
  RootIndex: '0CB3C1AD2C371136AEA434246D971C5FCCD32CBF520667E131AB7B10D706E752',
  index: '0B4A2E68C111F7E42FAEEE405F7344560C8240840B151D9D04131EB79D080167'
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions