mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-10 04:01:51 +00:00
Updated for queueless withdrawals spec
This commit is contained in:
@@ -11,8 +11,8 @@ use types::{
|
||||
BeaconStateError, ChainSpec, DepositData, Domain, Epoch, EthSpec, Fork, Hash256,
|
||||
InconsistentFork, IndexedAttestation, ProposerSlashing, PublicKey, PublicKeyBytes, Signature,
|
||||
SignedAggregateAndProof, SignedBeaconBlock, SignedBeaconBlockHeader,
|
||||
SignedContributionAndProof, SignedRoot, SignedVoluntaryExit, SigningData, Slot, SyncAggregate,
|
||||
SyncAggregatorSelectionData, Unsigned,
|
||||
SignedBlsToExecutionChange, SignedContributionAndProof, SignedRoot, SignedVoluntaryExit,
|
||||
SigningData, Slot, SyncAggregate, SyncAggregatorSelectionData, Unsigned,
|
||||
};
|
||||
|
||||
pub type Result<T> = std::result::Result<T, Error>;
|
||||
@@ -156,6 +156,33 @@ where
|
||||
))
|
||||
}
|
||||
|
||||
pub fn bls_execution_change_signature_set<'a, T: EthSpec>(
|
||||
state: &'a BeaconState<T>,
|
||||
signed_address_change: &'a SignedBlsToExecutionChange,
|
||||
spec: &'a ChainSpec,
|
||||
) -> Result<SignatureSet<'a>> {
|
||||
let domain = spec.get_domain(
|
||||
state.current_epoch(),
|
||||
Domain::BlsToExecutionChange,
|
||||
&state.fork(),
|
||||
state.genesis_validators_root(),
|
||||
);
|
||||
let message = signed_address_change.message.signing_root(domain);
|
||||
let signing_key = Cow::Owned(
|
||||
signed_address_change
|
||||
.message
|
||||
.from_bls_pubkey
|
||||
.decompress()
|
||||
.map_err(|_| Error::PublicKeyDecompressionFailed)?,
|
||||
);
|
||||
|
||||
Ok(SignatureSet::single_pubkey(
|
||||
&signed_address_change.signature,
|
||||
signing_key,
|
||||
message,
|
||||
))
|
||||
}
|
||||
|
||||
/// A signature set that is valid if the block proposers randao reveal signature is correct.
|
||||
pub fn randao_signature_set<'a, T, F, Payload: AbstractExecPayload<T>>(
|
||||
state: &'a BeaconState<T>,
|
||||
|
||||
Reference in New Issue
Block a user