remove spec minimal feature gating in tests (#4468)

* remove spec minimal feature gating in tests

* do merge transition in overflow cache test
This commit is contained in:
realbigsean 2023-07-14 15:59:15 -04:00 committed by GitHub
parent c3ef84bda2
commit 2b93c0eb0d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 28 additions and 42 deletions

View File

@ -119,8 +119,8 @@ jobs:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Run operation_pool tests for all known forks
run: make test-op-pool
network-minimal-tests:
name: network-minimal-tests
network-tests:
name: network-tests
runs-on: ubuntu-latest
needs: cargo-fmt
steps:
@ -131,8 +131,8 @@ jobs:
uses: arduino/setup-protoc@e52d9eb8f7b63115df1ac544a1376fdbf5a39612
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Run network tests for all known forks using the minimal spec
run: make test-network-minimal
- name: Run network tests for all known forks
run: make test-network
slasher-tests:
name: slasher-tests
runs-on: ubuntu-latest

3
.gitignore vendored
View File

@ -13,6 +13,7 @@ genesis.ssz
# IntelliJ
/*.iml
.idea
# VSCode
/.vscode
.idea

View File

@ -106,12 +106,12 @@ build-release-tarballs:
# Runs the full workspace tests in **release**, without downloading any additional
# test vectors.
test-release:
cargo test --workspace --release --exclude ef_tests --exclude beacon_chain --exclude slasher
cargo test --workspace --release --exclude ef_tests --exclude beacon_chain --exclude slasher --exclude network
# Runs the full workspace tests in **debug**, without downloading any additional test
# vectors.
test-debug:
cargo test --workspace --exclude ef_tests --exclude beacon_chain
cargo test --workspace --exclude ef_tests --exclude beacon_chain --exclude network
# Runs cargo-fmt (linter).
cargo-fmt:
@ -143,11 +143,12 @@ test-op-pool-%:
--features 'beacon_chain/fork_from_env'\
-p operation_pool
test-network-minimal: $(patsubst %,test-network-minimal-%,$(FORKS))
# Run the tests in the `network` crate for all known forks.
test-network: $(patsubst %,test-network-%,$(FORKS))
test-network-minimal-%:
test-network-%:
env FORK_NAME=$* cargo test --release \
--features 'fork_from_env,spec-minimal'\
--features 'fork_from_env' \
-p network
# Run the tests in the `slasher` crate for all supported database backends.

View File

@ -13,7 +13,6 @@ node_test_rig = { path = "../testing/node_test_rig" }
[features]
write_ssz_files = ["beacon_chain/write_ssz_files"] # Writes debugging .ssz files to /tmp during block processing.
spec-minimal = ["beacon_chain/spec-minimal"]
[dependencies]
eth2_config = { path = "../common/eth2_config" }

View File

@ -10,7 +10,6 @@ default = ["participation_metrics"]
write_ssz_files = [] # Writes debugging .ssz files to /tmp during block processing.
participation_metrics = [] # Exposes validator participation metrics to Prometheus.
fork_from_env = [] # Initialise the harness chain spec from the FORK_NAME env variable
spec-minimal = ["kzg/minimal-spec"]
[dev-dependencies]
maplit = "1.0.2"

View File

@ -849,7 +849,6 @@ impl ssz::Decode for OverflowKey {
#[cfg(test)]
mod test {
use super::*;
#[cfg(feature = "spec-minimal")]
use crate::{
blob_verification::{
validate_blob_sidecar_for_gossip, verify_kzg_for_blob, GossipVerifiedBlob,
@ -859,31 +858,20 @@ mod test {
eth1_finalization_cache::Eth1FinalizationData,
test_utils::{BaseHarnessType, BeaconChainHarness, DiskHarnessType},
};
#[cfg(feature = "spec-minimal")]
use execution_layer::test_utils::DEFAULT_TERMINAL_BLOCK;
use fork_choice::PayloadVerificationStatus;
#[cfg(feature = "spec-minimal")]
use logging::test_logger;
#[cfg(feature = "spec-minimal")]
use slog::{info, Logger};
#[cfg(feature = "spec-minimal")]
use state_processing::ConsensusContext;
#[cfg(feature = "spec-minimal")]
use std::collections::{BTreeMap, HashMap, VecDeque};
#[cfg(feature = "spec-minimal")]
use std::ops::AddAssign;
#[cfg(feature = "spec-minimal")]
use store::{HotColdDB, ItemStore, LevelDB, StoreConfig};
#[cfg(feature = "spec-minimal")]
use tempfile::{tempdir, TempDir};
#[cfg(feature = "spec-minimal")]
use types::beacon_state::ssz_tagged_beacon_state;
#[cfg(feature = "spec-minimal")]
use types::{ChainSpec, ExecPayload, MinimalEthSpec};
#[cfg(feature = "spec-minimal")]
const LOW_VALIDATOR_COUNT: usize = 32;
#[cfg(feature = "spec-minimal")]
fn get_store_with_spec<E: EthSpec>(
db_path: &TempDir,
spec: ChainSpec,
@ -906,7 +894,6 @@ mod test {
}
// get a beacon chain harness advanced to just before deneb fork
#[cfg(feature = "spec-minimal")]
async fn get_deneb_chain<E: EthSpec>(
log: Logger,
db_path: &TempDir,
@ -994,7 +981,6 @@ mod test {
}
#[tokio::test]
#[cfg(feature = "spec-minimal")]
async fn ssz_tagged_beacon_state_encode_decode_equality() {
type E = MinimalEthSpec;
let altair_fork_epoch = Epoch::new(1);
@ -1011,6 +997,13 @@ mod test {
spec.bellatrix_fork_epoch = Some(bellatrix_fork_epoch);
spec.capella_fork_epoch = Some(capella_fork_epoch);
spec.deneb_fork_epoch = Some(deneb_fork_epoch);
let genesis_block = execution_layer::test_utils::generate_genesis_block(
spec.terminal_total_difficulty,
DEFAULT_TERMINAL_BLOCK,
)
.unwrap();
spec.terminal_block_hash = genesis_block.block_hash;
spec.terminal_block_hash_activation_epoch = bellatrix_fork_epoch;
let harness = BeaconChainHarness::builder(E::default())
.spec(spec)
@ -1069,7 +1062,6 @@ mod test {
assert_eq!(state, decoded, "Encoded and decoded states should be equal");
}
#[cfg(feature = "spec-minimal")]
async fn availability_pending_block<E, Hot, Cold>(
harness: &BeaconChainHarness<BaseHarnessType<E, Hot, Cold>>,
log: Logger,
@ -1166,7 +1158,6 @@ mod test {
}
#[tokio::test]
#[cfg(feature = "spec-minimal")]
async fn overflow_cache_test_insert_components() {
type E = MinimalEthSpec;
type T = DiskHarnessType<E>;
@ -1287,7 +1278,6 @@ mod test {
}
#[tokio::test]
#[cfg(feature = "spec-minimal")]
async fn overflow_cache_test_overflow() {
type E = MinimalEthSpec;
type T = DiskHarnessType<E>;
@ -1447,7 +1437,6 @@ mod test {
}
#[tokio::test]
#[cfg(feature = "spec-minimal")]
async fn overflow_cache_test_maintenance() {
type E = MinimalEthSpec;
type T = DiskHarnessType<E>;
@ -1599,7 +1588,6 @@ mod test {
}
#[tokio::test]
#[cfg(feature = "spec-minimal")]
async fn overflow_cache_test_persist_recover() {
type E = MinimalEthSpec;
type T = DiskHarnessType<E>;

View File

@ -25,8 +25,8 @@ use warp::{http::StatusCode, Filter, Rejection};
use crate::EngineCapabilities;
pub use execution_block_generator::{
generate_genesis_header, generate_pow_block, generate_random_blobs, Block,
ExecutionBlockGenerator,
generate_genesis_block, generate_genesis_header, generate_pow_block, generate_random_blobs,
Block, ExecutionBlockGenerator,
};
pub use hook::Hook;
pub use mock_builder::{Context as MockBuilderContext, MockBuilder, Operation, TestingBuilder};

View File

@ -49,5 +49,4 @@ operation_pool = { path = "../operation_pool" }
execution_layer = { path = "../execution_layer" }
[features]
spec-minimal = ["beacon_chain/spec-minimal"]
fork_from_env = ["beacon_chain/fork_from_env"]

View File

@ -1,4 +1,3 @@
#![cfg(feature = "spec-minimal")]
use std::sync::Arc;
use crate::service::RequestId;
@ -117,7 +116,7 @@ impl TestRig {
};
let (bundle, transactions) = execution_layer::test_utils::generate_random_blobs::<E>(
num_blobs,
&self.harness.chain.kzg.as_ref().unwrap(),
self.harness.chain.kzg.as_ref().unwrap(),
)
.unwrap();
@ -148,8 +147,8 @@ impl TestRig {
block_parent_root: block.parent_root(),
proposer_index: block.message().proposer_index(),
blob: blob.clone(),
kzg_commitment: kzg_commitment.clone(),
kzg_proof: kzg_proof.clone(),
kzg_commitment,
kzg_proof,
});
}
}
@ -1393,7 +1392,7 @@ mod deneb_only {
fn blobs_response_was_valid(mut self) -> Self {
self.rig.expect_empty_network();
if self.blobs.len() > 0 {
if !self.blobs.is_empty() {
self.rig.expect_block_process(ResponseType::Blob);
}
self

View File

@ -17,7 +17,7 @@ modern = ["bls/supranational-force-adx"]
# Uses the slower Milagro BLS library, which is written in native Rust.
milagro = ["bls/milagro"]
# Support minimal spec (used for testing only).
spec-minimal = ["beacon_node/spec-minimal"]
spec-minimal = []
# Support Gnosis spec and Gnosis Beacon Chain.
gnosis = []
# Support slasher MDBX backend.