Change the cached sync tests to canopy

This change requires a cached state rebuild. The rebuilt state will be
significantly larger.
This commit is contained in:
teor 2021-03-15 10:35:43 +10:00
parent a649bd10e3
commit 74cc30c307
3 changed files with 27 additions and 27 deletions

View File

@ -69,8 +69,8 @@ jobs:
cd zebra/;
docker build --build-arg SHORT_SHA=$SHORT_SHA -f docker/Dockerfile.test -t zebrad-test .;
docker run -i zebrad-test cargo test --workspace --no-fail-fast -- -Zunstable-options --include-ignored;
docker run -i --mount type=bind,source=/mnt/disks/gce-containers-mounts/gce-persistent-disks/zebrad-cache-$SHORT_SHA-mainnet-419200,target=/zebrad-cache zebrad-test:latest cargo test --verbose --features test_sync_past_sapling_mainnet --manifest-path zebrad/Cargo.toml sync_past_sapling_mainnet;
docker run -i --mount type=bind,source=/mnt/disks/gce-containers-mounts/gce-persistent-disks/zebrad-cache-$SHORT_SHA-testnet-280000,target=/zebrad-cache zebrad-test:latest cargo test --verbose --features test_sync_past_sapling_testnet --manifest-path zebrad/Cargo.toml sync_past_sapling_testnet;
docker run -i --mount type=bind,source=/mnt/disks/gce-containers-mounts/gce-persistent-disks/zebrad-cache-$SHORT_SHA-mainnet-419200,target=/zebrad-cache zebrad-test:latest cargo test --verbose --features test_sync_past_canopy_mainnet --manifest-path zebrad/Cargo.toml sync_past_canopy_mainnet;
docker run -i --mount type=bind,source=/mnt/disks/gce-containers-mounts/gce-persistent-disks/zebrad-cache-$SHORT_SHA-testnet-280000,target=/zebrad-cache zebrad-test:latest cargo test --verbose --features test_sync_past_canopy_testnet --manifest-path zebrad/Cargo.toml sync_past_canopy_testnet;
"
# Clean up
- name: Delete test instance

View File

@ -57,7 +57,7 @@ zebra-test = { path = "../zebra-test" }
[features]
enable-sentry = []
test_sync_to_sapling_mainnet = []
test_sync_to_sapling_testnet = []
test_sync_past_sapling_mainnet = []
test_sync_past_sapling_testnet = []
test_sync_to_canopy_mainnet = []
test_sync_to_canopy_testnet = []
test_sync_past_canopy_mainnet = []
test_sync_past_canopy_testnet = []

View File

@ -800,7 +800,7 @@ fn sync_until(
Ok(child.dir)
}
fn cached_sapling_test_config() -> Result<ZebradConfig> {
fn cached_canopy_test_config() -> Result<ZebradConfig> {
let mut config = persistent_test_config()?;
config.consensus.checkpoint_sync = true;
config.state.cache_dir = "/zebrad-cache".into();
@ -813,7 +813,7 @@ fn create_cached_database_height(network: Network, height: Height) -> Result<()>
let timeout = Duration::from_secs(60 * 60 * 8);
// Use a persistent state, so we can handle large syncs
let mut config = cached_sapling_test_config()?;
let mut config = cached_canopy_test_config()?;
// TODO: add convenience methods?
config.network.network = network;
config.state.debug_stop_at_height = Some(height.0);
@ -834,12 +834,12 @@ fn create_cached_database_height(network: Network, height: Height) -> Result<()>
}
fn create_cached_database(network: Network) -> Result<()> {
let height = NetworkUpgrade::Sapling.activation_height(network).unwrap();
let height = NetworkUpgrade::Canopy.activation_height(network).unwrap();
create_cached_database_height(network, height)
}
fn sync_past_sapling(network: Network) -> Result<()> {
let height = NetworkUpgrade::Sapling.activation_height(network).unwrap() + 1200;
fn sync_past_canopy(network: Network) -> Result<()> {
let height = NetworkUpgrade::Canopy.activation_height(network).unwrap() + 1200;
create_cached_database_height(network, height.unwrap())
}
@ -850,17 +850,17 @@ fn sync_past_sapling(network: Network) -> Result<()> {
// drives populated by the first two tests, snapshot those drives, and then use
// those to more quickly run the second two tests.
// Sync up to the sapling activation height on mainnet and stop.
#[cfg_attr(feature = "test_sync_to_sapling_mainnet", test)]
fn sync_to_sapling_mainnet() {
// Sync up to the canopy activation height on mainnet and stop.
#[cfg_attr(feature = "test_sync_to_canopy_mainnet", test)]
fn sync_to_canopy_mainnet() {
zebra_test::init();
let network = Mainnet;
create_cached_database(network).unwrap();
}
// Sync to the sapling activation height testnet and stop.
#[cfg_attr(feature = "test_sync_to_sapling_testnet", test)]
fn sync_to_sapling_testnet() {
// Sync to the canopy activation height testnet and stop.
#[cfg_attr(feature = "test_sync_to_canopy_testnet", test)]
fn sync_to_canopy_testnet() {
zebra_test::init();
let network = Testnet;
create_cached_database(network).unwrap();
@ -868,26 +868,26 @@ fn sync_to_sapling_testnet() {
/// Test syncing 1200 blocks (3 checkpoints) past the last checkpoint on mainnet.
///
/// This assumes that the config'd state is already synced at or near Sapling
/// activation on mainnet. If the state has already synced past Sapling
/// This assumes that the config'd state is already synced at or near Canopy
/// activation on mainnet. If the state has already synced past Canopy
/// activation by 1200 blocks, it will fail.
#[cfg_attr(feature = "test_sync_past_sapling_mainnet", test)]
fn sync_past_sapling_mainnet() {
#[cfg_attr(feature = "test_sync_past_canopy_mainnet", test)]
fn sync_past_canopy_mainnet() {
zebra_test::init();
let network = Mainnet;
sync_past_sapling(network).unwrap();
sync_past_canopy(network).unwrap();
}
/// Test syncing 1200 blocks (3 checkpoints) past the last checkpoint on testnet.
///
/// This assumes that the config'd state is already synced at or near Sapling
/// activation on testnet. If the state has already synced past Sapling
/// This assumes that the config'd state is already synced at or near Canopy
/// activation on testnet. If the state has already synced past Canopy
/// activation by 1200 blocks, it will fail.
#[cfg_attr(feature = "test_sync_past_sapling_testnet", test)]
fn sync_past_sapling_testnet() {
#[cfg_attr(feature = "test_sync_past_canopy_testnet", test)]
fn sync_past_canopy_testnet() {
zebra_test::init();
let network = Testnet;
sync_past_sapling(network).unwrap();
sync_past_canopy(network).unwrap();
}
/// Returns a random port number from the ephemeral port range.