certora-cli-alpha-feat-github-oidc-login 20261126.10.54.604998__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 (93) hide show
  1. certora_cli_alpha_feat_github_oidc_login-20261126.10.54.604998/LICENSE +15 -0
  2. certora_cli_alpha_feat_github_oidc_login-20261126.10.54.604998/MANIFEST.in +3 -0
  3. certora_cli_alpha_feat_github_oidc_login-20261126.10.54.604998/PKG-INFO +41 -0
  4. certora_cli_alpha_feat_github_oidc_login-20261126.10.54.604998/README.md +1 -0
  5. certora_cli_alpha_feat_github_oidc_login-20261126.10.54.604998/certora_bins/__init__.py +0 -0
  6. certora_cli_alpha_feat_github_oidc_login-20261126.10.54.604998/certora_cli/CertoraProver/Compiler/CompilerCollector.py +214 -0
  7. certora_cli_alpha_feat_github_oidc_login-20261126.10.54.604998/certora_cli/CertoraProver/Compiler/CompilerCollectorFactory.py +210 -0
  8. certora_cli_alpha_feat_github_oidc_login-20261126.10.54.604998/certora_cli/CertoraProver/Compiler/CompilerCollectorSol.py +122 -0
  9. certora_cli_alpha_feat_github_oidc_login-20261126.10.54.604998/certora_cli/CertoraProver/Compiler/CompilerCollectorSolBased.py +36 -0
  10. certora_cli_alpha_feat_github_oidc_login-20261126.10.54.604998/certora_cli/CertoraProver/Compiler/CompilerCollectorVy.py +1450 -0
  11. certora_cli_alpha_feat_github_oidc_login-20261126.10.54.604998/certora_cli/CertoraProver/Compiler/CompilerCollectorYul.py +126 -0
  12. certora_cli_alpha_feat_github_oidc_login-20261126.10.54.604998/certora_cli/CertoraProver/Compiler/__init__.py +18 -0
  13. certora_cli_alpha_feat_github_oidc_login-20261126.10.54.604998/certora_cli/CertoraProver/__init__.py +20 -0
  14. certora_cli_alpha_feat_github_oidc_login-20261126.10.54.604998/certora_cli/CertoraProver/castingInstrumenter.py +199 -0
  15. certora_cli_alpha_feat_github_oidc_login-20261126.10.54.604998/certora_cli/CertoraProver/certoraApp.py +60 -0
  16. certora_cli_alpha_feat_github_oidc_login-20261126.10.54.604998/certora_cli/CertoraProver/certoraBuild.py +4448 -0
  17. certora_cli_alpha_feat_github_oidc_login-20261126.10.54.604998/certora_cli/CertoraProver/certoraBuildCacheManager.py +275 -0
  18. certora_cli_alpha_feat_github_oidc_login-20261126.10.54.604998/certora_cli/CertoraProver/certoraBuildDataClasses.py +358 -0
  19. certora_cli_alpha_feat_github_oidc_login-20261126.10.54.604998/certora_cli/CertoraProver/certoraBuildRust.py +573 -0
  20. certora_cli_alpha_feat_github_oidc_login-20261126.10.54.604998/certora_cli/CertoraProver/certoraBuildSui.py +142 -0
  21. certora_cli_alpha_feat_github_oidc_login-20261126.10.54.604998/certora_cli/CertoraProver/certoraCloudIO.py +1264 -0
  22. certora_cli_alpha_feat_github_oidc_login-20261126.10.54.604998/certora_cli/CertoraProver/certoraCollectConfigurationLayout.py +387 -0
  23. certora_cli_alpha_feat_github_oidc_login-20261126.10.54.604998/certora_cli/CertoraProver/certoraCollectRunMetadata.py +317 -0
  24. certora_cli_alpha_feat_github_oidc_login-20261126.10.54.604998/certora_cli/CertoraProver/certoraCompilerParameters.py +48 -0
  25. certora_cli_alpha_feat_github_oidc_login-20261126.10.54.604998/certora_cli/CertoraProver/certoraConfigIO.py +152 -0
  26. certora_cli_alpha_feat_github_oidc_login-20261126.10.54.604998/certora_cli/CertoraProver/certoraContext.py +724 -0
  27. certora_cli_alpha_feat_github_oidc_login-20261126.10.54.604998/certora_cli/CertoraProver/certoraContextAttributes.py +2186 -0
  28. certora_cli_alpha_feat_github_oidc_login-20261126.10.54.604998/certora_cli/CertoraProver/certoraContextClass.py +24 -0
  29. certora_cli_alpha_feat_github_oidc_login-20261126.10.54.604998/certora_cli/CertoraProver/certoraContextValidator.py +1006 -0
  30. certora_cli_alpha_feat_github_oidc_login-20261126.10.54.604998/certora_cli/CertoraProver/certoraContractFuncs.py +209 -0
  31. certora_cli_alpha_feat_github_oidc_login-20261126.10.54.604998/certora_cli/CertoraProver/certoraExtensionInfo.py +53 -0
  32. certora_cli_alpha_feat_github_oidc_login-20261126.10.54.604998/certora_cli/CertoraProver/certoraJobList.py +307 -0
  33. certora_cli_alpha_feat_github_oidc_login-20261126.10.54.604998/certora_cli/CertoraProver/certoraMiniSpecParser.py +204 -0
  34. certora_cli_alpha_feat_github_oidc_login-20261126.10.54.604998/certora_cli/CertoraProver/certoraNodeFilters.py +79 -0
  35. certora_cli_alpha_feat_github_oidc_login-20261126.10.54.604998/certora_cli/CertoraProver/certoraOffsetConverter.py +54 -0
  36. certora_cli_alpha_feat_github_oidc_login-20261126.10.54.604998/certora_cli/CertoraProver/certoraParseBuildScript.py +154 -0
  37. certora_cli_alpha_feat_github_oidc_login-20261126.10.54.604998/certora_cli/CertoraProver/certoraProjectScanner.py +198 -0
  38. certora_cli_alpha_feat_github_oidc_login-20261126.10.54.604998/certora_cli/CertoraProver/certoraSourceFinders.py +453 -0
  39. certora_cli_alpha_feat_github_oidc_login-20261126.10.54.604998/certora_cli/CertoraProver/certoraType.py +730 -0
  40. certora_cli_alpha_feat_github_oidc_login-20261126.10.54.604998/certora_cli/CertoraProver/certoraVerifyGenerator.py +203 -0
  41. certora_cli_alpha_feat_github_oidc_login-20261126.10.54.604998/certora_cli/CertoraProver/erc7201.py +45 -0
  42. certora_cli_alpha_feat_github_oidc_login-20261126.10.54.604998/certora_cli/CertoraProver/splitRules.py +189 -0
  43. certora_cli_alpha_feat_github_oidc_login-20261126.10.54.604998/certora_cli/CertoraProver/storageExtension.py +357 -0
  44. certora_cli_alpha_feat_github_oidc_login-20261126.10.54.604998/certora_cli/CertoraProver/test_certoraCloudIO.py +196 -0
  45. certora_cli_alpha_feat_github_oidc_login-20261126.10.54.604998/certora_cli/CertoraProver/uncheckedOverflowInstrumenter.py +152 -0
  46. certora_cli_alpha_feat_github_oidc_login-20261126.10.54.604998/certora_cli/EquivalenceCheck/Eq_default.conf +9 -0
  47. certora_cli_alpha_feat_github_oidc_login-20261126.10.54.604998/certora_cli/EquivalenceCheck/Eq_mc_no_out_template.spec +73 -0
  48. certora_cli_alpha_feat_github_oidc_login-20261126.10.54.604998/certora_cli/EquivalenceCheck/Eq_mc_template.spec +90 -0
  49. certora_cli_alpha_feat_github_oidc_login-20261126.10.54.604998/certora_cli/EquivalenceCheck/Eq_sanity.conf +8 -0
  50. certora_cli_alpha_feat_github_oidc_login-20261126.10.54.604998/certora_cli/EquivalenceCheck/Eq_template.spec +44 -0
  51. certora_cli_alpha_feat_github_oidc_login-20261126.10.54.604998/certora_cli/EquivalenceCheck/__init__.py +0 -0
  52. certora_cli_alpha_feat_github_oidc_login-20261126.10.54.604998/certora_cli/EquivalenceCheck/equivCheck.py +477 -0
  53. certora_cli_alpha_feat_github_oidc_login-20261126.10.54.604998/certora_cli/EquivalenceCheck/sanity.spec +6 -0
  54. certora_cli_alpha_feat_github_oidc_login-20261126.10.54.604998/certora_cli/Mutate/__init__.py +20 -0
  55. certora_cli_alpha_feat_github_oidc_login-20261126.10.54.604998/certora_cli/Mutate/mutateApp.py +2029 -0
  56. certora_cli_alpha_feat_github_oidc_login-20261126.10.54.604998/certora_cli/Mutate/mutateAttributes.py +307 -0
  57. certora_cli_alpha_feat_github_oidc_login-20261126.10.54.604998/certora_cli/Mutate/mutateConstants.py +110 -0
  58. certora_cli_alpha_feat_github_oidc_login-20261126.10.54.604998/certora_cli/Mutate/mutateUtil.py +62 -0
  59. certora_cli_alpha_feat_github_oidc_login-20261126.10.54.604998/certora_cli/Mutate/mutateValidate.py +194 -0
  60. certora_cli_alpha_feat_github_oidc_login-20261126.10.54.604998/certora_cli/Mutate/test_mutateApp.py +72 -0
  61. certora_cli_alpha_feat_github_oidc_login-20261126.10.54.604998/certora_cli/Shared/ExpectedComparator.py +410 -0
  62. certora_cli_alpha_feat_github_oidc_login-20261126.10.54.604998/certora_cli/Shared/__init__.py +22 -0
  63. certora_cli_alpha_feat_github_oidc_login-20261126.10.54.604998/certora_cli/Shared/certoraAttrUtil.py +211 -0
  64. certora_cli_alpha_feat_github_oidc_login-20261126.10.54.604998/certora_cli/Shared/certoraLogging.py +326 -0
  65. certora_cli_alpha_feat_github_oidc_login-20261126.10.54.604998/certora_cli/Shared/certoraUtils.py +1751 -0
  66. certora_cli_alpha_feat_github_oidc_login-20261126.10.54.604998/certora_cli/Shared/certoraValidateFuncs.py +1156 -0
  67. certora_cli_alpha_feat_github_oidc_login-20261126.10.54.604998/certora_cli/Shared/proverCommon.py +318 -0
  68. certora_cli_alpha_feat_github_oidc_login-20261126.10.54.604998/certora_cli/Shared/test_certoraUtils.py +112 -0
  69. certora_cli_alpha_feat_github_oidc_login-20261126.10.54.604998/certora_cli/Shared/test_proverCommon.py +76 -0
  70. certora_cli_alpha_feat_github_oidc_login-20261126.10.54.604998/certora_cli/__init__.py +0 -0
  71. certora_cli_alpha_feat_github_oidc_login-20261126.10.54.604998/certora_cli/certoraCVLFormatter.py +76 -0
  72. certora_cli_alpha_feat_github_oidc_login-20261126.10.54.604998/certora_cli/certoraConcord.py +39 -0
  73. certora_cli_alpha_feat_github_oidc_login-20261126.10.54.604998/certora_cli/certoraEVMProver.py +37 -0
  74. certora_cli_alpha_feat_github_oidc_login-20261126.10.54.604998/certora_cli/certoraEqCheck.py +32 -0
  75. certora_cli_alpha_feat_github_oidc_login-20261126.10.54.604998/certora_cli/certoraMutate.py +113 -0
  76. certora_cli_alpha_feat_github_oidc_login-20261126.10.54.604998/certora_cli/certoraRanger.py +39 -0
  77. certora_cli_alpha_feat_github_oidc_login-20261126.10.54.604998/certora_cli/certoraRun.py +191 -0
  78. certora_cli_alpha_feat_github_oidc_login-20261126.10.54.604998/certora_cli/certoraSolanaProver.py +119 -0
  79. certora_cli_alpha_feat_github_oidc_login-20261126.10.54.604998/certora_cli/certoraSorobanProver.py +91 -0
  80. certora_cli_alpha_feat_github_oidc_login-20261126.10.54.604998/certora_cli/certoraSuiProver.py +93 -0
  81. certora_cli_alpha_feat_github_oidc_login-20261126.10.54.604998/certora_cli/rustMutator.py +420 -0
  82. certora_cli_alpha_feat_github_oidc_login-20261126.10.54.604998/certora_cli_alpha_feat_github_oidc_login.egg-info/PKG-INFO +41 -0
  83. certora_cli_alpha_feat_github_oidc_login-20261126.10.54.604998/certora_cli_alpha_feat_github_oidc_login.egg-info/SOURCES.txt +91 -0
  84. certora_cli_alpha_feat_github_oidc_login-20261126.10.54.604998/certora_cli_alpha_feat_github_oidc_login.egg-info/dependency_links.txt +1 -0
  85. certora_cli_alpha_feat_github_oidc_login-20261126.10.54.604998/certora_cli_alpha_feat_github_oidc_login.egg-info/entry_points.txt +11 -0
  86. certora_cli_alpha_feat_github_oidc_login-20261126.10.54.604998/certora_cli_alpha_feat_github_oidc_login.egg-info/requires.txt +12 -0
  87. certora_cli_alpha_feat_github_oidc_login-20261126.10.54.604998/certora_cli_alpha_feat_github_oidc_login.egg-info/top_level.txt +3 -0
  88. certora_cli_alpha_feat_github_oidc_login-20261126.10.54.604998/certora_jars/ASTExtraction.jar +0 -0
  89. certora_cli_alpha_feat_github_oidc_login-20261126.10.54.604998/certora_jars/CERTORA-CLI-VERSION-METADATA.json +1 -0
  90. certora_cli_alpha_feat_github_oidc_login-20261126.10.54.604998/certora_jars/Typechecker.jar +0 -0
  91. certora_cli_alpha_feat_github_oidc_login-20261126.10.54.604998/certora_jars/__init__.py +0 -0
  92. certora_cli_alpha_feat_github_oidc_login-20261126.10.54.604998/setup.cfg +4 -0
  93. certora_cli_alpha_feat_github_oidc_login-20261126.10.54.604998/setup.py +41 -0
@@ -0,0 +1,15 @@
1
+
2
+ The Certora Prover
3
+ Copyright (C) 2025 Certora Ltd.
4
+
5
+ This program is free software: you can redistribute it and/or modify
6
+ it under the terms of the GNU General Public License as published by
7
+ the Free Software Foundation, version 3 of the License.
8
+
9
+ This program is distributed in the hope that it will be useful,
10
+ but WITHOUT ANY WARRANTY, without even the implied warranty of
11
+ MERCHANTABILITY or FITNESS FOR a PARTICULAR PURPOSE. See the
12
+ GNU General Public License for more details.
13
+
14
+ You should have received a copy of the GNU General Public License
15
+ along with this program. If not, see <https://www.gnu.org/licenses/>.
@@ -0,0 +1,3 @@
1
+ recursive-include certora_jars *.jar CERTORA-CLI-VERSION-METADATA.json
2
+ recursive-include certora_bins gambit
3
+ recursive-include certora_cli EquivalenceCheck/equivCheck.py EquivalenceCheck/sanity.spec EquivalenceCheck/Eq_sanity.conf EquivalenceCheck/Eq_default.conf EquivalenceCheck/Eq_template.spec EquivalenceCheck/Eq_mc_template.spec EquivalenceCheck/Eq_mc_no_out_template.spec
@@ -0,0 +1,41 @@
1
+ Metadata-Version: 2.2
2
+ Name: certora-cli-alpha-feat-github-oidc-login
3
+ Version: 20261126.10.54.604998
4
+ Summary: Runner for the Certora Prover
5
+ Home-page: https://pypi.org/project/certora-cli-alpha-feat-github-oidc-login
6
+ Author: Certora
7
+ Author-email: support@certora.com
8
+ License: GPL-3.0-only
9
+ Project-URL: Documentation, https://docs.certora.com/en/latest/
10
+ Project-URL: Source, https://github.com/Certora/CertoraProver
11
+ Classifier: Programming Language :: Python :: 3
12
+ Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
13
+ Classifier: Operating System :: OS Independent
14
+ Requires-Python: >=3.9
15
+ Description-Content-Type: text/markdown
16
+ License-File: LICENSE
17
+ Requires-Dist: click
18
+ Requires-Dist: json5
19
+ Requires-Dist: pycryptodome
20
+ Requires-Dist: requests
21
+ Requires-Dist: rich
22
+ Requires-Dist: sly
23
+ Requires-Dist: tabulate
24
+ Requires-Dist: tqdm
25
+ Requires-Dist: StrEnum
26
+ Requires-Dist: jinja2
27
+ Requires-Dist: wcmatch
28
+ Requires-Dist: typing_extensions
29
+ Dynamic: author
30
+ Dynamic: author-email
31
+ Dynamic: classifier
32
+ Dynamic: description
33
+ Dynamic: description-content-type
34
+ Dynamic: home-page
35
+ Dynamic: license
36
+ Dynamic: project-url
37
+ Dynamic: requires-dist
38
+ Dynamic: requires-python
39
+ Dynamic: summary
40
+
41
+ Commit bb228e4. Build and Run scripts for executing the Certora Prover on Solidity smart contracts.
@@ -0,0 +1 @@
1
+ Commit bb228e4. Build and Run scripts for executing the Certora Prover on Solidity smart contracts.
@@ -0,0 +1,214 @@
1
+ # The Certora Prover
2
+ # Copyright (C) 2025 Certora Ltd.
3
+ #
4
+ # This program is free software: you can redistribute it and/or modify
5
+ # it under the terms of the GNU General Public License as published by
6
+ # the Free Software Foundation, version 3 of the License.
7
+ #
8
+ # This program is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
+ # GNU General Public License for more details.
12
+ #
13
+ # You should have received a copy of the GNU General Public License
14
+ # along with this program. If not, see <https://www.gnu.org/licenses/>.
15
+
16
+ from abc import abstractmethod, ABC
17
+ from dataclasses import dataclass
18
+ from pathlib import Path
19
+ from typing import Any, Dict, List, Optional, Tuple, Set
20
+ from Shared.certoraUtils import AbstractAndSingleton, CompilerVersion
21
+ from CertoraProver.certoraContractFuncs import SourceBytes
22
+ import CertoraProver.certoraType as CT
23
+
24
+
25
+ # TODO: merge this with Func in certoraBuild
26
+ @dataclass
27
+ class CompilerLangFunc:
28
+ name: str
29
+ fullArgs: List[CT.TypeInstance]
30
+ paramNames: List[str]
31
+ returns: List[CT.TypeInstance]
32
+ sighash: str
33
+ notpayable: bool
34
+ fromLib: bool # not serialized
35
+ isConstructor: bool # not serialized
36
+ stateMutability: str
37
+ visibility: str
38
+ implemented: bool # does this function have a body? (false for interface functions)
39
+ overrides: bool # does this function override an interface declaration or super-contract definition?
40
+ contractName: str
41
+ source_bytes: Optional[SourceBytes]
42
+ ast_id: Optional[int] = None
43
+ original_file: Optional[str] = None
44
+ body_location: Optional[str] = None
45
+
46
+
47
+ class CompilerLang(metaclass=AbstractAndSingleton):
48
+ """
49
+ This class represents the compiler-language property attached to [CompilerCollector].
50
+ """
51
+
52
+ @property
53
+ @abstractmethod
54
+ def name(self) -> str:
55
+ pass
56
+
57
+ @property
58
+ @abstractmethod
59
+ def compiler_name(self) -> str:
60
+ pass
61
+
62
+ @staticmethod
63
+ def normalize_func_hash(func_hash: str) -> str:
64
+ """
65
+ Normalizes the hash [func_hash] (first 4 bites in a function's signature).
66
+ """
67
+ return func_hash
68
+
69
+ @staticmethod
70
+ def normalize_deployed_bytecode(deployed_bytecode: str) -> str:
71
+ """
72
+ Normalizes the deployed bytecode [deployed_bytecode].
73
+ """
74
+ return deployed_bytecode
75
+
76
+ @staticmethod
77
+ @abstractmethod
78
+ def get_contract_def_node_ref(contract_file_ast: Dict[int, Any], contract_file: str, contract_name: str) -> \
79
+ int:
80
+ """
81
+ Given the AST [contract_file_ast], the contract-file [contract_file] and the contract [contract_name] inside
82
+ [contract_file], returns the (expected to be single) definition node reference for [contract_name] which is
83
+ located inside [contract_file_ast].
84
+ """
85
+ pass
86
+
87
+ @staticmethod
88
+ @abstractmethod
89
+ def compilation_output_path(sdc_name: str) -> Path:
90
+ """
91
+ Returns the path to the output file generated by the compiler for [sdc_name],
92
+ using the given config path [config_path]. If several output files are generated by the compiler, returns the
93
+ one that stores stdout.
94
+ """
95
+ pass
96
+
97
+ @staticmethod
98
+ @abstractmethod
99
+ def all_compilation_artifacts(sdc_name: str) -> Set[Path]:
100
+ """
101
+ Returns the set of paths for all files generated after compilation.
102
+ """
103
+ pass
104
+
105
+ @staticmethod
106
+ def collect_storage_layout_info(file_abs_path: str,
107
+ config_path: Path,
108
+ compiler_cmd: str,
109
+ compiler_version: Optional[CompilerVersion],
110
+ data: Dict[str, Any],
111
+ asts : Dict[str, Dict[int, Any]],
112
+ ast_key: str) -> Dict[str, Any]:
113
+ """
114
+ Returns the data dictionary of the contract with storage layout information if needed
115
+ """
116
+ return data
117
+
118
+ @staticmethod
119
+ @abstractmethod
120
+ def get_supports_imports() -> bool:
121
+ """
122
+ Returns True if the language supports imports, False otherwise
123
+ """
124
+ pass
125
+
126
+ @staticmethod
127
+ @abstractmethod
128
+ def collect_source_type_descriptions_and_funcs(asts: Dict[str, Dict[str, Dict[int, Any]]],
129
+ data: Dict[str, Any],
130
+ contract_file: str,
131
+ contract_name: str,
132
+ build_arg_contract_file: str) -> \
133
+ Tuple[List[CT.Type], List[CompilerLangFunc]]:
134
+ """
135
+ :return: `(types, funcs)` where `types` contains the user-defined types that are declared in the contract,
136
+ and `funcs` contains descriptors for the internal and external functions defined in the contract
137
+ :param asts: A flattened mapping filename -> contract name -> node ID -> AST node
138
+ :param data: The original standard JSON output from the underlying compiler
139
+ :param contract_file: ?
140
+ :param contract_name:
141
+ :param build_arg_contract_file: ?
142
+ TODO: presumably one of these files is the original file, and the other is the munged file, but I'm not sure
143
+ which is which
144
+ """
145
+ pass
146
+
147
+ @property
148
+ @abstractmethod
149
+ def supports_typed_immutables(self) -> bool:
150
+ """
151
+ :return: True if has type information associated to immutables
152
+ """
153
+ pass
154
+
155
+ @property
156
+ @abstractmethod
157
+ def supports_ast_output(self) -> bool:
158
+ """
159
+ :return: True if compiling contracts in this language produces AST output
160
+ """
161
+ pass
162
+
163
+ @property
164
+ @abstractmethod
165
+ def supports_srclist_output(self) -> bool:
166
+ """
167
+ :return: True if compiling contracts in this language produces srclist output
168
+ """
169
+ pass
170
+
171
+
172
+ class CompilerCollector(ABC):
173
+ """
174
+ This class incorporates all the compiler settings.
175
+ Compiler-settings related computations should be done here.
176
+ """
177
+
178
+ @property
179
+ @abstractmethod
180
+ def compiler_name(self) -> str:
181
+ pass
182
+
183
+ @property
184
+ @abstractmethod
185
+ def smart_contract_lang(self) -> CompilerLang:
186
+ pass
187
+
188
+ @property
189
+ @abstractmethod
190
+ def compiler_version(self) -> CompilerVersion:
191
+ pass
192
+
193
+ # Full version identifier from the compiler's `--version` output
194
+ # (e.g. solc '0.8.34+commit.80d5c536.Darwin.appleclang'), recording the exact
195
+ # compiler build. None when it could not be extracted. Set by the factory after
196
+ # construction so subclass constructors need not change.
197
+ _compiler_version_full: Optional[str] = None
198
+
199
+ @property
200
+ def compiler_version_full(self) -> Optional[str]:
201
+ return self._compiler_version_full
202
+
203
+ @compiler_version_full.setter
204
+ def compiler_version_full(self, value: Optional[str]) -> None:
205
+ self._compiler_version_full = value
206
+
207
+ def normalize_file_compiler_path_name(self, file_abs_path: str) -> str:
208
+ """
209
+ Normalizes the absolute path name [file_abs_path] of a file, given to the compiler.
210
+ """
211
+ return file_abs_path
212
+
213
+ def __str__(self) -> str:
214
+ return f"{self.compiler_name} {self.compiler_version}"
@@ -0,0 +1,210 @@
1
+ # The Certora Prover
2
+ # Copyright (C) 2025 Certora Ltd.
3
+ #
4
+ # This program is free software: you can redistribute it and/or modify
5
+ # it under the terms of the GNU General Public License as published by
6
+ # the Free Software Foundation, version 3 of the License.
7
+ #
8
+ # This program is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
+ # GNU General Public License for more details.
12
+ #
13
+ # You should have received a copy of the GNU General Public License
14
+ # along with this program. If not, see <https://www.gnu.org/licenses/>.
15
+
16
+ import os
17
+
18
+ from Shared import certoraUtils as Util
19
+ from pathlib import Path
20
+ from functools import lru_cache
21
+ from typing import Set, Callable, Tuple, Optional
22
+ import re
23
+ import logging
24
+ from CertoraProver.Compiler.CompilerCollector import CompilerLang, CompilerCollector
25
+ from CertoraProver.Compiler.CompilerCollectorSol import CompilerCollectorSol, CompilerLangSol
26
+ from CertoraProver.Compiler.CompilerCollectorYul import CompilerLangYul, CompilerCollectorYul
27
+ from CertoraProver.Compiler.CompilerCollectorVy import CompilerCollectorVy, CompilerLangVy
28
+ from Shared.certoraUtils import remove_file, get_certora_config_dir
29
+ from CertoraProver.certoraContextClass import CertoraContext
30
+ import CertoraProver.certoraContext as Ctx
31
+
32
+ # logger for running the Solidity compiler and reporting any errors it emits
33
+ compiler_logger = logging.getLogger("compiler")
34
+
35
+
36
+ def get_relevant_compiler(contract_file_path: Path, context: CertoraContext) -> str:
37
+ """
38
+ @param contract_file_path: the contract that we are working on
39
+ @param context: context object
40
+ @return: the name of the compiler executable we want to run on this file (as a string, could be a path
41
+ or a resolvable executable name)
42
+ """
43
+
44
+ if contract_file_path.is_absolute():
45
+ contract_file_path = Path(os.path.relpath(contract_file_path, Path.cwd()))
46
+
47
+ # If the contract file is in the sources directory, we want to use the relative path from the "cwd" in the source tree.
48
+ if Util.get_certora_sources_dir() in contract_file_path.parents:
49
+ cwd_in_source = Util.get_certora_sources_dir() / context.cwd_rel_in_sources
50
+ contract_file_path = Path(os.path.relpath(contract_file_path, cwd_in_source))
51
+
52
+ if context.compiler_map:
53
+ match = Ctx.get_map_attribute_value(context, contract_file_path, 'compiler')
54
+ if match:
55
+ return str(match)
56
+ else:
57
+ raise RuntimeError(f'cannot match compiler to {contract_file_path} from compiler_map')
58
+
59
+ if Util.is_vyper_file(str(contract_file_path)):
60
+ if context.vyper:
61
+ return context.vyper
62
+ else:
63
+ return Util.DEFAULT_VYPER_COMPILER
64
+ elif Util.is_solidity_file(str(contract_file_path)):
65
+ if context.solc:
66
+ return context.solc
67
+ else:
68
+ return Util.DEFAULT_SOLC_COMPILER
69
+ raise RuntimeError(f'cannot match compiler to {contract_file_path}')
70
+
71
+
72
+ class CompilerCollectorFactory:
73
+ """
74
+ Returns [CompilerCollector] instance, based on type of the file [file_name] and the file path
75
+ compiler_args: input args optimize and optimize_runs
76
+ optimize_map: input arg mapping contract to optimized number of runs
77
+ compiler_mappings: input arg mapping contract to the compiler executable (solc/vyper)
78
+ default_compiler: compiler exec we want to run in case the specified file_name is not in compiler_mappings
79
+
80
+ We added context as first step of making it the only parameters (the other params already appear in Context)
81
+ """
82
+
83
+ def __init__(self, context: CertoraContext):
84
+ self.context = context
85
+ self._stdout_paths_to_clean: Set[Path] = set()
86
+ self._stderr_paths_to_clean: Set[Path] = set()
87
+
88
+ @lru_cache(maxsize=32)
89
+ def get_compiler_collector(self, path: Path) -> CompilerCollector:
90
+ """
91
+ 1. Same file path will get the same compiler collector
92
+ 2. autoFinder_X file will get the compiler collector of X file
93
+ @returns [CompilerCollector] instance, based on type of the file [file_name] and the file path
94
+ @param path: path of the file to create [CompilerCollector] for
95
+ """
96
+ if str(path).endswith(".vy"):
97
+ version, full_version = self.__get_vyper_version(path)
98
+ collector: CompilerCollector = CompilerCollectorVy(version)
99
+ elif str(path).endswith(".sol"):
100
+ version, full_version = self.__get_solc_version(path)
101
+ collector = CompilerCollectorSol(version, CompilerLangSol(), not self.context.no_memory_safe_autofinders)
102
+ elif str(path).endswith(".yul"):
103
+ version, full_version = self.__get_solc_version(path)
104
+ collector = CompilerCollectorYul(version, CompilerLangYul())
105
+ else:
106
+ raise RuntimeError(f'expected {path} to represent a Solidity, Yul, or Vyper file')
107
+
108
+ collector.compiler_version_full = full_version
109
+ return collector
110
+
111
+ def __get_vyper_version(self, contract_file_path: Path) -> Tuple[Util.CompilerVersion, Optional[str]]:
112
+ """
113
+ @param contract_file_path: the contract that we are working on
114
+ @return: the running Vyper version (triplet, full identifier)
115
+ """
116
+ vyper_exec_to_run = get_relevant_compiler(contract_file_path, self.context)
117
+ return self.__get_compiler_exe_version(vyper_exec_to_run, self.__version_string_handler_vyper)
118
+
119
+ def __get_solc_version(self, contract_file_path: Path) -> Tuple[Util.CompilerVersion, Optional[str]]:
120
+ """
121
+ @param contract_file_path: the contract that we are working on
122
+ @return: the running solc version (triplet, full identifier)
123
+ """
124
+ compiler_logger.debug(f"visiting contract file {contract_file_path}")
125
+ solc_path = get_relevant_compiler(contract_file_path, self.context)
126
+ return self.__get_compiler_exe_version(solc_path, self.__version_string_handler_solc)
127
+
128
+ @lru_cache(maxsize=32)
129
+ def __get_compiler_exe_version(self, compiler_name: str,
130
+ version_string_handler:
131
+ Callable[[str], Util.CompilerVersion]) -> Tuple[Util.CompilerVersion, Optional[str]]:
132
+ """
133
+ @param compiler_name: name of the solc we want to run on this contract
134
+ @return: a tuple of (the running compiler version triplet, the full version
135
+ identifier string from `--version` such as
136
+ '0.8.34+commit.80d5c536.Darwin.appleclang', or None if it could not
137
+ be extracted). The triplet is used for behavioural checks; the full
138
+ identifier records the exact compiler build for reproducibility.
139
+ """
140
+ out_name = f"version_check_{Path(compiler_name).name}"
141
+ stdout_path = get_certora_config_dir() / f'{out_name}.stdout'
142
+ stderr_path = get_certora_config_dir() / f'{out_name}.stderr'
143
+ self._stdout_paths_to_clean.add(stdout_path)
144
+ self._stderr_paths_to_clean.add(stderr_path)
145
+
146
+ Util.run_compiler_cmd(
147
+ f"{compiler_name} --version",
148
+ wd=Path(os.getcwd()),
149
+ output_file_name=out_name)
150
+
151
+ with stdout_path.open() as r:
152
+ version_string = r.read(-1)
153
+ return version_string_handler(version_string), self.__extract_full_version(version_string)
154
+
155
+ @staticmethod
156
+ def __extract_full_version(version_string: str) -> Optional[str]:
157
+ """
158
+ Extracts the full version identifier from a compiler's `--version` output.
159
+ solc prints a `Version: <id>` line (e.g. 'Version: 0.8.34+commit.80d5c536.Darwin.appleclang');
160
+ vyper prints the bare identifier. Returns the identifier token, or None if not found.
161
+ """
162
+ version_matches = re.findall(r'^Version:\s*(\S+)', version_string, re.MULTILINE)
163
+ if version_matches:
164
+ return version_matches[0]
165
+ for line in version_string.splitlines():
166
+ line = line.strip()
167
+ if line:
168
+ return line
169
+ return None
170
+
171
+ @staticmethod
172
+ def __version_string_handler_vyper(version_string: str) -> Util.CompilerVersion:
173
+ version_matches = re.findall(Util.version_triplet_regex(), version_string, re.MULTILINE)
174
+ if len(version_matches) != 1:
175
+ msg = f"Couldn't extract Vyper version from output {version_string}, giving up"
176
+ compiler_logger.debug(msg)
177
+ raise RuntimeError(msg)
178
+ match = version_matches[0]
179
+ return int(match[0]), int(match[1]), int(match[2])
180
+
181
+ @staticmethod
182
+ def __version_string_handler_solc(version_string: str) -> Util.CompilerVersion:
183
+ version_matches = re.findall(Util.version_triplet_regex(prefix="Version: "), version_string, re.MULTILINE)
184
+ if len(version_matches) != 1:
185
+ msg = f"Couldn't extract Solidity version from output {version_string}, giving up"
186
+ compiler_logger.debug(msg)
187
+ raise RuntimeError(msg)
188
+ match = version_matches[0]
189
+ return int(match[0]), int(match[1]), int(match[2])
190
+
191
+ def __del__(self) -> None:
192
+ for path in self._stdout_paths_to_clean:
193
+ remove_file(path)
194
+ for path in self._stderr_paths_to_clean:
195
+ remove_file(path)
196
+
197
+
198
+ def get_compiler_lang(file_name: str) -> CompilerLang:
199
+ """
200
+ Returns [CompilerLang] instance, based on type of the file [file_name]
201
+ :param file_name: name of the file to create [CompilerLang] from
202
+ """
203
+ if file_name.endswith(".vy"):
204
+ return CompilerLangVy()
205
+ elif file_name.endswith(".sol"):
206
+ return CompilerLangSol()
207
+ elif file_name.endswith(".yul"):
208
+ return CompilerLangYul()
209
+ else:
210
+ raise RuntimeError(f'expected {file_name} to represent a Solidity or Vyper file')
@@ -0,0 +1,122 @@
1
+ # The Certora Prover
2
+ # Copyright (C) 2025 Certora Ltd.
3
+ #
4
+ # This program is free software: you can redistribute it and/or modify
5
+ # it under the terms of the GNU General Public License as published by
6
+ # the Free Software Foundation, version 3 of the License.
7
+ #
8
+ # This program is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
+ # GNU General Public License for more details.
12
+ #
13
+ # You should have received a copy of the GNU General Public License
14
+ # along with this program. If not, see <https://www.gnu.org/licenses/>.
15
+
16
+ from pathlib import Path
17
+ from typing import Any, List, Tuple, Dict, Set
18
+
19
+ from CertoraProver.Compiler.CompilerCollector import CompilerLang, CompilerLangFunc
20
+ from CertoraProver.Compiler.CompilerCollectorSolBased import CompilerCollectorSolBased
21
+ from Shared.certoraUtils import Singleton, CompilerVersion, get_certora_config_dir
22
+ import CertoraProver.certoraType as CT
23
+
24
+
25
+ class CompilerLangSol(CompilerLang, metaclass=Singleton):
26
+ """
27
+ [CompilerLang] for Solidity.
28
+ """
29
+
30
+ @property
31
+ def name(self) -> str:
32
+ return "Solidity"
33
+
34
+ @property
35
+ def compiler_name(self) -> str:
36
+ return "solc"
37
+
38
+ @staticmethod
39
+ def get_contract_def_node_ref(contract_file_ast: Dict[int, Any], contract_file: str, contract_name: str) -> \
40
+ int:
41
+ contract_def_refs = list(filter(
42
+ lambda node_id: contract_file_ast[node_id].get("nodeType") == "ContractDefinition" and
43
+ contract_file_ast[node_id].get("name") == contract_name, contract_file_ast))
44
+ assert len(contract_def_refs) != 0, \
45
+ f'Failed to find a "ContractDefinition" ast node id for the contract {contract_name}'
46
+ assert len(
47
+ contract_def_refs) == 1, f'Found multiple "ContractDefinition" ast node ids for the same contract ' \
48
+ f'{contract_name}: {contract_def_refs}'
49
+ return contract_def_refs[0]
50
+
51
+ @staticmethod
52
+ def compilation_output_path(sdc_name: str) -> Path:
53
+ return get_certora_config_dir() / f"{sdc_name}.standard.stdout.json"
54
+
55
+ @staticmethod
56
+ def get_supports_imports() -> bool:
57
+ return True
58
+
59
+ # Todo - add this for Vyper too and make it a CompilerLang class method one day
60
+ @staticmethod
61
+ def compilation_error_path(sdc_name: str) -> Path:
62
+ return get_certora_config_dir() / f"{sdc_name}.standard.json.stderr"
63
+
64
+ @staticmethod
65
+ def all_compilation_artifacts(sdc_name: str) -> Set[Path]:
66
+ """
67
+ Returns the set of paths for all files generated after compilation.
68
+ """
69
+ return {CompilerLangSol.compilation_output_path(sdc_name),
70
+ CompilerLangSol.compilation_error_path(sdc_name)}
71
+
72
+ @staticmethod
73
+ def collect_source_type_descriptions_and_funcs(asts: Dict[str, Dict[str, Dict[int, Any]]],
74
+ data: Dict[str, Any],
75
+ contract_file: str,
76
+ contract_name: str,
77
+ build_arg_contract_file: str) -> \
78
+ Tuple[List[CT.Type], List[CompilerLangFunc]]:
79
+ assert False, "collect_source_type_descriptions() has not yet been implemented in CompilerLangSol"
80
+
81
+ @property
82
+ def supports_typed_immutables(self) -> bool:
83
+ return True
84
+
85
+ @property
86
+ def supports_ast_output(self) -> bool:
87
+ return True
88
+
89
+ @property
90
+ def supports_srclist_output(self) -> bool:
91
+ return True
92
+
93
+
94
+ # This class is intended for calculations of compiler-settings related queries
95
+ class CompilerCollectorSol(CompilerCollectorSolBased):
96
+
97
+ def __init__(self, version: CompilerVersion, lang: CompilerLang, use_memory_safe_autofinders: bool):
98
+ super().__init__(version, lang)
99
+ # will only be applied for supporting solc versions
100
+ self.__use_memory_safe_autofinders = use_memory_safe_autofinders
101
+
102
+ def normalize_storage(self, is_storage: bool, arg_name: str) -> str:
103
+ if not is_storage:
104
+ return arg_name
105
+ if self.compiler_version[0] == 0 and self.compiler_version[1] < 7:
106
+ return arg_name + "_slot"
107
+ else:
108
+ return arg_name + ".slot"
109
+
110
+ def supports_calldata_assembly(self, arg_name: str) -> bool:
111
+ return (self.compiler_version[1] > 7 or (
112
+ self.compiler_version[1] == 7 and self.compiler_version[2] >= 5)) and arg_name != ""
113
+
114
+ def supports_memory_safe_assembly(self) -> bool:
115
+ return (self.compiler_version[1] > 8 or (
116
+ self.compiler_version[1] == 8 and self.compiler_version[2] >= 13))
117
+
118
+ def gen_memory_safe_assembly_prefix(self) -> str:
119
+ if self.supports_memory_safe_assembly() and self.__use_memory_safe_autofinders:
120
+ return 'assembly ("memory-safe")'
121
+ else:
122
+ return 'assembly'
@@ -0,0 +1,36 @@
1
+ # The Certora Prover
2
+ # Copyright (C) 2025 Certora Ltd.
3
+ #
4
+ # This program is free software: you can redistribute it and/or modify
5
+ # it under the terms of the GNU General Public License as published by
6
+ # the Free Software Foundation, version 3 of the License.
7
+ #
8
+ # This program is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
+ # GNU General Public License for more details.
12
+ #
13
+ # You should have received a copy of the GNU General Public License
14
+ # along with this program. If not, see <https://www.gnu.org/licenses/>.
15
+
16
+ from CertoraProver.Compiler.CompilerCollector import CompilerCollector, CompilerLang
17
+ from Shared.certoraUtils import CompilerVersion
18
+
19
+
20
+ class CompilerCollectorSolBased(CompilerCollector):
21
+
22
+ def __init__(self, version: CompilerVersion, lang: CompilerLang):
23
+ self.__compiler_version = version
24
+ self.__smart_contract_lang = lang
25
+
26
+ @property
27
+ def compiler_name(self) -> str:
28
+ return self.smart_contract_lang.compiler_name
29
+
30
+ @property
31
+ def smart_contract_lang(self) -> CompilerLang:
32
+ return self.__smart_contract_lang
33
+
34
+ @property
35
+ def compiler_version(self) -> CompilerVersion:
36
+ return self.__compiler_version