-
Notifications
You must be signed in to change notification settings - Fork 689
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix or remove storage_keys
and storage_pairs
RPC APIs
#22
Comments
If we can support this, it sounds like a good solution. |
From a technical PoV I think we can; I have a semi-working private prototype There are just some tricky issues regarding how |
I was more "afraid" of the JSONRPC spec (not sure something like this exists) doesn't support streaming. |
Well, let's say the endpoint returns a JSON array: [1,2,3,4,5] So you can either send it like this: socket.send("[1,2,3,4,5]"); or you could send it like this: socket.send("[");
socket.send("1");
socket.send(",2");
socket.send(",3");
socket.send(",4");
socket.send(",5");
socket.send("]"); The first one just sends it all in one go, and the second one streams it. Protocol-wise it's all the same as the streaming/chunking part can just be done on the socket layer (which already must be handled by the clients, since you can't have TCP packets of unlimited size). That's also why this streaming approach is backwards compatible, because neither the server nor the client needs to care whether the other side writes/reads the payload in one go or in a streaming manner. It's just an implementation detail that can be independently added to the server, to the client, or to both. |
Ahh yeah, on TCP level this makes sense :D |
Many if not most of the JSON-RPC functions are broken in various ways. This is not news. I would strongly suggest to focus on https://github.com/paritytech/json-rpc-interface-spec/ instead of fixing legacy broken things. |
To give more detail: We had a long discussion in an Element channel a while ago. Basically, if you fix these functions in the source code, you're breaking the entire world. A better approach that we ended up going for is to design a new API with new function names, then ask people to switch, then deprecate the old ones. |
* Copy node-template over from Substrate repo Got the template at rev=6e6d06c33911 * Use dependencies from crates.io + stop renaming on import * Remove template pallet * Stop using crates.io dependencies Instead they're going to be pinned at v2.0.0-alpha.2 at commit `2afecf81ee19b8a6edb364b419190ea47c4a4a31` until something stable comes along. * Remove LICENSE * Change references of `node-template` to `bridge-node` * Remove README * Fix some missed node-template references * Add WASM toolchain to CI * Be more specific about nightly version to use * Maybe don't tie to a specific nightly * Use composite accounts * Update to use lazy reaping * Only use Development chain config
… import message (#4021) Sometimes you need to debug some issues just by the logs and reconstruct what happened. In these scenarios it would be nice to know if a block was imported as best block, and what it parent was. So here I propose to change the output of the informant to this: ``` 2024-04-05 20:38:22.004 INFO ⋮substrate: [Parachain] ✨ Imported #18 (0xe7b3…4555 -> 0xbd6f…ced7) 2024-04-05 20:38:24.005 INFO ⋮substrate: [Parachain] ✨ Imported #19 (0xbd6f…ced7 -> 0x4dd0…d81f) 2024-04-05 20:38:24.011 INFO ⋮substrate: [jobless-children-5352] 🌟 Imported #42 (0xed2e…27fc -> 0x718f…f30e) 2024-04-05 20:38:26.005 INFO ⋮substrate: [Parachain] ✨ Imported #20 (0x4dd0…d81f -> 0x6e85…e2b8) 2024-04-05 20:38:28.004 INFO ⋮substrate: [Parachain] 🌟 Imported #21 (0x6e85…e2b8 -> 0xad53…2a97) 2024-04-05 20:38:30.004 INFO ⋮substrate: [Parachain] 🌟 Imported #22 (0xad53…2a97 -> 0xa874…890f) ``` --------- Co-authored-by: Bastian Köcher <git@kchr.de>
* Copy node-template over from Substrate repo Got the template at rev=6e6d06c33911 * Use dependencies from crates.io + stop renaming on import * Remove template pallet * Stop using crates.io dependencies Instead they're going to be pinned at v2.0.0-alpha.2 at commit `2afecf81ee19b8a6edb364b419190ea47c4a4a31` until something stable comes along. * Remove LICENSE * Change references of `node-template` to `bridge-node` * Remove README * Fix some missed node-template references * Add WASM toolchain to CI * Be more specific about nightly version to use * Maybe don't tie to a specific nightly * Use composite accounts * Update to use lazy reaping * Only use Development chain config
… import message (#4021) Sometimes you need to debug some issues just by the logs and reconstruct what happened. In these scenarios it would be nice to know if a block was imported as best block, and what it parent was. So here I propose to change the output of the informant to this: ``` 2024-04-05 20:38:22.004 INFO ⋮substrate: [Parachain] ✨ Imported #18 (0xe7b3…4555 -> 0xbd6f…ced7) 2024-04-05 20:38:24.005 INFO ⋮substrate: [Parachain] ✨ Imported #19 (0xbd6f…ced7 -> 0x4dd0…d81f) 2024-04-05 20:38:24.011 INFO ⋮substrate: [jobless-children-5352] 🌟 Imported #42 (0xed2e…27fc -> 0x718f…f30e) 2024-04-05 20:38:26.005 INFO ⋮substrate: [Parachain] ✨ Imported #20 (0x4dd0…d81f -> 0x6e85…e2b8) 2024-04-05 20:38:28.004 INFO ⋮substrate: [Parachain] 🌟 Imported #21 (0x6e85…e2b8 -> 0xad53…2a97) 2024-04-05 20:38:30.004 INFO ⋮substrate: [Parachain] 🌟 Imported #22 (0xad53…2a97 -> 0xa874…890f) ``` --------- Co-authored-by: Bastian Köcher <git@kchr.de>
* Copy node-template over from Substrate repo Got the template at rev=6e6d06c33911 * Use dependencies from crates.io + stop renaming on import * Remove template pallet * Stop using crates.io dependencies Instead they're going to be pinned at v2.0.0-alpha.2 at commit `2afecf81ee19b8a6edb364b419190ea47c4a4a31` until something stable comes along. * Remove LICENSE * Change references of `node-template` to `bridge-node` * Remove README * Fix some missed node-template references * Add WASM toolchain to CI * Be more specific about nightly version to use * Maybe don't tie to a specific nightly * Use composite accounts * Update to use lazy reaping * Only use Development chain config
… import message (paritytech#4021) Sometimes you need to debug some issues just by the logs and reconstruct what happened. In these scenarios it would be nice to know if a block was imported as best block, and what it parent was. So here I propose to change the output of the informant to this: ``` 2024-04-05 20:38:22.004 INFO ⋮substrate: [Parachain] ✨ Imported paritytech#18 (0xe7b3…4555 -> 0xbd6f…ced7) 2024-04-05 20:38:24.005 INFO ⋮substrate: [Parachain] ✨ Imported paritytech#19 (0xbd6f…ced7 -> 0x4dd0…d81f) 2024-04-05 20:38:24.011 INFO ⋮substrate: [jobless-children-5352] 🌟 Imported paritytech#42 (0xed2e…27fc -> 0x718f…f30e) 2024-04-05 20:38:26.005 INFO ⋮substrate: [Parachain] ✨ Imported paritytech#20 (0x4dd0…d81f -> 0x6e85…e2b8) 2024-04-05 20:38:28.004 INFO ⋮substrate: [Parachain] 🌟 Imported paritytech#21 (0x6e85…e2b8 -> 0xad53…2a97) 2024-04-05 20:38:30.004 INFO ⋮substrate: [Parachain] 🌟 Imported paritytech#22 (0xad53…2a97 -> 0xa874…890f) ``` --------- Co-authored-by: Bastian Köcher <git@kchr.de>
* Copy node-template over from Substrate repo Got the template at rev=6e6d06c33911 * Use dependencies from crates.io + stop renaming on import * Remove template pallet * Stop using crates.io dependencies Instead they're going to be pinned at v2.0.0-alpha.2 at commit `2afecf81ee19b8a6edb364b419190ea47c4a4a31` until something stable comes along. * Remove LICENSE * Change references of `node-template` to `bridge-node` * Remove README * Fix some missed node-template references * Add WASM toolchain to CI * Be more specific about nightly version to use * Maybe don't tie to a specific nightly * Use composite accounts * Update to use lazy reaping * Only use Development chain config
* Copy node-template over from Substrate repo Got the template at rev=6e6d06c33911 * Use dependencies from crates.io + stop renaming on import * Remove template pallet * Stop using crates.io dependencies Instead they're going to be pinned at v2.0.0-alpha.2 at commit `2afecf81ee19b8a6edb364b419190ea47c4a4a31` until something stable comes along. * Remove LICENSE * Change references of `node-template` to `bridge-node` * Remove README * Fix some missed node-template references * Add WASM toolchain to CI * Be more specific about nightly version to use * Maybe don't tie to a specific nightly * Use composite accounts * Update to use lazy reaping * Only use Development chain config
* Copy node-template over from Substrate repo Got the template at rev=6e6d06c33911 * Use dependencies from crates.io + stop renaming on import * Remove template pallet * Stop using crates.io dependencies Instead they're going to be pinned at v2.0.0-alpha.2 at commit `2afecf81ee19b8a6edb364b419190ea47c4a4a31` until something stable comes along. * Remove LICENSE * Change references of `node-template` to `bridge-node` * Remove README * Fix some missed node-template references * Add WASM toolchain to CI * Be more specific about nightly version to use * Maybe don't tie to a specific nightly * Use composite accounts * Update to use lazy reaping * Only use Development chain config
* Copy node-template over from Substrate repo Got the template at rev=6e6d06c33911 * Use dependencies from crates.io + stop renaming on import * Remove template pallet * Stop using crates.io dependencies Instead they're going to be pinned at v2.0.0-alpha.2 at commit `2afecf81ee19b8a6edb364b419190ea47c4a4a31` until something stable comes along. * Remove LICENSE * Change references of `node-template` to `bridge-node` * Remove README * Fix some missed node-template references * Add WASM toolchain to CI * Be more specific about nightly version to use * Maybe don't tie to a specific nightly * Use composite accounts * Update to use lazy reaping * Only use Development chain config
* Copy node-template over from Substrate repo Got the template at rev=6e6d06c33911 * Use dependencies from crates.io + stop renaming on import * Remove template pallet * Stop using crates.io dependencies Instead they're going to be pinned at v2.0.0-alpha.2 at commit `2afecf81ee19b8a6edb364b419190ea47c4a4a31` until something stable comes along. * Remove LICENSE * Change references of `node-template` to `bridge-node` * Remove README * Fix some missed node-template references * Add WASM toolchain to CI * Be more specific about nightly version to use * Maybe don't tie to a specific nightly * Use composite accounts * Update to use lazy reaping * Only use Development chain config
* Copy node-template over from Substrate repo Got the template at rev=6e6d06c33911 * Use dependencies from crates.io + stop renaming on import * Remove template pallet * Stop using crates.io dependencies Instead they're going to be pinned at v2.0.0-alpha.2 at commit `2afecf81ee19b8a6edb364b419190ea47c4a4a31` until something stable comes along. * Remove LICENSE * Change references of `node-template` to `bridge-node` * Remove README * Fix some missed node-template references * Add WASM toolchain to CI * Be more specific about nightly version to use * Maybe don't tie to a specific nightly * Use composite accounts * Update to use lazy reaping * Only use Development chain config
* Copy node-template over from Substrate repo Got the template at rev=6e6d06c33911 * Use dependencies from crates.io + stop renaming on import * Remove template pallet * Stop using crates.io dependencies Instead they're going to be pinned at v2.0.0-alpha.2 at commit `2afecf81ee19b8a6edb364b419190ea47c4a4a31` until something stable comes along. * Remove LICENSE * Change references of `node-template` to `bridge-node` * Remove README * Fix some missed node-template references * Add WASM toolchain to CI * Be more specific about nightly version to use * Maybe don't tie to a specific nightly * Use composite accounts * Update to use lazy reaping * Only use Development chain config
* Copy node-template over from Substrate repo Got the template at rev=6e6d06c33911 * Use dependencies from crates.io + stop renaming on import * Remove template pallet * Stop using crates.io dependencies Instead they're going to be pinned at v2.0.0-alpha.2 at commit `2afecf81ee19b8a6edb364b419190ea47c4a4a31` until something stable comes along. * Remove LICENSE * Change references of `node-template` to `bridge-node` * Remove README * Fix some missed node-template references * Add WASM toolchain to CI * Be more specific about nightly version to use * Maybe don't tie to a specific nightly * Use composite accounts * Update to use lazy reaping * Only use Development chain config
* Move Coin definition into subcoin-runtime-primitives * Update README.md * Fix fetching UTXO from current block * Inline fetch_coin_value_in_current_block() * Nits * Update README.md * Add test * Rename to btc_mainnet_385044.data
The following two RPC endpoints are inherently broken due to the fact that they return
Vec
s:We should either delete them, or fix them.
Option 1: just delete them
This would require adding replacements which are paged and return the data in chunks; this was already done for
storage_keys
:The downside of this approach is that these are harder to use as the client needs to track the pages by themselves, and it's not backwards compatible.
Option 2: fix them
This would require modifying
jsonrpsee
and allow the payloads to be streamed.Right now if an RPC endpoint returns a
Vec
in has to 1) create the wholeVec
, 2) serialize the whole thing into JSON, 3) only then start streaming the JSON. When the number of elements is big this becomes very problematic.What could be done here is to make it possible for the RPC handlers to return an iterator of values which would be dynamically iterated over and serialized into JSON as it is being read by the client.
The downside of this approach is extra complexity, but the upside is that it's fully backwards compatible (the current RPC endpoints and clients which use those endpoints still work) and arguably it can be simpler to use (when the client supports streaming too, or if they don't care if everything has to be preloaded into memory on their side before they can use it).
Option 3: fix them and have
_paged
variantsWe could fix them to keep backwards compatibility and also have the paged variants, and let clients chose whichever they prefer.
cc @niklasad1
The text was updated successfully, but these errors were encountered: