Skip to content

Commit 3086047

Browse files
authored
Merge pull request #337 from sc-forks/upgrade/testrpc-sc
Upgrade testrpc-sc to 6.4.5
2 parents b54b8ed + 58ffad8 commit 3086047

File tree

7 files changed

+1026
-2130
lines changed

7 files changed

+1026
-2130
lines changed

.circleci/config.yml

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,7 @@ jobs:
3838
# command: |
3939
# ./scripts/run-colony.sh
4040

41-
# It would be nice if all this could be a shell script but Circle is
42-
# extremely annoying about
43-
# a) cacheing
44-
# b) sudo
45-
# c) scripts
46-
# d) being in a docker container.
41+
# It would be nice if all this could be a shell script... :/
4742
e2e-zeppelin:
4843
docker:
4944
- image: circleci/node:10.12-stretch
@@ -55,15 +50,35 @@ jobs:
5550
sudo git clone https://github.com/OpenZeppelin/openzeppelin-solidity.git &&
5651
cd openzeppelin-solidity &&
5752
sudo sed -i 's/cat coverage\/lcov.info | npx coveralls/echo "No coveralls"/g' scripts/test.sh &&
53+
sudo sed -i 's/ganache-cli-coverage/testrpc-sc/g' scripts/test.sh &&
54+
sudo sed -i 's/--emitFreeLogs true/ /g' scripts/test.sh &&
5855
sudo yarn &&
5956
sudo yarn remove solidity-coverage --dev &&
6057
sudo yarn add "$PR_PATH" --dev &&
6158
sudo npm run coverage
6259
60+
# AND...this doesn't work either! Thanks to truffle "obtain" and circle permission denied.
61+
e2e-metacoin:
62+
docker:
63+
- image: circleci/node:10.12-stretch
64+
steps:
65+
- checkout
66+
- run: >
67+
sudo npm config set user 0 &&
68+
sudo npm config set unsafe-perm true &&
69+
sudo rm -rf node_modules &&
70+
PR_PATH=$(echo "$CIRCLE_REPOSITORY_URL#$CIRCLE_BRANCH" | sudo sed 's/git@github.com:/https:\/\/github.com\//') &&
71+
sudo mkdir metacoin &&
72+
cd metacoin &&
73+
sudo npx truffle unbox metacoin &&
74+
sudo rm test/TestMetacoin.sol &&
75+
sudo yarn add $PR_PATH --dev &&
76+
sudo npx solidity-coverage
6377
workflows:
6478
version: 2
6579
build:
6680
jobs:
6781
- unit-test
6882
- e2e-zeppelin
83+
- e2e-metacoin
6984
#- e2e-colony

lib/app.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -207,12 +207,11 @@ class App {
207207
return new Promise((resolve, reject) => {
208208
if (!this.norpc) {
209209
const defaultRpcOptions = `--accounts ${this.accounts} --port ${this.port}`;
210-
const options = (this.testrpcOptions || defaultRpcOptions) + ` --gasLimit ${gasLimitHex} --allowUnlimitedContractSize`;
211-
const command = require.resolve('ethereumjs-testrpc-sc/cli.js');
210+
const options = (this.testrpcOptions || defaultRpcOptions) + ` --gasLimit ${gasLimitHex}`;
212211

213212
// Launch
214213
const execOpts = {maxBuffer: 1024 * 1024 * 100};
215-
this.testrpcProcess = childprocess.exec(`node ${command} ${options}`, execOpts, (err, stdout, stderr) => {
214+
this.testrpcProcess = childprocess.exec(`npx testrpc-sc ${options}`, execOpts, (err, stdout, stderr) => {
216215
if (err) {
217216
if (stdout) this.log(`testRpc stdout:\n${stdout}`);
218217
if (stderr) this.log(`testRpc stderr:\n${stderr}`);

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,15 @@
2121
"license": "ISC",
2222
"dependencies": {
2323
"death": "^1.1.0",
24-
"ethereumjs-testrpc-sc": "6.4.1",
24+
"ethereumjs-testrpc-sc": "6.4.5-sc.2",
2525
"istanbul": "^0.4.5",
2626
"keccakjs": "^0.2.1",
2727
"req-cwd": "^1.0.1",
2828
"shelljs": "https://github.com/sc-forks/shelljs.git",
2929
"sol-explore": "^1.6.2",
30-
"solidity-parser-antlr": "^0.4.1",
30+
"solidity-parser-antlr": "0.4.5",
3131
"tree-kill": "^1.2.0",
32-
"web3": "^1.0.0-beta.50",
32+
"web3": "1.0.0-beta.50",
3333
"web3-eth-abi": "1.0.0-beta.50"
3434
},
3535
"devDependencies": {
@@ -42,6 +42,6 @@
4242
"mocha": "^4.1.0",
4343
"request": "^2.88.0",
4444
"solc": "^0.5.3",
45-
"truffle": "^5.0.0"
45+
"truffle": "^5.0.26"
4646
}
4747
}

test/app.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ describe('app', () => {
2828
};
2929

3030
before(done => {
31-
const command = `./node_modules/.bin/testrpc-sc --allowUnlimitedContractSize --gasLimit 0xfffffffffff --port ${port}`;
31+
const command = `npx testrpc-sc --gasLimit 0xfffffffffff --port ${port}`;
3232
testrpcProcess = childprocess.exec(command);
3333

3434
testrpcProcess.stdout.on('data', data => {
@@ -153,15 +153,14 @@ describe('app', () => {
153153
coverage: {
154154
host: "localhost",
155155
port: 8999,
156-
network_id: "*"
156+
network_id: "*",
157+
gas: 0xfffffffffff,
158+
gasPrice: 0x01
157159
}
158160
},
159161
compilers: {
160162
solc: {
161163
version: "0.5.3",
162-
settings: {
163-
evmVersion: "constantinople"
164-
}
165164
}
166165
}
167166
};`;

test/sources/zeppelin

Lines changed: 0 additions & 1 deletion
This file was deleted.

test/util/mockTruffle.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ module.exports.install = function install(
3737
) {
3838
const configjs = `module.exports = ${JSON.stringify(config)}`;
3939
const contractLocation = `./${contract}`;
40-
const trufflejsName = _trufflejsName || 'truffle.js';
40+
const trufflejsName = _trufflejsName || 'truffle-config.js';
4141

4242
// Mock migrations
4343
const initialMigration = `
@@ -55,7 +55,7 @@ module.exports.install = function install(
5555
// Mock external asset
5656
const asset = 'module.exports = { value: true };';
5757

58-
// Mock truffle.js
58+
// Mock truffle-config.js
5959
const trufflejs = _trufflejs || defaultTruffleJs;
6060

6161
// Generate mock
@@ -126,12 +126,12 @@ module.exports.installInheritanceTest = function installInheritanceTest(config)
126126
// Mock test
127127
shell.cp('./test/cli/inheritance.js', './mock/test/inheritance.js');
128128

129-
// Mock truffle.js
129+
// Mock truffle-config.js
130130
const trufflejs = defaultTruffleJs;
131131

132132
const configjs = `module.exports = ${JSON.stringify(config)}`;
133133

134-
fs.writeFileSync('./mock/truffle.js', trufflejs);
134+
fs.writeFileSync('./mock/truffle-config.js', trufflejs);
135135
fs.writeFileSync('./.solcover.js', configjs);
136136
};
137137

@@ -177,7 +177,7 @@ module.exports.installLibraryTest = function installInheritanceTest(config) {
177177
shell.cp('./test/sources/cli/CLibrary.sol', './mock/assets/CLibrary.sol');
178178
shell.cp('./test/sources/cli/Face.sol', './mock/assets/Face.sol');
179179

180-
// Mock truffle.js
180+
// Mock truffle-config.js
181181
const trufflejs = defaultTruffleJs;
182182

183183
const configjs = `module.exports = ${JSON.stringify(config)}`;

0 commit comments

Comments
 (0)