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
0409d123
Unverified
Commit
0409d123
authored
Feb 16, 2021
by
thiolliere
Committed by
GitHub
Feb 16, 2021
Browse files
companion: Babe remove inherent (#2438)
parent
cb0570d8
Pipeline
#124383
canceled with stages
in 5 minutes and 21 seconds
Changes
8
Pipelines
1
Expand all
Hide whitespace changes
Inline
Side-by-side
Cargo.lock
View file @
0409d123
This diff is collapsed.
Click to expand it.
node/test/client/Cargo.toml
View file @
0409d123
...
...
@@ -25,6 +25,7 @@ sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-api
=
{
git
=
"https://github.com/paritytech/substrate"
,
branch
=
"master"
}
sp-timestamp
=
{
git
=
"https://github.com/paritytech/substrate"
,
branch
=
"master"
}
sp-consensus
=
{
git
=
"https://github.com/paritytech/substrate"
,
branch
=
"master"
}
sp-consensus-babe
=
{
git
=
"https://github.com/paritytech/substrate"
,
branch
=
"master"
}
sp-state-machine
=
{
git
=
"https://github.com/paritytech/substrate"
,
branch
=
"master"
}
[dev-dependencies]
...
...
node/test/client/src/block_builder.rs
View file @
0409d123
...
...
@@ -17,8 +17,9 @@
use
crate
::{
Client
,
FullBackend
};
use
polkadot_test_runtime
::{
GetLastTimestamp
,
UncheckedExtrinsic
};
use
polkadot_primitives
::
v1
::
Block
;
use
sp_runtime
::
generic
::
BlockId
;
use
sp_runtime
::
{
generic
::
BlockId
,
Digest
,
DigestItem
}
;
use
sp_api
::
ProvideRuntimeApi
;
use
sp_consensus_babe
::{
BABE_ENGINE_ID
,
digests
::{
PreDigest
,
SecondaryPlainPreDigest
}};
use
sc_block_builder
::{
BlockBuilderProvider
,
BlockBuilder
};
use
sp_state_machine
::
BasicExternalities
;
use
parity_scale_codec
::{
Encode
,
Decode
};
...
...
@@ -52,10 +53,6 @@ impl InitPolkadotBlockBuilder for Client {
&
self
,
at
:
&
BlockId
<
Block
>
,
)
->
BlockBuilder
<
Block
,
Client
,
FullBackend
>
{
let
mut
block_builder
=
self
.new_block_at
(
at
,
Default
::
default
(),
false
)
.expect
(
"Creates new block builder for test runtime"
);
let
mut
inherent_data
=
sp_inherents
::
InherentData
::
new
();
let
last_timestamp
=
self
.runtime_api
()
.get_last_timestamp
(
&
at
)
...
...
@@ -67,6 +64,29 @@ impl InitPolkadotBlockBuilder for Client {
let
timestamp
=
last_timestamp
+
minimum_period
;
// `SlotDuration` is a storage parameter type that requires externalities to access the value.
let
slot_duration
=
BasicExternalities
::
new_empty
()
.execute_with
(||
polkadot_test_runtime
::
SlotDuration
::
get
());
let
slot
=
(
timestamp
/
slot_duration
)
.into
();
let
digest
=
Digest
{
logs
:
vec!
[
DigestItem
::
PreRuntime
(
BABE_ENGINE_ID
,
PreDigest
::
SecondaryPlain
(
SecondaryPlainPreDigest
{
slot
,
authority_index
:
42
,
})
.encode
()
),
],
};
let
mut
block_builder
=
self
.new_block_at
(
at
,
digest
,
false
)
.expect
(
"Creates new block builder for test runtime"
);
let
mut
inherent_data
=
sp_inherents
::
InherentData
::
new
();
inherent_data
.put_data
(
sp_timestamp
::
INHERENT_IDENTIFIER
,
&
timestamp
)
.expect
(
"Put timestamp inherent data"
);
...
...
runtime/kusama/src/lib.rs
View file @
0409d123
...
...
@@ -980,7 +980,7 @@ construct_runtime! {
RandomnessCollectiveFlip
:
pallet_randomness_collective_flip
::{
Module
,
Storage
}
=
32
,
// Must be before session.
Babe
:
pallet_babe
::{
Module
,
Call
,
Storage
,
Config
,
Inherent
,
ValidateUnsigned
}
=
1
,
Babe
:
pallet_babe
::{
Module
,
Call
,
Storage
,
Config
,
ValidateUnsigned
}
=
1
,
Timestamp
:
pallet_timestamp
::{
Module
,
Call
,
Storage
,
Inherent
}
=
2
,
Indices
:
pallet_indices
::{
Module
,
Call
,
Storage
,
Config
<
T
>
,
Event
<
T
>
}
=
3
,
...
...
runtime/polkadot/src/lib.rs
View file @
0409d123
...
...
@@ -985,7 +985,7 @@ construct_runtime! {
Scheduler
:
pallet_scheduler
::{
Module
,
Call
,
Storage
,
Event
<
T
>
}
=
1
,
// Must be before session.
Babe
:
pallet_babe
::{
Module
,
Call
,
Storage
,
Config
,
Inherent
,
ValidateUnsigned
}
=
2
,
Babe
:
pallet_babe
::{
Module
,
Call
,
Storage
,
Config
,
ValidateUnsigned
}
=
2
,
Timestamp
:
pallet_timestamp
::{
Module
,
Call
,
Storage
,
Inherent
}
=
3
,
Indices
:
pallet_indices
::{
Module
,
Call
,
Storage
,
Config
<
T
>
,
Event
<
T
>
}
=
4
,
...
...
runtime/rococo/src/lib.rs
View file @
0409d123
...
...
@@ -168,7 +168,7 @@ construct_runtime! {
System
:
frame_system
::{
Module
,
Call
,
Storage
,
Config
,
Event
<
T
>
},
// Must be before session.
Babe
:
pallet_babe
::{
Module
,
Call
,
Storage
,
Config
,
Inherent
,
ValidateUnsigned
},
Babe
:
pallet_babe
::{
Module
,
Call
,
Storage
,
Config
,
ValidateUnsigned
},
Timestamp
:
pallet_timestamp
::{
Module
,
Call
,
Storage
,
Inherent
},
Indices
:
pallet_indices
::{
Module
,
Call
,
Storage
,
Config
<
T
>
,
Event
<
T
>
},
...
...
runtime/test-runtime/src/lib.rs
View file @
0409d123
...
...
@@ -491,7 +491,7 @@ construct_runtime! {
RandomnessCollectiveFlip
:
pallet_randomness_collective_flip
::{
Module
,
Storage
},
// Must be before session.
Babe
:
pallet_babe
::{
Module
,
Call
,
Storage
,
Config
,
Inherent
},
Babe
:
pallet_babe
::{
Module
,
Call
,
Storage
,
Config
},
Timestamp
:
pallet_timestamp
::{
Module
,
Call
,
Storage
,
Inherent
},
Indices
:
pallet_indices
::{
Module
,
Call
,
Storage
,
Config
<
T
>
,
Event
<
T
>
},
...
...
runtime/westend/src/lib.rs
View file @
0409d123
...
...
@@ -690,7 +690,7 @@ construct_runtime! {
RandomnessCollectiveFlip
:
pallet_randomness_collective_flip
::{
Module
,
Storage
}
=
25
,
// Must be before session.
Babe
:
pallet_babe
::{
Module
,
Call
,
Storage
,
Config
,
Inherent
,
ValidateUnsigned
}
=
1
,
Babe
:
pallet_babe
::{
Module
,
Call
,
Storage
,
Config
,
ValidateUnsigned
}
=
1
,
Timestamp
:
pallet_timestamp
::{
Module
,
Call
,
Storage
,
Inherent
}
=
2
,
Indices
:
pallet_indices
::{
Module
,
Call
,
Storage
,
Config
<
T
>
,
Event
<
T
>
}
=
3
,
...
...
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