Skip to content

Commit

Permalink
Merge pull request #349 from crytic/dev-standard-fix
Browse files Browse the repository at this point in the history
Improve support for new standard format
  • Loading branch information
montyly authored Jan 11, 2023
2 parents 29b6c9d + b94bdac commit aad5d41
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 5 deletions.
2 changes: 1 addition & 1 deletion crytic_compile/platform/standard.py
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,7 @@ def _load_from_compile_current(crytic_compile: "CryticCompile", loaded_json: Dic
filename = compilation_unit.filename_lookup(filename_str)
source_unit = compilation_unit.create_source_unit(filename)

for contract_name, contract in source_unit_data["contracts"].items():
for contract_name, contract in source_unit_data.get("contracts", {}).items():
compilation_unit.filename_to_contracts[filename].add(contract_name)

source_unit = compilation_unit.create_source_unit(filename)
Expand Down
11 changes: 7 additions & 4 deletions scripts/ci_test_standard.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,21 @@

DIR=$(mktemp -d)

cp tests/contract.sol "$DIR"
cp tests/contract_with_toplevel.sol "$DIR"
cp tests/toplevel.sol "$DIR"
cd "$DIR" || exit 255

crytic-compile contract.sol --export-format archive
solc-select use 0.8.0 --always-install

crytic-compile contract_with_toplevel.sol --export-format archive

if [ $? -ne 0 ]
then
echo "Standard test failed"
exit 255
fi

crytic-compile crytic-export/contract.sol_export_archive.json
crytic-compile crytic-export/contract_with_toplevel.sol_export_archive.json

if [ $? -ne 0 ]
then
Expand All @@ -22,7 +25,7 @@ then
fi


crytic-compile contract.sol --export-zip test.zip
crytic-compile contract_with_toplevel.sol --export-zip test.zip

if [ $? -ne 0 ]
then
Expand Down
7 changes: 7 additions & 0 deletions tests/contract_with_toplevel.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import "./toplevel.sol";

contract C{
function f() external{

}
}
3 changes: 3 additions & 0 deletions tests/toplevel.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
function g(){

}

0 comments on commit aad5d41

Please sign in to comment.