Skip to content

Commit

Permalink
Remove outdated TODOs [skip ci]
Browse files Browse the repository at this point in the history
- noinline consts: nim-lang/RFCs#257
  • Loading branch information
mratsim committed Oct 11, 2020
1 parent 6530596 commit 1383aae
Show file tree
Hide file tree
Showing 13 changed files with 5 additions and 27 deletions.
2 changes: 1 addition & 1 deletion benchmarks/platforms.nim
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# * Apache v2 license (license terms in the root directory or at http://www.apache.org/licenses/LICENSE-2.0).
# at your option. This file may not be copied, modified, or distributed except according to those terms.

when defined(amd64): # TODO defined(i386) but it seems lie RDTSC call is misconfigured
when defined(amd64): # TODO defined(i386) but it seems like RDTSC call is misconfigured
import platforms/x86
export getTicks, cpuName

Expand Down
1 change: 0 additions & 1 deletion constantine.nimble
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,6 @@ const useDebug = [

proc test(flags, path: string, commandFile = false) =
# commandFile should be a "file" but Nimscript doesn't support IO
# TODO: use a proper runner
if not dirExists "build":
mkDir "build"
# Compilation language is controlled by WEAVE_TEST_LANG
Expand Down
2 changes: 0 additions & 2 deletions constantine/arithmetic/limbs_modular.nim
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,6 @@ func steinsGCD*(v: var Limbs, a: Limbs, F, M: Limbs, bits: int, mp1div2: Limbs)

# TODO: the inlining of primitives like `csub` is bad for codesize
# but there is a 80% slowdown without it.
# TODO: The `cmov` in `cadd` and `csub` always retest the condition
# which is probably costly here given how many we have.

var a = a
var b = M
Expand Down
7 changes: 3 additions & 4 deletions constantine/config/curves_parser.nim
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import
# - properly cross the compile-time -> runtime boundary
# - avoid inlining large const arrays at the call site
# for example when using the `r2modP` constant in multiple overloads in the same module
# TODO: check that those constants use extern const to avoid duplication across modules

type
CurveFamily* = enum
Expand Down Expand Up @@ -352,9 +351,9 @@ macro declareCurves*(curves: untyped): untyped =
## ...
## ]
##
## TODO: Ensure that
## 1. the modulus is not inlined at runtime to avoid codesize explosion.
## 2. is not duplicated across compilation modules.
## Ensure that
## 1. the modulus is not inlined at runtime to avoid codesize explosion.
## 2. is not duplicated across compilation modules.

curves.expectKind(nnkStmtList)
curvesDefinitions.parseCurveDecls(curves)
Expand Down
5 changes: 0 additions & 5 deletions constantine/elliptic/ec_endomorphism_accel.nim
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,6 @@ func decomposeEndo*[M, scalBits, L: static int](
## - Conditional negate is about 10 cycles per Fp, on G2 projective we have 3 (coords) * 2 (Fp2) * 10 (cycles) ~= 60 cycles
## We need to test the mini scalar, which is 65 bits so 2 Fp so about 2 cycles
## and negate it as well.
##
## However solution 1 seems to cause issues (TODO)
## with some of the BLS12-381 test cases (6 and 9)
## - 0x5668a2332db27199dcfb7cbdfca6317c2ff128db26d7df68483e0a095ec8e88f
## - 0x644dc62869683f0c93f38eaef2ba6912569dc91ec2806e46b4a3dd6a4421dad1

# Equal when no window or no negative handling, greater otherwise
static: doAssert L >= (scalBits + M - 1) div M + 1
Expand Down
1 change: 0 additions & 1 deletion constantine/elliptic/ec_shortweierstrass_affine.nim
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ func trySetFromCoordX*[F, Tw](
## Note: Dedicated robust procedures for hashing-to-curve
## will be provided, this is intended for testing purposes.
P.y.curve_eq_rhs(x, Tw)
# TODO: supports non p ≡ 3 (mod 4) modulus like BLS12-377
result = sqrt_if_square(P.y)

func neg*(P: var ECP_ShortW_Aff, Q: ECP_ShortW_Aff) =
Expand Down
2 changes: 0 additions & 2 deletions constantine/elliptic/ec_shortweierstrass_jacobian.nim
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ func trySetFromCoordsXandZ*[F; Tw](
## Note: Dedicated robust procedures for hashing-to-curve
## will be provided, this is intended for testing purposes.
P.y.curve_eq_rhs(x, Tw)
# TODO: supports non p ≡ 3 (mod 4) modulus like BLS12-377
result = sqrt_if_square(P.y)

var z2 {.noInit.}: F
Expand All @@ -116,7 +115,6 @@ func trySetFromCoordX*[F; Tw](
## Note: Dedicated robust procedures for hashing-to-curve
## will be provided, this is intended for testing purposes.
P.y.curve_eq_rhs(x, Tw)
# TODO: supports non p ≡ 3 (mod 4) modulus like BLS12-377
result = sqrt_if_square(P.y)
P.x = x
P.z.setOne()
Expand Down
2 changes: 0 additions & 2 deletions constantine/elliptic/ec_shortweierstrass_projective.nim
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ func trySetFromCoordsXandZ*[F; Tw](
## Note: Dedicated robust procedures for hashing-to-curve
## will be provided, this is intended for testing purposes.
P.y.curve_eq_rhs(x, Tw)
# TODO: supports non p ≡ 3 (mod 4) modulus like BLS12-377
result = sqrt_if_square(P.y)

P.x.prod(x, z)
Expand All @@ -107,7 +106,6 @@ func trySetFromCoordX*[F; Tw](
## Note: Dedicated robust procedures for hashing-to-curve
## will be provided, this is intended for testing purposes.
P.y.curve_eq_rhs(x, Tw)
# TODO: supports non p ≡ 3 (mod 4) modulus like BLS12-377
result = sqrt_if_square(P.y)
P.x = x
P.z.setOne()
Expand Down
2 changes: 0 additions & 2 deletions constantine/io/io_ec.nim
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@ func toHex*[EC](P: EC): string =
## CT:
## - no leaks
##
## TODO: only normalize and don't display the Z coordinate
##
## This proc output may change format in the future

var aff {.noInit.}: ECP_ShortW_Aff[EC.F, EC.Tw]
Expand Down
4 changes: 0 additions & 4 deletions constantine/pairing/pairing_bls12.nim
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ func millerLoopGenericBLS12*[C](
) =
## Generic Miller Loop for BLS12 curve
## Computes f{u,Q}(P) with u the BLS curve parameter
# TODO: retrieve the curve parameter from the curve declaration

# Boundary cases
# Loop start
Expand Down Expand Up @@ -147,9 +146,6 @@ func finalExpHard_BLS12*[C](f: var Fp12[C]) =
#
# p14: 3 Φ₁₂(p(x))/r(x) = (x−1)² (x+p) (x²+p²−1) + 3
#
# TODO: paper costs are 4Eₓ+Eₓ/₂+7M₁₂+S₁₂+F₁+F₂
# so we have an extra cyclotomic squaring since we use 5Eₓ
#
# with
# - Eₓ being f^x
# - Eₓ/₂ being f^(x/2)
Expand Down
1 change: 0 additions & 1 deletion constantine/pairing/pairing_bn.nim
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ func millerLoopGenericBN*[C](
) =
## Generic Miller Loop for BN curves
## Computes f{6u+2,Q}(P) with u the BN curve parameter
# TODO: retrieve the curve parameter from the curve declaration

# TODO - boundary cases
# Loop start
Expand Down
1 change: 0 additions & 1 deletion constantine/towers.nim
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,6 @@ func `*=`*(a: var Fp4, _: typedesc[γ]) {.inline.} =

func `*=`*(a: var Fp2, b: Fp) =
## Multiply an element of Fp2 by an element of Fp
# TODO: make generic and move to tower_field_extensions
a.c0 *= b
a.c1 *= b

Expand Down
2 changes: 1 addition & 1 deletion tests/t_finite_fields_vs_gmp.nim
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ proc binary_prologue[C: static Curve, N: static int](
doAssert len >= aW, "Expected at most " & $len & " bytes but wrote " & $aW & " for " & toHex(aBuf) & " (big-endian)"
doAssert len >= bW, "Expected at most " & $len & " bytes but wrote " & $bW & " for " & toHex(bBuf) & " (big-endian)"

# Build the bigint - TODO more fields codecs
# Build the bigint
aTest = Fp[C].fromBig BigInt[bits].fromRawUint(aBuf.toOpenArray(0, aW-1), bigEndian)
bTest = Fp[C].fromBig BigInt[bits].fromRawUint(bBuf.toOpenArray(0, bW-1), bigEndian)

Expand Down

0 comments on commit 1383aae

Please sign in to comment.