mirror of
https://github.com/sigp/lighthouse.git
synced 2026-07-03 04:44:28 +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:
@@ -474,12 +474,12 @@ where
|
||||
mod tests {
|
||||
use super::*;
|
||||
use fixed_bytes::FixedBytesExtended;
|
||||
use types::{AttestationBase, Hash256, test_utils::test_random_instance};
|
||||
use types::{AttestationBase, Hash256, test_utils::test_arbitrary_instance};
|
||||
|
||||
type E = types::MainnetEthSpec;
|
||||
|
||||
fn get_attestation(slot: Slot, beacon_block_root: u64) -> Attestation<E> {
|
||||
let a: AttestationBase<E> = test_random_instance();
|
||||
let a: AttestationBase<E> = test_arbitrary_instance();
|
||||
let mut a = Attestation::Base(a);
|
||||
a.data_mut().slot = slot;
|
||||
a.data_mut().beacon_block_root = Hash256::from_low_u64_be(beacon_block_root);
|
||||
@@ -487,7 +487,7 @@ mod tests {
|
||||
}
|
||||
|
||||
fn get_sync_contribution(slot: Slot, beacon_block_root: u64) -> SyncCommitteeContribution<E> {
|
||||
let mut a: SyncCommitteeContribution<E> = test_random_instance();
|
||||
let mut a: SyncCommitteeContribution<E> = test_arbitrary_instance();
|
||||
a.slot = slot;
|
||||
a.beacon_block_root = Hash256::from_low_u64_be(beacon_block_root);
|
||||
a
|
||||
|
||||
Reference in New Issue
Block a user