Add solana-test-validator --warp-slot argument

This commit is contained in:
Michael Vines
2021-01-21 18:34:51 -08:00
parent dd5a2ef05f
commit bf1943e489
12 changed files with 147 additions and 24 deletions

View File

@ -17,7 +17,7 @@ use std::{
pub use crate::snapshot_utils::SnapshotVersion;
#[derive(Clone, Debug, Eq, PartialEq)]
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
pub enum ArchiveFormat {
TarBzip2,
TarGzip,

View File

@ -172,7 +172,7 @@ pub fn package_snapshot<P: AsRef<Path>, Q: AsRef<Path>>(
let snapshot_package_output_file = get_snapshot_archive_path(
&snapshot_package_output_path,
&(bank.slot(), bank.get_accounts_hash()),
&archive_format,
archive_format,
);
let package = AccountsPackage::new(
@ -190,7 +190,7 @@ pub fn package_snapshot<P: AsRef<Path>, Q: AsRef<Path>>(
Ok(package)
}
fn get_archive_ext(archive_format: &ArchiveFormat) -> &'static str {
fn get_archive_ext(archive_format: ArchiveFormat) -> &'static str {
match archive_format {
ArchiveFormat::TarBzip2 => ".tar.bz2",
ArchiveFormat::TarGzip => ".tar.gz",
@ -291,7 +291,7 @@ pub fn archive_snapshot_package(snapshot_package: &AccountsPackage) -> Result<()
f.write_all(snapshot_package.snapshot_version.as_str().as_bytes())?;
}
let file_ext = get_archive_ext(&snapshot_package.archive_format);
let file_ext = get_archive_ext(snapshot_package.archive_format);
// Tar the staging directory into the archive at `archive_path`
//
@ -633,7 +633,7 @@ pub fn bank_from_archive<P: AsRef<Path>>(
pub fn get_snapshot_archive_path<P: AsRef<Path>>(
snapshot_output_dir: P,
snapshot_hash: &(Slot, Hash),
archive_format: &ArchiveFormat,
archive_format: ArchiveFormat,
) -> PathBuf {
snapshot_output_dir.as_ref().join(format!(
"snapshot-{}-{}{}",
@ -906,7 +906,7 @@ pub fn snapshot_bank(
status_cache_slot_deltas,
snapshot_package_output_path,
storages,
archive_format.clone(),
*archive_format,
snapshot_version,
)?;
@ -922,6 +922,7 @@ pub fn bank_to_snapshot_archive<P: AsRef<Path>, Q: AsRef<Path>>(
bank: &Bank,
snapshot_version: Option<SnapshotVersion>,
snapshot_package_output_path: Q,
archive_format: ArchiveFormat,
) -> Result<PathBuf> {
let snapshot_version = snapshot_version.unwrap_or_default();
@ -943,7 +944,7 @@ pub fn bank_to_snapshot_archive<P: AsRef<Path>, Q: AsRef<Path>>(
bank.src.slot_deltas(&bank.src.roots()),
snapshot_package_output_path,
storages,
ArchiveFormat::TarZstd,
archive_format,
snapshot_version,
)?;