I was surprised to see that this may be violated in secp256k1_eckey_pubkey_parse:
https://github.com/bitcoin-core/secp256k1/blob/cc557575522c4cf11e5bcde1fea9637339cea21f/src/eckey_impl.h#L26-L31
I claim
ge(j)objects should always represent valid points on the curve.- This invariant should be checked in VERIFY mode, in
secp256k1_ge(j)_verifyor at least insecp256k1_ge_set_xy - There should be a separate function
secp256k1_ge_try_set_xywhich checks if (x,y) is on the curve, and only if yes, returns 1 and outputs age. That function can be used to implementsecp256k1_eckey_pubkey_parse. secp256k1_ge_is_valid_varshould be removed (or repurposed tosecp256k1_ge_verify_on_curve_varwithout return value, as mentioned above).