Import BLS to execution changes before Capella (#3892)

* Import BLS to execution changes before Capella

* Test for BLS to execution change HTTP API

* Pack BLS to execution changes in LIFO order

* Remove unused var

* Clippy
This commit is contained in:
Michael Sproul
2023-01-21 10:39:59 +11:00
committed by realbigsean
parent 9f2baced0b
commit a4cfe50ade
12 changed files with 517 additions and 91 deletions

View File

@@ -28,6 +28,26 @@ pub struct BlsToExecutionChange {
impl SignedRoot for BlsToExecutionChange {}
impl BlsToExecutionChange {
pub fn sign(
self,
secret_key: &SecretKey,
genesis_validators_root: Hash256,
spec: &ChainSpec,
) -> SignedBlsToExecutionChange {
let domain = spec.compute_domain(
Domain::BlsToExecutionChange,
spec.genesis_fork_version,
genesis_validators_root,
);
let message = self.signing_root(domain);
SignedBlsToExecutionChange {
message: self,
signature: secret_key.sign(message),
}
}
}
#[cfg(test)]
mod tests {
use super::*;