MCPcopy Create free account
hub / github.com/SeismicSystems/summit / get_initial_state

Function get_initial_state

node/src/args.rs:704–763  ·  view source on GitHub ↗
(
    genesis: &Genesis,
    genesis_committee: &Vec<Validator>,
    checkpoint: Option<ConsensusState>,
)

Source from the content-addressed store, hash-verified

702 .unwrap();
703 let config = MetricServerConfig::new(listen_addr, hooks, Some(context.child("prom")));
704 let stop_signal = context.stopped();
705 MetricServer::new(config).serve(stop_signal).await.unwrap();
706 }
707
708 // configure network
709 let network_committee_ingress: Vec<_> =
710 if let Some(ref bootstrappers_path) = flags.bootstrappers {
711 Bootstrappers::load_from_file(bootstrappers_path)
712 .expect("Failed to load bootstrappers file")
713 .to_ingress_list()
714 .expect("Failed to parse bootstrappers")
715 } else {
716 network_committee
717 .iter()
718 .map(|(pk, addr)| (pk.clone(), Ingress::from(*addr)))
719 .collect()
720 };
721
722 let listen = wildcard_listen_for(our_ip, flags.port);
723 // Bind the live p2p authentication domain to immutable chain identity so a
724 // peer from a different deployment that reuses this namespace and the same
725 // node keys cannot authenticate against us.
726 let p2p_domain = summit_types::chain_domain(genesis.config_digest());
727 let namespace = p2p_domain.as_slice();
728 let max_message_size = genesis.max_message_size_bytes as u32;
729
730 let (engine, p2p, rpc_handle) = if let Some(index) = flags.observer {
731 let signer = ExtPrivateKey::derive_child_signer(&key_store.node_key, namespace, index);
732 // The observer's network identity is exactly this P2P signer's public
733 // key; capture it here so the engine and resolver reuse the same derived
734 // key rather than deriving it a second time (which could drift).
735 let observer_network_key = Some(signer.public_key());
736 let mut p2p_cfg = authenticated::discovery::Config::recommended(
737 signer,
738 namespace,
739 listen,
740 our_ip,
741 network_committee_ingress,
742 max_message_size,
743 );
744 p2p_cfg.mailbox_size = MAILBOX_SIZE;
745 start_network_and_engine(
746 context.child("node"),
747 p2p_cfg,
748 engine_client,
749 key_store,
750 peers,
751 flags,
752 &genesis,
753 initial_state,
754 loaded.last_block,
755 loaded.finalized_header,
756 observer_network_key,
757 )
758 .await
759 } else {
760 let signer = key_store.node_key.clone();
761 let mut p2p_cfg = authenticated::discovery::Config::recommended(

Callers 2

run_node_innerFunction · 0.70
run_node_local_innerFunction · 0.70

Calls 1

set_accountMethod · 0.80

Tested by

no test coverage detected