Files
zeekay abf99d05fc papers: reorganize into per-paper dirs, add Antje Worring as co-author
Restructured from flat .tex/.pdf files into per-paper subdirectories.
Added Antje Worring as co-author on all papers.
Synced PDFs to pdfs/ for download site.
2026-04-18 21:50:07 -07:00

56 lines
2.0 KiB
TeX

\section{Gas Cost Modeling}
\subsection{Principle: Gas Reflects Wall-Clock Time}
Gas costs must reflect actual computation time to prevent denial-of-service attacks.
If a precompile is underpriced, an attacker can consume node CPU without paying
proportional gas. If overpriced, legitimate use is discouraged.
\subsection{Calibration Method}
\begin{enumerate}[nosep]
\item Benchmark the precompile on reference hardware (AMD EPYC 7713, which runs Lux
Network validators).
\item Measure wall-clock time for representative inputs.
\item Compute gas per nanosecond using the baseline: \texttt{ecrecover} costs 3,000 gas
and takes approximately 26\,$\mu$s on reference hardware, giving a rate of approximately
$0.115$ gas/ns.
\item Gas cost $= \text{execution time (ns)} \times 0.115$, rounded up to the nearest
1,000.
\end{enumerate}
\subsection{Gas Cost Table}
\begin{table}[H]
\centering
\small
\begin{tabular}{@{}lrrr@{}}
\toprule
\textbf{Precompile} & \textbf{Time ($\mu$s)} & \textbf{Gas} & \textbf{Gas/ns} \\
\midrule
BLS12-381 pairing (1 pair) & 1,700 & 113,000 & 0.066 \\
BLS12-381 G1 add & 2.4 & 500 & 0.208 \\
BLS12-381 G1 scalar mul & 340 & 45,000 & 0.132 \\
BN254 pairing (1 pair) & 820 & 65,000 & 0.079 \\
Batch ecrecover (100 sigs) & 12,000 & 180,000 & 0.015 \\
ML-DSA-65 verify & 300 & 35,000 & 0.117 \\
FALCON-512 verify & 180 & 22,000 & 0.122 \\
FHE encrypt & 450 & 55,000 & 0.122 \\
FHE add & 12 & 2,000 & 0.167 \\
FHE multiply & 850 & 100,000 & 0.118 \\
Warp message verify & 95 & 12,000 & 0.126 \\
NTT-256 forward & 3.1 & 500 & 0.161 \\
NTT-256 inverse & 3.3 & 500 & 0.152 \\
\bottomrule
\end{tabular}
\caption{Gas costs calibrated to execution time on AMD EPYC 7713.}
\end{table}
All gas/ns ratios fall within the range $[0.015, 0.208]$, a factor of 14x variation.
The target is $0.115 \pm 2\text{x}$. Batch ecrecover is intentionally underpriced to
incentivize batching (it replaces 100 individual ecrecover calls at 300,000 gas with
180,000 gas for the batch).
%% ============================================================