From b35885a0266326199dd1dbb3c9ce772360e65ae2 Mon Sep 17 00:00:00 2001 From: Federico Franzoni <8609060+fed-franz@users.noreply.github.com> Date: Tue, 20 Aug 2024 17:40:21 +0200 Subject: [PATCH 1/2] consensus: rename Operations verify_block_header - rename `verify_block_header` to `verify_candidate_header` - remove `disable_winning_att_check` parameter --- consensus/src/operations.rs | 3 +-- consensus/src/validation/step.rs | 5 ++--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/consensus/src/operations.rs b/consensus/src/operations.rs index 3011102cfb..fd406b6935 100644 --- a/consensus/src/operations.rs +++ b/consensus/src/operations.rs @@ -82,10 +82,9 @@ impl fmt::Display for VerificationOutput { #[async_trait::async_trait] pub trait Operations: Send + Sync { - async fn verify_block_header( + async fn verify_candidate_header( &self, candidate_header: &Header, - disable_winning_att_check: bool, ) -> Result<(u8, Vec, Vec), Error>; async fn verify_faults( diff --git a/consensus/src/validation/step.rs b/consensus/src/validation/step.rs index 9484ca01b2..691f0aa558 100644 --- a/consensus/src/validation/step.rs +++ b/consensus/src/validation/step.rs @@ -79,9 +79,8 @@ impl ValidationStep { let candidate = candidate.expect("Candidate to be already checked"); let header = candidate.header(); - // Verify candidate header (all fields except the winning attestation) - // NB: Winning attestation is produced only on reaching consensus - let vote = match executor.verify_block_header(header, true).await { + // Verify candidate header + let vote = match executor.verify_candidate_header(header).await { Ok((_, voters, _)) => { // Call Verify State Transition to make sure transactions set is // valid From f84ac8513f6dbf1fd0eee0c291d9e80b75ebc0be Mon Sep 17 00:00:00 2001 From: Federico Franzoni <8609060+fed-franz@users.noreply.github.com> Date: Tue, 20 Aug 2024 17:44:16 +0200 Subject: [PATCH 2/2] node: rename Operations verify_block_header --- node/src/chain/consensus.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/node/src/chain/consensus.rs b/node/src/chain/consensus.rs index d2838cad01..4db67c4bb1 100644 --- a/node/src/chain/consensus.rs +++ b/node/src/chain/consensus.rs @@ -252,10 +252,9 @@ impl Executor { #[async_trait::async_trait] impl Operations for Executor { - async fn verify_block_header( + async fn verify_candidate_header( &self, candidate_header: &Header, - disable_winning_att_check: bool, ) -> Result<(u8, Vec, Vec), Error> { let validator = Validator::new( self.db.clone(), @@ -264,7 +263,7 @@ impl Operations for Executor { ); validator - .execute_checks(candidate_header, disable_winning_att_check) + .execute_checks(candidate_header, true) .await .map_err(operations::Error::InvalidHeader) }