Closed mratsim closed 2 months ago
From https://github.com/mratsim/constantine/actions/runs/8629836320/job/23654839440 in PR https://github.com/mratsim/constantine/pull/368
v2.0.4 with git hash b47747d31844c6bd9af4322efe55e24fefea544c was working fine
Reproduced locally, the compiler loses the concrete type here:
Some possibly interesting points:
b
input is static genericb
input is instantiated via a dynamicBindSym macro
https://github.com/mratsim/constantine/blob/976c8bb215a3f0b21ce3d05f894eb506072a6285/constantine/math/constants/zoo_hash_to_curve.nim#L18-L23isOne
proc does not import directly or via its import graph the h2cConst
input which might lead to generic sandwich issuesFixed upstream in https://github.com/nim-lang/Nim/pull/23852 And workaround in https://github.com/mratsim/constantine/pull/434
From https://github.com/mratsim/constantine/pull/370#issuecomment-2081212632
Overview
Command:
It seems like there is a regression in Nim 2.0.x devel branch that breaks type-checking:
No issue in Nim 2.0.2 or 2.04
Investigation
Error
The input should match:
https://github.com/mratsim/constantine/blob/976c8bb215a3f0b21ce3d05f894eb506072a6285/constantine/math/extension_fields/towers.nim#L124-L129
and ExtensionField is just a generic typeclass
https://github.com/mratsim/constantine/blob/976c8bb215a3f0b21ce3d05f894eb506072a6285/constantine/math/extension_fields/towers.nim#L34-L48
The only potential buggy part is that it's called in a compile-time context: https://github.com/mratsim/constantine/blob/976c8bb215a3f0b21ce3d05f894eb506072a6285/constantine/math/extension_fields/towers.nim#L1442-L1447