From dcc523c443d5fe24382005979f08558e8ac908c3 Mon Sep 17 00:00:00 2001 From: Herr Seppia Date: Fri, 1 Dec 2023 21:00:37 +0100 Subject: [PATCH] node: remove `public_key` from `acceptor::verify_block_cert` --- node/benches/accept.rs | 2 -- node/src/chain/acceptor.rs | 12 ++---------- node/src/chain/fallback.rs | 1 - 3 files changed, 2 insertions(+), 13 deletions(-) diff --git a/node/benches/accept.rs b/node/benches/accept.rs index 47c4f52656..f245bf59b6 100644 --- a/node/benches/accept.rs +++ b/node/benches/accept.rs @@ -96,7 +96,6 @@ pub fn verify_block_cert(c: &mut Criterion) { let height = 1; let seed = Signature([5; 48]); let block_hash = [1; 32]; - let curr_public_key = keys.first().unwrap().0.clone(); let iteration = 0; let mut cert = Certificate::default(); @@ -128,7 +127,6 @@ pub fn verify_block_cert(c: &mut Criterion) { chain::verify_block_cert( seed, &provisioners, - &curr_public_key, block_hash, height, &cert, diff --git a/node/src/chain/acceptor.rs b/node/src/chain/acceptor.rs index 9c4267678e..a5b24dcce2 100644 --- a/node/src/chain/acceptor.rs +++ b/node/src/chain/acceptor.rs @@ -228,7 +228,6 @@ impl Acceptor { enable_consensus: bool, ) -> anyhow::Result<()> { let mut task = self.task.write().await; - let (_, public_key) = task.keys.clone(); let mut mrb = self.mrb.write().await; let mut provisioners_list = self.provisioners_list.write().await; @@ -239,7 +238,6 @@ impl Acceptor { self.db.clone(), &mrb.header().clone(), &provisioners_list, - &public_key, blk.header(), ) .await?; @@ -451,7 +449,6 @@ pub(crate) async fn verify_block_header( db: Arc>, mrb: &ledger::Header, mrb_eligible_provisioners: &Provisioners, - public_key: &node_data::bls::PublicKey, new_blk: &ledger::Header, ) -> anyhow::Result<()> { if new_blk.version > 0 { @@ -505,7 +502,6 @@ pub(crate) async fn verify_block_header( verify_block_cert( prev_block_seed, prev_eligible_provisioners, - public_key, mrb.hash, mrb.height, &new_blk.prev_block_cert, @@ -527,7 +523,6 @@ pub(crate) async fn verify_block_header( verify_block_cert( mrb.seed, mrb_eligible_provisioners, - public_key, [0u8; 32], new_blk.height, cert, @@ -542,7 +537,6 @@ pub(crate) async fn verify_block_header( verify_block_cert( mrb.seed, mrb_eligible_provisioners, - public_key, new_blk.hash, new_blk.height, &new_blk.cert, @@ -552,11 +546,9 @@ pub(crate) async fn verify_block_header( .await } -#[allow(clippy::too_many_arguments)] pub async fn verify_block_cert( curr_seed: Signature, curr_eligible_provisioners: &Provisioners, - curr_public_key: &node_data::bls::PublicKey, block_hash: [u8; 32], height: u64, cert: &ledger::Certificate, @@ -564,13 +556,13 @@ pub async fn verify_block_cert( enable_quorum_check: bool, ) -> anyhow::Result<()> { let committee = Arc::new(Mutex::new(CommitteeSet::new( - curr_public_key.clone(), + node_data::bls::PublicKey::default(), curr_eligible_provisioners.clone(), ))); let hdr = node_data::message::Header { topic: 0, - pubkey_bls: curr_public_key.clone(), + pubkey_bls: node_data::bls::PublicKey::default(), round: height, step: iteration.step_from_name(StepName::SecondRed), block_hash, diff --git a/node/src/chain/fallback.rs b/node/src/chain/fallback.rs index e7a2b5e6c8..77823edcaa 100644 --- a/node/src/chain/fallback.rs +++ b/node/src/chain/fallback.rs @@ -99,7 +99,6 @@ impl<'a, N: Network, DB: database::DB, VM: vm::VMExecution> self.acc.db.clone(), prev_block.header(), &provisioners_list, - &PublicKey::default(), blk.header(), ) .await