pub fn operator_registrations(node_configs: &[NodeConfig]) -> Vec<OperatorRegistration> {
    node_configs
        .iter()
        .map(|n| {
            let test_config = n.test.as_ref().unwrap();
            let owner_key = test_config.owner_keypair.as_ref().unwrap().public_key();
            let owner_account = AuthenticationKey::ed25519(&owner_key).derived_address();
            let operator_key = test_config.operator_keypair.as_ref().unwrap().public_key();

            let sr_test = n.consensus.safety_rules.test.as_ref().unwrap();
            let consensus_key = sr_test.consensus_keypair.as_ref().unwrap().public_key();

            let network = n.validator_network.as_ref().unwrap();
            let identity_key = network.identity.public_key_from_config().unwrap();

            let addr = network
                .discovery_method
                .advertised_address()
                .append_prod_protos(identity_key, HANDSHAKE_VERSION);
            let raw_addr = RawNetworkAddress::try_from(&addr).unwrap();

            let seq_num = 0;
            let addr_idx = 0;
            let enc_addr = raw_addr.clone().encrypt(
                &TEST_SHARED_VAL_NETADDR_KEY,
                TEST_SHARED_VAL_NETADDR_KEY_VERSION,
                &owner_account,
                seq_num,
                addr_idx,
            );
            let raw_enc_addr = RawEncNetworkAddress::try_from(&enc_addr).unwrap();

            // TODO(philiphayes): do something with n.full_node_networks instead
            // of ignoring them?

            let script = transaction_builder::encode_set_validator_config_script(
                owner_account,
                consensus_key.to_bytes().to_vec(),
                identity_key.to_bytes(),
                raw_enc_addr.into(),
                identity_key.to_bytes(),
                raw_addr.into(),
            );
            (operator_key, script)
        })
        .collect::<Vec<_>>()
}
/// Generates an artificial set of OperatorRegistrations using the given node configurations for
/// testing.
Generates an artificial set of OperatorRegistrations using the given node configurations for
testing.
Generates an artificial set of OperatorRegistrations using the given node configurations for testing .
pub fn operator_registrations(node_configs: &[NodeConfig]) -> Vec<OperatorRegistration> {
    node_configs
        .iter()
        .map(|n| {
            let test_config = n.test.as_ref().unwrap();
            let owner_key = test_config.owner_keypair.as_ref().unwrap().public_key();
            let owner_account = AuthenticationKey::ed25519(&owner_key).derived_address();
            let operator_key = test_config.operator_keypair.as_ref().unwrap().public_key();
            let sr_test = n.consensus.safety_rules.test.as_ref().unwrap();
            let consensus_key = sr_test.consensus_keypair.as_ref().unwrap().public_key();
            let network = n.validator_network.as_ref().unwrap();
            let identity_key = network.identity.public_key_from_config().unwrap();
            let addr = network
                .discovery_method
                .advertised_address()
                .append_prod_protos(identity_key, HANDSHAKE_VERSION);
            let raw_addr = RawNetworkAddress::try_from(&addr).unwrap();
            let seq_num = 0;
            let addr_idx = 0;
            let enc_addr = raw_addr.clone().encrypt(
                &TEST_SHARED_VAL_NETADDR_KEY,
                TEST_SHARED_VAL_NETADDR_KEY_VERSION,
                &owner_account,
                seq_num,
                addr_idx,
            );
            let raw_enc_addr = RawEncNetworkAddress::try_from(&enc_addr).unwrap();
            // TODO(philiphayes): do something with n.full_node_networks instead
            // of ignoring them?
            let script = transaction_builder::encode_set_validator_config_script(
                owner_account,
                consensus_key.to_bytes().to_vec(),
                identity_key.to_bytes(),
                raw_enc_addr.into(),
                identity_key.to_bytes(),
                raw_addr.into(),
            );
            (operator_key, script)
        })
        .collect::<Vec<_>>()
}
pub fn operator_registrations ( node_configs : & [ NodeConfig ] ) -> Vec < OperatorRegistration > { node_configs . iter ( ) . map ( | n | { let test_config = n . test . as_ref ( ) . unwrap ( ) ; let owner_key = test_config . owner_keypair . as_ref ( ) . unwrap ( ) . public_key ( ) ; let owner_account = AuthenticationKey :: ed25519 ( & owner_key ) . derived_address ( ) ; let operator_key = test_config . operator_keypair . as_ref ( ) . unwrap ( ) . public_key ( ) ; let sr_test = n . consensus . safety_rules . test . as_ref ( ) . unwrap ( ) ; let consensus_key = sr_test . consensus_keypair . as_ref ( ) . unwrap ( ) . public_key ( ) ; let network = n . validator_network . as_ref ( ) . unwrap ( ) ; let identity_key = network . identity . public_key_from_config ( ) . unwrap ( ) ; let addr = network . discovery_method . advertised_address ( ) . append_prod_protos ( identity_key , HANDSHAKE_VERSION ) ; let raw_addr = RawNetworkAddress :: try_from ( & addr ) . unwrap ( ) ; let seq_num = 0 ; let addr_idx = 0 ; let enc_addr = raw_addr . clone ( ) . encrypt ( & TEST_SHARED_VAL_NETADDR_KEY , TEST_SHARED_VAL_NETADDR_KEY_VERSION , & owner_account , seq_num , addr_idx , ) ; let raw_enc_addr = RawEncNetworkAddress :: try_from ( & enc_addr ) . unwrap ( ) ; // TODO(philiphayes): do something with n.full_node_networks instead // of ignoring them? let script = transaction_builder :: encode_set_validator_config_script ( owner_account , consensus_key . to_bytes ( ) . to_vec ( ) , identity_key . to_bytes ( ) , raw_enc_addr . into ( ) , identity_key . to_bytes ( ) , raw_addr . into ( ) , ) ; ( operator_key , script ) } ) . collect :: < Vec < _ > > ( ) }
Generates an artificial set of OperatorRegistrations using the given node configurations for
testing.
Generates an artificial set of OperatorRegistrations using the given node configurations for testing .
node_configs
&[NodeConfig]
node_configs
&[NodeConfig]