Implement support for renaming runtime api functions (#2160)

* Implement support for renaming runtime api functions

* Redelete the wasm files

* FIxes test

* Fix test correctly...

* Bring back old `authorities`

* Tag as deprecated

* Fixes compilation on WASM

* Add missing method implementations

* Fixes tests

* Increase `spec_version`
This commit is contained in:
Bastian Köcher
2019-04-02 10:05:35 +02:00
committed by Gav Wood
parent e89ce263bd
commit 345145326b
13 changed files with 288 additions and 81 deletions
+15 -6
View File
@@ -267,7 +267,7 @@ impl ProvideRuntimeApi for TestApi {
}
impl Core<Block> for RuntimeApi {
fn version_runtime_api_impl(
fn Core_version_runtime_api_impl(
&self,
_: &BlockId<Block>,
_: ExecutionContext,
@@ -277,7 +277,7 @@ impl Core<Block> for RuntimeApi {
unimplemented!("Not required for testing!")
}
fn execute_block_runtime_api_impl(
fn Core_execute_block_runtime_api_impl(
&self,
_: &BlockId<Block>,
_: ExecutionContext,
@@ -287,7 +287,7 @@ impl Core<Block> for RuntimeApi {
unimplemented!("Not required for testing!")
}
fn initialize_block_runtime_api_impl(
fn Core_initialize_block_runtime_api_impl(
&self,
_: &BlockId<Block>,
_: ExecutionContext,
@@ -296,6 +296,15 @@ impl Core<Block> for RuntimeApi {
) -> Result<NativeOrEncoded<()>> {
unimplemented!("Not required for testing!")
}
fn Core_authorities_runtime_api_impl(
&self,
_: &BlockId<Block>,
_: ExecutionContext,
_: Option<()>,
_: Vec<u8>,
) -> Result<NativeOrEncoded<Vec<AuthorityId>>> {
unimplemented!("Not required for testing!")
}
}
impl ApiExt<Block> for RuntimeApi {
@@ -312,7 +321,7 @@ impl ApiExt<Block> for RuntimeApi {
}
impl GrandpaApi<Block> for RuntimeApi {
fn grandpa_authorities_runtime_api_impl(
fn GrandpaApi_grandpa_authorities_runtime_api_impl(
&self,
at: &BlockId<Block>,
_: ExecutionContext,
@@ -326,7 +335,7 @@ impl GrandpaApi<Block> for RuntimeApi {
}
}
fn grandpa_pending_change_runtime_api_impl(
fn GrandpaApi_grandpa_pending_change_runtime_api_impl(
&self,
at: &BlockId<Block>,
_: ExecutionContext,
@@ -343,7 +352,7 @@ impl GrandpaApi<Block> for RuntimeApi {
Ok(self.inner.scheduled_changes.lock().get(&parent_hash).map(|c| c.clone())).map(NativeOrEncoded::Native)
}
fn grandpa_forced_change_runtime_api_impl(
fn GrandpaApi_grandpa_forced_change_runtime_api_impl(
&self,
at: &BlockId<Block>,
_: ExecutionContext,