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
f1321134
Commit
f1321134
authored
2 years ago
by
Serban Iorga
Committed by
Bastian Köcher
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
Small cosmetic changes
Signed-off-by:
Serban Iorga
<
serban@parity.io
>
parent
c131a5e3
Branches
Branches containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
bridges/bin/millau/runtime/src/lib.rs
+1
-2
1 addition, 2 deletions
bridges/bin/millau/runtime/src/lib.rs
bridges/relays/lib-substrate-relay/src/on_demand/parachains.rs
+20
-32
20 additions, 32 deletions
...es/relays/lib-substrate-relay/src/on_demand/parachains.rs
with
21 additions
and
34 deletions
bridges/bin/millau/runtime/src/lib.rs
+
1
−
2
View file @
f1321134
...
...
@@ -847,11 +847,10 @@ impl_runtime_apis! {
fn
best_finalized
()
->
Option
<
(
bp_rialto
::
BlockNumber
,
bp_rialto
::
Hash
)
>
{
// the parachains finality pallet is never decoding parachain heads, so it is
// only done in the integration code
use
bp_rialto_parachain
::
RIALTO_PARACHAIN_ID
;
let
encoded_head
=
pallet_bridge_parachains
::
Pallet
::
<
Runtime
,
WithRialtoParachainsInstance
,
>
::
best_parachain_head
(
RIALTO_PARACHAIN_ID
.into
())
?
;
>
::
best_parachain_head
(
bp_rialto_parachain
::
RIALTO_PARACHAIN_ID
.into
())
?
;
let
head
=
bp_rialto_parachain
::
Header
::
decode
(
&
mut
&
encoded_head
.0
[
..
])
.ok
()
?
;
Some
((
*
head
.number
(),
head
.hash
()))
}
...
...
This diff is collapsed.
Click to expand it.
bridges/relays/lib-substrate-relay/src/on_demand/parachains.rs
+
20
−
32
View file @
f1321134
...
...
@@ -433,42 +433,30 @@ where
ParaNumber
:
Copy
+
PartialOrd
+
Zero
,
RelayNumber
:
Copy
+
Debug
+
Ord
,
{
// this switch is responsible for processing `RelayingRelayHeader` state
match
state
{
RelayState
::
Idle
|
RelayState
::
RelayingParaHeader
(
_
)
=>
(),
RelayState
::
RelayingRelayHeader
(
relay_header_number
)
=>
{
if
data
.relay_header_at_target
<
relay_header_number
{
// required relay header hasn't yet been relayed
return
RelayState
::
RelayingRelayHeader
(
relay_header_number
)
}
// we may switch to `RelayingParaHeader` if parachain head is available
if
let
Some
(
para_header_at_relay_header_at_target
)
=
data
.para_header_at_relay_header_at_target
.clone
()
{
state
=
RelayState
::
RelayingParaHeader
(
para_header_at_relay_header_at_target
);
}
else
{
// otherwise, we'd need to restart (this may happen only if parachain has been
// deregistered)
state
=
RelayState
::
Idle
;
}
},
// Process the `RelayingRelayHeader` state.
if
let
&
RelayState
::
RelayingRelayHeader
(
relay_header_number
)
=
&
state
{
if
data
.relay_header_at_target
<
relay_header_number
{
// The required relay header hasn't yet been relayed. Ask / wait for it.
return
state
}
// We may switch to `RelayingParaHeader` if parachain head is available.
state
=
data
.para_header_at_relay_header_at_target
.clone
()
.map_or
(
RelayState
::
Idle
,
RelayState
::
RelayingParaHeader
);
}
// this switch is responsible for processing `RelayingParaHeader` state
let
para_header_at_target_or_zero
=
data
.para_header_at_target
.unwrap_or_else
(
Zero
::
zero
);
match
state
{
RelayState
::
Idle
=>
(),
RelayState
::
RelayingRelayHeader
(
_
)
=>
unreachable!
(
"processed by previous match; qed"
),
RelayState
::
RelayingParaHeader
(
para_header_id
)
=>
{
if
para_header_at_target_or_zero
<
para_header_id
.0
{
// parachain header hasn't yet been relayed
return
RelayState
::
RelayingParaHeader
(
para_header_id
)
}
},
// Process the `RelayingParaHeader` state.
if
let
RelayState
::
RelayingParaHeader
(
para_header_id
)
=
&
state
{
let
para_header_at_target_or_zero
=
data
.para_header_at_target
.unwrap_or_else
(
Zero
::
zero
);
if
para_header_at_target_or_zero
<
para_header_id
.0
{
// The required parachain header hasn't yet been relayed. Ask / wait for it.
return
state
}
}
// if we haven't read para head from the source, we can't yet do any
h
ting
// if we haven't read para head from the source, we can't yet do anyt
h
ing
let
para_header_at_source
=
match
data
.para_header_at_source
{
Some
(
ref
para_header_at_source
)
=>
para_header_at_source
.clone
(),
None
=>
return
RelayState
::
Idle
,
...
...
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