certora-cli 7.17.2__tar.gz → 7.20.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. {certora_cli-7.17.2/certora_cli.egg-info → certora_cli-7.20.3}/PKG-INFO +3 -2
  2. certora_cli-7.20.3/README.md +1 -0
  3. {certora_cli-7.17.2 → certora_cli-7.20.3}/certora_cli/EVMVerifier/Compiler/CompilerCollectorFactory.py +36 -52
  4. {certora_cli-7.17.2 → certora_cli-7.20.3}/certora_cli/EVMVerifier/Compiler/CompilerCollectorVy.py +3 -3
  5. {certora_cli-7.17.2 → certora_cli-7.20.3}/certora_cli/EVMVerifier/certoraBuild.py +167 -338
  6. certora_cli-7.20.3/certora_cli/EVMVerifier/certoraBuildDataClasses.py +321 -0
  7. {certora_cli-7.17.2 → certora_cli-7.20.3}/certora_cli/EVMVerifier/certoraCloudIO.py +89 -62
  8. {certora_cli-7.17.2 → certora_cli-7.20.3}/certora_cli/EVMVerifier/certoraContext.py +68 -1
  9. {certora_cli-7.17.2 → certora_cli-7.20.3}/certora_cli/EVMVerifier/certoraContextAttributes.py +46 -20
  10. {certora_cli-7.17.2 → certora_cli-7.20.3}/certora_cli/EVMVerifier/certoraContextValidator.py +37 -11
  11. certora_cli-7.20.3/certora_cli/EVMVerifier/certoraSourceFinders.py +405 -0
  12. {certora_cli-7.17.2 → certora_cli-7.20.3}/certora_cli/Mutate/mutateApp.py +2 -2
  13. {certora_cli-7.17.2 → certora_cli-7.20.3}/certora_cli/Shared/certoraAttrUtil.py +1 -1
  14. {certora_cli-7.17.2 → certora_cli-7.20.3}/certora_cli/Shared/certoraUtils.py +41 -9
  15. {certora_cli-7.17.2 → certora_cli-7.20.3}/certora_cli/Shared/certoraValidateFuncs.py +16 -10
  16. {certora_cli-7.17.2 → certora_cli-7.20.3}/certora_cli/certoraRun.py +3 -1
  17. {certora_cli-7.17.2 → certora_cli-7.20.3/certora_cli.egg-info}/PKG-INFO +3 -2
  18. {certora_cli-7.17.2 → certora_cli-7.20.3}/certora_cli.egg-info/SOURCES.txt +2 -0
  19. {certora_cli-7.17.2 → certora_cli-7.20.3}/certora_cli.egg-info/requires.txt +1 -0
  20. certora_cli-7.20.3/certora_jars/CERTORA-CLI-VERSION-METADATA.json +1 -0
  21. {certora_cli-7.17.2 → certora_cli-7.20.3}/certora_jars/Typechecker.jar +0 -0
  22. {certora_cli-7.17.2 → certora_cli-7.20.3}/setup.py +3 -3
  23. certora_cli-7.17.2/README.md +0 -1
  24. certora_cli-7.17.2/certora_jars/CERTORA-CLI-VERSION-METADATA.json +0 -1
  25. {certora_cli-7.17.2 → certora_cli-7.20.3}/LICENSE +0 -0
  26. {certora_cli-7.17.2 → certora_cli-7.20.3}/MANIFEST.in +0 -0
  27. {certora_cli-7.17.2 → certora_cli-7.20.3}/certora_bins/__init__.py +0 -0
  28. {certora_cli-7.17.2 → certora_cli-7.20.3}/certora_cli/EVMVerifier/Compiler/CompilerCollector.py +0 -0
  29. {certora_cli-7.17.2 → certora_cli-7.20.3}/certora_cli/EVMVerifier/Compiler/CompilerCollectorSol.py +0 -0
  30. {certora_cli-7.17.2 → certora_cli-7.20.3}/certora_cli/EVMVerifier/Compiler/CompilerCollectorSolBased.py +0 -0
  31. {certora_cli-7.17.2 → certora_cli-7.20.3}/certora_cli/EVMVerifier/Compiler/CompilerCollectorYul.py +0 -0
  32. {certora_cli-7.17.2 → certora_cli-7.20.3}/certora_cli/EVMVerifier/Compiler/__init__.py +0 -0
  33. {certora_cli-7.17.2 → certora_cli-7.20.3}/certora_cli/EVMVerifier/__init__.py +0 -0
  34. {certora_cli-7.17.2 → certora_cli-7.20.3}/certora_cli/EVMVerifier/certoraBuildCacheManager.py +0 -0
  35. {certora_cli-7.17.2 → certora_cli-7.20.3}/certora_cli/EVMVerifier/certoraCollectRunMetadata.py +0 -0
  36. {certora_cli-7.17.2 → certora_cli-7.20.3}/certora_cli/EVMVerifier/certoraCompilerParameters.py +0 -0
  37. {certora_cli-7.17.2 → certora_cli-7.20.3}/certora_cli/EVMVerifier/certoraConfigIO.py +0 -0
  38. {certora_cli-7.17.2 → certora_cli-7.20.3}/certora_cli/EVMVerifier/certoraContextClass.py +0 -0
  39. {certora_cli-7.17.2 → certora_cli-7.20.3}/certora_cli/EVMVerifier/certoraContractFuncs.py +0 -0
  40. {certora_cli-7.17.2 → certora_cli-7.20.3}/certora_cli/EVMVerifier/certoraExtensionInfo.py +0 -0
  41. {certora_cli-7.17.2 → certora_cli-7.20.3}/certora_cli/EVMVerifier/certoraJobList.py +0 -0
  42. {certora_cli-7.17.2 → certora_cli-7.20.3}/certora_cli/EVMVerifier/certoraMiniSpecParser.py +0 -0
  43. {certora_cli-7.17.2 → certora_cli-7.20.3}/certora_cli/EVMVerifier/certoraNodeFilters.py +0 -0
  44. {certora_cli-7.17.2 → certora_cli-7.20.3}/certora_cli/EVMVerifier/certoraType.py +0 -0
  45. {certora_cli-7.17.2 → certora_cli-7.20.3}/certora_cli/EVMVerifier/certoraVerifyGenerator.py +0 -0
  46. {certora_cli-7.17.2 → certora_cli-7.20.3}/certora_cli/EquivalenceCheck/Eq_default.conf +0 -0
  47. {certora_cli-7.17.2 → certora_cli-7.20.3}/certora_cli/EquivalenceCheck/Eq_mc_no_out_template.spec +0 -0
  48. {certora_cli-7.17.2 → certora_cli-7.20.3}/certora_cli/EquivalenceCheck/Eq_mc_template.spec +0 -0
  49. {certora_cli-7.17.2 → certora_cli-7.20.3}/certora_cli/EquivalenceCheck/Eq_sanity.conf +0 -0
  50. {certora_cli-7.17.2 → certora_cli-7.20.3}/certora_cli/EquivalenceCheck/Eq_template.spec +0 -0
  51. {certora_cli-7.17.2 → certora_cli-7.20.3}/certora_cli/EquivalenceCheck/__init__.py +0 -0
  52. {certora_cli-7.17.2 → certora_cli-7.20.3}/certora_cli/EquivalenceCheck/equivCheck.py +0 -0
  53. {certora_cli-7.17.2 → certora_cli-7.20.3}/certora_cli/EquivalenceCheck/sanity.spec +0 -0
  54. {certora_cli-7.17.2 → certora_cli-7.20.3}/certora_cli/Mutate/__init__.py +0 -0
  55. {certora_cli-7.17.2 → certora_cli-7.20.3}/certora_cli/Mutate/mutateAttributes.py +0 -0
  56. {certora_cli-7.17.2 → certora_cli-7.20.3}/certora_cli/Mutate/mutateConstants.py +0 -0
  57. {certora_cli-7.17.2 → certora_cli-7.20.3}/certora_cli/Mutate/mutateUtil.py +0 -0
  58. {certora_cli-7.17.2 → certora_cli-7.20.3}/certora_cli/Mutate/mutateValidate.py +0 -0
  59. {certora_cli-7.17.2 → certora_cli-7.20.3}/certora_cli/Shared/ExpectedComparator.py +0 -0
  60. {certora_cli-7.17.2 → certora_cli-7.20.3}/certora_cli/Shared/__init__.py +0 -0
  61. {certora_cli-7.17.2 → certora_cli-7.20.3}/certora_cli/Shared/certoraLogging.py +0 -0
  62. {certora_cli-7.17.2 → certora_cli-7.20.3}/certora_cli/__init__.py +0 -0
  63. {certora_cli-7.17.2 → certora_cli-7.20.3}/certora_cli/certoraEqCheck.py +0 -0
  64. {certora_cli-7.17.2 → certora_cli-7.20.3}/certora_cli/certoraMutate.py +0 -0
  65. {certora_cli-7.17.2 → certora_cli-7.20.3}/certora_cli.egg-info/dependency_links.txt +0 -0
  66. {certora_cli-7.17.2 → certora_cli-7.20.3}/certora_cli.egg-info/entry_points.txt +0 -0
  67. {certora_cli-7.17.2 → certora_cli-7.20.3}/certora_cli.egg-info/top_level.txt +0 -0
  68. {certora_cli-7.17.2 → certora_cli-7.20.3}/certora_jars/__init__.py +0 -0
  69. {certora_cli-7.17.2 → certora_cli-7.20.3}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: certora-cli
3
- Version: 7.17.2
3
+ Version: 7.20.3
4
4
  Summary: Runner for the Certora Prover
5
5
  Home-page: https://pypi.org/project/certora-cli
6
6
  Author: Certora
@@ -20,5 +20,6 @@ Requires-Dist: sly
20
20
  Requires-Dist: tabulate
21
21
  Requires-Dist: tqdm
22
22
  Requires-Dist: StrEnum
23
+ Requires-Dist: tomli
23
24
 
24
- Commit 501a551. Build and Run scripts for executing the Certora Prover on Solidity smart contracts.
25
+ Commit 7b9a1c7. Build and Run scripts for executing the Certora Prover on Solidity smart contracts.
@@ -0,0 +1 @@
1
+ Commit 7b9a1c7. Build and Run scripts for executing the Certora Prover on Solidity smart contracts.
@@ -1,42 +1,47 @@
1
1
  import os
2
- import shutil
3
2
 
4
- from Shared.certoraUtils import run_compiler_cmd, VYPER, CompilerVersion, version_triplet_regex
3
+ from Shared import certoraUtils as Util
5
4
  from pathlib import Path
6
5
  from functools import lru_cache
7
- from typing import Dict, Set, Callable
6
+ from typing import Set, Callable
8
7
  import re
9
8
  import logging
10
9
  from EVMVerifier.Compiler.CompilerCollector import CompilerLang, CompilerCollector
11
10
  from EVMVerifier.Compiler.CompilerCollectorSol import CompilerCollectorSol, CompilerLangSol
12
11
  from EVMVerifier.Compiler.CompilerCollectorYul import CompilerLangYul, CompilerCollectorYul
13
12
  from EVMVerifier.Compiler.CompilerCollectorVy import CompilerCollectorVy, CompilerLangVy
14
- from Shared.certoraUtils import is_windows, match_path_to_mapping_key, remove_file, get_certora_config_dir
13
+ from Shared.certoraUtils import match_path_to_mapping_key, remove_file, get_certora_config_dir
15
14
  from EVMVerifier.certoraContextClass import CertoraContext
16
15
 
17
16
  # logger for running the Solidity compiler and reporting any errors it emits
18
17
  compiler_logger = logging.getLogger("compiler")
19
18
 
20
19
 
21
- def get_relevant_compiler(contract_file_path: Path, default_compiler: str, compiler_mappings: Dict[str, str]) -> str:
20
+ def get_relevant_compiler(contract_file_path: Path, context: CertoraContext) -> str:
22
21
  """
23
22
  @param contract_file_path: the contract that we are working on
24
- @param compiler_mappings: input arg mapping contract to compiler
25
- @param default_compiler: compiler we want to run in case the specified file_name is not in compiler_mappings
26
- @return: the name of the compiler executable we want to run on this contract (as a string, could be a path
23
+ @param context: context object
24
+ @return: the name of the compiler executable we want to run on this file (as a string, could be a path
27
25
  or a resolvable executable name)
28
26
  """
29
- match = None
30
- if compiler_mappings:
31
- match = match_path_to_mapping_key(contract_file_path, compiler_mappings)
32
- if match is not None:
33
- base = match
34
- else:
35
- base = default_compiler
36
- if is_windows() and not base.endswith(".exe"):
37
- base = base + ".exe"
38
- compiler_logger.debug(f"relevant compiler is {base}")
39
- return base
27
+ if context.solc_map:
28
+ match = match_path_to_mapping_key(contract_file_path, context.solc_map)
29
+ if match:
30
+ return match
31
+ else:
32
+ raise RuntimeError(f'cannot match compiler to {contract_file_path} from solc_map')
33
+
34
+ if Util.is_vyper_file(str(contract_file_path)):
35
+ if context.vyper:
36
+ return context.vyper
37
+ else:
38
+ return Util.DEFAULT_VYPER_COMPILER
39
+ elif Util.is_solidity_file(str(contract_file_path)):
40
+ if context.solc:
41
+ return context.solc
42
+ else:
43
+ return Util.DEFAULT_SOLC_COMPILER
44
+ raise RuntimeError(f'cannot match compiler to {contract_file_path}')
40
45
 
41
46
 
42
47
  class CompilerCollectorFactory:
@@ -50,12 +55,8 @@ class CompilerCollectorFactory:
50
55
  We added context as first step of making it the only parameters (the other params already appear in Context)
51
56
  """
52
57
 
53
- def __init__(self, context: CertoraContext, default_compiler: str,
54
- compiler_mappings: Dict[str, str]):
58
+ def __init__(self, context: CertoraContext):
55
59
  self.context = context
56
- self._default_compiler = default_compiler
57
- self._compiler_mappings = compiler_mappings
58
-
59
60
  self._stdout_paths_to_clean: Set[Path] = set()
60
61
  self._stderr_paths_to_clean: Set[Path] = set()
61
62
 
@@ -80,46 +81,29 @@ class CompilerCollectorFactory:
80
81
  else:
81
82
  raise RuntimeError(f'expected {path} to represent a Solidity, Yul, or Vyper file')
82
83
 
83
- @staticmethod
84
- def get_vyper_compiler(contract_file_path: Path, default_compiler: str, compiler_mappings: Dict[str, str]) -> str:
85
- """
86
- @param contract_file_path: the contract that we wish to compile
87
- @param default_compiler: the default compiler for the contract
88
- @param compiler_mappings: mappings from context mapping files to the relevant compiler executable
89
- @return: the name of the compiler executable to run
90
- """
91
- vyper_location = shutil.which(VYPER, os.F_OK)
92
- if vyper_location is not None:
93
- # has vyper. use it
94
- compiler = VYPER
95
- else:
96
- compiler = default_compiler
97
-
98
- vyper_exec = get_relevant_compiler(contract_file_path, compiler, compiler_mappings)
99
- return vyper_exec
100
-
101
- def __get_vyper_version(self, contract_file_path: Path) -> CompilerVersion:
84
+ def __get_vyper_version(self, contract_file_path: Path) -> Util.CompilerVersion:
102
85
  """
103
86
  @param contract_file_path: the contract that we are working on
104
87
  @return: the running Vyper version
105
88
  """
106
- vyper_exec_to_run = self.get_vyper_compiler(contract_file_path, self._default_compiler, self._compiler_mappings)
89
+ vyper_exec_to_run = get_relevant_compiler(contract_file_path, self.context)
107
90
  version = self.__get_compiler_exe_version(vyper_exec_to_run, self.__version_string_handler_vyper)
108
91
  return version
109
92
 
110
- def __get_solc_version(self, contract_file_path: Path) -> CompilerVersion:
93
+ def __get_solc_version(self, contract_file_path: Path) -> Util.CompilerVersion:
111
94
  """
112
95
  @param contract_file_path: the contract that we are working on
113
96
  @return: the running solc version
114
97
  """
115
98
  compiler_logger.debug(f"visiting contract file {contract_file_path}")
116
- solc_path = get_relevant_compiler(contract_file_path, self._default_compiler, self._compiler_mappings)
99
+ solc_path = get_relevant_compiler(contract_file_path, self.context)
117
100
  version = self.__get_compiler_exe_version(solc_path, self.__version_string_handler_solc)
118
101
  return version
119
102
 
120
103
  @lru_cache(maxsize=32)
121
104
  def __get_compiler_exe_version(self, compiler_name: str,
122
- version_string_handler: Callable[[str], CompilerVersion]) -> CompilerVersion:
105
+ version_string_handler:
106
+ Callable[[str], Util.CompilerVersion]) -> Util.CompilerVersion:
123
107
  """
124
108
  @param compiler_name: name of the solc we want to run on this contract
125
109
  @return: the running compiler version
@@ -130,7 +114,7 @@ class CompilerCollectorFactory:
130
114
  self._stdout_paths_to_clean.add(stdout_path)
131
115
  self._stderr_paths_to_clean.add(stderr_path)
132
116
 
133
- run_compiler_cmd(
117
+ Util.run_compiler_cmd(
134
118
  f"{compiler_name} --version",
135
119
  wd=Path(os.getcwd()),
136
120
  output_file_name=out_name)
@@ -140,8 +124,8 @@ class CompilerCollectorFactory:
140
124
  return version_string_handler(version_string)
141
125
 
142
126
  @staticmethod
143
- def __version_string_handler_vyper(version_string: str) -> CompilerVersion:
144
- version_matches = re.findall(version_triplet_regex(), version_string, re.MULTILINE)
127
+ def __version_string_handler_vyper(version_string: str) -> Util.CompilerVersion:
128
+ version_matches = re.findall(Util.version_triplet_regex(), version_string, re.MULTILINE)
145
129
  if len(version_matches) != 1:
146
130
  msg = f"Couldn't extract Vyper version from output {version_string}, giving up"
147
131
  compiler_logger.debug(msg)
@@ -150,8 +134,8 @@ class CompilerCollectorFactory:
150
134
  return int(match[0]), int(match[1]), int(match[2])
151
135
 
152
136
  @staticmethod
153
- def __version_string_handler_solc(version_string: str) -> CompilerVersion:
154
- version_matches = re.findall(version_triplet_regex(prefix="Version: "), version_string, re.MULTILINE)
137
+ def __version_string_handler_solc(version_string: str) -> Util.CompilerVersion:
138
+ version_matches = re.findall(Util.version_triplet_regex(prefix="Version: "), version_string, re.MULTILINE)
155
139
  if len(version_matches) != 1:
156
140
  msg = f"Couldn't extract Solidity version from output {version_string}, giving up"
157
141
  compiler_logger.debug(msg)
@@ -11,7 +11,7 @@ from typing import Any, Dict, List, Set, Tuple, Optional
11
11
  import EVMVerifier.certoraType as CT
12
12
  from Crypto.Hash import keccak
13
13
  from EVMVerifier.Compiler.CompilerCollector import CompilerCollector, CompilerLang, CompilerLangFunc
14
- from Shared.certoraUtils import Singleton, VYPER, CompilerVersion
14
+ from Shared.certoraUtils import Singleton, DEFAULT_VYPER_COMPILER, CompilerVersion
15
15
  from Shared.certoraUtils import print_failed_to_run, get_certora_config_dir
16
16
 
17
17
  ast_logger = logging.getLogger("ast")
@@ -24,11 +24,11 @@ class CompilerLangVy(CompilerLang, metaclass=Singleton):
24
24
 
25
25
  @property
26
26
  def name(self) -> str:
27
- return VYPER.capitalize() # yes, Vyper wants to be spelled "Vyper" in the json input
27
+ return DEFAULT_VYPER_COMPILER.capitalize() # yes, Vyper wants to be spelled "Vyper" in the json input
28
28
 
29
29
  @property
30
30
  def compiler_name(self) -> str:
31
- return VYPER
31
+ return DEFAULT_VYPER_COMPILER
32
32
 
33
33
  @staticmethod
34
34
  def normalize_func_hash(func_hash: str) -> str: