mirror of
https://github.com/sigp/lighthouse.git
synced 2026-04-16 12:28:24 +00:00
Fix some low-hanging FIXMEs
This commit is contained in:
@@ -197,7 +197,6 @@ where
|
||||
};
|
||||
let finalized_checkpoint = justified_checkpoint;
|
||||
|
||||
// FIXME(sproul): avoid `to_vec` perf penalty
|
||||
Self {
|
||||
store,
|
||||
balances_cache: <_>::default(),
|
||||
|
||||
@@ -626,7 +626,6 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
|
||||
.get_full_block(&new_view.head_block_root, None)?
|
||||
.ok_or(Error::MissingBeaconBlock(new_view.head_block_root))?;
|
||||
|
||||
// FIXME(sproul): use advanced state?
|
||||
let beacon_state_root = beacon_block.state_root();
|
||||
let beacon_state: BeaconState<T::EthSpec> = self
|
||||
.get_state(&beacon_state_root, Some(beacon_block.slot()))?
|
||||
@@ -1288,8 +1287,7 @@ fn observe_head_block_delays<E: EthSpec, S: SlotClock>(
|
||||
// If the block was enshrined as head too late for attestations to be created for it,
|
||||
// log a debug warning and increment a metric.
|
||||
if late_head {
|
||||
// FIXME(sproul): restore this metric, idk where it went
|
||||
// metrics::inc_counter(&metrics::BEACON_BLOCK_HEAD_SLOT_START_DELAY_EXCEEDED_TOTAL);
|
||||
metrics::inc_counter(&metrics::BEACON_BLOCK_HEAD_SLOT_START_DELAY_EXCEEDED_TOTAL);
|
||||
debug!(
|
||||
log,
|
||||
"Delayed head block";
|
||||
|
||||
@@ -72,7 +72,6 @@ pub use store;
|
||||
pub use timeout_rw_lock::TimeoutRwLock;
|
||||
pub use types;
|
||||
|
||||
// FIXME(sproul): compatibility shim
|
||||
pub mod validator_pubkey_cache {
|
||||
use crate::BeaconChainTypes;
|
||||
|
||||
|
||||
@@ -813,6 +813,11 @@ lazy_static! {
|
||||
// [0.1, 0.2, 0.5, 1, 2, 5, 10, 20, 50]
|
||||
decimal_buckets(-1,2)
|
||||
);
|
||||
pub static ref BEACON_BLOCK_HEAD_SLOT_START_DELAY_EXCEEDED_TOTAL: Result<IntCounter> = try_create_int_counter(
|
||||
"beacon_block_head_slot_start_delay_exceeded_total",
|
||||
"Triggered when the duration between the start of the block's slot and the current time \
|
||||
will result in failed attestations.",
|
||||
);
|
||||
pub static ref BEACON_BLOCK_HEAD_MISSED_ATT_DEADLINE_LATE: Result<IntCounter> = try_create_int_counter(
|
||||
"beacon_block_head_missed_att_deadline_late",
|
||||
"Total number of delayed head blocks that arrived late"
|
||||
|
||||
@@ -513,8 +513,7 @@ impl<E: EthSpec, Hot: ItemStore<E>, Cold: ItemStore<E>> HotColdDB<E, Hot, Cold>
|
||||
return Ok(None);
|
||||
};
|
||||
|
||||
// FIXME(sproul): dodgy compression factor estimation
|
||||
let mut ssz_bytes = Vec::with_capacity(2 * bytes.len());
|
||||
let mut ssz_bytes = Vec::with_capacity(self.config.estimate_decompressed_size(bytes.len()));
|
||||
let mut decoder = Decoder::new(&*bytes).map_err(Error::Compression)?;
|
||||
decoder
|
||||
.read_to_end(&mut ssz_bytes)
|
||||
@@ -550,12 +549,11 @@ impl<E: EthSpec, Hot: ItemStore<E>, Cold: ItemStore<E>> HotColdDB<E, Hot, Cold>
|
||||
&slot.as_u64().to_be_bytes(),
|
||||
);
|
||||
|
||||
// FIXME(sproul): fix compression estimate and level
|
||||
let compression_level = 3;
|
||||
let ssz_bytes = block.as_ssz_bytes();
|
||||
let mut compressed_value = Vec::with_capacity(ssz_bytes.len() / 2);
|
||||
let mut encoder =
|
||||
Encoder::new(&mut compressed_value, compression_level).map_err(Error::Compression)?;
|
||||
let mut compressed_value =
|
||||
Vec::with_capacity(self.config.estimate_compressed_size(ssz_bytes.len()));
|
||||
let mut encoder = Encoder::new(&mut compressed_value, self.config.compression_level)
|
||||
.map_err(Error::Compression)?;
|
||||
encoder.write_all(&ssz_bytes).map_err(Error::Compression)?;
|
||||
encoder.finish().map_err(Error::Compression)?;
|
||||
|
||||
|
||||
@@ -100,8 +100,7 @@ impl<E: EthSpec, Hot: ItemStore<E>, Cold: ItemStore<E>> ValidatorPubkeyCache<E,
|
||||
self.import(
|
||||
state
|
||||
.validators()
|
||||
.iter_from(self.pubkeys.len())
|
||||
.unwrap() // FIXME(sproul)
|
||||
.iter_from(self.pubkeys.len())?
|
||||
.map(|v| v.immutable.clone()),
|
||||
store,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user