Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
parity
Mirrored projects
polkadot
Commits
1ecf385a
Commit
1ecf385a
authored
Aug 12, 2020
by
Cecile Tonglet
Browse files
WIP
Forked at:
e9164236
Parent branch: origin/rococo-branch
parent
e056a020
Changes
2
Hide whitespace changes
Inline
Side-by-side
collator/src/lib.rs
View file @
1ecf385a
...
...
@@ -121,7 +121,7 @@ pub trait BuildParachainContext {
/// Build the `ParachainContext`.
fn
build
<
SP
,
Client
,
Block
,
Backend
>
(
self
,
client
:
Client
,
client
:
Arc
<
Client
>
,
spawner
:
SP
,
network
:
impl
Network
+
SyncOracle
+
Clone
+
'static
,
)
->
Result
<
Self
::
ParachainContext
,
()
>
...
...
@@ -225,7 +225,6 @@ struct BuildCollationWork<P> {
key
:
Arc
<
CollatorPair
>
,
build_parachain_context
:
P
,
spawner
:
SpawnTaskHandle
,
client
:
polkadot_service
::
Client
,
}
impl
<
P
>
polkadot_service
::
ExecuteWithClient
for
BuildCollationWork
<
P
>
...
...
@@ -242,15 +241,6 @@ impl<P> polkadot_service::ExecuteWithClient for BuildCollationWork<P>
Backend
::
State
:
sp_api
::
StateBackend
<
BlakeTwo256
>
,
Api
:
RuntimeApiCollection
<
StateBackend
=
Backend
::
State
>
,
Client
:
AbstractClient
<
Block
,
Backend
,
Api
=
Api
>
+
'static
,
/*
Client: BlockchainEvents<Block> + sp_api::ProvideRuntimeApi<Block> + HeaderBackend<Block>
+ Sized + Send + Sync
+ sp_api::CallApiAt<
Block,
Error = sp_blockchain::Error,
StateBackend = Backend::State
>,
*/
{
let
polkadot_network
=
self
.handles
.polkadot_network
...
...
@@ -263,7 +253,7 @@ impl<P> polkadot_service::ExecuteWithClient for BuildCollationWork<P>
.ok_or_else
(||
"Collator cannot run when validation networking has not been started"
)
?
;
let
parachain_context
=
match
self
.build_parachain_context
.build
(
self
.
client
,
client
.clone
()
,
self
.spawner
.clone
(),
polkadot_network
.clone
(),
)
{
...
...
@@ -383,7 +373,6 @@ pub fn build_collator_service<P>(
key
,
build_parachain_context
,
spawner
,
client
:
client
.clone
(),
})
}
...
...
service/src/client.rs
View file @
1ecf385a
...
...
@@ -120,6 +120,11 @@ pub trait ExecuteWithClient {
Client
:
AbstractClient
<
Block
,
Backend
,
Api
=
Api
>
+
'static
;
}
/// Yet Another ExecuteWithClient
pub
trait
YaExecuteWithClient
{
fn
execute_with
<
T
:
ExecuteWithClient
>
(
&
self
,
t
:
T
)
->
T
::
Output
;
}
/// A client instance of Polkadot.
///
/// See [`ExecuteWithClient`] for more information.
...
...
@@ -129,12 +134,11 @@ pub enum Client {
Westend
(
Arc
<
crate
::
FullClient
<
westend_runtime
::
RuntimeApi
,
crate
::
WestendExecutor
>>
),
Kusama
(
Arc
<
crate
::
FullClient
<
kusama_runtime
::
RuntimeApi
,
crate
::
KusamaExecutor
>>
),
Rococo
(
Arc
<
crate
::
FullClient
<
rococo_runtime
::
RuntimeApi
,
crate
::
RococoExecutor
>>
),
//Test(Arc<crate::FullClient<polkadot_test_runtime::RuntimeApi, polkadot_test_service::RococoExecutor>>),
}
impl
Client
{
impl
YaExecuteWithClient
for
Client
{
/// Execute the given something with the client.
pub
fn
execute_with
<
T
:
ExecuteWithClient
>
(
&
self
,
t
:
T
)
->
T
::
Output
{
fn
execute_with
<
T
:
ExecuteWithClient
>
(
&
self
,
t
:
T
)
->
T
::
Output
{
match
self
{
Self
::
Polkadot
(
client
)
=>
{
T
::
execute_with_client
::
<
_
,
_
,
crate
::
FullBackend
>
(
t
,
client
.clone
())
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment