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
bc5d442e
Unverified
Commit
bc5d442e
authored
Oct 07, 2020
by
Bastian Köcher
Committed by
GitHub
Oct 07, 2020
Browse files
Use `Pin<Box<>>` for collation future (#1792)
parent
f0a352a4
Pipeline
#109808
passed with stages
in 15 minutes and 32 seconds
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
node/collation-generation/src/lib.rs
View file @
bc5d442e
...
@@ -407,7 +407,7 @@ mod tests {
...
@@ -407,7 +407,7 @@ mod tests {
Arc
::
new
(
CollationGenerationConfig
{
Arc
::
new
(
CollationGenerationConfig
{
key
:
CollatorPair
::
generate
()
.0
,
key
:
CollatorPair
::
generate
()
.0
,
collator
:
Box
::
new
(|
_
:
Hash
,
_vd
:
&
ValidationData
|
{
collator
:
Box
::
new
(|
_
:
Hash
,
_vd
:
&
ValidationData
|
{
Box
::
new
(
TestCollator
)
TestCollator
.boxed
(
)
}),
}),
para_id
:
para_id
.into
(),
para_id
:
para_id
.into
(),
})
})
...
...
node/overseer/src/lib.rs
View file @
bc5d442e
...
@@ -1876,7 +1876,7 @@ mod tests {
...
@@ -1876,7 +1876,7 @@ mod tests {
fn
test_collator_generation_msg
()
->
CollationGenerationMessage
{
fn
test_collator_generation_msg
()
->
CollationGenerationMessage
{
CollationGenerationMessage
::
Initialize
(
CollationGenerationConfig
{
CollationGenerationMessage
::
Initialize
(
CollationGenerationConfig
{
key
:
CollatorPair
::
generate
()
.0
,
key
:
CollatorPair
::
generate
()
.0
,
collator
:
Box
::
new
(|
_
,
_
|
Box
::
new
(
TestCollator
)),
collator
:
Box
::
new
(|
_
,
_
|
TestCollator
.boxed
(
)),
para_id
:
Default
::
default
(),
para_id
:
Default
::
default
(),
})
})
}
}
...
...
node/primitives/src/lib.rs
View file @
bc5d442e
...
@@ -35,6 +35,7 @@ use polkadot_statement_table::{
...
@@ -35,6 +35,7 @@ use polkadot_statement_table::{
},
},
v1
::
Misbehavior
as
TableMisbehavior
,
v1
::
Misbehavior
as
TableMisbehavior
,
};
};
use
std
::
pin
::
Pin
;
pub
use
sp_core
::
traits
::
SpawnNamed
;
pub
use
sp_core
::
traits
::
SpawnNamed
;
...
@@ -289,7 +290,7 @@ pub struct CollationGenerationConfig {
...
@@ -289,7 +290,7 @@ pub struct CollationGenerationConfig {
/// Will be called with the hash of the relay chain block the parachain
/// Will be called with the hash of the relay chain block the parachain
/// block should be build on and the [`ValidationData`] that provides
/// block should be build on and the [`ValidationData`] that provides
/// information about the state of the parachain on the relay chain.
/// information about the state of the parachain on the relay chain.
pub
collator
:
Box
<
dyn
Fn
(
Hash
,
&
ValidationData
)
->
Box
<
dyn
Future
<
Output
=
Option
<
Collation
>>
+
Unpin
+
Send
>
+
Send
+
Sync
>
,
pub
collator
:
Box
<
dyn
Fn
(
Hash
,
&
ValidationData
)
->
Pin
<
Box
<
dyn
Future
<
Output
=
Option
<
Collation
>>
+
Send
>
>
+
Send
+
Sync
>
,
/// The parachain that this collator collates for
/// The parachain that this collator collates for
pub
para_id
:
ParaId
,
pub
para_id
:
ParaId
,
}
}
...
...
roadmap/implementers-guide/src/node/collators/collation-generation.md
View file @
bc5d442e
...
@@ -39,7 +39,7 @@ struct CollationGenerationConfig {
...
@@ -39,7 +39,7 @@ struct CollationGenerationConfig {
/// Collate will be called with the relay chain hash the parachain should build
/// Collate will be called with the relay chain hash the parachain should build
/// a block on and the `ValidationData` that provides information about the state
/// a block on and the `ValidationData` that provides information about the state
/// of the parachain on the relay chain.
/// of the parachain on the relay chain.
collator
:
Box
<
dyn
Fn
(
Hash
,
&
ValidationData
)
->
Box
<
dyn
Future
<
Output
=
Option
<
Collation
>>>>
collator
:
Box
<
dyn
Fn
(
Hash
,
&
ValidationData
)
->
Pin
<
Box
<
dyn
Future
<
Output
=
Option
<
Collation
>>>>
>
para_id
:
ParaId
,
para_id
:
ParaId
,
}
}
```
```
...
...
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