mirror of
https://github.com/sigp/lighthouse.git
synced 2026-04-17 04:48:21 +00:00
fix some todos (#5817)
This commit is contained in:
@@ -488,7 +488,7 @@ mod tests {
|
||||
// This test will only pass with `blst`, if we run these tests with another
|
||||
// BLS library in future we will have to make it generic.
|
||||
#[test]
|
||||
fn size_of() {
|
||||
fn size_of_base() {
|
||||
use std::mem::size_of;
|
||||
|
||||
let aggregation_bits =
|
||||
@@ -501,16 +501,43 @@ mod tests {
|
||||
assert_eq!(signature, 288 + 16);
|
||||
|
||||
let attestation_expected = aggregation_bits + attestation_data + signature;
|
||||
// TODO(electra) since we've removed attestation aggregation for electra variant
|
||||
// i've updated the attestation value expected from 488 544
|
||||
// assert_eq!(attestation_expected, 488);
|
||||
assert_eq!(attestation_expected, 488);
|
||||
assert_eq!(
|
||||
size_of::<Attestation<MainnetEthSpec>>(),
|
||||
size_of::<AttestationBase<MainnetEthSpec>>(),
|
||||
attestation_expected
|
||||
);
|
||||
}
|
||||
|
||||
// TODO(electra): can we do this with both variants or should we?
|
||||
ssz_and_tree_hash_tests!(AttestationBase<MainnetEthSpec>);
|
||||
#[test]
|
||||
fn size_of_electra() {
|
||||
use std::mem::size_of;
|
||||
|
||||
let aggregation_bits =
|
||||
size_of::<BitList<<MainnetEthSpec as EthSpec>::MaxValidatorsPerSlot>>();
|
||||
let attestation_data = size_of::<AttestationData>();
|
||||
let committee_bits =
|
||||
size_of::<BitList<<MainnetEthSpec as EthSpec>::MaxCommitteesPerSlot>>();
|
||||
let signature = size_of::<AggregateSignature>();
|
||||
|
||||
assert_eq!(aggregation_bits, 56);
|
||||
assert_eq!(committee_bits, 56);
|
||||
assert_eq!(attestation_data, 128);
|
||||
assert_eq!(signature, 288 + 16);
|
||||
|
||||
let attestation_expected = aggregation_bits + committee_bits + attestation_data + signature;
|
||||
assert_eq!(attestation_expected, 544);
|
||||
assert_eq!(
|
||||
size_of::<AttestationElectra<MainnetEthSpec>>(),
|
||||
attestation_expected
|
||||
);
|
||||
}
|
||||
|
||||
mod base {
|
||||
use super::*;
|
||||
ssz_and_tree_hash_tests!(AttestationBase<MainnetEthSpec>);
|
||||
}
|
||||
mod electra {
|
||||
use super::*;
|
||||
ssz_and_tree_hash_tests!(AttestationElectra<MainnetEthSpec>);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -164,7 +164,12 @@ impl<E: EthSpec> AttesterSlashing<E> {
|
||||
mod tests {
|
||||
use super::*;
|
||||
use crate::*;
|
||||
|
||||
// TODO(electra): should this be done for both variants?
|
||||
ssz_and_tree_hash_tests!(AttesterSlashingBase<MainnetEthSpec>);
|
||||
mod base {
|
||||
use super::*;
|
||||
ssz_and_tree_hash_tests!(AttesterSlashingBase<MainnetEthSpec>);
|
||||
}
|
||||
mod electra {
|
||||
use super::*;
|
||||
ssz_and_tree_hash_tests!(AttesterSlashingElectra<MainnetEthSpec>);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -607,14 +607,12 @@ impl<E: EthSpec, Payload: AbstractExecPayload<E>> BeaconBlockElectra<E, Payload>
|
||||
/// Return a Electra block where the block has maximum size.
|
||||
pub fn full(spec: &ChainSpec) -> Self {
|
||||
let base_block: BeaconBlockBase<_, Payload> = BeaconBlockBase::full(spec);
|
||||
// TODO(electra): check this
|
||||
let indexed_attestation: IndexedAttestationElectra<E> = IndexedAttestationElectra {
|
||||
attesting_indices: VariableList::new(vec![0_u64; E::MaxValidatorsPerSlot::to_usize()])
|
||||
.unwrap(),
|
||||
data: AttestationData::default(),
|
||||
signature: AggregateSignature::empty(),
|
||||
};
|
||||
// TODO(electra): fix this so we calculate this size correctly
|
||||
let attester_slashings = vec![
|
||||
AttesterSlashingElectra {
|
||||
attestation_1: indexed_attestation.clone(),
|
||||
@@ -627,7 +625,6 @@ impl<E: EthSpec, Payload: AbstractExecPayload<E>> BeaconBlockElectra<E, Payload>
|
||||
aggregation_bits: BitList::with_capacity(E::MaxValidatorsPerSlot::to_usize()).unwrap(),
|
||||
data: AttestationData::default(),
|
||||
signature: AggregateSignature::empty(),
|
||||
// TODO(electra): does this actually allocate the size correctly?
|
||||
committee_bits: BitVector::new(),
|
||||
};
|
||||
let mut attestations_electra = vec![];
|
||||
|
||||
Reference in New Issue
Block a user