mirror of
https://github.com/sigp/lighthouse.git
synced 2026-06-01 05:37:05 +00:00
Remove TestRandom (#9006)
We have a legacy `TestRandom` trait which generates random types for testing and fuzzing. This function overlaps with `arbitrary` which is used very commonly in the ecosystem. Remove `TestRandom` and generate random type instances using `Arbitrary`. Co-Authored-By: Mac L <mjladson@pm.me> Co-Authored-By: Michael Sproul <michael@sigmaprime.io>
This commit is contained in:
@@ -582,20 +582,20 @@ mod tests {
|
||||
use tree_hash::TreeHash;
|
||||
use types::{
|
||||
Attestation, AttestationBase, AttestationElectra, Fork, Hash256, SyncCommitteeMessage,
|
||||
test_utils::{generate_deterministic_keypair, test_random_instance},
|
||||
test_utils::{generate_deterministic_keypair, test_arbitrary_instance},
|
||||
};
|
||||
|
||||
type E = types::MainnetEthSpec;
|
||||
|
||||
fn get_attestation_base(slot: Slot) -> Attestation<E> {
|
||||
let mut a: AttestationBase<E> = test_random_instance();
|
||||
let mut a: AttestationBase<E> = test_arbitrary_instance();
|
||||
a.data.slot = slot;
|
||||
a.aggregation_bits = BitList::with_capacity(4).expect("should create bitlist");
|
||||
Attestation::Base(a)
|
||||
}
|
||||
|
||||
fn get_attestation_electra(slot: Slot) -> Attestation<E> {
|
||||
let mut a: AttestationElectra<E> = test_random_instance();
|
||||
let mut a: AttestationElectra<E> = test_arbitrary_instance();
|
||||
a.data.slot = slot;
|
||||
a.aggregation_bits = BitList::with_capacity(4).expect("should create bitlist");
|
||||
a.committee_bits = BitVector::new();
|
||||
@@ -606,7 +606,7 @@ mod tests {
|
||||
}
|
||||
|
||||
fn get_sync_contribution(slot: Slot) -> SyncCommitteeContribution<E> {
|
||||
let mut a: SyncCommitteeContribution<E> = test_random_instance();
|
||||
let mut a: SyncCommitteeContribution<E> = test_arbitrary_instance();
|
||||
a.slot = slot;
|
||||
a.aggregation_bits = BitVector::new();
|
||||
a
|
||||
|
||||
Reference in New Issue
Block a user