diff --git a/.env.deployment.amoy b/.env.deployment.amoy new file mode 100644 index 000000000..45303657d --- /dev/null +++ b/.env.deployment.amoy @@ -0,0 +1,119 @@ +# ================================================================================ +# [Shared Settings] + +# Services to be started during the deployment +# Leaving it blank will default to 'deployer, worker' +# Options are: administrator, client, deployer, optimist, worker +export DEPLOYMENT_SERVICES= + +# The network name defined for this deployment +# Information related to this network is present in config/default.js. See the README.md for additional details +# Required! +export ETH_NETWORK=amoy + +# The Ethereum address to be used during the deployment +# Required! +export ETH_ADDRESS= + +# The private key related to the Ethereum address set in ETH_ADDRESS +# Required! +export ETH_PRIVATE_KEY= + +# The blockchain the services will connect to +# Required! +export BLOCKCHAIN_URL= + +# Sets the default gas value and price +# Leaving it blank will fallback to the defined defaults +export GAS= +export GAS_PRICE= + +# Text free variable indicating the environment name +export ENVIRONMENT=amoy + +# Log level +export LOG_LEVEL= + +# If the logging of HTTP payload is enabled +export LOG_HTTP_PAYLOAD_ENABLED= + +# If the HTTP full data payload should be logged +export LOG_HTTP_FULL_DATA= + +# Number of times the app will try to get the contracts info before giving up +export AUTOSTART_RETRIES= + +# Used by the client & deployer services - defines the 'worker' host. +# Leave it blank to get the one started in the docker-compose +export CIRCOM_WORKER_HOST= + +# Used by the client & optimist services +# Set to 'true' so that client will not wait for the blockchain to initialize +export USE_EXTERNAL_NODE= + + +# ================================================================================ +# [Administrator] + +# MongoDB database connection string +# Leaving it blank will make the app connect to the mongodb started by the docker-compose +export ADMIN_MONGO_URL= + + +# ================================================================================ +# [Client] + +# MongoDB database connection string +# Leaving it blank will make the app connect to the mongodb started by the docker-compose +export CLIENT_MONGO_URL= + +# Optimist host the client will connect to +# Leaving it blank will make the app connect to the mongodb started by the docker-compose +export OPTIMIST_HOST= +export OPTIMIST_PORT= + +# If the queue should be enabled +# Leaving it blank will make the apps connect to the RabbitMQ instance +export ENABLE_QUEUE= + +# RabbitMQ host the client will connect to +# Leaving it blank will make the app connect to the mongodb started by the docker-compose +export RABBITMQ_HOST= +export RABBITMQ_PORT= + + +# ================================================================================ +# [Deployer] + +# The L2 Token ID that was defined in the settings ('config/default.js') to be used to pay the fees. See nightfall-deployer/README.md. +# Required! +FEE_L2_TOKEN_ID= + +# When submitting a transaction, Nightfall verifies if the sender address is sanctioned on Chainalysis sanctions screening oracle +# If set to 'true', a mocked sanctions contract will be deployed, otherwise the Chainalysis sanctions oracle will be used instead. +# Required! +export DEPLOY_MOCKED_SANCTIONS_CONTRACT=true + +# It is enabled by default. Set to 'disable' to disable the whitelisting process. See docs/whitelist.md +export WHITELISTING=disable + +# The number of Approvers required to authorise `onlyOwner` transactions. See nightfall-administrator/README.md. +# Required! +export MULTISIG_SIGNATURE_THRESHOLD=1 + +# A comma separated Ethereum addresses list of the approvers +# Leave it blank if no approvers are needed +export MULTISIG_APPROVERS= + +# If the Trusted Setup should always run during the deployment +export ALWAYS_DO_TRUSTED_SETUP= + +# If for some reason the contracts deployment went well, but the cirtuits didn't finish well, set to 'true' to skip the contracts' deployment +export SKIP_DEPLOYMENT= + +# If the deployment to run will upgrade contracts +export UPGRADE_CONTRACTS= + +# When set to anything different of 'false', deploys the Smart Contract mocks, and funds some contracts and users (for Testing) +# Defaults to 'true' if left blank +export DEPLOY_MOCK_TOKENS=false diff --git a/.env.deployment.basesepolia b/.env.deployment.basesepolia new file mode 100644 index 000000000..81019a4d7 --- /dev/null +++ b/.env.deployment.basesepolia @@ -0,0 +1,119 @@ +# ================================================================================ +# [Shared Settings] + +# Services to be started during the deployment +# Leaving it blank will default to 'deployer, worker' +# Options are: administrator, client, deployer, optimist, worker +export DEPLOYMENT_SERVICES= + +# The network name defined for this deployment +# Information related to this network is present in config/default.js. See the README.md for additional details +# Required! +export ETH_NETWORK=baseSepolia + +# The Ethereum address to be used during the deployment +# Required! +export ETH_ADDRESS= + +# The private key related to the Ethereum address set in ETH_ADDRESS +# Required! +export ETH_PRIVATE_KEY= + +# The blockchain the services will connect to +# Required! +export BLOCKCHAIN_URL= + +# Sets the default gas value and price +# Leaving it blank will fallback to the defined defaults +export GAS= +export GAS_PRICE= + +# Text free variable indicating the environment name +export ENVIRONMENT=baseSepolia + +# Log level +export LOG_LEVEL= + +# If the logging of HTTP payload is enabled +export LOG_HTTP_PAYLOAD_ENABLED= + +# If the HTTP full data payload should be logged +export LOG_HTTP_FULL_DATA= + +# Number of times the app will try to get the contracts info before giving up +export AUTOSTART_RETRIES= + +# Used by the client & deployer services - defines the 'worker' host. +# Leave it blank to get the one started in the docker-compose +export CIRCOM_WORKER_HOST= + +# Used by the client & optimist services +# Set to 'true' so that client will not wait for the blockchain to initialize +export USE_EXTERNAL_NODE= + + +# ================================================================================ +# [Administrator] + +# MongoDB database connection string +# Leaving it blank will make the app connect to the mongodb started by the docker-compose +export ADMIN_MONGO_URL= + + +# ================================================================================ +# [Client] + +# MongoDB database connection string +# Leaving it blank will make the app connect to the mongodb started by the docker-compose +export CLIENT_MONGO_URL= + +# Optimist host the client will connect to +# Leaving it blank will make the app connect to the mongodb started by the docker-compose +export OPTIMIST_HOST= +export OPTIMIST_PORT= + +# If the queue should be enabled +# Leaving it blank will make the apps connect to the RabbitMQ instance +export ENABLE_QUEUE= + +# RabbitMQ host the client will connect to +# Leaving it blank will make the app connect to the mongodb started by the docker-compose +export RABBITMQ_HOST= +export RABBITMQ_PORT= + + +# ================================================================================ +# [Deployer] + +# The L2 Token ID that was defined in the settings ('config/default.js') to be used to pay the fees. See nightfall-deployer/README.md. +# Required! +FEE_L2_TOKEN_ID= + +# When submitting a transaction, Nightfall verifies if the sender address is sanctioned on Chainalysis sanctions screening oracle +# If set to 'true', a mocked sanctions contract will be deployed, otherwise the Chainalysis sanctions oracle will be used instead. +# Required! +export DEPLOY_MOCKED_SANCTIONS_CONTRACT=true + +# It is enabled by default. Set to 'disable' to disable the whitelisting process. See docs/whitelist.md +export WHITELISTING=disable + +# The number of Approvers required to authorise `onlyOwner` transactions. See nightfall-administrator/README.md. +# Required! +export MULTISIG_SIGNATURE_THRESHOLD=1 + +# A comma separated Ethereum addresses list of the approvers +# Leave it blank if no approvers are needed +export MULTISIG_APPROVERS= + +# If the Trusted Setup should always run during the deployment +export ALWAYS_DO_TRUSTED_SETUP= + +# If for some reason the contracts deployment went well, but the cirtuits didn't finish well, set to 'true' to skip the contracts' deployment +export SKIP_DEPLOYMENT= + +# If the deployment to run will upgrade contracts +export UPGRADE_CONTRACTS= + +# When set to anything different of 'false', deploys the Smart Contract mocks, and funds some contracts and users (for Testing) +# Defaults to 'true' if left blank +export DEPLOY_MOCK_TOKENS=false diff --git a/apps/gas-estimate/index.js b/apps/gas-estimate/index.js index 72ae0acd1..8e0edfee7 100644 --- a/apps/gas-estimate/index.js +++ b/apps/gas-estimate/index.js @@ -26,17 +26,14 @@ function getRequest(url) { exports.handler = async () => { try { - console.log('ETH_GAS_STATION', process.env.ETH_GAS_STATION); const result = await getRequest( `https://api.etherscan.io/api?module=gastracker&action=gasoracle&apikey=${process.env.ETH_GAS_STATION}`, ); - console.log('result', result); return { statusCode: 200, body: JSON.stringify(result), }; } catch (error) { - console.log('Error is️:', error); return { statusCode: 400, body: error.message, diff --git a/apps/proposer/package-lock.json b/apps/proposer/package-lock.json index 07c51dc8f..e949d231c 100644 --- a/apps/proposer/package-lock.json +++ b/apps/proposer/package-lock.json @@ -18,6 +18,9 @@ "reconnecting-websocket": "^4.4.0", "web3": "^1.7.5", "ws": "^8.2.3" + }, + "devDependencies": { + "nodemon": "^2.0.19" } }, "../../common-files": { @@ -565,6 +568,19 @@ "url": "https://github.com/sponsors/epoberezkin" } }, + "node_modules/anymatch": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", + "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", + "dev": true, + "dependencies": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + }, + "engines": { + "node": ">= 8" + } + }, "node_modules/array-flatten": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", @@ -639,6 +655,12 @@ "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.11.0.tgz", "integrity": "sha512-xh1Rl34h6Fi1DC2WWKfxUTVqRsNnr6LsKz2+hfwDxQJWmrx8+c7ylaqBMcHfl1U1r2dsifOvKX3LQuLNZ+XSvA==" }, + "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==", + "dev": true + }, "node_modules/base-x": { "version": "3.0.9", "resolved": "https://registry.npmjs.org/base-x/-/base-x-3.0.9.tgz", @@ -682,6 +704,18 @@ "node": "*" } }, + "node_modules/binary-extensions": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.3.0.tgz", + "integrity": "sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==", + "dev": true, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/blakejs": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/blakejs/-/blakejs-1.2.1.tgz", @@ -720,6 +754,28 @@ "npm": "1.2.8000 || >= 1.4.16" } }, + "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==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/braces": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", + "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", + "dev": true, + "dependencies": { + "fill-range": "^7.1.1" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/brorand": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/brorand/-/brorand-1.1.0.tgz", @@ -929,6 +985,30 @@ "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", "integrity": "sha512-4tYFyifaFfGacoiObjJegolkwSU4xQNGbVgUiNYVUxbQ2x2lUsFvY4hVgVzGiIe6WLOPqycWXA40l+PWsxthUw==" }, + "node_modules/chokidar": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz", + "integrity": "sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==", + "dev": true, + "dependencies": { + "anymatch": "~3.1.2", + "braces": "~3.0.2", + "glob-parent": "~5.1.2", + "is-binary-path": "~2.1.0", + "is-glob": "~4.0.1", + "normalize-path": "~3.0.0", + "readdirp": "~3.6.0" + }, + "engines": { + "node": ">= 8.10.0" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + }, + "optionalDependencies": { + "fsevents": "~2.3.2" + } + }, "node_modules/chownr": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.4.tgz", @@ -1001,6 +1081,12 @@ "resolved": "../../common-files", "link": true }, + "node_modules/concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", + "dev": true + }, "node_modules/config": { "version": "3.3.8", "resolved": "https://registry.npmjs.org/config/-/config-3.3.8.tgz", @@ -1627,6 +1713,18 @@ "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==" }, + "node_modules/fill-range": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", + "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", + "dev": true, + "dependencies": { + "to-regex-range": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/finalhandler": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.2.0.tgz", @@ -1712,6 +1810,20 @@ "minipass": "^2.6.0" } }, + "node_modules/fsevents": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "dev": true, + "hasInstallScript": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, "node_modules/function-bind": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", @@ -1789,6 +1901,18 @@ "assert-plus": "^1.0.0" } }, + "node_modules/glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dev": true, + "dependencies": { + "is-glob": "^4.0.1" + }, + "engines": { + "node": ">= 6" + } + }, "node_modules/global": { "version": "4.4.0", "resolved": "https://registry.npmjs.org/global/-/global-4.4.0.tgz", @@ -1869,6 +1993,15 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", + "dev": true, + "engines": { + "node": ">=4" + } + }, "node_modules/has-property-descriptors": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.0.tgz", @@ -2037,6 +2170,12 @@ } ] }, + "node_modules/ignore-by-default": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/ignore-by-default/-/ignore-by-default-1.0.1.tgz", + "integrity": "sha512-Ius2VYcGNk7T90CppJqcIkS5ooHUZyIQK+ClZfMfMNFEF9VSE73Fq+906u/CWu92x4gzZMWOwfFYckPObzdEbA==", + "dev": true + }, "node_modules/inherits": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", @@ -2089,6 +2228,18 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/is-binary-path": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", + "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", + "dev": true, + "dependencies": { + "binary-extensions": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/is-boolean-object": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/is-boolean-object/-/is-boolean-object-1.1.2.tgz", @@ -2129,6 +2280,15 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/is-function": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/is-function/-/is-function-1.0.2.tgz", @@ -2148,6 +2308,18 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dev": true, + "dependencies": { + "is-extglob": "^2.1.1" + }, + "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", @@ -2168,6 +2340,15 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true, + "engines": { + "node": ">=0.12.0" + } + }, "node_modules/is-number-object": { "version": "1.0.7", "resolved": "https://registry.npmjs.org/is-number-object/-/is-number-object-1.0.7.tgz", @@ -2470,6 +2651,18 @@ "resolved": "https://registry.npmjs.org/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz", "integrity": "sha512-JIYlbt6g8i5jKfJ3xz7rF0LXmv2TkDxBLUkiBeZ7bAx4GnnNMr8xFpGnOxn6GhTEHx3SjRrZEoU+j04prX1ktg==" }, + "node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, "node_modules/minimist": { "version": "1.2.7", "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.7.tgz", @@ -2638,6 +2831,58 @@ "node-gyp-build-test": "build-test.js" } }, + "node_modules/nodemon": { + "version": "2.0.22", + "resolved": "https://registry.npmjs.org/nodemon/-/nodemon-2.0.22.tgz", + "integrity": "sha512-B8YqaKMmyuCO7BowF1Z1/mkPqLk6cs/l63Ojtd6otKjMx47Dq1utxfRxcavH1I7VSaL8n5BUaoutadnsX3AAVQ==", + "dev": true, + "dependencies": { + "chokidar": "^3.5.2", + "debug": "^3.2.7", + "ignore-by-default": "^1.0.1", + "minimatch": "^3.1.2", + "pstree.remy": "^1.1.8", + "semver": "^5.7.1", + "simple-update-notifier": "^1.0.7", + "supports-color": "^5.5.0", + "touch": "^3.1.0", + "undefsafe": "^2.0.5" + }, + "bin": { + "nodemon": "bin/nodemon.js" + }, + "engines": { + "node": ">=8.10.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/nodemon" + } + }, + "node_modules/nodemon/node_modules/debug": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", + "dev": true, + "dependencies": { + "ms": "^2.1.1" + } + }, + "node_modules/nodemon/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==", + "dev": true + }, + "node_modules/normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/normalize-url": { "version": "6.1.0", "resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-6.1.0.tgz", @@ -2801,6 +3046,18 @@ "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", "integrity": "sha512-7EAHlyLHI56VEIdK57uwHdHKIaAGbnXPiw0yWbarQZOKaKpvUIgW0jWRVLiatnM+XXlSwsanIBH/hzGMJulMow==" }, + "node_modules/picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "dev": true, + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, "node_modules/process": { "version": "0.11.10", "resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz", @@ -2826,6 +3083,12 @@ "resolved": "https://registry.npmjs.org/psl/-/psl-1.9.0.tgz", "integrity": "sha512-E/ZsdU4HLs/68gYzgGTkMicWTLPdAftJLfJFlLUAAKZGkStNU72sZjT66SnMDVOfOWY/YAoiD7Jxa9iHvngcag==" }, + "node_modules/pstree.remy": { + "version": "1.1.8", + "resolved": "https://registry.npmjs.org/pstree.remy/-/pstree.remy-1.1.8.tgz", + "integrity": "sha512-77DZwxQmxKnu3aR542U+X8FypNzbfJ+C5XQDk3uWjWxn6151aIMGthWYRXTqT1E5oJvg+ljaa2OJi+VfvCOQ8w==", + "dev": true + }, "node_modules/public-encrypt": { "version": "4.0.3", "resolved": "https://registry.npmjs.org/public-encrypt/-/public-encrypt-4.0.3.tgz", @@ -2883,6 +3146,11 @@ "node": ">=0.10.0" } }, + "node_modules/querystringify": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/querystringify/-/querystringify-2.2.0.tgz", + "integrity": "sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ==" + }, "node_modules/quick-lru": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/quick-lru/-/quick-lru-5.1.1.tgz", @@ -2946,6 +3214,18 @@ "node": ">= 6" } }, + "node_modules/readdirp": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", + "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", + "dev": true, + "dependencies": { + "picomatch": "^2.2.1" + }, + "engines": { + "node": ">=8.10.0" + } + }, "node_modules/reconnecting-websocket": { "version": "4.4.0", "resolved": "https://registry.npmjs.org/reconnecting-websocket/-/reconnecting-websocket-4.4.0.tgz", @@ -3015,6 +3295,11 @@ "uuid": "bin/uuid" } }, + "node_modules/requires-port": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz", + "integrity": "sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ==" + }, "node_modules/resolve-alpn": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/resolve-alpn/-/resolve-alpn-1.2.1.tgz", @@ -3120,6 +3405,15 @@ "node": ">=10.0.0" } }, + "node_modules/semver": { + "version": "5.7.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.2.tgz", + "integrity": "sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==", + "dev": true, + "bin": { + "semver": "bin/semver" + } + }, "node_modules/send": { "version": "0.18.0", "resolved": "https://registry.npmjs.org/send/-/send-0.18.0.tgz", @@ -3252,6 +3546,27 @@ "node": ">=4" } }, + "node_modules/simple-update-notifier": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/simple-update-notifier/-/simple-update-notifier-1.1.0.tgz", + "integrity": "sha512-VpsrsJSUcJEseSbMHkrsrAVSdvVS5I96Qo1QAQ4FxQ9wXFcB+pjj7FB7/us9+GcgfW4ziHtYMc1J0PLczb55mg==", + "dev": true, + "dependencies": { + "semver": "~7.0.0" + }, + "engines": { + "node": ">=8.10.0" + } + }, + "node_modules/simple-update-notifier/node_modules/semver": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.0.0.tgz", + "integrity": "sha512-+GB6zVA9LWh6zovYQLALHwv5rb2PHGlJi3lfiqIHxR0uuwCgefcOJc59v9fv1w8GbStwxuuqqAjI9NMAOOgq1A==", + "dev": true, + "bin": { + "semver": "bin/semver.js" + } + }, "node_modules/sshpk": { "version": "1.17.0", "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.17.0.tgz", @@ -3338,6 +3653,18 @@ "npm": ">=3" } }, + "node_modules/supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "dependencies": { + "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, "node_modules/swarm-js": { "version": "0.1.42", "resolved": "https://registry.npmjs.org/swarm-js/-/swarm-js-0.1.42.tgz", @@ -3463,6 +3790,18 @@ "node": ">=0.10.0" } }, + "node_modules/to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, + "dependencies": { + "is-number": "^7.0.0" + }, + "engines": { + "node": ">=8.0" + } + }, "node_modules/toidentifier": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz", @@ -3471,16 +3810,35 @@ "node": ">=0.6" } }, + "node_modules/touch": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/touch/-/touch-3.1.1.tgz", + "integrity": "sha512-r0eojU4bI8MnHr8c5bNo7lJDdI2qXlWWJk6a9EAFG7vbhTjElYhBVS3/miuE0uOuoLdb8Mc/rVfsmm6eo5o9GA==", + "dev": true, + "bin": { + "nodetouch": "bin/nodetouch.js" + } + }, "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==", + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-4.1.3.tgz", + "integrity": "sha512-aX/y5pVRkfRnfmuX+OdbSdXvPe6ieKX/G2s7e98f4poJHnqH3281gDPm/metm6E/WRamfx7WC4HUqkWHfQHprw==", "dependencies": { - "psl": "^1.1.28", - "punycode": "^2.1.1" + "psl": "^1.1.33", + "punycode": "^2.1.1", + "universalify": "^0.2.0", + "url-parse": "^1.5.3" }, "engines": { - "node": ">=0.8" + "node": ">=6" + } + }, + "node_modules/tough-cookie/node_modules/universalify": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.2.0.tgz", + "integrity": "sha512-CJ1QgKmNg3CwvAv/kOFmtnEN05f0D/cn9QntgNOQlQF9dgvVTHj3t+8JPdjqawCHk7V/KA+fbUqzZ9XWhcqPUg==", + "engines": { + "node": ">= 4.0.0" } }, "node_modules/tslib": { @@ -3548,6 +3906,12 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/undefsafe": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/undefsafe/-/undefsafe-2.0.5.tgz", + "integrity": "sha512-WxONCrssBM8TSPRqN5EmsjVrsv4A8X12J4ArBiiayv3DyyG3ZlIg6yysuuSYdZsVz3TKcTg2fd//Ujd4CHV1iA==", + "dev": true + }, "node_modules/universalify": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", @@ -3572,6 +3936,15 @@ "punycode": "^2.1.0" } }, + "node_modules/url-parse": { + "version": "1.5.10", + "resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.5.10.tgz", + "integrity": "sha512-WypcfiRhfeUP9vvF0j6rw0J3hrWrw6iZv3+22h6iRMJ/8z1Tj6XfLP4DsUix5MhMPnXpiHDoKyoZ/bdCkwBCiQ==", + "dependencies": { + "querystringify": "^2.1.1", + "requires-port": "^1.0.0" + } + }, "node_modules/url-set-query": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/url-set-query/-/url-set-query-1.0.0.tgz", @@ -4462,6 +4835,16 @@ "uri-js": "^4.2.2" } }, + "anymatch": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", + "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", + "dev": true, + "requires": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + } + }, "array-flatten": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", @@ -4524,6 +4907,12 @@ "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.11.0.tgz", "integrity": "sha512-xh1Rl34h6Fi1DC2WWKfxUTVqRsNnr6LsKz2+hfwDxQJWmrx8+c7ylaqBMcHfl1U1r2dsifOvKX3LQuLNZ+XSvA==" }, + "balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "dev": true + }, "base-x": { "version": "3.0.9", "resolved": "https://registry.npmjs.org/base-x/-/base-x-3.0.9.tgz", @@ -4550,6 +4939,12 @@ "resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.1.0.tgz", "integrity": "sha512-4LwHK4nfDOraBCtst+wOWIHbu1vhvAPJK8g8nROd4iuc3PSEjWif/qwbkh8jwCJz6yDBvtU4KPynETgrfh7y3A==" }, + "binary-extensions": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.3.0.tgz", + "integrity": "sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==", + "dev": true + }, "blakejs": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/blakejs/-/blakejs-1.2.1.tgz", @@ -4584,6 +4979,25 @@ "unpipe": "1.0.0" } }, + "brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "requires": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "braces": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", + "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", + "dev": true, + "requires": { + "fill-range": "^7.1.1" + } + }, "brorand": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/brorand/-/brorand-1.1.0.tgz", @@ -4760,6 +5174,22 @@ "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", "integrity": "sha512-4tYFyifaFfGacoiObjJegolkwSU4xQNGbVgUiNYVUxbQ2x2lUsFvY4hVgVzGiIe6WLOPqycWXA40l+PWsxthUw==" }, + "chokidar": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz", + "integrity": "sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==", + "dev": true, + "requires": { + "anymatch": "~3.1.2", + "braces": "~3.0.2", + "fsevents": "~2.3.2", + "glob-parent": "~5.1.2", + "is-binary-path": "~2.1.0", + "is-glob": "~4.0.1", + "normalize-path": "~3.0.0", + "readdirp": "~3.6.0" + } + }, "chownr": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.4.tgz", @@ -4841,6 +5271,12 @@ "ws": "^8.5.0" } }, + "concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", + "dev": true + }, "config": { "version": "3.3.8", "resolved": "https://registry.npmjs.org/config/-/config-3.3.8.tgz", @@ -5383,6 +5819,15 @@ "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==" }, + "fill-range": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", + "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", + "dev": true, + "requires": { + "to-regex-range": "^5.0.1" + } + }, "finalhandler": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.2.0.tgz", @@ -5453,6 +5898,13 @@ "minipass": "^2.6.0" } }, + "fsevents": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "dev": true, + "optional": true + }, "function-bind": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", @@ -5506,6 +5958,15 @@ "assert-plus": "^1.0.0" } }, + "glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dev": true, + "requires": { + "is-glob": "^4.0.1" + } + }, "global": { "version": "4.4.0", "resolved": "https://registry.npmjs.org/global/-/global-4.4.0.tgz", @@ -5567,6 +6028,12 @@ "resolved": "https://registry.npmjs.org/has-bigints/-/has-bigints-1.0.2.tgz", "integrity": "sha512-tSvCKtBr9lkF0Ex0aQiP9N+OpV4zi2r/Nee5VkRDbaqv35RLYMzbwQfFSZZH0kR+Rd6302UJZ2p/bJCEoR3VoQ==" }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", + "dev": true + }, "has-property-descriptors": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.0.tgz", @@ -5686,6 +6153,12 @@ "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==" }, + "ignore-by-default": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/ignore-by-default/-/ignore-by-default-1.0.1.tgz", + "integrity": "sha512-Ius2VYcGNk7T90CppJqcIkS5ooHUZyIQK+ClZfMfMNFEF9VSE73Fq+906u/CWu92x4gzZMWOwfFYckPObzdEbA==", + "dev": true + }, "inherits": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", @@ -5723,6 +6196,15 @@ "has-bigints": "^1.0.1" } }, + "is-binary-path": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", + "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", + "dev": true, + "requires": { + "binary-extensions": "^2.0.0" + } + }, "is-boolean-object": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/is-boolean-object/-/is-boolean-object-1.1.2.tgz", @@ -5745,6 +6227,12 @@ "has-tostringtag": "^1.0.0" } }, + "is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", + "dev": true + }, "is-function": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/is-function/-/is-function-1.0.2.tgz", @@ -5758,6 +6246,15 @@ "has-tostringtag": "^1.0.0" } }, + "is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dev": true, + "requires": { + "is-extglob": "^2.1.1" + } + }, "is-hex-prefixed": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-hex-prefixed/-/is-hex-prefixed-1.0.0.tgz", @@ -5768,6 +6265,12 @@ "resolved": "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.2.tgz", "integrity": "sha512-dqJvarLawXsFbNDeJW7zAz8ItJ9cd28YufuuFzh0G8pNHjJMnY08Dv7sYX2uF5UpQOwieAeOExEYAWWfu7ZZUA==" }, + "is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true + }, "is-number-object": { "version": "1.0.7", "resolved": "https://registry.npmjs.org/is-number-object/-/is-number-object-1.0.7.tgz", @@ -5991,6 +6494,15 @@ "resolved": "https://registry.npmjs.org/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz", "integrity": "sha512-JIYlbt6g8i5jKfJ3xz7rF0LXmv2TkDxBLUkiBeZ7bAx4GnnNMr8xFpGnOxn6GhTEHx3SjRrZEoU+j04prX1ktg==" }, + "minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "requires": { + "brace-expansion": "^1.1.7" + } + }, "minimist": { "version": "1.2.7", "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.7.tgz", @@ -6128,6 +6640,47 @@ "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.5.0.tgz", "integrity": "sha512-2iGbaQBV+ITgCz76ZEjmhUKAKVf7xfY1sRl4UiKQspfZMH2h06SyhNsnSVy50cwkFQDGLyif6m/6uFXHkOZ6rg==" }, + "nodemon": { + "version": "2.0.22", + "resolved": "https://registry.npmjs.org/nodemon/-/nodemon-2.0.22.tgz", + "integrity": "sha512-B8YqaKMmyuCO7BowF1Z1/mkPqLk6cs/l63Ojtd6otKjMx47Dq1utxfRxcavH1I7VSaL8n5BUaoutadnsX3AAVQ==", + "dev": true, + "requires": { + "chokidar": "^3.5.2", + "debug": "^3.2.7", + "ignore-by-default": "^1.0.1", + "minimatch": "^3.1.2", + "pstree.remy": "^1.1.8", + "semver": "^5.7.1", + "simple-update-notifier": "^1.0.7", + "supports-color": "^5.5.0", + "touch": "^3.1.0", + "undefsafe": "^2.0.5" + }, + "dependencies": { + "debug": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", + "dev": true, + "requires": { + "ms": "^2.1.1" + } + }, + "ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true + } + } + }, + "normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "dev": true + }, "normalize-url": { "version": "6.1.0", "resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-6.1.0.tgz", @@ -6253,6 +6806,12 @@ "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", "integrity": "sha512-7EAHlyLHI56VEIdK57uwHdHKIaAGbnXPiw0yWbarQZOKaKpvUIgW0jWRVLiatnM+XXlSwsanIBH/hzGMJulMow==" }, + "picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "dev": true + }, "process": { "version": "0.11.10", "resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz", @@ -6272,6 +6831,12 @@ "resolved": "https://registry.npmjs.org/psl/-/psl-1.9.0.tgz", "integrity": "sha512-E/ZsdU4HLs/68gYzgGTkMicWTLPdAftJLfJFlLUAAKZGkStNU72sZjT66SnMDVOfOWY/YAoiD7Jxa9iHvngcag==" }, + "pstree.remy": { + "version": "1.1.8", + "resolved": "https://registry.npmjs.org/pstree.remy/-/pstree.remy-1.1.8.tgz", + "integrity": "sha512-77DZwxQmxKnu3aR542U+X8FypNzbfJ+C5XQDk3uWjWxn6151aIMGthWYRXTqT1E5oJvg+ljaa2OJi+VfvCOQ8w==", + "dev": true + }, "public-encrypt": { "version": "4.0.3", "resolved": "https://registry.npmjs.org/public-encrypt/-/public-encrypt-4.0.3.tgz", @@ -6317,6 +6882,11 @@ "strict-uri-encode": "^1.0.0" } }, + "querystringify": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/querystringify/-/querystringify-2.2.0.tgz", + "integrity": "sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ==" + }, "quick-lru": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/quick-lru/-/quick-lru-5.1.1.tgz", @@ -6365,6 +6935,15 @@ "util-deprecate": "^1.0.1" } }, + "readdirp": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", + "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", + "dev": true, + "requires": { + "picomatch": "^2.2.1" + } + }, "reconnecting-websocket": { "version": "4.4.0", "resolved": "https://registry.npmjs.org/reconnecting-websocket/-/reconnecting-websocket-4.4.0.tgz", @@ -6402,7 +6981,7 @@ "performance-now": "^2.1.0", "qs": "~6.5.2", "safe-buffer": "^5.1.2", - "tough-cookie": "~2.5.0", + "tough-cookie": "4.1.3", "tunnel-agent": "^0.6.0", "uuid": "^3.3.2" }, @@ -6419,6 +6998,11 @@ } } }, + "requires-port": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz", + "integrity": "sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ==" + }, "resolve-alpn": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/resolve-alpn/-/resolve-alpn-1.2.1.tgz", @@ -6498,6 +7082,12 @@ "node-gyp-build": "^4.2.0" } }, + "semver": { + "version": "5.7.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.2.tgz", + "integrity": "sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==", + "dev": true + }, "send": { "version": "0.18.0", "resolved": "https://registry.npmjs.org/send/-/send-0.18.0.tgz", @@ -6602,6 +7192,23 @@ } } }, + "simple-update-notifier": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/simple-update-notifier/-/simple-update-notifier-1.1.0.tgz", + "integrity": "sha512-VpsrsJSUcJEseSbMHkrsrAVSdvVS5I96Qo1QAQ4FxQ9wXFcB+pjj7FB7/us9+GcgfW4ziHtYMc1J0PLczb55mg==", + "dev": true, + "requires": { + "semver": "~7.0.0" + }, + "dependencies": { + "semver": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.0.0.tgz", + "integrity": "sha512-+GB6zVA9LWh6zovYQLALHwv5rb2PHGlJi3lfiqIHxR0uuwCgefcOJc59v9fv1w8GbStwxuuqqAjI9NMAOOgq1A==", + "dev": true + } + } + }, "sshpk": { "version": "1.17.0", "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.17.0.tgz", @@ -6664,6 +7271,15 @@ "is-hex-prefixed": "1.0.0" } }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + }, "swarm-js": { "version": "0.1.42", "resolved": "https://registry.npmjs.org/swarm-js/-/swarm-js-0.1.42.tgz", @@ -6763,18 +7379,42 @@ "resolved": "https://registry.npmjs.org/timed-out/-/timed-out-4.0.1.tgz", "integrity": "sha512-G7r3AhovYtr5YKOWQkta8RKAPb+J9IsO4uVmzjl8AZwfhs8UcUwTiD6gcJYSgOtzyjvQKrKYn41syHbUWMkafA==" }, + "to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, + "requires": { + "is-number": "^7.0.0" + } + }, "toidentifier": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz", "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==" }, + "touch": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/touch/-/touch-3.1.1.tgz", + "integrity": "sha512-r0eojU4bI8MnHr8c5bNo7lJDdI2qXlWWJk6a9EAFG7vbhTjElYhBVS3/miuE0uOuoLdb8Mc/rVfsmm6eo5o9GA==", + "dev": true + }, "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==", + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-4.1.3.tgz", + "integrity": "sha512-aX/y5pVRkfRnfmuX+OdbSdXvPe6ieKX/G2s7e98f4poJHnqH3281gDPm/metm6E/WRamfx7WC4HUqkWHfQHprw==", "requires": { - "psl": "^1.1.28", - "punycode": "^2.1.1" + "psl": "^1.1.33", + "punycode": "^2.1.1", + "universalify": "^0.2.0", + "url-parse": "^1.5.3" + }, + "dependencies": { + "universalify": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.2.0.tgz", + "integrity": "sha512-CJ1QgKmNg3CwvAv/kOFmtnEN05f0D/cn9QntgNOQlQF9dgvVTHj3t+8JPdjqawCHk7V/KA+fbUqzZ9XWhcqPUg==" + } } }, "tslib": { @@ -6833,6 +7473,12 @@ "which-boxed-primitive": "^1.0.2" } }, + "undefsafe": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/undefsafe/-/undefsafe-2.0.5.tgz", + "integrity": "sha512-WxONCrssBM8TSPRqN5EmsjVrsv4A8X12J4ArBiiayv3DyyG3ZlIg6yysuuSYdZsVz3TKcTg2fd//Ujd4CHV1iA==", + "dev": true + }, "universalify": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", @@ -6851,6 +7497,15 @@ "punycode": "^2.1.0" } }, + "url-parse": { + "version": "1.5.10", + "resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.5.10.tgz", + "integrity": "sha512-WypcfiRhfeUP9vvF0j6rw0J3hrWrw6iZv3+22h6iRMJ/8z1Tj6XfLP4DsUix5MhMPnXpiHDoKyoZ/bdCkwBCiQ==", + "requires": { + "querystringify": "^2.1.1", + "requires-port": "^1.0.0" + } + }, "url-set-query": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/url-set-query/-/url-set-query-1.0.0.tgz", diff --git a/apps/proposer/package.json b/apps/proposer/package.json index e78b51f70..319b2dbf9 100644 --- a/apps/proposer/package.json +++ b/apps/proposer/package.json @@ -5,7 +5,8 @@ "main": "index.js", "scripts": { "start": "node --trace-warnings src/app.mjs", - "test": "echo \"Error: no test specified\" && exit 1" + "test": "echo \"Error: no test specified\" && exit 1", + "dev": "nodemon src/app.mjs" }, "author": "westlad", "license": "CC0-1.0", @@ -20,9 +21,15 @@ "web3": "^1.7.5", "ws": "^8.2.3" }, + "devDependencies": { + "nodemon": "^2.0.19" + }, "overrides": { "swarm-js": { "got": "11.8.5" + }, + "request": { + "tough-cookie": "4.1.3" } } } diff --git a/apps/proposer/src/proposer.mjs b/apps/proposer/src/proposer.mjs index 4527241c2..8159d939b 100644 --- a/apps/proposer/src/proposer.mjs +++ b/apps/proposer/src/proposer.mjs @@ -7,9 +7,13 @@ import logger from 'common-files/utils/logger.mjs'; import { waitForTimeout } from 'common-files/utils/utils.mjs'; import config from 'config'; -const { TIMER_CHANGE_PROPOSER_SECOND, MAX_ROTATE_TIMES } = config; +const { + TIMER_CHANGE_PROPOSER_SECOND, + MAX_ROTATE_TIMES, + ENABLE_CHECK_AND_CHANGE_PROPOSER, + CHECK_REGISTER_PROPOSER_SECOND, +} = config; -const CHECK_REGISTER_PROPOSER_SECOND = 10; /** * check that it is possible to make the proposer change by checking the following conditions: * the number of registered proposers is greater than 1 @@ -18,7 +22,7 @@ const CHECK_REGISTER_PROPOSER_SECOND = 10; */ async function checkAndChangeProposer(nf3) { // eslint-disable-next-line no-constant-condition - while (true) { + while (ENABLE_CHECK_AND_CHANGE_PROPOSER === 'true') { logger.info('Checking Proposer...'); const proposerStartBlock = await nf3.proposerStartBlock(); const rotateProposerBlocks = await nf3.getRotateProposerBlocks(); @@ -64,22 +68,26 @@ async function checkAndChangeProposer(nf3) { async function checkAndRegisterProposer(nf3, proposerBaseUrl) { // eslint-disable-next-line no-constant-condition while (true) { - const { proposers } = await nf3.getProposers(); - const thisProposer = proposers.filter(p => p.thisAddress === nf3.ethereumAddress); - if (!thisProposer.length) { - logger.info('Attempting to register proposer'); - const blockStake = await nf3.getBlockStake(); - const minimumStake = await nf3.getMinimumStake(); + try { + const { proposers } = await nf3.getProposers(); + const thisProposer = proposers.filter(p => p.thisAddress === nf3.ethereumAddress); + if (!thisProposer.length) { + logger.info('Attempting to register proposer'); + const blockStake = await nf3.getBlockStake(); + const minimumStake = await nf3.getMinimumStake(); - logger.info(`blockStake: ${blockStake}, minimumStake: ${minimumStake}`); + logger.info(`blockStake: ${blockStake}, minimumStake: ${minimumStake}`); - try { - await nf3.registerProposer(proposerBaseUrl, minimumStake); - } catch (err) { - logger.info( - `Error registering proposer ${proposerBaseUrl} with error message ${err.message}`, - ); + try { + await nf3.registerProposer(proposerBaseUrl, minimumStake); + } catch (err) { + logger.info( + `Error registering proposer ${proposerBaseUrl} with error message ${err.message}`, + ); + } } + } catch (err) { + logger.info(`Error during checkAndRegisterProposer with error message ${err.message}`); } await waitForTimeout(CHECK_REGISTER_PROPOSER_SECOND * 1000); @@ -117,7 +125,6 @@ export default async function startProposer(nf3, proposerBaseUrl) { ); if (error.message.includes('Transaction has been reverted by the EVM')) { const stakeAccount = await nf3.getProposerStake(); - console.log('CURRENT STAKE: ', stakeAccount); const blockStake = await nf3.getBlockStake(); const minimumStake = await nf3.getMinimumStake(); if (stakeAccount.amount <= blockStake) { diff --git a/apps/proposer/src/routes/proposer.mjs b/apps/proposer/src/routes/proposer.mjs index 37ea7f585..78fb6998c 100644 --- a/apps/proposer/src/routes/proposer.mjs +++ b/apps/proposer/src/routes/proposer.mjs @@ -7,12 +7,14 @@ module but handle the entire request here. */ import express from 'express'; import config from 'config'; +import logger from 'common-files/utils/logger.mjs'; const { MAX_BLOCK_SIZE, MINIMUM_TRANSACTION_SLOTS } = config; const router = express.Router(); router.post('/offchain-transaction', async (req, res, next) => { + logger.info('Starting execution of /offchain-transaction', req?.body); const nf3 = req.app.get('nf3'); const { transaction } = req.body; if (!transaction) { @@ -29,14 +31,18 @@ router.post('/offchain-transaction', async (req, res, next) => { 32; if (txBytes > MAX_BLOCK_SIZE) { + logger.error(`Block size limit exceeded: ${txBytes}`); res.sendStatus(404); return; } + logger.info('Forwarding to optimist'); try { const res2 = await nf3.forwardOffchainTransaction(transaction); res.sendStatus(res2.status); } catch (error) { + logger.error('Error when forwarding off-chain tx to optimist'); + logger.error(error); next(error); } }); diff --git a/bin/amoy-deployer b/bin/amoy-deployer new file mode 100755 index 000000000..206775a70 --- /dev/null +++ b/bin/amoy-deployer @@ -0,0 +1,9 @@ +#!/bin/bash + +echo "Setting up the environment variables for nf3 deployer ..." + +source bin/amoy-deployment.env <"private key without 0x"> <"https provider RPC"> + +echo "Running nightfall deployer script..." + +./bin/deploy-contracts .env.deployment.amoy \ No newline at end of file diff --git a/bin/amoy-deployment.env b/bin/amoy-deployment.env new file mode 100755 index 000000000..cd525ad2a --- /dev/null +++ b/bin/amoy-deployment.env @@ -0,0 +1,13 @@ +#! /bin/bash +set -o allexport +BLOCKCHAIN_URL="$2" +ETH_NETWORK=amoy +ETH_PRIVATE_KEY="$1" +MULTISIG_APPROVERS='0x0000000000000000000000000000000000000001,0x0000000000000000000000000000000000000002,0x0000000000000000000000000000000000000003,0x0000000000000000000000000000000000000004' +WHITELISTING=disable +NF_SERVICES_TO_START='deployer,worker' +DEPLOY_MOCK_TOKENS=false +ENVIRONMENT=amoy +FEE_L2_TOKEN_ID=WMATIC +DEPLOY_MOCKED_SANCTIONS_CONTRACT=true +set +o allexport \ No newline at end of file diff --git a/bin/amoy-node.env b/bin/amoy-node.env new file mode 100755 index 000000000..f66dc1ebd --- /dev/null +++ b/bin/amoy-node.env @@ -0,0 +1,18 @@ +#! /bin/bash +set -o allexport +BLOCKCHAIN_URL="$3" +ETH_PRIVATE_KEY="$1" +NF_SERVICES_TO_START='worker, client, optimist' +ENVIRONMENT=amoy +USE_EXTERNAL_NODE=true +USER1_KEY="$1" +USER2_KEY="$2" +PROPOSER_KEY="$2" +LIQUIDITY_PROVIDER_KEY="$1" +ERC20_COIN=WMATIC +FEE_L2_TOKEN_ID=WMATIC +ETH_NETWORK=amoy +DEPLOY_MOCKED_SANCTIONS_CONTRACT= +STATE_GENESIS_BLOCK=6002135 +CONFIRMATIONS=1 +set +o allexport \ No newline at end of file diff --git a/bin/amoy-setup b/bin/amoy-setup new file mode 100755 index 000000000..5191f6feb --- /dev/null +++ b/bin/amoy-setup @@ -0,0 +1,62 @@ +#!/bin/bash + +source bin/amoy-node.env <"private key 1 without 0x"> <"private key 2 without 0x"> <"websocket provider RPC"> + +# Define volume names +VOLUME_BUILD="nightfall_3_build" +VOLUME_PROVING_FILES="nightfall_3_proving_files" + +# Define paths for the source directories +SOURCE_BUILD_PATH="docker/volumes/build/." +SOURCE_PROVING_FILES_PATH="docker/volumes/proving_files/." + +# Bring down existing Docker Compose setup +echo "Bringing down existing Docker Compose setup..." +docker-compose -f docker/docker-compose.yml -f docker/docker-compose.apps.yml -p 'nightfall_3' down -v + +# Remove existing volumes +echo "Removing existing Docker volumes..." +docker volume rm $VOLUME_BUILD +docker volume rm $VOLUME_PROVING_FILES + +# Create new volumes +echo "Creating new Docker volumes..." +docker volume create $VOLUME_BUILD +docker volume create $VOLUME_PROVING_FILES + +# Copy build files to the build volume +echo "Copying build files to the build volume..." +docker container create --name temp -v $VOLUME_BUILD:/mnt busybox +docker cp $SOURCE_BUILD_PATH temp:/mnt +docker rm temp + +# Copy proving files to the proving files volume +echo "Copying proving files to the proving files volume..." +docker container create --name temp -v $VOLUME_PROVING_FILES:/mnt busybox +docker cp $SOURCE_PROVING_FILES_PATH temp:/mnt +docker rm temp + +echo "Docker operations completed successfully." + +# Navigate to common-files directory and link package +echo "Linking npm packages..." +cd common-files +npm link +cd .. + +# Link @polygon-nightfall/common-files globally +npm link @polygon-nightfall/common-files + +# Navigate to cli directory and link @polygon-nightfall/common-files +cd cli +npm link @polygon-nightfall/common-files +cd .. + +echo "NPM linking operations completed successfully." + +# Call the additional shell script +echo "Running setup-nightfall script..." +./bin/setup-nightfall + +echo "Running start-nightfall script..." +./bin/start-nightfall -n diff --git a/bin/basesepolia-deployer b/bin/basesepolia-deployer new file mode 100755 index 000000000..a7a57bf96 --- /dev/null +++ b/bin/basesepolia-deployer @@ -0,0 +1,9 @@ +#!/bin/bash + +echo "Setting up the environment variables for nf3 deployer ..." + +source bin/basesepolia-deployment.env + +echo "Running nightfall deployer script..." + +./bin/deploy-contracts .env.deployment.basesepolia \ No newline at end of file diff --git a/bin/basesepolia-deployment.env b/bin/basesepolia-deployment.env new file mode 100755 index 000000000..482310c22 --- /dev/null +++ b/bin/basesepolia-deployment.env @@ -0,0 +1,14 @@ +#! /bin/bash +set -o allexport +BLOCKCHAIN_URL="$2" +ETH_NETWORK=baseSepolia +ETH_PRIVATE_KEY="$1" +MULTISIG_APPROVERS='0x0000000000000000000000000000000000000001,0x0000000000000000000000000000000000000002,0x0000000000000000000000000000000000000003,0x0000000000000000000000000000000000000004' +WHITELISTING=disable +NF_SERVICES_TO_START='deployer,worker' +DEPLOY_MOCK_TOKENS=false +ENVIRONMENT=baseSepolia +FEE_L2_TOKEN_ID=WMATIC +DEPLOY_MOCKED_SANCTIONS_CONTRACT=true +ETH_ADDRESS=0x9E4E71699DdFb78A226F3a9dc376340D00b10eBb +set +o allexport \ No newline at end of file diff --git a/bin/basesepolia-node.env b/bin/basesepolia-node.env new file mode 100755 index 000000000..2cd4825ab --- /dev/null +++ b/bin/basesepolia-node.env @@ -0,0 +1,18 @@ +#! /bin/bash +set -o allexport +BLOCKCHAIN_URL="$3" +ETH_PRIVATE_KEY="$1" +NF_SERVICES_TO_START='worker, client, optimist' +ENVIRONMENT=baseSepolia +USE_EXTERNAL_NODE=true +USER1_KEY="$1" +USER2_KEY="$2" +PROPOSER_KEY="$2" +LIQUIDITY_PROVIDER_KEY="$1" +ERC20_COIN=WMATIC +FEE_L2_TOKEN_ID=WMATIC +ETH_NETWORK=baseSepolia +DEPLOY_MOCKED_SANCTIONS_CONTRACT= +STATE_GENESIS_BLOCK=10948768 +CONFIRMATIONS=1 +set +o allexport \ No newline at end of file diff --git a/bin/basesepolia-setup b/bin/basesepolia-setup new file mode 100755 index 000000000..9b8377880 --- /dev/null +++ b/bin/basesepolia-setup @@ -0,0 +1,62 @@ +#!/bin/bash + +source bin/basesepolia-node.env + +# Define volume names +VOLUME_BUILD="nightfall_3_build" +VOLUME_PROVING_FILES="nightfall_3_proving_files" + +# Define paths for the source directories +SOURCE_BUILD_PATH="docker/volumes/build/." +SOURCE_PROVING_FILES_PATH="docker/volumes/proving_files/." + +# Bring down existing Docker Compose setup +echo "Bringing down existing Docker Compose setup..." +docker-compose -f docker/docker-compose.yml -f docker/docker-compose.apps.yml -p 'nightfall_3' down -v + +# Remove existing volumes +echo "Removing existing Docker volumes..." +docker volume rm $VOLUME_BUILD +docker volume rm $VOLUME_PROVING_FILES + +# Create new volumes +echo "Creating new Docker volumes..." +docker volume create $VOLUME_BUILD +docker volume create $VOLUME_PROVING_FILES + +# Copy build files to the build volume +echo "Copying build files to the build volume..." +docker container create --name temp -v $VOLUME_BUILD:/mnt busybox +docker cp $SOURCE_BUILD_PATH temp:/mnt +docker rm temp + +# Copy proving files to the proving files volume +echo "Copying proving files to the proving files volume..." +docker container create --name temp -v $VOLUME_PROVING_FILES:/mnt busybox +docker cp $SOURCE_PROVING_FILES_PATH temp:/mnt +docker rm temp + +echo "Docker operations completed successfully." + +# Navigate to common-files directory and link package +echo "Linking npm packages..." +cd common-files +npm link +cd .. + +# Link @polygon-nightfall/common-files globally +npm link @polygon-nightfall/common-files + +# Navigate to cli directory and link @polygon-nightfall/common-files +cd cli +npm link @polygon-nightfall/common-files +cd .. + +echo "NPM linking operations completed successfully." + +# Call the additional shell script +echo "Running setup-nightfall script..." +./bin/setup-nightfall + +echo "Running start-nightfall script..." +./bin/start-nightfall -n diff --git a/cli/package-lock.json b/cli/package-lock.json index ad72503ae..40c44d705 100644 --- a/cli/package-lock.json +++ b/cli/package-lock.json @@ -5603,6 +5603,11 @@ "node": ">=0.10.0" } }, + "node_modules/querystringify": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/querystringify/-/querystringify-2.2.0.tgz", + "integrity": "sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ==" + }, "node_modules/queue": { "version": "6.0.2", "resolved": "https://registry.npmjs.org/queue/-/queue-6.0.2.tgz", @@ -5841,6 +5846,11 @@ "node": ">=0.10.0" } }, + "node_modules/requires-port": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz", + "integrity": "sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ==" + }, "node_modules/resolve": { "version": "1.22.1", "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.1.tgz", @@ -6464,15 +6474,25 @@ } }, "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==", + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-4.1.3.tgz", + "integrity": "sha512-aX/y5pVRkfRnfmuX+OdbSdXvPe6ieKX/G2s7e98f4poJHnqH3281gDPm/metm6E/WRamfx7WC4HUqkWHfQHprw==", "dependencies": { - "psl": "^1.1.28", - "punycode": "^2.1.1" + "psl": "^1.1.33", + "punycode": "^2.1.1", + "universalify": "^0.2.0", + "url-parse": "^1.5.3" }, "engines": { - "node": ">=0.8" + "node": ">=6" + } + }, + "node_modules/tough-cookie/node_modules/universalify": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.2.0.tgz", + "integrity": "sha512-CJ1QgKmNg3CwvAv/kOFmtnEN05f0D/cn9QntgNOQlQF9dgvVTHj3t+8JPdjqawCHk7V/KA+fbUqzZ9XWhcqPUg==", + "engines": { + "node": ">= 4.0.0" } }, "node_modules/tslib": { @@ -6641,6 +6661,15 @@ "punycode": "^2.1.0" } }, + "node_modules/url-parse": { + "version": "1.5.10", + "resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.5.10.tgz", + "integrity": "sha512-WypcfiRhfeUP9vvF0j6rw0J3hrWrw6iZv3+22h6iRMJ/8z1Tj6XfLP4DsUix5MhMPnXpiHDoKyoZ/bdCkwBCiQ==", + "dependencies": { + "querystringify": "^2.1.1", + "requires-port": "^1.0.0" + } + }, "node_modules/url-set-query": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/url-set-query/-/url-set-query-1.0.0.tgz", @@ -11381,6 +11410,11 @@ "strict-uri-encode": "^1.0.0" } }, + "querystringify": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/querystringify/-/querystringify-2.2.0.tgz", + "integrity": "sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ==" + }, "queue": { "version": "6.0.2", "resolved": "https://registry.npmjs.org/queue/-/queue-6.0.2.tgz", @@ -11551,7 +11585,7 @@ "performance-now": "^2.1.0", "qs": "~6.5.2", "safe-buffer": "^5.1.2", - "tough-cookie": "~2.5.0", + "tough-cookie": "4.1.3", "tunnel-agent": "^0.6.0", "uuid": "^3.3.2" }, @@ -11573,6 +11607,11 @@ "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==" }, + "requires-port": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz", + "integrity": "sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ==" + }, "resolve": { "version": "1.22.1", "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.1.tgz", @@ -12049,12 +12088,21 @@ "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==" }, "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==", + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-4.1.3.tgz", + "integrity": "sha512-aX/y5pVRkfRnfmuX+OdbSdXvPe6ieKX/G2s7e98f4poJHnqH3281gDPm/metm6E/WRamfx7WC4HUqkWHfQHprw==", "requires": { - "psl": "^1.1.28", - "punycode": "^2.1.1" + "psl": "^1.1.33", + "punycode": "^2.1.1", + "universalify": "^0.2.0", + "url-parse": "^1.5.3" + }, + "dependencies": { + "universalify": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.2.0.tgz", + "integrity": "sha512-CJ1QgKmNg3CwvAv/kOFmtnEN05f0D/cn9QntgNOQlQF9dgvVTHj3t+8JPdjqawCHk7V/KA+fbUqzZ9XWhcqPUg==" + } } }, "tslib": { @@ -12174,6 +12222,15 @@ "punycode": "^2.1.0" } }, + "url-parse": { + "version": "1.5.10", + "resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.5.10.tgz", + "integrity": "sha512-WypcfiRhfeUP9vvF0j6rw0J3hrWrw6iZv3+22h6iRMJ/8z1Tj6XfLP4DsUix5MhMPnXpiHDoKyoZ/bdCkwBCiQ==", + "requires": { + "querystringify": "^2.1.1", + "requires-port": "^1.0.0" + } + }, "url-set-query": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/url-set-query/-/url-set-query-1.0.0.tgz", diff --git a/cli/package.json b/cli/package.json index a4f1824bd..4da6df3f8 100644 --- a/cli/package.json +++ b/cli/package.json @@ -38,6 +38,9 @@ "overrides": { "swarm-js": { "got": "11.8.5" + }, + "request": { + "tough-cookie": "4.1.3" } }, "repository": { diff --git a/common-files/package-lock.json b/common-files/package-lock.json index 28ae1bf04..88c94ba81 100644 --- a/common-files/package-lock.json +++ b/common-files/package-lock.json @@ -4125,6 +4125,11 @@ "node": ">=0.10.0" } }, + "node_modules/querystringify": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/querystringify/-/querystringify-2.2.0.tgz", + "integrity": "sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ==" + }, "node_modules/queue": { "version": "6.0.2", "resolved": "https://registry.npmjs.org/queue/-/queue-6.0.2.tgz", @@ -4294,6 +4299,11 @@ "node": ">=0.10.0" } }, + "node_modules/requires-port": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz", + "integrity": "sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ==" + }, "node_modules/resolve-alpn": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/resolve-alpn/-/resolve-alpn-1.2.1.tgz", @@ -4951,15 +4961,25 @@ } }, "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==", + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-4.1.3.tgz", + "integrity": "sha512-aX/y5pVRkfRnfmuX+OdbSdXvPe6ieKX/G2s7e98f4poJHnqH3281gDPm/metm6E/WRamfx7WC4HUqkWHfQHprw==", "dependencies": { - "psl": "^1.1.28", - "punycode": "^2.1.1" + "psl": "^1.1.33", + "punycode": "^2.1.1", + "universalify": "^0.2.0", + "url-parse": "^1.5.3" }, "engines": { - "node": ">=0.8" + "node": ">=6" + } + }, + "node_modules/tough-cookie/node_modules/universalify": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.2.0.tgz", + "integrity": "sha512-CJ1QgKmNg3CwvAv/kOFmtnEN05f0D/cn9QntgNOQlQF9dgvVTHj3t+8JPdjqawCHk7V/KA+fbUqzZ9XWhcqPUg==", + "engines": { + "node": ">= 4.0.0" } }, "node_modules/tr46": { @@ -5071,6 +5091,15 @@ "punycode": "^2.1.0" } }, + "node_modules/url-parse": { + "version": "1.5.10", + "resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.5.10.tgz", + "integrity": "sha512-WypcfiRhfeUP9vvF0j6rw0J3hrWrw6iZv3+22h6iRMJ/8z1Tj6XfLP4DsUix5MhMPnXpiHDoKyoZ/bdCkwBCiQ==", + "dependencies": { + "querystringify": "^2.1.1", + "requires-port": "^1.0.0" + } + }, "node_modules/url-set-query": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/url-set-query/-/url-set-query-1.0.0.tgz", @@ -8943,6 +8972,11 @@ "strict-uri-encode": "^1.0.0" } }, + "querystringify": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/querystringify/-/querystringify-2.2.0.tgz", + "integrity": "sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ==" + }, "queue": { "version": "6.0.2", "resolved": "https://registry.npmjs.org/queue/-/queue-6.0.2.tgz", @@ -9050,7 +9084,7 @@ "performance-now": "^2.1.0", "qs": "~6.5.2", "safe-buffer": "^5.1.2", - "tough-cookie": "~2.5.0", + "tough-cookie": "4.1.3", "tunnel-agent": "^0.6.0", "uuid": "^3.3.2" }, @@ -9073,6 +9107,11 @@ "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==", "dev": true }, + "requires-port": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz", + "integrity": "sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ==" + }, "resolve-alpn": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/resolve-alpn/-/resolve-alpn-1.2.1.tgz", @@ -9576,12 +9615,21 @@ "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==" }, "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==", + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-4.1.3.tgz", + "integrity": "sha512-aX/y5pVRkfRnfmuX+OdbSdXvPe6ieKX/G2s7e98f4poJHnqH3281gDPm/metm6E/WRamfx7WC4HUqkWHfQHprw==", "requires": { - "psl": "^1.1.28", - "punycode": "^2.1.1" + "psl": "^1.1.33", + "punycode": "^2.1.1", + "universalify": "^0.2.0", + "url-parse": "^1.5.3" + }, + "dependencies": { + "universalify": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.2.0.tgz", + "integrity": "sha512-CJ1QgKmNg3CwvAv/kOFmtnEN05f0D/cn9QntgNOQlQF9dgvVTHj3t+8JPdjqawCHk7V/KA+fbUqzZ9XWhcqPUg==" + } } }, "tr46": { @@ -9672,6 +9720,15 @@ "punycode": "^2.1.0" } }, + "url-parse": { + "version": "1.5.10", + "resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.5.10.tgz", + "integrity": "sha512-WypcfiRhfeUP9vvF0j6rw0J3hrWrw6iZv3+22h6iRMJ/8z1Tj6XfLP4DsUix5MhMPnXpiHDoKyoZ/bdCkwBCiQ==", + "requires": { + "querystringify": "^2.1.1", + "requires-port": "^1.0.0" + } + }, "url-set-query": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/url-set-query/-/url-set-query-1.0.0.tgz", diff --git a/common-files/package.json b/common-files/package.json index 513629437..d4dbe5833 100644 --- a/common-files/package.json +++ b/common-files/package.json @@ -32,6 +32,9 @@ "overrides": { "swarm-js": { "got": "11.8.5" + }, + "request": { + "tough-cookie": "4.1.3" } } } diff --git a/config/default.js b/config/default.js index 6d4d619d5..621ceb19e 100644 --- a/config/default.js +++ b/config/default.js @@ -299,6 +299,52 @@ module.exports = { PROPOSER_KEY: process.env.PROPOSER_KEY, CHALLENGER_KEY: process.env.CHALLENGER_KEY, }, + amoy: { + name: 'amoy', + chainId: 80002, + clientApiUrl: process.env.CLIENT_HOST + ? `http://${process.env.CLIENT_HOST}:${process.env.CLIENT_PORT}` + : 'http://localhost:8080', + optimistApiUrl: process.env.OPTIMIST_HOST + ? `http://${process.env.OPTIMIST_HOST}:${process.env.OPTIMIST_PORT}` + : 'http://localhost:8081', + optimistWsUrl: process.env.OPTIMIST_HOST + ? `ws://${process.env.OPTIMIST_HOST}:${process.env.OPTIMIST_WS_PORT}` + : 'ws://localhost:8082', + proposerBaseUrl: process.env.PROPOSER_HOST + ? `http://${process.env.PROPOSER_HOST}:${process.env.PROPOSER_PORT}` + : 'http://localhost:8092', + adversarialOptimistApiUrl: 'http://localhost:8088', + adversarialOptimistWsUrl: 'ws://localhost:8089', + adversarialClientApiUrl: 'http://localhost:8093', + adversarialClientWsUrl: 'ws://localhost:8094', + web3WsUrl: process.env.BLOCKCHAIN_URL, + PROPOSER_KEY: process.env.PROPOSER_KEY, + CHALLENGER_KEY: process.env.CHALLENGER_KEY, + }, + baseSepolia: { + name: 'baseSepolia', + chainId: 84532, + clientApiUrl: process.env.CLIENT_HOST + ? `http://${process.env.CLIENT_HOST}:${process.env.CLIENT_PORT}` + : 'http://localhost:8080', + optimistApiUrl: process.env.OPTIMIST_HOST + ? `http://${process.env.OPTIMIST_HOST}:${process.env.OPTIMIST_PORT}` + : 'http://localhost:8081', + optimistWsUrl: process.env.OPTIMIST_HOST + ? `ws://${process.env.OPTIMIST_HOST}:${process.env.OPTIMIST_WS_PORT}` + : 'ws://localhost:8082', + proposerBaseUrl: process.env.PROPOSER_HOST + ? `http://${process.env.PROPOSER_HOST}:${process.env.PROPOSER_PORT}` + : 'http://localhost:8092', + adversarialOptimistApiUrl: 'http://localhost:8088', + adversarialOptimistWsUrl: 'ws://localhost:8089', + adversarialClientApiUrl: 'http://localhost:8093', + adversarialClientWsUrl: 'ws://localhost:8094', + web3WsUrl: process.env.BLOCKCHAIN_URL, + PROPOSER_KEY: process.env.PROPOSER_KEY, + CHALLENGER_KEY: process.env.CHALLENGER_KEY, + }, polygonPos: { name: 'polygonPos', chainId: 137, @@ -640,6 +686,30 @@ module.exports = { amount: process.env.MATIC_RESTRICT || '1000000000000000000000', }, ], + amoy: [ + { + name: 'USDC', + address: '0xE097d6B3100777DC31B34dC2c58fB524C2e76921', + amount: process.env.USDC_RESTRICT || '1000000000', + }, + { + name: 'WMATIC', + address: '0x768fE7cDf628c214D59b4941Db59Be731cC4B0Cd', + amount: process.env.MATIC_RESTRICT || '1000000000000000000000', + }, + ], + baseSepolia: [ + { + name: 'USDC', + address: '0xE097d6B3100777DC31B34dC2c58fB524C2e76921', + amount: process.env.USDC_RESTRICT || '1000000000', + }, + { + name: 'ETH', + address: '0x768fE7cDf628c214D59b4941Db59Be731cC4B0Cd', + amount: process.env.MATIC_RESTRICT || '1000000000000000000000', + }, + ], polygonPos: [ { name: 'USDC', @@ -698,6 +768,7 @@ module.exports = { staging: getDefaultX509Params(), staging_edge: getDefaultX509Params(), mumbai: getDefaultX509Params(), + amoy: getDefaultX509Params(), mainnet: getDefaultX509Params(), localhost: getDefaultX509Params(), polygonPos: getLiveX509Params(), @@ -735,6 +806,8 @@ module.exports = { '(uint256,uint256[],bytes32,bytes32,bytes32,bytes32[],bytes32[],bytes32[2],uint256[4])', }, TIMER_CHANGE_PROPOSER_SECOND: Number(process.env.TIMER_CHANGE_PROPOSER_SECOND) || 30, + CHECK_REGISTER_PROPOSER_SECOND: Number(process.env.CHECK_REGISTER_PROPOSER_SECOND) || 10, + ENABLE_CHECK_AND_CHANGE_PROPOSER: process.env.ENABLE_CHECK_AND_CHANGE_PROPOSER || 'true', MAX_ROTATE_TIMES: Number(process.env.MAX_ROTATE_TIMES) || 2, WEBHOOK: { CALL_WEBHOOK_ON_CONFIRMATION: process.env.CALL_WEBHOOK_ON_CONFIRMATION, @@ -743,4 +816,5 @@ module.exports = { WEBHOOK_PATH: process.env.WEBHOOK_PATH, // For posting optional layer 2 transaction finalization details WEBHOOK_SIGNING_KEY: process.env.WEBHOOK_SIGNING_KEY, }, + MEMPOOL_TXS_FETCH_LIMIT: Number(process.env.MEMPOOL_TXS_FETCH_LIMIT), }; diff --git a/docker/admin.Dockerfile b/docker/admin.Dockerfile old mode 100644 new mode 100755 diff --git a/docker/anvil.Dockerfile b/docker/anvil.Dockerfile old mode 100644 new mode 100755 diff --git a/docker/challenger.Dockerfile b/docker/challenger.Dockerfile old mode 100644 new mode 100755 diff --git a/docker/circom.Dockerfile b/docker/circom.Dockerfile old mode 100644 new mode 100755 diff --git a/docker/client.Dockerfile b/docker/client.Dockerfile old mode 100644 new mode 100755 index 97ab354d6..f7e0bb1ea --- a/docker/client.Dockerfile +++ b/docker/client.Dockerfile @@ -1,4 +1,11 @@ -FROM node:18.19.1-bullseye-slim +FROM node:18.19.0-bullseye-slim + +ARG USERNAME=app_user +ARG USER_UID=1001 +ARG USER_GID=$USER_UID + +RUN groupadd --gid $USER_GID $USERNAME \ + && useradd --uid $USER_UID --gid $USER_GID -m $USERNAME # 'node-gyp' requires 'python3', 'make' and 'g++'' # entrypoint script requires 'netcat' @@ -12,17 +19,20 @@ EXPOSE 80 9229 ENTRYPOINT ["/app/docker-entrypoint.sh"] WORKDIR / -COPY common-files common-files -COPY config/default.js app/config/default.js +COPY --chown=$USERNAME common-files common-files +COPY --chown=$USERNAME config/default.js app/config/default.js WORKDIR /common-files RUN npm ci WORKDIR /app -COPY nightfall-client/src src -COPY nightfall-client/docker-entrypoint.sh nightfall-client/package.json nightfall-client/package-lock.json ./ +COPY --chown=$USERNAME nightfall-client/src src +COPY --chown=$USERNAME nightfall-client/docker-entrypoint.sh nightfall-client/package.json nightfall-client/package-lock.json ./ RUN npm ci +RUN mkdir keys && chown $USERNAME:$USERNAME keys + +USER $USERNAME -CMD ["npm", "start"] +CMD ["npm", "start"] \ No newline at end of file diff --git a/docker/deployer.Dockerfile b/docker/deployer.Dockerfile old mode 100644 new mode 100755 index ad267105e..dac9df29d --- a/docker/deployer.Dockerfile +++ b/docker/deployer.Dockerfile @@ -1,4 +1,13 @@ -FROM node:18.19.1-bullseye-slim +FROM node:18.19.0-bullseye-slim + +ARG USERNAME=app_user +ARG USER_UID=1001 +ARG USER_GID=$USER_UID + +RUN groupadd --gid $USER_GID $USERNAME \ + && useradd --uid $USER_UID --gid $USER_GID -m $USERNAME + +USER root # 'node-gyp' requires 'python3', 'make' and 'g++'' # entrypoint script requires 'netcat' @@ -7,22 +16,41 @@ RUN apt-get update \ python3 make g++ netcat-openbsd \ && rm -rf /var/lib/apt/lists/* -ENTRYPOINT ["/app/entrypoint.sh"] +# ENTRYPOINT ["/app/entrypoint.sh"] + +USER $USERNAME WORKDIR / -COPY common-files common-files + +COPY --chown=$USERNAME common-files common-files COPY config/default.js app/config/default.js WORKDIR /common-files RUN npm ci +# RUN mkdir /app +# RUN chown -R $USERNAME:$USERNAME /app +USER root WORKDIR /app -COPY nightfall-deployer/package*.json ./ -COPY nightfall-deployer/src src -COPY nightfall-deployer/contracts contracts -COPY nightfall-deployer/scripts scripts -COPY nightfall-deployer/hardhat.config.js hardhat.config.js -COPY nightfall-deployer/circuits circuits -COPY nightfall-deployer/entrypoint.sh entrypoint.sh +RUN chown -R $USERNAME:$USERNAME /app + +USER $USERNAME + +COPY --chown=$USERNAME nightfall-deployer/package*.json ./ +COPY --chown=$USERNAME nightfall-deployer/src src +COPY --chown=$USERNAME nightfall-deployer/contracts contracts +COPY --chown=$USERNAME nightfall-deployer/scripts scripts +COPY --chown=$USERNAME nightfall-deployer/hardhat.config.js hardhat.config.js +COPY --chown=$USERNAME nightfall-deployer/circuits circuits +COPY --chown=$USERNAME nightfall-deployer/entrypoint.sh entrypoint.sh + +RUN mkdir -p /app/build/contracts +RUN mkdir /app/.openzeppelin + +RUN chown -R $USERNAME:$USERNAME /app/build/contracts +RUN chown -R $USERNAME:$USERNAME /app/.openzeppelin + RUN npm ci + +ENTRYPOINT ["/app/entrypoint.sh"] diff --git a/docker/docker-compose.adversary.yml b/docker/docker-compose.adversary.yml old mode 100644 new mode 100755 diff --git a/docker/docker-compose.anvil.yml b/docker/docker-compose.anvil.yml old mode 100644 new mode 100755 diff --git a/docker/docker-compose.apps.yml b/docker/docker-compose.apps.yml old mode 100644 new mode 100755 index f10cdc4d2..b7264e4dc --- a/docker/docker-compose.apps.yml +++ b/docker/docker-compose.apps.yml @@ -11,6 +11,7 @@ services: ports: # to use with postman and etc - 8092:8092 + command: ['npm', 'run', 'dev'] environment: AUTOSTART_RETRIES: ${AUTOSTART_RETRIES:-100} BLOCKCHAIN_WS_HOST: ${BLOCKCHAIN_WS_HOST:-blockchain} @@ -32,13 +33,15 @@ services: ETH_PRIVATE_KEY: ${ETH_PRIVATE_KEY} PROPOSER_KEY: ${PROPOSER_KEY} CHALLENGER_KEY: ${CHALLENGER_KEY} + # ENABLE_CHECK_AND_CHANGE_PROPOSER: 'false' + # CHECK_REGISTER_PROPOSER_SECOND: 3600 networks: - nightfall_network volumes: - type: bind source: ../apps/proposer/src target: /app/app/src - + challenger: build: dockerfile: docker/challenger.Dockerfile diff --git a/docker/docker-compose.client.dev.yml b/docker/docker-compose.client.dev.yml old mode 100644 new mode 100755 diff --git a/docker/docker-compose.client.yml b/docker/docker-compose.client.yml old mode 100644 new mode 100755 diff --git a/docker/docker-compose.deployment.yml b/docker/docker-compose.deployment.yml old mode 100644 new mode 100755 diff --git a/docker/docker-compose.dev.yml b/docker/docker-compose.dev.yml old mode 100644 new mode 100755 index 93d6583f9..8b5798fb2 --- a/docker/docker-compose.dev.yml +++ b/docker/docker-compose.dev.yml @@ -37,6 +37,10 @@ services: ports: - 9239:9229 command: ['npm', 'run', 'dev'] + # environment: + # - CALL_WEBHOOK_ON_CONFIRMATION=true + # - WEBHOOK_PATH=http://host.docker.internal:3099/zk-tx-response + # - WEBHOOK_SIGNING_KEY=0x720117fdc01793b32217d32622916babc66350c4bb60905336ec8b29b1f16757 deployer: build: @@ -87,6 +91,8 @@ services: - type: bind source: ../config/default.js target: /app/config/default.js + # environment: + # MEMPOOL_TXS_FETCH_LIMIT: 5 ports: - 9229:9229 command: ['npm', 'run', 'dev'] diff --git a/docker/docker-compose.hardhat.yml b/docker/docker-compose.hardhat.yml old mode 100644 new mode 100755 diff --git a/docker/docker-compose.host.docker.internal.yml b/docker/docker-compose.host.docker.internal.yml old mode 100644 new mode 100755 diff --git a/docker/docker-compose.multiproposer-test.host.docker.internal.yml b/docker/docker-compose.multiproposer-test.host.docker.internal.yml old mode 100644 new mode 100755 diff --git a/docker/docker-compose.multiproposer-test.yml b/docker/docker-compose.multiproposer-test.yml old mode 100644 new mode 100755 diff --git a/docker/docker-compose.optimist.yml b/docker/docker-compose.optimist.yml old mode 100644 new mode 100755 diff --git a/docker/docker-compose.polygon-edge.yml b/docker/docker-compose.polygon-edge.yml old mode 100644 new mode 100755 diff --git a/docker/docker-compose.standalone.geth.yml b/docker/docker-compose.standalone.geth.yml old mode 100644 new mode 100755 diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml old mode 100644 new mode 100755 index 0e36cc68c..e760c71e4 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -39,7 +39,7 @@ services: environment: AUTHENTICATION_KEY: ${AUTHENTICATION_KEY} AUTOSTART_RETRIES: ${AUTOSTART_RETRIES:-600} - BLOCKCHAIN_URL: ${BLOCKCHAIN_URL} + BLOCKCHAIN_URL: ${BLOCKCHAIN_URL} BLOCKCHAIN_WS_HOST: ${BLOCKCHAIN_WS_HOST:-blockchain} BLOCKCHAIN_PORT: ${BLOCKCHAIN_PORT:-8546} CIRCOM_WORKER_HOST: ${CIRCOM_WORKER_HOST:-worker} @@ -104,7 +104,7 @@ services: USDC_RESTRICT: ${USDC_RESTRICT} UPGRADE: ${UPGRADE_CONTRACTS} WHITELISTING: ${WHITELISTING} - WETH_RESTRICT: ${WETH_RESTRICT} + WETH_RESTRICT: ${WETH_RESTRICT} hosted-utils-api-server: build: @@ -153,6 +153,7 @@ services: PROPOSER_MAX_BLOCK_PERIOD_MILIS: ${PROPOSER_MAX_BLOCK_PERIOD_MILIS:-0} USE_EXTERNAL_NODE: ${USE_EXTERNAL_NODE} WEBSOCKET_PORT: ${WEBSOCKET_PORT:-8080} + ETH_PRIVATE_KEY: ${ETH_PRIVATE_KEY} command: ['npm', 'run', 'dev'] rabbitmq: diff --git a/docker/hardhat.Dockerfile b/docker/hardhat.Dockerfile old mode 100644 new mode 100755 diff --git a/docker/hosted-utils-api-server.Dockerfile b/docker/hosted-utils-api-server.Dockerfile old mode 100644 new mode 100755 diff --git a/docker/optimist.Dockerfile b/docker/optimist.Dockerfile old mode 100644 new mode 100755 index 83e385254..80671c45a --- a/docker/optimist.Dockerfile +++ b/docker/optimist.Dockerfile @@ -1,4 +1,13 @@ -FROM node:16.17-bullseye-slim +FROM node:18.19.0-bullseye-slim + +ARG USERNAME=app_user +ARG USER_UID=1001 +ARG USER_GID=$USER_UID + +RUN groupadd --gid $USER_GID $USERNAME \ + && useradd --uid $USER_UID --gid $USER_GID -m $USERNAME + +USER root # 'node-gyp' requires 'python3', 'make' and 'g++'' # entrypoint script requires 'netcat' @@ -7,21 +16,28 @@ RUN apt-get update \ python3 make g++ netcat-openbsd \ && rm -rf /var/lib/apt/lists/* +USER $USERNAME + EXPOSE 80 8080 9229 ENTRYPOINT ["/app/docker-entrypoint.sh"] WORKDIR / -COPY common-files common-files -COPY config/default.js app/config/default.js +COPY --chown=$USERNAME common-files common-files +COPY --chown=$USERNAME config/default.js app/config/default.js WORKDIR /common-files RUN npm ci +USER root WORKDIR /app -COPY nightfall-optimist/src src -COPY nightfall-optimist/docker-entrypoint.sh nightfall-optimist/package*.json ./ +RUN chown -R $USERNAME:$USERNAME /app + +USER $USERNAME + +COPY --chown=$USERNAME nightfall-optimist/src src +COPY --chown=$USERNAME nightfall-optimist/docker-entrypoint.sh nightfall-optimist/package*.json ./ RUN npm ci -CMD ["npm", "start"] +CMD ["npm", "start"] \ No newline at end of file diff --git a/docker/optimist.standalone.Dockerfile b/docker/optimist.standalone.Dockerfile old mode 100644 new mode 100755 diff --git a/docker/proposer.Dockerfile b/docker/proposer.Dockerfile old mode 100644 new mode 100755 index badedafc1..b4ebad5c1 --- a/docker/proposer.Dockerfile +++ b/docker/proposer.Dockerfile @@ -1,4 +1,13 @@ -FROM node:16.17-bullseye-slim +FROM node:18.19.0-bullseye-slim + +ARG USERNAME=app_user +ARG USER_UID=1001 +ARG USER_GID=$USER_UID + +RUN groupadd --gid $USER_GID $USERNAME \ + && useradd --uid $USER_UID --gid $USER_GID -m $USERNAME + +USER root # 'node-gyp' requires 'python3', 'make' and 'g++'' # entrypoint script requires 'netcat' @@ -7,26 +16,35 @@ RUN apt-get update \ python3 make g++ netcat-openbsd iputils-ping\ && rm -rf /var/lib/apt/lists/* + +USER $USERNAME + # websocket port 8080 EXPOSE 8080 ENTRYPOINT ["/app/app/docker-entrypoint.sh"] WORKDIR / -COPY common-files common-files +COPY --chown=$USERNAME common-files common-files WORKDIR /common-files RUN npm ci +USER root +WORKDIR /app +RUN chown -R $USERNAME:$USERNAME /app + +USER $USERNAME + WORKDIR /app/app -COPY cli cli +COPY --chown=$USERNAME cli cli WORKDIR /app/app/cli RUN npm ci WORKDIR /app/app -COPY apps/proposer/package*.json ./ -COPY apps/proposer/src src -COPY apps/proposer/docker-entrypoint.sh docker-entrypoint.sh -COPY config config +COPY --chown=$USERNAME apps/proposer/package*.json ./ +COPY --chown=$USERNAME apps/proposer/src src +COPY --chown=$USERNAME apps/proposer/docker-entrypoint.sh docker-entrypoint.sh +COPY --chown=$USERNAME config config RUN npm ci @@ -34,4 +52,4 @@ RUN npm ci # COPY common-files/utils node_modules/common-files/utils # COPY common-files/constants node_modules/common-files/constants -CMD ["npm", "start"] +CMD ["npm", "start"] \ No newline at end of file diff --git a/docker/worker.Dockerfile b/docker/worker.Dockerfile old mode 100644 new mode 100755 index efac0c596..e00696d3c --- a/docker/worker.Dockerfile +++ b/docker/worker.Dockerfile @@ -1,33 +1,52 @@ # build circom from source for local verify FROM ghcr.io/eyblockchain/local-circom as builder +FROM node:18.19.0-bullseye-slim -FROM node:16.17-bullseye-slim +ARG USERNAME=app_user +ARG USER_UID=1001 +ARG USER_GID=$USER_UID +RUN groupadd --gid $USER_GID $USERNAME \ + && useradd --uid $USER_UID --gid $USER_GID -m $USERNAME + +USER root # 'node-gyp' requires 'python3', 'make' and 'g++'' # entrypoint script requires 'netcat' -RUN apt-get update \ - && apt-get install -y --no-install-recommends \ +RUN apt-get update \ + && apt-get install -y --no-install-recommends \ python3 make g++ netcat-openbsd \ - && rm -rf /var/lib/apt/lists/* + && rm -rf /var/lib/apt/lists/* + -EXPOSE 80 +# EXPOSE 80 ENV CIRCOM_HOME /app WORKDIR / -COPY common-files common-files + +COPY --chown=$USERNAME common-files common-files + WORKDIR /common-files + RUN npm ci WORKDIR /app -COPY config/default.js config/default.js -COPY /nightfall-deployer/circuits circuits -COPY --from=builder /app/circom/target/release/circom /app/circom -COPY ./worker/package.json ./worker/package-lock.json ./ -COPY ./worker/src ./src -COPY ./worker/start-script ./start-script -COPY ./worker/start-dev ./start-dev + +COPY config/default.js config/default.js +COPY /nightfall-deployer/circuits circuits +COPY --from=builder /app/circom/target/release/circom /app/circom +COPY ./worker/package.json ./worker/package-lock.json ./ +COPY ./worker/src ./src +COPY ./worker/start-script ./start-script +COPY ./worker/start-dev ./start-dev + +RUN mkdir /app/output + +RUN chown -R $USERNAME:$USERNAME /app/output +RUN find /app/output -type d -exec chmod 755 {} \; RUN npm ci -CMD ["npm", "start"] +USER $USERNAME + +CMD ["npm", "start"] \ No newline at end of file diff --git a/nightfall-client/package-lock.json b/nightfall-client/package-lock.json index f0268fb92..5d0a955a3 100644 --- a/nightfall-client/package-lock.json +++ b/nightfall-client/package-lock.json @@ -5593,15 +5593,25 @@ } }, "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==", + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-4.1.3.tgz", + "integrity": "sha512-aX/y5pVRkfRnfmuX+OdbSdXvPe6ieKX/G2s7e98f4poJHnqH3281gDPm/metm6E/WRamfx7WC4HUqkWHfQHprw==", "dependencies": { - "psl": "^1.1.28", - "punycode": "^2.1.1" + "psl": "^1.1.33", + "punycode": "^2.1.1", + "universalify": "^0.2.0", + "url-parse": "^1.5.3" }, "engines": { - "node": ">=0.8" + "node": ">=6" + } + }, + "node_modules/tough-cookie/node_modules/universalify": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.2.0.tgz", + "integrity": "sha512-CJ1QgKmNg3CwvAv/kOFmtnEN05f0D/cn9QntgNOQlQF9dgvVTHj3t+8JPdjqawCHk7V/KA+fbUqzZ9XWhcqPUg==", + "engines": { + "node": ">= 4.0.0" } }, "node_modules/tr46": { @@ -10298,7 +10308,7 @@ "performance-now": "^2.1.0", "qs": "~6.5.2", "safe-buffer": "^5.1.2", - "tough-cookie": "~2.5.0", + "tough-cookie": "4.1.3", "tunnel-agent": "^0.6.0", "uuid": "^3.3.2" }, @@ -10801,12 +10811,21 @@ } }, "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==", + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-4.1.3.tgz", + "integrity": "sha512-aX/y5pVRkfRnfmuX+OdbSdXvPe6ieKX/G2s7e98f4poJHnqH3281gDPm/metm6E/WRamfx7WC4HUqkWHfQHprw==", "requires": { - "psl": "^1.1.28", - "punycode": "^2.1.1" + "psl": "^1.1.33", + "punycode": "^2.1.1", + "universalify": "^0.2.0", + "url-parse": "^1.5.3" + }, + "dependencies": { + "universalify": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.2.0.tgz", + "integrity": "sha512-CJ1QgKmNg3CwvAv/kOFmtnEN05f0D/cn9QntgNOQlQF9dgvVTHj3t+8JPdjqawCHk7V/KA+fbUqzZ9XWhcqPUg==" + } } }, "tr46": { diff --git a/nightfall-client/package.json b/nightfall-client/package.json index da82c90fb..fb0d1e2ca 100644 --- a/nightfall-client/package.json +++ b/nightfall-client/package.json @@ -51,12 +51,19 @@ "verbose": true, "ignore": [ "mongodb/", - "build/" + "build/", + "keys/" ] }, "overrides": { "swarm-js": { "got": "11.8.5" + }, + "request": { + "tough-cookie": "4.1.3" + }, + "snarkjs":{ + "ejs": "3.1.9" } } } diff --git a/nightfall-client/src/app.mjs b/nightfall-client/src/app.mjs index ec8006d89..993b5ca4a 100644 --- a/nightfall-client/src/app.mjs +++ b/nightfall-client/src/app.mjs @@ -23,11 +23,12 @@ import { const app = express(); -// Add check for syncing state. If it is in syncing state, just respond 400 +// Add check for syncing state. If it is in syncing state, just respond 503 app.use((req, res, next) => { + if (req.path === '/healthcheck') return next(); + if (req.app.get('isSyncing')) { - res.sendStatus(400); - return res.status; + return res.status(503).send('Nightfall3 Client is syncing'); } return next(); }); diff --git a/nightfall-client/src/event-handlers/block-proposed.mjs b/nightfall-client/src/event-handlers/block-proposed.mjs index c88d60d53..04d0c9717 100644 --- a/nightfall-client/src/event-handlers/block-proposed.mjs +++ b/nightfall-client/src/event-handlers/block-proposed.mjs @@ -259,6 +259,7 @@ async function blockProposedEventHandler(data, syncing) { proposer: block.proposer, blockNumberL2: block.blockNumberL2, transactionHashes: block.transactionHashes, + transactionHashL1, }; logger.info({ msg: 'Calling webhook', url: WEBHOOK_PATH, data: dataToPublish }); try { diff --git a/nightfall-client/src/index.mjs b/nightfall-client/src/index.mjs index ab2252c54..66a18f470 100644 --- a/nightfall-client/src/index.mjs +++ b/nightfall-client/src/index.mjs @@ -1,13 +1,14 @@ import config from 'config'; import logger from 'common-files/utils/logger.mjs'; import mongo from 'common-files/utils/mongo.mjs'; -import { queueManager, pauseQueue, unpauseQueue } from 'common-files/utils/event-queue.mjs'; +import { queueManager, pauseQueue } from 'common-files/utils/event-queue.mjs'; import { checkContractsABI } from 'common-files/utils/sync-files.mjs'; import app from './app.mjs'; import rabbitmq from './utils/rabbitmq.mjs'; import queues from './queues/index.mjs'; import { initialClientSync } from './services/state-sync.mjs'; import { startEventQueue, eventHandlers } from './event-handlers/index.mjs'; +import { loadKeysFromPersistence } from './services/keys.mjs'; const main = async () => { // we want to have endpoints responding as soon as possible, but prevent @@ -15,7 +16,7 @@ const main = async () => { // _isSyncing that informs if client is syncing. On the other hand, // a middleware function is checking this variable. If client is still syncing, // it will just return a 400 - app.listen(80); + app.listen(process.env.CLIENT_SERVER_PORT || 80); app.set('isSyncing', true); try { if (process.env.ENABLE_QUEUE) { @@ -27,10 +28,10 @@ const main = async () => { await checkContractsABI(); await startEventQueue(queueManager, eventHandlers); await pauseQueue(0); - initialClientSync().then(() => { - app.set('isSyncing', false); - unpauseQueue(0); - }); + await loadKeysFromPersistence(); + await initialClientSync(); + app.set('isSyncing', false); + logger.info('Syncing complete, queues unpaused'); } catch (err) { logger.error(err); process.exit(1); diff --git a/nightfall-client/src/services/commitment-sync.mjs b/nightfall-client/src/services/commitment-sync.mjs index 55db6c146..2e0ff80ec 100644 --- a/nightfall-client/src/services/commitment-sync.mjs +++ b/nightfall-client/src/services/commitment-sync.mjs @@ -76,10 +76,12 @@ export async function clientCommitmentSync(zkpPrivateKey, nullifierKey) { const nonZeroCommitments = transactions[i].commitments.filter(n => n !== ZERO); // In order to check if the transaction is a transfer, we check if the compressed secrets // are different than zero. All other transaction types have compressedSecrets = [ZERO,ZERO] + // eslint-disable-next-line no-await-in-loop + const countOfCommitments = await countCommitments([nonZeroCommitments[0]]); if ( (transactions[i].compressedSecrets[0] !== ZERO || transactions[i].compressedSecrets[1] !== ZERO) && - countCommitments([nonZeroCommitments[0]]) === 0 + countOfCommitments === 0 ) decryptCommitment(transactions[i], zkpPrivateKey, nullifierKey); } diff --git a/nightfall-client/src/services/keys.mjs b/nightfall-client/src/services/keys.mjs index 7ec45778b..89bf0fe6d 100644 --- a/nightfall-client/src/services/keys.mjs +++ b/nightfall-client/src/services/keys.mjs @@ -1,19 +1,26 @@ +/* eslint-disable no-await-in-loop */ import { GN, generalise } from 'general-number'; import poseidon from 'common-files/utils/crypto/poseidon/poseidon.mjs'; import bip39Pkg from 'bip39'; import pkg from 'ethereumjs-wallet'; +import fs from 'fs'; import { scalarMult, edwardsCompress, edwardsDecompress, } from 'common-files/utils/curve-maths/curves.mjs'; import constants from 'common-files/constants/index.mjs'; +import logger from 'common-files/utils/logger.mjs'; +import path from 'path'; +// eslint-disable-next-line import/no-extraneous-dependencies +import { createHash } from 'crypto'; const { hdkey } = pkg; const { validateMnemonic, mnemonicToSeedSync } = bip39Pkg; export const zkpPrivateKeys = []; export const nullifierKeys = []; const { BABYJUBJUB, BN128_GROUP_ORDER } = constants; +const KEY_BACKUP_FILE_PATH = '/app/keys'; export class ZkpKeys { rootKey; @@ -105,11 +112,85 @@ export class ZkpKeys { } } -export function storeMemoryKeysForDecryption(zkpPrivateKey, nullifierKey) { - return Promise.all([ - zkpPrivateKeys.includes(zkpPrivateKey[0]) - ? zkpPrivateKeys - : zkpPrivateKeys.push(...zkpPrivateKey), - nullifierKeys.includes(nullifierKey[0]) ? nullifierKey : nullifierKeys.push(...nullifierKey), - ]); +async function isValidPath(filename) { + try { + logger.info(`Validating if filepath ${filename} exists...`); + await fs.promises.access(filename); + logger.info(`Filepath ${filename} exists`); + return true; + } catch (error) { + logger.error(error); + logger.error(`Non-Fatal Error: Filepath ${filename} does not exist`); + return false; + } +} + +export async function addKeysToPersistence(_zkpPrivateKeys, _nullifierKeys) { + const stringifiedZkpPrivateKeys = _zkpPrivateKeys.map(zkpPrivateKey => zkpPrivateKey.toString()); + const stringifiedNullifierKeys = _nullifierKeys.map(nullifierKey => nullifierKey.toString()); + + const fileContent = JSON.stringify([stringifiedZkpPrivateKeys, stringifiedNullifierKeys]); + const fileNameHash = `${createHash('sha256').update(fileContent).digest('hex')}.json`; + logger.info(`New filename: ${fileNameHash}`); + + await fs.promises.writeFile(path.join(KEY_BACKUP_FILE_PATH, fileNameHash), fileContent); +} + +export async function storeMemoryKeysForDecryption( + _zkpPrivateKeys, + _nullifierKeys, + persist = true, +) { + if (!zkpPrivateKeys.includes(_zkpPrivateKeys[0])) { + zkpPrivateKeys.push(..._zkpPrivateKeys); + } + + if (!nullifierKeys.includes(_nullifierKeys[0])) { + nullifierKeys.push(..._nullifierKeys); + } + + if (persist) { + logger.info(`Attempting to persist key to backup`); + await addKeysToPersistence(_zkpPrivateKeys, _nullifierKeys); + } +} + +/** + * This method is intended to "restore" any viewing keys that are lost during a restart of the client. + */ +export async function loadKeysFromPersistence() { + try { + if (await isValidPath(KEY_BACKUP_FILE_PATH)) { + logger.info(`Reading viewing keys from backup`); + const allFiles = await fs.promises.readdir(KEY_BACKUP_FILE_PATH); + + const jsonFiles = allFiles.filter(file => path.extname(file) === '.json'); + + for (const file of jsonFiles) { + logger.info(`Restoring keys from ${file}`); + const fileContent = await fs.promises.readFile( + path.join(KEY_BACKUP_FILE_PATH, file), + 'utf-8', + ); + const parsedFileContent = JSON.parse(fileContent); + + const _zkpPrivateKeys = parsedFileContent[0].map(zkpPrivateKey => BigInt(zkpPrivateKey)); + const _nullifierKeys = parsedFileContent[1].map(nullifierKey => BigInt(nullifierKey)); + + await storeMemoryKeysForDecryption(_zkpPrivateKeys, _nullifierKeys, false); + } + + logger.info(`Viewing keys restored`); + } + } catch (error) { + logger.error(`loadKeysFromPersistence: ${error}`); + throw error; + } +} + +export function getCurrentKeys() { + return { + zkpPrivateKeys, + nullifierKeys, + }; } diff --git a/nightfall-client/src/services/state-sync.mjs b/nightfall-client/src/services/state-sync.mjs index 48421beb3..8ee813f38 100644 --- a/nightfall-client/src/services/state-sync.mjs +++ b/nightfall-client/src/services/state-sync.mjs @@ -67,20 +67,18 @@ const genGetCommitments = async (query = {}, proj = {}) => { // eslint-disable-next-line import/prefer-default-export export const initialClientSync = async () => { - const allCommitments = await genGetCommitments(); - const commitmentBlockNumbers = allCommitments.map(a => a.blockNumber).filter(n => n >= 0); - - logger.info(`commitmentBlockNumbers: ${commitmentBlockNumbers}`); - - const firstSeenBlockNumber = Math.min(...commitmentBlockNumbers); - - logger.info(`firstSeenBlockNumber: ${firstSeenBlockNumber}`); - - // fistSeenBlockNumber can be infinity if the commitmentBlockNumbers array is empty - if (firstSeenBlockNumber === Infinity) { + const allCommitments = await genGetCommitments({ isOnChain: { $ne: '-1' } }); + if (allCommitments?.length < 1) { + logger.info(`No existing commitments to sync, starting from L1 block ${STATE_GENESIS_BLOCK}`); await syncState(STATE_GENESIS_BLOCK); } else { - await syncState(firstSeenBlockNumber); + const commitmentBlockNumbers = allCommitments.map(a => a.blockNumber).filter(n => n >= 0); + logger.info(`commitmentBlockNumbers: ${commitmentBlockNumbers}`); + + const lastProcessedBlockNumber = Math.max(...commitmentBlockNumbers); + logger.info(`lastProcessedBlockNumber: ${lastProcessedBlockNumber}`); + + await syncState(lastProcessedBlockNumber); } unpauseQueue(0); // the queues are paused to start with, so get them going once we are synced diff --git a/nightfall-deployer/contracts/Proposers.sol b/nightfall-deployer/contracts/Proposers.sol index ffb68aff4..b4ce2bd5f 100644 --- a/nightfall-deployer/contracts/Proposers.sol +++ b/nightfall-deployer/contracts/Proposers.sol @@ -21,10 +21,12 @@ contract Proposers is Stateful, Config, ReentrancyGuardUpgradeable, Certified { /** @dev register proposer with stake */ - function registerProposer( - string calldata url, - uint256 fee - ) external payable nonReentrant onlyCertified { + function registerProposer(string calldata url, uint256 fee) + external + payable + nonReentrant + onlyCertified + { require( state.numProposers() < maxProposers, 'Proposers: Max number of registered proposers' @@ -118,10 +120,12 @@ contract Proposers is Stateful, Config, ReentrancyGuardUpgradeable, Certified { } // Proposers can change REST API URL or increment stake - function updateProposer( - string calldata url, - uint256 fee - ) external payable nonReentrant onlyCertified { + function updateProposer(string calldata url, uint256 fee) + external + payable + nonReentrant + onlyCertified + { require( state.getProposer(msg.sender).thisAddress != address(0), 'Proposers: This proposer is not registered or you are not that proposer' diff --git a/nightfall-deployer/hardhat.config.js b/nightfall-deployer/hardhat.config.js index a96677a39..492623513 100644 --- a/nightfall-deployer/hardhat.config.js +++ b/nightfall-deployer/hardhat.config.js @@ -72,6 +72,24 @@ module.exports = { gas: config.WEB3_OPTIONS.gas, }, + amoy: { + url: toHttpUrl(config.BLOCKCHAIN_URL), + accounts: [config.ETH_PRIVATE_KEY], + chainId: 80002, + timeout: 1000000000, + gasMultiplier: 2, + gas: config.WEB3_OPTIONS.gas, + }, + + baseSepolia: { + url: toHttpUrl(config.BLOCKCHAIN_URL), + accounts: [config.ETH_PRIVATE_KEY], + chainId: 84532, + timeout: 1000000000, + gasMultiplier: 2, + gas: config.WEB3_OPTIONS.gas, + }, + polygonPos: { url: toHttpUrl(config.BLOCKCHAIN_URL), accounts: [config.ETH_PRIVATE_KEY], diff --git a/nightfall-optimist/src/index.mjs b/nightfall-optimist/src/index.mjs index 30118ba18..2a0cf3702 100644 --- a/nightfall-optimist/src/index.mjs +++ b/nightfall-optimist/src/index.mjs @@ -54,7 +54,7 @@ const main = async () => { // try to sync any missing blockchain state (event queues will be paused until this finishes) initialBlockSync(proposer); - app.listen(80); + app.listen(process.env.OPTIMIST_SERVER_PORT || 80); } catch (err) { logger.error(err); process.exit(1); diff --git a/nightfall-optimist/src/routes/debug.mjs b/nightfall-optimist/src/routes/debug.mjs index 946f4c943..9c7275ad3 100644 --- a/nightfall-optimist/src/routes/debug.mjs +++ b/nightfall-optimist/src/routes/debug.mjs @@ -1,5 +1,7 @@ import express from 'express'; +import logger from 'common-files/utils/logger.mjs'; import { getDebugCounters } from '../services/debug-counters.mjs'; +import { setEnableHeartBeatLogging } from '../services/block-assembler.mjs'; const router = express.Router(); @@ -12,4 +14,16 @@ router.get('/counters', async (req, res, next) => { } }); +router.post('/toggle-heartbeat-logging', async (req, res, next) => { + const heartBeatLogging = req?.body?.heartBeatLogging === 'true' || false; + + try { + logger.info(`Setting heartbeat logging to ${heartBeatLogging}`); + setEnableHeartBeatLogging(heartBeatLogging); + res.sendStatus(200); + } catch (err) { + next(err); + } +}); + export default router; diff --git a/nightfall-optimist/src/services/block-assembler.mjs b/nightfall-optimist/src/services/block-assembler.mjs index 677085ac3..78c6690a3 100644 --- a/nightfall-optimist/src/services/block-assembler.mjs +++ b/nightfall-optimist/src/services/block-assembler.mjs @@ -19,11 +19,17 @@ import { increaseProposerBlockNotSent, } from './debug-counters.mjs'; -const { MAX_BLOCK_SIZE, MINIMUM_TRANSACTION_SLOTS, PROPOSER_MAX_BLOCK_PERIOD_MILIS } = config; +const { + MAX_BLOCK_SIZE, + MINIMUM_TRANSACTION_SLOTS, + PROPOSER_MAX_BLOCK_PERIOD_MILIS, + MEMPOOL_TXS_FETCH_LIMIT, +} = config; const { STATE_CONTRACT_NAME } = constants; let ws; let makeNow = false; +let enableHeartBeatLogging = true; let lastBlockTimestamp = new Date().getTime(); let blockPeriodMs = PROPOSER_MAX_BLOCK_PERIOD_MILIS; @@ -39,6 +45,10 @@ export function setBlockPeriodMs(timeMs) { blockPeriodMs = timeMs; } +export function setEnableHeartBeatLogging(flagValue) { + enableHeartBeatLogging = flagValue; +} + /** Function to indicate to a listening proposer that a rollback has been completed. This is of little use at the moment but will enable the proposer to take actions such as @@ -79,16 +89,19 @@ export async function conditionalMakeBlock(proposer) { transaction. If not, we must wait until either we have enough (hooray) or we're no-longer the proposer (boo). */ - - logger.info(`I am the current proposer: ${proposer.isMe}`); + if (enableHeartBeatLogging) { + logger.info(`Current proposer: ${proposer.address} is me: ${proposer.isMe}`); + } if (proposer.isMe) { - logger.info({ - msg: 'The maximum size of the block is', - blockSize: MAX_BLOCK_SIZE, - blockPeriodMs, - makeNow, - }); + if (enableHeartBeatLogging) { + logger.info({ + msg: 'The maximum size of the block is', + blockSize: MAX_BLOCK_SIZE, + blockPeriodMs, + makeNow, + }); + } // Get all the mempool transactions sorted by fee const mempoolTransactions = await getMempoolTransactionsSortedByFee(); @@ -108,11 +121,17 @@ export async function conditionalMakeBlock(proposer) { const totalBytes = mempoolTransactionSizes.reduce((acc, curr) => acc + curr, 0); const currentTime = new Date().getTime(); - logger.info({ - msg: 'In the mempool there are the following number of transactions', - numberTransactions: mempoolTransactions.length, - totalBytes, - }); + if (enableHeartBeatLogging) { + let hbMsg = 'In the mempool there are the following number of transactions'; + if (MEMPOOL_TXS_FETCH_LIMIT) { + hbMsg = 'In this throttled mempool batch there are the following number of transactions'; + } + logger.info({ + msg: hbMsg, + numberTransactions: mempoolTransactions.length, + totalBytes, + }); + } const transactionBatches = []; if (totalBytes > 0) { @@ -134,10 +153,12 @@ export async function conditionalMakeBlock(proposer) { } } - logger.info({ - msg: 'The proposer can create the following number of blocks', - transactionBatches: transactionBatches.length, - }); + if (enableHeartBeatLogging) { + logger.info({ + msg: 'The proposer can create the following number of blocks', + transactionBatches: transactionBatches.length, + }); + } if (transactionBatches.length >= 1) { lastBlockTimestamp = currentTime; diff --git a/nightfall-optimist/src/services/database.mjs b/nightfall-optimist/src/services/database.mjs index 5b3ebaa1c..bfa2f4761 100644 --- a/nightfall-optimist/src/services/database.mjs +++ b/nightfall-optimist/src/services/database.mjs @@ -22,6 +22,7 @@ const { TIMBER_COLLECTION, TIMBER_HEIGHT, HASH_TYPE, + MEMPOOL_TXS_FETCH_LIMIT, } = config; /** @@ -370,11 +371,17 @@ export async function getMempoolTransactions() { export async function getMempoolTransactionsSortedByFee() { const connection = await mongo.connection(MONGO_URL); const db = connection.db(OPTIMIST_DB); - return db + let query = db .collection(TRANSACTIONS_COLLECTION) .find({ mempool: true }, { _id: 0 }) - .sort({ fee: -1 }) - .toArray(); + .sort({ fee: -1 }); + + if (MEMPOOL_TXS_FETCH_LIMIT) { + logger.info(`Throttling enabled for pending mempool transactions: ${MEMPOOL_TXS_FETCH_LIMIT}`); + query = query.limit(MEMPOOL_TXS_FETCH_LIMIT); + } + + return query.toArray(); } /** diff --git a/worker/src/index.mjs b/worker/src/index.mjs index b7c7257b0..5be609417 100644 --- a/worker/src/index.mjs +++ b/worker/src/index.mjs @@ -15,7 +15,7 @@ const main = async () => { queues(); } - app.listen(80); + app.listen(process.env.WORKER_PORT || 80); } catch (err) { logger.error(err); process.exit(1);