Skip to content

Commit

Permalink
test: fix Typescript errors in Benchmark.test.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
CJ42 committed Oct 2, 2023
1 parent 759912a commit 1b6ec54
Showing 1 changed file with 1 addition and 64 deletions.
65 changes: 1 addition & 64 deletions tests/Benchmark.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -654,8 +654,6 @@ describe('⛽📊 Gas Benchmark', () => {
describe('KeyManager', () => {
describe('`execute(...)` via Key Manager', () => {
describe('main controller (this browser extension)', () => {
const casesExecuteMainController: Row[] = [];

let context: LSP6TestContext;

let recipientEOA: SignerWithAddress;
Expand Down Expand Up @@ -724,11 +722,6 @@ describe('⛽📊 Gas Benchmark', () => {
const tx = await context.universalProfile.connect(context.owner).execute(OPERATION_TYPES.CALL, recipientEOA.address, lyxAmount, "0x");
const receipt = await tx.wait();

casesExecuteMainController.push([
'transfer LYX to an EOA',
receipt.gasUsed.toNumber().toString(),
]);

gasBenchmark['runtime_costs']['KeyManager_owner']['execute']['case_1'][
'main_controller'
] = receipt.gasUsed.toNumber();
Expand All @@ -741,11 +734,6 @@ describe('⛽📊 Gas Benchmark', () => {
const tx = await context.universalProfile.connect(context.owner).execute(OPERATION_TYPES.CALL, aliceUP.address, lyxAmount, "0x");
const receipt = await tx.wait();

casesExecuteMainController.push([
'transfer LYX to a UP',
receipt.gasUsed.toNumber().toString(),
]);

gasBenchmark['runtime_costs']['KeyManager_owner']['execute']['case_2'][
'main_controller'
] = receipt.gasUsed.toNumber();
Expand All @@ -769,11 +757,6 @@ describe('⛽📊 Gas Benchmark', () => {
);
const receipt = await tx.wait();

casesExecuteMainController.push([
'transfer tokens (LSP7) to an EOA (no data)',
receipt.gasUsed.toNumber().toString(),
]);

gasBenchmark['runtime_costs']['KeyManager_owner']['execute']['case_3'][
'main_controller'
] = receipt.gasUsed.toNumber();
Expand All @@ -797,11 +780,6 @@ describe('⛽📊 Gas Benchmark', () => {
);
const receipt = await tx.wait();

casesExecuteMainController.push([
'transfer tokens (LSP7) to a UP (no data)',
receipt.gasUsed.toNumber().toString(),
]);

gasBenchmark['runtime_costs']['KeyManager_owner']['execute']['case_4'][
'main_controller'
] = receipt.gasUsed.toNumber();
Expand All @@ -825,11 +803,6 @@ describe('⛽📊 Gas Benchmark', () => {
);
const receipt = await tx.wait();

casesExecuteMainController.push([
'transfer a NFT (LSP8) to a EOA (no data)',
receipt.gasUsed.toNumber().toString(),
]);

gasBenchmark['runtime_costs']['KeyManager_owner']['execute']['case_5'][
'main_controller'
] = receipt.gasUsed.toNumber();
Expand All @@ -853,19 +826,13 @@ describe('⛽📊 Gas Benchmark', () => {
);
const receipt = await tx.wait();

casesExecuteMainController.push([
'transfer a NFT (LSP8) to a UP (no data)',
receipt.gasUsed.toNumber().toString(),
]);

gasBenchmark['runtime_costs']['KeyManager_owner']['execute']['case_6'][
'main_controller'
] = receipt.gasUsed.toNumber();
});
});

describe('controllers with some restrictions', () => {
const casesExecuteRestrictedController: Row[] = [];
let context: LSP6TestContext;

let recipientEOA: SignerWithAddress;
Expand Down Expand Up @@ -1002,11 +969,6 @@ describe('⛽📊 Gas Benchmark', () => {
.execute(OPERATION_TYPES.CALL, allowedAddressToTransferValue, lyxAmount, '0x');
const receipt = await tx.wait();

casesExecuteRestrictedController.push([
'transfer some LYXes to an EOA - restricted to 2 x allowed address only (an EOA + a UP) (TRANSFERVALUE + 2x AllowedCalls)',
receipt.gasUsed.toNumber().toString(),
]);

gasBenchmark['runtime_costs']['KeyManager_owner']['execute']['case_1'][
'restricted_controller'
] = receipt.gasUsed.toNumber();
Expand All @@ -1021,11 +983,6 @@ describe('⛽📊 Gas Benchmark', () => {
.execute(OPERATION_TYPES.CALL, aliceUP.address, lyxAmount, '0x');
const receipt = await tx.wait();

casesExecuteRestrictedController.push([
'transfer some LYXes to a UP - restricted to 2 x allowed address only (an EOA + a UP) (TRANSFERVALUE + 2x AllowedCalls)',
receipt.gasUsed.toNumber().toString(),
]);

gasBenchmark['runtime_costs']['KeyManager_owner']['execute']['case_2'][
'restricted_controller'
] = receipt.gasUsed.toNumber();
Expand All @@ -1049,11 +1006,6 @@ describe('⛽📊 Gas Benchmark', () => {
);
const receipt = await tx.wait();

casesExecuteRestrictedController.push([
'transfers some tokens (LSP7) to an EOA - restricted to LSP7 + 2x allowed contracts only (CALL + 2x AllowedCalls) (no data)',
receipt.gasUsed.toNumber().toString(),
]);

gasBenchmark['runtime_costs']['KeyManager_owner']['execute']['case_3'][
'restricted_controller'
] = receipt.gasUsed.toNumber();
Expand All @@ -1077,11 +1029,6 @@ describe('⛽📊 Gas Benchmark', () => {
);
const receipt = await tx.wait();

casesExecuteRestrictedController.push([
'transfers some tokens (LSP7) to an other UP - restricted to LSP7 + 2x allowed contracts only (CALL + 2x AllowedCalls) (no data)',
receipt.gasUsed.toNumber().toString(),
]);

gasBenchmark['runtime_costs']['KeyManager_owner']['execute']['case_4'][
'restricted_controller'
] = receipt.gasUsed.toNumber();
Expand All @@ -1105,11 +1052,6 @@ describe('⛽📊 Gas Benchmark', () => {
);
const receipt = await tx.wait();

casesExecuteRestrictedController.push([
'transfers a NFT (LSP8) to an EOA - restricted to LSP8 + 2x allowed contracts only (CALL + 2x AllowedCalls) (no data)',
receipt.gasUsed.toNumber().toString(),
]);

gasBenchmark['runtime_costs']['KeyManager_owner']['execute']['case_5'][
'restricted_controller'
] = receipt.gasUsed.toNumber();
Expand All @@ -1133,11 +1075,6 @@ describe('⛽📊 Gas Benchmark', () => {
);
const receipt = await tx.wait();

casesExecuteRestrictedController.push([
'transfers a NFT (LSP8) to an other UP - restricted to LSP8 + 2x allowed contracts only (CALL + 2x AllowedCalls) (no data)',
receipt.gasUsed.toNumber().toString(),
]);

gasBenchmark['runtime_costs']['KeyManager_owner']['execute']['case_6'][
'restricted_controller'
] = receipt.gasUsed.toNumber();
Expand Down Expand Up @@ -1642,7 +1579,7 @@ describe('⛽📊 Gas Benchmark', () => {
// prettier-ignore
const dataKeys = [
ERC725YDataKeys.LSP6["AddressPermissions[]"].length,
ERC725YDataKeys.LSP6["AddressPermissions[]"].index + ethers.utils.hexZeroPad(ethers.BigNumber.from(AddressPermissionsArrayLength).sub(1), 16).substring(2),
ERC725YDataKeys.LSP6["AddressPermissions[]"].index + ethers.utils.hexZeroPad(ethers.BigNumber.from(AddressPermissionsArrayLength).sub(1).toHexString(), 16).substring(2),
ERC725YDataKeys.LSP6["AddressPermissions:Permissions"] + newController.address.substring(2),
ERC725YDataKeys.LSP6["AddressPermissions:AllowedERC725YDataKeys"] + newController.address.substring(2),
];
Expand Down

0 comments on commit 1b6ec54

Please sign in to comment.