Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Martin Pugh
polkadot
Commits
1c9cf042
Unverified
Commit
1c9cf042
authored
Nov 30, 2019
by
Ashley
Browse files
Final changes to validation
parent
322cca52
Changes
2
Hide whitespace changes
Inline
Side-by-side
validation/src/lib.rs
View file @
1c9cf042
...
@@ -59,8 +59,8 @@ use txpool_api::{TransactionPool, InPoolTransaction};
...
@@ -59,8 +59,8 @@ use txpool_api::{TransactionPool, InPoolTransaction};
use
attestation_service
::
ServiceHandle
;
use
attestation_service
::
ServiceHandle
;
use
futures
::{
use
futures
::{
future
::{
self
,
Either
,
select
},
FutureExt
,
StreamExt
,
Stream
,
future
::{
self
,
Either
,
select
},
FutureExt
,
StreamExt
,
Stream
,
TryFutureExt
,
stream
::
unfold
,
stream
::
unfold
,
task
::{
Spawn
,
SpawnExt
},
task
::{
Spawn
,
SpawnExt
},
};
};
use
collation
::
CollationFetch
;
use
collation
::
CollationFetch
;
use
dynamic_inclusion
::
DynamicInclusion
;
use
dynamic_inclusion
::
DynamicInclusion
;
...
@@ -122,13 +122,16 @@ pub trait TableRouter: Clone {
...
@@ -122,13 +122,16 @@ pub trait TableRouter: Clone {
/// A long-lived network which can create parachain statement and BFT message routing processes on demand.
/// A long-lived network which can create parachain statement and BFT message routing processes on demand.
pub
trait
Network
{
pub
trait
Network
{
/// The error type of asynchronously building the table router.
type
Error
:
std
::
fmt
::
Debug
;
/// The table router type. This should handle importing of any statements,
/// The table router type. This should handle importing of any statements,
/// routing statements to peers, and driving completion of any `StatementProducers`.
/// routing statements to peers, and driving completion of any `StatementProducers`.
type
TableRouter
:
TableRouter
;
type
TableRouter
:
TableRouter
;
/// The future used for asynchronously building the table router.
/// The future used for asynchronously building the table router.
/// This should not fail.
/// This should not fail.
type
BuildTableRouter
:
futures
::
Future
<
Output
=
Self
::
TableRouter
>
;
type
BuildTableRouter
:
futures
::
Future
<
Output
=
Result
<
Self
::
TableRouter
,
Self
::
Error
>
>
;
/// Instantiate a table router using the given shared table.
/// Instantiate a table router using the given shared table.
/// Also pass through any outgoing messages to be broadcast to peers.
/// Also pass through any outgoing messages to be broadcast to peers.
...
@@ -406,7 +409,7 @@ impl<C, N, P> ParachainValidation<C, N, P> where
...
@@ -406,7 +409,7 @@ impl<C, N, P> ParachainValidation<C, N, P> where
})
})
};
};
let
router
=
build_router
.map
(
with_router
);
let
router
=
build_router
.map
_ok
(
with_router
);
let
cancellable_work
=
select
(
exit
,
router
)
.map
(|
_
|
());
let
cancellable_work
=
select
(
exit
,
router
)
.map
(|
_
|
());
...
...
validation/src/shared_table/mod.rs
View file @
1c9cf042
...
@@ -267,13 +267,13 @@ pub struct ParachainWork<Fetch> {
...
@@ -267,13 +267,13 @@ pub struct ParachainWork<Fetch> {
max_block_data_size
:
Option
<
u64
>
,
max_block_data_size
:
Option
<
u64
>
,
}
}
impl
<
Fetch
:
futures
::
Future
>
ParachainWork
<
Fetch
>
{
impl
<
Fetch
:
futures
::
Future
+
Unpin
>
ParachainWork
<
Fetch
>
{
/// Prime the parachain work with an API reference for extracting
/// Prime the parachain work with an API reference for extracting
/// chain information.
/// chain information.
pub
fn
prime
<
P
:
ProvideRuntimeApi
>
(
self
,
api
:
Arc
<
P
>
)
pub
fn
prime
<
P
:
ProvideRuntimeApi
>
(
self
,
api
:
Arc
<
P
>
)
->
PrimedParachainWork
<
->
PrimedParachainWork
<
Fetch
,
Fetch
,
impl
Send
+
FnMut
(
&
BlockId
,
&
Collation
)
->
Result
<
OutgoingMessages
,
()
>
,
impl
Send
+
FnMut
(
&
BlockId
,
&
Collation
)
->
Result
<
OutgoingMessages
,
()
>
+
Unpin
,
>
>
where
where
P
:
Send
+
Sync
+
'static
,
P
:
Send
+
Sync
+
'static
,
...
...
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