Skip to content

Commit

Permalink
Make formatter happy
Browse files Browse the repository at this point in the history
  • Loading branch information
abailly committed Dec 5, 2024
1 parent ca1d447 commit 89a85b6
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 8 deletions.
13 changes: 8 additions & 5 deletions ouroboros-praos/benches/benchmark.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use ouroboros::ledger::{MockLedgerState, PoolId, PoolSigma};
use ouroboros::validator::Validator;
use ouroboros_praos::consensus::BlockValidator;
use pallas_crypto::hash::Hash;
use pallas_math::math::{FixedDecimal, FixedPrecision};
use pallas_math::math::FixedDecimal;
use pallas_traverse::MultiEraHeader;

fn validate_conway_block() {
Expand Down Expand Up @@ -56,15 +56,18 @@ fn validate_conway_block() {
.expect_latest_opcert_sequence_number()
.returning(|_| None);

let block_validator = BlockValidator::new(babbage_header, &ledger_state, &epoch_nonce, &active_slots_coeff);
let block_validator = BlockValidator::new(
babbage_header,
&ledger_state,
&epoch_nonce,
&active_slots_coeff,
);
assert_eq!(block_validator.validate().is_ok(), expected);
}
}

fn benchmark_validate_conway_block(c: &mut Criterion) {
c.bench_function("validate_conway_block", |b| {
b.iter(|| validate_conway_block())
});
c.bench_function("validate_conway_block", |b| b.iter(validate_conway_block));
}

criterion_group!(benches, benchmark_validate_conway_block);
Expand Down
14 changes: 11 additions & 3 deletions ouroboros-praos/src/consensus/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,11 @@ impl<'b> BlockValidator<'b> {
})
}

fn validate_operational_certificate(&self, issuer_vkey: &[u8], pool_id: &PoolId) -> Result<(), ValidationError> {
fn validate_operational_certificate(
&self,
issuer_vkey: &[u8],
pool_id: &PoolId,
) -> Result<(), ValidationError> {
// Verify the Operational Certificate signature
let opcert_signature = Signature::try_from(
self.header
Expand Down Expand Up @@ -445,8 +449,12 @@ mod tests {
.expect_latest_opcert_sequence_number()
.returning(|_| None);

let block_validator =
BlockValidator::new(babbage_header, &ledger_state, &epoch_nonce, &active_slots_coeff);
let block_validator = BlockValidator::new(
babbage_header,
&ledger_state,
&epoch_nonce,
&active_slots_coeff,
);
assert_eq!(block_validator.validate().is_ok(), expected);
}
}
Expand Down

0 comments on commit 89a85b6

Please sign in to comment.