Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change verify_block_header to verify_candidate_header #2167

Merged
merged 2 commits into from
Aug 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions consensus/src/operations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<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
Loading