Skip to content

Commit

Permalink
Fix init v2.2.0 test
Browse files Browse the repository at this point in the history
  • Loading branch information
anajuliabit committed Jun 13, 2023
1 parent 42cb91d commit 0efcc36
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 44 deletions.
2 changes: 1 addition & 1 deletion scripts/migrations/migrate_2.2.1.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ async function migrate(env) {
console.log(`Migration ${tag} started`);
try {
console.log("Removing any local changes before upgrading");
shell.exec(`git reset`);
shell.exec(`git reset @{u}`);
const statusOutput = shell.exec("git status -s -uno scripts");

if (statusOutput.stdout) {
Expand Down
40 changes: 0 additions & 40 deletions test/protocol/ConfigHandlerTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,46 +158,10 @@ describe("IBosonConfigHandler", function () {
.to.emit(configHandler, "ProtocolFeeFlatBosonChanged")
.withArgs(protocolFeeFlatBoson, deployer.address);

await expect(cutTransaction)
.to.emit(configHandler, "MaxExchangesPerBatchChanged")
.withArgs(maxExchangesPerBatch, deployer.address);

await expect(cutTransaction)
.to.emit(configHandler, "MaxOffersPerGroupChanged")
.withArgs(maxOffersPerGroup, deployer.address);

await expect(cutTransaction)
.to.emit(configHandler, "MaxTwinsPerBundleChanged")
.withArgs(maxTwinsPerBundle, deployer.address);

await expect(cutTransaction)
.to.emit(configHandler, "MaxOffersPerBundleChanged")
.withArgs(maxOffersPerBundle, deployer.address);

await expect(cutTransaction)
.to.emit(configHandler, "MaxOffersPerBatchChanged")
.withArgs(maxOffersPerBatch, deployer.address);

await expect(cutTransaction)
.to.emit(configHandler, "MaxTokensPerWithdrawalChanged")
.withArgs(maxTokensPerWithdrawal, deployer.address);

await expect(cutTransaction)
.to.emit(configHandler, "MaxFeesPerDisputeResolverChanged")
.withArgs(maxFeesPerDisputeResolver, deployer.address);

await expect(cutTransaction)
.to.emit(configHandler, "MaxEscalationResponsePeriodChanged")
.withArgs(maxEscalationResponsePeriod, deployer.address);

await expect(cutTransaction)
.to.emit(configHandler, "MaxDisputesPerBatchChanged")
.withArgs(maxDisputesPerBatch, deployer.address);

await expect(cutTransaction)
.to.emit(configHandler, "MaxAllowedSellersChanged")
.withArgs(maxAllowedSellers, deployer.address);

await expect(cutTransaction)
.to.emit(configHandler, "BuyerEscalationFeePercentageChanged")
.withArgs(buyerEscalationDepositPercentage, deployer.address);
Expand All @@ -213,10 +177,6 @@ describe("IBosonConfigHandler", function () {
await expect(cutTransaction)
.to.emit(configHandler, "MinDisputePeriodChanged")
.withArgs(minDisputePeriod, deployer.address);

await expect(cutTransaction)
.to.emit(configHandler, "MaxPremintedVouchersChanged")
.withArgs(maxPremintedVouchers, deployer.address);
});
});
});
Expand Down
10 changes: 7 additions & 3 deletions test/protocol/ProtocolInitializationHandlerTest.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
const { expect } = require("chai");
const hre = require("hardhat");
const ethers = hre.ethers;
const { keccak256, toUtf8Bytes } = ethers.utils;

const Role = require("../../scripts/domain/Role");
const { deployProtocolDiamond } = require("../../scripts/util/deploy-protocol-diamond.js");
Expand All @@ -12,6 +13,7 @@ const { getFacetAddCut, getFacetReplaceCut } = require("../../scripts/util/diamo
const { RevertReasons } = require("../../scripts/config/revert-reasons.js");
const { getFacetsWithArgs } = require("../util/utils.js");
const { getV2_2_0DeployConfig } = require("../upgrade/00_config.js");
const { getStorageAt } = require("@nomicfoundation/hardhat-network-helpers");

describe("ProtocolInitializationHandler", async function () {
// Common vars
Expand Down Expand Up @@ -56,7 +58,7 @@ describe("ProtocolInitializationHandler", async function () {
version = "2.2.0";

// initialization data for v2.2.0
maxPremintedVouchers = "1000";
maxPremintedVouchers = "10000";
initializationData = ethers.utils.defaultAbiCoder.encode(["uint256"], [maxPremintedVouchers]);
});

Expand Down Expand Up @@ -466,8 +468,10 @@ describe("ProtocolInitializationHandler", async function () {
await getFees(maxPriorityFeePerGas)
);

// Verify that new value is stored
expect(await configHandler.connect(rando).getMaxPremintedVouchers()).to.equal(maxPremintedVouchers);
const protocolLimitsSlot = ethers.BigNumber.from(keccak256(toUtf8Bytes("boson.protocol.limits")));
const maxPremintedVoucherStorage = await getStorageAt(diamondCutFacet.address, protocolLimitsSlot.add(4));

expect(ethers.BigNumber.from(maxPremintedVoucherStorage).toString()).to.equal(maxPremintedVouchers);
});

context("💔 Revert Reasons", async function () {
Expand Down

0 comments on commit 0efcc36

Please sign in to comment.