cfg.py 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270
  1. #!/usr/bin/env python3
  2. #
  3. # MMGen Wallet, a terminal-based cryptocurrency wallet
  4. # Copyright (C)2013-2024 The MMGen Project <mmgen@tuta.io>
  5. # Licensed under the GNU General Public License, Version 3:
  6. # https://www.gnu.org/licenses
  7. # Public project repositories:
  8. # https://github.com/mmgen/mmgen-wallet
  9. # https://gitlab.com/mmgen/mmgen-wallet
  10. """
  11. test.cmdtest_d.cfg: configuration data for cmdtest.py
  12. """
  13. from .common import pwfile, hincog_fn, incog_id_fn, randbool
  14. from ..include.common import cfg
  15. cmd_groups_altcoin = ['ref_altcoin', 'autosign', 'ethdev', 'xmrwallet', 'xmr_autosign']
  16. cmd_groups_dfl = {
  17. 'misc': ('CmdTestMisc', {}),
  18. 'opts': ('CmdTestOpts', {'full_data': True}),
  19. 'cfgfile': ('CmdTestCfgFile', {'full_data': True}),
  20. 'help': ('CmdTestHelp', {'full_data': True}),
  21. 'main': ('CmdTestMain', {'full_data': True}),
  22. 'conv': ('CmdTestWalletConv', {'is3seed': True, 'modname': 'wallet'}),
  23. 'ref': ('CmdTestRef', {}),
  24. 'ref3': ('CmdTestRef3Seed', {'is3seed': True, 'modname': 'ref_3seed'}),
  25. 'ref3_addr': ('CmdTestRef3Addr', {'is3seed': True, 'modname': 'ref_3seed'}),
  26. 'ref3_pw': ('CmdTestRef3Passwd', {'is3seed': True, 'modname': 'ref_3seed'}),
  27. 'ref_altcoin': ('CmdTestRefAltcoin', {}),
  28. 'seedsplit': ('CmdTestSeedSplit', {}),
  29. 'tool': ('CmdTestTool', {'full_data': True}),
  30. 'input': ('CmdTestInput', {}),
  31. 'output': ('CmdTestOutput', {'modname': 'misc', 'full_data': True}),
  32. 'autosign_clean': ('CmdTestAutosignClean', {'modname': 'autosign'}),
  33. 'autosign': ('CmdTestAutosign', {}),
  34. 'autosign_automount': ('CmdTestAutosignAutomount', {'modname': 'automount'}),
  35. 'autosign_eth': ('CmdTestAutosignETH', {'modname': 'automount_eth'}),
  36. 'regtest': ('CmdTestRegtest', {}),
  37. # 'chainsplit': ('CmdTestChainsplit', {}),
  38. 'ethdev': ('CmdTestEthdev', {}),
  39. 'xmrwallet': ('CmdTestXMRWallet', {}),
  40. 'xmr_autosign': ('CmdTestXMRAutosign', {}),
  41. }
  42. cmd_groups_extra = {
  43. 'dev': ('CmdTestDev', {'modname': 'misc'}),
  44. 'regtest_legacy': ('CmdTestRegtestBDBWallet', {'modname': 'regtest'}),
  45. 'autosign_btc': ('CmdTestAutosignBTC', {'modname': 'autosign'}),
  46. 'autosign_live': ('CmdTestAutosignLive', {'modname': 'autosign'}),
  47. 'autosign_live_simulate': ('CmdTestAutosignLiveSimulate', {'modname': 'autosign'}),
  48. 'create_ref_tx': ('CmdTestRefTX', {'modname': 'misc', 'full_data': True}),
  49. }
  50. cfgs = { # addr_idx_lists (except 31, 32, 33, 34) must contain exactly 8 addresses
  51. '1': {
  52. 'wpasswd': 'Dorian-α',
  53. 'kapasswd': 'Grok the blockchain',
  54. 'addr_idx_list': '12,99,5-10,5,12',
  55. 'dep_generators': {
  56. pwfile: 'walletgen',
  57. 'mmdat': 'walletgen',
  58. 'addrs': 'addrgen',
  59. 'rawtx': 'txcreate',
  60. 'txbump': 'txbump',
  61. 'sigtx': 'txsign',
  62. 'mmwords': 'export_mnemonic',
  63. 'mmseed': 'export_seed',
  64. 'mmhex': 'export_hex',
  65. 'mmincog': 'export_incog',
  66. 'mmincox': 'export_incog_hex',
  67. hincog_fn: 'export_incog_hidden',
  68. incog_id_fn: 'export_incog_hidden',
  69. 'akeys.mmenc': 'keyaddrgen'
  70. },
  71. },
  72. '2': {
  73. 'wpasswd': 'Hodling away',
  74. 'addr_idx_list': '37,45,3-6,22-23',
  75. 'seed_len': 128,
  76. 'dep_generators': {
  77. 'mmdat': 'walletgen2',
  78. 'addrs': 'addrgen2',
  79. 'rawtx': 'txcreate2',
  80. 'sigtx': 'txsign2',
  81. 'mmwords': 'export_mnemonic2',
  82. },
  83. },
  84. '3': {
  85. 'wpasswd': 'Major miner',
  86. 'addr_idx_list': '73,54,1022-1023,2-5',
  87. 'dep_generators': {
  88. 'mmdat': 'walletgen3',
  89. 'addrs': 'addrgen3',
  90. 'rawtx': 'txcreate3',
  91. 'sigtx': 'txsign3'
  92. },
  93. },
  94. '4': {
  95. 'wpasswd': 'Hashrate good',
  96. 'addr_idx_list': '63,1004,542-544,7-9',
  97. 'seed_len': 192,
  98. 'dep_generators': {
  99. 'mmdat': 'walletgen4',
  100. 'mmbrain': 'walletgen4',
  101. 'addrs': 'addrgen4',
  102. 'rawtx': 'txcreate4',
  103. 'sigtx': 'txsign4',
  104. 'txdo': 'txdo4',
  105. },
  106. 'bw_filename': 'brainwallet.mmbrain',
  107. 'bw_params': '192,1',
  108. },
  109. '5': {
  110. 'wpasswd': 'My changed password-α',
  111. 'hash_preset': '2',
  112. 'dep_generators': {
  113. 'mmdat': 'passchg',
  114. pwfile: 'passchg',
  115. },
  116. },
  117. '6': {
  118. 'seed_len': 128,
  119. 'seed_id': 'FE3C6545',
  120. 'ref_bw_seed_id': '33F10310',
  121. 'wpasswd': 'reference password',
  122. 'kapasswd': '',
  123. 'dep_generators': {
  124. 'mmdat': 'ref_walletgen_brain_1',
  125. pwfile: 'ref_walletgen_brain_1',
  126. 'addrs': 'refaddrgen_1',
  127. 'akeys.mmenc': 'refkeyaddrgen_1'
  128. },
  129. },
  130. '7': {
  131. 'seed_len': 192,
  132. 'seed_id': '1378FC64',
  133. 'ref_bw_seed_id': 'CE918388',
  134. 'wpasswd': 'reference password',
  135. 'kapasswd': '',
  136. 'dep_generators': {
  137. 'mmdat': 'ref_walletgen_brain_2',
  138. pwfile: 'ref_walletgen_brain_2',
  139. 'addrs': 'refaddrgen_2',
  140. 'akeys.mmenc': 'refkeyaddrgen_2'
  141. },
  142. },
  143. '8': {
  144. 'seed_len': 256,
  145. 'seed_id': '98831F3A',
  146. 'ref_bw_seed_id': 'B48CD7FC',
  147. 'wpasswd': 'reference password',
  148. 'kapasswd': '',
  149. 'dep_generators': {
  150. 'mmdat': 'ref_walletgen_brain_3',
  151. pwfile: 'ref_walletgen_brain_3',
  152. 'addrs': 'refaddrgen_3',
  153. 'akeys.mmenc': 'refkeyaddrgen_3'
  154. },
  155. },
  156. '9': {
  157. 'tool_enc_infn': 'tool_encrypt.in',
  158. 'dep_generators': {
  159. 'tool_encrypt.in': 'tool_encrypt',
  160. 'tool_encrypt.in.mmenc': 'tool_encrypt',
  161. },
  162. },
  163. '11': {}, # wallet
  164. '12': {}, # wallet
  165. '13': {}, # wallet
  166. '14': {
  167. 'kapasswd': 'Maxwell',
  168. 'wpasswd': 'The Halving',
  169. 'addr_idx_list': '61,998,502-504,7-9',
  170. 'seed_len': 256,
  171. 'dep_generators': {
  172. 'mmdat': 'walletgen14',
  173. 'addrs': 'addrgen14',
  174. 'akeys.mmenc': 'keyaddrgen14',
  175. },
  176. },
  177. '15': {
  178. 'wpasswd': 'Dorian-α',
  179. 'kapasswd': 'Grok the blockchain',
  180. 'addr_idx_list': '12,99,5-10,5,12',
  181. 'dep_generators': {
  182. pwfile: 'walletgen_dfl_wallet',
  183. 'addrs': 'addrgen_dfl_wallet',
  184. 'rawtx': 'txcreate_dfl_wallet',
  185. 'sigtx': 'txsign_dfl_wallet',
  186. 'mmseed': 'export_seed_dfl_wallet',
  187. 'del_dw_run': 'delete_dfl_wallet',
  188. },
  189. },
  190. '16': {
  191. 'wpasswd': 'My changed password',
  192. 'hash_preset': '2',
  193. 'dep_generators': {
  194. pwfile: 'passchg_dfl_wallet',
  195. },
  196. },
  197. '17': {}, # regtest
  198. '18': {}, # autosign
  199. '19': {'wpasswd': 'abc'},
  200. '20': {
  201. 'wpasswd': 'Vsize it',
  202. 'addr_idx_list': '1-8',
  203. 'seed_len': 256,
  204. 'dep_generators': {
  205. 'mmdat': 'walletgen5',
  206. 'addrs': 'addrgen5',
  207. 'rawtx': 'txcreate5',
  208. 'sigtx': 'txsign5',
  209. },
  210. },
  211. '21': {
  212. 'wpasswd': 'Vsize it',
  213. 'addr_idx_list': '1-8',
  214. 'seed_len': 256,
  215. 'dep_generators': {
  216. 'mmdat': 'walletgen6',
  217. 'addrs': 'addrgen6',
  218. 'rawtx': 'txcreate6',
  219. 'sigtx': 'txsign6',
  220. },
  221. },
  222. '22': {}, # ethdev
  223. '23': {}, # seedsplit
  224. '26': {}, # ref_3seed
  225. '27': {}, # ref_3seed
  226. '28': {}, # ref_3seed
  227. '29': {}, # xmrwallet
  228. '31': {}, # ref_tx
  229. '32': {}, # ref_tx
  230. '33': {}, # ref_tx
  231. '34': {}, # ref_tx
  232. '38': {}, # autosign_clean
  233. '39': {}, # xmr_autosign
  234. '40': {}, # cfgfile
  235. '41': {}, # opts
  236. '49': {}, # autosign_automount
  237. '59': {}, # autosign_eth
  238. '99': {}, # dummy
  239. }
  240. def fixup_cfgs():
  241. import os
  242. for k in cfgs:
  243. cfgs[k]['tmpdir'] = os.path.join('test', 'tmp', str(k))
  244. for src, target in (
  245. ('6', '11'),
  246. ('7', '12'),
  247. ('8', '13'),
  248. ('6', '26'),
  249. ('7', '27'),
  250. ('8', '28')):
  251. cfgs[target].update(cfgs[src])
  252. cfgs[target]['tmpdir'] = os.path.join('test', 'tmp', target)
  253. for k in cfgs:
  254. cfgs[k]['segwit'] = randbool() if cfg.segwit_random else bool(cfg.segwit or cfg.bech32)
  255. if cfg.debug_utf8:
  256. for k in cfgs:
  257. cfgs[k]['tmpdir'] += '-α'
  258. fixup_cfgs()