Skip to content

Commit 5c041e8

Browse files
committed
test: implement the first emit artifacts test
1 parent fc2e236 commit 5c041e8

File tree

20 files changed

+1036
-3
lines changed

20 files changed

+1036
-3
lines changed

v-next/hardhat/src/internal/builtin-plugins/solidity/build-system/build-system.ts

+1-3
Original file line numberDiff line numberDiff line change
@@ -481,11 +481,9 @@ export class SolidityBuildSystemImplementation implements SolidityBuildSystem {
481481
return result;
482482
}
483483

484-
public async cleanupArtifacts(): Promise<void> {
484+
public async cleanupArtifacts(rootFilePaths: string[]): Promise<void> {
485485
log(`Cleaning up artifacts`);
486486

487-
const rootFilePaths = await this.getRootFilePaths();
488-
489487
const publicSourceNames = rootFilePaths.map((rootFilePath) => {
490488
const parsed = parseRootPath(rootFilePath);
491489
return isNpmParsedRootPath(parsed)

v-next/hardhat/test/fixture-projects/solidity/example-project/artifacts/artifacts.d.ts

Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{
2+
"_format": "hh3-sol-build-info-1",
3+
"id": "89eed7b31e13eec3ee71467386d39108",
4+
"solcVersion": "0.7.1",
5+
"solcLongVersion": "0.7.1+commit.f4a555be",
6+
"publicSourceNameMap": {
7+
"contracts/NoImports.sol": "contracts/NoImports.sol"
8+
},
9+
"input": {
10+
"language": "Solidity",
11+
"sources": {
12+
"contracts/NoImports.sol": {
13+
"content": "// SPDX-License-Identifier: SEE LICENSE IN LICENSE\npragma solidity ^0.7.0;\n\ncontract NoImports {}\n"
14+
}
15+
},
16+
"settings": {
17+
"evmVersion": "istanbul",
18+
"outputSelection": {
19+
"*": {
20+
"": ["ast"]
21+
},
22+
"contracts/NoImports.sol": {
23+
"*": [
24+
"abi",
25+
"evm.bytecode",
26+
"evm.deployedBytecode",
27+
"evm.methodIdentifiers",
28+
"metadata"
29+
]
30+
}
31+
},
32+
"remappings": [
33+
"remapped/=npm/@openzeppelin/[email protected]/access/",
34+
"@openzeppelin/contracts/=npm/@openzeppelin/[email protected]/"
35+
]
36+
}
37+
}
38+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
{
2+
"_format": "hh3-sol-build-info-output-1",
3+
"id": "89eed7b31e13eec3ee71467386d39108",
4+
"output": {
5+
"contracts": {
6+
"contracts/NoImports.sol": {
7+
"NoImports": {
8+
"abi": [],
9+
"evm": {
10+
"bytecode": {
11+
"linkReferences": {},
12+
"object": "6080604052348015600f57600080fd5b50603f80601d6000396000f3fe6080604052600080fdfea2646970667358221220622ff1f92fb75a340477cc69a6f9fcbbd9518f40d01c4ed0fc96c42f94e05c5a64736f6c63430007010033",
13+
"opcodes": "PUSH1 0x80 PUSH1 0x40 MSTORE CALLVALUE DUP1 ISZERO PUSH1 0xF JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x3F DUP1 PUSH1 0x1D PUSH1 0x0 CODECOPY PUSH1 0x0 RETURN INVALID PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x0 DUP1 REVERT INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 PUSH3 0x2FF1F9 0x2F 0xB7 GAS CALLVALUE DIV PUSH24 0xCC69A6F9FCBBD9518F40D01C4ED0FC96C42F94E05C5A6473 PUSH16 0x6C634300070100330000000000000000 ",
14+
"sourceMap": "76:21:0:-:0;;;;;;;;;;;;;;;;;;;"
15+
},
16+
"deployedBytecode": {
17+
"immutableReferences": {},
18+
"linkReferences": {},
19+
"object": "6080604052600080fdfea2646970667358221220622ff1f92fb75a340477cc69a6f9fcbbd9518f40d01c4ed0fc96c42f94e05c5a64736f6c63430007010033",
20+
"opcodes": "PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x0 DUP1 REVERT INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 PUSH3 0x2FF1F9 0x2F 0xB7 GAS CALLVALUE DIV PUSH24 0xCC69A6F9FCBBD9518F40D01C4ED0FC96C42F94E05C5A6473 PUSH16 0x6C634300070100330000000000000000 ",
21+
"sourceMap": "76:21:0:-:0;;;;;"
22+
},
23+
"methodIdentifiers": {}
24+
},
25+
"metadata": "{\"compiler\":{\"version\":\"0.7.1+commit.f4a555be\"},\"language\":\"Solidity\",\"output\":{\"abi\":[],\"devdoc\":{\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/NoImports.sol\":\"NoImports\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":false,\"runs\":200},\"remappings\":[\":@openzeppelin/contracts/=npm/@openzeppelin/[email protected]/\",\":remapped/=npm/@openzeppelin/[email protected]/access/\"]},\"sources\":{\"contracts/NoImports.sol\":{\"keccak256\":\"0x3a28c66ec59da4cb822584ed8f391ddaff26410fb89766d49d577497823bc5ea\",\"license\":\"SEE LICENSE IN LICENSE\",\"urls\":[\"bzz-raw://fb9c7244739857b5c2b14000e0cdf717a521671457ed04d73bf4dfce002cf454\",\"dweb:/ipfs/QmZH2Ky7fy8Q87bsf7g9wcMnM1qNJQLzjcyQSG8nX84yPY\"]}},\"version\":1}"
26+
}
27+
}
28+
},
29+
"sources": {
30+
"contracts/NoImports.sol": {
31+
"ast": {
32+
"absolutePath": "contracts/NoImports.sol",
33+
"exportedSymbols": { "NoImports": [2] },
34+
"id": 3,
35+
"license": "SEE LICENSE IN LICENSE",
36+
"nodeType": "SourceUnit",
37+
"nodes": [
38+
{
39+
"id": 1,
40+
"literals": ["solidity", "^", "0.7", ".0"],
41+
"nodeType": "PragmaDirective",
42+
"src": "51:23:0"
43+
},
44+
{
45+
"abstract": false,
46+
"baseContracts": [],
47+
"contractDependencies": [],
48+
"contractKind": "contract",
49+
"fullyImplemented": true,
50+
"id": 2,
51+
"linearizedBaseContracts": [2],
52+
"name": "NoImports",
53+
"nodeType": "ContractDefinition",
54+
"nodes": [],
55+
"scope": 3,
56+
"src": "76:21:0"
57+
}
58+
],
59+
"src": "51:47:0"
60+
},
61+
"id": 0
62+
}
63+
}
64+
}
65+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
{
2+
"_format": "hh3-sol-build-info-1",
3+
"id": "c6d3d46c7bda8aac0e4258c216012f50",
4+
"solcVersion": "0.8.22",
5+
"solcLongVersion": "0.8.22+commit.4fc1097e",
6+
"publicSourceNameMap": {
7+
"contracts/A.sol": "contracts/A.sol",
8+
"contracts/B.sol": "contracts/B.sol",
9+
"contracts/C.sol": "contracts/C.sol",
10+
"contracts/D.sol": "contracts/D.sol",
11+
"contracts/E.sol": "contracts/E.sol",
12+
"contracts/UserRemappedImport.sol": "contracts/UserRemappedImport.sol"
13+
},
14+
"input": {
15+
"language": "Solidity",
16+
"sources": {
17+
"contracts/A.sol": {
18+
"content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.0;\npragma solidity *;\n\nimport \"./B.sol\";\n\ncontract A is B {}\n"
19+
},
20+
"contracts/B.sol": {
21+
"content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\n\ncontract B {}\n"
22+
},
23+
"contracts/C.sol": {
24+
"content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.0;\n\nimport \"./B.sol\";\n\ncontract C {}\n\ncontract C2 {}\n"
25+
},
26+
"contracts/D.sol": {
27+
"content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.22;\n\nimport \"./C.sol\";\n"
28+
},
29+
"contracts/E.sol": {
30+
"content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.22;\n\nimport \"./C.sol\";\n"
31+
},
32+
"contracts/UserRemappedImport.sol": {
33+
"content": "// SPDX-License-Identifier: SEE LICENSE IN LICENSE\npragma solidity ^0.8.0;\n\nimport \"remapped/Ownable.sol\";\n"
34+
},
35+
"npm/@openzeppelin/[email protected]/access/Ownable.sol": {
36+
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol)\n\npragma solidity ^0.8.20;\n\nabstract contract Ownable {}\n"
37+
}
38+
},
39+
"settings": {
40+
"evmVersion": "shanghai",
41+
"outputSelection": {
42+
"*": {
43+
"": ["ast"]
44+
},
45+
"contracts/A.sol": {
46+
"*": [
47+
"abi",
48+
"evm.bytecode",
49+
"evm.deployedBytecode",
50+
"evm.methodIdentifiers",
51+
"metadata"
52+
]
53+
},
54+
"contracts/B.sol": {
55+
"*": [
56+
"abi",
57+
"evm.bytecode",
58+
"evm.deployedBytecode",
59+
"evm.methodIdentifiers",
60+
"metadata"
61+
]
62+
},
63+
"contracts/C.sol": {
64+
"*": [
65+
"abi",
66+
"evm.bytecode",
67+
"evm.deployedBytecode",
68+
"evm.methodIdentifiers",
69+
"metadata"
70+
]
71+
},
72+
"contracts/D.sol": {
73+
"*": [
74+
"abi",
75+
"evm.bytecode",
76+
"evm.deployedBytecode",
77+
"evm.methodIdentifiers",
78+
"metadata"
79+
]
80+
},
81+
"contracts/E.sol": {
82+
"*": [
83+
"abi",
84+
"evm.bytecode",
85+
"evm.deployedBytecode",
86+
"evm.methodIdentifiers",
87+
"metadata"
88+
]
89+
},
90+
"contracts/UserRemappedImport.sol": {
91+
"*": [
92+
"abi",
93+
"evm.bytecode",
94+
"evm.deployedBytecode",
95+
"evm.methodIdentifiers",
96+
"metadata"
97+
]
98+
}
99+
},
100+
"remappings": [
101+
"remapped/=npm/@openzeppelin/[email protected]/access/",
102+
"@openzeppelin/contracts/=npm/@openzeppelin/[email protected]/"
103+
]
104+
}
105+
}
106+
}

0 commit comments

Comments
 (0)