mirror of
https://gitlab.com/pulsechaincom/lighthouse-pulse.git
synced 2025-01-03 17:54:28 +00:00
fix blob validation for empty blobs when using
This commit is contained in:
parent
1dc0759f57
commit
adf5f462d5
@ -42,6 +42,7 @@ pub enum Error {
|
|||||||
// Boxed to avoid an infinite-size recursion issue.
|
// Boxed to avoid an infinite-size recursion issue.
|
||||||
BeaconChain(Box<BeaconChainError>),
|
BeaconChain(Box<BeaconChainError>),
|
||||||
MissingBeaconState(Hash256),
|
MissingBeaconState(Hash256),
|
||||||
|
MissingBlobs,
|
||||||
FailedToTransitionState(StateAdvanceError),
|
FailedToTransitionState(StateAdvanceError),
|
||||||
CannotAttestToFutureState {
|
CannotAttestToFutureState {
|
||||||
state_slot: Slot,
|
state_slot: Slot,
|
||||||
|
@ -2935,7 +2935,7 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
|
|||||||
// If the write fails, revert fork choice to the version from disk, else we can
|
// If the write fails, revert fork choice to the version from disk, else we can
|
||||||
// end up with blocks in fork choice that are missing from disk.
|
// end up with blocks in fork choice that are missing from disk.
|
||||||
// See https://github.com/sigp/lighthouse/issues/2028
|
// See https://github.com/sigp/lighthouse/issues/2028
|
||||||
let (signed_block, blobs) = signed_block.deconstruct();
|
let (signed_block, blobs) = signed_block.deconstruct(Some(block_root));
|
||||||
let block = signed_block.message();
|
let block = signed_block.message();
|
||||||
let mut ops: Vec<_> = confirmed_state_roots
|
let mut ops: Vec<_> = confirmed_state_roots
|
||||||
.into_iter()
|
.into_iter()
|
||||||
|
@ -69,7 +69,7 @@ impl<E: EthSpec> EarlyAttesterCache<E> {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
let (block, blobs) = block.deconstruct();
|
let (block, blobs) = block.deconstruct(Some(beacon_block_root));
|
||||||
let item = CacheItem {
|
let item = CacheItem {
|
||||||
epoch,
|
epoch,
|
||||||
committee_lengths,
|
committee_lengths,
|
||||||
@ -77,7 +77,7 @@ impl<E: EthSpec> EarlyAttesterCache<E> {
|
|||||||
source,
|
source,
|
||||||
target,
|
target,
|
||||||
block,
|
block,
|
||||||
blobs: blobs?,
|
blobs: blobs.map_err(|_|Error::MissingBlobs)?,
|
||||||
proto_block,
|
proto_block,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -93,11 +93,14 @@ impl<T: EthSpec> BlockWrapper<T> {
|
|||||||
self.block().parent_root()
|
self.block().parent_root()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn deconstruct(self) -> (Arc<SignedBeaconBlock<T>>, Result<Option<Arc<BlobsSidecar<T>>>, BlobReconstructionError>) {
|
pub fn deconstruct(self, block_root: Option<Hash256>) -> (Arc<SignedBeaconBlock<T>>, Result<Option<Arc<BlobsSidecar<T>>>, BlobReconstructionError>) {
|
||||||
match self {
|
match self {
|
||||||
BlockWrapper::Block(block) => (block, block
|
BlockWrapper::Block(block) => {
|
||||||
.reconstruct_empty_blobs(block_root)
|
let blobs = block
|
||||||
.map(|blob_opt| blob_opt.map(Arc::new))),
|
.reconstruct_empty_blobs(block_root)
|
||||||
|
.map(|blob_opt| blob_opt.map(Arc::new));
|
||||||
|
(block,blobs)
|
||||||
|
} ,
|
||||||
BlockWrapper::BlockAndBlob(block_sidecar_pair) => {
|
BlockWrapper::BlockAndBlob(block_sidecar_pair) => {
|
||||||
let SignedBeaconBlockAndBlobsSidecar {
|
let SignedBeaconBlockAndBlobsSidecar {
|
||||||
beacon_block,
|
beacon_block,
|
||||||
|
Loading…
Reference in New Issue
Block a user