@@ -39,7 +39,7 @@ use codec::Decode;
39
39
use sr_primitives:: traits:: { ApiRef , ProvideRuntimeApi , Header as HeaderT } ;
40
40
use sr_primitives:: generic:: { BlockId , DigestItem } ;
41
41
use primitives:: { NativeOrEncoded , ExecutionContext , crypto:: Public } ;
42
- use fg_primitives:: { GRANDPA_ENGINE_ID , AuthorityList } ;
42
+ use fg_primitives:: { GRANDPA_ENGINE_ID , AuthorityList , GrandpaApi } ;
43
43
use state_machine:: { backend:: InMemory , prove_read, read_proof_check} ;
44
44
45
45
use authorities:: AuthoritySet ;
@@ -199,13 +199,15 @@ impl TestApi {
199
199
}
200
200
}
201
201
202
- pub ( crate ) struct RuntimeApi ;
202
+ pub ( crate ) struct RuntimeApi {
203
+ inner : TestApi ,
204
+ }
203
205
204
206
impl ProvideRuntimeApi for TestApi {
205
207
type Api = RuntimeApi ;
206
208
207
209
fn runtime_api < ' a > ( & ' a self ) -> ApiRef < ' a , Self :: Api > {
208
- RuntimeApi . into ( )
210
+ RuntimeApi { inner : self . clone ( ) } . into ( )
209
211
}
210
212
}
211
213
@@ -262,6 +264,18 @@ impl ApiExt<Block> for RuntimeApi {
262
264
}
263
265
}
264
266
267
+ impl GrandpaApi < Block > for RuntimeApi {
268
+ fn GrandpaApi_grandpa_authorities_runtime_api_impl (
269
+ & self ,
270
+ _: & BlockId < Block > ,
271
+ _: ExecutionContext ,
272
+ _: Option < ( ) > ,
273
+ _: Vec < u8 > ,
274
+ ) -> Result < NativeOrEncoded < AuthorityList > > {
275
+ Ok ( self . inner . genesis_authorities . clone ( ) ) . map ( NativeOrEncoded :: Native )
276
+ }
277
+ }
278
+
265
279
impl GenesisAuthoritySetProvider < Block > for TestApi {
266
280
fn get ( & self ) -> Result < AuthorityList > {
267
281
Ok ( self . genesis_authorities . clone ( ) )
0 commit comments