Commit graph

16 commits

Author SHA1 Message Date
f9e6d994f0
whitespace: test/misc 2024-10-18 10:32:13 +00:00
5c419c802b
main.py: add fqmod param; add test/misc/opts.py launcher 2024-03-08 14:13:23 +00:00
211b71431d
renamed: test/misc/opts.py -> test/misc/opts_main.py 2024-03-08 14:13:23 +00:00
aff850d1c8
test suite: import cleanups 2023-10-03 14:27:57 +00:00
286105b73a
opts.py: remove show_common_opts_diff() 2023-04-04 16:04:11 +00:00
d81d82fe35
cfg.py: prefix internally used attrs with underscore 2023-04-04 16:04:11 +00:00
9e1935ad19
opts.init() -> Config() 2023-04-04 16:04:10 +00:00
c7adb56e38
Config API, Part I
This patch eliminates the global configuration variables `opt` and `g`, making
all functions and class instances locally configurable.  Configuration data is
passed to functions and constructors via the `cfg` parameter and made available
to methods in `self.cfg`.

Local configuration free from dependence on the command line will enable the
creation of multiple, independently configured instances of MMGen’s data
objects within a single process.

Potential applications include testing (tracking wallets configured to interact
with spawned processes, for example) and the use of MMGen as a library for
other projects.

This patch completes most of the work required to enable the API.  The full
implementation will appear in a forthcoming commit.
2023-03-28 18:14:37 +00:00
78e882143c
whitespace, cleanups, imports throughout [73 files changed] 2023-03-27 10:49:04 +00:00
91156f6847
globalvars.py: required_opts -> init_opts 2022-01-21 11:23:43 +00:00
0ac28869b3
remove unneeded 'add_opts' argument in opts.init() calls 2022-01-21 11:23:43 +00:00
54e9799989
test suite: minor cleanups 2022-01-19 11:43:52 +00:00
32c522c039
overhaul public key and address generation code
- pubkey generation code has been rewritten and moved from addr.py to
  keygen.py
- address generation code has been rewritten and moved from addr.py to
  addrgen.py
- keygen/addrgen classes now present a consistent API across all pubkey and
  address types
- key/address operations and related data objects now use bytes internally
  instead of hex strings
- pubkey generator backends are now selected using the `--keygen-backend`
  option
- for Monero pubkeys, the new `nacl` backend has replaced `ed25519ll_djbec`
  as the default
- a minimal unit test has been added

Examples:

    # Generate a random Monero keypair using the unoptimized 'ed25519' backend:
    $ mmgen-tool --coin=xmr --keygen-backend=3 randpair

    # Generate an LTC Bech32 address list from the default wallet using the
    # 'python-ecdsa' backend:
    $ mmgen-addrgen --coin=ltc --type=bech32 --keygen-backend=2 1-10

Testing:

    # Run the minimal unit test:
    $ test/unit_tests_py gen

    # Compare BTC Segwit addresses from default 'libsecp256k1' backend to
    # 'pycoin' library, with edge cases and 10,000 random rounds:
    $ test/gentest.py --type=segwit 1:pycoin 10000

    # Test all configured Monero backends against 'moneropy', with edge cases
    # and 10 random rounds:
    $ test/gentest.py --coin=xmr all:moneropy 10

    # Test the 'nacl' and 'ed25519ll_djbec' backends against each other, with
    # edge cases and 1000 random rounds:
    $ test/gentest.py --coin=xmr 1:2 1000

    # Test the speed of the Monero 'nacl' backend using 10,000 rounds:
    $ test/gentest.py --coin=xmr 1 10000

    # Same for Zcash:
    $ test/gentest.py --coin=zec --type=zcash_z 1 10000
2022-01-15 14:00:12 +00:00
0138a6fa49
whitespace, cleanups, minor fixes 2022-01-15 14:00:09 +00:00
6692a43d59
f-strings, whitespace (test files) [44 files patched] 2021-09-29 21:17:57 +00:00
987dafd353
opts.py: init sequence, opt checking cleanups/improvements
Testing:

  $ test/test.py opts
2020-03-12 17:10:02 +00:00