mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-09 19:51:47 +00:00
Fetch and sign payload envelope
This commit is contained in:
@@ -20,12 +20,12 @@ use task_executor::TaskExecutor;
|
||||
use tracing::{error, info, instrument, warn};
|
||||
use types::{
|
||||
AbstractExecPayload, Address, AggregateAndProof, Attestation, BeaconBlock, BlindedPayload,
|
||||
ChainSpec, ContributionAndProof, Domain, Epoch, EthSpec, Fork, Graffiti, Hash256,
|
||||
SelectionProof, SignedAggregateAndProof, SignedBeaconBlock, SignedContributionAndProof,
|
||||
SignedRoot, SignedValidatorRegistrationData, SignedVoluntaryExit, Slot,
|
||||
SyncAggregatorSelectionData, SyncCommitteeContribution, SyncCommitteeMessage,
|
||||
SyncSelectionProof, SyncSubnetId, ValidatorRegistrationData, VoluntaryExit,
|
||||
graffiti::GraffitiString,
|
||||
ChainSpec, ContributionAndProof, Domain, Epoch, EthSpec, ExecutionPayloadEnvelope, Fork,
|
||||
FullPayload, Graffiti, Hash256, SelectionProof, SignedAggregateAndProof, SignedBeaconBlock,
|
||||
SignedContributionAndProof, SignedExecutionPayloadEnvelope, SignedRoot,
|
||||
SignedValidatorRegistrationData, SignedVoluntaryExit, Slot, SyncAggregatorSelectionData,
|
||||
SyncCommitteeContribution, SyncCommitteeMessage, SyncSelectionProof, SyncSubnetId,
|
||||
ValidatorRegistrationData, VoluntaryExit, graffiti::GraffitiString,
|
||||
};
|
||||
use validator_store::{
|
||||
DoppelgangerStatus, Error as ValidatorStoreError, ProposalData, SignedBlock, UnsignedBlock,
|
||||
@@ -1242,4 +1242,33 @@ impl<T: SlotClock + 'static, E: EthSpec> ValidatorStore for LighthouseValidatorS
|
||||
.get_builder_proposals_defaulting(validator.get_builder_proposals()),
|
||||
})
|
||||
}
|
||||
|
||||
/// Sign an `ExecutionPayloadEnvelope` for Gloas (local building).
|
||||
/// The proposer acts as the builder and signs with the BeaconBuilder domain.
|
||||
async fn sign_execution_payload_envelope(
|
||||
&self,
|
||||
validator_pubkey: PublicKeyBytes,
|
||||
envelope: ExecutionPayloadEnvelope<E>,
|
||||
) -> Result<SignedExecutionPayloadEnvelope<E>, Error> {
|
||||
let domain_hash = self.spec.get_builder_domain();
|
||||
let signing_root = envelope.signing_root(domain_hash);
|
||||
|
||||
// Execution payload envelope signing is not slashable, bypass doppelganger protection.
|
||||
let signing_method = self.doppelganger_bypassed_signing_method(validator_pubkey)?;
|
||||
|
||||
let signature = signing_method
|
||||
.get_signature_from_root::<E, FullPayload<E>>(
|
||||
SignableMessage::ExecutionPayloadEnvelope(&envelope),
|
||||
signing_root,
|
||||
&self.task_executor,
|
||||
None,
|
||||
)
|
||||
.await
|
||||
.map_err(Error::SpecificError)?;
|
||||
|
||||
Ok(SignedExecutionPayloadEnvelope {
|
||||
message: envelope,
|
||||
signature,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user