certora-cli-alpha-master 20241217.22.6.367707__tar.gz → 20241219.20.36.174596__tar.gz
Sign up to get free protection for your applications and to get access to all the features.
- {certora_cli_alpha_master-20241217.22.6.367707/certora_cli_alpha_master.egg-info → certora_cli_alpha_master-20241219.20.36.174596}/PKG-INFO +2 -2
- certora_cli_alpha_master-20241219.20.36.174596/README.md +1 -0
- {certora_cli_alpha_master-20241217.22.6.367707 → certora_cli_alpha_master-20241219.20.36.174596}/certora_cli/EVMVerifier/certoraBuild.py +11 -1
- {certora_cli_alpha_master-20241217.22.6.367707 → certora_cli_alpha_master-20241219.20.36.174596}/certora_cli/EVMVerifier/certoraCloudIO.py +5 -1
- {certora_cli_alpha_master-20241217.22.6.367707 → certora_cli_alpha_master-20241219.20.36.174596}/certora_cli/EVMVerifier/certoraContext.py +10 -4
- {certora_cli_alpha_master-20241217.22.6.367707 → certora_cli_alpha_master-20241219.20.36.174596}/certora_cli/EVMVerifier/certoraContextAttributes.py +8 -9
- {certora_cli_alpha_master-20241217.22.6.367707 → certora_cli_alpha_master-20241219.20.36.174596}/certora_cli/EVMVerifier/certoraContextValidator.py +6 -3
- {certora_cli_alpha_master-20241217.22.6.367707 → certora_cli_alpha_master-20241219.20.36.174596}/certora_cli/EVMVerifier/certoraParseBuildScript.py +5 -5
- {certora_cli_alpha_master-20241217.22.6.367707 → certora_cli_alpha_master-20241219.20.36.174596}/certora_cli/EVMVerifier/certoraType.py +1 -0
- {certora_cli_alpha_master-20241217.22.6.367707 → certora_cli_alpha_master-20241219.20.36.174596}/certora_cli/Shared/certoraUtils.py +2 -1
- {certora_cli_alpha_master-20241217.22.6.367707 → certora_cli_alpha_master-20241219.20.36.174596}/certora_cli/rustMutator.py +38 -50
- {certora_cli_alpha_master-20241217.22.6.367707 → certora_cli_alpha_master-20241219.20.36.174596/certora_cli_alpha_master.egg-info}/PKG-INFO +2 -2
- certora_cli_alpha_master-20241219.20.36.174596/certora_jars/CERTORA-CLI-VERSION-METADATA.json +1 -0
- {certora_cli_alpha_master-20241217.22.6.367707 → certora_cli_alpha_master-20241219.20.36.174596}/certora_jars/Typechecker.jar +0 -0
- {certora_cli_alpha_master-20241217.22.6.367707 → certora_cli_alpha_master-20241219.20.36.174596}/setup.py +2 -2
- certora_cli_alpha_master-20241217.22.6.367707/README.md +0 -1
- certora_cli_alpha_master-20241217.22.6.367707/certora_jars/CERTORA-CLI-VERSION-METADATA.json +0 -1
- {certora_cli_alpha_master-20241217.22.6.367707 → certora_cli_alpha_master-20241219.20.36.174596}/LICENSE +0 -0
- {certora_cli_alpha_master-20241217.22.6.367707 → certora_cli_alpha_master-20241219.20.36.174596}/MANIFEST.in +0 -0
- {certora_cli_alpha_master-20241217.22.6.367707 → certora_cli_alpha_master-20241219.20.36.174596}/certora_bins/__init__.py +0 -0
- {certora_cli_alpha_master-20241217.22.6.367707 → certora_cli_alpha_master-20241219.20.36.174596}/certora_cli/EVMVerifier/Compiler/CompilerCollector.py +0 -0
- {certora_cli_alpha_master-20241217.22.6.367707 → certora_cli_alpha_master-20241219.20.36.174596}/certora_cli/EVMVerifier/Compiler/CompilerCollectorFactory.py +0 -0
- {certora_cli_alpha_master-20241217.22.6.367707 → certora_cli_alpha_master-20241219.20.36.174596}/certora_cli/EVMVerifier/Compiler/CompilerCollectorSol.py +0 -0
- {certora_cli_alpha_master-20241217.22.6.367707 → certora_cli_alpha_master-20241219.20.36.174596}/certora_cli/EVMVerifier/Compiler/CompilerCollectorSolBased.py +0 -0
- {certora_cli_alpha_master-20241217.22.6.367707 → certora_cli_alpha_master-20241219.20.36.174596}/certora_cli/EVMVerifier/Compiler/CompilerCollectorVy.py +0 -0
- {certora_cli_alpha_master-20241217.22.6.367707 → certora_cli_alpha_master-20241219.20.36.174596}/certora_cli/EVMVerifier/Compiler/CompilerCollectorYul.py +0 -0
- {certora_cli_alpha_master-20241217.22.6.367707 → certora_cli_alpha_master-20241219.20.36.174596}/certora_cli/EVMVerifier/Compiler/__init__.py +0 -0
- {certora_cli_alpha_master-20241217.22.6.367707 → certora_cli_alpha_master-20241219.20.36.174596}/certora_cli/EVMVerifier/__init__.py +0 -0
- {certora_cli_alpha_master-20241217.22.6.367707 → certora_cli_alpha_master-20241219.20.36.174596}/certora_cli/EVMVerifier/certoraBuildCacheManager.py +0 -0
- {certora_cli_alpha_master-20241217.22.6.367707 → certora_cli_alpha_master-20241219.20.36.174596}/certora_cli/EVMVerifier/certoraBuildDataClasses.py +0 -0
- {certora_cli_alpha_master-20241217.22.6.367707 → certora_cli_alpha_master-20241219.20.36.174596}/certora_cli/EVMVerifier/certoraCollectRunMetadata.py +0 -0
- {certora_cli_alpha_master-20241217.22.6.367707 → certora_cli_alpha_master-20241219.20.36.174596}/certora_cli/EVMVerifier/certoraCompilerParameters.py +0 -0
- {certora_cli_alpha_master-20241217.22.6.367707 → certora_cli_alpha_master-20241219.20.36.174596}/certora_cli/EVMVerifier/certoraConfigIO.py +0 -0
- {certora_cli_alpha_master-20241217.22.6.367707 → certora_cli_alpha_master-20241219.20.36.174596}/certora_cli/EVMVerifier/certoraContextClass.py +0 -0
- {certora_cli_alpha_master-20241217.22.6.367707 → certora_cli_alpha_master-20241219.20.36.174596}/certora_cli/EVMVerifier/certoraContractFuncs.py +0 -0
- {certora_cli_alpha_master-20241217.22.6.367707 → certora_cli_alpha_master-20241219.20.36.174596}/certora_cli/EVMVerifier/certoraExtensionInfo.py +0 -0
- {certora_cli_alpha_master-20241217.22.6.367707 → certora_cli_alpha_master-20241219.20.36.174596}/certora_cli/EVMVerifier/certoraJobList.py +0 -0
- {certora_cli_alpha_master-20241217.22.6.367707 → certora_cli_alpha_master-20241219.20.36.174596}/certora_cli/EVMVerifier/certoraMiniSpecParser.py +0 -0
- {certora_cli_alpha_master-20241217.22.6.367707 → certora_cli_alpha_master-20241219.20.36.174596}/certora_cli/EVMVerifier/certoraNodeFilters.py +0 -0
- {certora_cli_alpha_master-20241217.22.6.367707 → certora_cli_alpha_master-20241219.20.36.174596}/certora_cli/EVMVerifier/certoraSourceFinders.py +0 -0
- {certora_cli_alpha_master-20241217.22.6.367707 → certora_cli_alpha_master-20241219.20.36.174596}/certora_cli/EVMVerifier/certoraVerifyGenerator.py +0 -0
- {certora_cli_alpha_master-20241217.22.6.367707 → certora_cli_alpha_master-20241219.20.36.174596}/certora_cli/EquivalenceCheck/Eq_default.conf +0 -0
- {certora_cli_alpha_master-20241217.22.6.367707 → certora_cli_alpha_master-20241219.20.36.174596}/certora_cli/EquivalenceCheck/Eq_mc_no_out_template.spec +0 -0
- {certora_cli_alpha_master-20241217.22.6.367707 → certora_cli_alpha_master-20241219.20.36.174596}/certora_cli/EquivalenceCheck/Eq_mc_template.spec +0 -0
- {certora_cli_alpha_master-20241217.22.6.367707 → certora_cli_alpha_master-20241219.20.36.174596}/certora_cli/EquivalenceCheck/Eq_sanity.conf +0 -0
- {certora_cli_alpha_master-20241217.22.6.367707 → certora_cli_alpha_master-20241219.20.36.174596}/certora_cli/EquivalenceCheck/Eq_template.spec +0 -0
- {certora_cli_alpha_master-20241217.22.6.367707 → certora_cli_alpha_master-20241219.20.36.174596}/certora_cli/EquivalenceCheck/__init__.py +0 -0
- {certora_cli_alpha_master-20241217.22.6.367707 → certora_cli_alpha_master-20241219.20.36.174596}/certora_cli/EquivalenceCheck/equivCheck.py +0 -0
- {certora_cli_alpha_master-20241217.22.6.367707 → certora_cli_alpha_master-20241219.20.36.174596}/certora_cli/EquivalenceCheck/sanity.spec +0 -0
- {certora_cli_alpha_master-20241217.22.6.367707 → certora_cli_alpha_master-20241219.20.36.174596}/certora_cli/Mutate/__init__.py +0 -0
- {certora_cli_alpha_master-20241217.22.6.367707 → certora_cli_alpha_master-20241219.20.36.174596}/certora_cli/Mutate/mutateApp.py +0 -0
- {certora_cli_alpha_master-20241217.22.6.367707 → certora_cli_alpha_master-20241219.20.36.174596}/certora_cli/Mutate/mutateAttributes.py +0 -0
- {certora_cli_alpha_master-20241217.22.6.367707 → certora_cli_alpha_master-20241219.20.36.174596}/certora_cli/Mutate/mutateConstants.py +0 -0
- {certora_cli_alpha_master-20241217.22.6.367707 → certora_cli_alpha_master-20241219.20.36.174596}/certora_cli/Mutate/mutateUtil.py +0 -0
- {certora_cli_alpha_master-20241217.22.6.367707 → certora_cli_alpha_master-20241219.20.36.174596}/certora_cli/Mutate/mutateValidate.py +0 -0
- {certora_cli_alpha_master-20241217.22.6.367707 → certora_cli_alpha_master-20241219.20.36.174596}/certora_cli/Shared/ExpectedComparator.py +0 -0
- {certora_cli_alpha_master-20241217.22.6.367707 → certora_cli_alpha_master-20241219.20.36.174596}/certora_cli/Shared/__init__.py +0 -0
- {certora_cli_alpha_master-20241217.22.6.367707 → certora_cli_alpha_master-20241219.20.36.174596}/certora_cli/Shared/certoraAttrUtil.py +0 -0
- {certora_cli_alpha_master-20241217.22.6.367707 → certora_cli_alpha_master-20241219.20.36.174596}/certora_cli/Shared/certoraLogging.py +0 -0
- {certora_cli_alpha_master-20241217.22.6.367707 → certora_cli_alpha_master-20241219.20.36.174596}/certora_cli/Shared/certoraValidateFuncs.py +0 -0
- {certora_cli_alpha_master-20241217.22.6.367707 → certora_cli_alpha_master-20241219.20.36.174596}/certora_cli/__init__.py +0 -0
- {certora_cli_alpha_master-20241217.22.6.367707 → certora_cli_alpha_master-20241219.20.36.174596}/certora_cli/certoraEqCheck.py +0 -0
- {certora_cli_alpha_master-20241217.22.6.367707 → certora_cli_alpha_master-20241219.20.36.174596}/certora_cli/certoraMutate.py +0 -0
- {certora_cli_alpha_master-20241217.22.6.367707 → certora_cli_alpha_master-20241219.20.36.174596}/certora_cli/certoraRun.py +0 -0
- {certora_cli_alpha_master-20241217.22.6.367707 → certora_cli_alpha_master-20241219.20.36.174596}/certora_cli/certoraSolanaProver.py +0 -0
- {certora_cli_alpha_master-20241217.22.6.367707 → certora_cli_alpha_master-20241219.20.36.174596}/certora_cli_alpha_master.egg-info/SOURCES.txt +0 -0
- {certora_cli_alpha_master-20241217.22.6.367707 → certora_cli_alpha_master-20241219.20.36.174596}/certora_cli_alpha_master.egg-info/dependency_links.txt +0 -0
- {certora_cli_alpha_master-20241217.22.6.367707 → certora_cli_alpha_master-20241219.20.36.174596}/certora_cli_alpha_master.egg-info/entry_points.txt +0 -0
- {certora_cli_alpha_master-20241217.22.6.367707 → certora_cli_alpha_master-20241219.20.36.174596}/certora_cli_alpha_master.egg-info/requires.txt +0 -0
- {certora_cli_alpha_master-20241217.22.6.367707 → certora_cli_alpha_master-20241219.20.36.174596}/certora_cli_alpha_master.egg-info/top_level.txt +0 -0
- {certora_cli_alpha_master-20241217.22.6.367707 → certora_cli_alpha_master-20241219.20.36.174596}/certora_jars/__init__.py +0 -0
- {certora_cli_alpha_master-20241217.22.6.367707 → certora_cli_alpha_master-20241219.20.36.174596}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: certora-cli-alpha-master
|
3
|
-
Version:
|
3
|
+
Version: 20241219.20.36.174596
|
4
4
|
Summary: Runner for the Certora Prover
|
5
5
|
Home-page: https://pypi.org/project/certora-cli-alpha-master
|
6
6
|
Author: Certora
|
@@ -23,4 +23,4 @@ Requires-Dist: StrEnum
|
|
23
23
|
Requires-Dist: tomli
|
24
24
|
Requires-Dist: universalmutator
|
25
25
|
|
26
|
-
Commit
|
26
|
+
Commit a0a7788. Build and Run scripts for executing the Certora Prover on Solidity smart contracts.
|
@@ -0,0 +1 @@
|
|
1
|
+
Commit a0a7788. Build and Run scripts for executing the Certora Prover on Solidity smart contracts.
|
@@ -1577,7 +1577,17 @@ class CertoraBuildGenerator:
|
|
1577
1577
|
while queue:
|
1578
1578
|
pop = queue.pop(0)
|
1579
1579
|
if isinstance(pop, dict) and node_id_attrb in pop:
|
1580
|
-
|
1580
|
+
idAttr = pop[node_id_attrb]
|
1581
|
+
if isinstance(idAttr, int):
|
1582
|
+
container[int(idAttr)] = pop
|
1583
|
+
elif isinstance(idAttr, list) and len(idAttr) == 1 and isinstance(idAttr[0], int):
|
1584
|
+
# In the bug reported in https://certora.atlassian.net/browse/CERT-7643 the id field is a list
|
1585
|
+
# instead of a single integer - we except that the first element of the list is the actual id
|
1586
|
+
# and unpack it.
|
1587
|
+
container[int(idAttr[0])] = pop
|
1588
|
+
else:
|
1589
|
+
raise Exception(f"Unexpected type of attribute `{node_id_attrb}`, was {idAttr}, expected an integer or an int-typed list of length 1")
|
1590
|
+
|
1581
1591
|
for key, value in pop.items():
|
1582
1592
|
if (node_type_attrb in pop and
|
1583
1593
|
pop[node_type_attrb] == "InlineAssembly" and key == "externalReferences"):
|
@@ -765,7 +765,11 @@ class CloudVerification:
|
|
765
765
|
short_output=Ctx.is_minimal_cli_output(self.context))
|
766
766
|
elif Attrs.is_evm_app() and self.context.is_bytecode:
|
767
767
|
# We zip the bytecode jsons and the spec
|
768
|
-
paths = [
|
768
|
+
paths = [Util.get_certora_build_file(), Util.get_certora_verify_file(),
|
769
|
+
Util.get_certora_metadata_file()]
|
770
|
+
if Util.get_certora_sources_dir().exists():
|
771
|
+
paths.append(Util.get_certora_sources_dir())
|
772
|
+
|
769
773
|
for bytecode_json in self.context.bytecode_jsons:
|
770
774
|
paths.append(Path(bytecode_json))
|
771
775
|
paths.append(Path(self.context.bytecode_spec))
|
@@ -1,10 +1,10 @@
|
|
1
1
|
import argparse
|
2
2
|
import hashlib
|
3
3
|
import json
|
4
|
-
import logging
|
5
4
|
import os
|
6
5
|
import re
|
7
6
|
import sys
|
7
|
+
import logging
|
8
8
|
|
9
9
|
|
10
10
|
from pathlib import Path
|
@@ -106,9 +106,15 @@ def get_local_run_cmd(context: CertoraContext) -> str:
|
|
106
106
|
@return: A command for running the prover locally
|
107
107
|
"""
|
108
108
|
run_args = []
|
109
|
-
|
109
|
+
|
110
|
+
if hasattr(context, 'rust_executables') and hasattr(context, 'rust_project_directory'):
|
111
|
+
run_args.append(os.path.join(context.rust_project_directory, context.rust_executables))
|
112
|
+
elif context.is_tac or Attrs.is_rust_app():
|
110
113
|
# For Rust app we assume the files holds the executable for the prover, currently we support a single file
|
111
|
-
|
114
|
+
try:
|
115
|
+
run_args.append(context.files[0])
|
116
|
+
except Exception:
|
117
|
+
raise RuntimeError("get_local_run_cmd: cannot find context.files[0]")
|
112
118
|
|
113
119
|
if Attrs.is_evm_app() and context.cache is not None:
|
114
120
|
run_args.extend(['-cache', context.cache])
|
@@ -231,7 +237,7 @@ def get_args(args_list: Optional[List[str]] = None) -> CertoraContext:
|
|
231
237
|
|
232
238
|
validator = Cv.CertoraContextValidator(context)
|
233
239
|
validator.validate()
|
234
|
-
if Attrs.is_evm_app():
|
240
|
+
if Attrs.is_evm_app() or Attrs.is_rust_app():
|
235
241
|
current_build_directory = Util.get_build_dir()
|
236
242
|
if context.build_dir is not None and current_build_directory != context.build_dir:
|
237
243
|
Util.reset_certora_internal_dir(context.build_dir)
|
@@ -161,6 +161,14 @@ class CommonAttributes(AttrUtil.Attributes):
|
|
161
161
|
disables_build_cache=False
|
162
162
|
)
|
163
163
|
|
164
|
+
BUILD_DIR = AttrUtil.AttributeDefinition(
|
165
|
+
attr_validation_func=Vf.validate_build_dir,
|
166
|
+
argparse_args={
|
167
|
+
'action': AttrUtil.UniqueStore
|
168
|
+
},
|
169
|
+
affects_build_cache_key=False,
|
170
|
+
disables_build_cache=False
|
171
|
+
)
|
164
172
|
|
165
173
|
class DeprecatedAttributes(AttrUtil.Attributes):
|
166
174
|
AUTO_NONDET_DIFFICULT_INTERNAL_FUNCS = AttrUtil.AttributeDefinition(
|
@@ -639,15 +647,6 @@ class EvmAttributes(AttrUtil.Attributes):
|
|
639
647
|
disables_build_cache=False
|
640
648
|
)
|
641
649
|
|
642
|
-
BUILD_DIR = AttrUtil.AttributeDefinition(
|
643
|
-
attr_validation_func=Vf.validate_build_dir,
|
644
|
-
argparse_args={
|
645
|
-
'action': AttrUtil.UniqueStore
|
646
|
-
},
|
647
|
-
affects_build_cache_key=False,
|
648
|
-
disables_build_cache=False
|
649
|
-
)
|
650
|
-
|
651
650
|
DISABLE_LOCAL_TYPECHECKING = AttrUtil.AttributeDefinition(
|
652
651
|
arg_type=AttrUtil.AttrArgType.BOOLEAN,
|
653
652
|
argparse_args={
|
@@ -173,14 +173,17 @@ class CertoraContextValidator:
|
|
173
173
|
"'disable_source_finders' is set to true while 'dynamic_bound' is set to 1 or higher"
|
174
174
|
)
|
175
175
|
context.disable_source_finders = True
|
176
|
-
|
176
|
+
package_name = Util.get_package_and_version()[1]
|
177
177
|
# if --fe_version was not set then if the package is alpha/beta we set it to latest else we set it to production
|
178
178
|
if not context.fe_version:
|
179
|
-
lastest_packages = [Util.
|
180
|
-
if
|
179
|
+
lastest_packages = [Util.ALPHA_PACKAGE_MASTER_NAME, Util.BETA_PACKAGE_NAME, Util.BETA_MIRROR_PACKAGE_NAME]
|
180
|
+
if package_name in lastest_packages:
|
181
181
|
context.fe_version = str(Util.FeValue.LATEST)
|
182
182
|
else:
|
183
183
|
context.fe_version = str(Util.FeValue.PRODUCTION)
|
184
|
+
if Util.ALPHA_PACKAGE_NAME in package_name and not context.prover_version:
|
185
|
+
raise Util.CertoraUserInputError('When running an "alpha release", a specific branch must be supplied '
|
186
|
+
'via --prover_version. For example: "--prover_version master"')
|
184
187
|
|
185
188
|
check_conflicting_branch_and_hash(context)
|
186
189
|
set_wait_for_results_default(context)
|
@@ -1,19 +1,19 @@
|
|
1
1
|
import subprocess
|
2
2
|
import json
|
3
|
-
|
3
|
+
import logging
|
4
4
|
|
5
5
|
from EVMVerifier.certoraContextClass import CertoraContext
|
6
6
|
from Shared import certoraUtils as Util
|
7
|
-
|
7
|
+
|
8
|
+
build_script_logger = logging.getLogger("build_script")
|
8
9
|
|
9
10
|
|
10
11
|
def run_script_and_parse_json(context: CertoraContext) -> None:
|
11
12
|
if not context.build_script:
|
12
13
|
return
|
13
14
|
try:
|
14
|
-
|
15
|
-
result = subprocess.run([
|
16
|
-
env=env, cwd=Path(context.build_script).resolve().parent)
|
15
|
+
build_script_logger.info(f"Building from script {context.build_script}")
|
16
|
+
result = subprocess.run([context.build_script, '--json'], capture_output=True, text=True)
|
17
17
|
|
18
18
|
# Check if the script executed successfully
|
19
19
|
if result.returncode != 0:
|
@@ -79,7 +79,8 @@ LAST_CONF_FILE = Path("run.conf")
|
|
79
79
|
EMV_JAR = Path("emv.jar")
|
80
80
|
CERTORA_SOURCES = Path(".certora_sources")
|
81
81
|
SOLANA_DEFAULT_COMMAND = "cargo +solana build-sbf"
|
82
|
-
ALPHA_PACKAGE_NAME = 'certora-cli-alpha
|
82
|
+
ALPHA_PACKAGE_NAME = 'certora-cli-alpha'
|
83
|
+
ALPHA_PACKAGE_MASTER_NAME = ALPHA_PACKAGE_NAME + '-master'
|
83
84
|
# contract names in Solidity consists of alphanums, underscores and dollar signs
|
84
85
|
# https://docs.soliditylang.org/en/latest/grammar.html#a4.SolidityLexer.Identifier
|
85
86
|
SOLIDITY_ID_SUBSTRING_RE = r"[a-zA-Z_$][a-zA-Z0-9_$]*" # string *contains* a valid solidity ID
|
@@ -1,5 +1,6 @@
|
|
1
1
|
#!/usr/bin/env python3
|
2
2
|
|
3
|
+
import atexit
|
3
4
|
import shutil
|
4
5
|
import subprocess
|
5
6
|
import argparse
|
@@ -31,7 +32,7 @@ def parse_args() -> argparse.Namespace:
|
|
31
32
|
)
|
32
33
|
)
|
33
34
|
parser.add_argument(
|
34
|
-
"--
|
35
|
+
"--file_to_mutate",
|
35
36
|
"-f",
|
36
37
|
type=Path,
|
37
38
|
required=True,
|
@@ -74,27 +75,12 @@ def parse_args() -> argparse.Namespace:
|
|
74
75
|
return parser.parse_args()
|
75
76
|
|
76
77
|
|
77
|
-
def
|
78
|
-
"""
|
79
|
-
Restore the original source file from the backup.
|
80
|
-
|
81
|
-
Args:
|
82
|
-
backup_file (Path): Path to the backup file.
|
83
|
-
file_to_mutant (Path): Path to the original source file.
|
84
|
-
"""
|
85
|
-
rust_mutator_logger.info(f"Restoring the original '{file_to_mutant}' from '{backup_file}'...")
|
86
|
-
if Util.restore_backup(backup_file):
|
87
|
-
rust_mutator_logger.info(f"Original '{file_to_mutant}' restored successfully.")
|
88
|
-
else:
|
89
|
-
rust_mutator_logger.warning(f"No backup file '{backup_file}' found. Skipping restoration.")
|
90
|
-
|
91
|
-
|
92
|
-
def clean_temp_files(file_to_mutant: Path) -> None:
|
78
|
+
def clean_temp_files(file_to_mutate: Path) -> None:
|
93
79
|
"""
|
94
80
|
Remove temporary mutant output files matching the pattern '.um.mutant_output.*'.
|
95
81
|
|
96
82
|
Args:
|
97
|
-
|
83
|
+
file_to_mutate (Path): Path to the original source file.
|
98
84
|
"""
|
99
85
|
temp_files = Path().rglob(".um.mutant_output.*")
|
100
86
|
|
@@ -103,7 +89,7 @@ def clean_temp_files(file_to_mutant: Path) -> None:
|
|
103
89
|
temp_file.unlink()
|
104
90
|
rust_mutator_logger.info(f"Removed: {temp_file}")
|
105
91
|
|
106
|
-
backup_file = next(Path().rglob(f"{
|
92
|
+
backup_file = next(Path().rglob(f"{file_to_mutate}.um.backup.*"), None)
|
107
93
|
if backup_file:
|
108
94
|
backup_file.unlink()
|
109
95
|
rust_mutator_logger.info(f"Removed: {backup_file}")
|
@@ -148,22 +134,22 @@ def uniform_selection(mutants: List[Path], num_select: int, seed: int) -> List[P
|
|
148
134
|
return shuffled_mutants[:num_select]
|
149
135
|
|
150
136
|
|
151
|
-
def validate_source_file(
|
137
|
+
def validate_source_file(file_to_mutate: Path) -> None:
|
152
138
|
"""
|
153
139
|
Validate that the source file exists and has a .rs extension.
|
154
140
|
|
155
141
|
Args:
|
156
|
-
|
142
|
+
file_to_mutate (Path): Path to the Rust source file.
|
157
143
|
|
158
144
|
Raises:
|
159
145
|
Util.CertoraUserInputError: If validation fails.
|
160
146
|
"""
|
161
|
-
if not
|
162
|
-
raise Util.CertoraUserInputError(f"Source file '{
|
163
|
-
if not
|
164
|
-
raise Util.CertoraUserInputError(f"Source file '{
|
165
|
-
if
|
166
|
-
raise Util.CertoraUserInputError(f"Source file '{
|
147
|
+
if not file_to_mutate.exists():
|
148
|
+
raise Util.CertoraUserInputError(f"Source file '{file_to_mutate}' does not exist.")
|
149
|
+
if not file_to_mutate.is_file():
|
150
|
+
raise Util.CertoraUserInputError(f"Source file '{file_to_mutate}' is not a file.")
|
151
|
+
if file_to_mutate.suffix != ".rs":
|
152
|
+
raise Util.CertoraUserInputError(f"Source file '{file_to_mutate}' does not have a .rs extension.")
|
167
153
|
|
168
154
|
|
169
155
|
def validate_mutant_dir(mutants_location: Path) -> None:
|
@@ -186,13 +172,13 @@ def validate_mutant_dir(mutants_location: Path) -> None:
|
|
186
172
|
rust_mutator_logger.info(f"Mutant directory '{mutants_location}' created successfully.")
|
187
173
|
|
188
174
|
|
189
|
-
def validate_mutant_count(
|
175
|
+
def validate_mutant_count(file_to_mutate: Path, mutants_location: Path, num_mutants: int, seed: int) -> None:
|
190
176
|
"""
|
191
177
|
Validate the number of mutants generated is less than or equal to the specified limit. If the number of mutants
|
192
178
|
exceeds the limit, select uniformly based on the seed and delete the rest.
|
193
179
|
|
194
180
|
Args:
|
195
|
-
|
181
|
+
file_to_mutate (Path): Path to the original Rust source file.
|
196
182
|
mutants_location (Path): Directory containing generated mutants.
|
197
183
|
num_mutants (int): Upper bound on the number of mutants to generate.
|
198
184
|
seed (int, optional): Seed value for random selection.
|
@@ -201,7 +187,7 @@ def validate_mutant_count(file_to_mutant: Path, mutants_location: Path, num_muta
|
|
201
187
|
Util.CertoraUserInputError: If no mutants are generated.
|
202
188
|
"""
|
203
189
|
# Define the regex pattern to extract the mutant number
|
204
|
-
pattern = re.compile(rf"{re.escape(
|
190
|
+
pattern = re.compile(rf"{re.escape(file_to_mutate.stem)}\.mutant\.(\d+)\.rs$")
|
205
191
|
|
206
192
|
# Gather all mutants matching the pattern
|
207
193
|
mutants = [mutant for mutant in mutants_location.iterdir() if pattern.match(mutant.name)]
|
@@ -233,7 +219,7 @@ def validate_mutant_count(file_to_mutant: Path, mutants_location: Path, num_muta
|
|
233
219
|
for mutant, mutant_number in numbered_mutants:
|
234
220
|
if not 0 <= mutant_number < num_mutants:
|
235
221
|
for i in range(num_mutants):
|
236
|
-
new_file_name = mutant.with_name(f"{
|
222
|
+
new_file_name = mutant.with_name(f"{file_to_mutate.stem}.mutant.{i}.rs")
|
237
223
|
if new_file_name.exists():
|
238
224
|
continue
|
239
225
|
mutant.rename(new_file_name)
|
@@ -251,12 +237,12 @@ def validate_mutate_command() -> None:
|
|
251
237
|
raise Util.CertoraUserInputError("universalmutator command 'mutate' not found in PATH.")
|
252
238
|
|
253
239
|
|
254
|
-
def run_mutate(
|
240
|
+
def run_mutate(file_to_mutate: Path, mutants_location: Path, build_command: str) -> None:
|
255
241
|
"""
|
256
242
|
Execute the universalmutator command to generate mutants, displaying a progress bar.
|
257
243
|
|
258
244
|
Args:
|
259
|
-
|
245
|
+
file_to_mutate (Path): Path to the Rust source file.
|
260
246
|
mutants_location (Path): Directory to store generated mutants.
|
261
247
|
build_command (str): Command to execute for each mutant to verify compilation.
|
262
248
|
|
@@ -265,7 +251,7 @@ def run_mutate(file_to_mutant: Path, mutants_location: Path, build_command: str)
|
|
265
251
|
"""
|
266
252
|
mutate_command = [
|
267
253
|
"mutate",
|
268
|
-
str(
|
254
|
+
str(file_to_mutate),
|
269
255
|
"rust",
|
270
256
|
"--mutantDir",
|
271
257
|
str(mutants_location),
|
@@ -287,7 +273,7 @@ def run_mutate(file_to_mutant: Path, mutants_location: Path, build_command: str)
|
|
287
273
|
total_mutants = None
|
288
274
|
mutant_pattern = re.compile(r"^PROCESSING MUTANT: (\d+):")
|
289
275
|
total_pattern = re.compile(r"^(\d+) MUTANTS GENERATED BY RULES")
|
290
|
-
valid_mutant_pattern = re.compile(rf"VALID \[written to {mutants_location.stem}/{
|
276
|
+
valid_mutant_pattern = re.compile(rf"VALID \[written to {mutants_location.stem}/{file_to_mutate.stem}\.mutant\.\d+\.rs\]")
|
291
277
|
|
292
278
|
progress_bar = None
|
293
279
|
|
@@ -306,7 +292,7 @@ def run_mutate(file_to_mutant: Path, mutants_location: Path, build_command: str)
|
|
306
292
|
if total_match:
|
307
293
|
total_mutants = int(total_match.group(1))
|
308
294
|
progress_bar = tqdm(total=total_mutants, desc="Mutants Generated", unit="mutant")
|
309
|
-
rust_mutator_logger.info(f"Total mutants
|
295
|
+
rust_mutator_logger.info(f"Total mutants generated: {total_mutants}")
|
310
296
|
continue
|
311
297
|
|
312
298
|
# Update progress bar for each processed mutant
|
@@ -340,7 +326,7 @@ def run_mutate(file_to_mutant: Path, mutants_location: Path, build_command: str)
|
|
340
326
|
process.terminate()
|
341
327
|
|
342
328
|
def run_universal_mutator(
|
343
|
-
|
329
|
+
file_to_mutate: Path,
|
344
330
|
build_script: str,
|
345
331
|
mutants_location: Path,
|
346
332
|
num_mutants: int = NUM_MUTANTS,
|
@@ -351,7 +337,7 @@ def run_universal_mutator(
|
|
351
337
|
Generate mutants for the specified source file and ensure the original file remains unchanged.
|
352
338
|
|
353
339
|
Args:
|
354
|
-
|
340
|
+
file_to_mutate (Path): Path to the Rust source file.
|
355
341
|
build_script (str): Command to execute for each mutant to verify compilation.
|
356
342
|
mutants_location (Path): Directory to store generated mutants.
|
357
343
|
num_mutants (int): Upper bound on the number of mutants to generate (default: {NUM_MUTANTS}).
|
@@ -365,7 +351,10 @@ def run_universal_mutator(
|
|
365
351
|
backup_file = None
|
366
352
|
build_command = f"cp MUTATE & python3 {build_script}"
|
367
353
|
|
354
|
+
atexit.register(clean_temp_files, file_to_mutate)
|
355
|
+
|
368
356
|
try:
|
357
|
+
|
369
358
|
# Set up the logger
|
370
359
|
setup_logger(debug)
|
371
360
|
|
@@ -373,38 +362,37 @@ def run_universal_mutator(
|
|
373
362
|
validate_mutate_command()
|
374
363
|
|
375
364
|
# Validate source file
|
376
|
-
validate_source_file(
|
365
|
+
validate_source_file(file_to_mutate)
|
377
366
|
|
378
367
|
# Backup the original source file
|
379
|
-
rust_mutator_logger.info(f"Backing up '{
|
380
|
-
backup_file = Util.create_backup(
|
368
|
+
rust_mutator_logger.info(f"Backing up '{file_to_mutate}' ...")
|
369
|
+
backup_file = Util.create_backup(file_to_mutate)
|
370
|
+
|
381
371
|
if backup_file:
|
382
|
-
|
372
|
+
atexit.register(Util.restore_backup, backup_file)
|
373
|
+
rust_mutator_logger.info(f"Backing up '{file_to_mutate}' to '{backup_file} succeeded")
|
383
374
|
else:
|
384
|
-
rust_mutator_logger.warning(f"Backing up '{
|
375
|
+
rust_mutator_logger.warning(f"Backing up '{file_to_mutate}' to '{backup_file} failed")
|
385
376
|
|
386
377
|
# Validate or create mutant directory
|
387
378
|
validate_mutant_dir(mutants_location)
|
388
379
|
|
389
380
|
# Run the mutation command
|
390
|
-
run_mutate(
|
381
|
+
run_mutate(file_to_mutate, mutants_location, build_command)
|
391
382
|
|
392
383
|
# Make sure the number of mutants generated is less than or equal to the specified limit
|
393
|
-
validate_mutant_count(
|
394
|
-
|
384
|
+
validate_mutant_count(file_to_mutate, mutants_location, num_mutants, seed)
|
395
385
|
finally:
|
396
|
-
# Restore the original source file
|
397
386
|
if backup_file:
|
398
387
|
Util.restore_backup(backup_file)
|
399
|
-
|
400
|
-
clean_temp_files(file_to_mutant)
|
388
|
+
clean_temp_files(file_to_mutate)
|
401
389
|
|
402
390
|
|
403
391
|
if __name__ == "__main__":
|
404
392
|
# Parse command-line arguments
|
405
393
|
args = parse_args()
|
406
394
|
run_universal_mutator(
|
407
|
-
args.
|
395
|
+
args.file_to_mutate,
|
408
396
|
args.build_script,
|
409
397
|
args.mutants_location,
|
410
398
|
args.num_mutants,
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: certora-cli-alpha-master
|
3
|
-
Version:
|
3
|
+
Version: 20241219.20.36.174596
|
4
4
|
Summary: Runner for the Certora Prover
|
5
5
|
Home-page: https://pypi.org/project/certora-cli-alpha-master
|
6
6
|
Author: Certora
|
@@ -23,4 +23,4 @@ Requires-Dist: StrEnum
|
|
23
23
|
Requires-Dist: tomli
|
24
24
|
Requires-Dist: universalmutator
|
25
25
|
|
26
|
-
Commit
|
26
|
+
Commit a0a7788. Build and Run scripts for executing the Certora Prover on Solidity smart contracts.
|
@@ -0,0 +1 @@
|
|
1
|
+
{"name": "certora-cli-alpha-master", "tag": "", "branch": "master", "commit": "a0a7788", "timestamp": "20241219.20.36.174596", "version": "20241219.20.36.174596+a0a7788"}
|
Binary file
|
@@ -3,11 +3,11 @@ import setuptools
|
|
3
3
|
|
4
4
|
setuptools.setup(
|
5
5
|
name="certora-cli-alpha-master",
|
6
|
-
version="
|
6
|
+
version="20241219.20.36.174596",
|
7
7
|
author="Certora",
|
8
8
|
author_email="support@certora.com",
|
9
9
|
description="Runner for the Certora Prover",
|
10
|
-
long_description="Commit
|
10
|
+
long_description="Commit a0a7788. Build and Run scripts for executing the Certora Prover on Solidity smart contracts.",
|
11
11
|
long_description_content_type="text/markdown",
|
12
12
|
url="https://pypi.org/project/certora-cli-alpha-master",
|
13
13
|
packages=setuptools.find_packages(),
|
@@ -1 +0,0 @@
|
|
1
|
-
Commit 885526e. Build and Run scripts for executing the Certora Prover on Solidity smart contracts.
|
certora_cli_alpha_master-20241217.22.6.367707/certora_jars/CERTORA-CLI-VERSION-METADATA.json
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{"name": "certora-cli-alpha-master", "tag": "", "branch": "master", "commit": "885526e", "timestamp": "20241217.22.6.367707", "version": "20241217.22.6.367707+885526e"}
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|