From 4e4325c186487c95c19f5ec12ce4d5e52d31119b Mon Sep 17 00:00:00 2001 From: Povilas Liubauskas Date: Thu, 8 Aug 2024 11:18:01 +0300 Subject: [PATCH] Use correct block epoch param used in slashing protection block proposal validations --- signer/Cargo.toml | 1 + signer/src/signer.rs | 11 +++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/signer/Cargo.toml b/signer/Cargo.toml index 11cdd93..787506b 100644 --- a/signer/Cargo.toml +++ b/signer/Cargo.toml @@ -12,6 +12,7 @@ arc-swap = { workspace = true } bls = { workspace = true } builder_api = { workspace = true } futures = { workspace = true } +helper_functions = { workspace = true } itertools = { workspace = true } log = { workspace = true } prometheus_metrics = { workspace = true } diff --git a/signer/src/signer.rs b/signer/src/signer.rs index bf51681..cd7d07e 100644 --- a/signer/src/signer.rs +++ b/signer/src/signer.rs @@ -11,6 +11,7 @@ use futures::{ stream::{FuturesUnordered, TryStreamExt as _}, try_join, TryFutureExt as _, }; +use helper_functions::misc; use itertools::{izip, Itertools as _}; use log::{info, warn}; use prometheus_metrics::Metrics; @@ -227,6 +228,7 @@ impl Snapshot { Ok(signature) } + #[allow(clippy::too_many_lines)] pub async fn sign_triples( &self, triples: impl IntoIterator> + Send, @@ -267,14 +269,19 @@ impl Snapshot { )); } SigningMessage::BeaconBlock(ref signing_block) => { + let slot = signing_block.slot(); let proposal = BlockProposal { - slot: signing_block.slot(), + slot, signing_root: Some(signing_root), }; block_messages.push((message, signing_root, public_key)); block_proposal_indices.push(index); - block_proposals.push((proposal, public_key, fork_info.fork.epoch)); + block_proposals.push(( + proposal, + public_key, + misc::compute_epoch_at_slot::

(slot), + )); } SigningMessage::AggregationSlot { .. } | SigningMessage::AggregateAndProof(_)