cic-internal-integration/apps/contract-migration/scripts
2021-02-21 13:52:20 +01:00
..
cmd Add docstrings 2021-02-21 13:52:20 +01:00
common Factor out repeated code for most cli apps, along with classes specific to traffic script 2021-02-21 10:52:48 +01:00
config Add docstrings 2021-02-21 13:52:20 +01:00
false Add missing import scripts 2021-02-13 22:18:40 +01:00
local Add docstrings 2021-02-21 13:52:20 +01:00
create_import_users.py WIP Fix more typos in daemons 2021-02-19 08:59:01 +01:00
import_balance.py Rehabilitate import scripts after adjustments for traffic generator 2021-02-20 21:12:46 +01:00
import_balance.sh Bump registry, eth versions 2021-02-19 13:08:22 +01:00
import_meta.js Update README 2021-02-18 15:27:13 +01:00
import_users.py Add traffic router, redis subscription, dynamic traffic item module loading 2021-02-19 23:11:25 +01:00
import_users.sh Add missing import scripts 2021-02-13 22:18:40 +01:00
package-lock.json WIP Fix more typos in daemons 2021-02-19 08:59:01 +01:00
README WIP Fix more typos in daemons 2021-02-19 08:59:01 +01:00
requirements.txt Rehabilitate import scripts after adjustments for traffic generator 2021-02-20 21:12:46 +01:00
traffic.py Factor out sub args from traffic script 2021-02-21 11:00:24 +01:00
verify.py Bump registry, eth versions 2021-02-19 13:08:22 +01:00

# DATA GENERATION TOOLS

This folder contains tools to generate and import test data.

## DATA CREATION

Does not need the cluster to run.

Vanilla:

`python create_import_users.py [--dir <datadir>] <number_of_users>`

If you want to use the `import_balance.py` script to add to the user's balance from an external address, add:

`python create_import_users.py --gift-threshold <max_units_to_send> [--dir <datadir>] <number_of_users>`


## IMPORT

Make sure the following is running in the cluster:
	* eth
	* postgres
	* redis
	* cic-eth-tasker
	* cic-eth-dispatcher
	* cic-eth-manager-head


You will want to run these in sequence:


## 1. Metadata

`node import_meta.js <datadir> <number_of_users>`

Monitors a folder for output from the `import_users.py` script, adding the metadata found to the `cic-meta` service.


## 2. Balances

(Only if you used the `--gift-threshold` option above)

`python -c config -i <newchain:id> -r <cic_registry_address> -p <eth_provider> --head -y ../keystore/UTC--2021-01-08T17-18-44.521011372Z--eb3907ecad74a0013c259d5874ae7f22dcbcc95c <datadir>` 

This will monitor new mined blocks and send balances to the newly created accounts.


### 3. Users

Without any modifications to the cluster and config files:

`python -c config --redis-host-callback redis <datadir>`

** A note on the The callback**:  The script uses a redis callback to retrieve the newly generated custodial address. This is the redis server _from the perspective of the cic-eth component_.


## VERIFY

`python verify.py -c config -i <newchain:id> -r <cic_registry_address> -p <eth_provider> <datadir>` 

Checks
	* Private key is in cic-eth keystore
	* Address is in accounts index
	* Address has balance matching the gift threshold 
	* Metadata can be retrieved and has exact match

Should exit with code 0 if all input data is found in the respective services.


## KNOWN ISSUES

If the faucet disbursement is set to a non-zero amount, the balances will be off. The verify script needs to be improved to check the faucet amount.