From 54425ded2e207f896ada7f54c65882fbbb451f96 Mon Sep 17 00:00:00 2001 From: dankelleher Date: Sun, 20 Jan 2019 17:29:35 +0100 Subject: [PATCH] Added tenderly proxy to help debugging --- README.md | 18 ++++++++++++++- package-lock.json | 58 +++++++++++++++++++++++++++++++++++++++++++++-- package.json | 9 +++++--- truffle.js | 9 ++++++++ 4 files changed, 88 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 6098ec8..d725b99 100644 --- a/README.md +++ b/README.md @@ -53,7 +53,23 @@ The project follows the Truffle framework basic structure: All tests are running against Truffle's Ganache. We have the `docker-compose.yml` file with default setup for ganache to speed up environment setup. -See `package.json` for available testing commands. + +To run the tests: + +``` +npm test +``` + +To run the tests with the [tenderly proxy](https://github.com/Tenderly/tenderly-cli/); + +``` +// in one shell +npm run tenderly-proxy +// in another shell +NETWORK=proxy npm test +``` + +See `package.json` for other available testing commands. # Running migrations diff --git a/package-lock.json b/package-lock.json index b88f315..5c1ffdd 100644 --- a/package-lock.json +++ b/package-lock.json @@ -737,6 +737,15 @@ "safe-buffer": "^5.0.1" } }, + "block-stream": { + "version": "0.0.9", + "resolved": "https://registry.npmjs.org/block-stream/-/block-stream-0.0.9.tgz", + "integrity": "sha1-E+v+d4oDIFz+A3UUgeu0szAMEmo=", + "dev": true, + "requires": { + "inherits": "~2.0.0" + } + }, "bn.js": { "version": "4.11.8", "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.8.tgz", @@ -2588,6 +2597,18 @@ } } }, + "fstream": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/fstream/-/fstream-1.0.11.tgz", + "integrity": "sha1-XB+x8RdHcRTwYyoOtLcbPLD9MXE=", + "dev": true, + "requires": { + "graceful-fs": "^4.1.2", + "inherits": "~2.0.0", + "mkdirp": ">=0.5 0", + "rimraf": "2" + } + }, "function-bind": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", @@ -2689,6 +2710,17 @@ "pinkie-promise": "^2.0.0" } }, + "go-npm": { + "version": "0.1.9", + "resolved": "https://registry.npmjs.org/go-npm/-/go-npm-0.1.9.tgz", + "integrity": "sha1-hcExXcsFVB7GOmAjjdOePAowcE8=", + "dev": true, + "requires": { + "mkdirp": "^0.5.1", + "request": "^2.81.0", + "tar": "^2.2.1" + } + }, "graceful-fs": { "version": "4.1.11", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz", @@ -5625,6 +5657,26 @@ } } }, + "tar": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/tar/-/tar-2.2.1.tgz", + "integrity": "sha1-jk0qJWwOIYXGsYrWlK7JaLg8sdE=", + "dev": true, + "requires": { + "block-stream": "*", + "fstream": "^1.0.2", + "inherits": "2" + } + }, + "tenderly": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/tenderly/-/tenderly-0.1.4.tgz", + "integrity": "sha512-qqfDrdlnRFkphoglS8XzA1yoqx9K9MnHS3eOm13fxGBz4mBL6VDNJKM8FzFXigFnManDSzToS5ZZCngmCRI4aA==", + "dev": true, + "requires": { + "go-npm": "^0.1.9" + } + }, "text-table": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", @@ -5828,6 +5880,7 @@ "resolved": "http://registry.npmjs.org/web3/-/web3-0.20.6.tgz", "integrity": "sha1-PpcwauAk+yThCj11yIQwJWIhUSA=", "requires": { + "bignumber.js": "git+https://github.com/frozeman/bignumber.js-nolookahead.git#57692b3ecfc98bbdd6b3a516cb2353652ea49934", "crypto-js": "^3.1.4", "utf8": "^2.1.1", "xhr2": "*", @@ -5836,7 +5889,7 @@ "dependencies": { "bignumber.js": { "version": "git+https://github.com/frozeman/bignumber.js-nolookahead.git#57692b3ecfc98bbdd6b3a516cb2353652ea49934", - "from": "git+https://github.com/frozeman/bignumber.js-nolookahead.git#57692b3ecfc98bbdd6b3a516cb2353652ea49934" + "from": "git+https://github.com/frozeman/bignumber.js-nolookahead.git" } } } @@ -6054,6 +6107,7 @@ "resolved": "https://registry.npmjs.org/web3/-/web3-0.20.7.tgz", "integrity": "sha512-VU6/DSUX93d1fCzBz7WP/SGCQizO1rKZi4Px9j/3yRyfssHyFcZamMw2/sj4E8TlfMXONvZLoforR8B4bRoyTQ==", "requires": { + "bignumber.js": "git+https://github.com/frozeman/bignumber.js-nolookahead.git#57692b3ecfc98bbdd6b3a516cb2353652ea49934", "crypto-js": "^3.1.4", "utf8": "^2.1.1", "xhr2-cookies": "^1.1.0", @@ -6062,7 +6116,7 @@ "dependencies": { "bignumber.js": { "version": "git+https://github.com/frozeman/bignumber.js-nolookahead.git#57692b3ecfc98bbdd6b3a516cb2353652ea49934", - "from": "git+https://github.com/frozeman/bignumber.js-nolookahead.git#57692b3ecfc98bbdd6b3a516cb2353652ea49934" + "from": "git+https://github.com/frozeman/bignumber.js-nolookahead.git" }, "crypto-js": { "version": "3.1.8", diff --git a/package.json b/package.json index fe51718..057c577 100644 --- a/package.json +++ b/package.json @@ -12,14 +12,16 @@ "ganache-down": "docker-compose down", "build": "truffle compile && cross-env NETWORK=ganache npm run deploy-contracts", "test": "npm-run-all ganache-up test-contracts ganache-down --continue-on-error", - "test-contracts": "cross-env NODE_ENV=test truffle test --network ganache", + "test-contracts": "cross-env NODE_ENV=test truffle test --network ${NETWORK:-ganache}", "lint": "npm run solium", "solium": "solium -d contracts/", "solium-autofix": "solium -d contracts/ --fix", "predeploy-contracts": "mkdir -p ./build/contracts && find ./artifacts/deployed/ -name \\*.json -exec cp {} ./build/contracts/ \\;", "deploy-contracts": "cross-env ACCOUNT_PASSWORD=privatenet123 NODE_ENV=test truffle migrate --network ${NETWORK}", "check": "npm-run-all test lint", - "check-ci": "npm-run-all test-contracts lint" + "check-ci": "npm-run-all test-contracts lint", + "pretenderly-proxy": "npm run ganache-up", + "tenderly-proxy": "tenderly proxy --target-port 8545" }, "repository": { "type": "git", @@ -55,6 +57,7 @@ "npm-run-all": "^4.1.5", "solc": "^0.4.23", "solium": "^1.1.8", - "solium-plugin-zeppelin": "0.0.2" + "solium-plugin-zeppelin": "0.0.2", + "tenderly": "^0.1.4" } } diff --git a/truffle.js b/truffle.js index 9e62e3b..bd8c0b4 100644 --- a/truffle.js +++ b/truffle.js @@ -12,6 +12,15 @@ module.exports = { network_id: '*', // Match any network id from: '0x48089757dbc23bd8e49436247c9966ff15802978' }, + // using tenderly to improve debug and error output + proxy: { + host: 'localhost', + port: 9545, + gas: 3141592, + gasPrice: 100000000000, + network_id: '*', // Match any network id + from: '0x48089757dbc23bd8e49436247c9966ff15802978' + }, // local or CI integration testing with a privatenet node // we need to separate this from the development network due to a bug with ganache-cli // https://github.com/trufflesuite/ganache-cli/issues/405