mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-03 00:31:50 +00:00
impl test random for some types (#7370)
ref: https://github.com/sigp/lighthouse/pull/7367 Implement `TestRandom` for a few types
This commit is contained in:
@@ -1,9 +1,9 @@
|
|||||||
use crate::beacon_block_body::KzgCommitments;
|
use crate::beacon_block_body::KzgCommitments;
|
||||||
use crate::{
|
use crate::{
|
||||||
ChainSpec, EthSpec, ExecutionPayloadHeaderBellatrix, ExecutionPayloadHeaderCapella,
|
test_utils::TestRandom, ChainSpec, EthSpec, ExecutionPayloadHeaderBellatrix,
|
||||||
ExecutionPayloadHeaderDeneb, ExecutionPayloadHeaderElectra, ExecutionPayloadHeaderFulu,
|
ExecutionPayloadHeaderCapella, ExecutionPayloadHeaderDeneb, ExecutionPayloadHeaderElectra,
|
||||||
ExecutionPayloadHeaderRef, ExecutionPayloadHeaderRefMut, ExecutionRequests, ForkName,
|
ExecutionPayloadHeaderFulu, ExecutionPayloadHeaderRef, ExecutionPayloadHeaderRefMut,
|
||||||
ForkVersionDecode, ForkVersionDeserialize, SignedRoot, Uint256,
|
ExecutionRequests, ForkName, ForkVersionDecode, ForkVersionDeserialize, SignedRoot, Uint256,
|
||||||
};
|
};
|
||||||
use bls::PublicKeyBytes;
|
use bls::PublicKeyBytes;
|
||||||
use bls::Signature;
|
use bls::Signature;
|
||||||
@@ -11,6 +11,7 @@ use serde::{Deserialize, Deserializer, Serialize};
|
|||||||
use ssz::Decode;
|
use ssz::Decode;
|
||||||
use ssz_derive::{Decode, Encode};
|
use ssz_derive::{Decode, Encode};
|
||||||
use superstruct::superstruct;
|
use superstruct::superstruct;
|
||||||
|
use test_random_derive::TestRandom;
|
||||||
use tree_hash_derive::TreeHash;
|
use tree_hash_derive::TreeHash;
|
||||||
|
|
||||||
#[superstruct(
|
#[superstruct(
|
||||||
@@ -24,7 +25,8 @@ use tree_hash_derive::TreeHash;
|
|||||||
Deserialize,
|
Deserialize,
|
||||||
TreeHash,
|
TreeHash,
|
||||||
Decode,
|
Decode,
|
||||||
Clone
|
Clone,
|
||||||
|
TestRandom
|
||||||
),
|
),
|
||||||
serde(bound = "E: EthSpec", deny_unknown_fields)
|
serde(bound = "E: EthSpec", deny_unknown_fields)
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
use crate::beacon_block_body::{format_kzg_commitments, BLOB_KZG_COMMITMENTS_INDEX};
|
use crate::beacon_block_body::{format_kzg_commitments, BLOB_KZG_COMMITMENTS_INDEX};
|
||||||
|
use crate::test_utils::TestRandom;
|
||||||
use crate::*;
|
use crate::*;
|
||||||
use derivative::Derivative;
|
use derivative::Derivative;
|
||||||
use merkle_proof::MerkleTree;
|
use merkle_proof::MerkleTree;
|
||||||
@@ -6,6 +7,7 @@ use serde::{Deserialize, Serialize};
|
|||||||
use ssz_derive::{Decode, Encode};
|
use ssz_derive::{Decode, Encode};
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use superstruct::superstruct;
|
use superstruct::superstruct;
|
||||||
|
use test_random_derive::TestRandom;
|
||||||
use tree_hash::TreeHash;
|
use tree_hash::TreeHash;
|
||||||
use tree_hash_derive::TreeHash;
|
use tree_hash_derive::TreeHash;
|
||||||
|
|
||||||
@@ -49,7 +51,8 @@ impl From<SignedBeaconBlockHash> for Hash256 {
|
|||||||
Decode,
|
Decode,
|
||||||
TreeHash,
|
TreeHash,
|
||||||
Derivative,
|
Derivative,
|
||||||
arbitrary::Arbitrary
|
arbitrary::Arbitrary,
|
||||||
|
TestRandom
|
||||||
),
|
),
|
||||||
derivative(PartialEq, Hash(bound = "E: EthSpec")),
|
derivative(PartialEq, Hash(bound = "E: EthSpec")),
|
||||||
serde(bound = "E: EthSpec, Payload: AbstractExecPayload<E>"),
|
serde(bound = "E: EthSpec, Payload: AbstractExecPayload<E>"),
|
||||||
|
|||||||
Reference in New Issue
Block a user