Skip to content

Commit c5bcb8a

Browse files
michaelsprouldanielrachi1
authored andcommitted
Delete temporary mitigation for equivocation via RPC (sigp#5037)
* Delete unnecessary RPC equivocation check
1 parent 467c78d commit c5bcb8a

File tree

1 file changed

+2
-72
lines changed

1 file changed

+2
-72
lines changed

beacon_node/network/src/network_beacon_processor/sync_methods.rs

Lines changed: 2 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,17 @@ use beacon_chain::block_verification_types::{AsBlock, RpcBlock};
99
use beacon_chain::data_availability_checker::AvailabilityCheckError;
1010
use beacon_chain::data_availability_checker::MaybeAvailableBlock;
1111
use beacon_chain::{
12-
observed_block_producers::Error as ObserveError,
13-
validator_monitor::{get_block_delay_ms, get_slot_delay_ms},
14-
AvailabilityProcessingStatus, BeaconChainError, BeaconChainTypes, BlockError,
15-
ChainSegmentResult, HistoricalBlockError, NotifyExecutionLayer,
12+
validator_monitor::get_slot_delay_ms, AvailabilityProcessingStatus, BeaconChainError,
13+
BeaconChainTypes, BlockError, ChainSegmentResult, HistoricalBlockError, NotifyExecutionLayer,
1614
};
1715
use beacon_processor::{
1816
work_reprocessing_queue::{QueuedRpcBlock, ReprocessQueueMessage},
1917
AsyncFn, BlockingFn, DuplicateCache,
2018
};
2119
use lighthouse_network::PeerAction;
2220
use slog::{debug, error, info, warn};
23-
use slot_clock::SlotClock;
2421
use std::sync::Arc;
2522
use std::time::Duration;
26-
use std::time::{SystemTime, UNIX_EPOCH};
2723
use store::KzgCommitment;
2824
use tokio::sync::mpsc;
2925
use types::beacon_block_body::format_kzg_commitments;
@@ -142,72 +138,6 @@ impl<T: BeaconChainTypes> NetworkBeaconProcessor<T> {
142138
return;
143139
};
144140

145-
// Returns `true` if the time now is after the 4s attestation deadline.
146-
let block_is_late = SystemTime::now()
147-
.duration_since(UNIX_EPOCH)
148-
// If we can't read the system time clock then indicate that the
149-
// block is late (and therefore should *not* be requeued). This
150-
// avoids infinite loops.
151-
.map_or(true, |now| {
152-
get_block_delay_ms(now, block.message(), &self.chain.slot_clock)
153-
> self.chain.slot_clock.unagg_attestation_production_delay()
154-
});
155-
156-
// Checks if a block from this proposer is already known.
157-
let block_equivocates = || {
158-
match self.chain.observed_slashable.read().is_slashable(
159-
block.slot(),
160-
block.message().proposer_index(),
161-
block.canonical_root(),
162-
) {
163-
Ok(is_slashable) => is_slashable,
164-
//Both of these blocks will be rejected, so reject them now rather
165-
// than re-queuing them.
166-
Err(ObserveError::FinalizedBlock { .. })
167-
| Err(ObserveError::ValidatorIndexTooHigh { .. }) => false,
168-
}
169-
};
170-
171-
// If we've already seen a block from this proposer *and* the block
172-
// arrived before the attestation deadline, requeue it to ensure it is
173-
// imported late enough that it won't receive a proposer boost.
174-
//
175-
// Don't requeue blocks if they're already known to fork choice, just
176-
// push them through to block processing so they can be handled through
177-
// the normal channels.
178-
if !block_is_late && block_equivocates() {
179-
debug!(
180-
self.log,
181-
"Delaying processing of duplicate RPC block";
182-
"block_root" => ?block_root,
183-
"proposer" => block.message().proposer_index(),
184-
"slot" => block.slot()
185-
);
186-
187-
// Send message to work reprocess queue to retry the block
188-
let (process_fn, ignore_fn) = self.clone().generate_rpc_beacon_block_fns(
189-
block_root,
190-
block,
191-
seen_timestamp,
192-
process_type,
193-
);
194-
let reprocess_msg = ReprocessQueueMessage::RpcBlock(QueuedRpcBlock {
195-
beacon_block_root: block_root,
196-
process_fn,
197-
ignore_fn,
198-
});
199-
200-
if reprocess_tx.try_send(reprocess_msg).is_err() {
201-
error!(
202-
self.log,
203-
"Failed to inform block import";
204-
"source" => "rpc",
205-
"block_root" => %block_root
206-
);
207-
}
208-
return;
209-
}
210-
211141
let slot = block.slot();
212142
let parent_root = block.message().parent_root();
213143
let commitments_formatted = block.as_block().commitments_formatted();

0 commit comments

Comments
 (0)