Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
polkadot-sdk
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
parity
Mirrored projects
polkadot-sdk
Commits
23432bb0
Commit
23432bb0
authored
5 years ago
by
Bastian Köcher
Committed by
asynchronous rob
5 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Pass `relay_parent` hash to `produce_candidate` (#300)
* Pass `relay_parent` hash to `produce_candidate` * Fixes compilation
parent
67ee2121
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
polkadot/collator/src/lib.rs
+8
-1
8 additions, 1 deletion
polkadot/collator/src/lib.rs
polkadot/test-parachains/adder/collator/src/main.rs
+2
-1
2 additions, 1 deletion
polkadot/test-parachains/adder/collator/src/main.rs
with
10 additions
and
2 deletions
polkadot/collator/src/lib.rs
+
8
−
1
View file @
23432bb0
...
...
@@ -100,9 +100,11 @@ impl<R: fmt::Display> fmt::Display for Error<R> {
pub
trait
ParachainContext
:
Clone
{
type
ProduceCandidate
:
IntoFuture
<
Item
=
(
BlockData
,
HeadData
,
Extrinsic
),
Error
=
InvalidHead
>
;
/// Produce a candidate, given the latest ingress queue information and the last parachain head.
/// Produce a candidate, given the relay parent hash, the latest ingress queue information
/// and the last parachain head.
fn
produce_candidate
<
I
:
IntoIterator
<
Item
=
(
ParaId
,
Message
)
>>
(
&
self
,
relay_parent
:
Hash
,
last_head
:
HeadData
,
ingress
:
I
,
)
->
Self
::
ProduceCandidate
;
...
...
@@ -124,6 +126,7 @@ pub trait RelayChainContext {
/// Produce a candidate for the parachain, with given contexts, parent head, and signing key.
pub
fn
collate
<
'a
,
R
,
P
>
(
relay_parent
:
Hash
,
local_id
:
ParaId
,
last_head
:
HeadData
,
relay_context
:
R
,
...
...
@@ -142,6 +145,7 @@ pub fn collate<'a, R, P>(
ingress
.and_then
(
move
|
ingress
|
{
para_context
.produce_candidate
(
relay_parent
,
last_head
,
ingress
.0
.iter
()
.flat_map
(|
&
(
id
,
ref
msgs
)|
msgs
.iter
()
.cloned
()
.map
(
move
|
msg
|
(
id
,
msg
)))
)
...
...
@@ -327,6 +331,7 @@ impl<P, E> Worker for CollationNode<P, E> where
};
let
collation_work
=
collate
(
relay_parent
,
para_id
,
HeadData
(
last_head
),
context
,
...
...
@@ -427,6 +432,7 @@ mod tests {
fn
produce_candidate
<
I
:
IntoIterator
<
Item
=
(
ParaId
,
Message
)
>>
(
&
self
,
_relay_parent
:
Hash
,
_last_head
:
HeadData
,
ingress
:
I
,
)
->
Result
<
(
BlockData
,
HeadData
,
Extrinsic
),
InvalidHead
>
{
...
...
@@ -476,6 +482,7 @@ mod tests {
]));
let
collation
=
collate
(
Default
::
default
(),
id
,
HeadData
(
vec!
[
5
]),
context
.clone
(),
...
...
This diff is collapsed.
Click to expand it.
polkadot/test-parachains/adder/collator/src/main.rs
+
2
−
1
View file @
23432bb0
...
...
@@ -23,7 +23,7 @@ use std::sync::Arc;
use
adder
::{
HeadData
as
AdderHead
,
BlockData
as
AdderBody
};
use
substrate_primitives
::
Pair
;
use
parachain
::
codec
::{
Encode
,
Decode
};
use
primitives
::
parachain
::{
HeadData
,
BlockData
,
Id
as
ParaId
,
Message
,
Extrinsic
};
use
primitives
::
{
Hash
,
parachain
::{
HeadData
,
BlockData
,
Id
as
ParaId
,
Message
,
Extrinsic
}
}
;
use
collator
::{
InvalidHead
,
ParachainContext
,
VersionInfo
};
use
parking_lot
::
Mutex
;
...
...
@@ -49,6 +49,7 @@ impl ParachainContext for AdderContext {
fn
produce_candidate
<
I
:
IntoIterator
<
Item
=
(
ParaId
,
Message
)
>>
(
&
self
,
_relay_parent
:
Hash
,
last_head
:
HeadData
,
ingress
:
I
,
)
->
Result
<
(
BlockData
,
HeadData
,
Extrinsic
),
InvalidHead
>
...
...
This diff is collapsed.
Click to expand it.
Preview
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!
Save comment
Cancel
Please
register
or
sign in
to comment