hold for now

This commit is contained in:
Mark Mackey
2025-10-15 10:15:44 -05:00
parent acac0503ed
commit 29e5a1f599
7 changed files with 712 additions and 1 deletions

View File

@@ -74,6 +74,36 @@ impl<E: EthSpec> SignedExecutionPayloadEnvelope<E> {
Self::NextFork(signed) => ExecutionPayloadEnvelopeRef::NextFork(&signed.message),
}
}
/// Verify `self.signature`.
///
/// The `parent_state` is the post-state of the beacon block with
/// block_root = self.message.beacon_block_root
pub fn verify_signature(
&self,
parent_state: &BeaconState<E>,
spec: &ChainSpec,
) -> Result<bool, BeaconStateError> {
let domain = spec.get_domain(
parent_state.current_epoch(),
Domain::BeaconBuilder,
&parent_state.fork(),
parent_state.genesis_validators_root(),
);
let pubkey = parent_state
.validators()
.get(self.message().builder_index() as usize)
.and_then(|v| {
let pk: Option<PublicKey> = v.pubkey.decompress().ok();
pk
})
.ok_or_else(|| {
BeaconStateError::UnknownValidator(self.message().builder_index() as usize)
})?;
let message = self.message().signing_root(domain);
Ok(self.signature().verify(&pubkey, message))
}
}
impl<'de, E: EthSpec> ContextDeserialize<'de, ForkName> for SignedExecutionPayloadEnvelope<E> {