mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-15 02:42:38 +00:00
Update Rust Edition to 2024 (#7766)
* #7749 Thanks @dknopik and @michaelsproul for your help!
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
use crate::rpc::RequestType;
|
||||
use crate::rpc::methods::*;
|
||||
use crate::rpc::protocol::{
|
||||
Encoding, ProtocolId, RPCError, SupportedProtocol, ERROR_TYPE_MAX, ERROR_TYPE_MIN,
|
||||
ERROR_TYPE_MAX, ERROR_TYPE_MIN, Encoding, ProtocolId, RPCError, SupportedProtocol,
|
||||
};
|
||||
use crate::rpc::RequestType;
|
||||
use libp2p::bytes::BufMut;
|
||||
use libp2p::bytes::BytesMut;
|
||||
use snap::read::FrameDecoder;
|
||||
@@ -467,12 +467,12 @@ fn context_bytes<E: EthSpec>(
|
||||
resp: &RpcResponse<E>,
|
||||
) -> Option<[u8; CONTEXT_BYTES_LEN]> {
|
||||
// Add the context bytes if required
|
||||
if protocol.has_context_bytes() {
|
||||
if let RpcResponse::Success(rpc_variant) = resp {
|
||||
return rpc_variant
|
||||
.slot()
|
||||
.map(|slot| fork_context.context_bytes(slot.epoch(E::slots_per_epoch())));
|
||||
}
|
||||
if protocol.has_context_bytes()
|
||||
&& let RpcResponse::Success(rpc_variant) = resp
|
||||
{
|
||||
return rpc_variant
|
||||
.slot()
|
||||
.map(|slot| fork_context.context_bytes(slot.epoch(E::slots_per_epoch())));
|
||||
}
|
||||
None
|
||||
}
|
||||
@@ -902,10 +902,10 @@ mod tests {
|
||||
use crate::rpc::protocol::*;
|
||||
use crate::types::{EnrAttestationBitfield, EnrSyncCommitteeBitfield};
|
||||
use types::{
|
||||
blob_sidecar::BlobIdentifier, data_column_sidecar::Cell, BeaconBlock, BeaconBlockAltair,
|
||||
BeaconBlockBase, BeaconBlockBellatrix, BeaconBlockHeader, DataColumnsByRootIdentifier,
|
||||
EmptyBlock, Epoch, FixedBytesExtended, FullPayload, KzgCommitment, KzgProof, Signature,
|
||||
SignedBeaconBlockHeader, Slot,
|
||||
BeaconBlock, BeaconBlockAltair, BeaconBlockBase, BeaconBlockBellatrix, BeaconBlockHeader,
|
||||
DataColumnsByRootIdentifier, EmptyBlock, Epoch, FixedBytesExtended, FullPayload,
|
||||
KzgCommitment, KzgProof, Signature, SignedBeaconBlockHeader, Slot,
|
||||
blob_sidecar::BlobIdentifier, data_column_sidecar::Cell,
|
||||
};
|
||||
|
||||
type Spec = types::MainnetEthSpec;
|
||||
@@ -1903,13 +1903,15 @@ mod tests {
|
||||
.unwrap(),
|
||||
);
|
||||
|
||||
assert!(decode_response(
|
||||
SupportedProtocol::MetaDataV2,
|
||||
&mut encoded_bytes,
|
||||
ForkName::Altair,
|
||||
&chain_spec,
|
||||
)
|
||||
.is_err());
|
||||
assert!(
|
||||
decode_response(
|
||||
SupportedProtocol::MetaDataV2,
|
||||
&mut encoded_bytes,
|
||||
ForkName::Altair,
|
||||
&chain_spec,
|
||||
)
|
||||
.is_err()
|
||||
);
|
||||
|
||||
// Sending context bytes which do not correspond to any fork should return an error
|
||||
let mut encoded_bytes = encode_response(
|
||||
|
||||
Reference in New Issue
Block a user