npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

hardhat-fhe-profiler

v0.1.3

Published

Hardhat plugin to profile fhEVM (Zama) HCU cost: per-function static analysis, CI cost- and confidence-regression gating, and trace reconciliation. hardhat-gas-reporter, but for Homomorphic Complexity Units.

Readme

hardhat-fhe-profiler

hardhat-gas-reporter, but for HCU — the per-transaction Homomorphic Complexity Unit budget that silently breaks fhEVM (Zama) confidential contracts and that no block explorer or gas reporter measures.

A confidential contract has two budgets: on-chain EVM gas (every explorer shows it) and per-transaction HCU, the off-chain coprocessor compute cap. Blow the HCU cap and the tx is mined but the FHE compute silently fails. This plugin profiles HCU per function, statically, and gates it in CI.

Built on Zama's own HCU primitives (@fhevm/mock-utils) — not a reimplementation.

Install

npm i -D hardhat-fhe-profiler
# or: pnpm add -D hardhat-fhe-profiler
// hardhat.config.ts
import "hardhat-fhe-profiler";

Use

npx hardhat fhe-profile                      # static HCU table for all your contracts
npx hardhat fhe-profile --json               # machine-readable reports
npx hardhat fhe-profile --update-baseline    # write .fhe-profile-baseline.json
npx hardhat fhe-profile --ci                 # gate: HCU regression / confidence regression / unknown
npx hardhat fhe-profile --ci --threshold 30  # allow +30% HCU drift
function                       txHCU      ownHCU  conf   why
placeBet                     813,130     813,130  LOW    unresolved edge: confidentialTransferFrom()
claim                      1,080,032   1,080,032  LOW    unresolved edge: confidentialTransfer()
createMarket                      64           0  HIGH   straight-line
_initMarket                       64          64  HIGH   straight-line

Confidence is the minimum of three axes (semantic · control-flow · graph-completeness); the why column names the binding one. An under-count is never silent and never HIGH — a function that calls an external body the analyzer can't see (e.g. an ERC-7984 confidentialTransfer) reports its txHCU as an explicit lower bound and names the excluded edge, rather than under-counting at HIGH.

CI gating

npx hardhat fhe-profile --update-baseline    # commit .fhe-profile-baseline.json
npx hardhat fhe-profile --ci                 # in CI — exit 1 on a blocking finding

The --ci gate fails on:

  • HCU_REGRESSION — a function's txHCU rose past the baseline by more than --threshold (default 0).
  • CONFIDENCE_REGRESSION — a function that was HIGH/MEDIUM at baseline dropped to LOW (a new unanalyzable edge crept in; its txHCU silently stopped being trustworthy). A function already LOW at baseline is an accepted, known limitation and passes — so a contract built on external confidential transfers can still run a meaningful gate. --no-fail-on-low disables this check.
  • UNKNOWN_OP / RESOLUTION_LOST — an FHE op the cost model can't price.

It warns (non-blocking) on VERSION_DRIFT (cost-model versions changed since baseline) and NEW_FUNCTION.

Trace mode (optional)

A runtime helper for tests, wrapping Zama's own receipt primitives — no instrumentation:

import { traceTx, reconcile } from "hardhat-fhe-profiler";
const row = await traceTx(hre, "placeBet", contract.placeBet(...));   // live globalHCU + ops
const rec = reconcile(staticReport, "placeBet", row);                 // static / trace / delta

Compatibility

Pinned to the @fhevm/mock-utils cost model. Validated against @fhevm/solidity 0.11.x, @fhevm/mock-utils 0.4.2, solc 0.8.28. Every report carries a version fingerprint; the --ci gate warns on drift.


Part of the fhe-gas-profiler monorepo — see the repo for the confidence model (CONFIDENCE.md), cross-project validation (VALIDATION.md), and the analysis engine (fhe-gas-profiler).

MIT © Laolex