mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-27 19:47:59 +00:00
Allow to expose a subset of unsafe RPCs (#5233)
* sc-cli: Use type-safe constructors for RPC/Prometheus interfaces * service: Simplify rpc handler creation Could probably be further simplifies once [this][commit] lands. [commit]: https://github.com/paritytech/jsonrpc/commit/20485387ed06a48f1a70bf4d609a7cde6cf0accf * service: Streamline some HTTP & WS server start logic * client: Introduce a simple RPC policy mechanism * rpc/system: Check unsafe RPCs * rpc/offchain: Check unsafe RPCs * rpc/author: Check unsafe RPCs
This commit is contained in:
@@ -57,6 +57,8 @@ pub enum Error {
|
||||
/// Invalid session keys encoding.
|
||||
#[display(fmt="Session keys are not encoded correctly")]
|
||||
InvalidSessionKeys,
|
||||
/// Call to an unsafe RPC was denied.
|
||||
UnsafeRpcCalled(crate::policy::UnsafeRpcError),
|
||||
}
|
||||
|
||||
impl std::error::Error for Error {
|
||||
@@ -65,6 +67,7 @@ impl std::error::Error for Error {
|
||||
Error::Client(ref err) => Some(&**err),
|
||||
Error::Pool(ref err) => Some(err),
|
||||
Error::Verification(ref err) => Some(&**err),
|
||||
Error::UnsafeRpcCalled(ref err) => Some(err),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
@@ -152,6 +155,7 @@ impl From<Error> for rpc::Error {
|
||||
request to insert the key successfully.".into()
|
||||
),
|
||||
},
|
||||
Error::UnsafeRpcCalled(e) => e.into(),
|
||||
e => errors::internal(e),
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user