1use std::net::SocketAddr;
5use std::path::PathBuf;
6use std::time::Duration;
7
8use consensus_config::{
9 NetworkPublicKey, ObserverParameters, Parameters as ConsensusParameters, PeerRecord,
10};
11use fastcrypto::encoding::{Encoding, Hex};
12use fastcrypto::traits::KeyPair;
13use sui_config::node::{
14 AuthorityKeyPairWithPath, AuthorityOverloadConfig, AuthorityStorePruningConfig,
15 CheckpointExecutorConfig, ConsensusTransactionPoolConfig, DBCheckpointConfig,
16 DEFAULT_GRPC_CONCURRENCY_LIMIT, ExecutionCacheConfig, ExecutionTimeObserverConfig,
17 ExpensiveSafetyCheckConfig, FundsWithdrawSchedulerType, Genesis, KeyPairWithPath,
18 StateSnapshotConfig, default_end_of_epoch_broadcast_channel_capacity,
19};
20use sui_config::node::{RunWithRange, TransactionDriverConfig, default_zklogin_oauth_providers};
21use sui_config::p2p::{P2pConfig, SeedPeer, StateSyncConfig};
22use sui_config::transaction_deny_config::PeerDenySyncConfig;
23use sui_config::verifier_signing_config::VerifierSigningConfig;
24use sui_config::{
25 AUTHORITIES_DB_NAME, CONSENSUS_DB_NAME, ConsensusConfig, FULL_NODE_DB_PATH, NodeConfig,
26 local_ip_utils,
27};
28use sui_protocol_config::Chain;
29use sui_types::crypto::{AuthorityKeyPair, AuthorityPublicKeyBytes, NetworkKeyPair, SuiKeyPair};
30use sui_types::multiaddr::Multiaddr;
31use sui_types::node_role::FullNodeSyncMode;
32use sui_types::supported_protocol_versions::SupportedProtocolVersions;
33use sui_types::traffic_control::{PolicyConfig, RemoteFirewallConfig};
34
35use crate::genesis_config::{ValidatorGenesisConfig, ValidatorGenesisConfigBuilder};
36use crate::network_config::NetworkConfig;
37
38#[derive(Clone, Default)]
41pub struct ValidatorConfigBuilder {
42 config_directory: Option<PathBuf>,
43 supported_protocol_versions: Option<SupportedProtocolVersions>,
44 force_unpruned_checkpoints: bool,
45 jwk_fetch_interval: Option<Duration>,
46 authority_overload_config: Option<AuthorityOverloadConfig>,
47 execution_cache_config: Option<ExecutionCacheConfig>,
48 data_ingestion_dir: Option<PathBuf>,
49 policy_config: Option<PolicyConfig>,
50 firewall_config: Option<RemoteFirewallConfig>,
51 global_state_hash_v2: bool,
52 funds_withdraw_scheduler_type: FundsWithdrawSchedulerType,
53 execution_time_observer_config: Option<ExecutionTimeObserverConfig>,
54 chain_override: Option<Chain>,
55 state_sync_config: Option<StateSyncConfig>,
56 observer_config: Option<ObserverParameters>,
57 peer_deny_sync_config: Option<PeerDenySyncConfig>,
58 consensus_transaction_pool_config: Option<ConsensusTransactionPoolConfig>,
59}
60
61impl ValidatorConfigBuilder {
62 pub fn new() -> Self {
63 Self {
64 global_state_hash_v2: true,
65 ..Default::default()
66 }
67 }
68
69 pub fn with_chain_override(mut self, chain: Chain) -> Self {
70 assert!(self.chain_override.is_none(), "Chain override already set");
71 self.chain_override = Some(chain);
72 self
73 }
74
75 pub fn with_config_directory(mut self, config_directory: PathBuf) -> Self {
76 assert!(self.config_directory.is_none());
77 self.config_directory = Some(config_directory);
78 self
79 }
80
81 pub fn with_supported_protocol_versions(
82 mut self,
83 supported_protocol_versions: SupportedProtocolVersions,
84 ) -> Self {
85 assert!(self.supported_protocol_versions.is_none());
86 self.supported_protocol_versions = Some(supported_protocol_versions);
87 self
88 }
89
90 pub fn with_unpruned_checkpoints(mut self) -> Self {
91 self.force_unpruned_checkpoints = true;
92 self
93 }
94
95 pub fn with_jwk_fetch_interval(mut self, i: Duration) -> Self {
96 self.jwk_fetch_interval = Some(i);
97 self
98 }
99
100 pub fn with_authority_overload_config(mut self, config: AuthorityOverloadConfig) -> Self {
101 self.authority_overload_config = Some(config);
102 self
103 }
104
105 pub fn with_consensus_transaction_pool_config(
106 mut self,
107 config: ConsensusTransactionPoolConfig,
108 ) -> Self {
109 self.consensus_transaction_pool_config = Some(config);
110 self
111 }
112
113 pub fn with_execution_cache_config(mut self, config: ExecutionCacheConfig) -> Self {
114 self.execution_cache_config = Some(config);
115 self
116 }
117
118 pub fn with_data_ingestion_dir(mut self, path: PathBuf) -> Self {
119 self.data_ingestion_dir = Some(path);
120 self
121 }
122
123 pub fn with_policy_config(mut self, config: Option<PolicyConfig>) -> Self {
124 self.policy_config = config;
125 self
126 }
127
128 pub fn with_firewall_config(mut self, config: Option<RemoteFirewallConfig>) -> Self {
129 self.firewall_config = config;
130 self
131 }
132
133 pub fn with_global_state_hash_v2_enabled(mut self, enabled: bool) -> Self {
134 self.global_state_hash_v2 = enabled;
135 self
136 }
137
138 pub fn with_funds_withdraw_scheduler_type(
139 mut self,
140 scheduler_type: FundsWithdrawSchedulerType,
141 ) -> Self {
142 self.funds_withdraw_scheduler_type = scheduler_type;
143 self
144 }
145
146 pub fn with_execution_time_observer_config(
147 mut self,
148 config: ExecutionTimeObserverConfig,
149 ) -> Self {
150 self.execution_time_observer_config = Some(config);
151 self
152 }
153
154 pub fn with_state_sync_config(mut self, config: StateSyncConfig) -> Self {
155 self.state_sync_config = Some(config);
156 self
157 }
158
159 pub fn with_observer_config(mut self, config: ObserverParameters) -> Self {
160 self.observer_config = Some(config);
161 self
162 }
163
164 pub fn with_peer_deny_sync_config(mut self, config: PeerDenySyncConfig) -> Self {
165 self.peer_deny_sync_config = Some(config);
166 self
167 }
168
169 pub fn build(
170 self,
171 validator: ValidatorGenesisConfig,
172 genesis: sui_config::genesis::Genesis,
173 ) -> NodeConfig {
174 let key_path = get_key_path(&validator.key_pair);
175 let config_directory = self
176 .config_directory
177 .unwrap_or_else(|| mysten_common::tempdir().unwrap().keep());
178 let db_path = config_directory
179 .join(AUTHORITIES_DB_NAME)
180 .join(key_path.clone());
181
182 let network_address = validator.network_address;
183 let consensus_db_path = config_directory.join(CONSENSUS_DB_NAME).join(key_path);
184 let localhost = local_ip_utils::localhost_for_testing();
185 let parameters = self
186 .observer_config
187 .map(|observer_config| ConsensusParameters {
188 observer: ObserverParameters {
189 server_port: observer_config
190 .server_port
191 .or_else(|| Some(local_ip_utils::get_available_port(&localhost))),
192 allowlist: observer_config.allowlist,
193 quorum_release: observer_config.quorum_release,
194 peers: observer_config.peers,
195 },
196 ..Default::default()
197 });
198 let consensus_config = ConsensusConfig {
199 db_path: consensus_db_path,
200 db_retention_epochs: None,
201 db_pruner_period_secs: None,
202 max_pending_transactions: None,
203 parameters,
204 listen_address: None,
205 external_address: None,
206 };
207
208 let p2p_config = P2pConfig {
209 listen_address: validator.p2p_listen_address.unwrap_or_else(|| {
210 validator
211 .p2p_address
212 .udp_multiaddr_to_listen_address()
213 .unwrap()
214 }),
215 external_address: Some(validator.p2p_address),
216 state_sync: Some(if let Some(mut config) = self.state_sync_config {
219 if config.checkpoint_content_timeout_ms.is_none() {
220 config.checkpoint_content_timeout_ms = Some(10_000);
221 }
222 config
223 } else {
224 StateSyncConfig {
225 checkpoint_content_timeout_ms: Some(10_000),
226 ..Default::default()
227 }
228 }),
229 ..Default::default()
230 };
231
232 let mut pruning_config = AuthorityStorePruningConfig::default();
233 if self.force_unpruned_checkpoints {
234 pruning_config.set_num_epochs_to_retain_for_checkpoints(None);
235 }
236 let pruning_config = pruning_config;
237 let checkpoint_executor_config = CheckpointExecutorConfig {
238 data_ingestion_dir: self.data_ingestion_dir,
239 ..Default::default()
240 };
241
242 NodeConfig {
243 recent_submission_dedup_window_ms: None,
244 address_prober: None,
245 protocol_key_pair: AuthorityKeyPairWithPath::new(validator.key_pair),
246 network_key_pair: KeyPairWithPath::new(SuiKeyPair::Ed25519(validator.network_key_pair)),
247 account_key_pair: KeyPairWithPath::new(validator.account_key_pair),
248 worker_key_pair: KeyPairWithPath::new(SuiKeyPair::Ed25519(validator.worker_key_pair)),
249 db_path,
250 network_address,
251 metrics_address: validator.metrics_address,
252 admin_interface_port: local_ip_utils::get_available_port(&localhost),
253 json_rpc_address: local_ip_utils::new_tcp_address_for_testing(&localhost)
254 .to_socket_addr()
255 .unwrap(),
256 consensus_config: Some(consensus_config),
257 fullnode_sync_mode: None,
258 genesis: sui_config::node::Genesis::new(genesis),
259 grpc_load_shed: None,
260 grpc_concurrency_limit: Some(DEFAULT_GRPC_CONCURRENCY_LIMIT),
261 p2p_config,
262 authority_store_pruning_config: pruning_config,
263 end_of_epoch_broadcast_channel_capacity:
264 default_end_of_epoch_broadcast_channel_capacity(),
265 checkpoint_executor_config,
266 metrics: None,
267 supported_protocol_versions: self.supported_protocol_versions,
268 db_checkpoint_config: Default::default(),
269 expensive_safety_check_config: ExpensiveSafetyCheckConfig::default(),
271 transaction_deny_config: Default::default(),
272 peer_deny_sync_config: self.peer_deny_sync_config.unwrap_or_default(),
273 dev_inspect_disabled: false,
274 certificate_deny_config: Default::default(),
275 state_debug_dump_config: Default::default(),
276 state_archive_read_config: vec![],
277 state_snapshot_write_config: StateSnapshotConfig::default(),
278 rpc: Some(sui_rpc_api::Config {
279 ..Default::default()
280 }),
281 jwk_fetch_interval_seconds: self
282 .jwk_fetch_interval
283 .map(|i| i.as_secs())
284 .unwrap_or(3600),
285 zklogin_oauth_providers: default_zklogin_oauth_providers(),
286 authority_overload_config: self.authority_overload_config.unwrap_or_default(),
287 execution_cache: self.execution_cache_config.unwrap_or_default(),
288 run_with_range: None,
289 policy_config: self.policy_config,
290 firewall_config: self.firewall_config,
291 state_accumulator_v2: self.global_state_hash_v2,
292 funds_withdraw_scheduler_type: self.funds_withdraw_scheduler_type,
293 enable_soft_bundle: true,
294 enable_simulate_allowed_proposers: true,
295 verifier_signing_config: VerifierSigningConfig::default(),
296 enable_db_write_stall: None,
297 enable_db_sync_to_disk: None,
298 execution_time_observer_config: self.execution_time_observer_config,
299 chain_override_for_testing: self.chain_override,
300 validator_client_monitor_config: None,
301 fork_recovery: None,
302 transaction_driver_config: Some(TransactionDriverConfig::default()),
303 consensus_transaction_pool: self.consensus_transaction_pool_config.unwrap_or_default(),
304 congestion_log: None,
305 }
306 }
307
308 pub fn build_new_validator<R: rand::RngCore + rand::CryptoRng>(
309 self,
310 rng: &mut R,
311 network_config: &NetworkConfig,
312 ) -> NodeConfig {
313 let validator_config = ValidatorGenesisConfigBuilder::new().build(rng);
314 self.build(validator_config, network_config.genesis.clone())
315 }
316}
317
318#[derive(Clone, Debug, Default)]
319pub struct FullnodeConfigBuilder {
320 config_directory: Option<PathBuf>,
321 rpc_port: Option<u16>,
323 rpc_addr: Option<SocketAddr>,
324 supported_protocol_versions: Option<SupportedProtocolVersions>,
325 db_checkpoint_config: Option<DBCheckpointConfig>,
326 expensive_safety_check_config: Option<ExpensiveSafetyCheckConfig>,
327 db_path: Option<PathBuf>,
328 network_address: Option<Multiaddr>,
329 json_rpc_address: Option<SocketAddr>,
330 metrics_address: Option<SocketAddr>,
331 admin_interface_port: Option<u16>,
332 genesis: Option<Genesis>,
333 p2p_external_address: Option<Multiaddr>,
334 p2p_listen_address: Option<SocketAddr>,
335 network_key_pair: Option<KeyPairWithPath>,
336 run_with_range: Option<RunWithRange>,
337 data_ingestion_dir: Option<PathBuf>,
338 disable_pruning: bool,
339 chain_override: Option<Chain>,
340 transaction_driver_config: Option<TransactionDriverConfig>,
341 rpc_config: Option<sui_config::RpcConfig>,
342 state_sync_config: Option<StateSyncConfig>,
343 observer_setup: Option<ObserverSetup>,
344}
345
346#[derive(Clone, Debug)]
348enum ObserverSetup {
349 Explicit(ObserverParameters),
351 SubscribeToValidator { index: usize },
354}
355
356pub fn observer_peer_record(validator_config: &NodeConfig) -> PeerRecord {
359 let observer_port = validator_config
360 .consensus_config()
361 .and_then(|c| c.parameters.as_ref())
362 .and_then(|p| p.observer.server_port)
363 .expect("validator must have its observer server enabled");
364 let public_key = NetworkPublicKey::new(validator_config.network_key_pair().public().clone());
365 let host = validator_config
366 .network_address
367 .to_socket_addr()
368 .unwrap()
369 .ip()
370 .to_string();
371 let address = format!("/ip4/{host}/udp/{observer_port}/http")
372 .parse()
373 .unwrap();
374 PeerRecord {
375 public_key,
376 address,
377 }
378}
379
380impl FullnodeConfigBuilder {
381 pub fn new() -> Self {
382 Self::default()
383 }
384
385 pub fn with_chain_override(mut self, chain: Chain) -> Self {
386 assert!(self.chain_override.is_none(), "Chain override already set");
387 self.chain_override = Some(chain);
388 self
389 }
390
391 pub fn with_config_directory(mut self, config_directory: PathBuf) -> Self {
392 self.config_directory = Some(config_directory);
393 self
394 }
395
396 pub fn with_rpc_port(mut self, port: u16) -> Self {
397 assert!(self.rpc_addr.is_none() && self.rpc_port.is_none());
398 self.rpc_port = Some(port);
399 self
400 }
401
402 pub fn with_rpc_addr(mut self, addr: SocketAddr) -> Self {
403 assert!(self.rpc_addr.is_none() && self.rpc_port.is_none());
404 self.rpc_addr = Some(addr);
405 self
406 }
407
408 pub fn with_rpc_config(mut self, rpc_config: sui_config::RpcConfig) -> Self {
409 self.rpc_config = Some(rpc_config);
410 self
411 }
412
413 pub fn with_supported_protocol_versions(mut self, versions: SupportedProtocolVersions) -> Self {
414 self.supported_protocol_versions = Some(versions);
415 self
416 }
417
418 pub fn with_db_checkpoint_config(mut self, db_checkpoint_config: DBCheckpointConfig) -> Self {
419 self.db_checkpoint_config = Some(db_checkpoint_config);
420 self
421 }
422
423 pub fn with_disable_pruning(mut self, disable_pruning: bool) -> Self {
424 self.disable_pruning = disable_pruning;
425 self
426 }
427
428 pub fn with_expensive_safety_check_config(
429 mut self,
430 expensive_safety_check_config: ExpensiveSafetyCheckConfig,
431 ) -> Self {
432 self.expensive_safety_check_config = Some(expensive_safety_check_config);
433 self
434 }
435
436 pub fn with_db_path(mut self, db_path: PathBuf) -> Self {
437 self.db_path = Some(db_path);
438 self
439 }
440
441 pub fn with_network_address(mut self, network_address: Multiaddr) -> Self {
442 self.network_address = Some(network_address);
443 self
444 }
445
446 pub fn with_json_rpc_address(mut self, json_rpc_address: SocketAddr) -> Self {
447 self.json_rpc_address = Some(json_rpc_address);
448 self
449 }
450
451 pub fn with_metrics_address(mut self, metrics_address: SocketAddr) -> Self {
452 self.metrics_address = Some(metrics_address);
453 self
454 }
455
456 pub fn with_admin_interface_port(mut self, admin_interface_port: u16) -> Self {
457 self.admin_interface_port = Some(admin_interface_port);
458 self
459 }
460
461 pub fn with_genesis(mut self, genesis: Genesis) -> Self {
462 self.genesis = Some(genesis);
463 self
464 }
465
466 pub fn with_p2p_external_address(mut self, p2p_external_address: Multiaddr) -> Self {
467 self.p2p_external_address = Some(p2p_external_address);
468 self
469 }
470
471 pub fn with_p2p_listen_address(mut self, p2p_listen_address: SocketAddr) -> Self {
472 self.p2p_listen_address = Some(p2p_listen_address);
473 self
474 }
475
476 pub fn with_network_key_pair(mut self, network_key_pair: Option<NetworkKeyPair>) -> Self {
477 if let Some(network_key_pair) = network_key_pair {
478 self.network_key_pair =
479 Some(KeyPairWithPath::new(SuiKeyPair::Ed25519(network_key_pair)));
480 }
481 self
482 }
483
484 pub fn with_run_with_range(mut self, run_with_range: Option<RunWithRange>) -> Self {
485 if let Some(run_with_range) = run_with_range {
486 self.run_with_range = Some(run_with_range);
487 }
488 self
489 }
490
491 pub fn with_data_ingestion_dir(mut self, path: Option<PathBuf>) -> Self {
492 self.data_ingestion_dir = path;
493 self
494 }
495
496 pub fn with_transaction_driver_config(
497 mut self,
498 config: Option<TransactionDriverConfig>,
499 ) -> Self {
500 self.transaction_driver_config = config;
501 self
502 }
503
504 pub fn with_state_sync_config(mut self, config: StateSyncConfig) -> Self {
505 self.state_sync_config = Some(config);
506 self
507 }
508
509 pub fn with_observer_config(mut self, config: ObserverParameters) -> Self {
510 self.observer_setup = Some(ObserverSetup::Explicit(config));
511 self
512 }
513
514 pub fn with_observer_subscribed_to_validator(mut self, index: usize) -> Self {
518 self.observer_setup = Some(ObserverSetup::SubscribeToValidator { index });
519 self
520 }
521
522 pub fn build<R: rand::RngCore + rand::CryptoRng>(
523 self,
524 rng: &mut R,
525 network_config: &NetworkConfig,
526 ) -> NodeConfig {
527 let validator_config = ValidatorGenesisConfigBuilder::new().build(rng);
530 let ip = validator_config
531 .network_address
532 .to_socket_addr()
533 .unwrap()
534 .ip()
535 .to_string();
536
537 let key_path = get_key_path(&validator_config.key_pair);
538 let config_directory = self
539 .config_directory
540 .unwrap_or_else(|| mysten_common::tempdir().unwrap().keep());
541
542 let consensus_db_path = config_directory.join(CONSENSUS_DB_NAME).join(&key_path);
543
544 let observer_config = self.observer_setup.map(|setup| match setup {
547 ObserverSetup::Explicit(config) => config,
548 ObserverSetup::SubscribeToValidator { index } => {
549 let validator_config = network_config
550 .validator_configs
551 .get(index)
552 .unwrap_or_else(|| panic!("no validator at index {index} in network config"));
553 ObserverParameters {
554 peers: vec![observer_peer_record(validator_config)],
555 ..Default::default()
556 }
557 }
558 });
559
560 let fullnode_sync_mode = observer_config.as_ref().map(|c| {
561 assert!(
563 !c.peers.is_empty(),
564 "observer fullnode must be configured with at least one peer"
565 );
566 FullNodeSyncMode::ConsensusObserver
567 });
568
569 let consensus_config = observer_config.map(|observer_config| ConsensusConfig {
571 db_path: consensus_db_path,
572 db_retention_epochs: None,
573 db_pruner_period_secs: None,
574 max_pending_transactions: None,
575 parameters: Some(ConsensusParameters {
576 observer: ObserverParameters {
577 server_port: observer_config
578 .server_port
579 .or_else(|| Some(local_ip_utils::get_available_port(&ip))),
580 allowlist: observer_config.allowlist,
581 quorum_release: observer_config.quorum_release,
582 peers: observer_config.peers,
583 },
584 ..Default::default()
585 }),
586 listen_address: None,
587 external_address: None,
588 });
589
590 let p2p_config = {
591 let seed_peers = network_config
592 .validator_configs
593 .iter()
594 .map(|config| SeedPeer {
595 peer_id: Some(anemo::PeerId(
596 config.network_key_pair().public().0.to_bytes(),
597 )),
598 address: config.p2p_config.external_address.clone().unwrap(),
599 })
600 .collect();
601
602 P2pConfig {
603 listen_address: self.p2p_listen_address.unwrap_or_else(|| {
604 validator_config.p2p_listen_address.unwrap_or_else(|| {
605 validator_config
606 .p2p_address
607 .udp_multiaddr_to_listen_address()
608 .unwrap()
609 })
610 }),
611 external_address: self
612 .p2p_external_address
613 .or(Some(validator_config.p2p_address.clone())),
614 seed_peers,
615 state_sync: Some(if let Some(mut config) = self.state_sync_config {
618 if config.checkpoint_content_timeout_ms.is_none() {
619 config.checkpoint_content_timeout_ms = Some(10_000);
620 }
621 config
622 } else {
623 StateSyncConfig {
624 checkpoint_content_timeout_ms: Some(10_000),
625 ..Default::default()
626 }
627 }),
628 ..Default::default()
629 }
630 };
631
632 let localhost = local_ip_utils::localhost_for_testing();
633 let json_rpc_address = self.rpc_addr.unwrap_or_else(|| {
634 let rpc_port = self
635 .rpc_port
636 .unwrap_or_else(|| local_ip_utils::get_available_port(&ip));
637 format!("{}:{}", ip, rpc_port).parse().unwrap()
638 });
639
640 let checkpoint_executor_config = CheckpointExecutorConfig {
641 data_ingestion_dir: self.data_ingestion_dir,
642 ..Default::default()
643 };
644
645 let mut pruning_config = AuthorityStorePruningConfig::default();
646 if self.disable_pruning {
647 pruning_config.set_num_epochs_to_retain_for_checkpoints(None);
648 pruning_config.set_num_epochs_to_retain(u64::MAX);
649 };
650
651 NodeConfig {
652 recent_submission_dedup_window_ms: None,
653 address_prober: None,
654 protocol_key_pair: AuthorityKeyPairWithPath::new(validator_config.key_pair),
655 account_key_pair: KeyPairWithPath::new(validator_config.account_key_pair),
656 worker_key_pair: KeyPairWithPath::new(SuiKeyPair::Ed25519(
657 validator_config.worker_key_pair,
658 )),
659 network_key_pair: self.network_key_pair.unwrap_or(KeyPairWithPath::new(
660 SuiKeyPair::Ed25519(validator_config.network_key_pair),
661 )),
662 db_path: self
663 .db_path
664 .unwrap_or(config_directory.join(FULL_NODE_DB_PATH).join(key_path)),
665 network_address: self
666 .network_address
667 .unwrap_or(validator_config.network_address),
668 metrics_address: self
669 .metrics_address
670 .unwrap_or(local_ip_utils::new_local_tcp_socket_for_testing()),
671 admin_interface_port: self
672 .admin_interface_port
673 .unwrap_or(local_ip_utils::get_available_port(&localhost)),
674 json_rpc_address: self.json_rpc_address.unwrap_or(json_rpc_address),
675 fullnode_sync_mode,
676 consensus_config,
677 genesis: self.genesis.unwrap_or(sui_config::node::Genesis::new(
678 network_config.genesis.clone(),
679 )),
680 grpc_load_shed: None,
681 grpc_concurrency_limit: None,
682 p2p_config,
683 authority_store_pruning_config: pruning_config,
684 end_of_epoch_broadcast_channel_capacity:
685 default_end_of_epoch_broadcast_channel_capacity(),
686 checkpoint_executor_config,
687 metrics: None,
688 supported_protocol_versions: self.supported_protocol_versions,
689 db_checkpoint_config: self.db_checkpoint_config.unwrap_or_default(),
690 expensive_safety_check_config: self
691 .expensive_safety_check_config
692 .unwrap_or_else(ExpensiveSafetyCheckConfig::new_enable_all),
693 transaction_deny_config: Default::default(),
694 peer_deny_sync_config: Default::default(),
695 dev_inspect_disabled: false,
696 certificate_deny_config: Default::default(),
697 state_debug_dump_config: Default::default(),
698 state_archive_read_config: vec![],
699 state_snapshot_write_config: StateSnapshotConfig::default(),
700 rpc: self.rpc_config.or_else(|| {
701 Some(sui_rpc_api::Config {
702 enable_indexing: Some(true),
703 ..Default::default()
704 })
705 }),
706 jwk_fetch_interval_seconds: 3600,
708 zklogin_oauth_providers: default_zklogin_oauth_providers(),
709 authority_overload_config: Default::default(),
710 run_with_range: self.run_with_range,
711 policy_config: None,
714 firewall_config: None,
715 execution_cache: ExecutionCacheConfig::default(),
716 state_accumulator_v2: true,
717 funds_withdraw_scheduler_type: FundsWithdrawSchedulerType::default(),
718 enable_soft_bundle: true,
719 enable_simulate_allowed_proposers: true,
720 verifier_signing_config: VerifierSigningConfig::default(),
721 enable_db_write_stall: None,
722 enable_db_sync_to_disk: None,
723 execution_time_observer_config: None,
724 chain_override_for_testing: self.chain_override,
725 validator_client_monitor_config: None,
726 fork_recovery: None,
727 transaction_driver_config: self
728 .transaction_driver_config
729 .or(Some(TransactionDriverConfig::default())),
730 consensus_transaction_pool: ConsensusTransactionPoolConfig::default(),
731 congestion_log: None,
732 }
733 }
734}
735
736fn get_key_path(key_pair: &AuthorityKeyPair) -> String {
738 let public_key: AuthorityPublicKeyBytes = key_pair.public().into();
739 let mut key_path = Hex::encode(public_key);
740 key_path.truncate(12);
742 key_path
743}