Skip to content

Commit 2173a79

Browse files
author
justin j. moses
authored
Upgrading truffle, fixing coverage and adding codecov.io (Synthetixio#452)
1 parent 87f2f76 commit 2173a79

File tree

8 files changed

+3031
-3961
lines changed

8 files changed

+3031
-3961
lines changed

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,5 @@ keys.json
2929
.vscode/launch.json
3030

3131
.DS_Store
32-
32+
coverage.json
33+
coverage

.solcover.js

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
module.exports = {
2+
port: 8545,
3+
skipFiles: ['test-helpers/PublicSafeDecimalMath.sol', 'test-helpers/PublicMath.sol'],
4+
client: require('ganache-cli'), // use ganache-cli version listed in dev deps
5+
providerOptions: {
6+
default_balance_ether: 10000000000000, // extra zero just in case (coverage consumes more gas)
7+
time: new Date("2019-03-06T00:00:00"),
8+
network_id: 55
9+
},
10+
mocha: {
11+
grep: "@cov-skip", // Find everything with this tag
12+
invert: true // Run the grep's inverse set.
13+
}
14+
};

.travis.yml

+5-4
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@ sudo: enabled
22
language: node_js
33
node_js:
44
- 10.16.3
5-
before_install:
6-
- npm ci
5+
env:
6+
- COVERAGE=1
7+
- GAS=1
78
script:
8-
- npm test
9-
- npx codechecks # report gas back to GitHub
9+
- if [ "$COVERAGE" = "1" ]; then npm run coverage && bash <(curl -s https://codecov.io/bash); fi
10+
- if [ "$GAS" = "1" ]; then npm ci && npm test && npx codechecks; fi

migrations/2_deploy_synthetix_system.js

+20-19
Original file line numberDiff line numberDiff line change
@@ -67,22 +67,22 @@ module.exports = async function(deployer, network, accounts) {
6767
// Math library
6868
// ----------------
6969
console.log(gray('Deploying Math library...'));
70-
deployer.link(SafeDecimalMath, MathLib);
70+
await deployer.link(SafeDecimalMath, MathLib);
7171
await deploy(MathLib, { from: deployerAccount });
7272

7373
// The PublicSafeDecimalMath contract is not used in a standalone way on mainnet, this is for testing
7474
// ----------------
7575
// Public Safe Decimal Math Library
7676
// ----------------
77-
deployer.link(SafeDecimalMath, PublicSafeDecimalMath);
77+
await deployer.link(SafeDecimalMath, PublicSafeDecimalMath);
7878
await deploy(PublicSafeDecimalMath, { from: deployerAccount });
7979

8080
// The PublicMath contract is not used in a standalone way on mainnet, this is for testing
8181
// ----------------
8282
// Public Math Library
8383
// ----------------
84-
deployer.link(SafeDecimalMath, PublicMath);
85-
deployer.link(MathLib, PublicMath);
84+
await deployer.link(SafeDecimalMath, PublicMath);
85+
await deployer.link(MathLib, PublicMath);
8686
await deploy(PublicMath, { from: deployerAccount });
8787

8888
// ----------------
@@ -95,7 +95,7 @@ module.exports = async function(deployer, network, accounts) {
9595
// Exchange Rates
9696
// ----------------
9797
console.log(gray('Deploying ExchangeRates...'));
98-
deployer.link(SafeDecimalMath, ExchangeRates);
98+
await deployer.link(SafeDecimalMath, ExchangeRates);
9999
const exchangeRates = await deploy(
100100
ExchangeRates,
101101
owner,
@@ -123,7 +123,7 @@ module.exports = async function(deployer, network, accounts) {
123123
// ----------------
124124
console.log(gray('Deploying SynthetixState...'));
125125
// constructor(address _owner, address _associatedContract)
126-
deployer.link(SafeDecimalMath, SynthetixState);
126+
await deployer.link(SafeDecimalMath, SynthetixState);
127127
const synthetixState = await deploy(SynthetixState, owner, ZERO_ADDRESS, {
128128
from: deployerAccount,
129129
});
@@ -144,19 +144,19 @@ module.exports = async function(deployer, network, accounts) {
144144
const feePoolProxy = await Proxy.new(owner, { from: deployerAccount });
145145

146146
console.log(gray('Deploying FeePoolState...'));
147-
deployer.link(SafeDecimalMath, FeePoolState);
147+
await deployer.link(SafeDecimalMath, FeePoolState);
148148
const feePoolState = await deploy(FeePoolState, owner, ZERO_ADDRESS, {
149149
from: deployerAccount,
150150
});
151151

152152
console.log(gray('Deploying FeePoolEternalStorage...'));
153-
deployer.link(SafeDecimalMath, FeePoolEternalStorage);
153+
await deployer.link(SafeDecimalMath, FeePoolEternalStorage);
154154
const feePoolEternalStorage = await deploy(FeePoolEternalStorage, owner, ZERO_ADDRESS, {
155155
from: deployerAccount,
156156
});
157157

158158
console.log(gray('Deploying FeePool...'));
159-
deployer.link(SafeDecimalMath, FeePool);
159+
await deployer.link(SafeDecimalMath, FeePool);
160160
const feePool = await deploy(
161161
FeePool,
162162
feePoolProxy.address,
@@ -198,8 +198,8 @@ module.exports = async function(deployer, network, accounts) {
198198
// ----------------
199199
console.log(gray('Deploying SupplySchedule...'));
200200
// constructor(address _owner)
201-
deployer.link(SafeDecimalMath, SupplySchedule);
202-
deployer.link(MathLib, SupplySchedule);
201+
await deployer.link(SafeDecimalMath, SupplySchedule);
202+
await deployer.link(MathLib, SupplySchedule);
203203

204204
const lastMintEvent = 0; // No mint event, weeksSinceIssuance will use inflation start date
205205
const weeksOfRewardSupply = 0;
@@ -218,7 +218,8 @@ module.exports = async function(deployer, network, accounts) {
218218
});
219219

220220
console.log(gray('Deploying Synthetix...'));
221-
deployer.link(SafeDecimalMath, Synthetix);
221+
await deployer.link(SafeDecimalMath, Synthetix);
222+
const block = await web3.eth.getBlock('latest');
222223
const synthetix = await deploy(
223224
Synthetix,
224225
synthetixProxy.address,
@@ -228,7 +229,7 @@ module.exports = async function(deployer, network, accounts) {
228229
resolver.address,
229230
{
230231
from: deployerAccount,
231-
gas: 8000000,
232+
gas: block.gasLimit,
232233
}
233234
);
234235

@@ -289,7 +290,7 @@ module.exports = async function(deployer, network, accounts) {
289290

290291
const synths = [];
291292

292-
deployer.link(SafeDecimalMath, PurgeableSynth);
293+
await deployer.link(SafeDecimalMath, PurgeableSynth);
293294

294295
for (const currencyKey of currencyKeys) {
295296
console.log(gray(`Deploying SynthTokenState for ${currencyKey}...`));
@@ -351,7 +352,7 @@ module.exports = async function(deployer, network, accounts) {
351352
// Depot
352353
// --------------------
353354
console.log(gray('Deploying Depot...'));
354-
deployer.link(SafeDecimalMath, Depot);
355+
await deployer.link(SafeDecimalMath, Depot);
355356
const depot = await deploy(Depot, owner, fundsWallet, resolver.address, {
356357
from: deployerAccount,
357358
});
@@ -363,7 +364,7 @@ module.exports = async function(deployer, network, accounts) {
363364
// Needs the SynthsETH & SynthsUSD in the address resolver
364365
const sETHSynth = synths.find(synth => synth.currencyKey === 'sETH');
365366
const sUSDSynth = synths.find(synth => synth.currencyKey === 'sUSD');
366-
deployer.link(SafeDecimalMath, EtherCollateral);
367+
await deployer.link(SafeDecimalMath, EtherCollateral);
367368
const etherCollateral = await deploy(EtherCollateral, owner, resolver.address, {
368369
from: deployerAccount,
369370
});
@@ -386,7 +387,7 @@ module.exports = async function(deployer, network, accounts) {
386387
// Exchanger
387388
// ----------------
388389
console.log(gray('Deploying Exchanger...'));
389-
deployer.link(SafeDecimalMath, Exchanger);
390+
await deployer.link(SafeDecimalMath, Exchanger);
390391
const exchanger = await deploy(Exchanger, owner, resolver.address, {
391392
from: deployerAccount,
392393
});
@@ -395,7 +396,7 @@ module.exports = async function(deployer, network, accounts) {
395396
// ExchangeState
396397
// ----------------
397398
console.log(gray('Deploying ExchangeState...'));
398-
// deployer.link(SafeDecimalMath, ExchangeState);
399+
// await deployer.link(SafeDecimalMath, ExchangeState);
399400
const exchangeState = await deploy(ExchangeState, owner, exchanger.address, {
400401
from: deployerAccount,
401402
});
@@ -404,7 +405,7 @@ module.exports = async function(deployer, network, accounts) {
404405
// Issuer
405406
// ----------------
406407
console.log(gray('Deploying Issuer...'));
407-
deployer.link(SafeDecimalMath, Issuer);
408+
await deployer.link(SafeDecimalMath, Issuer);
408409
const issuer = await deploy(Issuer, owner, resolver.address, { from: deployerAccount });
409410

410411
console.log(gray('Deploying IssuanceEternalStorage...'));

0 commit comments

Comments
 (0)