mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-19 21:04:41 +00:00
fix rate limits, and a couple other bugs
This commit is contained in:
@@ -298,8 +298,8 @@ impl<TSpec: EthSpec> Decoder for SSZSnappyOutboundCodec<TSpec> {
|
||||
.rpc_response_limits::<TSpec>(&self.fork_context);
|
||||
if ssz_limits.is_out_of_bounds(length, self.max_packet_size) {
|
||||
return Err(RPCError::InvalidData(format!(
|
||||
"RPC response length is out of bounds, length {}",
|
||||
length
|
||||
"RPC response length is out of bounds, length {}, max {}, min {}",
|
||||
length, ssz_limits.max, ssz_limits.min
|
||||
)));
|
||||
}
|
||||
// Calculate worst case compression length for given uncompressed length
|
||||
|
||||
@@ -23,7 +23,7 @@ use tokio_util::{
|
||||
use types::BlobsSidecar;
|
||||
use types::{
|
||||
BeaconBlock, BeaconBlockAltair, BeaconBlockBase, BeaconBlockMerge, Blob, EmptyBlock, EthSpec,
|
||||
ForkContext, ForkName, Hash256, MainnetEthSpec, Signature, SignedBeaconBlock,
|
||||
ForkContext, ForkName, Hash256, MainnetEthSpec, Signature, SignedBeaconBlock
|
||||
};
|
||||
|
||||
lazy_static! {
|
||||
@@ -107,6 +107,12 @@ lazy_static! {
|
||||
.as_ssz_bytes()
|
||||
.len();
|
||||
|
||||
pub static ref BLOBS_SIDECAR_MIN: usize = BlobsSidecar::<MainnetEthSpec>::empty().as_ssz_bytes().len();
|
||||
pub static ref BLOBS_SIDECAR_MAX: usize = BlobsSidecar::<MainnetEthSpec>::max_size();
|
||||
|
||||
//FIXME(sean) these are underestimates
|
||||
pub static ref SIGNED_BLOCK_AND_BLOBS_MIN: usize = *BLOBS_SIDECAR_MIN + *SIGNED_BEACON_BLOCK_BASE_MIN;
|
||||
pub static ref SIGNED_BLOCK_AND_BLOBS_MAX: usize =*BLOBS_SIDECAR_MAX + *SIGNED_BEACON_BLOCK_EIP4844_MAX;
|
||||
}
|
||||
|
||||
/// The maximum bytes that can be sent across the RPC pre-merge.
|
||||
@@ -359,9 +365,14 @@ impl ProtocolId {
|
||||
Protocol::BlocksByRange => rpc_block_limits_by_fork(fork_context.current_fork()),
|
||||
Protocol::BlocksByRoot => rpc_block_limits_by_fork(fork_context.current_fork()),
|
||||
|
||||
//FIXME(sean) add blob sizes
|
||||
Protocol::BlobsByRange => rpc_block_limits_by_fork(fork_context.current_fork()),
|
||||
Protocol::BlobsByRoot => rpc_block_limits_by_fork(fork_context.current_fork()),
|
||||
Protocol::BlobsByRange => RpcLimits::new(
|
||||
*BLOBS_SIDECAR_MIN,
|
||||
*BLOBS_SIDECAR_MAX,
|
||||
),
|
||||
Protocol::BlobsByRoot => RpcLimits::new(
|
||||
*SIGNED_BLOCK_AND_BLOBS_MIN,
|
||||
*SIGNED_BLOCK_AND_BLOBS_MAX,
|
||||
),
|
||||
|
||||
Protocol::Ping => RpcLimits::new(
|
||||
<Ping as Encode>::ssz_fixed_len(),
|
||||
|
||||
Reference in New Issue
Block a user