taproot-assets icon indicating copy to clipboard operation
taproot-assets copied to clipboard

[feature]: use consistent pubkey encoding in RPC message definitions

Open ZZiigguurraatt opened this issue 1 year ago • 1 comments

There is an inconsistent script_key object across RPC calls. Some are of type taprpc.ScriptKey (https://github.com/lightninglabs/taproot-assets/blob/ee06af74d45a5eb37887876972ebaf2223fd8a82/taprpc/taprootassets.proto#L908-L926) and some are of type bytes.

taprpc.ScriptKey includes a pub_key sub object of type bytes. On the contrary, the script_key object of type bytes is the same as that pub_key sub object of type bytes, except there are an extra two bytes prepended to the script_key object of type bytes. I'm not sure what these two extra bytes are for.

I think all RPC calls should use the taprpc.ScriptKey object with the bytes pub_key sub object and get rid of the bytes script_key objects that have the two extra bytes prepended to them. taprpc.ScriptKey is more descriptive.

Some uses of ScriptKey

  • https://github.com/lightninglabs/taproot-assets/blob/ee06af74d45a5eb37887876972ebaf2223fd8a82/taprpc/taprootassets.proto#L858-L906
  • https://github.com/lightninglabs/taproot-assets/blob/47a265d73f7e2280c8aae09732b47f482334ba73/taprpc/assetwalletrpc/assetwallet.proto#L396-L398
  • https://github.com/lightninglabs/taproot-assets/blob/47a265d73f7e2280c8aae09732b47f482334ba73/taprpc/assetwalletrpc/assetwallet.proto#L417-L419
  • https://github.com/lightninglabs/taproot-assets/blob/47a265d73f7e2280c8aae09732b47f482334ba73/taprpc/assetwalletrpc/assetwallet.proto#L474-L476
  • https://github.com/lightninglabs/taproot-assets/blob/47a265d73f7e2280c8aae09732b47f482334ba73/taprpc/assetwalletrpc/assetwallet.proto#L478-L480
  • https://github.com/lightninglabs/taproot-assets/blob/47a265d73f7e2280c8aae09732b47f482334ba73/taprpc/mintrpc/mint.proto#L61-L116
  • https://github.com/lightninglabs/taproot-assets/blob/47a265d73f7e2280c8aae09732b47f482334ba73/taprpc/mintrpc/mint.proto#L129-L204

Some uses of script_key

  • https://github.com/lightninglabs/taproot-assets/blob/47a265d73f7e2280c8aae09732b47f482334ba73/taprpc/assetwalletrpc/assetwallet.proto#L421-L432
  • https://github.com/lightninglabs/taproot-assets/blob/47a265d73f7e2280c8aae09732b47f482334ba73/taprpc/assetwalletrpc/assetwallet.proto#L201-L217
  • https://github.com/lightninglabs/taproot-assets/blob/47a265d73f7e2280c8aae09732b47f482334ba73/taprpc/taprootassets.proto#L662-L675
  • https://github.com/lightninglabs/taproot-assets/blob/47a265d73f7e2280c8aae09732b47f482334ba73/taprpc/taprootassets.proto#L384-L455
  • https://github.com/lightninglabs/taproot-assets/blob/47a265d73f7e2280c8aae09732b47f482334ba73/taprpc/taprootassets.proto#L662-L675
  • https://github.com/lightninglabs/taproot-assets/blob/47a265d73f7e2280c8aae09732b47f482334ba73/taprpc/taprootassets.proto#L728-L753
  • https://github.com/lightninglabs/taproot-assets/blob/47a265d73f7e2280c8aae09732b47f482334ba73/taprpc/taprootassets.proto#L784-L832
  • https://github.com/lightninglabs/taproot-assets/blob/47a265d73f7e2280c8aae09732b47f482334ba73/taprpc/taprootassets.proto#L1072-L1079
  • https://github.com/lightninglabs/taproot-assets/blob/47a265d73f7e2280c8aae09732b47f482334ba73/taprpc/taprootassets.proto#L1149-L1154
  • https://github.com/lightninglabs/taproot-assets/blob/47a265d73f7e2280c8aae09732b47f482334ba73/taprpc/universerpc/universe.proto#L285-L300

ZZiigguurraatt avatar Nov 18 '24 17:11 ZZiigguurraatt

I think the raw-byte script_key fields must be legacy definitions using the compressed encoding (if there's one byte prepended).

jtobin avatar Sep 23 '25 08:09 jtobin