Skip to content

Commit

Permalink
Merge pull request #982 from lukso-network/test/fix-foundry-tests-dep…
Browse files Browse the repository at this point in the history
…endencies

build: fix Foundry test failing and `@erc725/smart-contracts` dependency clash between package
  • Loading branch information
CJ42 authored Oct 23, 2024
2 parents d16a366 + 9a71438 commit b428604
Show file tree
Hide file tree
Showing 33 changed files with 1,629 additions and 1,666 deletions.
5 changes: 5 additions & 0 deletions foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ solc_version = "0.8.17"
runs = 10_000
max_test_rejects = 200_000

[profile.lsp0]
src = 'packages/lsp0-contracts/contracts'
test = 'packages/lsp0-contracts/foundry'
out = 'packages/lsp0-contracts/contracts/foundry_artifacts'

[profile.lsp2]
src = 'packages/lsp2-contracts/contracts'
test = 'packages/lsp2-contracts/foundry'
Expand Down
2,953 changes: 1,436 additions & 1,517 deletions package-lock.json

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@
"test:reentrancy": "hardhat test --no-compile packages/lsp-smart-contracts/tests/Reentrancy/Reentrancy.test.ts",
"test:reentrancyinit": "hardhat test --no-compile packages/lsp-smart-contracts/tests/Reentrancy/ReentrancyInit.test.ts"
},
"dependencies": {
"@erc725/smart-contracts-v8": "npm:@erc725/[email protected]"
},
"devDependencies": {
"@b00ste/hardhat-dodoc": "^0.3.16",
"@erc725/erc725.js": "0.23.0",
Expand Down
4 changes: 2 additions & 2 deletions packages/lsp-smart-contracts/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ export type {
LSP4DigitalAssetMetadataJSON,
LSP4DigitalAssetMetadata,
AttributeMetadata,
AssetFile,
DigitalAsset,
FileAsset,
ContractAsset,
} from '@lukso/lsp4-contracts';
export type { LSP6PermissionName } from '@lukso/lsp6-contracts';

Expand Down
44 changes: 22 additions & 22 deletions packages/lsp-smart-contracts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,27 +68,27 @@
"test:benchmark": "hardhat test --no-compile tests/Benchmark.test.ts"
},
"dependencies": {
"@lukso/lsp0-contracts": "~0.15.0",
"@lukso/lsp1-contracts": "~0.15.0",
"@lukso/lsp10-contracts": "~0.15.0",
"@lukso/lsp12-contracts": "~0.15.0",
"@lukso/lsp14-contracts": "~0.15.0",
"@lukso/lsp16-contracts": "~0.15.0",
"@lukso/lsp17-contracts": "~0.15.0",
"@lukso/lsp17contractextension-contracts": "~0.15.0",
"@lukso/lsp1delegate-contracts": "~0.15.0",
"@lukso/lsp2-contracts": "~0.15.0",
"@lukso/lsp20-contracts": "~0.15.0",
"@lukso/lsp23-contracts": "~0.15.0",
"@lukso/lsp25-contracts": "~0.15.0",
"@lukso/lsp26-contracts": "~0.15.0",
"@lukso/lsp3-contracts": "~0.15.0",
"@lukso/lsp4-contracts": "~0.15.0",
"@lukso/lsp5-contracts": "~0.15.0",
"@lukso/lsp6-contracts": "~0.15.0",
"@lukso/lsp7-contracts": "~0.15.0",
"@lukso/lsp8-contracts": "~0.15.0",
"@lukso/lsp9-contracts": "~0.15.0",
"@lukso/universalprofile-contracts": "~0.15.0"
"@lukso/lsp0-contracts": "*",
"@lukso/lsp1-contracts": "*",
"@lukso/lsp10-contracts": "*",
"@lukso/lsp12-contracts": "*",
"@lukso/lsp14-contracts": "*",
"@lukso/lsp16-contracts": "*",
"@lukso/lsp17-contracts": "*",
"@lukso/lsp17contractextension-contracts": "*",
"@lukso/lsp1delegate-contracts": "*",
"@lukso/lsp2-contracts": "*",
"@lukso/lsp20-contracts": "*",
"@lukso/lsp23-contracts": "*",
"@lukso/lsp25-contracts": "*",
"@lukso/lsp26-contracts": "*",
"@lukso/lsp3-contracts": "*",
"@lukso/lsp4-contracts": "*",
"@lukso/lsp5-contracts": "*",
"@lukso/lsp6-contracts": "*",
"@lukso/lsp7-contracts": "*",
"@lukso/lsp8-contracts": "*",
"@lukso/lsp9-contracts": "*",
"@lukso/universalprofile-contracts": "*"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ describe('When deploying LSP7 with LSP6 as owner', () => {

await expect(
context.keyManager.connect(context.mainController).execute(payload),
).to.be.revertedWithCustomError(context.token, 'OwnableCallerNotTheOwner');
).to.be.revertedWith('Ownable: caller is not the owner');
});

it('should allow the new owner to call setData(..)', async () => {
Expand Down Expand Up @@ -212,7 +212,7 @@ describe('When deploying LSP7 with LSP6 as owner', () => {

await expect(
context.keyManager.connect(context.mainController).execute(transferOwnershipPayload),
).to.be.revertedWithCustomError(context.token, 'OwnableCallerNotTheOwner');
).to.be.revertedWith('Ownable: caller is not the owner');
});

it('should allow the new owner to call transferOwnership(..)', async () => {
Expand All @@ -227,7 +227,7 @@ describe('When deploying LSP7 with LSP6 as owner', () => {

await expect(
context.keyManager.connect(context.mainController).execute(renounceOwnershipPayload),
).to.be.revertedWithCustomError(context.token, 'OwnableCallerNotTheOwner');
).to.be.revertedWith('Ownable: caller is not the owner');
});

it('should allow the new owner to call renounceOwnership(..)', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2128,7 +2128,7 @@ export const shouldBehaveLikeLSP7 = (buildContext: () => Promise<LSP7TestContext
const newOwner = context.accounts.anyone;
await expect(
context.lsp7.connect(newOwner).transferOwnership(newOwner.address),
).to.be.revertedWithCustomError(context.lsp7, 'OwnableCallerNotTheOwner');
).to.be.revertedWith('Ownable: caller is not the owner');
});

describe('after transferring ownership of the contract', () => {
Expand All @@ -2140,21 +2140,21 @@ export const shouldBehaveLikeLSP7 = (buildContext: () => Promise<LSP7TestContext
const randomAddress = context.accounts.anyone.address;
await expect(
context.lsp7.connect(oldOwner).transferOwnership(randomAddress),
).to.be.revertedWithCustomError(context.lsp7, 'OwnableCallerNotTheOwner');
).to.be.revertedWith('Ownable: caller is not the owner');
});

it('old owner should not be allowed to use `renounceOwnership(..)`', async () => {
await expect(
context.lsp7.connect(oldOwner).renounceOwnership(),
).to.be.revertedWithCustomError(context.lsp7, 'OwnableCallerNotTheOwner');
await expect(context.lsp7.connect(oldOwner).renounceOwnership()).to.be.revertedWith(
'Ownable: caller is not the owner',
);
});

it('old owner should not be allowed to use `setData(..)`', async () => {
const key = ethers.keccak256(ethers.toUtf8Bytes('key'));
const value = ethers.keccak256(ethers.toUtf8Bytes('value'));
await expect(
context.lsp7.connect(oldOwner).setData(key, value),
).to.be.revertedWithCustomError(context.lsp7, 'OwnableCallerNotTheOwner');
await expect(context.lsp7.connect(oldOwner).setData(key, value)).to.be.revertedWith(
'Ownable: caller is not the owner',
);
});

it('new owner should be allowed to use `transferOwnership(..)`', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export const shouldBehaveLikeLSP7Mintable = (

await expect(
context.lsp7Mintable.connect(nonOwner).mint(nonOwner.address, amountToMint, true, '0x'),
).to.be.revertedWithCustomError(context.lsp7Mintable, 'OwnableCallerNotTheOwner');
).to.be.revertedWith('Ownable: caller is not the owner');
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ export const shouldBehaveLikeLSP8 = (
context.lsp8
.connect(context.accounts.anyone)
.setDataForTokenId(tokenId, dataKey, dataValue),
).to.be.revertedWithCustomError(context.lsp8, 'OwnableCallerNotTheOwner');
).to.be.revertedWith('Ownable: caller is not the owner');
});

it('TokenIdDataChanged emitted when data is set for a specific tokenId', async () => {
Expand Down Expand Up @@ -1795,7 +1795,7 @@ export const shouldBehaveLikeLSP8 = (
const newOwner = context.accounts.anyone;
await expect(
context.lsp8.connect(newOwner).transferOwnership(newOwner.address),
).to.be.revertedWithCustomError(context.lsp8, 'OwnableCallerNotTheOwner');
).to.be.revertedWith('Ownable: caller is not the owner');
});

it('should transfer ownership of the contract', async () => {
Expand All @@ -1814,21 +1814,21 @@ export const shouldBehaveLikeLSP8 = (
const randomAddress = context.accounts.anyone.address;
await expect(
context.lsp8.connect(oldOwner).transferOwnership(randomAddress),
).to.be.revertedWithCustomError(context.lsp8, 'OwnableCallerNotTheOwner');
).to.be.revertedWith('Ownable: caller is not the owner');
});

it('old owner should not be allowed to use `renounceOwnership(..)`', async () => {
await expect(
context.lsp8.connect(oldOwner).renounceOwnership(),
).to.be.revertedWithCustomError(context.lsp8, 'OwnableCallerNotTheOwner');
await expect(context.lsp8.connect(oldOwner).renounceOwnership()).to.be.revertedWith(
'Ownable: caller is not the owner',
);
});

it('old owner should not be allowed to use `setData(..)`', async () => {
const key = ethers.keccak256(ethers.toUtf8Bytes('key'));
const value = ethers.keccak256(ethers.toUtf8Bytes('value'));
await expect(
context.lsp8.connect(oldOwner).setData(key, value),
).to.be.revertedWithCustomError(context.lsp8, 'OwnableCallerNotTheOwner');
await expect(context.lsp8.connect(oldOwner).setData(key, value)).to.be.revertedWith(
'Ownable: caller is not the owner',
);
});

it('new owner should be allowed to use `transferOwnership(..)`', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export const shouldBehaveLikeLSP8Mintable = (
context.lsp8Mintable
.connect(nonOwner)
.mint(context.accounts.tokenReceiver.address, randomTokenId, true, '0x'),
).to.be.revertedWithCustomError(context.lsp8Mintable, 'OwnableCallerNotTheOwner');
).to.be.revertedWith('Ownable: caller is not the owner');
});
});

Expand Down

This file was deleted.

2 changes: 1 addition & 1 deletion packages/lsp0-contracts/constants.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// ERC165 Interface ID
// ----------
export const INTERFACE_ID_LSP0ERC725Account = '0x24871b3d';
export const INTERFACE_ID_LSP0 = '0x24871b3d';

// ERC1271
// ----------
Expand Down
13 changes: 7 additions & 6 deletions packages/lsp0-contracts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,16 @@
"clean": "hardhat clean && rm -Rf dist/",
"format": "prettier --write .",
"lint": "eslint . --ext .ts,.js",
"lint:solidity": "solhint 'contracts/**/*.sol' && prettier --check 'contracts/**/*.sol'"
"lint:solidity": "solhint 'contracts/**/*.sol' && prettier --check 'contracts/**/*.sol'",
"test:foundry": "FOUNDRY_PROFILE=lsp0 forge test -vvv"
},
"dependencies": {
"@erc725/smart-contracts": "^7.0.0",
"@openzeppelin/contracts": "^4.9.6",
"@lukso/lsp1-contracts": "~0.15.0",
"@lukso/lsp2-contracts": "~0.15.0",
"@lukso/lsp14-contracts": "~0.15.0",
"@lukso/lsp17contractextension-contracts": "~0.15.0",
"@lukso/lsp20-contracts": "~0.15.0"
"@lukso/lsp1-contracts": "*",
"@lukso/lsp2-contracts": "*",
"@lukso/lsp14-contracts": "*",
"@lukso/lsp17contractextension-contracts": "*",
"@lukso/lsp20-contracts": "*"
}
}
2 changes: 1 addition & 1 deletion packages/lsp10-contracts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,6 @@
},
"dependencies": {
"@erc725/smart-contracts": "^7.0.0",
"@lukso/lsp2-contracts": "~0.15.0"
"@lukso/lsp2-contracts": "*"
}
}
2 changes: 1 addition & 1 deletion packages/lsp11-contracts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
},
"dependencies": {
"@erc725/smart-contracts": "^7.0.0",
"@lukso/lsp25-contracts": "~0.15.0",
"@lukso/lsp25-contracts": "*",
"@openzeppelin/contracts": "^4.9.3"
}
}
6 changes: 3 additions & 3 deletions packages/lsp17-contracts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@
"@erc725/smart-contracts": "^7.0.0",
"@openzeppelin/contracts": "^4.9.6",
"@account-abstraction/contracts": "^0.6.0",
"@lukso/lsp14-contracts": "~0.15.0",
"@lukso/lsp17contractextension-contracts": "~0.15.0",
"@lukso/lsp20-contracts": "~0.15.0"
"@lukso/lsp14-contracts": "*",
"@lukso/lsp17contractextension-contracts": "*",
"@lukso/lsp20-contracts": "*"
}
}
12 changes: 6 additions & 6 deletions packages/lsp1delegate-contracts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@
"dependencies": {
"@erc725/smart-contracts": "^7.0.0",
"@openzeppelin/contracts": "^4.9.6",
"@lukso/lsp1-contracts": "~0.15.0",
"@lukso/lsp5-contracts": "~0.15.0",
"@lukso/lsp7-contracts": "~0.15.0",
"@lukso/lsp8-contracts": "~0.15.0",
"@lukso/lsp9-contracts": "~0.15.0",
"@lukso/lsp10-contracts": "~0.15.0"
"@lukso/lsp1-contracts": "*",
"@lukso/lsp5-contracts": "*",
"@lukso/lsp7-contracts": "*",
"@lukso/lsp8-contracts": "*",
"@lukso/lsp9-contracts": "*",
"@lukso/lsp10-contracts": "*"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
pragma solidity ^0.8.4;

// modules
import {ERC725Y} from "@erc725/smart-contracts/contracts/ERC725Y.sol";
import {ERC725Y} from "@erc725/smart-contracts-v8/contracts/ERC725Y.sol";

// constants
import {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ pragma solidity ^0.8.4;
// modules
import {
ERC725YInitAbstract
} from "@erc725/smart-contracts/contracts/ERC725YInitAbstract.sol";
} from "@erc725/smart-contracts-v8/contracts/ERC725YInitAbstract.sol";

// constants
import {
Expand Down
Binary file not shown.
2 changes: 1 addition & 1 deletion packages/lsp4-contracts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"lint:solidity": "solhint 'contracts/**/*.sol' && prettier --check 'contracts/**/*.sol'"
},
"dependencies": {
"@erc725/smart-contracts": "^8.0.0",
"@erc725/smart-contracts-v8": "npm:@erc725/smart-contracts@8.0.0",
"@lukso/lsp2-contracts": "*"
}
}
Loading

0 comments on commit b428604

Please sign in to comment.