Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
parity
Mirrored projects
polkadot
Commits
fec0e492
Unverified
Commit
fec0e492
authored
Oct 27, 2020
by
Bernhard Schuster
Committed by
GitHub
Oct 27, 2020
Browse files
introduce errors with info (#1834)
parent
56492295
Pipeline
#112040
passed with stages
in 26 minutes and 36 seconds
Changes
58
Pipelines
1
Expand all
Hide whitespace changes
Inline
Side-by-side
Cargo.lock
View file @
fec0e492
This diff is collapsed.
Click to expand it.
cli/Cargo.toml
View file @
fec0e492
...
...
@@ -14,19 +14,12 @@ wasm-opt = false
crate-type
=
[
"cdylib"
,
"rlib"
]
[dependencies]
log
=
"0.4.8"
futures
=
{
version
=
"0.3.4"
,
features
=
["compat"]
}
structopt
=
"0.3.8"
sp-api
=
{
git
=
"https://github.com/paritytech/substrate"
,
branch
=
"master"
}
log
=
"0.4.11"
structopt
=
{
version
=
"0.3.8"
,
optional
=
true
}
sp-core
=
{
git
=
"https://github.com/paritytech/substrate"
,
branch
=
"master"
}
sp-runtime
=
{
git
=
"https://github.com/paritytech/substrate"
,
branch
=
"master"
}
sc-client-api
=
{
git
=
"https://github.com/paritytech/substrate"
,
branch
=
"master"
}
sc-client-db
=
{
git
=
"https://github.com/paritytech/substrate"
,
branch
=
"master"
}
sc-executor
=
{
git
=
"https://github.com/paritytech/substrate"
,
branch
=
"master"
}
sc-tracing
=
{
git
=
"https://github.com/paritytech/substrate"
,
branch
=
"master"
}
service
=
{
package
=
"polkadot-service"
,
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"
,
branch
=
"master"
,
optional
=
true
}
sc-cli
=
{
git
=
"https://github.com/paritytech/substrate"
,
branch
=
"master"
,
optional
=
true
}
sc-service
=
{
git
=
"https://github.com/paritytech/substrate"
,
branch
=
"master"
,
optional
=
true
}
...
...
@@ -46,7 +39,7 @@ default = [ "wasmtime", "db", "cli", "full-node", "trie-memory-tracker" ]
wasmtime
=
[
"sc-cli/wasmtime"
]
db
=
[
"service/db"
]
cli
=
[
"
tokio
"
,
"
structopt
"
,
"sc-cli"
,
"sc-service"
,
"frame-benchmarking-cli"
,
...
...
cli/src/lib.rs
View file @
fec0e492
...
...
@@ -17,7 +17,6 @@
//! Polkadot CLI library.
#![warn(missing_docs)]
#![warn(unused_extern_crates)]
#[cfg(feature
=
"browser"
)]
mod
browser
;
...
...
erasure-coding/Cargo.toml
View file @
fec0e492
...
...
@@ -10,4 +10,4 @@ reed_solomon = { package = "reed-solomon-erasure", version = "4.0.2"}
codec
=
{
package
=
"parity-scale-codec"
,
version
=
"1.3.4"
,
default-features
=
false
,
features
=
["derive"]
}
sp-core
=
{
git
=
"https://github.com/paritytech/substrate"
,
branch
=
"master"
}
trie
=
{
package
=
"sp-trie"
,
git
=
"https://github.com/paritytech/substrate"
,
branch
=
"master"
}
derive_m
or
e
=
"
0.15.0
"
thiserr
or
=
"
1.0.21
"
erasure-coding/src/lib.rs
View file @
fec0e492
...
...
@@ -30,6 +30,7 @@ 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
}};
use
thiserror
::
Error
;
use
self
::
wrapped_shard
::
WrappedShard
;
...
...
@@ -39,35 +40,43 @@ mod wrapped_shard;
const
MAX_VALIDATORS
:
usize
=
<
galois_16
::
Field
as
reed_solomon
::
Field
>
::
ORDER
;
/// Errors in erasure coding.
#[derive(Debug,
Clone,
PartialEq,
derive_more::Display
)]
#[derive(Debug,
Clone,
PartialEq,
Error
)]
pub
enum
Error
{
/// Returned when there are too many validators.
#[error(
"There are too many validators"
)]
TooManyValidators
,
/// Cannot encode something for no validators
#[error(
"Validator set is empty"
)]
EmptyValidators
,
/// Cannot reconstruct: wrong number of validators.
#[error(
"Validator count mismatches between encoding and decoding"
)]
WrongValidatorCount
,
/// Not enough chunks present.
#[error(
"Not enough chunks to reconstruct message"
)]
NotEnoughChunks
,
/// Too many chunks present.
#[error(
"Too many chunks present"
)]
TooManyChunks
,
/// Chunks not of uniform length or the chunks are empty.
#[error(
"Chunks are not unform, mismatch in length or are zero sized"
)]
NonUniformChunks
,
/// An uneven byte-length of a shard is not valid for GF(2^16) encoding.
#[error(
"Uneven length is not valid for field GF(2^16)"
)]
UnevenLength
,
/// Chunk index out of bounds.
#[
display(fmt
=
"Chunk is out of bounds: {
} {}"
,
_0,
_1
)]
ChunkIndexOutOfBounds
(
usize
,
usize
)
,
#[
error(
"Chunk is out of bounds: {
chunk_index} not included in 0..{n_validators}"
)]
ChunkIndexOutOfBounds
{
chunk_index
:
usize
,
n_validators
:
usize
}
,
/// Bad payload in reconstructed bytes.
#[error(
"Reconstructed payload invalid"
)]
BadPayload
,
/// Invalid branch proof.
#[error(
"Invalid branch proof"
)]
InvalidBranchProof
,
/// Branch out of bounds.
#[error(
"Branch is out of bounds"
)]
BranchOutOfBounds
,
}
impl
std
::
error
::
Error
for
Error
{
}
#[derive(Debug,
PartialEq)]
struct
CodeParams
{
data_shards
:
usize
,
...
...
@@ -206,7 +215,7 @@ fn reconstruct<'a, I: 'a, T: Decode>(n_validators: usize, chunks: I) -> Result<T
let
mut
shard_len
=
None
;
for
(
chunk_data
,
chunk_idx
)
in
chunks
.into_iter
()
.take
(
n_validators
)
{
if
chunk_idx
>=
n_validators
{
return
Err
(
Error
::
ChunkIndexOutOfBounds
(
chunk_idx
,
n_validators
)
);
return
Err
(
Error
::
ChunkIndexOutOfBounds
{
chunk_index
:
chunk_idx
,
n_validators
}
);
}
let
shard_len
=
shard_len
.get_or_insert_with
(||
chunk_data
.len
());
...
...
node/collation-generation/Cargo.toml
View file @
fec0e492
...
...
@@ -5,7 +5,6 @@ authors = ["Parity Technologies <admin@parity.io>"]
edition
=
"2018"
[dependencies]
derive_more
=
"0.99.9"
futures
=
"0.3.5"
log
=
"0.4.8"
polkadot-erasure-coding
=
{
path
=
"../../erasure-coding"
}
...
...
@@ -14,6 +13,7 @@ polkadot-node-subsystem = { path = "../subsystem" }
polkadot-node-subsystem-util
=
{
path
=
"../subsystem-util"
}
polkadot-primitives
=
{
path
=
"../../primitives"
}
sp-core
=
{
git
=
"https://github.com/paritytech/substrate"
,
branch
=
"master"
}
thiserror
=
"1.0.21"
[dev-dependencies]
polkadot-node-subsystem-test-helpers
=
{
path
=
"../subsystem-test-helpers"
}
node/collation-generation/src/error.rs
View file @
fec0e492
...
...
@@ -14,19 +14,20 @@
// You should have received a copy of the GNU General Public License
// along with Polkadot. If not, see <http://www.gnu.org/licenses/>.
use
thiserror
::
Error
;
#[derive(Debug,
derive_more::F
ro
m
)]
#[derive(Debug,
Er
ro
r
)]
pub
enum
Error
{
#[
from
]
Subsystem
(
polkadot_node_subsystem
::
SubsystemError
),
#[
from
]
OneshotRecv
(
futures
::
channel
::
oneshot
::
Canceled
),
#[
from
]
Runtime
(
polkadot_node_subsystem
::
errors
::
RuntimeApiError
),
#[
from
]
Util
(
polkadot_node_subsystem_util
::
Error
),
#[
from
]
Erasure
(
polkadot_erasure_coding
::
Error
),
#[
error(transparent)
]
Subsystem
(
#[from]
polkadot_node_subsystem
::
SubsystemError
),
#[
error(transparent)
]
OneshotRecv
(
#[from]
futures
::
channel
::
oneshot
::
Canceled
),
#[
error(transparent)
]
Runtime
(
#[from]
polkadot_node_subsystem
::
errors
::
RuntimeApiError
),
#[
error(transparent)
]
Util
(
#[from]
polkadot_node_subsystem_util
::
Error
),
#[
error(transparent)
]
Erasure
(
#[from]
polkadot_erasure_coding
::
Error
),
}
pub
type
Result
<
T
>
=
std
::
result
::
Result
<
T
,
Error
>
;
node/core/av-store/Cargo.toml
View file @
fec0e492
...
...
@@ -5,12 +5,12 @@ authors = ["Parity Technologies <admin@parity.io>"]
edition
=
"2018"
[dependencies]
derive_more
=
"0.99.9"
futures
=
"0.3.5"
futures-timer
=
"3.0.2"
kvdb
=
"0.7.0"
kvdb-rocksdb
=
"0.9.1"
log
=
"0.4.8"
log
=
"0.4.11"
thiserror
=
"1.0.21"
codec
=
{
package
=
"parity-scale-codec"
,
version
=
"1.3.1"
,
features
=
["derive"]
}
erasure
=
{
package
=
"polkadot-erasure-coding"
,
path
=
"../../../erasure-coding"
}
...
...
node/core/av-store/src/lib.rs
View file @
fec0e492
...
...
@@ -44,6 +44,7 @@ use polkadot_node_subsystem_util::metrics::{self, prometheus};
use
polkadot_subsystem
::
messages
::{
AllMessages
,
AvailabilityStoreMessage
,
ChainApiMessage
,
RuntimeApiMessage
,
RuntimeApiRequest
,
};
use
thiserror
::
Error
;
const
LOG_TARGET
:
&
str
=
"availability"
;
...
...
@@ -53,22 +54,22 @@ mod columns {
pub
const
NUM_COLUMNS
:
u32
=
2
;
}
#[derive(Debug,
derive_more::F
ro
m
)]
#[derive(Debug,
Er
ro
r
)]
enum
Error
{
#[
from
]
Chain
(
Chain
ApiError
),
#[
from
]
Erasure
(
erasure
::
Error
),
#[
from
]
Io
(
io
::
Error
),
#[
from
]
Oneshot
(
oneshot
::
Canceled
),
#[
from
]
Runtime
(
RuntimeApiError
),
#[
from
]
Subsystem
(
SubsystemError
),
#[
from
]
Time
(
SystemTimeError
),
#[
error(transparent)
]
RuntimeAPI
(
#[from]
Runtime
ApiError
),
#[
error(transparent)
]
ChainAPI
(
#[from]
ChainApi
Error
),
#[
error(transparent)
]
Erasure
(
#[from]
erasure
::
Error
),
#[
error(transparent)
]
Io
(
#[from]
io
::
Error
),
#[
error(transparent)
]
Oneshot
(
#[from]
oneshot
::
Canceled
),
#[
error(transparent)
]
Subsystem
(
#[from]
SubsystemError
),
#[
error(transparent)
]
Time
(
#[from]
SystemTimeError
),
}
/// A wrapper type for delays.
...
...
node/core/backing/Cargo.toml
View file @
fec0e492
...
...
@@ -6,19 +6,16 @@ edition = "2018"
[dependencies]
futures
=
"0.3.5"
sp-api
=
{
git
=
"https://github.com/paritytech/substrate"
,
branch
=
"master"
}
sp-keystore
=
{
git
=
"https://github.com/paritytech/substrate"
,
branch
=
"master"
}
sc-client-api
=
{
git
=
"https://github.com/paritytech/substrate"
,
branch
=
"master"
}
sp-blockchain
=
{
git
=
"https://github.com/paritytech/substrate"
,
branch
=
"master"
}
polkadot-primitives
=
{
path
=
"../../../primitives"
}
polkadot-node-primitives
=
{
path
=
"../../primitives"
}
polkadot-subsystem
=
{
package
=
"polkadot-node-subsystem"
,
path
=
"../../subsystem"
}
polkadot-node-subsystem-util
=
{
path
=
"../../subsystem-util"
}
erasure-coding
=
{
package
=
"polkadot-erasure-coding"
,
path
=
"../../../erasure-coding"
}
statement-table
=
{
package
=
"polkadot-statement-table"
,
path
=
"../../../statement-table"
}
derive_more
=
"0.99.9"
bitvec
=
{
version
=
"0.17.4"
,
default-features
=
false
,
features
=
["alloc"]
}
log
=
"0.4.8"
log
=
"0.4.11"
thiserror
=
"1.0.21"
[dev-dependencies]
sp-core
=
{
git
=
"https://github.com/paritytech/substrate"
,
branch
=
"master"
}
...
...
node/core/backing/src/lib.rs
View file @
fec0e492
...
...
@@ -16,6 +16,8 @@
//! Implements a `CandidateBackingSubsystem`.
#![deny(unused_crate_dependencies)]
use
std
::
collections
::{
HashMap
,
HashSet
};
use
std
::
convert
::
TryFrom
;
use
std
::
pin
::
Pin
;
...
...
@@ -64,22 +66,26 @@ use statement_table::{
SignedStatement
as
TableSignedStatement
,
Summary
as
TableSummary
,
},
};
use
thiserror
::
Error
;
#[derive(Debug,
derive_more::F
ro
m
)]
#[derive(Debug,
Er
ro
r
)]
enum
Error
{
#[error(
"Candidate is not found"
)]
CandidateNotFound
,
#[error(
"Signature is invalid"
)]
InvalidSignature
,
StoreFailed
,
#[from]
Erasure
(
erasure_coding
::
Error
),
#[from]
ValidationFailed
(
ValidationFailed
),
#[from]
Oneshot
(
oneshot
::
Canceled
),
#[from]
Mpsc
(
mpsc
::
SendError
),
#[from]
UtilError
(
util
::
Error
),
#[error(
"Failed to send candidates {0:?}"
)]
Send
(
Vec
<
NewBackedCandidate
>
),
#[error(
"Oneshot never resolved"
)]
Oneshot
(
#[from]
#[source]
oneshot
::
Canceled
),
#[error(
"Obtaining erasure chunks failed"
)]
ObtainErasureChunks
(
#[from]
#[source]
erasure_coding
::
Error
),
#[error(transparent)]
ValidationFailed
(
#[from]
ValidationFailed
),
#[error(transparent)]
Mpsc
(
#[from]
mpsc
::
SendError
),
#[error(transparent)]
UtilError
(
#[from]
util
::
Error
),
}
/// Holds all data needed for candidate backing job operation.
...
...
@@ -468,7 +474,7 @@ impl CandidateBackingJob {
CandidateBackingMessage
::
GetBackedCandidates
(
_
,
tx
)
=>
{
let
backed
=
self
.get_backed
();
tx
.send
(
backed
)
.map_err
(|
_
|
oneshot
::
Canceled
)
?
;
tx
.send
(
backed
)
.map_err
(|
data
|
Error
::
Send
(
data
)
)
?
;
}
}
...
...
@@ -640,7 +646,7 @@ impl CandidateBackingJob {
)
)
.await
?
;
rx
.await
?
.map_err
(|
_
|
Error
::
StoreFailed
)
?
;
let
_
=
rx
.await
?
;
Ok
(())
}
...
...
node/core/bitfield-signing/Cargo.toml
View file @
fec0e492
...
...
@@ -6,11 +6,11 @@ edition = "2018"
[dependencies]
bitvec
=
"0.17.4"
derive_more
=
"0.99.9"
futures
=
"0.3.5"
log
=
"0.4.
8
"
log
=
"0.4.
11
"
polkadot-primitives
=
{
path
=
"../../../primitives"
}
polkadot-node-subsystem
=
{
path
=
"../../subsystem"
}
polkadot-node-subsystem-util
=
{
path
=
"../../subsystem-util"
}
sp-keystore
=
{
git
=
"https://github.com/paritytech/substrate"
,
branch
=
"master"
}
wasm-timer
=
"0.2.4"
thiserror
=
"1.0.21"
node/core/bitfield-signing/src/lib.rs
View file @
fec0e492
...
...
@@ -16,6 +16,9 @@
//! The bitfield signing subsystem produces `SignedAvailabilityBitfield`s once per block.
#![deny(unused_crate_dependencies,
unused_results)]
#![warn(missing_docs)]
use
bitvec
::
bitvec
;
use
futures
::{
channel
::{
mpsc
,
oneshot
},
...
...
@@ -37,6 +40,7 @@ use polkadot_node_subsystem_util::{
use
polkadot_primitives
::
v1
::{
AvailabilityBitfield
,
CoreState
,
Hash
,
ValidatorIndex
};
use
std
::{
convert
::
TryFrom
,
pin
::
Pin
,
time
::
Duration
};
use
wasm_timer
::{
Delay
,
Instant
};
use
thiserror
::
Error
;
/// Delay between starting a bitfield signing job and its attempting to create a bitfield.
const
JOB_DELAY
:
Duration
=
Duration
::
from_millis
(
1500
);
...
...
@@ -45,6 +49,7 @@ const JOB_DELAY: Duration = Duration::from_millis(1500);
pub
struct
BitfieldSigningJob
;
/// Messages which a `BitfieldSigningJob` is prepared to receive.
#[allow(missing_docs)]
pub
enum
ToJob
{
BitfieldSigning
(
BitfieldSigningMessage
),
Stop
,
...
...
@@ -79,6 +84,7 @@ impl From<BitfieldSigningMessage> for ToJob {
}
/// Messages which may be sent from a `BitfieldSigningJob`.
#[allow(missing_docs)]
pub
enum
FromJob
{
AvailabilityStore
(
AvailabilityStoreMessage
),
BitfieldDistribution
(
BitfieldDistributionMessage
),
...
...
@@ -112,28 +118,28 @@ impl TryFrom<AllMessages> for FromJob {
}
/// Errors we may encounter in the course of executing the `BitfieldSigningSubsystem`.
#[derive(Debug,
derive_more::F
ro
m
)]
#[derive(Debug,
Er
ro
r
)]
pub
enum
Error
{
/// error propagated from the utility subsystem
#[
from
]
Util
(
util
::
Error
),
#[
error(transparent)
]
Util
(
#[from]
util
::
Error
),
/// io error
#[
from
]
Io
(
std
::
io
::
Error
),
#[
error(transparent)
]
Io
(
#[from]
std
::
io
::
Error
),
/// a one shot channel was canceled
#[
from
]
Oneshot
(
oneshot
::
Canceled
),
#[
error(transparent)
]
Oneshot
(
#[from]
oneshot
::
Canceled
),
/// a mspc channel failed to send
#[
from
]
MpscSend
(
mpsc
::
SendError
),
#[
error(transparent)
]
MpscSend
(
#[from]
mpsc
::
SendError
),
/// several errors collected into one
#[
from
]
#[
error(
"Multiple errours occured: {0:?}"
)
]
Multiple
(
Vec
<
Error
>
),
/// the runtime API failed to return what we wanted
#[
from
]
Runtime
(
RuntimeApiError
),
#[
error(transparent)
]
Runtime
(
#[from]
RuntimeApiError
),
/// the keystore failed to process signing request
#[
from
]
#[
error(
"Keystore failed: {0:?}"
)
]
Keystore
(
KeystoreError
),
}
...
...
@@ -252,7 +258,7 @@ async fn construct_availability_bitfield(
if
errs
.is_empty
()
{
Ok
(
out
.into_inner
()
.into
())
}
else
{
Err
(
errs
.into
())
Err
(
Error
::
Multiple
(
errs
.into
())
)
}
}
...
...
node/core/candidate-selection/Cargo.toml
View file @
fec0e492
...
...
@@ -5,9 +5,9 @@ authors = ["Parity Technologies <admin@parity.io>"]
edition
=
"2018"
[dependencies]
derive_more
=
"0.99.9"
futures
=
"0.3.5"
log
=
"0.4.8"
log
=
"0.4.11"
thiserror
=
"1.0.21"
polkadot-primitives
=
{
path
=
"../../../primitives"
}
polkadot-node-primitives
=
{
path
=
"../../primitives"
}
polkadot-node-subsystem
=
{
path
=
"../../subsystem"
}
...
...
node/core/candidate-selection/src/lib.rs
View file @
fec0e492
...
...
@@ -17,7 +17,7 @@
//! The provisioner is responsible for assembling a relay chain block
//! from a set of available parachain candidates of its choice.
#![deny(missing_docs)]
#![deny(missing_docs
,
unused_crate_dependencies,
unused_results
)]
use
futures
::{
channel
::{
mpsc
,
oneshot
},
...
...
@@ -39,6 +39,7 @@ use polkadot_primitives::v1::{
CandidateDescriptor
,
CandidateReceipt
,
CollatorId
,
Hash
,
Id
as
ParaId
,
PoV
,
};
use
std
::{
convert
::
TryFrom
,
pin
::
Pin
,
sync
::
Arc
};
use
thiserror
::
Error
;
const
TARGET
:
&
'static
str
=
"candidate_selection"
;
...
...
@@ -116,18 +117,18 @@ impl TryFrom<AllMessages> for FromJob {
}
}
#[derive(Debug,
derive_more::F
ro
m
)]
#[derive(Debug,
Er
ro
r
)]
enum
Error
{
#[
from
]
Sending
(
mpsc
::
SendError
),
#[
from
]
Util
(
util
::
Error
),
#[
from
]
OneshotRecv
(
oneshot
::
Canceled
),
#[
from
]
ChainApi
(
ChainApiError
),
#[
from
]
Runtime
(
RuntimeApiError
),
#[
error(transparent)
]
Sending
(
#[from]
mpsc
::
SendError
),
#[
error(transparent)
]
Util
(
#[from]
util
::
Error
),
#[
error(transparent)
]
OneshotRecv
(
#[from]
oneshot
::
Canceled
),
#[
error(transparent)
]
ChainApi
(
#[from]
ChainApiError
),
#[
error(transparent)
]
Runtime
(
#[from]
RuntimeApiError
),
}
impl
JobTrait
for
CandidateSelectionJob
{
...
...
@@ -149,14 +150,13 @@ impl JobTrait for CandidateSelectionJob {
receiver
:
mpsc
::
Receiver
<
ToJob
>
,
sender
:
mpsc
::
Sender
<
FromJob
>
,
)
->
Pin
<
Box
<
dyn
Future
<
Output
=
Result
<
(),
Self
::
Error
>>
+
Send
>>
{
async
move
{
Box
::
pin
(
async
move
{
let
job
=
CandidateSelectionJob
::
new
(
metrics
,
sender
,
receiver
);
// it isn't necessary to break run_loop into its own function,
// but it's convenient to separate the concerns in this way
job
.run_loop
()
.await
}
.boxed
()
})
}
}
...
...
node/core/candidate-validation/Cargo.toml
View file @
fec0e492
...
...
@@ -5,11 +5,9 @@ authors = ["Parity Technologies <admin@parity.io>"]
edition
=
"2018"
[dependencies]
derive_more
=
"0.99.9"
futures
=
"0.3.5"
log
=
"0.4.
8
"
log
=
"0.4.
11
"
sp-blockchain
=
{
git
=
"https://github.com/paritytech/substrate"
,
branch
=
"master"
}
sp-core
=
{
package
=
"sp-core"
,
git
=
"https://github.com/paritytech/substrate"
,
branch
=
"master"
}
parity-scale-codec
=
{
version
=
"1.3.0"
,
default-features
=
false
,
features
=
[
"bit-vec"
,
"derive"
]
}
...
...
node/core/candidate-validation/src/lib.rs
View file @
fec0e492
...
...
@@ -20,8 +20,11 @@
//! according to a validation function. This delegates validation to an underlying
//! pool of processes used for execution of the Wasm.
#![deny(unused_crate_dependencies,
unused_results)]
#![warn(missing_docs)]
use
polkadot_subsystem
::{
Subsystem
,
SubsystemContext
,
SpawnedSubsystem
,
SubsystemResult
,
Subsystem
,
SubsystemContext
,
SpawnedSubsystem
,
SubsystemResult
,
SubsystemError
,
FromOverseer
,
OverseerSignal
,
messages
::{
AllMessages
,
CandidateValidationMessage
,
RuntimeApiMessage
,
...
...
@@ -116,9 +119,13 @@ impl<S, C> Subsystem<C> for CandidateValidationSubsystem<S> where
S
:
SpawnNamed
+
Clone
+
'static
,
{
fn
start
(
self
,
ctx
:
C
)
->
SpawnedSubsystem
{
let
future
=
run
(
ctx
,
self
.spawn
,
self
.metrics
)
.map_err
(|
e
|
SubsystemError
::
with_origin
(
"candidate-validation"
,
e
))
.map
(|
_
|
())
.boxed
();
SpawnedSubsystem
{
name
:
"candidate-validation-subsystem"
,
future
:
run
(
ctx
,
self
.spawn
,
self
.metrics
)
.map
(|
_
|
())
.boxed
()
,
future
,
}
}
}
...
...
node/core/chain-api/src/lib.rs
View file @
fec0e492
...
...
@@ -27,9 +27,12 @@
//! * Last finalized block number
//! * Ancestors
#![deny(unused_crate_dependencies,
unused_results)]
#![warn(missing_docs)]
use
polkadot_subsystem
::{
FromOverseer
,
OverseerSignal
,
SpawnedSubsystem
,
Subsystem
,
SubsystemResult
,
SubsystemContext
,
SpawnedSubsystem
,
Subsystem
,
SubsystemResult
,
SubsystemError
,
SubsystemContext
,
messages
::
ChainApiMessage
,
};
use
polkadot_node_subsystem_util
::{
...
...
@@ -61,8 +64,12 @@ impl<Client, Context> Subsystem<Context> for ChainApiSubsystem<Client> where
Context
:
SubsystemContext
<
Message
=
ChainApiMessage
>
{
fn
start
(
self
,
ctx
:
Context
)
->
SpawnedSubsystem
{
let
future
=
run
(
ctx
,
self
)
.map_err
(|
e
|
SubsystemError
::
with_origin
(
"chain-api"
,
e
))
.map
(|
_
|
())
.boxed
();
SpawnedSubsystem
{
future
:
run
(
ctx
,
self
)
.map
(|
_
|
())
.boxed
()
,
future
,
name
:
"chain-api-subsystem"
,
}
}
...
...
@@ -112,7 +119,10 @@ where
let
maybe_header
=
subsystem
.client
.header
(
BlockId
::
Hash
(
hash
));
match
maybe_header
{
// propagate the error
Err
(
e
)
=>
Some
(
Err
(
e
.to_string
()
.into
())),
Err
(
e
)
=>
{
let
e
=
e
.to_string
()
.into
();
Some
(
Err
(
e
))
},
// fewer than `k` ancestors are available
Ok
(
None
)
=>
None
,
Ok
(
Some
(
header
))
=>
{
...
...
node/core/proposer/Cargo.toml
View file @
fec0e492
...
...
@@ -6,16 +6,13 @@ edition = "2018"
[dependencies]
futures
=
"0.3.4"
futures-timer
=
"3.0.1"
log
=
"0.4.8"
parity-scale-codec
=
"1.3.4"
polkadot-node-subsystem
=
{
path
=
"../../subsystem"
}
polkadot-overseer
=
{
path
=
"../../overseer"
}
polkadot-primitives
=
{
path
=
"../../../primitives"
}
sc-basic-authorship
=
{
git
=
"https://github.com/paritytech/substrate"
,
branch
=
"master"
}
sc-block-builder
=
{
git
=
"https://github.com/paritytech/substrate"
,
branch
=
"master"
}
sc-client-api
=
{
git
=
"https://github.com/paritytech/substrate"
,
branch
=
"master"
}
sc-telemetry
=
{
git
=
"https://github.com/paritytech/substrate"
,
branch
=
"master"
}
sp-api
=
{
git
=
"https://github.com/paritytech/substrate"
,
branch
=
"master"
}
sp-blockchain
=
{
git
=
"https://github.com/paritytech/substrate"
,
branch
=
"master"
}
sp-consensus
=
{
git
=
"https://github.com/paritytech/substrate"
,
branch
=
"master"
}
...
...
@@ -23,5 +20,4 @@ sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-inherents
=
{
git
=
"https://github.com/paritytech/substrate"
,
branch
=
"master"
}
sp-runtime
=
{
git
=
"https://github.com/paritytech/substrate"
,
branch
=
"master"
}
sp-transaction-pool
=
{
git
=
"https://github.com/paritytech/substrate"
,
branch
=
"master"
}
tokio-executor
=
{
version
=
"0.2.0-alpha.6"
,
features
=
["blocking"]
}
wasm-timer
=
"0.2.4"
node/core/proposer/src/lib.rs
View file @
fec0e492
// Copyright 2020 Parity Technologies (UK) Ltd.
// This file is part of Polkadot.
// Polkadot is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// Polkadot is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.