chopsticks icon indicating copy to clipboard operation
chopsticks copied to clipboard

Missing RPC methods when using Chopsticks fork (getReadProof and others)

Open nhussein11 opened this issue 1 year ago • 3 comments

Description

When connecting to a live Kusama endpoint, all expected RPC methods are available through api.rpc.state. However, when using Chopsticks to fork the same network locally, several RPC methods are missing, including getReadProof which is required for my use case.

Steps to Reproduce

  1. Create a simple script to check available RPC methods:
import { ApiPromise, WsProvider } from "@polkadot/api";

try {
  // Toggle between live endpoint and chopsticks
  const kusamaProvider = new WsProvider("wss://kusama.dotters.network");
  // const kusamaProvider = new WsProvider('ws://localhost:8000');

  const kusamaApi = await ApiPromise.create({ provider: kusamaProvider });

  const result = await kusamaApi.rpc.state;
  console.log('result', result)

  await kusamaApi.disconnect();
} catch (error) {
  console.error("Remote proxy execution failed:", error.message);
}
  1. Run Chopsticks with Kusama fork:
LOG_LEVEL=trace chopsticks -c kusama
  1. Execute the script with both endpoints

Expected Behavior

When using wss://kusama.dotters.network, the following RPC methods are available:

result {
  call: [Getter],
  getChildReadProof: [Getter],
  getKeys: [Getter],
  getKeysPaged: [Getter],
  getMetadata: [Getter],
  getPairs: [Getter],
  getReadProof: [Getter],
  getRuntimeVersion: [Getter],
  getStorage: [Getter],
  getStorageHash: [Getter],
  getStorageSize: [Getter],
  queryStorage: [Getter],
  queryStorageAt: [Getter],
  subscribeRuntimeVersion: [Getter],
  subscribeStorage: [Getter],
  traceBlock: [Getter],
  trieMigrationStatus: [Getter]
}

Actual Behavior

When using Chopsticks (ws://localhost:8000), several methods are missing:

result {
  call: [Getter],
  getKeysPaged: [Getter],
  getMetadata: [Getter],
  getRuntimeVersion: [Getter],
  getStorage: [Getter],
  queryStorageAt: [Getter],
  subscribeRuntimeVersion: [Getter],
  subscribeStorage: [Getter]
}

Missing Methods

The following RPC methods are missing in Chopsticks:

  • getChildReadProof
  • getKeys
  • getPairs
  • getReadProof ⚠️ Required for my use case
  • getStorageHash
  • getStorageSize
  • queryStorage
  • traceBlock
  • trieMigrationStatus

nhussein11 avatar Aug 01 '25 16:08 nhussein11

Can you give bit more context on how you using this rpc? Because Chopsticks can arbitrarily modify storages so it is not always passible to generate a valid read proof. However, we can easily return some mock value or with more work, generate proof that works for most of the cases.

xlc avatar Aug 03 '25 21:08 xlc

@xlc, thanks! Here's the context -> https://blog.kchr.de/polkadot/guides/remote-proxies-for-the-braves/#sending-a-remote-proxy-transaction-via-polkadot-js

I'm trying to replicate that script, but in a fork of Kusama Relay Chain and Kusama Asset Hub for testing with my own accounts.

nhussein11 avatar Aug 03 '25 21:08 nhussein11

ok that requires real proof and that will take some time to implement

xlc avatar Aug 03 '25 22:08 xlc