mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-14 10:22:38 +00:00
superstruct the AttesterSlashing (#5636)
* `superstruct` Attester Fork Variants * Push a little further * Deal with Encode / Decode of AttesterSlashing * not so sure about this.. * Stop Encode/Decode Bounds from Propagating Out * Tons of Changes.. * More Conversions to AttestationRef * Add AsReference trait (#15) * Add AsReference trait * Fix some snafus * Got it Compiling! :D * Got Tests Building * Get beacon chain tests compiling --------- Co-authored-by: Michael Sproul <micsproul@gmail.com>
This commit is contained in:
@@ -10,8 +10,8 @@ use std::collections::{HashMap, HashSet};
|
||||
use std::marker::PhantomData;
|
||||
use std::sync::Arc;
|
||||
use types::{
|
||||
Attestation, BeaconCommittee, BeaconState, BeaconStateError, BlindedPayload, ChainSpec, Epoch,
|
||||
EthSpec, Hash256, OwnedBeaconCommittee, RelativeEpoch, SignedBeaconBlock, Slot,
|
||||
AttestationRef, BeaconCommittee, BeaconState, BeaconStateError, BlindedPayload, ChainSpec,
|
||||
Epoch, EthSpec, Hash256, OwnedBeaconCommittee, RelativeEpoch, SignedBeaconBlock, Slot,
|
||||
};
|
||||
use warp_utils::reject::{beacon_chain_error, custom_bad_request, custom_server_error};
|
||||
|
||||
@@ -111,9 +111,9 @@ impl<E: EthSpec> PackingEfficiencyHandler<E> {
|
||||
let attestations = block_body.attestations();
|
||||
|
||||
let mut attestations_in_block = HashMap::new();
|
||||
for attestation in attestations.iter() {
|
||||
for attestation in attestations {
|
||||
match attestation {
|
||||
Attestation::Base(attn) => {
|
||||
AttestationRef::Base(attn) => {
|
||||
for (position, voted) in attn.aggregation_bits.iter().enumerate() {
|
||||
if voted {
|
||||
let unique_attestation = UniqueAttestation {
|
||||
@@ -133,7 +133,7 @@ impl<E: EthSpec> PackingEfficiencyHandler<E> {
|
||||
}
|
||||
}
|
||||
// TODO(electra) implement electra variant
|
||||
Attestation::Electra(_) => {
|
||||
AttestationRef::Electra(_) => {
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1635,7 +1635,12 @@ pub fn serve<T: BeaconChainTypes>(
|
||||
let (block, execution_optimistic, finalized) =
|
||||
block_id.blinded_block(&chain)?;
|
||||
Ok(api_types::GenericResponse::from(
|
||||
block.message().body().attestations().clone(),
|
||||
block
|
||||
.message()
|
||||
.body()
|
||||
.attestations()
|
||||
.map(|att| att.clone_as_attestation())
|
||||
.collect::<Vec<_>>(),
|
||||
)
|
||||
.add_execution_optimistic_finalized(execution_optimistic, finalized))
|
||||
})
|
||||
@@ -1833,7 +1838,7 @@ pub fn serve<T: BeaconChainTypes>(
|
||||
chain
|
||||
.validator_monitor
|
||||
.read()
|
||||
.register_api_attester_slashing(&slashing);
|
||||
.register_api_attester_slashing(slashing.to_ref());
|
||||
|
||||
if let ObservationOutcome::New(slashing) = outcome {
|
||||
publish_pubsub_message(
|
||||
|
||||
Reference in New Issue
Block a user