Skip to content

Commit

Permalink
more seeds
Browse files Browse the repository at this point in the history
  • Loading branch information
wacban committed Oct 31, 2023
1 parent c6e8702 commit 7d55c5b
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 19 deletions.
14 changes: 1 addition & 13 deletions core/chain-configs/src/genesis_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use crate::genesis_validate::validate_genesis;
use anyhow::Context;
use chrono::{DateTime, Utc};
use near_config_utils::ValidationError;
use near_primitives::epoch_manager::{AllEpochConfig, EpochConfig};
use near_primitives::epoch_manager::EpochConfig;
use near_primitives::shard_layout::ShardLayout;
use near_primitives::types::validator_stake::ValidatorStake;
use near_primitives::types::StateRoot;
Expand Down Expand Up @@ -216,18 +216,6 @@ impl From<&GenesisConfig> for EpochConfig {
}
}

impl From<&GenesisConfig> for AllEpochConfig {
fn from(genesis_config: &GenesisConfig) -> Self {
let initial_epoch_config = EpochConfig::from(genesis_config);
let epoch_config = Self::new(
genesis_config.use_production_config(),
initial_epoch_config,
&genesis_config.chain_id,
);
epoch_config
}
}

/// Records in storage at genesis (get split into shards at genesis creation).
#[derive(
Debug,
Expand Down
44 changes: 38 additions & 6 deletions integration-tests/src/tests/client/resharding.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1299,9 +1299,6 @@ fn test_shard_layout_upgrade_incoming_receipts_impl_v1() {
test_shard_layout_upgrade_incoming_receipts_impl(ReshardingType::V1, 42);
}

// TODO(resharding) Add another test like this but drop more chunks and at
// random. The _missing_chunks tests below test only the case when all chunks
// are missing in block but can likely be adjusted for this case.
#[cfg(feature = "protocol_feature_simple_nightshade_v2")]
#[test]
fn test_shard_layout_upgrade_incoming_receipts_impl_v2_seed_42() {
Expand Down Expand Up @@ -1391,20 +1388,55 @@ fn test_shard_layout_upgrade_missing_chunks_high_missing_prob_v1() {
test_shard_layout_upgrade_missing_chunks(ReshardingType::V1, 0.9, 42);
}

// V2, low missing prob

#[test]
fn test_shard_layout_upgrade_missing_chunks_low_missing_prob_v2() {
fn test_shard_layout_upgrade_missing_chunks_low_missing_prob_v2_seed_42() {
test_shard_layout_upgrade_missing_chunks(ReshardingType::V2, 0.1, 42);
}

#[test]
fn test_shard_layout_upgrade_missing_chunks_mid_missing_prob_v2() {
fn test_shard_layout_upgrade_missing_chunks_low_missing_prob_v2_seed_43() {
test_shard_layout_upgrade_missing_chunks(ReshardingType::V2, 0.1, 43);
}

#[test]
fn test_shard_layout_upgrade_missing_chunks_low_missing_prob_v2_seed_44() {
test_shard_layout_upgrade_missing_chunks(ReshardingType::V2, 0.1, 44);
}

// V2, mid missing prob

#[test]
fn test_shard_layout_upgrade_missing_chunks_mid_missing_prob_v2_seed_42() {
test_shard_layout_upgrade_missing_chunks(ReshardingType::V2, 0.5, 42);
}
#[test]
fn test_shard_layout_upgrade_missing_chunks_mid_missing_prob_v2_seed_43() {
test_shard_layout_upgrade_missing_chunks(ReshardingType::V2, 0.5, 43);
}

#[test]
fn test_shard_layout_upgrade_missing_chunks_high_missing_prob_v2() {
fn test_shard_layout_upgrade_missing_chunks_mid_missing_prob_v2_seed_44() {
test_shard_layout_upgrade_missing_chunks(ReshardingType::V2, 0.5, 44);
}

// V2, high missing prob

#[test]
fn test_shard_layout_upgrade_missing_chunks_high_missing_prob_v2_seed_42() {
test_shard_layout_upgrade_missing_chunks(ReshardingType::V2, 0.9, 42);
}

#[test]
fn test_shard_layout_upgrade_missing_chunks_high_missing_prob_v2_seed_43() {
test_shard_layout_upgrade_missing_chunks(ReshardingType::V2, 0.9, 43);
}

#[test]
fn test_shard_layout_upgrade_missing_chunks_high_missing_prob_v2_seed_44() {
test_shard_layout_upgrade_missing_chunks(ReshardingType::V2, 0.9, 44);
}

// TODO(resharding) add a test with missing blocks
// TODO(resharding) add a test with deleting accounts and delayed receipts check

0 comments on commit 7d55c5b

Please sign in to comment.