Reduce size of futures in HTTP API to prevent stack overflows (#5104)

* Box::pin a few big futures

* Arc the blocks early in publication

* Fix more tests
This commit is contained in:
Michael Sproul
2024-01-23 15:32:07 +11:00
committed by GitHub
parent 02d1f36090
commit a403138ed0
17 changed files with 116 additions and 123 deletions

View File

@@ -450,12 +450,13 @@ impl<T: SlotClock + 'static, E: EthSpec> BlockService<T, E> {
self.validator_store
.sign_block(*validator_pubkey, block, slot)
.await
.map(|b| SignedBlock::Full(PublishBlockRequest::new(b, maybe_blobs)))
.map(|b| SignedBlock::Full(PublishBlockRequest::new(Arc::new(b), maybe_blobs)))
}
UnsignedBlock::Blinded(block) => self
.validator_store
.sign_block(*validator_pubkey, block, slot)
.await
.map(Arc::new)
.map(SignedBlock::Blinded),
};
@@ -870,7 +871,7 @@ impl<E: EthSpec> UnsignedBlock<E> {
pub enum SignedBlock<E: EthSpec> {
Full(PublishBlockRequest<E>),
Blinded(SignedBlindedBeaconBlock<E>),
Blinded(Arc<SignedBlindedBeaconBlock<E>>),
}
impl<E: EthSpec> SignedBlock<E> {