mirror of
https://github.com/sigp/lighthouse.git
synced 2026-04-30 19:23:50 +00:00
Squashed reset to unstable
This commit is contained in:
committed by
Daniel Knopik
parent
b71b5f2231
commit
f61f0b654c
@@ -25,8 +25,6 @@ mod tests {
|
||||
use initialized_validators::{
|
||||
load_pem_certificate, load_pkcs12_identity, InitializedValidators,
|
||||
};
|
||||
use lighthouse_validator_store::LighthouseValidatorStore;
|
||||
use logging::test_logger;
|
||||
use parking_lot::Mutex;
|
||||
use reqwest::Client;
|
||||
use serde::Serialize;
|
||||
@@ -46,7 +44,7 @@ mod tests {
|
||||
use tokio::time::sleep;
|
||||
use types::{attestation::AttestationBase, *};
|
||||
use url::Url;
|
||||
use validator_store::{Error as ValidatorStoreError, SignedBlock, ValidatorStore};
|
||||
use validator_store::{Error as ValidatorStoreError, ValidatorStore};
|
||||
|
||||
/// If the we are unable to reach the Web3Signer HTTP API within this time out then we will
|
||||
/// assume it failed to start.
|
||||
@@ -75,7 +73,6 @@ mod tests {
|
||||
impl SignedObject for Signature {}
|
||||
impl SignedObject for Attestation<E> {}
|
||||
impl SignedObject for SignedBeaconBlock<E> {}
|
||||
impl SignedObject for SignedBlock<E> {}
|
||||
impl SignedObject for SignedAggregateAndProof<E> {}
|
||||
impl SignedObject for SelectionProof {}
|
||||
impl SignedObject for SyncSelectionProof {}
|
||||
@@ -180,14 +177,7 @@ mod tests {
|
||||
pub async fn new(network: &str, listen_address: &str, listen_port: u16) -> Self {
|
||||
GET_WEB3SIGNER_BIN
|
||||
.get_or_init(|| async {
|
||||
// Read a Github API token from the environment. This is intended to prevent rate-limits on CI.
|
||||
// We use a name that is unlikely to accidentally collide with anything the user has configured.
|
||||
let github_token = env::var("LIGHTHOUSE_GITHUB_TOKEN");
|
||||
download_binary(
|
||||
TEMP_DIR.lock().path().to_path_buf(),
|
||||
github_token.as_deref().unwrap_or(""),
|
||||
)
|
||||
.await;
|
||||
download_binary(TEMP_DIR.lock().path().to_path_buf()).await;
|
||||
})
|
||||
.await;
|
||||
|
||||
@@ -311,7 +301,7 @@ mod tests {
|
||||
|
||||
/// A testing rig which holds a `ValidatorStore`.
|
||||
struct ValidatorStoreRig {
|
||||
validator_store: Arc<LighthouseValidatorStore<TestingSlotClock, E>>,
|
||||
validator_store: Arc<ValidatorStore<TestingSlotClock, E>>,
|
||||
_validator_dir: TempDir,
|
||||
runtime: Arc<tokio::runtime::Runtime>,
|
||||
_runtime_shutdown: async_channel::Sender<()>,
|
||||
@@ -325,7 +315,6 @@ mod tests {
|
||||
using_web3signer: bool,
|
||||
spec: Arc<ChainSpec>,
|
||||
) -> Self {
|
||||
let log = test_logger();
|
||||
let validator_dir = TempDir::new().unwrap();
|
||||
|
||||
let config = initialized_validators::Config::default();
|
||||
@@ -334,7 +323,6 @@ mod tests {
|
||||
validator_definitions,
|
||||
validator_dir.path().into(),
|
||||
config.clone(),
|
||||
log.clone(),
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
@@ -349,8 +337,12 @@ mod tests {
|
||||
);
|
||||
let (runtime_shutdown, exit) = async_channel::bounded(1);
|
||||
let (shutdown_tx, _) = futures::channel::mpsc::channel(1);
|
||||
let executor =
|
||||
TaskExecutor::new(Arc::downgrade(&runtime), exit, log.clone(), shutdown_tx);
|
||||
let executor = TaskExecutor::new(
|
||||
Arc::downgrade(&runtime),
|
||||
exit,
|
||||
shutdown_tx,
|
||||
"test".to_string(),
|
||||
);
|
||||
|
||||
let slashing_db_path = validator_dir.path().join(SLASHING_PROTECTION_FILENAME);
|
||||
let slashing_protection = SlashingDatabase::open_or_create(&slashing_db_path).unwrap();
|
||||
@@ -360,12 +352,12 @@ mod tests {
|
||||
|
||||
let slot_clock =
|
||||
TestingSlotClock::new(Slot::new(0), Duration::from_secs(0), Duration::from_secs(1));
|
||||
let config = lighthouse_validator_store::Config {
|
||||
let config = validator_store::Config {
|
||||
enable_web3signer_slashing_protection: slashing_protection_config.local,
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
let validator_store = LighthouseValidatorStore::new(
|
||||
let validator_store = ValidatorStore::<_, E>::new(
|
||||
initialized_validators,
|
||||
slashing_protection,
|
||||
Hash256::repeat_byte(42),
|
||||
@@ -374,7 +366,6 @@ mod tests {
|
||||
slot_clock,
|
||||
&config,
|
||||
executor,
|
||||
log.clone(),
|
||||
);
|
||||
|
||||
Self {
|
||||
@@ -490,7 +481,7 @@ mod tests {
|
||||
generate_sig: F,
|
||||
) -> Self
|
||||
where
|
||||
F: Fn(PublicKeyBytes, Arc<LighthouseValidatorStore<TestingSlotClock, E>>) -> R,
|
||||
F: Fn(PublicKeyBytes, Arc<ValidatorStore<TestingSlotClock, E>>) -> R,
|
||||
R: Future<Output = S>,
|
||||
// We use the `SignedObject` trait to white-list objects for comparison. This avoids
|
||||
// accidentally comparing something meaningless like a `()`.
|
||||
@@ -525,8 +516,8 @@ mod tests {
|
||||
web3signer_should_sign: bool,
|
||||
) -> Self
|
||||
where
|
||||
F: Fn(PublicKeyBytes, Arc<LighthouseValidatorStore<TestingSlotClock, E>>) -> R,
|
||||
R: Future<Output = Result<(), lighthouse_validator_store::Error>>,
|
||||
F: Fn(PublicKeyBytes, Arc<ValidatorStore<TestingSlotClock, E>>) -> R,
|
||||
R: Future<Output = Result<(), ValidatorStoreError>>,
|
||||
{
|
||||
for validator_rig in &self.validator_rigs {
|
||||
let result =
|
||||
@@ -600,10 +591,10 @@ mod tests {
|
||||
.assert_signatures_match("beacon_block_base", |pubkey, validator_store| {
|
||||
let spec = spec.clone();
|
||||
async move {
|
||||
let block = BeaconBlock::<E>::Base(BeaconBlockBase::empty(&spec));
|
||||
let block = BeaconBlock::Base(BeaconBlockBase::empty(&spec));
|
||||
let block_slot = block.slot();
|
||||
validator_store
|
||||
.sign_block(pubkey, block.into(), block_slot)
|
||||
.sign_block(pubkey, block, block_slot)
|
||||
.await
|
||||
.unwrap()
|
||||
}
|
||||
@@ -670,14 +661,10 @@ mod tests {
|
||||
.assert_signatures_match("beacon_block_altair", |pubkey, validator_store| {
|
||||
let spec = spec.clone();
|
||||
async move {
|
||||
let mut altair_block = BeaconBlockAltair::<E>::empty(&spec);
|
||||
let mut altair_block = BeaconBlockAltair::empty(&spec);
|
||||
altair_block.slot = altair_fork_slot;
|
||||
validator_store
|
||||
.sign_block(
|
||||
pubkey,
|
||||
BeaconBlock::Altair(altair_block).into(),
|
||||
altair_fork_slot,
|
||||
)
|
||||
.sign_block(pubkey, BeaconBlock::Altair(altair_block), altair_fork_slot)
|
||||
.await
|
||||
.unwrap()
|
||||
}
|
||||
@@ -757,12 +744,12 @@ mod tests {
|
||||
.assert_signatures_match("beacon_block_bellatrix", |pubkey, validator_store| {
|
||||
let spec = spec.clone();
|
||||
async move {
|
||||
let mut bellatrix_block = BeaconBlockBellatrix::<E>::empty(&spec);
|
||||
let mut bellatrix_block = BeaconBlockBellatrix::empty(&spec);
|
||||
bellatrix_block.slot = bellatrix_fork_slot;
|
||||
validator_store
|
||||
.sign_block(
|
||||
pubkey,
|
||||
BeaconBlock::Bellatrix(bellatrix_block).into(),
|
||||
BeaconBlock::Bellatrix(bellatrix_block),
|
||||
bellatrix_fork_slot,
|
||||
)
|
||||
.await
|
||||
@@ -818,7 +805,7 @@ mod tests {
|
||||
};
|
||||
|
||||
let first_block = || {
|
||||
let mut bellatrix_block = BeaconBlockBellatrix::<E>::empty(&spec);
|
||||
let mut bellatrix_block = BeaconBlockBellatrix::empty(&spec);
|
||||
bellatrix_block.slot = bellatrix_fork_slot;
|
||||
BeaconBlock::Bellatrix(bellatrix_block)
|
||||
};
|
||||
@@ -884,7 +871,7 @@ mod tests {
|
||||
let block = first_block();
|
||||
let slot = block.slot();
|
||||
validator_store
|
||||
.sign_block(pubkey, block.into(), slot)
|
||||
.sign_block(pubkey, block, slot)
|
||||
.await
|
||||
.unwrap()
|
||||
})
|
||||
@@ -895,7 +882,7 @@ mod tests {
|
||||
let block = double_vote_block();
|
||||
let slot = block.slot();
|
||||
validator_store
|
||||
.sign_block(pubkey, block.into(), slot)
|
||||
.sign_block(pubkey, block, slot)
|
||||
.await
|
||||
.map(|_| ())
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user