mirror of
https://github.com/bitcoin/bips.git
synced 2026-10-19 19:29:18 +00:00
bip138: generalize key-selection test vectors
Rename keys_types.json to recipient_keys.json and generalize the format to support multiple descriptors and multiple recipient keys: - "key": a single key-expression string becomes "descriptors": an array of complete descriptor strings. - "expected": an x-only key string becomes "expected_keys": an array containing that key; null remains null. Convert the nine existing cases by wrapping each key expression in tr(), except the uncompressed literal uses pk(), since tr() does not accept it. Each case has one descriptor.
This commit is contained in:
@@ -590,8 +590,11 @@ The version field enables possible future enhancements:
|
||||
|
||||
### Test Vectors
|
||||
|
||||
[key_types.json](./bip-0138/test_vectors/keys_types.json) contains test
|
||||
vectors for key serialisations.
|
||||
[recipient_keys.json](./bip-0138/test_vectors/recipient_keys.json) contains
|
||||
test vectors for recipient selection. `descriptors` lists the payload's descriptor
|
||||
strings; `expected_keys` lists the sorted, deduplicated x-only recipient roots
|
||||
before application-specific exclusions. `null` requires refusing to encode.
|
||||
|
||||
[content_type.json](./bip-0138/test_vectors/content_type.json) contains test
|
||||
vectors for content types serialisations.
|
||||
[payload.json](./bip-0138/test_vectors/payload.json) contains test vectors for payload parsing.
|
||||
|
||||
@@ -1,47 +0,0 @@
|
||||
[
|
||||
{
|
||||
"description": "Xpub with origin and multipath wildcard",
|
||||
"key": "[58b7f8dc/48'/1'/0'/2']tpubDEPBvXvhta3pjVaKokqC3eeMQnszj9ehFaA2zD5nSdkaccwGAizu8jVB2NeSpvmP2P52MBoZvNCixqXRJnTyXx51FQzARR63tjxQSyP3Btw/<0;1>/*",
|
||||
"expected": "ebd252ca0877aae09b9d058219682775aa3cbcd049c12f07832f2cf6a3b51708"
|
||||
},
|
||||
{
|
||||
"description": "Xpub with single-path wildcard",
|
||||
"key": "[58b7f8dc/48'/1'/0'/2']tpubDEPBvXvhta3pjVaKokqC3eeMQnszj9ehFaA2zD5nSdkaccwGAizu8jVB2NeSpvmP2P52MBoZvNCixqXRJnTyXx51FQzARR63tjxQSyP3Btw/0/*",
|
||||
"expected": "ebd252ca0877aae09b9d058219682775aa3cbcd049c12f07832f2cf6a3b51708"
|
||||
},
|
||||
{
|
||||
"description": "Xpub with bare wildcard (no preceding path)",
|
||||
"key": "[58b7f8dc/48'/1'/0'/2']tpubDEPBvXvhta3pjVaKokqC3eeMQnszj9ehFaA2zD5nSdkaccwGAizu8jVB2NeSpvmP2P52MBoZvNCixqXRJnTyXx51FQzARR63tjxQSyP3Btw/*",
|
||||
"expected": "ebd252ca0877aae09b9d058219682775aa3cbcd049c12f07832f2cf6a3b51708"
|
||||
},
|
||||
{
|
||||
"description": "Xpub with fixed deep derivation, no wildcard",
|
||||
"key": "[58b7f8dc/48'/1'/0'/2']tpubDEPBvXvhta3pjVaKokqC3eeMQnszj9ehFaA2zD5nSdkaccwGAizu8jVB2NeSpvmP2P52MBoZvNCixqXRJnTyXx51FQzARR63tjxQSyP3Btw/0/5",
|
||||
"expected": "ebd252ca0877aae09b9d058219682775aa3cbcd049c12f07832f2cf6a3b51708"
|
||||
},
|
||||
{
|
||||
"description": "Xpub with multipath, no wildcard",
|
||||
"key": "[58b7f8dc/48'/1'/0'/2']tpubDEPBvXvhta3pjVaKokqC3eeMQnszj9ehFaA2zD5nSdkaccwGAizu8jVB2NeSpvmP2P52MBoZvNCixqXRJnTyXx51FQzARR63tjxQSyP3Btw/<0;1>",
|
||||
"expected": "ebd252ca0877aae09b9d058219682775aa3cbcd049c12f07832f2cf6a3b51708"
|
||||
},
|
||||
{
|
||||
"description": "Bare xpub (no derivation, no wildcard); DISALLOWED",
|
||||
"key": "[d4ab66f1/48'/1'/1'/2']tpubDFTxBKyUCgkwp5enwZh3t2FJ5AMJqmCWoh1NRT13qNYQb1iKTUrAG6u5gpsDYhG8cZGXouYWuQtzcuSVjPStTc4dwU6JqPMFtgaLGvSQXhi",
|
||||
"expected": null
|
||||
},
|
||||
{
|
||||
"description": "Compressed literal pubkey; DISALLOWED",
|
||||
"key": "02ebd252ca0877aae09b9d058219682775aa3cbcd049c12f07832f2cf6a3b51708",
|
||||
"expected": null
|
||||
},
|
||||
{
|
||||
"description": "X-only literal pubkey; DISALLOWED",
|
||||
"key": "ebd252ca0877aae09b9d058219682775aa3cbcd049c12f07832f2cf6a3b51708",
|
||||
"expected": null
|
||||
},
|
||||
{
|
||||
"description": "Uncompressed literal pubkey; DISALLOWED",
|
||||
"key": "04ebd252ca0877aae09b9d058219682775aa3cbcd049c12f07832f2cf6a3b517089e956909c4c07e8529f45f3ff8904d28df5a181619e21bdf748a896322530039",
|
||||
"expected": null
|
||||
}
|
||||
]
|
||||
75
bip-0138/test_vectors/recipient_keys.json
Normal file
75
bip-0138/test_vectors/recipient_keys.json
Normal file
@@ -0,0 +1,75 @@
|
||||
[
|
||||
{
|
||||
"description": "Xpub with origin and multipath wildcard",
|
||||
"descriptors": [
|
||||
"tr([58b7f8dc/48'/1'/0'/2']tpubDEPBvXvhta3pjVaKokqC3eeMQnszj9ehFaA2zD5nSdkaccwGAizu8jVB2NeSpvmP2P52MBoZvNCixqXRJnTyXx51FQzARR63tjxQSyP3Btw/<0;1>/*)"
|
||||
],
|
||||
"expected_keys": [
|
||||
"ebd252ca0877aae09b9d058219682775aa3cbcd049c12f07832f2cf6a3b51708"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "Xpub with single-path wildcard",
|
||||
"descriptors": [
|
||||
"tr([58b7f8dc/48'/1'/0'/2']tpubDEPBvXvhta3pjVaKokqC3eeMQnszj9ehFaA2zD5nSdkaccwGAizu8jVB2NeSpvmP2P52MBoZvNCixqXRJnTyXx51FQzARR63tjxQSyP3Btw/0/*)"
|
||||
],
|
||||
"expected_keys": [
|
||||
"ebd252ca0877aae09b9d058219682775aa3cbcd049c12f07832f2cf6a3b51708"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "Xpub with bare wildcard (no preceding path)",
|
||||
"descriptors": [
|
||||
"tr([58b7f8dc/48'/1'/0'/2']tpubDEPBvXvhta3pjVaKokqC3eeMQnszj9ehFaA2zD5nSdkaccwGAizu8jVB2NeSpvmP2P52MBoZvNCixqXRJnTyXx51FQzARR63tjxQSyP3Btw/*)"
|
||||
],
|
||||
"expected_keys": [
|
||||
"ebd252ca0877aae09b9d058219682775aa3cbcd049c12f07832f2cf6a3b51708"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "Xpub with fixed deep derivation, no wildcard",
|
||||
"descriptors": [
|
||||
"tr([58b7f8dc/48'/1'/0'/2']tpubDEPBvXvhta3pjVaKokqC3eeMQnszj9ehFaA2zD5nSdkaccwGAizu8jVB2NeSpvmP2P52MBoZvNCixqXRJnTyXx51FQzARR63tjxQSyP3Btw/0/5)"
|
||||
],
|
||||
"expected_keys": [
|
||||
"ebd252ca0877aae09b9d058219682775aa3cbcd049c12f07832f2cf6a3b51708"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "Xpub with multipath, no wildcard",
|
||||
"descriptors": [
|
||||
"tr([58b7f8dc/48'/1'/0'/2']tpubDEPBvXvhta3pjVaKokqC3eeMQnszj9ehFaA2zD5nSdkaccwGAizu8jVB2NeSpvmP2P52MBoZvNCixqXRJnTyXx51FQzARR63tjxQSyP3Btw/<0;1>)"
|
||||
],
|
||||
"expected_keys": [
|
||||
"ebd252ca0877aae09b9d058219682775aa3cbcd049c12f07832f2cf6a3b51708"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "Bare xpub (no derivation, no wildcard); DISALLOWED",
|
||||
"descriptors": [
|
||||
"tr([d4ab66f1/48'/1'/1'/2']tpubDFTxBKyUCgkwp5enwZh3t2FJ5AMJqmCWoh1NRT13qNYQb1iKTUrAG6u5gpsDYhG8cZGXouYWuQtzcuSVjPStTc4dwU6JqPMFtgaLGvSQXhi)"
|
||||
],
|
||||
"expected_keys": null
|
||||
},
|
||||
{
|
||||
"description": "Compressed literal pubkey; DISALLOWED",
|
||||
"descriptors": [
|
||||
"tr(02ebd252ca0877aae09b9d058219682775aa3cbcd049c12f07832f2cf6a3b51708)"
|
||||
],
|
||||
"expected_keys": null
|
||||
},
|
||||
{
|
||||
"description": "X-only literal pubkey; DISALLOWED",
|
||||
"descriptors": [
|
||||
"tr(ebd252ca0877aae09b9d058219682775aa3cbcd049c12f07832f2cf6a3b51708)"
|
||||
],
|
||||
"expected_keys": null
|
||||
},
|
||||
{
|
||||
"description": "Uncompressed literal pubkey; DISALLOWED",
|
||||
"descriptors": [
|
||||
"pk(04ebd252ca0877aae09b9d058219682775aa3cbcd049c12f07832f2cf6a3b517089e956909c4c07e8529f45f3ff8904d28df5a181619e21bdf748a896322530039)"
|
||||
],
|
||||
"expected_keys": null
|
||||
}
|
||||
]
|
||||
Reference in New Issue
Block a user