3

Following along the Substrate's Forkless Upgrades guide. I can upgrade the runtime but I can't figure it out how to upgrade my pallet's RPC.

I have commented the below code for testing purposes and forgot to uncomment during build. Thought, this would be a good practice if I could make a forkless upgrade but I'm stuck. :(

node/src/rpc.rs:

/** snip */
// io.extend_with(TemplateStorageApi::to_delegate(TemplateStorage::new(client.clone())));

1 Answer 1

8

The environment has 2 parts: the on-chain runtime (WASM) and then the node that executes the actual runtime.

Effectively the runtime deals with everything that happens on-chain. The node deals with everything that interfaces with the physical world, e.g. Database access (the runtime has host calls to communicate with the DB), WS/HTTP interfaces, etc.

Therefore the node/binary provides the RPC interfaces itself and if there are changes on this layer, the binary itself needs an update. Some RPCs will indeed call into the runtime, others may not (for instance if you get network stats, this is only extracted from the P2P interfaces).

The short version: if you add a new pallet or extrinsic, upgrade the runtime. If you add a new RPC, upgrade the node binary.

2
  • Do I have to edit any versions in the runtime? Which file should I upload? When I build for release, I only get wasm file for the runtime, and the node's binary is too big to upload.
    – Burak
    Apr 6, 2022 at 18:23
  • 2
    The binary is not what gets uploaded on-chain. To replace to binary - copy it to a node and restart the node. The same happens on e.g. the Polkadot new version releases - it indicates to the validators if a binary upgrade is needed, this is independent of the on-chain forkless runtime upgrade.
    – Xiu Hung
    Apr 7, 2022 at 10:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.