Skip to content

[BUG] Block/Header RPCs Fail with a verbosity Argument #568

Description

@phroi

Hello folks at CKB DevRel,

I noticed that the block/header methods fail whenever verbosity is passed.

Minimal Reproduction

import { ccc } from "@ckb-ccc/core";

const owner = ccc.ClientPublicTestnet.open();
const client = owner.value;
for (const read of [
  () => client.getTipHeader(0),
  () => client.getTipHeader("0x0" as never),
  () => client.getBlockByNumber(1, "0x0" as never),
  () => client.getBlockByNumber(1, "0x2" as never, true),
]) {
  console.log(await read().catch((error) => error.message));
}
await owner.dispose();

Behavior

Invalid parameter for `verbosity`: invalid type: integer `0`, expected a hex-encoded, 0x-prefixed Uint32
undefined is not iterable (cannot read property Symbol(Symbol.iterator))
Cannot read properties of undefined (reading 'dao')
Cannot read properties of undefined (reading 'dao')

The senders encode only the block number or hash, so a numeric verbosity reaches the node as a JSON number instead of the Uint32 hex string the node expects. A hex string gets past the node, but the serialized bytes and the with_cycles response then reach transformers that expect a decoded header or block. getBlockByHash, getHeaderByNumber and getHeaderByHash fail the same way.

Environment

  • @ckb-ccc/core@1.20.0, 1.20.1 and 1.22.0
  • Node.js 24.18.0, Linux

Keep up the Great Work,
Phroi %31

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

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions