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
d88a8785
Commit
d88a8785
authored
Jul 27, 2020
by
Cecile Tonglet
Browse files
Merge commit
feb5039e
(no conflict)
parents
183d971e
feb5039e
Pipeline
#101717
passed with stages
in 19 minutes and 47 seconds
Changes
120
Pipelines
1
Expand all
Hide whitespace changes
Inline
Side-by-side
Cargo.lock
View file @
d88a8785
This diff is collapsed.
Click to expand it.
Cargo.toml
View file @
d88a8785
...
...
@@ -51,6 +51,7 @@ members = [
"node/overseer"
,
"node/primitives"
,
"node/service"
,
"node/core/backing"
,
"node/subsystem"
,
"node/test-helpers/subsystem"
,
"node/test-service"
,
...
...
Process.toml
0 → 100644
View file @
d88a8785
[Batch:
Availability
and
Validity]
owner
=
"rphmeier"
whitelist
=
[]
matrix_room_id
=
"!wQXGIDhhJQSVXKqPwi:matrix.parity.io"
[Batch:
Codebase
Restructure]
owner
=
"rphmeier"
whitelist
=
[]
matrix_room_id
=
"!wQXGIDhhJQSVXKqPwi:matrix.parity.io"
[Cumulus]
owner
=
"bkchr"
whitelist
=
[]
matrix_room_id
=
"!wQXGIDhhJQSVXKqPwi:matrix.parity.io"
availability-store/Cargo.toml
View file @
d88a8785
...
...
@@ -15,14 +15,14 @@ futures = "0.3.4"
tokio
=
{
version
=
"0.2.13"
,
features
=
["rt-core"]
}
exit-future
=
"0.2.0"
codec
=
{
package
=
"parity-scale-codec"
,
version
=
"1.3.0"
,
features
=
["derive"]
}
sc-network
=
{
git
=
"https://github.com/paritytech/substrate"
,
rev
=
"
e824e8ab0fadec9949ebb8b9e14d98703d6b8d44
"
}
consensus_common
=
{
package
=
"sp-consensus"
,
git
=
"https://github.com/paritytech/substrate"
,
rev
=
"
e824e8ab0fadec9949ebb8b9e14d98703d6b8d44
"
}
client
=
{
package
=
"sc-client-api"
,
git
=
"https://github.com/paritytech/substrate"
,
rev
=
"
e824e8ab0fadec9949ebb8b9e14d98703d6b8d44
"
}
sp-runtime
=
{
git
=
"https://github.com/paritytech/substrate"
,
rev
=
"
e824e8ab0fadec9949ebb8b9e14d98703d6b8d44
"
}
sp-blockchain
=
{
git
=
"https://github.com/paritytech/substrate"
,
rev
=
"
e824e8ab0fadec9949ebb8b9e14d98703d6b8d44
"
}
sp-api
=
{
git
=
"https://github.com/paritytech/substrate"
,
rev
=
"
e824e8ab0fadec9949ebb8b9e14d98703d6b8d44
"
}
keystore
=
{
package
=
"sc-keystore"
,
git
=
"https://github.com/paritytech/substrate"
,
rev
=
"
e824e8ab0fadec9949ebb8b9e14d98703d6b8d44
"
}
sp-core
=
{
git
=
"https://github.com/paritytech/substrate"
,
rev
=
"
e824e8ab0fadec9949ebb8b9e14d98703d6b8d44
"
}
sc-network
=
{
git
=
"https://github.com/paritytech/substrate"
,
rev
=
"
56cf04f289f9cd5e8bb96fe5bd23a923e21acf1c
"
}
consensus_common
=
{
package
=
"sp-consensus"
,
git
=
"https://github.com/paritytech/substrate"
,
rev
=
"
56cf04f289f9cd5e8bb96fe5bd23a923e21acf1c
"
}
client
=
{
package
=
"sc-client-api"
,
git
=
"https://github.com/paritytech/substrate"
,
rev
=
"
56cf04f289f9cd5e8bb96fe5bd23a923e21acf1c
"
}
sp-runtime
=
{
git
=
"https://github.com/paritytech/substrate"
,
rev
=
"
56cf04f289f9cd5e8bb96fe5bd23a923e21acf1c
"
}
sp-blockchain
=
{
git
=
"https://github.com/paritytech/substrate"
,
rev
=
"
56cf04f289f9cd5e8bb96fe5bd23a923e21acf1c
"
}
sp-api
=
{
git
=
"https://github.com/paritytech/substrate"
,
rev
=
"
56cf04f289f9cd5e8bb96fe5bd23a923e21acf1c
"
}
keystore
=
{
package
=
"sc-keystore"
,
git
=
"https://github.com/paritytech/substrate"
,
rev
=
"
56cf04f289f9cd5e8bb96fe5bd23a923e21acf1c
"
}
sp-core
=
{
git
=
"https://github.com/paritytech/substrate"
,
rev
=
"
56cf04f289f9cd5e8bb96fe5bd23a923e21acf1c
"
}
kvdb
=
"0.7.0"
kvdb-memorydb
=
"0.7.0"
...
...
availability-store/src/lib.rs
View file @
d88a8785
...
...
@@ -25,12 +25,10 @@
use
futures
::
prelude
::
*
;
use
futures
::
channel
::{
mpsc
,
oneshot
};
use
keystore
::
KeyStorePtr
;
use
polkadot_primitives
::{
use
polkadot_primitives
::
v0
::
{
Hash
,
Block
,
parachain
::{
PoVBlock
,
AbridgedCandidateReceipt
,
ErasureChunk
,
ParachainHost
,
AvailableData
,
OmittedValidationData
,
},
PoVBlock
,
AbridgedCandidateReceipt
,
ErasureChunk
,
ParachainHost
,
AvailableData
,
OmittedValidationData
,
};
use
sp_runtime
::
traits
::
HashFor
;
use
sp_blockchain
::
Result
as
ClientResult
;
...
...
availability-store/src/store.rs
View file @
d88a8785
...
...
@@ -19,11 +19,8 @@ use kvdb_rocksdb::{Database, DatabaseConfig};
use
kvdb
::{
KeyValueDB
,
DBTransaction
};
use
codec
::{
Encode
,
Decode
};
use
polkadot_erasure_coding
as
erasure
;
use
polkadot_primitives
::{
Hash
,
parachain
::{
ErasureChunk
,
AvailableData
,
AbridgedCandidateReceipt
,
},
use
polkadot_primitives
::
v0
::{
Hash
,
ErasureChunk
,
AvailableData
,
AbridgedCandidateReceipt
,
};
use
parking_lot
::
Mutex
;
...
...
@@ -273,7 +270,7 @@ impl Store {
// If there are no block data in the store at this point,
// check that they can be reconstructed now and add them to store if they can.
if
self
.execution_data
(
&
candidate_hash
)
.is_none
()
{
if
let
Ok
(
available_data
)
=
erasure
::
reconstruct
(
if
let
Ok
(
available_data
)
=
erasure
::
reconstruct
_v0
(
n_validators
as
usize
,
v
.iter
()
.map
(|
chunk
|
(
chunk
.chunk
.as_ref
(),
chunk
.index
as
usize
)),
)
...
...
@@ -390,7 +387,7 @@ impl Store {
mod
tests
{
use
super
::
*
;
use
polkadot_erasure_coding
::{
self
as
erasure
};
use
polkadot_primitives
::
parachain
::{
use
polkadot_primitives
::
v0
::{
Id
as
ParaId
,
BlockData
,
AvailableData
,
PoVBlock
,
OmittedValidationData
,
};
...
...
@@ -489,7 +486,7 @@ mod tests {
let
available_data
=
available_data
(
&
[
42
;
8
]);
let
n_validators
=
5
;
let
erasure_chunks
=
erasure
::
obtain_chunks
(
let
erasure_chunks
=
erasure
::
obtain_chunks
_v0
(
n_validators
,
&
available_data
,
)
.unwrap
();
...
...
availability-store/src/worker.rs
View file @
d88a8785
...
...
@@ -33,8 +33,8 @@ use consensus_common::{
import_queue
::
CacheKeyId
,
};
use
sp_core
::
traits
::
SpawnNamed
;
use
polkadot_primitives
::
{
Block
,
BlockId
,
Hash
};
use
polkadot_primitives
::
parachain
::{
use
polkadot_primitives
::
v0
::{
Block
,
BlockId
,
Hash
,
ParachainHost
,
ValidatorId
,
AbridgedCandidateReceipt
,
AvailableData
,
ValidatorPair
,
ErasureChunk
,
};
...
...
cli/Cargo.toml
View file @
d88a8785
...
...
@@ -17,26 +17,26 @@ crate-type = ["cdylib", "rlib"]
log
=
"0.4.8"
futures
=
{
version
=
"0.3.4"
,
features
=
["compat"]
}
structopt
=
"0.3.8"
sp-api
=
{
git
=
"https://github.com/paritytech/substrate"
,
rev
=
"
e824e8ab0fadec9949ebb8b9e14d98703d6b8d44
"
}
sp-core
=
{
git
=
"https://github.com/paritytech/substrate"
,
rev
=
"
e824e8ab0fadec9949ebb8b9e14d98703d6b8d44
"
}
sp-runtime
=
{
git
=
"https://github.com/paritytech/substrate"
,
rev
=
"
e824e8ab0fadec9949ebb8b9e14d98703d6b8d44
"
}
sc-client-api
=
{
git
=
"https://github.com/paritytech/substrate"
,
rev
=
"
e824e8ab0fadec9949ebb8b9e14d98703d6b8d44
"
}
sc-client-db
=
{
git
=
"https://github.com/paritytech/substrate"
,
rev
=
"
e824e8ab0fadec9949ebb8b9e14d98703d6b8d44
"
}
sc-executor
=
{
git
=
"https://github.com/paritytech/substrate"
,
rev
=
"
e824e8ab0fadec9949ebb8b9e14d98703d6b8d44
"
}
sp-api
=
{
git
=
"https://github.com/paritytech/substrate"
,
rev
=
"
56cf04f289f9cd5e8bb96fe5bd23a923e21acf1c
"
}
sp-core
=
{
git
=
"https://github.com/paritytech/substrate"
,
rev
=
"
56cf04f289f9cd5e8bb96fe5bd23a923e21acf1c
"
}
sp-runtime
=
{
git
=
"https://github.com/paritytech/substrate"
,
rev
=
"
56cf04f289f9cd5e8bb96fe5bd23a923e21acf1c
"
}
sc-client-api
=
{
git
=
"https://github.com/paritytech/substrate"
,
rev
=
"
56cf04f289f9cd5e8bb96fe5bd23a923e21acf1c
"
}
sc-client-db
=
{
git
=
"https://github.com/paritytech/substrate"
,
rev
=
"
56cf04f289f9cd5e8bb96fe5bd23a923e21acf1c
"
}
sc-executor
=
{
git
=
"https://github.com/paritytech/substrate"
,
rev
=
"
56cf04f289f9cd5e8bb96fe5bd23a923e21acf1c
"
}
service
=
{
package
=
"polkadot-service"
,
path
=
"../service"
,
default-features
=
false
,
optional
=
true
}
service-new
=
{
package
=
"polkadot-service-new"
,
path
=
"../node/service"
,
default-features
=
false
,
optional
=
true
}
tokio
=
{
version
=
"0.2.13"
,
features
=
["rt-threaded"]
,
optional
=
true
}
frame-benchmarking-cli
=
{
git
=
"https://github.com/paritytech/substrate"
,
rev
=
"
e824e8ab0fadec9949ebb8b9e14d98703d6b8d44
"
,
optional
=
true
}
sc-cli
=
{
git
=
"https://github.com/paritytech/substrate"
,
rev
=
"
e824e8ab0fadec9949ebb8b9e14d98703d6b8d44
"
,
optional
=
true
}
sc-service
=
{
git
=
"https://github.com/paritytech/substrate"
,
rev
=
"
e824e8ab0fadec9949ebb8b9e14d98703d6b8d44
"
,
optional
=
true
}
frame-benchmarking-cli
=
{
git
=
"https://github.com/paritytech/substrate"
,
rev
=
"
56cf04f289f9cd5e8bb96fe5bd23a923e21acf1c
"
,
optional
=
true
}
sc-cli
=
{
git
=
"https://github.com/paritytech/substrate"
,
rev
=
"
56cf04f289f9cd5e8bb96fe5bd23a923e21acf1c
"
,
optional
=
true
}
sc-service
=
{
git
=
"https://github.com/paritytech/substrate"
,
rev
=
"
56cf04f289f9cd5e8bb96fe5bd23a923e21acf1c
"
,
optional
=
true
}
wasm-bindgen
=
{
version
=
"0.2.57"
,
optional
=
true
}
wasm-bindgen-futures
=
{
version
=
"0.4.7"
,
optional
=
true
}
browser-utils
=
{
package
=
"substrate-browser-utils"
,
git
=
"https://github.com/paritytech/substrate"
,
rev
=
"
e824e8ab0fadec9949ebb8b9e14d98703d6b8d44
"
,
optional
=
true
}
browser-utils
=
{
package
=
"substrate-browser-utils"
,
git
=
"https://github.com/paritytech/substrate"
,
rev
=
"
56cf04f289f9cd5e8bb96fe5bd23a923e21acf1c
"
,
optional
=
true
}
[build-dependencies]
substrate-build-script-utils
=
{
git
=
"https://github.com/paritytech/substrate"
,
rev
=
"
e824e8ab0fadec9949ebb8b9e14d98703d6b8d44
"
}
substrate-build-script-utils
=
{
git
=
"https://github.com/paritytech/substrate"
,
rev
=
"
56cf04f289f9cd5e8bb96fe5bd23a923e21acf1c
"
}
[features]
default
=
[
"wasmtime"
,
"db"
,
"cli"
,
"service-old"
]
...
...
cli/src/command.rs
View file @
d88a8785
...
...
@@ -19,7 +19,7 @@ use log::info;
use
service
::{
IdentifyVariant
,
self
};
#[cfg(feature
=
"service-rewr"
)]
use
service_new
::{
IdentifyVariant
,
self
as
service
};
use
sc_cli
::{
CliConfiguration
,
SubstrateCli
,
Result
,
RuntimeVersion
,
Role
};
use
sc_cli
::{
SubstrateCli
,
Result
,
RuntimeVersion
,
Role
};
use
crate
::
cli
::{
Cli
,
Subcommand
};
fn
get_exec_name
()
->
Option
<
String
>
{
...
...
@@ -213,7 +213,7 @@ pub fn run() -> Result<()> {
}
},
Some
(
Subcommand
::
ValidationWorker
(
cmd
))
=>
{
sc_cli
::
init_logger
(
""
,
cli
.run.base
.log_rotation_opt
()
?
)
?
;
sc_cli
::
init_logger
(
""
)
;
if
cfg!
(
feature
=
"browser"
)
{
Err
(
sc_cli
::
Error
::
Input
(
"Cannot run validation worker in browser"
.into
()))
...
...
collator/Cargo.toml
View file @
d88a8785
...
...
@@ -7,16 +7,16 @@ edition = "2018"
[dependencies]
futures
=
"0.3.4"
sc-service
=
{
git
=
"https://github.com/paritytech/substrate"
,
rev
=
"
e824e8ab0fadec9949ebb8b9e14d98703d6b8d44
"
}
sc-executor
=
{
git
=
"https://github.com/paritytech/substrate"
,
rev
=
"
e824e8ab0fadec9949ebb8b9e14d98703d6b8d44
"
}
sc-cli
=
{
git
=
"https://github.com/paritytech/substrate"
,
rev
=
"
e824e8ab0fadec9949ebb8b9e14d98703d6b8d44
"
}
sc-client-api
=
{
git
=
"https://github.com/paritytech/substrate"
,
rev
=
"
e824e8ab0fadec9949ebb8b9e14d98703d6b8d44
"
}
sc-network
=
{
git
=
"https://github.com/paritytech/substrate"
,
rev
=
"
e824e8ab0fadec9949ebb8b9e14d98703d6b8d44
"
}
sp-blockchain
=
{
git
=
"https://github.com/paritytech/substrate"
,
rev
=
"
e824e8ab0fadec9949ebb8b9e14d98703d6b8d44
"
}
sp-api
=
{
git
=
"https://github.com/paritytech/substrate"
,
rev
=
"
e824e8ab0fadec9949ebb8b9e14d98703d6b8d44
"
}
sp-core
=
{
git
=
"https://github.com/paritytech/substrate"
,
rev
=
"
e824e8ab0fadec9949ebb8b9e14d98703d6b8d44
"
}
sp-runtime
=
{
git
=
"https://github.com/paritytech/substrate"
,
rev
=
"
e824e8ab0fadec9949ebb8b9e14d98703d6b8d44
"
}
consensus_common
=
{
package
=
"sp-consensus"
,
git
=
"https://github.com/paritytech/substrate"
,
rev
=
"
e824e8ab0fadec9949ebb8b9e14d98703d6b8d44
"
}
sc-service
=
{
git
=
"https://github.com/paritytech/substrate"
,
rev
=
"
56cf04f289f9cd5e8bb96fe5bd23a923e21acf1c
"
}
sc-executor
=
{
git
=
"https://github.com/paritytech/substrate"
,
rev
=
"
56cf04f289f9cd5e8bb96fe5bd23a923e21acf1c
"
}
sc-cli
=
{
git
=
"https://github.com/paritytech/substrate"
,
rev
=
"
56cf04f289f9cd5e8bb96fe5bd23a923e21acf1c
"
}
sc-client-api
=
{
git
=
"https://github.com/paritytech/substrate"
,
rev
=
"
56cf04f289f9cd5e8bb96fe5bd23a923e21acf1c
"
}
sc-network
=
{
git
=
"https://github.com/paritytech/substrate"
,
rev
=
"
56cf04f289f9cd5e8bb96fe5bd23a923e21acf1c
"
}
sp-blockchain
=
{
git
=
"https://github.com/paritytech/substrate"
,
rev
=
"
56cf04f289f9cd5e8bb96fe5bd23a923e21acf1c
"
}
sp-api
=
{
git
=
"https://github.com/paritytech/substrate"
,
rev
=
"
56cf04f289f9cd5e8bb96fe5bd23a923e21acf1c
"
}
sp-core
=
{
git
=
"https://github.com/paritytech/substrate"
,
rev
=
"
56cf04f289f9cd5e8bb96fe5bd23a923e21acf1c
"
}
sp-runtime
=
{
git
=
"https://github.com/paritytech/substrate"
,
rev
=
"
56cf04f289f9cd5e8bb96fe5bd23a923e21acf1c
"
}
consensus_common
=
{
package
=
"sp-consensus"
,
git
=
"https://github.com/paritytech/substrate"
,
rev
=
"
56cf04f289f9cd5e8bb96fe5bd23a923e21acf1c
"
}
polkadot-primitives
=
{
path
=
"../primitives"
}
polkadot-cli
=
{
path
=
"../cli"
}
polkadot-network
=
{
path
=
"../network"
}
...
...
@@ -29,7 +29,7 @@ futures-timer = "2.0"
codec
=
{
package
=
"parity-scale-codec"
,
version
=
"1.3.0"
}
[dev-dependencies]
keyring
=
{
package
=
"sp-keyring"
,
git
=
"https://github.com/paritytech/substrate"
,
rev
=
"
e824e8ab0fadec9949ebb8b9e14d98703d6b8d44
"
}
keyring
=
{
package
=
"sp-keyring"
,
git
=
"https://github.com/paritytech/substrate"
,
rev
=
"
56cf04f289f9cd5e8bb96fe5bd23a923e21acf1c
"
}
[features]
default
=
["service-old"]
...
...
collator/src/lib.rs
View file @
d88a8785
...
...
@@ -55,12 +55,11 @@ use log::warn;
use
sc_client_api
::{
StateBackend
,
BlockchainEvents
};
use
sp_blockchain
::
HeaderBackend
;
use
sp_core
::
Pair
;
use
polkadot_primitives
::{
use
polkadot_primitives
::
v0
::
{
BlockId
,
Hash
,
Block
,
DownwardMessage
,
parachain
::{
self
,
BlockData
,
DutyRoster
,
HeadData
,
Id
as
ParaId
,
PoVBlock
,
ValidatorId
,
CollatorPair
,
LocalValidationData
,
GlobalValidationSchedule
,
}
BlockData
,
DutyRoster
,
HeadData
,
Id
as
ParaId
,
PoVBlock
,
ValidatorId
,
CollatorPair
,
LocalValidationData
,
GlobalValidationSchedule
,
Collation
,
CollationInfo
,
collator_signature_payload
,
};
use
polkadot_cli
::{
ProvideRuntimeApi
,
ParachainHost
,
IdentifyVariant
,
...
...
@@ -69,7 +68,7 @@ use polkadot_cli::{
pub
use
polkadot_cli
::
service
::
Configuration
;
pub
use
polkadot_cli
::
Cli
;
pub
use
polkadot_validation
::
SignedStatement
;
pub
use
polkadot_primitives
::
parachain
::
CollatorId
;
pub
use
polkadot_primitives
::
v0
::
CollatorId
;
pub
use
sc_network
::
PeerId
;
pub
use
service
::
RuntimeApiCollection
;
pub
use
sc_cli
::
SubstrateCli
;
...
...
@@ -164,7 +163,7 @@ pub async fn collate<P>(
downward_messages
:
Vec
<
DownwardMessage
>
,
mut
para_context
:
P
,
key
:
Arc
<
CollatorPair
>
,
)
->
Option
<
parachain
::
Collation
>
)
->
Option
<
Collation
>
where
P
:
ParachainContext
,
P
::
ProduceCandidate
:
Send
,
...
...
@@ -181,13 +180,13 @@ pub async fn collate<P>(
};
let
pov_block_hash
=
pov_block
.hash
();
let
signature
=
key
.sign
(
&
parachain
::
collator_signature_payload
(
let
signature
=
key
.sign
(
&
collator_signature_payload
(
&
relay_parent
,
&
local_id
,
&
pov_block_hash
,
));
let
info
=
parachain
::
CollationInfo
{
let
info
=
CollationInfo
{
parachain_index
:
local_id
,
relay_parent
,
collator
:
key
.public
(),
...
...
@@ -196,7 +195,7 @@ pub async fn collate<P>(
pov_block_hash
,
};
let
collation
=
parachain
::
Collation
{
let
collation
=
Collation
{
info
,
pov
:
pov_block
,
};
...
...
@@ -456,7 +455,7 @@ where
#[cfg(not(feature
=
"service-rewr"
))]
fn
compute_targets
(
para_id
:
ParaId
,
session_keys
:
&
[
ValidatorId
],
roster
:
DutyRoster
)
->
HashSet
<
ValidatorId
>
{
use
polkadot_primitives
::
parachain
::
Chain
;
use
polkadot_primitives
::
v0
::
Chain
;
roster
.validator_duty
.iter
()
.enumerate
()
.filter
(|
&
(
_
,
c
)|
c
==
&
Chain
::
Parachain
(
para_id
))
...
...
core-primitives/Cargo.toml
View file @
d88a8785
...
...
@@ -5,9 +5,9 @@ authors = ["Parity Technologies <admin@parity.io>"]
edition
=
"2018"
[dependencies]
sp-core
=
{
git
=
"https://github.com/paritytech/substrate"
,
rev
=
"
e824e8ab0fadec9949ebb8b9e14d98703d6b8d44
"
,
default-features
=
false
}
sp-std
=
{
git
=
"https://github.com/paritytech/substrate"
,
rev
=
"
e824e8ab0fadec9949ebb8b9e14d98703d6b8d44
"
,
default-features
=
false
}
sp-runtime
=
{
git
=
"https://github.com/paritytech/substrate"
,
rev
=
"
e824e8ab0fadec9949ebb8b9e14d98703d6b8d44
"
,
default-features
=
false
}
sp-core
=
{
git
=
"https://github.com/paritytech/substrate"
,
rev
=
"
56cf04f289f9cd5e8bb96fe5bd23a923e21acf1c
"
,
default-features
=
false
}
sp-std
=
{
git
=
"https://github.com/paritytech/substrate"
,
rev
=
"
56cf04f289f9cd5e8bb96fe5bd23a923e21acf1c
"
,
default-features
=
false
}
sp-runtime
=
{
git
=
"https://github.com/paritytech/substrate"
,
rev
=
"
56cf04f289f9cd5e8bb96fe5bd23a923e21acf1c
"
,
default-features
=
false
}
codec
=
{
package
=
"parity-scale-codec"
,
version
=
"1.3.0"
,
default-features
=
false
,
features
=
[
"derive"
]
}
[features]
...
...
core-primitives/src/lib.rs
View file @
d88a8785
...
...
@@ -94,3 +94,8 @@ pub enum DownwardMessage<AccountId = crate::AccountId> {
/// XCMP message for the Parachain.
XCMPMessage
(
sp_std
::
vec
::
Vec
<
u8
>
),
}
/// V1 primitives.
pub
mod
v1
{
pub
use
super
::
*
;
}
erasure-coding/Cargo.toml
View file @
d88a8785
...
...
@@ -8,6 +8,6 @@ edition = "2018"
primitives
=
{
package
=
"polkadot-primitives"
,
path
=
"../primitives"
}
reed_solomon
=
{
package
=
"reed-solomon-erasure"
,
version
=
"4.0.2"
}
codec
=
{
package
=
"parity-scale-codec"
,
version
=
"1.3.0"
,
default-features
=
false
,
features
=
["derive"]
}
sp-core
=
{
git
=
"https://github.com/paritytech/substrate"
,
rev
=
"
e824e8ab0fadec9949ebb8b9e14d98703d6b8d44
"
}
trie
=
{
package
=
"sp-trie"
,
git
=
"https://github.com/paritytech/substrate"
,
rev
=
"
e824e8ab0fadec9949ebb8b9e14d98703d6b8d44
"
}
sp-core
=
{
git
=
"https://github.com/paritytech/substrate"
,
rev
=
"
56cf04f289f9cd5e8bb96fe5bd23a923e21acf1c
"
}
trie
=
{
package
=
"sp-trie"
,
git
=
"https://github.com/paritytech/substrate"
,
rev
=
"
56cf04f289f9cd5e8bb96fe5bd23a923e21acf1c
"
}
derive_more
=
"0.15.0"
erasure-coding/src/lib.rs
View file @
d88a8785
...
...
@@ -26,8 +26,8 @@
use
codec
::{
Encode
,
Decode
};
use
reed_solomon
::
galois_16
::{
self
,
ReedSolomon
};
use
primitives
::
{
Hash
as
H256
,
BlakeTwo256
,
HashT
};
use
primitives
::
parachain
::
AvailableData
;
use
primitives
::
v0
::{
self
,
Hash
as
H256
,
BlakeTwo256
,
HashT
};
use
primitives
::
v1
;
use
sp_core
::
Blake2Hasher
;
use
trie
::{
EMPTY_PREFIX
,
MemoryDB
,
Trie
,
TrieMut
,
trie_types
::{
TrieDBMut
,
TrieDB
}};
...
...
@@ -124,14 +124,32 @@ fn code_params(n_validators: usize) -> Result<CodeParams, Error> {
})
}
/// Obtain erasure-coded chunks for v0 `AvailableData`, one for each validator.
///
/// Works only up to 65536 validators, and `n_validators` must be non-zero.
pub
fn
obtain_chunks_v0
(
n_validators
:
usize
,
data
:
&
v0
::
AvailableData
)
->
Result
<
Vec
<
Vec
<
u8
>>
,
Error
>
{
obtain_chunks
(
n_validators
,
data
)
}
/// Obtain erasure-coded chunks for v1 `AvailableData`, one for each validator.
///
/// Works only up to 65536 validators, and `n_validators` must be non-zero.
pub
fn
obtain_chunks_v1
(
n_validators
:
usize
,
data
:
&
v1
::
AvailableData
)
->
Result
<
Vec
<
Vec
<
u8
>>
,
Error
>
{
obtain_chunks
(
n_validators
,
data
)
}
/// Obtain erasure-coded chunks, one for each validator.
///
/// Works only up to 65536 validators, and `n_validators` must be non-zero.
pub
fn
obtain_chunks
(
n_validators
:
usize
,
available_data
:
&
AvailableData
)
fn
obtain_chunks
<
T
:
Encode
>
(
n_validators
:
usize
,
data
:
&
T
)
->
Result
<
Vec
<
Vec
<
u8
>>
,
Error
>
{
let
params
=
code_params
(
n_validators
)
?
;
let
encoded
=
available_
data
.encode
();
let
encoded
=
data
.encode
();
if
encoded
.is_empty
()
{
return
Err
(
Error
::
BadPayload
);
...
...
@@ -145,15 +163,42 @@ pub fn obtain_chunks(n_validators: usize, available_data: &AvailableData)
Ok
(
shards
.into_iter
()
.map
(|
w
|
w
.into_inner
())
.collect
())
}
/// Reconstruct the block data from a set of chunks.
/// Reconstruct the v0 available data from a set of chunks.
///
/// Provide an iterator containing chunk data and the corresponding index.
/// The indices of the present chunks must be indicated. If too few chunks
/// are provided, recovery is not possible.
///
/// Works only up to 65536 validators, and `n_validators` must be non-zero.
pub
fn
reconstruct_v0
<
'a
,
I
:
'a
>
(
n_validators
:
usize
,
chunks
:
I
)
->
Result
<
v0
::
AvailableData
,
Error
>
where
I
:
IntoIterator
<
Item
=
(
&
'a
[
u8
],
usize
)
>
{
reconstruct
(
n_validators
,
chunks
)
}
/// Reconstruct the v1 available data from a set of chunks.
///
/// Provide an iterator containing chunk data and the corresponding index.
/// The indices of the present chunks must be indicated. If too few chunks
/// are provided, recovery is not possible.
///
/// Works only up to 65536 validators, and `n_validators` must be non-zero.
pub
fn
reconstruct_v1
<
'a
,
I
:
'a
>
(
n_validators
:
usize
,
chunks
:
I
)
->
Result
<
v1
::
AvailableData
,
Error
>
where
I
:
IntoIterator
<
Item
=
(
&
'a
[
u8
],
usize
)
>
{
reconstruct
(
n_validators
,
chunks
)
}
/// Reconstruct decodable data from a set of chunks.
///
/// Provide an iterator containing chunk data and the corresponding index.
/// The indices of the present chunks must be indicated. If too few chunks
/// are provided, recovery is not possible.
///
/// Works only up to 65536 validators, and `n_validators` must be non-zero.
pub
fn
reconstruct
<
'a
,
I
:
'a
>
(
n_validators
:
usize
,
chunks
:
I
)
->
Result
<
AvailableData
,
Error
>
fn
reconstruct
<
'a
,
I
:
'a
,
T
:
Decode
>
(
n_validators
:
usize
,
chunks
:
I
)
->
Result
<
T
,
Error
>
where
I
:
IntoIterator
<
Item
=
(
&
'a
[
u8
],
usize
)
>
{
let
params
=
code_params
(
n_validators
)
?
;
...
...
@@ -343,7 +388,7 @@ impl<'a, I: Iterator<Item=&'a [u8]>> codec::Input for ShardInput<'a, I> {
#[cfg(test)]
mod
tests
{
use
super
::
*
;
use
primitives
::
parachain
::{
BlockData
,
PoVBlock
};
use
primitives
::
v0
::{
AvailableData
,
BlockData
,
PoVBlock
};
#[test]
fn
field_order_is_right_size
()
{
...
...
@@ -420,7 +465,7 @@ mod tests {
assert_eq!
(
chunks
.len
(),
10
);
// any 4 chunks should work.
let
reconstructed
=
reconstruct
(
let
reconstructed
:
AvailableData
=
reconstruct
(
10
,
[
(
&*
chunks
[
1
],
1
),
...
...
network/Cargo.toml
View file @
d88a8785
...
...
@@ -15,19 +15,19 @@ polkadot-validation = { path = "../validation" }
polkadot-primitives
=
{
path
=
"../primitives"
}
polkadot-erasure-coding
=
{
path
=
"../erasure-coding"
}
codec
=
{
package
=
"parity-scale-codec"
,
version
=
"1.3.0"
,
default-features
=
false
,
features
=
["derive"]
}
sc-network
=
{
git
=
"https://github.com/paritytech/substrate"
,
rev
=
"
e824e8ab0fadec9949ebb8b9e14d98703d6b8d44
"
}
sc-network-gossip
=
{
git
=
"https://github.com/paritytech/substrate"
,
rev
=
"
e824e8ab0fadec9949ebb8b9e14d98703d6b8d44
"
}
sp-core
=
{
git
=
"https://github.com/paritytech/substrate"
,
rev
=
"
e824e8ab0fadec9949ebb8b9e14d98703d6b8d44
"
}
sp-runtime
=
{
git
=
"https://github.com/paritytech/substrate"
,
rev
=
"
e824e8ab0fadec9949ebb8b9e14d98703d6b8d44
"
}
sc-network
=
{
git
=
"https://github.com/paritytech/substrate"
,
rev
=
"
56cf04f289f9cd5e8bb96fe5bd23a923e21acf1c
"
}
sc-network-gossip
=
{
git
=
"https://github.com/paritytech/substrate"
,
rev
=
"
56cf04f289f9cd5e8bb96fe5bd23a923e21acf1c
"
}
sp-core
=
{
git
=
"https://github.com/paritytech/substrate"
,
rev
=
"
56cf04f289f9cd5e8bb96fe5bd23a923e21acf1c
"
}
sp-runtime
=
{
git
=
"https://github.com/paritytech/substrate"
,
rev
=
"
56cf04f289f9cd5e8bb96fe5bd23a923e21acf1c
"
}
futures
=
"0.3.5"
log
=
"0.4.8"
exit-future
=
"0.2.0"
futures-timer
=
"2.0"
sp-blockchain
=
{
git
=
"https://github.com/paritytech/substrate"
,
rev
=
"
e824e8ab0fadec9949ebb8b9e14d98703d6b8d44
"
}
sp-api
=
{
git
=
"https://github.com/paritytech/substrate"
,
rev
=
"
e824e8ab0fadec9949ebb8b9e14d98703d6b8d44
"
}
sp-blockchain
=
{
git
=
"https://github.com/paritytech/substrate"
,
rev
=
"
56cf04f289f9cd5e8bb96fe5bd23a923e21acf1c
"
}
sp-api
=
{
git
=
"https://github.com/paritytech/substrate"
,
rev
=
"
56cf04f289f9cd5e8bb96fe5bd23a923e21acf1c
"
}
wasm-timer
=
"0.2.4"
rand
=
"0.7.3"
[dev-dependencies]
sp-keyring
=
{
git
=
"https://github.com/paritytech/substrate"
,
rev
=
"
e824e8ab0fadec9949ebb8b9e14d98703d6b8d44
"
}
sp-state-machine
=
{
git
=
"https://github.com/paritytech/substrate"
,
rev
=
"
e824e8ab0fadec9949ebb8b9e14d98703d6b8d44
"
}
sp-keyring
=
{
git
=
"https://github.com/paritytech/substrate"
,
rev
=
"
56cf04f289f9cd5e8bb96fe5bd23a923e21acf1c
"
}
sp-state-machine
=
{
git
=
"https://github.com/paritytech/substrate"
,
rev
=
"
56cf04f289f9cd5e8bb96fe5bd23a923e21acf1c
"
}
network/src/legacy/collator_pool.rs
View file @
d88a8785
...
...
@@ -17,8 +17,7 @@
//! Bridge between the network and consensus service for getting collations to it.
use
codec
::{
Encode
,
Decode
};
use
polkadot_primitives
::
Hash
;
use
polkadot_primitives
::
parachain
::{
CollatorId
,
Id
as
ParaId
,
Collation
};
use
polkadot_primitives
::
v0
::{
Hash
,
CollatorId
,
Id
as
ParaId
,
Collation
};
use
sc_network
::
PeerId
;
use
futures
::
channel
::
oneshot
;
...
...
@@ -236,7 +235,7 @@ impl CollatorPool {
mod
tests
{
use
super
::
*
;
use
sp_core
::
crypto
::
UncheckedInto
;
use
polkadot_primitives
::
parachain
::{
CollationInfo
,
BlockData
,
PoVBlock
};
use
polkadot_primitives
::
v0
::{
CollationInfo
,
BlockData
,
PoVBlock
};
use
futures
::
executor
::
block_on
;
fn
make_pov
(
block_data
:
Vec
<
u8
>
)
->
PoVBlock
{
...
...
network/src/legacy/gossip/attestation.rs
View file @
d88a8785
...
...
@@ -33,7 +33,7 @@
use
sc_network_gossip
::{
ValidationResult
as
GossipValidationResult
};
use
sc_network
::
ReputationChange
;
use
polkadot_validation
::
GenericStatement
;
use
polkadot_primitives
::
Hash
;
use
polkadot_primitives
::
v0
::
Hash
;
use
std
::
collections
::
HashMap
;
...
...
network/src/legacy/gossip/mod.rs
View file @
d88a8785
...
...
@@ -58,8 +58,8 @@ use sc_network_gossip::{
ValidatorContext
,
MessageIntent
,
};
use
polkadot_validation
::{
SignedStatement
};
use
polkadot_primitives
::
{
Block
,
Hash
};
use
polkadot_primitives
::
parachain
::{
use
polkadot_primitives
::
v0
::{
Block
,
Hash
,
ParachainHost
,
ValidatorId
,
ErasureChunk
as
PrimitiveChunk
,
SigningContext
,
PoVBlock
,
};
use
polkadot_erasure_coding
::{
self
as
erasure
};
...
...
@@ -755,7 +755,7 @@ mod tests {
use
sc_network_gossip
::
Validator
as
ValidatorT
;
use
std
::
sync
::
mpsc
;
use
parking_lot
::
Mutex
;
use
polkadot_primitives
::
parachain
::{
AbridgedCandidateReceipt
,
BlockData
};
use
polkadot_primitives
::
v0
::{
AbridgedCandidateReceipt
,
BlockData
};
use
sp_core
::
sr25519
::
Signature
as
Sr25519Signature
;
use
polkadot_validation
::
GenericStatement
;
...
...
network/src/legacy/local_collations.rs
View file @
d88a8785
...
...
@@ -19,7 +19,7 @@
//! Collations are attempted to be repropagated when a new validator connects,
//! a validator changes his session key, or when they are generated.
use
polkadot_primitives
::{
Hash
,
parachain
::{
ValidatorId
}
}
;
use
polkadot_primitives
::
v0
::
{
Hash
,
ValidatorId
};
use
crate
::
legacy
::
collator_pool
::
Role
;
use
std
::
collections
::{
HashMap
,
HashSet
};
use
std
::
time
::
Duration
;
...
...
@@ -144,7 +144,7 @@ impl<C: Clone> LocalCollations<C> {
mod
tests
{
use
super
::
*
;
use
sp_core
::
crypto
::
UncheckedInto
;
use
polkadot_primitives
::
parachain
::
ValidatorId
;
use
polkadot_primitives
::
v0
::
ValidatorId
;
#[test]
fn
add_validator_with_ready_collation
()
{
...
...
Prev
1
2
3
4
5
6
Next
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