mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-06 10:11:44 +00:00
@@ -456,11 +456,10 @@ impl<'a, T: BeaconChainTypes> IndexedAggregatedAttestation<'a, T> {
|
||||
chain: &BeaconChain<T>,
|
||||
) -> Result<Self, Error> {
|
||||
Self::verify_slashable(signed_aggregate, chain)
|
||||
.map(|verified_aggregate| {
|
||||
.inspect(|verified_aggregate| {
|
||||
if let Some(slasher) = chain.slasher.as_ref() {
|
||||
slasher.accept_attestation(verified_aggregate.indexed_attestation.clone());
|
||||
}
|
||||
verified_aggregate
|
||||
})
|
||||
.map_err(|slash_info| process_slash_info(slash_info, chain))
|
||||
}
|
||||
@@ -892,11 +891,10 @@ impl<'a, T: BeaconChainTypes> IndexedUnaggregatedAttestation<'a, T> {
|
||||
chain: &BeaconChain<T>,
|
||||
) -> Result<Self, Error> {
|
||||
Self::verify_slashable(attestation.to_ref(), subnet_id, chain)
|
||||
.map(|verified_unaggregated| {
|
||||
.inspect(|verified_unaggregated| {
|
||||
if let Some(slasher) = chain.slasher.as_ref() {
|
||||
slasher.accept_attestation(verified_unaggregated.indexed_attestation.clone());
|
||||
}
|
||||
verified_unaggregated
|
||||
})
|
||||
.map_err(|slash_info| process_slash_info(slash_info, chain))
|
||||
}
|
||||
|
||||
@@ -2035,7 +2035,7 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
|
||||
let _timer =
|
||||
metrics::start_timer(&metrics::UNAGGREGATED_ATTESTATION_GOSSIP_VERIFICATION_TIMES);
|
||||
|
||||
VerifiedUnaggregatedAttestation::verify(unaggregated_attestation, subnet_id, self).map(
|
||||
VerifiedUnaggregatedAttestation::verify(unaggregated_attestation, subnet_id, self).inspect(
|
||||
|v| {
|
||||
// This method is called for API and gossip attestations, so this covers all unaggregated attestation events
|
||||
if let Some(event_handler) = self.event_handler.as_ref() {
|
||||
@@ -2046,7 +2046,6 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
|
||||
}
|
||||
}
|
||||
metrics::inc_counter(&metrics::UNAGGREGATED_ATTESTATION_PROCESSING_SUCCESSES);
|
||||
v
|
||||
},
|
||||
)
|
||||
}
|
||||
@@ -2074,7 +2073,7 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
|
||||
let _timer =
|
||||
metrics::start_timer(&metrics::AGGREGATED_ATTESTATION_GOSSIP_VERIFICATION_TIMES);
|
||||
|
||||
VerifiedAggregatedAttestation::verify(signed_aggregate, self).map(|v| {
|
||||
VerifiedAggregatedAttestation::verify(signed_aggregate, self).inspect(|v| {
|
||||
// This method is called for API and gossip attestations, so this covers all aggregated attestation events
|
||||
if let Some(event_handler) = self.event_handler.as_ref() {
|
||||
if event_handler.has_attestation_subscribers() {
|
||||
@@ -2084,7 +2083,6 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
|
||||
}
|
||||
}
|
||||
metrics::inc_counter(&metrics::AGGREGATED_ATTESTATION_PROCESSING_SUCCESSES);
|
||||
v
|
||||
})
|
||||
}
|
||||
|
||||
@@ -2098,9 +2096,8 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
|
||||
metrics::inc_counter(&metrics::SYNC_MESSAGE_PROCESSING_REQUESTS);
|
||||
let _timer = metrics::start_timer(&metrics::SYNC_MESSAGE_GOSSIP_VERIFICATION_TIMES);
|
||||
|
||||
VerifiedSyncCommitteeMessage::verify(sync_message, subnet_id, self).map(|v| {
|
||||
VerifiedSyncCommitteeMessage::verify(sync_message, subnet_id, self).inspect(|_| {
|
||||
metrics::inc_counter(&metrics::SYNC_MESSAGE_PROCESSING_SUCCESSES);
|
||||
v
|
||||
})
|
||||
}
|
||||
|
||||
@@ -2112,7 +2109,7 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
|
||||
) -> Result<VerifiedSyncContribution<T>, SyncCommitteeError> {
|
||||
metrics::inc_counter(&metrics::SYNC_CONTRIBUTION_PROCESSING_REQUESTS);
|
||||
let _timer = metrics::start_timer(&metrics::SYNC_CONTRIBUTION_GOSSIP_VERIFICATION_TIMES);
|
||||
VerifiedSyncContribution::verify(sync_contribution, self).map(|v| {
|
||||
VerifiedSyncContribution::verify(sync_contribution, self).inspect(|v| {
|
||||
if let Some(event_handler) = self.event_handler.as_ref() {
|
||||
if event_handler.has_contribution_subscribers() {
|
||||
event_handler.register(EventKind::ContributionAndProof(Box::new(
|
||||
@@ -2121,7 +2118,6 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
|
||||
}
|
||||
}
|
||||
metrics::inc_counter(&metrics::SYNC_CONTRIBUTION_PROCESSING_SUCCESSES);
|
||||
v
|
||||
})
|
||||
}
|
||||
|
||||
@@ -2136,9 +2132,8 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
|
||||
self,
|
||||
seen_timestamp,
|
||||
)
|
||||
.map(|v| {
|
||||
.inspect(|_| {
|
||||
metrics::inc_counter(&metrics::FINALITY_UPDATE_PROCESSING_SUCCESSES);
|
||||
v
|
||||
})
|
||||
}
|
||||
|
||||
@@ -2149,9 +2144,8 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
|
||||
) -> Result<GossipVerifiedDataColumn<T>, GossipDataColumnError> {
|
||||
metrics::inc_counter(&metrics::DATA_COLUMN_SIDECAR_PROCESSING_REQUESTS);
|
||||
let _timer = metrics::start_timer(&metrics::DATA_COLUMN_SIDECAR_GOSSIP_VERIFICATION_TIMES);
|
||||
GossipVerifiedDataColumn::new(data_column_sidecar, subnet_id, self).map(|v| {
|
||||
GossipVerifiedDataColumn::new(data_column_sidecar, subnet_id, self).inspect(|_| {
|
||||
metrics::inc_counter(&metrics::DATA_COLUMN_SIDECAR_PROCESSING_SUCCESSES);
|
||||
v
|
||||
})
|
||||
}
|
||||
|
||||
@@ -2162,9 +2156,8 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
|
||||
) -> Result<GossipVerifiedBlob<T>, GossipBlobError> {
|
||||
metrics::inc_counter(&metrics::BLOBS_SIDECAR_PROCESSING_REQUESTS);
|
||||
let _timer = metrics::start_timer(&metrics::BLOBS_SIDECAR_GOSSIP_VERIFICATION_TIMES);
|
||||
GossipVerifiedBlob::new(blob_sidecar, subnet_id, self).map(|v| {
|
||||
GossipVerifiedBlob::new(blob_sidecar, subnet_id, self).inspect(|_| {
|
||||
metrics::inc_counter(&metrics::BLOBS_SIDECAR_PROCESSING_SUCCESSES);
|
||||
v
|
||||
})
|
||||
}
|
||||
|
||||
@@ -2179,9 +2172,8 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
|
||||
self,
|
||||
seen_timestamp,
|
||||
)
|
||||
.map(|v| {
|
||||
.inspect(|_| {
|
||||
metrics::inc_counter(&metrics::OPTIMISTIC_UPDATE_PROCESSING_SUCCESSES);
|
||||
v
|
||||
})
|
||||
}
|
||||
|
||||
@@ -2485,7 +2477,7 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
|
||||
.observed_voluntary_exits
|
||||
.lock()
|
||||
.verify_and_observe_at(exit, wall_clock_epoch, head_state, &self.spec)
|
||||
.map(|exit| {
|
||||
.inspect(|exit| {
|
||||
// this method is called for both API and gossip exits, so this covers all exit events
|
||||
if let Some(event_handler) = self.event_handler.as_ref() {
|
||||
if event_handler.has_exit_subscribers() {
|
||||
@@ -2494,7 +2486,6 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
|
||||
}
|
||||
}
|
||||
}
|
||||
exit
|
||||
})?)
|
||||
}
|
||||
|
||||
|
||||
@@ -834,12 +834,11 @@ pub trait IntoExecutionPendingBlock<T: BeaconChainTypes>: Sized {
|
||||
notify_execution_layer: NotifyExecutionLayer,
|
||||
) -> Result<ExecutionPendingBlock<T>, BlockError> {
|
||||
self.into_execution_pending_block_slashable(block_root, chain, notify_execution_layer)
|
||||
.map(|execution_pending| {
|
||||
.inspect(|execution_pending| {
|
||||
// Supply valid block to slasher.
|
||||
if let Some(slasher) = chain.slasher.as_ref() {
|
||||
slasher.accept_block_header(execution_pending.block.signed_block_header());
|
||||
}
|
||||
execution_pending
|
||||
})
|
||||
.map_err(|slash_info| process_block_slash_info::<_, BlockError>(chain, slash_info))
|
||||
}
|
||||
|
||||
@@ -75,10 +75,7 @@ impl Inner {
|
||||
SszEth1Cache::from_ssz_bytes(bytes)
|
||||
.map_err(|e| format!("Ssz decoding error: {:?}", e))?
|
||||
.to_inner(config, spec)
|
||||
.map(|inner| {
|
||||
inner.block_cache.write().rebuild_by_hash_map();
|
||||
inner
|
||||
})
|
||||
.inspect(|inner| inner.block_cache.write().rebuild_by_hash_map())
|
||||
}
|
||||
|
||||
/// Returns a reference to the specification.
|
||||
|
||||
@@ -98,14 +98,13 @@ impl<E: EthSpec> KeyValueStore<E> for LevelDB<E> {
|
||||
.get(self.read_options(), BytesKey::from_vec(column_key))
|
||||
.map_err(Into::into)
|
||||
.map(|opt| {
|
||||
opt.map(|bytes| {
|
||||
opt.inspect(|bytes| {
|
||||
metrics::inc_counter_vec_by(
|
||||
&metrics::DISK_DB_READ_BYTES,
|
||||
&[col],
|
||||
bytes.len() as u64,
|
||||
);
|
||||
metrics::stop_timer(timer);
|
||||
bytes
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user