Skip to content

Commit

Permalink
Merge pull request #2167 from dusk-network/2152-remove-disable_winnin…
Browse files Browse the repository at this point in the history
…g_att_check

Change `verify_block_header` to ` verify_candidate_header`
  • Loading branch information
fed-franz authored Aug 26, 2024
2 parents 7083344 + f84ac85 commit 76698f2
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 8 deletions.
3 changes: 1 addition & 2 deletions consensus/src/operations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,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<Voter>, Vec<Voter>), Error>;

async fn verify_faults(
Expand Down
5 changes: 2 additions & 3 deletions consensus/src/validation/step.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,8 @@ impl<T: Operations + 'static> ValidationStep<T> {
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
Expand Down
5 changes: 2 additions & 3 deletions node/src/chain/consensus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -252,10 +252,9 @@ impl<DB: database::DB, VM: vm::VMExecution> Executor<DB, VM> {

#[async_trait::async_trait]
impl<DB: database::DB, VM: vm::VMExecution> Operations for Executor<DB, VM> {
async fn verify_block_header(
async fn verify_candidate_header(
&self,
candidate_header: &Header,
disable_winning_att_check: bool,
) -> Result<(u8, Vec<Voter>, Vec<Voter>), Error> {
let validator = Validator::new(
self.db.clone(),
Expand All @@ -264,7 +263,7 @@ impl<DB: database::DB, VM: vm::VMExecution> Operations for Executor<DB, VM> {
);

validator
.execute_checks(candidate_header, disable_winning_att_check)
.execute_checks(candidate_header, true)
.await
.map_err(operations::Error::InvalidHeader)
}
Expand Down

0 comments on commit 76698f2

Please sign in to comment.