cic-internal-integration/apps/contract-migration/scripts
2021-04-07 21:27:56 +02:00
..
cmd Refactor import scripts 2021-02-21 15:41:37 +00:00
common Refactor import scripts 2021-02-21 15:41:37 +00:00
config Add celery poller for phone index 2021-04-07 14:18:03 +02:00
false Refactor import scripts 2021-02-21 15:41:37 +00:00
local Rehabilitate import scripts after leak fixes 2021-02-22 20:00:18 +00:00
create_import_users.py Verify (manually) phone index add works with cic-meta-server 2021-04-07 15:34:45 +02:00
import_balance.py Add celery poller for phone index 2021-04-07 14:18:03 +02:00
import_balance.sh Refactor import scripts 2021-02-21 15:41:37 +00:00
import_meta.js Rehabilitate CLI and API after nonce changes 2021-03-07 18:01:44 +00:00
import_sovereign_users.py Use external chain queue engine 2021-04-04 12:40:59 +00:00
import_task.py Full import by ussd 2021-04-07 21:23:50 +02:00
import_users.py Make 40k import pass 2021-04-06 15:14:04 +00:00
import_users.sh Refactor import scripts 2021-02-21 15:41:37 +00:00
import_ussd_balance.py Full import by ussd 2021-04-07 21:23:50 +02:00
import_ussd_users.py Remove loglines 2021-04-07 21:27:56 +02:00
import_util.py Full import by ussd 2021-04-07 21:23:50 +02:00
package-lock.json Refactor import scripts 2021-02-21 15:41:37 +00:00
README.md Sovereign import part II 2021-03-31 11:04:05 +00:00
requirements.txt Make 40k import pass 2021-04-06 15:14:04 +00:00
traffic.py Refactor import scripts 2021-02-21 15:41:37 +00:00
verify.py cic-eth: Rehabilitate retrier with chainqueue 2021-04-05 15:07:09 +00: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-meta-server

If using the custodial alternative for user imports, also run: * cic-eth-tasker * cic-eth-dispatcher * cic-eth-tracker

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

Only use one of the following

Custodial

This alternative generates accounts using the cic-eth custodial engine

Without any modifications to the cluster and config files:

python import_users.py -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.

Sovereign

This alternative generates keystore files, while registering corresponding addresses in the accounts registry directly

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

A keystore sub-directory in the data path is created, with ethereum keystore files for all generated private keys. Passphrase is set to empty string for all of them.

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.