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
Show whitespace changes
Inline
Side-by-side
network/src/validation.rs
View file @
cc0c54c9
...
...
@@ -40,9 +40,10 @@ use std::sync::Arc;
use
arrayvec
::
ArrayVec
;
use
tokio
::
runtime
::
TaskExecutor
;
use
parking_lot
::
Mutex
;
use
log
::
warn
;
use
router
::
Router
;
use
gossip
::{
POLKADOT_ENGINE_ID
,
RegisteredMessageValidator
,
MessageValidationData
};
use
crate
::
router
::
Router
;
use
crate
::
gossip
::{
POLKADOT_ENGINE_ID
,
RegisteredMessageValidator
,
MessageValidationData
};
use
super
::
PolkadotProtocol
;
...
...
primitives/Cargo.toml
View file @
cc0c54c9
...
...
@@ -2,17 +2,17 @@
name
=
"polkadot-primitives"
version
=
"0.1.0"
authors
=
[
"Parity Technologies <admin@parity.io>"
]
edition
=
"2018"
[dependencies]
serde
=
{
version
=
"1.0"
,
optional
=
true
}
serde_derive
=
{
version
=
"1.0"
,
optional
=
true
}
serde
=
{
version
=
"1.0"
,
optional
=
true
,
features
=
["derive"]
}
parity-codec
=
{
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"
}
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"
}
sr-
primitives
=
{
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"
}
runtime_
primitives
=
{
package
=
"sr-primitives"
,
git
=
"https://github.com/paritytech/substrate"
,
default-features
=
false
,
branch
=
"polkadot-master"
}
polkadot-parachain
=
{
path
=
"../parachain"
,
default-features
=
false
}
[dev-dependencies]
...
...
@@ -24,12 +24,11 @@ default = ["std"]
std
=
[
"parity-codec/std"
,
"parity-codec-derive/std"
,
"
substrate-
primitives/std"
,
"primitives/std"
,
"substrate-client/std"
,
"
sr-
std/std"
,
"
r
std/std"
,
"sr-version/std"
,
"sr-primitives/std"
,
"serde_derive"
,
"runtime_primitives/std"
,
"serde"
,
"polkadot-parachain/std"
,
]
primitives/src/lib.rs
View file @
cc0c54c9
...
...
@@ -20,38 +20,19 @@
#![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"
)]
extern
crate
serde
;
#[macro_use]
extern
crate
substrate_client
;
use
serde
::{
Serialize
,
Deserialize
};
use
rstd
::
prelude
::
*
;
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
};
use
primitives
::
ed25519
;
pub
mod
parachain
;
pub
use
codec
::
Compact
;
pub
use
parity_
codec
::
Compact
;
#[cfg(feature
=
"std"
)]
use
primitives
::
bytes
;
...
...
primitives/src/parachain.rs
View file @
cc0c54c9
...
...
@@ -18,8 +18,12 @@
use
rstd
::
prelude
::
*
;
use
rstd
::
cmp
::
Ordering
;
use
parity_codec
::{
Encode
,
Decode
};
use
super
::
Hash
;
#[cfg(feature
=
"std"
)]
use
serde
::{
Serialize
,
Deserialize
};
#[cfg(feature
=
"std"
)]
use
primitives
::
bytes
;
use
primitives
::
ed25519
;
...
...
@@ -297,7 +301,7 @@ impl AttestedCandidate {
}
}
decl_runtime_apis!
{
substrate_client
::
decl_runtime_apis!
{
/// The API for querying the state of parachains on-chain.
pub
trait
ParachainHost
{
/// Get the current validators.
...
...
runtime/Cargo.toml
View file @
cc0c54c9
...
...
@@ -2,6 +2,7 @@
name
=
"polkadot-runtime"
version
=
"0.1.0"
authors
=
[
"Parity Technologies <admin@parity.io>"
]
edition
=
"2018"
[dependencies]
bitvec
=
{
version
=
"0.8"
,
default-features
=
false
,
features
=
["alloc"]
}
...
...
@@ -10,41 +11,40 @@ log = { version = "0.3", optional = true }
serde
=
{
version
=
"1.0"
,
default-features
=
false
}
serde_derive
=
{
version
=
"1.0"
,
optional
=
true
}
safe-mix
=
{
version
=
"1.0"
,
default-features
=
false
}
polkadot-primitives
=
{
path
=
"../primitives"
,
default-features
=
false
}
parity-codec
=
{
version
=
"3.0"
,
default-features
=
false
}
parity-codec-derive
=
{
version
=
"3.0"
,
default-features
=
false
}
primitives
=
{
package
=
"polkadot-primitives"
,
path
=
"../primitives"
,
default-features
=
false
}
parity-codec
=
{
version
=
"3.0"
,
default-features
=
false
,
features
=
["derive"]
}
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"
}
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-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"
}
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"
}
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"
}
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"
}
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"
}
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"
}
client
=
{
package
=
"
substrate-client
"
,
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"
}
consensus_aura
=
{
package
=
"
substrate-consensus-aura-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"
}
aura
=
{
package
=
"
srml-aura
"
,
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"
}
consensus
=
{
package
=
"
srml-consensus
"
,
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"
}
democracy
=
{
package
=
"
srml-democracy
"
,
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"
}
grandpa
=
{
package
=
"
srml-grandpa
"
,
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"
}
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"
}
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"
}
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"
}
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"
}
session
=
{
package
=
"
srml-session
"
,
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"
}
sudo
=
{
package
=
"
srml-sudo
"
,
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"
}
timestamp
=
{
package
=
"
srml-timestamp
"
,
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"
}
version
=
{
package
=
"sr-version"
,
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]
hex-literal
=
"0.
1
.0"
hex-literal
=
"0.
2
.0"
libsecp256k1
=
"0.2.1"
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"
}
trie-db
=
"0.12"
...
...
@@ -52,36 +52,34 @@ trie-db = "0.12"
default
=
["std"]
std
=
[
"bitvec/std"
,
"
polkadot-
primitives/std"
,
"primitives/std"
,
"rustc-hex/std"
,
"parity-codec/std"
,
"parity-codec-derive/std"
,
"substrate-inherents/std"
,
"inherents/std"
,
"substrate-primitives/std"
,
"substrate-client/std"
,
"substrate-inherents/std"
,
"substrate-offchain-primitives/std"
,
"sr-std/std"
,
"client/std"
,
"offchain_primitives/std"
,
"rstd/std"
,
"sr-io/std"
,
"srml-support/std"
,
"
srml-
balances/std"
,
"
srml-
consensus/std"
,
"
srml-
council/std"
,
"
srml-
democracy/std"
,
"
srml-
executive/std"
,
"
srml-
grandpa/std"
,
"
srml-
indices/std"
,
"balances/std"
,
"consensus/std"
,
"council/std"
,
"democracy/std"
,
"executive/std"
,
"grandpa/std"
,
"indices/std"
,
"sr-primitives/std"
,
"
srml-
session/std"
,
"
srml-
staking/std"
,
"
srml-
sudo/std"
,
"
srml-
system/std"
,
"
srml-
timestamp/std"
,
"
srml-
treasury/std"
,
"
sr-
version/std"
,
"session/std"
,
"staking/std"
,
"sudo/std"
,
"system/std"
,
"timestamp/std"
,
"treasury/std"
,
"version/std"
,
"serde_derive"
,
"serde/std"
,
"log"
,
"safe-mix/std"
,
"
substrate-
consensus
-
authorities/std"
"consensus
_
authorities/std"
]
runtime/src/claims.rs
View file @
cc0c54c9
...
...
@@ -18,10 +18,10 @@
use
rstd
::
prelude
::
*
;
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
system
::
ensure_none
;
use
codec
::
Encode
;
use
parity_
codec
::
{
Encode
,
Decode
}
;
#[cfg(feature
=
"std"
)]
use
sr_primitives
::
traits
::
Zero
;
use
sr_primitives
::
traits
::
ValidateUnsigned
;
...
...
@@ -183,17 +183,19 @@ impl<T: Trait> ValidateUnsigned for Module<T> {
mod
tests
{
use
secp256k1
;
use
tiny_keccak
::
keccak256
;
use
hex_literal
::
hex
;
use
super
::
*
;
use
sr_io
::
with_externalities
;
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
// or public keys. `u64` is used as the `AccountId` and no `Signature`s are requried.
use
sr_primitives
::{
BuildStorage
,
traits
::{
BlakeTwo256
,
IdentityLookup
},
testing
::{
Digest
,
DigestItem
,
Header
}
};
use
balances
;
use
srml_support
::{
impl_outer_origin
,
assert_ok
,
assert_err
,
assert_noop
};
impl_outer_origin!
{
pub
enum
Origin
for
Test
{}
...
...
runtime/src/curated_grandpa.rs
View file @
cc0c54c9
...
...
@@ -17,9 +17,10 @@
//! A module for manually curated GRANDPA set.
use
{
grandpa
,
system
};
use
codec
::
Decode
;
use
parity_
codec
::
Decode
;
use
sr_primitives
::
traits
::{
Hash
as
HashT
,
BlakeTwo256
,
Zero
};
use
rstd
::
prelude
::
*
;
use
srml_support
::{
decl_storage
,
decl_module
};
pub
trait
Trait
:
grandpa
::
Trait
{}
...
...
runtime/src/lib.rs
View file @
cc0c54c9
...
...
@@ -20,59 +20,6 @@
// `construct_runtime!` does a lot of recursion and requires us to increase the limit to 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
parachains
;
mod
claims
;
...
...
@@ -87,10 +34,10 @@ use primitives::{
};
use
client
::{
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
::{
ApplyResult
,
generic
,
transaction_validity
::
TransactionValidity
,
ApplyResult
,
generic
,
transaction_validity
::
TransactionValidity
,
create_runtime_str
,
traits
::{
BlakeTwo256
,
Block
as
BlockT
,
DigestFor
,
StaticLookup
,
Convert
,
AuthorityIdFor
}
...
...
@@ -103,6 +50,7 @@ use council::seats as council_seats;
#[cfg(any(feature
=
"std"
,
test))]
use
version
::
NativeVersion
;
use
substrate_primitives
::
OpaqueMetadata
;
use
srml_support
::{
parameter_types
,
construct_runtime
};
#[cfg(feature
=
"std"
)]
pub
use
staking
::
StakerStatus
;
...
...
runtime/src/parachains.rs
View file @
cc0c54c9
...
...
@@ -17,9 +17,10 @@
//! Main parachains logic. For now this is just the determination of which validators do what.
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
primitives
::{
Hash
,
parachain
::{
Id
as
ParaId
,
Chain
,
DutyRoster
,
AttestedCandidate
,
Statement
,
AccountIdConversion
}};
use
{
system
,
session
};
...
...
@@ -216,7 +217,7 @@ fn majority_of(list_len: usize) -> usize {
}
fn
localized_payload
(
statement
:
Statement
,
parent_hash
:
::
primitives
::
Hash
)
->
Vec
<
u8
>
{
use
codec
::
Encode
;
use
parity_
codec
::
Encode
;
let
mut
encoded
=
statement
.encode
();
encoded
.extend
(
parent_hash
.as_ref
());
...
...
@@ -513,6 +514,7 @@ mod tests {
use
sr_primitives
::
traits
::{
BlakeTwo256
,
IdentityLookup
};
use
primitives
::{
parachain
::{
CandidateReceipt
,
HeadData
,
ValidityAttestation
,
ValidatorIndex
},
SessionKey
};
use
keyring
::{
AuthorityKeyring
,
AccountKeyring
};
use
srml_support
::{
impl_outer_origin
,
assert_ok
};
use
{
consensus
,
timestamp
};
impl_outer_origin!
{
...
...
@@ -524,20 +526,20 @@ mod tests {
impl
consensus
::
Trait
for
Test
{
type
InherentOfflineReport
=
();
type
SessionKey
=
SessionKey
;
type
Log
=
::
Log
;
type
Log
=
crate
::
Log
;
}
impl
system
::
Trait
for
Test
{
type
Origin
=
Origin
;
type
Index
=
::
Nonce
;
type
Index
=
crate
::
Nonce
;
type
BlockNumber
=
u64
;
type
Hash
=
H256
;
type
Hashing
=
BlakeTwo256
;
type
Digest
=
generic
::
Digest
<
::
Log
>
;
type
AccountId
=
::
AccountId
;
type
Lookup
=
IdentityLookup
<
::
AccountId
>
;
type
Header
=
::
Header
;
type
Digest
=
generic
::
Digest
<
crate
::
Log
>
;
type
AccountId
=
crate
::
AccountId
;
type
Lookup
=
IdentityLookup
<
crate
::
AccountId
>
;
type
Header
=
crate
::
Header
;
type
Event
=
();
type
Log
=
::
Log
;
type
Log
=
crate
::
Log
;
}
impl
session
::
Trait
for
Test
{
type
ConvertAccountIdToSessionKey
=
();
...
...
@@ -582,7 +584,7 @@ mod tests {
}
.build_storage
()
.unwrap
()
.0
);
t
.extend
(
session
::
GenesisConfig
::
<
Test
>
{
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!
[],
}
.build_storage
()
.unwrap
()
.0
);
t
.extend
(
GenesisConfig
::
<
Test
>
{
...
...
@@ -594,12 +596,12 @@ mod tests {
fn
make_attestations
(
candidate
:
&
mut
AttestedCandidate
)
{
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
candidate_hash
=
candidate
.candidate
.hash
();
let
authorities
=
::
Consensus
::
authorities
();
let
authorities
=
crate
::
Consensus
::
authorities
();
let
extract_key
=
|
public
:
SessionKey
|
{
AuthorityKeyring
::
from_raw_public
(
public
.0
)
.unwrap
()
};
...
...
runtime/src/slot_range.rs
View file @
cc0c54c9
...
...
@@ -19,6 +19,7 @@
use
rstd
::{
result
,
ops
::
Add
,
convert
::{
TryFrom
,
TryInto
}};
use
sr_primitives
::
traits
::
CheckedSub
;
use
parity_codec
::{
Encode
,
Decode
};
/// Total number of possible sub ranges of slots.
pub
const
SLOT_RANGE_COUNT
:
usize
=
10
;
...
...
runtime/src/slots.rs
View file @
cc0c54c9
...
...
@@ -20,8 +20,8 @@
use
rstd
::{
prelude
::
*
,
mem
::
swap
,
convert
::
TryInto
};
use
sr_primitives
::
traits
::{
CheckedSub
,
StaticLookup
,
Zero
,
One
,
CheckedConversion
,
Hash
};
use
codec
::
Decode
;
use
srml_support
::{
decl_module
,
decl_storage
,
decl_event
,
StorageValue
,
StorageMap
,
use
parity_codec
::{
Encode
,
Decode
}
;
use
srml_support
::{
decl_module
,
decl_storage
,
decl_event
,
StorageValue
,
StorageMap
,
ensure
,
traits
::{
Currency
,
ReservableCurrency
,
WithdrawReason
,
ExistenceRequirement
,
Get
}};
use
primitives
::
parachain
::
AccountIdConversion
;
use
crate
::
parachains
::
ParachainRegistrar
;
...
...
@@ -785,7 +785,7 @@ mod tests {
traits
::{
BlakeTwo256
,
Hash
,
IdentityLookup
,
OnInitialize
,
OnFinalize
},
testing
::{
Digest
,
DigestItem
,
Header
}
};
use
srml_support
::{
impl_outer_origin
,
assert_ok
};
use
srml_support
::{
impl_outer_origin
,
parameter_types
,
assert_ok
,
assert_noop
};
use
balances
;
use
primitives
::
parachain
::
Id
as
ParaId
;
...
...
runtime/wasm/Cargo.toml
View file @
cc0c54c9
...
...
@@ -2,6 +2,7 @@
name
=
"polkadot-runtime-wasm"
version
=
"0.1.0"
authors
=
[
"Parity Technologies <admin@parity.io>"
]
edition
=
"2018"
[lib]
name
=
"polkadot_runtime"
...
...
runtime/wasm/src/lib.rs
View file @
cc0c54c9
...
...
@@ -18,5 +18,4 @@
#![cfg_attr(not(feature
=
"std"
),
no_std)]
extern
crate
polkadot_runtime
;
pub
use
polkadot_runtime
::
*
;
service/Cargo.toml
View file @
cc0c54c9
...
...
@@ -2,6 +2,7 @@
name
=
"polkadot-service"
version
=
"0.5.0"
authors
=
[
"Parity Technologies <admin@parity.io>"
]
edition
=
"2018"
[dependencies]
parking_lot
=
"0.7.1"
...
...
@@ -10,22 +11,22 @@ lazy_static = "1.0"
log
=
"0.4.6"
slog
=
"^2"
tokio
=
"0.1.7"
hex-literal
=
"0.
1
"
polkadot-availability-store
=
{
path
=
"../availability-store"
}
polkadot-validation
=
{
path
=
"../validation"
}
hex-literal
=
"0.
2
"
av_store
=
{
package
=
"
polkadot-availability-store
"
,
path
=
"../availability-store"
}
consensus
=
{
package
=
"
polkadot-validation
"
,
path
=
"../validation"
}
polkadot-primitives
=
{
path
=
"../primitives"
}
polkadot-runtime
=
{
path
=
"../runtime"
}
polkadot-executor
=
{
path
=
"../executor"
}
polkadot-network
=
{
path
=
"../network"
}
sr-io
=
{
git
=
"https://github.com/paritytech/substrate"
,
branch
=
"polkadot-master"
}
sr-primitives
=
{
git
=
"https://github.com/paritytech/substrate"
,
branch
=
"polkadot-master"
}
substrate-primitives
=
{
git
=
"https://github.com/paritytech/substrate"
,
branch
=
"polkadot-master"
}
substrate-client
=
{
git
=
"https://github.com/paritytech/substrate"
,
branch
=
"polkadot-master"
}
substrate-consensus-aura
=
{
git
=
"https://github.com/paritytech/substrate"
,
branch
=
"polkadot-master"
}
substrate-consensus-common
=
{
git
=
"https://github.com/paritytech/substrate"
,
branch
=
"polkadot-master"
}
substrate-finality-grandpa
=
{
git
=
"https://github.com/paritytech/substrate"
,
branch
=
"polkadot-master"
}
substrate-inherents
=
{
git
=
"https://github.com/paritytech/substrate"
,
branch
=
"polkadot-master"
}
substrate-service
=
{
git
=
"https://github.com/paritytech/substrate"
,
branch
=
"polkadot-master"
}
substrate-telemetry
=
{
git
=
"https://github.com/paritytech/substrate"
,
branch
=
"polkadot-master"
}
substrate-transaction-pool
=
{
git
=
"https://github.com/paritytech/substrate"
,
branch
=
"polkadot-master"
}
primitives
=
{
package
=
"
substrate-primitives
"
,
git
=
"https://github.com/paritytech/substrate"
,
branch
=
"polkadot-master"
}
client
=
{
package
=
"
substrate-client
"
,
git
=
"https://github.com/paritytech/substrate"
,
branch
=
"polkadot-master"
}
aura
=
{
package
=
"
substrate-consensus-aura
"
,
git
=
"https://github.com/paritytech/substrate"
,
branch
=
"polkadot-master"
}
consensus_common
=
{
package
=
"
substrate-consensus-common
"
,
git
=
"https://github.com/paritytech/substrate"
,
branch
=
"polkadot-master"
}
grandpa
=
{
package
=
"
substrate-finality-grandpa
"
,
git
=
"https://github.com/paritytech/substrate"
,
branch
=
"polkadot-master"
}
inherents
=
{
package
=
"
substrate-inherents
"
,
git
=
"https://github.com/paritytech/substrate"
,
branch
=
"polkadot-master"
}
service
=
{
package
=
"
substrate-service
"
,
git
=
"https://github.com/paritytech/substrate"
,
branch
=
"polkadot-master"
}
telemetry
=
{
package
=
"
substrate-telemetry
"
,
git
=
"https://github.com/paritytech/substrate"
,
branch
=
"polkadot-master"
}
transaction_pool
=
{
package
=
"
substrate-transaction-pool
"
,
git
=
"https://github.com/paritytech/substrate"
,
branch
=
"polkadot-master"
}
substrate-keystore
=
{
git
=
"https://github.com/paritytech/substrate"
,
branch
=
"polkadot-master"
}
service/src/chain_spec.rs
View file @
cc0c54c9
...
...
@@ -25,6 +25,7 @@ use polkadot_runtime::{
CuratedGrandpaConfig
,
StakerStatus
,
};
use
telemetry
::
TelemetryEndpoints
;
use
hex_literal
::
hex
;
const
STAGING_TELEMETRY_URL
:
&
str
=
"wss://telemetry.polkadot.io/submit/"
;
const
DEFAULT_PROTOCOL_ID
:
&
str
=
"dot"
;
...
...
service/src/lib.rs
View file @
cc0c54c9
...
...
@@ -16,30 +16,6 @@
//! Polkadot service. Specialized wrapper over substrate service.
extern
crate
polkadot_availability_store
as
av_store
;
extern
crate
polkadot_validation
as
consensus
;
extern
crate
polkadot_primitives
;
extern
crate
polkadot_runtime
;
extern
crate
polkadot_executor
;
extern
crate
polkadot_network
;
extern
crate
sr_primitives
;
extern
crate
substrate_primitives
as
primitives
;
extern
crate
substrate_client
as
client
;
#[macro_use]
extern
crate
substrate_service
as
service
;
extern
crate
substrate_consensus_aura
as
aura
;
extern
crate
substrate_consensus_common
as
consensus_common
;
extern
crate
substrate_finality_grandpa
as
grandpa
;
extern
crate
substrate_transaction_pool
as
transaction_pool
;
extern
crate
substrate_telemetry
as
telemetry
;
extern
crate
tokio
;
extern
crate
substrate_inherents
as
inherents
;
#[macro_use]
extern
crate
log
;
#[macro_use]
extern
crate
hex_literal
;
pub
mod
chain_spec
;