Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Commit

Permalink
Add node name to the log lines (#7328)
Browse files Browse the repository at this point in the history
* Initial commit

Forked at: d67fc4c
Parent branch: origin/master

* WIP

Forked at: d67fc4c
Parent branch: origin/master

* WIP

Forked at: d67fc4c
Parent branch: origin/master

* WIP

Forked at: d67fc4c
Parent branch: origin/master

* WIP

Forked at: d67fc4c
Parent branch: origin/master

* WIP

Forked at: d67fc4c
Parent branch: origin/master

* CLEANUP

Forked at: d67fc4c
Parent branch: origin/master

* Add notes to original source code

* CLEANUP

Forked at: d67fc4c
Parent branch: origin/master

* CLEANUP

Forked at: d67fc4c
Parent branch: origin/master

* WIP

Forked at: d67fc4c
Parent branch: origin/master

* WIP

Forked at: d67fc4c
Parent branch: origin/master

* WIP

Forked at: d67fc4c
Parent branch: origin/master

* CLEANUP

Forked at: d67fc4c
Parent branch: origin/master

* WIP

Forked at: d67fc4c
Parent branch: origin/master

* Some doc

* Test with trybuild

* Revert "Test with trybuild" (issue with trybuild atm)

This reverts commit 9055ec2.

dtolnay/trybuild#53

* Apply suggestions

* Rename derive to proc-macro

* Remove "prefix" feature from informant

* Blocking task should use SpawnHandle::spawn_blocking

* Improve doc as suggested

* Fixes

Forked at: d67fc4c
Parent branch: origin/master

* Apply suggestion

* Update client/cli/proc-macro/src/lib.rs

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>

* More suggestions

* CLEANUP

Forked at: d67fc4c
Parent branch: origin/master

* Improve error message

* CLEANUP

Forked at: d67fc4c
Parent branch: origin/master

* Fix async issue

* CLEANUP

Forked at: d67fc4c
Parent branch: origin/master

* CLEANUP

Forked at: d67fc4c
Parent branch: origin/master

* Add test

* fix doc test

* Update client/cli/src/logging.rs

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>

* Update client/basic-authorship/src/basic_authorship.rs

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>

* Update client/basic-authorship/src/basic_authorship.rs

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>

* Apply suggestions

* Suggestions

* Clarify doc

* WIP

Forked at: d67fc4c
Parent branch: origin/master

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
  • Loading branch information
cecton and bkchr authored Oct 21, 2020
1 parent 5cad894 commit a467358
Show file tree
Hide file tree
Showing 20 changed files with 704 additions and 77 deletions.
22 changes: 22 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ members = [
"client/chain-spec",
"client/chain-spec/derive",
"client/cli",
"client/cli/proc-macro",
"client/consensus/aura",
"client/consensus/babe",
"client/consensus/babe/rpc",
Expand Down
1 change: 1 addition & 0 deletions bin/node-template/node/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ pub fn new_full(config: Configuration) -> Result<TaskManager, ServiceError> {

if role.is_authority() {
let proposer = sc_basic_authorship::ProposerFactory::new(
task_manager.spawn_handle(),
client.clone(),
transaction_pool,
prometheus_registry.as_ref(),
Expand Down
3 changes: 2 additions & 1 deletion bin/node/bench/src/construct.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ impl core::Benchmark for ConstructionBenchmark {
}

let mut proposer_factory = sc_basic_authorship::ProposerFactory::new(
context.spawn_handle.clone(),
context.client.clone(),
self.transactions.clone().into(),
None,
Expand Down Expand Up @@ -293,4 +294,4 @@ impl sp_transaction_pool::TransactionPool for Transactions {
fn ready_transaction(&self, _hash: &TxHash<Self>) -> Option<Arc<Self::InPoolTransaction>> {
unimplemented!()
}
}
}
2 changes: 2 additions & 0 deletions bin/node/cli/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@ pub fn new_full_base(

if let sc_service::config::Role::Authority { .. } = &role {
let proposer = sc_basic_authorship::ProposerFactory::new(
task_manager.spawn_handle(),
client.clone(),
transaction_pool.clone(),
prometheus_registry.as_ref(),
Expand Down Expand Up @@ -557,6 +558,7 @@ mod tests {
);

let mut proposer_factory = sc_basic_authorship::ProposerFactory::new(
service.spawn_handle(),
service.client(),
service.transaction_pool(),
None,
Expand Down
21 changes: 15 additions & 6 deletions bin/node/testing/src/bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,12 @@ impl BenchDb {
"Created seed db at {}",
dir.path().to_string_lossy(),
);
let (_client, _backend) = Self::bench_client(database_type, dir.path(), Profile::Native, &keyring);
let (_client, _backend, _task_executor) = Self::bench_client(
database_type,
dir.path(),
Profile::Native,
&keyring,
);
let directory_guard = Guard(dir);

BenchDb { keyring, directory_guard, database_type }
Expand Down Expand Up @@ -401,13 +406,14 @@ impl BenchDb {
dir: &std::path::Path,
profile: Profile,
keyring: &BenchKeyring,
) -> (Client, std::sync::Arc<Backend>) {
) -> (Client, std::sync::Arc<Backend>, TaskExecutor) {
let db_config = sc_client_db::DatabaseSettings {
state_cache_size: 16*1024*1024,
state_cache_child_ratio: Some((0, 100)),
pruning: PruningMode::ArchiveAll,
source: database_type.into_settings(dir.into()),
};
let task_executor = TaskExecutor::new();

let (client, backend) = sc_service::new_client(
db_config,
Expand All @@ -416,12 +422,12 @@ impl BenchDb {
None,
None,
ExecutionExtensions::new(profile.into_execution_strategies(), None),
Box::new(TaskExecutor::new()),
Box::new(task_executor.clone()),
None,
Default::default(),
).expect("Should not fail");

(client, backend)
(client, backend, task_executor)
}

/// Generate list of required inherents.
Expand Down Expand Up @@ -450,7 +456,7 @@ impl BenchDb {

/// Get cliet for this database operations.
pub fn client(&mut self) -> Client {
let (client, _backend) = Self::bench_client(
let (client, _backend, _task_executor) = Self::bench_client(
self.database_type,
self.directory_guard.path(),
Profile::Wasm,
Expand Down Expand Up @@ -504,7 +510,7 @@ impl BenchDb {
/// Clone this database and create context for testing/benchmarking.
pub fn create_context(&self, profile: Profile) -> BenchContext {
let BenchDb { directory_guard, keyring, database_type } = self.clone();
let (client, backend) = Self::bench_client(
let (client, backend, task_executor) = Self::bench_client(
database_type,
directory_guard.path(),
profile,
Expand All @@ -515,6 +521,7 @@ impl BenchDb {
client: Arc::new(client),
db_guard: directory_guard,
backend,
spawn_handle: Box::new(task_executor),
}
}
}
Expand Down Expand Up @@ -649,6 +656,8 @@ pub struct BenchContext {
pub client: Arc<Client>,
/// Node backend.
pub backend: Arc<Backend>,
/// Spawn handle.
pub spawn_handle: Box<dyn SpawnNamed>,

db_guard: Guard,
}
Expand Down
Loading

0 comments on commit a467358

Please sign in to comment.