Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove remnants of last_slot.bin #1334

Merged
merged 2 commits into from
May 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion core-primitives/settings/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ pub mod files {

// used by worker and enclave
pub const SHARDS_PATH: &str = "shards";
pub const LAST_SLOT_BIN: &str = "last_slot.bin";

#[cfg(feature = "production")]
pub static RA_SPID_FILE: &str = "spid_production.txt";
Expand Down
7 changes: 0 additions & 7 deletions local-setup/py/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ def check_shard_and_prompt_delete(self, shard=None):
def purge(self):
""" Deletes the light_client_db.bin, the shards and the sidechain_db
"""
self.purge_last_slot_seal()
self.purge_light_client_db()
self.purge_shards_and_sidechain_db()
return self
Expand All @@ -120,12 +119,6 @@ def purge_light_client_db(self):
print(f'remove: {db}')
db.unlink()

def purge_last_slot_seal(self):
print(f'purging last_slot_seal')
for db in pathlib.Path(self.cwd).glob('last_slot.bin'):
print(f'remove: {db}')
db.unlink()

def mrenclave(self):
""" Returns the mrenclave and caches it. """
if not self._mrenclave:
Expand Down
6 changes: 1 addition & 5 deletions service/src/setup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ use crate::error::{Error, ServiceResult};
use codec::Encode;
use itp_enclave_api::{enclave_base::EnclaveBase, Enclave};
use itp_settings::files::{
LAST_SLOT_BIN, LIGHT_CLIENT_DB, SHARDS_PATH, SHIELDING_KEY_FILE, SIDECHAIN_STORAGE_PATH,
SIGNING_KEY_FILE,
LIGHT_CLIENT_DB, SHARDS_PATH, SHIELDING_KEY_FILE, SIDECHAIN_STORAGE_PATH, SIGNING_KEY_FILE,
};
use itp_types::ShardIdentifier;
use log::*;
Expand Down Expand Up @@ -97,7 +96,6 @@ fn purge_files(root_directory: &Path) -> ServiceResult<()> {
remove_dir_if_it_exists(root_directory, SHARDS_PATH)?;
remove_dir_if_it_exists(root_directory, SIDECHAIN_STORAGE_PATH)?;

remove_file_if_it_exists(root_directory, LAST_SLOT_BIN)?;
remove_file_if_it_exists(root_directory, LIGHT_CLIENT_DB)?;
remove_file_if_it_exists(root_directory, light_client_backup_file().as_str())?;

Expand Down Expand Up @@ -147,15 +145,13 @@ mod tests {
fs::File::create(&sidechain_db_path.join("sidechain_db_2.bin")).unwrap();
fs::File::create(&sidechain_db_path.join("sidechain_db_3.bin")).unwrap();

fs::File::create(&root_directory.join(LAST_SLOT_BIN)).unwrap();
fs::File::create(&root_directory.join(LIGHT_CLIENT_DB)).unwrap();
fs::File::create(&root_directory.join(light_client_backup_file())).unwrap();

purge_files(&root_directory).unwrap();

assert!(!shards_path.exists());
assert!(!sidechain_db_path.exists());
assert!(!root_directory.join(LAST_SLOT_BIN).exists());
assert!(!root_directory.join(LIGHT_CLIENT_DB).exists());
assert!(!root_directory.join(light_client_backup_file()).exists());
}
Expand Down