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
cc0c54c9
Commit
cc0c54c9
authored
May 29, 2019
by
Stanislav Tkach
Committed by
Gavin Wood
May 29, 2019
Browse files
Migrate to the 2018 edition (#273)
parent
620b8610
Pipeline
#39104
failed with stages
in 8 minutes and 10 seconds
Changes
53
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
network/src/validation.rs
View file @
cc0c54c9
...
@@ -40,9 +40,10 @@ use std::sync::Arc;
...
@@ -40,9 +40,10 @@ use std::sync::Arc;
use
arrayvec
::
ArrayVec
;
use
arrayvec
::
ArrayVec
;
use
tokio
::
runtime
::
TaskExecutor
;
use
tokio
::
runtime
::
TaskExecutor
;
use
parking_lot
::
Mutex
;
use
parking_lot
::
Mutex
;
use
log
::
warn
;
use
router
::
Router
;
use
crate
::
router
::
Router
;
use
gossip
::{
POLKADOT_ENGINE_ID
,
RegisteredMessageValidator
,
MessageValidationData
};
use
crate
::
gossip
::{
POLKADOT_ENGINE_ID
,
RegisteredMessageValidator
,
MessageValidationData
};
use
super
::
PolkadotProtocol
;
use
super
::
PolkadotProtocol
;
...
...
primitives/Cargo.toml
View file @
cc0c54c9
...
@@ -2,17 +2,17 @@
...
@@ -2,17 +2,17 @@
name
=
"polkadot-primitives"
name
=
"polkadot-primitives"
version
=
"0.1.0"
version
=
"0.1.0"
authors
=
[
"Parity Technologies <admin@parity.io>"
]
authors
=
[
"Parity Technologies <admin@parity.io>"
]
edition
=
"2018"
[dependencies]
[dependencies]
serde
=
{
version
=
"1.0"
,
optional
=
true
}
serde
=
{
version
=
"1.0"
,
optional
=
true
,
features
=
["derive"]
}
serde_derive
=
{
version
=
"1.0"
,
optional
=
true
}
parity-codec
=
{
version
=
"3.0"
,
default-features
=
false
}
parity-codec
=
{
version
=
"3.0"
,
default-features
=
false
}
parity-codec-derive
=
{
version
=
"3.0"
,
default-features
=
false
}
parity-codec-derive
=
{
version
=
"3.0"
,
default-features
=
false
}
substrate-primitives
=
{
git
=
"https://github.com/paritytech/substrate"
,
default-features
=
false
,
branch
=
"polkadot-master"
}
primitives
=
{
package
=
"
substrate-primitives
"
,
git
=
"https://github.com/paritytech/substrate"
,
default-features
=
false
,
branch
=
"polkadot-master"
}
substrate-client
=
{
git
=
"https://github.com/paritytech/substrate"
,
default-features
=
false
,
branch
=
"polkadot-master"
}
substrate-client
=
{
git
=
"https://github.com/paritytech/substrate"
,
default-features
=
false
,
branch
=
"polkadot-master"
}
sr-version
=
{
git
=
"https://github.com/paritytech/substrate"
,
default-features
=
false
,
branch
=
"polkadot-master"
}
sr-version
=
{
git
=
"https://github.com/paritytech/substrate"
,
default-features
=
false
,
branch
=
"polkadot-master"
}
sr-
std
=
{
git
=
"https://github.com/paritytech/substrate"
,
default-features
=
false
,
branch
=
"polkadot-master"
}
r
std
=
{
package
=
"sr-std"
,
git
=
"https://github.com/paritytech/substrate"
,
default-features
=
false
,
branch
=
"polkadot-master"
}
sr-
primitives
=
{
git
=
"https://github.com/paritytech/substrate"
,
default-features
=
false
,
branch
=
"polkadot-master"
}
runtime_
primitives
=
{
package
=
"sr-primitives"
,
git
=
"https://github.com/paritytech/substrate"
,
default-features
=
false
,
branch
=
"polkadot-master"
}
polkadot-parachain
=
{
path
=
"../parachain"
,
default-features
=
false
}
polkadot-parachain
=
{
path
=
"../parachain"
,
default-features
=
false
}
[dev-dependencies]
[dev-dependencies]
...
@@ -24,12 +24,11 @@ default = ["std"]
...
@@ -24,12 +24,11 @@ default = ["std"]
std
=
[
std
=
[
"parity-codec/std"
,
"parity-codec/std"
,
"parity-codec-derive/std"
,
"parity-codec-derive/std"
,
"
substrate-
primitives/std"
,
"primitives/std"
,
"substrate-client/std"
,
"substrate-client/std"
,
"
sr-
std/std"
,
"
r
std/std"
,
"sr-version/std"
,
"sr-version/std"
,
"sr-primitives/std"
,
"runtime_primitives/std"
,
"serde_derive"
,
"serde"
,
"serde"
,
"polkadot-parachain/std"
,
"polkadot-parachain/std"
,
]
]
primitives/src/lib.rs
View file @
cc0c54c9
...
@@ -20,38 +20,19 @@
...
@@ -20,38 +20,19 @@
#![cfg_attr(not(feature
=
"std"
),
no_std)]
#![cfg_attr(not(feature
=
"std"
),
no_std)]
extern
crate
parity_codec
as
codec
;
extern
crate
substrate_primitives
as
primitives
;
extern
crate
sr_primitives
as
runtime_primitives
;
extern
crate
sr_std
as
rstd
;
extern
crate
sr_version
;
extern
crate
polkadot_parachain
;
#[cfg(test)]
extern
crate
substrate_serializer
;
#[macro_use]
extern
crate
parity_codec_derive
;
#[cfg(feature
=
"std"
)]
#[macro_use]
extern
crate
serde_derive
;
#[cfg(feature
=
"std"
)]
#[cfg(feature
=
"std"
)]
extern
crate
serde
;
use
serde
::{
Serialize
,
Deserialize
};
#[macro_use]
extern
crate
substrate_client
;
use
rstd
::
prelude
::
*
;
use
rstd
::
prelude
::
*
;
use
runtime_primitives
::{
generic
,
traits
::
Extrinsic
,
AnySignature
};
use
runtime_primitives
::{
generic
,
traits
::
Extrinsic
,
AnySignature
};
use
parity_codec
::{
Encode
,
Decode
};
use
primitives
::
ed25519
;
pub
use
runtime_primitives
::
traits
::{
BlakeTwo256
,
Hash
as
HashT
,
Verify
};
pub
use
runtime_primitives
::
traits
::{
BlakeTwo256
,
Hash
as
HashT
,
Verify
};
use
primitives
::
ed25519
;
pub
mod
parachain
;
pub
mod
parachain
;
pub
use
codec
::
Compact
;
pub
use
parity_
codec
::
Compact
;
#[cfg(feature
=
"std"
)]
#[cfg(feature
=
"std"
)]
use
primitives
::
bytes
;
use
primitives
::
bytes
;
...
...
primitives/src/parachain.rs
View file @
cc0c54c9
...
@@ -18,8 +18,12 @@
...
@@ -18,8 +18,12 @@
use
rstd
::
prelude
::
*
;
use
rstd
::
prelude
::
*
;
use
rstd
::
cmp
::
Ordering
;
use
rstd
::
cmp
::
Ordering
;
use
parity_codec
::{
Encode
,
Decode
};
use
super
::
Hash
;
use
super
::
Hash
;
#[cfg(feature
=
"std"
)]
use
serde
::{
Serialize
,
Deserialize
};
#[cfg(feature
=
"std"
)]
#[cfg(feature
=
"std"
)]
use
primitives
::
bytes
;
use
primitives
::
bytes
;
use
primitives
::
ed25519
;
use
primitives
::
ed25519
;
...
@@ -297,7 +301,7 @@ impl AttestedCandidate {
...
@@ -297,7 +301,7 @@ impl AttestedCandidate {
}
}
}
}
decl_runtime_apis!
{
substrate_client
::
decl_runtime_apis!
{
/// The API for querying the state of parachains on-chain.
/// The API for querying the state of parachains on-chain.
pub
trait
ParachainHost
{
pub
trait
ParachainHost
{
/// Get the current validators.
/// Get the current validators.
...
...
runtime/Cargo.toml
View file @
cc0c54c9
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
name
=
"polkadot-runtime"
name
=
"polkadot-runtime"
version
=
"0.1.0"
version
=
"0.1.0"
authors
=
[
"Parity Technologies <admin@parity.io>"
]
authors
=
[
"Parity Technologies <admin@parity.io>"
]
edition
=
"2018"
[dependencies]
[dependencies]
bitvec
=
{
version
=
"0.8"
,
default-features
=
false
,
features
=
["alloc"]
}
bitvec
=
{
version
=
"0.8"
,
default-features
=
false
,
features
=
["alloc"]
}
...
@@ -10,41 +11,40 @@ log = { version = "0.3", optional = true }
...
@@ -10,41 +11,40 @@ log = { version = "0.3", optional = true }
serde
=
{
version
=
"1.0"
,
default-features
=
false
}
serde
=
{
version
=
"1.0"
,
default-features
=
false
}
serde_derive
=
{
version
=
"1.0"
,
optional
=
true
}
serde_derive
=
{
version
=
"1.0"
,
optional
=
true
}
safe-mix
=
{
version
=
"1.0"
,
default-features
=
false
}
safe-mix
=
{
version
=
"1.0"
,
default-features
=
false
}
polkadot-primitives
=
{
path
=
"../primitives"
,
default-features
=
false
}
primitives
=
{
package
=
"polkadot-primitives"
,
path
=
"../primitives"
,
default-features
=
false
}
parity-codec
=
{
version
=
"3.0"
,
default-features
=
false
}
parity-codec
=
{
version
=
"3.0"
,
default-features
=
false
,
features
=
["derive"]
}
parity-codec-derive
=
{
version
=
"3.0"
,
default-features
=
false
}
substrate-serializer
=
{
git
=
"https://github.com/paritytech/substrate"
,
default-features
=
false
,
branch
=
"polkadot-master"
}
substrate-serializer
=
{
git
=
"https://github.com/paritytech/substrate"
,
default-features
=
false
,
branch
=
"polkadot-master"
}
sr-
std
=
{
git
=
"https://github.com/paritytech/substrate"
,
default-features
=
false
,
branch
=
"polkadot-master"
}
r
std
=
{
package
=
"sr-std"
,
git
=
"https://github.com/paritytech/substrate"
,
default-features
=
false
,
branch
=
"polkadot-master"
}
sr-io
=
{
git
=
"https://github.com/paritytech/substrate"
,
default-features
=
false
,
branch
=
"polkadot-master"
}
sr-io
=
{
git
=
"https://github.com/paritytech/substrate"
,
default-features
=
false
,
branch
=
"polkadot-master"
}
srml-support
=
{
git
=
"https://github.com/paritytech/substrate"
,
default-features
=
false
,
branch
=
"polkadot-master"
}
srml-support
=
{
git
=
"https://github.com/paritytech/substrate"
,
default-features
=
false
,
branch
=
"polkadot-master"
}
substrate-primitives
=
{
git
=
"https://github.com/paritytech/substrate"
,
default-features
=
false
,
branch
=
"polkadot-master"
}
substrate-primitives
=
{
git
=
"https://github.com/paritytech/substrate"
,
default-features
=
false
,
branch
=
"polkadot-master"
}
substrate-client
=
{
git
=
"https://github.com/paritytech/substrate"
,
default-features
=
false
,
branch
=
"polkadot-master"
}
client
=
{
package
=
"
substrate-client
"
,
git
=
"https://github.com/paritytech/substrate"
,
default-features
=
false
,
branch
=
"polkadot-master"
}
substrate-inherents
=
{
git
=
"https://github.com/paritytech/substrate"
,
default-features
=
false
,
branch
=
"polkadot-master"
}
inherents
=
{
package
=
"
substrate-inherents
"
,
git
=
"https://github.com/paritytech/substrate"
,
default-features
=
false
,
branch
=
"polkadot-master"
}
substrate-consensus-aura-primitives
=
{
git
=
"https://github.com/paritytech/substrate"
,
default-features
=
false
,
branch
=
"polkadot-master"
}
consensus_aura
=
{
package
=
"
substrate-consensus-aura-primitives
"
,
git
=
"https://github.com/paritytech/substrate"
,
default-features
=
false
,
branch
=
"polkadot-master"
}
substrate-offchain-primitives
=
{
git
=
"https://github.com/paritytech/substrate"
,
default-features
=
false
,
branch
=
"polkadot-master"
}
offchain_primitives
=
{
package
=
"
substrate-offchain-primitives
"
,
git
=
"https://github.com/paritytech/substrate"
,
default-features
=
false
,
branch
=
"polkadot-master"
}
srml-aura
=
{
git
=
"https://github.com/paritytech/substrate"
,
default-features
=
false
,
branch
=
"polkadot-master"
}
aura
=
{
package
=
"
srml-aura
"
,
git
=
"https://github.com/paritytech/substrate"
,
default-features
=
false
,
branch
=
"polkadot-master"
}
srml-balances
=
{
git
=
"https://github.com/paritytech/substrate"
,
default-features
=
false
,
branch
=
"polkadot-master"
}
balances
=
{
package
=
"
srml-balances
"
,
git
=
"https://github.com/paritytech/substrate"
,
default-features
=
false
,
branch
=
"polkadot-master"
}
srml-consensus
=
{
git
=
"https://github.com/paritytech/substrate"
,
default-features
=
false
,
branch
=
"polkadot-master"
}
consensus
=
{
package
=
"
srml-consensus
"
,
git
=
"https://github.com/paritytech/substrate"
,
default-features
=
false
,
branch
=
"polkadot-master"
}
srml-council
=
{
git
=
"https://github.com/paritytech/substrate"
,
default-features
=
false
,
branch
=
"polkadot-master"
}
council
=
{
package
=
"
srml-council
"
,
git
=
"https://github.com/paritytech/substrate"
,
default-features
=
false
,
branch
=
"polkadot-master"
}
srml-democracy
=
{
git
=
"https://github.com/paritytech/substrate"
,
default-features
=
false
,
branch
=
"polkadot-master"
}
democracy
=
{
package
=
"
srml-democracy
"
,
git
=
"https://github.com/paritytech/substrate"
,
default-features
=
false
,
branch
=
"polkadot-master"
}
srml-executive
=
{
git
=
"https://github.com/paritytech/substrate"
,
default-features
=
false
,
branch
=
"polkadot-master"
}
executive
=
{
package
=
"
srml-executive
"
,
git
=
"https://github.com/paritytech/substrate"
,
default-features
=
false
,
branch
=
"polkadot-master"
}
srml-grandpa
=
{
git
=
"https://github.com/paritytech/substrate"
,
default-features
=
false
,
branch
=
"polkadot-master"
}
grandpa
=
{
package
=
"
srml-grandpa
"
,
git
=
"https://github.com/paritytech/substrate"
,
default-features
=
false
,
branch
=
"polkadot-master"
}
srml-indices
=
{
git
=
"https://github.com/paritytech/substrate"
,
default-features
=
false
,
branch
=
"polkadot-master"
}
indices
=
{
package
=
"
srml-indices
"
,
git
=
"https://github.com/paritytech/substrate"
,
default-features
=
false
,
branch
=
"polkadot-master"
}
sr-primitives
=
{
git
=
"https://github.com/paritytech/substrate"
,
default-features
=
false
,
branch
=
"polkadot-master"
}
sr-primitives
=
{
git
=
"https://github.com/paritytech/substrate"
,
default-features
=
false
,
branch
=
"polkadot-master"
}
srml-session
=
{
git
=
"https://github.com/paritytech/substrate"
,
default-features
=
false
,
branch
=
"polkadot-master"
}
session
=
{
package
=
"
srml-session
"
,
git
=
"https://github.com/paritytech/substrate"
,
default-features
=
false
,
branch
=
"polkadot-master"
}
srml-staking
=
{
git
=
"https://github.com/paritytech/substrate"
,
default-features
=
false
,
branch
=
"polkadot-master"
}
staking
=
{
package
=
"
srml-staking
"
,
git
=
"https://github.com/paritytech/substrate"
,
default-features
=
false
,
branch
=
"polkadot-master"
}
srml-sudo
=
{
git
=
"https://github.com/paritytech/substrate"
,
default-features
=
false
,
branch
=
"polkadot-master"
}
sudo
=
{
package
=
"
srml-sudo
"
,
git
=
"https://github.com/paritytech/substrate"
,
default-features
=
false
,
branch
=
"polkadot-master"
}
srml-system
=
{
git
=
"https://github.com/paritytech/substrate"
,
default-features
=
false
,
branch
=
"polkadot-master"
}
system
=
{
package
=
"
srml-system
"
,
git
=
"https://github.com/paritytech/substrate"
,
default-features
=
false
,
branch
=
"polkadot-master"
}
srml-timestamp
=
{
git
=
"https://github.com/paritytech/substrate"
,
default-features
=
false
,
branch
=
"polkadot-master"
}
timestamp
=
{
package
=
"
srml-timestamp
"
,
git
=
"https://github.com/paritytech/substrate"
,
default-features
=
false
,
branch
=
"polkadot-master"
}
srml-treasury
=
{
git
=
"https://github.com/paritytech/substrate"
,
default-features
=
false
,
branch
=
"polkadot-master"
}
treasury
=
{
package
=
"
srml-treasury
"
,
git
=
"https://github.com/paritytech/substrate"
,
default-features
=
false
,
branch
=
"polkadot-master"
}
sr-
version
=
{
git
=
"https://github.com/paritytech/substrate"
,
default-features
=
false
,
branch
=
"polkadot-master"
}
version
=
{
package
=
"sr-version"
,
git
=
"https://github.com/paritytech/substrate"
,
default-features
=
false
,
branch
=
"polkadot-master"
}
substrate-consensus-authorities
=
{
git
=
"https://github.com/paritytech/substrate"
,
default-features
=
false
,
branch
=
"polkadot-master"
}
consensus_authorities
=
{
package
=
"
substrate-consensus-authorities
"
,
git
=
"https://github.com/paritytech/substrate"
,
default-features
=
false
,
branch
=
"polkadot-master"
}
[dev-dependencies]
[dev-dependencies]
hex-literal
=
"0.
1
.0"
hex-literal
=
"0.
2
.0"
libsecp256k1
=
"0.2.1"
libsecp256k1
=
"0.2.1"
tiny-keccak
=
"1.4.2"
tiny-keccak
=
"1.4.2"
substrate-keyring
=
{
git
=
"https://github.com/paritytech/substrate"
,
branch
=
"polkadot-master"
}
keyring
=
{
package
=
"
substrate-keyring
"
,
git
=
"https://github.com/paritytech/substrate"
,
branch
=
"polkadot-master"
}
substrate-trie
=
{
git
=
"https://github.com/paritytech/substrate"
,
branch
=
"polkadot-master"
}
substrate-trie
=
{
git
=
"https://github.com/paritytech/substrate"
,
branch
=
"polkadot-master"
}
trie-db
=
"0.12"
trie-db
=
"0.12"
...
@@ -52,36 +52,34 @@ trie-db = "0.12"
...
@@ -52,36 +52,34 @@ trie-db = "0.12"
default
=
["std"]
default
=
["std"]
std
=
[
std
=
[
"bitvec/std"
,
"bitvec/std"
,
"
polkadot-
primitives/std"
,
"primitives/std"
,
"rustc-hex/std"
,
"rustc-hex/std"
,
"parity-codec/std"
,
"parity-codec/std"
,
"parity-codec-derive/std"
,
"inherents/std"
,
"substrate-inherents/std"
,
"substrate-primitives/std"
,
"substrate-primitives/std"
,
"substrate-client/std"
,
"client/std"
,
"substrate-inherents/std"
,
"offchain_primitives/std"
,
"substrate-offchain-primitives/std"
,
"rstd/std"
,
"sr-std/std"
,
"sr-io/std"
,
"sr-io/std"
,
"srml-support/std"
,
"srml-support/std"
,
"
srml-
balances/std"
,
"balances/std"
,
"
srml-
consensus/std"
,
"consensus/std"
,
"
srml-
council/std"
,
"council/std"
,
"
srml-
democracy/std"
,
"democracy/std"
,
"
srml-
executive/std"
,
"executive/std"
,
"
srml-
grandpa/std"
,
"grandpa/std"
,
"
srml-
indices/std"
,
"indices/std"
,
"sr-primitives/std"
,
"sr-primitives/std"
,
"
srml-
session/std"
,
"session/std"
,
"
srml-
staking/std"
,
"staking/std"
,
"
srml-
sudo/std"
,
"sudo/std"
,
"
srml-
system/std"
,
"system/std"
,
"
srml-
timestamp/std"
,
"timestamp/std"
,
"
srml-
treasury/std"
,
"treasury/std"
,
"
sr-
version/std"
,
"version/std"
,
"serde_derive"
,
"serde_derive"
,
"serde/std"
,
"serde/std"
,
"log"
,
"log"
,
"safe-mix/std"
,
"safe-mix/std"
,
"
substrate-
consensus
-
authorities/std"
"consensus
_
authorities/std"
]
]
runtime/src/claims.rs
View file @
cc0c54c9
...
@@ -18,10 +18,10 @@
...
@@ -18,10 +18,10 @@
use
rstd
::
prelude
::
*
;
use
rstd
::
prelude
::
*
;
use
sr_io
::{
keccak_256
,
secp256k1_ecdsa_recover
};
use
sr_io
::{
keccak_256
,
secp256k1_ecdsa_recover
};
use
srml_support
::{
StorageValue
,
StorageMap
};
use
srml_support
::{
StorageValue
,
StorageMap
,
decl_event
,
decl_storage
,
decl_module
};
use
srml_support
::
traits
::
Currency
;
use
srml_support
::
traits
::
Currency
;
use
system
::
ensure_none
;
use
system
::
ensure_none
;
use
codec
::
Encode
;
use
parity_
codec
::
{
Encode
,
Decode
}
;
#[cfg(feature
=
"std"
)]
#[cfg(feature
=
"std"
)]
use
sr_primitives
::
traits
::
Zero
;
use
sr_primitives
::
traits
::
Zero
;
use
sr_primitives
::
traits
::
ValidateUnsigned
;
use
sr_primitives
::
traits
::
ValidateUnsigned
;
...
@@ -183,17 +183,19 @@ impl<T: Trait> ValidateUnsigned for Module<T> {
...
@@ -183,17 +183,19 @@ impl<T: Trait> ValidateUnsigned for Module<T> {
mod
tests
{
mod
tests
{
use
secp256k1
;
use
secp256k1
;
use
tiny_keccak
::
keccak256
;
use
tiny_keccak
::
keccak256
;
use
hex_literal
::
hex
;
use
super
::
*
;
use
super
::
*
;
use
sr_io
::
with_externalities
;
use
sr_io
::
with_externalities
;
use
substrate_primitives
::{
H256
,
Blake2Hasher
};
use
substrate_primitives
::{
H256
,
Blake2Hasher
};
use
codec
::{
Decode
,
Encode
};
use
parity_
codec
::{
Decode
,
Encode
};
// The testing primitives are very useful for avoiding having to work with signatures
// The testing primitives are very useful for avoiding having to work with signatures
// or public keys. `u64` is used as the `AccountId` and no `Signature`s are requried.
// or public keys. `u64` is used as the `AccountId` and no `Signature`s are requried.
use
sr_primitives
::{
use
sr_primitives
::{
BuildStorage
,
traits
::{
BlakeTwo256
,
IdentityLookup
},
testing
::{
Digest
,
DigestItem
,
Header
}
BuildStorage
,
traits
::{
BlakeTwo256
,
IdentityLookup
},
testing
::{
Digest
,
DigestItem
,
Header
}
};
};
use
balances
;
use
balances
;
use
srml_support
::{
impl_outer_origin
,
assert_ok
,
assert_err
,
assert_noop
};
impl_outer_origin!
{
impl_outer_origin!
{
pub
enum
Origin
for
Test
{}
pub
enum
Origin
for
Test
{}
...
...
runtime/src/curated_grandpa.rs
View file @
cc0c54c9
...
@@ -17,9 +17,10 @@
...
@@ -17,9 +17,10 @@
//! A module for manually curated GRANDPA set.
//! A module for manually curated GRANDPA set.
use
{
grandpa
,
system
};
use
{
grandpa
,
system
};
use
codec
::
Decode
;
use
parity_
codec
::
Decode
;
use
sr_primitives
::
traits
::{
Hash
as
HashT
,
BlakeTwo256
,
Zero
};
use
sr_primitives
::
traits
::{
Hash
as
HashT
,
BlakeTwo256
,
Zero
};
use
rstd
::
prelude
::
*
;
use
rstd
::
prelude
::
*
;
use
srml_support
::{
decl_storage
,
decl_module
};
pub
trait
Trait
:
grandpa
::
Trait
{}
pub
trait
Trait
:
grandpa
::
Trait
{}
...
...
runtime/src/lib.rs
View file @
cc0c54c9
...
@@ -20,59 +20,6 @@
...
@@ -20,59 +20,6 @@
// `construct_runtime!` does a lot of recursion and requires us to increase the limit to 256.
// `construct_runtime!` does a lot of recursion and requires us to increase the limit to 256.
#![recursion_limit=
"256"
]
#![recursion_limit=
"256"
]
#[cfg(test)]
#[macro_use]
extern
crate
hex_literal
;
#[cfg(test)]
extern
crate
secp256k1
;
#[cfg(test)]
extern
crate
tiny_keccak
;
#[macro_use]
extern
crate
bitvec
;
extern
crate
parity_codec_derive
;
extern
crate
parity_codec
as
codec
;
extern
crate
substrate_consensus_aura_primitives
as
consensus_aura
;
extern
crate
substrate_primitives
;
extern
crate
substrate_inherents
as
inherents
;
extern
crate
substrate_offchain_primitives
as
offchain_primitives
;
#[macro_use]
extern
crate
substrate_client
as
client
;
extern
crate
sr_std
as
rstd
;
extern
crate
sr_io
;
extern
crate
sr_version
as
version
;
#[macro_use]
extern
crate
sr_primitives
;
#[macro_use]
extern
crate
srml_support
;
extern
crate
srml_aura
as
aura
;
extern
crate
srml_balances
as
balances
;
extern
crate
srml_consensus
as
consensus
;
extern
crate
srml_council
as
council
;
extern
crate
srml_democracy
as
democracy
;
extern
crate
srml_executive
as
executive
;
extern
crate
srml_grandpa
as
grandpa
;
extern
crate
srml_indices
as
indices
;
extern
crate
srml_session
as
session
;
extern
crate
srml_staking
as
staking
;
extern
crate
srml_sudo
as
sudo
;
extern
crate
srml_system
as
system
;
extern
crate
srml_timestamp
as
timestamp
;
extern
crate
srml_treasury
as
treasury
;
extern
crate
substrate_consensus_authorities
as
consensus_authorities
;
extern
crate
polkadot_primitives
as
primitives
;
#[cfg(test)]
extern
crate
substrate_keyring
as
keyring
;
#[cfg(test)]
extern
crate
substrate_trie
;
mod
curated_grandpa
;
mod
curated_grandpa
;
mod
parachains
;
mod
parachains
;
mod
claims
;
mod
claims
;
...
@@ -87,10 +34,10 @@ use primitives::{
...
@@ -87,10 +34,10 @@ use primitives::{
};
};
use
client
::{
use
client
::{
block_builder
::
api
::{
self
as
block_builder_api
,
InherentData
,
CheckInherentsResult
},
block_builder
::
api
::{
self
as
block_builder_api
,
InherentData
,
CheckInherentsResult
},
runtime_api
as
client_api
,
runtime_api
as
client_api
,
impl_runtime_apis
,
};
};
use
sr_primitives
::{
use
sr_primitives
::{
ApplyResult
,
generic
,
transaction_validity
::
TransactionValidity
,
ApplyResult
,
generic
,
transaction_validity
::
TransactionValidity
,
create_runtime_str
,
traits
::{
traits
::{
BlakeTwo256
,
Block
as
BlockT
,
DigestFor
,
StaticLookup
,
Convert
,
AuthorityIdFor
BlakeTwo256
,
Block
as
BlockT
,
DigestFor
,
StaticLookup
,
Convert
,
AuthorityIdFor
}
}
...
@@ -103,6 +50,7 @@ use council::seats as council_seats;
...
@@ -103,6 +50,7 @@ use council::seats as council_seats;
#[cfg(any(feature
=
"std"
,
test))]
#[cfg(any(feature
=
"std"
,
test))]
use
version
::
NativeVersion
;
use
version
::
NativeVersion
;
use
substrate_primitives
::
OpaqueMetadata
;
use
substrate_primitives
::
OpaqueMetadata
;
use
srml_support
::{
parameter_types
,
construct_runtime
};
#[cfg(feature
=
"std"
)]
#[cfg(feature
=
"std"
)]
pub
use
staking
::
StakerStatus
;
pub
use
staking
::
StakerStatus
;
...
...
runtime/src/parachains.rs
View file @
cc0c54c9
...
@@ -17,9 +17,10 @@
...
@@ -17,9 +17,10 @@
//! Main parachains logic. For now this is just the determination of which validators do what.
//! Main parachains logic. For now this is just the determination of which validators do what.
use
rstd
::
prelude
::
*
;
use
rstd
::
prelude
::
*
;
use
codec
::{
Decode
,
HasCompact
};
use
parity_codec
::{
Decode
,
HasCompact
};
use
srml_support
::{
decl_storage
,
decl_module
,
fail
,
ensure
};
use
bitvec
::
BigEndian
;
use
bitvec
::
{
bitvec
,
BigEndian
}
;
use
sr_primitives
::
traits
::{
Hash
as
HashT
,
BlakeTwo256
,
Member
};
use
sr_primitives
::
traits
::{
Hash
as
HashT
,
BlakeTwo256
,
Member
};
use
primitives
::{
Hash
,
parachain
::{
Id
as
ParaId
,
Chain
,
DutyRoster
,
AttestedCandidate
,
Statement
,
AccountIdConversion
}};
use
primitives
::{
Hash
,
parachain
::{
Id
as
ParaId
,
Chain
,
DutyRoster
,
AttestedCandidate
,
Statement
,
AccountIdConversion
}};
use
{
system
,
session
};
use
{
system
,
session
};
...
@@ -216,7 +217,7 @@ fn majority_of(list_len: usize) -> usize {
...
@@ -216,7 +217,7 @@ fn majority_of(list_len: usize) -> usize {
}
}
fn
localized_payload
(
statement
:
Statement
,
parent_hash
:
::
primitives
::
Hash
)
->
Vec
<
u8
>
{
fn
localized_payload
(
statement
:
Statement
,
parent_hash
:
::
primitives
::
Hash
)
->
Vec
<
u8
>
{
use
codec
::
Encode
;
use
parity_
codec
::
Encode
;
let
mut
encoded
=
statement
.encode
();
let
mut
encoded
=
statement
.encode
();
encoded
.extend
(
parent_hash
.as_ref
());
encoded
.extend
(
parent_hash
.as_ref
());
...
@@ -513,6 +514,7 @@ mod tests {
...
@@ -513,6 +514,7 @@ mod tests {
use
sr_primitives
::
traits
::{
BlakeTwo256
,
IdentityLookup
};
use
sr_primitives
::
traits
::{
BlakeTwo256
,
IdentityLookup
};
use
primitives
::{
parachain
::{
CandidateReceipt
,
HeadData
,
ValidityAttestation
,
ValidatorIndex
},
SessionKey
};
use
primitives
::{
parachain
::{
CandidateReceipt
,
HeadData
,
ValidityAttestation
,
ValidatorIndex
},
SessionKey
};
use
keyring
::{
AuthorityKeyring
,
AccountKeyring
};
use
keyring
::{
AuthorityKeyring
,
AccountKeyring
};
use
srml_support
::{
impl_outer_origin
,
assert_ok
};
use
{
consensus
,
timestamp
};
use
{
consensus
,
timestamp
};
impl_outer_origin!
{
impl_outer_origin!
{
...
@@ -524,20 +526,20 @@ mod tests {
...
@@ -524,20 +526,20 @@ mod tests {
impl
consensus
::
Trait
for
Test
{
impl
consensus
::
Trait
for
Test
{
type
InherentOfflineReport
=
();
type
InherentOfflineReport
=
();
type
SessionKey
=
SessionKey
;
type
SessionKey
=
SessionKey
;
type
Log
=
::
Log
;
type
Log
=
crate
::
Log
;
}
}
impl
system
::
Trait
for
Test
{
impl
system
::
Trait
for
Test
{
type
Origin
=
Origin
;
type
Origin
=
Origin
;
type
Index
=
::
Nonce
;
type
Index
=
crate
::
Nonce
;
type
BlockNumber
=
u64
;
type
BlockNumber
=
u64
;
type
Hash
=
H256
;
type
Hash
=
H256
;
type
Hashing
=
BlakeTwo256
;
type
Hashing
=
BlakeTwo256
;
type
Digest
=
generic
::
Digest
<
::
Log
>
;
type
Digest
=
generic
::
Digest
<
crate
::
Log
>
;
type
AccountId
=
::
AccountId
;
type
AccountId
=
crate
::
AccountId
;
type
Lookup
=
IdentityLookup
<
::
AccountId
>
;
type
Lookup
=
IdentityLookup
<
crate
::
AccountId
>
;
type
Header
=
::
Header
;
type
Header
=
crate
::
Header
;
type
Event
=
();
type
Event
=
();
type
Log
=
::
Log
;
type
Log
=
crate
::
Log
;
}
}
impl
session
::
Trait
for
Test
{
impl
session
::
Trait
for
Test
{
type
ConvertAccountIdToSessionKey
=
();
type
ConvertAccountIdToSessionKey
=
();
...
@@ -582,7 +584,7 @@ mod tests {
...
@@ -582,7 +584,7 @@ mod tests {
}
.build_storage
()
.unwrap
()
.0
);
}
.build_storage
()
.unwrap
()
.0
);
t
.extend
(
session
::
GenesisConfig
::
<
Test
>
{
t
.extend
(
session
::
GenesisConfig
::
<
Test
>
{
session_length
:
1000
,
session_length
:
1000
,
validators
:
validator_keys
.iter
()
.map
(|
k
|
::
AccountId
::
from
(
*
k
))
.collect
(),
validators
:
validator_keys
.iter
()
.map
(|
k
|
crate
::
AccountId
::
from
(
*
k
))
.collect
(),
keys
:
vec!
[],
keys
:
vec!
[],
}
.build_storage
()
.unwrap
()
.0
);
}
.build_storage
()
.unwrap
()
.0
);
t
.extend
(
GenesisConfig
::
<
Test
>
{
t
.extend
(
GenesisConfig
::
<
Test
>
{
...
@@ -594,12 +596,12 @@ mod tests {
...
@@ -594,12 +596,12 @@ mod tests {
fn
make_attestations
(
candidate
:
&
mut
AttestedCandidate
)
{
fn
make_attestations
(
candidate
:
&
mut
AttestedCandidate
)
{
let
mut
vote_implicit
=
false
;
let
mut
vote_implicit
=
false
;
let
parent_hash
=
::
System
::
parent_hash
();
let
parent_hash
=
crate
::
System
::
parent_hash
();
let
duty_roster
=
Parachains
::
calculate_duty_roster
();
let
duty_roster
=
Parachains
::
calculate_duty_roster
();
let
candidate_hash
=
candidate
.candidate
.hash
();
let
candidate_hash
=
candidate
.candidate
.hash
();