Couple blocks and blobs in gossip (#3670)

* Revert "Add more gossip verification conditions"

This reverts commit 1430b561c3.

* Revert "Add todos"

This reverts commit 91efb9d4c7.

* Revert "Reprocess blob sidecar messages"

This reverts commit 21bf3d37cd.

* Add the coupled topic

* Decode SignedBeaconBlockAndBlobsSidecar correctly

* Process Block and Blobs in beacon processor

* Remove extra blob publishing logic from vc

* Remove blob signing in vc

* Ugly hack to compile
This commit is contained in:
Pawan Dhananjay
2022-11-01 19:58:21 +05:30
committed by GitHub
parent 9f155eec7a
commit 29f2ec46d3
25 changed files with 293 additions and 989 deletions

View File

@@ -22,9 +22,9 @@ use types::{
AggregateAndProof, Attestation, BeaconBlock, BlindedPayload, BlobsSidecar, ChainSpec,
ContributionAndProof, Domain, Epoch, EthSpec, ExecPayload, Fork, FullPayload, Graffiti,
Hash256, Keypair, PublicKeyBytes, SelectionProof, Signature, SignedAggregateAndProof,
SignedBeaconBlock, SignedBlobsSidecar, SignedContributionAndProof, SignedRoot,
SignedValidatorRegistrationData, Slot, SyncAggregatorSelectionData, SyncCommitteeContribution,
SyncCommitteeMessage, SyncSelectionProof, SyncSubnetId, ValidatorRegistrationData,
SignedBeaconBlock, SignedContributionAndProof, SignedRoot, SignedValidatorRegistrationData,
Slot, SyncAggregatorSelectionData, SyncCommitteeContribution, SyncCommitteeMessage,
SyncSelectionProof, SyncSubnetId, ValidatorRegistrationData,
};
use validator_dir::ValidatorDir;
@@ -532,42 +532,6 @@ impl<T: SlotClock + 'static, E: EthSpec> ValidatorStore<T, E> {
}
}
pub async fn sign_blobs(
&self,
validator_pubkey: PublicKeyBytes,
blobs_sidecar: BlobsSidecar<E>,
current_slot: Slot,
) -> Result<SignedBlobsSidecar<E>, Error> {
let slot = blobs_sidecar.beacon_block_slot;
// Make sure the blob slot is not higher than the current slot to avoid potential attacks.
if slot > current_slot {
warn!(
self.log,
"Not signing blob with slot greater than current slot";
"blob_slot" => slot.as_u64(),
"current_slot" => current_slot.as_u64()
);
return Err(Error::GreaterThanCurrentSlot { slot, current_slot });
}
let signing_epoch = slot.epoch(E::slots_per_epoch());
let signing_context = self.signing_context(Domain::BlobsSideCar, signing_epoch);
metrics::inc_counter_vec(&metrics::SIGNED_BLOBS_TOTAL, &[metrics::SUCCESS]);
let signing_method = self.doppelganger_checked_signing_method(validator_pubkey)?;
let signature = signing_method
.get_signature::<E, FullPayload<E>>(
SignableMessage::BlobsSidecar(&blobs_sidecar),
signing_context,
&self.spec,
&self.task_executor,
)
.await?;
Ok(SignedBlobsSidecar::from_blob(blobs_sidecar, signature))
}
pub async fn sign_attestation(
&self,
validator_pubkey: PublicKeyBytes,