Skip to content

Commit

Permalink
fix typo
Browse files Browse the repository at this point in the history
  • Loading branch information
zajck committed Nov 18, 2022
1 parent 3f74c0c commit ceecbd2
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 31 deletions.
58 changes: 29 additions & 29 deletions test/upgrade/2.0.0-2.1.0.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const {
mockCondition,
mockTwin,
} = require("../util/mock");
const { setNextBlockTimestamp, paddingType, getMappinStoragePosition } = require("../util/utils.js");
const { setNextBlockTimestamp, paddingType, getMappingStoragePosition } = require("../util/utils.js");
const { oneMonth, oneDay } = require("../util/constants");
const { readContracts } = require("../../scripts/util/utils");
const { getInterfaceIds } = require("../../scripts/config/supported-interfaces.js");
Expand Down Expand Up @@ -829,7 +829,7 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation

const inputTypesState = [];
for (const inputTypeKey of inputTypeKeys) {
const storageSlot = getMappinStoragePosition(metaTxStorageSlotNumber.add("4"), inputTypeKey, paddingType.NONE);
const storageSlot = getMappingStoragePosition(metaTxStorageSlotNumber.add("4"), inputTypeKey, paddingType.NONE);
inputTypesState.push(await getStorageAt(protocolDiamondAddress, storageSlot));
}

Expand All @@ -845,7 +845,7 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation

const hashInfoState = [];
for (const hashInfoType of Object.values(hashInfoTypes)) {
const storageSlot = getMappinStoragePosition(metaTxStorageSlotNumber.add("5"), hashInfoType, paddingType.START);
const storageSlot = getMappingStoragePosition(metaTxStorageSlotNumber.add("5"), hashInfoType, paddingType.START);
// get also hashFunction
hashInfoState.push({
typeHash: await getStorageAt(protocolDiamondAddress, storageSlot),
Expand Down Expand Up @@ -881,7 +881,7 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation

const initializedInterfacesState = [];
for (const interfaceId of Object.values(interfaceIds)) {
const storageSlot = getMappinStoragePosition(
const storageSlot = getMappingStoragePosition(
protocolStatusStorageSlotNumber.add("2"),
interfaceId,
paddingType.END
Expand Down Expand Up @@ -942,7 +942,7 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation
// exchangeIdsByOffer
let exchangeIdsByOffer = [];
const arraySlot = ethers.BigNumber.from(
getMappinStoragePosition(protocolLookupsSlotNumber.add("0"), id, paddingType.START)
getMappingStoragePosition(protocolLookupsSlotNumber.add("0"), id, paddingType.START)
);
const arrayLength = ethers.BigNumber.from(await getStorageAt(protocolDiamondAddress, arraySlot)).toNumber();
const arrayStart = ethers.BigNumber.from(keccak256(arraySlot));
Expand All @@ -955,7 +955,7 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation
groupIdByOfferState.push(
await getStorageAt(
protocolDiamondAddress,
getMappinStoragePosition(protocolLookupsSlotNumber.add("3"), id, paddingType.START)
getMappingStoragePosition(protocolLookupsSlotNumber.add("3"), id, paddingType.START)
)
);
}
Expand All @@ -974,28 +974,28 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation
buyerIdByWallet.push(
await getStorageAt(
protocolDiamondAddress,
getMappinStoragePosition(protocolLookupsSlotNumber.add("8"), accountAddress, paddingType.START)
getMappingStoragePosition(protocolLookupsSlotNumber.add("8"), accountAddress, paddingType.START)
)
);

// agentIdByWallet
agentIdByWallet.push(
await getStorageAt(
protocolDiamondAddress,
getMappinStoragePosition(protocolLookupsSlotNumber.add("13"), accountAddress, paddingType.START)
getMappingStoragePosition(protocolLookupsSlotNumber.add("13"), accountAddress, paddingType.START)
)
);

// conditionalCommitsByAddress
const firstMappingStorageSlot = ethers.BigNumber.from(
getMappinStoragePosition(protocolLookupsSlotNumber.add("19"), accountAddress, paddingType.START)
getMappingStoragePosition(protocolLookupsSlotNumber.add("19"), accountAddress, paddingType.START)
);
let commitsPerGroup = [];
for (let id = 1; id <= groups.length; id++) {
commitsPerGroup.push(
await getStorageAt(
protocolDiamondAddress,
getMappinStoragePosition(firstMappingStorageSlot, id, paddingType.START)
getMappingStoragePosition(firstMappingStorageSlot, id, paddingType.START)
)
);
}
Expand All @@ -1015,47 +1015,47 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation
for (let id = 1; id <= totalCount; id++) {
// disputeResolverFeeTokenIndex
let firstMappingStorageSlot = ethers.BigNumber.from(
getMappinStoragePosition(protocolLookupsSlotNumber.add("12"), id, paddingType.START)
getMappingStoragePosition(protocolLookupsSlotNumber.add("12"), id, paddingType.START)
);
disputeResolverFeeTokenIndex.push({
native: await getStorageAt(
protocolDiamondAddress,
getMappinStoragePosition(firstMappingStorageSlot, ethers.constants.AddressZero, paddingType.START)
getMappingStoragePosition(firstMappingStorageSlot, ethers.constants.AddressZero, paddingType.START)
),
mockToken: await getStorageAt(
protocolDiamondAddress,
getMappinStoragePosition(firstMappingStorageSlot, mockToken.address, paddingType.START)
getMappingStoragePosition(firstMappingStorageSlot, mockToken.address, paddingType.START)
),
});

// tokenIndexByAccount
firstMappingStorageSlot = ethers.BigNumber.from(
getMappinStoragePosition(protocolLookupsSlotNumber.add("16"), id, paddingType.START)
getMappingStoragePosition(protocolLookupsSlotNumber.add("16"), id, paddingType.START)
);
tokenIndexByAccount.push({
native: await getStorageAt(
protocolDiamondAddress,
getMappinStoragePosition(firstMappingStorageSlot, ethers.constants.AddressZero, paddingType.START)
getMappingStoragePosition(firstMappingStorageSlot, ethers.constants.AddressZero, paddingType.START)
),
mockToken: await getStorageAt(
protocolDiamondAddress,
getMappinStoragePosition(firstMappingStorageSlot, mockToken.address, paddingType.START)
getMappingStoragePosition(firstMappingStorageSlot, mockToken.address, paddingType.START)
),
});

// cloneAddress
cloneAddress.push(
await getStorageAt(
protocolDiamondAddress,
getMappinStoragePosition(protocolLookupsSlotNumber.add("17"), id, paddingType.START)
getMappingStoragePosition(protocolLookupsSlotNumber.add("17"), id, paddingType.START)
)
);

// voucherCount
voucherCount.push(
await getStorageAt(
protocolDiamondAddress,
getMappinStoragePosition(protocolLookupsSlotNumber.add("18"), id, paddingType.START)
getMappingStoragePosition(protocolLookupsSlotNumber.add("18"), id, paddingType.START)
)
);
}
Expand All @@ -1064,12 +1064,12 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation
let twinRangesBySeller = [];
for (let id = 1; id <= totalCount; id++) {
const firstMappingStorageSlot = ethers.BigNumber.from(
getMappinStoragePosition(protocolLookupsSlotNumber.add("22"), id, paddingType.START)
getMappingStoragePosition(protocolLookupsSlotNumber.add("22"), id, paddingType.START)
);
let ranges = {};
for (let mockTwin of mockTwinTokens) {
ranges[mockTwin.address] = [];
const arraySlot = getMappinStoragePosition(firstMappingStorageSlot, mockTwin.address, paddingType.START);
const arraySlot = getMappingStoragePosition(firstMappingStorageSlot, mockTwin.address, paddingType.START);
const arrayLength = ethers.BigNumber.from(await getStorageAt(protocolDiamondAddress, arraySlot)).toNumber();
const arrayStart = ethers.BigNumber.from(keccak256(arraySlot));
for (let i = 0; i < arrayLength * 2; i = i + 2) {
Expand All @@ -1087,12 +1087,12 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation
let twinIdsByTokenAddressAndBySeller = [];
for (let id = 1; id <= totalCount; id++) {
const firstMappingStorageSlot = ethers.BigNumber.from(
getMappinStoragePosition(protocolLookupsSlotNumber.add("23"), id, paddingType.START)
getMappingStoragePosition(protocolLookupsSlotNumber.add("23"), id, paddingType.START)
);
let twinIds = {};
for (let mockTwin of mockTwinTokens) {
twinIds[mockTwin.address] = [];
const arraySlot = getMappinStoragePosition(firstMappingStorageSlot, mockTwin.address, paddingType.START);
const arraySlot = getMappingStoragePosition(firstMappingStorageSlot, mockTwin.address, paddingType.START);
const arrayLength = ethers.BigNumber.from(await getStorageAt(protocolDiamondAddress, arraySlot)).toNumber();
const arrayStart = ethers.BigNumber.from(keccak256(arraySlot));
for (let i = 0; i < arrayLength; i++) {
Expand All @@ -1106,7 +1106,7 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation
let allowedSellerIndex = [];
for (const DR of DRs) {
const firstMappingStorageSlot = ethers.BigNumber.from(
getMappinStoragePosition(
getMappingStoragePosition(
protocolLookupsSlotNumber.add("26"),
ethers.BigNumber.from(DR.disputeResolver.id).toHexString(),
paddingType.START
Expand All @@ -1117,7 +1117,7 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation
sellerStatus.push(
await getStorageAt(
protocolDiamondAddress,
getMappinStoragePosition(
getMappingStoragePosition(
firstMappingStorageSlot,
ethers.BigNumber.from(seller.seller.id).toHexString(),
paddingType.START
Expand All @@ -1132,14 +1132,14 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation
let offerIdIndexByGroup = [];
for (let id = 1; id <= groups.length; id++) {
const firstMappingStorageSlot = ethers.BigNumber.from(
getMappinStoragePosition(protocolLookupsSlotNumber.add("28"), id, paddingType.START)
getMappingStoragePosition(protocolLookupsSlotNumber.add("28"), id, paddingType.START)
);
let offerInidices = [];
for (let id2 = 1; id2 <= offers.length; id2++) {
offerInidices.push(
await getStorageAt(
protocolDiamondAddress,
getMappinStoragePosition(firstMappingStorageSlot, id2, paddingType.START)
getMappingStoragePosition(firstMappingStorageSlot, id2, paddingType.START)
)
);
}
Expand All @@ -1155,7 +1155,7 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation
for (let id = 1; id <= totalCount; id++) {
// pendingAddressUpdatesBySeller
let structStorageSlot = ethers.BigNumber.from(
getMappinStoragePosition(protocolLookupsSlotNumber.add("29"), id, paddingType.START)
getMappingStoragePosition(protocolLookupsSlotNumber.add("29"), id, paddingType.START)
);
let structFields = [];
for (let i = 0; i < 5; i++) {
Expand All @@ -1166,7 +1166,7 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation

// pendingAuthTokenUpdatesBySeller
structStorageSlot = ethers.BigNumber.from(
getMappinStoragePosition(protocolLookupsSlotNumber.add("30"), id, paddingType.START)
getMappingStoragePosition(protocolLookupsSlotNumber.add("30"), id, paddingType.START)
);
structFields = [];
for (let i = 0; i < 2; i++) {
Expand All @@ -1177,7 +1177,7 @@ describe("[@skip-on-coverage] After facet upgrade, everything is still operation

// pendingAddressUpdatesByDisputeResolver
structStorageSlot = ethers.BigNumber.from(
getMappinStoragePosition(protocolLookupsSlotNumber.add("31"), id, paddingType.START)
getMappingStoragePosition(protocolLookupsSlotNumber.add("31"), id, paddingType.START)
);
structFields = [];
for (let i = 0; i < 8; i++) {
Expand Down
4 changes: 2 additions & 2 deletions test/util/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ const paddingType = {
END: 2,
};

function getMappinStoragePosition(slot, key, padding = paddingType.NONE) {
function getMappingStoragePosition(slot, key, padding = paddingType.NONE) {
let keyBuffer;
switch (padding) {
case paddingType.NONE:
Expand All @@ -209,4 +209,4 @@ exports.calculateVoucherExpiry = calculateVoucherExpiry;
exports.calculateContractAddress = calculateContractAddress;
exports.applyPercentage = applyPercentage;
exports.paddingType = paddingType;
exports.getMappinStoragePosition = getMappinStoragePosition;
exports.getMappingStoragePosition = getMappingStoragePosition;

0 comments on commit ceecbd2

Please sign in to comment.