Commit graph

198 commits

Author SHA1 Message Date
f9a483f34f
asyncio/aiohttp support
Asynchronous HTTP significantly speeds up operations involving multiple
JSON-RPC calls to the server, such as tracking wallet views for wallets
with a large number of outputs.

This patch adds base-level asyncio infrastructure plus aiohttp support to all
applicable MMGen commands.

The aiohttp package is not currently supported by MSYS2, so Windows users will
have to choose one of the other backends ('curl' is the default).

Tested on: Linux, Armbian, Windows; Python 3.6, 3.7, 3.8

New user features:

    - configurable RPC backends via the 'rpc_backend' option.  Supported
      options are 'aiohttp' (Linux-only), 'httplib', 'requests' and 'curl'

    - configurable RPC queue size via the 'aiohttp_rpc_queue_len' option

The patch also includes a rewrite/redesign of large parts of the MMGen code
base, most importantly:

    - rpc.py - full rewrite of RPC library, new RPCBackends class
    - main_addrimport.py - full rewrite
    - main_autosign.py - LED code now handled by new LEDControl class
    - eth/tw.py, eth/tx.py - reworked logic for resolving token symbols and
      addresses
    - eth/tx.py - separate classes for signed and unsigned transactions

Testing:

    # Set a backend (choose one):
    $ export MMGEN_RPC_BACKEND='aiohttp' # Linux-only
    $ export MMGEN_RPC_BACKEND='curl'    # Windows
    $ export MMGEN_RPC_BACKEND='httplib' # compare performance with 'aiohttp'

    # Bitcoin:
    $ test/unit_tests.py rpc btc
    $ test/test.py main regtest autosign

    # Ethereum:
    $ test/unit_tests.py rpc eth
    $ test/tooltest2.py --coin=eth --testnet=1 txview
    $ test/test.py --coin=eth ethdev

    # Monero wallet:
    $ test/unit_tests.py rpc xmr_wallet
    $ test/test-release.sh -F xmr
2020-05-10 14:07:54 +00:00
57f12cd1cb
minor changes and fixes throughout 2020-05-10 13:39:53 +00:00
3610b3ef29
OrderedDict -> dict throughout 2020-04-09 19:34:24 +00:00
de7fba0c19
test suite: relocate some modules, use relative imports 2020-03-16 10:45:00 +00:00
d8e1d5f88c
term.py: new MMGenTerm family of classes
Testing:

    $ test/misc/term.py
2020-03-15 19:43:23 +00:00
9a888735a6
minor fixes and cleanups 2020-03-13 19:51:08 +00:00
987dafd353
opts.py: init sequence, opt checking cleanups/improvements
Testing:

  $ test/test.py opts
2020-03-12 17:10:02 +00:00
924ccc6012
new CfgFile API for mmgen.cfg and related files
Testing:

  $ test/test.py cfg
2020-03-12 17:01:47 +00:00
ea83e2595d
test.py: move tool and input tests to their own modules 2020-03-12 16:59:55 +00:00
853a24df21
minor fixes, cleanups and additions 2020-03-12 16:38:02 +00:00
5fe92460ad
release/testing: UTF8 testing fixes, other fixes and improvements 2020-02-22 19:54:03 +00:00
673b97b3b8
update copyright dates 2020-02-18 14:07:27 +00:00
70675956b8
various fixes and cleanups throughout 2020-02-12 10:36:15 +00:00
93bb5ebcb5
global rename: Daemon -> CoinDaemon 2020-02-08 17:58:56 +00:00
6f0e51d566
Daemon: handle path and RPC port selection logic in class 2020-02-08 17:43:59 +00:00
12e742fb00
global rename: TestDaemon -> Daemon 2019-12-10 18:27:19 +00:00
ac02cf66a6
file rename: test_daemon.py -> daemon.py 2019-12-10 18:16:56 +00:00
3d9bcd7876
test.py ethdev: auto-use precompiled contract data if solc not available 2019-12-08 18:38:31 +00:00
69890d831b
TestDaemon: use non-standard RPC ports 2019-12-08 18:29:46 +00:00
fe8fdabdab
test_daemon.py,rpc.py: various cleanups 2019-12-08 18:19:12 +00:00
041c55b65a
test.py,unit_tests.py: start/stop BTC,LTC,BCH daemons automatically 2019-12-07 12:45:04 +00:00
d22fd160c5
lots of minor fixes and cleanups throughout 2019-12-07 12:20:21 +00:00
768f4b960c
test.py: add 'shared_deps' feature 2019-10-31 10:46:46 +00:00
57682dce3f
test.py: cleanups and fixes throughout 2019-10-24 16:21:09 +00:00
d57631695a
test suite: move path fixup code to test/tests_header.py 2019-10-23 10:01:11 +00:00
6cf4fcc7e4
Use subprocess.run() throughout, related cleanups 2019-10-23 09:31:21 +00:00
c1347d1080
various fixes and cleanups 2019-10-19 17:34:49 +03:00
94eda8473e
test.py: use importlib, clean up module loading code 2019-10-19 13:15:31 +03:00
41d2d17b51
test.py: split ref3 cmd group into ref3, ref3_addr 2019-10-17 14:42:16 +03:00
c7ca0c3d62
N-of-N (XOR) seed splitting: user-level support
This patch introduces the commands `mmgen-seedsplit` and `mmgen-seedjoin`.
The first creates shares one at a time, while the second joins them to
recover the original seed.  By default, the default wallet is operated upon.

Shares are ordinary MMGen wallets and as such may be saved in any MMGen wallet
format, with one minor limitation: only one share in a given split may be in
hidden incognito format, and it must be the master share in the case of a
master share split.

For usage information and examples, see:

    mmgen-seedsplit --help
    mmgen-seedjoin --help

Relevant tests:

    test/test.py -e seedsplit
    ls -lrt test/tmp23/* # list the created files

    test/objtest.py SeedSplitSpecifier

Related commits:

    7311f474 - seed splitting: seed-level infrastructure
    237567bc - master shares
2019-10-13 20:33:22 +03:00
94d26212f6
minor fixes, changes 2019-07-10 16:01:54 +03:00
23ae73d908
minor fixes and cleanups 2019-07-03 20:30:53 +03:00
448e2c24bf
test.py: generated reference wallet filename checks 2019-06-11 18:57:51 +03:00
7ebfac59fd
test.py: force correct terminal width for spawned scripts 2019-05-27 18:40:13 +03:00
c7beb2e60c
test.py: add utf8 output tests 2019-05-25 15:50:09 +03:00
7ed00d98e5
test.py: add password_entry, mnemonic_entry tests 2019-05-21 16:09:33 +03:00
017ecef3bc
[opts]: separate code from text in opts_data
- When parsing opts, opts.init() now looks only at string values from
  opts_data.  Global variables are evaluated only when printing help text,
  after the variables are initialized
2019-03-26 15:59:37 +03:00
dcab10949e
Support MSWin via MSYS2
This is a work in progress.  Currently, basic operations for BTC and ETH are
supported.

The successor to the MinGW64 project, MSYS2 features package management via
`pacman` and support for Python 3:

    https://sourceforge.net/projects/msys2
    https://www.msys2.org
2019-03-25 13:07:04 +03:00
122ac43573
minor changes 2019-03-23 17:30:47 +03:00
2a68ee8ef4
with open('foo') as f: t = f.read() -> t = open('foo').read() 2019-03-17 14:56:04 +03:00
b5f1ebc640
py3port: make hexadecimal values be strings instead of bytes type
- binascii.hexlify(b'foo') -> b'foo'.hex()
- binascii.unhexlify('aabb') -> bytes.fromhex('aabb')
- replace HexBytes class with HexStr

This change has led to a ≈10% speedup in the full test-release.sh run
2019-03-17 13:33:55 +03:00
634fb2e444
py3port: use dictionary comprehensions where applicable 2019-03-16 20:45:44 +03:00
91410dd96c
test.py: refactor, modularize, cleanup code, make fully OO
- test groups are now separate classes in separate modules
- test data and code is loaded on an as-needed basis
- new TestSuiteRunner and CmdGroupMgr classes
- simplified invocation: if arguments are omitted, all default tests relevant
  for given network and option are run.  The following set of invocations
  provides nearly complete coverage of MMGen's core functionality:

    test/test.py
    test/test.py --segwit-random
    test/test.py --bech32

    test/test.py --coin=ltc
    test/test.py --coin=ltc --segwit-random
    test/test.py --coin=ltc --bech32

    test/test.py --coin=bch
    test/test.py --coin=eth
    test/test.py --coin=etc
2019-03-02 21:27:53 +03:00
729a547c7d
tool.py, main_tool.py: major rewrite, cleanup
- group tool commands into classes
- add docstrings to command classes and methods
- annotate command method args
- generate call signatures + help and usage screens on the fly

- API changes:
  - listaddresses,twview: new 'age_fmt' option replaces 'show_days' and 'show_age'
  - addrfile_chksum and friends: 'mmtype' option removed

- tooltest.py, tooltest2.py and test.py have been updated accordingly
2019-02-22 23:23:06 +03:00
583430b262
test.py: new '--list-cmd-groups' option 2019-02-19 12:02:49 +03:00
7b1b235a80
tool.py: new MMGenToolCmd class 2019-02-17 23:00:08 +03:00
6289180c1f py3port: test.py: add 'ref_hincog_blkdev_conv_out' (test read/write from block device) 2019-02-13 17:54:44 +03:00
514c1100ee Update copyright dates 2019-02-12 21:35:12 +03:00
766281cb0e py3port: test.py: improved version checking for solc 2019-02-12 21:08:18 +03:00
8c1df23332 py3port: 'test.py autosign_live' - test device insertion/removal + LED 2019-02-12 13:41:27 +03:00