-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Failing to decode the SCALE encoded input in the state_call
RPC causes a runtime panic
#12548
Comments
IMO it looks like ContractsUI hasn't compatible with latest |
I don't think behavior is specific to contracts. It is what happens when the |
I don't think this relates to recent contracts Runtime API change either. |
The title of a issue is a bit of a clickbait, though. Cause the runtime only panics when you have direct access to a node via RPC. And only this one node's runtimes panics. Purely offchain. In this case it might be a bit ugly but not at all dangerous. Still, I think it shouldn't be a panic but an error. |
Do you think it's more clear to rename the title to "Bad Runtime RPC call lead the Runtime panic"? |
state_call
causes a runtime panic
I renamed in a way that I think describes the problem. |
state_call
causes a runtime panicstate_call
RPC causes a runtime panic
Panic is completely fine. This is done this way since always and otherwise we would need to wrap return type of a runtime function into an extra result. If you don't follow the Abi, there is no other way than panicking because the input is invalid. |
Does it means the node need to recreate one when the Runtime panicked? I'm concerning that could be a DoS vector of node (not the network). |
No. You need to reset the memory. However, we reset the memory anyway for every new call into the runtime. So, there is no difference to the normal behavior. |
So the only issue here is this should be a error or just suppress it, or end-user will confuse this |
Who is the end user here? The node operator? |
Yes, the node operator, including me, when I saw "This is a bug. Please report it at:" my instant thinking is collecting info and submit to here, then you explain to me this is not bug, it's design, but the node said it's a bug, so I guess others would submit this too Another old story is #12354 But our users (node operators) don't know that, 3 years I got maybe hundreds report (The DB growth faster than we thought) for that issue because the node says it's a bug, please submit to Phala team. So I'd proposal it is worthy to suppress expected errors, not raise "Please report it" |
Yeah that is because it panicked in the native runtime. A panic in the wasm runtime doesn't print this. For the wasm runtime we have the following feature: https://github.com/paritytech/substrate/blob/master/primitives/io/Cargo.toml#L91 When this feature is enabled, the panics will be returned as an error of the execution and not directly printed to the log. |
Is there an existing issue?
Experiencing problems? Have you tried our Stack Exchange first?
Description of bug
When trying upload an Ink contract via https://contracts-ui.substrate.io/add-contract
The node's runtime will panic.
Steps to reproduce
It can be reproduced since
polkadot-v0.9.31
and later, may relates to this PR #12429cargo contract new flipper
thencargo contract build
forflipper.contract
cargo build --release -p node-cli
thentarget/release/substrate --dev
flipper.contract
The text was updated successfully, but these errors were encountered: