bench-protocol
Measurement protocol for trustworthy timings. It covers interleaved A/B rounds, medians with IQR and bootstrap CIs, at least 3 repeats, warm-up, no stale builds, an isolated and locked machine, thread pinning, and recorded environment. Use for every performance number, whether FHE, lattice attack, SAT/MILP, MPC/PSI or PQC, before it can enter EVIDENCE.md.
- License 许可
- MIT
- 最近更新
- 2026-11-15
- Stars
- ★ 81
- Forks
- 17
01 前言 Front Matter
- name
- bench-protocol
- description
- Measurement protocol for trustworthy timings. It covers interleaved A/B rounds, medians with IQR and bootstrap CIs, at least 3 repeats, warm-up, no stale builds, an isolated and locked machine, thread pinning, and recorded environment. Use for every performance number, whether FHE, lattice attack, SAT/MILP, MPC/PSI or PQC, before it can enter EVIDENCE.md.
02 资源文件 3
- 许可证LICENSE1.1 KB
- 参考文档SOURCE.md355 B
- 参考文档TRUST.auto.yaml2.1 KB
03 SKILL.md 正文
bench-protocol
Rules
- Interleave. Run the arms in rounds with rotating order (A B, B A, ...). Never run all of A and then all of B. Machine state (thermal, turbo, co-tenants, page cache) drifts. Absolute times can swing by a factor of two across hours on a shared server, so only ratios from back-to-back pairs in the same session are trusted.
- Repeat. Use at least 3 measured repeats plus at least 1 discarded warm-up round. Use at least 7 when the arms differ by less than 10% or the spread is large. Single measurements of the same binary can differ by nearly 2×.
- Report the median, with the IQR and a bootstrap 95% CI. For a ratio, report
median(A)/median(B)with a paired bootstrap CI. Never report the mean of a skewed timing distribution as the headline number. Never report the best of N unless the protocol states it for both arms. - Lock and isolate. Hold
crbench's file lock so benches never overlap. Run benches one at a time with low concurrency: parallel benches compete for memory bandwidth and inflate the arm that uses it more. Keep the machine free of other heavy jobs.crbench envwarns on high load and non-performancegovernors. - Control threads. Set
OMP_NUM_THREADS,RAYON_NUM_THREADS,GOMAXPROCSand the MKL/OpenBLAS thread variables explicitly (--threads). Pin withtaskset(--cpus) when comparing single-thread numbers. Report the single-thread comparison even when the headline is parallel. - No stale builds. Build from the pinned commit into a configuration-specific
directory. Run
crbench stale BIN SRCbefore each campaign. Record the build flags. - Record the environment.
crbench runstores CPU, governor, load, compilers, git commit and dirty flag of--target, and the performance environment variables inrun.json. Keep it. - Record failures. A crash, timeout or missing output stays in the ledger as a failed execution with its error. It is excluded from statistics but never deleted. If one arm fails systematically, that is a result: document the boundary.
- Verify correctness in the timed binary. The benchmark must check its output (decrypt and compare, verify). A fast wrong answer is not a data point.
- Explain surprises. If a wall-clock speed-up exceeds the operation-count ratio, find the mechanism before publishing. Examples: evaluation at a lower level with a smaller modulus, lower depth, cache effects. Otherwise, suspect the measurement.
Command
crbench run \
-a base='./build-base/bench --set toy' \
-a new='./build-new/bench --set toy' \
-n 7 -w 1 --order alternate --parser generic --metric time \
--threads 1 --cpus 2 --target ./src --log-dir results/2026-01-01-toy-ab
Outputs: results/.../run.json (all executions, environment, summary),
results/.../<arm>/rNNN.log (raw output of each execution), and a JSON summary on
stdout with the speed-up and its CI.
Choosing the metric
| domain | primary metric | also record |
|---|---|---|
| FHE | latency per operation, or amortised per slot or bit | peak memory (/usr/bin/time -v), key sizes, multiplicative depth or level used |
| lattice attacks / estimators | wall time and success rate over seeds | block size β, dimension, memory |
| SAT / MILP | time to solve, median over ≥ 10 seeds or instances | timeouts (count), solver version, CNF/LP hash |
| MPC / PSI | end-to-end time per network profile | bytes sent per party, rounds, offline/online split |
| PQC | median cycles (fixed frequency) | stack and heap usage, key and ciphertext/signature sizes |
When numbers disagree across sessions
Rerun both arms back to back in one session. If the new pair contradicts an earlier headline, the same-session pair wins. Withdraw the old number explicitly in EVIDENCE.md (strike it through and add a reason) rather than silently replacing it. Check whether the cache is really the variable before you blame it: run a cache-isolation experiment.
Hand-off
run.json and logs are in place, with at least 3 successful repeats per arm. Then
use skills/log-to-evidence to create EVIDENCE rows.
04 同仓库更多 Skills
troves
Deposit and withdraw from Troves DeFi yield vault strategies on Starknet. View available strategies, check positions, and manage vault deposits. Use this skill when the user mentions Troves, vault, yield vault, DeFi vault, strategy, yield farming, vault deposit, vault withdraw, earning yield through vaults, passive yield strategies, or wants to deposit into or withdraw from a yield strategy — even if they don't say "Troves" explicitly.
trade
Swap tokens on Starknet via Fibrous DEX aggregator. Supports per-provider selection (avnu, ekubo, or auto to race all). Use this skill when the user wants to swap, exchange, trade, convert, buy, or sell one token for another on Starknet. Also use when the user asks about token prices, exchange rates, DEX routing, best swap route, or wants to check how much they would receive for a given amount — even if they don't explicitly say "swap".
staking
Stake, unstake, claim, and compound rewards for STRK, WBTC, tBTC, SolvBTC, and LBTC on Starknet. View validators, pools, and staking positions. Use this skill when the user mentions staking, delegating, validators, staking pools, rewards, compounding, unstaking, earning yield, passive income on crypto, or wants to earn on their STRK or BTC tokens — even if they don't say "stake" explicitly.
send
Send STRK, ETH, or any ERC-20 token to a Starknet address. Supports simulation (dry-run) before execution. Use this skill when the user wants to send, transfer, pay, tip, or move tokens to another wallet address on Starknet. Also trigger when the user mentions sending funds to someone, making a payment, transferring assets, or moving crypto to a specific address — even if they just say "pay 10 STRK to 0x...".
portfolio
View a comprehensive DeFi portfolio dashboard and optimize portfolio allocation via automated rebalancing. Use this skill when the user wants an overview, summary, dashboard, total value, net worth, portfolio rebalancing, target allocation, or wants to see all their DeFi positions across Starknet at once. Also trigger when the user asks "what do I have", "show me everything", "how much am I worth", "my positions", "my investments", "rebalance my portfolio", "I want 50% ETH", "optimize my holdings", or any request for a holistic view of their Starknet holdings — even if they don't explicitly say "portfolio".
multi-swap
Execute multiple token swaps in a single Starknet transaction via Fibrous (default). Supports per-provider selection (avnu, ekubo, or auto to race all). Supports 2-3 swap pairs bundled into one multicall. Use this skill when the user wants to swap multiple token pairs at once, do batch swaps, execute several trades simultaneously, perform parallel swaps, or do bulk trading in one transaction. Also trigger when the user mentions "two swaps", "three swaps", "swap X and Y at the same time", or wants to convert multiple tokens in a single call.