Compiler stack: Protect loadGeneratedIR from contracts that cannot be deployed#15505
Compiler stack: Protect loadGeneratedIR from contracts that cannot be deployed#15505
Conversation
|
I would also add a test case like: // SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.0;
abstract contract C {
function f() public virtual returns (string memory);
}and // SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.0;
interface I {
function f() external returns (string memory);
}Could be similar to our current ast ir command-line test (https://github.com/ethereum/solidity/blob/e8b5ca83f37b6a126db6a0a1dcfa00decff63647/test/cmdlineTests/ast_ir/args). And also one, or more, for standard Json output (https://github.com/ethereum/solidity/blob/e8b5ca83f37b6a126db6a0a1dcfa00decff63647/test/cmdlineTests/standard_ir_ast_requested/input.json): {
"language": "Solidity",
"sources":
{
"C":
{
"content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity >=0.0; abstract contract C {}"
}
},
"settings": {
"optimizer": {
"enabled": true,
"details": {
"yul": true
}
},
"viaIR": true,
"outputSelection": {
"*": {
"*": ["irAst", "irOptimizedAst", "yulCFGJson"]
}
}
}
} |
test/cmdlineTests/standard_ir_ast_interface_requested/output.json
Outdated
Show resolved
Hide resolved
test/cmdlineTests/standard_ir_ast_interface_requested/output.json
Outdated
Show resolved
Hide resolved
f2cd9a1 to
84e08d5
Compare
r0qs
left a comment
There was a problem hiding this comment.
I have only one suggestion. But it looks good to me anyway :)
84e08d5 to
a4d66c4
Compare
|
This should probably also get a bugfix changelog entry. A bit annoying that this is in the release now, but I guess people rarely use these json artifacts anyways - might be a good indicator for how much they're used in the wild actually (since if they're used, people will quickly run into this I guess) |
a4d66c4 to
b7f7244
Compare
3548b2d to
1f20ccd
Compare
1f20ccd to
a7eaac7
Compare
a7eaac7 to
7972c51
Compare
If a contract is not deployable (ie interface / abstract), no
yulIRwill be generated. This causes the object parser to error out inloadGeneratedIR, as it expectsobject {}as a bare minimum, but gets an empty string instead.