Closed siv2r closed 1 month ago
Agree that the return type should be Optional[PlainPk]
. Since None
is not not a plain public key, I don't see how a user could confuse this.
I think the function returns False now because it used to return Point
at some point in the past and not PlainPk
.
The
extract_adaptor
API returnsFalse
when it’s unable to generate a valid adaptor point. In one of our calls, we decided on usingFalse
becauseNone
is used to represent an infinity point.Wouldn’t it be more pragmatic to use
None
instead?Here are my reasons:
extract_adaptor
is supposed to return a point, so returning a boolean value seems unusualNone
keyword doesn’t make sense.0x0000...0000
(33-byte array) and tries to create a pre-signature for it. This won't work becausecpoint(adaptor)
would raise value error. So, the adaptor can never be an infinity point in our APIs.assert
for this inextract_secadaptor
cpoint
None
approach. Thelift_x
function returnsNone
when it cannot generate a valid point. Even thoughNone
represents the infinity point for thepoint_add
,point_mul
, andpoint_negate
functions.