Skip to content

[BUG] Spore lockProxy Adds an Extra Cluster-Owner Output per Spore #597

Description

@phroi

Hello folks at CKB DevRel,

I noticed that two spores of the same cluster in one transaction, with clusterMode: "lockProxy", get two cluster-owner outputs for one owner input.

Minimal Reproduction

import { ccc } from "@ckb-ccc/core";
import { spore } from "@ckb-ccc/spore";
import { packRawClusterData, prepareCluster } from "@ckb-ccc/spore/advanced";

const client = new ccc.ClientPublicTestnet();
const lock = { codeHash: "0x" + "00".repeat(32), hashType: "type", args: "0x" } as const;
const clusterId = "0x" + "66".repeat(32);

// A cluster cell owned by `lock`, and a transaction already spending a `lock` cell
await client.cache.markUsable({
  outPoint: { txHash: "0x" + "77".repeat(32), index: 0 },
  cellOutput: { lock, type: { ...spore.getClusterScriptInfo(client), args: clusterId } },
  outputData: packRawClusterData({ name: "", description: "" }),
});
const tx = ccc.Transaction.from({
  inputs: [{ previousOutput: { txHash: "0x" + "88".repeat(32), index: 0 }, cellOutput: { capacity: 0, lock }, outputData: "0x" }],
});

// Two spores of the same cluster
const signer = new ccc.SignerCkbScriptReadonly(client, lock);
await prepareCluster(signer, tx, { contentType: "", content: "0x", clusterId }, "lockProxy");
await prepareCluster(signer, tx, { contentType: "", content: "0x", clusterId }, "lockProxy");
console.log(tx.inputs.length, "input,", tx.outputs.length, "outputs");

Behavior

1 input, 2 outputs

prepareCluster runs once per spore. It finds the owner input by value. But it looks for the owner output with output.lock === lock, which compares object references. So it misses the output it already added, then adds another copy of the owner cell.

Each extra copy has the owner cell's full capacity. The signer pays for it, but the cell goes to the cluster owner.

Same two-spore setup as #125 (fixed by #127), different cause.

Environment

  • @ckb-ccc/core@1.23.0, @ckb-ccc/spore@1.6.15
  • Node.js 24.18.0, Linux

Keep up the Great Work,
Phroi %29

Activity

  1. added theissue type on Oct 13, 2026
  2. ashuralyk commented on Oct 24, 2026

    @ashuralyk
    Contributor

    Thanks to your report on this BUG, I'm already fixing it.

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

    bugSomething isn't working

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions