1

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?

1 Answer 1

1

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!

1
  • Usually dangerous rpc like 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
    – Ron
    Apr 22, 2022 at 13:22

Your Answer

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

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