Remove IndexedAttestation faulty Decode impl

This commit is contained in:
dapplion
2024-06-17 19:01:06 +02:00
parent 4f08f6e0da
commit f0492852f3
2 changed files with 7 additions and 23 deletions

View File

@@ -2,7 +2,6 @@ use crate::{test_utils::TestRandom, AggregateSignature, AttestationData, EthSpec
use core::slice::Iter;
use derivative::Derivative;
use serde::{Deserialize, Serialize};
use ssz::Decode;
use ssz::Encode;
use ssz_derive::{Decode, Encode};
use std::hash::{Hash, Hasher};
@@ -187,26 +186,6 @@ impl<'a, E: EthSpec> IndexedAttestationRef<'a, E> {
}
}
impl<E: EthSpec> Decode for IndexedAttestation<E> {
fn is_ssz_fixed_len() -> bool {
false
}
fn from_ssz_bytes(bytes: &[u8]) -> Result<Self, ssz::DecodeError> {
if let Ok(result) = IndexedAttestationBase::from_ssz_bytes(bytes) {
return Ok(IndexedAttestation::Base(result));
}
if let Ok(result) = IndexedAttestationElectra::from_ssz_bytes(bytes) {
return Ok(IndexedAttestation::Electra(result));
}
Err(ssz::DecodeError::BytesInvalid(String::from(
"bytes not valid for any fork variant",
)))
}
}
/// Implementation of non-crypto-secure `Hash`, for use with `HashMap` and `HashSet`.
///
/// Guarantees `att1 == att2 -> hash(att1) == hash(att2)`.