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
55ca13ab
Commit
55ca13ab
authored
6 years ago
by
asynchronous rob
Browse files
Options
Downloads
Patches
Plain Diff
call into chain WASM to check for changes
parent
442e3001
Branches
Branches containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
substrate/core/finality-grandpa/src/lib.rs
+15
-12
15 additions, 12 deletions
substrate/core/finality-grandpa/src/lib.rs
with
15 additions
and
12 deletions
substrate/core/finality-grandpa/src/lib.rs
+
15
−
12
View file @
55ca13ab
...
@@ -48,7 +48,7 @@ use client::{Client, error::Error as ClientError, ImportNotifications, backend::
...
@@ -48,7 +48,7 @@ use client::{Client, error::Error as ClientError, ImportNotifications, backend::
use
codec
::{
Encode
,
Decode
};
use
codec
::{
Encode
,
Decode
};
use
consensus_common
::{
BlockImport
,
ImportBlock
,
ImportResult
};
use
consensus_common
::{
BlockImport
,
ImportBlock
,
ImportResult
};
use
runtime_primitives
::
traits
::{
use
runtime_primitives
::
traits
::{
NumberFor
,
Block
as
BlockT
,
Header
as
HeaderT
,
Digest
Item
For
,
NumberFor
,
Block
as
BlockT
,
Header
as
HeaderT
,
DigestFor
,
};
};
use
runtime_primitives
::
generic
::
BlockId
;
use
runtime_primitives
::
generic
::
BlockId
;
use
substrate_primitives
::{
ed25519
,
AuthorityId
,
Blake2Hasher
};
use
substrate_primitives
::{
ed25519
,
AuthorityId
,
Blake2Hasher
};
...
@@ -434,7 +434,6 @@ impl<Block: BlockT, B, E, N> grandpa::Chain<Block::Hash, NumberFor<Block>> for E
...
@@ -434,7 +434,6 @@ impl<Block: BlockT, B, E, N> grandpa::Chain<Block::Hash, NumberFor<Block>> for E
N
:
Network
+
'static
,
N
:
Network
+
'static
,
N
::
In
:
'static
,
N
::
In
:
'static
,
NumberFor
<
Block
>
:
BlockNumberOps
,
NumberFor
<
Block
>
:
BlockNumberOps
,
DigestItemFor
<
Block
>
:
CompatibleDigestItem
<
NumberFor
<
Block
>>
,
{
{
fn
ancestry
(
&
self
,
base
:
Block
::
Hash
,
block
:
Block
::
Hash
)
->
Result
<
Vec
<
Block
::
Hash
>
,
GrandpaError
>
{
fn
ancestry
(
&
self
,
base
:
Block
::
Hash
,
block
:
Block
::
Hash
)
->
Result
<
Vec
<
Block
::
Hash
>
,
GrandpaError
>
{
let
tree_route_res
=
::
client
::
blockchain
::
tree_route
(
let
tree_route_res
=
::
client
::
blockchain
::
tree_route
(
...
@@ -529,7 +528,6 @@ impl<B, E, Block: BlockT, N> voter::Environment<Block::Hash, NumberFor<Block>> f
...
@@ -529,7 +528,6 @@ impl<B, E, Block: BlockT, N> voter::Environment<Block::Hash, NumberFor<Block>> f
N
:
Network
+
'static
,
N
:
Network
+
'static
,
N
::
In
:
'static
,
N
::
In
:
'static
,
NumberFor
<
Block
>
:
BlockNumberOps
,
NumberFor
<
Block
>
:
BlockNumberOps
,
DigestItemFor
<
Block
>
:
CompatibleDigestItem
<
NumberFor
<
Block
>>
,
{
{
type
Timer
=
Box
<
Future
<
Item
=
(),
Error
=
Self
::
Error
>>
;
type
Timer
=
Box
<
Future
<
Item
=
(),
Error
=
Self
::
Error
>>
;
type
Id
=
AuthorityId
;
type
Id
=
AuthorityId
;
...
@@ -686,7 +684,7 @@ pub struct GrandpaBlockImport<B, E, Block: BlockT> {
...
@@ -686,7 +684,7 @@ pub struct GrandpaBlockImport<B, E, Block: BlockT> {
impl
<
B
,
E
,
Block
:
BlockT
>
BlockImport
<
Block
>
for
GrandpaBlockImport
<
B
,
E
,
Block
>
where
impl
<
B
,
E
,
Block
:
BlockT
>
BlockImport
<
Block
>
for
GrandpaBlockImport
<
B
,
E
,
Block
>
where
B
:
Backend
<
Block
,
Blake2Hasher
>
+
'static
,
B
:
Backend
<
Block
,
Blake2Hasher
>
+
'static
,
E
:
CallExecutor
<
Block
,
Blake2Hasher
>
+
'static
+
Clone
,
E
:
CallExecutor
<
Block
,
Blake2Hasher
>
+
'static
+
Clone
,
Digest
Item
For
<
Block
>
:
CompatibleDigestItem
<
NumberFor
<
Block
>>
,
DigestFor
<
Block
>
:
Encode
,
{
{
type
Error
=
ClientError
;
type
Error
=
ClientError
;
...
@@ -696,13 +694,20 @@ impl<B, E, Block: BlockT> BlockImport<Block> for GrandpaBlockImport<B, E, Block>
...
@@ -696,13 +694,20 @@ impl<B, E, Block: BlockT> BlockImport<Block> for GrandpaBlockImport<B, E, Block>
use
runtime_primitives
::
traits
::
Digest
;
use
runtime_primitives
::
traits
::
Digest
;
use
authorities
::
PendingChange
;
use
authorities
::
PendingChange
;
let
maybe_event
=
block
.header
.digest
()
.logs
()
.iter
()
let
maybe_change
:
Option
<
ScheduledChange
<
NumberFor
<
Block
>>>
=
self
.inner
.call_api_at
(
.filter_map
(|
log
|
log
.scheduled_change
())
&
BlockId
::
hash
(
block
.header
.parent_hash
()
.clone
()),
.next
()
::
fg_primitives
::
PENDING_CHANGE_CALL
,
.map
(|
change
|
(
block
.header
.hash
(),
*
block
.header
.number
(),
change
));
block
.header
.digest
()
)
?
;
let
maybe_change
=
maybe_change
.map
(|
change
|
(
block
.header
.hash
(),
block
.header
.number
()
.clone
(),
change
));
let
result
=
self
.inner
.import_block
(
block
,
new_authorities
);
let
result
=
self
.inner
.import_block
(
block
,
new_authorities
);
if
let
(
true
,
Some
((
hash
,
number
,
change
)))
=
(
result
.is_ok
(),
maybe_
event
)
{
if
let
(
true
,
Some
((
hash
,
number
,
change
)))
=
(
result
.is_ok
(),
maybe_
change
)
{
self
.authority_set
.add_pending_change
(
PendingChange
{
self
.authority_set
.add_pending_change
(
PendingChange
{
next_authorities
:
change
.next_authorities
,
next_authorities
:
change
.next_authorities
,
finalization_depth
:
number
+
change
.delay
,
finalization_depth
:
number
+
change
.delay
,
...
@@ -734,7 +739,7 @@ pub fn run_grandpa<B, E, Block: BlockT, N>(
...
@@ -734,7 +739,7 @@ pub fn run_grandpa<B, E, Block: BlockT, N>(
N
:
Network
+
'static
,
N
:
Network
+
'static
,
N
::
In
:
'static
,
N
::
In
:
'static
,
NumberFor
<
Block
>
:
BlockNumberOps
,
NumberFor
<
Block
>
:
BlockNumberOps
,
Digest
Item
For
<
Block
>
:
CompatibleDigestItem
<
NumberFor
<
Block
>>
,
DigestFor
<
Block
>
:
Encode
,
{
{
use
futures
::
future
::{
self
,
Loop
as
FutureLoop
};
use
futures
::
future
::{
self
,
Loop
as
FutureLoop
};
...
@@ -826,8 +831,6 @@ mod tests {
...
@@ -826,8 +831,6 @@ mod tests {
use
keyring
::
Keyring
;
use
keyring
::
Keyring
;
use
client
::
BlockchainEvents
;
use
client
::
BlockchainEvents
;
impl
CompatibleDigestItem
<
NumberFor
<
Block
>>
for
DigestItemFor
<
Block
>
{
}
#[derive(Clone)]
#[derive(Clone)]
struct
TestGrandpaNetwork
{
struct
TestGrandpaNetwork
{
inner
:
Arc
<
Mutex
<
TestNet
>>
,
inner
:
Arc
<
Mutex
<
TestNet
>>
,
...
...
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