Skip to content

Commit 852d59a

Browse files
committed
fix bug causing standard json to be shared across classes instances
1 parent 1150349 commit 852d59a

File tree

1 file changed

+20
-20
lines changed

1 file changed

+20
-20
lines changed

crytic_compile/platform/vyper.py

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -33,28 +33,28 @@ class VyperStandardJson(AbstractPlatform):
3333
NAME = "vyper"
3434
PROJECT_URL = "https://github.com/vyperlang/vyper"
3535
TYPE = Type.VYPER
36-
standard_json_input: Dict = {
37-
"language": "Vyper",
38-
"sources": {},
39-
"settings": {
40-
"outputSelection": {
41-
"*": {
42-
"*": [
43-
"abi",
44-
"devdoc",
45-
"userdoc",
46-
"evm.bytecode",
47-
"evm.deployedBytecode",
48-
"evm.deployedBytecode.sourceMap",
49-
],
50-
"": ["ast"],
51-
}
52-
}
53-
},
54-
}
5536

5637
def __init__(self, target: Optional[Path] = None, **_kwargs: str):
5738
super().__init__(target, **_kwargs)
39+
self.standard_json_input = {
40+
"language": "Vyper",
41+
"sources": {},
42+
"settings": {
43+
"outputSelection": {
44+
"*": {
45+
"*": [
46+
"abi",
47+
"devdoc",
48+
"userdoc",
49+
"evm.bytecode",
50+
"evm.deployedBytecode",
51+
"evm.deployedBytecode.sourceMap",
52+
],
53+
"": ["ast"],
54+
}
55+
}
56+
},
57+
}
5858

5959
def compile(self, crytic_compile: "CryticCompile", **kwargs: str) -> None:
6060
"""Compile the target
@@ -75,7 +75,7 @@ def compile(self, crytic_compile: "CryticCompile", **kwargs: str) -> None:
7575
compilation_artifacts = None
7676
with tempfile.NamedTemporaryFile(mode="a+") as f:
7777
json.dump(self.standard_json_input, f)
78-
f.seek(0)
78+
f.flush()
7979
compilation_artifacts = _run_vyper_standard_json(f.name, vyper_bin)
8080

8181
if "errors" in compilation_artifacts:

0 commit comments

Comments
 (0)