mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-16 03:12:41 +00:00
Sidecar inclusion proof (#4900)
* Refactor BlobSidecar to new type * Fix some compile errors * Gossip verification compiles * Fix http api types take 1 * Fix another round of compile errors * Beacon node crate compiles * EF tests compile * Remove all blob signing from VC * fmt * Tests compile * Fix some tests * Fix more http tests * get compiling * Fix gossip conditions and tests * Add basic proof generation and verification * remove unnecessary ssz decode * add back build_sidecar * remove default at fork for blobs * fix beacon chain tests * get relase tests compiling * fix lints * fix existing spec tests * add new ef tests * fix gossip duplicate rule * lints * add back sidecar signature check in gossip * add finalized descendant check to blob sidecar gossip * fix error conversion * fix release tests * sidecar inclusion self review cleanup * Add proof verification and computation metrics * Remove accidentally committed file * Unify some block and blob errors; add slashing conditions for sidecars * Address review comment * Clean up re-org tests (#4957) * Address more review comments * Add Comments & Eliminate Unnecessary Clones * update names * Update beacon_node/beacon_chain/src/metrics.rs Co-authored-by: Jimmy Chen <jchen.tc@gmail.com> * Update beacon_node/network/src/network_beacon_processor/tests.rs Co-authored-by: Jimmy Chen <jchen.tc@gmail.com> * pr feedback * fix test compile * Sidecar Inclusion proof small refactor and updates (#4967) * Update some comments, variables and small cosmetic fixes. * Couple blobs and proofs into a tuple in `PayloadAndBlobs` for simplicity and safety. * Update function comment. * Update testing/ef_tests/src/cases/merkle_proof_validity.rs Co-authored-by: Jimmy Chen <jchen.tc@gmail.com> * Rename the block and blob wrapper types used in the beacon API interfaces. * make sure gossip invalid blobs are passed to the slasher (#4970) * Add blob headers to slasher before adding to DA checker * Replace Vec with HashSet in BlockQueue * fmt * Rename gindex -> index * Simplify gossip condition --------- Co-authored-by: realbigsean <seananderson33@gmail.com> Co-authored-by: realbigsean <sean@sigmaprime.io> Co-authored-by: Michael Sproul <michael@sigmaprime.io> Co-authored-by: Mark Mackey <mark@sigmaprime.io> Co-authored-by: Jimmy Chen <jchen.tc@gmail.com>
This commit is contained in:
@@ -428,7 +428,7 @@ impl<L: Lookup, T: BeaconChainTypes> RequestState<L, T> for BlobRequestState<L,
|
||||
verified_response
|
||||
.into_iter()
|
||||
.filter_map(|blob| blob.as_ref())
|
||||
.map(|blob| blob.block_parent_root)
|
||||
.map(|blob| blob.block_parent_root())
|
||||
.next()
|
||||
}
|
||||
|
||||
|
||||
@@ -213,10 +213,8 @@ impl TestRig {
|
||||
) -> (SignedBeaconBlock<E>, Vec<BlobSidecar<E>>) {
|
||||
let (mut block, mut blobs) = self.rand_block_and_blobs(fork_name, num_blobs);
|
||||
*block.message_mut().parent_root_mut() = parent_root;
|
||||
let block_root = block.canonical_root();
|
||||
blobs.iter_mut().for_each(|blob| {
|
||||
blob.block_parent_root = parent_root;
|
||||
blob.block_root = block_root;
|
||||
blob.signed_block_header = block.signed_block_header();
|
||||
});
|
||||
(block, blobs)
|
||||
}
|
||||
@@ -1293,7 +1291,7 @@ mod deneb_only {
|
||||
|
||||
let child_blob = blobs.first().cloned().unwrap();
|
||||
let parent_root = block_root;
|
||||
let child_root = child_blob.block_root;
|
||||
let child_root = child_blob.block_root();
|
||||
block_root = child_root;
|
||||
|
||||
let mut blobs = FixedBlobSidecarList::default();
|
||||
|
||||
@@ -46,7 +46,7 @@ impl<T: EthSpec> BlocksAndBlobsRequestInfo<T> {
|
||||
while {
|
||||
let pair_next_blob = blob_iter
|
||||
.peek()
|
||||
.map(|sidecar| sidecar.slot == block.slot())
|
||||
.map(|sidecar| sidecar.slot() == block.slot())
|
||||
.unwrap_or(false);
|
||||
pair_next_blob
|
||||
} {
|
||||
|
||||
@@ -637,9 +637,9 @@ impl<T: BeaconChainTypes> SyncManager<T> {
|
||||
);
|
||||
}
|
||||
SyncMessage::UnknownParentBlob(peer_id, blob) => {
|
||||
let blob_slot = blob.slot;
|
||||
let block_root = blob.block_root;
|
||||
let parent_root = blob.block_parent_root;
|
||||
let blob_slot = blob.slot();
|
||||
let block_root = blob.block_root();
|
||||
let parent_root = blob.block_parent_root();
|
||||
let blob_index = blob.index;
|
||||
if blob_index >= T::EthSpec::max_blobs_per_block() as u64 {
|
||||
warn!(self.log, "Peer sent blob with invalid index"; "index" => blob_index, "peer_id" => %peer_id);
|
||||
|
||||
Reference in New Issue
Block a user