Refactor register node: returns deleted contracts #5
| @ -1,20 +1,43 @@ | |||||||
| use anyhow::Result; | use anyhow::Result; | ||||||
| use ed25519_dalek::SigningKey; | use ed25519_dalek::SigningKey; | ||||||
| use log::{info, warn}; | use log::{info, warn}; | ||||||
|  | use rand::Rng; | ||||||
| use sha2::{Digest, Sha256}; | use sha2::{Digest, Sha256}; | ||||||
| use std::fs::File; | use std::fs::File; | ||||||
| use std::io::{Read, Write}; | use std::io::{Read, Write}; | ||||||
| use std::sync::LazyLock; | use std::sync::LazyLock; | ||||||
| 
 | 
 | ||||||
| pub const DETEE_ROOT_CA: &str = "/etc/detee/root_ca.pem"; | pub const DETEE_ROOT_CA: &str = "/etc/detee/root_ca.pem"; | ||||||
| pub const BRAIN_STAGING: (&str, &str) = ("https://159.65.58.38:31337", "staging-brain"); | pub(crate) const BRAIN_STAGING_URLS: [&str; 3] = [ | ||||||
| pub const BRAIN_TESTING: (&str, &str) = ("https://164.92.249.180:31337", "testnet-brain"); |     "https://184.107.169.199:49092", | ||||||
|  |     "https://149.22.95.1:47855", | ||||||
|  |     "https://149.36.48.99:48843", | ||||||
|  | ]; | ||||||
|  | pub(crate) const BRAIN_TESTING_URLS: [&str; 3] = [ | ||||||
|  |     "https://184.107.169.199:45223", | ||||||
|  |     "https://149.22.95.1:44522", | ||||||
|  |     "https://149.36.48.99:48638", | ||||||
|  | ]; | ||||||
| pub const PACKAGE_ARCHIVE_POSTFIX: &str = "-enclave_package.tar.gz"; | pub const PACKAGE_ARCHIVE_POSTFIX: &str = "-enclave_package.tar.gz"; | ||||||
| pub const PACKAGE_ARCHIVE_DIR_PATH: &str = "/var/lib/detee/archives"; | pub const PACKAGE_ARCHIVE_DIR_PATH: &str = "/var/lib/detee/archives"; | ||||||
| pub const PACKAGE_DIR_PATH: &str = "/var/lib/detee/enclaves"; | pub const PACKAGE_DIR_PATH: &str = "/var/lib/detee/enclaves"; | ||||||
| 
 | 
 | ||||||
| pub const APP_NAME_PREFIX: &str = "dtpm"; | pub const APP_NAME_PREFIX: &str = "dtpm"; | ||||||
| 
 | 
 | ||||||
|  | pub static BRAIN_STAGING: LazyLock<(&str, &str)> = LazyLock::new(|| { | ||||||
|  |     ( | ||||||
|  |         BRAIN_STAGING_URLS[rand::thread_rng().gen_range(0..BRAIN_STAGING_URLS.len())], | ||||||
|  |         "staging-brain", | ||||||
|  |     ) | ||||||
|  | }); | ||||||
|  | 
 | ||||||
|  | pub static BRAIN_TESTING: LazyLock<(&str, &str)> = LazyLock::new(|| { | ||||||
|  |     ( | ||||||
|  |         BRAIN_TESTING_URLS[rand::thread_rng().gen_range(0..BRAIN_TESTING_URLS.len())], | ||||||
|  |         "testnet-brain", | ||||||
|  |     ) | ||||||
|  | }); | ||||||
|  | 
 | ||||||
| // const DETEE_DIR_ENV_NAME: &str = "DETEE_DIR";
 | // const DETEE_DIR_ENV_NAME: &str = "DETEE_DIR";
 | ||||||
| 
 | 
 | ||||||
| pub static IP_INFO: LazyLock<IPInfo> = | pub static IP_INFO: LazyLock<IPInfo> = | ||||||
|  | |||||||
| @ -24,8 +24,8 @@ pub struct ConnectionData { | |||||||
| 
 | 
 | ||||||
| async fn client(network: &str) -> Result<BrainAppDaemonClient<Channel>> { | async fn client(network: &str) -> Result<BrainAppDaemonClient<Channel>> { | ||||||
|     let (brain_url, brain_san) = match network { |     let (brain_url, brain_san) = match network { | ||||||
|         "staging" => BRAIN_STAGING, |         "staging" => *BRAIN_STAGING, | ||||||
|         "testnet" => BRAIN_TESTING, |         "testnet" => *BRAIN_TESTING, | ||||||
|         _ => { |         _ => { | ||||||
|             return Err(anyhow::anyhow!( |             return Err(anyhow::anyhow!( | ||||||
|                 "The only networks currently supported are staging and testnet." |                 "The only networks currently supported are staging and testnet." | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user