refgen

command
v1.9.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 23, 2026 License: Apache-2.0, MIT Imports: 3 Imported by: 0

Documentation

Overview

refgen regenerates the reference reorg-probability vectors used by TestCalcValidatorProb_PythonReference against the calculator's current implementation on the CPU it runs on.

Usage:

go run ./chain/ecfinality/tools/refgen

Copy the printed map body into calculator_test.go under the appropriate reference vector (pythonReferenceResults for FMA-capable CPUs, nonFMAReferenceResults for x86_64 without FMA3). This is only needed when adding support for a new CPU class or when the algorithm's math changes intentionally.

Background: math.Log / math.Exp / math.Lgamma produce slightly different values on FMA-capable vs non-FMA CPUs due to different polynomial evaluations. The test dispatches by cpu.X86.HasFMA and checks 1e-12 parity within each class, so regressions on either CPU family are caught cleanly without loosening tolerance globally.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL