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.