From 9285191fc16c2372de931837a5470e3e7eaa6e66 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 23 Jun 2023 15:07:29 +0000 Subject: [PATCH 1/6] Bump actions/deploy-pages from 1 to 2 Bumps [actions/deploy-pages](https://github.com/actions/deploy-pages) from 1 to 2. - [Release notes](https://github.com/actions/deploy-pages/releases) - [Commits](https://github.com/actions/deploy-pages/compare/v1...v2) --- updated-dependencies: - dependency-name: actions/deploy-pages dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/doc.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/doc.yml b/.github/workflows/doc.yml index 20fa16a7..6fd178d5 100644 --- a/.github/workflows/doc.yml +++ b/.github/workflows/doc.yml @@ -43,4 +43,4 @@ jobs: path: './html/' - name: Deploy to GitHub Pages id: deployment - uses: actions/deploy-pages@v1 \ No newline at end of file + uses: actions/deploy-pages@v2 \ No newline at end of file From ca2d60ccfeef3cf52dd5cded1f641ab81f70c1ba Mon Sep 17 00:00:00 2001 From: alpharush <0xalpharush@protonmail.com> Date: Fri, 23 Jun 2023 16:05:51 -0500 Subject: [PATCH 2/6] fix rendering on pypi --- setup.py | 1 + 1 file changed, 1 insertion(+) diff --git a/setup.py b/setup.py index 1ee7f052..8787a3c0 100644 --- a/setup.py +++ b/setup.py @@ -35,6 +35,7 @@ }, license="AGPL-3.0", long_description=long_description, + long_description_content_type="text/markdown", package_data={"crytic_compile": ["py.typed"]}, entry_points={"console_scripts": ["crytic-compile = crytic_compile.__main__:main"]}, ) From b813e6dd926d6829e6abe5b7404a70c575079583 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 26 Jun 2023 23:59:37 +0000 Subject: [PATCH 3/6] Bump pypa/gh-action-pypi-publish from 1.8.6 to 1.8.7 Bumps [pypa/gh-action-pypi-publish](https://github.com/pypa/gh-action-pypi-publish) from 1.8.6 to 1.8.7. - [Release notes](https://github.com/pypa/gh-action-pypi-publish/releases) - [Commits](https://github.com/pypa/gh-action-pypi-publish/compare/v1.8.6...v1.8.7) --- updated-dependencies: - dependency-name: pypa/gh-action-pypi-publish dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- .github/workflows/publish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 4faba206..ae3164d6 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.8.6 + uses: pypa/gh-action-pypi-publish@v1.8.7 - name: sign uses: sigstore/gh-action-sigstore-python@v1.2.3 From 6978753a9525e1639b7b76b92576e434e94eb195 Mon Sep 17 00:00:00 2001 From: alpharush <0xalpharush@protonmail.com> Date: Fri, 30 Jun 2023 09:53:50 -0500 Subject: [PATCH 4/6] fix build status badge --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 62b7c43f..d06404a9 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # Crytic-compile -[![Build Status](https://img.shields.io/github/workflow/status/crytic/crytic-compile/CI/master)](https://github.com/crytic/crytic-compile/actions?query=workflow%3ACI) +[![Build Status](https://img.shields.io/github/actions/workflow/status/crytic/crytic-compile/ci.yml?branch=master)](https://github.com/crytic/crytic-compile/actions?query=workflow%3ACI) [![Slack Status](https://slack.empirehacking.nyc/badge.svg)](https://slack.empirehacking.nyc) [![PyPI version](https://badge.fury.io/py/crytic-compile.svg)](https://badge.fury.io/py/crytic-compile) From 2319634bd0b2b326598aa493ad0b04ffc50853cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20L=C3=B3pez?= Date: Wed, 5 Jul 2023 10:31:20 -0300 Subject: [PATCH 5/6] platform: hardhat: add support for CommonJS configuration file --- crytic_compile/platform/hardhat.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/crytic_compile/platform/hardhat.py b/crytic_compile/platform/hardhat.py index b11bdbb6..af652799 100755 --- a/crytic_compile/platform/hardhat.py +++ b/crytic_compile/platform/hardhat.py @@ -216,8 +216,10 @@ def is_supported(target: str, **kwargs: str) -> bool: if os.path.isfile(os.path.join(target, "foundry.toml")): return False - return os.path.isfile(os.path.join(target, "hardhat.config.js")) | os.path.isfile( - os.path.join(target, "hardhat.config.ts") + return ( + os.path.isfile(os.path.join(target, "hardhat.config.js")) + or os.path.isfile(os.path.join(target, "hardhat.config.ts")) + or os.path.isfile(os.path.join(target, "hardhat.config.cjs")) ) def is_dependency(self, path: str) -> bool: From e337b305c7bd87016939950348170874f0c34a69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20L=C3=B3pez?= Date: Wed, 5 Jul 2023 10:32:57 -0300 Subject: [PATCH 6/6] platform: extract special priority handling into platform ordering --- crytic_compile/crytic_compile.py | 4 ++-- crytic_compile/platform/hardhat.py | 4 ---- crytic_compile/platform/truffle.py | 6 ------ crytic_compile/platform/types.py | 21 +++++++++++++++++++++ crytic_compile/platform/waffle.py | 6 ------ 5 files changed, 23 insertions(+), 18 deletions(-) diff --git a/crytic_compile/crytic_compile.py b/crytic_compile/crytic_compile.py index b9ae62bb..7b81bbaa 100644 --- a/crytic_compile/crytic_compile.py +++ b/crytic_compile/crytic_compile.py @@ -36,14 +36,14 @@ def get_platforms() -> List[Type[AbstractPlatform]]: - """Return the available platforms classes + """Return the available platforms classes in order of preference Returns: List[Type[AbstractPlatform]]: Available platforms """ platforms = [getattr(all_platforms, name) for name in dir(all_platforms)] platforms = [d for d in platforms if inspect.isclass(d) and issubclass(d, AbstractPlatform)] - return sorted(platforms, key=lambda platform: platform.TYPE) + return sorted(platforms, key=lambda platform: (platform.TYPE.priority(), platform.TYPE)) def is_supported(target: str) -> bool: diff --git a/crytic_compile/platform/hardhat.py b/crytic_compile/platform/hardhat.py index af652799..ca3f5f84 100755 --- a/crytic_compile/platform/hardhat.py +++ b/crytic_compile/platform/hardhat.py @@ -212,10 +212,6 @@ def is_supported(target: str, **kwargs: str) -> bool: if hardhat_ignore: return False - # If there is both foundry and hardhat, foundry takes priority - if os.path.isfile(os.path.join(target, "foundry.toml")): - return False - return ( os.path.isfile(os.path.join(target, "hardhat.config.js")) or os.path.isfile(os.path.join(target, "hardhat.config.ts")) diff --git a/crytic_compile/platform/truffle.py b/crytic_compile/platform/truffle.py index e654c1be..67c3b74c 100755 --- a/crytic_compile/platform/truffle.py +++ b/crytic_compile/platform/truffle.py @@ -305,12 +305,6 @@ def is_supported(target: str, **kwargs: str) -> bool: if truffle_ignore: return False - # Avoid conflicts with hardhat - if os.path.isfile(os.path.join(target, "hardhat.config.js")) | os.path.isfile( - os.path.join(target, "hardhat.config.ts") - ): - return False - return os.path.isfile(os.path.join(target, "truffle.js")) or os.path.isfile( os.path.join(target, "truffle-config.js") ) diff --git a/crytic_compile/platform/types.py b/crytic_compile/platform/types.py index e662780e..e07eaeb1 100644 --- a/crytic_compile/platform/types.py +++ b/crytic_compile/platform/types.py @@ -66,3 +66,24 @@ def __str__(self) -> str: # pylint: disable=too-many-branches if self == Type.FOUNDRY: return "Foundry" raise ValueError + + def priority(self) -> int: + """Return the priority for a certain platform. + + A lower priority means the platform is more preferable. This is used to + consistently select a platform when two or more are available. + + Returns: + int: priority number + """ + + if self == Type.FOUNDRY: + return 100 + + if self == Type.HARDHAT: + return 200 + + if self in [Type.TRUFFLE, Type.WAFFLE]: + return 300 + + return 1000 diff --git a/crytic_compile/platform/waffle.py b/crytic_compile/platform/waffle.py index 302972e3..6735649a 100755 --- a/crytic_compile/platform/waffle.py +++ b/crytic_compile/platform/waffle.py @@ -245,12 +245,6 @@ def is_supported(target: str, **kwargs: str) -> bool: if waffle_ignore: return False - # Avoid conflicts with hardhat - if os.path.isfile(os.path.join(target, "hardhat.config.js")) | os.path.isfile( - os.path.join(target, "hardhat.config.ts") - ): - return False - if os.path.isfile(os.path.join(target, "waffle.json")) or os.path.isfile( os.path.join(target, ".waffle.json") ):