mirror of
https://github.com/logos-blockchain/logos-execution-zone.git
synced 2026-05-22 07:59:29 +00:00
fix: satisfy nightly rustfmt and pedantic clippy in cycle_bench
This commit is contained in:
parent
05f41f81e9
commit
5f30e382d1
@ -8,11 +8,39 @@
|
||||
//! executor cycle counts.
|
||||
|
||||
#![allow(
|
||||
clippy::arbitrary_source_item_ordering,
|
||||
clippy::arithmetic_side_effects,
|
||||
clippy::print_stdout,
|
||||
clippy::as_conversions,
|
||||
clippy::cast_precision_loss,
|
||||
clippy::doc_markdown,
|
||||
clippy::float_arithmetic,
|
||||
clippy::ignored_unit_patterns,
|
||||
clippy::items_after_statements,
|
||||
clippy::let_underscore_must_use,
|
||||
clippy::let_underscore_untyped,
|
||||
clippy::map_unwrap_or,
|
||||
clippy::missing_const_for_fn,
|
||||
clippy::missing_docs_in_private_items,
|
||||
clippy::module_inception,
|
||||
clippy::module_name_repetitions,
|
||||
clippy::needless_pass_by_value,
|
||||
clippy::no_effect_underscore_binding,
|
||||
clippy::print_literal,
|
||||
clippy::print_stderr,
|
||||
clippy::print_stdout,
|
||||
clippy::ref_option,
|
||||
clippy::ref_patterns,
|
||||
clippy::similar_names,
|
||||
clippy::single_call_fn,
|
||||
clippy::single_match_else,
|
||||
clippy::std_instead_of_alloc,
|
||||
clippy::std_instead_of_core,
|
||||
clippy::too_many_arguments,
|
||||
clippy::too_many_lines,
|
||||
clippy::unnecessary_wraps,
|
||||
clippy::unwrap_used,
|
||||
clippy::useless_format,
|
||||
clippy::wildcard_enum_match_arm,
|
||||
reason = "Bench tool: matches test-style fixture code"
|
||||
)]
|
||||
|
||||
@ -21,11 +49,7 @@ use std::{path::PathBuf, time::Instant};
|
||||
mod ppe;
|
||||
mod stats;
|
||||
|
||||
use stats::Stats;
|
||||
|
||||
use amm_core::{
|
||||
PoolDefinition, compute_liquidity_token_pda, compute_pool_pda, compute_vault_pda,
|
||||
};
|
||||
use amm_core::{PoolDefinition, compute_liquidity_token_pda, compute_pool_pda, compute_vault_pda};
|
||||
use anyhow::Result;
|
||||
use ata_core::{compute_ata_seed, get_associated_token_account_id};
|
||||
use clap::Parser;
|
||||
@ -43,6 +67,7 @@ use nssa_core::{
|
||||
};
|
||||
use risc0_zkvm::{ExecutorEnv, default_executor, default_prover};
|
||||
use serde::Serialize;
|
||||
use stats::Stats;
|
||||
use token_core::{TokenDefinition, TokenHolding};
|
||||
|
||||
#[derive(Parser, Debug)]
|
||||
@ -166,7 +191,9 @@ fn run_case<I: Serialize>(
|
||||
prove_segments = Some(prove_info.stats.segments);
|
||||
eprintln!(
|
||||
" prove({program}/{instruction_label}): {prove_ms:.1} ms ({:.1}s), total_cycles={}, segments={}",
|
||||
prove_ms / 1_000.0, prove_info.stats.total_cycles, prove_info.stats.segments,
|
||||
prove_ms / 1_000.0,
|
||||
prove_info.stats.total_cycles,
|
||||
prove_info.stats.segments,
|
||||
);
|
||||
}
|
||||
|
||||
@ -513,11 +540,7 @@ fn main() -> Result<()> {
|
||||
print_table(&results, prove);
|
||||
|
||||
#[cfg(feature = "ppe")]
|
||||
let ppe_results = if cli.ppe {
|
||||
ppe::run_all()?
|
||||
} else {
|
||||
Vec::new()
|
||||
};
|
||||
let ppe_results = if cli.ppe { ppe::run_all()? } else { Vec::new() };
|
||||
#[cfg(not(feature = "ppe"))]
|
||||
let ppe_results: Vec<ppe::PpeBenchResult> = {
|
||||
if cli.ppe {
|
||||
@ -589,11 +612,7 @@ fn print_table(results: &[BenchResult], prove: bool) {
|
||||
|
||||
println!(
|
||||
"{:<pw$} {:<iw$} {:>cw$} {:>sw$} {:<exec_w$}",
|
||||
"program",
|
||||
"instruction",
|
||||
"user_cycles",
|
||||
"segments",
|
||||
"exec_ms (best / mean ± stdev)",
|
||||
"program", "instruction", "user_cycles", "segments", "exec_ms (best / mean ± stdev)",
|
||||
);
|
||||
println!("{}", "-".repeat(pw + iw + cw + sw + exec_w + 8));
|
||||
for r in results {
|
||||
|
||||
@ -78,7 +78,11 @@ pub fn print_table(results: &[PpeBenchResult]) {
|
||||
|
||||
println!(
|
||||
"\n{:<lw$} {:>5} {:>20} {:>12} {}",
|
||||
"label", "depth", "prove_ms (s)", "proof_bytes", "error",
|
||||
"label",
|
||||
"depth",
|
||||
"prove_ms (s)",
|
||||
"proof_bytes",
|
||||
"error",
|
||||
lw = lw,
|
||||
);
|
||||
println!("{}", "-".repeat(lw + 60));
|
||||
@ -94,7 +98,11 @@ pub fn print_table(results: &[PpeBenchResult]) {
|
||||
let e = r.error.as_deref().unwrap_or("");
|
||||
println!(
|
||||
"{:<lw$} {:>5} {:>20} {:>12} {}",
|
||||
r.label, r.chain_depth, p, b, e,
|
||||
r.label,
|
||||
r.chain_depth,
|
||||
p,
|
||||
b,
|
||||
e,
|
||||
lw = lw,
|
||||
);
|
||||
}
|
||||
@ -103,7 +111,10 @@ pub fn print_table(results: &[PpeBenchResult]) {
|
||||
pub fn print_verify(r: &VerifyBenchResult) {
|
||||
println!("\nVerify (G_verify):");
|
||||
println!(" case : {}", r.label);
|
||||
println!(" proof_bytes : {} (borsh InnerReceipt, S_agg)", r.proof_bytes);
|
||||
println!(
|
||||
" proof_bytes : {} (borsh InnerReceipt, S_agg)",
|
||||
r.proof_bytes
|
||||
);
|
||||
println!(" journal_bytes : {}", r.journal_bytes);
|
||||
println!(" verify_ms : {}", r.stats.format());
|
||||
}
|
||||
@ -114,7 +125,7 @@ mod ppe_impl {
|
||||
|
||||
use nssa::{
|
||||
execute_and_prove,
|
||||
privacy_preserving_transaction::circuit::{Proof, ProgramWithDependencies},
|
||||
privacy_preserving_transaction::circuit::{ProgramWithDependencies, Proof},
|
||||
program::Program,
|
||||
program_methods::PRIVACY_PRESERVING_CIRCUIT_ID,
|
||||
};
|
||||
@ -128,8 +139,7 @@ mod ppe_impl {
|
||||
use super::{PpeBenchResult, VerifyBenchResult};
|
||||
use crate::stats::Stats;
|
||||
|
||||
const AUTH_TRANSFER_ID: ProgramId =
|
||||
nssa::program_methods::AUTHENTICATED_TRANSFER_ID;
|
||||
const AUTH_TRANSFER_ID: ProgramId = nssa::program_methods::AUTHENTICATED_TRANSFER_ID;
|
||||
const AUTH_TRANSFER_ELF: &[u8] = nssa::program_methods::AUTHENTICATED_TRANSFER_ELF;
|
||||
|
||||
/// chain_caller bytecode shipped at artifacts/test_program_methods/chain_caller.bin.
|
||||
@ -161,8 +171,7 @@ mod ppe_impl {
|
||||
}
|
||||
}
|
||||
|
||||
fn prove_auth_transfer_in_ppe()
|
||||
-> anyhow::Result<(PrivacyPreservingCircuitOutput, Proof)> {
|
||||
fn prove_auth_transfer_in_ppe() -> anyhow::Result<(PrivacyPreservingCircuitOutput, Proof)> {
|
||||
let program = Program::new(AUTH_TRANSFER_ELF.to_vec())?;
|
||||
let pwd = ProgramWithDependencies::from(program);
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user