interlay / interbtc

interBTC: Bitcoin Anywhere
https://app.interlay.io/
Apache License 2.0
245 stars 83 forks source link

RPCs not compliant with the JSON-RPC spec #1246

Open josepot opened 1 week ago

josepot commented 1 week ago

Dear Interlay Team,

I hope this message finds you well. My name is Josep, and I'm the technical lead of the Polkadot-API (PAPI) team.

In case you're not familiar with Polkadot-API, it's a modern library designed to replace PolkadotJS, built on top of a properly specified and standardized JSON-RPC API for Polkadot-based networks. The modern JSON-RPC APIs offer many advantages over the legacy ones; you can read more about it here and here.

We've noticed that there are no available public Interlay RPCs that expose the modern JSON-RPC API. Thankfully, it's still possible to use PAPI with Interlay thanks to the light-client provider, using the following chainspec with smoldot:

{
  "name": "Interlay",
  "id": "interlay",
  "chainType": "Live",
  "bootNodes": [
    "/dns/interlay-01.interlay.interlay.io/tcp/30333/p2p/12D3KooWGD9FgkiKWQTp5t6VLJgTKYqex7AY8CHTs7PGpARLTSZr",
    "/dns/interlay-02.interlay.interlay.io/tcp/30333/p2p/12D3KooWJ8Ga38UfUWcBuKCVjJFNCyFAd5YrLnDikTvinE4QG8TG",
    "/dns/interlay-03.interlay.interlay.io/tcp/30333/p2p/12D3KooWRXVqAn6xNkUbs1g2KhugSMCRDRxWVXq7ZRnvqjUQ71cr",
    "/dns/interlay-04.interlay.interlay.io/tcp/30333/p2p/12D3KooWHJW8vqWTbVJsJPYMDypm14Qrwf2rdKrW7t1TuAUbKEZw",
    "/dns/interlay-05.interlay.interlay.io/tcp/30333/p2p/12D3KooWQWUe64Cmqg3ygRNhxtZFaQHtoPBrCsJW6bUucuyiiR78",
    "/dns/interlay-06.interlay.interlay.io/tcp/30333/p2p/12D3KooWEUYPLnp1mVHZmitDLUiu4PHwMD2FxEx5GvEfMN8tiSLq",
    "/dns/interlay-07.interlay.interlay.io/tcp/30333/p2p/12D3KooWQsTnGMPF2uoHvF3p9yTxLsRiWfgVMQZvmq974ebkrqVX"
  ],
  "properties": {
    "ss58Format": 2032,
    "tokenDecimals": [10, 8, 10, 12, 8, 12],
    "tokenSymbol": ["INTR", "IBTC", "DOT", "KINT", "KBTC", "KSM"],
    "bitcoinNetwork": "bitcoin-mainnet"
  },
  "relay_chain": "polkadot",
  "para_id": 2032,
  "codeSubstitutes": {},
  "genesis": {
    "stateRootHash": "0x7b656545a767d7c7b5aeee94307434a45a15713aeb53e05914875ab061fa6600"
  }
}

However, not all consumers can utilize the light-client.

Our team has developed a middleware solution to ensure that Polkadot-API can function seamlessly with chains running older versions of the Polkadot-SDK node. Unfortunately, it appears that the RPC providers for Interlay are using an even older version, which the middleware does not support.

We kindly request that you consider working with your RPC providers to upgrade the PolkadotSDK node to a more modern version that supports the new JSON-RPC API. This upgrade would enable DApp developers to easily interact with your chain using PAPI, unlocking benefits such as improved performance, reduced resource usage, out-of-the-box strong type generation for your chain, and the ability for developers to handle runtime upgrades on the fly.

Thank you for your time and consideration.

Best regards,

Josep

nud3l commented 6 days ago

Thanks for opening the issue! I don't see upgrading these nodes in the foreseeable future. If anyone wants to pick up this issue, though, it'd be highly appreciated!

I'll give a bit of background on why we won't focus on this right now:

I'm not really sure why the middleware created for PAPI does not support the Interlay RPC nodes. Maybe that is a change that can be done on the PAPI side? New js libraries should support the bigger parachains rather than the parachains adapting their code to meet the needs of a js library. In the end, if PAPI support for Interlay breaks, it's not a major issue. It is a major issue if Interlay breaks due to a Polkadot SDK upgrade.

josepot commented 3 days ago

You're completely missing the point.

The modern JSON-RPC APIs aren’t just some "PAPI thing"—they’re the only properly spec'd JSON-RPC APIs we have, designed to replace the outdated legacy ones. PolkadotJS is on its way out, in maintenance mode, and soon enough, it’ll either migrate entirely to the new JSON-RPC API or be sunsetted.

If you care to understand more, you can read up on it here:

It's great to see PAPI's new ownership. It's been in development for quite a while though.

That’s flat-out wrong. You’re clearly confusing PAPI with something else.

I'm not really sure why the middleware created for PAPI does not support the Interlay RPC nodes.

I know exactly why—because you haven’t bothered upgrading the PolkadotSDK node in over a year.

All the Interlay code is built on PolkadotJS. There's no meaningful benefit to Interlay in upgrading to PAPI.

Actually, there would be a benefit for modern DApps that want to interact with your chain. But if keeping your chain up to date isn’t important enough for you, then frankly, there’s no reason to waste time supporting it with the modern dev tools we’re building.