When running a substrate node, the CLI accepts a parameter called rpc_methods
which accepts Auto
, Safe
and Unsafe
arguments.
How can developers declare an RPC call Unsafe and how can one get the list of RpcMethods::Unsafe
methods?
Declaring a RPC unsafe is completely up to the developer. You need to pass the DenyUnsafe
type to your RPC implementation. (you get the deny unsafe passed to the rpc_extensions_builder
). Then you need to call in your RPC self.deny_unsafe.check_if_safe()?
. That's it.
how can one get the list of RpcMethods::Unsafe methods
That is currently not supported!
author.insert_key
or expensive rpc like state.storage_pairs
should be marked as unsafe. You can just search substrate code base with deny_unsafe.check_if_safe()
to find all unsafe methods as mentioned above