Skip to content

Commit

Permalink
tests: migrate singlesig tx tests to mnemonic + descriptor-based
Browse files Browse the repository at this point in the history
These tests use the standard bip44-style wallets whose descriptors are
given in the previous commit message. Test cases can be generated from
any bip44-compatible singlesig wallet.

Extend the test code to allow testing Anti-Exfil and legacy signing flows
for a single test case, and enable both for each new test case.
  • Loading branch information
jgriffiths committed Jan 20, 2025
1 parent 000ed5e commit f7b558c
Show file tree
Hide file tree
Showing 11 changed files with 281 additions and 200 deletions.
22 changes: 0 additions & 22 deletions test_data/singlesig_txn.json

This file was deleted.

32 changes: 0 additions & 32 deletions test_data/singlesig_txn_bech32.json

This file was deleted.

38 changes: 0 additions & 38 deletions test_data/singlesig_txn_bech32_ae.json

This file was deleted.

31 changes: 0 additions & 31 deletions test_data/singlesig_txn_change.json

This file was deleted.

32 changes: 0 additions & 32 deletions test_data/singlesig_txn_p2sh.json

This file was deleted.

32 changes: 0 additions & 32 deletions test_data/singlesig_txn_pkh.json

This file was deleted.

68 changes: 68 additions & 0 deletions test_data/tx_ss_p2pkh.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
{
"description": "Spend from 2/n4dfrfmhy4hMTHBnCPL3LgSfA7FLy7LG2y and 3/mqeLdHHAgne2gvwtye4356Nc9DcN7nRsUo to bcrt1qc9feglfcmnx8ywy50mdjan4f5ss2nlg75yqlsd (tx contains gdk dummy signatures)",
"input": {
"network": "localtest",
"use_ae_signatures": true,
"txn": "020000000283dbdaaee275d2910cd17f65187ea3f20fe37a553b16df398160f14b84ff49a3000000006b483045022100ff7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f02207f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f01210268246c0462037aefb8611a9cebf313ee2430c22a4f3644e6460f4e88d73b54f4fdffffff4c3f7d4310d8d679d89a8af18094bb29be7de8cbfdb4b466c400fd41bf11d9af000000006b483045022100ff7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f02207f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f0121027eeb53798c29e1d19ad9c4948fce7f4fd13f65ba25a3100130ec5d4747bf1d54fdffffff02983a000000000000160014c153947d38dccc7238947edb2ecea9a420a9fd1e15120000000000001976a914c4e6c152268f755afbd8e70b8aa07f9c3aa0b4c888ac72000000",
"change": [
null,
{
"is_change": true,
"path": [
2147483692,
2147483649,
2147483648,
1,
2
],
"variant": "pkh(k)"
}
],
"inputs": [
{
"is_witness": false,
"path": [
2147483692,
2147483649,
2147483648,
0,
3
],
"script": "76a9146f16cf9c04a990dcc10f97366b617c9b93f40a6088ac",
"sighash": 1,
"ae_host_commitment": "ac9502e41a8e102ebf1e7f892471a992e3059ac939e706f67dfce7409a79497a",
"ae_host_entropy": "48277294236f5540dc4974c6c9257367da630a5e6d5a72a84dadb52f65c3772d",
"input_tx": "02000000000101eebd4a7d313d1ec91c6c89007596517d67ea1243f372518d60ed3b62c740cf8a0000000000fdffffff0210270000000000001976a9146f16cf9c04a990dcc10f97366b617c9b93f40a6088ac146b052a010000001976a9140da921dc5e7b086fba1e8b4a84e9617df4551c6b88ac0247304402205a8b5a6461cf73ee808796b45f23f0f97afd27a9d545e222c219cf308dc92a4f02206321bd5cd942762ccec95bd9a021dfc6e400678361ecc37171057216131f42050121026bb7a906e88c9ca7e7a33c88958bca0a6bd4c6a78275ffaeee70b16fb9efc8e367000000"
},
{
"is_witness": false,
"path": [
2147483692,
2147483649,
2147483648,
0,
2
],
"script": "76a914fd9015522dbafda0b33ad66b24d0ee75507a2c1588ac",
"sighash": 1,
"ae_host_commitment": "05fe73f81c4a0140325909a33c9160688047181ac89632f12c499d01a818b70e",
"ae_host_entropy": "087ff71e646f5621c5169df148e2c23fde3c9d7d784a6938b8cbd39fbecb2ec2",
"input_tx": "02000000000101962675e3082c9df574155ea8a005a4d2888e8f6a68769e0fef1ca1fff24b23190100000000fdffffff0210270000000000001976a914fd9015522dbafda0b33ad66b24d0ee75507a2c1588ac823e052a010000001976a91490b4e7048b353f993bce1ec4378d96c173984af788ac02473044022058de24b35cba33a9e637097eef9a0311b159530db54893faa4e81664c61fd209022067a5b7fedf1bfc7da3a90d022afd574a3b7439784f0a32dff3203682700e0186012103f945102a86fe1974e403948e1537eb5c6329fb12e67f971247881c25a4815ae271000000"
}
]
},
"expected_output": [
[
"03eb450ce7b0a020b5eae2de8029ce4f1805de9e58496f30e58dcddd65ef74d51a",
"3045022100e1b40ae9dd7e3908b405d4199a6f32ef66f4b62826fcb5f34d6ab27c660fef8602206bf79d2c8556f45c1c9bd01bca80726320515fb751d1d235fb7bcac4efdffbcb01"
],
[
"021f4dd40630e820b011964080111b2b71aa93487830e47c3e006072a59aaaf499",
"304402201714f7ab0907f6081294fe8915061ab848dbaf9219aef6fe2cd7b52f22f96f400220433fd3f1ed4c1057216efad0e666e11c49db507a299faabb690830326a2141d701"
]
],
"expected_legacy_output": [
"3044022077ba475ddd478e786788e7f79e1b3196edfbe4b754914e883c69a6ac9711aa4e02201fdae82d1363f08bbcc7bce82af264f9ac58795b6551288e4edebf2ab788413f01",
"304402201a1942a4002c7d1112e54a1d5b068a2d504cc10464d59775c08ff1128c0061fe022000da1b6d41732db58e6cb2e308cebedf5d989ced9fe1782833fa0358862f231301"
]
}
68 changes: 68 additions & 0 deletions test_data/tx_ss_p2sh_p2wpkh.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
{
"description": "Spend from 1/2Msh4aZx2mk2ipcYW5ZYo1fmwerWvbTpufA and 2/2My3xuMSH6WgjznunEaJYQCtsSQV3QPz9Ka to bcrt1qc9feglfcmnx8ywy50mdjan4f5ss2nlg75yqlsd",
"input": {
"network": "localtest",
"use_ae_signatures": true,
"txn": "020000000001024bdb95507000c172a757c26f0fcf554ab5b5d209d498eced887313894d65569a0100000017160014797b05b0895da6298a9d0713ed723101834fb6dcfdffffff08d7adadf5de5860f51c491c996203cf1c3738602b3ed07b87ef19f859395c9c00000000171600144dc8746a6fd43f521dddccb073d057ecb5d0e3d4fdffffff02983a000000000000160014c153947d38dccc7238947edb2ecea9a420a9fd1e881200000000000017a914d3ba752ff86c82a0567ed95bc7dd63d9daf514558702002103154481df78c34067add6c2beb2d5741018708f687b754f41e1e58d1ad5ad178d0200210345867588c2118fa3b3f4ae013a8e8a9b27d2c299f374f48cc1e2c813ac401d746f000000",
"change": [
null,
{
"is_change": true,
"path": [
2147483697,
2147483649,
2147483648,
1,
1
],
"variant": "sh(wpkh(k))"
}
],
"inputs": [
{
"is_witness": true,
"path": [
2147483697,
2147483649,
2147483648,
0,
2
],
"script": "76a914797b05b0895da6298a9d0713ed723101834fb6dc88ac",
"sighash": 1,
"ae_host_commitment": "159cc760fb95905f674109b73b82c21d6950eeb706ee1147eac79541bc3febf5",
"ae_host_entropy": "24d8b71dbe4e7d5fe6f57e2b0768bb47ecac88710dddb4b27d1758b06eb444d9",
"input_tx": "020000000001011b05f84ebd21404d45e9360b78aa637205fb61998888e0b5c2f5a7d356bdab1a0000000000fdffffff025ac5052a0100000017a914c7ac0620a694c60ec512ec831777735726d23cd887102700000000000017a9143faf9637b80644b24d4cc64fad605753bcacdf1a870247304402200ab263a4648a5c37f30182765b1820b37b25f1ec13a09b5476b6a6acf00ea64902203f1d4a32754f2ab8aa3f0b022807cc917fb7587382dec0d9c1edbcd90609718601210225c5eaed63de3dad268ab08cb01bb8bfc12e1037d71da85696a1d51ad27c215d6e000000"
},
{
"is_witness": true,
"path": [
2147483697,
2147483649,
2147483648,
0,
1
],
"script": "76a9144dc8746a6fd43f521dddccb073d057ecb5d0e3d488ac",
"sighash": 1,
"ae_host_commitment": "fde1d2488845b5d85e790745013530245c2a168c18b807934270b868d532463d",
"ae_host_entropy": "13728fa03bab4b4eafb1fa7ccdd8a361e38c894ab4dc5e05763ca13695f92484",
"input_tx": "02000000000101fd0ffe17937a8c7d95d8684c7f1b1c5f4069e20f1ffc7a13673ce07bf6e2b1a10000000000fdffffff02102700000000000017a91404e2f5fb8023c2f9f54eacb730a2b8b0efab42e6875ac5052a0100000017a914c34b1926aabb7434a089ce14e5625591e6b2b5d38702473044022033077b65956432245dc1629db850901092678e035bbc191bd6c3550f61433c630220167a66eab0b7297552c4af4cc992c83199774649f301c45c7a351d3759fffbe101210225c5eaed63de3dad268ab08cb01bb8bfc12e1037d71da85696a1d51ad27c215d6e000000"
}
]
},
"expected_output": [
[
"022d3138c72a686c8ddf95b1d336b7fa5cdbe3d8bb5a0fc780daca40bd28210d60",
"30450221008af9dc89a0b8650e26a20c035877e4a679ead14d982dd53aa0e4f80c3c42551702205ed68e5bd5d7171cb0cce043349d1be2b24d001a32580bc2e8b5d1e097eec75b01"
],
[
"0341cf1fdc5d10be3b68938a3d45cfa954fdd907fb0b68625e45b882d6004280d2",
"3045022100ed5f72b93ac3c32010d54c20c56632b95280a63590ad0cb13c96926561f98c9a02204c76f34bdd15bba5e73873b6b62d73a32aded52bc8944aae1543201e652ccdf001"
]
],
"expected_legacy_output": [
"304402205762bafa42c0640c3a4a9625c4ae9ba4d615d47bbfceea29101438647e8fb8520220046b846a0bc909ff489d01d9f312b6ae46b7071737c44d6517140fb4592f8f2501",
"30440220489666c99191ba296ce4880ecb35ee4d1e718d9f17c1bc8f21b32c374bf08d5d02202f0b9aaa0376a2a17bed9000482f27c078a200b0217fe275b63c2d9645687a1601"
]
}
68 changes: 68 additions & 0 deletions test_data/tx_ss_p2wpkh.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
{
"description": "Spend from 1/bcrt1qqydlk09e5v3k8zkmuxs6ntfusdlfg5sjxlg4ex and 2/bcrt1ql246fkptjgm3rxzr00r0cluetq60muj6q40cqp to bcrt1qc9feglfcmnx8ywy50mdjan4f5ss2nlg75yqlsd",
"input": {
"network": "localtest",
"use_ae_signatures": true,
"txn": "02000000000102962675e3082c9df574155ea8a005a4d2888e8f6a68769e0fef1ca1fff24b23190000000000fdffffff62d743e449ed6a5996f9ea538a9ed3f9528dd629f2d0ecc7817428c698412a520000000000fdffffff02983a000000000000160014c153947d38dccc7238947edb2ecea9a420a9fd1eb7120000000000001600148d18afb6a224c66053562b278cf4eb78d23f0a0402002102151478c7a51abb39dc80bc35231ebb6e4d681f68a955c7c2a37ea0aa4415fe6902002102a0fe7e4c2bacbed42d68cbc19582b7fc54990dab0c44fe42560e41a068374a6571000000",
"change": [
null,
{
"is_change": true,
"path": [
2147483732,
2147483649,
2147483648,
1,
2
],
"variant": "wpkh(k)"
}
],
"inputs": [
{
"is_witness": true,
"path": [
2147483732,
2147483649,
2147483648,
0,
2
],
"script": "76a914faaba4d82b92371198437bc6fc7f995834fdf25a88ac",
"sighash": 1,
"ae_host_commitment": "464145d9424d1e82f6b34cb9893b1a88c12a01e3cb34c697e42f8e56a5b638fa",
"ae_host_entropy": "95cb0a37ca7de8a3fdba4531cee5d8f98b487f82b5c65b27857cfaee4d892dad",
"input_tx": "0200000000010162d743e449ed6a5996f9ea538a9ed3f9528dd629f2d0ecc7817428c698412a520100000000fdffffff021027000000000000160014faaba4d82b92371198437bc6fc7f995834fdf25a506b052a01000000160014540a4e28e92e63f66b19866e6c8bb603507529c602473044022018c2132e4d2b017ae903dce09eb2a1d82c13d57fccb342dd9e67f470e205eebe02200892f45bbd1e9ccd8c98c4e03f13f5eba7ac756b75cf7a816889b582246f8911012102d2525cdcdb470691838d2629b774e8c97d2310f1c91eb36e2f9c4d7838876ec570000000"
},
{
"is_witness": true,
"path": [
2147483732,
2147483649,
2147483648,
0,
1
],
"script": "76a914011bfb3cb9a323638adbe1a1a9ad3c837e94521288ac",
"sighash": 1,
"ae_host_commitment": "09bd3d20056b754c72a3f06a7157b53d6660ee317de4861d7cdaa8cfb78159ef",
"ae_host_entropy": "3eb9cea6140e4463dbf2c0ebee49aaf75165a4a5bd2fae60ddf7bbba8a5a5745",
"input_tx": "020000000001014bdb95507000c172a757c26f0fcf554ab5b5d209d498eced887313894d65569a000000001716001424925b07e6a7b43b9cef657f22e521fb5669f05dfdffffff021027000000000000160014011bfb3cb9a323638adbe1a1a9ad3c837e945212e297052a01000000160014c935a5383b984246bd1def6834b535a41ec2452a0247304402207c0d13e6a9afe9fb0b0d61e9af081c4916a5bf55f4f501115b45426ee29af80802204c3d3e62207cc9e154cdd7c3f243a2b3367112c96dac0453065c6bc1e0b320ef012103cc383fd545ede82eca8b16e08c0469f2bc28546cdc712607c8028afeab040c306f000000"
}
]
},
"expected_output": [
[
"03d63c861b7c5122f74daa728abbe3ae82f2a40eb6d3c19ede6795531c30bb0558",
"3045022100c2daba3eb2d9924f87ff2c65b6161a9ab83156a0cab39430f0130d5d469da5d50220514c92ced608d47b994849707e3731b4e1e0ddb2848bd850be12039adacf639f01"
],
[
"02fab288ff8f2d96162c68f55c89fc00a533caeed1930d870dfe3c2268ae573b73",
"3045022100cbaf3fd781374cd6054811a007681350fd60b71f54e2cb01c9bc7528a3e9d519022041cc3141bc034e8b852d1dae43c469252756a082e00cf556feed24ceef1b8da301"
]
],
"expected_legacy_output": [
"3044022040f5678e165bb6d7f5eefa2cb0735ae55123cd8f61338f2ee440f4ed79bb7a1e0220727e53f3d53706e7cec5cdb6e668ec789d90bcfe26f599e2e346de5d57854da201",
"304402205871475f3e7cf0a0d6457cf1f923d08ef225dfa64aaf2e169fc2ac2dedf37b2c022022b28ca4600388a188fe2f5e7a4a6ad8d5fa67212f45faaacb45460c342e2ed301"
]
}
Loading

0 comments on commit f7b558c

Please sign in to comment.