Unverified Commit b892796b authored by Bernhard Schuster's avatar Bernhard Schuster Committed by GitHub
Browse files
parent 6701f772
Pipeline #116919 failed with stages
in 24 minutes and 10 seconds
......@@ -265,17 +265,35 @@ dependencies = [
"event-listener",
]
[[package]]
name = "async-process"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4c8cea09c1fb10a317d1b5af8024eeba256d6554763e85ecd90ff8df31c7bbda"
dependencies = [
"async-io",
"blocking",
"cfg-if 0.1.10",
"event-listener",
"futures-lite",
"once_cell",
"signal-hook",
"winapi 0.3.9",
]
[[package]]
name = "async-std"
version = "1.6.5"
version = "1.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a9fa76751505e8df1c7a77762f60486f60c71bbd9b8557f4da6ad47d083732ed"
checksum = "8f9f84f1280a2b436a2c77c2582602732b6c2f4321d5494d6e799e6c367859a8"
dependencies = [
"async-channel",
"async-global-executor",
"async-io",
"async-mutex",
"async-process",
"blocking",
"crossbeam-utils",
"crossbeam-utils 0.8.1",
"futures-channel",
"futures-core",
"futures-io",
......@@ -286,7 +304,7 @@ dependencies = [
"memchr",
"num_cpus",
"once_cell",
"pin-project-lite 0.1.7",
"pin-project-lite 0.2.0",
"pin-utils",
"slab",
"wasm-bindgen-futures",
......@@ -936,7 +954,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9f02af974daeee82218205558e51ec8768b48cf524bd01d550abe5573a608285"
dependencies = [
"crossbeam-epoch",
"crossbeam-utils",
"crossbeam-utils 0.7.2",
"maybe-uninit",
]
......@@ -948,7 +966,7 @@ checksum = "058ed274caafc1f60c4997b5fc07bf7dc7cca454af7c6e81edffe5f33f70dace"
dependencies = [
"autocfg 1.0.0",
"cfg-if 0.1.10",
"crossbeam-utils",
"crossbeam-utils 0.7.2",
"lazy_static",
"maybe-uninit",
"memoffset",
......@@ -962,7 +980,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "774ba60a54c213d409d5353bda12d49cd68d14e45036a285234c8d6f91f92570"
dependencies = [
"cfg-if 0.1.10",
"crossbeam-utils",
"crossbeam-utils 0.7.2",
"maybe-uninit",
]
......@@ -977,6 +995,17 @@ dependencies = [
"lazy_static",
]
[[package]]
name = "crossbeam-utils"
version = "0.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "02d96d1e189ef58269ebe5b97953da3274d83a93af647c2ddd6f9dab28cedb8d"
dependencies = [
"autocfg 1.0.0",
"cfg-if 1.0.0",
"lazy_static",
]
[[package]]
name = "crunchy"
version = "0.2.2"
......@@ -1465,6 +1494,16 @@ dependencies = [
"parity-scale-codec",
]
[[package]]
name = "form_urlencoded"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ece68d15c92e84fa4f19d3780f1294e5ca82a78a6d515f1efaabcc144688be00"
dependencies = [
"matches",
"percent-encoding 2.1.0",
]
[[package]]
name = "frame-benchmarking"
version = "2.0.0"
......@@ -2369,6 +2408,12 @@ version = "0.1.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5b141fdc7836c525d4d594027d318c84161ca17aaf8113ab1f81ab93ae897485"
[[package]]
name = "integer-encoding"
version = "1.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4f4ebd0bd29be0f11973e9b3e219005661042a019fd757798c36a47c87852625"
[[package]]
name = "integer-sqrt"
version = "0.1.3"
......@@ -3178,7 +3223,7 @@ dependencies = [
"rustls 0.19.0",
"rw-stream-sink",
"soketto",
"url 2.1.1",
"url 2.2.0",
"webpki",
"webpki-roots",
]
......@@ -3424,6 +3469,17 @@ dependencies = [
"zeroize",
]
[[package]]
name = "mick-jaeger"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "68c751e6643309568aa78a725b75755c11d866d6d0d0f7209033142007971cdd"
dependencies = [
"futures 0.3.8",
"rand 0.7.3",
"thrift",
]
[[package]]
name = "minicbor"
version = "0.7.0"
......@@ -3794,6 +3850,15 @@ version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "77af24da69f9d9341038eba93a073b1fdaaa1b788221b00a69bce9e762cb32de"
[[package]]
name = "ordered-float"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3741934be594d77de1c8461ebcbbe866f585ea616a9753aa78f2bdc69f0e4579"
dependencies = [
"num-traits 0.2.12",
]
[[package]]
name = "output_vt100"
version = "0.1.2"
......@@ -4385,7 +4450,7 @@ dependencies = [
"serde",
"static_assertions",
"unsigned-varint",
"url 2.1.1",
"url 2.2.0",
]
[[package]]
......@@ -4496,7 +4561,7 @@ dependencies = [
"rand 0.7.3",
"sha-1",
"slab",
"url 2.1.1",
"url 2.2.0",
]
[[package]]
......@@ -5133,10 +5198,14 @@ name = "polkadot-node-subsystem"
version = "0.1.0"
dependencies = [
"assert_matches",
"async-std",
"async-trait",
"derive_more",
"futures 0.3.8",
"futures-timer 3.0.2",
"lazy_static",
"log",
"mick-jaeger",
"parity-scale-codec",
"parking_lot 0.11.1",
"pin-project 1.0.2",
......@@ -6269,7 +6338,7 @@ checksum = "e92e15d89083484e11353891f1af602cc661426deb9564c298b270c726973280"
dependencies = [
"crossbeam-deque",
"crossbeam-queue",
"crossbeam-utils",
"crossbeam-utils 0.7.2",
"lazy_static",
"num_cpus",
]
......@@ -6487,7 +6556,7 @@ dependencies = [
"base64 0.11.0",
"blake2b_simd",
"constant_time_eq",
"crossbeam-utils",
"crossbeam-utils 0.7.2",
]
[[package]]
......@@ -7829,6 +7898,16 @@ version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7fdf1b9db47230893d76faad238fd6097fd6d6a9245cd7a4d90dbd639536bbd2"
[[package]]
name = "signal-hook"
version = "0.1.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "604508c1418b99dfe1925ca9224829bb2a8a9a04dda655cc01fcad46f4ab05ed"
dependencies = [
"libc",
"signal-hook-registry",
]
[[package]]
name = "signal-hook-registry"
version = "1.2.0"
......@@ -9056,6 +9135,19 @@ dependencies = [
"num_cpus",
]
[[package]]
name = "thrift"
version = "0.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0c6d965454947cc7266d22716ebfd07b18d84ebaf35eec558586bbb2a8cb6b5b"
dependencies = [
"byteorder",
"integer-encoding",
"log",
"ordered-float",
"threadpool",
]
[[package]]
name = "time"
version = "0.1.43"
......@@ -9184,7 +9276,7 @@ version = "0.1.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fb2d1b8f4548dbf5e1f7818512e9c406860678f29c300cdf0ebac72d1a3a1671"
dependencies = [
"crossbeam-utils",
"crossbeam-utils 0.7.2",
"futures 0.1.29",
]
......@@ -9240,7 +9332,7 @@ version = "0.1.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "09bc590ec4ba8ba87652da2068d150dcada2cfa2e07faae270a5e0409aa51351"
dependencies = [
"crossbeam-utils",
"crossbeam-utils 0.7.2",
"futures 0.1.29",
"lazy_static",
"log",
......@@ -9306,7 +9398,7 @@ checksum = "df720b6581784c118f0eb4310796b12b1d242a7eb95f716a8367855325c25f89"
dependencies = [
"crossbeam-deque",
"crossbeam-queue",
"crossbeam-utils",
"crossbeam-utils 0.7.2",
"futures 0.1.29",
"lazy_static",
"log",
......@@ -9321,7 +9413,7 @@ version = "0.2.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "93044f2d313c95ff1cb7809ce9a7a05735b012288a888b62d4434fd58c94f296"
dependencies = [
"crossbeam-utils",
"crossbeam-utils 0.7.2",
"futures 0.1.29",
"slab",
"tokio-executor",
......@@ -9643,10 +9735,11 @@ dependencies = [
[[package]]
name = "url"
version = "2.1.1"
version = "2.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "829d4a8476c35c9bf0bbce5a3b23f4106f79728039b726d292bb93bc106787cb"
checksum = "5909f2b0817350449ed73e8bcd81c8c3c8d9a7a5d8acba4b27db277f1868976e"
dependencies = [
"form_urlencoded",
"idna 0.2.0",
"matches",
"percent-encoding 2.1.0",
......
......@@ -91,6 +91,13 @@ pub struct RunCmd {
/// elapsed (i.e. until a block at height `pause_block + delay` is imported).
#[structopt(long = "grandpa-pause", number_of_values(2))]
pub grandpa_pause: Vec<u32>,
/// Add the destination address to the jaeger agent.
///
/// Must be valid socket address, of format `IP:Port`
/// commonly `127.0.0.1:6831`.
#[structopt(long)]
pub jaeger_agent: Option<std::net::SocketAddr>,
}
#[allow(missing_docs)]
......@@ -98,7 +105,6 @@ pub struct RunCmd {
pub struct Cli {
#[structopt(subcommand)]
pub subcommand: Option<Subcommand>,
#[structopt(flatten)]
pub run: RunCmd,
}
......@@ -162,17 +162,19 @@ pub fn run() -> Result<()> {
info!("----------------------------");
}
let jaeger_agent = cli.run.jaeger_agent;
Ok(runner.run_node_until_exit(move |config| async move {
let role = config.role.clone();
let task_manager = match role {
Role::Light => service::build_light(config).map(|(task_manager, _)| task_manager)
.map_err(|e| sc_service::Error::Other(e.to_string()) ),
.map_err(|e| sc_service::Error::Other(e.to_string())),
_ => service::build_full(
config,
service::IsCollator::No,
grandpa_pause,
jaeger_agent,
).map(|full| full.task_manager)
.map_err(|e| sc_service::Error::Other(e.to_string()) )
};
......@@ -191,7 +193,7 @@ pub fn run() -> Result<()> {
set_default_ss58_version(chain_spec);
runner.async_run(|mut config| {
let (client, _, import_queue, task_manager) = service::new_chain_ops(&mut config)
let (client, _, import_queue, task_manager) = service::new_chain_ops(&mut config, None)
.map_err(|e| sc_service::Error::Other(e.to_string()))?;
Ok((cmd.run(client, import_queue), task_manager))
})
......@@ -203,7 +205,7 @@ pub fn run() -> Result<()> {
set_default_ss58_version(chain_spec);
runner.async_run(|mut config| {
let (client, _, _, task_manager) = service::new_chain_ops(&mut config)
let (client, _, _, task_manager) = service::new_chain_ops(&mut config, None)
.map_err(|e| sc_service::Error::Other(e.to_string()))?;
Ok((cmd.run(client, config.database), task_manager))
})
......@@ -215,7 +217,7 @@ pub fn run() -> Result<()> {
set_default_ss58_version(chain_spec);
runner.async_run(|mut config| {
let (client, _, _, task_manager) = service::new_chain_ops(&mut config)
let (client, _, _, task_manager) = service::new_chain_ops(&mut config, None)
.map_err(|e| sc_service::Error::Other(e.to_string()))?;
Ok((cmd.run(client, config.chain_spec), task_manager))
})
......@@ -227,7 +229,7 @@ pub fn run() -> Result<()> {
set_default_ss58_version(chain_spec);
runner.async_run(|mut config| {
let (client, _, import_queue, task_manager) = service::new_chain_ops(&mut config)
let (client, _, import_queue, task_manager) = service::new_chain_ops(&mut config, None)
.map_err(|e| sc_service::Error::Other(e.to_string()))?;
Ok((cmd.run(client, import_queue), task_manager))
})
......@@ -244,7 +246,7 @@ pub fn run() -> Result<()> {
set_default_ss58_version(chain_spec);
runner.async_run(|mut config| {
let (client, backend, _, task_manager) = service::new_chain_ops(&mut config)
let (client, backend, _, task_manager) = service::new_chain_ops(&mut config, None)
.map_err(|e| sc_service::Error::Other(e.to_string()))?;
Ok((cmd.run(client, backend), task_manager))
})
......
......@@ -37,6 +37,7 @@ use polkadot_node_primitives::{
FromTableMisbehavior, Statement, SignedFullStatement, MisbehaviorReport, ValidationResult,
};
use polkadot_subsystem::{
jaeger,
messages::{
AllMessages, AvailabilityStoreMessage, CandidateBackingMessage, CandidateSelectionMessage,
CandidateValidationMessage, PoVDistributionMessage, ProvisionableData,
......@@ -457,10 +458,12 @@ impl CandidateBackingJob {
async fn run_loop(
mut self,
mut rx_to: mpsc::Receiver<CandidateBackingMessage>,
span: &jaeger::JaegerSpan
) -> Result<(), Error> {
loop {
futures::select! {
validated_command = self.background_validation.next() => {
let _span = span.child("background validation");
if let Some(c) = validated_command {
self.handle_validated_candidate_command(c).await?;
} else {
......@@ -470,6 +473,7 @@ impl CandidateBackingJob {
to_job = rx_to.next() => match to_job {
None => break,
Some(msg) => {
let _span = span.child("process message");
self.process_msg(msg).await?;
}
}
......@@ -870,6 +874,9 @@ impl util::JobTrait for CandidateBackingJob {
}
}
let span = jaeger::hash_span(&parent, "run:backing");
let _span = span.child("runtime apis");
let (validators, groups, session_index, cores) = futures::try_join!(
try_runtime_api!(request_validators(parent, &mut tx_from).await),
try_runtime_api!(request_validator_groups(parent, &mut tx_from).await),
......@@ -886,6 +893,9 @@ impl util::JobTrait for CandidateBackingJob {
let session_index = try_runtime_api!(session_index);
let cores = try_runtime_api!(cores);
drop(_span);
let _span = span.child("validator construction");
let signing_context = SigningContext { parent_hash: parent, session_index };
let validator = match Validator::construct(
&validators,
......@@ -905,6 +915,10 @@ impl util::JobTrait for CandidateBackingJob {
}
};
drop(_span);
let _span = span.child("calc validator groups");
let mut groups = HashMap::new();
let n_cores = cores.len();
......@@ -936,6 +950,9 @@ impl util::JobTrait for CandidateBackingJob {
Some((assignment, required_collator)) => (Some(assignment), required_collator),
};
drop(_span);
let _span = span.child("wait for candidate backing job");
let (background_tx, background_rx) = mpsc::channel(16);
let job = CandidateBackingJob {
parent,
......@@ -954,10 +971,10 @@ impl util::JobTrait for CandidateBackingJob {
background_validation_tx: background_tx,
metrics,
};
drop(_span);
job.run_loop(rx_to).await
}
.boxed()
job.run_loop(rx_to, &span).await
}.boxed()
}
}
......
......@@ -23,6 +23,7 @@
use futures::{channel::{mpsc, oneshot}, lock::Mutex, prelude::*, future, Future};
use sp_keystore::{Error as KeystoreError, SyncCryptoStorePtr};
use polkadot_node_subsystem::{
jaeger,
messages::{
AllMessages, AvailabilityStoreMessage, BitfieldDistributionMessage,
BitfieldSigningMessage, RuntimeApiMessage, RuntimeApiRequest,
......@@ -75,7 +76,9 @@ async fn get_core_availability(
validator_idx: ValidatorIndex,
sender: &Mutex<&mut mpsc::Sender<FromJobCommand>>,
) -> Result<bool, Error> {
let span = jaeger::hash_span(&relay_parent, "core_availability");
if let CoreState::Occupied(core) = core {
let _span = span.child("occupied");
let (tx, rx) = oneshot::channel();
sender
.lock()
......@@ -97,6 +100,10 @@ async fn get_core_availability(
return Ok(false);
}
};
drop(_span);
let _span = span.child("query chunk");
let (tx, rx) = oneshot::channel();
sender
.lock()
......@@ -120,6 +127,7 @@ async fn get_availability_cores(
relay_parent: Hash,
sender: &mut mpsc::Sender<FromJobCommand>,
) -> Result<Vec<CoreState>, Error> {
let _span = jaeger::hash_span(&relay_parent, "get availability cores");
let (tx, rx) = oneshot::channel();
sender
.send(AllMessages::from(RuntimeApiMessage::Request(relay_parent, RuntimeApiRequest::AvailabilityCores(tx))).into())
......@@ -226,6 +234,8 @@ impl JobTrait for BitfieldSigningJob {
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send>> {
let metrics = metrics.clone();
async move {
let span = jaeger::hash_span(&relay_parent, "run:bitfield-signing");
let _span = span.child("delay");
let wait_until = Instant::now() + JOB_DELAY;
// now do all the work we can before we need to wait for the availability store
......@@ -243,6 +253,9 @@ impl JobTrait for BitfieldSigningJob {
// JOB_DELAY each time.
let _timer = metrics.time_run();
drop(_span);
let _span = span.child("availablity");
let bitfield =
match construct_availability_bitfield(relay_parent, validator.index(), &mut sender).await
{
......@@ -255,12 +268,18 @@ impl JobTrait for BitfieldSigningJob {
Ok(bitfield) => bitfield,
};
drop(_span);
let _span = span.child("signing");
let signed_bitfield = validator
.sign(keystore.clone(), bitfield)
.await
.map_err(|e| Error::Keystore(e))?;
metrics.on_bitfield_signed();
drop(_span);
let _span = span.child("gossip");
sender
.send(
AllMessages::from(
......
......@@ -25,6 +25,7 @@ use futures::{
};
use sp_keystore::SyncCryptoStorePtr;
use polkadot_node_subsystem::{
jaeger,
errors::ChainApiError,
messages::{
AllMessages, CandidateBackingMessage, CandidateSelectionMessage, CollatorProtocolMessage,
......@@ -99,7 +100,9 @@ impl JobTrait for CandidateSelectionJob {
receiver: mpsc::Receiver<CandidateSelectionMessage>,
mut sender: mpsc::Sender<FromJobCommand>,
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send>> {
let span = jaeger::hash_span(&relay_parent, "candidate-selection:run");
async move {
let _span = span.child("query runtime");
let (groups, cores) = futures::try_join!(
try_runtime_api!(request_validator_groups(relay_parent, &mut sender).await),
try_runtime_api!(request_from_runtime(
......@@ -112,6 +115,9 @@ impl JobTrait for CandidateSelectionJob {
let (validator_groups, group_rotation_info) = try_runtime_api!(groups);
let cores = try_runtime_api!(cores);
drop(_span);
let _span = span.child("find assignment");
let n_cores = cores.len();
let validator = match Validator::new(relay_parent, keystore.clone(), sender.clone()).await {
......@@ -141,7 +147,9 @@ impl JobTrait for CandidateSelectionJob {
None => return Ok(()),
};
CandidateSelectionJob::new(assignment, metrics, sender, receiver).run_loop().await
drop(_span);
CandidateSelectionJob::new(assignment, metrics, sender, receiver).run_loop(&span).await
}.boxed()
}
}
......@@ -162,7 +170,8 @@ impl CandidateSelectionJob {
}
}
async fn run_loop(&mut self) -> Result<(), Error> {
async fn run_loop(&mut self, span: &jaeger::JaegerSpan) -> Result<(), Error> {
let span = span.child("run loop");
loop {
match self.receiver.next().await {
Some(CandidateSelectionMessage::Collation(
......@@ -170,12 +179,14 @@ impl CandidateSelectionJob {
para_id,
collator_id,
)) => {
let _span = span.child("handle collation");
self.handle_collation(relay_parent, para_id, collator_id).await;
}
Some(CandidateSelectionMessage::Invalid(
_,
candidate_receipt,
)) => {
let _span = span.child("handle invalid");
self.handle_invalid(candidate_receipt).await;
}
None => break,
......@@ -459,10 +470,10 @@ mod tests {
};
preconditions(&mut job);
let span = jaeger::JaegerSpan::Disabled;
let (_, job_result) = futures::executor::block_on(future::join(
test(to_job_tx, from_job_rx),
job.run_loop(),
job.run_loop(&span),
));
postconditions(job, job_result);
......
......@@ -20,7 +20,10 @@
use futures::prelude::*;
use futures::select;
use polkadot_node_subsystem::{messages::{AllMessages, ProvisionerInherentData, ProvisionerMessage}, SubsystemError};
use polkadot_node_subsystem::{
jaeger,
messages::{AllMessages, ProvisionerInherentData, ProvisionerMessage}, SubsystemError,
};
use polkadot_overseer::OverseerHandler;
use polkadot_primitives::v1::{
Block, Hash, Header,
......@@ -193,6 +196,9 @@ where
record_proof: RecordProof,
) -> Self::Proposal {
async move {
let span = jaeger::hash_span(&self.parent_header_hash, "propose");
let _span = span.child("get provisioner");
let provisioner_data = match self.get_provisioner_data().await {
Ok(pd) => pd,
Err(err) => {
......@@ -201,11 +207,14 @@ where
}
};
drop(_span);
inherent_data.put_data(
polkadot_primitives::v1::INCLUSION_INHERENT_IDENTIFIER,
&provisioner_data,
)?;