Pass blobs into ValidatorStore::sign_block (#7497)

While the Lighthouse implementation of the `ValidatorStore` does not really care about blobs, Anchor needs to be able to return different blobs from `sign_blocks` than what was passed into it, in case it decides to sign another Anchor node's block. Only passing the unsigned block into `sign_block` and only returning a signed block from it (without any blobs and proofs) was an oversight in #6705.


  - Replace `validator_store::{Uns,S}ignedBlock` with `validator_store::block_service::{Uns,S}ignedBlock`, as we need all data in there.
- In `lighthouse_validator_store`, just add the received blobs back to the signed block after signing it.
This commit is contained in:
Daniel Knopik
2025-05-21 02:50:16 +02:00
committed by GitHub
parent f06d1d0346
commit 0688932de2
7 changed files with 83 additions and 128 deletions

View File

@@ -1,5 +1,6 @@
use account_utils::validator_definitions::{PasswordStorage, ValidatorDefinition};
use doppelganger_service::DoppelgangerService;
use eth2::types::PublishBlockRequest;
use initialized_validators::InitializedValidators;
use logging::crit;
use parking_lot::{Mutex, RwLock};
@@ -733,14 +734,18 @@ impl<T: SlotClock + 'static, E: EthSpec> ValidatorStore for LighthouseValidatorS
current_slot: Slot,
) -> Result<SignedBlock<E>, Error> {
match block {
UnsignedBlock::Full(block) => self
.sign_abstract_block(validator_pubkey, block, current_slot)
.await
.map(SignedBlock::Full),
UnsignedBlock::Full(block) => {
let (block, blobs) = block.deconstruct();
self.sign_abstract_block(validator_pubkey, block, current_slot)
.await
.map(|block| {
SignedBlock::Full(PublishBlockRequest::new(Arc::new(block), blobs))
})
}
UnsignedBlock::Blinded(block) => self
.sign_abstract_block(validator_pubkey, block, current_slot)
.await
.map(SignedBlock::Blinded),
.map(|block| SignedBlock::Blinded(Arc::new(block))),
}
}