certora-cli-alpha-master 20250109.12.56.561847__py3-none-macosx_10_9_universal2.whl → 20250109.15.35.401095__py3-none-macosx_10_9_universal2.whl
Sign up to get free protection for your applications and to get access to all the features.
- certora_cli/EVMVerifier/certoraBuild.py +0 -134
- certora_cli/EVMVerifier/certoraContextAttributes.py +14 -1
- certora_cli/Shared/certoraValidateFuncs.py +37 -0
- {certora_cli_alpha_master-20250109.12.56.561847.dist-info → certora_cli_alpha_master-20250109.15.35.401095.dist-info}/METADATA +2 -2
- {certora_cli_alpha_master-20250109.12.56.561847.dist-info → certora_cli_alpha_master-20250109.15.35.401095.dist-info}/RECORD +11 -11
- certora_jars/CERTORA-CLI-VERSION-METADATA.json +1 -1
- certora_jars/Typechecker.jar +0 -0
- {certora_cli_alpha_master-20250109.12.56.561847.dist-info → certora_cli_alpha_master-20250109.15.35.401095.dist-info}/LICENSE +0 -0
- {certora_cli_alpha_master-20250109.12.56.561847.dist-info → certora_cli_alpha_master-20250109.15.35.401095.dist-info}/WHEEL +0 -0
- {certora_cli_alpha_master-20250109.12.56.561847.dist-info → certora_cli_alpha_master-20250109.15.35.401095.dist-info}/entry_points.txt +0 -0
- {certora_cli_alpha_master-20250109.12.56.561847.dist-info → certora_cli_alpha_master-20250109.15.35.401095.dist-info}/top_level.txt +0 -0
@@ -2458,112 +2458,6 @@ class CertoraBuildGenerator:
|
|
2458
2458
|
# some referenced function calls could be builtins like require, whose declarations we do not see
|
2459
2459
|
return [node[self.CERTORA_CONTRACT_NAME()] for node in referenced_nodes if self.CERTORA_CONTRACT_NAME() in node]
|
2460
2460
|
|
2461
|
-
@staticmethod
|
2462
|
-
def __find_closest_methods(method_name: str, methods: List[Func]) -> List[str]:
|
2463
|
-
"""
|
2464
|
-
Gets a name of a method and a list of existing methods. Returns a list of closest matching method signatures.
|
2465
|
-
The match is performed on the name only, ignoring the parameters in the function.
|
2466
|
-
:param method_name: Name of a method
|
2467
|
-
:param methods: A list of possible methods.
|
2468
|
-
:return: An list of best suggested method signatures as replacement. Ordered by descending relevance.
|
2469
|
-
"""
|
2470
|
-
# Step 1: find the closest method names
|
2471
|
-
all_method_names = [method.name for method in methods]
|
2472
|
-
all_method_names = list(set(all_method_names)) # remove duplicate names
|
2473
|
-
possible_method_names = Util.get_closest_strings(method_name, all_method_names)
|
2474
|
-
|
2475
|
-
# Step 2: fetch the parameters of the closest matching method names
|
2476
|
-
possible_methods = list()
|
2477
|
-
for name in possible_method_names:
|
2478
|
-
for method in methods:
|
2479
|
-
if method.name == name:
|
2480
|
-
possible_methods.append(method.signature())
|
2481
|
-
return possible_methods
|
2482
|
-
|
2483
|
-
@staticmethod
|
2484
|
-
def __suggest_methods(wrong_sig: str, suggested_replacements: List[str]) -> None:
|
2485
|
-
"""
|
2486
|
-
Raises an error suggesting replacement methods for an erroneous signature.
|
2487
|
-
:param wrong_sig: A method signature as inserted by the user. Had no exact matches in the code.
|
2488
|
-
:param suggested_replacements: A list of suggested method signatures, ordered by descending relevance
|
2489
|
-
:raises: AttributeError always
|
2490
|
-
"""
|
2491
|
-
if len(suggested_replacements) == 0:
|
2492
|
-
raise Util.CertoraUserInputError(f"Method {wrong_sig} was not found.")
|
2493
|
-
|
2494
|
-
if len(suggested_replacements) == 1:
|
2495
|
-
options_str = suggested_replacements[0]
|
2496
|
-
elif len(suggested_replacements) == 2:
|
2497
|
-
options_str = " or ".join(suggested_replacements)
|
2498
|
-
elif len(suggested_replacements) > 2:
|
2499
|
-
# Code below adds or after the last comma if there are multiple options
|
2500
|
-
options_str = ", ".join(suggested_replacements)
|
2501
|
-
last_commas_location_regex = r"(?<=,)(?=[^,]*$)"
|
2502
|
-
options_str = re.sub(last_commas_location_regex, r" or", options_str)
|
2503
|
-
|
2504
|
-
raise Util.CertoraUserInputError(f"Method {wrong_sig} was not found. Maybe you meant {options_str}?")
|
2505
|
-
|
2506
|
-
def __verify_method(self, method_input: str, sdc_pre_finder: SDC) -> None:
|
2507
|
-
input_method_name = method_input.split('(')[0]
|
2508
|
-
input_method_sig = method_input.replace(' ', '')
|
2509
|
-
|
2510
|
-
"""
|
2511
|
-
A list of suggested methods, in case the user inserted a wrong method signature. Only public/external methods
|
2512
|
-
are suggested to the user. The suggestions are ordered by closest match - index zero is the best match, and
|
2513
|
-
descending.
|
2514
|
-
"""
|
2515
|
-
possible_methods = list()
|
2516
|
-
|
2517
|
-
# Step #1 - check if an exact match exists. If not, check if only the parameters were wrong in the signature
|
2518
|
-
|
2519
|
-
contract_names = [contract.name for contract in sdc_pre_finder.contracts]
|
2520
|
-
public_method_sets = [contract.methods for contract in sdc_pre_finder.contracts]
|
2521
|
-
public_methods = Util.flatten_set_list(public_method_sets)
|
2522
|
-
|
2523
|
-
for method in public_methods:
|
2524
|
-
if method.name == input_method_name: # Correct name, now we check parameter types
|
2525
|
-
if method.signature() == input_method_sig: # An exact match was found
|
2526
|
-
return
|
2527
|
-
|
2528
|
-
# A method with the same name but different parameters exists
|
2529
|
-
possible_methods.append(method.signature())
|
2530
|
-
|
2531
|
-
for contract_name in contract_names:
|
2532
|
-
contract_method_name = method.name_for_contract(contract_name)
|
2533
|
-
if contract_method_name == input_method_name:
|
2534
|
-
if method.signature_for_contract(contract_name) == input_method_sig:
|
2535
|
-
return
|
2536
|
-
|
2537
|
-
possible_methods.append(contract_method_name)
|
2538
|
-
|
2539
|
-
# Now we check if the method exists, but is private or external
|
2540
|
-
private_method_sets = [contract.internal_funcs for contract in sdc_pre_finder.contracts]
|
2541
|
-
private_methods = Util.flatten_set_list(private_method_sets)
|
2542
|
-
|
2543
|
-
for method in private_methods:
|
2544
|
-
if method.name == input_method_name: # Correct name, now we check parameter types
|
2545
|
-
if method.signature() == input_method_sig: # An exact match was found
|
2546
|
-
raise Util.CertoraUserInputError(
|
2547
|
-
f"Method {input_method_sig} is {method.visibility}. Please change it to external or public")
|
2548
|
-
|
2549
|
-
for contract_name in contract_names:
|
2550
|
-
contract_method_name = method.name_for_contract(contract_name)
|
2551
|
-
if contract_method_name == input_method_name:
|
2552
|
-
if method.signature_for_contract(contract_name) == input_method_sig:
|
2553
|
-
raise Util.CertoraUserInputError(
|
2554
|
-
f"Method {contract_method_name} is {method.visibility}. "
|
2555
|
-
"Please change it to external or public")
|
2556
|
-
|
2557
|
-
# We suggest a different method name, if we have a good enough suggestion
|
2558
|
-
# A method with correct name but wrong argument types takes precedence over a method with a different name
|
2559
|
-
if len(possible_methods) == 0:
|
2560
|
-
possible_methods = self.__find_closest_methods(input_method_name, public_methods)
|
2561
|
-
|
2562
|
-
if len(possible_methods) > 0: # We have suggestions
|
2563
|
-
self.__suggest_methods(method_input, possible_methods)
|
2564
|
-
|
2565
|
-
raise Util.CertoraUserInputError(f"Method {method_input} was not found")
|
2566
|
-
|
2567
2461
|
@staticmethod
|
2568
2462
|
def get_fresh_backupdir(backupdir: Path) -> Path:
|
2569
2463
|
"""
|
@@ -2595,34 +2489,6 @@ class CertoraBuildGenerator:
|
|
2595
2489
|
sdc_pre_finders = self.collect_for_file(build_arg_contract_file, i, compiler_lang, Path(os.getcwd()),
|
2596
2490
|
path_for_compiler_collector_file, original_sdc=None)
|
2597
2491
|
|
2598
|
-
if context.method and (build_arg_contract_file in context.verified_contract_files):
|
2599
|
-
# we check the --method flag's argument on compile time only for those modes
|
2600
|
-
# notice: when the backend will support multiple contracts to be verified/asserted,
|
2601
|
-
# we will have to be more careful here, since we assume there is only one contract
|
2602
|
-
# which is verified/asserted. For now, only the CLI support such multiple contracts.
|
2603
|
-
if context.verify:
|
2604
|
-
verified_contract_name = context.verify.split(":")[0]
|
2605
|
-
elif context.assert_contracts:
|
2606
|
-
verified_contract_name = context.assert_contracts[0]
|
2607
|
-
else:
|
2608
|
-
verified_contract_name = None
|
2609
|
-
|
2610
|
-
if verified_contract_name:
|
2611
|
-
sdc_with_verified_contract_name = next(
|
2612
|
-
curr_sdc for index, curr_sdc in enumerate(sdc_pre_finders) if
|
2613
|
-
curr_sdc.primary_contract == verified_contract_name)
|
2614
|
-
errs = []
|
2615
|
-
for method in context.method:
|
2616
|
-
try:
|
2617
|
-
self.__verify_method(method, sdc_with_verified_contract_name)
|
2618
|
-
except Util.CertoraUserInputError as e:
|
2619
|
-
errs.append(e)
|
2620
|
-
if len(errs) > 0:
|
2621
|
-
raise Util.CertoraUserInputError(
|
2622
|
-
"Some methods as specified via the `method` flag could not be found!"
|
2623
|
-
f"{Util.NEW_LINE}{Util.NEW_LINE.join(str(e) for e in errs)}"
|
2624
|
-
)
|
2625
|
-
|
2626
2492
|
# Build sources tree
|
2627
2493
|
build_logger.debug("Building source tree")
|
2628
2494
|
sources_from_pre_finder_SDCs = set()
|
@@ -742,10 +742,22 @@ class EvmAttributes(AttrUtil.Attributes):
|
|
742
742
|
argparse_args={
|
743
743
|
'action': AttrUtil.STORE_TRUE
|
744
744
|
},
|
745
|
-
affects_build_cache_key=
|
745
|
+
affects_build_cache_key=True,
|
746
746
|
disables_build_cache=False
|
747
747
|
)
|
748
748
|
|
749
|
+
AUTO_DISPATCHER = AttrUtil.AttributeDefinition(
|
750
|
+
arg_type=AttrUtil.AttrArgType.BOOLEAN,
|
751
|
+
jar_flag='-autoDispatcher',
|
752
|
+
argparse_args={
|
753
|
+
'action': AttrUtil.STORE_TRUE
|
754
|
+
},
|
755
|
+
affects_build_cache_key=True,
|
756
|
+
disables_build_cache=False,
|
757
|
+
help_msg="automatically add `DISPATCHER(true)` summaries for all calls with unresolved callees",
|
758
|
+
default_desc=""
|
759
|
+
)
|
760
|
+
|
749
761
|
MAX_GRAPH_DEPTH = AttrUtil.AttributeDefinition(
|
750
762
|
attr_validation_func=Vf.validate_non_negative_integer,
|
751
763
|
jar_flag='-graphDrawLimit',
|
@@ -964,6 +976,7 @@ class BackendAttributes(AttrUtil.Attributes):
|
|
964
976
|
)
|
965
977
|
|
966
978
|
METHOD = AttrUtil.AttributeDefinition(
|
979
|
+
attr_validation_func=Vf.validate_method_flag,
|
967
980
|
jar_flag='-method',
|
968
981
|
arg_type=AttrUtil.AttrArgType.LIST,
|
969
982
|
help_msg="Filter methods to be verified by their signature",
|
@@ -707,6 +707,43 @@ def validate_git_hash(git_hash: str) -> str:
|
|
707
707
|
return git_hash
|
708
708
|
|
709
709
|
|
710
|
+
def validate_method_flag(method: str) -> str:
|
711
|
+
contract_and_method = method.split('.')
|
712
|
+
if len(contract_and_method) > 2:
|
713
|
+
raise Util.CertoraUserInputError(f"Malformed method '{method}' in `--method` list: a method should be of the form `[ContractName.]functionABISignature(...)`")
|
714
|
+
elif (len(contract_and_method) == 2):
|
715
|
+
contract = contract_and_method[0]
|
716
|
+
validate_contract_name(contract)
|
717
|
+
m = contract_and_method[1]
|
718
|
+
else:
|
719
|
+
m = contract_and_method[0]
|
720
|
+
|
721
|
+
if ' ' in method:
|
722
|
+
raise Util.CertoraUserInputError(f"Malformed method '{method}' in `--method` list: remove all whitespace")
|
723
|
+
|
724
|
+
if not __validate_matching_parens(m):
|
725
|
+
raise Util.CertoraUserInputError(f"Malformed method '{method}' in `--method` list: unmatched parenthesis")
|
726
|
+
|
727
|
+
return method
|
728
|
+
|
729
|
+
|
730
|
+
def __validate_matching_parens(s: str) -> bool:
|
731
|
+
stack = []
|
732
|
+
matching_pairs = {")": "(", "]": "["}
|
733
|
+
|
734
|
+
for char in s:
|
735
|
+
if char in "([": # Opening parenthesis
|
736
|
+
stack.append(char)
|
737
|
+
elif char in ")]": # Closing parenthesis
|
738
|
+
if not stack: # Nothing to match with
|
739
|
+
return False
|
740
|
+
top = stack.pop()
|
741
|
+
if matching_pairs[char] != top:
|
742
|
+
return False
|
743
|
+
|
744
|
+
return not stack # Stack should be empty if all matched
|
745
|
+
|
746
|
+
|
710
747
|
def __validate_solidity_id(string: str, object: str) -> str:
|
711
748
|
"""
|
712
749
|
validates that string is a valid Solidity ID i.e. starts with aletter, a dollar sign or an underscore followed by
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: certora-cli-alpha-master
|
3
|
-
Version: 20250109.
|
3
|
+
Version: 20250109.15.35.401095
|
4
4
|
Summary: Runner for the Certora Prover
|
5
5
|
Home-page: https://pypi.org/project/certora-cli-alpha-master
|
6
6
|
Author: Certora
|
@@ -24,4 +24,4 @@ Requires-Dist: tomli
|
|
24
24
|
Requires-Dist: universalmutator
|
25
25
|
Requires-Dist: jinja2
|
26
26
|
|
27
|
-
Commit
|
27
|
+
Commit 7ab7df2. Build and Run scripts for executing the Certora Prover on Solidity smart contracts.
|
@@ -9,7 +9,7 @@ certora_cli/certoraSolanaProver.py,sha256=LEfKpfef0l91mqIQxSzCXtzE8oxZQek-ILcI02
|
|
9
9
|
certora_cli/certoraSorobanProver.py,sha256=L7mwsHZUxdZMW20_HfPgJeDHZAwIO2Bm2oHl_Nnn1xs,563
|
10
10
|
certora_cli/rustMutator.py,sha256=8FMLCFYfHK5A9YvHL-OEEWVxt55RVzBHLl3rP_F90Q8,13854
|
11
11
|
certora_cli/EVMVerifier/__init__.py,sha256=AJxj90KAGh1JqAsxKqDBTL2rFbqgtkhDfW_XmxSHft0,159
|
12
|
-
certora_cli/EVMVerifier/certoraBuild.py,sha256=
|
12
|
+
certora_cli/EVMVerifier/certoraBuild.py,sha256=GLo5piIDyojpNMu41cBwY5jRbrlsYf6WZ1IG2GKcf8w,196161
|
13
13
|
certora_cli/EVMVerifier/certoraBuildCacheManager.py,sha256=ZSVCsdTkFFtawuNJ8VK3wJOb01Uyu5e8viPQ8wTziSQ,12563
|
14
14
|
certora_cli/EVMVerifier/certoraBuildDataClasses.py,sha256=4IhvOA_fg-ij5RM9RRlvDDoS7imfp4Zru-AgHhxcHc0,13314
|
15
15
|
certora_cli/EVMVerifier/certoraBuildRust.py,sha256=SzQyaY4X1z6bg9pyFrxNJmyiLi4yCbV-13hnJ69iuf4,3353
|
@@ -18,7 +18,7 @@ certora_cli/EVMVerifier/certoraCollectRunMetadata.py,sha256=selEf-p7UW8_70-AbPfa
|
|
18
18
|
certora_cli/EVMVerifier/certoraCompilerParameters.py,sha256=PDKW3K_lNeRNPHisW0e5hYtfu6unDRjJUop-yItGHO0,762
|
19
19
|
certora_cli/EVMVerifier/certoraConfigIO.py,sha256=zlXcSAXPXQEhCdOqbogNLgIRSURFQgArYjFKd3VMkfg,4693
|
20
20
|
certora_cli/EVMVerifier/certoraContext.py,sha256=52YMEYYm67F_AsDZoIFjgcR34gQQDTnlmhiH9VrLCYE,21649
|
21
|
-
certora_cli/EVMVerifier/certoraContextAttributes.py,sha256=
|
21
|
+
certora_cli/EVMVerifier/certoraContextAttributes.py,sha256=04y4oLlJ6Sh44HmcM8D18MlEtOzTTdonVay3Y1SQTF4,57494
|
22
22
|
certora_cli/EVMVerifier/certoraContextClass.py,sha256=qdHYmrzI4zeQaAaMnonw4C-h1PFrPEhI84trrgvxFj0,210
|
23
23
|
certora_cli/EVMVerifier/certoraContextValidator.py,sha256=8zbhc8J6-5ODEEzlJFBiyK4yse4mat1YMGbB1bGPIBM,37569
|
24
24
|
certora_cli/EVMVerifier/certoraContractFuncs.py,sha256=W3lAvKotGKK7ZGJLg4yYh0FzTwwSQJbZMpizyGaYXZo,6229
|
@@ -56,13 +56,13 @@ certora_cli/Shared/__init__.py,sha256=QGoFb_Uu87tWp4E4L6C_VtzdG-sfNrzdNtRK79h5_L
|
|
56
56
|
certora_cli/Shared/certoraAttrUtil.py,sha256=hUi1ye5kIAHGZqCR1YbXayn5-ToZi3WAa4MwkI_jdzc,6761
|
57
57
|
certora_cli/Shared/certoraLogging.py,sha256=5Lx-XWKl7GnwnWi7KlwTLIfsEvUvCTZ8KeyfNyi_6RU,13323
|
58
58
|
certora_cli/Shared/certoraUtils.py,sha256=WmVX8Hz5wMZ7WI2JhYavAilH1kO3fwKLUBsf4hQ4b-o,53676
|
59
|
-
certora_cli/Shared/certoraValidateFuncs.py,sha256=
|
60
|
-
certora_jars/CERTORA-CLI-VERSION-METADATA.json,sha256=
|
61
|
-
certora_jars/Typechecker.jar,sha256=
|
59
|
+
certora_cli/Shared/certoraValidateFuncs.py,sha256=7Z3w9EjTbhNmlQIPjtlhNaC6JZ36R1H0Xv-pvO2NpMI,38521
|
60
|
+
certora_jars/CERTORA-CLI-VERSION-METADATA.json,sha256=1m7aV_oD7FI_KC9WuJC7Jss59-NfXdrPmf0HdZLgR4M,170
|
61
|
+
certora_jars/Typechecker.jar,sha256=jfoDJ9-KpFiC7jiZFoeSKzy50o8YNl1gAc1Fw3MmQ14,16834573
|
62
62
|
certora_jars/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
63
|
-
certora_cli_alpha_master-20250109.
|
64
|
-
certora_cli_alpha_master-20250109.
|
65
|
-
certora_cli_alpha_master-20250109.
|
66
|
-
certora_cli_alpha_master-20250109.
|
67
|
-
certora_cli_alpha_master-20250109.
|
68
|
-
certora_cli_alpha_master-20250109.
|
63
|
+
certora_cli_alpha_master-20250109.15.35.401095.dist-info/LICENSE,sha256=VeEBJLgfzZqyAUfjLoKUztf7KJBBUjtZ1ap99eQubOo,1065
|
64
|
+
certora_cli_alpha_master-20250109.15.35.401095.dist-info/METADATA,sha256=tvW8cYQT60ShdziEHCzQdIhrypsq-GQ46k5grj7dWTs,860
|
65
|
+
certora_cli_alpha_master-20250109.15.35.401095.dist-info/WHEEL,sha256=N3Zagyg8u7FcZiPCx4UnuNyRRYq7IQpu24eWYyuhGOQ,110
|
66
|
+
certora_cli_alpha_master-20250109.15.35.401095.dist-info/entry_points.txt,sha256=x2dyit80wAtF72k5CQj9F5lnWZEmP9ioseqvrEGWyFc,389
|
67
|
+
certora_cli_alpha_master-20250109.15.35.401095.dist-info/top_level.txt,sha256=8C77w3JLanY0-NW45vpJsjRssyCqVP-qmPiN9FjWiX4,38
|
68
|
+
certora_cli_alpha_master-20250109.15.35.401095.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": "7ab7df2", "timestamp": "20250109.15.35.401095", "version": "20250109.15.35.401095+7ab7df2"}
|
certora_jars/Typechecker.jar
CHANGED
Binary file
|
File without changes
|
File without changes
|
File without changes
|