Skip to content

Commit

Permalink
node: remove public_key from acceptor::verify_block_cert
Browse files Browse the repository at this point in the history
  • Loading branch information
herr-seppia committed Dec 2, 2023
1 parent 2684742 commit dcc523c
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 13 deletions.
2 changes: 0 additions & 2 deletions node/benches/accept.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down Expand Up @@ -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,
Expand Down
12 changes: 2 additions & 10 deletions node/src/chain/acceptor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,6 @@ impl<DB: database::DB, VM: vm::VMExecution, N: Network> Acceptor<N, DB, VM> {
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;
Expand All @@ -239,7 +238,6 @@ impl<DB: database::DB, VM: vm::VMExecution, N: Network> Acceptor<N, DB, VM> {
self.db.clone(),
&mrb.header().clone(),
&provisioners_list,
&public_key,
blk.header(),
)
.await?;
Expand Down Expand Up @@ -451,7 +449,6 @@ pub(crate) async fn verify_block_header<DB: database::DB>(
db: Arc<RwLock<DB>>,
mrb: &ledger::Header,
mrb_eligible_provisioners: &Provisioners,
public_key: &node_data::bls::PublicKey,
new_blk: &ledger::Header,
) -> anyhow::Result<()> {
if new_blk.version > 0 {
Expand Down Expand Up @@ -505,7 +502,6 @@ pub(crate) async fn verify_block_header<DB: database::DB>(
verify_block_cert(
prev_block_seed,
prev_eligible_provisioners,
public_key,
mrb.hash,
mrb.height,
&new_blk.prev_block_cert,
Expand All @@ -527,7 +523,6 @@ pub(crate) async fn verify_block_header<DB: database::DB>(
verify_block_cert(
mrb.seed,
mrb_eligible_provisioners,
public_key,
[0u8; 32],
new_blk.height,
cert,
Expand All @@ -542,7 +537,6 @@ pub(crate) async fn verify_block_header<DB: database::DB>(
verify_block_cert(
mrb.seed,
mrb_eligible_provisioners,
public_key,
new_blk.hash,
new_blk.height,
&new_blk.cert,
Expand All @@ -552,25 +546,23 @@ pub(crate) async fn verify_block_header<DB: database::DB>(
.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,
iteration: u8,
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,
Expand Down
1 change: 0 additions & 1 deletion node/src/chain/fallback.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit dcc523c

Please sign in to comment.