Skip to content

Commit

Permalink
feat: add annotation
Browse files Browse the repository at this point in the history
  • Loading branch information
ratankaliani committed Oct 17, 2024
1 parent ab1eaa7 commit 707f7d6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions scripts/utils/bin/cost_estimator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,7 @@ fn aggregate_execution_stats(
aggregate_stats.bn_mul_cycles += stats.bn_mul_cycles;
aggregate_stats.kzg_eval_cycles += stats.kzg_eval_cycles;
aggregate_stats.ec_recover_cycles += stats.ec_recover_cycles;
aggregate_stats.secp256r1_verify_cycles += stats.secp256r1_verify_cycles;
}

// For statistics that are per-block or per-transaction, we take the average over the entire
Expand Down
5 changes: 5 additions & 0 deletions utils/host/src/stats.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ pub struct ExecutionStats {
pub bn_mul_cycles: u64,
pub kzg_eval_cycles: u64,
pub ec_recover_cycles: u64,
pub secp256r1_verify_cycles: u64,
}

/// Write a statistic to the formatter.
Expand Down Expand Up @@ -99,6 +100,7 @@ impl fmt::Display for ExecutionStats {
write_stat(f, "BN Mul Cycles", self.bn_mul_cycles)?;
write_stat(f, "KZG Eval Cycles", self.kzg_eval_cycles)?;
write_stat(f, "EC Recover Cycles", self.ec_recover_cycles)?;
write_stat(f, "Secp256r1 Verify Cycles", self.secp256r1_verify_cycles)?;
writeln!(
f,
"+--------------------------------+---------------------------+"
Expand Down Expand Up @@ -141,6 +143,7 @@ impl ExecutionStats {
self.bn_pair_cycles = get_cycles("precompile-bn-pair");
self.kzg_eval_cycles = get_cycles("precompile-kzg-eval");
self.ec_recover_cycles = get_cycles("precompile-ec-recover");
self.secp256r1_verify_cycles = get_cycles("precompile-secp256r1-verify");
self.total_sp1_gas = report.estimate_gas();
}

Expand Down Expand Up @@ -185,6 +188,7 @@ pub struct SpanBatchStats {
pub bn_pair_cycles: u64,
pub kzg_eval_cycles: u64,
pub ec_recover_cycles: u64,
pub secp256r1_verify_cycles: u64,
}

impl fmt::Display for SpanBatchStats {
Expand Down Expand Up @@ -221,6 +225,7 @@ impl fmt::Display for SpanBatchStats {
write_stat(f, "BN Pair Cycles", self.bn_pair_cycles)?;
write_stat(f, "KZG Eval Cycles", self.kzg_eval_cycles)?;
write_stat(f, "EC Recover Cycles", self.ec_recover_cycles)?;
write_stat(f, "Secp256r1 Verify Cycles", self.secp256r1_verify_cycles)?;
writeln!(
f,
"+-------------------------------+---------------------------+"
Expand Down

0 comments on commit 707f7d6

Please sign in to comment.