certora-cli-beta-mirror 7.30.1__py3-none-any.whl → 8.0.0__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/CertoraProver/Compiler/CompilerCollectorFactory.py +11 -2
- certora_cli/CertoraProver/certoraBuild.py +68 -62
- certora_cli/CertoraProver/certoraBuildCacheManager.py +17 -16
- certora_cli/CertoraProver/certoraBuildRust.py +33 -21
- certora_cli/{Shared/rustProverCommon.py → CertoraProver/certoraBuildSui.py} +24 -18
- certora_cli/CertoraProver/certoraCloudIO.py +42 -33
- certora_cli/CertoraProver/certoraCollectConfigurationLayout.py +62 -51
- certora_cli/CertoraProver/certoraCollectRunMetadata.py +20 -5
- certora_cli/CertoraProver/certoraConfigIO.py +17 -14
- certora_cli/CertoraProver/certoraContext.py +62 -10
- certora_cli/CertoraProver/certoraContextAttributes.py +132 -203
- certora_cli/CertoraProver/certoraContextValidator.py +108 -101
- certora_cli/CertoraProver/certoraParseBuildScript.py +4 -3
- certora_cli/CertoraProver/certoraVerifyGenerator.py +9 -4
- certora_cli/CertoraProver/splitRules.py +2 -0
- certora_cli/CertoraProver/storageExtension.py +0 -35
- certora_cli/Mutate/mutateApp.py +16 -10
- certora_cli/Mutate/mutateAttributes.py +11 -0
- certora_cli/Shared/certoraAttrUtil.py +11 -5
- certora_cli/Shared/certoraUtils.py +50 -47
- certora_cli/Shared/certoraValidateFuncs.py +29 -15
- certora_cli/Shared/proverCommon.py +6 -2
- certora_cli/certoraCVLFormatter.py +76 -0
- certora_cli/certoraConcord.py +39 -0
- certora_cli/certoraRun.py +53 -91
- certora_cli/certoraSolanaProver.py +1 -1
- certora_cli/certoraSorobanProver.py +1 -1
- {certora_cli_beta_mirror-7.30.1.dist-info → certora_cli_beta_mirror-8.0.0.dist-info}/METADATA +4 -3
- {certora_cli_beta_mirror-7.30.1.dist-info → certora_cli_beta_mirror-8.0.0.dist-info}/RECORD +36 -33
- {certora_cli_beta_mirror-7.30.1.dist-info → certora_cli_beta_mirror-8.0.0.dist-info}/entry_points.txt +1 -0
- certora_jars/ASTExtraction.jar +0 -0
- certora_jars/CERTORA-CLI-VERSION-METADATA.json +1 -1
- certora_jars/Typechecker.jar +0 -0
- {certora_cli_beta_mirror-7.30.1.dist-info → certora_cli_beta_mirror-8.0.0.dist-info}/LICENSE +0 -0
- {certora_cli_beta_mirror-7.30.1.dist-info → certora_cli_beta_mirror-8.0.0.dist-info}/WHEEL +0 -0
- {certora_cli_beta_mirror-7.30.1.dist-info → certora_cli_beta_mirror-8.0.0.dist-info}/top_level.txt +0 -0
|
@@ -20,6 +20,8 @@ import os
|
|
|
20
20
|
import re
|
|
21
21
|
import sys
|
|
22
22
|
import logging
|
|
23
|
+
import fnmatch
|
|
24
|
+
from wcmatch import glob
|
|
23
25
|
|
|
24
26
|
|
|
25
27
|
from pathlib import Path
|
|
@@ -120,7 +122,11 @@ def get_local_run_cmd(context: CertoraContext) -> List[str]:
|
|
|
120
122
|
"""
|
|
121
123
|
run_args = []
|
|
122
124
|
|
|
123
|
-
if Attrs.
|
|
125
|
+
if Attrs.is_sui_app():
|
|
126
|
+
# For local runs, we want path to be relative to cwd instead of zip root.
|
|
127
|
+
move_rel_path = os.path.relpath(Path(context.move_path), os.getcwd())
|
|
128
|
+
run_args.extend(['-movePath', move_rel_path])
|
|
129
|
+
elif Attrs.is_rust_app():
|
|
124
130
|
# For local runs, we want path to be relative to cwd instead of zip root.
|
|
125
131
|
rust_rel_path = os.path.relpath(Path(context.files[0]), os.getcwd())
|
|
126
132
|
run_args.append(rust_rel_path)
|
|
@@ -133,7 +139,8 @@ def get_local_run_cmd(context: CertoraContext) -> List[str]:
|
|
|
133
139
|
|
|
134
140
|
if Attrs.is_evm_app() and context.cache is not None:
|
|
135
141
|
run_args.extend(['-cache', context.cache])
|
|
136
|
-
|
|
142
|
+
if Attrs.is_concord_app():
|
|
143
|
+
run_args.extend(['-equivalenceCheck', 'true'])
|
|
137
144
|
jar_args = collect_jar_args(context)
|
|
138
145
|
run_args.extend(jar_args)
|
|
139
146
|
|
|
@@ -150,8 +157,6 @@ def get_local_run_cmd(context: CertoraContext) -> List[str]:
|
|
|
150
157
|
java_cmd.extend(context.java_args.strip().split(' '))
|
|
151
158
|
|
|
152
159
|
cmd = java_cmd + ["-jar", jar_path] + run_args
|
|
153
|
-
if context.test == str(Util.TestValue.LOCAL_JAR):
|
|
154
|
-
raise Util.TestResultsReady(' '.join(cmd))
|
|
155
160
|
return cmd
|
|
156
161
|
|
|
157
162
|
|
|
@@ -161,12 +166,17 @@ class ProverParser(AttrUtil.ContextAttributeParser):
|
|
|
161
166
|
|
|
162
167
|
def format_help(self) -> str:
|
|
163
168
|
console = Console()
|
|
164
|
-
if Attrs.
|
|
169
|
+
if Attrs.is_concord_app():
|
|
170
|
+
console.print("\n\nConcord - Certora’s equivalence checker for smart contracts")
|
|
171
|
+
elif Attrs.is_ranger_app():
|
|
165
172
|
console.print("\n\nRanger - Certora’s bounded model checker for smart contracts")
|
|
166
173
|
else:
|
|
167
174
|
console.print("\n\nThe Certora Prover - A formal verification tool for smart contracts")
|
|
168
175
|
# Using sys.stdout.write() as print() would color some of the strings here
|
|
169
176
|
sys.stdout.write(f"\n\nUsage: {sys.argv[0]} <Files> <Flags>\n\n")
|
|
177
|
+
if Attrs.is_concord_app():
|
|
178
|
+
sys.stdout.write("Concord supports only Solidity (.sol/.yul) and configuration (.conf) files.\n"
|
|
179
|
+
"Rust and Vyper contracts are not currently supported.\n\n")
|
|
170
180
|
if Attrs.is_ranger_app():
|
|
171
181
|
sys.stdout.write("Ranger supports only Solidity (.sol) and configuration (.conf) files.\n"
|
|
172
182
|
"Rust and Vyper contracts are not currently supported.\n\n")
|
|
@@ -210,6 +220,16 @@ def __get_argparser() -> argparse.ArgumentParser:
|
|
|
210
220
|
return parser
|
|
211
221
|
|
|
212
222
|
|
|
223
|
+
def set_apps_members(context: CertoraContext) -> None:
|
|
224
|
+
# in many cases accessing context is simpler than accessing Attrs
|
|
225
|
+
context.is_solana_app = Attrs.is_solana_app()
|
|
226
|
+
context.is_soroban_app = Attrs.is_soroban_app()
|
|
227
|
+
context.is_rust_app = Attrs.is_rust_app()
|
|
228
|
+
context.is_evm_app = Attrs.is_evm_app()
|
|
229
|
+
context.is_ranger_app = Attrs.is_ranger_app()
|
|
230
|
+
context.is_concord_app = Attrs.is_concord_app()
|
|
231
|
+
|
|
232
|
+
|
|
213
233
|
def get_args(args_list: Optional[List[str]] = None) -> CertoraContext:
|
|
214
234
|
"""
|
|
215
235
|
Compiles an argparse.Namespace from the given list of command line arguments.
|
|
@@ -244,6 +264,7 @@ def get_args(args_list: Optional[List[str]] = None) -> CertoraContext:
|
|
|
244
264
|
args = parser.parse_args(args_list)
|
|
245
265
|
context = CertoraContext(**vars(args))
|
|
246
266
|
context.args_list = args_list
|
|
267
|
+
set_apps_members(context)
|
|
247
268
|
|
|
248
269
|
__remove_parsing_whitespace(args_list)
|
|
249
270
|
format_input(context)
|
|
@@ -251,7 +272,7 @@ def get_args(args_list: Optional[List[str]] = None) -> CertoraContext:
|
|
|
251
272
|
|
|
252
273
|
if context.is_conf:
|
|
253
274
|
read_from_conf_file(context)
|
|
254
|
-
|
|
275
|
+
context.process = None
|
|
255
276
|
context.local = Util.is_local(context)
|
|
256
277
|
context.is_tac = context.files and context.files[0].endswith('.tac')
|
|
257
278
|
context.is_vyper = context.files and context.files[0].endswith('.vy')
|
|
@@ -260,8 +281,7 @@ def get_args(args_list: Optional[List[str]] = None) -> CertoraContext:
|
|
|
260
281
|
Cv.check_mode_of_operation(context) # Here boolean run characteristics are set
|
|
261
282
|
|
|
262
283
|
validator = Cv.CertoraContextValidator(context)
|
|
263
|
-
|
|
264
|
-
validator.handle_ranger_attrs()
|
|
284
|
+
|
|
265
285
|
validator.validate()
|
|
266
286
|
if Attrs.is_evm_app() or Attrs.is_rust_app():
|
|
267
287
|
current_build_directory = Util.get_build_dir()
|
|
@@ -278,6 +298,8 @@ def get_args(args_list: Optional[List[str]] = None) -> CertoraContext:
|
|
|
278
298
|
if Attrs.is_evm_app():
|
|
279
299
|
validator.check_args_post_argparse()
|
|
280
300
|
setup_cache(context) # Here context.cache, context.user_defined_cache are set
|
|
301
|
+
validator.handle_ranger_attrs()
|
|
302
|
+
validator.handle_concord_attrs()
|
|
281
303
|
if Attrs.is_rust_app():
|
|
282
304
|
validator.check_rust_args_post_argparse()
|
|
283
305
|
|
|
@@ -285,6 +307,7 @@ def get_args(args_list: Optional[List[str]] = None) -> CertoraContext:
|
|
|
285
307
|
# Setup defaults (defaults are not recorded in conf file)
|
|
286
308
|
context.expected_file = context.expected_file or "expected.json"
|
|
287
309
|
context.run_source = context.run_source or Vf.RunSources.COMMAND.name.upper()
|
|
310
|
+
context.java_version = Util.get_java_version()
|
|
288
311
|
|
|
289
312
|
context_logger.debug("parsed args successfully.")
|
|
290
313
|
context_logger.debug(f"args= {context}")
|
|
@@ -403,7 +426,7 @@ def setup_cache(context: CertoraContext) -> None:
|
|
|
403
426
|
# we have a user defined cache key if the user provided a cache key
|
|
404
427
|
context.user_defined_cache = context.cache is not None
|
|
405
428
|
if not context.disable_auto_cache_key_gen and not os.environ.get("CERTORA_DISABLE_AUTO_CACHE") is not None:
|
|
406
|
-
if context.is_verify or context.
|
|
429
|
+
if context.is_verify or context.is_conf:
|
|
407
430
|
# in local mode we don't want to create a cache key if not such is given
|
|
408
431
|
if (context.cache is None) and (not context.local):
|
|
409
432
|
optimistic_loop = context.optimistic_loop
|
|
@@ -524,6 +547,8 @@ def run_typechecker(typechecker_name: str, with_typechecking: bool, args: List[s
|
|
|
524
547
|
if with_typechecking:
|
|
525
548
|
cmd_str_list.append('-typeCheck')
|
|
526
549
|
|
|
550
|
+
context_logger.debug(f"typechecking cmd: {' '.join(cmd_str_list)}")
|
|
551
|
+
|
|
527
552
|
exit_code = Util.run_jar_cmd(cmd_str_list, False,
|
|
528
553
|
custom_error_message="Failed to run Certora Prover locally. Please check the errors "
|
|
529
554
|
"below for problems in the specifications (.spec files) or the "
|
|
@@ -547,7 +572,7 @@ def run_local_spec_check(with_typechecking: bool, context: CertoraContext) -> No
|
|
|
547
572
|
if context.disable_local_typechecking or Util.is_ci_or_git_action():
|
|
548
573
|
return
|
|
549
574
|
args = collect_jar_args(context)
|
|
550
|
-
if Util.is_java_installed():
|
|
575
|
+
if Util.is_java_installed(context.java_version):
|
|
551
576
|
run_typechecker("Typechecker.jar", with_typechecking, args)
|
|
552
577
|
else:
|
|
553
578
|
raise Util.CertoraUserInputError("Cannot run local checks because of missing a suitable java installation. "
|
|
@@ -615,3 +640,30 @@ def attrs_to_relative(context: CertoraContext) -> None:
|
|
|
615
640
|
packages_to_relative()
|
|
616
641
|
prover_resource_file_to_relative()
|
|
617
642
|
verify_to_relative()
|
|
643
|
+
|
|
644
|
+
def get_map_attribute_value(context: CertoraContext, path: Path, attr_name: str) -> Optional[Union[str, bool]]:
|
|
645
|
+
|
|
646
|
+
value = getattr(context, attr_name, None)
|
|
647
|
+
if value:
|
|
648
|
+
return value
|
|
649
|
+
|
|
650
|
+
map_value = getattr(context, f"{attr_name}_map", None)
|
|
651
|
+
if not map_value:
|
|
652
|
+
return None # No map value defined
|
|
653
|
+
for key, entry_value in map_value.items():
|
|
654
|
+
# Split key to handle contract:field syntax
|
|
655
|
+
key_parts = key.split(':')
|
|
656
|
+
pattern = key_parts[0]
|
|
657
|
+
|
|
658
|
+
if Path(pattern).suffix == "": # This is a contract pattern
|
|
659
|
+
# Find contracts that match the pattern
|
|
660
|
+
for contract_name, contract_file_path in context.contract_to_file.items():
|
|
661
|
+
if fnmatch.fnmatch(contract_name, pattern):
|
|
662
|
+
# Check if this contract's file matches our target path
|
|
663
|
+
if Path(contract_file_path) == path:
|
|
664
|
+
return entry_value
|
|
665
|
+
else: # This is a file pattern
|
|
666
|
+
# Match the file pattern against the path
|
|
667
|
+
if glob.globmatch(str(path), pattern, flags=glob.GLOBSTAR):
|
|
668
|
+
return entry_value
|
|
669
|
+
return None # No match
|
|
@@ -15,7 +15,6 @@
|
|
|
15
15
|
|
|
16
16
|
import logging
|
|
17
17
|
|
|
18
|
-
import json5
|
|
19
18
|
import sys
|
|
20
19
|
from pathlib import Path
|
|
21
20
|
from typing import Type, List, Optional
|
|
@@ -30,6 +29,8 @@ from CertoraProver.certoraCollectConfigurationLayout import AttributeJobConfigDa
|
|
|
30
29
|
|
|
31
30
|
attributes_logger = logging.getLogger("attributes")
|
|
32
31
|
|
|
32
|
+
FORBIDDEN_PROVER_ARGS = ['-solanaInlining', '-solanaSummaries']
|
|
33
|
+
|
|
33
34
|
|
|
34
35
|
def validate_prover_args(value: str) -> str:
|
|
35
36
|
|
|
@@ -50,6 +51,11 @@ def validate_prover_args(value: str) -> str:
|
|
|
50
51
|
if not attr.temporary_jar_invocation_allowed:
|
|
51
52
|
raise Util.CertoraUserInputError(
|
|
52
53
|
f"Use CLI flag '{flag_name}' instead of 'prover_attrs' with {string} as value")
|
|
54
|
+
|
|
55
|
+
for string in strings:
|
|
56
|
+
if string in FORBIDDEN_PROVER_ARGS:
|
|
57
|
+
raise Util.CertoraUserInputError(
|
|
58
|
+
f"Use a Prover option instead of 'prover_attrs' with {string} as value")
|
|
53
59
|
return value
|
|
54
60
|
|
|
55
61
|
|
|
@@ -156,7 +162,9 @@ class CommonAttributes(AttrUtil.Attributes):
|
|
|
156
162
|
'action': AttrUtil.NotAllowed
|
|
157
163
|
},
|
|
158
164
|
affects_build_cache_key=False,
|
|
159
|
-
disables_build_cache=False
|
|
165
|
+
disables_build_cache=False,
|
|
166
|
+
# Avoiding presentation of this attribute in Config Tab
|
|
167
|
+
config_data=None
|
|
160
168
|
)
|
|
161
169
|
|
|
162
170
|
RUN_SOURCE = AttrUtil.AttributeDefinition(
|
|
@@ -208,87 +216,58 @@ class CommonAttributes(AttrUtil.Attributes):
|
|
|
208
216
|
disables_build_cache=False
|
|
209
217
|
)
|
|
210
218
|
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
deprecation_msg="`auto_nondet_difficult_internal_funcs` is deprecated, use `nondet_difficult_funcs` instead",
|
|
216
|
-
argparse_args={
|
|
217
|
-
'action': AttrUtil.STORE_TRUE
|
|
218
|
-
},
|
|
219
|
-
affects_build_cache_key=False,
|
|
220
|
-
disables_build_cache=False
|
|
221
|
-
)
|
|
222
|
-
AUTO_NONDET_MINIMAL_DIFFICULTY = AttrUtil.AttributeDefinition(
|
|
223
|
-
attr_validation_func=Vf.validate_non_negative_integer,
|
|
224
|
-
deprecation_msg="`auto_nondet_minimal_difficulty` is deprecated, use `nondet_minimal_difficulty` instead",
|
|
219
|
+
URL_VISIBILITY = AttrUtil.AttributeDefinition(
|
|
220
|
+
attr_validation_func=Vf.validate_url_visibility,
|
|
221
|
+
help_msg="Sets the visibility of the generated report link",
|
|
222
|
+
default_desc="Generate a Private report link",
|
|
225
223
|
argparse_args={
|
|
226
|
-
'
|
|
224
|
+
'nargs': AttrUtil.SINGLE_OR_NONE_OCCURRENCES,
|
|
225
|
+
'action': AttrUtil.UniqueStore,
|
|
226
|
+
'default': None, # 'default': when --url_visibility was not used
|
|
227
|
+
# when --url_visibility was used without an argument its probably because the link should be public
|
|
228
|
+
'const': str(Vf.UrlVisibilityOptions.PUBLIC)
|
|
227
229
|
},
|
|
228
230
|
affects_build_cache_key=False,
|
|
229
|
-
disables_build_cache=False
|
|
230
|
-
)
|
|
231
|
-
CONTRACT_COMPILER_SKIP_SEVERE_WARNING_AS_ERROR = AttrUtil.AttributeDefinition(
|
|
232
|
-
arg_type=AttrUtil.AttrArgType.BOOLEAN,
|
|
233
|
-
deprecation_msg="`contract_compiler_skip_severe_warning_as_error` is deprecated. "
|
|
234
|
-
"Use `ignore_solidity_warnings` instead",
|
|
235
|
-
affects_build_cache_key=True,
|
|
236
231
|
disables_build_cache=False,
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
}
|
|
232
|
+
# Avoiding presentation of this attribute in Config Tab
|
|
233
|
+
config_data=None
|
|
240
234
|
)
|
|
241
235
|
|
|
242
|
-
SEND_ONLY = AttrUtil.AttributeDefinition(
|
|
243
|
-
arg_type=AttrUtil.AttrArgType.BOOLEAN,
|
|
244
|
-
deprecation_msg="'send_only' is deprecated and is now the default. In CI, use 'wait_for_results none' instead",
|
|
245
|
-
argparse_args={
|
|
246
|
-
'action': AttrUtil.STORE_TRUE
|
|
247
|
-
},
|
|
248
|
-
affects_build_cache_key=False,
|
|
249
|
-
disables_build_cache=False
|
|
250
|
-
)
|
|
251
236
|
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
deprecation_msg="`use_memory_safe_autofinders` is deprecated and is turned on by default. To disable it"
|
|
255
|
-
" use `no_memory_safe_autofinders`",
|
|
256
|
-
argparse_args={
|
|
257
|
-
'action': AttrUtil.STORE_TRUE
|
|
258
|
-
},
|
|
259
|
-
affects_build_cache_key=True,
|
|
260
|
-
disables_build_cache=False
|
|
261
|
-
)
|
|
262
|
-
|
|
263
|
-
DISABLE_FINDER_FRIENDLY_OPTIMIZER = AttrUtil.AttributeDefinition(
|
|
264
|
-
arg_type=AttrUtil.AttrArgType.BOOLEAN,
|
|
265
|
-
deprecation_msg="`disable_finder_friendly_optimizer` is deprecated, use `strict_solc_optimizer` instead",
|
|
266
|
-
argparse_args={
|
|
267
|
-
'action': AttrUtil.STORE_TRUE
|
|
268
|
-
},
|
|
269
|
-
affects_build_cache_key=True,
|
|
270
|
-
disables_build_cache=False
|
|
271
|
-
)
|
|
237
|
+
class DeprecatedAttributes(AttrUtil.Attributes):
|
|
238
|
+
pass
|
|
272
239
|
|
|
273
|
-
|
|
274
|
-
arg_type=AttrUtil.AttrArgType.BOOLEAN,
|
|
275
|
-
deprecation_msg="`do_not_use_memory_safe_autofinders` is deprecated, use `no_memory_safe_autofinders` instead",
|
|
240
|
+
PROCESS = AttrUtil.AttributeDefinition(
|
|
276
241
|
argparse_args={
|
|
277
|
-
'action': AttrUtil.
|
|
242
|
+
'action': AttrUtil.UniqueStore,
|
|
278
243
|
},
|
|
279
|
-
|
|
244
|
+
deprecation_msg="`process` is deprecated and will be removed in a future release.",
|
|
245
|
+
affects_build_cache_key=False,
|
|
280
246
|
disables_build_cache=False
|
|
281
247
|
)
|
|
282
248
|
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
249
|
+
SOLC_MAP = AttrUtil.AttributeDefinition(
|
|
250
|
+
attr_validation_func=Vf.validate_compiler_map,
|
|
251
|
+
arg_type=AttrUtil.AttrArgType.MAP,
|
|
252
|
+
deprecation_msg="`solc_map` is deprecated, use `compiler_map` instead",
|
|
253
|
+
help_msg='Map contracts to the appropriate Solidity compiler in case not all contract files are compiled '
|
|
254
|
+
'with the same Solidity compiler version. \n\nCLI Example: '
|
|
255
|
+
'\n --solc_map A=solc8.11,B=solc8.9,C=solc7.5\n\nJSON Example: '
|
|
256
|
+
'\n "solc_map: {"'
|
|
257
|
+
'\n "A": "solc8.11",'
|
|
258
|
+
'\n "B": "solc8.9",'
|
|
259
|
+
'\n "C": "solc7.5"'
|
|
260
|
+
'\n }',
|
|
261
|
+
default_desc="Uses the same Solidity compiler version for all contracts",
|
|
287
262
|
argparse_args={
|
|
288
|
-
'action': AttrUtil.
|
|
263
|
+
'action': AttrUtil.UniqueStore,
|
|
264
|
+
'type': lambda value: Vf.parse_ordered_dict('solc_map', value)
|
|
289
265
|
},
|
|
290
266
|
affects_build_cache_key=True,
|
|
291
|
-
disables_build_cache=False
|
|
267
|
+
disables_build_cache=False,
|
|
268
|
+
config_data=AttributeJobConfigData(
|
|
269
|
+
main_section=MainSection.SOLIDITY_COMPILER
|
|
270
|
+
)
|
|
292
271
|
)
|
|
293
272
|
|
|
294
273
|
|
|
@@ -340,7 +319,7 @@ class EvmAttributes(AttrUtil.Attributes):
|
|
|
340
319
|
default_desc="do not set via_ir during compilation unless solc_via_ir is set",
|
|
341
320
|
argparse_args={
|
|
342
321
|
'action': AttrUtil.UniqueStore,
|
|
343
|
-
'type': lambda value: Vf.
|
|
322
|
+
'type': lambda value: Vf.parse_ordered_dict('solc_via_ir_map', value, bool)
|
|
344
323
|
},
|
|
345
324
|
affects_build_cache_key=True,
|
|
346
325
|
disables_build_cache=False,
|
|
@@ -382,30 +361,7 @@ class EvmAttributes(AttrUtil.Attributes):
|
|
|
382
361
|
default_desc="Uses the same Solidity EVM version for all contracts",
|
|
383
362
|
argparse_args={
|
|
384
363
|
'action': AttrUtil.UniqueStore,
|
|
385
|
-
'type': lambda value: Vf.
|
|
386
|
-
},
|
|
387
|
-
affects_build_cache_key=True,
|
|
388
|
-
disables_build_cache=False,
|
|
389
|
-
config_data=AttributeJobConfigData(
|
|
390
|
-
main_section=MainSection.SOLIDITY_COMPILER
|
|
391
|
-
)
|
|
392
|
-
)
|
|
393
|
-
|
|
394
|
-
SOLC_MAP = AttrUtil.AttributeDefinition(
|
|
395
|
-
attr_validation_func=Vf.validate_compiler_map,
|
|
396
|
-
arg_type=AttrUtil.AttrArgType.MAP,
|
|
397
|
-
help_msg='Map contracts to the appropriate Solidity compiler in case not all contract files are compiled '
|
|
398
|
-
'with the same Solidity compiler version. \n\nCLI Example: '
|
|
399
|
-
'\n --solc_map A=solc8.11,B=solc8.9,C=solc7.5\n\nJSON Example: '
|
|
400
|
-
'\n "solc_map: {"'
|
|
401
|
-
'\n "A": "solc8.11",'
|
|
402
|
-
'\n "B": "solc8.9",'
|
|
403
|
-
'\n "C": "solc7.5"'
|
|
404
|
-
'\n }',
|
|
405
|
-
default_desc="Uses the same Solidity compiler version for all contracts",
|
|
406
|
-
argparse_args={
|
|
407
|
-
'action': AttrUtil.UniqueStore,
|
|
408
|
-
'type': lambda value: Vf.parse_dict('solc_map', value)
|
|
364
|
+
'type': lambda value: Vf.parse_ordered_dict('solc_evm_version_map', value)
|
|
409
365
|
},
|
|
410
366
|
affects_build_cache_key=True,
|
|
411
367
|
disables_build_cache=False,
|
|
@@ -428,7 +384,7 @@ class EvmAttributes(AttrUtil.Attributes):
|
|
|
428
384
|
default_desc="Uses the same compiler version for all contracts",
|
|
429
385
|
argparse_args={
|
|
430
386
|
'action': AttrUtil.UniqueStore,
|
|
431
|
-
'type': lambda value: Vf.
|
|
387
|
+
'type': lambda value: Vf.parse_ordered_dict('compiler_map', value)
|
|
432
388
|
},
|
|
433
389
|
affects_build_cache_key=True,
|
|
434
390
|
disables_build_cache=False,
|
|
@@ -481,7 +437,7 @@ class EvmAttributes(AttrUtil.Attributes):
|
|
|
481
437
|
default_desc="Compiles all contracts with the same optimization settings",
|
|
482
438
|
argparse_args={
|
|
483
439
|
'action': AttrUtil.UniqueStore,
|
|
484
|
-
'type': lambda value: Vf.
|
|
440
|
+
'type': lambda value: Vf.parse_ordered_dict('solc_optimize_map', value)
|
|
485
441
|
},
|
|
486
442
|
affects_build_cache_key=True,
|
|
487
443
|
disables_build_cache=False,
|
|
@@ -582,6 +538,16 @@ class EvmAttributes(AttrUtil.Attributes):
|
|
|
582
538
|
affects_build_cache_key=True,
|
|
583
539
|
disables_build_cache=True
|
|
584
540
|
)
|
|
541
|
+
|
|
542
|
+
YUL_OPTIMIZER_STEPS = AttrUtil.AttributeDefinition(
|
|
543
|
+
# overrides the hardcoded yul optimizer steps, set in certoraBuild.py
|
|
544
|
+
argparse_args={
|
|
545
|
+
'action': AttrUtil.UniqueStore
|
|
546
|
+
},
|
|
547
|
+
affects_build_cache_key=True,
|
|
548
|
+
disables_build_cache=False
|
|
549
|
+
)
|
|
550
|
+
|
|
585
551
|
CACHE = AttrUtil.AttributeDefinition(
|
|
586
552
|
argparse_args={
|
|
587
553
|
'action': AttrUtil.UniqueStore
|
|
@@ -740,8 +706,7 @@ class EvmAttributes(AttrUtil.Attributes):
|
|
|
740
706
|
'action': AttrUtil.UniqueStore
|
|
741
707
|
},
|
|
742
708
|
affects_build_cache_key=False,
|
|
743
|
-
disables_build_cache=False
|
|
744
|
-
config_data=None
|
|
709
|
+
disables_build_cache=False
|
|
745
710
|
)
|
|
746
711
|
|
|
747
712
|
BUILD_CACHE = AttrUtil.AttributeDefinition(
|
|
@@ -813,17 +778,6 @@ class EvmAttributes(AttrUtil.Attributes):
|
|
|
813
778
|
disables_build_cache=False
|
|
814
779
|
)
|
|
815
780
|
|
|
816
|
-
ASSERT_CONTRACTS = AttrUtil.AttributeDefinition(
|
|
817
|
-
attr_validation_func=Vf.validate_assert_contracts,
|
|
818
|
-
arg_type=AttrUtil.AttrArgType.LIST,
|
|
819
|
-
argparse_args={
|
|
820
|
-
'nargs': AttrUtil.ONE_OR_MORE_OCCURRENCES,
|
|
821
|
-
'action': AttrUtil.APPEND,
|
|
822
|
-
},
|
|
823
|
-
affects_build_cache_key=False,
|
|
824
|
-
disables_build_cache=False
|
|
825
|
-
)
|
|
826
|
-
|
|
827
781
|
EQUIVALENCE_CONTRACTS = AttrUtil.AttributeDefinition(
|
|
828
782
|
attr_validation_func=Vf.validate_equivalence_contracts,
|
|
829
783
|
arg_type=AttrUtil.AttrArgType.STRING,
|
|
@@ -1346,12 +1300,10 @@ class BackendAttributes(AttrUtil.Attributes):
|
|
|
1346
1300
|
attr_validation_func=Vf.validate_sanity_value,
|
|
1347
1301
|
help_msg="Select the type of sanity check that will be performed during execution",
|
|
1348
1302
|
jar_flag='-ruleSanityChecks',
|
|
1349
|
-
default_desc="
|
|
1303
|
+
default_desc="Basic sanity checks (Vacuity and trivial invariant check)",
|
|
1350
1304
|
argparse_args={
|
|
1351
|
-
'nargs': AttrUtil.SINGLE_OR_NONE_OCCURRENCES,
|
|
1352
1305
|
'action': AttrUtil.UniqueStore,
|
|
1353
1306
|
'default': None, # 'default': when no --rule_sanity given
|
|
1354
|
-
'const': Vf.RuleSanityValue.BASIC.name.lower() # 'default': when empty --rule_sanity is given
|
|
1355
1307
|
},
|
|
1356
1308
|
affects_build_cache_key=False,
|
|
1357
1309
|
disables_build_cache=False
|
|
@@ -1463,17 +1415,6 @@ class BackendAttributes(AttrUtil.Attributes):
|
|
|
1463
1415
|
disables_build_cache=False
|
|
1464
1416
|
)
|
|
1465
1417
|
|
|
1466
|
-
PROCESS = AttrUtil.AttributeDefinition(
|
|
1467
|
-
argparse_args={
|
|
1468
|
-
'action': AttrUtil.UniqueStore,
|
|
1469
|
-
'default': 'emv'
|
|
1470
|
-
},
|
|
1471
|
-
affects_build_cache_key=False,
|
|
1472
|
-
disables_build_cache=False,
|
|
1473
|
-
# Avoiding presentation of this attribute in Config Tab
|
|
1474
|
-
config_data=None
|
|
1475
|
-
)
|
|
1476
|
-
|
|
1477
1418
|
PROVER_ARGS = AttrUtil.AttributeDefinition(
|
|
1478
1419
|
arg_type=AttrUtil.AttrArgType.LIST,
|
|
1479
1420
|
attr_validation_func=validate_prover_args,
|
|
@@ -1652,16 +1593,6 @@ class BackendAttributes(AttrUtil.Attributes):
|
|
|
1652
1593
|
disables_build_cache=False
|
|
1653
1594
|
)
|
|
1654
1595
|
|
|
1655
|
-
ALLOW_SOLIDITY_CALLS_IN_QUANTIFIERS = AttrUtil.AttributeDefinition(
|
|
1656
|
-
arg_type=AttrUtil.AttrArgType.BOOLEAN,
|
|
1657
|
-
jar_flag='-allowSolidityQuantifierCalls',
|
|
1658
|
-
argparse_args={
|
|
1659
|
-
'action': AttrUtil.STORE_TRUE
|
|
1660
|
-
},
|
|
1661
|
-
affects_build_cache_key=False,
|
|
1662
|
-
disables_build_cache=False
|
|
1663
|
-
)
|
|
1664
|
-
|
|
1665
1596
|
|
|
1666
1597
|
class RustAttributes(AttrUtil.Attributes):
|
|
1667
1598
|
|
|
@@ -1697,10 +1628,11 @@ class RustAttributes(AttrUtil.Attributes):
|
|
|
1697
1628
|
disables_build_cache=False
|
|
1698
1629
|
)
|
|
1699
1630
|
|
|
1631
|
+
|
|
1700
1632
|
class EvmProverAttributes(CommonAttributes, DeprecatedAttributes, EvmAttributes, InternalUseAttributes,
|
|
1701
1633
|
BackendAttributes):
|
|
1702
1634
|
FILES = AttrUtil.AttributeDefinition(
|
|
1703
|
-
attr_validation_func=Vf.
|
|
1635
|
+
attr_validation_func=Vf.validate_evm_input_file,
|
|
1704
1636
|
arg_type=AttrUtil.AttrArgType.LIST,
|
|
1705
1637
|
help_msg="Solidity or Vyper contract files for analysis or a conf file",
|
|
1706
1638
|
default_desc="",
|
|
@@ -1715,22 +1647,46 @@ class EvmProverAttributes(CommonAttributes, DeprecatedAttributes, EvmAttributes,
|
|
|
1715
1647
|
)
|
|
1716
1648
|
|
|
1717
1649
|
|
|
1650
|
+
class ConcordAttributes(EvmProverAttributes):
|
|
1651
|
+
CHECK_METHOD = AttrUtil.AttributeDefinition(
|
|
1652
|
+
attr_validation_func=Vf.validate_check_method_flag,
|
|
1653
|
+
help_msg="the method to be checked by Concord equivalent checker",
|
|
1654
|
+
default_desc="Mandatory for Concord",
|
|
1655
|
+
jar_flag='-method',
|
|
1656
|
+
argparse_args={
|
|
1657
|
+
'action': AttrUtil.UniqueStore
|
|
1658
|
+
},
|
|
1659
|
+
affects_build_cache_key=False,
|
|
1660
|
+
disables_build_cache=False
|
|
1661
|
+
)
|
|
1662
|
+
|
|
1663
|
+
@classmethod
|
|
1664
|
+
def unsupported_attributes(cls) -> List[AttrUtil.AttributeDefinition]:
|
|
1665
|
+
return [cls.VERIFY, cls.MSG, cls.PROTOCOL_NAME, cls.PROTOCOL_AUTHOR, cls.RULE, cls.EXCLUDE_RULE,
|
|
1666
|
+
cls.SPLIT_RULES, cls.EXCLUDE_METHOD, cls.PARAMETRIC_CONTRACTS, cls.COVERAGE_INFO, cls.FOUNDRY,
|
|
1667
|
+
cls.INDEPENDENT_SATISFY, cls.MULTI_ASSERT_CHECK, cls.MULTI_EXAMPLE, cls.PROJECT_SANITY,
|
|
1668
|
+
cls.RULE_SANITY, cls.ADDRESS, cls.CONTRACT_EXTENSIONS, cls.CONTRACT_RECURSION_LIMIT, cls.LINK,
|
|
1669
|
+
cls.OPTIMISTIC_CONTRACT_RECURSION, cls.STRUCT_LINK, cls.DYNAMIC_BOUND, cls.DYNAMIC_DISPATCH,
|
|
1670
|
+
cls.PROTOTYPE, cls.METHOD]
|
|
1671
|
+
|
|
1672
|
+
|
|
1718
1673
|
class RangerAttributes(EvmProverAttributes):
|
|
1719
1674
|
@classmethod
|
|
1720
|
-
def
|
|
1675
|
+
def unsupported_attributes(cls) -> List[AttrUtil.AttributeDefinition]:
|
|
1721
1676
|
return [cls.PROJECT_SANITY, cls.RULE_SANITY, cls.COVERAGE_INFO, cls.FOUNDRY, cls.INDEPENDENT_SATISFY,
|
|
1722
|
-
cls.MULTI_ASSERT_CHECK, cls.MULTI_EXAMPLE]
|
|
1677
|
+
cls.MULTI_ASSERT_CHECK, cls.MULTI_EXAMPLE, cls.VYPER]
|
|
1723
1678
|
|
|
1724
1679
|
@classmethod
|
|
1725
|
-
def
|
|
1680
|
+
def true_by_default_attributes(cls) -> List[AttrUtil.AttributeDefinition]:
|
|
1726
1681
|
return [cls.OPTIMISTIC_LOOP, cls.OPTIMISTIC_FALLBACK, cls.AUTO_DISPATCHER, cls.OPTIMISTIC_HASHING]
|
|
1727
1682
|
|
|
1728
1683
|
@classmethod
|
|
1729
1684
|
def hide_attributes(cls) -> List[str]:
|
|
1730
1685
|
# do not show these attributes in the help message
|
|
1731
|
-
combined_list = cls.
|
|
1686
|
+
combined_list = cls.unsupported_attributes() + cls.true_by_default_attributes()
|
|
1732
1687
|
return [attr.name for attr in combined_list] + [cls.LOOP_ITER.name, cls.RANGER_FAILURE_LIMIT.name]
|
|
1733
1688
|
|
|
1689
|
+
|
|
1734
1690
|
class SorobanProverAttributes(CommonAttributes, InternalUseAttributes, BackendAttributes, RustAttributes):
|
|
1735
1691
|
FILES = AttrUtil.AttributeDefinition(
|
|
1736
1692
|
attr_validation_func=Vf.validate_soroban_extension,
|
|
@@ -1748,6 +1704,36 @@ class SorobanProverAttributes(CommonAttributes, InternalUseAttributes, BackendAt
|
|
|
1748
1704
|
)
|
|
1749
1705
|
|
|
1750
1706
|
|
|
1707
|
+
class SuiProverAttributes(CommonAttributes, InternalUseAttributes, BackendAttributes):
|
|
1708
|
+
FILES = AttrUtil.AttributeDefinition(
|
|
1709
|
+
attr_validation_func=Vf.validate_dir,
|
|
1710
|
+
arg_type=AttrUtil.AttrArgType.LIST,
|
|
1711
|
+
argparse_args={
|
|
1712
|
+
'nargs': AttrUtil.MULTIPLE_OCCURRENCES
|
|
1713
|
+
},
|
|
1714
|
+
affects_build_cache_key=True,
|
|
1715
|
+
disables_build_cache=False,
|
|
1716
|
+
config_data=AttributeJobConfigData(
|
|
1717
|
+
main_section=MainSection.NEW_SECTION
|
|
1718
|
+
)
|
|
1719
|
+
)
|
|
1720
|
+
|
|
1721
|
+
MOVE_PATH = AttrUtil.AttributeDefinition(
|
|
1722
|
+
attr_validation_func=Vf.validate_dir,
|
|
1723
|
+
arg_type=AttrUtil.AttrArgType.STRING,
|
|
1724
|
+
help_msg="path to a directory which includes all binary .mv files for the Prover",
|
|
1725
|
+
default_desc="",
|
|
1726
|
+
argparse_args={
|
|
1727
|
+
'action': AttrUtil.UniqueStore
|
|
1728
|
+
},
|
|
1729
|
+
affects_build_cache_key=True,
|
|
1730
|
+
disables_build_cache=False,
|
|
1731
|
+
config_data=AttributeJobConfigData(
|
|
1732
|
+
main_section=MainSection.NEW_SECTION
|
|
1733
|
+
)
|
|
1734
|
+
)
|
|
1735
|
+
|
|
1736
|
+
|
|
1751
1737
|
class SolanaProverAttributes(CommonAttributes, InternalUseAttributes, BackendAttributes, RustAttributes):
|
|
1752
1738
|
FILES = AttrUtil.AttributeDefinition(
|
|
1753
1739
|
attr_validation_func=Vf.validate_solana_extension,
|
|
@@ -1806,70 +1792,6 @@ def set_attribute_class(cls: Type[AttrUtil.Attributes]) -> None:
|
|
|
1806
1792
|
cls.set_attribute_list()
|
|
1807
1793
|
|
|
1808
1794
|
|
|
1809
|
-
def detect_application_class(args: List[str]) -> Type[AttrUtil.Attributes]:
|
|
1810
|
-
|
|
1811
|
-
attributes_logger.debug("calling detect_application_class")
|
|
1812
|
-
|
|
1813
|
-
def application_by_suffix(file: str) -> Type[AttrUtil.Attributes]:
|
|
1814
|
-
if file.endswith(Util.EVM_EXTENSIONS):
|
|
1815
|
-
return EvmProverAttributes
|
|
1816
|
-
elif file.endswith(Util.SOROBAN_EXEC_EXTENSION):
|
|
1817
|
-
return SorobanProverAttributes
|
|
1818
|
-
elif file.endswith(Util.SOLANA_EXEC_EXTENSION):
|
|
1819
|
-
return SolanaProverAttributes
|
|
1820
|
-
elif file.endswith('.conf'):
|
|
1821
|
-
raise Util.CertoraUserInputError(f"Cannot use conf files inside a conf file: {file}")
|
|
1822
|
-
else:
|
|
1823
|
-
raise Util.CertoraUserInputError(f"Unsupported file type: {file}")
|
|
1824
|
-
|
|
1825
|
-
cli_files = []
|
|
1826
|
-
cli_conf_files = []
|
|
1827
|
-
files = []
|
|
1828
|
-
build_script = None
|
|
1829
|
-
for arg in args:
|
|
1830
|
-
if arg.startswith('-'):
|
|
1831
|
-
break # Stop processing when a flag is detected
|
|
1832
|
-
cli_files.append(arg)
|
|
1833
|
-
if arg.endswith('.conf'):
|
|
1834
|
-
cli_conf_files.append(arg)
|
|
1835
|
-
|
|
1836
|
-
if len(cli_conf_files) == 1:
|
|
1837
|
-
conf_file_path = Path(cli_conf_files[0])
|
|
1838
|
-
|
|
1839
|
-
with conf_file_path.open() as conf_file:
|
|
1840
|
-
configuration = json5.load(conf_file, allow_duplicate_keys=False)
|
|
1841
|
-
files = configuration.get('files', [])
|
|
1842
|
-
build_script = configuration.get('build_script')
|
|
1843
|
-
|
|
1844
|
-
if build_script:
|
|
1845
|
-
return SorobanProverAttributes
|
|
1846
|
-
|
|
1847
|
-
if len(cli_conf_files) == 0:
|
|
1848
|
-
files = cli_files
|
|
1849
|
-
|
|
1850
|
-
if len(cli_conf_files) > 1:
|
|
1851
|
-
raise Util.CertoraUserInputError(f"multiple conf files: {cli_conf_files})")
|
|
1852
|
-
|
|
1853
|
-
candidate = None
|
|
1854
|
-
|
|
1855
|
-
for file in files:
|
|
1856
|
-
file = file.split(':')[0] # remove contract part if exist
|
|
1857
|
-
app = application_by_suffix(file)
|
|
1858
|
-
if not candidate:
|
|
1859
|
-
candidate = app
|
|
1860
|
-
elif candidate == app:
|
|
1861
|
-
continue
|
|
1862
|
-
else:
|
|
1863
|
-
raise Util.CertoraUserInputError(f"Illegal files combination: {files})")
|
|
1864
|
-
|
|
1865
|
-
if candidate:
|
|
1866
|
-
attributes_logger.debug(f"detect_application_class returns {candidate}")
|
|
1867
|
-
return candidate
|
|
1868
|
-
else:
|
|
1869
|
-
attributes_logger.debug(f"detect_application_class returns {EvmProverAttributes}")
|
|
1870
|
-
return EvmProverAttributes
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
1795
|
def is_solana_app() -> bool:
|
|
1874
1796
|
return get_attribute_class() == SolanaProverAttributes
|
|
1875
1797
|
|
|
@@ -1881,12 +1803,19 @@ def is_soroban_app() -> bool:
|
|
|
1881
1803
|
def is_rust_app() -> bool:
|
|
1882
1804
|
return is_soroban_app() or is_solana_app()
|
|
1883
1805
|
|
|
1884
|
-
|
|
1806
|
+
|
|
1807
|
+
# Ranger and Concord will also return true for this function
|
|
1885
1808
|
def is_evm_app() -> bool:
|
|
1886
1809
|
return issubclass(get_attribute_class(), EvmProverAttributes)
|
|
1887
1810
|
|
|
1811
|
+
|
|
1888
1812
|
def is_ranger_app() -> bool:
|
|
1889
1813
|
return get_attribute_class() == RangerAttributes
|
|
1890
1814
|
|
|
1891
|
-
|
|
1892
|
-
|
|
1815
|
+
|
|
1816
|
+
def is_concord_app() -> bool:
|
|
1817
|
+
return get_attribute_class() == ConcordAttributes
|
|
1818
|
+
|
|
1819
|
+
|
|
1820
|
+
def is_sui_app() -> bool:
|
|
1821
|
+
return get_attribute_class() == SuiProverAttributes
|