Skip to content

Commit

Permalink
first iteration:
Browse files Browse the repository at this point in the history
add `tracing` feature of tokio, and the console-subscriber
  • Loading branch information
b-yap committed Apr 29, 2024
1 parent 9aafee4 commit 16db713
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 13 deletions.
2 changes: 2 additions & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[build]
rustflags = ["--cfg", "tokio_unstable"]
3 changes: 2 additions & 1 deletion clients/stellar-relay-lib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ tokio = { version = "1.0", features = [
"macros", # allows main function to be async
"rt-multi-thread", # for multi-thread runtime
"sync", # to make channels available
"time" # for timeouts and sleep, when reconnecting
"time", # for timeouts and sleep, when reconnecting
"tracing" # for tokio console
] }
async-std = { version = "1.12.0", features = ["attributes"] }

Expand Down
5 changes: 4 additions & 1 deletion clients/vault/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,12 @@ signal-hook = "0.3.14"
signal-hook-tokio = { version = "0.3.1", features = ["futures-v0_3"] }
sysinfo = "0.26.1"
thiserror = "1.0"
tokio = { version = "1.0", features = ["full"] }

# tokio related
tokio = { version = "1.0", features = ["full", "tracing"] }
tokio-metrics = { version = "0.1.0", default-features = false }
tokio-stream = { version = "0.1.9", features = ["sync"] }
console-subscriber = "0.2.0"

tracing = { version = "0.1", features = ["log"] }
tracing-futures = { version = "0.2.5" }
Expand Down
1 change: 1 addition & 0 deletions clients/vault/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ async fn start() -> Result<(), ServiceError<Error>> {

#[tokio::main]
async fn main() {
console_subscriber::init();
let exit_code = if let Err(err) = start().await {
tracing::error!("Exiting: {}", err);
1
Expand Down
2 changes: 1 addition & 1 deletion clients/wallet/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ reqwest = { version = "0.11", features = ["json"] }
serde = "1.0.136"
serde_json = { version = '1.0.45', default-features = false, features = ['alloc'] }
thiserror = "1.0"
tokio = { version = "1.0", features = ["full"] }
tokio = { version = "1.0", features = ["full", "tracing"] }
tokio-metrics = { version = "0.1.0", default-features = false }
tokio-stream = { version = "0.1.9", features = ["sync"] }
tracing = { version = "0.1", features = ["log"] }
Expand Down
13 changes: 8 additions & 5 deletions testchain/runtime/mainnet/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ use sp_std::{marker::PhantomData, prelude::*};
use sp_version::NativeVersion;
use sp_version::RuntimeVersion;

use currency::{testing_constants, Amount};
use currency::Amount;
pub use issue::{Event as IssueEvent, IssueRequest};
pub use module_oracle_rpc_runtime_api::BalanceWrapper;
pub use nomination::Event as NominationEvent;
Expand Down Expand Up @@ -201,16 +201,19 @@ impl pallet_timestamp::Config for Runtime {
const NATIVE_CURRENCY_ID: CurrencyId = CurrencyId::Native;
const PARENT_CURRENCY_ID: CurrencyId = CurrencyId::XCM(0);
#[cfg(feature = "runtime-benchmarks")]
const WRAPPED_CURRENCY_ID: CurrencyId = testing_constants::DEFAULT_WRAPPED_CURRENCY;
const WRAPPED_CURRENCY_ID: CurrencyId = currency::testing_constants::DEFAULT_WRAPPED_CURRENCY;

parameter_types! {
pub const GetNativeCurrencyId: CurrencyId = NATIVE_CURRENCY_ID;
#[cfg(feature = "runtime-benchmarks")]
pub const GetWrappedCurrencyId: CurrencyId = WRAPPED_CURRENCY_ID;
pub const GetRelayChainCurrencyId: CurrencyId = PARENT_CURRENCY_ID;
pub const TransactionByteFee: Balance = MILLICENTS;
}

#[cfg(feature = "runtime-benchmarks")]
parameter_types! {
pub const GetWrappedCurrencyId: CurrencyId = WRAPPED_CURRENCY_ID;
}

impl pallet_transaction_payment::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type OnChargeTransaction = pallet_transaction_payment::CurrencyAdapter<Balances, ()>;
Expand Down Expand Up @@ -285,7 +288,7 @@ pub struct DustRemovalWhitelist;

impl Contains<AccountId> for DustRemovalWhitelist {
fn contains(a: &AccountId) -> bool {
vec![].contains(a)
[].contains(a)
}
}

Expand Down
13 changes: 8 additions & 5 deletions testchain/runtime/testnet/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ use sp_std::{marker::PhantomData, prelude::*};
use sp_version::NativeVersion;
use sp_version::RuntimeVersion;

use currency::{testing_constants, Amount};
use currency::Amount;
pub use issue::{Event as IssueEvent, IssueRequest};
pub use module_oracle_rpc_runtime_api::BalanceWrapper;
pub use nomination::Event as NominationEvent;
Expand Down Expand Up @@ -199,16 +199,19 @@ impl pallet_timestamp::Config for Runtime {
const NATIVE_CURRENCY_ID: CurrencyId = CurrencyId::Native;
const PARENT_CURRENCY_ID: CurrencyId = CurrencyId::XCM(0);
#[cfg(feature = "runtime-benchmarks")]
const WRAPPED_CURRENCY_ID: CurrencyId = testing_constants::DEFAULT_WRAPPED_CURRENCY;
const WRAPPED_CURRENCY_ID: CurrencyId = currency::testing_constants::DEFAULT_WRAPPED_CURRENCY;

parameter_types! {
pub const GetNativeCurrencyId: CurrencyId = NATIVE_CURRENCY_ID;
#[cfg(feature = "runtime-benchmarks")]
pub const GetWrappedCurrencyId: CurrencyId = WRAPPED_CURRENCY_ID;
pub const GetRelayChainCurrencyId: CurrencyId = PARENT_CURRENCY_ID;
pub const TransactionByteFee: Balance = MILLICENTS;
}

#[cfg(feature = "runtime-benchmarks")]
parameter_types! {
pub const GetWrappedCurrencyId: CurrencyId = WRAPPED_CURRENCY_ID;
}

impl pallet_transaction_payment::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type OnChargeTransaction = pallet_transaction_payment::CurrencyAdapter<Balances, ()>;
Expand Down Expand Up @@ -281,7 +284,7 @@ impl orml_tokens::Config for Runtime {
pub struct DustRemovalWhitelist;
impl Contains<AccountId> for DustRemovalWhitelist {
fn contains(a: &AccountId) -> bool {
vec![].contains(a)
[].contains(a)
}
}

Expand Down

0 comments on commit 16db713

Please sign in to comment.