certora-cli-alpha-master 20250520.21.30.33372__py3-none-any.whl → 20250521.12.50.829403__py3-none-any.whl
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.
- certora_cli/Mutate/mutateApp.py +7 -2
- certora_cli/Shared/proverCommon.py +300 -0
- certora_cli/Shared/rustProverCommon.py +62 -0
- certora_cli/certoraEVMProver.py +2 -1
- certora_cli/certoraRanger.py +4 -36
- certora_cli/certoraRun.py +62 -166
- certora_cli/certoraSolanaProver.py +39 -134
- certora_cli/certoraSorobanProver.py +31 -224
- {certora_cli_alpha_master-20250520.21.30.33372.dist-info → certora_cli_alpha_master-20250521.12.50.829403.dist-info}/METADATA +2 -2
- {certora_cli_alpha_master-20250520.21.30.33372.dist-info → certora_cli_alpha_master-20250521.12.50.829403.dist-info}/RECORD +16 -14
- certora_jars/CERTORA-CLI-VERSION-METADATA.json +1 -1
- certora_jars/Typechecker.jar +0 -0
- {certora_cli_alpha_master-20250520.21.30.33372.dist-info → certora_cli_alpha_master-20250521.12.50.829403.dist-info}/LICENSE +0 -0
- {certora_cli_alpha_master-20250520.21.30.33372.dist-info → certora_cli_alpha_master-20250521.12.50.829403.dist-info}/WHEEL +0 -0
- {certora_cli_alpha_master-20250520.21.30.33372.dist-info → certora_cli_alpha_master-20250521.12.50.829403.dist-info}/entry_points.txt +0 -0
- {certora_cli_alpha_master-20250520.21.30.33372.dist-info → certora_cli_alpha_master-20250521.12.50.829403.dist-info}/top_level.txt +0 -0
@@ -16,195 +16,31 @@
|
|
16
16
|
|
17
17
|
|
18
18
|
import sys
|
19
|
-
import time
|
20
19
|
import logging
|
21
20
|
from pathlib import Path
|
22
|
-
from rich.console import Console
|
23
21
|
|
24
22
|
scripts_dir_path = Path(__file__).parent.resolve() # containing directory
|
25
23
|
sys.path.insert(0, str(scripts_dir_path))
|
26
24
|
|
27
|
-
from
|
28
|
-
from Shared import certoraUtils as Util
|
29
|
-
from typing import List, Optional, Tuple, Dict
|
25
|
+
from typing import List, Optional, Dict
|
30
26
|
|
31
|
-
import CertoraProver.certoraContext as Ctx
|
32
27
|
import CertoraProver.certoraContextAttributes as Attrs
|
33
|
-
from CertoraProver import certoraContextValidator as Cv
|
34
|
-
from CertoraProver.certoraContextClass import CertoraContext
|
35
|
-
from CertoraProver.certoraCollectRunMetadata import collect_run_metadata
|
36
|
-
from CertoraProver.certoraCollectConfigurationLayout import collect_configuration_layout
|
37
|
-
from CertoraProver.certoraBuildRust import set_rust_build_directory
|
38
|
-
from CertoraProver.certoraCloudIO import CloudVerification, validate_version_and_branch
|
39
|
-
from certoraRun import CertoraRunResult, VIOLATIONS_EXIT_CODE, CertoraFoundViolations
|
40
28
|
|
29
|
+
from Shared.rustProverCommon import build_rust_project
|
30
|
+
from Shared.proverCommon import (
|
31
|
+
build_context,
|
32
|
+
collect_and_dump_metadata,
|
33
|
+
collect_and_dump_config_layout,
|
34
|
+
ensure_version_compatibility,
|
35
|
+
run_local,
|
36
|
+
run_remote,
|
37
|
+
CertoraRunResult,
|
38
|
+
handle_exit,
|
39
|
+
catch_exits,
|
40
|
+
)
|
41
41
|
|
42
42
|
run_logger = logging.getLogger("run")
|
43
43
|
|
44
|
-
def setup_environment(args: List[str]) -> Tuple[CertoraContext, LoggingManager]:
|
45
|
-
"""
|
46
|
-
Setup the environment for running the prover.
|
47
|
-
This includes:
|
48
|
-
1. Setting up the logging manager
|
49
|
-
2. Parsing the arguments
|
50
|
-
3. Setting up the context
|
51
|
-
"""
|
52
|
-
Attrs.set_attribute_class(Attrs.SorobanProverAttributes)
|
53
|
-
non_str_els = [x for x in args if not isinstance(x, str)]
|
54
|
-
if non_str_els:
|
55
|
-
print(f"args for run_certora that are not strings: {non_str_els}")
|
56
|
-
exit(1)
|
57
|
-
|
58
|
-
# If we are not in debug mode, we do not want to print the traceback in case of exceptions.
|
59
|
-
if '--debug' not in args: # We check manually, because we want no traceback in argument parsing exceptions
|
60
|
-
sys.tracebacklimit = 0
|
61
|
-
|
62
|
-
# creating the default internal dir, files may be copied to user defined build directory after
|
63
|
-
# parsing the input
|
64
|
-
|
65
|
-
if not ('--help' in args or '--version' in args):
|
66
|
-
Util.reset_certora_internal_dir()
|
67
|
-
Util.safe_create_dir(Util.get_build_dir())
|
68
|
-
logging_manager = LoggingManager()
|
69
|
-
|
70
|
-
Ctx.handle_flags_in_args(args)
|
71
|
-
context = Ctx.get_args(args) # Parse arguments
|
72
|
-
|
73
|
-
assert logging_manager, "logging manager was not set"
|
74
|
-
logging_manager.set_log_level_and_format(is_quiet=Ctx.is_minimal_cli_output(context),
|
75
|
-
debug=context.debug,
|
76
|
-
debug_topics=context.debug_topics,
|
77
|
-
show_debug_topics=context.show_debug_topics)
|
78
|
-
|
79
|
-
return context, logging_manager
|
80
|
-
|
81
|
-
|
82
|
-
def collect_and_validate_metadata(context: CertoraContext) -> None:
|
83
|
-
"""
|
84
|
-
Collect and validate run metadata.
|
85
|
-
|
86
|
-
Args:
|
87
|
-
context: The Certora context containing verification settings
|
88
|
-
|
89
|
-
Raises:
|
90
|
-
Util.TestResultsReady: If this is a metadata test run
|
91
|
-
"""
|
92
|
-
metadata = collect_run_metadata(wd=Path.cwd(), raw_args=sys.argv, context=context)
|
93
|
-
|
94
|
-
if context.test == str(Util.TestValue.CHECK_METADATA):
|
95
|
-
raise Util.TestResultsReady(metadata)
|
96
|
-
|
97
|
-
metadata.dump()
|
98
|
-
|
99
|
-
|
100
|
-
def collect_and_dump(context: CertoraContext) -> None:
|
101
|
-
"""
|
102
|
-
Collect and dump the configuration layout.
|
103
|
-
|
104
|
-
Args:
|
105
|
-
context: The Certora context containing verification settings
|
106
|
-
|
107
|
-
Raises:
|
108
|
-
Util.TestResultsReady: If this is a configuration layout test run
|
109
|
-
"""
|
110
|
-
configuration_layout = collect_configuration_layout()
|
111
|
-
|
112
|
-
if context.test == str(Util.TestValue.CHECK_CONFIG_LAYOUT):
|
113
|
-
raise Util.TestResultsReady(configuration_layout)
|
114
|
-
|
115
|
-
configuration_layout.dump()
|
116
|
-
|
117
|
-
|
118
|
-
def build_project(context: CertoraContext) -> Dict:
|
119
|
-
"""
|
120
|
-
Build the Rust application.
|
121
|
-
|
122
|
-
Args:
|
123
|
-
context: The Certora context containing build settings
|
124
|
-
|
125
|
-
Returns:
|
126
|
-
Dict: Timing information for the build process
|
127
|
-
|
128
|
-
Raises:
|
129
|
-
Util.TestResultsReady: If this is a build test run
|
130
|
-
"""
|
131
|
-
timings = {}
|
132
|
-
run_logger.debug("Build Soroban target")
|
133
|
-
|
134
|
-
build_start = time.perf_counter()
|
135
|
-
set_rust_build_directory(context)
|
136
|
-
build_end = time.perf_counter()
|
137
|
-
|
138
|
-
timings["buildTime"] = round(build_end - build_start, 4)
|
139
|
-
|
140
|
-
if context.test == str(Util.TestValue.AFTER_BUILD):
|
141
|
-
raise Util.TestResultsReady(context)
|
142
|
-
|
143
|
-
return timings
|
144
|
-
|
145
|
-
def run_local_verification(context: CertoraContext) -> int:
|
146
|
-
"""
|
147
|
-
Run verification locally.
|
148
|
-
|
149
|
-
Args:
|
150
|
-
context: The Certora context containing verification settings
|
151
|
-
|
152
|
-
Returns:
|
153
|
-
int: Exit code (0 for success, non-zero for failure)
|
154
|
-
"""
|
155
|
-
check_cmd = Ctx.get_local_run_cmd(context)
|
156
|
-
run_logger.info(f"Verifier run command:\n {check_cmd}")
|
157
|
-
|
158
|
-
run_result = Util.run_jar_cmd(
|
159
|
-
check_cmd, override_exit_code=False, logger_topic="verification", print_output=True
|
160
|
-
)
|
161
|
-
|
162
|
-
if run_result == 0:
|
163
|
-
Util.print_completion_message("Finished running verifier:")
|
164
|
-
run_logger.info(f"\t{check_cmd}")
|
165
|
-
return 0
|
166
|
-
else:
|
167
|
-
return 1
|
168
|
-
|
169
|
-
|
170
|
-
def run_cloud_verification(context: CertoraContext, args: List[str],
|
171
|
-
timings: dict) -> Tuple[int, Optional[CertoraRunResult]]:
|
172
|
-
"""
|
173
|
-
Run verification in the cloud.
|
174
|
-
|
175
|
-
Args:
|
176
|
-
context: The Certora context containing verification settings
|
177
|
-
args: Command line arguments
|
178
|
-
timings: Dict containing timing information
|
179
|
-
|
180
|
-
Returns:
|
181
|
-
Tuple[int, Optional[CertoraRunResult]]: Exit code and result object
|
182
|
-
"""
|
183
|
-
if context.compilation_steps_only:
|
184
|
-
return 0, CertoraRunResult(None, False, Util.get_certora_sources_dir(), None)
|
185
|
-
|
186
|
-
context.key = Cv.validate_certora_key()
|
187
|
-
cloud_verifier = CloudVerification(context, timings)
|
188
|
-
|
189
|
-
# Wrap strings with space with ' so it can be copied and pasted to shell
|
190
|
-
pretty_args = [f"'{arg}'" if ' ' in arg else arg for arg in args]
|
191
|
-
cl_args = ' '.join(pretty_args)
|
192
|
-
|
193
|
-
exit_code = 0
|
194
|
-
return_value = None
|
195
|
-
|
196
|
-
if not cloud_verifier.cli_verify_and_report(cl_args, context.wait_for_results):
|
197
|
-
exit_code = VIOLATIONS_EXIT_CODE
|
198
|
-
|
199
|
-
if cloud_verifier.statusUrl:
|
200
|
-
return_value = CertoraRunResult(
|
201
|
-
cloud_verifier.statusUrl, False,
|
202
|
-
Util.get_certora_sources_dir(), cloud_verifier.reportUrl
|
203
|
-
)
|
204
|
-
|
205
|
-
return exit_code, return_value
|
206
|
-
|
207
|
-
|
208
44
|
def run_soroban_prover(args: List[str]) -> Optional[CertoraRunResult]:
|
209
45
|
"""
|
210
46
|
The main function that is responsible for the general flow of the script.
|
@@ -213,72 +49,43 @@ def run_soroban_prover(args: List[str]) -> Optional[CertoraRunResult]:
|
|
213
49
|
2. Run the necessary steps (build/ cloud verification/ local verification)
|
214
50
|
"""
|
215
51
|
|
216
|
-
context, logging_manager =
|
217
|
-
timings = {}
|
52
|
+
context, logging_manager = build_context(args, Attrs.SorobanProverAttributes)
|
53
|
+
timings: Dict[str, float] = {}
|
218
54
|
exit_code = 0 # The exit code of the script. 0 means success, any other number is an error.
|
219
55
|
return_value = None
|
220
56
|
|
221
57
|
# Collect and validate metadata and configuration layout
|
222
|
-
|
223
|
-
|
58
|
+
collect_and_dump_metadata(context)
|
59
|
+
collect_and_dump_config_layout(context)
|
224
60
|
|
225
61
|
# Version validation
|
226
|
-
|
227
|
-
"""
|
228
|
-
The line below will raise an exception if the local version is incompatible.
|
229
|
-
"""
|
230
|
-
validate_version_and_branch(context)
|
62
|
+
ensure_version_compatibility(context)
|
231
63
|
|
232
64
|
# Build the application
|
233
|
-
|
65
|
+
build_rust_project(context, timings)
|
234
66
|
|
235
67
|
# Run verification if requested
|
236
|
-
if
|
68
|
+
if context.build_only:
|
69
|
+
return return_value
|
237
70
|
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
71
|
+
if context.local:
|
72
|
+
exit_code = run_local(context, timings)
|
73
|
+
else:
|
74
|
+
# Remove debug logger before running cloud verification
|
75
|
+
logging_manager.remove_debug_logger()
|
76
|
+
exit_code, return_value = run_remote(context, args, timings)
|
244
77
|
|
245
|
-
# Handle exit
|
246
|
-
|
247
|
-
raise CertoraFoundViolations("violations were found", return_value)
|
248
|
-
if exit_code != 0:
|
249
|
-
raise Util.CertoraUserInputError(f"certoraSorobanProver failed (code {exit_code})")
|
250
|
-
return return_value
|
78
|
+
# Handle exit code
|
79
|
+
return handle_exit(exit_code, return_value)
|
251
80
|
|
252
81
|
|
82
|
+
@catch_exits
|
253
83
|
def entry_point() -> None:
|
254
84
|
"""
|
255
85
|
This function is the entry point of the certora_cli customer-facing package, as well as this script.
|
256
86
|
It is important this function gets no arguments!
|
257
87
|
"""
|
258
|
-
|
259
|
-
run_soroban_prover(sys.argv[1:])
|
260
|
-
sys.exit(0)
|
261
|
-
except KeyboardInterrupt:
|
262
|
-
Console().print("[bold red]\nInterrupted by user")
|
263
|
-
sys.exit(1)
|
264
|
-
except CertoraFoundViolations as e:
|
265
|
-
try:
|
266
|
-
if e.results and e.results.rule_report_link:
|
267
|
-
print(f"report url: {e.results.rule_report_link}")
|
268
|
-
except Exception:
|
269
|
-
pass
|
270
|
-
Console().print("[bold red]\nViolations were found\n")
|
271
|
-
sys.exit(1)
|
272
|
-
except Util.CertoraUserInputError as e:
|
273
|
-
if e.orig:
|
274
|
-
print(f"\n{str(e.orig).strip()}")
|
275
|
-
if e.more_info:
|
276
|
-
print(f"\n{e.more_info.strip()}")
|
277
|
-
Console().print(f"[bold red]\n{e}\n")
|
278
|
-
sys.exit(1)
|
279
|
-
except Exception as e:
|
280
|
-
Console().print(f"[bold red]{e}")
|
281
|
-
sys.exit(1)
|
88
|
+
run_soroban_prover(sys.argv[1:])
|
282
89
|
|
283
90
|
|
284
91
|
if __name__ == '__main__':
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.2
|
2
2
|
Name: certora-cli-alpha-master
|
3
|
-
Version:
|
3
|
+
Version: 20250521.12.50.829403
|
4
4
|
Summary: Runner for the Certora Prover
|
5
5
|
Home-page: https://pypi.org/project/certora-cli-alpha-master
|
6
6
|
Author: Certora
|
@@ -37,4 +37,4 @@ Dynamic: requires-dist
|
|
37
37
|
Dynamic: requires-python
|
38
38
|
Dynamic: summary
|
39
39
|
|
40
|
-
Commit
|
40
|
+
Commit 0cdebd6. Build and Run scripts for executing the Certora Prover on Solidity smart contracts.
|
@@ -1,12 +1,12 @@
|
|
1
1
|
certora_bins/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
2
2
|
certora_cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
3
|
-
certora_cli/certoraEVMProver.py,sha256=
|
3
|
+
certora_cli/certoraEVMProver.py,sha256=gLxqPXG9jKlCdLdgfo0aNjvp09vbHGSs8wghY6RH0Gg,1274
|
4
4
|
certora_cli/certoraEqCheck.py,sha256=qfZq7bpU1kbAIezC66W61VfKNZz7Uywg2Ygup62qYeo,1069
|
5
5
|
certora_cli/certoraMutate.py,sha256=XhFHyNVP_sk-3XkY6AAV5fVliEFAVRq-JeDGsqE5IQQ,3333
|
6
|
-
certora_cli/certoraRanger.py,sha256=
|
7
|
-
certora_cli/certoraRun.py,sha256=
|
8
|
-
certora_cli/certoraSolanaProver.py,sha256=
|
9
|
-
certora_cli/certoraSorobanProver.py,sha256=
|
6
|
+
certora_cli/certoraRanger.py,sha256=cwejxWTNlHsbwtu6Lew0SNsynSeq_ZKJu1Cr9uu0DhE,1314
|
7
|
+
certora_cli/certoraRun.py,sha256=IIPykXqarflxubpd7zJomoBMcCcj7-uLXIPiv7nrL_k,8675
|
8
|
+
certora_cli/certoraSolanaProver.py,sha256=7hu-YJJNA_P5eAJq_jYh6IGjiUf0PegGUBRCJ5AhE7s,3274
|
9
|
+
certora_cli/certoraSorobanProver.py,sha256=qE6b_vicC8KgOvUz7UTOaDuXT3UW0MMhq3keQgUVvzs,2865
|
10
10
|
certora_cli/rustMutator.py,sha256=6AvOGU8Ijz89zW_ZJCWlfXkeobJsk7EsqZhK7Eqwn-Y,14544
|
11
11
|
certora_cli/CertoraProver/__init__.py,sha256=QHNr-PJQAoyuPgTkO7gg23GRchiWSXglWNG7yLSQZvs,849
|
12
12
|
certora_cli/CertoraProver/certoraBuild.py,sha256=ZwCdvywuuA8as3M88YgSOzYztjCz5bqDo3jTfEGeZvI,211678
|
@@ -51,7 +51,7 @@ certora_cli/EquivalenceCheck/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NM
|
|
51
51
|
certora_cli/EquivalenceCheck/equivCheck.py,sha256=D3TA1DRppaXpEcVW_smqMQzeUle0jPu0wIXXEd5un0U,20620
|
52
52
|
certora_cli/EquivalenceCheck/sanity.spec,sha256=tWmE9z2Sq3_SWaqKDRQaNajRrw94maUrirvoUmX89LE,103
|
53
53
|
certora_cli/Mutate/__init__.py,sha256=QHNr-PJQAoyuPgTkO7gg23GRchiWSXglWNG7yLSQZvs,849
|
54
|
-
certora_cli/Mutate/mutateApp.py,sha256=
|
54
|
+
certora_cli/Mutate/mutateApp.py,sha256=bLBZeaVdK3kQ8u96wMoxNJhSKiQhRAlcv775QVKGMwU,87844
|
55
55
|
certora_cli/Mutate/mutateAttributes.py,sha256=brsoisPowxpxQxN_-y0NDvsv8feoHONhtlOayXaLDdk,10092
|
56
56
|
certora_cli/Mutate/mutateConstants.py,sha256=LRrz3wMM8WpPYSshkc-PLYqT0nexcWQeBNsehip-LOE,3945
|
57
57
|
certora_cli/Mutate/mutateUtil.py,sha256=B7MCIFtZBetjR4MMxU6F5ikYsaot1wTG7XYMjgVXl4k,2287
|
@@ -62,12 +62,14 @@ certora_cli/Shared/certoraAttrUtil.py,sha256=ZsoS6xbSZnAjEoPEcfiJi6CvHU-1ySBKubv
|
|
62
62
|
certora_cli/Shared/certoraLogging.py,sha256=cV2UQMhQ5j8crGXgeq9CEamI-Lk4HgdiA3HCrP-kSR4,14013
|
63
63
|
certora_cli/Shared/certoraUtils.py,sha256=fWb0-zZMCT_lRvhaPhf8GeXUySW6I0enChv1aOYhoOY,55185
|
64
64
|
certora_cli/Shared/certoraValidateFuncs.py,sha256=WG4UiyES8u49o3XmuRIvNf79rcpWFuCKtV__QUptOEQ,41852
|
65
|
-
|
66
|
-
|
65
|
+
certora_cli/Shared/proverCommon.py,sha256=NZ7DRdGU_rdjkomDZ61VKmm9m95CFubJ9AoA_iWvoUw,11172
|
66
|
+
certora_cli/Shared/rustProverCommon.py,sha256=NIZ5ECbhuiMegyRAl07CV3r68MFG2tBNKgUAQoV4uLI,2049
|
67
|
+
certora_jars/CERTORA-CLI-VERSION-METADATA.json,sha256=ooSq-SDHWVJlQNrfHT1TjZ2YjCYHMTEiwNqVADEpYsc,170
|
68
|
+
certora_jars/Typechecker.jar,sha256=aFHO4nSSEelS4ZzKzFG-9yqLNoCIDLNL4rM17l0h8q0,17138706
|
67
69
|
certora_jars/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
68
|
-
certora_cli_alpha_master-
|
69
|
-
certora_cli_alpha_master-
|
70
|
-
certora_cli_alpha_master-
|
71
|
-
certora_cli_alpha_master-
|
72
|
-
certora_cli_alpha_master-
|
73
|
-
certora_cli_alpha_master-
|
70
|
+
certora_cli_alpha_master-20250521.12.50.829403.dist-info/LICENSE,sha256=UGKSKIJSetF8m906JLKqNLkUS2CL60XfQdNvxBvpQXo,620
|
71
|
+
certora_cli_alpha_master-20250521.12.50.829403.dist-info/METADATA,sha256=dKjh1xSDWCg1us91MEZvyfQ1r1SJqbCOQmWbQ3LjDd4,1248
|
72
|
+
certora_cli_alpha_master-20250521.12.50.829403.dist-info/WHEEL,sha256=jB7zZ3N9hIM9adW7qlTAyycLYW9npaWKLRzaoVcLKcM,91
|
73
|
+
certora_cli_alpha_master-20250521.12.50.829403.dist-info/entry_points.txt,sha256=_SQ5_uYOAJXtqEW992nIvq7blW9cWFSUVEdbMGuy--4,443
|
74
|
+
certora_cli_alpha_master-20250521.12.50.829403.dist-info/top_level.txt,sha256=8C77w3JLanY0-NW45vpJsjRssyCqVP-qmPiN9FjWiX4,38
|
75
|
+
certora_cli_alpha_master-20250521.12.50.829403.dist-info/RECORD,,
|
@@ -1 +1 @@
|
|
1
|
-
{"name": "certora-cli-alpha-master", "tag": "", "branch": "master", "commit": "
|
1
|
+
{"name": "certora-cli-alpha-master", "tag": "", "branch": "master", "commit": "0cdebd6", "timestamp": "20250521.12.50.829403", "version": "20250521.12.50.829403+0cdebd6"}
|
certora_jars/Typechecker.jar
CHANGED
Binary file
|
File without changes
|
File without changes
|
File without changes
|