ElementsProject / elements-miniscript

Creative Commons Zero v1.0 Universal
11 stars 14 forks source link

elip150: handle x-only pubkeys #66

Closed LeoComandini closed 8 months ago

LeoComandini commented 8 months ago

In ELIP150, descriptor blinding keys cannot be x-only pubkeys. Thus if we have a 64 hex char descriptor blinding key, we need to interpret is as a single view descriptor blinding key.

apoelstra commented 8 months ago

Compressed public keys are allowed, but these are 66 bytes, not 64.

You mean to say that x-only pubkeys, which are 64 bytes, are disallowed.

You also need to change your test vectors.

LeoComandini commented 8 months ago

You mean to say that x-only pubkeys

yes, my bad, replaced "compressed" with "x-only"

You also need to change your test vectors.

removed a forgotten println!, or did you mean something else?

RCasatta commented 8 months ago

utACK e6d6028cbdacedacf5eab2734435da18daf5026c

apoelstra commented 8 months ago

removed a forgotten println!, or did you mean something else?

You are testing 66-char hex strings, but these are uninteresting because they're unambiguously compressed pubkeys. You mean to test 64-char hex strings, which could be parsed as x-only keys but shouldn't be.

LeoComandini commented 8 months ago

@apoelstra

You are testing 66-char hex strings, but these are uninteresting because they're unambiguously compressed pubkeys. You mean to test 64-char hex strings, which could be parsed as x-only keys but shouldn't be.

I still don't get it, in view_xonly_pubkey_descriptor I'm testing ct(ab16855a17319477d4283fe5c29cc7d047f81e8ffb199e20d9be1bc31a751c4c,elwpkh(021a8fb6bd5a653b021b98a2a785725b8ddacfe3687bc043aa7f4d25d3a48d40b5))#n9uc7tzt which now parses a CT descriptor with a view key, but before this commit was parsing as a CT descriptor with a bare key. Since ab16855a17319477d4283fe5c29cc7d047f81e8ffb199e20d9be1bc31a751c4c (64 chars) parses both as a x-only public key and as a descriptor private blinding key.

apoelstra commented 8 months ago

Oh! You're right, I misread your test. You are using the 33-byte key pk but not as the view key.