diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a9a01211..30954646 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -63,10 +63,10 @@ jobs: solc-select use 0.5.7 --always-install - name: Set up nix if: matrix.type == 'dapp' - uses: cachix/install-nix-action@v30 + uses: cachix/install-nix-action@v31 - name: Set up cachix if: matrix.type == 'dapp' - uses: cachix/cachix-action@v15 + uses: cachix/cachix-action@v16 with: name: dapp - name: Install Foundry diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index cb743bc1..d1f67dbb 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -45,7 +45,7 @@ jobs: path: dist/ - name: publish - uses: pypa/gh-action-pypi-publish@v1.12.3 + uses: pypa/gh-action-pypi-publish@v1.12.4 - name: sign uses: sigstore/gh-action-sigstore-python@v3.0.0 diff --git a/CODEOWNERS b/CODEOWNERS index e6361699..66a2e934 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -1 +1 @@ -* @montyly @0xalpharush @bohendo +* @elopez @bohendo @smonicas diff --git a/crytic_compile/platform/etherscan.py b/crytic_compile/platform/etherscan.py index e042d377..72f67def 100644 --- a/crytic_compile/platform/etherscan.py +++ b/crytic_compile/platform/etherscan.py @@ -97,6 +97,21 @@ "sepoliaera.zksync": ("300", "sepolia-era.zksync.network"), "xai": ("660279", "xaiscan.io"), "sepolia.xai": ("37714555429", "sepolia.xaiscan.io"), + "xdc": ("50", "xdcscan.com"), + "testnet.xdc": ("51", "testnet.xdcscan.com"), + "apechain": ("33139", "apescan.io"), + "curtis.apechain": ("33111", "curtis.apescan.io"), + "world": ("480", "worldscan.org"), + "sepolia.world": ("4801", "sepolia.worldscan.org"), + "sophon": ("50104", "sophscan.xyz"), + "testnet.sophon": ("531050104", "testnet.sophscan.xyz"), + "sonic": ("146", "sonicscan.org"), + "testnet.sonic": ("57054", "testnet.sonicscan.org"), + "unichain": ("130", "uniscan.xyz"), + "sepolia.unichain": ("1301", "sepolia.uniscan.xyz"), + "abstract": ("2741", "abscan.org"), + "sepolia.abstract": ("11124", "sepolia.abscan.org"), + "berachain": ("80094", "berascan.com"), } SUPPORTED_NETWORK = {**SUPPORTED_NETWORK_V1, **SUPPORTED_NETWORK_V2} diff --git a/crytic_compile/platform/foundry.py b/crytic_compile/platform/foundry.py index 2ea66a96..79c418b4 100755 --- a/crytic_compile/platform/foundry.py +++ b/crytic_compile/platform/foundry.py @@ -165,7 +165,7 @@ def is_dependency(self, path: str) -> bool: """ if path in self._cached_dependencies: return self._cached_dependencies[path] - ret = "lib" in Path(path).parts + ret = "lib" in Path(path).parts or "node_modules" in Path(path).parts self._cached_dependencies[path] = ret return ret diff --git a/scripts/ci_test_solc_multi_file.sh b/scripts/ci_test_solc_multi_file.sh index 01b9d6f8..55624e90 100755 --- a/scripts/ci_test_solc_multi_file.sh +++ b/scripts/ci_test_solc_multi_file.sh @@ -2,12 +2,51 @@ DIR=$(mktemp -d) +normalize_file() { + JQ_SCRIPT=$(cat <<'EOF' +def sort_deps: + if type == "object" then + # Process each key-value pair + with_entries( + if .key == "contractDependencies" and (.value | type == "array") then + .value = (.value | sort) + else + .value = (.value | sort_deps) + end + ) + elif type == "array" then + # Process each array element recursively + map(sort_deps) + else + . + end; + +sort_deps +EOF +) + + jq "$JQ_SCRIPT" "$1" > "$1.mod" + mv "$1.mod" "$1" +} + cp -r tests/solc-multi-file "$DIR" cd "$DIR/solc-multi-file" || exit 255 crytic-compile --compile-remove-metadata --export-formats solc,truffle A.sol cd - || exit 255 node tests/process_combined_solc.js "$DIR/solc-multi-file/crytic-export/combined_solc.json" "$DIR" + +case "$(uname -sr)" in + #for some reason, contractDependencies appear in random order in Windows + #so we sort them for consistency in the tests + CYGWIN*|MINGW*|MSYS*) + echo "Testing on Windows, doing extra JSON normalization" + for f in "$DIR/solc-multi-file/crytic-export/"*.json tests/expected/solc-multi-file/*.json; do + normalize_file "$f" + done + ;; +esac + DIFF=$(diff -r "$DIR/solc-multi-file/crytic-export" tests/expected/solc-multi-file) if [ "$?" != "0" ] || [ "$DIFF" != "" ] then diff --git a/setup.py b/setup.py index 974c9dcd..f35704c5 100644 --- a/setup.py +++ b/setup.py @@ -11,7 +11,7 @@ description="Util to facilitate smart contracts compilation.", url="https://github.com/crytic/crytic-compile", author="Trail of Bits", - version="0.3.8", + version="0.3.9", packages=find_packages(), # Python 3.12.0 on Windows suffers from https://github.com/python/cpython/issues/109590 # breaking some of our integrations. The issue is fixed in 3.12.1