cic-internal-integration/apps/contract-migration/scripts
2021-02-19 07:58:27 +01:00
..
config WIP user generation revamp 2021-02-18 10:11:46 +01:00
false Add missing import scripts 2021-02-13 22:18:40 +01:00
node_modules Add missing import scripts 2021-02-13 22:18:40 +01:00
create_import_users.py Update README 2021-02-18 15:27:13 +01:00
import_balance.py Rehabiilitate import scripts to handle sempo exports after changes 2021-02-18 16:38:09 +01:00
import_balance.sh Add missing import scripts 2021-02-13 22:18:40 +01:00
import_meta.js Update README 2021-02-18 15:27:13 +01:00
import_users.py Rehabiilitate import scripts to handle sempo exports after changes 2021-02-18 16:38:09 +01:00
import_users.sh Add missing import scripts 2021-02-13 22:18:40 +01:00
package-lock.json Add import meta script 2021-02-12 20:40:18 +01:00
README Update README 2021-02-18 15:27:13 +01:00
requirements.txt Fix requirements file, add debug database flag to docker compose 2021-02-19 07:58:27 +01:00
verify.py Rehabiilitate import scripts to handle sempo exports after changes 2021-02-18 16:38:09 +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 <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.