mirror of
https://github.com/sigp/lighthouse.git
synced 2026-04-18 13:28:33 +00:00
Increase network limits (#2796)
Fix max packet sizes Fix max_payload_size function Add merge block test Fix max size calculation; fix up test Clear comments Add a payload_size_function Use safe arith for payload calculation Return an error if block too big in block production Separate test to check if block is over limit
This commit is contained in:
@@ -61,6 +61,7 @@ use safe_arith::SafeArith;
|
||||
use slasher::Slasher;
|
||||
use slog::{crit, debug, error, info, trace, warn, Logger};
|
||||
use slot_clock::SlotClock;
|
||||
use ssz::Encode;
|
||||
use state_processing::{
|
||||
common::get_indexed_attestation,
|
||||
per_block_processing,
|
||||
@@ -3006,6 +3007,19 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
|
||||
Signature::empty(),
|
||||
);
|
||||
|
||||
let block_size = block.ssz_bytes_len();
|
||||
debug!(
|
||||
self.log,
|
||||
"Produced block on state";
|
||||
"block_size" => block_size,
|
||||
);
|
||||
|
||||
metrics::observe(&metrics::BLOCK_SIZE, block_size as f64);
|
||||
|
||||
if block_size > self.config.max_network_size {
|
||||
return Err(BlockProductionError::BlockTooLarge(block_size));
|
||||
}
|
||||
|
||||
let process_timer = metrics::start_timer(&metrics::BLOCK_PRODUCTION_PROCESS_TIMES);
|
||||
per_block_processing(
|
||||
&mut state,
|
||||
|
||||
@@ -16,6 +16,8 @@ pub struct ChainConfig {
|
||||
pub reconstruct_historic_states: bool,
|
||||
/// Whether timeouts on `TimeoutRwLock`s are enabled or not.
|
||||
pub enable_lock_timeouts: bool,
|
||||
/// The max size of a message that can be sent over the network.
|
||||
pub max_network_size: usize,
|
||||
}
|
||||
|
||||
impl Default for ChainConfig {
|
||||
@@ -25,6 +27,7 @@ impl Default for ChainConfig {
|
||||
weak_subjectivity_checkpoint: None,
|
||||
reconstruct_historic_states: false,
|
||||
enable_lock_timeouts: true,
|
||||
max_network_size: 10 * 1_048_576, // 10M
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -185,6 +185,7 @@ pub enum BlockProductionError {
|
||||
GetPayloadFailed(execution_layer::Error),
|
||||
FailedToReadFinalizedBlock(store::Error),
|
||||
MissingFinalizedBlock(Hash256),
|
||||
BlockTooLarge(usize),
|
||||
}
|
||||
|
||||
easy_from_to!(BlockProcessingError, BlockProductionError);
|
||||
|
||||
@@ -107,6 +107,11 @@ lazy_static! {
|
||||
"Number of attestations in a block"
|
||||
);
|
||||
|
||||
pub static ref BLOCK_SIZE: Result<Histogram> = try_create_histogram(
|
||||
"beacon_block_total_size",
|
||||
"Size of a signed beacon block"
|
||||
);
|
||||
|
||||
/*
|
||||
* Unaggregated Attestation Verification
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user