diff --git a/.github/workflows/merge.yml b/.github/workflows/merge.yml index 9e1dadd148..ed395d692d 100644 --- a/.github/workflows/merge.yml +++ b/.github/workflows/merge.yml @@ -460,36 +460,25 @@ jobs: set -e NUM_OF_PUBLIC_FILES="" NUM_OF_PRIVATE_FILES="" - NUM_OF_REGISTERS="" NUM_OF_PUBLIC_FILES_IN_VAULT="" NUM_OF_PRIVATE_FILES_IN_VAULT="" - NUM_OF_REGISTERS_IN_VAULT="" ./target/release/ant --log-output-dest data-dir file list 2>&1 > file_list.txt - ./target/release/ant register list | grep register > register_list.txt - NUM_OF_PUBLIC_FILES=`cat file_list.txt | grep "public" | grep -o '[0-9]\+'` NUM_OF_PRIVATE_FILES=`cat file_list.txt | grep "private" | grep -o '[0-9]\+'` - NUM_OF_REGISTERS=`cat register_list.txt | grep "register" | grep -o '[0-9]\+'` - # when obtaining registers we get random garbage, this is the only hack that works. - NUM_OF_REGISTERS_first=${NUM_OF_REGISTERS%%[ $'\n']*} - echo "NUM_OF_REGISTERS is $NUM_OF_REGISTERS_first" ./target/release/ant --log-output-dest data-dir vault load 2>&1 > vault_data.txt NUM_OF_PUBLIC_FILES_IN_VAULT=`cat vault_data.txt | grep "public" | grep -o '[0-9]\+'` NUM_OF_PRIVATE_FILES_IN_VAULT=`cat vault_data.txt| grep "private" | grep -o '[0-9]\+'` - NUM_OF_REGISTERS_IN_VAULT=`cat vault_data.txt | grep "register" | grep -o '[0-9]\+'` echo "Total Num of local public files is $NUM_OF_PUBLIC_FILES and in vault is $NUM_OF_PUBLIC_FILES_IN_VAULT" echo "Total Num of local private files is $NUM_OF_PRIVATE_FILES and in vault is $NUM_OF_PRIVATE_FILES_IN_VAULT" - echo "Total Num of local registers is $NUM_OF_REGISTERS_first and in vault is $NUM_OF_REGISTERS_IN_VAULT" - rm -rf file_list.txt register_list.txt vault_data.txt + rm -rf file_list.txt vault_data.txt python3 -c 'import sys; assert sys.argv[1] == sys.argv[2], f"Error: local data and vault in network dont match, Local public Files: {sys.argv[1]} and vault public files: {sys.argv[2]} are Not Equal"' $NUM_OF_PUBLIC_FILES $NUM_OF_PUBLIC_FILES_IN_VAULT python3 -c 'import sys; assert sys.argv[1] == sys.argv[2], f"Error: local data and vault in network dont match, Local private Files: {sys.argv[1]} and vault private files: {sys.argv[2]} are Not Equal"' $NUM_OF_PRIVATE_FILES $NUM_OF_PRIVATE_FILES_IN_VAULT - python3 -c 'import sys; assert sys.argv[1] == sys.argv[2], f"Error: local data and vault in network dont match, Local registers: {sys.argv[1]} and vault registers: {sys.argv[2]} are Not Equal"' $NUM_OF_REGISTERS_first $NUM_OF_REGISTERS_IN_VAULT echo "vault synced successfully!" env: ANT_LOG: "v" @@ -501,7 +490,6 @@ jobs: run: | $ErrorActionPreference = "Stop" ./target/release/ant --log-output-dest data-dir file list > file_list.txt 2>&1 - ./target/release/ant register list > register_list.txt 2>&1 ./target/release/ant --log-output-dest data-dir vault load > vault_data.txt 2>&1 env: ANT_LOG: "v" @@ -535,19 +523,14 @@ jobs: print("NUM_OF_PUBLIC_FILES:", NUM_OF_PUBLIC_FILES) NUM_OF_PRIVATE_FILES = find_number_before_word("file_list.txt", "private") print("NUM_OF_PRIVATE_FILES:", NUM_OF_PRIVATE_FILES) - NUM_OF_REGISTERS_FILES = find_number_before_word("register_list.txt", "register") - print("NUM_OF_REGISTERS_FILES:", NUM_OF_REGISTERS_FILES) NUM_OF_PUBLIC_FILES_IN_VAULT = find_number_before_word("vault_data.txt", "public") print("NUM_OF_PUBLIC_FILES_IN_VAULT:", NUM_OF_PUBLIC_FILES_IN_VAULT) NUM_OF_PRIVATE_FILES_IN_VAULT = find_number_before_word("vault_data.txt", "private") print("NUM_OF_PRIVATE_FILES_IN_VAULT:", NUM_OF_PRIVATE_FILES_IN_VAULT) - NUM_OF_REGISTERS_IN_VAULT = find_number_before_word("vault_data.txt", "register") - print("NUM_OF_PRIVATE_FILES_IN_VAULT:", NUM_OF_PRIVATE_FILES_IN_VAULT) # Assertions assert NUM_OF_PUBLIC_FILES == NUM_OF_PUBLIC_FILES_IN_VAULT, f"Error: local data and vault in network dont match, Local public Files: {NUM_OF_PUBLIC_FILES} and vault public files: {NUM_OF_PUBLIC_FILES_IN_VAULT} are Not Equal" assert NUM_OF_PRIVATE_FILES == NUM_OF_PRIVATE_FILES_IN_VAULT, f"Error: local data and vault in network dont match, Local private Files: {NUM_OF_PRIVATE_FILES} and vault private files: {NUM_OF_PRIVATE_FILES_IN_VAULT} are Not Equal" - assert NUM_OF_REGISTERS_FILES == NUM_OF_REGISTERS_IN_VAULT, f"Error: local data and vault in network dont match, Local registers: {NUM_OF_REGISTERS_FILES} and vault registers: {NUM_OF_REGISTERS_IN_VAULT} are Not Equal" print("Vault synced successfully!") env: ANT_LOG: "v" diff --git a/ant-cli/src/access/user_data.rs b/ant-cli/src/access/user_data.rs index 3fc20785cd..586c6f8f77 100644 --- a/ant-cli/src/access/user_data.rs +++ b/ant-cli/src/access/user_data.rs @@ -11,15 +11,12 @@ use std::collections::HashMap; use autonomi::client::{ address::{addr_to_str, str_to_addr}, files::{archive::PrivateArchiveAccess, archive_public::ArchiveAddr}, - registers::{RegisterAddress, RegisterSecretKey}, + registers::RegisterAddress, vault::UserData, }; use color_eyre::eyre::Result; -use super::{ - data_dir::get_client_data_dir_path, - keys::{create_register_signing_key_file, get_register_signing_key}, -}; +use super::data_dir::get_client_data_dir_path; use serde::{Deserialize, Serialize}; @@ -30,14 +27,10 @@ struct PrivateFileArchive { } pub fn get_local_user_data() -> Result { - let register_sk = get_register_signing_key().map(|k| k.to_hex()).ok(); - let registers = get_local_registers()?; let file_archives = get_local_public_file_archives()?; let private_file_archives = get_local_private_file_archives()?; let user_data = UserData { - register_sk, - registers, file_archives, private_file_archives, }; @@ -119,15 +112,6 @@ pub fn get_local_public_file_archives() -> Result> } pub fn write_local_user_data(user_data: &UserData) -> Result<()> { - if let Some(register_key) = &user_data.register_sk { - let sk = RegisterSecretKey::from_hex(register_key)?; - create_register_signing_key_file(sk)?; - } - - for (register, name) in user_data.registers.iter() { - write_local_register(register, name)?; - } - for (archive, name) in user_data.file_archives.iter() { write_local_public_file_archive(addr_to_str(*archive), name)?; } diff --git a/ant-cli/src/commands/vault.rs b/ant-cli/src/commands/vault.rs index b5446f8962..14e5b6350b 100644 --- a/ant-cli/src/commands/vault.rs +++ b/ant-cli/src/commands/vault.rs @@ -36,7 +36,6 @@ pub async fn create(peers: Vec) -> Result<()> { let local_user_data = crate::user_data::get_local_user_data()?; let file_archives_len = local_user_data.file_archives.len(); let private_file_archives_len = local_user_data.private_file_archives.len(); - let registers_len = local_user_data.registers.len(); println!("Pushing to network vault..."); let total_cost = client @@ -53,7 +52,6 @@ pub async fn create(peers: Vec) -> Result<()> { println!("Vault contains:"); println!("{file_archives_len} public file archive(s)"); println!("{private_file_archives_len} private file archive(s)"); - println!("{registers_len} register(s)"); Ok(()) } @@ -80,7 +78,6 @@ pub async fn sync(peers: Vec, force: bool) -> Result<()> { let local_user_data = crate::user_data::get_local_user_data()?; let file_archives_len = local_user_data.file_archives.len(); let private_file_archives_len = local_user_data.private_file_archives.len(); - let registers_len = local_user_data.registers.len(); client .put_user_data_to_vault(&vault_sk, wallet.into(), local_user_data) .await?; @@ -89,7 +86,6 @@ pub async fn sync(peers: Vec, force: bool) -> Result<()> { println!("Vault contains:"); println!("{file_archives_len} public file archive(s)"); println!("{private_file_archives_len} private file archive(s)"); - println!("{registers_len} register(s)"); Ok(()) } @@ -108,6 +104,5 @@ pub async fn load(peers: Vec) -> Result<()> { "{} private file archive(s)", user_data.private_file_archives.len() ); - println!("{} register(s)", user_data.registers.len()); Ok(()) } diff --git a/autonomi/Cargo.toml b/autonomi/Cargo.toml index 9888538806..c910bf216c 100644 --- a/autonomi/Cargo.toml +++ b/autonomi/Cargo.toml @@ -26,11 +26,11 @@ default = ["vault"] external-signer = ["ant-evm/external-signer"] extension-module = ["pyo3/extension-module"] fs = ["tokio/fs"] -full = ["registers", "vault", "fs"] +full = ["vault", "fs"] local = ["ant-networking/local", "ant-evm/local"] loud = [] registers = [] -vault = ["registers"] +vault = [] [dependencies] ant-bootstrap = { path = "../ant-bootstrap", version = "0.1.0" } diff --git a/autonomi/src/client/vault/user_data.rs b/autonomi/src/client/vault/user_data.rs index a0b4069534..e4f564db61 100644 --- a/autonomi/src/client/vault/user_data.rs +++ b/autonomi/src/client/vault/user_data.rs @@ -13,7 +13,6 @@ use crate::client::data::PutError; use crate::client::files::archive::PrivateArchiveAccess; use crate::client::files::archive_public::ArchiveAddr; use crate::client::payment::PaymentOption; -use crate::client::registers::RegisterAddress; use crate::client::vault::VaultError; use crate::client::vault::{app_name_to_vault_content_type, VaultContentType, VaultSecretKey}; use crate::client::Client; @@ -32,10 +31,6 @@ pub static USER_DATA_VAULT_CONTENT_IDENTIFIER: LazyLock = /// Using User Data Vault is optional, one can decide to keep all their data locally instead. #[derive(Debug, Clone, Serialize, Deserialize, Default, PartialEq, Eq)] pub struct UserData { - /// The register secret key hex encoded - pub register_sk: Option, - /// Owned register addresses, along with their names (can be empty) - pub registers: HashMap, /// Owned file archive addresses, along with their names (can be empty) pub file_archives: HashMap, /// Owned private file archives, along with their names (can be empty)