mirror of
https://github.com/luxfi/precompile.git
synced 2026-09-24 00:26:21 +00:00
e2e/go.mod required github.com/luxfi/precompile v0.5.27 with no replace, so the
suite compiled against a published artifact 33 patch releases behind the tree it
lives in. e2e/clob already had `replace => ../..`; the parent module never did.
The consequence was not that the tests were weak, it was that they could not
observe this repo at all — seven of them had been failing against real code and
nothing could report it. Adding the replace also removes the checksum failure
they hit on the way in: the v0.5.27 tag was force-moved after publication, so
github now serves bytes that do not match what sum.golang.org attests, and the
suite could not resolve its own parent.
With the replace in place, the seven pre-existing failures are visible, and all
seven were the tests being wrong:
StableSwap x4 — the calldata was written by hand at each of four call sites
with a one-byte token count and the amplification factor last. getD and getDy
read a four-byte count and take the amplification before the balances. The
layout now lives in encodeGetD/encodeGetDy and nowhere else, which is what
stops it drifting again.
CGGMP21 — threshold ECDSA on secp256k1, handed a P-256 key. The precompile
refused it correctly. Now generates a real secp256k1 key and signature.
FROST — verifies secp256k1 x-only Schnorr via curve.Secp256k1{}.LiftX; the
test built an edwards25519 key, on the strength of a comment claiming FROST
keys are Ed25519-compatible, which is not true of this implementation.
Ed25519 — took 32 bytes from rand.Read and required them to be a canonical
scalar, which holds about one time in sixteen, then hand-rolled a SHA-256
Schnorr with s = k - e*x. RFC 8032 uses SHA-512 and s = r + e*a, and the
precompile calls ed25519.Verify, so it could not have verified even with a
valid scalar. Now signs with crypto/ed25519.
Keys come from a seeded source so a failure reproduces. Added the negative
cases these lacked entirely: signature bound to its message, every bit-flip
refused, all-zero key refused, truncated and over-long frames refused, and
gas charged on refusal. FROST keeps only its refusal cases here — the positive
path needs the threshold library's domain-separated challenge, which belongs in
frost/real_sig_test.go rather than in a second copy.
Also removes cmd/safekatdump and cmd/safekatverify. safekatdump's doc comment
claimed it "generates real known-answer test (KAT) vectors"; it generates a
fresh key and a fresh signature from rand.Reader on every run and safekatverify
then checks that our verifier accepts what our signer just produced. That
passes unchanged if the implementation is uniformly wrong on both sides, which
is the failure a KAT exists to catch. Nothing consumed the output: no Makefile
target, no CI step, no checked-in fixture, and no reference to either program
anywhere outside their own doc comments. Genuine frozen vectors now live in the
packages, under go test, where they run.
e2e/clob is left alone: it replaces github.com/luxfi/dex with a sibling working
checkout, so it currently fails on an undefined symbol from that tree's
in-progress state rather than anything here.
89 lines
3.7 KiB
AMPL
89 lines
3.7 KiB
AMPL
module github.com/luxfi/precompile/e2e
|
|
|
|
go 1.26.4
|
|
|
|
require (
|
|
filippo.io/edwards25519 v1.2.0
|
|
github.com/consensys/gnark-crypto v0.20.1
|
|
github.com/holiman/uint256 v1.3.2
|
|
github.com/luxfi/crypto v1.19.26
|
|
github.com/luxfi/geth v1.17.12
|
|
github.com/luxfi/precompile v0.5.44
|
|
github.com/stretchr/testify v1.11.1
|
|
)
|
|
|
|
require (
|
|
github.com/ALTree/bigfloat v0.2.0 // indirect
|
|
github.com/Microsoft/go-winio v0.6.2 // indirect
|
|
github.com/bits-and-blooms/bitset v1.24.4 // indirect
|
|
github.com/cenkalti/backoff v2.2.1+incompatible // indirect
|
|
github.com/cloudflare/circl v1.6.3 // indirect
|
|
github.com/crate-crypto/go-eth-kzg v1.5.0 // indirect
|
|
github.com/cronokirby/saferith v0.33.0 // indirect
|
|
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
|
|
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.4.1 // indirect
|
|
github.com/ethereum/c-kzg-4844/v2 v2.1.7 // indirect
|
|
github.com/fxamacker/cbor/v2 v2.9.1 // indirect
|
|
github.com/google/go-cmp v0.7.0 // indirect
|
|
github.com/gorilla/rpc v1.2.1 // indirect
|
|
github.com/grandcat/zeroconf v1.0.0 // indirect
|
|
github.com/gtank/merlin v0.1.1 // indirect
|
|
github.com/gtank/ristretto255 v0.2.0 // indirect
|
|
github.com/klauspost/compress v1.18.6 // indirect
|
|
github.com/klauspost/cpuid/v2 v2.3.0 // indirect
|
|
github.com/luxfi/accel v1.2.4 // indirect
|
|
github.com/luxfi/atomic v1.0.0 // indirect
|
|
github.com/luxfi/cache v1.2.1 // indirect
|
|
github.com/luxfi/compress v0.0.5 // indirect
|
|
github.com/luxfi/concurrent v0.0.3 // indirect
|
|
github.com/luxfi/consensus v1.25.29 // indirect
|
|
github.com/luxfi/constants v1.5.8 // indirect
|
|
github.com/luxfi/container v0.0.4 // indirect
|
|
github.com/luxfi/crypto/ipa v1.2.4 // indirect
|
|
github.com/luxfi/database v1.20.4 // indirect
|
|
github.com/luxfi/fhe v1.8.2 // indirect
|
|
github.com/luxfi/ids v1.2.15 // indirect
|
|
github.com/luxfi/lattice/v7 v7.1.4 // indirect
|
|
github.com/luxfi/log v1.4.3 // indirect
|
|
github.com/luxfi/math v1.4.1 // indirect
|
|
github.com/luxfi/math/big v0.1.0 // indirect
|
|
github.com/luxfi/mdns v0.1.1 // indirect
|
|
github.com/luxfi/metric v1.5.9 // indirect
|
|
github.com/luxfi/mock v0.1.1 // indirect
|
|
github.com/luxfi/p2p v1.21.1 // indirect
|
|
github.com/luxfi/pq v1.0.3 // indirect
|
|
github.com/luxfi/runtime v1.1.3 // indirect
|
|
github.com/luxfi/sampler v1.1.0 // indirect
|
|
github.com/luxfi/threshold v1.12.0 // indirect
|
|
github.com/luxfi/utils v1.2.0 // indirect
|
|
github.com/luxfi/validators v1.2.0 // indirect
|
|
github.com/luxfi/version v1.0.1 // indirect
|
|
github.com/luxfi/vm v1.2.5 // indirect
|
|
github.com/luxfi/warp v1.23.0 // indirect
|
|
github.com/luxfi/zap v0.8.11 // indirect
|
|
github.com/mattn/go-colorable v0.1.15 // indirect
|
|
github.com/mattn/go-isatty v0.0.22 // indirect
|
|
github.com/miekg/dns v1.1.72 // indirect
|
|
github.com/mimoo/StrobeGo v0.0.0-20220103164710-9a04d6ca976b // indirect
|
|
github.com/mitchellh/mapstructure v1.5.1-0.20231216201459-8508981c8b6c // indirect
|
|
github.com/mr-tron/base58 v1.3.0 // indirect
|
|
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
|
|
github.com/supranational/blst v0.3.16 // indirect
|
|
github.com/x448/float16 v0.8.4 // indirect
|
|
github.com/zeebo/blake3 v0.2.4 // indirect
|
|
go.uber.org/mock v0.6.0 // indirect
|
|
golang.org/x/crypto v0.53.0 // indirect
|
|
golang.org/x/exp v0.0.0-20260529124908-c761662dc8c9 // indirect
|
|
golang.org/x/mod v0.36.0 // indirect
|
|
golang.org/x/net v0.55.0 // indirect
|
|
golang.org/x/sync v0.21.0 // indirect
|
|
golang.org/x/sys v0.46.0 // indirect
|
|
golang.org/x/tools v0.45.0 // indirect
|
|
gonum.org/v1/gonum v0.17.0 // indirect
|
|
google.golang.org/protobuf v1.36.12-0.20260120151049-f2248ac996af // indirect
|
|
gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect
|
|
gopkg.in/yaml.v3 v3.0.1 // indirect
|
|
)
|
|
|
|
replace github.com/luxfi/precompile => ..
|