From cd45fcb2aa0cabe66de8c6ea5a4dbd41965e56be Mon Sep 17 00:00:00 2001 From: Jacinta Ferrant Date: Mon, 23 Dec 2024 14:06:06 -0500 Subject: [PATCH 1/3] Do not process block validation responses for the wrong reward cycle Signed-off-by: Jacinta Ferrant --- stacks-signer/src/v0/signer.rs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/stacks-signer/src/v0/signer.rs b/stacks-signer/src/v0/signer.rs index 22a02bc107..5bf8976784 100644 --- a/stacks-signer/src/v0/signer.rs +++ b/stacks-signer/src/v0/signer.rs @@ -564,6 +564,14 @@ impl Signer { // For mutability reasons, we need to take the block_info out of the map and add it back after processing let mut block_info = match self.signer_db.block_lookup(&signer_signature_hash) { Ok(Some(block_info)) => { + if block_info.reward_cycle != self.reward_cycle { + // We are not signing for this reward cycle. Ignore the block. + debug!( + "{self}: Received a block validation response for a different reward cycle. Ignore it."; + "requested_reward_cycle" => block_info.reward_cycle, + ); + return None; + } if block_info.is_locally_finalized() { debug!("{self}: Received block validation for a block that is already marked as {}. Ignoring...", block_info.state); return None; @@ -635,6 +643,14 @@ impl Signer { } let mut block_info = match self.signer_db.block_lookup(&signer_signature_hash) { Ok(Some(block_info)) => { + if block_info.reward_cycle != self.reward_cycle { + // We are not signing for this reward cycle. Ignore the block. + debug!( + "{self}: Received a block validation response for a different reward cycle. Ignore it."; + "requested_reward_cycle" => block_info.reward_cycle, + ); + return None; + } if block_info.is_locally_finalized() { debug!("{self}: Received block validation for a block that is already marked as {}. Ignoring...", block_info.state); return None; From ed4f50b13ecbeb6284450e3a1a9b0e9853d81fe8 Mon Sep 17 00:00:00 2001 From: Jacinta Ferrant Date: Mon, 23 Dec 2024 14:32:14 -0500 Subject: [PATCH 2/3] Add changelog Signed-off-by: Jacinta Ferrant --- stacks-signer/CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/stacks-signer/CHANGELOG.md b/stacks-signer/CHANGELOG.md index fd38fe9775..df4fa218bf 100644 --- a/stacks-signer/CHANGELOG.md +++ b/stacks-signer/CHANGELOG.md @@ -8,6 +8,7 @@ and this project adheres to the versioning scheme outlined in the [README.md](RE ## [Unreleased] ## Added +- Prevent old reward cycle signers from processing block validation response messages that do not apply to blocks from their cycle. ## Changed From 1cdabb307889a24d8723b90b962216ac2d204b17 Mon Sep 17 00:00:00 2001 From: Jacinta Ferrant Date: Mon, 23 Dec 2024 14:34:24 -0500 Subject: [PATCH 3/3] FIx changelog Signed-off-by: Jacinta Ferrant --- stacks-signer/CHANGELOG.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/stacks-signer/CHANGELOG.md b/stacks-signer/CHANGELOG.md index df4fa218bf..dc5507b065 100644 --- a/stacks-signer/CHANGELOG.md +++ b/stacks-signer/CHANGELOG.md @@ -8,10 +8,17 @@ and this project adheres to the versioning scheme outlined in the [README.md](RE ## [Unreleased] ## Added -- Prevent old reward cycle signers from processing block validation response messages that do not apply to blocks from their cycle. ## Changed +# [3.1.0.0.2.1] + +## Added + +## Changed + +- Prevent old reward cycle signers from processing block validation response messages that do not apply to blocks from their cycle. + ## [3.1.0.0.2.0] ## Added