Skip to content

Bunch of changes around key generation and few minor unrelated changes

Piotr Batko requested to merge pbatko/lazy-key-generation-in-account-object into master

Add new way of key generation -- with PrivateKey and PublicKey classes

Now keys can be generated with following syntax:

import test_tools as tt

private_key = tt.PrivateKey('alice')
public_key = tt.PublicKey('alice')

Add support for using them with node config and messages, e.g.:

# Example use in node config
node.config.private_key.append(tt.PrivateKey('example-witness'))

# Example use in message
wallet.api.import_key(tt.PrivateKey('example-account'))

Generate keys in lazy way

There are use case, where immediate key generation cause problems, because in this case, key generator executable is not provided. Account object should be generated independently from presence of key generator executable. Now key generation is moved to moment, when they are really needed.

Make name and secret members read only

To prevent mistakes with changing account name or secret after key generation, mentioned members are now read only.

Fix bug with returning cached initminer's keys only when key generator executable is provided

Now key generator executable can be missing and initminer's keys will be returned anyway.

Minor unrelated changes

On CI run only tests which do not need executables

Tests are splitted into unit_tests and functional_tests. Unit tests never use any executables (like hived or cli_wallet). In functional tests using executables is allowed. Unit tests run on TestTools' CI, and there we don't have access to executables -- this is reason of mentioned limitation in unit tests.

This limitation was problematic, because we started to write tests, which requires executables, but are small and precise like unit test should be. So requires_hived_executables mark was introduced and such unit tests are marked with them. Now such tests are skipped on TestTools' CI (as they would be anyway), but it allowed to put these test to correct category -- into unit_tests directory.

Reviewers:

Edited by Piotr Batko

Merge request reports