mirror of
https://github.com/sigp/lighthouse.git
synced 2026-05-30 12:47:05 +00:00
Implement gloas proposer preference vc duty (#9208)
Allow for the vc to submit its proposer preferences to the network Co-Authored-By: Eitan Seri-Levi <eserilev@ucsc.edu> Co-Authored-By: Jimmy Chen <jchen.tc@gmail.com>
This commit is contained in:
@@ -22,11 +22,12 @@ use types::{
|
||||
AbstractExecPayload, Address, AggregateAndProof, Attestation, BeaconBlock, BlindedPayload,
|
||||
ChainSpec, ContributionAndProof, Domain, Epoch, EthSpec, ExecutionPayloadEnvelope, Fork,
|
||||
FullPayload, Graffiti, Hash256, PayloadAttestationData, PayloadAttestationMessage,
|
||||
SelectionProof, SignedAggregateAndProof, SignedBeaconBlock, SignedContributionAndProof,
|
||||
SignedExecutionPayloadEnvelope, SignedRoot, SignedValidatorRegistrationData,
|
||||
SignedVoluntaryExit, Slot, SyncAggregatorSelectionData, SyncCommitteeContribution,
|
||||
SyncCommitteeMessage, SyncSelectionProof, SyncSubnetId, ValidatorRegistrationData,
|
||||
VoluntaryExit, graffiti::GraffitiString,
|
||||
ProposerPreferences, SelectionProof, SignedAggregateAndProof, SignedBeaconBlock,
|
||||
SignedContributionAndProof, SignedExecutionPayloadEnvelope, SignedProposerPreferences,
|
||||
SignedRoot, SignedValidatorRegistrationData, SignedVoluntaryExit, Slot,
|
||||
SyncAggregatorSelectionData, SyncCommitteeContribution, SyncCommitteeMessage,
|
||||
SyncSelectionProof, SyncSubnetId, ValidatorRegistrationData, VoluntaryExit,
|
||||
graffiti::GraffitiString,
|
||||
};
|
||||
use validator_store::{
|
||||
AggregateToSign, AttestationToSign, ContributionToSign, DoppelgangerStatus,
|
||||
@@ -1485,4 +1486,32 @@ impl<T: SlotClock + 'static, E: EthSpec> ValidatorStore for LighthouseValidatorS
|
||||
signature,
|
||||
})
|
||||
}
|
||||
|
||||
async fn sign_proposer_preferences(
|
||||
&self,
|
||||
validator_pubkey: PublicKeyBytes,
|
||||
preferences: ProposerPreferences,
|
||||
) -> Result<SignedProposerPreferences, Error> {
|
||||
let signing_context = self.signing_context(
|
||||
Domain::ProposerPreferences,
|
||||
preferences.proposal_slot.epoch(E::slots_per_epoch()),
|
||||
);
|
||||
|
||||
let signing_method = self.doppelganger_bypassed_signing_method(validator_pubkey)?;
|
||||
|
||||
let signature = signing_method
|
||||
.get_signature::<E, FullPayload<E>>(
|
||||
SignableMessage::ProposerPreferences(&preferences),
|
||||
signing_context,
|
||||
&self.spec,
|
||||
&self.task_executor,
|
||||
)
|
||||
.await
|
||||
.map_err(Error::SpecificError)?;
|
||||
|
||||
Ok(SignedProposerPreferences {
|
||||
message: preferences,
|
||||
signature,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user