mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-11 18:04:18 +00:00
Some gossip work
This commit is contained in:
@@ -15,7 +15,10 @@ use std::io::{Read, Write};
|
||||
use std::marker::PhantomData;
|
||||
use std::sync::Arc;
|
||||
use tokio_util::codec::{Decoder, Encoder};
|
||||
use types::{BlobWrapper, EthSpec, ForkContext, ForkName, SignedBeaconBlock, SignedBeaconBlockAltair, SignedBeaconBlockBase, SignedBeaconBlockMerge, SignedBeaconBlockShanghai};
|
||||
use types::{
|
||||
BlobWrapper, EthSpec, ForkContext, ForkName, SignedBeaconBlock, SignedBeaconBlockAltair,
|
||||
SignedBeaconBlockBase, SignedBeaconBlockMerge, SignedBeaconBlockShanghai,
|
||||
};
|
||||
use unsigned_varint::codec::Uvi;
|
||||
|
||||
const CONTEXT_BYTES_LEN: usize = 4;
|
||||
@@ -603,13 +606,9 @@ fn handle_v2_response<T: EthSpec>(
|
||||
)?),
|
||||
)))),
|
||||
},
|
||||
Protocol::TxBlobsByRange => {
|
||||
Ok(Some(RPCResponse::TxBlobsByRange(Box::new(
|
||||
BlobWrapper::from_ssz_bytes(
|
||||
decoded_buffer,
|
||||
)?
|
||||
))))
|
||||
},
|
||||
Protocol::TxBlobsByRange => Ok(Some(RPCResponse::TxBlobsByRange(Box::new(
|
||||
BlobWrapper::from_ssz_bytes(decoded_buffer)?,
|
||||
)))),
|
||||
Protocol::BlocksByRoot => match fork_name {
|
||||
ForkName::Altair => Ok(Some(RPCResponse::BlocksByRoot(Arc::new(
|
||||
SignedBeaconBlock::Altair(SignedBeaconBlockAltair::from_ssz_bytes(
|
||||
|
||||
@@ -73,9 +73,11 @@ impl<TSpec: EthSpec> OutboundRequest<TSpec> {
|
||||
ProtocolId::new(Protocol::BlocksByRange, Version::V1, Encoding::SSZSnappy),
|
||||
],
|
||||
//FIXME(sean) what should the protocol version be?
|
||||
OutboundRequest::TxBlobsByRange(_) => vec![
|
||||
ProtocolId::new(Protocol::TxBlobsByRange, Version::V2, Encoding::SSZSnappy),
|
||||
],
|
||||
OutboundRequest::TxBlobsByRange(_) => vec![ProtocolId::new(
|
||||
Protocol::TxBlobsByRange,
|
||||
Version::V2,
|
||||
Encoding::SSZSnappy,
|
||||
)],
|
||||
OutboundRequest::BlocksByRoot(_) => vec![
|
||||
ProtocolId::new(Protocol::BlocksByRoot, Version::V2, Encoding::SSZSnappy),
|
||||
ProtocolId::new(Protocol::BlocksByRoot, Version::V1, Encoding::SSZSnappy),
|
||||
|
||||
@@ -20,7 +20,10 @@ use tokio_util::{
|
||||
codec::Framed,
|
||||
compat::{Compat, FuturesAsyncReadCompatExt},
|
||||
};
|
||||
use types::{BeaconBlock, BeaconBlockAltair, BeaconBlockBase, BeaconBlockMerge, BlobWrapper, EthSpec, ForkContext, ForkName, Hash256, MainnetEthSpec, Signature, SignedBeaconBlock};
|
||||
use types::{
|
||||
BeaconBlock, BeaconBlockAltair, BeaconBlockBase, BeaconBlockMerge, BlobWrapper, EthSpec,
|
||||
ForkContext, ForkName, Hash256, MainnetEthSpec, Signature, SignedBeaconBlock,
|
||||
};
|
||||
|
||||
lazy_static! {
|
||||
// Note: Hardcoding the `EthSpec` type for `SignedBeaconBlock` as min/max values is
|
||||
@@ -288,12 +291,10 @@ impl ProtocolId {
|
||||
<OldBlocksByRangeRequest as Encode>::ssz_fixed_len(),
|
||||
<OldBlocksByRangeRequest as Encode>::ssz_fixed_len(),
|
||||
),
|
||||
Protocol::TxBlobsByRange => {
|
||||
RpcLimits::new(
|
||||
<TxBlobsByRangeRequest as Encode>::ssz_fixed_len(),
|
||||
<TxBlobsByRangeRequest as Encode>::ssz_fixed_len(),
|
||||
)
|
||||
}
|
||||
Protocol::TxBlobsByRange => RpcLimits::new(
|
||||
<TxBlobsByRangeRequest as Encode>::ssz_fixed_len(),
|
||||
<TxBlobsByRangeRequest as Encode>::ssz_fixed_len(),
|
||||
),
|
||||
Protocol::BlocksByRoot => {
|
||||
RpcLimits::new(*BLOCKS_BY_ROOT_REQUEST_MIN, *BLOCKS_BY_ROOT_REQUEST_MAX)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user