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
8e2b7b7c
Commit
8e2b7b7c
authored
3 years ago
by
Andrew Jones
Committed by
GitHub
3 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Remove grandpa `StoredPendingChange` shim (#8788)
* Remove grandpa StoredPendingChange shim * Unused import
parent
0849bcce
Branches
Branches containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
substrate/frame/grandpa/src/lib.rs
+1
-28
1 addition, 28 deletions
substrate/frame/grandpa/src/lib.rs
substrate/frame/grandpa/src/tests.rs
+1
-17
1 addition, 17 deletions
substrate/frame/grandpa/src/tests.rs
with
2 additions
and
45 deletions
substrate/frame/grandpa/src/lib.rs
+
1
−
28
View file @
8e2b7b7c
...
...
@@ -107,21 +107,8 @@ pub trait WeightInfo {
fn
note_stalled
()
->
Weight
;
}
/// A stored pending change, old format.
// TODO: remove shim
// https://github.com/paritytech/substrate/issues/1614
#[derive(Encode,
Decode)]
pub
struct
OldStoredPendingChange
<
N
>
{
/// The block number this was scheduled at.
pub
scheduled_at
:
N
,
/// The delay in blocks until it will be applied.
pub
delay
:
N
,
/// The next authority set.
pub
next_authorities
:
AuthorityList
,
}
/// A stored pending change.
#[derive(Encode)]
#[derive(Encode
,
Decode
)]
pub
struct
StoredPendingChange
<
N
>
{
/// The block number this was scheduled at.
pub
scheduled_at
:
N
,
...
...
@@ -134,20 +121,6 @@ pub struct StoredPendingChange<N> {
pub
forced
:
Option
<
N
>
,
}
impl
<
N
:
Decode
>
Decode
for
StoredPendingChange
<
N
>
{
fn
decode
<
I
:
codec
::
Input
>
(
value
:
&
mut
I
)
->
core
::
result
::
Result
<
Self
,
codec
::
Error
>
{
let
old
=
OldStoredPendingChange
::
decode
(
value
)
?
;
let
forced
=
<
Option
<
N
>>
::
decode
(
value
)
.unwrap_or
(
None
);
Ok
(
StoredPendingChange
{
scheduled_at
:
old
.scheduled_at
,
delay
:
old
.delay
,
next_authorities
:
old
.next_authorities
,
forced
,
})
}
}
/// Current state of the GRANDPA authority set. State transitions must happen in
/// the same order of states defined below, e.g. `Paused` implies a prior
/// `PendingPause`.
...
...
This diff is collapsed.
Click to expand it.
substrate/frame/grandpa/src/tests.rs
+
1
−
17
View file @
8e2b7b7c
...
...
@@ -21,7 +21,7 @@
use
super
::{
Call
,
Event
,
*
};
use
crate
::
mock
::
*
;
use
codec
::
{
Decode
,
Encode
}
;
use
codec
::
Encode
;
use
fg_primitives
::
ScheduledChange
;
use
frame_support
::{
assert_err
,
assert_ok
,
assert_noop
,
...
...
@@ -127,22 +127,6 @@ fn cannot_schedule_change_when_one_pending() {
});
}
#[test]
fn
new_decodes_from_old
()
{
let
old
=
OldStoredPendingChange
{
scheduled_at
:
5u32
,
delay
:
100u32
,
next_authorities
:
to_authorities
(
vec!
[(
1
,
5
),
(
2
,
10
),
(
3
,
2
)]),
};
let
encoded
=
old
.encode
();
let
new
=
StoredPendingChange
::
<
u32
>
::
decode
(
&
mut
&
encoded
[
..
])
.unwrap
();
assert!
(
new
.forced
.is_none
());
assert_eq!
(
new
.scheduled_at
,
old
.scheduled_at
);
assert_eq!
(
new
.delay
,
old
.delay
);
assert_eq!
(
new
.next_authorities
,
old
.next_authorities
);
}
#[test]
fn
dispatch_forced_change
()
{
new_test_ext
(
vec!
[(
1
,
1
),
(
2
,
1
),
(
3
,
1
)])
.execute_with
(||
{
...
...
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