Partial processing#4
Conversation
|
I think I resolved all this stuff I was mentioning yesterday.
The reason for this being that we can now entirely circumvent any cache logic during block processing if we have an available block. Our cache will only accept blocks with type AvailabilityPendingExecutedBlock. This reduces the amount of scenarios we need to handle in the caching logic.
The reason for also having this is to keep consensus logic out of networking and also because it keeps us from having unsafe type conversions while also reducing the amount of test-refactoring we have to do. We previously had this which circumvents checks around whether a block should have blobs, making the information provided by the variant less reliable: But removing this would have been a refactoring PITA. So by splitting up the type we can do conversions to the unsafe type in tests and put off converting to the safe type later in processing. |
* introduce availability pending block * add intoavailableblock trait * small fixes * add 'gossip blob cache' and start to clean up processing and transition types * shard memory blob cache * Initial commit * Fix after rebase * Add gossip verification conditions * cache cleanup * general chaos * extended chaos * cargo fmt * more progress * more progress * tons of changes, just tryna compile * everything, everywhere, all at once * Reprocess an ExecutedBlock on unavailable blobs * Add sus gossip verification for blobs * Merge stuff * Remove reprocessing cache stuff * lint * Add a wrapper to allow construction of only valid `AvailableBlock`s * rename blob arc list to blob list * merge cleanuo * Revert "merge cleanuo" This reverts commit 5e98326. * Revert "Revert "merge cleanuo"" This reverts commit 3a40094. * fix rpc methods * move beacon block and blob to eth2/types * rename gossip blob cache to data availability checker * lots of changes * fix some compilation issues * fix compilation issues * fix compilation issues * fix compilation issues * fix compilation issues * fix compilation issues * cargo fmt * use a common data structure for block import types * fix availability check on proposal import * refactor the blob cache and split the block wrapper into two types * add type conversion for signed block and block wrapper * fix beacon chain tests and do some renaming, add some comments * Partial processing (#4) * move beacon block and blob to eth2/types * rename gossip blob cache to data availability checker * lots of changes * fix some compilation issues * fix compilation issues * fix compilation issues * fix compilation issues * fix compilation issues * fix compilation issues * cargo fmt * use a common data structure for block import types * fix availability check on proposal import * refactor the blob cache and split the block wrapper into two types * add type conversion for signed block and block wrapper * fix beacon chain tests and do some renaming, add some comments * cargo update (#6) --------- Co-authored-by: realbigsean <sean@sigmaprime.io> Co-authored-by: realbigsean <seananderson33@gmail.com>
A couple things I tried to sort out here:
The networking layer tries to match up blocks and blobs very simplistically without doing any consensus checks. The block wrapper was what was used to do this pairing previously. We now use the block wrapper throughout consensus and there's no variant in it to denote "totally unchecked block and blobs". I added this variant. It's useful in sync to delay when we have to do the block vs blob verification.
Related to this, I added a new
KzgVerifiedBlobtype which is useful to differentiate cached blobs from blobs we get during sync. I also added aIntoKzgVerifiedBlobstrait to make sure we can construct anAvailableBlockfrom either aVec<KzgVerifiedBlob>(blobs cached and previously verified) orVec<BlobSidecar>(sync or local so we can verify all blobs in the block at once).The BlockWrapper being nested inside the ExecutedBlock was causing issues with de contstructing and reconstructing the same object but altering the availability status of the BlockWrapper (the same is also true of
ExecutionPendingBlockbut I haven't touched that one.. yet). So I restructured theExecutedBlocka bit, not sure if I like it but it made some things easier. I also wanted to gain back theAvailableBlocktype safety on whatever we return from the blob cache. Hence creating theAvailableExecutedBlock. I kind of want to see if we can simplify these types still though.Random note:
The
AvailableBlockInnerdoesn’t seem to be serving a purpose anymore because all the fields ofAvailableBlockare private now. But we now haveVerifiedBlobs::Available(BlobSidecarList<T>)which maybe should have an VerifiedBlobSidecarListInner type (because enum fields are always mutable and since this has been fully verified this should not be). Not sure on this one either but just something to think about.