common_runtime/lib.rs
1#![cfg_attr(not(feature = "std"), no_std)]
2
3pub mod constants;
4pub mod extensions;
5pub mod fee;
6pub mod proxy;
7pub mod signature;
8pub mod weights;
9
10/// Macro to set a value (e.g. when using the `parameter_types` macro) to either a production value
11/// or to an environment variable or testing value (in case the `frequency-local` feature is selected or in instant sealing mode).
12/// Note that the environment variable is evaluated _at compile time_.
13///
14/// Usage:
15/// ```Rust
16/// parameter_types! {
17/// // Note that the env variable version parameter cannot be const.
18/// pub LaunchPeriod: BlockNumber = prod_or_testnet_or_local!(7 * DAYS, 28 * DAYS, 1 * MINUTES);
19/// pub const VotingPeriod: BlockNumber = prod_or_testnet_or_local!(7 * DAYS, 28 * DAYS, 1 * MINUTES);
20/// }
21/// ```
22#[macro_export]
23macro_rules! prod_or_testnet_or_local {
24 ($prod:expr, $test:expr, $local:expr) => {
25 if cfg!(any(feature = "frequency-local", feature = "frequency-no-relay",)) {
26 $local
27 } else if cfg!(feature = "frequency-testnet") {
28 $test
29 } else if cfg!(feature = "frequency-westend") {
30 $test
31 } else {
32 $prod
33 }
34 };
35}