Skip to content

Commit

Permalink
wip5
Browse files Browse the repository at this point in the history
  • Loading branch information
zajck committed Aug 31, 2023
1 parent 777ec6a commit d9cbdc9
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 74 deletions.
21 changes: 2 additions & 19 deletions test/upgrade/01_generic.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,17 +51,16 @@ function getGenericContext(

// Create new protocol entities. Existing data should not be affected
context("📋 New data after the upgrade do not corrupt the data from before the upgrade", async function () {
this.timeout(1000000);
let protocolContractStateAfterUpgradeAndActions;

before(async function () {
console.log("1")
postUpgradeEntities = await populateProtocolContract(
deployer,
protocolDiamondAddress,
contractsAfter,
mockContracts
);
console.log("2")

// Get protocol state after the upgrade
// First get the data that should be in location of old data
Expand All @@ -71,7 +70,6 @@ function getGenericContext(
mockContracts,
preUpgradeEntities
);
console.log("3")

// Counters are the only values that should be changed
// We check that the number increased for expected amount
Expand All @@ -82,8 +80,6 @@ function getGenericContext(
postUpgradeEntities.agents.length +
postUpgradeEntities.buyers.length;

console.log("4")

assert.equal(
protocolContractStateAfterUpgradeAndActions.accountContractState.nextAccountId,
Number(protocolContractState.accountContractState.nextAccountId) + accountCount,
Expand Down Expand Up @@ -129,17 +125,12 @@ function getGenericContext(
delete protocolContractState.twinContractState.nextTwinId;
delete protocolContractState.bundleContractState.nextBundleId;
});
console.log("5")


for (const test of includeTests) {
it(`State of ${test} is not affected`, async function () {
assert.deepEqual(protocolContractState[test], protocolContractStateAfterUpgradeAndActions[test]);
});
}

console.log("6")

});

// Test that offers and exchanges from before the upgrade can normally be used
Expand Down Expand Up @@ -231,15 +222,7 @@ function getGenericContext(
const exchange = preUpgradeEntities.exchanges[5 - 1]; // exchange for which dispute was raised

const buyerWallet = preUpgradeEntities.buyers[exchange.buyerIndex].wallet;
const offer = preUpgradeEntities.offers.find((o) => o.offer.id == exchange.offerId);

const [,,disputeDates] = await disputeHandler.getDispute(exchange.exchangeId);
console.log(disputeDates)

const blockNumber = await provider.getBlockNumber();
const block = await provider.getBlock(blockNumber);
console.log(block.timestamp)

const offer = preUpgradeEntities.offers.find((o) => o.offer.id == exchange.offerId);

await expect(disputeHandler.connect(buyerWallet).escalateDispute(exchange.exchangeId))
.to.emit(disputeHandler, "DisputeEscalated")
Expand Down
2 changes: 2 additions & 0 deletions test/upgrade/2.2.1-2.3.0.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
const shell = require("shelljs");
const hre = require("hardhat");
const ethers = hre.ethers;
const { ZeroAddress, parseEther, Wallet, provider, getContractFactory, getContractAt, encodeBytes32String } = ethers;
Expand Down Expand Up @@ -208,6 +209,7 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation
disputeResolver.assistant = rando.address;
await accountHandler.connect(wallet).updateDisputeResolver(disputeResolver);

shell.exec(`git checkout HEAD scripts`);
await migrate("upgrade-test");

// Cast to updated interface
Expand Down
Loading

0 comments on commit d9cbdc9

Please sign in to comment.