Skip to content

Commit 0cf80f1

Browse files
committed
Post-review changes
1 parent e647d9d commit 0cf80f1

File tree

4 files changed

+27
-36
lines changed

4 files changed

+27
-36
lines changed

.circleci/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ jobs:
220220
environment:
221221
NODE_OPTIONS: --max-old-space-size=6144
222222
# name: "Running parity upgrade tests"
223-
# command: npm run test:contracts:upgrade:parity && npm run test:contracts:upgrade:ganache
223+
# command: npm run test:contracts:upgrade:parity
224224
# environment:
225225
# NODE_OPTIONS: --max-old-space-size=6144
226226
- run:

helpers/test-helper.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/* globals artifacts, hre */
2+
const fs = require("fs");
23
const shortid = require("shortid");
34
const chai = require("chai");
45
const { asciiToHex, isBN } = require("web3-utils");
@@ -17,6 +18,7 @@ const {
1718
MAINNET_CHAINID,
1819
XDAI_CHAINID,
1920
FORKED_XDAI_CHAINID,
21+
CREATEX_ADDRESS,
2022
} = require("./constants");
2123

2224
const IColony = artifacts.require("IColony");
@@ -1267,6 +1269,28 @@ exports.isXdai = async function isXdai() {
12671269
return chainId === XDAI_CHAINID || chainId === FORKED_XDAI_CHAINID;
12681270
};
12691271

1272+
exports.deployCreateXIfNeeded = async function deployCreateXIfNeeded() {
1273+
// Deploy CreateX if it's not already deployed
1274+
const createXCode = await web3.eth.getCode(CREATEX_ADDRESS);
1275+
if (createXCode === "0x") {
1276+
const accounts = await web3.eth.getAccounts();
1277+
await web3.eth.sendTransaction({
1278+
from: accounts[0],
1279+
to: "0xeD456e05CaAb11d66C4c797dD6c1D6f9A7F352b5",
1280+
value: web3.utils.toWei("0.3", "ether"),
1281+
gasPrice: web3.utils.toWei("1", "gwei"),
1282+
gas: 300000,
1283+
});
1284+
const rawTx = fs
1285+
.readFileSync("lib/createx/scripts/presigned-createx-deployment-transactions/signed_serialised_transaction_gaslimit_3000000_.json", {
1286+
encoding: "utf8",
1287+
})
1288+
.replace(/"/g, "")
1289+
.replace("\n", "");
1290+
await web3.eth.sendSignedTransaction(rawTx);
1291+
}
1292+
};
1293+
12701294
class TestAdapter {
12711295
constructor() {
12721296
this.outputs = [];

test/cross-chain/cross-chain.js

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -160,34 +160,28 @@ contract("Cross-chain", (accounts) => {
160160
});
161161

162162
beforeEach(async () => {
163-
console.log("beforeEach");
164163
web3HomeProvider = new web3.eth.providers.HttpProvider(ethersHomeSigner.provider.connection.url);
165164
web3ForeignProvider = new web3.eth.providers.HttpProvider(ethersForeignSigner.provider.connection.url);
166165

167-
console.log("beforeEach");
168166
homeSnapshotId = await snapshot(web3HomeProvider);
169167
foreignSnapshotId = await snapshot(web3ForeignProvider);
170168
bridgeMonitor.reset();
171169

172-
console.log("beforeEach");
173170
let tx = await foreignBridge.setBridgeEnabled(true);
174171
await tx.wait();
175172
tx = await homeBridge.setBridgeEnabled(true);
176173
await tx.wait();
177174

178-
console.log("beforeEach");
179175
const foreignMCAddress = await foreignColonyNetwork.getMetaColony();
180176
foreignMetacolony = await new ethers.Contract(foreignMCAddress, IMetaColony.abi, ethersForeignSigner);
181177
const homeMCAddress = await homeColonyNetwork.getMetaColony();
182178
homeMetacolony = await new ethers.Contract(homeMCAddress, IMetaColony.abi, ethersHomeSigner);
183179

184-
console.log("beforeEach");
185180
await setForeignBridgeData(foreignColonyBridge.address);
186181
await setHomeBridgeData(homeColonyBridge.address);
187182

188183
// Bridge over skills that have been created on the foreign chain
189184

190-
console.log("beforeEach");
191185
const latestSkillId = await foreignColonyNetwork.getSkillCount();
192186
const skillId = ethers.BigNumber.from(foreignChainId).mul(ethers.BigNumber.from(2).pow(128)).add(1);
193187
for (let i = skillId; i <= latestSkillId; i = i.add(1)) {
@@ -198,7 +192,6 @@ contract("Cross-chain", (accounts) => {
198192
// process.exit(1);
199193
}
200194

201-
console.log("beforeEach");
202195
// Set up mining client
203196
client = new ReputationMinerTestWrapper({
204197
loader: contractLoader,
@@ -209,27 +202,22 @@ contract("Cross-chain", (accounts) => {
209202

210203
await client.initialise(homeColonyNetwork.address);
211204

212-
console.log("beforeEach");
213205
await forwardTime(MINING_CYCLE_DURATION + CHALLENGE_RESPONSE_WINDOW_DURATION, undefined, web3HomeProvider);
214206
await client.addLogContentsToReputationTree();
215207
await client.submitRootHash();
216208
await client.confirmNewHash();
217209

218-
console.log("beforeEach");
219210
await forwardTime(MINING_CYCLE_DURATION + CHALLENGE_RESPONSE_WINDOW_DURATION, undefined, web3HomeProvider);
220211
await client.addLogContentsToReputationTree();
221212
await client.submitRootHash();
222213
await client.confirmNewHash();
223-
console.log("beforerEach");
224214

225215
// Set up a colony on the home chain. That may or may not be the truffle chain...
226216
homeColony = await setupColony(homeColonyNetwork);
227217

228-
console.log("beforerEach");
229218
const p = bridgeMonitor.getPromiseForNextBridgedTransaction(2);
230219
foreignColony = await setupColony(foreignColonyNetwork);
231220
await p;
232-
console.log("beforerEach");
233221
});
234222

235223
async function setupColony(colonyNetworkEthers) {

test/truffle-fixture.js

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
/* globals artifacts, hre */
2-
const fs = require("fs");
3-
42
const EtherRouter = artifacts.require("EtherRouter");
53
const EtherRouterCreate3 = artifacts.require("EtherRouterCreate3");
64
const Resolver = artifacts.require("Resolver");
@@ -78,7 +76,7 @@ const {
7876
setupEtherRouter,
7977
} = require("../helpers/upgradable-contracts");
8078
const { FORKED_XDAI_CHAINID, XDAI_CHAINID, UINT256_MAX, CREATEX_ADDRESS } = require("../helpers/constants");
81-
const { getChainId, hardhatRevert, hardhatSnapshot } = require("../helpers/test-helper");
79+
const { getChainId, hardhatRevert, hardhatSnapshot, deployCreateXIfNeeded } = require("../helpers/test-helper");
8280

8381
module.exports = async () => {
8482
if (postFixtureSnapshotId) {
@@ -139,25 +137,7 @@ async function deployContracts() {
139137
const reputationMiningCycleBinarySearch = await ReputationMiningCycleBinarySearch.new();
140138
ReputationMiningCycleBinarySearch.setAsDeployed(reputationMiningCycleBinarySearch);
141139

142-
// Deploy CreateX if it's not already deployed
143-
const createXCode = await web3.eth.getCode(CREATEX_ADDRESS);
144-
if (createXCode === "0x") {
145-
const accounts = await web3.eth.getAccounts();
146-
await web3.eth.sendTransaction({
147-
from: accounts[0],
148-
to: "0xeD456e05CaAb11d66C4c797dD6c1D6f9A7F352b5",
149-
value: web3.utils.toWei("0.3", "ether"),
150-
gasPrice: web3.utils.toWei("1", "gwei"),
151-
gas: 300000,
152-
});
153-
const rawTx = fs
154-
.readFileSync("lib/createx/scripts/presigned-createx-deployment-transactions/signed_serialised_transaction_gaslimit_3000000_.json", {
155-
encoding: "utf8",
156-
})
157-
.replace(/"/g, "")
158-
.replace("\n", "");
159-
await web3.eth.sendSignedTransaction(rawTx);
160-
}
140+
await deployCreateXIfNeeded();
161141
}
162142

163143
async function setupColonyNetwork() {
@@ -183,7 +163,6 @@ async function setupColonyNetwork() {
183163
const fakeEtherRouter = await EtherRouterCreate3.at(colonyNetwork.address);
184164
const setOwnerData = fakeEtherRouter.contract.methods.setOwner(accounts[0]).encodeABI();
185165
const tx = await createX.methods["deployCreate3AndInit(bytes32,bytes,bytes,(uint256,uint256))"](
186-
// `${accounts[0]}001212121212121212121212`,
187166
`0xb77d57f4959eafa0339424b83fcfaf9c15407461005e95d52076387600e2c1e9`,
188167
EtherRouterCreate3.bytecode,
189168
setOwnerData,

0 commit comments

Comments
 (0)