From 8d5526be3ef99785f7bc02a99926e5649e7067b8 Mon Sep 17 00:00:00 2001 From: Alex Rea Date: Wed, 28 Aug 2024 16:00:46 +0100 Subject: [PATCH] Vaguely port chainid-based-behaviour tests (needs more work) --- .circleci/config.yml | 20 +--- .../colonyNetwork/ColonyNetworkMining.sol | 24 ++-- .../colonyNetwork/ColonyNetworkStorage.sol | 25 ++--- helpers/test-data-generator.js | 16 ++- test/cross-chain/cross-chain.js | 104 +++++++++--------- test/deploy-proxy-network-fixture.js | 2 + test/misc/chainid.js | 86 +++------------ test/truffle-fixture.js | 7 +- 8 files changed, 103 insertions(+), 181 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 5f9bcf9308..79fc38785b 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -309,31 +309,13 @@ jobs: - <<: *step_pull_solc_docker - <<: *step_setup_global_packages - run: - name: "Running chainid tests with coverage for mainnet" - command: CHAIN_ID=1 pnpm run test:contracts:chainid:coverage - environment: - NODE_OPTIONS: --max-old-space-size=6144 - - run: - name: "Running chainid tests with coverage for goerli" - command: CHAIN_ID=5 pnpm run test:contracts:chainid:coverage - environment: - NODE_OPTIONS: --max-old-space-size=6144 - - run: - name: "Running chainid tests with coverage for xDai" - command: CHAIN_ID=100 pnpm run test:contracts:chainid:coverage - environment: - NODE_OPTIONS: --max-old-space-size=6144 - - run: - name: "Running chainid tests with coverage for an unsupported network" + name: "Running chainid tests with for network where mining takes place" command: CHAIN_ID=777 pnpm run test:contracts:chainid:coverage environment: NODE_OPTIONS: --max-old-space-size=6144 - persist_to_workspace: root: ./ paths: - - coverage-chainid-1 - - coverage-chainid-5 - - coverage-chainid-100 - coverage-chainid-777 coverage-test-bridging: <<: *job_common diff --git a/contracts/colonyNetwork/ColonyNetworkMining.sol b/contracts/colonyNetwork/ColonyNetworkMining.sol index 999ed97bd1..7a869bdf81 100644 --- a/contracts/colonyNetwork/ColonyNetworkMining.sol +++ b/contracts/colonyNetwork/ColonyNetworkMining.sol @@ -41,7 +41,7 @@ contract ColonyNetworkMining is ColonyNetworkStorage { _; } - function setMiningDelegate(address _delegate, bool _allowed) public onlyMiningChain stoppable { + function setMiningDelegate(address _delegate, bool _allowed) public stoppable miningInitialised { if (miningDelegators[_delegate] != address(0x00)) { require( miningDelegators[_delegate] == msgSender(), @@ -69,7 +69,7 @@ contract ColonyNetworkMining is ColonyNetworkStorage { address _colony, uint128 _nUpdates, uint128 _nPreviousUpdates - ) public onlyMiningChain recovery auth { + ) public recovery auth miningInitialised { replacementReputationUpdateLogsExist[_reputationMiningCycle] = true; replacementReputationUpdateLog[_reputationMiningCycle][_id] = ReputationLogEntry( @@ -102,7 +102,7 @@ contract ColonyNetworkMining is ColonyNetworkStorage { bytes32 newHash, uint256 newNLeaves, address[] memory stakers - ) public onlyMiningChain stoppable onlyReputationMiningCycle { + ) public stoppable miningInitialised onlyReputationMiningCycle { reputationRootHash = newHash; reputationRootHashNLeaves = newNLeaves; // Reward stakers @@ -163,7 +163,7 @@ contract ColonyNetworkMining is ColonyNetworkStorage { } // slither-disable-next-line reentrancy-no-eth - function startNextCycle() public onlyMiningChain stoppable { + function startNextCycle() public stoppable miningInitialised { address clnyToken = IMetaColony(metaColony).getToken(); require(clnyToken != address(0x0), "colony-reputation-mining-clny-token-invalid-address"); require(activeReputationMiningCycle == address(0x0), "colony-reputation-mining-still-active"); @@ -263,7 +263,7 @@ contract ColonyNetworkMining is ColonyNetworkStorage { function punishStakers( address[] memory _stakers, uint256 _amount - ) public onlyMiningChain stoppable onlyReputationMiningCycle { + ) public stoppable miningInitialised onlyReputationMiningCycle { address clnyToken = IMetaColony(metaColony).getToken(); uint256 lostStake; // Passing an array so that we don't incur the EtherRouter overhead for each staker if we looped over @@ -285,19 +285,19 @@ contract ColonyNetworkMining is ColonyNetworkStorage { function reward( address _recipient, uint256 _amount - ) public onlyMiningChain stoppable onlyReputationMiningCycle { + ) public stoppable miningInitialised onlyReputationMiningCycle { // TODO: Gain rep? pendingMiningRewards[_recipient] += _amount; } - function claimMiningReward(address _recipient) public onlyMiningChain stoppable { + function claimMiningReward(address _recipient) public miningInitialised stoppable { address clnyToken = IMetaColony(metaColony).getToken(); uint256 amount = pendingMiningRewards[_recipient]; pendingMiningRewards[_recipient] = 0; ITokenLocking(tokenLocking).transfer(clnyToken, amount, _recipient, true); } - function stakeForMining(uint256 _amount) public onlyMiningChainOrDuringSetup stoppable { + function stakeForMining(uint256 _amount) public stoppable miningInitialisedOrDuringSetup { address clnyToken = IMetaColony(metaColony).getToken(); ITokenLocking(tokenLocking).approveStake(msgSender(), _amount, clnyToken); @@ -312,7 +312,7 @@ contract ColonyNetworkMining is ColonyNetworkStorage { miningStakes[msgSender()].amount += _amount; } - function unstakeForMining(uint256 _amount) public onlyMiningChain stoppable { + function unstakeForMining(uint256 _amount) public stoppable miningInitialised { address clnyToken = IMetaColony(metaColony).getToken(); // Prevent those involved in a mining cycle withdrawing stake during the mining process. require( @@ -329,7 +329,7 @@ contract ColonyNetworkMining is ColonyNetworkStorage { function burnUnneededRewards( uint256 _amount - ) public onlyMiningChain stoppable onlyReputationMiningCycle { + ) public stoppable miningInitialised onlyReputationMiningCycle { // If there are no rewards to burn, no need to do anything if (_amount == 0) { return; @@ -346,7 +346,7 @@ contract ColonyNetworkMining is ColonyNetworkStorage { function setReputationMiningCycleReward( uint256 _amount - ) public onlyMiningChain stoppable calledByMetaColony { + ) public stoppable miningInitialised calledByMetaColony { totalMinerRewardPerCycle = _amount; emit ReputationMiningRewardSet(_amount); @@ -380,7 +380,7 @@ contract ColonyNetworkMining is ColonyNetworkStorage { function setMiningResolver( address _miningResolver - ) public stoppable onlyMiningChainOrDuringSetup auth { + ) public stoppable auth miningInitialisedOrDuringSetup { require(_miningResolver != address(0x0), "colony-mining-resolver-cannot-be-zero"); miningCycleResolver = _miningResolver; diff --git a/contracts/colonyNetwork/ColonyNetworkStorage.sol b/contracts/colonyNetwork/ColonyNetworkStorage.sol index 3451de5ca5..cc36ef9e33 100644 --- a/contracts/colonyNetwork/ColonyNetworkStorage.sol +++ b/contracts/colonyNetwork/ColonyNetworkStorage.sol @@ -171,30 +171,22 @@ contract ColonyNetworkStorage is _; } - modifier onlyMiningChain() { - if (getMiningChainId() == block.chainid) { - require( - inactiveReputationMiningCycle != address(0x0), - "colony-reputation-mining-not-initialised" - ); - } - require(isMiningChain(), "colony-only-valid-on-mining-chain"); + modifier miningInitialised() { + require( + inactiveReputationMiningCycle != address(0x0), + "colony-reputation-mining-not-initialised" + ); _; } - modifier onlyMiningChainOrDuringSetup() { + modifier miningInitialisedOrDuringSetup() { require( - isMiningChain() || getMiningChainId() == 0, + inactiveReputationMiningCycle != address(0x0) || getMiningChainId() == 0, "colony-only-valid-on-mining-chain-or-during-setup" ); _; } - modifier onlyNotMiningChain() { - require(!isMiningChain(), "colony-only-valid-not-on-mining-chain"); - _; - } - // Internal functions function toRootSkillId(uint256 _chainId) internal pure returns (uint256) { @@ -211,9 +203,6 @@ contract ColonyNetworkStorage is } function getMiningChainId() public view returns (uint256) { - if (reputationMiningChainId == 0 && isXdai()) { - return block.chainid; - } return reputationMiningChainId; } diff --git a/helpers/test-data-generator.js b/helpers/test-data-generator.js index 30deb98ace..78f6d186ae 100644 --- a/helpers/test-data-generator.js +++ b/helpers/test-data-generator.js @@ -3,7 +3,18 @@ const BN = require("bn.js"); const { signTypedData_v4: signTypedData } = require("eth-sig-util"); -const { UINT256_MAX, MANAGER_PAYOUT, EVALUATOR_PAYOUT, WORKER_PAYOUT, INITIAL_FUNDING, SLOT0, SLOT1, SLOT2, ADDRESS_ZERO } = require("./constants"); +const { + UINT256_MAX, + MANAGER_PAYOUT, + EVALUATOR_PAYOUT, + WORKER_PAYOUT, + INITIAL_FUNDING, + SLOT0, + SLOT1, + SLOT2, + ADDRESS_ZERO, + NETWORK_ADDRESS, +} = require("./constants"); const { getTokenArgs, web3GetAccounts, getChildSkillIndex, getChainId } = require("./test-helper"); @@ -226,8 +237,7 @@ exports.unlockCLNYToken = async function unlockCLNYToken(metaColony) { }; exports.setupColonyNetwork = async function setupColonyNetwork() { - const cnAddress = (await EtherRouter.deployed()).address; - const deployedColonyNetwork = await IColonyNetwork.at(cnAddress); + const deployedColonyNetwork = await IColonyNetwork.at(NETWORK_ADDRESS); // Make a new ColonyNetwork const etherRouter = await EtherRouter.new(); diff --git a/test/cross-chain/cross-chain.js b/test/cross-chain/cross-chain.js index f5651c5e2f..a1cd032932 100644 --- a/test/cross-chain/cross-chain.js +++ b/test/cross-chain/cross-chain.js @@ -23,13 +23,10 @@ const { expect } = chai; chai.use(bnChai(web3.utils.BN)); const IColonyNetwork = artifacts.require("IColonyNetwork"); -const EtherRouterCreate3 = artifacts.require("EtherRouterCreate3"); const EtherRouter = artifacts.require("EtherRouter"); const IMetaColony = artifacts.require("IMetaColony"); -const Resolver = artifacts.require("Resolver"); const Token = artifacts.require("Token"); const IColony = artifacts.require("IColony"); -const ICreateX = artifacts.require("ICreateX"); const ProxyColonyNetwork = artifacts.require("ProxyColonyNetwork"); const ProxyColony = artifacts.require("ProxyColony"); const MetaTxToken = artifacts.require("MetaTxToken"); @@ -48,7 +45,6 @@ const { const { forwardTime, checkErrorRevertEthers, revert, snapshot } = require("../../helpers/test-helper"); const ReputationMinerTestWrapper = require("../../packages/reputation-miner/test/ReputationMinerTestWrapper"); const { TruffleLoader } = require("../../packages/package-utils"); -const { setupProxyColonyNetwork, setupEtherRouter } = require("../../helpers/upgradable-contracts"); const UINT256_MAX_ETHERS = ethers.BigNumber.from(2).pow(256).sub(1); @@ -139,56 +135,56 @@ contract("Cross-chain", (accounts) => { foreignChainId = await ethersForeignSigner.provider.send("eth_chainId", []); // Deploy shell colonyNetwork to whichever chain truffle hasn't already deployed to. - try { - if (process.env.HARDHAT_FOREIGN === "true") { - await exec(`CHAIN_ID=${parseInt(foreignChainId, 16)} npx hardhat ensureCreateXDeployed --network development`); - } else { - await exec(`CHAIN_ID=${parseInt(foreignChainId, 16)} npx hardhat ensureCreateXDeployed --network development2`); - } - - const createX = await new ethers.Contract(CREATEX_ADDRESS, ICreateX.abi, ethersForeignSigner); - - // This is a fake instance of an etherRouter, just so we can call encodeABs - const fakeEtherRouter = await EtherRouterCreate3.at(CREATEX_ADDRESS); - const setOwnerData = fakeEtherRouter.contract.methods.setOwner(accounts[0]).encodeABI(); - - const tx = await createX["deployCreate3AndInit(bytes32,bytes,bytes,(uint256,uint256))"]( - `0xb77d57f4959eafa0339424b83fcfaf9c15407461005e95d52076387600e2c1e9`, - EtherRouterCreate3.bytecode, - setOwnerData, - [0, 0], - { from: accounts[0] }, - ); - - const receipt = await tx.wait(); - - const etherRouter = await new ethers.Contract( - receipt.events.filter((log) => log.event === "ContractCreation")[0].args.newContract, - EtherRouter.abi, - ethersForeignSigner, - ); - let resolver = await new ethers.ContractFactory(Resolver.abi, Resolver.bytecode, ethersForeignSigner).deploy(); - const proxyColonyNetworkImplementation = await new ethers.ContractFactory( - ProxyColonyNetwork.abi, - ProxyColonyNetwork.bytecode, - ethersForeignSigner, - ).deploy(); - - await setupProxyColonyNetwork(etherRouter, proxyColonyNetworkImplementation, resolver); - console.log("**** shell colony network set up"); - - // Set up the resolver for shell colonies - resolver = await new ethers.ContractFactory(Resolver.abi, Resolver.bytecode, ethersForeignSigner).deploy(); - const proxyColonyImplementation = await new ethers.ContractFactory(ProxyColony.abi, ProxyColony.bytecode, ethersForeignSigner).deploy(); - - await setupEtherRouter("bridging", "ProxyColony", { ProxyColony: proxyColonyImplementation.address }, resolver); - const proxyColonyNetwork = new ethers.Contract(etherRouter.address, ProxyColonyNetwork.abi, ethersForeignSigner); - - await proxyColonyNetwork.setProxyColonyResolverAddress(resolver.address); - } catch (err) { - console.log(err); - process.exit(1); - } + // try { + // if (process.env.HARDHAT_FOREIGN === "true") { + // await exec(`CHAIN_ID=${parseInt(foreignChainId, 16)} npx hardhat ensureCreateXDeployed --network development`); + // } else { + // await exec(`CHAIN_ID=${parseInt(foreignChainId, 16)} npx hardhat ensureCreateXDeployed --network development2`); + // } + + // const createX = await new ethers.Contract(CREATEX_ADDRESS, ICreateX.abi, ethersForeignSigner); + + // // This is a fake instance of an etherRouter, just so we can call encodeABs + // const fakeEtherRouter = await EtherRouterCreate3.at(CREATEX_ADDRESS); + // const setOwnerData = fakeEtherRouter.contract.methods.setOwner(accounts[0]).encodeABI(); + + // const tx = await createX["deployCreate3AndInit(bytes32,bytes,bytes,(uint256,uint256))"]( + // `0xb77d57f4959eafa0339424b83fcfaf9c15407461005e95d52076387600e2c1e9`, + // EtherRouterCreate3.bytecode, + // setOwnerData, + // [0, 0], + // { from: accounts[0] }, + // ); + + // const receipt = await tx.wait(); + + // const etherRouter = await new ethers.Contract( + // receipt.events.filter((log) => log.event === "ContractCreation")[0].args.newContract, + // EtherRouter.abi, + // ethersForeignSigner, + // ); + // let resolver = await new ethers.ContractFactory(Resolver.abi, Resolver.bytecode, ethersForeignSigner).deploy(); + // const proxyColonyNetworkImplementation = await new ethers.ContractFactory( + // ProxyColonyNetwork.abi, + // ProxyColonyNetwork.bytecode, + // ethersForeignSigner, + // ).deploy(); + + // await setupProxyColonyNetwork(etherRouter, proxyColonyNetworkImplementation, resolver); + // console.log("**** shell colony network set up"); + + // // Set up the resolver for shell colonies + // resolver = await new ethers.ContractFactory(Resolver.abi, Resolver.bytecode, ethersForeignSigner).deploy(); + // const proxyColonyImplementation = await new ethers.ContractFactory(ProxyColony.abi, ProxyColony.bytecode, ethersForeignSigner).deploy(); + + // await setupEtherRouter("bridging", "ProxyColony", { ProxyColony: proxyColonyImplementation.address }, resolver); + // const proxyColonyNetwork = new ethers.Contract(etherRouter.address, ProxyColonyNetwork.abi, ethersForeignSigner); + + // await proxyColonyNetwork.setProxyColonyResolverAddress(resolver.address); + // } catch (err) { + // console.log(err); + // process.exit(1); + // } // 0x539 is the chain id used by truffle by default (regardless of networkid), and if // we see it in our tests that's the coverage chain, which builds the contract artifacts diff --git a/test/deploy-proxy-network-fixture.js b/test/deploy-proxy-network-fixture.js index 92d23a600a..1b5100041a 100644 --- a/test/deploy-proxy-network-fixture.js +++ b/test/deploy-proxy-network-fixture.js @@ -42,6 +42,8 @@ module.exports = async () => { let resolver = await Resolver.new(); + await Resolver.setAsDeployed(resolver); + await setupProxyColonyNetwork(etherRouter, proxyColonyNetworkImplementation, resolver); // Set up the resolver for shell colonies and register it with the network diff --git a/test/misc/chainid.js b/test/misc/chainid.js index d539e707ee..c4560fd169 100644 --- a/test/misc/chainid.js +++ b/test/misc/chainid.js @@ -24,12 +24,11 @@ const { isXdai, getChainId, } = require("../../helpers/test-helper"); -const { MINING_CYCLE_DURATION, MIN_STAKE, CHALLENGE_RESPONSE_WINDOW_DURATION, WAD, DEFAULT_STAKE, XDAI_CHAINID } = require("../../helpers/constants"); +const { MINING_CYCLE_DURATION, MIN_STAKE, CHALLENGE_RESPONSE_WINDOW_DURATION, WAD, DEFAULT_STAKE } = require("../../helpers/constants"); const { expect } = chai; const ENSRegistry = artifacts.require("ENSRegistry"); const DutchAuction = artifacts.require("DutchAuction"); -const ITokenLocking = artifacts.require("ITokenLocking"); const Token = artifacts.require("Token"); chai.use(bnChai(web3.utils.BN)); @@ -57,18 +56,14 @@ contract("Contract Storage", (accounts) => { ({ metaColony, clnyToken } = await setupMetaColonyWithLockedCLNYToken(colonyNetwork)); const ensRegistry = await ENSRegistry.new(); await setupENSRegistrar(colonyNetwork, ensRegistry, accounts[0]); - if (await isXdai()) { - await giveUserCLNYTokensAndStake(colonyNetwork, MINER1, DEFAULT_STAKE); - await giveUserCLNYTokensAndStake(colonyNetwork, MINER2, DEFAULT_STAKE); - await giveUserCLNYTokensAndStake(colonyNetwork, MINER3, DEFAULT_STAKE); - - await metaColony.initialiseReputationMining(chainId, ethers.constants.HashZero, 0); - } else { - await metaColony.initialiseReputationMining(XDAI_CHAINID, ethers.constants.HashZero, 0); - } + await giveUserCLNYTokensAndStake(colonyNetwork, MINER1, DEFAULT_STAKE); + await giveUserCLNYTokensAndStake(colonyNetwork, MINER2, DEFAULT_STAKE); + await giveUserCLNYTokensAndStake(colonyNetwork, MINER3, DEFAULT_STAKE); + + await metaColony.initialiseReputationMining(chainId, ethers.constants.HashZero, 0); }); - describe("Should behave differently based on the network deployed to", () => { + describe("Should behave appropriately with old per-chain behaviours", () => { it("should be able to get the domain name", async () => { await metaColony.registerColonyLabel("meta", "", { from: accounts[0] }); if (await isMainnet()) { @@ -85,26 +80,7 @@ contract("Contract Storage", (accounts) => { } }); - it("can only stake tokens for mining (and therefore can only mine) on the mining chain", async () => { - await giveUserCLNYTokens(colonyNetwork, MINER1, DEFAULT_STAKE); - const tokenLockingAddress = await colonyNetwork.getTokenLocking(); - const tokenLocking = await ITokenLocking.at(tokenLockingAddress); - await clnyToken.approve(tokenLocking.address, DEFAULT_STAKE, { from: MINER1 }); - await tokenLocking.methods["deposit(address,uint256,bool)"](clnyToken.address, DEFAULT_STAKE, true, { from: MINER1 }); - const tx = colonyNetwork.stakeForMining(DEFAULT_STAKE, { from: MINER1 }); - - if (await isXdai()) { - await tx; - } else { - await checkErrorRevert(tx, "colony-only-valid-on-mining-chain-or-during-setup"); - } - }); - it("should not make 0-value transfers to 'burn' unneeded mining rewards on xdai", async function () { - if (!(await isXdai())) { - // We don't mine anywhere else, so skip - this.skip(); - } await giveUserCLNYTokensAndStake(colonyNetwork, MINER1, MIN_STAKE); await advanceMiningCycleNoContest({ colonyNetwork, test: this }); @@ -123,23 +99,13 @@ contract("Contract Storage", (accounts) => { it("should handle tokens appropriately if auction is initialised for the CLNY token", async () => { await giveUserCLNYTokens(colonyNetwork, colonyNetwork.address, WAD); const supplyBefore = await clnyToken.totalSupply(); - const balanceBefore = await clnyToken.balanceOf(colonyNetwork.address); const tx = await colonyNetwork.startTokenAuction(clnyToken.address); const supplyAfter = await clnyToken.totalSupply(); - const balanceAfter = await clnyToken.balanceOf(colonyNetwork.address); - if (await isMainnet()) { - // tokens should be burned. - expect(supplyBefore.sub(supplyAfter)).to.eq.BN(balanceBefore); - await expectEvent(tx, "Burn(address indexed,uint256)", [colonyNetwork.address, WAD]); - expect(balanceAfter).to.be.zero; - expect(supplyBefore.sub(balanceBefore)).to.eq.BN(supplyAfter); - } else { - // tokens should be transferred to metacolony - expect(supplyBefore).to.eq.BN(supplyAfter); - await expectEvent(tx, "Transfer(address indexed,address indexed,uint256)", [colonyNetwork.address, metaColony.address, WAD]); - } + // tokens should be transferred to metacolony + expect(supplyBefore).to.eq.BN(supplyAfter); + await expectEvent(tx, "Transfer(address indexed,address indexed,uint256)", [colonyNetwork.address, metaColony.address, WAD]); }); it("CLNY raised from auctions is dealt with appropriately", async () => { @@ -159,7 +125,6 @@ contract("Contract Storage", (accounts) => { await clnyToken.approve(tokenAuction.address, clnyNeededForMaxPriceAuctionSellout, { from: accounts[1] }); await tokenAuction.bid(clnyNeededForMaxPriceAuctionSellout, { from: accounts[1] }); - const balanceBefore = await clnyToken.balanceOf(tokenAuction.address); const supplyBefore = await clnyToken.totalSupply(); const receivedTotal = await tokenAuction.receivedTotal(); expect(receivedTotal).to.not.be.zero; @@ -168,34 +133,9 @@ contract("Contract Storage", (accounts) => { const balanceAfter = await clnyToken.balanceOf(tokenAuction.address); expect(balanceAfter).to.be.zero; const supplyAfter = await clnyToken.totalSupply(); - if (await isMainnet()) { - // tokens should be burned. - expect(supplyBefore.sub(supplyAfter)).to.eq.BN(balanceBefore); - await expectEvent(tx, "Burn(address indexed,uint256)", [tokenAuction.address, receivedTotal]); - } else { - // tokens should be transferred to metacolony - expect(supplyBefore).to.eq.BN(supplyAfter); - await expectEvent(tx, "Transfer(address indexed,address indexed,uint256)", [tokenAuction.address, metaColony.address, receivedTotal]); - } - }); - - it("reputation mining chain can be changed on non-mining chain", async function () { - if (await isXdai()) { - // Not appropriate test on xdai - this.skip(); - } - - const oldChainId = await colonyNetwork.getMiningChainId(); - - const otherChainId = oldChainId + 1; - await metaColony.initialiseReputationMining(otherChainId, ethers.constants.HashZero, 0); - - const newChainId = await colonyNetwork.getMiningChainId(); - expect(newChainId).to.eq.BN(oldChainId + 1); - }); - - it.skip("reputation mining chain can be changed on mining chain", async () => { - // Not a test, or contract code, that has been written yet + // tokens should be transferred to metacolony + expect(supplyBefore).to.eq.BN(supplyAfter); + await expectEvent(tx, "Transfer(address indexed,address indexed,uint256)", [tokenAuction.address, metaColony.address, receivedTotal]); }); }); }); diff --git a/test/truffle-fixture.js b/test/truffle-fixture.js index 3c4ef5dd6d..e59865c0ed 100644 --- a/test/truffle-fixture.js +++ b/test/truffle-fixture.js @@ -87,8 +87,11 @@ module.exports = async () => { } const chainId = await getChainId(); - if (chainId !== FORKED_XDAI_CHAINID) { - console.log("Skipping deployment of contracts on non-home chain"); + const miningChainId = parseInt(process.env.MINING_CHAIN_ID, 10) || chainId; + + if (chainId !== miningChainId) { + console.log("On non-mining chain, so deploy proxy infrastructure"); + await hre.run("deploy-proxy-network"); return; }