From 95269f69ed1199ef51cb6442c55ea527c17d7a23 Mon Sep 17 00:00:00 2001 From: Louis Holbrook Date: Tue, 20 Apr 2021 13:25:02 +0000 Subject: [PATCH 01/17] CIC-cache backend syncer mixup --- .gitignore | 4 +- .../runnable/daemons/filters/erc20.py | 3 +- .../cic_cache/runnable/daemons/tracker.py | 2 +- .../scripts/eth/import_users.py | 2 +- .../scripts/package-lock.json | 2261 +---------------- apps/contract-migration/scripts/package.json | 2 +- apps/contract-migration/scripts/verify.py | 2 +- 7 files changed, 98 insertions(+), 2178 deletions(-) diff --git a/.gitignore b/.gitignore index 5e271b94..04eee297 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,6 @@ service-configs/* !service-configs/.gitkeep -node_modules +**/node_modules/ __pycache__ *.pyc -*.o \ No newline at end of file +*.o diff --git a/apps/cic-cache/cic_cache/runnable/daemons/filters/erc20.py b/apps/cic-cache/cic_cache/runnable/daemons/filters/erc20.py index e2312a71..0ff88852 100644 --- a/apps/cic-cache/cic_cache/runnable/daemons/filters/erc20.py +++ b/apps/cic-cache/cic_cache/runnable/daemons/filters/erc20.py @@ -67,6 +67,7 @@ class ERC20TransferFilter(SyncFilter): tx.status == Status.SUCCESS, block.timestamp, ) - db_session.flush() + #db_session.flush() + db_session.commit() return True diff --git a/apps/cic-cache/cic_cache/runnable/daemons/tracker.py b/apps/cic-cache/cic_cache/runnable/daemons/tracker.py index bd03528a..270e1f6a 100644 --- a/apps/cic-cache/cic_cache/runnable/daemons/tracker.py +++ b/apps/cic-cache/cic_cache/runnable/daemons/tracker.py @@ -77,7 +77,7 @@ def main(): if len(syncer_backends) == 0: logg.info('found no backends to resume') - syncers.append(SQLBackend.initial(chain_spec, block_offset)) + syncer_backends.append(SQLBackend.initial(chain_spec, block_offset)) else: for syncer_backend in syncer_backends: logg.info('resuming sync session {}'.format(syncer_backend)) diff --git a/apps/contract-migration/scripts/eth/import_users.py b/apps/contract-migration/scripts/eth/import_users.py index c5a5fb69..ed3659d6 100644 --- a/apps/contract-migration/scripts/eth/import_users.py +++ b/apps/contract-migration/scripts/eth/import_users.py @@ -24,7 +24,7 @@ from chainlib.eth.gas import RPCGasOracle from chainlib.eth.nonce import RPCNonceOracle from cic_types.processor import generate_metadata_pointer from eth_accounts_index import AccountRegistry -from contract_registry import Registry +from eth_contract_registry import Registry from crypto_dev_signer.keystore.dict import DictKeystore from crypto_dev_signer.eth.signer.defaultsigner import ReferenceSigner as EIP155Signer from crypto_dev_signer.keystore.keyfile import to_dict as to_keyfile_dict diff --git a/apps/contract-migration/scripts/package-lock.json b/apps/contract-migration/scripts/package-lock.json index 9737db2f..b99a4777 100644 --- a/apps/contract-migration/scripts/package-lock.json +++ b/apps/contract-migration/scripts/package-lock.json @@ -1,2118 +1,37 @@ { - "name": "scripts", - "lockfileVersion": 2, "requires": true, - "packages": { - "": { - "dependencies": { - "cic-client-meta": "^0.0.7-alpha.5", - "vcard-parser": "^1.0.0" - } - }, - "node_modules/@ethereumjs/common": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/@ethereumjs/common/-/common-2.0.0.tgz", - "integrity": "sha512-yL0zA7Xwgz8IFHKW0VoXGjdZDVxUJg8BQ/muMHvYPW7zHJNNC80gQmvLH+MpvIg1TCXZkFXxrpYRAyCElSm+aw==", - "dependencies": { - "crc-32": "^1.2.0" - } - }, - "node_modules/@ethereumjs/tx": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/@ethereumjs/tx/-/tx-3.0.2.tgz", - "integrity": "sha512-zmFCosjOdj1WoYEiQBdC4sCOAllBEwxdKuY85L9FgZ4zVDfZUVsQ4S9paczt4hVt65A7N8sJwgVEzDaQmrRaqw==", - "dependencies": { - "@ethereumjs/common": "^2.0.0", - "ethereumjs-util": "^7.0.8" - } - }, - "node_modules/@types/bn.js": { - "version": "4.11.6", - "resolved": "https://registry.npmjs.org/@types/bn.js/-/bn.js-4.11.6.tgz", - "integrity": "sha512-pqr857jrp2kPuO9uRjZ3PwnJTjoQy+fcdxvBTvHm6dkmEL9q+hDD/2j/0ELOBPtPnS8LjCX0gI9nbl8lVkadpg==", - "dependencies": { - "@types/node": "*" - } - }, - "node_modules/@types/node": { - "version": "14.14.30", - "resolved": "https://registry.npmjs.org/@types/node/-/node-14.14.30.tgz", - "integrity": "sha512-gUWhy8s45fQp4PqqKecsnOkdW0kt1IaKjgOIR3HPokkzTmQj9ji2wWFID5THu1MKrtO+d4s2lVrlEhXUsPXSvg==" - }, - "node_modules/@types/pbkdf2": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/@types/pbkdf2/-/pbkdf2-3.1.0.tgz", - "integrity": "sha512-Cf63Rv7jCQ0LaL8tNXmEyqTHuIJxRdlS5vMh1mj5voN4+QFhVZnlZruezqpWYDiJ8UTzhP0VmeLXCmBk66YrMQ==", - "dependencies": { - "@types/node": "*" - } - }, - "node_modules/@types/secp256k1": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/@types/secp256k1/-/secp256k1-4.0.1.tgz", - "integrity": "sha512-+ZjSA8ELlOp8SlKi0YLB2tz9d5iPNEmOBd+8Rz21wTMdaXQIa9b6TEnD6l5qKOCypE7FSyPyck12qZJxSDNoog==", - "dependencies": { - "@types/node": "*" - } - }, - "node_modules/abbrev": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", - "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==" - }, - "node_modules/aes-js": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/aes-js/-/aes-js-3.1.2.tgz", - "integrity": "sha512-e5pEa2kBnBOgR4Y/p20pskXI74UEz7de8ZGVo58asOtvSVG5YAbJeELPZxOmt+Bnz3rX753YKhfIn4X4l1PPRQ==" - }, - "node_modules/ajv": { - "version": "6.12.6", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", - "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", - "optional": true, - "dependencies": { - "fast-deep-equal": "^3.1.1", - "fast-json-stable-stringify": "^2.0.0", - "json-schema-traverse": "^0.4.1", - "uri-js": "^4.2.2" - } - }, - "node_modules/ansi-regex": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", - "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/aproba": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/aproba/-/aproba-1.2.0.tgz", - "integrity": "sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw==" - }, - "node_modules/are-we-there-yet": { - "version": "1.1.5", - "resolved": "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-1.1.5.tgz", - "integrity": "sha512-5hYdAkZlcG8tOLujVDTgCT+uPX0VnpAH28gWsLfzpXYm7wP6mp5Q/gYyR7YQ0cKVJcXJnl3j2kpBan13PtQf6w==", - "dependencies": { - "delegates": "^1.0.0", - "readable-stream": "^2.0.6" - } - }, - "node_modules/are-we-there-yet/node_modules/readable-stream": { - "version": "2.3.7", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", - "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", - "dependencies": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - } - }, - "node_modules/are-we-there-yet/node_modules/safe-buffer": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" - }, - "node_modules/are-we-there-yet/node_modules/string_decoder": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", - "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", - "dependencies": { - "safe-buffer": "~5.1.0" - } - }, - "node_modules/asn1": { - "version": "0.2.4", - "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.4.tgz", - "integrity": "sha512-jxwzQpLQjSmWXgwaCZE9Nz+glAG01yF1QnWgbhGwHI5A6FRIEY6IVqtHhIepHqI7/kyEyQEagBC5mBEFlIYvdg==", - "optional": true, - "dependencies": { - "safer-buffer": "~2.1.0" - } - }, - "node_modules/asn1.js": { - "version": "5.4.1", - "resolved": "https://registry.npmjs.org/asn1.js/-/asn1.js-5.4.1.tgz", - "integrity": "sha512-+I//4cYPccV8LdmBLiX8CYvf9Sp3vQsrqu2QNXRcrbiWvcx/UdlFiqUJJzxRQxgsZmvhXhn4cSKeSmoFjVdupA==", - "dependencies": { - "bn.js": "^4.0.0", - "inherits": "^2.0.1", - "minimalistic-assert": "^1.0.0", - "safer-buffer": "^2.1.0" - } - }, - "node_modules/asn1.js/node_modules/bn.js": { - "version": "4.11.9", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.9.tgz", - "integrity": "sha512-E6QoYqCKZfgatHTdHzs1RRKP7ip4vvm+EyRUeE2RF0NblwVvb0p6jSVeNTOFxPn26QXN2o6SMfNxKp6kU8zQaw==" - }, - "node_modules/assert-plus": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", - "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=", - "optional": true, - "engines": { - "node": ">=0.8" - } - }, - "node_modules/asynckit": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", - "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=", - "optional": true - }, - "node_modules/automerge": { - "version": "0.14.2", - "resolved": "https://registry.npmjs.org/automerge/-/automerge-0.14.2.tgz", - "integrity": "sha512-shiwuJHCbNRI23WZyIECLV4Ovf3WiAFJ7P9BH4l5gON1In/UUbjcSJKRygtIirObw2UQumeYxp3F2XBdSvQHnA==", - "dependencies": { - "immutable": "^3.8.2", - "transit-immutable-js": "^0.7.0", - "transit-js": "^0.8.861", - "uuid": "^3.4.0" - } - }, - "node_modules/aws-sign2": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", - "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=", - "optional": true, - "engines": { - "node": "*" - } - }, - "node_modules/aws4": { - "version": "1.11.0", - "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.11.0.tgz", - "integrity": "sha512-xh1Rl34h6Fi1DC2WWKfxUTVqRsNnr6LsKz2+hfwDxQJWmrx8+c7ylaqBMcHfl1U1r2dsifOvKX3LQuLNZ+XSvA==", - "optional": true - }, - "node_modules/balanced-match": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", - "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=" - }, - "node_modules/base-x": { - "version": "3.0.8", - "resolved": "https://registry.npmjs.org/base-x/-/base-x-3.0.8.tgz", - "integrity": "sha512-Rl/1AWP4J/zRrk54hhlxH4drNxPJXYUaKffODVI53/dAsV4t9fBxyxYKAVPU1XBHxYwOWP9h9H0hM2MVw4YfJA==", - "dependencies": { - "safe-buffer": "^5.0.1" - } - }, - "node_modules/bcrypt-pbkdf": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", - "integrity": "sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4=", - "optional": true, - "dependencies": { - "tweetnacl": "^0.14.3" - } - }, - "node_modules/blakejs": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/blakejs/-/blakejs-1.1.0.tgz", - "integrity": "sha1-ad+S75U6qIylGjLfarHFShVfx6U=" - }, - "node_modules/block-stream": { - "version": "0.0.9", - "resolved": "https://registry.npmjs.org/block-stream/-/block-stream-0.0.9.tgz", - "integrity": "sha1-E+v+d4oDIFz+A3UUgeu0szAMEmo=", - "optional": true, - "dependencies": { - "inherits": "~2.0.0" - }, - "engines": { - "node": "0.4 || >=0.5.8" - } - }, - "node_modules/bn.js": { - "version": "5.1.3", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.1.3.tgz", - "integrity": "sha512-GkTiFpjFtUzU9CbMeJ5iazkCzGL3jrhzerzZIuqLABjbwRaFt33I9tUdSNryIptM+RxDet6OKm2WnLXzW51KsQ==" - }, - "node_modules/brace-expansion": { - "version": "1.1.11", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", - "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", - "dependencies": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, - "node_modules/brorand": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/brorand/-/brorand-1.1.0.tgz", - "integrity": "sha1-EsJe/kCkXjwyPrhnWgoM5XsiNx8=" - }, - "node_modules/browserify-aes": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/browserify-aes/-/browserify-aes-1.2.0.tgz", - "integrity": "sha512-+7CHXqGuspUn/Sl5aO7Ea0xWGAtETPXNSAjHo48JfLdPWcMng33Xe4znFvQweqc/uzk5zSOI3H52CYnjCfb5hA==", - "dependencies": { - "buffer-xor": "^1.0.3", - "cipher-base": "^1.0.0", - "create-hash": "^1.1.0", - "evp_bytestokey": "^1.0.3", - "inherits": "^2.0.1", - "safe-buffer": "^5.0.1" - } - }, - "node_modules/bs58": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/bs58/-/bs58-4.0.1.tgz", - "integrity": "sha1-vhYedsNU9veIrkBx9j806MTwpCo=", - "dependencies": { - "base-x": "^3.0.2" - } - }, - "node_modules/bs58check": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/bs58check/-/bs58check-2.1.2.tgz", - "integrity": "sha512-0TS1jicxdU09dwJMNZtVAfzPi6Q6QeN0pM1Fkzrjn+XYHvzMKPU3pHVpva+769iNVSfIYWf7LJ6WR+BuuMf8cA==", - "dependencies": { - "bs58": "^4.0.0", - "create-hash": "^1.1.0", - "safe-buffer": "^5.1.2" - } - }, - "node_modules/buffer-writer": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/buffer-writer/-/buffer-writer-2.0.0.tgz", - "integrity": "sha512-a7ZpuTZU1TRtnwyCNW3I5dc0wWNC3VR9S++Ewyk2HHZdrO3CQJqSpd+95Us590V6AL7JqUAH2IwZ/398PmNFgw==", - "engines": { - "node": ">=4" - } - }, - "node_modules/buffer-xor": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/buffer-xor/-/buffer-xor-1.0.3.tgz", - "integrity": "sha1-JuYe0UIvtw3ULm42cp7VHYVf6Nk=" - }, - "node_modules/caseless": { - "version": "0.12.0", - "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", - "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=", - "optional": true - }, - "node_modules/chownr": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.4.tgz", - "integrity": "sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg==" - }, - "node_modules/cic-client-meta": { - "version": "0.0.7-alpha.5", - "resolved": "https://registry.npmjs.org/cic-client-meta/-/cic-client-meta-0.0.7-alpha.5.tgz", - "integrity": "sha512-h+0wmAKZIgezppBNYDmG387w6tI91FSWqONMTZbMuaO1Ej76Gg0Mk2UcDyAF/dmY6doXz3kHAbWkWat7mTzXAQ==", - "dependencies": { - "@ethereumjs/tx": "^3.0.0-beta.1", - "automerge": "^0.14.1", - "ethereumjs-wallet": "^1.0.1", - "ini": "^1.3.5", - "openpgp": "^4.10.8", - "pg": "^8.4.2", - "sqlite3": "^5.0.0", - "yargs": "^16.1.0" - }, - "engines": { - "node": "~15.3.0" - } - }, - "node_modules/cipher-base": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/cipher-base/-/cipher-base-1.0.4.tgz", - "integrity": "sha512-Kkht5ye6ZGmwv40uUDZztayT2ThLQGfnj/T71N/XzeZeo3nf8foyW7zGTsPYkEya3m5f3cAypH+qe7YOrM1U2Q==", - "dependencies": { - "inherits": "^2.0.1", - "safe-buffer": "^5.0.1" - } - }, - "node_modules/cliui": { - "version": "7.0.4", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz", - "integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==", - "dependencies": { - "string-width": "^4.2.0", - "strip-ansi": "^6.0.0", - "wrap-ansi": "^7.0.0" - } - }, - "node_modules/cliui/node_modules/ansi-regex": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", - "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==", - "engines": { - "node": ">=8" - } - }, - "node_modules/cliui/node_modules/is-fullwidth-code-point": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", - "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", - "engines": { - "node": ">=8" - } - }, - "node_modules/cliui/node_modules/string-width": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.0.tgz", - "integrity": "sha512-zUz5JD+tgqtuDjMhwIg5uFVV3dtqZ9yQJlZVfq4I01/K5Paj5UHj7VyrQOJvzawSVlKpObApbfD0Ed6yJc+1eg==", - "dependencies": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/cliui/node_modules/strip-ansi": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", - "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", - "dependencies": { - "ansi-regex": "^5.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/code-point-at": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", - "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" - }, - "node_modules/combined-stream": { - "version": "1.0.8", - "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", - "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", - "optional": true, - "dependencies": { - "delayed-stream": "~1.0.0" - }, - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/concat-map": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=" - }, - "node_modules/console-control-strings": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz", - "integrity": "sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4=" - }, - "node_modules/core-util-is": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", - "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" - }, - "node_modules/crc-32": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/crc-32/-/crc-32-1.2.0.tgz", - "integrity": "sha512-1uBwHxF+Y/4yF5G48fwnKq6QsIXheor3ZLPT80yGBV1oEUwpPojlEhQbWKVw1VwcTQyMGHK1/XMmTjmlsmTTGA==", - "dependencies": { - "exit-on-epipe": "~1.0.1", - "printj": "~1.1.0" - }, - "bin": { - "crc32": "bin/crc32.njs" - }, - "engines": { - "node": ">=0.8" - } - }, - "node_modules/create-hash": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/create-hash/-/create-hash-1.2.0.tgz", - "integrity": "sha512-z00bCGNHDG8mHAkP7CtT1qVu+bFQUPjYq/4Iv3C3kWjTFV10zIjfSoeqXo9Asws8gwSHDGj/hl2u4OGIjapeCg==", - "dependencies": { - "cipher-base": "^1.0.1", - "inherits": "^2.0.1", - "md5.js": "^1.3.4", - "ripemd160": "^2.0.1", - "sha.js": "^2.4.0" - } - }, - "node_modules/create-hmac": { - "version": "1.1.7", - "resolved": "https://registry.npmjs.org/create-hmac/-/create-hmac-1.1.7.tgz", - "integrity": "sha512-MJG9liiZ+ogc4TzUwuvbER1JRdgvUFSB5+VR/g5h82fGaIRWMWddtKBHi7/sVhfjQZ6SehlyhvQYrcYkaUIpLg==", - "dependencies": { - "cipher-base": "^1.0.3", - "create-hash": "^1.1.0", - "inherits": "^2.0.1", - "ripemd160": "^2.0.0", - "safe-buffer": "^5.0.1", - "sha.js": "^2.4.8" - } - }, - "node_modules/dashdash": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", - "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=", - "optional": true, - "dependencies": { - "assert-plus": "^1.0.0" - }, - "engines": { - "node": ">=0.10" - } - }, - "node_modules/debug": { - "version": "3.2.7", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", - "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", - "dependencies": { - "ms": "^2.1.1" - } - }, - "node_modules/deep-extend": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz", - "integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==", - "engines": { - "node": ">=4.0.0" - } - }, - "node_modules/delayed-stream": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", - "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=", - "optional": true, - "engines": { - "node": ">=0.4.0" - } - }, - "node_modules/delegates": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz", - "integrity": "sha1-hMbhWbgZBP3KWaDvRM2HDTElD5o=" - }, - "node_modules/detect-libc": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-1.0.3.tgz", - "integrity": "sha1-+hN8S9aY7fVc1c0CrFWfkaTEups=", - "bin": { - "detect-libc": "bin/detect-libc.js" - }, - "engines": { - "node": ">=0.10" - } - }, - "node_modules/ecc-jsbn": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", - "integrity": "sha1-OoOpBOVDUyh4dMVkt1SThoSamMk=", - "optional": true, - "dependencies": { - "jsbn": "~0.1.0", - "safer-buffer": "^2.1.0" - } - }, - "node_modules/elliptic": { - "version": "6.5.4", - "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.4.tgz", - "integrity": "sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ==", - "dependencies": { - "bn.js": "^4.11.9", - "brorand": "^1.1.0", - "hash.js": "^1.0.0", - "hmac-drbg": "^1.0.1", - "inherits": "^2.0.4", - "minimalistic-assert": "^1.0.1", - "minimalistic-crypto-utils": "^1.0.1" - } - }, - "node_modules/elliptic/node_modules/bn.js": { - "version": "4.11.9", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.9.tgz", - "integrity": "sha512-E6QoYqCKZfgatHTdHzs1RRKP7ip4vvm+EyRUeE2RF0NblwVvb0p6jSVeNTOFxPn26QXN2o6SMfNxKp6kU8zQaw==" - }, - "node_modules/emoji-regex": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==" - }, - "node_modules/escalade": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", - "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==", - "engines": { - "node": ">=6" - } - }, - "node_modules/ethereum-cryptography": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/ethereum-cryptography/-/ethereum-cryptography-0.1.3.tgz", - "integrity": "sha512-w8/4x1SGGzc+tO97TASLja6SLd3fRIK2tLVcV2Gx4IB21hE19atll5Cq9o3d0ZmAYC/8aw0ipieTSiekAea4SQ==", - "dependencies": { - "@types/pbkdf2": "^3.0.0", - "@types/secp256k1": "^4.0.1", - "blakejs": "^1.1.0", - "browserify-aes": "^1.2.0", - "bs58check": "^2.1.2", - "create-hash": "^1.2.0", - "create-hmac": "^1.1.7", - "hash.js": "^1.1.7", - "keccak": "^3.0.0", - "pbkdf2": "^3.0.17", - "randombytes": "^2.1.0", - "safe-buffer": "^5.1.2", - "scrypt-js": "^3.0.0", - "secp256k1": "^4.0.1", - "setimmediate": "^1.0.5" - } - }, - "node_modules/ethereumjs-util": { - "version": "7.0.8", - "resolved": "https://registry.npmjs.org/ethereumjs-util/-/ethereumjs-util-7.0.8.tgz", - "integrity": "sha512-JJt7tDpCAmDPw/sGoFYeq0guOVqT3pTE9xlEbBmc/nlCij3JRCoS2c96SQ6kXVHOT3xWUNLDm5QCJLQaUnVAtQ==", - "dependencies": { - "@types/bn.js": "^4.11.3", - "bn.js": "^5.1.2", - "create-hash": "^1.1.2", - "ethereum-cryptography": "^0.1.3", - "ethjs-util": "0.1.6", - "rlp": "^2.2.4" - }, - "engines": { - "node": ">=10.0.0" - } - }, - "node_modules/ethereumjs-wallet": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/ethereumjs-wallet/-/ethereumjs-wallet-1.0.1.tgz", - "integrity": "sha512-3Z5g1hG1das0JWU6cQ9HWWTY2nt9nXCcwj7eXVNAHKbo00XAZO8+NHlwdgXDWrL0SXVQMvTWN8Q/82DRH/JhPw==", - "dependencies": { - "aes-js": "^3.1.1", - "bs58check": "^2.1.2", - "ethereum-cryptography": "^0.1.3", - "ethereumjs-util": "^7.0.2", - "randombytes": "^2.0.6", - "scrypt-js": "^3.0.1", - "utf8": "^3.0.0", - "uuid": "^3.3.2" - } - }, - "node_modules/ethjs-util": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/ethjs-util/-/ethjs-util-0.1.6.tgz", - "integrity": "sha512-CUnVOQq7gSpDHZVVrQW8ExxUETWrnrvXYvYz55wOU8Uj4VCgw56XC2B/fVqQN+f7gmrnRHSLVnFAwsCuNwji8w==", - "dependencies": { - "is-hex-prefixed": "1.0.0", - "strip-hex-prefix": "1.0.0" - }, - "engines": { - "node": ">=6.5.0", - "npm": ">=3" - } - }, - "node_modules/evp_bytestokey": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/evp_bytestokey/-/evp_bytestokey-1.0.3.tgz", - "integrity": "sha512-/f2Go4TognH/KvCISP7OUsHn85hT9nUkxxA9BEWxFn+Oj9o8ZNLm/40hdlgSLyuOimsrTKLUMEorQexp/aPQeA==", - "dependencies": { - "md5.js": "^1.3.4", - "safe-buffer": "^5.1.1" - } - }, - "node_modules/exit-on-epipe": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/exit-on-epipe/-/exit-on-epipe-1.0.1.tgz", - "integrity": "sha512-h2z5mrROTxce56S+pnvAV890uu7ls7f1kEvVGJbw1OlFH3/mlJ5bkXu0KRyW94v37zzHPiUd55iLn3DA7TjWpw==", - "engines": { - "node": ">=0.8" - } - }, - "node_modules/extend": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", - "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==", - "optional": true - }, - "node_modules/extsprintf": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", - "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=", - "engines": [ - "node >=0.6.0" - ], - "optional": true - }, - "node_modules/fast-deep-equal": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", - "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", - "optional": true - }, - "node_modules/fast-json-stable-stringify": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", - "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", - "optional": true - }, - "node_modules/forever-agent": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", - "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=", - "optional": true, - "engines": { - "node": "*" - } - }, - "node_modules/form-data": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.3.tgz", - "integrity": "sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ==", - "optional": true, - "dependencies": { - "asynckit": "^0.4.0", - "combined-stream": "^1.0.6", - "mime-types": "^2.1.12" - }, - "engines": { - "node": ">= 0.12" - } - }, - "node_modules/fs-minipass": { - "version": "1.2.7", - "resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-1.2.7.tgz", - "integrity": "sha512-GWSSJGFy4e9GUeCcbIkED+bgAoFyj7XF1mV8rma3QW4NIqX9Kyx79N/PF61H5udOV3aY1IaMLs6pGbH71nlCTA==", - "dependencies": { - "minipass": "^2.6.0" - } - }, - "node_modules/fs.realpath": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=" - }, - "node_modules/fstream": { - "version": "1.0.12", - "resolved": "https://registry.npmjs.org/fstream/-/fstream-1.0.12.tgz", - "integrity": "sha512-WvJ193OHa0GHPEL+AycEJgxvBEwyfRkN1vhjca23OaPVMCaLCXTd5qAu82AjTcgP1UJmytkOKb63Ypde7raDIg==", - "optional": true, - "dependencies": { - "graceful-fs": "^4.1.2", - "inherits": "~2.0.0", - "mkdirp": ">=0.5 0", - "rimraf": "2" - }, - "engines": { - "node": ">=0.6" - } - }, - "node_modules/gauge": { - "version": "2.7.4", - "resolved": "https://registry.npmjs.org/gauge/-/gauge-2.7.4.tgz", - "integrity": "sha1-LANAXHU4w51+s3sxcCLjJfsBi/c=", - "dependencies": { - "aproba": "^1.0.3", - "console-control-strings": "^1.0.0", - "has-unicode": "^2.0.0", - "object-assign": "^4.1.0", - "signal-exit": "^3.0.0", - "string-width": "^1.0.1", - "strip-ansi": "^3.0.1", - "wide-align": "^1.1.0" - } - }, - "node_modules/get-caller-file": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", - "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", - "engines": { - "node": "6.* || 8.* || >= 10.*" - } - }, - "node_modules/getpass": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", - "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=", - "optional": true, - "dependencies": { - "assert-plus": "^1.0.0" - } - }, - "node_modules/glob": { - "version": "7.1.6", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz", - "integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==", - "dependencies": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.0.4", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - }, - "engines": { - "node": "*" - } - }, - "node_modules/graceful-fs": { - "version": "4.2.6", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.6.tgz", - "integrity": "sha512-nTnJ528pbqxYanhpDYsi4Rd8MAeaBA67+RZ10CM1m3bTAVFEDcd5AuA4a6W5YkGZ1iNXHzZz8T6TBKLeBuNriQ==" - }, - "node_modules/har-schema": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", - "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=", - "optional": true, - "engines": { - "node": ">=4" - } - }, - "node_modules/har-validator": { - "version": "5.1.5", - "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.5.tgz", - "integrity": "sha512-nmT2T0lljbxdQZfspsno9hgrG3Uir6Ks5afism62poxqBM6sDnMEuPmzTq8XN0OEwqKLLdh1jQI3qyE66Nzb3w==", - "optional": true, - "dependencies": { - "ajv": "^6.12.3", - "har-schema": "^2.0.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/has-unicode": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz", - "integrity": "sha1-4Ob+aijPUROIVeCG0Wkedx3iqLk=" - }, - "node_modules/hash-base": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/hash-base/-/hash-base-3.1.0.tgz", - "integrity": "sha512-1nmYp/rhMDiE7AYkDw+lLwlAzz0AntGIe51F3RfFfEqyQ3feY2eI/NcwC6umIQVOASPMsWJLJScWKSSvzL9IVA==", - "dependencies": { - "inherits": "^2.0.4", - "readable-stream": "^3.6.0", - "safe-buffer": "^5.2.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/hash.js": { - "version": "1.1.7", - "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.7.tgz", - "integrity": "sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA==", - "dependencies": { - "inherits": "^2.0.3", - "minimalistic-assert": "^1.0.1" - } - }, - "node_modules/hmac-drbg": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz", - "integrity": "sha1-0nRXAQJabHdabFRXk+1QL8DGSaE=", - "dependencies": { - "hash.js": "^1.0.3", - "minimalistic-assert": "^1.0.0", - "minimalistic-crypto-utils": "^1.0.1" - } - }, - "node_modules/http-signature": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", - "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=", - "optional": true, - "dependencies": { - "assert-plus": "^1.0.0", - "jsprim": "^1.2.2", - "sshpk": "^1.7.0" - }, - "engines": { - "node": ">=0.8", - "npm": ">=1.3.7" - } - }, - "node_modules/iconv-lite": { - "version": "0.4.24", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", - "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", - "dependencies": { - "safer-buffer": ">= 2.1.2 < 3" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/ignore-walk": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/ignore-walk/-/ignore-walk-3.0.3.tgz", - "integrity": "sha512-m7o6xuOaT1aqheYHKf8W6J5pYH85ZI9w077erOzLje3JsB1gkafkAhHHY19dqjulgIZHFm32Cp5uNZgcQqdJKw==", - "dependencies": { - "minimatch": "^3.0.4" - } - }, - "node_modules/immutable": { - "version": "3.8.2", - "resolved": "https://registry.npmjs.org/immutable/-/immutable-3.8.2.tgz", - "integrity": "sha1-wkOZUUVbs5kT2vKBN28VMOEErfM=", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/imurmurhash": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", - "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=", - "engines": { - "node": ">=0.8.19" - } - }, - "node_modules/inflight": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", - "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", - "dependencies": { - "once": "^1.3.0", - "wrappy": "1" - } - }, - "node_modules/inherits": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" - }, - "node_modules/ini": { - "version": "1.3.8", - "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz", - "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==" - }, - "node_modules/is-fullwidth-code-point": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", - "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", - "dependencies": { - "number-is-nan": "^1.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/is-hex-prefixed": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-hex-prefixed/-/is-hex-prefixed-1.0.0.tgz", - "integrity": "sha1-fY035q135dEnFIkTxXPggtd39VQ=", - "engines": { - "node": ">=6.5.0", - "npm": ">=3" - } - }, - "node_modules/is-typedarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", - "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=", - "optional": true - }, - "node_modules/isarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" - }, - "node_modules/isexe": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", - "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", - "optional": true - }, - "node_modules/isstream": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", - "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=", - "optional": true - }, - "node_modules/jsbn": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", - "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=", - "optional": true - }, - "node_modules/json-schema": { - "version": "0.2.3", - "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz", - "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=", - "optional": true - }, - "node_modules/json-schema-traverse": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", - "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", - "optional": true - }, - "node_modules/json-stringify-safe": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", - "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=", - "optional": true - }, - "node_modules/jsprim": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", - "integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=", - "engines": [ - "node >=0.6.0" - ], - "optional": true, - "dependencies": { - "assert-plus": "1.0.0", - "extsprintf": "1.3.0", - "json-schema": "0.2.3", - "verror": "1.10.0" - } - }, - "node_modules/keccak": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/keccak/-/keccak-3.0.1.tgz", - "integrity": "sha512-epq90L9jlFWCW7+pQa6JOnKn2Xgl2mtI664seYR6MHskvI9agt7AnDqmAlp9TqU4/caMYbA08Hi5DMZAl5zdkA==", - "dependencies": { - "node-addon-api": "^2.0.0", - "node-gyp-build": "^4.2.0" - }, - "engines": { - "node": ">=10.0.0" - } - }, - "node_modules/md5.js": { - "version": "1.3.5", - "resolved": "https://registry.npmjs.org/md5.js/-/md5.js-1.3.5.tgz", - "integrity": "sha512-xitP+WxNPcTTOgnTJcrhM0xvdPepipPSf3I8EIpGKeFLjt3PlJLIDG3u8EX53ZIubkb+5U2+3rELYpEhHhzdkg==", - "dependencies": { - "hash-base": "^3.0.0", - "inherits": "^2.0.1", - "safe-buffer": "^5.1.2" - } - }, - "node_modules/mime-db": { - "version": "1.46.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.46.0.tgz", - "integrity": "sha512-svXaP8UQRZ5K7or+ZmfNhg2xX3yKDMUzqadsSqi4NCH/KomcH75MAMYAGVlvXn4+b/xOPhS3I2uHKRUzvjY7BQ==", - "optional": true, - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/mime-types": { - "version": "2.1.29", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.29.tgz", - "integrity": "sha512-Y/jMt/S5sR9OaqteJtslsFZKWOIIqMACsJSiHghlCAyhf7jfVYjKBmLiX8OgpWeW+fjJ2b+Az69aPFPkUOY6xQ==", - "optional": true, - "dependencies": { - "mime-db": "1.46.0" - }, - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/minimalistic-assert": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", - "integrity": "sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==" - }, - "node_modules/minimalistic-crypto-utils": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz", - "integrity": "sha1-9sAMHAsIIkblxNmd+4x8CDsrWCo=" - }, - "node_modules/minimatch": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", - "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", - "dependencies": { - "brace-expansion": "^1.1.7" - }, - "engines": { - "node": "*" - } - }, - "node_modules/minimist": { - "version": "1.2.5", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", - "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==" - }, - "node_modules/minipass": { - "version": "2.9.0", - "resolved": "https://registry.npmjs.org/minipass/-/minipass-2.9.0.tgz", - "integrity": "sha512-wxfUjg9WebH+CUDX/CdbRlh5SmfZiy/hpkxaRI16Y9W56Pa75sWgd/rvFilSgrauD9NyFymP/+JFV3KwzIsJeg==", - "dependencies": { - "safe-buffer": "^5.1.2", - "yallist": "^3.0.0" - } - }, - "node_modules/minizlib": { - "version": "1.3.3", - "resolved": "https://registry.npmjs.org/minizlib/-/minizlib-1.3.3.tgz", - "integrity": "sha512-6ZYMOEnmVsdCeTJVE0W9ZD+pVnE8h9Hma/iOwwRDsdQoePpoX56/8B6z3P9VNwppJuBKNRuFDRNRqRWexT9G9Q==", - "dependencies": { - "minipass": "^2.9.0" - } - }, - "node_modules/mkdirp": { - "version": "0.5.5", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz", - "integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==", - "dependencies": { - "minimist": "^1.2.5" - }, - "bin": { - "mkdirp": "bin/cmd.js" - } - }, - "node_modules/ms": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", - "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" - }, - "node_modules/needle": { - "version": "2.6.0", - "resolved": "https://registry.npmjs.org/needle/-/needle-2.6.0.tgz", - "integrity": "sha512-KKYdza4heMsEfSWD7VPUIz3zX2XDwOyX2d+geb4vrERZMT5RMU6ujjaD+I5Yr54uZxQ2w6XRTAhHBbSCyovZBg==", - "dependencies": { - "debug": "^3.2.6", - "iconv-lite": "^0.4.4", - "sax": "^1.2.4" - }, - "bin": { - "needle": "bin/needle" - }, - "engines": { - "node": ">= 4.4.x" - } - }, - "node_modules/node-addon-api": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-2.0.2.tgz", - "integrity": "sha512-Ntyt4AIXyaLIuMHF6IOoTakB3K+RWxwtsHNRxllEoA6vPwP9o4866g6YWDLUdnucilZhmkxiHwHr11gAENw+QA==" - }, - "node_modules/node-fetch": { - "version": "2.6.1", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.1.tgz", - "integrity": "sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw==", - "engines": { - "node": "4.x || >=6.0.0" - } - }, - "node_modules/node-gyp": { - "version": "3.8.0", - "resolved": "https://registry.npmjs.org/node-gyp/-/node-gyp-3.8.0.tgz", - "integrity": "sha512-3g8lYefrRRzvGeSowdJKAKyks8oUpLEd/DyPV4eMhVlhJ0aNaZqIrNUIPuEWWTAoPqyFkfGrM67MC69baqn6vA==", - "optional": true, - "dependencies": { - "fstream": "^1.0.0", - "glob": "^7.0.3", - "graceful-fs": "^4.1.2", - "mkdirp": "^0.5.0", - "nopt": "2 || 3", - "npmlog": "0 || 1 || 2 || 3 || 4", - "osenv": "0", - "request": "^2.87.0", - "rimraf": "2", - "semver": "~5.3.0", - "tar": "^2.0.0", - "which": "1" - }, - "bin": { - "node-gyp": "bin/node-gyp.js" - }, - "engines": { - "node": ">= 0.8.0" - } - }, - "node_modules/node-gyp-build": { - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.2.3.tgz", - "integrity": "sha512-MN6ZpzmfNCRM+3t57PTJHgHyw/h4OWnZ6mR8P5j/uZtqQr46RRuDE/P+g3n0YR/AiYXeWixZZzaip77gdICfRg==", - "bin": { - "node-gyp-build": "bin.js", - "node-gyp-build-optional": "optional.js", - "node-gyp-build-test": "build-test.js" - } - }, - "node_modules/node-localstorage": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/node-localstorage/-/node-localstorage-1.3.1.tgz", - "integrity": "sha512-NMWCSWWc6JbHT5PyWlNT2i8r7PgGYXVntmKawY83k/M0UJScZ5jirb61TLnqKwd815DfBQu+lR3sRw08SPzIaQ==", - "dependencies": { - "write-file-atomic": "^1.1.4" - }, - "engines": { - "node": ">=0.12" - } - }, - "node_modules/node-pre-gyp": { - "version": "0.11.0", - "resolved": "https://registry.npmjs.org/node-pre-gyp/-/node-pre-gyp-0.11.0.tgz", - "integrity": "sha512-TwWAOZb0j7e9eGaf9esRx3ZcLaE5tQ2lvYy1pb5IAaG1a2e2Kv5Lms1Y4hpj+ciXJRofIxxlt5haeQ/2ANeE0Q==", - "dependencies": { - "detect-libc": "^1.0.2", - "mkdirp": "^0.5.1", - "needle": "^2.2.1", - "nopt": "^4.0.1", - "npm-packlist": "^1.1.6", - "npmlog": "^4.0.2", - "rc": "^1.2.7", - "rimraf": "^2.6.1", - "semver": "^5.3.0", - "tar": "^4" - }, - "bin": { - "node-pre-gyp": "bin/node-pre-gyp" - } - }, - "node_modules/node-pre-gyp/node_modules/nopt": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/nopt/-/nopt-4.0.3.tgz", - "integrity": "sha512-CvaGwVMztSMJLOeXPrez7fyfObdZqNUK1cPAEzLHrTybIua9pMdmmPR5YwtfNftIOMv3DPUhFaxsZMNTQO20Kg==", - "dependencies": { - "abbrev": "1", - "osenv": "^0.1.4" - }, - "bin": { - "nopt": "bin/nopt.js" - } - }, - "node_modules/node-pre-gyp/node_modules/tar": { - "version": "4.4.13", - "resolved": "https://registry.npmjs.org/tar/-/tar-4.4.13.tgz", - "integrity": "sha512-w2VwSrBoHa5BsSyH+KxEqeQBAllHhccyMFVHtGtdMpF4W7IRWfZjFiQceJPChOeTsSDVUpER2T8FA93pr0L+QA==", - "dependencies": { - "chownr": "^1.1.1", - "fs-minipass": "^1.2.5", - "minipass": "^2.8.6", - "minizlib": "^1.2.1", - "mkdirp": "^0.5.0", - "safe-buffer": "^5.1.2", - "yallist": "^3.0.3" - }, - "engines": { - "node": ">=4.5" - } - }, - "node_modules/nopt": { - "version": "3.0.6", - "resolved": "https://registry.npmjs.org/nopt/-/nopt-3.0.6.tgz", - "integrity": "sha1-xkZdvwirzU2zWTF/eaxopkayj/k=", - "optional": true, - "dependencies": { - "abbrev": "1" - }, - "bin": { - "nopt": "bin/nopt.js" - } - }, - "node_modules/npm-bundled": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/npm-bundled/-/npm-bundled-1.1.1.tgz", - "integrity": "sha512-gqkfgGePhTpAEgUsGEgcq1rqPXA+tv/aVBlgEzfXwA1yiUJF7xtEt3CtVwOjNYQOVknDk0F20w58Fnm3EtG0fA==", - "dependencies": { - "npm-normalize-package-bin": "^1.0.1" - } - }, - "node_modules/npm-normalize-package-bin": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/npm-normalize-package-bin/-/npm-normalize-package-bin-1.0.1.tgz", - "integrity": "sha512-EPfafl6JL5/rU+ot6P3gRSCpPDW5VmIzX959Ob1+ySFUuuYHWHekXpwdUZcKP5C+DS4GEtdJluwBjnsNDl+fSA==" - }, - "node_modules/npm-packlist": { - "version": "1.4.8", - "resolved": "https://registry.npmjs.org/npm-packlist/-/npm-packlist-1.4.8.tgz", - "integrity": "sha512-5+AZgwru5IevF5ZdnFglB5wNlHG1AOOuw28WhUq8/8emhBmLv6jX5by4WJCh7lW0uSYZYS6DXqIsyZVIXRZU9A==", - "dependencies": { - "ignore-walk": "^3.0.1", - "npm-bundled": "^1.0.1", - "npm-normalize-package-bin": "^1.0.1" - } - }, - "node_modules/npmlog": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/npmlog/-/npmlog-4.1.2.tgz", - "integrity": "sha512-2uUqazuKlTaSI/dC8AzicUck7+IrEaOnN/e0jd3Xtt1KcGpwx30v50mL7oPyr/h9bL3E4aZccVwpwP+5W9Vjkg==", - "dependencies": { - "are-we-there-yet": "~1.1.2", - "console-control-strings": "~1.1.0", - "gauge": "~2.7.3", - "set-blocking": "~2.0.0" - } - }, - "node_modules/number-is-nan": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", - "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/oauth-sign": { - "version": "0.9.0", - "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz", - "integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==", - "optional": true, - "engines": { - "node": "*" - } - }, - "node_modules/object-assign": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", - "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/once": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", - "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", - "dependencies": { - "wrappy": "1" - } - }, - "node_modules/openpgp": { - "version": "4.10.10", - "resolved": "https://registry.npmjs.org/openpgp/-/openpgp-4.10.10.tgz", - "integrity": "sha512-Ub48OogGPjNsr0G/wnJ/SyAQzt/tfcXZTWVZdjKFpXCQV1Ca+upFdSPPkBlGG3lb9EQGOKZJ2tzYNH6ZyKMkDQ==", - "dependencies": { - "asn1.js": "^5.0.0", - "node-fetch": "^2.1.2", - "node-localstorage": "~1.3.0" - }, - "engines": { - "node": ">= 8.0.0" - } - }, - "node_modules/os-homedir": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", - "integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/os-tmpdir": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", - "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/osenv": { - "version": "0.1.5", - "resolved": "https://registry.npmjs.org/osenv/-/osenv-0.1.5.tgz", - "integrity": "sha512-0CWcCECdMVc2Rw3U5w9ZjqX6ga6ubk1xDVKxtBQPK7wis/0F2r9T6k4ydGYhecl7YUBxBVxhL5oisPsNxAPe2g==", - "dependencies": { - "os-homedir": "^1.0.0", - "os-tmpdir": "^1.0.0" - } - }, - "node_modules/packet-reader": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/packet-reader/-/packet-reader-1.0.0.tgz", - "integrity": "sha512-HAKu/fG3HpHFO0AA8WE8q2g+gBJaZ9MG7fcKk+IJPLTGAD6Psw4443l+9DGRbOIh3/aXr7Phy0TjilYivJo5XQ==" - }, - "node_modules/path-is-absolute": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", - "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/pbkdf2": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/pbkdf2/-/pbkdf2-3.1.1.tgz", - "integrity": "sha512-4Ejy1OPxi9f2tt1rRV7Go7zmfDQ+ZectEQz3VGUQhgq62HtIRPDyG/JtnwIxs6x3uNMwo2V7q1fMvKjb+Tnpqg==", - "dependencies": { - "create-hash": "^1.1.2", - "create-hmac": "^1.1.4", - "ripemd160": "^2.0.1", - "safe-buffer": "^5.0.1", - "sha.js": "^2.4.8" - }, - "engines": { - "node": ">=0.12" - } - }, - "node_modules/performance-now": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", - "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=", - "optional": true - }, - "node_modules/pg": { - "version": "8.5.1", - "resolved": "https://registry.npmjs.org/pg/-/pg-8.5.1.tgz", - "integrity": "sha512-9wm3yX9lCfjvA98ybCyw2pADUivyNWT/yIP4ZcDVpMN0og70BUWYEGXPCTAQdGTAqnytfRADb7NERrY1qxhIqw==", - "dependencies": { - "buffer-writer": "2.0.0", - "packet-reader": "1.0.0", - "pg-connection-string": "^2.4.0", - "pg-pool": "^3.2.2", - "pg-protocol": "^1.4.0", - "pg-types": "^2.1.0", - "pgpass": "1.x" - }, - "engines": { - "node": ">= 8.0.0" - } - }, - "node_modules/pg-connection-string": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/pg-connection-string/-/pg-connection-string-2.4.0.tgz", - "integrity": "sha512-3iBXuv7XKvxeMrIgym7njT+HlZkwZqqGX4Bu9cci8xHZNT+Um1gWKqCsAzcC0d95rcKMU5WBg6YRUcHyV0HZKQ==" - }, - "node_modules/pg-int8": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/pg-int8/-/pg-int8-1.0.1.tgz", - "integrity": "sha512-WCtabS6t3c8SkpDBUlb1kjOs7l66xsGdKpIPZsg4wR+B3+u9UAum2odSsF9tnvxg80h4ZxLWMy4pRjOsFIqQpw==", - "engines": { - "node": ">=4.0.0" - } - }, - "node_modules/pg-pool": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/pg-pool/-/pg-pool-3.2.2.tgz", - "integrity": "sha512-ORJoFxAlmmros8igi608iVEbQNNZlp89diFVx6yV5v+ehmpMY9sK6QgpmgoXbmkNaBAx8cOOZh9g80kJv1ooyA==" - }, - "node_modules/pg-protocol": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/pg-protocol/-/pg-protocol-1.4.0.tgz", - "integrity": "sha512-El+aXWcwG/8wuFICMQjM5ZSAm6OWiJicFdNYo+VY3QP+8vI4SvLIWVe51PppTzMhikUJR+PsyIFKqfdXPz/yxA==" - }, - "node_modules/pg-types": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/pg-types/-/pg-types-2.2.0.tgz", - "integrity": "sha512-qTAAlrEsl8s4OiEQY69wDvcMIdQN6wdz5ojQiOy6YRMuynxenON0O5oCpJI6lshc6scgAY8qvJ2On/p+CXY0GA==", - "dependencies": { - "pg-int8": "1.0.1", - "postgres-array": "~2.0.0", - "postgres-bytea": "~1.0.0", - "postgres-date": "~1.0.4", - "postgres-interval": "^1.1.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/pgpass": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/pgpass/-/pgpass-1.0.4.tgz", - "integrity": "sha512-YmuA56alyBq7M59vxVBfPJrGSozru8QAdoNlWuW3cz8l+UX3cWge0vTvjKhsSHSJpo3Bom8/Mm6hf0TR5GY0+w==", - "dependencies": { - "split2": "^3.1.1" - } - }, - "node_modules/postgres-array": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/postgres-array/-/postgres-array-2.0.0.tgz", - "integrity": "sha512-VpZrUqU5A69eQyW2c5CA1jtLecCsN2U/bD6VilrFDWq5+5UIEVO7nazS3TEcHf1zuPYO/sqGvUvW62g86RXZuA==", - "engines": { - "node": ">=4" - } - }, - "node_modules/postgres-bytea": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/postgres-bytea/-/postgres-bytea-1.0.0.tgz", - "integrity": "sha1-AntTPAqokOJtFy1Hz5zOzFIazTU=", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/postgres-date": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/postgres-date/-/postgres-date-1.0.7.tgz", - "integrity": "sha512-suDmjLVQg78nMK2UZ454hAG+OAW+HQPZ6n++TNDUX+L0+uUlLywnoxJKDou51Zm+zTCjrCl0Nq6J9C5hP9vK/Q==", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/postgres-interval": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/postgres-interval/-/postgres-interval-1.2.0.tgz", - "integrity": "sha512-9ZhXKM/rw350N1ovuWHbGxnGh/SNJ4cnxHiM0rxE4VN41wsg8P8zWn9hv/buK00RP4WvlOyr/RBDiptyxVbkZQ==", - "dependencies": { - "xtend": "^4.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/printj": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/printj/-/printj-1.1.2.tgz", - "integrity": "sha512-zA2SmoLaxZyArQTOPj5LXecR+RagfPSU5Kw1qP+jkWeNlrq+eJZyY2oS68SU1Z/7/myXM4lo9716laOFAVStCQ==", - "bin": { - "printj": "bin/printj.njs" - }, - "engines": { - "node": ">=0.8" - } - }, - "node_modules/process-nextick-args": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", - "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==" - }, - "node_modules/psl": { - "version": "1.8.0", - "resolved": "https://registry.npmjs.org/psl/-/psl-1.8.0.tgz", - "integrity": "sha512-RIdOzyoavK+hA18OGGWDqUTsCLhtA7IcZ/6NCs4fFJaHBDab+pDDmDIByWFRQJq2Cd7r1OoQxBGKOaztq+hjIQ==", - "optional": true - }, - "node_modules/punycode": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", - "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==", - "optional": true, - "engines": { - "node": ">=6" - } - }, - "node_modules/qs": { - "version": "6.5.2", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz", - "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==", - "optional": true, - "engines": { - "node": ">=0.6" - } - }, - "node_modules/randombytes": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", - "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", - "dependencies": { - "safe-buffer": "^5.1.0" - } - }, - "node_modules/rc": { - "version": "1.2.8", - "resolved": "https://registry.npmjs.org/rc/-/rc-1.2.8.tgz", - "integrity": "sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==", - "dependencies": { - "deep-extend": "^0.6.0", - "ini": "~1.3.0", - "minimist": "^1.2.0", - "strip-json-comments": "~2.0.1" - }, - "bin": { - "rc": "cli.js" - } - }, - "node_modules/readable-stream": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", - "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", - "dependencies": { - "inherits": "^2.0.3", - "string_decoder": "^1.1.1", - "util-deprecate": "^1.0.1" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/request": { - "version": "2.88.2", - "resolved": "https://registry.npmjs.org/request/-/request-2.88.2.tgz", - "integrity": "sha512-MsvtOrfG9ZcrOwAW+Qi+F6HbD0CWXEh9ou77uOb7FM2WPhwT7smM833PzanhJLsgXjN89Ir6V2PczXNnMpwKhw==", - "optional": true, - "dependencies": { - "aws-sign2": "~0.7.0", - "aws4": "^1.8.0", - "caseless": "~0.12.0", - "combined-stream": "~1.0.6", - "extend": "~3.0.2", - "forever-agent": "~0.6.1", - "form-data": "~2.3.2", - "har-validator": "~5.1.3", - "http-signature": "~1.2.0", - "is-typedarray": "~1.0.0", - "isstream": "~0.1.2", - "json-stringify-safe": "~5.0.1", - "mime-types": "~2.1.19", - "oauth-sign": "~0.9.0", - "performance-now": "^2.1.0", - "qs": "~6.5.2", - "safe-buffer": "^5.1.2", - "tough-cookie": "~2.5.0", - "tunnel-agent": "^0.6.0", - "uuid": "^3.3.2" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/require-directory": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", - "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/rimraf": { - "version": "2.7.1", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz", - "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==", - "dependencies": { - "glob": "^7.1.3" - }, - "bin": { - "rimraf": "bin.js" - } - }, - "node_modules/ripemd160": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/ripemd160/-/ripemd160-2.0.2.tgz", - "integrity": "sha512-ii4iagi25WusVoiC4B4lq7pbXfAp3D9v5CwfkY33vffw2+pkDjY1D8GaN7spsxvCSx8dkPqOZCEZyfxcmJG2IA==", - "dependencies": { - "hash-base": "^3.0.0", - "inherits": "^2.0.1" - } - }, - "node_modules/rlp": { - "version": "2.2.6", - "resolved": "https://registry.npmjs.org/rlp/-/rlp-2.2.6.tgz", - "integrity": "sha512-HAfAmL6SDYNWPUOJNrM500x4Thn4PZsEy5pijPh40U9WfNk0z15hUYzO9xVIMAdIHdFtD8CBDHd75Td1g36Mjg==", - "dependencies": { - "bn.js": "^4.11.1" - }, - "bin": { - "rlp": "bin/rlp" - } - }, - "node_modules/rlp/node_modules/bn.js": { - "version": "4.11.9", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.9.tgz", - "integrity": "sha512-E6QoYqCKZfgatHTdHzs1RRKP7ip4vvm+EyRUeE2RF0NblwVvb0p6jSVeNTOFxPn26QXN2o6SMfNxKp6kU8zQaw==" - }, - "node_modules/safe-buffer": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", - "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==" - }, - "node_modules/safer-buffer": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", - "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" - }, - "node_modules/sax": { - "version": "1.2.4", - "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz", - "integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==" - }, - "node_modules/scrypt-js": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/scrypt-js/-/scrypt-js-3.0.1.tgz", - "integrity": "sha512-cdwTTnqPu0Hyvf5in5asVdZocVDTNRmR7XEcJuIzMjJeSHybHl7vpB66AzwTaIg6CLSbtjcxc8fqcySfnTkccA==" - }, - "node_modules/secp256k1": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/secp256k1/-/secp256k1-4.0.2.tgz", - "integrity": "sha512-UDar4sKvWAksIlfX3xIaQReADn+WFnHvbVujpcbr+9Sf/69odMwy2MUsz5CKLQgX9nsIyrjuxL2imVyoNHa3fg==", - "dependencies": { - "elliptic": "^6.5.2", - "node-addon-api": "^2.0.0", - "node-gyp-build": "^4.2.0" - }, - "engines": { - "node": ">=10.0.0" - } - }, - "node_modules/semver": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.3.0.tgz", - "integrity": "sha1-myzl094C0XxgEq0yaqa00M9U+U8=", - "bin": { - "semver": "bin/semver" - } - }, - "node_modules/set-blocking": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", - "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=" - }, - "node_modules/setimmediate": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.5.tgz", - "integrity": "sha1-KQy7Iy4waULX1+qbg3Mqt4VvgoU=" - }, - "node_modules/sha.js": { - "version": "2.4.11", - "resolved": "https://registry.npmjs.org/sha.js/-/sha.js-2.4.11.tgz", - "integrity": "sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ==", - "dependencies": { - "inherits": "^2.0.1", - "safe-buffer": "^5.0.1" - }, - "bin": { - "sha.js": "bin.js" - } - }, - "node_modules/signal-exit": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.3.tgz", - "integrity": "sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA==" - }, - "node_modules/slide": { - "version": "1.1.6", - "resolved": "https://registry.npmjs.org/slide/-/slide-1.1.6.tgz", - "integrity": "sha1-VusCfWW00tzmyy4tMsTUr8nh1wc=", - "engines": { - "node": "*" - } - }, - "node_modules/split2": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/split2/-/split2-3.2.2.tgz", - "integrity": "sha512-9NThjpgZnifTkJpzTZ7Eue85S49QwpNhZTq6GRJwObb6jnLFNGB7Qm73V5HewTROPyxD0C29xqmaI68bQtV+hg==", - "dependencies": { - "readable-stream": "^3.0.0" - } - }, - "node_modules/sqlite3": { - "version": "5.0.2", - "resolved": "https://registry.npmjs.org/sqlite3/-/sqlite3-5.0.2.tgz", - "integrity": "sha512-1SdTNo+BVU211Xj1csWa8lV6KM0CtucDwRyA0VHl91wEH1Mgh7RxUpI4rVvG7OhHrzCSGaVyW5g8vKvlrk9DJA==", - "dependencies": { - "node-addon-api": "^3.0.0", - "node-pre-gyp": "^0.11.0" - }, - "optionalDependencies": { - "node-gyp": "3.x" - } - }, - "node_modules/sqlite3/node_modules/node-addon-api": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-3.1.0.tgz", - "integrity": "sha512-flmrDNB06LIl5lywUz7YlNGZH/5p0M7W28k8hzd9Lshtdh1wshD2Y+U4h9LD6KObOy1f+fEVdgprPrEymjM5uw==" - }, - "node_modules/sshpk": { - "version": "1.16.1", - "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.16.1.tgz", - "integrity": "sha512-HXXqVUq7+pcKeLqqZj6mHFUMvXtOJt1uoUx09pFW6011inTMxqI8BA8PM95myrIyyKwdnzjdFjLiE6KBPVtJIg==", - "optional": true, - "dependencies": { - "asn1": "~0.2.3", - "assert-plus": "^1.0.0", - "bcrypt-pbkdf": "^1.0.0", - "dashdash": "^1.12.0", - "ecc-jsbn": "~0.1.1", - "getpass": "^0.1.1", - "jsbn": "~0.1.0", - "safer-buffer": "^2.0.2", - "tweetnacl": "~0.14.0" - }, - "bin": { - "sshpk-conv": "bin/sshpk-conv", - "sshpk-sign": "bin/sshpk-sign", - "sshpk-verify": "bin/sshpk-verify" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/string_decoder": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", - "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", - "dependencies": { - "safe-buffer": "~5.2.0" - } - }, - "node_modules/string-width": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", - "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", - "dependencies": { - "code-point-at": "^1.0.0", - "is-fullwidth-code-point": "^1.0.0", - "strip-ansi": "^3.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/strip-ansi": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", - "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", - "dependencies": { - "ansi-regex": "^2.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/strip-hex-prefix": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/strip-hex-prefix/-/strip-hex-prefix-1.0.0.tgz", - "integrity": "sha1-DF8VX+8RUTczd96du1iNoFUA428=", - "dependencies": { - "is-hex-prefixed": "1.0.0" - }, - "engines": { - "node": ">=6.5.0", - "npm": ">=3" - } - }, - "node_modules/strip-json-comments": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", - "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/tar": { - "version": "2.2.2", - "resolved": "https://registry.npmjs.org/tar/-/tar-2.2.2.tgz", - "integrity": "sha512-FCEhQ/4rE1zYv9rYXJw/msRqsnmlje5jHP6huWeBZ704jUTy02c5AZyWujpMR1ax6mVw9NyJMfuK2CMDWVIfgA==", - "optional": true, - "dependencies": { - "block-stream": "*", - "fstream": "^1.0.12", - "inherits": "2" - } - }, - "node_modules/tough-cookie": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.5.0.tgz", - "integrity": "sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g==", - "optional": true, - "dependencies": { - "psl": "^1.1.28", - "punycode": "^2.1.1" - }, - "engines": { - "node": ">=0.8" - } - }, - "node_modules/transit-immutable-js": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/transit-immutable-js/-/transit-immutable-js-0.7.0.tgz", - "integrity": "sha1-mT4lCJtjEf9AIUD1VidtbSUwBdk=" - }, - "node_modules/transit-js": { - "version": "0.8.867", - "resolved": "https://registry.npmjs.org/transit-js/-/transit-js-0.8.867.tgz", - "integrity": "sha512-rOwB4K0z/WZ+E2bV42iN9UV3mvGzmwSv/IpMOKdnFpawPAZT0d1L7f91Y+tZQF7lXSDGk+oln4XyIQXo+pyTGA==", - "engines": { - "node": ">= 0.10.0" - } - }, - "node_modules/tunnel-agent": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", - "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=", - "optional": true, - "dependencies": { - "safe-buffer": "^5.0.1" - }, - "engines": { - "node": "*" - } - }, - "node_modules/tweetnacl": { - "version": "0.14.5", - "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", - "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=", - "optional": true - }, - "node_modules/uri-js": { - "version": "4.4.1", - "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", - "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", - "optional": true, - "dependencies": { - "punycode": "^2.1.0" - } - }, - "node_modules/utf8": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/utf8/-/utf8-3.0.0.tgz", - "integrity": "sha512-E8VjFIQ/TyQgp+TZfS6l8yp/xWppSAHzidGiRrqe4bK4XP9pTRyKFgGJpO3SN7zdX4DeomTrwaseCHovfpFcqQ==" - }, - "node_modules/util-deprecate": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", - "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=" - }, - "node_modules/uuid": { - "version": "3.4.0", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz", - "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==", - "bin": { - "uuid": "bin/uuid" - } - }, - "node_modules/vcard-parser": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/vcard-parser/-/vcard-parser-1.0.0.tgz", - "integrity": "sha512-rSEjrjBK3of4VimMR5vBjLLcN5ZCSp9yuVzyx5i4Fwx74Yd0s+DnHtSit/wAAtj1a7/T/qQc0ykwXADoD0+fTQ==" - }, - "node_modules/verror": { - "version": "1.10.0", - "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", - "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=", - "engines": [ - "node >=0.6.0" - ], - "optional": true, - "dependencies": { - "assert-plus": "^1.0.0", - "core-util-is": "1.0.2", - "extsprintf": "^1.2.0" - } - }, - "node_modules/which": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", - "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", - "optional": true, - "dependencies": { - "isexe": "^2.0.0" - }, - "bin": { - "which": "bin/which" - } - }, - "node_modules/wide-align": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.3.tgz", - "integrity": "sha512-QGkOQc8XL6Bt5PwnsExKBPuMKBxnGxWWW3fU55Xt4feHozMUhdUMaBCk290qpm/wG5u/RSKzwdAC4i51YigihA==", - "dependencies": { - "string-width": "^1.0.2 || 2" - } - }, - "node_modules/wrap-ansi": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", - "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", - "dependencies": { - "ansi-styles": "^4.0.0", - "string-width": "^4.1.0", - "strip-ansi": "^6.0.0" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/wrap-ansi/node_modules/ansi-regex": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", - "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==", - "engines": { - "node": ">=8" - } - }, - "node_modules/wrap-ansi/node_modules/is-fullwidth-code-point": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", - "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", - "engines": { - "node": ">=8" - } - }, - "node_modules/wrap-ansi/node_modules/string-width": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.0.tgz", - "integrity": "sha512-zUz5JD+tgqtuDjMhwIg5uFVV3dtqZ9yQJlZVfq4I01/K5Paj5UHj7VyrQOJvzawSVlKpObApbfD0Ed6yJc+1eg==", - "dependencies": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/wrap-ansi/node_modules/strip-ansi": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", - "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", - "dependencies": { - "ansi-regex": "^5.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/wrappy": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" - }, - "node_modules/write-file-atomic": { - "version": "1.3.4", - "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-1.3.4.tgz", - "integrity": "sha1-+Aek8LHZ6ROuekgRLmzDrxmRtF8=", - "dependencies": { - "graceful-fs": "^4.1.11", - "imurmurhash": "^0.1.4", - "slide": "^1.1.5" - } - }, - "node_modules/xtend": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", - "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==", - "engines": { - "node": ">=0.4" - } - }, - "node_modules/y18n": { - "version": "5.0.5", - "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.5.tgz", - "integrity": "sha512-hsRUr4FFrvhhRH12wOdfs38Gy7k2FFzB9qgN9v3aLykRq0dRcdcpz5C9FxdS2NuhOrI/628b/KSTJ3rwHysYSg==", - "engines": { - "node": ">=10" - } - }, - "node_modules/yallist": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", - "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==" - }, - "node_modules/yargs": { - "version": "16.2.0", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz", - "integrity": "sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==", - "dependencies": { - "cliui": "^7.0.2", - "escalade": "^3.1.1", - "get-caller-file": "^2.0.5", - "require-directory": "^2.1.1", - "string-width": "^4.2.0", - "y18n": "^5.0.5", - "yargs-parser": "^20.2.2" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/yargs-parser": { - "version": "20.2.5", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.5.tgz", - "integrity": "sha512-jYRGS3zWy20NtDtK2kBgo/TlAoy5YUuhD9/LZ7z7W4j1Fdw2cqD0xEEclf8fxc8xjD6X5Qr+qQQwCEsP8iRiYg==", - "engines": { - "node": ">=10" - } - }, - "node_modules/yargs/node_modules/ansi-regex": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", - "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==", - "engines": { - "node": ">=8" - } - }, - "node_modules/yargs/node_modules/is-fullwidth-code-point": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", - "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", - "engines": { - "node": ">=8" - } - }, - "node_modules/yargs/node_modules/string-width": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.0.tgz", - "integrity": "sha512-zUz5JD+tgqtuDjMhwIg5uFVV3dtqZ9yQJlZVfq4I01/K5Paj5UHj7VyrQOJvzawSVlKpObApbfD0Ed6yJc+1eg==", - "dependencies": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/yargs/node_modules/strip-ansi": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", - "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", - "dependencies": { - "ansi-regex": "^5.0.0" - }, - "engines": { - "node": ">=8" - } - } - }, + "lockfileVersion": 1, "dependencies": { "@ethereumjs/common": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/@ethereumjs/common/-/common-2.0.0.tgz", - "integrity": "sha512-yL0zA7Xwgz8IFHKW0VoXGjdZDVxUJg8BQ/muMHvYPW7zHJNNC80gQmvLH+MpvIg1TCXZkFXxrpYRAyCElSm+aw==", + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/@ethereumjs/common/-/common-2.2.0.tgz", + "integrity": "sha512-PyQiTG00MJtBRkJmv46ChZL8u2XWxNBeAthznAUIUiefxPAXjbkuiCZOuncgJS34/XkMbNc9zMt/PlgKRBElig==", "requires": { - "crc-32": "^1.2.0" + "crc-32": "^1.2.0", + "ethereumjs-util": "^7.0.9" } }, "@ethereumjs/tx": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/@ethereumjs/tx/-/tx-3.0.2.tgz", - "integrity": "sha512-zmFCosjOdj1WoYEiQBdC4sCOAllBEwxdKuY85L9FgZ4zVDfZUVsQ4S9paczt4hVt65A7N8sJwgVEzDaQmrRaqw==", + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/@ethereumjs/tx/-/tx-3.1.3.tgz", + "integrity": "sha512-DJBu6cbwYtiPTFeCUR8DF5p+PF0jxs+0rALJZiEcTz2tiRPIEkM72GEbrkGuqzENLCzBrJHT43O0DxSYTqeo+g==", "requires": { - "@ethereumjs/common": "^2.0.0", - "ethereumjs-util": "^7.0.8" + "@ethereumjs/common": "^2.2.0", + "ethereumjs-util": "^7.0.10" } }, "@types/bn.js": { - "version": "4.11.6", - "resolved": "https://registry.npmjs.org/@types/bn.js/-/bn.js-4.11.6.tgz", - "integrity": "sha512-pqr857jrp2kPuO9uRjZ3PwnJTjoQy+fcdxvBTvHm6dkmEL9q+hDD/2j/0ELOBPtPnS8LjCX0gI9nbl8lVkadpg==", + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/@types/bn.js/-/bn.js-5.1.0.tgz", + "integrity": "sha512-QSSVYj7pYFN49kW77o2s9xTCwZ8F2xLbjLLSEVh8D2F4JUhZtPAGOFLTD+ffqksBx/u4cE/KImFjyhqCjn/LIA==", "requires": { "@types/node": "*" } }, "@types/node": { - "version": "14.14.30", - "resolved": "https://registry.npmjs.org/@types/node/-/node-14.14.30.tgz", - "integrity": "sha512-gUWhy8s45fQp4PqqKecsnOkdW0kt1IaKjgOIR3HPokkzTmQj9ji2wWFID5THu1MKrtO+d4s2lVrlEhXUsPXSvg==" + "version": "14.14.41", + "resolved": "https://registry.npmjs.org/@types/node/-/node-14.14.41.tgz", + "integrity": "sha512-dueRKfaJL4RTtSa7bWeTK1M+VH+Gns73oCgzvYfHZywRCoPSd8EkXBL0mZ9unPTveBn+D9phZBaxuzpwjWkW0g==" }, "@types/pbkdf2": { "version": "3.1.0", @@ -2123,9 +42,9 @@ } }, "@types/secp256k1": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/@types/secp256k1/-/secp256k1-4.0.1.tgz", - "integrity": "sha512-+ZjSA8ELlOp8SlKi0YLB2tz9d5iPNEmOBd+8Rz21wTMdaXQIa9b6TEnD6l5qKOCypE7FSyPyck12qZJxSDNoog==", + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/@types/secp256k1/-/secp256k1-4.0.2.tgz", + "integrity": "sha512-QMg+9v0bbNJ2peLuHRWxzmy0HRJIG6gFZNhaRSp7S3ggSbCCxiqQB2/ybvhXyhHOCequpNkrx7OavNhrWOsW0A==", "requires": { "@types/node": "*" } @@ -2229,9 +148,9 @@ }, "dependencies": { "bn.js": { - "version": "4.11.9", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.9.tgz", - "integrity": "sha512-E6QoYqCKZfgatHTdHzs1RRKP7ip4vvm+EyRUeE2RF0NblwVvb0p6jSVeNTOFxPn26QXN2o6SMfNxKp6kU8zQaw==" + "version": "4.12.0", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", + "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==" } } }, @@ -2271,9 +190,9 @@ "optional": true }, "balanced-match": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", - "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=" + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" }, "base-x": { "version": "3.0.8", @@ -2307,9 +226,9 @@ } }, "bn.js": { - "version": "5.1.3", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.1.3.tgz", - "integrity": "sha512-GkTiFpjFtUzU9CbMeJ5iazkCzGL3jrhzerzZIuqLABjbwRaFt33I9tUdSNryIptM+RxDet6OKm2WnLXzW51KsQ==" + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.0.tgz", + "integrity": "sha512-D7iWRBvnZE8ecXiLj/9wbxH7Tk79fAh8IHaTNq1RWRixsS02W+5qS+iE9yq6RYl0asXx5tw0bLhmT5pIfbSquw==" }, "brace-expansion": { "version": "1.1.11", @@ -2378,9 +297,9 @@ "integrity": "sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg==" }, "cic-client-meta": { - "version": "0.0.7-alpha.5", - "resolved": "https://registry.npmjs.org/cic-client-meta/-/cic-client-meta-0.0.7-alpha.5.tgz", - "integrity": "sha512-h+0wmAKZIgezppBNYDmG387w6tI91FSWqONMTZbMuaO1Ej76Gg0Mk2UcDyAF/dmY6doXz3kHAbWkWat7mTzXAQ==", + "version": "0.0.7-alpha.6", + "resolved": "https://registry.npmjs.org/cic-client-meta/-/cic-client-meta-0.0.7-alpha.6.tgz", + "integrity": "sha512-oIN1aHkPHfsxJKDV6k4f1kX2tcppw3Q+D1b4BoPh0hYjNKNb7gImBMWnGsy8uiD9W6SNYE4sIXyrtct8mvrhsw==", "requires": { "@ethereumjs/tx": "^3.0.0-beta.1", "automerge": "^0.14.1", @@ -2422,9 +341,9 @@ "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==" }, "string-width": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.0.tgz", - "integrity": "sha512-zUz5JD+tgqtuDjMhwIg5uFVV3dtqZ9yQJlZVfq4I01/K5Paj5UHj7VyrQOJvzawSVlKpObApbfD0Ed6yJc+1eg==", + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.2.tgz", + "integrity": "sha512-XBJbT3N4JhVumXE0eoLU9DCjcaF92KLNqTmFCnG1pf8duUxFGwtP6AD6nkjw9a3IdiRtL3E2w3JDiE/xi3vOeA==", "requires": { "emoji-regex": "^8.0.0", "is-fullwidth-code-point": "^3.0.0", @@ -2580,9 +499,9 @@ }, "dependencies": { "bn.js": { - "version": "4.11.9", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.9.tgz", - "integrity": "sha512-E6QoYqCKZfgatHTdHzs1RRKP7ip4vvm+EyRUeE2RF0NblwVvb0p6jSVeNTOFxPn26QXN2o6SMfNxKp6kU8zQaw==" + "version": "4.12.0", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", + "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==" } } }, @@ -2619,11 +538,11 @@ } }, "ethereumjs-util": { - "version": "7.0.8", - "resolved": "https://registry.npmjs.org/ethereumjs-util/-/ethereumjs-util-7.0.8.tgz", - "integrity": "sha512-JJt7tDpCAmDPw/sGoFYeq0guOVqT3pTE9xlEbBmc/nlCij3JRCoS2c96SQ6kXVHOT3xWUNLDm5QCJLQaUnVAtQ==", + "version": "7.0.10", + "resolved": "https://registry.npmjs.org/ethereumjs-util/-/ethereumjs-util-7.0.10.tgz", + "integrity": "sha512-c/xThw6A+EAnej5Xk5kOzFzyoSnw0WX0tSlZ6pAsfGVvQj3TItaDg9b1+Fz1RJXA+y2YksKwQnuzgt1eY6LKzw==", "requires": { - "@types/bn.js": "^4.11.3", + "@types/bn.js": "^5.1.0", "bn.js": "^5.1.2", "create-hash": "^1.1.2", "ethereum-cryptography": "^0.1.3", @@ -2980,18 +899,18 @@ } }, "mime-db": { - "version": "1.46.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.46.0.tgz", - "integrity": "sha512-svXaP8UQRZ5K7or+ZmfNhg2xX3yKDMUzqadsSqi4NCH/KomcH75MAMYAGVlvXn4+b/xOPhS3I2uHKRUzvjY7BQ==", + "version": "1.47.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.47.0.tgz", + "integrity": "sha512-QBmA/G2y+IfeS4oktet3qRZ+P5kPhCKRXxXnQEudYqUaEioAU1/Lq2us3D/t1Jfo4hE9REQPrbB7K5sOczJVIw==", "optional": true }, "mime-types": { - "version": "2.1.29", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.29.tgz", - "integrity": "sha512-Y/jMt/S5sR9OaqteJtslsFZKWOIIqMACsJSiHghlCAyhf7jfVYjKBmLiX8OgpWeW+fjJ2b+Az69aPFPkUOY6xQ==", + "version": "2.1.30", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.30.tgz", + "integrity": "sha512-crmjA4bLtR8m9qLpHvgxSChT+XoSlZi8J4n/aIdn3z92e/U47Z0V/yl+Wh9W046GgFVAmoNR/fmdbZYcSSIUeg==", "optional": true, "requires": { - "mime-db": "1.46.0" + "mime-db": "1.47.0" } }, "minimalistic-assert": { @@ -3249,9 +1168,9 @@ "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=" }, "pbkdf2": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/pbkdf2/-/pbkdf2-3.1.1.tgz", - "integrity": "sha512-4Ejy1OPxi9f2tt1rRV7Go7zmfDQ+ZectEQz3VGUQhgq62HtIRPDyG/JtnwIxs6x3uNMwo2V7q1fMvKjb+Tnpqg==", + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/pbkdf2/-/pbkdf2-3.1.2.tgz", + "integrity": "sha512-iuh7L6jA7JEGu2WxDwtQP1ddOpaJNC4KlDEFfdQajSGgGPNi4OyDc2R7QnbY2bR9QjBVGwgvTdNJZoE7RaxUMA==", "requires": { "create-hash": "^1.1.2", "create-hmac": "^1.1.4", @@ -3267,23 +1186,23 @@ "optional": true }, "pg": { - "version": "8.5.1", - "resolved": "https://registry.npmjs.org/pg/-/pg-8.5.1.tgz", - "integrity": "sha512-9wm3yX9lCfjvA98ybCyw2pADUivyNWT/yIP4ZcDVpMN0og70BUWYEGXPCTAQdGTAqnytfRADb7NERrY1qxhIqw==", + "version": "8.6.0", + "resolved": "https://registry.npmjs.org/pg/-/pg-8.6.0.tgz", + "integrity": "sha512-qNS9u61lqljTDFvmk/N66EeGq3n6Ujzj0FFyNMGQr6XuEv4tgNTXvJQTfJdcvGit5p5/DWPu+wj920hAJFI+QQ==", "requires": { "buffer-writer": "2.0.0", "packet-reader": "1.0.0", - "pg-connection-string": "^2.4.0", - "pg-pool": "^3.2.2", - "pg-protocol": "^1.4.0", + "pg-connection-string": "^2.5.0", + "pg-pool": "^3.3.0", + "pg-protocol": "^1.5.0", "pg-types": "^2.1.0", "pgpass": "1.x" } }, "pg-connection-string": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/pg-connection-string/-/pg-connection-string-2.4.0.tgz", - "integrity": "sha512-3iBXuv7XKvxeMrIgym7njT+HlZkwZqqGX4Bu9cci8xHZNT+Um1gWKqCsAzcC0d95rcKMU5WBg6YRUcHyV0HZKQ==" + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/pg-connection-string/-/pg-connection-string-2.5.0.tgz", + "integrity": "sha512-r5o/V/ORTA6TmUnyWZR9nCj1klXCO2CEKNRlVuJptZe85QuhFayC7WeMic7ndayT5IRIR0S0xFxFi2ousartlQ==" }, "pg-int8": { "version": "1.0.1", @@ -3291,14 +1210,14 @@ "integrity": "sha512-WCtabS6t3c8SkpDBUlb1kjOs7l66xsGdKpIPZsg4wR+B3+u9UAum2odSsF9tnvxg80h4ZxLWMy4pRjOsFIqQpw==" }, "pg-pool": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/pg-pool/-/pg-pool-3.2.2.tgz", - "integrity": "sha512-ORJoFxAlmmros8igi608iVEbQNNZlp89diFVx6yV5v+ehmpMY9sK6QgpmgoXbmkNaBAx8cOOZh9g80kJv1ooyA==" + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/pg-pool/-/pg-pool-3.3.0.tgz", + "integrity": "sha512-0O5huCql8/D6PIRFAlmccjphLYWC+JIzvUhSzXSpGaf+tjTZc4nn+Lr7mLXBbFJfvwbP0ywDv73EiaBsxn7zdg==" }, "pg-protocol": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/pg-protocol/-/pg-protocol-1.4.0.tgz", - "integrity": "sha512-El+aXWcwG/8wuFICMQjM5ZSAm6OWiJicFdNYo+VY3QP+8vI4SvLIWVe51PppTzMhikUJR+PsyIFKqfdXPz/yxA==" + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/pg-protocol/-/pg-protocol-1.5.0.tgz", + "integrity": "sha512-muRttij7H8TqRNu/DxrAJQITO4Ac7RmX3Klyr/9mJEOBeIpgnF8f9jAfRz5d3XwQZl5qBjF9gLsUtMPJE0vezQ==" }, "pg-types": { "version": "2.2.0", @@ -3459,9 +1378,9 @@ }, "dependencies": { "bn.js": { - "version": "4.11.9", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.9.tgz", - "integrity": "sha512-E6QoYqCKZfgatHTdHzs1RRKP7ip4vvm+EyRUeE2RF0NblwVvb0p6jSVeNTOFxPn26QXN2o6SMfNxKp6kU8zQaw==" + "version": "4.12.0", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", + "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==" } } }, @@ -3571,14 +1490,6 @@ "tweetnacl": "~0.14.0" } }, - "string_decoder": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", - "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", - "requires": { - "safe-buffer": "~5.2.0" - } - }, "string-width": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", @@ -3589,6 +1500,14 @@ "strip-ansi": "^3.0.0" } }, + "string_decoder": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", + "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", + "requires": { + "safe-buffer": "~5.2.0" + } + }, "strip-ansi": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", @@ -3734,9 +1653,9 @@ "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==" }, "string-width": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.0.tgz", - "integrity": "sha512-zUz5JD+tgqtuDjMhwIg5uFVV3dtqZ9yQJlZVfq4I01/K5Paj5UHj7VyrQOJvzawSVlKpObApbfD0Ed6yJc+1eg==", + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.2.tgz", + "integrity": "sha512-XBJbT3N4JhVumXE0eoLU9DCjcaF92KLNqTmFCnG1pf8duUxFGwtP6AD6nkjw9a3IdiRtL3E2w3JDiE/xi3vOeA==", "requires": { "emoji-regex": "^8.0.0", "is-fullwidth-code-point": "^3.0.0", @@ -3774,9 +1693,9 @@ "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==" }, "y18n": { - "version": "5.0.5", - "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.5.tgz", - "integrity": "sha512-hsRUr4FFrvhhRH12wOdfs38Gy7k2FFzB9qgN9v3aLykRq0dRcdcpz5C9FxdS2NuhOrI/628b/KSTJ3rwHysYSg==" + "version": "5.0.8", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", + "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==" }, "yallist": { "version": "3.1.1", @@ -3808,9 +1727,9 @@ "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==" }, "string-width": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.0.tgz", - "integrity": "sha512-zUz5JD+tgqtuDjMhwIg5uFVV3dtqZ9yQJlZVfq4I01/K5Paj5UHj7VyrQOJvzawSVlKpObApbfD0Ed6yJc+1eg==", + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.2.tgz", + "integrity": "sha512-XBJbT3N4JhVumXE0eoLU9DCjcaF92KLNqTmFCnG1pf8duUxFGwtP6AD6nkjw9a3IdiRtL3E2w3JDiE/xi3vOeA==", "requires": { "emoji-regex": "^8.0.0", "is-fullwidth-code-point": "^3.0.0", @@ -3828,9 +1747,9 @@ } }, "yargs-parser": { - "version": "20.2.5", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.5.tgz", - "integrity": "sha512-jYRGS3zWy20NtDtK2kBgo/TlAoy5YUuhD9/LZ7z7W4j1Fdw2cqD0xEEclf8fxc8xjD6X5Qr+qQQwCEsP8iRiYg==" + "version": "20.2.7", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.7.tgz", + "integrity": "sha512-FiNkvbeHzB/syOjIUxFDCnhSfzAL8R5vs40MgLFBorXACCOAEaWu0gRZl14vG8MR9AOJIZbmkjhusqBYZ3HTHw==" } } } diff --git a/apps/contract-migration/scripts/package.json b/apps/contract-migration/scripts/package.json index b5f273d2..0f61facd 100644 --- a/apps/contract-migration/scripts/package.json +++ b/apps/contract-migration/scripts/package.json @@ -1,6 +1,6 @@ { "dependencies": { - "cic-client-meta": "^0.0.7-alpha.6", + "cic-client-meta": "0.0.7-alpha.6", "vcard-parser": "^1.0.0" } } diff --git a/apps/contract-migration/scripts/verify.py b/apps/contract-migration/scripts/verify.py index 786ef615..f24a1148 100644 --- a/apps/contract-migration/scripts/verify.py +++ b/apps/contract-migration/scripts/verify.py @@ -22,7 +22,7 @@ from hexathon import ( strip_0x, add_0x, ) -from chainsyncer.backend import MemBackend +from chainsyncer.backend.memory import MemBackend from chainsyncer.driver import HeadSyncer from chainlib.chain import ChainSpec from chainlib.eth.connection import EthHTTPConnection From 03b3e8cd3fff6cbc717379bdc74457770516d605 Mon Sep 17 00:00:00 2001 From: Louis Holbrook Date: Wed, 21 Apr 2021 05:46:42 +0000 Subject: [PATCH 02/17] Adapt deployment to Bloxberg --- apps/cic-ussd/.config/app.ini | 2 +- apps/contract-migration/docker/Dockerfile | 7 +- apps/contract-migration/reset.sh | 84 +++++++++++++++-------- docker-compose.yml | 4 ++ 4 files changed, 67 insertions(+), 30 deletions(-) diff --git a/apps/cic-ussd/.config/app.ini b/apps/cic-ussd/.config/app.ini index 6d37c421..9d7cd2c0 100644 --- a/apps/cic-ussd/.config/app.ini +++ b/apps/cic-ussd/.config/app.ini @@ -20,5 +20,5 @@ TRANSITIONS=/usr/src/cic-ussd/transitions/ [client] host = -port = +port = ssl = diff --git a/apps/contract-migration/docker/Dockerfile b/apps/contract-migration/docker/Dockerfile index 6b053b66..c370006c 100644 --- a/apps/contract-migration/docker/Dockerfile +++ b/apps/contract-migration/docker/Dockerfile @@ -60,16 +60,19 @@ ARG pip_extra_index_url=https://pip.grassrootseconomics.net:8433 ARG cic_base_version=0.1.2a77 ARG cic_eth_version=0.11.0b6 ARG sarafu_faucet_version=0.0.2a28 +ARG sarafu_token_version==0.0.1a6 ARG cic_contracts_version=0.0.2a2 RUN pip install --user --extra-index-url $pip_extra_index_url cic-base[full_graph]==$cic_base_version \ cic-eth==$cic_eth_version \ cic-contracts==$cic_contracts_version \ - sarafu-faucet==$sarafu_faucet_version + sarafu-faucet==$sarafu_faucet_version \ + sarafu-token==$sarafu_token_version FROM python:3.8.6-slim-buster as runtime-image RUN apt-get update -RUN apt-get install -y --no-install-recommends gnupg libpq-dev +RUN apt-get install -y --no-install-recommends gnupg libpq-dev +RUN apt-get install -y --no-install-recommends jq COPY --from=compile-image /usr/local/bin/ /usr/local/bin/ COPY --from=compile-image /usr/local/etc/cic/ /usr/local/etc/cic/ diff --git a/apps/contract-migration/reset.sh b/apps/contract-migration/reset.sh index 2d81ae64..bbdeaa3b 100755 --- a/apps/contract-migration/reset.sh +++ b/apps/contract-migration/reset.sh @@ -2,82 +2,112 @@ set -a -DEV_ETH_ACCOUNT_CONTRACT_DEPLOYER=0xEb3907eCad74a0013c259D5874AE7f22DcBcC95C +CIC_CHAIN_SPEC=${CIC_CHAIN_SPEC:-evm:bloxberg:8995} +DEV_TOKEN_TYPE=${DEV_TOKEN_TYPE:-giftable} DEV_ETH_ACCOUNT_RESERVE_MINTER=${DEV_ETH_ACCOUNT_RESERVE_MINTER:-$DEV_ETH_ACCOUNT_CONTRACT_DEPLOYER} DEV_ETH_ACCOUNT_ACCOUNTS_INDEX_WRITER=${DEV_ETH_ACCOUNT_RESERVE_MINTER:-$DEV_ETH_ACCOUNT_CONTRACT_DEPLOYER} DEV_RESERVE_AMOUNT=${DEV_ETH_RESERVE_AMOUNT:-""10000000000000000000000000000000000} -faucet_amount=${DEV_FAUCET_AMOUNT:-0} -keystore_file=$(realpath ./keystore/UTC--2021-01-08T17-18-44.521011372Z--eb3907ecad74a0013c259d5874ae7f22dcbcc95c) +DEV_FAUCET_AMOUNT=${DEV_FAUCET_AMOUNT:-0} +DEV_ETH_KEYSTORE_FILE=${DEV_ETH_KEYSTORE_FILE:-`realpath ./keystore/UTC--2021-01-08T17-18-44.521011372Z--eb3907ecad74a0013c259d5874ae7f22dcbcc95c`} + +set -e + +DEV_ETH_ACCOUNT_CONTRACT_DEPLOYER=`eth-checksum $(cat $DEV_ETH_KEYSTORE_FILE | jq -r .address)` + +if [ ! -z $DEV_ETH_GAS_PRICE ]; then + gas_price_arg="--gas-price $DEV_ETH_GAS_PRICE" + >&2 echo using static gas price $DEV_ETH_GAS_PRICE +fi + +if [[ $DEV_TOKEN_TYPE != 'giftable' && $DEV_TOKEN_TYPE != 'sarafu' ]]; then + echo $DEV_TOKEN_TYPE + >&2 echo DEV_TOKEN_TYPE must be one of [giftable,sarafu] + exit 1 +fi echo "environment:" printenv echo \n +echo "using wallet address '$DEV_ETH_ACCOUNT_CONTRACT_DEPLOYER' from keystore file $DEV_ETH_KEYSTORE_FILE" + # This is a grassroots team convention for building the Bancor contracts using the bancor protocol repository truffle setup # Running this in docker-internal dev container (built from Docker folder in this repo) will write a # source-able env file to CIC_DATA_DIR. Services dependent on these contracts can mount this file OR # define these parameters at runtime # pushd /usr/src +if [ -z $CIC_DATA_DIR ]; then + CIC_DATA_DIR=`mktemp -d` +fi +>&2 echo using data dir $CIC_DATA_DIR + init_level_file=${CIC_DATA_DIR}/.init if [ ! -f ${CIC_DATA_DIR}/.init ]; then echo "Creating .init file..." mkdir -p $CIC_DATA_DIR - touch /tmp/cic/config/.init + touch $CIC_DATA_DIR/.init # touch $init_level_file fi echo -n 1 > $init_level_file # Abort on any error (including if wait-for-it fails). -set -e # Wait for the backend to be up, if we know where it is. if [[ -n "${ETH_PROVIDER}" ]]; then - echo "waiting for ${ETH_PROVIDER}..." - ./wait-for-it.sh "${ETH_PROVIDER_HOST}:${ETH_PROVIDER_PORT}" - DEV_RESERVE_ADDRESS=`giftable-token-deploy -p $ETH_PROVIDER -y $keystore_file -i $CIC_CHAIN_SPEC -v -w --name "Sarafu" --symbol "SRF" --decimals 6` - giftable-token-gift -p $ETH_PROVIDER -y $keystore_file -i $CIC_CHAIN_SPEC -v -w -a $DEV_RESERVE_ADDRESS $DEV_RESERVE_AMOUNT + if [ ! -z "$DEV_USE_DOCKER_WAIT_SCRIPT" ]; then + echo "waiting for ${ETH_PROVIDER}..." + ./wait-for-it.sh "${ETH_PROVIDER_HOST}:${ETH_PROVIDER_PORT}" + fi - #BANCOR_REGISTRY_ADDRESS=`cic-bancor-deploy --bancor-dir /usr/local/share/cic/bancor -z $DEV_ETH_RESERVE_ADDRESS -p $ETH_PROVIDER -o $DEV_ETH_ACCOUNT_CONTRACT_DEPLOYER` + if [ $DEV_TOKEN_TYPE == 'giftable' ]; then + >&2 echo "deploying 'giftable token'" + DEV_RESERVE_ADDRESS=`giftable-token-deploy $gas_price_arg -p $ETH_PROVIDER -y $DEV_ETH_KEYSTORE_FILE -i $CIC_CHAIN_SPEC -vv -w --name "Giftable Token" --symbol "GFT" --decimals 6 -vv` + else + >&2 echo "deploying 'sarafu' token'" + DEV_RESERVE_ADDRESS=`sarafu-token-deploy $gas_price_arg -p $ETH_PROVIDER -y $DEV_ETH_KEYSTORE_FILE -i $CIC_CHAIN_SPEC -vv -w --name "Sarafu" --decimals 6 -vv SRF $DEV_SARAFU_DEMURRAGE_LEVEL` + fi + giftable-token-gift $gas_price_arg -p $ETH_PROVIDER -y $DEV_ETH_KEYSTORE_FILE -i $CIC_CHAIN_SPEC -vv -w -a $DEV_RESERVE_ADDRESS $DEV_RESERVE_AMOUNT + + #BANCOR_REGISTRY_ADDRESS=`cic-bancor-deploy $gas_price_arg --bancor-dir /usr/local/share/cic/bancor -z $DEV_ETH_RESERVE_ADDRESS -p $ETH_PROVIDER -o $DEV_ETH_ACCOUNT_CONTRACT_DEPLOYER` >&2 echo "deploy account index contract" - DEV_ACCOUNT_INDEX_ADDRESS=`eth-accounts-index-deploy -i $CIC_CHAIN_SPEC -p $ETH_PROVIDER -y $keystore_file -vv -w` + DEV_ACCOUNT_INDEX_ADDRESS=`eth-accounts-index-deploy $gas_price_arg -i $CIC_CHAIN_SPEC -p $ETH_PROVIDER -y $DEV_ETH_KEYSTORE_FILE -vv -w` >&2 echo "add deployer address as account index writer" - eth-accounts-index-writer -y $keystore_file -i $CIC_CHAIN_SPEC -p $ETH_PROVIDER -a $DEV_ACCOUNT_INDEX_ADDRESS -ww $debug $DEV_ETH_ACCOUNT_CONTRACT_DEPLOYER + eth-accounts-index-writer $gas_price_arg -y $DEV_ETH_KEYSTORE_FILE -i $CIC_CHAIN_SPEC -p $ETH_PROVIDER -a $DEV_ACCOUNT_INDEX_ADDRESS -ww -vv $debug $DEV_ETH_ACCOUNT_CONTRACT_DEPLOYER - CIC_REGISTRY_ADDRESS=`eth-contract-registry-deploy -i $CIC_CHAIN_SPEC -y $keystore_file --identifier BancorRegistry --identifier AccountRegistry --identifier TokenRegistry --identifier AddressDeclarator --identifier Faucet --identifier TransferAuthorization -p $ETH_PROVIDER -vv -w` - eth-contract-registry-set -w -y $keystore_file -r $CIC_REGISTRY_ADDRESS -i $CIC_CHAIN_SPEC -p $ETH_PROVIDER -vv ContractRegistry $CIC_REGISTRY_ADDRESS - #cic-registry-set -r $CIC_REGISTRY_ADDRESS -i $CIC_CHAIN_SPEC -k BancorRegistry -p $ETH_PROVIDER $BANCOR_REGISTRY_ADDRESS -vv - eth-contract-registry-set -w -y $keystore_file -r $CIC_REGISTRY_ADDRESS -i $CIC_CHAIN_SPEC -p $ETH_PROVIDER -vv AccountRegistry $DEV_ACCOUNT_INDEX_ADDRESS + CIC_REGISTRY_ADDRESS=`eth-contract-registry-deploy $gas_price_arg -i $CIC_CHAIN_SPEC -y $DEV_ETH_KEYSTORE_FILE --identifier BancorRegistry --identifier AccountRegistry --identifier TokenRegistry --identifier AddressDeclarator --identifier Faucet --identifier TransferAuthorization -p $ETH_PROVIDER -vv -w` + eth-contract-registry-set $gas_price_arg -w -y $DEV_ETH_KEYSTORE_FILE -r $CIC_REGISTRY_ADDRESS -i $CIC_CHAIN_SPEC -p $ETH_PROVIDER -vv ContractRegistry $CIC_REGISTRY_ADDRESS + eth-contract-registry-set $gas_price_arg -w -y $DEV_ETH_KEYSTORE_FILE -r $CIC_REGISTRY_ADDRESS -i $CIC_CHAIN_SPEC -p $ETH_PROVIDER -vv AccountRegistry $DEV_ACCOUNT_INDEX_ADDRESS # Deploy address declarator registry >&2 echo "deploy address declarator contract" declarator_description=0x546869732069732074686520434943206e6574776f726b000000000000000000 - DEV_DECLARATOR_ADDRESS=`eth-address-declarator-deploy -y $keystore_file -i $CIC_CHAIN_SPEC -p $ETH_PROVIDER -w -v $declarator_description` - eth-contract-registry-set -w -y $keystore_file -r $CIC_REGISTRY_ADDRESS -i $CIC_CHAIN_SPEC -p $ETH_PROVIDER -vv AddressDeclarator $DEV_DECLARATOR_ADDRESS + DEV_DECLARATOR_ADDRESS=`eth-address-declarator-deploy -y $DEV_ETH_KEYSTORE_FILE -i $CIC_CHAIN_SPEC -p $ETH_PROVIDER -w -vv $declarator_description` + eth-contract-registry-set $gas_price_arg -w -y $DEV_ETH_KEYSTORE_FILE -r $CIC_REGISTRY_ADDRESS -i $CIC_CHAIN_SPEC -p $ETH_PROVIDER -vv AddressDeclarator $DEV_DECLARATOR_ADDRESS # Deploy transfer authorization contact >&2 echo "deploy address declarator contract" - DEV_TRANSFER_AUTHORIZATION_ADDRESS=`erc20-transfer-auth-deploy -y $keystore_file -i $CIC_CHAIN_SPEC -p $ETH_PROVIDER -w -v` - eth-contract-registry-set -w -y $keystore_file -r $CIC_REGISTRY_ADDRESS -i $CIC_CHAIN_SPEC -p $ETH_PROVIDER -vv TransferAuthorization $DEV_TRANSFER_AUTHORIZATION_ADDRESS + DEV_TRANSFER_AUTHORIZATION_ADDRESS=`erc20-transfer-auth-deploy $gas_price_arg -y $DEV_ETH_KEYSTORE_FILE -i $CIC_CHAIN_SPEC -p $ETH_PROVIDER -w -vv` + eth-contract-registry-set $gas_price_arg -w -y $DEV_ETH_KEYSTORE_FILE -r $CIC_REGISTRY_ADDRESS -i $CIC_CHAIN_SPEC -p $ETH_PROVIDER -vv TransferAuthorization $DEV_TRANSFER_AUTHORIZATION_ADDRESS # Deploy token index contract >&2 echo "deploy token index contract" - DEV_TOKEN_INDEX_ADDRESS=`eth-token-index-deploy -y $keystore_file -i $CIC_CHAIN_SPEC -p $ETH_PROVIDER -w -v` - eth-contract-registry-set -w -y $keystore_file -r $CIC_REGISTRY_ADDRESS -i $CIC_CHAIN_SPEC -p $ETH_PROVIDER -vv TokenRegistry $DEV_TOKEN_INDEX_ADDRESS + DEV_TOKEN_INDEX_ADDRESS=`eth-token-index-deploy $gas_price_arg -y $DEV_ETH_KEYSTORE_FILE -i $CIC_CHAIN_SPEC -p $ETH_PROVIDER -w -vv` + eth-contract-registry-set $gas_price_arg -w -y $DEV_ETH_KEYSTORE_FILE -r $CIC_REGISTRY_ADDRESS -i $CIC_CHAIN_SPEC -p $ETH_PROVIDER -vv TokenRegistry $DEV_TOKEN_INDEX_ADDRESS >&2 echo "add reserve token to token index" - eth-token-index-add -w -y $keystore_file -i $CIC_CHAIN_SPEC -p $ETH_PROVIDER -vv -a $DEV_TOKEN_INDEX_ADDRESS $DEV_RESERVE_ADDRESS + eth-token-index-add $gas_price_arg -w -y $DEV_ETH_KEYSTORE_FILE -i $CIC_CHAIN_SPEC -p $ETH_PROVIDER -vv -a $DEV_TOKEN_INDEX_ADDRESS $DEV_RESERVE_ADDRESS # Sarafu faucet contract >&2 echo "deploy token faucet contract" - DEV_FAUCET_ADDRESS=`sarafu-faucet-deploy -y $keystore_file -i $CIC_CHAIN_SPEC -p $ETH_PROVIDER -w -v --account-index-address $DEV_ACCOUNT_INDEX_ADDRESS $DEV_RESERVE_ADDRESS` - eth-contract-registry-set -w -y $keystore_file -r $CIC_REGISTRY_ADDRESS -i $CIC_CHAIN_SPEC -p $ETH_PROVIDER -vv Faucet $DEV_FAUCET_ADDRESS + DEV_FAUCET_ADDRESS=`sarafu-faucet-deploy $gas_price_arg -y $DEV_ETH_KEYSTORE_FILE -i $CIC_CHAIN_SPEC -p $ETH_PROVIDER -w -vv --account-index-address $DEV_ACCOUNT_INDEX_ADDRESS $DEV_RESERVE_ADDRESS` + eth-contract-registry-set $gas_price_arg -w -y $DEV_ETH_KEYSTORE_FILE -r $CIC_REGISTRY_ADDRESS -i $CIC_CHAIN_SPEC -p $ETH_PROVIDER -vv Faucet $DEV_FAUCET_ADDRESS >&2 echo "set faucet as token minter" - giftable-token-minter -w -y $keystore_file -a $DEV_RESERVE_ADDRESS -i $CIC_CHAIN_SPEC -p $ETH_PROVIDER -vv $DEV_FAUCET_ADDRESS + giftable-token-minter $gas_price_arg -w -y $DEV_ETH_KEYSTORE_FILE -a $DEV_RESERVE_ADDRESS -i $CIC_CHAIN_SPEC -p $ETH_PROVIDER -vv $DEV_FAUCET_ADDRESS >&2 echo "set token faucet amount" - sarafu-faucet-set -y $keystore_file -i $CIC_CHAIN_SPEC -p $ETH_PROVIDER -a $DEV_FAUCET_ADDRESS $faucet_amount + sarafu-faucet-set $gas_price_arg -y $DEV_ETH_KEYSTORE_FILE -i $CIC_CHAIN_SPEC -p $ETH_PROVIDER -a $DEV_FAUCET_ADDRESS -vv $DEV_FAUCET_AMOUNT else diff --git a/docker-compose.yml b/docker-compose.yml index 78221926..69a9c318 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -85,6 +85,7 @@ services: # ETH_PROVIDER should be broken out into host/port but cic-eth expects this ETH_PROVIDER: http://eth:8545 # And these two are for wait-for-it (could parse this) + DEV_USE_DOCKER_WAIT_SCRIPT: 1 ETH_PROVIDER_HOST: eth ETH_PROVIDER_PORT: 8545 CIC_CHAIN_SPEC: ${CIC_CHAIN_SPEC:-evm:bloxberg:8996} @@ -103,6 +104,9 @@ services: DEV_PIP_EXTRA_INDEX_URL: ${DEV_PIP_EXTRA_INDEX_URL:-https://pip.grassrootseconomics.net:8433} RUN_MASK: ${RUN_MASK:-0} # bit flags; 1: contract migrations 2: seed data DEV_FAUCET_AMOUNT: ${DEV_FAUCET_AMOUNT:-0} + DEV_TOKEN_TYPE: ${DEV_TOKEN_TYPE:-giftable} + DEV_SARAFU_DEMURRAGE_LEVEL: ${DEV_SARAFU_DEMURRAGE_LEVEL:-196454828847045000000000000000000} + DEV_ETH_GAS_PRICE: ${DEV_ETH_GAS_PRICE:-1} command: ["./run_job.sh"] #command: ["./reset.sh"] depends_on: From 65250196cc0fcb689cca58938be3e52cb80a0faf Mon Sep 17 00:00:00 2001 From: nolash Date: Wed, 21 Apr 2021 19:03:14 +0200 Subject: [PATCH 03/17] cic-eth versionbump --- apps/cic-eth/cic_eth/version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/cic-eth/cic_eth/version.py b/apps/cic-eth/cic_eth/version.py index 9ed70fd9..1624e647 100644 --- a/apps/cic-eth/cic_eth/version.py +++ b/apps/cic-eth/cic_eth/version.py @@ -10,7 +10,7 @@ version = ( 0, 11, 0, - 'beta.6', + 'beta.7', ) version_object = semver.VersionInfo( From 39fe4a14ec32113e15c59b2d5cb4a4931cb886cc Mon Sep 17 00:00:00 2001 From: Louis Holbrook Date: Wed, 21 Apr 2021 17:25:57 +0000 Subject: [PATCH 04/17] USSD final steps --- apps/cic-eth/cic_eth/version.py | 2 +- apps/cic-ussd/requirements.txt | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/cic-eth/cic_eth/version.py b/apps/cic-eth/cic_eth/version.py index 9ed70fd9..1624e647 100644 --- a/apps/cic-eth/cic_eth/version.py +++ b/apps/cic-eth/cic_eth/version.py @@ -10,7 +10,7 @@ version = ( 0, 11, 0, - 'beta.6', + 'beta.7', ) version_object = semver.VersionInfo( diff --git a/apps/cic-ussd/requirements.txt b/apps/cic-ussd/requirements.txt index 25578d59..36aa04b5 100644 --- a/apps/cic-ussd/requirements.txt +++ b/apps/cic-ussd/requirements.txt @@ -1,4 +1,4 @@ -cic_base[full_graph]~=0.1.2a68 -cic-eth~=0.11.0b3 +cic_base[full_graph]~=0.1.2a79 +cic-eth~=0.11.0b7 cic-notify~=0.4.0a4 cic-types~=0.1.0a10 From 1bc7cde1f0ffa898d54ee67977a4d642018323ec Mon Sep 17 00:00:00 2001 From: Louis Holbrook Date: Wed, 21 Apr 2021 17:34:13 +0000 Subject: [PATCH 05/17] K8s health utilities for cic containers --- .gitignore | 4 + apps/cic-cache/docker/start_tracker.sh | 5 + apps/cic-eth/cic_eth/k8s/db.py | 7 + .../cic_eth/runnable/daemons/tasker.py | 16 ++- apps/cic-eth/config/cic.ini | 1 + apps/cic-eth/docker/Dockerfile | 2 + apps/cic-eth/requirements.txt | 2 +- apps/cic-eth/setup.cfg | 1 + apps/util/liveness/MANIFEST.in | 1 + apps/util/liveness/Makefile | 10 ++ apps/util/liveness/README.md | 105 +++++++++++++++ apps/util/liveness/doc/texinfo/index.texi | 71 ++++++++++ apps/util/liveness/health.sh | 35 +++++ apps/util/liveness/liveness/linux.py | 54 ++++++++ apps/util/liveness/setup.py | 7 + apps/util/liveness/test_health.sh | 17 +++ apps/util/liveness/tests/imports/__init__.py | 0 .../liveness/tests/imports/import_args.py | 8 ++ .../liveness/tests/imports/import_false.py | 2 + .../liveness/tests/imports/import_true.py | 2 + apps/util/liveness/tests/test_imports.py | 127 ++++++++++++++++++ 21 files changed, 471 insertions(+), 6 deletions(-) create mode 100644 apps/cic-eth/cic_eth/k8s/db.py create mode 100644 apps/util/liveness/MANIFEST.in create mode 100644 apps/util/liveness/Makefile create mode 100644 apps/util/liveness/README.md create mode 100644 apps/util/liveness/doc/texinfo/index.texi create mode 100644 apps/util/liveness/health.sh create mode 100644 apps/util/liveness/liveness/linux.py create mode 100644 apps/util/liveness/setup.py create mode 100644 apps/util/liveness/test_health.sh create mode 100644 apps/util/liveness/tests/imports/__init__.py create mode 100644 apps/util/liveness/tests/imports/import_args.py create mode 100644 apps/util/liveness/tests/imports/import_false.py create mode 100644 apps/util/liveness/tests/imports/import_true.py create mode 100644 apps/util/liveness/tests/test_imports.py diff --git a/.gitignore b/.gitignore index 04eee297..402a2482 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,7 @@ service-configs/* __pycache__ *.pyc *.o +gmon.out +*.egg-info +dist/ +build/ diff --git a/apps/cic-cache/docker/start_tracker.sh b/apps/cic-cache/docker/start_tracker.sh index cca1cb1a..0f722537 100644 --- a/apps/cic-cache/docker/start_tracker.sh +++ b/apps/cic-cache/docker/start_tracker.sh @@ -2,4 +2,9 @@ . ./db.sh +if [ $? -ne "0" ]; then + >&2 echo db migrate fail + exit 1 +fi + /usr/local/bin/cic-cache-trackerd $@ diff --git a/apps/cic-eth/cic_eth/k8s/db.py b/apps/cic-eth/cic_eth/k8s/db.py new file mode 100644 index 00000000..485e1b56 --- /dev/null +++ b/apps/cic-eth/cic_eth/k8s/db.py @@ -0,0 +1,7 @@ +from cic_eth.db.models.base import SessionBase + +def health(*args, **kwargs): + session = SessionBase.create_session() + session.execute('SELECT count(*) from alembic_version') + session.close() + return True diff --git a/apps/cic-eth/cic_eth/runnable/daemons/tasker.py b/apps/cic-eth/cic_eth/runnable/daemons/tasker.py index bfaf8ee1..2d9d0434 100644 --- a/apps/cic-eth/cic_eth/runnable/daemons/tasker.py +++ b/apps/cic-eth/cic_eth/runnable/daemons/tasker.py @@ -15,6 +15,7 @@ from chainlib.connection import RPCConnection from chainlib.eth.connection import EthUnixSignerConnection from chainlib.chain import ChainSpec from chainqueue.db.models.otx import Otx +import liveness.linux # local imports from cic_eth.eth import ( @@ -52,6 +53,7 @@ from cic_eth.registry import ( connect_token_registry, ) + logging.basicConfig(level=logging.WARNING) logg = logging.getLogger() @@ -90,14 +92,15 @@ config.censor('PASSWORD', 'DATABASE') config.censor('PASSWORD', 'SSL') logg.debug('config loaded from {}:\n{}'.format(args.c, config)) +health_modules = config.get('CIC_HEALTH_MODULES', []) +if len(health_modules) != 0: + health_modules = health_modules.split(',') +logg.debug('health mods {}'.format(health_modules)) + # connect to database dsn = dsn_from_config(config) SessionBase.connect(dsn, pool_size=int(config.get('DATABASE_POOL_SIZE')), debug=config.true('DATABASE_DEBUG')) -# verify database connection with minimal sanity query -session = SessionBase.create_session() -session.execute('select version_num from alembic_version') -session.close() # set up celery current_app = celery.Celery(__name__) @@ -139,6 +142,7 @@ RPCConnection.register_location(config.get('SIGNER_SOCKET_PATH'), chain_spec, 's Otx.tracing = config.true('TASKS_TRACE_QUEUE_STATUS') +liveness.linux.load(health_modules) def main(): argv = ['worker'] @@ -173,8 +177,10 @@ def main(): logg.info('using trusted address {}'.format(address)) connect_declarator(rpc, chain_spec, trusted_addresses) connect_token_registry(rpc, chain_spec) - + + liveness.linux.set() current_app.worker_main(argv) + liveness.linux.reset() @celery.signals.eventlet_pool_postshutdown.connect diff --git a/apps/cic-eth/config/cic.ini b/apps/cic-eth/config/cic.ini index 7c6d825c..10ec9cdc 100644 --- a/apps/cic-eth/config/cic.ini +++ b/apps/cic-eth/config/cic.ini @@ -3,3 +3,4 @@ registry_address = chain_spec = evm:bloxberg:8996 tx_retry_delay = trust_address = +health_modules = cic_eth.k8s.db diff --git a/apps/cic-eth/docker/Dockerfile b/apps/cic-eth/docker/Dockerfile index 9ca4a83a..00f3903a 100644 --- a/apps/cic-eth/docker/Dockerfile +++ b/apps/cic-eth/docker/Dockerfile @@ -53,3 +53,5 @@ COPY cic-eth/crypto_dev_signer_config/ /usr/local/etc/crypto-dev-signer/ RUN git clone https://gitlab.com/grassrootseconomics/cic-contracts.git && \ mkdir -p /usr/local/share/cic/solidity && \ cp -R cic-contracts/abis /usr/local/share/cic/solidity/abi + +COPY util/liveness/health.sh /usr/local/bin/health.sh diff --git a/apps/cic-eth/requirements.txt b/apps/cic-eth/requirements.txt index 15e02448..3ab41375 100644 --- a/apps/cic-eth/requirements.txt +++ b/apps/cic-eth/requirements.txt @@ -1,4 +1,4 @@ -cic-base~=0.1.2a76 +cic-base==0.1.2a79+build.35e442bc celery==4.4.7 crypto-dev-signer~=0.4.14b2 confini~=0.3.6rc3 diff --git a/apps/cic-eth/setup.cfg b/apps/cic-eth/setup.cfg index d2895943..cc0d5549 100644 --- a/apps/cic-eth/setup.cfg +++ b/apps/cic-eth/setup.cfg @@ -38,6 +38,7 @@ packages = cic_eth.runnable.daemons.filters cic_eth.callbacks cic_eth.sync + cic_eth.k8s scripts = ./scripts/migrate.py diff --git a/apps/util/liveness/MANIFEST.in b/apps/util/liveness/MANIFEST.in new file mode 100644 index 00000000..76894836 --- /dev/null +++ b/apps/util/liveness/MANIFEST.in @@ -0,0 +1 @@ +include *health*.sh diff --git a/apps/util/liveness/Makefile b/apps/util/liveness/Makefile new file mode 100644 index 00000000..257775f8 --- /dev/null +++ b/apps/util/liveness/Makefile @@ -0,0 +1,10 @@ +docs: + mkdir -p doc/texinfo/html + makeinfo doc/texinfo/index.texi --html -o doc/texinfo/html/ + +markdown: doc + pandoc -f html -t markdown --standalone doc/texinfo/html/liveness.html -o README.md + + +.PHONY dist: + python setup.py sdist diff --git a/apps/util/liveness/README.md b/apps/util/liveness/README.md new file mode 100644 index 00000000..7081db01 --- /dev/null +++ b/apps/util/liveness/README.md @@ -0,0 +1,105 @@ +--- +description: liveness (Untitled Document) +distribution: global +Generator: makeinfo +keywords: liveness (Untitled Document) +lang: en +resource-type: document +title: liveness (Untitled Document) +--- + +[]{#liveness}[]{#liveness-1} + +## 1 liveness {#liveness .chapter} + +[]{#ilveness_005foverview}[]{#Overview} + +### 1.1 Overview {#overview .section} + +This is a cluster-specific convenience setup for enabling a +Kubernetes-style liveness/readiness test as outlined in +. + +Conceptually, it provides an application with means to: + +- Run a collection of functions to validate sanity of the environment +- Set a no-error state before execution of the main routine +- Modify the error state during execution +- Invalidating all state when execution ends + +[]{#Python-module} + +### 1.2 Python module {#python-module .section} + +Three python methods are provided. + +[]{#load} + +#### 1.2.1 load {#load .subsection} + +This is meant to be called after configurations and environment has been +set up, but before the execution logic has commenced. + +It receives a list of externally defined fully-qualified python modules. +Each of these modules must implement the method `health(*args,**kwargs)` +in its global namespace. + +Any module returning `False` will cause a `RuntimeException`. + +The component will not trap any other exception from the modules. + +If successful, it will write the `pid` of the application to the +specified run data folder. By default this is `/run/`, but the +path can be modified if desired. + +[]{#set} + +#### 1.2.2 set {#set .subsection} + +This is meant to be called during the execution of the main program +routine begins. + +[]{#at-startup} + +#### 1.2.2.1 at startup {#at-startup .subsubsection} + +It should be called once at the *start* of execution of the main program +routine. + +For one-shot routines, this would mean the start of any code only run +when the module name is `__main__`. + +For daemons, it would be just before handing over execution to the main +loop. + +[]{#during-execution} + +#### 1.2.2.2 during execution {#during-execution .subsubsection} + +Call `set(error_code=, ...` any time the health state temporarily +changes. Any `error` value other than `0` is considered an unhealthy +state. + +[]{#at-shutdown} + +#### 1.2.2.3 at shutdown {#at-shutdown .subsubsection} + +Call `reset(...)`, which will indicate that the state is to be +considered the same as at startup. + +[]{#shell} + +### 1.3 shell {#shell .section} + +A bash script is provided for *Kubernetes* to perform the health check. + +It performs the following checks: + +1. A numeric value exists in `//pid`{.sample}. +2. The numeric value is a directory in `/proc`{.sample} (a valid pid) +3. The file `//error`{.sample} contains \"0\" + +If any of these checks fail should inditcate that the container is +unhealthy. + +------------------------------------------------------------------------ diff --git a/apps/util/liveness/doc/texinfo/index.texi b/apps/util/liveness/doc/texinfo/index.texi new file mode 100644 index 00000000..82972d98 --- /dev/null +++ b/apps/util/liveness/doc/texinfo/index.texi @@ -0,0 +1,71 @@ +@node liveness +@chapter liveness + +@anchor{ilveness_overview} +@section Overview + +This is a cluster-specific convenience setup for enabling a Kubernetes-style liveness/readiness test as outlined in @url{https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/}. + +Conceptually, it provides an application with means to: + +@itemize +@item Run a collection of functions to validate sanity of the environment +@item Set a no-error state before execution of the main routine +@item Modify the error state during execution +@item Invalidating all state when execution ends +@end itemize + + +@section Python module + +Three python methods are provided. + +@subsection load + +This is meant to be called after configurations and environment has been set up, but before the execution logic has commenced. + +It receives a list of externally defined fully-qualified python modules. Each of these modules must implement the method @code{health(*args,**kwargs)} in its global namespace. + +Any module returning @code{False} will cause a @code{RuntimeException}. + +The component will not trap any other exception from the modules. + +If successful, it will write the @code{pid} of the application to the specified run data folder. By default this is @code{/run/}, but the path can be modified if desired. + + +@subsection set + +This is meant to be called during the execution of the main program routine begins. + +@subsubsection at startup + +It should be called once at the @emph{start} of execution of the main program routine. + +For one-shot routines, this would mean the start of any code only run when the module name is @code{__main__}. + +For daemons, it would be just before handing over execution to the main loop. + + +@subsubsection during execution + +Call @code{set(error_code=, ...} any time the health state temporarily changes. Any @code{error} value other than @code{0} is considered an unhealthy state. + + +@subsubsection at shutdown + +Call @code{reset(...)}, which will indicate that the state is to be considered the same as at startup. + + +@section shell + +A bash script is provided for @emph{Kubernetes} to perform the health check. + +It performs the following checks: + +@enumerate +@item A numeric value exists in @file{//pid}. +@item The numeric value is a directory in @file{/proc} (a valid pid) +@item The file @file{//error} contains "0" +@end enumerate + +If any of these checks fail should inditcate that the container is unhealthy. diff --git a/apps/util/liveness/health.sh b/apps/util/liveness/health.sh new file mode 100644 index 00000000..b19763e4 --- /dev/null +++ b/apps/util/liveness/health.sh @@ -0,0 +1,35 @@ +#!/bin/bash + +rundir=${CIC_RUNDIR:-/run} +unit=${CIC_UNIT:-$HOSTNAME} + +read p < $rundir/$unit/pid + +if [ -z $p ]; then + >&2 echo unit $unit has no pid + exit 1 +fi + +if [ ! -d /proc/$p ]; then + >&2 echo unit $unit reports non-existent pid $p + exit 1 +fi + +>&2 echo unit $unit has pid $p + +if [ ! -f $rundir/$unit/error ]; then + >&2 echo unit $unit has unspecified state + exit 1 +fi + +read e 2> /dev/null < $rundir/$unit/error +if [ -z $e ]; then + >&2 echo unit $unit has unspecified state + exit 1 +fi + +>&2 echo unit $unit has error $e + +if [ $e -gt 0 ]; then + exit 1; +fi diff --git a/apps/util/liveness/liveness/linux.py b/apps/util/liveness/liveness/linux.py new file mode 100644 index 00000000..24bb59e6 --- /dev/null +++ b/apps/util/liveness/liveness/linux.py @@ -0,0 +1,54 @@ +# standard imports +import importlib +import sys +import os +import logging + +logg = logging.getLogger().getChild(__name__) + +pid = os.getpid() + +default_namespace = os.environ.get('LIVENESS_UNIT_NAME') +if default_namespace == None: + import socket + default_namespace = socket.gethostname() + + +def load(check_strs, namespace=default_namespace, rundir='/run', *args, **kwargs): + + if namespace == None: + import socket + namespace = socket.gethostname() + + logg.info('pid ' + str(pid)) + + checks = [] + for m in check_strs: + logg.debug('added liveness check: {}'.format(str(m))) + module = importlib.import_module(m) + checks.append(module) + + for check in checks: + r = check.health(args, kwargs) + if r == False: + raise RuntimeError('liveness check {} failed'.format(str(check))) + logg.info('liveness check passed: {}'.format(str(check))) + + app_rundir = os.path.join(rundir, namespace) + os.makedirs(app_rundir, exist_ok=True) # should not already exist + f = open(os.path.join(app_rundir, 'pid'), 'w') + f.write(str(pid)) + f.close() + + +def set(error=0, namespace=default_namespace, rundir='/run'): + app_rundir = os.path.join(rundir, namespace) + f = open(os.path.join(app_rundir, 'error'), 'w') + f.write(str(error)) + f.close() + + +def reset(namespace=default_namespace, rundir='/run'): + app_rundir = os.path.join(rundir, namespace) + os.unlink(os.path.join(app_rundir, 'pid')) + os.unlink(os.path.join(app_rundir, 'error')) diff --git a/apps/util/liveness/setup.py b/apps/util/liveness/setup.py new file mode 100644 index 00000000..3c8b3f2e --- /dev/null +++ b/apps/util/liveness/setup.py @@ -0,0 +1,7 @@ +from setuptools import setup +setup( + name='liveness', + version='0.0.1a6', + packages=['liveness'], + include_package_data=True, + ) diff --git a/apps/util/liveness/test_health.sh b/apps/util/liveness/test_health.sh new file mode 100644 index 00000000..898a05d2 --- /dev/null +++ b/apps/util/liveness/test_health.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +export CIC_RUNDIR=`realpath ./tests/testdata/run` +t=`mktemp -d -p $CIC_RUNDIR` +export CIC_UNIT=`basename $t` + +>&2 echo test pid $$ +echo $$ > $t/pid +echo 0 > $t/error + +. health.sh + +echo 1 > $t/error +#unlink $t/error +. health.sh + +echo if error this is not printed diff --git a/apps/util/liveness/tests/imports/__init__.py b/apps/util/liveness/tests/imports/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/apps/util/liveness/tests/imports/import_args.py b/apps/util/liveness/tests/imports/import_args.py new file mode 100644 index 00000000..a68003b1 --- /dev/null +++ b/apps/util/liveness/tests/imports/import_args.py @@ -0,0 +1,8 @@ +a = ['foo'] +kw = { + 'bar': 42, + } + +def health(*args, **kwargs): + args[0] == a[0] + kwargs['bar'] = kw['bar'] diff --git a/apps/util/liveness/tests/imports/import_false.py b/apps/util/liveness/tests/imports/import_false.py new file mode 100644 index 00000000..311f2781 --- /dev/null +++ b/apps/util/liveness/tests/imports/import_false.py @@ -0,0 +1,2 @@ +def health(*args, **kwargs): + return False diff --git a/apps/util/liveness/tests/imports/import_true.py b/apps/util/liveness/tests/imports/import_true.py new file mode 100644 index 00000000..69c2e286 --- /dev/null +++ b/apps/util/liveness/tests/imports/import_true.py @@ -0,0 +1,2 @@ +def health(*args, **kwargs): + return True diff --git a/apps/util/liveness/tests/test_imports.py b/apps/util/liveness/tests/test_imports.py new file mode 100644 index 00000000..02e6be79 --- /dev/null +++ b/apps/util/liveness/tests/test_imports.py @@ -0,0 +1,127 @@ +# standard imports +import os +import unittest +import logging +import tempfile +import socket + +# local imports +import liveness.linux + +## test imports +import tests.imports + + +logging.basicConfig(level=logging.DEBUG) +logg = logging.getLogger() +script_dir = os.path.realpath(os.path.dirname(__file__)) +data_dir = os.path.join(script_dir, 'testdata') +run_base_dir = os.path.join(data_dir, 'run') + + +class TestImports(unittest.TestCase): + + def setUp(self): + os.makedirs(run_base_dir, exist_ok=True) + self.run_dir = tempfile.mkdtemp(dir=run_base_dir) + self.unit = 'unittest' + self.unit_dir = os.path.join(self.run_dir, self.unit) + self.pid_path = os.path.join(self.unit_dir, 'pid') + self.error_path = os.path.join(self.unit_dir, 'error') + self.host_path = os.path.join(self.run_dir, socket.gethostname()) + + + def test_no_import(self): + liveness.linux.load([], namespace=self.unit, rundir=self.run_dir) + f = open(self.pid_path, 'r') + r = f.read() + f.close() + self.assertEqual(str(os.getpid()), r) + + + def test_hostname(self): + liveness.linux.load([], rundir=self.run_dir) + f = open(os.path.join(self.host_path, 'pid'), 'r') + r = f.read() + f.close() + self.assertEqual(str(os.getpid()), r) + + + def test_import_single_true(self): + checks = ['tests.imports.import_true'] + liveness.linux.load(checks, namespace=self.unit, rundir=self.run_dir) + f = open(self.pid_path, 'r') + r = f.read() + f.close() + self.assertEqual(str(os.getpid()), r) + + + def test_import_single_false(self): + checks = ['tests.imports.import_false'] + with self.assertRaises(RuntimeError): + liveness.linux.load(checks, namespace=self.unit, rundir=self.run_dir) + with self.assertRaises(FileNotFoundError): + os.stat(self.pid_path) + + + def test_import_false_then_true(self): + checks = ['tests.imports.import_false', 'tests.imports.import_true'] + with self.assertRaises(RuntimeError): + liveness.linux.load(checks, namespace=self.unit, rundir=self.run_dir) + with self.assertRaises(FileNotFoundError): + os.stat(self.pid_path) + + + def test_import_multiple_true(self): + checks = ['tests.imports.import_true', 'tests.imports.import_true'] + liveness.linux.load(checks, namespace=self.unit, rundir=self.run_dir) + f = open(self.pid_path, 'r') + r = f.read() + f.close() + self.assertEqual(str(os.getpid()), r) + + + def test_set(self): + liveness.linux.load([], namespace='unittest', rundir=self.run_dir) + liveness.linux.set(namespace='unittest', rundir=self.run_dir) + f = open(self.error_path, 'r') + r = f.read() + f.close() + self.assertEqual('0', r) + + liveness.linux.set(error=42, namespace='unittest', rundir=self.run_dir) + f = open(self.error_path, 'r') + r = f.read() + f.close() + self.assertEqual('42', r) + + liveness.linux.reset(namespace='unittest', rundir=self.run_dir) + with self.assertRaises(FileNotFoundError): + os.stat(self.error_path) + + + def test_set_hostname(self): + liveness.linux.load([], rundir=self.run_dir) + liveness.linux.set(rundir=self.run_dir) + error_path = os.path.join(self.host_path, 'error') + f = open(error_path, 'r') + r = f.read() + f.close() + self.assertEqual('0', r) + + liveness.linux.reset(rundir=self.run_dir) + with self.assertRaises(FileNotFoundError): + os.stat(error_path) + + + def test_args(self): + checks = ['tests.imports.import_args'] + liveness.linux.load(checks, namespace=self.unit, rundir=self.run_dir, args=['foo'], kwargs={'bar': 42}) + f = open(self.pid_path, 'r') + r = f.read() + f.close() + self.assertEqual(str(os.getpid()), r) + + +if __name__ == '__main__': + unittest.main() From 96e755b54d7764d7c834f1e4d2b392d7141d5325 Mon Sep 17 00:00:00 2001 From: nolash Date: Thu, 22 Apr 2021 11:58:39 +0200 Subject: [PATCH 06/17] Simplify token selector --- apps/contract-migration/reset.sh | 9 ++++----- apps/contract-migration/seed_cic_eth.sh | 4 ++-- docker-compose.yml | 2 +- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/apps/contract-migration/reset.sh b/apps/contract-migration/reset.sh index bbdeaa3b..57011010 100755 --- a/apps/contract-migration/reset.sh +++ b/apps/contract-migration/reset.sh @@ -3,7 +3,7 @@ set -a CIC_CHAIN_SPEC=${CIC_CHAIN_SPEC:-evm:bloxberg:8995} -DEV_TOKEN_TYPE=${DEV_TOKEN_TYPE:-giftable} +DEV_TOKEN_TYPE=${DEV_TOKEN_TYPE:-GFT} DEV_ETH_ACCOUNT_RESERVE_MINTER=${DEV_ETH_ACCOUNT_RESERVE_MINTER:-$DEV_ETH_ACCOUNT_CONTRACT_DEPLOYER} DEV_ETH_ACCOUNT_ACCOUNTS_INDEX_WRITER=${DEV_ETH_ACCOUNT_RESERVE_MINTER:-$DEV_ETH_ACCOUNT_CONTRACT_DEPLOYER} DEV_RESERVE_AMOUNT=${DEV_ETH_RESERVE_AMOUNT:-""10000000000000000000000000000000000} @@ -19,9 +19,8 @@ if [ ! -z $DEV_ETH_GAS_PRICE ]; then >&2 echo using static gas price $DEV_ETH_GAS_PRICE fi -if [[ $DEV_TOKEN_TYPE != 'giftable' && $DEV_TOKEN_TYPE != 'sarafu' ]]; then - echo $DEV_TOKEN_TYPE - >&2 echo DEV_TOKEN_TYPE must be one of [giftable,sarafu] +if [[ $DEV_TOKEN_TYPE != 'GFT' && $DEV_TOKEN_TYPE != 'SRF' ]]; then + >&2 echo DEV_TOKEN_TYPE must be one of [GFT,SRF], but was $DEV_TOKEN_TYPE exit 1 fi @@ -61,7 +60,7 @@ if [[ -n "${ETH_PROVIDER}" ]]; then ./wait-for-it.sh "${ETH_PROVIDER_HOST}:${ETH_PROVIDER_PORT}" fi - if [ $DEV_TOKEN_TYPE == 'giftable' ]; then + if [ $DEV_TOKEN_TYPE == 'GFT' ]; then >&2 echo "deploying 'giftable token'" DEV_RESERVE_ADDRESS=`giftable-token-deploy $gas_price_arg -p $ETH_PROVIDER -y $DEV_ETH_KEYSTORE_FILE -i $CIC_CHAIN_SPEC -vv -w --name "Giftable Token" --symbol "GFT" --decimals 6 -vv` else diff --git a/apps/contract-migration/seed_cic_eth.sh b/apps/contract-migration/seed_cic_eth.sh index 84d1258c..5df672ad 100755 --- a/apps/contract-migration/seed_cic_eth.sh +++ b/apps/contract-migration/seed_cic_eth.sh @@ -33,11 +33,11 @@ set -a # get required addresses from registries DEV_TOKEN_INDEX_ADDRESS=`eth-contract-registry-list -i $CIC_CHAIN_SPEC -p $ETH_PROVIDER -r $CIC_REGISTRY_ADDRESS -f brief TokenRegistry` DEV_ACCOUNT_INDEX_ADDRESS=`eth-contract-registry-list -i $CIC_CHAIN_SPEC -p $ETH_PROVIDER -r $CIC_REGISTRY_ADDRESS -f brief AccountRegistry` -DEV_RESERVE_ADDRESS=`eth-token-index-list -i $CIC_CHAIN_SPEC -p $ETH_PROVIDER -a $DEV_TOKEN_INDEX_ADDRESS -f brief SRF` +DEV_RESERVE_ADDRESS=`eth-token-index-list -i $CIC_CHAIN_SPEC -p $ETH_PROVIDER -a $DEV_TOKEN_INDEX_ADDRESS -f brief $DEV_TOKEN_TYPE` cat <&2 echo "create account for gas gifter" diff --git a/docker-compose.yml b/docker-compose.yml index 69a9c318..71681073 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -104,7 +104,7 @@ services: DEV_PIP_EXTRA_INDEX_URL: ${DEV_PIP_EXTRA_INDEX_URL:-https://pip.grassrootseconomics.net:8433} RUN_MASK: ${RUN_MASK:-0} # bit flags; 1: contract migrations 2: seed data DEV_FAUCET_AMOUNT: ${DEV_FAUCET_AMOUNT:-0} - DEV_TOKEN_TYPE: ${DEV_TOKEN_TYPE:-giftable} + DEV_TOKEN_TYPE: ${DEV_TOKEN_TYPE:-GFT} DEV_SARAFU_DEMURRAGE_LEVEL: ${DEV_SARAFU_DEMURRAGE_LEVEL:-196454828847045000000000000000000} DEV_ETH_GAS_PRICE: ${DEV_ETH_GAS_PRICE:-1} command: ["./run_job.sh"] From 3129a78e067ac7a9681bd2ae9981a6c149b6bc23 Mon Sep 17 00:00:00 2001 From: Louis Holbrook Date: Fri, 23 Apr 2021 21:02:51 +0000 Subject: [PATCH 07/17] cic-eth: Add sanity checks for emergency shutdown / liveness tests --- apps/cic-eth/cic_eth/admin/ctrl.py | 12 +++-- apps/cic-eth/cic_eth/check/__init__.py | 0 apps/cic-eth/cic_eth/{k8s => check}/db.py | 1 + apps/cic-eth/cic_eth/check/gas.py | 48 +++++++++++++++++++ apps/cic-eth/cic_eth/check/signer.py | 37 ++++++++++++++ apps/cic-eth/cic_eth/db/enum.py | 9 ++-- .../default/versions/75d4767b3031_lock.py | 6 ++- apps/cic-eth/cic_eth/runnable/ctrl.py | 12 +++-- .../cic_eth/runnable/daemons/tasker.py | 17 +++++-- apps/cic-eth/cic_eth/task.py | 5 ++ apps/cic-eth/cic_eth/version.py | 2 +- apps/cic-eth/config/cic.ini | 3 +- apps/cic-eth/config/docker/cic.ini | 2 + apps/cic-eth/config/docker/eth.ini | 8 +--- apps/cic-eth/config/docker/signer.ini | 2 +- apps/cic-eth/config/eth.ini | 8 +--- apps/cic-eth/requirements.txt | 4 +- apps/cic-eth/setup.cfg | 2 +- apps/contract-migration/docker/Dockerfile | 4 +- apps/contract-migration/seed_cic_eth.sh | 12 +++++ apps/util/liveness/liveness/linux.py | 2 +- apps/util/liveness/setup.py | 2 +- apps/util/liveness/tests/test_imports.py | 4 +- 23 files changed, 165 insertions(+), 37 deletions(-) create mode 100644 apps/cic-eth/cic_eth/check/__init__.py rename apps/cic-eth/cic_eth/{k8s => check}/db.py (99%) create mode 100644 apps/cic-eth/cic_eth/check/gas.py create mode 100644 apps/cic-eth/cic_eth/check/signer.py diff --git a/apps/cic-eth/cic_eth/admin/ctrl.py b/apps/cic-eth/cic_eth/admin/ctrl.py index c3815d3b..0b55ffc5 100644 --- a/apps/cic-eth/cic_eth/admin/ctrl.py +++ b/apps/cic-eth/cic_eth/admin/ctrl.py @@ -32,7 +32,9 @@ def lock(chained_input, chain_spec_dict, address=ZERO_ADDRESS, flags=LockEnum.AL :returns: New lock state for address :rtype: number """ - chain_str = str(ChainSpec.from_dict(chain_spec_dict)) + chain_str = '::' + if chain_spec_dict != None: + chain_str = str(ChainSpec.from_dict(chain_spec_dict)) r = Lock.set(chain_str, flags, address=address, tx_hash=tx_hash) logg.debug('Locked {} for {}, flag now {}'.format(flags, address, r)) return chained_input @@ -51,7 +53,9 @@ def unlock(chained_input, chain_spec_dict, address=ZERO_ADDRESS, flags=LockEnum. :returns: New lock state for address :rtype: number """ - chain_str = str(ChainSpec.from_dict(chain_spec_dict)) + chain_str = '::' + if chain_spec_dict != None: + chain_str = str(ChainSpec.from_dict(chain_spec_dict)) r = Lock.reset(chain_str, flags, address=address) logg.debug('Unlocked {} for {}, flag now {}'.format(flags, address, r)) return chained_input @@ -127,7 +131,9 @@ def unlock_queue(chained_input, chain_spec_dict, address=ZERO_ADDRESS): @celery_app.task(base=CriticalSQLAlchemyTask) def check_lock(chained_input, chain_spec_dict, lock_flags, address=None): - chain_str = str(ChainSpec.from_dict(chain_spec_dict)) + chain_str = '::' + if chain_spec_dict != None: + chain_str = str(ChainSpec.from_dict(chain_spec_dict)) session = SessionBase.create_session() r = Lock.check(chain_str, lock_flags, address=ZERO_ADDRESS, session=session) if address != None: diff --git a/apps/cic-eth/cic_eth/check/__init__.py b/apps/cic-eth/cic_eth/check/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/apps/cic-eth/cic_eth/k8s/db.py b/apps/cic-eth/cic_eth/check/db.py similarity index 99% rename from apps/cic-eth/cic_eth/k8s/db.py rename to apps/cic-eth/cic_eth/check/db.py index 485e1b56..3382a33d 100644 --- a/apps/cic-eth/cic_eth/k8s/db.py +++ b/apps/cic-eth/cic_eth/check/db.py @@ -1,5 +1,6 @@ from cic_eth.db.models.base import SessionBase + def health(*args, **kwargs): session = SessionBase.create_session() session.execute('SELECT count(*) from alembic_version') diff --git a/apps/cic-eth/cic_eth/check/gas.py b/apps/cic-eth/cic_eth/check/gas.py new file mode 100644 index 00000000..b1646fd6 --- /dev/null +++ b/apps/cic-eth/cic_eth/check/gas.py @@ -0,0 +1,48 @@ +# standard imports +import logging + +# external imports +from chainlib.connection import RPCConnection +from chainlib.chain import ChainSpec +from chainlib.eth.gas import balance + +# local imports +from cic_eth.db.models.role import AccountRole +from cic_eth.db.models.base import SessionBase +from cic_eth.db.enum import LockEnum +from cic_eth.error import LockedError +from cic_eth.admin.ctrl import check_lock + +logg = logging.getLogger().getChild(__name__) + + +def health(*args, **kwargs): + + session = SessionBase.create_session() + + config = kwargs['config'] + chain_spec = ChainSpec.from_chain_str(config.get('CIC_CHAIN_SPEC')) + logg.debug('check gas balance of gas gifter for chain {}'.format(chain_spec)) + + try: + check_lock(None, None, LockEnum.INIT) + except LockedError: + logg.warning('INIT lock is set, skipping GAS GIFTER balance check.') + return True + + gas_provider = AccountRole.get_address('GAS_GIFTER', session=session) + session.close() + + rpc = RPCConnection.connect(chain_spec, 'default') + o = balance(gas_provider) + r = rpc.do(o) + try: + r = int(r, 16) + except TypeError: + r = int(r) + gas_min = int(config.get('ETH_GAS_GIFTER_MINIMUM_BALANCE')) + if r < gas_min: + logg.error('EEK! gas gifter has balance {}, below minimum {}'.format(r, gas_min)) + return False + + return True diff --git a/apps/cic-eth/cic_eth/check/signer.py b/apps/cic-eth/cic_eth/check/signer.py new file mode 100644 index 00000000..87b7785f --- /dev/null +++ b/apps/cic-eth/cic_eth/check/signer.py @@ -0,0 +1,37 @@ +# standard imports +import time +import logging +from urllib.error import URLError + +# external imports +from chainlib.connection import RPCConnection +from chainlib.eth.constant import ZERO_ADDRESS +from chainlib.eth.sign import sign_message +from chainlib.error import JSONRPCException + +logg = logging.getLogger().getChild(__name__) + + +def health(*args, **kwargs): + blocked = True + max_attempts = 5 + conn = RPCConnection.connect(kwargs['config'].get('CIC_CHAIN_SPEC'), tag='signer') + for i in range(max_attempts): + idx = i + 1 + logg.debug('attempt signer connection check {}/{}'.format(idx, max_attempts)) + try: + conn.do(sign_message(ZERO_ADDRESS, '0x2a')) + except FileNotFoundError: + pass + except ConnectionError: + pass + except URLError: + pass + except JSONRPCException: + logg.debug('signer connection succeeded') + return True + + if idx < max_attempts: + time.sleep(0.5) + + return False diff --git a/apps/cic-eth/cic_eth/db/enum.py b/apps/cic-eth/cic_eth/db/enum.py index 67a50f0d..2ce3eccd 100644 --- a/apps/cic-eth/cic_eth/db/enum.py +++ b/apps/cic-eth/cic_eth/db/enum.py @@ -74,10 +74,11 @@ class LockEnum(enum.IntEnum): QUEUE: Disable queueing new or modified transactions """ STICKY=1 - CREATE=2 - SEND=4 - QUEUE=8 - QUERY=16 + INIT=2 + CREATE=4 + SEND=8 + QUEUE=16 + QUERY=32 ALL=int(0xfffffffffffffffe) diff --git a/apps/cic-eth/cic_eth/db/migrations/default/versions/75d4767b3031_lock.py b/apps/cic-eth/cic_eth/db/migrations/default/versions/75d4767b3031_lock.py index 656fdd06..cfbbff09 100644 --- a/apps/cic-eth/cic_eth/db/migrations/default/versions/75d4767b3031_lock.py +++ b/apps/cic-eth/cic_eth/db/migrations/default/versions/75d4767b3031_lock.py @@ -5,8 +5,11 @@ Revises: 1f1b3b641d08 Create Date: 2021-04-02 18:41:20.864265 """ +import datetime from alembic import op import sqlalchemy as sa +from chainlib.eth.constant import ZERO_ADDRESS +from cic_eth.db.enum import LockEnum # revision identifiers, used by Alembic. @@ -23,10 +26,11 @@ def upgrade(): sa.Column("address", sa.String(42), nullable=True), sa.Column('blockchain', sa.String), sa.Column("flags", sa.BIGINT(), nullable=False, default=0), - sa.Column("date_created", sa.DateTime, nullable=False), + sa.Column("date_created", sa.DateTime, nullable=False, default=datetime.datetime.utcnow), sa.Column("otx_id", sa.Integer, sa.ForeignKey('otx.id'), nullable=True), ) op.create_index('idx_chain_address', 'lock', ['blockchain', 'address'], unique=True) + op.execute("INSERT INTO lock (address, date_created, blockchain, flags) VALUES('{}', '{}', '::', {})".format(ZERO_ADDRESS, datetime.datetime.utcnow(), LockEnum.INIT | LockEnum.SEND | LockEnum.QUEUE)) def downgrade(): diff --git a/apps/cic-eth/cic_eth/runnable/ctrl.py b/apps/cic-eth/cic_eth/runnable/ctrl.py index 87020851..8f9df080 100644 --- a/apps/cic-eth/cic_eth/runnable/ctrl.py +++ b/apps/cic-eth/cic_eth/runnable/ctrl.py @@ -59,6 +59,7 @@ args_override = { 'CIC_CHAIN_SPEC': getattr(args, 'i'), } # override args +config.dict_override(args_override, 'cli') config.censor('PASSWORD', 'DATABASE') config.censor('PASSWORD', 'SSL') logg.debug('config loaded from {}:\n{}'.format(config_dir, config)) @@ -67,7 +68,9 @@ celery_app = celery.Celery(broker=config.get('CELERY_BROKER_URL'), backend=confi queue = args.q -chain_spec = ChainSpec.from_chain_str(config.get('CIC_CHAIN_SPEC')) +chain_spec = None +if config.get('CIC_CHAIN_SPEC') != None and config.get('CIC_CHAIN_SPEC') != '::': + chain_spec = ChainSpec.from_chain_str(config.get('CIC_CHAIN_SPEC')) admin_api = AdminApi(None) @@ -82,6 +85,9 @@ def lock_names_to_flag(s): # TODO: move each command to submodule def main(): + chain_spec_dict = None + if chain_spec != None: + chain_spec_dict = chain_spec.asdict() if args.command == 'unlock': flags = lock_names_to_flag(args.flags) if not is_checksum_address(args.address): @@ -91,7 +97,7 @@ def main(): 'cic_eth.admin.ctrl.unlock', [ None, - chain_spec.asdict(), + chain_spec_dict, args.address, flags, ], @@ -110,7 +116,7 @@ def main(): 'cic_eth.admin.ctrl.lock', [ None, - chain_spec.asdict(), + chain_spec_dict, args.address, flags, ], diff --git a/apps/cic-eth/cic_eth/runnable/daemons/tasker.py b/apps/cic-eth/cic_eth/runnable/daemons/tasker.py index 2d9d0434..38689243 100644 --- a/apps/cic-eth/cic_eth/runnable/daemons/tasker.py +++ b/apps/cic-eth/cic_eth/runnable/daemons/tasker.py @@ -15,8 +15,10 @@ from chainlib.connection import RPCConnection from chainlib.eth.connection import EthUnixSignerConnection from chainlib.chain import ChainSpec from chainqueue.db.models.otx import Otx +from cic_eth_registry.error import UnknownContractError import liveness.linux + # local imports from cic_eth.eth import ( erc20, @@ -138,11 +140,15 @@ else: chain_spec = ChainSpec.from_chain_str(config.get('CIC_CHAIN_SPEC')) RPCConnection.register_location(config.get('ETH_PROVIDER'), chain_spec, 'default') -RPCConnection.register_location(config.get('SIGNER_SOCKET_PATH'), chain_spec, 'signer', constructor=EthUnixSignerConnection) +#RPCConnection.register_location(config.get('SIGNER_SOCKET_PATH'), chain_spec, 'signer', constructor=EthUnixSignerConnection) +RPCConnection.register_location(config.get('SIGNER_SOCKET_PATH'), chain_spec, 'signer') Otx.tracing = config.true('TASKS_TRACE_QUEUE_STATUS') -liveness.linux.load(health_modules) +#import cic_eth.checks.gas +#if not cic_eth.checks.gas.health(config=config): +# raise RuntimeError() +liveness.linux.load(health_modules, rundir=config.get('CIC_RUN_DIR'), config=config) def main(): argv = ['worker'] @@ -166,7 +172,11 @@ def main(): rpc = RPCConnection.connect(chain_spec, 'default') - connect_registry(rpc, chain_spec, config.get('CIC_REGISTRY_ADDRESS')) + try: + connect_registry(rpc, chain_spec, config.get('CIC_REGISTRY_ADDRESS')) + except UnknownContractError as e: + logg.exception('Registry contract connection failed for {}: {}'.format(config.get('CIC_REGISTRY_ADDRESS'), e)) + sys.exit(1) trusted_addresses_src = config.get('CIC_TRUST_ADDRESS') if trusted_addresses_src == None: @@ -175,6 +185,7 @@ def main(): trusted_addresses = trusted_addresses_src.split(',') for address in trusted_addresses: logg.info('using trusted address {}'.format(address)) + connect_declarator(rpc, chain_spec, trusted_addresses) connect_token_registry(rpc, chain_spec) diff --git a/apps/cic-eth/cic_eth/task.py b/apps/cic-eth/cic_eth/task.py index e95f482f..45ba12b7 100644 --- a/apps/cic-eth/cic_eth/task.py +++ b/apps/cic-eth/cic_eth/task.py @@ -94,3 +94,8 @@ class CriticalWeb3AndSignerTask(CriticalTask): def hello(self): time.sleep(0.1) return id(SessionBase.create_session) + + +@celery_app.task() +def check_health(self): + celery.app.control.shutdown() diff --git a/apps/cic-eth/cic_eth/version.py b/apps/cic-eth/cic_eth/version.py index 1624e647..4740b580 100644 --- a/apps/cic-eth/cic_eth/version.py +++ b/apps/cic-eth/cic_eth/version.py @@ -10,7 +10,7 @@ version = ( 0, 11, 0, - 'beta.7', + 'beta.8', ) version_object = semver.VersionInfo( diff --git a/apps/cic-eth/config/cic.ini b/apps/cic-eth/config/cic.ini index 10ec9cdc..20f1fe8e 100644 --- a/apps/cic-eth/config/cic.ini +++ b/apps/cic-eth/config/cic.ini @@ -3,4 +3,5 @@ registry_address = chain_spec = evm:bloxberg:8996 tx_retry_delay = trust_address = -health_modules = cic_eth.k8s.db +health_modules = cic_eth.check.db,cic_eth.check.signer,cic_eth.check.gas +run_dir = /run diff --git a/apps/cic-eth/config/docker/cic.ini b/apps/cic-eth/config/docker/cic.ini index 50032aa9..45bd47ea 100644 --- a/apps/cic-eth/config/docker/cic.ini +++ b/apps/cic-eth/config/docker/cic.ini @@ -3,3 +3,5 @@ registry_address = chain_spec = evm:bloxberg:8996 trust_address = 0xEb3907eCad74a0013c259D5874AE7f22DcBcC95C tx_retry_delay = 20 +health_modules = cic_eth.check.db,cic_eth.check.signer,cic_eth.check.gas +run_dir = /run diff --git a/apps/cic-eth/config/docker/eth.ini b/apps/cic-eth/config/docker/eth.ini index d162a5e5..9d6b6607 100644 --- a/apps/cic-eth/config/docker/eth.ini +++ b/apps/cic-eth/config/docker/eth.ini @@ -1,8 +1,4 @@ [eth] -#ws_provider = ws://localhost:8546 -#ttp_provider = http://localhost:8545 provider = http://localhost:63545 -gas_provider_address = -#chain_id = -abi_dir = /home/lash/src/ext/cic/grassrootseconomics/cic-contracts/abis -account_accounts_index_writer = +health_modules = cic_eth.check.db,cic_eth.check.gas +gas_gifter_minimum_balance = 10000000000000000000000 diff --git a/apps/cic-eth/config/docker/signer.ini b/apps/cic-eth/config/docker/signer.ini index 69df88d8..fe72206f 100644 --- a/apps/cic-eth/config/docker/signer.ini +++ b/apps/cic-eth/config/docker/signer.ini @@ -1,5 +1,5 @@ [signer] -socket_path = /tmp/crypto-dev-signer/jsonrpc.ipc +socket_path = ipc:///tmp/crypto-dev-signer/jsonrpc.ipc secret = deedbeef database_name = signer_test dev_keys_path = diff --git a/apps/cic-eth/config/eth.ini b/apps/cic-eth/config/eth.ini index 1a6935e1..3b41af90 100644 --- a/apps/cic-eth/config/eth.ini +++ b/apps/cic-eth/config/eth.ini @@ -1,8 +1,4 @@ [eth] -#ws_provider = ws://localhost:8546 -#ttp_provider = http://localhost:8545 provider = http://localhost:8545 -gas_provider_address = -#chain_id = -abi_dir = /usr/local/share/cic/solidity/abi -account_accounts_index_writer = +gas_gifter_minimum_balance = 10000000000000000000000 +health_modules = cic_eth.check.db,cic_eth.check.gas diff --git a/apps/cic-eth/requirements.txt b/apps/cic-eth/requirements.txt index 3ab41375..44d8b272 100644 --- a/apps/cic-eth/requirements.txt +++ b/apps/cic-eth/requirements.txt @@ -1,6 +1,6 @@ -cic-base==0.1.2a79+build.35e442bc +cic-base==0.1.2b1 celery==4.4.7 -crypto-dev-signer~=0.4.14b2 +crypto-dev-signer~=0.4.14b3 confini~=0.3.6rc3 cic-eth-registry~=0.5.4a16 #cic-bancor~=0.0.6 diff --git a/apps/cic-eth/setup.cfg b/apps/cic-eth/setup.cfg index cc0d5549..55bbb4c9 100644 --- a/apps/cic-eth/setup.cfg +++ b/apps/cic-eth/setup.cfg @@ -38,7 +38,7 @@ packages = cic_eth.runnable.daemons.filters cic_eth.callbacks cic_eth.sync - cic_eth.k8s + cic_eth.check scripts = ./scripts/migrate.py diff --git a/apps/contract-migration/docker/Dockerfile b/apps/contract-migration/docker/Dockerfile index c370006c..f0d82cb1 100644 --- a/apps/contract-migration/docker/Dockerfile +++ b/apps/contract-migration/docker/Dockerfile @@ -57,8 +57,8 @@ WORKDIR /home/grassroots USER grassroots ARG pip_extra_index_url=https://pip.grassrootseconomics.net:8433 -ARG cic_base_version=0.1.2a77 -ARG cic_eth_version=0.11.0b6 +ARG cic_base_version=0.1.2a79 +ARG cic_eth_version=0.11.0b8+build.c2286e5c ARG sarafu_faucet_version=0.0.2a28 ARG sarafu_token_version==0.0.1a6 ARG cic_contracts_version=0.0.2a2 diff --git a/apps/contract-migration/seed_cic_eth.sh b/apps/contract-migration/seed_cic_eth.sh index 5df672ad..42db0cab 100755 --- a/apps/contract-migration/seed_cic_eth.sh +++ b/apps/contract-migration/seed_cic_eth.sh @@ -13,6 +13,12 @@ DEV_PIP_EXTRA_INDEX_URL=${DEV_PIP_EXTRA_INDEX_URL:-https://pip.grassrootseconomi DEV_DATABASE_NAME_CIC_ETH=${DEV_DATABASE_NAME_CIC_ETH:-"cic-eth"} CIC_DATA_DIR=${CIC_DATA_DIR:-/tmp/cic} ETH_PASSPHRASE='' +DEV_TOKEN_TYPE=${DEV_TOKEN_TYPE:-giftable} +if [ $DEV_TOKEN_TYPE = 'giftable' ]; then + token_symbol='GFT' +else + token_symbol='SRF' +fi # Debug flag DEV_ETH_ACCOUNT_CONTRACT_DEPLOYER=0xEb3907eCad74a0013c259D5874AE7f22DcBcC95C @@ -46,6 +52,7 @@ DEV_ETH_ACCOUNT_GAS_GIFTER=`cic-eth-create $debug --redis-host-callback=$REDIS_H echo DEV_ETH_ACCOUNT_GAS_GIFTER=$DEV_ETH_ACCOUNT_GAS_GIFTER >> $env_out_file cic-eth-tag -i $CIC_CHAIN_SPEC GAS_GIFTER $DEV_ETH_ACCOUNT_GAS_GIFTER + >&2 echo "create account for sarafu gifter" DEV_ETH_ACCOUNT_SARAFU_GIFTER=`cic-eth-create $debug --redis-host-callback=$REDIS_HOST --redis-port-callback=$REDIS_PORT --no-register` echo DEV_ETH_ACCOUNT_SARAFU_GIFTER=$DEV_ETH_ACCOUNT_SARAFU_GIFTER >> $env_out_file @@ -97,5 +104,10 @@ export DEV_ETH_SARAFU_TOKEN_ADDRESS=$DEV_ETH_RESERVE_ADDRESS #echo -n 0 > $init_level_file +# Remove the SEND (8), QUEUE (16) and INIT (2) locks (or'ed), set by default at migration +cic-eth-ctl -i :: unlock INIT +cic-eth-ctl -i :: unlock SEND +cic-eth-ctl -i :: unlock QUEUE + set +a set +e diff --git a/apps/util/liveness/liveness/linux.py b/apps/util/liveness/liveness/linux.py index 24bb59e6..7ff754f0 100644 --- a/apps/util/liveness/liveness/linux.py +++ b/apps/util/liveness/liveness/linux.py @@ -29,7 +29,7 @@ def load(check_strs, namespace=default_namespace, rundir='/run', *args, **kwargs checks.append(module) for check in checks: - r = check.health(args, kwargs) + r = check.health(*args, **kwargs) if r == False: raise RuntimeError('liveness check {} failed'.format(str(check))) logg.info('liveness check passed: {}'.format(str(check))) diff --git a/apps/util/liveness/setup.py b/apps/util/liveness/setup.py index 3c8b3f2e..ed75fca1 100644 --- a/apps/util/liveness/setup.py +++ b/apps/util/liveness/setup.py @@ -1,7 +1,7 @@ from setuptools import setup setup( name='liveness', - version='0.0.1a6', + version='0.0.1a7', packages=['liveness'], include_package_data=True, ) diff --git a/apps/util/liveness/tests/test_imports.py b/apps/util/liveness/tests/test_imports.py index 02e6be79..3af935ad 100644 --- a/apps/util/liveness/tests/test_imports.py +++ b/apps/util/liveness/tests/test_imports.py @@ -116,7 +116,9 @@ class TestImports(unittest.TestCase): def test_args(self): checks = ['tests.imports.import_args'] - liveness.linux.load(checks, namespace=self.unit, rundir=self.run_dir, args=['foo'], kwargs={'bar': 42}) + aargs=['foo'] + kwaargs={'bar': 42} + liveness.linux.load(checks, self.unit, self.run_dir, *aargs, **kwaargs) f = open(self.pid_path, 'r') r = f.read() f.close() From cfab16f4a93d495f83ec1e1837a45fa1d45ce192 Mon Sep 17 00:00:00 2001 From: Louis Holbrook Date: Sat, 24 Apr 2021 06:14:24 +0000 Subject: [PATCH 08/17] Add custom meta tags --- apps/cic-eth/cic_eth/api/api_task.py | 12 + .../cic_eth/runnable/daemons/tasker.py | 10 +- apps/cic-eth/cic_eth/task.py | 2 + apps/cic-eth/config/cic.ini | 1 + apps/cic-eth/config/docker/cic.ini | 1 + apps/cic-eth/setup.cfg | 1 + apps/contract-migration/reset.sh | 8 +- .../scripts/cic_eth/import_users.py | 46 +- .../scripts/cic_meta/import_meta_custom.js | 139 ++ .../scripts/create_import_users.py | 8 + .../scripts/eth/import_users.py | 51 +- .../scripts/package-lock.json | 2101 ++++++++++++++++- apps/contract-migration/seed_cic_eth.sh | 4 +- docker-compose.yml | 3 +- 14 files changed, 2363 insertions(+), 24 deletions(-) create mode 100644 apps/contract-migration/scripts/cic_meta/import_meta_custom.js diff --git a/apps/cic-eth/cic_eth/api/api_task.py b/apps/cic-eth/cic_eth/api/api_task.py index 52aedee5..93a4d1bf 100644 --- a/apps/cic-eth/cic_eth/api/api_task.py +++ b/apps/cic-eth/cic_eth/api/api_task.py @@ -62,6 +62,18 @@ class Api: ) + def default_token(self): + s_token = celery.signature( + 'cic_eth.admin.token.default_token', + [], + queue=self.queue, + ) + if self.callback_param != None: + s_token.link(self.callback_success) + + return s_token.apply_async() + + def convert_transfer(self, from_address, to_address, target_return, minimum_return, from_token_symbol, to_token_symbol): """Executes a chain of celery tasks that performs conversion between two ERC20 tokens, and transfers to a specified receipient after convert has completed. diff --git a/apps/cic-eth/cic_eth/runnable/daemons/tasker.py b/apps/cic-eth/cic_eth/runnable/daemons/tasker.py index 38689243..8b268d08 100644 --- a/apps/cic-eth/cic_eth/runnable/daemons/tasker.py +++ b/apps/cic-eth/cic_eth/runnable/daemons/tasker.py @@ -30,6 +30,7 @@ from cic_eth.eth import ( from cic_eth.admin import ( debug, ctrl, + token, ) from cic_eth.queue import ( query, @@ -54,6 +55,7 @@ from cic_eth.registry import ( connect_declarator, connect_token_registry, ) +from cic_eth.task import BaseTask logging.basicConfig(level=logging.WARNING) @@ -66,6 +68,7 @@ argparser.add_argument('-p', '--provider', dest='p', type=str, help='rpc provide argparser.add_argument('-c', type=str, default=config_dir, help='config file') argparser.add_argument('-q', type=str, default='cic-eth', help='queue name for worker tasks') argparser.add_argument('-r', type=str, help='CIC registry address') +argparser.add_argument('--default-token-symbol', dest='default_token_symbol', type=str, help='Symbol of default token to use') argparser.add_argument('--abi-dir', dest='abi_dir', type=str, help='Directory containing bytecode and abi') argparser.add_argument('--trace-queue-status', default=None, dest='trace_queue_status', action='store_true', help='set to perist all queue entry status changes to storage') argparser.add_argument('-i', '--chain-spec', dest='i', type=str, help='chain spec') @@ -85,6 +88,7 @@ config.process() args_override = { 'CIC_CHAIN_SPEC': getattr(args, 'i'), 'CIC_REGISTRY_ADDRESS': getattr(args, 'r'), + 'CIC_DEFAULT_TOKEN_SYMBOL': getattr(args, 'default_token_symbol'), 'ETH_PROVIDER': getattr(args, 'p'), 'TASKS_TRACE_QUEUE_STATUS': getattr(args, 'trace_queue_status'), } @@ -173,7 +177,7 @@ def main(): rpc = RPCConnection.connect(chain_spec, 'default') try: - connect_registry(rpc, chain_spec, config.get('CIC_REGISTRY_ADDRESS')) + registry = connect_registry(rpc, chain_spec, config.get('CIC_REGISTRY_ADDRESS')) except UnknownContractError as e: logg.exception('Registry contract connection failed for {}: {}'.format(config.get('CIC_REGISTRY_ADDRESS'), e)) sys.exit(1) @@ -188,6 +192,10 @@ def main(): connect_declarator(rpc, chain_spec, trusted_addresses) connect_token_registry(rpc, chain_spec) + + BaseTask.default_token_symbol = config.get('CIC_DEFAULT_TOKEN_SYMBOL') + BaseTask.default_token_address = registry.by_name(BaseTask.default_token_symbol) + logg.info('default token set to {} {}'.format(BaseTask.default_token_symbol, BaseTask.default_token_address)) liveness.linux.set() current_app.worker_main(argv) diff --git a/apps/cic-eth/cic_eth/task.py b/apps/cic-eth/cic_eth/task.py index 45ba12b7..4c4a7f78 100644 --- a/apps/cic-eth/cic_eth/task.py +++ b/apps/cic-eth/cic_eth/task.py @@ -29,6 +29,8 @@ class BaseTask(celery.Task): call_address = ZERO_ADDRESS create_nonce_oracle = RPCNonceOracle create_gas_oracle = RPCGasOracle + default_token_address = None + default_token_symbol = None def create_session(self): return BaseTask.session_func() diff --git a/apps/cic-eth/config/cic.ini b/apps/cic-eth/config/cic.ini index 20f1fe8e..bce15e14 100644 --- a/apps/cic-eth/config/cic.ini +++ b/apps/cic-eth/config/cic.ini @@ -3,5 +3,6 @@ registry_address = chain_spec = evm:bloxberg:8996 tx_retry_delay = trust_address = +default_token_symbol = GFT health_modules = cic_eth.check.db,cic_eth.check.signer,cic_eth.check.gas run_dir = /run diff --git a/apps/cic-eth/config/docker/cic.ini b/apps/cic-eth/config/docker/cic.ini index 45bd47ea..e4b9e0bd 100644 --- a/apps/cic-eth/config/docker/cic.ini +++ b/apps/cic-eth/config/docker/cic.ini @@ -3,5 +3,6 @@ registry_address = chain_spec = evm:bloxberg:8996 trust_address = 0xEb3907eCad74a0013c259D5874AE7f22DcBcC95C tx_retry_delay = 20 +default_token_symbol = GFT health_modules = cic_eth.check.db,cic_eth.check.signer,cic_eth.check.gas run_dir = /run diff --git a/apps/cic-eth/setup.cfg b/apps/cic-eth/setup.cfg index 55bbb4c9..36c90f14 100644 --- a/apps/cic-eth/setup.cfg +++ b/apps/cic-eth/setup.cfg @@ -53,6 +53,7 @@ console_scripts = cic-eth-create = cic_eth.runnable.create:main cic-eth-inspect = cic_eth.runnable.view:main cic-eth-ctl = cic_eth.runnable.ctrl:main + cic-eth-info = cic_eth.runnable.info:main # TODO: Merge this with ctl when subcmds sorted to submodules cic-eth-tag = cic_eth.runnable.tag:main cic-eth-resend = cic_eth.runnable.resend:main diff --git a/apps/contract-migration/reset.sh b/apps/contract-migration/reset.sh index 57011010..4ecf2fba 100755 --- a/apps/contract-migration/reset.sh +++ b/apps/contract-migration/reset.sh @@ -3,7 +3,7 @@ set -a CIC_CHAIN_SPEC=${CIC_CHAIN_SPEC:-evm:bloxberg:8995} -DEV_TOKEN_TYPE=${DEV_TOKEN_TYPE:-GFT} +CIC_DEFAULT_TOKEN_SYMBOL=${CIC_DEFAULT_TOKEN_SYMBOL:-GFT} DEV_ETH_ACCOUNT_RESERVE_MINTER=${DEV_ETH_ACCOUNT_RESERVE_MINTER:-$DEV_ETH_ACCOUNT_CONTRACT_DEPLOYER} DEV_ETH_ACCOUNT_ACCOUNTS_INDEX_WRITER=${DEV_ETH_ACCOUNT_RESERVE_MINTER:-$DEV_ETH_ACCOUNT_CONTRACT_DEPLOYER} DEV_RESERVE_AMOUNT=${DEV_ETH_RESERVE_AMOUNT:-""10000000000000000000000000000000000} @@ -19,8 +19,8 @@ if [ ! -z $DEV_ETH_GAS_PRICE ]; then >&2 echo using static gas price $DEV_ETH_GAS_PRICE fi -if [[ $DEV_TOKEN_TYPE != 'GFT' && $DEV_TOKEN_TYPE != 'SRF' ]]; then - >&2 echo DEV_TOKEN_TYPE must be one of [GFT,SRF], but was $DEV_TOKEN_TYPE +if [[ $CIC_DEFAULT_TOKEN_SYMBOL != 'GFT' && $CIC_DEFAULT_TOKEN_SYMBOL != 'SRF' ]]; then + >&2 echo CIC_DEFAULT_TOKEN_SYMBOL must be one of [GFT,SRF], but was $CIC_DEFAULT_TOKEN_SYMBOL exit 1 fi @@ -60,7 +60,7 @@ if [[ -n "${ETH_PROVIDER}" ]]; then ./wait-for-it.sh "${ETH_PROVIDER_HOST}:${ETH_PROVIDER_PORT}" fi - if [ $DEV_TOKEN_TYPE == 'GFT' ]; then + if [ $CIC_DEFAULT_TOKEN_SYMBOL == 'GFT' ]; then >&2 echo "deploying 'giftable token'" DEV_RESERVE_ADDRESS=`giftable-token-deploy $gas_price_arg -p $ETH_PROVIDER -y $DEV_ETH_KEYSTORE_FILE -i $CIC_CHAIN_SPEC -vv -w --name "Giftable Token" --symbol "GFT" --decimals 6 -vv` else diff --git a/apps/contract-migration/scripts/cic_eth/import_users.py b/apps/contract-migration/scripts/cic_eth/import_users.py index f5312187..d27bf09b 100644 --- a/apps/contract-migration/scripts/cic_eth/import_users.py +++ b/apps/contract-migration/scripts/cic_eth/import_users.py @@ -32,6 +32,7 @@ default_config_dir = '/usr/local/etc/cic' argparser = argparse.ArgumentParser() argparser.add_argument('-c', type=str, default=default_config_dir, help='config file') argparser.add_argument('-i', '--chain-spec', dest='i', type=str, help='Chain specification string') +argparser.add_argument('--old-chain-spec', type=str, dest='old_chain_spec', default='evm:oldchain:1', help='chain spec') argparser.add_argument('--redis-host', dest='redis_host', type=str, help='redis host to use for task submission') argparser.add_argument('--redis-port', dest='redis_port', type=int, help='redis host to use for task submission') argparser.add_argument('--redis-db', dest='redis_db', type=int, help='redis db to use for task submission and callback') @@ -76,6 +77,11 @@ os.makedirs(user_new_dir) meta_dir = os.path.join(args.user_dir, 'meta') os.makedirs(meta_dir) +custom_dir = os.path.join(args.user_dir, 'custom') +os.makedirs(custom_dir) +os.makedirs(os.path.join(custom_dir, 'new')) +os.makedirs(os.path.join(custom_dir, 'meta')) + phone_dir = os.path.join(args.user_dir, 'phone') os.makedirs(os.path.join(phone_dir, 'meta')) @@ -85,6 +91,11 @@ os.stat(user_old_dir) txs_dir = os.path.join(args.user_dir, 'txs') os.makedirs(txs_dir) +user_dir = args.user_dir + +old_chain_spec = ChainSpec.from_chain_str(args.old_chain_spec) +old_chain_str = str(old_chain_spec) + chain_spec = ChainSpec.from_chain_str(config.get('CIC_CHAIN_SPEC')) chain_str = str(chain_spec) @@ -133,7 +144,17 @@ def register_eth(i, u): if __name__ == '__main__': - #fi = open(os.path.join(user_out_dir, 'addresses.csv'), 'a') + user_tags = {} + f = open(os.path.join(user_dir, 'tags.csv'), 'r') + while True: + r = f.readline().rstrip() + if len(r) == 0: + break + (old_address, tags_csv) = r.split(':') + old_address = strip_0x(old_address) + user_tags[old_address] = tags_csv.split(',') + logg.debug('read tags {} for old address {}'.format(user_tags[old_address], old_address)) + i = 0 j = 0 @@ -198,6 +219,29 @@ if __name__ == '__main__': os.symlink(os.path.realpath(filepath), meta_phone_filepath) + # custom data + custom_key = generate_metadata_pointer(phone.encode('utf-8'), ':cic.custom') + custom_filepath = os.path.join(custom_dir, 'meta', custom_key) + + filepath = os.path.join( + custom_dir, + 'new', + custom_key[:2].upper(), + custom_key[2:4].upper(), + custom_key.upper() + '.json', + ) + os.makedirs(os.path.dirname(filepath), exist_ok=True) + + sub_old_chain_str = '{}:{}'.format(old_chain_spec.common_name(), old_chain_spec.network_id()) + f = open(filepath, 'w') + k = u.identities['evm'][sub_old_chain_str][0] + tag_data = {'tags': user_tags[strip_0x(k)]} + f.write(json.dumps(tag_data)) + f.close() + + os.symlink(os.path.realpath(filepath), custom_filepath) + + i += 1 sys.stdout.write('imported {} {}'.format(i, u).ljust(200) + "\r") diff --git a/apps/contract-migration/scripts/cic_meta/import_meta_custom.js b/apps/contract-migration/scripts/cic_meta/import_meta_custom.js new file mode 100644 index 00000000..18ce37e9 --- /dev/null +++ b/apps/contract-migration/scripts/cic_meta/import_meta_custom.js @@ -0,0 +1,139 @@ +const fs = require('fs'); +const path = require('path'); +const http = require('http'); + +const cic = require('cic-client-meta'); +const vcfp = require('vcard-parser'); + +//const conf = JSON.parse(fs.readFileSync('./cic.conf')); + +const config = new cic.Config('./config'); +config.process(); +console.log(config); + + +function sendit(uid, envelope) { + const d = envelope.toJSON(); + + const contentLength = (new TextEncoder().encode(d)).length; + const opts = { + method: 'PUT', + headers: { + 'Content-Type': 'application/json', + 'Content-Length': contentLength, + 'X-CIC-AUTOMERGE': 'client', + + }, + }; + let url = config.get('META_URL'); + url = url.replace(new RegExp('^(.+://[^/]+)/*$'), '$1/'); + console.log('posting to url: ' + url + uid); + const req = http.request(url + uid, opts, (res) => { + res.on('data', process.stdout.write); + res.on('end', () => { + console.log('result', res.statusCode, res.headers); + }); + }); + if (!req.write(d)) { + console.error('foo', d); + process.exit(1); + } + req.end(); +} + +function doOne(keystore, filePath, identifier) { + const signer = new cic.PGPSigner(keystore); + + const o = JSON.parse(fs.readFileSync(filePath).toString()); + //const b = Buffer.from(j['vcard'], 'base64'); + //const s = b.toString(); + //const o = vcfp.parse(s); + //const phone = o.tel[0].value; + + //cic.Phone.toKey(phone).then((uid) => { + //const o = fs.readFileSync(filePath, 'utf-8'); + + const s = new cic.Syncable(identifier, o); + s.setSigner(signer); + s.onwrap = (env) => { + sendit(identifier, env); + }; + s.sign(); + //}); +} + +const privateKeyPath = path.join(config.get('PGP_EXPORTS_DIR'), config.get('PGP_PRIVATE_KEY_FILE')); +const publicKeyPath = path.join(config.get('PGP_EXPORTS_DIR'), config.get('PGP_PRIVATE_KEY_FILE')); +pk = fs.readFileSync(privateKeyPath); +pubk = fs.readFileSync(publicKeyPath); + +new cic.PGPKeyStore( + config.get('PGP_PASSPHRASE'), + pk, + pubk, + undefined, + undefined, + importMetaCustom, +); + +const batchSize = 16; +const batchDelay = 1000; +const total = parseInt(process.argv[3]); +const dataDir = process.argv[2]; +const workDir = path.join(dataDir, 'custom/meta'); +const userDir = path.join(dataDir, 'custom/new'); +let count = 0; +let batchCount = 0; + + +function importMetaCustom(keystore) { + let err; + let files; + + try { + err, files = fs.readdirSync(workDir); + } catch { + console.error('source directory not yet ready', workDir); + setTimeout(importMetaPhone, batchDelay, keystore); + return; + } + let limit = batchSize; + if (files.length < limit) { + limit = files.length; + } + for (let i = 0; i < limit; i++) { + const file = files[i]; + if (file.length < 3) { + console.debug('skipping file', file); + continue; + } + //const identifier = file.substr(0,file.length-5); + const identifier = file; + const filePath = path.join(workDir, file); + console.log(filePath); + + //const address = fs.readFileSync(filePath).toString().substring(2).toUpperCase(); + const custom = JSON.parse(fs.readFileSync(filePath).toString()); + const customFilePath = path.join( + userDir, + identifier.substring(0, 2), + identifier.substring(2, 4), + identifier + '.json', + ); + + doOne(keystore, filePath, identifier); + fs.unlinkSync(filePath); + count++; + batchCount++; + if (batchCount == batchSize) { + console.debug('reached batch size, breathing'); + batchCount=0; + setTimeout(importMeta, batchDelay, keystore); + return; + } + } + if (count == total) { + return; + } + setTimeout(importMetaCustom, 100, keystore); +} diff --git a/apps/contract-migration/scripts/create_import_users.py b/apps/contract-migration/scripts/create_import_users.py index 9f7c3d9c..fbd919b3 100644 --- a/apps/contract-migration/scripts/create_import_users.py +++ b/apps/contract-migration/scripts/create_import_users.py @@ -37,6 +37,7 @@ config_dir = os.environ.get('CONFINI_DIR', os.path.join(script_dir, 'config')) argparser = argparse.ArgumentParser() argparser.add_argument('-c', type=str, default=config_dir, help='Config dir') +argparser.add_argument('--tag', type=str, action='append', help='Tags to add to record') argparser.add_argument('--gift-threshold', type=int, help='If set, users will be funded with additional random balance (in token integer units)') argparser.add_argument('-v', action='store_true', help='Be verbose') argparser.add_argument('-vv', action='store_true', help='Be more verbose') @@ -81,6 +82,10 @@ phone_idx = [] user_dir = args.dir user_count = args.user_count +tags = args.tag +if tags == None or len(tags) == 0: + tags = ['individual'] + random.seed() def genPhoneIndex(phone): @@ -189,6 +194,7 @@ if __name__ == '__main__': os.makedirs(base_dir, exist_ok=True) fa = open(os.path.join(user_dir, 'balances.csv'), 'w') + ft = open(os.path.join(user_dir, 'tags.csv'), 'w') i = 0 while i < user_count: @@ -215,10 +221,12 @@ if __name__ == '__main__': f.write(eth) f.close() + ft.write('{}:{}\n'.format(eth, ','.join(tags))) amount = genAmount() fa.write('{},{}\n'.format(eth,amount)) logg.debug('pidx {}, uid {}, eth {}, amount {}, phone {}'.format(pidx, uid, eth, amount, phone)) i += 1 + ft.close() fa.close() diff --git a/apps/contract-migration/scripts/eth/import_users.py b/apps/contract-migration/scripts/eth/import_users.py index ed3659d6..f81a1077 100644 --- a/apps/contract-migration/scripts/eth/import_users.py +++ b/apps/contract-migration/scripts/eth/import_users.py @@ -38,6 +38,7 @@ argparser = argparse.ArgumentParser() argparser.add_argument('-p', '--provider', dest='p', default='http://localhost:8545', type=str, help='Web3 provider url (http only)') argparser.add_argument('-y', '--key-file', dest='y', type=str, help='Ethereum keystore file to use for signing') argparser.add_argument('-c', type=str, default=default_config_dir, help='config file') +argparser.add_argument('--old-chain-spec', type=str, dest='old_chain_spec', default='evm:oldchain:1', help='chain spec') argparser.add_argument('-i', '--chain-spec', dest='i', type=str, help='Chain specification string') argparser.add_argument('-r', '--registry', dest='r', type=str, help='Contract registry address') argparser.add_argument('--batch-size', dest='batch_size', default=50, type=int, help='burst size of sending transactions to node') @@ -68,6 +69,11 @@ os.makedirs(user_new_dir) meta_dir = os.path.join(args.user_dir, 'meta') os.makedirs(meta_dir) +custom_dir = os.path.join(args.user_dir, 'custom') +os.makedirs(custom_dir) +os.makedirs(os.path.join(custom_dir, 'new')) +os.makedirs(os.path.join(custom_dir, 'meta')) + phone_dir = os.path.join(args.user_dir, 'phone') os.makedirs(os.path.join(phone_dir, 'meta')) @@ -77,9 +83,14 @@ os.stat(user_old_dir) txs_dir = os.path.join(args.user_dir, 'txs') os.makedirs(txs_dir) +user_dir = args.user_dir + chain_spec = ChainSpec.from_chain_str(config.get('CIC_CHAIN_SPEC')) chain_str = str(chain_spec) +old_chain_spec = ChainSpec.from_chain_str(args.old_chain_spec) +old_chain_str = str(old_chain_spec) + batch_size = args.batch_size batch_delay = args.batch_delay @@ -127,12 +138,18 @@ def register_eth(i, u): return address -def register_ussd(u): - pass - - if __name__ == '__main__': + user_tags = {} + f = open(os.path.join(user_dir, 'tags.csv'), 'r') + while True: + r = f.readline().rstrip() + if len(r) == 0: + break + (old_address, tags_csv) = r.split(':') + old_address = strip_0x(old_address) + user_tags[old_address] = tags_csv.split(',') + logg.debug('read tags {} for old address {}'.format(user_tags[old_address], old_address)) i = 0 j = 0 @@ -150,6 +167,7 @@ if __name__ == '__main__': continue f.close() u = Person.deserialize(o) + logg.debug('u {}'.format(o)) new_address = register_eth(i, u) if u.identities.get('evm') == None: @@ -157,8 +175,6 @@ if __name__ == '__main__': sub_chain_str = '{}:{}'.format(chain_spec.common_name(), chain_spec.network_id()) u.identities['evm'][sub_chain_str] = [new_address] - register_ussd(u) - new_address_clean = strip_0x(new_address) filepath = os.path.join( user_new_dir, @@ -198,6 +214,29 @@ if __name__ == '__main__': os.symlink(os.path.realpath(filepath), meta_phone_filepath) + + # custom data + custom_key = generate_metadata_pointer(phone.encode('utf-8'), ':cic.custom') + custom_filepath = os.path.join(custom_dir, 'meta', custom_key) + + filepath = os.path.join( + custom_dir, + 'new', + custom_key[:2].upper(), + custom_key[2:4].upper(), + custom_key.upper() + '.json', + ) + os.makedirs(os.path.dirname(filepath), exist_ok=True) + + sub_old_chain_str = '{}:{}'.format(old_chain_spec.common_name(), old_chain_spec.network_id()) + f = open(filepath, 'w') + k = u.identities['evm'][sub_old_chain_str][0] + tag_data = {'tags': user_tags[strip_0x(k)]} + f.write(json.dumps(tag_data)) + f.close() + + os.symlink(os.path.realpath(filepath), custom_filepath) + i += 1 sys.stdout.write('imported {} {}'.format(i, u).ljust(200) + "\r") diff --git a/apps/contract-migration/scripts/package-lock.json b/apps/contract-migration/scripts/package-lock.json index b99a4777..a9957bbc 100644 --- a/apps/contract-migration/scripts/package-lock.json +++ b/apps/contract-migration/scripts/package-lock.json @@ -1,6 +1,2089 @@ { + "name": "scripts", + "lockfileVersion": 2, "requires": true, - "lockfileVersion": 1, + "packages": { + "": { + "dependencies": { + "cic-client-meta": "0.0.7-alpha.6", + "vcard-parser": "^1.0.0" + } + }, + "node_modules/@ethereumjs/common": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/@ethereumjs/common/-/common-2.2.0.tgz", + "integrity": "sha512-PyQiTG00MJtBRkJmv46ChZL8u2XWxNBeAthznAUIUiefxPAXjbkuiCZOuncgJS34/XkMbNc9zMt/PlgKRBElig==", + "dependencies": { + "crc-32": "^1.2.0", + "ethereumjs-util": "^7.0.9" + } + }, + "node_modules/@ethereumjs/tx": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/@ethereumjs/tx/-/tx-3.1.3.tgz", + "integrity": "sha512-DJBu6cbwYtiPTFeCUR8DF5p+PF0jxs+0rALJZiEcTz2tiRPIEkM72GEbrkGuqzENLCzBrJHT43O0DxSYTqeo+g==", + "dependencies": { + "@ethereumjs/common": "^2.2.0", + "ethereumjs-util": "^7.0.10" + } + }, + "node_modules/@types/bn.js": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/@types/bn.js/-/bn.js-5.1.0.tgz", + "integrity": "sha512-QSSVYj7pYFN49kW77o2s9xTCwZ8F2xLbjLLSEVh8D2F4JUhZtPAGOFLTD+ffqksBx/u4cE/KImFjyhqCjn/LIA==", + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/node": { + "version": "14.14.41", + "resolved": "https://registry.npmjs.org/@types/node/-/node-14.14.41.tgz", + "integrity": "sha512-dueRKfaJL4RTtSa7bWeTK1M+VH+Gns73oCgzvYfHZywRCoPSd8EkXBL0mZ9unPTveBn+D9phZBaxuzpwjWkW0g==" + }, + "node_modules/@types/pbkdf2": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/@types/pbkdf2/-/pbkdf2-3.1.0.tgz", + "integrity": "sha512-Cf63Rv7jCQ0LaL8tNXmEyqTHuIJxRdlS5vMh1mj5voN4+QFhVZnlZruezqpWYDiJ8UTzhP0VmeLXCmBk66YrMQ==", + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/secp256k1": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/@types/secp256k1/-/secp256k1-4.0.2.tgz", + "integrity": "sha512-QMg+9v0bbNJ2peLuHRWxzmy0HRJIG6gFZNhaRSp7S3ggSbCCxiqQB2/ybvhXyhHOCequpNkrx7OavNhrWOsW0A==", + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/abbrev": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", + "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==" + }, + "node_modules/aes-js": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/aes-js/-/aes-js-3.1.2.tgz", + "integrity": "sha512-e5pEa2kBnBOgR4Y/p20pskXI74UEz7de8ZGVo58asOtvSVG5YAbJeELPZxOmt+Bnz3rX753YKhfIn4X4l1PPRQ==" + }, + "node_modules/ajv": { + "version": "6.12.6", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", + "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", + "optional": true, + "dependencies": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + } + }, + "node_modules/ansi-regex": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/aproba": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/aproba/-/aproba-1.2.0.tgz", + "integrity": "sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw==" + }, + "node_modules/are-we-there-yet": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-1.1.5.tgz", + "integrity": "sha512-5hYdAkZlcG8tOLujVDTgCT+uPX0VnpAH28gWsLfzpXYm7wP6mp5Q/gYyR7YQ0cKVJcXJnl3j2kpBan13PtQf6w==", + "dependencies": { + "delegates": "^1.0.0", + "readable-stream": "^2.0.6" + } + }, + "node_modules/are-we-there-yet/node_modules/readable-stream": { + "version": "2.3.7", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", + "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", + "dependencies": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "node_modules/are-we-there-yet/node_modules/safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + }, + "node_modules/are-we-there-yet/node_modules/string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "dependencies": { + "safe-buffer": "~5.1.0" + } + }, + "node_modules/asn1": { + "version": "0.2.4", + "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.4.tgz", + "integrity": "sha512-jxwzQpLQjSmWXgwaCZE9Nz+glAG01yF1QnWgbhGwHI5A6FRIEY6IVqtHhIepHqI7/kyEyQEagBC5mBEFlIYvdg==", + "optional": true, + "dependencies": { + "safer-buffer": "~2.1.0" + } + }, + "node_modules/asn1.js": { + "version": "5.4.1", + "resolved": "https://registry.npmjs.org/asn1.js/-/asn1.js-5.4.1.tgz", + "integrity": "sha512-+I//4cYPccV8LdmBLiX8CYvf9Sp3vQsrqu2QNXRcrbiWvcx/UdlFiqUJJzxRQxgsZmvhXhn4cSKeSmoFjVdupA==", + "dependencies": { + "bn.js": "^4.0.0", + "inherits": "^2.0.1", + "minimalistic-assert": "^1.0.0", + "safer-buffer": "^2.1.0" + } + }, + "node_modules/asn1.js/node_modules/bn.js": { + "version": "4.12.0", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", + "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==" + }, + "node_modules/assert-plus": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", + "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=", + "optional": true, + "engines": { + "node": ">=0.8" + } + }, + "node_modules/asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=", + "optional": true + }, + "node_modules/automerge": { + "version": "0.14.2", + "resolved": "https://registry.npmjs.org/automerge/-/automerge-0.14.2.tgz", + "integrity": "sha512-shiwuJHCbNRI23WZyIECLV4Ovf3WiAFJ7P9BH4l5gON1In/UUbjcSJKRygtIirObw2UQumeYxp3F2XBdSvQHnA==", + "dependencies": { + "immutable": "^3.8.2", + "transit-immutable-js": "^0.7.0", + "transit-js": "^0.8.861", + "uuid": "^3.4.0" + } + }, + "node_modules/aws-sign2": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", + "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=", + "optional": true, + "engines": { + "node": "*" + } + }, + "node_modules/aws4": { + "version": "1.11.0", + "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.11.0.tgz", + "integrity": "sha512-xh1Rl34h6Fi1DC2WWKfxUTVqRsNnr6LsKz2+hfwDxQJWmrx8+c7ylaqBMcHfl1U1r2dsifOvKX3LQuLNZ+XSvA==", + "optional": true + }, + "node_modules/balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" + }, + "node_modules/base-x": { + "version": "3.0.8", + "resolved": "https://registry.npmjs.org/base-x/-/base-x-3.0.8.tgz", + "integrity": "sha512-Rl/1AWP4J/zRrk54hhlxH4drNxPJXYUaKffODVI53/dAsV4t9fBxyxYKAVPU1XBHxYwOWP9h9H0hM2MVw4YfJA==", + "dependencies": { + "safe-buffer": "^5.0.1" + } + }, + "node_modules/bcrypt-pbkdf": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", + "integrity": "sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4=", + "optional": true, + "dependencies": { + "tweetnacl": "^0.14.3" + } + }, + "node_modules/blakejs": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/blakejs/-/blakejs-1.1.0.tgz", + "integrity": "sha1-ad+S75U6qIylGjLfarHFShVfx6U=" + }, + "node_modules/block-stream": { + "version": "0.0.9", + "resolved": "https://registry.npmjs.org/block-stream/-/block-stream-0.0.9.tgz", + "integrity": "sha1-E+v+d4oDIFz+A3UUgeu0szAMEmo=", + "optional": true, + "dependencies": { + "inherits": "~2.0.0" + }, + "engines": { + "node": "0.4 || >=0.5.8" + } + }, + "node_modules/bn.js": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.0.tgz", + "integrity": "sha512-D7iWRBvnZE8ecXiLj/9wbxH7Tk79fAh8IHaTNq1RWRixsS02W+5qS+iE9yq6RYl0asXx5tw0bLhmT5pIfbSquw==" + }, + "node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/brorand": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/brorand/-/brorand-1.1.0.tgz", + "integrity": "sha1-EsJe/kCkXjwyPrhnWgoM5XsiNx8=" + }, + "node_modules/browserify-aes": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/browserify-aes/-/browserify-aes-1.2.0.tgz", + "integrity": "sha512-+7CHXqGuspUn/Sl5aO7Ea0xWGAtETPXNSAjHo48JfLdPWcMng33Xe4znFvQweqc/uzk5zSOI3H52CYnjCfb5hA==", + "dependencies": { + "buffer-xor": "^1.0.3", + "cipher-base": "^1.0.0", + "create-hash": "^1.1.0", + "evp_bytestokey": "^1.0.3", + "inherits": "^2.0.1", + "safe-buffer": "^5.0.1" + } + }, + "node_modules/bs58": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/bs58/-/bs58-4.0.1.tgz", + "integrity": "sha1-vhYedsNU9veIrkBx9j806MTwpCo=", + "dependencies": { + "base-x": "^3.0.2" + } + }, + "node_modules/bs58check": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/bs58check/-/bs58check-2.1.2.tgz", + "integrity": "sha512-0TS1jicxdU09dwJMNZtVAfzPi6Q6QeN0pM1Fkzrjn+XYHvzMKPU3pHVpva+769iNVSfIYWf7LJ6WR+BuuMf8cA==", + "dependencies": { + "bs58": "^4.0.0", + "create-hash": "^1.1.0", + "safe-buffer": "^5.1.2" + } + }, + "node_modules/buffer-writer": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/buffer-writer/-/buffer-writer-2.0.0.tgz", + "integrity": "sha512-a7ZpuTZU1TRtnwyCNW3I5dc0wWNC3VR9S++Ewyk2HHZdrO3CQJqSpd+95Us590V6AL7JqUAH2IwZ/398PmNFgw==", + "engines": { + "node": ">=4" + } + }, + "node_modules/buffer-xor": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/buffer-xor/-/buffer-xor-1.0.3.tgz", + "integrity": "sha1-JuYe0UIvtw3ULm42cp7VHYVf6Nk=" + }, + "node_modules/caseless": { + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", + "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=", + "optional": true + }, + "node_modules/chownr": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.4.tgz", + "integrity": "sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg==" + }, + "node_modules/cic-client-meta": { + "version": "0.0.7-alpha.6", + "resolved": "https://registry.npmjs.org/cic-client-meta/-/cic-client-meta-0.0.7-alpha.6.tgz", + "integrity": "sha512-oIN1aHkPHfsxJKDV6k4f1kX2tcppw3Q+D1b4BoPh0hYjNKNb7gImBMWnGsy8uiD9W6SNYE4sIXyrtct8mvrhsw==", + "dependencies": { + "@ethereumjs/tx": "^3.0.0-beta.1", + "automerge": "^0.14.1", + "ethereumjs-wallet": "^1.0.1", + "ini": "^1.3.5", + "openpgp": "^4.10.8", + "pg": "^8.4.2", + "sqlite3": "^5.0.0", + "yargs": "^16.1.0" + }, + "engines": { + "node": "~14.16.1" + } + }, + "node_modules/cipher-base": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/cipher-base/-/cipher-base-1.0.4.tgz", + "integrity": "sha512-Kkht5ye6ZGmwv40uUDZztayT2ThLQGfnj/T71N/XzeZeo3nf8foyW7zGTsPYkEya3m5f3cAypH+qe7YOrM1U2Q==", + "dependencies": { + "inherits": "^2.0.1", + "safe-buffer": "^5.0.1" + } + }, + "node_modules/cliui": { + "version": "7.0.4", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz", + "integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==", + "dependencies": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.0", + "wrap-ansi": "^7.0.0" + } + }, + "node_modules/cliui/node_modules/ansi-regex": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", + "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==", + "engines": { + "node": ">=8" + } + }, + "node_modules/cliui/node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "engines": { + "node": ">=8" + } + }, + "node_modules/cliui/node_modules/string-width": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.2.tgz", + "integrity": "sha512-XBJbT3N4JhVumXE0eoLU9DCjcaF92KLNqTmFCnG1pf8duUxFGwtP6AD6nkjw9a3IdiRtL3E2w3JDiE/xi3vOeA==", + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/cliui/node_modules/strip-ansi": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", + "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", + "dependencies": { + "ansi-regex": "^5.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/code-point-at": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", + "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" + }, + "node_modules/combined-stream": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", + "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "optional": true, + "dependencies": { + "delayed-stream": "~1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=" + }, + "node_modules/console-control-strings": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz", + "integrity": "sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4=" + }, + "node_modules/core-util-is": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", + "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" + }, + "node_modules/crc-32": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/crc-32/-/crc-32-1.2.0.tgz", + "integrity": "sha512-1uBwHxF+Y/4yF5G48fwnKq6QsIXheor3ZLPT80yGBV1oEUwpPojlEhQbWKVw1VwcTQyMGHK1/XMmTjmlsmTTGA==", + "dependencies": { + "exit-on-epipe": "~1.0.1", + "printj": "~1.1.0" + }, + "bin": { + "crc32": "bin/crc32.njs" + }, + "engines": { + "node": ">=0.8" + } + }, + "node_modules/create-hash": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/create-hash/-/create-hash-1.2.0.tgz", + "integrity": "sha512-z00bCGNHDG8mHAkP7CtT1qVu+bFQUPjYq/4Iv3C3kWjTFV10zIjfSoeqXo9Asws8gwSHDGj/hl2u4OGIjapeCg==", + "dependencies": { + "cipher-base": "^1.0.1", + "inherits": "^2.0.1", + "md5.js": "^1.3.4", + "ripemd160": "^2.0.1", + "sha.js": "^2.4.0" + } + }, + "node_modules/create-hmac": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/create-hmac/-/create-hmac-1.1.7.tgz", + "integrity": "sha512-MJG9liiZ+ogc4TzUwuvbER1JRdgvUFSB5+VR/g5h82fGaIRWMWddtKBHi7/sVhfjQZ6SehlyhvQYrcYkaUIpLg==", + "dependencies": { + "cipher-base": "^1.0.3", + "create-hash": "^1.1.0", + "inherits": "^2.0.1", + "ripemd160": "^2.0.0", + "safe-buffer": "^5.0.1", + "sha.js": "^2.4.8" + } + }, + "node_modules/dashdash": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", + "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=", + "optional": true, + "dependencies": { + "assert-plus": "^1.0.0" + }, + "engines": { + "node": ">=0.10" + } + }, + "node_modules/debug": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", + "dependencies": { + "ms": "^2.1.1" + } + }, + "node_modules/deep-extend": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz", + "integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==", + "engines": { + "node": ">=4.0.0" + } + }, + "node_modules/delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=", + "optional": true, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/delegates": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz", + "integrity": "sha1-hMbhWbgZBP3KWaDvRM2HDTElD5o=" + }, + "node_modules/detect-libc": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-1.0.3.tgz", + "integrity": "sha1-+hN8S9aY7fVc1c0CrFWfkaTEups=", + "bin": { + "detect-libc": "bin/detect-libc.js" + }, + "engines": { + "node": ">=0.10" + } + }, + "node_modules/ecc-jsbn": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", + "integrity": "sha1-OoOpBOVDUyh4dMVkt1SThoSamMk=", + "optional": true, + "dependencies": { + "jsbn": "~0.1.0", + "safer-buffer": "^2.1.0" + } + }, + "node_modules/elliptic": { + "version": "6.5.4", + "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.4.tgz", + "integrity": "sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ==", + "dependencies": { + "bn.js": "^4.11.9", + "brorand": "^1.1.0", + "hash.js": "^1.0.0", + "hmac-drbg": "^1.0.1", + "inherits": "^2.0.4", + "minimalistic-assert": "^1.0.1", + "minimalistic-crypto-utils": "^1.0.1" + } + }, + "node_modules/elliptic/node_modules/bn.js": { + "version": "4.12.0", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", + "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==" + }, + "node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==" + }, + "node_modules/escalade": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", + "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==", + "engines": { + "node": ">=6" + } + }, + "node_modules/ethereum-cryptography": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/ethereum-cryptography/-/ethereum-cryptography-0.1.3.tgz", + "integrity": "sha512-w8/4x1SGGzc+tO97TASLja6SLd3fRIK2tLVcV2Gx4IB21hE19atll5Cq9o3d0ZmAYC/8aw0ipieTSiekAea4SQ==", + "dependencies": { + "@types/pbkdf2": "^3.0.0", + "@types/secp256k1": "^4.0.1", + "blakejs": "^1.1.0", + "browserify-aes": "^1.2.0", + "bs58check": "^2.1.2", + "create-hash": "^1.2.0", + "create-hmac": "^1.1.7", + "hash.js": "^1.1.7", + "keccak": "^3.0.0", + "pbkdf2": "^3.0.17", + "randombytes": "^2.1.0", + "safe-buffer": "^5.1.2", + "scrypt-js": "^3.0.0", + "secp256k1": "^4.0.1", + "setimmediate": "^1.0.5" + } + }, + "node_modules/ethereumjs-util": { + "version": "7.0.10", + "resolved": "https://registry.npmjs.org/ethereumjs-util/-/ethereumjs-util-7.0.10.tgz", + "integrity": "sha512-c/xThw6A+EAnej5Xk5kOzFzyoSnw0WX0tSlZ6pAsfGVvQj3TItaDg9b1+Fz1RJXA+y2YksKwQnuzgt1eY6LKzw==", + "dependencies": { + "@types/bn.js": "^5.1.0", + "bn.js": "^5.1.2", + "create-hash": "^1.1.2", + "ethereum-cryptography": "^0.1.3", + "ethjs-util": "0.1.6", + "rlp": "^2.2.4" + }, + "engines": { + "node": ">=10.0.0" + } + }, + "node_modules/ethereumjs-wallet": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/ethereumjs-wallet/-/ethereumjs-wallet-1.0.1.tgz", + "integrity": "sha512-3Z5g1hG1das0JWU6cQ9HWWTY2nt9nXCcwj7eXVNAHKbo00XAZO8+NHlwdgXDWrL0SXVQMvTWN8Q/82DRH/JhPw==", + "dependencies": { + "aes-js": "^3.1.1", + "bs58check": "^2.1.2", + "ethereum-cryptography": "^0.1.3", + "ethereumjs-util": "^7.0.2", + "randombytes": "^2.0.6", + "scrypt-js": "^3.0.1", + "utf8": "^3.0.0", + "uuid": "^3.3.2" + } + }, + "node_modules/ethjs-util": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/ethjs-util/-/ethjs-util-0.1.6.tgz", + "integrity": "sha512-CUnVOQq7gSpDHZVVrQW8ExxUETWrnrvXYvYz55wOU8Uj4VCgw56XC2B/fVqQN+f7gmrnRHSLVnFAwsCuNwji8w==", + "dependencies": { + "is-hex-prefixed": "1.0.0", + "strip-hex-prefix": "1.0.0" + }, + "engines": { + "node": ">=6.5.0", + "npm": ">=3" + } + }, + "node_modules/evp_bytestokey": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/evp_bytestokey/-/evp_bytestokey-1.0.3.tgz", + "integrity": "sha512-/f2Go4TognH/KvCISP7OUsHn85hT9nUkxxA9BEWxFn+Oj9o8ZNLm/40hdlgSLyuOimsrTKLUMEorQexp/aPQeA==", + "dependencies": { + "md5.js": "^1.3.4", + "safe-buffer": "^5.1.1" + } + }, + "node_modules/exit-on-epipe": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/exit-on-epipe/-/exit-on-epipe-1.0.1.tgz", + "integrity": "sha512-h2z5mrROTxce56S+pnvAV890uu7ls7f1kEvVGJbw1OlFH3/mlJ5bkXu0KRyW94v37zzHPiUd55iLn3DA7TjWpw==", + "engines": { + "node": ">=0.8" + } + }, + "node_modules/extend": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", + "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==", + "optional": true + }, + "node_modules/extsprintf": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", + "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=", + "engines": [ + "node >=0.6.0" + ], + "optional": true + }, + "node_modules/fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", + "optional": true + }, + "node_modules/fast-json-stable-stringify": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", + "optional": true + }, + "node_modules/forever-agent": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", + "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=", + "optional": true, + "engines": { + "node": "*" + } + }, + "node_modules/form-data": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.3.tgz", + "integrity": "sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ==", + "optional": true, + "dependencies": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.6", + "mime-types": "^2.1.12" + }, + "engines": { + "node": ">= 0.12" + } + }, + "node_modules/fs-minipass": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-1.2.7.tgz", + "integrity": "sha512-GWSSJGFy4e9GUeCcbIkED+bgAoFyj7XF1mV8rma3QW4NIqX9Kyx79N/PF61H5udOV3aY1IaMLs6pGbH71nlCTA==", + "dependencies": { + "minipass": "^2.6.0" + } + }, + "node_modules/fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=" + }, + "node_modules/fstream": { + "version": "1.0.12", + "resolved": "https://registry.npmjs.org/fstream/-/fstream-1.0.12.tgz", + "integrity": "sha512-WvJ193OHa0GHPEL+AycEJgxvBEwyfRkN1vhjca23OaPVMCaLCXTd5qAu82AjTcgP1UJmytkOKb63Ypde7raDIg==", + "optional": true, + "dependencies": { + "graceful-fs": "^4.1.2", + "inherits": "~2.0.0", + "mkdirp": ">=0.5 0", + "rimraf": "2" + }, + "engines": { + "node": ">=0.6" + } + }, + "node_modules/gauge": { + "version": "2.7.4", + "resolved": "https://registry.npmjs.org/gauge/-/gauge-2.7.4.tgz", + "integrity": "sha1-LANAXHU4w51+s3sxcCLjJfsBi/c=", + "dependencies": { + "aproba": "^1.0.3", + "console-control-strings": "^1.0.0", + "has-unicode": "^2.0.0", + "object-assign": "^4.1.0", + "signal-exit": "^3.0.0", + "string-width": "^1.0.1", + "strip-ansi": "^3.0.1", + "wide-align": "^1.1.0" + } + }, + "node_modules/get-caller-file": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", + "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", + "engines": { + "node": "6.* || 8.* || >= 10.*" + } + }, + "node_modules/getpass": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", + "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=", + "optional": true, + "dependencies": { + "assert-plus": "^1.0.0" + } + }, + "node_modules/glob": { + "version": "7.1.6", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz", + "integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==", + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + } + }, + "node_modules/graceful-fs": { + "version": "4.2.6", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.6.tgz", + "integrity": "sha512-nTnJ528pbqxYanhpDYsi4Rd8MAeaBA67+RZ10CM1m3bTAVFEDcd5AuA4a6W5YkGZ1iNXHzZz8T6TBKLeBuNriQ==" + }, + "node_modules/har-schema": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", + "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=", + "optional": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/har-validator": { + "version": "5.1.5", + "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.5.tgz", + "integrity": "sha512-nmT2T0lljbxdQZfspsno9hgrG3Uir6Ks5afism62poxqBM6sDnMEuPmzTq8XN0OEwqKLLdh1jQI3qyE66Nzb3w==", + "optional": true, + "dependencies": { + "ajv": "^6.12.3", + "har-schema": "^2.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/has-unicode": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz", + "integrity": "sha1-4Ob+aijPUROIVeCG0Wkedx3iqLk=" + }, + "node_modules/hash-base": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/hash-base/-/hash-base-3.1.0.tgz", + "integrity": "sha512-1nmYp/rhMDiE7AYkDw+lLwlAzz0AntGIe51F3RfFfEqyQ3feY2eI/NcwC6umIQVOASPMsWJLJScWKSSvzL9IVA==", + "dependencies": { + "inherits": "^2.0.4", + "readable-stream": "^3.6.0", + "safe-buffer": "^5.2.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/hash.js": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.7.tgz", + "integrity": "sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA==", + "dependencies": { + "inherits": "^2.0.3", + "minimalistic-assert": "^1.0.1" + } + }, + "node_modules/hmac-drbg": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz", + "integrity": "sha1-0nRXAQJabHdabFRXk+1QL8DGSaE=", + "dependencies": { + "hash.js": "^1.0.3", + "minimalistic-assert": "^1.0.0", + "minimalistic-crypto-utils": "^1.0.1" + } + }, + "node_modules/http-signature": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", + "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=", + "optional": true, + "dependencies": { + "assert-plus": "^1.0.0", + "jsprim": "^1.2.2", + "sshpk": "^1.7.0" + }, + "engines": { + "node": ">=0.8", + "npm": ">=1.3.7" + } + }, + "node_modules/iconv-lite": { + "version": "0.4.24", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", + "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/ignore-walk": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/ignore-walk/-/ignore-walk-3.0.3.tgz", + "integrity": "sha512-m7o6xuOaT1aqheYHKf8W6J5pYH85ZI9w077erOzLje3JsB1gkafkAhHHY19dqjulgIZHFm32Cp5uNZgcQqdJKw==", + "dependencies": { + "minimatch": "^3.0.4" + } + }, + "node_modules/immutable": { + "version": "3.8.2", + "resolved": "https://registry.npmjs.org/immutable/-/immutable-3.8.2.tgz", + "integrity": "sha1-wkOZUUVbs5kT2vKBN28VMOEErfM=", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/imurmurhash": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=", + "engines": { + "node": ">=0.8.19" + } + }, + "node_modules/inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "dependencies": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" + }, + "node_modules/ini": { + "version": "1.3.8", + "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz", + "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==" + }, + "node_modules/is-fullwidth-code-point": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", + "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", + "dependencies": { + "number-is-nan": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-hex-prefixed": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-hex-prefixed/-/is-hex-prefixed-1.0.0.tgz", + "integrity": "sha1-fY035q135dEnFIkTxXPggtd39VQ=", + "engines": { + "node": ">=6.5.0", + "npm": ">=3" + } + }, + "node_modules/is-typedarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", + "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=", + "optional": true + }, + "node_modules/isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" + }, + "node_modules/isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", + "optional": true + }, + "node_modules/isstream": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", + "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=", + "optional": true + }, + "node_modules/jsbn": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", + "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=", + "optional": true + }, + "node_modules/json-schema": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz", + "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=", + "optional": true + }, + "node_modules/json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "optional": true + }, + "node_modules/json-stringify-safe": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", + "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=", + "optional": true + }, + "node_modules/jsprim": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", + "integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=", + "engines": [ + "node >=0.6.0" + ], + "optional": true, + "dependencies": { + "assert-plus": "1.0.0", + "extsprintf": "1.3.0", + "json-schema": "0.2.3", + "verror": "1.10.0" + } + }, + "node_modules/keccak": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/keccak/-/keccak-3.0.1.tgz", + "integrity": "sha512-epq90L9jlFWCW7+pQa6JOnKn2Xgl2mtI664seYR6MHskvI9agt7AnDqmAlp9TqU4/caMYbA08Hi5DMZAl5zdkA==", + "dependencies": { + "node-addon-api": "^2.0.0", + "node-gyp-build": "^4.2.0" + }, + "engines": { + "node": ">=10.0.0" + } + }, + "node_modules/md5.js": { + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/md5.js/-/md5.js-1.3.5.tgz", + "integrity": "sha512-xitP+WxNPcTTOgnTJcrhM0xvdPepipPSf3I8EIpGKeFLjt3PlJLIDG3u8EX53ZIubkb+5U2+3rELYpEhHhzdkg==", + "dependencies": { + "hash-base": "^3.0.0", + "inherits": "^2.0.1", + "safe-buffer": "^5.1.2" + } + }, + "node_modules/mime-db": { + "version": "1.47.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.47.0.tgz", + "integrity": "sha512-QBmA/G2y+IfeS4oktet3qRZ+P5kPhCKRXxXnQEudYqUaEioAU1/Lq2us3D/t1Jfo4hE9REQPrbB7K5sOczJVIw==", + "optional": true, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime-types": { + "version": "2.1.30", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.30.tgz", + "integrity": "sha512-crmjA4bLtR8m9qLpHvgxSChT+XoSlZi8J4n/aIdn3z92e/U47Z0V/yl+Wh9W046GgFVAmoNR/fmdbZYcSSIUeg==", + "optional": true, + "dependencies": { + "mime-db": "1.47.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/minimalistic-assert": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", + "integrity": "sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==" + }, + "node_modules/minimalistic-crypto-utils": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz", + "integrity": "sha1-9sAMHAsIIkblxNmd+4x8CDsrWCo=" + }, + "node_modules/minimatch": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/minimist": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", + "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==" + }, + "node_modules/minipass": { + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-2.9.0.tgz", + "integrity": "sha512-wxfUjg9WebH+CUDX/CdbRlh5SmfZiy/hpkxaRI16Y9W56Pa75sWgd/rvFilSgrauD9NyFymP/+JFV3KwzIsJeg==", + "dependencies": { + "safe-buffer": "^5.1.2", + "yallist": "^3.0.0" + } + }, + "node_modules/minizlib": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/minizlib/-/minizlib-1.3.3.tgz", + "integrity": "sha512-6ZYMOEnmVsdCeTJVE0W9ZD+pVnE8h9Hma/iOwwRDsdQoePpoX56/8B6z3P9VNwppJuBKNRuFDRNRqRWexT9G9Q==", + "dependencies": { + "minipass": "^2.9.0" + } + }, + "node_modules/mkdirp": { + "version": "0.5.5", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz", + "integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==", + "dependencies": { + "minimist": "^1.2.5" + }, + "bin": { + "mkdirp": "bin/cmd.js" + } + }, + "node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" + }, + "node_modules/needle": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/needle/-/needle-2.6.0.tgz", + "integrity": "sha512-KKYdza4heMsEfSWD7VPUIz3zX2XDwOyX2d+geb4vrERZMT5RMU6ujjaD+I5Yr54uZxQ2w6XRTAhHBbSCyovZBg==", + "dependencies": { + "debug": "^3.2.6", + "iconv-lite": "^0.4.4", + "sax": "^1.2.4" + }, + "bin": { + "needle": "bin/needle" + }, + "engines": { + "node": ">= 4.4.x" + } + }, + "node_modules/node-addon-api": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-2.0.2.tgz", + "integrity": "sha512-Ntyt4AIXyaLIuMHF6IOoTakB3K+RWxwtsHNRxllEoA6vPwP9o4866g6YWDLUdnucilZhmkxiHwHr11gAENw+QA==" + }, + "node_modules/node-fetch": { + "version": "2.6.1", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.1.tgz", + "integrity": "sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw==", + "engines": { + "node": "4.x || >=6.0.0" + } + }, + "node_modules/node-gyp": { + "version": "3.8.0", + "resolved": "https://registry.npmjs.org/node-gyp/-/node-gyp-3.8.0.tgz", + "integrity": "sha512-3g8lYefrRRzvGeSowdJKAKyks8oUpLEd/DyPV4eMhVlhJ0aNaZqIrNUIPuEWWTAoPqyFkfGrM67MC69baqn6vA==", + "optional": true, + "dependencies": { + "fstream": "^1.0.0", + "glob": "^7.0.3", + "graceful-fs": "^4.1.2", + "mkdirp": "^0.5.0", + "nopt": "2 || 3", + "npmlog": "0 || 1 || 2 || 3 || 4", + "osenv": "0", + "request": "^2.87.0", + "rimraf": "2", + "semver": "~5.3.0", + "tar": "^2.0.0", + "which": "1" + }, + "bin": { + "node-gyp": "bin/node-gyp.js" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/node-gyp-build": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.2.3.tgz", + "integrity": "sha512-MN6ZpzmfNCRM+3t57PTJHgHyw/h4OWnZ6mR8P5j/uZtqQr46RRuDE/P+g3n0YR/AiYXeWixZZzaip77gdICfRg==", + "bin": { + "node-gyp-build": "bin.js", + "node-gyp-build-optional": "optional.js", + "node-gyp-build-test": "build-test.js" + } + }, + "node_modules/node-localstorage": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/node-localstorage/-/node-localstorage-1.3.1.tgz", + "integrity": "sha512-NMWCSWWc6JbHT5PyWlNT2i8r7PgGYXVntmKawY83k/M0UJScZ5jirb61TLnqKwd815DfBQu+lR3sRw08SPzIaQ==", + "dependencies": { + "write-file-atomic": "^1.1.4" + }, + "engines": { + "node": ">=0.12" + } + }, + "node_modules/node-pre-gyp": { + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/node-pre-gyp/-/node-pre-gyp-0.11.0.tgz", + "integrity": "sha512-TwWAOZb0j7e9eGaf9esRx3ZcLaE5tQ2lvYy1pb5IAaG1a2e2Kv5Lms1Y4hpj+ciXJRofIxxlt5haeQ/2ANeE0Q==", + "dependencies": { + "detect-libc": "^1.0.2", + "mkdirp": "^0.5.1", + "needle": "^2.2.1", + "nopt": "^4.0.1", + "npm-packlist": "^1.1.6", + "npmlog": "^4.0.2", + "rc": "^1.2.7", + "rimraf": "^2.6.1", + "semver": "^5.3.0", + "tar": "^4" + }, + "bin": { + "node-pre-gyp": "bin/node-pre-gyp" + } + }, + "node_modules/node-pre-gyp/node_modules/nopt": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/nopt/-/nopt-4.0.3.tgz", + "integrity": "sha512-CvaGwVMztSMJLOeXPrez7fyfObdZqNUK1cPAEzLHrTybIua9pMdmmPR5YwtfNftIOMv3DPUhFaxsZMNTQO20Kg==", + "dependencies": { + "abbrev": "1", + "osenv": "^0.1.4" + }, + "bin": { + "nopt": "bin/nopt.js" + } + }, + "node_modules/node-pre-gyp/node_modules/tar": { + "version": "4.4.13", + "resolved": "https://registry.npmjs.org/tar/-/tar-4.4.13.tgz", + "integrity": "sha512-w2VwSrBoHa5BsSyH+KxEqeQBAllHhccyMFVHtGtdMpF4W7IRWfZjFiQceJPChOeTsSDVUpER2T8FA93pr0L+QA==", + "dependencies": { + "chownr": "^1.1.1", + "fs-minipass": "^1.2.5", + "minipass": "^2.8.6", + "minizlib": "^1.2.1", + "mkdirp": "^0.5.0", + "safe-buffer": "^5.1.2", + "yallist": "^3.0.3" + }, + "engines": { + "node": ">=4.5" + } + }, + "node_modules/nopt": { + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/nopt/-/nopt-3.0.6.tgz", + "integrity": "sha1-xkZdvwirzU2zWTF/eaxopkayj/k=", + "optional": true, + "dependencies": { + "abbrev": "1" + }, + "bin": { + "nopt": "bin/nopt.js" + } + }, + "node_modules/npm-bundled": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/npm-bundled/-/npm-bundled-1.1.1.tgz", + "integrity": "sha512-gqkfgGePhTpAEgUsGEgcq1rqPXA+tv/aVBlgEzfXwA1yiUJF7xtEt3CtVwOjNYQOVknDk0F20w58Fnm3EtG0fA==", + "dependencies": { + "npm-normalize-package-bin": "^1.0.1" + } + }, + "node_modules/npm-normalize-package-bin": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/npm-normalize-package-bin/-/npm-normalize-package-bin-1.0.1.tgz", + "integrity": "sha512-EPfafl6JL5/rU+ot6P3gRSCpPDW5VmIzX959Ob1+ySFUuuYHWHekXpwdUZcKP5C+DS4GEtdJluwBjnsNDl+fSA==" + }, + "node_modules/npm-packlist": { + "version": "1.4.8", + "resolved": "https://registry.npmjs.org/npm-packlist/-/npm-packlist-1.4.8.tgz", + "integrity": "sha512-5+AZgwru5IevF5ZdnFglB5wNlHG1AOOuw28WhUq8/8emhBmLv6jX5by4WJCh7lW0uSYZYS6DXqIsyZVIXRZU9A==", + "dependencies": { + "ignore-walk": "^3.0.1", + "npm-bundled": "^1.0.1", + "npm-normalize-package-bin": "^1.0.1" + } + }, + "node_modules/npmlog": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/npmlog/-/npmlog-4.1.2.tgz", + "integrity": "sha512-2uUqazuKlTaSI/dC8AzicUck7+IrEaOnN/e0jd3Xtt1KcGpwx30v50mL7oPyr/h9bL3E4aZccVwpwP+5W9Vjkg==", + "dependencies": { + "are-we-there-yet": "~1.1.2", + "console-control-strings": "~1.1.0", + "gauge": "~2.7.3", + "set-blocking": "~2.0.0" + } + }, + "node_modules/number-is-nan": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", + "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/oauth-sign": { + "version": "0.9.0", + "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz", + "integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==", + "optional": true, + "engines": { + "node": "*" + } + }, + "node_modules/object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "dependencies": { + "wrappy": "1" + } + }, + "node_modules/openpgp": { + "version": "4.10.10", + "resolved": "https://registry.npmjs.org/openpgp/-/openpgp-4.10.10.tgz", + "integrity": "sha512-Ub48OogGPjNsr0G/wnJ/SyAQzt/tfcXZTWVZdjKFpXCQV1Ca+upFdSPPkBlGG3lb9EQGOKZJ2tzYNH6ZyKMkDQ==", + "dependencies": { + "asn1.js": "^5.0.0", + "node-fetch": "^2.1.2", + "node-localstorage": "~1.3.0" + }, + "engines": { + "node": ">= 8.0.0" + } + }, + "node_modules/os-homedir": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", + "integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/os-tmpdir": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", + "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/osenv": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/osenv/-/osenv-0.1.5.tgz", + "integrity": "sha512-0CWcCECdMVc2Rw3U5w9ZjqX6ga6ubk1xDVKxtBQPK7wis/0F2r9T6k4ydGYhecl7YUBxBVxhL5oisPsNxAPe2g==", + "dependencies": { + "os-homedir": "^1.0.0", + "os-tmpdir": "^1.0.0" + } + }, + "node_modules/packet-reader": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/packet-reader/-/packet-reader-1.0.0.tgz", + "integrity": "sha512-HAKu/fG3HpHFO0AA8WE8q2g+gBJaZ9MG7fcKk+IJPLTGAD6Psw4443l+9DGRbOIh3/aXr7Phy0TjilYivJo5XQ==" + }, + "node_modules/path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/pbkdf2": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/pbkdf2/-/pbkdf2-3.1.2.tgz", + "integrity": "sha512-iuh7L6jA7JEGu2WxDwtQP1ddOpaJNC4KlDEFfdQajSGgGPNi4OyDc2R7QnbY2bR9QjBVGwgvTdNJZoE7RaxUMA==", + "dependencies": { + "create-hash": "^1.1.2", + "create-hmac": "^1.1.4", + "ripemd160": "^2.0.1", + "safe-buffer": "^5.0.1", + "sha.js": "^2.4.8" + }, + "engines": { + "node": ">=0.12" + } + }, + "node_modules/performance-now": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", + "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=", + "optional": true + }, + "node_modules/pg": { + "version": "8.6.0", + "resolved": "https://registry.npmjs.org/pg/-/pg-8.6.0.tgz", + "integrity": "sha512-qNS9u61lqljTDFvmk/N66EeGq3n6Ujzj0FFyNMGQr6XuEv4tgNTXvJQTfJdcvGit5p5/DWPu+wj920hAJFI+QQ==", + "dependencies": { + "buffer-writer": "2.0.0", + "packet-reader": "1.0.0", + "pg-connection-string": "^2.5.0", + "pg-pool": "^3.3.0", + "pg-protocol": "^1.5.0", + "pg-types": "^2.1.0", + "pgpass": "1.x" + }, + "engines": { + "node": ">= 8.0.0" + } + }, + "node_modules/pg-connection-string": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/pg-connection-string/-/pg-connection-string-2.5.0.tgz", + "integrity": "sha512-r5o/V/ORTA6TmUnyWZR9nCj1klXCO2CEKNRlVuJptZe85QuhFayC7WeMic7ndayT5IRIR0S0xFxFi2ousartlQ==" + }, + "node_modules/pg-int8": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/pg-int8/-/pg-int8-1.0.1.tgz", + "integrity": "sha512-WCtabS6t3c8SkpDBUlb1kjOs7l66xsGdKpIPZsg4wR+B3+u9UAum2odSsF9tnvxg80h4ZxLWMy4pRjOsFIqQpw==", + "engines": { + "node": ">=4.0.0" + } + }, + "node_modules/pg-pool": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/pg-pool/-/pg-pool-3.3.0.tgz", + "integrity": "sha512-0O5huCql8/D6PIRFAlmccjphLYWC+JIzvUhSzXSpGaf+tjTZc4nn+Lr7mLXBbFJfvwbP0ywDv73EiaBsxn7zdg==" + }, + "node_modules/pg-protocol": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/pg-protocol/-/pg-protocol-1.5.0.tgz", + "integrity": "sha512-muRttij7H8TqRNu/DxrAJQITO4Ac7RmX3Klyr/9mJEOBeIpgnF8f9jAfRz5d3XwQZl5qBjF9gLsUtMPJE0vezQ==" + }, + "node_modules/pg-types": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/pg-types/-/pg-types-2.2.0.tgz", + "integrity": "sha512-qTAAlrEsl8s4OiEQY69wDvcMIdQN6wdz5ojQiOy6YRMuynxenON0O5oCpJI6lshc6scgAY8qvJ2On/p+CXY0GA==", + "dependencies": { + "pg-int8": "1.0.1", + "postgres-array": "~2.0.0", + "postgres-bytea": "~1.0.0", + "postgres-date": "~1.0.4", + "postgres-interval": "^1.1.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/pgpass": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/pgpass/-/pgpass-1.0.4.tgz", + "integrity": "sha512-YmuA56alyBq7M59vxVBfPJrGSozru8QAdoNlWuW3cz8l+UX3cWge0vTvjKhsSHSJpo3Bom8/Mm6hf0TR5GY0+w==", + "dependencies": { + "split2": "^3.1.1" + } + }, + "node_modules/postgres-array": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/postgres-array/-/postgres-array-2.0.0.tgz", + "integrity": "sha512-VpZrUqU5A69eQyW2c5CA1jtLecCsN2U/bD6VilrFDWq5+5UIEVO7nazS3TEcHf1zuPYO/sqGvUvW62g86RXZuA==", + "engines": { + "node": ">=4" + } + }, + "node_modules/postgres-bytea": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/postgres-bytea/-/postgres-bytea-1.0.0.tgz", + "integrity": "sha1-AntTPAqokOJtFy1Hz5zOzFIazTU=", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/postgres-date": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/postgres-date/-/postgres-date-1.0.7.tgz", + "integrity": "sha512-suDmjLVQg78nMK2UZ454hAG+OAW+HQPZ6n++TNDUX+L0+uUlLywnoxJKDou51Zm+zTCjrCl0Nq6J9C5hP9vK/Q==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/postgres-interval": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/postgres-interval/-/postgres-interval-1.2.0.tgz", + "integrity": "sha512-9ZhXKM/rw350N1ovuWHbGxnGh/SNJ4cnxHiM0rxE4VN41wsg8P8zWn9hv/buK00RP4WvlOyr/RBDiptyxVbkZQ==", + "dependencies": { + "xtend": "^4.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/printj": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/printj/-/printj-1.1.2.tgz", + "integrity": "sha512-zA2SmoLaxZyArQTOPj5LXecR+RagfPSU5Kw1qP+jkWeNlrq+eJZyY2oS68SU1Z/7/myXM4lo9716laOFAVStCQ==", + "bin": { + "printj": "bin/printj.njs" + }, + "engines": { + "node": ">=0.8" + } + }, + "node_modules/process-nextick-args": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", + "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==" + }, + "node_modules/psl": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/psl/-/psl-1.8.0.tgz", + "integrity": "sha512-RIdOzyoavK+hA18OGGWDqUTsCLhtA7IcZ/6NCs4fFJaHBDab+pDDmDIByWFRQJq2Cd7r1OoQxBGKOaztq+hjIQ==", + "optional": true + }, + "node_modules/punycode": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", + "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==", + "optional": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/qs": { + "version": "6.5.2", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz", + "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==", + "optional": true, + "engines": { + "node": ">=0.6" + } + }, + "node_modules/randombytes": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", + "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", + "dependencies": { + "safe-buffer": "^5.1.0" + } + }, + "node_modules/rc": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/rc/-/rc-1.2.8.tgz", + "integrity": "sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==", + "dependencies": { + "deep-extend": "^0.6.0", + "ini": "~1.3.0", + "minimist": "^1.2.0", + "strip-json-comments": "~2.0.1" + }, + "bin": { + "rc": "cli.js" + } + }, + "node_modules/readable-stream": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", + "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", + "dependencies": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/request": { + "version": "2.88.2", + "resolved": "https://registry.npmjs.org/request/-/request-2.88.2.tgz", + "integrity": "sha512-MsvtOrfG9ZcrOwAW+Qi+F6HbD0CWXEh9ou77uOb7FM2WPhwT7smM833PzanhJLsgXjN89Ir6V2PczXNnMpwKhw==", + "optional": true, + "dependencies": { + "aws-sign2": "~0.7.0", + "aws4": "^1.8.0", + "caseless": "~0.12.0", + "combined-stream": "~1.0.6", + "extend": "~3.0.2", + "forever-agent": "~0.6.1", + "form-data": "~2.3.2", + "har-validator": "~5.1.3", + "http-signature": "~1.2.0", + "is-typedarray": "~1.0.0", + "isstream": "~0.1.2", + "json-stringify-safe": "~5.0.1", + "mime-types": "~2.1.19", + "oauth-sign": "~0.9.0", + "performance-now": "^2.1.0", + "qs": "~6.5.2", + "safe-buffer": "^5.1.2", + "tough-cookie": "~2.5.0", + "tunnel-agent": "^0.6.0", + "uuid": "^3.3.2" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/require-directory": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", + "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/rimraf": { + "version": "2.7.1", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz", + "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==", + "dependencies": { + "glob": "^7.1.3" + }, + "bin": { + "rimraf": "bin.js" + } + }, + "node_modules/ripemd160": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/ripemd160/-/ripemd160-2.0.2.tgz", + "integrity": "sha512-ii4iagi25WusVoiC4B4lq7pbXfAp3D9v5CwfkY33vffw2+pkDjY1D8GaN7spsxvCSx8dkPqOZCEZyfxcmJG2IA==", + "dependencies": { + "hash-base": "^3.0.0", + "inherits": "^2.0.1" + } + }, + "node_modules/rlp": { + "version": "2.2.6", + "resolved": "https://registry.npmjs.org/rlp/-/rlp-2.2.6.tgz", + "integrity": "sha512-HAfAmL6SDYNWPUOJNrM500x4Thn4PZsEy5pijPh40U9WfNk0z15hUYzO9xVIMAdIHdFtD8CBDHd75Td1g36Mjg==", + "dependencies": { + "bn.js": "^4.11.1" + }, + "bin": { + "rlp": "bin/rlp" + } + }, + "node_modules/rlp/node_modules/bn.js": { + "version": "4.12.0", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", + "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==" + }, + "node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==" + }, + "node_modules/safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" + }, + "node_modules/sax": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz", + "integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==" + }, + "node_modules/scrypt-js": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/scrypt-js/-/scrypt-js-3.0.1.tgz", + "integrity": "sha512-cdwTTnqPu0Hyvf5in5asVdZocVDTNRmR7XEcJuIzMjJeSHybHl7vpB66AzwTaIg6CLSbtjcxc8fqcySfnTkccA==" + }, + "node_modules/secp256k1": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/secp256k1/-/secp256k1-4.0.2.tgz", + "integrity": "sha512-UDar4sKvWAksIlfX3xIaQReADn+WFnHvbVujpcbr+9Sf/69odMwy2MUsz5CKLQgX9nsIyrjuxL2imVyoNHa3fg==", + "dependencies": { + "elliptic": "^6.5.2", + "node-addon-api": "^2.0.0", + "node-gyp-build": "^4.2.0" + }, + "engines": { + "node": ">=10.0.0" + } + }, + "node_modules/semver": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.3.0.tgz", + "integrity": "sha1-myzl094C0XxgEq0yaqa00M9U+U8=", + "bin": { + "semver": "bin/semver" + } + }, + "node_modules/set-blocking": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", + "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=" + }, + "node_modules/setimmediate": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.5.tgz", + "integrity": "sha1-KQy7Iy4waULX1+qbg3Mqt4VvgoU=" + }, + "node_modules/sha.js": { + "version": "2.4.11", + "resolved": "https://registry.npmjs.org/sha.js/-/sha.js-2.4.11.tgz", + "integrity": "sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ==", + "dependencies": { + "inherits": "^2.0.1", + "safe-buffer": "^5.0.1" + }, + "bin": { + "sha.js": "bin.js" + } + }, + "node_modules/signal-exit": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.3.tgz", + "integrity": "sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA==" + }, + "node_modules/slide": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/slide/-/slide-1.1.6.tgz", + "integrity": "sha1-VusCfWW00tzmyy4tMsTUr8nh1wc=", + "engines": { + "node": "*" + } + }, + "node_modules/split2": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/split2/-/split2-3.2.2.tgz", + "integrity": "sha512-9NThjpgZnifTkJpzTZ7Eue85S49QwpNhZTq6GRJwObb6jnLFNGB7Qm73V5HewTROPyxD0C29xqmaI68bQtV+hg==", + "dependencies": { + "readable-stream": "^3.0.0" + } + }, + "node_modules/sqlite3": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/sqlite3/-/sqlite3-5.0.2.tgz", + "integrity": "sha512-1SdTNo+BVU211Xj1csWa8lV6KM0CtucDwRyA0VHl91wEH1Mgh7RxUpI4rVvG7OhHrzCSGaVyW5g8vKvlrk9DJA==", + "dependencies": { + "node-addon-api": "^3.0.0", + "node-pre-gyp": "^0.11.0" + }, + "optionalDependencies": { + "node-gyp": "3.x" + } + }, + "node_modules/sqlite3/node_modules/node-addon-api": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-3.1.0.tgz", + "integrity": "sha512-flmrDNB06LIl5lywUz7YlNGZH/5p0M7W28k8hzd9Lshtdh1wshD2Y+U4h9LD6KObOy1f+fEVdgprPrEymjM5uw==" + }, + "node_modules/sshpk": { + "version": "1.16.1", + "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.16.1.tgz", + "integrity": "sha512-HXXqVUq7+pcKeLqqZj6mHFUMvXtOJt1uoUx09pFW6011inTMxqI8BA8PM95myrIyyKwdnzjdFjLiE6KBPVtJIg==", + "optional": true, + "dependencies": { + "asn1": "~0.2.3", + "assert-plus": "^1.0.0", + "bcrypt-pbkdf": "^1.0.0", + "dashdash": "^1.12.0", + "ecc-jsbn": "~0.1.1", + "getpass": "^0.1.1", + "jsbn": "~0.1.0", + "safer-buffer": "^2.0.2", + "tweetnacl": "~0.14.0" + }, + "bin": { + "sshpk-conv": "bin/sshpk-conv", + "sshpk-sign": "bin/sshpk-sign", + "sshpk-verify": "bin/sshpk-verify" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/string_decoder": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", + "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", + "dependencies": { + "safe-buffer": "~5.2.0" + } + }, + "node_modules/string-width": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", + "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", + "dependencies": { + "code-point-at": "^1.0.0", + "is-fullwidth-code-point": "^1.0.0", + "strip-ansi": "^3.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/strip-ansi": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", + "dependencies": { + "ansi-regex": "^2.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/strip-hex-prefix": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/strip-hex-prefix/-/strip-hex-prefix-1.0.0.tgz", + "integrity": "sha1-DF8VX+8RUTczd96du1iNoFUA428=", + "dependencies": { + "is-hex-prefixed": "1.0.0" + }, + "engines": { + "node": ">=6.5.0", + "npm": ">=3" + } + }, + "node_modules/strip-json-comments": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", + "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/tar": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/tar/-/tar-2.2.2.tgz", + "integrity": "sha512-FCEhQ/4rE1zYv9rYXJw/msRqsnmlje5jHP6huWeBZ704jUTy02c5AZyWujpMR1ax6mVw9NyJMfuK2CMDWVIfgA==", + "optional": true, + "dependencies": { + "block-stream": "*", + "fstream": "^1.0.12", + "inherits": "2" + } + }, + "node_modules/tough-cookie": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.5.0.tgz", + "integrity": "sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g==", + "optional": true, + "dependencies": { + "psl": "^1.1.28", + "punycode": "^2.1.1" + }, + "engines": { + "node": ">=0.8" + } + }, + "node_modules/transit-immutable-js": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/transit-immutable-js/-/transit-immutable-js-0.7.0.tgz", + "integrity": "sha1-mT4lCJtjEf9AIUD1VidtbSUwBdk=" + }, + "node_modules/transit-js": { + "version": "0.8.867", + "resolved": "https://registry.npmjs.org/transit-js/-/transit-js-0.8.867.tgz", + "integrity": "sha512-rOwB4K0z/WZ+E2bV42iN9UV3mvGzmwSv/IpMOKdnFpawPAZT0d1L7f91Y+tZQF7lXSDGk+oln4XyIQXo+pyTGA==", + "engines": { + "node": ">= 0.10.0" + } + }, + "node_modules/tunnel-agent": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", + "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=", + "optional": true, + "dependencies": { + "safe-buffer": "^5.0.1" + }, + "engines": { + "node": "*" + } + }, + "node_modules/tweetnacl": { + "version": "0.14.5", + "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", + "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=", + "optional": true + }, + "node_modules/uri-js": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", + "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", + "optional": true, + "dependencies": { + "punycode": "^2.1.0" + } + }, + "node_modules/utf8": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/utf8/-/utf8-3.0.0.tgz", + "integrity": "sha512-E8VjFIQ/TyQgp+TZfS6l8yp/xWppSAHzidGiRrqe4bK4XP9pTRyKFgGJpO3SN7zdX4DeomTrwaseCHovfpFcqQ==" + }, + "node_modules/util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=" + }, + "node_modules/uuid": { + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz", + "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==", + "bin": { + "uuid": "bin/uuid" + } + }, + "node_modules/vcard-parser": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/vcard-parser/-/vcard-parser-1.0.0.tgz", + "integrity": "sha512-rSEjrjBK3of4VimMR5vBjLLcN5ZCSp9yuVzyx5i4Fwx74Yd0s+DnHtSit/wAAtj1a7/T/qQc0ykwXADoD0+fTQ==" + }, + "node_modules/verror": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", + "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=", + "engines": [ + "node >=0.6.0" + ], + "optional": true, + "dependencies": { + "assert-plus": "^1.0.0", + "core-util-is": "1.0.2", + "extsprintf": "^1.2.0" + } + }, + "node_modules/which": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", + "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", + "optional": true, + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "which": "bin/which" + } + }, + "node_modules/wide-align": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.3.tgz", + "integrity": "sha512-QGkOQc8XL6Bt5PwnsExKBPuMKBxnGxWWW3fU55Xt4feHozMUhdUMaBCk290qpm/wG5u/RSKzwdAC4i51YigihA==", + "dependencies": { + "string-width": "^1.0.2 || 2" + } + }, + "node_modules/wrap-ansi": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/wrap-ansi/node_modules/ansi-regex": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", + "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==", + "engines": { + "node": ">=8" + } + }, + "node_modules/wrap-ansi/node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "engines": { + "node": ">=8" + } + }, + "node_modules/wrap-ansi/node_modules/string-width": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.2.tgz", + "integrity": "sha512-XBJbT3N4JhVumXE0eoLU9DCjcaF92KLNqTmFCnG1pf8duUxFGwtP6AD6nkjw9a3IdiRtL3E2w3JDiE/xi3vOeA==", + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/wrap-ansi/node_modules/strip-ansi": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", + "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", + "dependencies": { + "ansi-regex": "^5.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" + }, + "node_modules/write-file-atomic": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-1.3.4.tgz", + "integrity": "sha1-+Aek8LHZ6ROuekgRLmzDrxmRtF8=", + "dependencies": { + "graceful-fs": "^4.1.11", + "imurmurhash": "^0.1.4", + "slide": "^1.1.5" + } + }, + "node_modules/xtend": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", + "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==", + "engines": { + "node": ">=0.4" + } + }, + "node_modules/y18n": { + "version": "5.0.8", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", + "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", + "engines": { + "node": ">=10" + } + }, + "node_modules/yallist": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", + "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==" + }, + "node_modules/yargs": { + "version": "16.2.0", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz", + "integrity": "sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==", + "dependencies": { + "cliui": "^7.0.2", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.0", + "y18n": "^5.0.5", + "yargs-parser": "^20.2.2" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/yargs-parser": { + "version": "20.2.7", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.7.tgz", + "integrity": "sha512-FiNkvbeHzB/syOjIUxFDCnhSfzAL8R5vs40MgLFBorXACCOAEaWu0gRZl14vG8MR9AOJIZbmkjhusqBYZ3HTHw==", + "engines": { + "node": ">=10" + } + }, + "node_modules/yargs/node_modules/ansi-regex": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", + "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==", + "engines": { + "node": ">=8" + } + }, + "node_modules/yargs/node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "engines": { + "node": ">=8" + } + }, + "node_modules/yargs/node_modules/string-width": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.2.tgz", + "integrity": "sha512-XBJbT3N4JhVumXE0eoLU9DCjcaF92KLNqTmFCnG1pf8duUxFGwtP6AD6nkjw9a3IdiRtL3E2w3JDiE/xi3vOeA==", + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/yargs/node_modules/strip-ansi": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", + "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", + "dependencies": { + "ansi-regex": "^5.0.0" + }, + "engines": { + "node": ">=8" + } + } + }, "dependencies": { "@ethereumjs/common": { "version": "2.2.0", @@ -1490,6 +3573,14 @@ "tweetnacl": "~0.14.0" } }, + "string_decoder": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", + "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", + "requires": { + "safe-buffer": "~5.2.0" + } + }, "string-width": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", @@ -1500,14 +3591,6 @@ "strip-ansi": "^3.0.0" } }, - "string_decoder": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", - "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", - "requires": { - "safe-buffer": "~5.2.0" - } - }, "strip-ansi": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", diff --git a/apps/contract-migration/seed_cic_eth.sh b/apps/contract-migration/seed_cic_eth.sh index 42db0cab..7795f176 100755 --- a/apps/contract-migration/seed_cic_eth.sh +++ b/apps/contract-migration/seed_cic_eth.sh @@ -39,11 +39,11 @@ set -a # get required addresses from registries DEV_TOKEN_INDEX_ADDRESS=`eth-contract-registry-list -i $CIC_CHAIN_SPEC -p $ETH_PROVIDER -r $CIC_REGISTRY_ADDRESS -f brief TokenRegistry` DEV_ACCOUNT_INDEX_ADDRESS=`eth-contract-registry-list -i $CIC_CHAIN_SPEC -p $ETH_PROVIDER -r $CIC_REGISTRY_ADDRESS -f brief AccountRegistry` -DEV_RESERVE_ADDRESS=`eth-token-index-list -i $CIC_CHAIN_SPEC -p $ETH_PROVIDER -a $DEV_TOKEN_INDEX_ADDRESS -f brief $DEV_TOKEN_TYPE` +DEV_RESERVE_ADDRESS=`eth-token-index-list -i $CIC_CHAIN_SPEC -p $ETH_PROVIDER -a $DEV_TOKEN_INDEX_ADDRESS -f brief $CIC_DEFAULT_TOKEN_SYMBOL` cat <&2 echo "create account for gas gifter" diff --git a/docker-compose.yml b/docker-compose.yml index 71681073..26681d8f 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -104,7 +104,7 @@ services: DEV_PIP_EXTRA_INDEX_URL: ${DEV_PIP_EXTRA_INDEX_URL:-https://pip.grassrootseconomics.net:8433} RUN_MASK: ${RUN_MASK:-0} # bit flags; 1: contract migrations 2: seed data DEV_FAUCET_AMOUNT: ${DEV_FAUCET_AMOUNT:-0} - DEV_TOKEN_TYPE: ${DEV_TOKEN_TYPE:-GFT} + CIC_DEFAULT_TOKEN_SYMBOL: ${CIC_DEFAULT_TOKEN_SYMBOL:-GFT} DEV_SARAFU_DEMURRAGE_LEVEL: ${DEV_SARAFU_DEMURRAGE_LEVEL:-196454828847045000000000000000000} DEV_ETH_GAS_PRICE: ${DEV_ETH_GAS_PRICE:-1} command: ["./run_job.sh"] @@ -249,6 +249,7 @@ services: SIGNER_SECRET: ${SIGNER_SECRET:-deadbeef} ETH_ACCOUNT_ACCOUNTS_INDEX_WRITER: ${DEV_ETH_ACCOUNT_ACCOUNTS_INDEX_WRITER:-0xACB0BC74E1686D62dE7DC6414C999EA60C09F0eA} TASKS_TRACE_QUEUE_STATUS: ${TASKS_TRACE_QUEUE_STATUS:-1} + CIC_DEFAULT_TOKEN_SYMBOL: ${CIC_DEFAULT_TOKEN_SYMBOL:-GFT} depends_on: - eth - postgres From 16dd210965ba70a8dbd7b2fd0d05e09bbf3f2ece Mon Sep 17 00:00:00 2001 From: Louis Holbrook Date: Sat, 24 Apr 2021 17:49:21 +0000 Subject: [PATCH 09/17] cic-eth: Add default token setting to cic-eth with api --- apps/cic-eth/cic_eth/admin/token.py | 19 ++++++ apps/cic-eth/cic_eth/runnable/info.py | 65 +++++++++++++++++++ apps/cic-eth/cic_eth/version.py | 2 +- apps/cic-eth/config/docker/eth.ini | 1 - apps/cic-eth/config/eth.ini | 1 - apps/cic-eth/tests/conftest.py | 27 ++++++++ apps/cic-eth/tests/fixtures_celery.py | 1 + .../tests/unit/admin/test_default_token.py | 21 ++++++ apps/cic-ussd/requirements.txt | 4 +- 9 files changed, 136 insertions(+), 5 deletions(-) create mode 100644 apps/cic-eth/cic_eth/admin/token.py create mode 100644 apps/cic-eth/cic_eth/runnable/info.py create mode 100644 apps/cic-eth/tests/unit/admin/test_default_token.py diff --git a/apps/cic-eth/cic_eth/admin/token.py b/apps/cic-eth/cic_eth/admin/token.py new file mode 100644 index 00000000..ffb17568 --- /dev/null +++ b/apps/cic-eth/cic_eth/admin/token.py @@ -0,0 +1,19 @@ +# standard imports +import logging + +# external imports +import celery + +# local imports +from cic_eth.task import BaseTask + +celery_app = celery.current_app +logg = logging.getLogger() + + +@celery_app.task(bind=True, base=BaseTask) +def default_token(self): + return { + 'symbol': self.default_token_symbol, + 'address': self.default_token_address, + } diff --git a/apps/cic-eth/cic_eth/runnable/info.py b/apps/cic-eth/cic_eth/runnable/info.py new file mode 100644 index 00000000..59bfb759 --- /dev/null +++ b/apps/cic-eth/cic_eth/runnable/info.py @@ -0,0 +1,65 @@ +#!python3 + +# SPDX-License-Identifier: GPL-3.0-or-later + +# standard imports +import logging +import argparse +import os + +# external imports +import confini +import celery + +# local imports +from cic_eth.api import Api + +logging.basicConfig(level=logging.WARNING) +logg = logging.getLogger() + +default_format = 'terminal' +default_config_dir = os.environ.get('CONFINI_DIR', '/usr/local/etc/cic') + + +argparser = argparse.ArgumentParser() +argparser.add_argument('-i', '--chain-spec', dest='i', type=str, help='chain spec') +argparser.add_argument('-c', type=str, default=default_config_dir, help='config root to use') +argparser.add_argument('-q', type=str, default='cic-eth', help='celery queue to submit transaction tasks to') +argparser.add_argument('--env-prefix', default=os.environ.get('CONFINI_ENV_PREFIX'), dest='env_prefix', type=str, help='environment prefix for variables to overwrite configuration') +argparser.add_argument('-v', action='store_true', help='Be verbose') +argparser.add_argument('-vv', help='be more verbose', action='store_true') +args = argparser.parse_args() + +if args.v == True: + logging.getLogger().setLevel(logging.INFO) +elif args.vv == True: + logging.getLogger().setLevel(logging.DEBUG) + +config_dir = os.path.join(args.c) +os.makedirs(config_dir, 0o777, True) +config = confini.Config(config_dir, args.env_prefix) +config.process() +args_override = { + 'CIC_CHAIN_SPEC': getattr(args, 'i'), + } +config.dict_override(args_override, 'cli args') +config.censor('PASSWORD', 'DATABASE') +config.censor('PASSWORD', 'SSL') +logg.debug('config loaded from {}:\n{}'.format(config_dir, config)) + + +celery_app = celery.Celery(broker=config.get('CELERY_BROKER_URL'), backend=config.get('CELERY_RESULT_URL')) + +queue = args.q + +api = Api(config.get('CIC_CHAIN_SPEC'), queue=queue) + +def main(): + t = api.default_token() + token_info = t.get() + print('Default token symbol: {}'.format(token_info['symbol'])) + print('Default token address: {}'.format(token_info['address'])) + + +if __name__ == '__main__': + main() diff --git a/apps/cic-eth/cic_eth/version.py b/apps/cic-eth/cic_eth/version.py index 4740b580..ed55ca63 100644 --- a/apps/cic-eth/cic_eth/version.py +++ b/apps/cic-eth/cic_eth/version.py @@ -10,7 +10,7 @@ version = ( 0, 11, 0, - 'beta.8', + 'beta.9', ) version_object = semver.VersionInfo( diff --git a/apps/cic-eth/config/docker/eth.ini b/apps/cic-eth/config/docker/eth.ini index 9d6b6607..534a2eea 100644 --- a/apps/cic-eth/config/docker/eth.ini +++ b/apps/cic-eth/config/docker/eth.ini @@ -1,4 +1,3 @@ [eth] provider = http://localhost:63545 -health_modules = cic_eth.check.db,cic_eth.check.gas gas_gifter_minimum_balance = 10000000000000000000000 diff --git a/apps/cic-eth/config/eth.ini b/apps/cic-eth/config/eth.ini index 3b41af90..3c589cb2 100644 --- a/apps/cic-eth/config/eth.ini +++ b/apps/cic-eth/config/eth.ini @@ -1,4 +1,3 @@ [eth] provider = http://localhost:8545 gas_gifter_minimum_balance = 10000000000000000000000 -health_modules = cic_eth.check.db,cic_eth.check.gas diff --git a/apps/cic-eth/tests/conftest.py b/apps/cic-eth/tests/conftest.py index 5c4c80d7..eca7cc8c 100644 --- a/apps/cic-eth/tests/conftest.py +++ b/apps/cic-eth/tests/conftest.py @@ -3,8 +3,12 @@ import os import sys import logging +# external imports +from chainlib.eth.erc20 import ERC20 + # local imports from cic_eth.api import Api +from cic_eth.task import BaseTask script_dir = os.path.dirname(os.path.realpath(__file__)) root_dir = os.path.dirname(script_dir) @@ -28,3 +32,26 @@ def api( ): chain_str = str(default_chain_spec) return Api(chain_str, queue=None, callback_param='foo') + + +@pytest.fixture(scope='function') +def foo_token_symbol( + default_chain_spec, + foo_token, + eth_rpc, + contract_roles, + ): + + c = ERC20(default_chain_spec) + o = c.symbol(foo_token, sender_address=contract_roles['CONTRACT_DEPLOYER']) + r = eth_rpc.do(o) + return c.parse_symbol(r) + + +@pytest.fixture(scope='function') +def default_token( + foo_token, + foo_token_symbol, + ): + BaseTask.default_token_symbol = foo_token_symbol + BaseTask.default_token_address = foo_token diff --git a/apps/cic-eth/tests/fixtures_celery.py b/apps/cic-eth/tests/fixtures_celery.py index 33cadc31..26f640d3 100644 --- a/apps/cic-eth/tests/fixtures_celery.py +++ b/apps/cic-eth/tests/fixtures_celery.py @@ -34,6 +34,7 @@ def celery_includes(): 'cic_eth.admin.ctrl', 'cic_eth.admin.nonce', 'cic_eth.admin.debug', + 'cic_eth.admin.token', 'cic_eth.eth.account', 'cic_eth.callbacks.noop', 'cic_eth.callbacks.http', diff --git a/apps/cic-eth/tests/unit/admin/test_default_token.py b/apps/cic-eth/tests/unit/admin/test_default_token.py new file mode 100644 index 00000000..d49ed3fe --- /dev/null +++ b/apps/cic-eth/tests/unit/admin/test_default_token.py @@ -0,0 +1,21 @@ +# external imports +import celery + + +def test_default_token( + default_token, + celery_session_worker, + foo_token, + foo_token_symbol, + ): + + s = celery.signature( + 'cic_eth.admin.token.default_token', + [], + queue=None, + ) + t = s.apply_async() + r = t.get() + + assert r['address'] == foo_token + assert r['symbol'] == foo_token_symbol diff --git a/apps/cic-ussd/requirements.txt b/apps/cic-ussd/requirements.txt index 36aa04b5..793d5021 100644 --- a/apps/cic-ussd/requirements.txt +++ b/apps/cic-ussd/requirements.txt @@ -1,4 +1,4 @@ -cic_base[full_graph]~=0.1.2a79 -cic-eth~=0.11.0b7 +cic_base[full_graph]~=0.1.2b2 +cic-eth~=0.11.0b9 cic-notify~=0.4.0a4 cic-types~=0.1.0a10 From f50da54274fc1516ff906b283fdda07c25da587c Mon Sep 17 00:00:00 2001 From: Louis Holbrook Date: Sat, 24 Apr 2021 17:53:45 +0000 Subject: [PATCH 10/17] Add remaining health checks and shutdown on critical errors --- apps/cic-eth/cic_eth/admin/ctrl.py | 8 ++- apps/cic-eth/cic_eth/admin/token.py | 19 ++++++ apps/cic-eth/cic_eth/check/redis.py | 18 +++++ apps/cic-eth/cic_eth/error.py | 16 +++-- apps/cic-eth/cic_eth/eth/account.py | 29 ++++++--- apps/cic-eth/cic_eth/eth/erc20.py | 15 ++++- apps/cic-eth/cic_eth/eth/gas.py | 14 +++- .../cic_eth/runnable/daemons/tasker.py | 21 ++++-- apps/cic-eth/cic_eth/runnable/info.py | 65 +++++++++++++++++++ apps/cic-eth/cic_eth/task.py | 27 +++++--- apps/cic-eth/config/cic.ini | 2 +- apps/cic-eth/config/docker/cic.ini | 2 +- apps/cic-eth/config/docker/eth.ini | 1 - apps/cic-eth/config/eth.ini | 1 - apps/cic-eth/requirements.txt | 2 +- apps/cic-eth/tests/conftest.py | 27 ++++++++ apps/cic-eth/tests/fixtures_celery.py | 1 + .../tests/unit/admin/test_default_token.py | 21 ++++++ apps/util/liveness/liveness/linux.py | 12 +++- docker-compose.yml | 2 + 20 files changed, 261 insertions(+), 42 deletions(-) create mode 100644 apps/cic-eth/cic_eth/admin/token.py create mode 100644 apps/cic-eth/cic_eth/check/redis.py create mode 100644 apps/cic-eth/cic_eth/runnable/info.py create mode 100644 apps/cic-eth/tests/unit/admin/test_default_token.py diff --git a/apps/cic-eth/cic_eth/admin/ctrl.py b/apps/cic-eth/cic_eth/admin/ctrl.py index 0b55ffc5..af6dd647 100644 --- a/apps/cic-eth/cic_eth/admin/ctrl.py +++ b/apps/cic-eth/cic_eth/admin/ctrl.py @@ -2,7 +2,7 @@ import datetime import logging -# third-party imports +# external imports import celery from chainlib.eth.constant import ZERO_ADDRESS from chainlib.chain import ChainSpec @@ -145,3 +145,9 @@ def check_lock(chained_input, chain_spec_dict, lock_flags, address=None): session.flush() session.close() return chained_input + + +@celery_app.task() +def shutdown(message): + logg.critical('shutdown called: {}'.format(message)) + celery_app.control.shutdown() #broadcast('shutdown') diff --git a/apps/cic-eth/cic_eth/admin/token.py b/apps/cic-eth/cic_eth/admin/token.py new file mode 100644 index 00000000..ffb17568 --- /dev/null +++ b/apps/cic-eth/cic_eth/admin/token.py @@ -0,0 +1,19 @@ +# standard imports +import logging + +# external imports +import celery + +# local imports +from cic_eth.task import BaseTask + +celery_app = celery.current_app +logg = logging.getLogger() + + +@celery_app.task(bind=True, base=BaseTask) +def default_token(self): + return { + 'symbol': self.default_token_symbol, + 'address': self.default_token_address, + } diff --git a/apps/cic-eth/cic_eth/check/redis.py b/apps/cic-eth/cic_eth/check/redis.py new file mode 100644 index 00000000..7a147fe9 --- /dev/null +++ b/apps/cic-eth/cic_eth/check/redis.py @@ -0,0 +1,18 @@ +# external imports +import redis +import os + + +def health(*args, **kwargs): + r = redis.Redis( + host=kwargs['config'].get('REDIS_HOST'), + port=kwargs['config'].get('REDIS_PORT'), + db=kwargs['config'].get('REDIS_DB'), + ) + try: + r.set(kwargs['unit'], os.getpid()) + except redis.connection.ConnectionError: + return False + except redis.connection.ResponseError: + return False + return True diff --git a/apps/cic-eth/cic_eth/error.py b/apps/cic-eth/cic_eth/error.py index 17053158..781fed85 100644 --- a/apps/cic-eth/cic_eth/error.py +++ b/apps/cic-eth/cic_eth/error.py @@ -48,6 +48,8 @@ class RoleMissingError(Exception): pass + + class IntegrityError(Exception): """Exception raised to signal irregularities with deduplication and ordering of tasks @@ -62,15 +64,19 @@ class LockedError(Exception): pass -class SignerError(Exception): +class SeppukuError(Exception): + """Exception base class for all errors that should cause system shutdown + + """ + + +class SignerError(SeppukuError): """Exception raised when signer is unavailable or generates an error """ pass -class EthError(Exception): - """Exception raised when unspecified error from evm node is encountered - +class RoleAgencyError(SeppukuError): + """Exception raise when a role cannot perform its function. This is a critical exception """ - pass diff --git a/apps/cic-eth/cic_eth/eth/account.py b/apps/cic-eth/cic_eth/eth/account.py index e35760ce..46b0060c 100644 --- a/apps/cic-eth/cic_eth/eth/account.py +++ b/apps/cic-eth/cic_eth/eth/account.py @@ -4,10 +4,10 @@ import logging # external imports import celery from erc20_single_shot_faucet import SingleShotFaucet as Faucet -from chainlib.eth.constant import ZERO_ADDRESS from hexathon import ( strip_0x, ) +from chainlib.eth.constant import ZERO_ADDRESS from chainlib.connection import RPCConnection from chainlib.eth.sign import ( new_account, @@ -19,6 +19,7 @@ from chainlib.eth.tx import ( unpack, ) from chainlib.chain import ChainSpec +from chainlib.error import JSONRPCException from eth_accounts_index import AccountRegistry from sarafu_faucet import MinterFaucet as Faucet from chainqueue.db.models.tx import TxCache @@ -70,11 +71,18 @@ def create(self, password, chain_spec_dict): a = None conn = RPCConnection.connect(chain_spec, 'signer') o = new_account() - a = conn.do(o) + try: + a = conn.do(o) + except ConnectionError as e: + raise SignerError(e) + except FileNotFoundError as e: + raise SignerError(e) conn.disconnect() + # TODO: It seems infeasible that a can be None in any case, verify if a == None: raise SignerError('create account') + logg.debug('created account {}'.format(a)) # Initialize nonce provider record for account @@ -219,21 +227,22 @@ def have(self, account, chain_spec_dict): """ chain_spec = ChainSpec.from_dict(chain_spec_dict) o = sign_message(account, '0x2a') - try: - conn = RPCConnection.connect(chain_spec, 'signer') - except Exception as e: - logg.debug('cannot sign with {}: {}'.format(account, e)) - return None + conn = RPCConnection.connect(chain_spec, 'signer') try: conn.do(o) - conn.disconnect() - return account - except Exception as e: + except ConnectionError as e: + raise SignerError(e) + except FileNotFoundError as e: + raise SignerError(e) + except JSONRPCException as e: logg.debug('cannot sign with {}: {}'.format(account, e)) conn.disconnect() return None + conn.disconnect() + return account + @celery_app.task(bind=True, base=CriticalSQLAlchemyTask) def set_role(self, tag, address, chain_spec_dict): diff --git a/apps/cic-eth/cic_eth/eth/erc20.py b/apps/cic-eth/cic_eth/eth/erc20.py index 5bde32b9..71dfd6a2 100644 --- a/apps/cic-eth/cic_eth/eth/erc20.py +++ b/apps/cic-eth/cic_eth/eth/erc20.py @@ -108,7 +108,13 @@ def transfer(self, tokens, holder_address, receiver_address, value, chain_spec_d nonce_oracle = CustodialTaskNonceOracle(holder_address, self.request.root_id, session=session) gas_oracle = self.create_gas_oracle(rpc, MaxGasOracle.gas) c = ERC20(chain_spec, signer=rpc_signer, gas_oracle=gas_oracle, nonce_oracle=nonce_oracle) - (tx_hash_hex, tx_signed_raw_hex) = c.transfer(t['address'], holder_address, receiver_address, value, tx_format=TxFormat.RLP_SIGNED) + try: + (tx_hash_hex, tx_signed_raw_hex) = c.transfer(t['address'], holder_address, receiver_address, value, tx_format=TxFormat.RLP_SIGNED) + except FileNotFoundError as e: + raise SignerError(e) + except ConnectionError as e: + raise SignerError(e) + rpc_signer.disconnect() rpc.disconnect() @@ -171,7 +177,12 @@ def approve(self, tokens, holder_address, spender_address, value, chain_spec_dic nonce_oracle = CustodialTaskNonceOracle(holder_address, self.request.root_id, session=session) gas_oracle = self.create_gas_oracle(rpc, MaxGasOracle.gas) c = ERC20(chain_spec, signer=rpc_signer, gas_oracle=gas_oracle, nonce_oracle=nonce_oracle) - (tx_hash_hex, tx_signed_raw_hex) = c.approve(t['address'], holder_address, spender_address, value, tx_format=TxFormat.RLP_SIGNED) + try: + (tx_hash_hex, tx_signed_raw_hex) = c.approve(t['address'], holder_address, spender_address, value, tx_format=TxFormat.RLP_SIGNED) + except FileNotFoundError as e: + raise SignerError(e) + except ConnectionError as e: + raise SignerError(e) rpc_signer.disconnect() rpc.disconnect() diff --git a/apps/cic-eth/cic_eth/eth/gas.py b/apps/cic-eth/cic_eth/eth/gas.py index f7b71eb9..258054c0 100644 --- a/apps/cic-eth/cic_eth/eth/gas.py +++ b/apps/cic-eth/cic_eth/eth/gas.py @@ -328,7 +328,12 @@ def refill_gas(self, recipient_address, chain_spec_dict): # build and add transaction logg.debug('tx send gas amount {} from provider {} to {}'.format(refill_amount, gas_provider, recipient_address)) - (tx_hash_hex, tx_signed_raw_hex) = c.create(gas_provider, recipient_address, refill_amount, tx_format=TxFormat.RLP_SIGNED) + try: + (tx_hash_hex, tx_signed_raw_hex) = c.create(gas_provider, recipient_address, refill_amount, tx_format=TxFormat.RLP_SIGNED) + except ConnectionError as e: + raise SignerError(e) + except FileNotFoundError as e: + raise SignerError(e) logg.debug('adding queue refill gas tx {}'.format(tx_hash_hex)) cache_task = 'cic_eth.eth.gas.cache_gas_data' register_tx(tx_hash_hex, tx_signed_raw_hex, chain_spec, queue, cache_task=cache_task, session=session) @@ -404,7 +409,12 @@ def resend_with_higher_gas(self, txold_hash_hex, chain_spec_dict, gas=None, defa c = TxFactory(chain_spec, signer=rpc_signer, gas_oracle=gas_oracle) logg.debug('change gas price from old {} to new {} for tx {}'.format(tx['gasPrice'], new_gas_price, tx)) tx['gasPrice'] = new_gas_price - (tx_hash_hex, tx_signed_raw_hex) = c.build_raw(tx) + try: + (tx_hash_hex, tx_signed_raw_hex) = c.build_raw(tx) + except ConnectionError as e: + raise SignerError(e) + except FileNotFoundError as e: + raise SignerError(e) queue_create( chain_spec, tx['nonce'], diff --git a/apps/cic-eth/cic_eth/runnable/daemons/tasker.py b/apps/cic-eth/cic_eth/runnable/daemons/tasker.py index 8b268d08..b6d74c59 100644 --- a/apps/cic-eth/cic_eth/runnable/daemons/tasker.py +++ b/apps/cic-eth/cic_eth/runnable/daemons/tasker.py @@ -11,8 +11,14 @@ import websocket # external imports import celery import confini -from chainlib.connection import RPCConnection -from chainlib.eth.connection import EthUnixSignerConnection +from chainlib.connection import ( + RPCConnection, + ConnType, + ) +from chainlib.eth.connection import ( + EthUnixSignerConnection, + EthHTTPSignerConnection, + ) from chainlib.chain import ChainSpec from chainqueue.db.models.otx import Otx from cic_eth_registry.error import UnknownContractError @@ -143,8 +149,10 @@ else: }) chain_spec = ChainSpec.from_chain_str(config.get('CIC_CHAIN_SPEC')) +RPCConnection.register_constructor(ConnType.UNIX, EthUnixSignerConnection, 'signer') +RPCConnection.register_constructor(ConnType.HTTP, EthHTTPSignerConnection, 'signer') +RPCConnection.register_constructor(ConnType.HTTP_SSL, EthHTTPSignerConnection, 'signer') RPCConnection.register_location(config.get('ETH_PROVIDER'), chain_spec, 'default') -#RPCConnection.register_location(config.get('SIGNER_SOCKET_PATH'), chain_spec, 'signer', constructor=EthUnixSignerConnection) RPCConnection.register_location(config.get('SIGNER_SOCKET_PATH'), chain_spec, 'signer') Otx.tracing = config.true('TASKS_TRACE_QUEUE_STATUS') @@ -152,7 +160,7 @@ Otx.tracing = config.true('TASKS_TRACE_QUEUE_STATUS') #import cic_eth.checks.gas #if not cic_eth.checks.gas.health(config=config): # raise RuntimeError() -liveness.linux.load(health_modules, rundir=config.get('CIC_RUN_DIR'), config=config) +liveness.linux.load(health_modules, rundir=config.get('CIC_RUN_DIR'), config=config, unit='cic-eth-tasker') def main(): argv = ['worker'] @@ -195,11 +203,12 @@ def main(): BaseTask.default_token_symbol = config.get('CIC_DEFAULT_TOKEN_SYMBOL') BaseTask.default_token_address = registry.by_name(BaseTask.default_token_symbol) + BaseTask.run_dir = config.get('CIC_RUN_DIR') logg.info('default token set to {} {}'.format(BaseTask.default_token_symbol, BaseTask.default_token_address)) - liveness.linux.set() + liveness.linux.set(rundir=config.get('CIC_RUN_DIR')) current_app.worker_main(argv) - liveness.linux.reset() + liveness.linux.reset(rundir=config.get('CIC_RUN_DIR')) @celery.signals.eventlet_pool_postshutdown.connect diff --git a/apps/cic-eth/cic_eth/runnable/info.py b/apps/cic-eth/cic_eth/runnable/info.py new file mode 100644 index 00000000..59bfb759 --- /dev/null +++ b/apps/cic-eth/cic_eth/runnable/info.py @@ -0,0 +1,65 @@ +#!python3 + +# SPDX-License-Identifier: GPL-3.0-or-later + +# standard imports +import logging +import argparse +import os + +# external imports +import confini +import celery + +# local imports +from cic_eth.api import Api + +logging.basicConfig(level=logging.WARNING) +logg = logging.getLogger() + +default_format = 'terminal' +default_config_dir = os.environ.get('CONFINI_DIR', '/usr/local/etc/cic') + + +argparser = argparse.ArgumentParser() +argparser.add_argument('-i', '--chain-spec', dest='i', type=str, help='chain spec') +argparser.add_argument('-c', type=str, default=default_config_dir, help='config root to use') +argparser.add_argument('-q', type=str, default='cic-eth', help='celery queue to submit transaction tasks to') +argparser.add_argument('--env-prefix', default=os.environ.get('CONFINI_ENV_PREFIX'), dest='env_prefix', type=str, help='environment prefix for variables to overwrite configuration') +argparser.add_argument('-v', action='store_true', help='Be verbose') +argparser.add_argument('-vv', help='be more verbose', action='store_true') +args = argparser.parse_args() + +if args.v == True: + logging.getLogger().setLevel(logging.INFO) +elif args.vv == True: + logging.getLogger().setLevel(logging.DEBUG) + +config_dir = os.path.join(args.c) +os.makedirs(config_dir, 0o777, True) +config = confini.Config(config_dir, args.env_prefix) +config.process() +args_override = { + 'CIC_CHAIN_SPEC': getattr(args, 'i'), + } +config.dict_override(args_override, 'cli args') +config.censor('PASSWORD', 'DATABASE') +config.censor('PASSWORD', 'SSL') +logg.debug('config loaded from {}:\n{}'.format(config_dir, config)) + + +celery_app = celery.Celery(broker=config.get('CELERY_BROKER_URL'), backend=config.get('CELERY_RESULT_URL')) + +queue = args.q + +api = Api(config.get('CIC_CHAIN_SPEC'), queue=queue) + +def main(): + t = api.default_token() + token_info = t.get() + print('Default token symbol: {}'.format(token_info['symbol'])) + print('Default token address: {}'.format(token_info['address'])) + + +if __name__ == '__main__': + main() diff --git a/apps/cic-eth/cic_eth/task.py b/apps/cic-eth/cic_eth/task.py index 4c4a7f78..3fe201f6 100644 --- a/apps/cic-eth/cic_eth/task.py +++ b/apps/cic-eth/cic_eth/task.py @@ -10,15 +10,13 @@ import sqlalchemy from chainlib.eth.constant import ZERO_ADDRESS from chainlib.eth.nonce import RPCNonceOracle from chainlib.eth.gas import RPCGasOracle +import liveness.linux # local imports -from cic_eth.error import ( - SignerError, - EthError, - ) +from cic_eth.error import SeppukuError from cic_eth.db.models.base import SessionBase -logg = logging.getLogger(__name__) +logg = logging.getLogger().getChild(__name__) celery_app = celery.current_app @@ -31,6 +29,7 @@ class BaseTask(celery.Task): create_gas_oracle = RPCGasOracle default_token_address = None default_token_symbol = None + run_dir = '/run' def create_session(self): return BaseTask.session_func() @@ -40,6 +39,19 @@ class BaseTask(celery.Task): logg.debug('task {} root uuid {}'.format(self.__class__.__name__, self.request.root_id)) return + + def on_failure(self, exc, task_id, args, kwargs, einfo): + if isinstance(exc, SeppukuError): + liveness.linux.reset(rundir=self.run_dir) + logg.critical(einfo) + msg = 'received critical exception {}, calling shutdown'.format(str(exc)) + s = celery.signature( + 'cic_eth.admin.ctrl.shutdown', + [msg], + queue=self.request.delivery_info.get('routing_key'), + ) + s.apply_async() + class CriticalTask(BaseTask): retry_jitter = True @@ -69,7 +81,6 @@ class CriticalSQLAlchemyAndWeb3Task(CriticalTask): sqlalchemy.exc.TimeoutError, requests.exceptions.ConnectionError, sqlalchemy.exc.ResourceClosedError, - EthError, ) safe_gas_threshold_amount = 2000000000 * 60000 * 3 safe_gas_refill_amount = safe_gas_threshold_amount * 5 @@ -80,13 +91,11 @@ class CriticalSQLAlchemyAndSignerTask(CriticalTask): sqlalchemy.exc.DatabaseError, sqlalchemy.exc.TimeoutError, sqlalchemy.exc.ResourceClosedError, - SignerError, ) class CriticalWeb3AndSignerTask(CriticalTask): autoretry_for = ( requests.exceptions.ConnectionError, - SignerError, ) safe_gas_threshold_amount = 2000000000 * 60000 * 3 safe_gas_refill_amount = safe_gas_threshold_amount * 5 @@ -100,4 +109,4 @@ def hello(self): @celery_app.task() def check_health(self): - celery.app.control.shutdown() + pass diff --git a/apps/cic-eth/config/cic.ini b/apps/cic-eth/config/cic.ini index bce15e14..d3840fac 100644 --- a/apps/cic-eth/config/cic.ini +++ b/apps/cic-eth/config/cic.ini @@ -4,5 +4,5 @@ chain_spec = evm:bloxberg:8996 tx_retry_delay = trust_address = default_token_symbol = GFT -health_modules = cic_eth.check.db,cic_eth.check.signer,cic_eth.check.gas +health_modules = cic_eth.check.db,cic_eth.check.redis,cic_eth.check.signer,cic_eth.check.gas run_dir = /run diff --git a/apps/cic-eth/config/docker/cic.ini b/apps/cic-eth/config/docker/cic.ini index e4b9e0bd..4fdefca0 100644 --- a/apps/cic-eth/config/docker/cic.ini +++ b/apps/cic-eth/config/docker/cic.ini @@ -4,5 +4,5 @@ chain_spec = evm:bloxberg:8996 trust_address = 0xEb3907eCad74a0013c259D5874AE7f22DcBcC95C tx_retry_delay = 20 default_token_symbol = GFT -health_modules = cic_eth.check.db,cic_eth.check.signer,cic_eth.check.gas +health_modules = cic_eth.check.db,cic_eth.check.redis,cic_eth.check.signer,cic_eth.check.gas run_dir = /run diff --git a/apps/cic-eth/config/docker/eth.ini b/apps/cic-eth/config/docker/eth.ini index 9d6b6607..534a2eea 100644 --- a/apps/cic-eth/config/docker/eth.ini +++ b/apps/cic-eth/config/docker/eth.ini @@ -1,4 +1,3 @@ [eth] provider = http://localhost:63545 -health_modules = cic_eth.check.db,cic_eth.check.gas gas_gifter_minimum_balance = 10000000000000000000000 diff --git a/apps/cic-eth/config/eth.ini b/apps/cic-eth/config/eth.ini index 3b41af90..3c589cb2 100644 --- a/apps/cic-eth/config/eth.ini +++ b/apps/cic-eth/config/eth.ini @@ -1,4 +1,3 @@ [eth] provider = http://localhost:8545 gas_gifter_minimum_balance = 10000000000000000000000 -health_modules = cic_eth.check.db,cic_eth.check.gas diff --git a/apps/cic-eth/requirements.txt b/apps/cic-eth/requirements.txt index 44d8b272..8d8cd68b 100644 --- a/apps/cic-eth/requirements.txt +++ b/apps/cic-eth/requirements.txt @@ -1,4 +1,4 @@ -cic-base==0.1.2b1 +cic-base==0.1.2b2 celery==4.4.7 crypto-dev-signer~=0.4.14b3 confini~=0.3.6rc3 diff --git a/apps/cic-eth/tests/conftest.py b/apps/cic-eth/tests/conftest.py index 5c4c80d7..eca7cc8c 100644 --- a/apps/cic-eth/tests/conftest.py +++ b/apps/cic-eth/tests/conftest.py @@ -3,8 +3,12 @@ import os import sys import logging +# external imports +from chainlib.eth.erc20 import ERC20 + # local imports from cic_eth.api import Api +from cic_eth.task import BaseTask script_dir = os.path.dirname(os.path.realpath(__file__)) root_dir = os.path.dirname(script_dir) @@ -28,3 +32,26 @@ def api( ): chain_str = str(default_chain_spec) return Api(chain_str, queue=None, callback_param='foo') + + +@pytest.fixture(scope='function') +def foo_token_symbol( + default_chain_spec, + foo_token, + eth_rpc, + contract_roles, + ): + + c = ERC20(default_chain_spec) + o = c.symbol(foo_token, sender_address=contract_roles['CONTRACT_DEPLOYER']) + r = eth_rpc.do(o) + return c.parse_symbol(r) + + +@pytest.fixture(scope='function') +def default_token( + foo_token, + foo_token_symbol, + ): + BaseTask.default_token_symbol = foo_token_symbol + BaseTask.default_token_address = foo_token diff --git a/apps/cic-eth/tests/fixtures_celery.py b/apps/cic-eth/tests/fixtures_celery.py index 33cadc31..26f640d3 100644 --- a/apps/cic-eth/tests/fixtures_celery.py +++ b/apps/cic-eth/tests/fixtures_celery.py @@ -34,6 +34,7 @@ def celery_includes(): 'cic_eth.admin.ctrl', 'cic_eth.admin.nonce', 'cic_eth.admin.debug', + 'cic_eth.admin.token', 'cic_eth.eth.account', 'cic_eth.callbacks.noop', 'cic_eth.callbacks.http', diff --git a/apps/cic-eth/tests/unit/admin/test_default_token.py b/apps/cic-eth/tests/unit/admin/test_default_token.py new file mode 100644 index 00000000..d49ed3fe --- /dev/null +++ b/apps/cic-eth/tests/unit/admin/test_default_token.py @@ -0,0 +1,21 @@ +# external imports +import celery + + +def test_default_token( + default_token, + celery_session_worker, + foo_token, + foo_token_symbol, + ): + + s = celery.signature( + 'cic_eth.admin.token.default_token', + [], + queue=None, + ) + t = s.apply_async() + r = t.get() + + assert r['address'] == foo_token + assert r['symbol'] == foo_token_symbol diff --git a/apps/util/liveness/liveness/linux.py b/apps/util/liveness/liveness/linux.py index 7ff754f0..52d4b24c 100644 --- a/apps/util/liveness/liveness/linux.py +++ b/apps/util/liveness/liveness/linux.py @@ -42,6 +42,7 @@ def load(check_strs, namespace=default_namespace, rundir='/run', *args, **kwargs def set(error=0, namespace=default_namespace, rundir='/run'): + logg.info('liveness SET error {} for namespace {}'.format(error, namespace)) app_rundir = os.path.join(rundir, namespace) f = open(os.path.join(app_rundir, 'error'), 'w') f.write(str(error)) @@ -49,6 +50,13 @@ def set(error=0, namespace=default_namespace, rundir='/run'): def reset(namespace=default_namespace, rundir='/run'): + logg.info('liveness RESET for namespace {}'.format(namespace)) app_rundir = os.path.join(rundir, namespace) - os.unlink(os.path.join(app_rundir, 'pid')) - os.unlink(os.path.join(app_rundir, 'error')) + try: + os.unlink(os.path.join(app_rundir, 'pid')) + except FileNotFoundError: + pass + try: + os.unlink(os.path.join(app_rundir, 'error')) + except FileNotFoundError: + pass diff --git a/docker-compose.yml b/docker-compose.yml index 26681d8f..a3abb776 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -240,6 +240,8 @@ services: DATABASE_DRIVER: ${DATABASE_DRIVER:-psycopg2} DATABASE_DEBUG: ${DATABASE_DEBUG:-0} DATABASE_POOL_SIZE: 0 + REDIS_PORT: 6379 + REDIS_HOST: redis PGPASSWORD: ${DATABASE_PASSWORD:-tralala} CIC_CHAIN_SPEC: ${CIC_CHAIN_SPEC:-evm:bloxberg:8996} BANCOR_DIR: ${BANCOR_DIR:-/usr/local/share/cic/bancor} From c20c5af27c9c2b883277e981e4fe70e1ec51c416 Mon Sep 17 00:00:00 2001 From: Louis Holbrook Date: Sun, 25 Apr 2021 12:08:40 +0000 Subject: [PATCH 11/17] Upgrade chainlib --- apps/cic-eth/requirements.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/cic-eth/requirements.txt b/apps/cic-eth/requirements.txt index 8d8cd68b..c923ada2 100644 --- a/apps/cic-eth/requirements.txt +++ b/apps/cic-eth/requirements.txt @@ -1,4 +1,4 @@ -cic-base==0.1.2b2 +cic-base==0.1.2b3 celery==4.4.7 crypto-dev-signer~=0.4.14b3 confini~=0.3.6rc3 @@ -15,7 +15,7 @@ semver==2.13.0 websocket-client==0.57.0 moolb~=0.1.1b2 eth-address-index~=0.1.1a9 -chainlib~=0.0.2a13 +chainlib~=0.0.2a18 hexathon~=0.0.1a7 chainsyncer[sql]~=0.0.2a2 chainqueue~=0.0.1a7 From 7428420cdaeaf526e0fb3354ac41c1eee366635e Mon Sep 17 00:00:00 2001 From: Louis Holbrook Date: Sun, 25 Apr 2021 12:14:55 +0000 Subject: [PATCH 12/17] Fix cic-ussd cic-eth conflict --- apps/cic-eth/cic_eth/version.py | 2 +- apps/contract-migration/scripts/requirements.txt | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/apps/cic-eth/cic_eth/version.py b/apps/cic-eth/cic_eth/version.py index ed55ca63..a1f9dd24 100644 --- a/apps/cic-eth/cic_eth/version.py +++ b/apps/cic-eth/cic_eth/version.py @@ -10,7 +10,7 @@ version = ( 0, 11, 0, - 'beta.9', + 'beta.10', ) version_object = semver.VersionInfo( diff --git a/apps/contract-migration/scripts/requirements.txt b/apps/contract-migration/scripts/requirements.txt index 4d02487e..8c055b61 100644 --- a/apps/contract-migration/scripts/requirements.txt +++ b/apps/contract-migration/scripts/requirements.txt @@ -1,5 +1,5 @@ -cic-base[full_graph]==0.1.2a77 +cic-base[full_graph]==0.1.2b2 sarafu-faucet==0.0.2a28 -cic-eth==0.11.0b6 +cic-eth==0.11.0b10 cic-types==0.1.0a10 -crypto-dev-signer==0.4.14b2 +crypto-dev-signer==0.4.14b3 From aa15353d6805eca85d126878d8d6c37c275a98b7 Mon Sep 17 00:00:00 2001 From: Louis Holbrook Date: Sun, 25 Apr 2021 12:24:17 +0000 Subject: [PATCH 13/17] Use task pool rpc for registry and eth queries with cic-eth view cli util --- apps/cic-eth/cic_eth/api/api_admin.py | 176 ++++++++++++------ apps/cic-eth/cic_eth/registry.py | 2 +- apps/cic-eth/cic_eth/runnable/ctrl.py | 1 - .../cic_eth/runnable/daemons/tasker.py | 1 - apps/cic-eth/cic_eth/runnable/transfer.py | 3 - apps/cic-eth/cic_eth/runnable/view.py | 18 +- apps/cic-eth/cic_eth/task.py | 39 +++- apps/cic-eth/cic_eth/version.py | 2 +- 8 files changed, 167 insertions(+), 75 deletions(-) diff --git a/apps/cic-eth/cic_eth/api/api_admin.py b/apps/cic-eth/cic_eth/api/api_admin.py index a0c804f2..5862dd65 100644 --- a/apps/cic-eth/cic_eth/api/api_admin.py +++ b/apps/cic-eth/cic_eth/api/api_admin.py @@ -60,6 +60,29 @@ class AdminApi: self.call_address = call_address + def proxy_do(self, chain_spec, o): + s_proxy = celery.signature( + 'cic_eth.task.rpc_proxy', + [ + chain_spec.asdict(), + o, + 'default', + ], + queue=self.queue + ) + return s_proxy.apply_async() + + + + def registry(self): + s_registry = celery.signature( + 'cic_eth.task.registry', + [], + queue=self.queue + ) + return s_registry.apply_async() + + def unlock(self, chain_spec, address, flags=None): s_unlock = celery.signature( 'cic_eth.admin.ctrl.unlock', @@ -146,7 +169,6 @@ class AdminApi: # TODO: This check should most likely be in resend task itself tx_dict = s_get_tx_cache.apply_async().get() - #if tx_dict['status'] in [StatusEnum.REVERTED, StatusEnum.SUCCESS, StatusEnum.CANCELLED, StatusEnum.OBSOLETED]: if not is_alive(getattr(StatusEnum, tx_dict['status']).value): raise TxStateChangeError('Cannot resend mined or obsoleted transaction'.format(txold_hash_hex)) @@ -226,9 +248,6 @@ class AdminApi: break last_nonce = nonce_otx - #nonce_cache = Nonce.get(address) - #nonce_w3 = self.w3.eth.getTransactionCount(address, 'pending') - return { 'nonce': { #'network': nonce_cache, @@ -272,20 +291,6 @@ class AdminApi: return s_nonce.apply_async() -# # TODO: this is a stub, complete all checks -# def ready(self): -# """Checks whether all required initializations have been performed. -# -# :raises cic_eth.error.InitializationError: At least one setting pre-requisite has not been met. -# :raises KeyError: An address provided for initialization is not known by the keystore. -# """ -# addr = AccountRole.get_address('ETH_GAS_PROVIDER_ADDRESS') -# if addr == ZERO_ADDRESS: -# raise InitializationError('missing account ETH_GAS_PROVIDER_ADDRESS') -# -# self.w3.eth.sign(addr, text='666f6f') - - def account(self, chain_spec, address, include_sender=True, include_recipient=True, renderer=None, w=sys.stdout): """Lists locally originated transactions for the given Ethereum address. @@ -348,6 +353,7 @@ class AdminApi: # TODO: Add exception upon non-existent tx aswell as invalid tx data to docstring + # TODO: This method is WAY too long def tx(self, chain_spec, tx_hash=None, tx_raw=None, registry=None, renderer=None, w=sys.stdout): """Output local and network details about a given transaction with local origin. @@ -370,7 +376,6 @@ class AdminApi: if tx_raw != None: tx_hash = add_0x(keccak256_hex_to_hex(tx_raw)) - #tx_hash = self.w3.keccak(hexstr=tx_raw).hex() s = celery.signature( 'cic_eth.queue.query.get_tx_cache', @@ -386,38 +391,78 @@ class AdminApi: source_token = None if tx['source_token'] != ZERO_ADDRESS: - try: - source_token = registry.by_address(tx['source_token']) - #source_token = CICRegistry.get_address(chain_spec, tx['source_token']).contract - except UnknownContractError: - #source_token_contract = self.w3.eth.contract(abi=CICRegistry.abi('ERC20'), address=tx['source_token']) - #source_token = CICRegistry.add_token(chain_spec, source_token_contract) - logg.warning('unknown source token contract {}'.format(tx['source_token'])) + if registry != None: + try: + source_token = registry.by_address(tx['source_token']) + except UnknownContractError: + logg.warning('unknown source token contract {} (direct)'.format(tx['source_token'])) + else: + s = celery.signature( + 'cic_eth.task.registry_address_lookup', + [ + chain_spec.asdict(), + tx['source_token'], + ], + queue=self.queue + ) + t = s.apply_async() + source_token = t.get() + if source_token == None: + logg.warning('unknown source token contract {} (task pool)'.format(tx['source_token'])) + destination_token = None - if tx['source_token'] != ZERO_ADDRESS: - try: - #destination_token = CICRegistry.get_address(chain_spec, tx['destination_token']) - destination_token = registry.by_address(tx['destination_token']) - except UnknownContractError: - #destination_token_contract = self.w3.eth.contract(abi=CICRegistry.abi('ERC20'), address=tx['source_token']) - #destination_token = CICRegistry.add_token(chain_spec, destination_token_contract) - logg.warning('unknown destination token contract {}'.format(tx['destination_token'])) + if tx['destination_token'] != ZERO_ADDRESS: + if registry != None: + try: + destination_token = registry.by_address(tx['destination_token']) + except UnknownContractError: + logg.warning('unknown destination token contract {}'.format(tx['destination_token'])) + else: + s = celery.signature( + 'cic_eth.task.registry_address_lookup', + [ + chain_spec.asdict(), + tx['destination_token'], + ], + queue=self.queue + ) + t = s.apply_async() + destination_token = t.get() + if destination_token == None: + logg.warning('unknown destination token contract {} (task pool)'.format(tx['destination_token'])) + tx['sender_description'] = 'Custodial account' tx['recipient_description'] = 'Custodial account' o = code(tx['sender']) - r = self.rpc.do(o) + t = self.proxy_do(chain_spec, o) + r = t.get() if len(strip_0x(r, allow_empty=True)) > 0: - try: - #sender_contract = CICRegistry.get_address(chain_spec, tx['sender']) - sender_contract = registry.by_address(tx['sender'], sender_address=self.call_address) - tx['sender_description'] = 'Contract at {}'.format(tx['sender']) #sender_contract) - except UnknownContractError: - tx['sender_description'] = 'Unknown contract' - except KeyError as e: - tx['sender_description'] = 'Unknown contract' + if registry != None: + try: + sender_contract = registry.by_address(tx['sender'], sender_address=self.call_address) + tx['sender_description'] = 'Contract at {}'.format(tx['sender']) + except UnknownContractError: + tx['sender_description'] = 'Unknown contract' + except KeyError as e: + tx['sender_description'] = 'Unknown contract' + else: + s = celery.signature( + 'cic_eth.task.registry_address_lookup', + [ + chain_spec.asdict(), + tx['sender'], + ], + queue=self.queue + ) + t = s.apply_async() + tx['sender_description'] = t.get() + if tx['sender_description'] == None: + tx['sender_description'] = 'Unknown contract' + + else: s = celery.signature( 'cic_eth.eth.account.have', @@ -446,16 +491,31 @@ class AdminApi: tx['sender_description'] = role o = code(tx['recipient']) - r = self.rpc.do(o) + t = self.proxy_do(chain_spec, o) + r = t.get() if len(strip_0x(r, allow_empty=True)) > 0: - try: - #recipient_contract = CICRegistry.by_address(tx['recipient']) - recipient_contract = registry.by_address(tx['recipient']) - tx['recipient_description'] = 'Contract at {}'.format(tx['recipient']) #recipient_contract) - except UnknownContractError as e: - tx['recipient_description'] = 'Unknown contract' - except KeyError as e: - tx['recipient_description'] = 'Unknown contract' + if registry != None: + try: + recipient_contract = registry.by_address(tx['recipient']) + tx['recipient_description'] = 'Contract at {}'.format(tx['recipient']) + except UnknownContractError as e: + tx['recipient_description'] = 'Unknown contract' + except KeyError as e: + tx['recipient_description'] = 'Unknown contract' + else: + s = celery.signature( + 'cic_eth.task.registry_address_lookup', + [ + chain_spec.asdict(), + tx['recipient'], + ], + queue=self.queue + ) + t = s.apply_async() + tx['recipient_description'] = t.get() + if tx['recipient_description'] == None: + tx['recipient_description'] = 'Unknown contract' + else: s = celery.signature( 'cic_eth.eth.account.have', @@ -497,7 +557,8 @@ class AdminApi: r = None try: o = transaction(tx_hash) - r = self.rpc.do(o) + t = self.proxy_do(chain_spec, o) + r = t.get() if r != None: tx['network_status'] = 'Mempool' except Exception as e: @@ -506,7 +567,8 @@ class AdminApi: if r != None: try: o = receipt(tx_hash) - r = self.rpc.do(o) + t = self.proxy_do(chain_spec, o) + r = t.get() logg.debug('h {} o {}'.format(tx_hash, o)) if int(strip_0x(r['status'])) == 1: tx['network_status'] = 'Confirmed' @@ -521,11 +583,13 @@ class AdminApi: pass o = balance(tx['sender']) - r = self.rpc.do(o) + t = self.proxy_do(chain_spec, o) + r = t.get() tx['sender_gas_balance'] = r o = balance(tx['recipient']) - r = self.rpc.do(o) + t = self.proxy_do(chain_spec, o) + r = t.get() tx['recipient_gas_balance'] = r tx_unpacked = unpack(bytes.fromhex(strip_0x(tx['signed_tx'])), chain_spec) diff --git a/apps/cic-eth/cic_eth/registry.py b/apps/cic-eth/cic_eth/registry.py index e1e481ef..2b5e2b94 100644 --- a/apps/cic-eth/cic_eth/registry.py +++ b/apps/cic-eth/cic_eth/registry.py @@ -29,5 +29,5 @@ def connect(rpc, chain_spec, registry_address): CICRegistry.address = registry_address registry = CICRegistry(chain_spec, rpc) registry_address = registry.by_name('ContractRegistry') - return registry + diff --git a/apps/cic-eth/cic_eth/runnable/ctrl.py b/apps/cic-eth/cic_eth/runnable/ctrl.py index 8f9df080..454b765d 100644 --- a/apps/cic-eth/cic_eth/runnable/ctrl.py +++ b/apps/cic-eth/cic_eth/runnable/ctrl.py @@ -23,7 +23,6 @@ default_config_dir = os.environ.get('CONFINI_DIR', '/usr/local/etc/cic') argparser = argparse.ArgumentParser() argparser.add_argument('-p', '--provider', dest='p', default='http://localhost:8545', type=str, help='Web3 provider url (http only)') -argparser.add_argument('-r', '--registry-address', type=str, help='CIC registry address') argparser.add_argument('-f', '--format', dest='f', default=default_format, type=str, help='Output format') argparser.add_argument('-c', type=str, default=default_config_dir, help='config root to use') argparser.add_argument('-i', '--chain-spec', dest='i', type=str, help='chain spec') diff --git a/apps/cic-eth/cic_eth/runnable/daemons/tasker.py b/apps/cic-eth/cic_eth/runnable/daemons/tasker.py index b6d74c59..de6a4f27 100644 --- a/apps/cic-eth/cic_eth/runnable/daemons/tasker.py +++ b/apps/cic-eth/cic_eth/runnable/daemons/tasker.py @@ -36,7 +36,6 @@ from cic_eth.eth import ( from cic_eth.admin import ( debug, ctrl, - token, ) from cic_eth.queue import ( query, diff --git a/apps/cic-eth/cic_eth/runnable/transfer.py b/apps/cic-eth/cic_eth/runnable/transfer.py index 6f408785..c63c72a7 100644 --- a/apps/cic-eth/cic_eth/runnable/transfer.py +++ b/apps/cic-eth/cic_eth/runnable/transfer.py @@ -85,9 +85,6 @@ def main(): callback_queue=args.q, ) - #register = not args.no_register - #logg.debug('register {}'.format(register)) - #t = api.create_account(register=register) t = api.transfer(config.get('_SENDER'), config.get('_RECIPIENT'), config.get('_VALUE'), config.get('_SYMBOL')) ps.get_message() diff --git a/apps/cic-eth/cic_eth/runnable/view.py b/apps/cic-eth/cic_eth/runnable/view.py index 50adce37..ef08e2a4 100644 --- a/apps/cic-eth/cic_eth/runnable/view.py +++ b/apps/cic-eth/cic_eth/runnable/view.py @@ -81,10 +81,14 @@ chain_spec = ChainSpec.from_chain_str(config.get('CIC_CHAIN_SPEC')) rpc = EthHTTPConnection(args.p) -registry_address = config.get('CIC_REGISTRY_ADDRESS') +#registry_address = config.get('CIC_REGISTRY_ADDRESS') admin_api = AdminApi(rpc) +t = admin_api.registry() +registry_address = t.get() +logg.info('got registry address from task pool: {}'.format(registry_address)) + trusted_addresses_src = config.get('CIC_TRUST_ADDRESS') if trusted_addresses_src == None: logg.critical('At least one trusted address must be declared in CIC_TRUST_ADDRESS') @@ -151,14 +155,16 @@ def main(): txs = [] renderer = render_tx if len(config.get('_QUERY')) > 66: - registry = connect_registry(rpc, chain_spec, registry_address) - admin_api.tx(chain_spec, tx_raw=config.get('_QUERY'), registry=registry, renderer=renderer) + #registry = connect_registry(rpc, chain_spec, registry_address) + #admin_api.tx(chain_spec, tx_raw=config.get('_QUERY'), registry=registry, renderer=renderer) + admin_api.tx(chain_spec, tx_raw=config.get('_QUERY'), renderer=renderer) elif len(config.get('_QUERY')) > 42: - registry = connect_registry(rpc, chain_spec, registry_address) - admin_api.tx(chain_spec, tx_hash=config.get('_QUERY'), registry=registry, renderer=renderer) + #registry = connect_registry(rpc, chain_spec, registry_address) + #admin_api.tx(chain_spec, tx_hash=config.get('_QUERY'), registry=registry, renderer=renderer) + admin_api.tx(chain_spec, tx_hash=config.get('_QUERY'), renderer=renderer) elif len(config.get('_QUERY')) == 42: - registry = connect_registry(rpc, chain_spec, registry_address) + #registry = connect_registry(rpc, chain_spec, registry_address) txs = admin_api.account(chain_spec, config.get('_QUERY'), include_recipient=False, renderer=render_account) renderer = render_account elif len(config.get('_QUERY')) >= 4 and config.get('_QUERY')[:4] == 'lock': diff --git a/apps/cic-eth/cic_eth/task.py b/apps/cic-eth/cic_eth/task.py index 3fe201f6..d0d41d47 100644 --- a/apps/cic-eth/cic_eth/task.py +++ b/apps/cic-eth/cic_eth/task.py @@ -7,9 +7,13 @@ import uuid # external imports import celery import sqlalchemy +from chainlib.chain import ChainSpec +from chainlib.connection import RPCConnection from chainlib.eth.constant import ZERO_ADDRESS from chainlib.eth.nonce import RPCNonceOracle from chainlib.eth.gas import RPCGasOracle +from cic_eth_registry import CICRegistry +from cic_eth_registry.error import UnknownContractError import liveness.linux # local imports @@ -101,12 +105,35 @@ class CriticalWeb3AndSignerTask(CriticalTask): safe_gas_refill_amount = safe_gas_threshold_amount * 5 -@celery_app.task(bind=True, base=BaseTask) -def hello(self): - time.sleep(0.1) - return id(SessionBase.create_session) - - @celery_app.task() def check_health(self): pass + + +# TODO: registry / rpc methods should perhaps be moved to better named module +@celery_app.task() +def registry(): + return CICRegistry.address + + +@celery_app.task() +def registry_address_lookup(chain_spec_dict, address, connection_tag='default'): + chain_spec = ChainSpec.from_dict(chain_spec_dict) + conn = RPCConnection.connect(chain_spec, tag=connection_tag) + registry = CICRegistry(chain_spec, conn) + return registry.by_address(address) + + +@celery_app.task(throws=(UnknownContractError,)) +def registry_name_lookup(chain_spec_dict, name, connection_tag='default'): + chain_spec = ChainSpec.from_dict(chain_spec_dict) + conn = RPCConnection.connect(chain_spec, tag=connection_tag) + registry = CICRegistry(chain_spec, conn) + return registry.by_name(name) + + +@celery_app.task() +def rpc_proxy(chain_spec_dict, o, connection_tag='default'): + chain_spec = ChainSpec.from_dict(chain_spec_dict) + conn = RPCConnection.connect(chain_spec, tag=connection_tag) + return conn.do(o) diff --git a/apps/cic-eth/cic_eth/version.py b/apps/cic-eth/cic_eth/version.py index a1f9dd24..a57e9bef 100644 --- a/apps/cic-eth/cic_eth/version.py +++ b/apps/cic-eth/cic_eth/version.py @@ -10,7 +10,7 @@ version = ( 0, 11, 0, - 'beta.10', + 'beta.11', ) version_object = semver.VersionInfo( From 5663741ed4c5f972a5dce53e578960253928b83d Mon Sep 17 00:00:00 2001 From: Louis Holbrook Date: Sun, 25 Apr 2021 14:54:54 +0000 Subject: [PATCH 14/17] cic-eth: Make failing tests pass again --- apps/cic-eth/cic_eth/ext/tx.py | 2 +- apps/cic-eth/cic_eth/queue/time.py | 1 + apps/cic-eth/requirements.txt | 6 +++--- apps/cic-eth/tests/filters/test_callback_filter.py | 2 ++ apps/cic-eth/tests/filters/test_tx_filter.py | 1 + apps/cic-eth/tests/fixtures_database.py | 3 +++ apps/cic-eth/tests/task/api/test_admin.py | 2 +- apps/cic-eth/tests/task/api/test_list.py | 2 +- 8 files changed, 13 insertions(+), 6 deletions(-) diff --git a/apps/cic-eth/cic_eth/ext/tx.py b/apps/cic-eth/cic_eth/ext/tx.py index d635fd54..a5d59aa7 100644 --- a/apps/cic-eth/cic_eth/ext/tx.py +++ b/apps/cic-eth/cic_eth/ext/tx.py @@ -114,7 +114,7 @@ def list_tx_by_bloom(self, bloomspec, address, chain_spec_dict): # TODO: pass through registry to validate declarator entry of token #token = registry.by_address(tx['to'], sender_address=self.call_address) - token = ERC20Token(rpc, tx['to']) + token = ERC20Token(chain_spec, rpc, tx['to']) token_symbol = token.symbol token_decimals = token.decimals times = tx_times(tx['hash'], chain_spec) diff --git a/apps/cic-eth/cic_eth/queue/time.py b/apps/cic-eth/cic_eth/queue/time.py index b3c74ece..e60a4788 100644 --- a/apps/cic-eth/cic_eth/queue/time.py +++ b/apps/cic-eth/cic_eth/queue/time.py @@ -12,6 +12,7 @@ from chainqueue.error import NotLocalTxError # local imports from cic_eth.task import CriticalSQLAlchemyAndWeb3Task +from cic_eth.db.models.base import SessionBase celery_app = celery.current_app diff --git a/apps/cic-eth/requirements.txt b/apps/cic-eth/requirements.txt index c923ada2..ced81836 100644 --- a/apps/cic-eth/requirements.txt +++ b/apps/cic-eth/requirements.txt @@ -1,4 +1,4 @@ -cic-base==0.1.2b3 +cic-base==0.1.2b5 celery==4.4.7 crypto-dev-signer~=0.4.14b3 confini~=0.3.6rc3 @@ -15,10 +15,10 @@ semver==2.13.0 websocket-client==0.57.0 moolb~=0.1.1b2 eth-address-index~=0.1.1a9 -chainlib~=0.0.2a18 +chainlib~=0.0.2a20 hexathon~=0.0.1a7 chainsyncer[sql]~=0.0.2a2 -chainqueue~=0.0.1a7 +chainqueue~=0.0.2a2 pysha3==1.0.2 coincurve==15.0.0 sarafu-faucet==0.0.2a28 diff --git a/apps/cic-eth/tests/filters/test_callback_filter.py b/apps/cic-eth/tests/filters/test_callback_filter.py index 952ff157..0edca810 100644 --- a/apps/cic-eth/tests/filters/test_callback_filter.py +++ b/apps/cic-eth/tests/filters/test_callback_filter.py @@ -210,9 +210,11 @@ def test_callback_filter( def __init__(self): self.results = {} + self.queue = 'test' def call_back(self, transfer_type, result): self.results[transfer_type] = result + return self mock = CallbackMock() fltr.call_back = mock.call_back diff --git a/apps/cic-eth/tests/filters/test_tx_filter.py b/apps/cic-eth/tests/filters/test_tx_filter.py index 7515401e..bd706e5d 100644 --- a/apps/cic-eth/tests/filters/test_tx_filter.py +++ b/apps/cic-eth/tests/filters/test_tx_filter.py @@ -65,6 +65,7 @@ def test_tx( tx_hash_hex_orig = tx_hash_hex gas_oracle = OverrideGasOracle(price=1100000000, limit=21000) + c = Gas(default_chain_spec, signer=eth_signer, nonce_oracle=nonce_oracle, gas_oracle=gas_oracle) (tx_hash_hex, tx_signed_raw_hex) = c.create(agent_roles['ALICE'], agent_roles['BOB'], 100 * (10 ** 6), tx_format=TxFormat.RLP_SIGNED) queue_create( default_chain_spec, diff --git a/apps/cic-eth/tests/fixtures_database.py b/apps/cic-eth/tests/fixtures_database.py index 604a87a4..6e43a852 100644 --- a/apps/cic-eth/tests/fixtures_database.py +++ b/apps/cic-eth/tests/fixtures_database.py @@ -53,6 +53,9 @@ def init_database( alembic.command.downgrade(ac, 'base') alembic.command.upgrade(ac, 'head') + session.execute('DELETE FROM lock') + session.commit() + yield session session.commit() session.close() diff --git a/apps/cic-eth/tests/task/api/test_admin.py b/apps/cic-eth/tests/task/api/test_admin.py index ca50f107..a37e94a9 100644 --- a/apps/cic-eth/tests/task/api/test_admin.py +++ b/apps/cic-eth/tests/task/api/test_admin.py @@ -273,7 +273,7 @@ def test_tx( eth_signer, agent_roles, contract_roles, - celery_worker, + celery_session_worker, ): nonce_oracle = RPCNonceOracle(agent_roles['ALICE'], eth_rpc) diff --git a/apps/cic-eth/tests/task/api/test_list.py b/apps/cic-eth/tests/task/api/test_list.py index 8f513ff4..0a452396 100644 --- a/apps/cic-eth/tests/task/api/test_list.py +++ b/apps/cic-eth/tests/task/api/test_list.py @@ -35,7 +35,7 @@ def test_list_tx( foo_token, register_tokens, init_eth_tester, - celery_worker, + celery_session_worker, ): tx_hashes = [] From f64ff1290cf4f2b58a4f555ea4f3efda7785e712 Mon Sep 17 00:00:00 2001 From: Blair Vanderlugt Date: Tue, 27 Apr 2021 21:01:58 -0700 Subject: [PATCH 15/17] switch to deb solc package --- apps/contract-migration/docker/Dockerfile | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/apps/contract-migration/docker/Dockerfile b/apps/contract-migration/docker/Dockerfile index f0d82cb1..7f9f2b88 100644 --- a/apps/contract-migration/docker/Dockerfile +++ b/apps/contract-migration/docker/Dockerfile @@ -4,9 +4,13 @@ FROM python:3.8.6-slim-buster as compile-image RUN apt-get update RUN apt-get install -y --no-install-recommends git gcc g++ libpq-dev gawk jq telnet wget openssl iputils-ping gnupg socat bash procps make python2 cargo -RUN apt-get install -y software-properties-common -RUN add-apt-repository ppa:ethereum/ethereum -RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 1C52189C923F6CA9 +RUN touch /etc/apt/sources.list.d/ethereum.list +RUN echo 'deb http://ppa.launchpad.net/ethereum/ethereum/ubuntu bionic main' > /etc/apt/sources.list.d/ethereum.list +RUN echo 'deb-src http://ppa.launchpad.net/ethereum/ethereum/ubuntu bionic main' >> /etc/apt/sources.list.d/ethereum.list + +RUN cat etc/apt/sources.list.d/ethereum.list +RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 2A518C819BE37D2C2031944D1C52189C923F6CA9 + RUN apt-get update RUN apt-get install solc RUN pip install --upgrade pip From 1bc29588a10df248355e9e4762ce29d5ed2cb836 Mon Sep 17 00:00:00 2001 From: Spencer Ofwiti Date: Wed, 28 Apr 2021 09:11:39 +0000 Subject: [PATCH 16/17] Remove library files into crdt-meta. --- apps/cic-meta/.gitignore | 1 - apps/cic-meta/package-lock.json | 101 +++++-- apps/cic-meta/package.json | 7 +- apps/cic-meta/scripts/dumpconfig.js | 4 +- apps/cic-meta/scripts/server/handlers.ts | 3 +- apps/cic-meta/scripts/server/server.ts | 6 +- apps/cic-meta/src/auth.ts | 191 ------------- apps/cic-meta/src/config.ts | 71 ----- apps/cic-meta/src/constants.ts | 38 --- apps/cic-meta/src/crypto.ts | 27 -- apps/cic-meta/src/db.ts | 90 ------ apps/cic-meta/src/digest.ts | 68 ----- apps/cic-meta/src/dispatch.ts | 58 ---- apps/cic-meta/src/format.ts | 5 - apps/cic-meta/src/index.ts | 7 +- apps/cic-meta/src/{assets => }/phone.ts | 3 +- apps/cic-meta/src/store.ts | 9 - apps/cic-meta/src/sync.ts | 266 ------------------ apps/cic-meta/src/transport.ts | 11 - apps/cic-meta/src/{assets => }/user.ts | 3 +- apps/cic-meta/tests/1_basic.ts | 50 ---- apps/cic-meta/tests/2_sync.ts | 212 -------------- apps/cic-meta/tests/3_transport.ts | 14 - apps/cic-meta/tests/4_auth.ts | 46 --- apps/cic-meta/tests/999_functional.ts | 47 ---- apps/cic-meta/tests/mock.ts | 150 ---------- apps/cic-meta/tests/server.ts | 5 +- .../scripts/cic_meta/import_meta.js | 9 +- .../scripts/cic_meta/import_meta_phone.js | 12 +- .../scripts/package-lock.json | 27 +- apps/contract-migration/scripts/package.json | 3 +- apps/contract-migration/scripts/verify.py | 5 +- 32 files changed, 133 insertions(+), 1416 deletions(-) delete mode 100644 apps/cic-meta/src/auth.ts delete mode 100644 apps/cic-meta/src/config.ts delete mode 100644 apps/cic-meta/src/constants.ts delete mode 100644 apps/cic-meta/src/crypto.ts delete mode 100644 apps/cic-meta/src/db.ts delete mode 100644 apps/cic-meta/src/digest.ts delete mode 100644 apps/cic-meta/src/dispatch.ts delete mode 100644 apps/cic-meta/src/format.ts rename apps/cic-meta/src/{assets => }/phone.ts (82%) delete mode 100644 apps/cic-meta/src/store.ts delete mode 100644 apps/cic-meta/src/sync.ts delete mode 100644 apps/cic-meta/src/transport.ts rename apps/cic-meta/src/{assets => }/user.ts (87%) delete mode 100644 apps/cic-meta/tests/1_basic.ts delete mode 100644 apps/cic-meta/tests/2_sync.ts delete mode 100644 apps/cic-meta/tests/3_transport.ts delete mode 100644 apps/cic-meta/tests/4_auth.ts delete mode 100644 apps/cic-meta/tests/999_functional.ts delete mode 100644 apps/cic-meta/tests/mock.ts diff --git a/apps/cic-meta/.gitignore b/apps/cic-meta/.gitignore index 1a6cc5bb..34ca73fc 100644 --- a/apps/cic-meta/.gitignore +++ b/apps/cic-meta/.gitignore @@ -3,4 +3,3 @@ dist dist-web dist-server scratch -tests diff --git a/apps/cic-meta/package-lock.json b/apps/cic-meta/package-lock.json index c0c67d0d..036c60c0 100644 --- a/apps/cic-meta/package-lock.json +++ b/apps/cic-meta/package-lock.json @@ -1,6 +1,6 @@ { "name": "cic-client-meta", - "version": "0.0.7-alpha.2", + "version": "0.0.7-alpha.7", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -852,6 +852,75 @@ "printj": "~1.1.0" } }, + "crdt-meta": { + "version": "0.0.8", + "resolved": "https://registry.npmjs.org/crdt-meta/-/crdt-meta-0.0.8.tgz", + "integrity": "sha512-CS0sS0L2QWthz7vmu6vzl3p4kcpJ+IKILBJ4tbgN4A3iNG8wnBeuDIv/z3KFFQjcfuP4QAh6E9LywKUTxtDc3g==", + "requires": { + "automerge": "^0.14.2", + "ini": "^1.3.8", + "openpgp": "^4.10.8", + "pg": "^8.5.1", + "sqlite3": "^5.0.2" + }, + "dependencies": { + "automerge": { + "version": "0.14.2", + "resolved": "https://registry.npmjs.org/automerge/-/automerge-0.14.2.tgz", + "integrity": "sha512-shiwuJHCbNRI23WZyIECLV4Ovf3WiAFJ7P9BH4l5gON1In/UUbjcSJKRygtIirObw2UQumeYxp3F2XBdSvQHnA==", + "requires": { + "immutable": "^3.8.2", + "transit-immutable-js": "^0.7.0", + "transit-js": "^0.8.861", + "uuid": "^3.4.0" + } + }, + "node-addon-api": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-3.1.0.tgz", + "integrity": "sha512-flmrDNB06LIl5lywUz7YlNGZH/5p0M7W28k8hzd9Lshtdh1wshD2Y+U4h9LD6KObOy1f+fEVdgprPrEymjM5uw==" + }, + "pg": { + "version": "8.6.0", + "resolved": "https://registry.npmjs.org/pg/-/pg-8.6.0.tgz", + "integrity": "sha512-qNS9u61lqljTDFvmk/N66EeGq3n6Ujzj0FFyNMGQr6XuEv4tgNTXvJQTfJdcvGit5p5/DWPu+wj920hAJFI+QQ==", + "requires": { + "buffer-writer": "2.0.0", + "packet-reader": "1.0.0", + "pg-connection-string": "^2.5.0", + "pg-pool": "^3.3.0", + "pg-protocol": "^1.5.0", + "pg-types": "^2.1.0", + "pgpass": "1.x" + } + }, + "pg-connection-string": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/pg-connection-string/-/pg-connection-string-2.5.0.tgz", + "integrity": "sha512-r5o/V/ORTA6TmUnyWZR9nCj1klXCO2CEKNRlVuJptZe85QuhFayC7WeMic7ndayT5IRIR0S0xFxFi2ousartlQ==" + }, + "pg-pool": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/pg-pool/-/pg-pool-3.3.0.tgz", + "integrity": "sha512-0O5huCql8/D6PIRFAlmccjphLYWC+JIzvUhSzXSpGaf+tjTZc4nn+Lr7mLXBbFJfvwbP0ywDv73EiaBsxn7zdg==" + }, + "pg-protocol": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/pg-protocol/-/pg-protocol-1.5.0.tgz", + "integrity": "sha512-muRttij7H8TqRNu/DxrAJQITO4Ac7RmX3Klyr/9mJEOBeIpgnF8f9jAfRz5d3XwQZl5qBjF9gLsUtMPJE0vezQ==" + }, + "sqlite3": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/sqlite3/-/sqlite3-5.0.2.tgz", + "integrity": "sha512-1SdTNo+BVU211Xj1csWa8lV6KM0CtucDwRyA0VHl91wEH1Mgh7RxUpI4rVvG7OhHrzCSGaVyW5g8vKvlrk9DJA==", + "requires": { + "node-addon-api": "^3.0.0", + "node-gyp": "3.x", + "node-pre-gyp": "^0.11.0" + } + } + } + }, "create-hash": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/create-hash/-/create-hash-1.2.0.tgz", @@ -966,17 +1035,17 @@ "dev": true }, "elliptic": { - "version": "6.5.3", - "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.3.tgz", - "integrity": "sha512-IMqzv5wNQf+E6aHeIqATs0tOLeOTwj1QKbRcS3jBbYkl5oLAserA8yJTT7/VyHUYG91PRmPyeQDObKLPpeS4dw==", + "version": "6.5.4", + "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.4.tgz", + "integrity": "sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ==", "requires": { - "bn.js": "^4.4.0", - "brorand": "^1.0.1", + "bn.js": "^4.11.9", + "brorand": "^1.1.0", "hash.js": "^1.0.0", - "hmac-drbg": "^1.0.0", - "inherits": "^2.0.1", - "minimalistic-assert": "^1.0.0", - "minimalistic-crypto-utils": "^1.0.0" + "hmac-drbg": "^1.0.1", + "inherits": "^2.0.4", + "minimalistic-assert": "^1.0.1", + "minimalistic-crypto-utils": "^1.0.1" } }, "emoji-regex": { @@ -1489,9 +1558,9 @@ "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" }, "ini": { - "version": "1.3.5", - "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.5.tgz", - "integrity": "sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw==" + "version": "1.3.8", + "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz", + "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==" }, "interpret": { "version": "2.2.0", @@ -1957,9 +2026,9 @@ } }, "y18n": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.0.tgz", - "integrity": "sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w==", + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.3.tgz", + "integrity": "sha512-JKhqTOwSrqNA1NY5lSztJ1GrBiUodLMmIZuLiDaMRJ+itFd+ABVE8XBjOvIWL+rSqNDC74LCSFmlb/U4UZ4hJQ==", "dev": true }, "yargs": { diff --git a/apps/cic-meta/package.json b/apps/cic-meta/package.json index ef706733..fd3bd050 100644 --- a/apps/cic-meta/package.json +++ b/apps/cic-meta/package.json @@ -1,6 +1,6 @@ { "name": "cic-client-meta", - "version": "0.0.7-alpha.6", + "version": "0.0.7-alpha.8", "description": "Signed CRDT metadata graphs for the CIC network", "main": "dist/index.js", "types": "dist/index.d.ts", @@ -15,8 +15,9 @@ "dependencies": { "@ethereumjs/tx": "^3.0.0-beta.1", "automerge": "^0.14.1", + "crdt-meta": "0.0.8", "ethereumjs-wallet": "^1.0.1", - "ini": "^1.3.5", + "ini": "^1.3.8", "openpgp": "^4.10.8", "pg": "^8.4.2", "sqlite3": "^5.0.0", @@ -40,6 +41,6 @@ ], "license": "GPL-3.0-or-later", "engines": { - "node": "~14.16.1" + "node": ">=14.16.1" } } diff --git a/apps/cic-meta/scripts/dumpconfig.js b/apps/cic-meta/scripts/dumpconfig.js index 526b6068..eae33056 100644 --- a/apps/cic-meta/scripts/dumpconfig.js +++ b/apps/cic-meta/scripts/dumpconfig.js @@ -1,4 +1,4 @@ -const config = require('./src/config'); +import { Config } from 'crdt-meta'; const fs = require('fs'); if (process.argv[2] === undefined) { @@ -15,6 +15,6 @@ try { process.exit(1); } -const c = new config.Config(process.argv[2], process.env['CONFINI_ENV_PREFIX']); +const c = new Config(process.argv[2], process.env['CONFINI_ENV_PREFIX']); c.process(); process.stdout.write(c.toString()); diff --git a/apps/cic-meta/scripts/server/handlers.ts b/apps/cic-meta/scripts/server/handlers.ts index c5245bf1..c433be2f 100644 --- a/apps/cic-meta/scripts/server/handlers.ts +++ b/apps/cic-meta/scripts/server/handlers.ts @@ -1,8 +1,7 @@ import * as Automerge from 'automerge'; import * as pgp from 'openpgp'; -import * as pg from 'pg'; -import { Envelope, Syncable } from '../../src/sync'; +import { Envelope, Syncable } from 'crdt-meta'; function handleNoMergeGet(db, digest, keystore) { diff --git a/apps/cic-meta/scripts/server/server.ts b/apps/cic-meta/scripts/server/server.ts index 9bef8bda..7c93ba11 100755 --- a/apps/cic-meta/scripts/server/server.ts +++ b/apps/cic-meta/scripts/server/server.ts @@ -1,15 +1,11 @@ import * as http from 'http'; import * as fs from 'fs'; import * as path from 'path'; -import * as pgp from 'openpgp'; import * as handlers from './handlers'; -import { Envelope, Syncable } from '../../src/sync'; -import { PGPKeyStore, PGPSigner } from '../../src/auth'; +import { PGPKeyStore, PGPSigner, Config, SqliteAdapter, PostgresAdapter } from 'crdt-meta'; import { standardArgs } from './args'; -import { Config } from '../../src/config'; -import { SqliteAdapter, PostgresAdapter } from '../../src/db'; let configPath = '/usr/local/etc/cic-meta'; diff --git a/apps/cic-meta/src/auth.ts b/apps/cic-meta/src/auth.ts deleted file mode 100644 index 182532c9..00000000 --- a/apps/cic-meta/src/auth.ts +++ /dev/null @@ -1,191 +0,0 @@ -import * as pgp from 'openpgp'; -import * as crypto from 'crypto'; - -interface Signable { - digest():string; -} - -type KeyGetter = () => any; - -type Signature = { - engine:string - algo:string - data:string - digest:string -} - -interface Signer { - prepare(Signable):boolean; - onsign(Signature):void; - onverify(boolean):void; - sign(digest:string):void - verify(digest:string, signature:Signature):void - fingerprint():string -} - -interface Authoritative { -} - -interface KeyStore { - getPrivateKey: KeyGetter - getFingerprint: () => string - getTrustedKeys: () => Array - getTrustedActiveKeys: () => Array - getEncryptKeys: () => Array -} - -class PGPKeyStore implements KeyStore { - - fingerprint: string - pk: any - - pubk = { - active: [], - trusted: [], - encrypt: [], - } - loads = 0x00; - loadsTarget = 0x0f; - onload: (k:KeyStore) => void; - - constructor(passphrase:string, pkArmor:string, pubkActiveArmor:string, pubkTrustedArmor:string, pubkEncryptArmor:string, onload = (ks:KeyStore) => {}) { - this._readKey(pkArmor, undefined, 1, passphrase); - this._readKey(pubkActiveArmor, 'active', 2); - this._readKey(pubkTrustedArmor, 'trusted', 4); - this._readKey(pubkEncryptArmor, 'encrypt', 8); - this.onload = onload; - } - - private _readKey(a:string, x:any, n:number, pass?:string) { - pgp.key.readArmored(a).then((k) => { - if (pass !== undefined) { - this.pk = k.keys[0]; - this.pk.decrypt(pass).then(() => { - this.fingerprint = this.pk.getFingerprint(); - console.log('private key (sign)', this.fingerprint); - this._registerLoad(n); - }); - } else { - this.pubk[x] = k.keys; - k.keys.forEach((pubk) => { - console.log('public key (' + x + ')', pubk.getFingerprint()); - }); - this._registerLoad(n); - } - }); - } - - private _registerLoad(b:number) { - this.loads |= b; - if (this.loads == this.loadsTarget) { - this.onload(this); - } - } - - public getTrustedKeys(): Array { - return this.pubk['trusted']; - } - - public getTrustedActiveKeys(): Array { - return this.pubk['active']; - - } - - public getEncryptKeys(): Array { - return this.pubk['encrypt']; - - } - - public getPrivateKey(): any { - return this.pk; - } - - public getFingerprint(): string { - return this.fingerprint; - } -} - -class PGPSigner implements Signer { - - engine = 'pgp' - algo = 'sha256' - dgst: string - signature: Signature - keyStore: KeyStore - onsign: (Signature) => void - onverify: (boolean) => void - - constructor(keyStore:KeyStore) { - this.keyStore = keyStore - this.onsign = (string) => {}; - this.onverify = (boolean) => {}; - } - - public fingerprint(): string { - return this.keyStore.getFingerprint(); - } - - public prepare(material:Signable):boolean { - this.dgst = material.digest(); - return true; - } - - public verify(digest:string, signature:Signature) { - pgp.signature.readArmored(signature.data).then((s) => { - const opts = { - message: pgp.cleartext.fromText(digest), - publicKeys: this.keyStore.getTrustedKeys(), - signature: s, - }; - pgp.verify(opts).then((v) => { - let i = 0; - for (i = 0; i < v.signatures.length; i++) { - const s = v.signatures[i]; - if (s.valid) { - this.onverify(s); - return; - } - } - console.error('checked ' + i + ' signature(s) but none valid'); - this.onverify(false); - }); - }).catch((e) => { - console.error(e); - this.onverify(false); - }); - } - - public sign(digest:string) { - const m = pgp.cleartext.fromText(digest); - const pk = this.keyStore.getPrivateKey(); - const opts = { - message: m, - privateKeys: [pk], - detached: true, - } - pgp.sign(opts).then((s) => { - this.signature = { - engine: this.engine, - algo: this.algo, - data: s.signature, - // TODO: fix for browser later - digest: digest, - }; - this.onsign(this.signature); - }).catch((e) => { - console.error(e); - this.onsign(undefined); - }); - } -} - -export { - Signature, - Authoritative, - Signer, - KeyGetter, - Signable, - KeyStore, - PGPSigner, - PGPKeyStore, -}; diff --git a/apps/cic-meta/src/config.ts b/apps/cic-meta/src/config.ts deleted file mode 100644 index e295f1cc..00000000 --- a/apps/cic-meta/src/config.ts +++ /dev/null @@ -1,71 +0,0 @@ -import * as fs from 'fs'; -import * as ini from 'ini'; -import * as path from 'path'; - -class Config { - - filepath: string - store: Object - censor: Array - require: Array - env_prefix: string - - constructor(filepath:string, env_prefix?:string) { - this.filepath = filepath; - this.store = {}; - this.censor = []; - this.require = []; - this.env_prefix = ''; - if (env_prefix !== undefined) { - this.env_prefix = env_prefix + "_"; - } - } - - public process() { - const d = fs.readdirSync(this.filepath); - - const r = /.*\.ini$/; - for (let i = 0; i < d.length; i++) { - const f = d[i]; - if (!f.match(r)) { - return; - } - - const fp = path.join(this.filepath, f); - const v = fs.readFileSync(fp, 'utf-8'); - const inid = ini.decode(v); - const inik = Object.keys(inid); - for (let j = 0; j < inik.length; j++) { - const k_section = inik[j] - const k = k_section.toUpperCase(); - Object.keys(inid[k_section]).forEach((k_directive) => { - const kk = k_directive.toUpperCase(); - const kkk = k + '_' + kk; - - let r = inid[k_section][k_directive]; - const k_env = this.env_prefix + kkk - const env = process.env[k_env]; - if (env !== undefined) { - console.debug('Environment variable ' + k_env + ' overrides ' + kkk); - r = env; - } - this.store[kkk] = r; - }); - } - } - } - - public get(s:string) { - return this.store[s]; - } - - public toString() { - let s = ''; - Object.keys(this.store).forEach((k) => { - s += k + '=' + this.store[k] + '\n'; - }); - return s; - } -} - -export { Config }; diff --git a/apps/cic-meta/src/constants.ts b/apps/cic-meta/src/constants.ts deleted file mode 100644 index 77587e6a..00000000 --- a/apps/cic-meta/src/constants.ts +++ /dev/null @@ -1,38 +0,0 @@ -import { JSONSerializable } from './format'; - -const ENGINE_NAME = 'automerge'; -const ENGINE_VERSION = '0.14.1'; - -const NETWORK_NAME = 'cic'; -const NETWORK_VERSION = '1'; - -const CRYPTO_NAME = 'pgp'; -const CRYPTO_VERSION = '2'; - -type VersionedSpec = { - name: string - version: string - ext?: Object -} - -const engineSpec:VersionedSpec = { - name: ENGINE_NAME, - version: ENGINE_VERSION, -} - -const cryptoSpec:VersionedSpec = { - name: CRYPTO_NAME, - version: CRYPTO_VERSION, -} - -const networkSpec:VersionedSpec = { - name: NETWORK_NAME, - version: NETWORK_VERSION, -} - -export { - engineSpec, - cryptoSpec, - networkSpec, - VersionedSpec, -}; diff --git a/apps/cic-meta/src/crypto.ts b/apps/cic-meta/src/crypto.ts deleted file mode 100644 index 620527c0..00000000 --- a/apps/cic-meta/src/crypto.ts +++ /dev/null @@ -1,27 +0,0 @@ -import * as crypto from 'crypto'; - -const _algs = { - 'SHA-256': 'sha256', -} - -function cryptoWrapper() { -} - -cryptoWrapper.prototype.digest = async function(s, d) { - const h = crypto.createHash(_algs[s]); - h.update(d); - return h.digest(); -} - -let subtle = undefined; -if (typeof window !== 'undefined') { - subtle = window.crypto.subtle; -} else { - subtle = new cryptoWrapper(); -} - - -export { - subtle, -} - diff --git a/apps/cic-meta/src/db.ts b/apps/cic-meta/src/db.ts deleted file mode 100644 index 9d157cda..00000000 --- a/apps/cic-meta/src/db.ts +++ /dev/null @@ -1,90 +0,0 @@ -import * as pg from 'pg'; -import * as sqlite from 'sqlite3'; - -type DbConfig = { - name: string - host: string - port: number - user: string - password: string -} - -interface DbAdapter { - query: (s:string, callback:(e:any, rs:any) => void) => void - close: () => void -} - -const re_creatematch = /^(CREATE)/i -const re_getmatch = /^(SELECT)/i; -const re_setmatch = /^(INSERT|UPDATE)/i; - -class SqliteAdapter implements DbAdapter { - - db: any - - constructor(dbConfig:DbConfig, callback?:(any) => void) { - this.db = new sqlite.Database(dbConfig.name); //, callback); - } - - public query(s:string, callback:(e:any, rs?:any) => void): void { - const local_callback = (e, rs) => { - let r = undefined; - if (rs !== undefined) { - r = { - rowCount: rs.length, - rows: rs, - } - } - callback(e, r); - }; - if (s.match(re_getmatch)) { - this.db.all(s, local_callback); - } else if (s.match(re_setmatch)) { - this.db.run(s, local_callback); - } else if (s.match(re_creatematch)) { - this.db.run(s, callback); - } else { - throw 'unhandled query'; - } - } - - public close() { - this.db.close(); - } -} - -class PostgresAdapter implements DbAdapter { - - db: any - - constructor(dbConfig:DbConfig) { - let o = dbConfig; - o['database'] = o.name; - this.db = new pg.Pool(o); - return this.db; - } - - public query(s:string, callback:(e:any, rs:any) => void): void { - this.db.query(s, (e, rs) => { - let r = { - length: rs.rowCount, - } - rs.length = rs.rowCount; - if (e === undefined) { - e = null; - } - console.debug(e, rs); - callback(e, rs); - }); - } - - public close() { - this.db.end(); - } -} - -export { - DbConfig, - SqliteAdapter, - PostgresAdapter, -} diff --git a/apps/cic-meta/src/digest.ts b/apps/cic-meta/src/digest.ts deleted file mode 100644 index d66f7463..00000000 --- a/apps/cic-meta/src/digest.ts +++ /dev/null @@ -1,68 +0,0 @@ -import * as crypto from './crypto'; - -interface Addressable { - key(): string - digest(): string -} - -function stringToBytes(s:string) { - const a = new Uint8Array(20); - let j = 2; - for (let i = 0; i < a.byteLength; i++) { - const n = parseInt(s.substring(j, j+2), 16); - a[i] = n; - j += 2; - } - return a; -} - -function bytesToHex(a:Uint8Array) { - let s = ''; - for (let i = 0; i < a.byteLength; i++) { - const h = '00' + a[i].toString(16); - s += h.slice(-2); - } - return s; -} - -async function mergeKey(a:Uint8Array, s:Uint8Array) { - const y = new Uint8Array(a.byteLength + s.byteLength); - for (let i = 0; i < a.byteLength; i++) { - y[i] = a[i]; - } - for (let i = 0; i < s.byteLength; i++) { - y[a.byteLength + i] = s[i]; - } - const z = await crypto.subtle.digest('SHA-256', y); - return bytesToHex(new Uint8Array(z)); -} - -async function toKey(v:string, salt:string) { - const a = stringToBytes(v); - const s = new TextEncoder().encode(salt); - return await mergeKey(a, s); -} - - -async function toAddressKey(zeroExHex:string, salt:string) { - const a = addressToBytes(zeroExHex); - const s = new TextEncoder().encode(salt); - return await mergeKey(a, s); -} - -const re_addrHex = /^0[xX][a-fA-F0-9]{40}$/; -function addressToBytes(s:string) { - if (!s.match(re_addrHex)) { - throw 'invalid address hex'; - } - return stringToBytes(s); -} - -export { - toKey, - toAddressKey, - mergeKey, - bytesToHex, - addressToBytes, - Addressable, -} diff --git a/apps/cic-meta/src/dispatch.ts b/apps/cic-meta/src/dispatch.ts deleted file mode 100644 index b84ccb99..00000000 --- a/apps/cic-meta/src/dispatch.ts +++ /dev/null @@ -1,58 +0,0 @@ -import { v4 as uuidv4 } from 'uuid'; -import { Syncable } from './sync'; -import { Store } from './store'; -import { PubSub } from './transport'; - -function toIndexKey(id:string):string { - const d = Date.now(); - return d + '_' + id + '_' + uuidv4(); -} - -const _re_indexKey = /^\d+_(.+)_[-\d\w]+$/; -function fromIndexKey(s:string):string { - const m = s.match(_re_indexKey); - if (m === null) { - throw 'Invalid index key'; - } - return m[1]; -} - -class Dispatcher { - - idx: Array - syncer: PubSub - store: Store - - constructor(store:Store, syncer:PubSub) { - this.idx = new Array() - this.syncer = syncer; - this.store = store; - } - - public isDirty(): boolean { - return this.idx.length > 0; - } - - public add(id:string, item:Syncable): string { - const v = item.toJSON(); - const k = toIndexKey(id); - this.store.put(k, v, true); - localStorage.setItem(k, v); - this.idx.push(k); - return k; - } - - public sync(offset:number): number { - let i = 0; - this.idx.forEach((k) => { - const v = localStorage.getItem(k); - const k_id = fromIndexKey(k); - this.syncer.pub(v); // this must block until guaranteed delivery - localStorage.removeItem(k); - i++; - }); - return i; - } -} - -export { Dispatcher, toIndexKey, fromIndexKey } diff --git a/apps/cic-meta/src/format.ts b/apps/cic-meta/src/format.ts deleted file mode 100644 index 3c223378..00000000 --- a/apps/cic-meta/src/format.ts +++ /dev/null @@ -1,5 +0,0 @@ -interface JSONSerializable { - toJSON(): string -} - -export { JSONSerializable }; diff --git a/apps/cic-meta/src/index.ts b/apps/cic-meta/src/index.ts index ced4a31c..47006e15 100644 --- a/apps/cic-meta/src/index.ts +++ b/apps/cic-meta/src/index.ts @@ -1,5 +1,2 @@ -export { PGPSigner, PGPKeyStore, Signer, KeyStore } from './auth'; -export { ArgPair,  Envelope, Syncable } from './sync'; -export { User } from './assets/user'; -export { Phone } from './assets/phone'; -export { Config } from './config'; +export { User } from './user'; +export { Phone } from './phone'; diff --git a/apps/cic-meta/src/assets/phone.ts b/apps/cic-meta/src/phone.ts similarity index 82% rename from apps/cic-meta/src/assets/phone.ts rename to apps/cic-meta/src/phone.ts index 7ace058f..5bf893b6 100644 --- a/apps/cic-meta/src/assets/phone.ts +++ b/apps/cic-meta/src/phone.ts @@ -1,5 +1,4 @@ -import { ArgPair, Syncable } from '../sync'; -import { Addressable, mergeKey } from '../digest'; +import { Syncable, Addressable, mergeKey } from 'crdt-meta'; class Phone extends Syncable implements Addressable { diff --git a/apps/cic-meta/src/store.ts b/apps/cic-meta/src/store.ts deleted file mode 100644 index 26d6972c..00000000 --- a/apps/cic-meta/src/store.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { Syncable } from './sync'; - -interface Store { - put(string, Syncable, boolean?) - get(string):Syncable - delete(string) -} - -export { Store }; diff --git a/apps/cic-meta/src/sync.ts b/apps/cic-meta/src/sync.ts deleted file mode 100644 index 21dcf87f..00000000 --- a/apps/cic-meta/src/sync.ts +++ /dev/null @@ -1,266 +0,0 @@ -import * as Automerge from 'automerge'; - -import { JSONSerializable } from './format'; - -import { Authoritative, Signer, PGPSigner, Signable, Signature } from './auth'; - -import { engineSpec, cryptoSpec, networkSpec, VersionedSpec } from './constants'; - -const fullSpec:VersionedSpec = { - name: 'cic', - version: '1', - ext: { - network: cryptoSpec, - engine: engineSpec, - }, -} - -class Envelope { - - o = fullSpec - - constructor(payload:Object) { - this.set(payload); - } - - public set(payload:Object) { - this.o['payload'] = payload - } - - public get():string { - return this.o['payload']; - } - - public toJSON() { - return JSON.stringify(this.o); - } - - public static fromJSON(s:string): Envelope { - const e = new Envelope(undefined); - e.o = JSON.parse(s); - return e; - } - - public unwrap(): Syncable { - return Syncable.fromJSON(this.o['payload']); - } -} - -class ArgPair { - - k:string - v:any - - constructor(k:string, v:any) { - this.k = k; - this.v = v; - } -} - -class SignablePart implements Signable { - - s: string - - constructor(s:string) { - this.s = s; - } - - public digest():string { - return this.s; - } -} - -function orderDict(src) { - let dst; - if (Array.isArray(src)) { - dst = []; - src.forEach((v) => { - if (typeof(v) == 'object') { - v = orderDict(v); - } - dst.push(v); - }); - } else { - dst = {} - Object.keys(src).sort().forEach((k) => { - let v = src[k]; - if (typeof(v) == 'object') { - v = orderDict(v); - } - dst[k] = v; - }); - } - return dst; -} - -class Syncable implements JSONSerializable, Authoritative, Signable { - - id: string - timestamp: number - m: any // automerge object - e: Envelope - signer: Signer - onwrap: (string) => void - onauthenticate: (boolean) => void - - // TODO: Move data to sub-object so timestamp, id, signature don't collide - constructor(id:string, v:Object) { - this.id = id; - const o = { - 'id': id, - 'timestamp': Math.floor(Date.now() / 1000), - 'data': v, - } - //this.m = Automerge.from(v) - this.m = Automerge.from(o) - } - - public setSigner(signer:Signer) { - this.signer = signer; - this.signer.onsign = (s) => { - this.wrap(s); - }; - } - - // TODO: To keep integrity, the non-link key/value pairs for each step also need to be hashed - public digest(): string { - const links = []; - Automerge.getAllChanges(this.m).forEach((ch:Object) => { - const op:Array = ch['ops']; - ch['ops'].forEach((op:Array) => { - if (op['action'] == 'link') { - //console.log('op link', op); - links.push([op['obj'], op['value']]); - } - }); - }); - //return JSON.stringify(links); - const j = JSON.stringify(links); - return Buffer.from(j).toString('base64'); - } - - private wrap(s:any) { - this.m = Automerge.change(this.m, 'sign', (doc) => { - doc['signature'] = s; - }); - this.e = new Envelope(this.toJSON()); - console.log('wrappin s', s, typeof(s)); - this.e.o['digest'] = s.digest; - if (this.onwrap !== undefined) { - this.onwrap(this.e); - } - - } - -// private _verifyLoop(i:number, history:Array, signable:Signable, result:boolean) { -// if (!result) { -// this.onauthenticate(false); -// return; -// } else if (history.length == 0) { -// this.onauthenticate(true); -// return; -// } -// const h = history.shift() -// if (i % 2 == 0) { -// i++; -// signable = { -// digest: () => { -// return Automerge.save(h.snapshot) -// }, -// }; -// this._verifyLoop(i, history, signable, true); -// } else { -// i++; -// const signature = h.snapshot['signature']; -// console.debug('signature', signature, signable.digest()); -// this.signer.onverify = (v) => { -// this._verifyLoop(i, history, signable, v) -// } -// this.signer.verify(signable, signature); -// } -// } -// -// // TODO: This should replay the graph and check signatures on each step -// public _authenticate(full:boolean=false) { -// let h = Automerge.getHistory(this.m); -// h.forEach((m) => { -// //console.debug(m.snapshot); -// }); -// const signable = { -// digest: () => { return '' }, -// } -// if (!full) { -// h = h.slice(h.length-2); -// } -// this._verifyLoop(0, h, signable, true); -// } - - public authenticate(full:boolean=false) { - if (full) { - console.warn('only doing shallow authentication for now, sorry'); - } - //console.log('authenticating', signable.digest()); - //console.log('signature', this.m.signature); - this.signer.onverify = (v) => { - //this._verifyLoop(i, history, signable, v) - this.onauthenticate(v); - } - this.signer.verify(this.m.signature.digest, this.m.signature); - } - - - public sign() { - //this.signer.prepare(this); - this.signer.sign(this.digest()); - } - - public update(changes:Array, changesDescription:string) { - this.m = Automerge.change(this.m, changesDescription, (m) => { - changes.forEach((c) => { - let path = c.k.split('.'); - let target = m['data']; - while (path.length > 1) { - const part = path.shift(); - target = target[part]; - } - target[path[0]] = c.v; - }); - m['timestamp'] = Math.floor(Date.now() / 1000); - }); - } - - public replace(o:Object, changesDescription:string) { - this.m = Automerge.change(this.m, changesDescription, (m) => { - Object.keys(o).forEach((k) => { - m['data'][k] = o[k]; - }); - Object.keys(m).forEach((k) => { - if (o[k] == undefined) { - delete m['data'][k]; - } - }); - m['timestamp'] = Math.floor(Date.now() / 1000); - }); - } - - public merge(s:Syncable) { - this.m = Automerge.merge(s.m, this.m); - } - - public toJSON(): string { - const s = Automerge.save(this.m); - const o = JSON.parse(s); - const oo = orderDict(o) - return JSON.stringify(oo); - - } - - public static fromJSON(s:string): Syncable { - const doc = Automerge.load(s); - let y = new Syncable(doc['id'], {}); - y.m = doc - return y - } -} - -export { JSONSerializable, Syncable, ArgPair, Envelope }; diff --git a/apps/cic-meta/src/transport.ts b/apps/cic-meta/src/transport.ts deleted file mode 100644 index fa3cda6f..00000000 --- a/apps/cic-meta/src/transport.ts +++ /dev/null @@ -1,11 +0,0 @@ -interface SubConsumer { - post(string) -} - -interface PubSub { - pub(v:string):boolean - close() -} - -export { PubSub, SubConsumer }; - diff --git a/apps/cic-meta/src/assets/user.ts b/apps/cic-meta/src/user.ts similarity index 87% rename from apps/cic-meta/src/assets/user.ts rename to apps/cic-meta/src/user.ts index 7ac99908..3faa5acf 100644 --- a/apps/cic-meta/src/assets/user.ts +++ b/apps/cic-meta/src/user.ts @@ -1,5 +1,4 @@ -import { ArgPair, Syncable } from '../sync'; -import { Addressable, addressToBytes, bytesToHex, toAddressKey } from '../digest'; +import { Syncable, Addressable, toAddressKey } from 'crdt-meta'; const keySalt = new TextEncoder().encode(':cic.person'); class User extends Syncable implements Addressable { diff --git a/apps/cic-meta/tests/1_basic.ts b/apps/cic-meta/tests/1_basic.ts deleted file mode 100644 index 3167a83f..00000000 --- a/apps/cic-meta/tests/1_basic.ts +++ /dev/null @@ -1,50 +0,0 @@ -import * as Automerge from 'automerge'; -import assert = require('assert'); - -import { Dispatcher, toIndexKey, fromIndexKey } from '../src/dispatch'; -import { User } from '../src/assets/user'; -import { Syncable, ArgPair } from '../src/sync'; - -import { MockSigner, MockStore } from './mock'; - -describe('basic', () => { - - it('store', () => { - const store = new MockStore('s'); - assert.equal(store.name, 's'); - - const mockSigner = new MockSigner(); - const v = new Syncable('foo', {baz: 42}); - v.setSigner(mockSigner); - store.put('foo', v); - const one = store.get('foo').toJSON(); - const vv = new Syncable('bar', {baz: 666}); - vv.setSigner(mockSigner); - assert.throws(() => { - store.put('foo', vv) - }); - store.put('foo', vv, true); - const other = store.get('foo').toJSON(); - assert.notEqual(one, other); - store.delete('foo'); - assert.equal(store.get('foo'), undefined); - }); - - it('add_doc_to_dispatcher', () => { - const store = new MockStore('s'); - //const syncer = new MockSyncer(); - const dispatcher = new Dispatcher(store, undefined); - const user = new User('foo'); - dispatcher.add(user.id, user); - assert(dispatcher.isDirty()); - }); - - it('dispatch_keyindex', () => { - const s = 'foo'; - const k = toIndexKey(s); - const v = fromIndexKey(k); - assert.equal(s, v); - }); - - -}); diff --git a/apps/cic-meta/tests/2_sync.ts b/apps/cic-meta/tests/2_sync.ts deleted file mode 100644 index aba024ea..00000000 --- a/apps/cic-meta/tests/2_sync.ts +++ /dev/null @@ -1,212 +0,0 @@ -import * as Automerge from 'automerge'; -import assert = require('assert'); - -import * as pgp from 'openpgp'; -import * as fs from 'fs'; - -import { PGPSigner } from '../src/auth'; - -import { Syncable, ArgPair } from '../src/sync'; - -import { MockKeyStore, MockSigner } from './mock'; - - -describe('sync', async () => { - it('sync_merge', () => { - const mockSigner = new MockSigner(); - const s = new Syncable('foo', { - bar: 'baz', - }); - s.setSigner(mockSigner); - const changePair = new ArgPair('xyzzy', 42); - s.update([changePair], 'ch-ch-cha-changes'); - assert.equal(s.m.data['xyzzy'], 42) - assert.equal(s.m.data['bar'], 'baz') - assert.equal(s.m['id'], 'foo') - assert.equal(Automerge.getHistory(s.m).length, 2); - }); - - it('sync_serialize', () => { - const mockSigner = new MockSigner(); - const s = new Syncable('foo', { - bar: 'baz', - }); - s.setSigner(mockSigner); - const j = s.toJSON(); - const ss = Syncable.fromJSON(j); - assert.equal(ss.m['id'], 'foo'); - assert.equal(ss.m['data']['bar'], 'baz'); - assert.equal(Automerge.getHistory(ss.m).length, 1); - }); - - it('sync_sign_and_wrap', () => { - const mockSigner = new MockSigner(); - const s = new Syncable('foo', { - bar: 'baz', - }); - s.setSigner(mockSigner); - s.onwrap = (e) => { - const j = e.toJSON(); - const v = JSON.parse(j); - assert.deepEqual(v.payload, e.o.payload); - - } - s.sign(); - }); - it('sync_verify_success', async () => { - const pksa = fs.readFileSync(__dirname + '/privatekeys.asc'); - const pks = await pgp.key.readArmored(pksa); - await pks.keys[0].decrypt('merman'); - await pks.keys[1].decrypt('beastman'); - - const pubksa = fs.readFileSync(__dirname + '/publickeys.asc'); - const pubks = await pgp.key.readArmored(pubksa); - - const oneStore = new MockKeyStore(pks.keys[0], pubks.keys); - const twoStore = new MockKeyStore(pks.keys[1], pubks.keys); - const threeStore = new MockKeyStore(pks.keys[2], [pubks.keys[0], pubks.keys[2]]); - - const oneSigner = new PGPSigner(oneStore); - const twoSigner = new PGPSigner(twoStore); - const threeSigner = new PGPSigner(threeStore); - - const x = new Syncable('foo', { - bar: 'baz', - }); - x.setSigner(oneSigner); - - // TODO: make this look better - x.onwrap = (e) => { - let updateData = new ArgPair('bar', 'xyzzy'); - x.update([updateData], 'change one'); - - x.onwrap = (e) => { - x.setSigner(twoSigner); - updateData = new ArgPair('bar', 42); - x.update([updateData], 'change two'); - - x.onwrap = (e) => { - const p = e.unwrap(); - p.setSigner(twoSigner); - p.onauthenticate = (v) => { - assert(v); - } - p.authenticate(); - } - - x.sign(); - }; - - x.sign(); - } - - x.sign(); - - }); - - it('sync_verify_fail', async () => { - const pksa = fs.readFileSync(__dirname + '/privatekeys.asc'); - const pks = await pgp.key.readArmored(pksa); - await pks.keys[0].decrypt('merman'); - await pks.keys[1].decrypt('beastman'); - - const pubksa = fs.readFileSync(__dirname + '/publickeys.asc'); - const pubks = await pgp.key.readArmored(pubksa); - - const oneStore = new MockKeyStore(pks.keys[0], pubks.keys); - const twoStore = new MockKeyStore(pks.keys[1], pubks.keys); - const threeStore = new MockKeyStore(pks.keys[2], [pubks.keys[0], pubks.keys[2]]); - - const oneSigner = new PGPSigner(oneStore); - const twoSigner = new PGPSigner(twoStore); - const threeSigner = new PGPSigner(threeStore); - - const x = new Syncable('foo', { - bar: 'baz', - }); - x.setSigner(oneSigner); - - // TODO: make this look better - x.onwrap = (e) => { - let updateData = new ArgPair('bar', 'xyzzy'); - x.update([updateData], 'change one'); - - x.onwrap = (e) => { - x.setSigner(twoSigner); - updateData = new ArgPair('bar', 42); - x.update([updateData], 'change two'); - - x.onwrap = (e) => { - const p = e.unwrap(); - p.setSigner(threeSigner); - p.onauthenticate = (v) => { - assert(!v); - } - p.authenticate(); - } - - x.sign(); - }; - - x.sign(); - } - - x.sign(); - - }); - - xit('sync_verify_shallow_tricked', async () => { - const pksa = fs.readFileSync(__dirname + '/privatekeys.asc'); - const pks = await pgp.key.readArmored(pksa); - await pks.keys[0].decrypt('merman'); - await pks.keys[1].decrypt('beastman'); - - const pubksa = fs.readFileSync(__dirname + '/publickeys.asc'); - const pubks = await pgp.key.readArmored(pubksa); - - const oneStore = new MockKeyStore(pks.keys[0], pubks.keys); - const twoStore = new MockKeyStore(pks.keys[1], pubks.keys); - const threeStore = new MockKeyStore(pks.keys[2], [pubks.keys[0], pubks.keys[2]]); - - const oneSigner = new PGPSigner(oneStore); - const twoSigner = new PGPSigner(twoStore); - const threeSigner = new PGPSigner(threeStore); - - const x = new Syncable('foo', { - bar: 'baz', - }); - x.setSigner(twoSigner); - - // TODO: make this look better - x.onwrap = (e) => { - let updateData = new ArgPair('bar', 'xyzzy'); - x.update([updateData], 'change one'); - - x.onwrap = (e) => { - updateData = new ArgPair('bar', 42); - x.update([updateData], 'change two'); - x.setSigner(oneSigner); - - x.onwrap = (e) => { - const p = e.unwrap(); - p.setSigner(threeSigner); - p.onauthenticate = (v) => { - assert(v); - p.onauthenticate = (v) => { - assert(!v); - } - p.authenticate(true); - } - p.authenticate(); - } - - x.sign(); - }; - - x.sign(); - } - - x.sign(); - - }); -}); diff --git a/apps/cic-meta/tests/3_transport.ts b/apps/cic-meta/tests/3_transport.ts deleted file mode 100644 index 6bae044c..00000000 --- a/apps/cic-meta/tests/3_transport.ts +++ /dev/null @@ -1,14 +0,0 @@ -import * as assert from 'assert'; - -import { MockPubSub, MockConsumer } from './mock'; - -describe('transport', () => { - it('pub_sub', () => { - const c = new MockConsumer(); - const ps = new MockPubSub('foo', c); - ps.pub('foo'); - ps.pub('bar'); - ps.flush(); - assert.deepEqual(c.omnoms, ['foo', 'bar']); - }); -}); diff --git a/apps/cic-meta/tests/4_auth.ts b/apps/cic-meta/tests/4_auth.ts deleted file mode 100644 index 33bba840..00000000 --- a/apps/cic-meta/tests/4_auth.ts +++ /dev/null @@ -1,46 +0,0 @@ -import assert = require('assert'); -import pgp = require('openpgp'); -import crypto = require('crypto'); - -import { Syncable, ArgPair } from '../src/sync'; - -import { MockKeyStore, MockSignable } from './mock'; - -import { PGPSigner } from '../src/auth'; - - -describe('auth', async () => { - await it('digest', async () => { - const opts = { - userIds: [ - { - name: 'John Marston', - email: 'red@dead.com', - }, - ], - numBits: 2048, - passphrase: 'foo', - }; - const pkgen = await pgp.generateKey(opts); - const pka = pkgen.privateKeyArmored; - const pks = await pgp.key.readArmored(pka); - await pks.keys[0].decrypt('foo'); - const pubka = pkgen.publicKeyArmored; - const pubks = await pgp.key.readArmored(pubka); - const keyStore = new MockKeyStore(pks.keys[0], pubks.keys); - const s = new PGPSigner(keyStore); - - const message = await pgp.cleartext.fromText('foo'); - s.onverify = (ok) => { - assert(ok); - } - s.onsign = (signature) => { - s.onverify((v) => { - console.log('bar', v); - }); - s.verify('foo', signature); - } - - await s.sign('foo'); - }); -}); diff --git a/apps/cic-meta/tests/999_functional.ts b/apps/cic-meta/tests/999_functional.ts deleted file mode 100644 index 9ed90777..00000000 --- a/apps/cic-meta/tests/999_functional.ts +++ /dev/null @@ -1,47 +0,0 @@ -import * as assert from 'assert'; -import * as pgp from 'openpgp'; - -import { Dispatcher } from '../src/dispatch'; -import { User } from '../src/assets/user'; -import { PGPSigner, KeyStore } from '../src/auth'; -import { SubConsumer } from '../src/transport'; - -import { MockStore, MockPubSub, MockConsumer, MockKeyStore } from './mock'; - -async function createKeyStore() { - const opts = { - userIds: [ - { - name: 'John Marston', - email: 'red@dead.com', - }, - ], - numBits: 2048, - passphrase: 'foo', - }; - const pkgen = await pgp.generateKey(opts); - const pka = pkgen.privateKeyArmored; - const pks = await pgp.key.readArmored(pka); - await pks.keys[0].decrypt('foo'); - return new MockKeyStore(pks.keys[0], []); -} - -describe('fullchain', async () => { - it('dispatch_and_publish_user', async () => { - const g = await createKeyStore(); - const n = new PGPSigner(g); - const u = new User('u1', {}); - u.setSigner(n); - u.setName('Nico', 'Bellic'); - const s = new MockStore('fooStore'); - const c = new MockConsumer(); - const p = new MockPubSub('fooPubSub', c); - const d = new Dispatcher(s, p); - u.onwrap = (e) => { - d.add(u.id, e); - d.sync(0); - assert.equal(p.pubs.length, 1); - }; - u.sign(); - }); -}); diff --git a/apps/cic-meta/tests/mock.ts b/apps/cic-meta/tests/mock.ts deleted file mode 100644 index c9ef81ad..00000000 --- a/apps/cic-meta/tests/mock.ts +++ /dev/null @@ -1,150 +0,0 @@ -import * as crypto from 'crypto'; - -import { Signable, Signature, KeyStore } from '../src/auth'; -import { Store } from '../src/store'; -import { PubSub, SubConsumer } from '../src/transport'; -import { Syncable } from '../src/sync'; - -class MockStore implements Store { - - contents: Object - name: string - - constructor(name:string) { - this.name = name; - this.contents = {}; - } - - public put(k:string, v:Syncable, existsOk = false) { - if (!existsOk && this.contents[k] !== undefined) { - throw '"' + k + '" already exists in store ' + this.name; - }  - this.contents[k] = v; - } - - public get(k:string): Syncable { - return this.contents[k]; - } - - public delete(k:string) { - delete this.contents[k]; - } -} - -class MockSigner { - onsign: (string) => void - onverify: (boolean) => void - public verify(src:string, signature:Signature) { - return true; - } - - public sign(s:string):boolean { - this.onsign('there would be a signature here'); - return true; - } - - public prepare(m:Signable):boolean { - return true; - } - - public fingerprint():string { - return ''; - } -} - -class MockConsumer implements SubConsumer { - - omnoms: Array - - constructor() { - this.omnoms = Array(); - } - - public post(v:string) { - this.omnoms.push(v); - } -} - -class MockPubSub implements PubSub { - - pubs: Array - consumer: SubConsumer - - constructor(name:string, consumer:SubConsumer) { - this.pubs = Array(); - this.consumer = consumer; - } - - public pub(v:string): boolean { - this.pubs.push(v); - return true; - } - - public flush() { - while (this.pubs.length > 0) { - const s = this.pubs.shift(); - this.consumer.post(s); - } - } - - public close() { - } -} - -class MockSignable implements Signable { - - src: string - dst: string - - constructor(src:string) { - this.src = src; - } - - public digest():string { - const h = crypto.createHash('sha256'); - h.update(this.src); - this.dst= h.digest('hex'); - return this.dst; - } - -} - -class MockKeyStore implements KeyStore { - - pk: any - pubks: Array - - constructor(pk:any, pubks:Array) { - this.pk = pk; - this.pubks = pubks; - } - - public getPrivateKey(): any { - return this.pk; - } - - public getTrustedKeys(): Array { - return this.pubks; - } - - public getTrustedActiveKeys(): Array { - return []; - } - - public getEncryptKeys(): Array { - return []; - } - - public getFingerprint(): string { - return ''; - } -} - -export { - MockStore, - MockPubSub, - MockConsumer, - MockSignable, - MockKeyStore, - MockSigner, -}; diff --git a/apps/cic-meta/tests/server.ts b/apps/cic-meta/tests/server.ts index 3071c096..d1399025 100644 --- a/apps/cic-meta/tests/server.ts +++ b/apps/cic-meta/tests/server.ts @@ -1,13 +1,10 @@ -import Automerge = require('automerge'); import assert = require('assert'); import fs = require('fs'); import pgp = require('openpgp'); import sqlite = require('sqlite3'); import * as handlers from '../scripts/server/handlers'; -import { Envelope, Syncable, ArgPair } from '../src/sync'; -import { PGPKeyStore, PGPSigner, KeyStore, Signer } from '../src/auth'; -import { SqliteAdapter } from '../src/db'; +import { Envelope, Syncable, ArgPair, PGPKeyStore, PGPSigner, KeyStore, Signer, SqliteAdapter } from 'crdt-meta'; function createKeystore() { const pksa = fs.readFileSync(__dirname + '/privatekeys.asc', 'utf-8'); diff --git a/apps/contract-migration/scripts/cic_meta/import_meta.js b/apps/contract-migration/scripts/cic_meta/import_meta.js index 28cf5f7d..fef853f1 100644 --- a/apps/contract-migration/scripts/cic_meta/import_meta.js +++ b/apps/contract-migration/scripts/cic_meta/import_meta.js @@ -3,10 +3,11 @@ const path = require('path'); const http = require('http'); const cic = require('cic-client-meta'); +const crdt = require('crdt-meta'); //const conf = JSON.parse(fs.readFileSync('./cic.conf')); -const config = new cic.Config('./config'); +const config = new crdt.Config('./config'); config.process(); console.log(config); @@ -41,7 +42,7 @@ function sendit(uid, envelope) { } function doOne(keystore, filePath) { - const signer = new cic.PGPSigner(keystore); + const signer = new crdt.PGPSigner(keystore); const parts = path.basename(filePath).split('.'); const ethereum_address = path.basename(parts[0]); @@ -51,7 +52,7 @@ function doOne(keystore, filePath) { //console.log(o); fs.unlinkSync(filePath); - const s = new cic.Syncable(uid, o); + const s = new crdt.Syncable(uid, o); s.setSigner(signer); s.onwrap = (env) => { sendit(uid, env); @@ -65,7 +66,7 @@ const publicKeyPath = path.join(config.get('PGP_EXPORTS_DIR'), config.get('PGP_P pk = fs.readFileSync(privateKeyPath); pubk = fs.readFileSync(publicKeyPath); -new cic.PGPKeyStore( +new crdt.PGPKeyStore( config.get('PGP_PASSPHRASE'), pk, pubk, diff --git a/apps/contract-migration/scripts/cic_meta/import_meta_phone.js b/apps/contract-migration/scripts/cic_meta/import_meta_phone.js index 9c82afe5..45bb546b 100644 --- a/apps/contract-migration/scripts/cic_meta/import_meta_phone.js +++ b/apps/contract-migration/scripts/cic_meta/import_meta_phone.js @@ -4,10 +4,11 @@ const http = require('http'); const cic = require('cic-client-meta'); const vcfp = require('vcard-parser'); +const crdt = require('crdt-meta'); //const conf = JSON.parse(fs.readFileSync('./cic.conf')); -const config = new cic.Config('./config'); +const config = new crdt.Config('./config'); config.process(); console.log(config); @@ -42,7 +43,7 @@ function sendit(uid, envelope) { } function doOne(keystore, filePath, address) { - const signer = new cic.PGPSigner(keystore); + const signer = new crdt.PGPSigner(keystore); const j = JSON.parse(fs.readFileSync(filePath).toString()); const b = Buffer.from(j['vcard'], 'base64'); @@ -51,9 +52,8 @@ function doOne(keystore, filePath, address) { const phone = o.tel[0].value; cic.Phone.toKey(phone).then((uid) => { - const o = fs.readFileSync(filePath, 'utf-8'); - const s = new cic.Syncable(uid, o); + const s = new crdt.Syncable(uid, address); s.setSigner(signer); s.onwrap = (env) => { sendit(uid, env); @@ -67,7 +67,7 @@ const publicKeyPath = path.join(config.get('PGP_EXPORTS_DIR'), config.get('PGP_P pk = fs.readFileSync(privateKeyPath); pubk = fs.readFileSync(publicKeyPath); -new cic.PGPKeyStore( +new crdt.PGPKeyStore( config.get('PGP_PASSPHRASE'), pk, pubk, @@ -123,7 +123,7 @@ function importMetaPhone(keystore) { if (batchCount == batchSize) { console.debug('reached batch size, breathing'); batchCount=0; - setTimeout(importMeta, batchDelay, keystore); + setTimeout(importMetaPhone, batchDelay, keystore); return; } } diff --git a/apps/contract-migration/scripts/package-lock.json b/apps/contract-migration/scripts/package-lock.json index a9957bbc..120250ba 100644 --- a/apps/contract-migration/scripts/package-lock.json +++ b/apps/contract-migration/scripts/package-lock.json @@ -2112,9 +2112,9 @@ } }, "@types/node": { - "version": "14.14.41", - "resolved": "https://registry.npmjs.org/@types/node/-/node-14.14.41.tgz", - "integrity": "sha512-dueRKfaJL4RTtSa7bWeTK1M+VH+Gns73oCgzvYfHZywRCoPSd8EkXBL0mZ9unPTveBn+D9phZBaxuzpwjWkW0g==" + "version": "14.14.39", + "resolved": "https://registry.npmjs.org/@types/node/-/node-14.14.39.tgz", + "integrity": "sha512-Qipn7rfTxGEDqZiezH+wxqWYR8vcXq5LRpZrETD19Gs4o8LbklbmqotSUsMU+s5G3PJwMRDfNEYoxrcBwIxOuw==" }, "@types/pbkdf2": { "version": "3.1.0", @@ -2380,14 +2380,15 @@ "integrity": "sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg==" }, "cic-client-meta": { - "version": "0.0.7-alpha.6", - "resolved": "https://registry.npmjs.org/cic-client-meta/-/cic-client-meta-0.0.7-alpha.6.tgz", - "integrity": "sha512-oIN1aHkPHfsxJKDV6k4f1kX2tcppw3Q+D1b4BoPh0hYjNKNb7gImBMWnGsy8uiD9W6SNYE4sIXyrtct8mvrhsw==", + "version": "0.0.7-alpha.8", + "resolved": "https://registry.npmjs.org/cic-client-meta/-/cic-client-meta-0.0.7-alpha.8.tgz", + "integrity": "sha512-NtU4b4dptG2gsKXIvAv1xCxxxhrr801tb8+Co1O+VLx+wvxFyPRxqa2f2eN5nrSnFnljNsWWpE6K5bJZb1+Rqw==", "requires": { "@ethereumjs/tx": "^3.0.0-beta.1", "automerge": "^0.14.1", + "crdt-meta": "0.0.8", "ethereumjs-wallet": "^1.0.1", - "ini": "^1.3.5", + "ini": "^1.3.8", "openpgp": "^4.10.8", "pg": "^8.4.2", "sqlite3": "^5.0.0", @@ -2494,6 +2495,18 @@ "printj": "~1.1.0" } }, + "crdt-meta": { + "version": "0.0.8", + "resolved": "https://registry.npmjs.org/crdt-meta/-/crdt-meta-0.0.8.tgz", + "integrity": "sha512-CS0sS0L2QWthz7vmu6vzl3p4kcpJ+IKILBJ4tbgN4A3iNG8wnBeuDIv/z3KFFQjcfuP4QAh6E9LywKUTxtDc3g==", + "requires": { + "automerge": "^0.14.2", + "ini": "^1.3.8", + "openpgp": "^4.10.8", + "pg": "^8.5.1", + "sqlite3": "^5.0.2" + } + }, "create-hash": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/create-hash/-/create-hash-1.2.0.tgz", diff --git a/apps/contract-migration/scripts/package.json b/apps/contract-migration/scripts/package.json index 0f61facd..50d054dd 100644 --- a/apps/contract-migration/scripts/package.json +++ b/apps/contract-migration/scripts/package.json @@ -1,6 +1,7 @@ { "dependencies": { - "cic-client-meta": "0.0.7-alpha.6", + "cic-client-meta": "^0.0.7-alpha.8", + "crdt-meta": "0.0.8", "vcard-parser": "^1.0.0" } } diff --git a/apps/contract-migration/scripts/verify.py b/apps/contract-migration/scripts/verify.py index f24a1148..7ff0a341 100644 --- a/apps/contract-migration/scripts/verify.py +++ b/apps/contract-migration/scripts/verify.py @@ -345,12 +345,11 @@ class Verifier: address_recovered = address_recovered.replace('"', '') try: - address = strip_0x(address) - address_recovered = strip_0x(address_recovered) + upper_address_recovered = strip_0x(address_recovered).upper() except ValueError: raise VerifierError(address_recovered, 'metadata (phone) address {} address recovered {}'.format(address, address_recovered)) - if address != address_recovered: + if upper_address != upper_address_recovered: raise VerifierError(address_recovered, 'metadata (phone)') From 04e9f45febd1abd8794a5aff688e153c72ccf526 Mon Sep 17 00:00:00 2001 From: nolash Date: Wed, 28 Apr 2021 19:24:33 +0200 Subject: [PATCH 17/17] Correct default token env vars in deployment step 2 --- apps/contract-migration/seed_cic_eth.sh | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/apps/contract-migration/seed_cic_eth.sh b/apps/contract-migration/seed_cic_eth.sh index 7795f176..5db1e428 100755 --- a/apps/contract-migration/seed_cic_eth.sh +++ b/apps/contract-migration/seed_cic_eth.sh @@ -13,11 +13,10 @@ DEV_PIP_EXTRA_INDEX_URL=${DEV_PIP_EXTRA_INDEX_URL:-https://pip.grassrootseconomi DEV_DATABASE_NAME_CIC_ETH=${DEV_DATABASE_NAME_CIC_ETH:-"cic-eth"} CIC_DATA_DIR=${CIC_DATA_DIR:-/tmp/cic} ETH_PASSPHRASE='' -DEV_TOKEN_TYPE=${DEV_TOKEN_TYPE:-giftable} -if [ $DEV_TOKEN_TYPE = 'giftable' ]; then - token_symbol='GFT' -else - token_symbol='SRF' +CIC_DEFAULT_TOKEN_SYMBOL=${CIC_DEFAULT_TOKEN_SYMBOL:-GFT} +if [[ $CIC_DEFAULT_TOKEN_SYMBOL != 'GFT' && $CIC_DEFAULT_TOKEN_SYMBOL != 'SRF' ]]; then + >&2 echo CIC_DEFAULT_TOKEN_SYMBOL must be one of [GFT,SRF], but was $CIC_DEFAULT_TOKEN_SYMBOL + exit 1 fi # Debug flag