-
Notifications
You must be signed in to change notification settings - Fork 145
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Verifier: add support for deployed code with immutable variables (#687)
- Loading branch information
1 parent
4f2d394
commit 5c8b63c
Showing
5 changed files
with
146 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
...ontract-verifier/smart-contract-verifier-server/tests/test_cases_solidity/immutables.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
{ | ||
"_comment": "Code with immutable references", | ||
"deployed_bytecode": "0x608060405234801561001057600080fd5b50600436106100415760003560e01c80636057361d146100465780638381f58a14610062578063d555654414610080575b600080fd5b610060600480360381019061005b9190610138565b61009e565b005b61006a6100d3565b6040516100779190610174565b60405180910390f35b6100886100d9565b6040516100959190610174565b60405180910390f35b7f0000000000000000000000000000000000000000000000000000000000000001816100ca91906101be565b60008190555050565b60005481565b7f000000000000000000000000000000000000000000000000000000000000000181565b600080fd5b6000819050919050565b61011581610102565b811461012057600080fd5b50565b6000813590506101328161010c565b92915050565b60006020828403121561014e5761014d6100fd565b5b600061015c84828501610123565b91505092915050565b61016e81610102565b82525050565b60006020820190506101896000830184610165565b92915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60006101c982610102565b91506101d483610102565b92508282019050808211156101ec576101eb61018f565b5b9291505056fea26469706673582212207215155b6a310856ceddcbd9ba15e34e5672fef1e055905f305ad37d295d755c64736f6c63430008120033", | ||
"creation_bytecode": "0x60a0604052600160809081525034801561001857600080fd5b506080516102286100396000396000818160a0015260db01526102286000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c80636057361d146100465780638381f58a14610062578063d555654414610080575b600080fd5b610060600480360381019061005b9190610138565b61009e565b005b61006a6100d3565b6040516100779190610174565b60405180910390f35b6100886100d9565b6040516100959190610174565b60405180910390f35b7f0000000000000000000000000000000000000000000000000000000000000000816100ca91906101be565b60008190555050565b60005481565b7f000000000000000000000000000000000000000000000000000000000000000081565b600080fd5b6000819050919050565b61011581610102565b811461012057600080fd5b50565b6000813590506101328161010c565b92915050565b60006020828403121561014e5761014d6100fd565b5b600061015c84828501610123565b91505092915050565b61016e81610102565b82525050565b60006020820190506101896000830184610165565b92915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60006101c982610102565b91506101d483610102565b92508282019050808211156101ec576101eb61018f565b5b9291505056fea26469706673582212207215155b6a310856ceddcbd9ba15e34e5672fef1e055905f305ad37d295d755c64736f6c63430008120033", | ||
"compiler_version": "v0.8.18+commit.87f61d96", | ||
"contract_name": "Storage", | ||
"source_code": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity >=0.7.0 <0.9.0;\n\n/**\n * @title Storage\n * @dev Store & retrieve value in a variable\n */\ncontract Storage {\n uint256 public number;\n\n uint256 public immutable offset = 1;\n\n /**\n * @dev Store value in variable\n * @param num value to store\n */\n function store(uint256 num) public {\n number = num + offset;\n }\n}", | ||
"expected_compiler_artifacts": { | ||
"abi": [{"inputs":[],"name":"number","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"offset","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"num","type":"uint256"}],"name":"store","outputs":[],"stateMutability":"nonpayable","type":"function"}], | ||
"userdoc": {"kind":"user","methods":{},"version":1}, | ||
"devdoc": {"details":"Store & retrieve value in a variable","kind":"dev","methods":{"store(uint256)":{"details":"Store value in variable","params":{"num":"value to store"}}},"title":"Storage","version":1}, | ||
"storageLayout": {"storage":[{"astId":4,"contract":"source.sol:Storage","label":"number","offset":0,"slot":"0","type":"t_uint256"}],"types":{"t_uint256":{"encoding":"inplace","label":"uint256","numberOfBytes":"32"}}}, | ||
"sources": {"source.sol": {"id": 0} } | ||
}, | ||
"expected_creation_input_artifacts": { | ||
"sourceMap": "141:253:0:-:0;;;226:1;192:35;;;;;141:253;;;;;;;;;;;;;;;;;;;;;;;;;;;", | ||
"linkReferences": {}, | ||
"cborAuxdata": { | ||
"0": { | ||
"offset": 556, | ||
"value": "0xa2646970667358221220513ec1504761ca45b2bc19e320ccc677d01d7b728a1c1422e9c2155f2e8128ad64736f6c63430008120033" | ||
} | ||
} | ||
}, | ||
"expected_deployed_bytecode_artifacts": { | ||
"sourceMap": "141:253:0:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;319:73;;;;;;;;;;;;;:::i;:::-;;:::i;:::-;;164:21;;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;192:35;;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;319:73;379:6;373:3;:12;;;;:::i;:::-;364:6;:21;;;;319:73;:::o;164:21::-;;;;:::o;192:35::-;;;:::o;88:117:1:-;197:1;194;187:12;334:77;371:7;400:5;389:16;;334:77;;;:::o;417:122::-;490:24;508:5;490:24;:::i;:::-;483:5;480:35;470:63;;529:1;526;519:12;470:63;417:122;:::o;545:139::-;591:5;629:6;616:20;607:29;;645:33;672:5;645:33;:::i;:::-;545:139;;;;:::o;690:329::-;749:6;798:2;786:9;777:7;773:23;769:32;766:119;;;804:79;;:::i;:::-;766:119;924:1;949:53;994:7;985:6;974:9;970:22;949:53;:::i;:::-;939:63;;895:117;690:329;;;;:::o;1025:118::-;1112:24;1130:5;1112:24;:::i;:::-;1107:3;1100:37;1025:118;;:::o;1149:222::-;1242:4;1280:2;1269:9;1265:18;1257:26;;1293:71;1361:1;1350:9;1346:17;1337:6;1293:71;:::i;:::-;1149:222;;;;:::o;1377:180::-;1425:77;1422:1;1415:88;1522:4;1519:1;1512:15;1546:4;1543:1;1536:15;1563:191;1603:3;1622:20;1640:1;1622:20;:::i;:::-;1617:25;;1656:20;1674:1;1656:20;:::i;:::-;1651:25;;1699:1;1696;1692:9;1685:16;;1720:3;1717:1;1714:10;1711:36;;;1727:18;;:::i;:::-;1711:36;1563:191;;;;:::o", | ||
"linkReferences": {}, | ||
"immutableReferences": {"7":[{"length":32,"start":160},{"length":32,"start":219}]}, | ||
"cborAuxdata": { | ||
"0": { | ||
"offset": 499, | ||
"value": "0xa2646970667358221220513ec1504761ca45b2bc19e320ccc677d01d7b728a1c1422e9c2155f2e8128ad64736f6c63430008120033" | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters