Skip to content

Commit e910e5b

Browse files
authored
Merge pull request #552 from crytic/dev
sync master <> dev
2 parents c0ad9f5 + de160c4 commit e910e5b

File tree

5 files changed

+62
-5
lines changed

5 files changed

+62
-5
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,10 @@ jobs:
6363
solc-select use 0.5.7 --always-install
6464
- name: Set up nix
6565
if: matrix.type == 'dapp'
66-
uses: cachix/install-nix-action@v24
66+
uses: cachix/install-nix-action@v25
6767
- name: Set up cachix
6868
if: matrix.type == 'dapp'
69-
uses: cachix/cachix-action@v13
69+
uses: cachix/cachix-action@v14
7070
with:
7171
name: dapp
7272
- name: Install Foundry

.github/workflows/publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ jobs:
4545
path: dist/
4646

4747
- name: publish
48-
uses: pypa/[email protected].11
48+
uses: pypa/[email protected].14
4949

5050
- name: sign
5151
uses: sigstore/[email protected]

crytic_compile/crytic_compile.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ def __init__(self, target: Union[str, AbstractPlatform], **kwargs: str) -> None:
124124
125125
Args:
126126
target (Union[str, AbstractPlatform]): Target
127-
**kwargs: additional arguments
127+
**kwargs: additional arguments. Used: "cwd"
128128
"""
129129

130130
# dependencies is needed for platform conversion
@@ -145,7 +145,11 @@ def __init__(self, target: Union[str, AbstractPlatform], **kwargs: str) -> None:
145145
# Note: line 1 is at index 0
146146
self._cached_line_to_code: Dict[Filename, List[bytes]] = {}
147147

148-
self._working_dir = Path.cwd()
148+
custom_cwd = kwargs.get("cwd")
149+
if custom_cwd is not None:
150+
self._working_dir = Path(custom_cwd)
151+
else:
152+
self._working_dir = Path.cwd()
149153

150154
# pylint: disable=too-many-nested-blocks
151155
if isinstance(target, str):

crytic_compile/platform/etherscan.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -424,6 +424,28 @@ def compile(self, crytic_compile: "CryticCompile", **kwargs: str) -> None:
424424
via_ir=via_ir_enabled,
425425
)
426426

427+
metadata_config = {
428+
"solc_remaps": remappings if remappings else {},
429+
"solc_solcs_select": compiler_version,
430+
"solc_args": " ".join(
431+
filter(
432+
None,
433+
[
434+
"--via-ir" if via_ir_enabled else "",
435+
"--optimize --optimize-runs " + str(optimize_runs) if optimize_runs else "",
436+
"--evm-version " + evm_version if evm_version else "",
437+
],
438+
)
439+
),
440+
}
441+
442+
with open(
443+
os.path.join(working_dir if working_dir else export_dir, "crytic_compile.config.json"),
444+
"w",
445+
encoding="utf-8",
446+
) as f:
447+
json.dump(metadata_config, f)
448+
427449
def clean(self, **_kwargs: str) -> None:
428450
pass
429451

scripts/ci_test_etherscan.sh

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,3 +99,34 @@ then
9999
exit 255
100100
fi
101101
echo "::endgroup::"
102+
103+
# From crytic/crytic-compile#544
104+
echo "::group::Etherscan #8"
105+
crytic-compile 0x9AB6b21cDF116f611110b048987E58894786C244 --etherscan-apikey "$GITHUB_ETHERSCAN"
106+
107+
if [ $? -ne 0 ]
108+
then
109+
echo "Etherscan #8 test failed"
110+
exit 255
111+
fi
112+
113+
dir_name=$(find crytic-export/etherscan-contracts/ -type d -name "*0x9AB6b21cDF116f611110b048987E58894786C244*" -print -quit)
114+
cd "$dir_name" || { echo "Failed to change directory"; exit 255; }
115+
116+
if [ ! -f crytic_compile.config.json ]; then
117+
echo "crytic_compile.config.json does not exist"
118+
exit 255
119+
fi
120+
121+
# TODO: Globbing at crytic_compile.py:720 to run with '.'
122+
crytic-compile 'contracts/InterestRates/InterestRatePositionManager.f.sol' --config-file crytic_compile.config.json
123+
124+
if [ $? -ne 0 ]
125+
then
126+
echo "crytic-compile command failed"
127+
exit 255
128+
fi
129+
130+
cd ../../../
131+
132+
echo "::endgroup::"

0 commit comments

Comments
 (0)