Introduce capabilities filtering for off-chain runtime calls. (#3454)

* Introduce capabilities filtering for calls.

* Bump impl version.

* Allow RichOffchainCall to only read offchain db.

* Fix code.

* Panic on invalid calls.

* Merge execution contexts and expose capabilities.

* Fix repr

* Re-enable keystore for offchain calls.
This commit is contained in:
Tomasz Drwięga
2019-08-27 10:07:30 +02:00
committed by Bastian Köcher
parent d81df14391
commit 0128d0db84
8 changed files with 224 additions and 22 deletions
@@ -552,9 +552,9 @@ impl<'a> ToClientSideDecl<'a> {
fn fold_trait_item_method(&mut self, method: TraitItemMethod)
-> (TraitItemMethod, Option<TraitItemMethod>, TraitItemMethod) {
let crate_ = self.crate_;
let context_other = quote!( #crate_::runtime_api::ExecutionContext::Other );
let context = quote!( #crate_::runtime_api::ExecutionContext::OffchainCall(None) );
let fn_impl = self.create_method_runtime_api_impl(method.clone());
let fn_decl = self.create_method_decl(method.clone(), context_other);
let fn_decl = self.create_method_decl(method.clone(), context);
let fn_decl_ctx = self.create_method_decl_with_context(method);
(fn_decl, fn_impl, fn_decl_ctx)