mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-11 18:04:18 +00:00
Lenient duplicate checks on HTTP API for block publication (#5574)
* start splitting gossip verification * WIP * Gossip verify separate (#7) * save * save * make ProvenancedBlock concrete * delete into gossip verified block contents * get rid of IntoBlobSidecar trait * remove IntoGossipVerified trait * get tests compiling * don't check sidecar slashability in publish * remove second publish closure * drop blob bool. also prefer using message index over index of position in list * Merge remote-tracking branch 'origin/unstable' into gossip-verify-separate * Fix low-hanging tests * Fix tests and clean up * Clean up imports * more cleanup * Merge remote-tracking branch 'origin/unstable' into gossip-verify-separate * Further refine behaviour and add tests * Merge remote-tracking branch 'origin/unstable' into gossip-verify-separate * Merge remote-tracking branch 'origin/unstable' into gossip-verify-separate * Remove empty line * Fix test (block is not fully imported just gossip verified) * Merge remote-tracking branch 'origin/unstable' into gossip-verify-separate * Update for unstable & use empty blob list * Update comment * Add test for duplicate block case * Merge remote-tracking branch 'origin/unstable' into gossip-verify-separate * Clarify unreachable case * Fix another publish_block case * Remove unreachable case in filter chain segment * Revert unrelated blob optimisation * Merge remote-tracking branch 'origin/unstable' into gossip-verify-separate * Merge remote-tracking branch 'origin/unstable' into gossip-verify-separate * Fix merge conflicts * Merge remote-tracking branch 'origin/unstable' into gossip-verify-separate * Fix some compilation issues. Impl is fucked though * Support peerDAS * Fix tests * Merge remote-tracking branch 'origin/unstable' into gossip-verify-separate * Fix conflict * Merge remote-tracking branch 'origin/unstable' into gossip-verify-separate * Address review comments * Merge remote-tracking branch 'origin/unstable' into gossip-verify-separate
This commit is contained in:
@@ -517,7 +517,7 @@ impl<T: BeaconChainTypes> BlockLookups<T> {
|
||||
|
||||
let action = match result {
|
||||
BlockProcessingResult::Ok(AvailabilityProcessingStatus::Imported(_))
|
||||
| BlockProcessingResult::Err(BlockError::BlockIsAlreadyKnown(_)) => {
|
||||
| BlockProcessingResult::Err(BlockError::DuplicateFullyImported(..)) => {
|
||||
// Successfully imported
|
||||
request_state.on_processing_success()?;
|
||||
Action::Continue
|
||||
@@ -541,6 +541,16 @@ impl<T: BeaconChainTypes> BlockLookups<T> {
|
||||
Action::Retry
|
||||
}
|
||||
}
|
||||
BlockProcessingResult::Err(BlockError::DuplicateImportStatusUnknown(..)) => {
|
||||
// This is unreachable because RPC blocks do not undergo gossip verification, and
|
||||
// this error can *only* come from gossip verification.
|
||||
error!(
|
||||
self.log,
|
||||
"Single block lookup hit unreachable condition";
|
||||
"block_root" => ?block_root
|
||||
);
|
||||
Action::Drop
|
||||
}
|
||||
BlockProcessingResult::Ignored => {
|
||||
// Beacon processor signalled to ignore the block processing result.
|
||||
// This implies that the cpu is overloaded. Drop the request.
|
||||
|
||||
@@ -1471,7 +1471,7 @@ fn test_parent_lookup_happy_path() {
|
||||
// Processing succeeds, now the rest of the chain should be sent for processing.
|
||||
rig.parent_block_processed(
|
||||
block_root,
|
||||
BlockError::BlockIsAlreadyKnown(block_root).into(),
|
||||
BlockError::DuplicateFullyImported(block_root).into(),
|
||||
);
|
||||
rig.expect_parent_chain_process();
|
||||
rig.parent_chain_processed_success(block_root, &[]);
|
||||
@@ -1839,7 +1839,7 @@ fn test_same_chain_race_condition() {
|
||||
rig.log(&format!("Block {i} was removed and is already known"));
|
||||
rig.parent_block_processed(
|
||||
chain_hash,
|
||||
BlockError::BlockIsAlreadyKnown(block.canonical_root()).into(),
|
||||
BlockError::DuplicateFullyImported(block.canonical_root()).into(),
|
||||
)
|
||||
} else {
|
||||
rig.log(&format!("Block {i} ParentUnknown"));
|
||||
|
||||
@@ -629,8 +629,8 @@ impl<T: BeaconChainTypes> SyncNetworkContext<T> {
|
||||
// cache nor in the request state of this lookup. Therefore, the block must either: (1) not
|
||||
// be downloaded yet or (2) the block is already imported into the fork-choice.
|
||||
// In case (1) the lookup must either successfully download the block or get dropped.
|
||||
// In case (2) the block will be downloaded, processed, reach `BlockIsAlreadyKnown` and
|
||||
// get dropped as completed.
|
||||
// In case (2) the block will be downloaded, processed, reach `DuplicateFullyImported`
|
||||
// and get dropped as completed.
|
||||
return Ok(LookupRequestResult::Pending("waiting for block download"));
|
||||
};
|
||||
let expected_blobs = block.num_expected_blobs();
|
||||
|
||||
Reference in New Issue
Block a user