pub trait DefaultConfigurationValues {
    fn p2p_listen_port() -> u16 { ... }
    fn rpc_ws_listen_port() -> u16 { ... }
    fn rpc_http_listen_port() -> u16 { ... }
    fn prometheus_listen_port() -> u16 { ... }
}
Expand description

Default configuration values used by Substrate

These values will be used by CliConfiguration to set default values for e.g. the listen port or the RPC port.

Provided Methods§

The port Substrate should listen on for p2p connections.

By default this is 30333.

Examples found in repository?
src/config.rs (line 525)
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
	fn create_configuration<C: SubstrateCli>(
		&self,
		cli: &C,
		tokio_handle: tokio::runtime::Handle,
	) -> Result<Configuration> {
		let is_dev = self.is_dev()?;
		let chain_id = self.chain_id(is_dev)?;
		let chain_spec = cli.load_spec(&chain_id)?;
		let base_path = self
			.base_path()?
			.unwrap_or_else(|| BasePath::from_project("", "", &C::executable_name()));
		let config_dir = base_path.config_dir(chain_spec.id());
		let net_config_dir = config_dir.join(DEFAULT_NETWORK_CONFIG_PATH);
		let client_id = C::client_id();
		let database_cache_size = self.database_cache_size()?.unwrap_or(1024);
		let database = self.database()?.unwrap_or(
			#[cfg(feature = "rocksdb")]
			{
				Database::RocksDb
			},
			#[cfg(not(feature = "rocksdb"))]
			{
				Database::ParityDb
			},
		);
		let node_key = self.node_key(&net_config_dir)?;
		let role = self.role(is_dev)?;
		let max_runtime_instances = self.max_runtime_instances()?.unwrap_or(8);
		let is_validator = role.is_authority();
		let (keystore_remote, keystore) = self.keystore_config(&config_dir)?;
		let telemetry_endpoints = self.telemetry_endpoints(&chain_spec)?;
		let runtime_cache_size = self.runtime_cache_size()?;

		Ok(Configuration {
			impl_name: C::impl_name(),
			impl_version: C::impl_version(),
			tokio_handle,
			transaction_pool: self.transaction_pool(is_dev)?,
			network: self.network_config(
				&chain_spec,
				is_dev,
				is_validator,
				net_config_dir,
				client_id.as_str(),
				self.node_name()?.as_str(),
				node_key,
				DCV::p2p_listen_port(),
			)?,
			keystore_remote,
			keystore,
			database: self.database_config(&config_dir, database_cache_size, database)?,
			trie_cache_maximum_size: self.trie_cache_maximum_size()?,
			state_pruning: self.state_pruning()?,
			blocks_pruning: self.blocks_pruning()?,
			wasm_method: self.wasm_method()?,
			wasm_runtime_overrides: self.wasm_runtime_overrides(),
			execution_strategies: self.execution_strategies(is_dev, is_validator)?,
			rpc_http: self.rpc_http(DCV::rpc_http_listen_port())?,
			rpc_ws: self.rpc_ws(DCV::rpc_ws_listen_port())?,
			rpc_ipc: self.rpc_ipc()?,
			rpc_methods: self.rpc_methods()?,
			rpc_ws_max_connections: self.rpc_ws_max_connections()?,
			rpc_cors: self.rpc_cors(is_dev)?,
			rpc_max_payload: self.rpc_max_payload()?,
			rpc_max_request_size: self.rpc_max_request_size()?,
			rpc_max_response_size: self.rpc_max_response_size()?,
			rpc_id_provider: None,
			rpc_max_subs_per_conn: self.rpc_max_subscriptions_per_connection()?,
			ws_max_out_buffer_capacity: self.ws_max_out_buffer_capacity()?,
			prometheus_config: self
				.prometheus_config(DCV::prometheus_listen_port(), &chain_spec)?,
			telemetry_endpoints,
			default_heap_pages: self.default_heap_pages()?,
			offchain_worker: self.offchain_worker(&role)?,
			force_authoring: self.force_authoring()?,
			disable_grandpa: self.disable_grandpa()?,
			dev_key_seed: self.dev_key_seed(is_dev)?,
			tracing_targets: self.tracing_targets()?,
			tracing_receiver: self.tracing_receiver()?,
			chain_spec,
			max_runtime_instances,
			announce_block: self.announce_block()?,
			role,
			base_path: Some(base_path),
			informant_output_format: Default::default(),
			runtime_cache_size,
		})
	}

The port Substrate should listen on for websocket connections.

By default this is 9944.

Examples found in repository?
src/config.rs (line 537)
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
	fn create_configuration<C: SubstrateCli>(
		&self,
		cli: &C,
		tokio_handle: tokio::runtime::Handle,
	) -> Result<Configuration> {
		let is_dev = self.is_dev()?;
		let chain_id = self.chain_id(is_dev)?;
		let chain_spec = cli.load_spec(&chain_id)?;
		let base_path = self
			.base_path()?
			.unwrap_or_else(|| BasePath::from_project("", "", &C::executable_name()));
		let config_dir = base_path.config_dir(chain_spec.id());
		let net_config_dir = config_dir.join(DEFAULT_NETWORK_CONFIG_PATH);
		let client_id = C::client_id();
		let database_cache_size = self.database_cache_size()?.unwrap_or(1024);
		let database = self.database()?.unwrap_or(
			#[cfg(feature = "rocksdb")]
			{
				Database::RocksDb
			},
			#[cfg(not(feature = "rocksdb"))]
			{
				Database::ParityDb
			},
		);
		let node_key = self.node_key(&net_config_dir)?;
		let role = self.role(is_dev)?;
		let max_runtime_instances = self.max_runtime_instances()?.unwrap_or(8);
		let is_validator = role.is_authority();
		let (keystore_remote, keystore) = self.keystore_config(&config_dir)?;
		let telemetry_endpoints = self.telemetry_endpoints(&chain_spec)?;
		let runtime_cache_size = self.runtime_cache_size()?;

		Ok(Configuration {
			impl_name: C::impl_name(),
			impl_version: C::impl_version(),
			tokio_handle,
			transaction_pool: self.transaction_pool(is_dev)?,
			network: self.network_config(
				&chain_spec,
				is_dev,
				is_validator,
				net_config_dir,
				client_id.as_str(),
				self.node_name()?.as_str(),
				node_key,
				DCV::p2p_listen_port(),
			)?,
			keystore_remote,
			keystore,
			database: self.database_config(&config_dir, database_cache_size, database)?,
			trie_cache_maximum_size: self.trie_cache_maximum_size()?,
			state_pruning: self.state_pruning()?,
			blocks_pruning: self.blocks_pruning()?,
			wasm_method: self.wasm_method()?,
			wasm_runtime_overrides: self.wasm_runtime_overrides(),
			execution_strategies: self.execution_strategies(is_dev, is_validator)?,
			rpc_http: self.rpc_http(DCV::rpc_http_listen_port())?,
			rpc_ws: self.rpc_ws(DCV::rpc_ws_listen_port())?,
			rpc_ipc: self.rpc_ipc()?,
			rpc_methods: self.rpc_methods()?,
			rpc_ws_max_connections: self.rpc_ws_max_connections()?,
			rpc_cors: self.rpc_cors(is_dev)?,
			rpc_max_payload: self.rpc_max_payload()?,
			rpc_max_request_size: self.rpc_max_request_size()?,
			rpc_max_response_size: self.rpc_max_response_size()?,
			rpc_id_provider: None,
			rpc_max_subs_per_conn: self.rpc_max_subscriptions_per_connection()?,
			ws_max_out_buffer_capacity: self.ws_max_out_buffer_capacity()?,
			prometheus_config: self
				.prometheus_config(DCV::prometheus_listen_port(), &chain_spec)?,
			telemetry_endpoints,
			default_heap_pages: self.default_heap_pages()?,
			offchain_worker: self.offchain_worker(&role)?,
			force_authoring: self.force_authoring()?,
			disable_grandpa: self.disable_grandpa()?,
			dev_key_seed: self.dev_key_seed(is_dev)?,
			tracing_targets: self.tracing_targets()?,
			tracing_receiver: self.tracing_receiver()?,
			chain_spec,
			max_runtime_instances,
			announce_block: self.announce_block()?,
			role,
			base_path: Some(base_path),
			informant_output_format: Default::default(),
			runtime_cache_size,
		})
	}

The port Substrate should listen on for http connections.

By default this is 9933.

Examples found in repository?
src/config.rs (line 536)
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
	fn create_configuration<C: SubstrateCli>(
		&self,
		cli: &C,
		tokio_handle: tokio::runtime::Handle,
	) -> Result<Configuration> {
		let is_dev = self.is_dev()?;
		let chain_id = self.chain_id(is_dev)?;
		let chain_spec = cli.load_spec(&chain_id)?;
		let base_path = self
			.base_path()?
			.unwrap_or_else(|| BasePath::from_project("", "", &C::executable_name()));
		let config_dir = base_path.config_dir(chain_spec.id());
		let net_config_dir = config_dir.join(DEFAULT_NETWORK_CONFIG_PATH);
		let client_id = C::client_id();
		let database_cache_size = self.database_cache_size()?.unwrap_or(1024);
		let database = self.database()?.unwrap_or(
			#[cfg(feature = "rocksdb")]
			{
				Database::RocksDb
			},
			#[cfg(not(feature = "rocksdb"))]
			{
				Database::ParityDb
			},
		);
		let node_key = self.node_key(&net_config_dir)?;
		let role = self.role(is_dev)?;
		let max_runtime_instances = self.max_runtime_instances()?.unwrap_or(8);
		let is_validator = role.is_authority();
		let (keystore_remote, keystore) = self.keystore_config(&config_dir)?;
		let telemetry_endpoints = self.telemetry_endpoints(&chain_spec)?;
		let runtime_cache_size = self.runtime_cache_size()?;

		Ok(Configuration {
			impl_name: C::impl_name(),
			impl_version: C::impl_version(),
			tokio_handle,
			transaction_pool: self.transaction_pool(is_dev)?,
			network: self.network_config(
				&chain_spec,
				is_dev,
				is_validator,
				net_config_dir,
				client_id.as_str(),
				self.node_name()?.as_str(),
				node_key,
				DCV::p2p_listen_port(),
			)?,
			keystore_remote,
			keystore,
			database: self.database_config(&config_dir, database_cache_size, database)?,
			trie_cache_maximum_size: self.trie_cache_maximum_size()?,
			state_pruning: self.state_pruning()?,
			blocks_pruning: self.blocks_pruning()?,
			wasm_method: self.wasm_method()?,
			wasm_runtime_overrides: self.wasm_runtime_overrides(),
			execution_strategies: self.execution_strategies(is_dev, is_validator)?,
			rpc_http: self.rpc_http(DCV::rpc_http_listen_port())?,
			rpc_ws: self.rpc_ws(DCV::rpc_ws_listen_port())?,
			rpc_ipc: self.rpc_ipc()?,
			rpc_methods: self.rpc_methods()?,
			rpc_ws_max_connections: self.rpc_ws_max_connections()?,
			rpc_cors: self.rpc_cors(is_dev)?,
			rpc_max_payload: self.rpc_max_payload()?,
			rpc_max_request_size: self.rpc_max_request_size()?,
			rpc_max_response_size: self.rpc_max_response_size()?,
			rpc_id_provider: None,
			rpc_max_subs_per_conn: self.rpc_max_subscriptions_per_connection()?,
			ws_max_out_buffer_capacity: self.ws_max_out_buffer_capacity()?,
			prometheus_config: self
				.prometheus_config(DCV::prometheus_listen_port(), &chain_spec)?,
			telemetry_endpoints,
			default_heap_pages: self.default_heap_pages()?,
			offchain_worker: self.offchain_worker(&role)?,
			force_authoring: self.force_authoring()?,
			disable_grandpa: self.disable_grandpa()?,
			dev_key_seed: self.dev_key_seed(is_dev)?,
			tracing_targets: self.tracing_targets()?,
			tracing_receiver: self.tracing_receiver()?,
			chain_spec,
			max_runtime_instances,
			announce_block: self.announce_block()?,
			role,
			base_path: Some(base_path),
			informant_output_format: Default::default(),
			runtime_cache_size,
		})
	}

The port Substrate should listen on for prometheus connections.

By default this is 9615.

Examples found in repository?
src/config.rs (line 549)
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
	fn create_configuration<C: SubstrateCli>(
		&self,
		cli: &C,
		tokio_handle: tokio::runtime::Handle,
	) -> Result<Configuration> {
		let is_dev = self.is_dev()?;
		let chain_id = self.chain_id(is_dev)?;
		let chain_spec = cli.load_spec(&chain_id)?;
		let base_path = self
			.base_path()?
			.unwrap_or_else(|| BasePath::from_project("", "", &C::executable_name()));
		let config_dir = base_path.config_dir(chain_spec.id());
		let net_config_dir = config_dir.join(DEFAULT_NETWORK_CONFIG_PATH);
		let client_id = C::client_id();
		let database_cache_size = self.database_cache_size()?.unwrap_or(1024);
		let database = self.database()?.unwrap_or(
			#[cfg(feature = "rocksdb")]
			{
				Database::RocksDb
			},
			#[cfg(not(feature = "rocksdb"))]
			{
				Database::ParityDb
			},
		);
		let node_key = self.node_key(&net_config_dir)?;
		let role = self.role(is_dev)?;
		let max_runtime_instances = self.max_runtime_instances()?.unwrap_or(8);
		let is_validator = role.is_authority();
		let (keystore_remote, keystore) = self.keystore_config(&config_dir)?;
		let telemetry_endpoints = self.telemetry_endpoints(&chain_spec)?;
		let runtime_cache_size = self.runtime_cache_size()?;

		Ok(Configuration {
			impl_name: C::impl_name(),
			impl_version: C::impl_version(),
			tokio_handle,
			transaction_pool: self.transaction_pool(is_dev)?,
			network: self.network_config(
				&chain_spec,
				is_dev,
				is_validator,
				net_config_dir,
				client_id.as_str(),
				self.node_name()?.as_str(),
				node_key,
				DCV::p2p_listen_port(),
			)?,
			keystore_remote,
			keystore,
			database: self.database_config(&config_dir, database_cache_size, database)?,
			trie_cache_maximum_size: self.trie_cache_maximum_size()?,
			state_pruning: self.state_pruning()?,
			blocks_pruning: self.blocks_pruning()?,
			wasm_method: self.wasm_method()?,
			wasm_runtime_overrides: self.wasm_runtime_overrides(),
			execution_strategies: self.execution_strategies(is_dev, is_validator)?,
			rpc_http: self.rpc_http(DCV::rpc_http_listen_port())?,
			rpc_ws: self.rpc_ws(DCV::rpc_ws_listen_port())?,
			rpc_ipc: self.rpc_ipc()?,
			rpc_methods: self.rpc_methods()?,
			rpc_ws_max_connections: self.rpc_ws_max_connections()?,
			rpc_cors: self.rpc_cors(is_dev)?,
			rpc_max_payload: self.rpc_max_payload()?,
			rpc_max_request_size: self.rpc_max_request_size()?,
			rpc_max_response_size: self.rpc_max_response_size()?,
			rpc_id_provider: None,
			rpc_max_subs_per_conn: self.rpc_max_subscriptions_per_connection()?,
			ws_max_out_buffer_capacity: self.ws_max_out_buffer_capacity()?,
			prometheus_config: self
				.prometheus_config(DCV::prometheus_listen_port(), &chain_spec)?,
			telemetry_endpoints,
			default_heap_pages: self.default_heap_pages()?,
			offchain_worker: self.offchain_worker(&role)?,
			force_authoring: self.force_authoring()?,
			disable_grandpa: self.disable_grandpa()?,
			dev_key_seed: self.dev_key_seed(is_dev)?,
			tracing_targets: self.tracing_targets()?,
			tracing_receiver: self.tracing_receiver()?,
			chain_spec,
			max_runtime_instances,
			announce_block: self.announce_block()?,
			role,
			base_path: Some(base_path),
			informant_output_format: Default::default(),
			runtime_cache_size,
		})
	}

Implementations on Foreign Types§

Implementors§