Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to latest solc 0.5.8 #616

Merged
merged 4 commits into from
May 20, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ step_setup_global_packages: &step_setup_global_packages
step_pull_solc_docker: &step_pull_solc_docker
run:
name: "Pull solc docker image"
command: docker pull ethereum/solc:0.5.6
command: docker pull ethereum/solc:0.5.8

jobs:
lint-and-unit-test:
Expand Down
1 change: 1 addition & 0 deletions helpers/test-data-generator.js
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,7 @@ export async function setupColonyNetwork() {
export async function setupRandomColony(colonyNetwork) {
const tokenArgs = getTokenArgs();
const token = await Token.new(...tokenArgs);
await token.unlock();

const { logs } = await colonyNetwork.createColony(token.address);
const { colonyAddress } = logs[0].args;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"generate:test:contracts": "bash ./scripts/generate-test-contracts.sh",
"clean:test:contracts": "rimraf ./contracts/*Updated*.*",
"clean:contracts": "rimraf ./build/contracts/*",
"provision:token:contracts": "truffle compile && truffle compile --contracts_directory 'lib/dappsys/[!proxy][!exec]*.sol' && bash ./scripts/provision-token-contracts.sh",
"provision:token:contracts": "truffle compile && truffle compile --contracts_directory 'lib/dappsys/[!note][!stop][!proxy][!thing][!token]*.sol' && bash ./scripts/provision-token-contracts.sh",
"start:blockchain:client": "bash ./scripts/start-blockchain-client.sh",
"stop:blockchain:client": "bash ./scripts/stop-blockchain-client.sh",
"test:contracts": "npm run start:blockchain:client & truffle migrate --reset --compile-all && truffle test --network development",
Expand Down
11 changes: 7 additions & 4 deletions test-gas-costs/gasCosts.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ import {
import ReputationMinerTestWrapper from "../packages/reputation-miner/test/ReputationMinerTestWrapper";
import MaliciousReputationMinerExtraRep from "../packages/reputation-miner/test/MaliciousReputationMinerExtraRep";

const DSToken = artifacts.require("DSToken");
const Token = artifacts.require("Token");
const IColony = artifacts.require("IColony");
const IMetaColony = artifacts.require("IMetaColony");
const IColonyNetwork = artifacts.require("IColonyNetwork");
Expand Down Expand Up @@ -88,7 +88,8 @@ contract("All", function(accounts) {
await IColony.defaults({ gasPrice });

const otherTokenArgs = getTokenArgs();
otherToken = await DSToken.new(otherTokenArgs[1]);
otherToken = await Token.new(...otherTokenArgs);
await otherToken.unlock();

await fundColonyWithTokens(colony, token, INITIAL_FUNDING);
});
Expand All @@ -97,7 +98,8 @@ contract("All", function(accounts) {
describe("Gas costs", function() {
it("when working with the Colony Network", async function() {
const tokenArgs = getTokenArgs();
const colonyToken = await DSToken.new(tokenArgs[1]);
const colonyToken = await Token.new(...tokenArgs);
await colonyToken.unlock();
await colonyNetwork.createColony(colonyToken.address);
});

Expand Down Expand Up @@ -281,7 +283,8 @@ contract("All", function(accounts) {
const managerReputation = WAD.muln(100);

const tokenArgs = getTokenArgs();
const newToken = await DSToken.new(tokenArgs[1]);
const newToken = await Token.new(...tokenArgs);
await newToken.unlock();
const { logs } = await colonyNetwork.createColony(newToken.address);
const { colonyAddress } = logs[0].args;
const newColony = await IColony.at(colonyAddress);
Expand Down
8 changes: 5 additions & 3 deletions test-upgrade/colony-network-upgrade.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/* eslint-disable prefer-arrow-callback */
import { getTokenArgs } from "../helpers/test-helper";

const DSToken = artifacts.require("DSToken");
const Token = artifacts.require("Token");
const IColonyNetwork = artifacts.require("IColonyNetwork");
const EtherRouter = artifacts.require("EtherRouter");
const Resolver = artifacts.require("Resolver");
Expand All @@ -20,12 +20,14 @@ contract("ColonyNetwork contract upgrade", function() {

// Setup 2 test colonies
const tokenArgs1 = getTokenArgs();
const newToken = await DSToken.new(tokenArgs1[1]);
const newToken = await Token.new(...tokenArgs1);
await newToken.unlock();
let { logs } = await colonyNetwork.createColony(newToken.address);
colonyAddress1 = logs[0].args.colonyAddress;

const tokenArgs2 = getTokenArgs();
const newToken2 = await DSToken.new(tokenArgs2[1]);
const newToken2 = await Token.new(...tokenArgs2);
await newToken2.unlock();
({ logs } = await colonyNetwork.createColony(newToken2.address));
colonyAddress2 = logs[0].args.colonyAddress;

Expand Down
7 changes: 4 additions & 3 deletions test-upgrade/colony-upgrade.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const ColonyPayment = artifacts.require("ColonyPayment");
const ColonyFunding = artifacts.require("ColonyFunding");
const UpdatedColony = artifacts.require("UpdatedColony");
const IUpdatedColony = artifacts.require("IUpdatedColony");
const DSToken = artifacts.require("DSToken");
const Token = artifacts.require("Token");
const ContractRecovery = artifacts.require("ContractRecovery");

contract("Colony contract upgrade", accounts => {
Expand Down Expand Up @@ -43,7 +43,8 @@ contract("Colony contract upgrade", accounts => {
dueDate = await currentBlockTime();

const tokenArgs = getTokenArgs();
const colonyToken = await DSToken.new(tokenArgs[1]);
const colonyToken = await Token.new(...tokenArgs);
await colonyToken.unlock();
const { logs } = await colonyNetwork.createColony(colonyToken.address);
const { colonyAddress } = logs[0].args;
colony = await IColony.at(colonyAddress);
Expand All @@ -52,7 +53,7 @@ contract("Colony contract upgrade", accounts => {
colonyFunding = await ColonyFunding.new();
contractRecovery = await ContractRecovery.new();
const tokenAddress = await colony.getToken();
token = await DSToken.at(tokenAddress);
token = await Token.at(tokenAddress);

await makeTask({ colony, dueDate });
await makeTask({ colony, dueDate: dueDate + 1, hash: SPECIFICATION_HASH_UPDATED });
Expand Down
5 changes: 3 additions & 2 deletions test/colony-funding.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ chai.use(bnChai(web3.utils.BN));

const EtherRouter = artifacts.require("EtherRouter");
const IColonyNetwork = artifacts.require("IColonyNetwork");
const DSToken = artifacts.require("DSToken");
const Token = artifacts.require("Token");

contract("Colony Funding", accounts => {
const MANAGER = accounts[0];
Expand All @@ -51,7 +51,8 @@ contract("Colony Funding", accounts => {
await colony.setRewardInverse(100);

const otherTokenArgs = getTokenArgs();
otherToken = await DSToken.new(otherTokenArgs[0]);
otherToken = await Token.new(...otherTokenArgs);
await otherToken.unlock();
});

describe("when receiving tokens", () => {
Expand Down
14 changes: 9 additions & 5 deletions test/colony-network-auction.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const { expect } = chai;
chai.use(bnChai(web3.utils.BN));

const DutchAuction = artifacts.require("DutchAuction");
const DSToken = artifacts.require("DSToken");
const Token = artifacts.require("Token");

contract("Colony Network Auction", accounts => {
const BIDDER_1 = accounts[1];
Expand Down Expand Up @@ -42,7 +42,8 @@ contract("Colony Network Auction", accounts => {
await colonyNetwork.startNextCycle();

const args = getTokenArgs();
token = await DSToken.new(args[1]);
token = await Token.new(...args);
await token.unlock();
await token.mint(colonyNetwork.address, quantity);
const { logs, receipt } = await colonyNetwork.startTokenAuction(token.address);
createAuctionTxReceipt = receipt;
Expand Down Expand Up @@ -77,7 +78,8 @@ contract("Colony Network Auction", accounts => {

it("should fail with zero quantity", async () => {
const args = getTokenArgs();
const otherToken = await DSToken.new(args[1]);
const otherToken = await Token.new(...args);
await otherToken.unlock();
await checkErrorRevert(colonyNetwork.startTokenAuction(otherToken.address));
});

Expand All @@ -104,7 +106,8 @@ contract("Colony Network Auction", accounts => {

it("should set the minimum price correctly for quantity < 1e18", async () => {
const args = getTokenArgs();
const otherToken = await DSToken.new(args[1]);
const otherToken = await Token.new(...args);
await otherToken.unlock();
await otherToken.mint(colonyNetwork.address, WAD.divn(10));
const { logs } = await colonyNetwork.startTokenAuction(otherToken.address);
const auctionAddress = logs[0].args.auction;
Expand Down Expand Up @@ -353,7 +356,8 @@ contract("Colony Network Auction", accounts => {
let otherToken;
beforeEach(async () => {
const args = getTokenArgs();
otherToken = await DSToken.new(args[1]);
otherToken = await Token.new(...args);
await otherToken.unlock();
});

const auctionPropsLowQuantitiesLowPrice = [
Expand Down
13 changes: 7 additions & 6 deletions test/colony-network.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const ENSRegistry = artifacts.require("ENSRegistry");
const EtherRouter = artifacts.require("EtherRouter");
const Resolver = artifacts.require("Resolver");
const IColonyNetwork = artifacts.require("IColonyNetwork");
const DSToken = artifacts.require("DSToken");
const Token = artifacts.require("Token");

contract("Colony Network", accounts => {
const SAMPLE_RESOLVER = "0x65a760e7441cf435086ae45e14a0c8fc1080f54c";
Expand Down Expand Up @@ -115,7 +115,8 @@ contract("Colony Network", accounts => {
});

it("should maintain correct count of colonies", async () => {
const token = await DSToken.new(getTokenArgs()[1]);
const token = await Token.new(...getTokenArgs());
await token.unlock();
await colonyNetwork.createColony(token.address);
await colonyNetwork.createColony(token.address);
await colonyNetwork.createColony(token.address);
Expand Down Expand Up @@ -146,7 +147,7 @@ contract("Colony Network", accounts => {
});

it("should fail to create meta colony if it already exists", async () => {
const token = await DSToken.new(TOKEN_ARGS[1]);
const token = await Token.new(...TOKEN_ARGS);
await checkErrorRevert(colonyNetwork.createMetaColony(token.address), "colony-meta-colony-exists-already");
});

Expand Down Expand Up @@ -174,22 +175,22 @@ contract("Colony Network", accounts => {
});

it("should fail if ETH is sent", async () => {
const token = await DSToken.new(TOKEN_ARGS[1]);
const token = await Token.new(...TOKEN_ARGS);
await checkErrorRevert(colonyNetwork.createColony(token.address, { value: 1, gas: createColonyGas }));

const colonyNetworkBalance = await web3GetBalance(colonyNetwork.address);
expect(colonyNetworkBalance).to.be.zero;
});

it("should log a ColonyAdded event", async () => {
const token = await DSToken.new(TOKEN_ARGS[1]);
const token = await Token.new(...TOKEN_ARGS);
await expectEvent(colonyNetwork.createColony(token.address), "ColonyAdded");
});
});

describe("when getting existing colonies", () => {
it("should allow users to get the address of a colony by its index", async () => {
const token = await DSToken.new(TOKEN_ARGS[1]);
const token = await Token.new(...TOKEN_ARGS);
await colonyNetwork.createColony(token.address);
await colonyNetwork.createColony(token.address);
await colonyNetwork.createColony(token.address);
Expand Down
5 changes: 3 additions & 2 deletions test/colony-payment.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ chai.use(bnChai(web3.utils.BN));
const EtherRouter = artifacts.require("EtherRouter");
const IColonyNetwork = artifacts.require("IColonyNetwork");
const IMetaColony = artifacts.require("IMetaColony");
const DSToken = artifacts.require("DSToken");
const Token = artifacts.require("Token");

contract("Colony Payment", accounts => {
const RECIPIENT = accounts[3];
Expand All @@ -38,7 +38,8 @@ contract("Colony Payment", accounts => {
await fundColonyWithTokens(colony, token, WAD.muln(20));

const tokenArgs = getTokenArgs();
otherToken = await DSToken.new(tokenArgs[1]);
otherToken = await Token.new(...tokenArgs);
await otherToken.unlock();
});

describe("when adding payments", () => {
Expand Down
32 changes: 21 additions & 11 deletions test/colony-reward-payouts.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const IColony = artifacts.require("IColony");
const IMetaColony = artifacts.require("IMetaColony");
const IColonyNetwork = artifacts.require("IColonyNetwork");
const ITokenLocking = artifacts.require("ITokenLocking");
const DSToken = artifacts.require("DSToken");
const Token = artifacts.require("Token");
const DSRoles = artifacts.require("DSRoles");

const contractLoader = new TruffleLoader({
Expand Down Expand Up @@ -75,7 +75,8 @@ contract("Colony Reward Payouts", accounts => {
await colony.setRewardInverse(100);

const otherTokenArgs = getTokenArgs();
otherToken = await DSToken.new(otherTokenArgs[0]);
otherToken = await Token.new(...otherTokenArgs);
await otherToken.unlock();

await fundColonyWithTokens(colony, otherToken, initialFunding);
await colony.mintTokens(initialFunding.muln(100).divn(99)); // Tke in to account 1% being siphoned off for rewards
Expand Down Expand Up @@ -144,7 +145,8 @@ contract("Colony Reward Payouts", accounts => {

it("should not be able to create reward payout if passed reputation is not from the correct colony", async () => {
const tokenArgs = getTokenArgs();
const newToken = await DSToken.new(tokenArgs[1]);
const newToken = await Token.new(...tokenArgs);
await newToken.unlock();
const { logs } = await colonyNetwork.createColony(newToken.address);
const { colonyAddress } = logs[0].args;
const newColony = await IColony.at(colonyAddress);
Expand Down Expand Up @@ -262,7 +264,8 @@ contract("Colony Reward Payouts", accounts => {

it("should not be able to start a reward payout if no one holds colony tokens", async () => {
const tokenArgs = getTokenArgs();
const newToken = await DSToken.new(tokenArgs[1]);
const newToken = await Token.new(...tokenArgs);
await newToken.unlock();
const { logs } = await colonyNetwork.createColony(newToken.address);
const { colonyAddress } = logs[0].args;
const newColony = await IColony.at(colonyAddress);
Expand Down Expand Up @@ -298,7 +301,8 @@ contract("Colony Reward Payouts", accounts => {

it("should be able to collect rewards from multiple payouts of different token", async () => {
const tokenArgs = getTokenArgs();
const newToken = await DSToken.new(tokenArgs[1]);
const newToken = await Token.new(...tokenArgs);
await newToken.unlock();
await fundColonyWithTokens(colony, newToken, initialFunding);

const tx1 = await colony.startNextRewardPayout(newToken.address, ...colonyWideReputationProof);
Expand All @@ -313,7 +317,8 @@ contract("Colony Reward Payouts", accounts => {

it("should not be able to claim payout if colony-wide reputation is 0", async () => {
const tokenArgs = getTokenArgs();
const newToken = await DSToken.new(tokenArgs[1]);
const newToken = await Token.new(...tokenArgs);
await newToken.unlock();
const { logs } = await colonyNetwork.createColony(newToken.address);
const { colonyAddress } = logs[0].args;
const newColony = await IColony.at(colonyAddress);
Expand Down Expand Up @@ -456,7 +461,8 @@ contract("Colony Reward Payouts", accounts => {

it("should not be able to claim funds if previous payout is not claimed", async () => {
const tokenArgs = getTokenArgs();
const newToken = await DSToken.new(tokenArgs[1]);
const newToken = await Token.new(...tokenArgs);
await newToken.unlock();
await fundColonyWithTokens(colony, newToken, initialFunding);

await colony.startNextRewardPayout(otherToken.address, ...colonyWideReputationProof);
Expand Down Expand Up @@ -559,7 +565,8 @@ contract("Colony Reward Payouts", accounts => {
it("should be able to collect payout from two colonies at the same time", async () => {
// Setting up a new token and two colonies
const tokenArgs = getTokenArgs();
const newToken = await DSToken.new(tokenArgs[1]);
const newToken = await Token.new(...tokenArgs);
await newToken.unlock();

let { logs } = await colonyNetwork.createColony(newToken.address);
let { colonyAddress } = logs[0].args;
Expand Down Expand Up @@ -676,7 +683,8 @@ contract("Colony Reward Payouts", accounts => {
it("should not be able to claim reward payout from a colony that didn't create it", async () => {
// Setting up a new token and two colonies
const tokenArgs = getTokenArgs();
const newToken = await DSToken.new(tokenArgs[1]);
const newToken = await Token.new(...tokenArgs);
await newToken.unlock();

let { logs } = await colonyNetwork.createColony(newToken.address);
let { colonyAddress } = logs[0].args;
Expand Down Expand Up @@ -815,14 +823,16 @@ contract("Colony Reward Payouts", accounts => {
total reputation/tokens: ${data.totalReputation.toString()}`, async () => {
// Setting up a new token and colony
const tokenArgs = getTokenArgs();
const newToken = await DSToken.new(tokenArgs[1]);
const newToken = await Token.new(...tokenArgs);
await newToken.unlock();
let { logs } = await colonyNetwork.createColony(newToken.address);
const { colonyAddress } = logs[0].args;
await newToken.setOwner(colonyAddress);
const newColony = await IColony.at(colonyAddress);

const payoutTokenArgs = getTokenArgs();
const payoutToken = await DSToken.new(payoutTokenArgs[0]);
const payoutToken = await Token.new(...payoutTokenArgs);
await payoutToken.unlock();
await fundColonyWithTokens(newColony, payoutToken, data.totalAmountOfPayoutTokens);
// Issuing colony's internal tokens so they can be given to users in `bootstrapColony`
await newColony.mintTokens(data.totalReputation);
Expand Down
5 changes: 3 additions & 2 deletions test/colony-task.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ chai.use(bnChai(web3.utils.BN));
const EtherRouter = artifacts.require("EtherRouter");
const IMetaColony = artifacts.require("IMetaColony");
const IColonyNetwork = artifacts.require("IColonyNetwork");
const DSToken = artifacts.require("DSToken");
const Token = artifacts.require("Token");
const TaskSkillEditing = artifacts.require("TaskSkillEditing");

contract("ColonyTask", accounts => {
Expand All @@ -89,7 +89,8 @@ contract("ColonyTask", accounts => {
await colony.setAdministrationRole(1, 0, COLONY_ADMIN, 1, true);

const otherTokenArgs = getTokenArgs();
otherToken = await DSToken.new(otherTokenArgs[1]);
otherToken = await Token.new(...otherTokenArgs);
await otherToken.unlock();
});

describe("when creating tasks", () => {
Expand Down
Loading