certora-cli-alpha-master 20241224.0.4.890155__tar.gz → 20241224.12.18.798750__tar.gz

Sign up to get free protection for your applications and to get access to all the features.
Files changed (75) hide show
  1. {certora_cli_alpha_master-20241224.0.4.890155/certora_cli_alpha_master.egg-info → certora_cli_alpha_master-20241224.12.18.798750}/PKG-INFO +2 -2
  2. certora_cli_alpha_master-20241224.12.18.798750/README.md +1 -0
  3. {certora_cli_alpha_master-20241224.0.4.890155 → certora_cli_alpha_master-20241224.12.18.798750}/certora_cli/EVMVerifier/certoraBuild.py +81 -81
  4. certora_cli_alpha_master-20241224.12.18.798750/certora_cli/EVMVerifier/certoraBuildRust.py +69 -0
  5. {certora_cli_alpha_master-20241224.0.4.890155 → certora_cli_alpha_master-20241224.12.18.798750}/certora_cli/EVMVerifier/certoraCloudIO.py +13 -43
  6. {certora_cli_alpha_master-20241224.0.4.890155 → certora_cli_alpha_master-20241224.12.18.798750}/certora_cli/EVMVerifier/certoraContext.py +0 -15
  7. {certora_cli_alpha_master-20241224.0.4.890155 → certora_cli_alpha_master-20241224.12.18.798750}/certora_cli/certoraEVMProver.py +8 -1
  8. {certora_cli_alpha_master-20241224.0.4.890155 → certora_cli_alpha_master-20241224.12.18.798750}/certora_cli/certoraRun.py +2 -1
  9. {certora_cli_alpha_master-20241224.0.4.890155 → certora_cli_alpha_master-20241224.12.18.798750}/certora_cli/certoraSolanaProver.py +4 -5
  10. {certora_cli_alpha_master-20241224.0.4.890155 → certora_cli_alpha_master-20241224.12.18.798750}/certora_cli/certoraSorobanProver.py +8 -1
  11. {certora_cli_alpha_master-20241224.0.4.890155 → certora_cli_alpha_master-20241224.12.18.798750/certora_cli_alpha_master.egg-info}/PKG-INFO +2 -2
  12. {certora_cli_alpha_master-20241224.0.4.890155 → certora_cli_alpha_master-20241224.12.18.798750}/certora_cli_alpha_master.egg-info/SOURCES.txt +1 -0
  13. {certora_cli_alpha_master-20241224.0.4.890155 → certora_cli_alpha_master-20241224.12.18.798750}/certora_cli_alpha_master.egg-info/entry_points.txt +1 -1
  14. certora_cli_alpha_master-20241224.12.18.798750/certora_jars/CERTORA-CLI-VERSION-METADATA.json +1 -0
  15. {certora_cli_alpha_master-20241224.0.4.890155 → certora_cli_alpha_master-20241224.12.18.798750}/certora_jars/Typechecker.jar +0 -0
  16. {certora_cli_alpha_master-20241224.0.4.890155 → certora_cli_alpha_master-20241224.12.18.798750}/setup.py +3 -3
  17. certora_cli_alpha_master-20241224.0.4.890155/README.md +0 -1
  18. certora_cli_alpha_master-20241224.0.4.890155/certora_jars/CERTORA-CLI-VERSION-METADATA.json +0 -1
  19. {certora_cli_alpha_master-20241224.0.4.890155 → certora_cli_alpha_master-20241224.12.18.798750}/LICENSE +0 -0
  20. {certora_cli_alpha_master-20241224.0.4.890155 → certora_cli_alpha_master-20241224.12.18.798750}/MANIFEST.in +0 -0
  21. {certora_cli_alpha_master-20241224.0.4.890155 → certora_cli_alpha_master-20241224.12.18.798750}/certora_bins/__init__.py +0 -0
  22. {certora_cli_alpha_master-20241224.0.4.890155 → certora_cli_alpha_master-20241224.12.18.798750}/certora_cli/EVMVerifier/Compiler/CompilerCollector.py +0 -0
  23. {certora_cli_alpha_master-20241224.0.4.890155 → certora_cli_alpha_master-20241224.12.18.798750}/certora_cli/EVMVerifier/Compiler/CompilerCollectorFactory.py +0 -0
  24. {certora_cli_alpha_master-20241224.0.4.890155 → certora_cli_alpha_master-20241224.12.18.798750}/certora_cli/EVMVerifier/Compiler/CompilerCollectorSol.py +0 -0
  25. {certora_cli_alpha_master-20241224.0.4.890155 → certora_cli_alpha_master-20241224.12.18.798750}/certora_cli/EVMVerifier/Compiler/CompilerCollectorSolBased.py +0 -0
  26. {certora_cli_alpha_master-20241224.0.4.890155 → certora_cli_alpha_master-20241224.12.18.798750}/certora_cli/EVMVerifier/Compiler/CompilerCollectorVy.py +0 -0
  27. {certora_cli_alpha_master-20241224.0.4.890155 → certora_cli_alpha_master-20241224.12.18.798750}/certora_cli/EVMVerifier/Compiler/CompilerCollectorYul.py +0 -0
  28. {certora_cli_alpha_master-20241224.0.4.890155 → certora_cli_alpha_master-20241224.12.18.798750}/certora_cli/EVMVerifier/Compiler/__init__.py +0 -0
  29. {certora_cli_alpha_master-20241224.0.4.890155 → certora_cli_alpha_master-20241224.12.18.798750}/certora_cli/EVMVerifier/__init__.py +0 -0
  30. {certora_cli_alpha_master-20241224.0.4.890155 → certora_cli_alpha_master-20241224.12.18.798750}/certora_cli/EVMVerifier/certoraBuildCacheManager.py +0 -0
  31. {certora_cli_alpha_master-20241224.0.4.890155 → certora_cli_alpha_master-20241224.12.18.798750}/certora_cli/EVMVerifier/certoraBuildDataClasses.py +0 -0
  32. {certora_cli_alpha_master-20241224.0.4.890155 → certora_cli_alpha_master-20241224.12.18.798750}/certora_cli/EVMVerifier/certoraCollectRunMetadata.py +0 -0
  33. {certora_cli_alpha_master-20241224.0.4.890155 → certora_cli_alpha_master-20241224.12.18.798750}/certora_cli/EVMVerifier/certoraCompilerParameters.py +0 -0
  34. {certora_cli_alpha_master-20241224.0.4.890155 → certora_cli_alpha_master-20241224.12.18.798750}/certora_cli/EVMVerifier/certoraConfigIO.py +0 -0
  35. {certora_cli_alpha_master-20241224.0.4.890155 → certora_cli_alpha_master-20241224.12.18.798750}/certora_cli/EVMVerifier/certoraContextAttributes.py +0 -0
  36. {certora_cli_alpha_master-20241224.0.4.890155 → certora_cli_alpha_master-20241224.12.18.798750}/certora_cli/EVMVerifier/certoraContextClass.py +0 -0
  37. {certora_cli_alpha_master-20241224.0.4.890155 → certora_cli_alpha_master-20241224.12.18.798750}/certora_cli/EVMVerifier/certoraContextValidator.py +0 -0
  38. {certora_cli_alpha_master-20241224.0.4.890155 → certora_cli_alpha_master-20241224.12.18.798750}/certora_cli/EVMVerifier/certoraContractFuncs.py +0 -0
  39. {certora_cli_alpha_master-20241224.0.4.890155 → certora_cli_alpha_master-20241224.12.18.798750}/certora_cli/EVMVerifier/certoraExtensionInfo.py +0 -0
  40. {certora_cli_alpha_master-20241224.0.4.890155 → certora_cli_alpha_master-20241224.12.18.798750}/certora_cli/EVMVerifier/certoraJobList.py +0 -0
  41. {certora_cli_alpha_master-20241224.0.4.890155 → certora_cli_alpha_master-20241224.12.18.798750}/certora_cli/EVMVerifier/certoraMiniSpecParser.py +0 -0
  42. {certora_cli_alpha_master-20241224.0.4.890155 → certora_cli_alpha_master-20241224.12.18.798750}/certora_cli/EVMVerifier/certoraNodeFilters.py +0 -0
  43. {certora_cli_alpha_master-20241224.0.4.890155 → certora_cli_alpha_master-20241224.12.18.798750}/certora_cli/EVMVerifier/certoraParseBuildScript.py +0 -0
  44. {certora_cli_alpha_master-20241224.0.4.890155 → certora_cli_alpha_master-20241224.12.18.798750}/certora_cli/EVMVerifier/certoraSourceFinders.py +0 -0
  45. {certora_cli_alpha_master-20241224.0.4.890155 → certora_cli_alpha_master-20241224.12.18.798750}/certora_cli/EVMVerifier/certoraType.py +0 -0
  46. {certora_cli_alpha_master-20241224.0.4.890155 → certora_cli_alpha_master-20241224.12.18.798750}/certora_cli/EVMVerifier/certoraVerifyGenerator.py +0 -0
  47. {certora_cli_alpha_master-20241224.0.4.890155 → certora_cli_alpha_master-20241224.12.18.798750}/certora_cli/EquivalenceCheck/Eq_default.conf +0 -0
  48. {certora_cli_alpha_master-20241224.0.4.890155 → certora_cli_alpha_master-20241224.12.18.798750}/certora_cli/EquivalenceCheck/Eq_mc_no_out_template.spec +0 -0
  49. {certora_cli_alpha_master-20241224.0.4.890155 → certora_cli_alpha_master-20241224.12.18.798750}/certora_cli/EquivalenceCheck/Eq_mc_template.spec +0 -0
  50. {certora_cli_alpha_master-20241224.0.4.890155 → certora_cli_alpha_master-20241224.12.18.798750}/certora_cli/EquivalenceCheck/Eq_sanity.conf +0 -0
  51. {certora_cli_alpha_master-20241224.0.4.890155 → certora_cli_alpha_master-20241224.12.18.798750}/certora_cli/EquivalenceCheck/Eq_template.spec +0 -0
  52. {certora_cli_alpha_master-20241224.0.4.890155 → certora_cli_alpha_master-20241224.12.18.798750}/certora_cli/EquivalenceCheck/__init__.py +0 -0
  53. {certora_cli_alpha_master-20241224.0.4.890155 → certora_cli_alpha_master-20241224.12.18.798750}/certora_cli/EquivalenceCheck/equivCheck.py +0 -0
  54. {certora_cli_alpha_master-20241224.0.4.890155 → certora_cli_alpha_master-20241224.12.18.798750}/certora_cli/EquivalenceCheck/sanity.spec +0 -0
  55. {certora_cli_alpha_master-20241224.0.4.890155 → certora_cli_alpha_master-20241224.12.18.798750}/certora_cli/Mutate/__init__.py +0 -0
  56. {certora_cli_alpha_master-20241224.0.4.890155 → certora_cli_alpha_master-20241224.12.18.798750}/certora_cli/Mutate/mutateApp.py +0 -0
  57. {certora_cli_alpha_master-20241224.0.4.890155 → certora_cli_alpha_master-20241224.12.18.798750}/certora_cli/Mutate/mutateAttributes.py +0 -0
  58. {certora_cli_alpha_master-20241224.0.4.890155 → certora_cli_alpha_master-20241224.12.18.798750}/certora_cli/Mutate/mutateConstants.py +0 -0
  59. {certora_cli_alpha_master-20241224.0.4.890155 → certora_cli_alpha_master-20241224.12.18.798750}/certora_cli/Mutate/mutateUtil.py +0 -0
  60. {certora_cli_alpha_master-20241224.0.4.890155 → certora_cli_alpha_master-20241224.12.18.798750}/certora_cli/Mutate/mutateValidate.py +0 -0
  61. {certora_cli_alpha_master-20241224.0.4.890155 → certora_cli_alpha_master-20241224.12.18.798750}/certora_cli/Shared/ExpectedComparator.py +0 -0
  62. {certora_cli_alpha_master-20241224.0.4.890155 → certora_cli_alpha_master-20241224.12.18.798750}/certora_cli/Shared/__init__.py +0 -0
  63. {certora_cli_alpha_master-20241224.0.4.890155 → certora_cli_alpha_master-20241224.12.18.798750}/certora_cli/Shared/certoraAttrUtil.py +0 -0
  64. {certora_cli_alpha_master-20241224.0.4.890155 → certora_cli_alpha_master-20241224.12.18.798750}/certora_cli/Shared/certoraLogging.py +0 -0
  65. {certora_cli_alpha_master-20241224.0.4.890155 → certora_cli_alpha_master-20241224.12.18.798750}/certora_cli/Shared/certoraUtils.py +0 -0
  66. {certora_cli_alpha_master-20241224.0.4.890155 → certora_cli_alpha_master-20241224.12.18.798750}/certora_cli/Shared/certoraValidateFuncs.py +0 -0
  67. {certora_cli_alpha_master-20241224.0.4.890155 → certora_cli_alpha_master-20241224.12.18.798750}/certora_cli/__init__.py +0 -0
  68. {certora_cli_alpha_master-20241224.0.4.890155 → certora_cli_alpha_master-20241224.12.18.798750}/certora_cli/certoraEqCheck.py +0 -0
  69. {certora_cli_alpha_master-20241224.0.4.890155 → certora_cli_alpha_master-20241224.12.18.798750}/certora_cli/certoraMutate.py +0 -0
  70. {certora_cli_alpha_master-20241224.0.4.890155 → certora_cli_alpha_master-20241224.12.18.798750}/certora_cli/rustMutator.py +0 -0
  71. {certora_cli_alpha_master-20241224.0.4.890155 → certora_cli_alpha_master-20241224.12.18.798750}/certora_cli_alpha_master.egg-info/dependency_links.txt +0 -0
  72. {certora_cli_alpha_master-20241224.0.4.890155 → certora_cli_alpha_master-20241224.12.18.798750}/certora_cli_alpha_master.egg-info/requires.txt +0 -0
  73. {certora_cli_alpha_master-20241224.0.4.890155 → certora_cli_alpha_master-20241224.12.18.798750}/certora_cli_alpha_master.egg-info/top_level.txt +0 -0
  74. {certora_cli_alpha_master-20241224.0.4.890155 → certora_cli_alpha_master-20241224.12.18.798750}/certora_jars/__init__.py +0 -0
  75. {certora_cli_alpha_master-20241224.0.4.890155 → certora_cli_alpha_master-20241224.12.18.798750}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: certora-cli-alpha-master
3
- Version: 20241224.0.4.890155
3
+ Version: 20241224.12.18.798750
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 b29f53e. Build and Run scripts for executing the Certora Prover on Solidity smart contracts.
26
+ Commit 103751c. Build and Run scripts for executing the Certora Prover on Solidity smart contracts.
@@ -0,0 +1 @@
1
+ Commit 103751c. Build and Run scripts for executing the Certora Prover on Solidity smart contracts.
@@ -2630,7 +2630,7 @@ class CertoraBuildGenerator:
2630
2630
  sources_from_pre_finder_SDCs |= sdc.all_contract_files
2631
2631
  sources = self.collect_sources(context, certora_verify_generator, sources_from_pre_finder_SDCs)
2632
2632
  try:
2633
- self.cwd_rel_in_sources = self.build_source_tree(sources, context)
2633
+ self.cwd_rel_in_sources = build_source_tree(sources, context)
2634
2634
  except Exception as e:
2635
2635
  build_logger.debug(f"build_source_tree failed. Sources: {sources}", exc_info=e)
2636
2636
  raise
@@ -2797,85 +2797,6 @@ class CertoraBuildGenerator:
2797
2797
  common_path = Path(os.path.commonpath(list(sources.union({cwd}))))
2798
2798
  return cwd.relative_to(common_path), common_path
2799
2799
 
2800
- @staticmethod
2801
- def build_source_tree(sources: Set[Path], context: CertoraContext, overwrite: bool = False) -> Path:
2802
- """
2803
- Copies files to .certora_sources
2804
- @returns the cwd relative in sources
2805
- """
2806
- sources = sources_to_abs(sources)
2807
- cwd_rel_in_sources, common_path = CertoraBuildGenerator.get_cwd_rel_in_sources(sources)
2808
-
2809
- for source_path in sources:
2810
- is_dir = source_path.is_dir()
2811
- # copy file to the path of the file from the common root under the sources directory
2812
-
2813
- # make sure directory exists
2814
- target_path = Util.get_certora_sources_dir() / source_path.relative_to(common_path)
2815
- target_directory = target_path if is_dir else target_path.parent
2816
- try:
2817
- target_directory.mkdir(parents=True, exist_ok=True)
2818
- except OSError as e:
2819
- build_logger.debug(f"Failed to create directory {target_directory}", exc_info=e)
2820
- raise
2821
-
2822
- # copy files. if we got a directory, nothing to do
2823
- if is_dir:
2824
- build_logger.debug(f"Skipping directory {source_path}")
2825
- continue
2826
-
2827
- try:
2828
- if overwrite:
2829
- # expecting target path to exist.
2830
- if target_path.exists():
2831
- build_logger.debug(f"Overwriting {target_path} by copying from {source_path}")
2832
- else:
2833
- build_logger.warning(f"Supposed to overwrite {target_path} by copying from {source_path}" +
2834
- " but it does not exist... this may indicate bad things happen")
2835
- if overwrite or not target_path.exists():
2836
- build_logger.debug(f"Copying {source_path} to {target_path}")
2837
- shutil.copyfile(source_path, target_path)
2838
- except OSError as e:
2839
- build_logger.debug(f"Couldn't copy {source_path} to {target_path}", exc_info=e)
2840
- raise
2841
-
2842
- # the empty file .cwd is written in the source tree to denote the current working directory
2843
- if cwd_rel_in_sources != '.':
2844
- file_path = Util.get_certora_sources_dir() / cwd_rel_in_sources / Util.CWD_FILE
2845
- file_path.parent.mkdir(parents=True, exist_ok=True)
2846
- file_path.touch()
2847
-
2848
- """
2849
- Once the resource files are copied to the source tree, the paths in the value of the 'prover_resource_files'
2850
- attribute are replaced with the relative path of the resource file from the source tree root.
2851
- This way The server can easily find the resource files in the source tree. The path from the source tree is the
2852
- relative path of cwd from source tree root (most cases '.') concatenated with the relative path of the resource
2853
- file from cwd
2854
- """
2855
- if context.prover_resource_files:
2856
- new_value = []
2857
- len_orig = len(context.prover_resource_files)
2858
- for value in context.prover_resource_files:
2859
- label, file_path = value.split(':')
2860
- rel_path = Path(os.path.relpath(file_path, '.'))
2861
- new_value.append(':'.join([label, os.path.normpath(rel_path)]))
2862
- if len_orig != len(new_value):
2863
- raise RuntimeError(f"fail to process prover_resource_files {len_orig} out of {len(new_value)}")
2864
- context.prover_resource_files = new_value
2865
-
2866
- # Copy the repro conf file to the sources as the overall way to reproduce this run easily.
2867
- # The file is being copied in here and not added through collect_sources, because we want
2868
- # to avoid building the whole tree up to the common path for this file. We simply want to copy
2869
- # the repro file from .certora_internal to .certora_sources so it will be uploaded as a run
2870
- # resource.
2871
- try:
2872
- shutil.copy(Util.get_last_conf_file(), Util.get_certora_sources_dir() / Util.LAST_CONF_FILE)
2873
- except OSError as e:
2874
- build_logger.debug("Couldn't copy repro conf to certora sources.", exc_info=e)
2875
- raise
2876
-
2877
- return cwd_rel_in_sources
2878
-
2879
2800
  @staticmethod
2880
2801
  def normalize_path(path: str) -> str:
2881
2802
  """
@@ -3472,6 +3393,85 @@ def sources_to_abs(sources: Set[Path]) -> Set[Path]:
3472
3393
  return result
3473
3394
 
3474
3395
 
3396
+ def build_source_tree(sources: Set[Path], context: CertoraContext, overwrite: bool = False) -> Path:
3397
+ """
3398
+ Copies files to .certora_sources
3399
+ @returns the cwd relative in sources
3400
+ """
3401
+ sources = sources_to_abs(sources)
3402
+ cwd_rel_in_sources, common_path = CertoraBuildGenerator.get_cwd_rel_in_sources(sources)
3403
+
3404
+ for source_path in sources:
3405
+ is_dir = source_path.is_dir()
3406
+ # copy file to the path of the file from the common root under the sources directory
3407
+
3408
+ # make sure directory exists
3409
+ target_path = Util.get_certora_sources_dir() / source_path.relative_to(common_path)
3410
+ target_directory = target_path if is_dir else target_path.parent
3411
+ try:
3412
+ target_directory.mkdir(parents=True, exist_ok=True)
3413
+ except OSError as e:
3414
+ build_logger.debug(f"Failed to create directory {target_directory}", exc_info=e)
3415
+ raise
3416
+
3417
+ # copy files. if we got a directory, nothing to do
3418
+ if is_dir:
3419
+ build_logger.debug(f"Skipping directory {source_path}")
3420
+ continue
3421
+
3422
+ try:
3423
+ if overwrite:
3424
+ # expecting target path to exist.
3425
+ if target_path.exists():
3426
+ build_logger.debug(f"Overwriting {target_path} by copying from {source_path}")
3427
+ else:
3428
+ build_logger.warning(f"Supposed to overwrite {target_path} by copying from {source_path}" +
3429
+ " but it does not exist... this may indicate bad things happen")
3430
+ if overwrite or not target_path.exists():
3431
+ build_logger.debug(f"Copying {source_path} to {target_path}")
3432
+ shutil.copyfile(source_path, target_path)
3433
+ except OSError as e:
3434
+ build_logger.debug(f"Couldn't copy {source_path} to {target_path}", exc_info=e)
3435
+ raise
3436
+
3437
+ # the empty file .cwd is written in the source tree to denote the current working directory
3438
+ if cwd_rel_in_sources != '.':
3439
+ file_path = Util.get_certora_sources_dir() / cwd_rel_in_sources / Util.CWD_FILE
3440
+ file_path.parent.mkdir(parents=True, exist_ok=True)
3441
+ file_path.touch()
3442
+
3443
+ """
3444
+ Once the resource files are copied to the source tree, the paths in the value of the 'prover_resource_files'
3445
+ attribute are replaced with the relative path of the resource file from the source tree root.
3446
+ This way The server can easily find the resource files in the source tree. The path from the source tree is the
3447
+ relative path of cwd from source tree root (most cases '.') concatenated with the relative path of the resource
3448
+ file from cwd
3449
+ """
3450
+ if context.prover_resource_files:
3451
+ new_value = []
3452
+ len_orig = len(context.prover_resource_files)
3453
+ for value in context.prover_resource_files:
3454
+ label, file_path = value.split(':')
3455
+ rel_path = Path(os.path.relpath(file_path, '.'))
3456
+ new_value.append(':'.join([label, os.path.normpath(rel_path)]))
3457
+ if len_orig != len(new_value):
3458
+ raise RuntimeError(f"fail to process prover_resource_files {len_orig} out of {len(new_value)}")
3459
+ context.prover_resource_files = new_value
3460
+
3461
+ # Copy the repro conf file to the sources as the overall way to reproduce this run easily.
3462
+ # The file is being copied in here and not added through collect_sources, because we want
3463
+ # to avoid building the whole tree up to the common path for this file. We simply want to copy
3464
+ # the repro file from .certora_internal to .certora_sources so it will be uploaded as a run
3465
+ # resource.
3466
+ try:
3467
+ shutil.copy(Util.get_last_conf_file(), Util.get_certora_sources_dir() / Util.LAST_CONF_FILE)
3468
+ except OSError as e:
3469
+ build_logger.debug("Couldn't copy repro conf to certora sources.", exc_info=e)
3470
+ raise
3471
+
3472
+ return cwd_rel_in_sources
3473
+
3474
+
3475
3475
  def build_from_scratch(certora_build_generator: CertoraBuildGenerator,
3476
3476
  certora_verify_generator: CertoraVerifyGenerator,
3477
3477
  build_cache_enabled: bool) -> CachedFiles:
@@ -3635,7 +3635,7 @@ def build(context: CertoraContext, ignore_spec_syntax_check: bool = False) -> No
3635
3635
  cached_files.all_contract_files)
3636
3636
  try:
3637
3637
  # Copies files, not updating state
3638
- certora_build_generator.build_source_tree(sources, context)
3638
+ build_source_tree(sources, context)
3639
3639
  except Exception as e:
3640
3640
  build_logger.debug("build_source_tree failed", exc_info=e)
3641
3641
 
@@ -0,0 +1,69 @@
1
+ import glob
2
+ import shutil
3
+ from pathlib import Path
4
+ from typing import Set
5
+
6
+ from EVMVerifier.certoraBuild import build_source_tree
7
+ from EVMVerifier.certoraContextClass import CertoraContext
8
+ from EVMVerifier.certoraParseBuildScript import run_script_and_parse_json
9
+ from Shared import certoraUtils as Util
10
+
11
+
12
+ def build_rust_app(context: CertoraContext) -> None:
13
+ if context.build_script:
14
+ run_script_and_parse_json(context)
15
+ if not context.rust_executables:
16
+ raise Util.CertoraUserInputError("failed to get target executable")
17
+
18
+ sources: Set[Path] = set()
19
+ root_directory = Path(context.rust_project_directory)
20
+ collect_files_from_rust_sources(context, sources, root_directory)
21
+
22
+ try:
23
+ # Create generators
24
+ build_source_tree(sources, context)
25
+
26
+ copy_files_to_build_dir(context, root_directory)
27
+
28
+ except Exception as e:
29
+ raise Util.CertoraUserInputError(f"Collecting build files failed with the exception: {e}")
30
+ else:
31
+ if not context.files:
32
+ raise Util.CertoraUserInputError("'files' or 'build_script' must be set for Rust projects")
33
+ if len(context.files) > 1:
34
+ raise Util.CertoraUserInputError("Rust projects must specify exactly one executable in 'files'.")
35
+ context.rust_executables = context.files[0]
36
+
37
+
38
+ def collect_files_from_rust_sources(context: CertoraContext, sources: Set[Path], root_directory: Path) -> None:
39
+ patterns = ["*.rs", "*.so", "*.wasm", "Cargo.toml", "Cargo.lock", "justfile"]
40
+ exclude_dirs = [".certora_internal"]
41
+
42
+ if not root_directory.is_dir():
43
+ raise ValueError(f"The given directory {root_directory} is not valid.")
44
+
45
+ for source in context.rust_sources:
46
+ for file in glob.glob(f'{root_directory.joinpath(source)}', recursive=True):
47
+ file_path = Path(file)
48
+ if any(excluded in file_path.parts for excluded in exclude_dirs):
49
+ continue
50
+ if file_path.is_file() and any(file_path.match(pattern) for pattern in patterns):
51
+ sources.add(file_path)
52
+
53
+ if Path(context.build_script).exists():
54
+ sources.add(Path(context.build_script).resolve())
55
+ if context.conf_file and Path(context.conf_file).exists():
56
+ sources.add(Path(context.conf_file).absolute())
57
+
58
+
59
+ def copy_files_to_build_dir(context: CertoraContext, root_directory: Path) -> None:
60
+ rust_executable = root_directory / context.rust_executables
61
+ shutil.copyfile(rust_executable, Util.get_build_dir() / rust_executable.name)
62
+
63
+ if context.prover_resource_files:
64
+ for value in context.prover_resource_files:
65
+ _, file_path = value.split(':')
66
+ cur_path = (Path(context.conf_file).parent / file_path).resolve()
67
+ shutil.copy(cur_path, Util.get_build_dir() / cur_path.name)
68
+ if cur_path.suffix == '.txt':
69
+ shutil.copy(cur_path, Util.get_certora_sources_dir() / cur_path.name)
@@ -1,9 +1,7 @@
1
- import glob
2
1
  import itertools
3
2
  import json
4
3
  import os
5
4
  import re
6
- import shutil
7
5
  import uuid
8
6
 
9
7
  import requests
@@ -192,45 +190,6 @@ def parse_json(response: Response) -> Dict[str, Any]:
192
190
  return json_response
193
191
 
194
192
 
195
- def zip_rust_files(zip_file_path: Path, context: CertoraContext, *resource_paths: Path) -> bool:
196
- patterns = ["*.rs", "*.so", "*.wasm", "Cargo.toml", "Cargo.lock", "justfile"]
197
- exclude_dirs = [".certora_internal"]
198
-
199
- root_directory = Path(context.rust_project_directory)
200
- if not root_directory.is_dir():
201
- raise ValueError(f"The given directory {root_directory} is not valid.")
202
-
203
- with zipfile.ZipFile(zip_file_path, 'w', zipfile.ZIP_DEFLATED) as zip_obj:
204
- for source in context.rust_sources:
205
- for file in glob.glob(f'{root_directory.joinpath(source)}', recursive=True):
206
- file_path = Path(file)
207
- if any(excluded in file_path.parts for excluded in exclude_dirs):
208
- continue
209
- if file_path.is_file() and any(file_path.match(pattern) for pattern in patterns):
210
- zip_obj.write(file_path, Util.CERTORA_SOURCES / file_path.relative_to(root_directory))
211
- if context.build_script and Path(context.build_script).exists():
212
- zip_obj.write(Path(context.build_script),
213
- Util.CERTORA_SOURCES / Path(context.build_script).absolute().relative_to(root_directory))
214
- if context.conf_file and Path(context.conf_file).exists():
215
- zip_obj.write(Path(context.conf_file),
216
- Util.CERTORA_SOURCES / Path(context.conf_file).absolute().relative_to(root_directory))
217
- if Util.get_last_conf_file():
218
- zip_obj.write(Util.get_last_conf_file(),
219
- Util.CERTORA_SOURCES / Util.get_last_conf_file().relative_to(Util.get_build_dir()))
220
-
221
- rust_executable = root_directory.joinpath(context.rust_executables)
222
- zip_obj.write(rust_executable, rust_executable.relative_to(rust_executable.parent))
223
- for path in resource_paths:
224
- zip_obj.write(path, os.path.relpath(path, Util.get_build_dir()))
225
- if path.suffix == '.txt':
226
- zip_obj.write(path, Util.CERTORA_SOURCES / path.relative_to(Util.get_build_dir()))
227
-
228
- if zip_file_path.stat().st_size > MAX_FILE_SIZE:
229
- cloud_logger.error(f"{GENERAL_ERR_PREFIX} Max 25MB file size exceeded. File is located at {zip_file_path}")
230
- return False
231
- return True
232
-
233
-
234
193
  def compress_files(zip_file_path: Path, *resource_paths: Path, short_output: bool = False) -> bool:
235
194
  with zipfile.ZipFile(zip_file_path, 'w', zipfile.ZIP_DEFLATED) as zip_obj:
236
195
 
@@ -779,14 +738,25 @@ class CloudVerification:
779
738
  files_list = [Util.get_certora_metadata_file()]
780
739
 
781
740
  if hasattr(self.context, 'build_script') and self.context.build_script:
741
+ result = compress_files(self.logZipFilePath, Util.get_debug_log_file(),
742
+ short_output=Ctx.is_minimal_cli_output(self.context))
743
+
744
+ if not result:
745
+ return False
746
+ files_list.append(self.logZipFilePath)
747
+ if Util.get_certora_sources_dir().exists():
748
+ files_list.append(Util.get_certora_sources_dir())
749
+
750
+ files_list.append(Util.get_build_dir() / Path(self.context.rust_executables).name)
751
+
782
752
  if self.context.prover_resource_files:
783
753
  for value in self.context.prover_resource_files:
784
754
  _, file_path = value.split(':')
785
755
  cur_path = (Path(self.context.conf_file).parent / Path(file_path)).resolve()
786
- shutil.copy(cur_path, Util.get_build_dir())
787
756
  files_list.append(Util.get_build_dir() / cur_path.name)
788
757
 
789
- result = zip_rust_files(self.ZipFilePath, self.context, *files_list)
758
+ result = compress_files(self.ZipFilePath, *files_list,
759
+ short_output=Ctx.is_minimal_cli_output(self.context))
790
760
 
791
761
  elif Attrs.is_solana_app():
792
762
  # We zip the ELF files and the two configuration files
@@ -11,8 +11,6 @@ from pathlib import Path
11
11
  from typing import Dict, List, Optional, Any
12
12
  from rich.console import Console
13
13
 
14
- from EVMVerifier.certoraParseBuildScript import run_script_and_parse_json
15
-
16
14
  scripts_dir_path = Path(__file__).parent.resolve() # containing directory
17
15
  sys.path.insert(0, str(scripts_dir_path))
18
16
 
@@ -521,16 +519,3 @@ def run_local_spec_check(with_typechecking: bool, context: CertoraContext) -> No
521
519
  else:
522
520
  raise Util.CertoraUserInputError("Cannot run local checks because of missing a suitable java installation. "
523
521
  "To skip local checks run with the --disable_local_typechecking flag")
524
-
525
-
526
- def build_rust_app(context: CertoraContext) -> None:
527
- if context.build_script:
528
- run_script_and_parse_json(context)
529
- if not context.rust_executables:
530
- raise Util.CertoraUserInputError("failed to get target executable")
531
- else:
532
- if not context.files:
533
- raise Util.CertoraUserInputError("'files' or 'build_script' must be set for Rust projects")
534
- if len(context.files) > 1:
535
- raise Util.CertoraUserInputError("Rust projects must specify exactly one executable in 'files'.")
536
- context.rust_executables = context.files[0]
@@ -1,6 +1,11 @@
1
1
  #!/usr/bin/env python3
2
2
 
3
3
  import sys
4
+ from pathlib import Path
5
+
6
+ scripts_dir_path = Path(__file__).parent.resolve() # containing directory
7
+ sys.path.insert(0, str(scripts_dir_path))
8
+
4
9
  import EVMVerifier.certoraContextAttributes as Attrs
5
10
  from certoraRun import run_certora, CertoraRunResult
6
11
  from typing import List, Optional
@@ -9,6 +14,8 @@ from typing import List, Optional
9
14
  def run_evm_prover(args: List[str]) -> Optional[CertoraRunResult]:
10
15
  return run_certora(args, Attrs.EvmProverAttributes)
11
16
 
17
+ def entry_point() -> None:
18
+ run_evm_prover(sys.argv[1:])
12
19
 
13
20
  if __name__ == '__main__':
14
- run_evm_prover(sys.argv[1:])
21
+ entry_point()
@@ -18,6 +18,7 @@ from EVMVerifier.certoraCloudIO import CloudVerification, validate_version_and_b
18
18
  from EVMVerifier.certoraCollectRunMetadata import collect_run_metadata
19
19
  from Shared.certoraLogging import LoggingManager
20
20
  from EVMVerifier.certoraBuild import build
21
+ from EVMVerifier.certoraBuildRust import build_rust_app
21
22
  import EVMVerifier.certoraContext as Ctx
22
23
 
23
24
  from EVMVerifier import certoraContextValidator as Cv
@@ -95,7 +96,7 @@ def run_certora(args: List[str], attrs_class: Optional[Type[AttrUtil.Attributes]
95
96
  metadata.dump()
96
97
 
97
98
  if Attrs.is_rust_app():
98
- Ctx.build_rust_app(context)
99
+ build_rust_app(context)
99
100
 
100
101
  if context.local:
101
102
  check_cmd = Ctx.get_local_run_cmd(context)
@@ -3,7 +3,7 @@
3
3
  import sys
4
4
  import time
5
5
  import logging
6
- from typing import List, Optional, Type
6
+ from typing import List, Optional
7
7
  from pathlib import Path
8
8
  from rich.console import Console
9
9
 
@@ -11,7 +11,6 @@ scripts_dir_path = Path(__file__).parent.resolve() # containing directory
11
11
  sys.path.insert(0, str(scripts_dir_path))
12
12
 
13
13
  from Shared import certoraUtils as Util
14
- from Shared import certoraAttrUtil as AttrUtil
15
14
  from Shared.certoraLogging import LoggingManager
16
15
 
17
16
  from EVMVerifier.certoraCloudIO import CloudVerification, validate_version_and_branch
@@ -20,6 +19,7 @@ from EVMVerifier import certoraContextValidator as Cv
20
19
 
21
20
  import EVMVerifier.certoraContext as Ctx
22
21
  import EVMVerifier.certoraContextAttributes as Attrs
22
+ from EVMVerifier.certoraBuildRust import build_rust_app
23
23
 
24
24
  from certoraRun import CertoraRunResult, VIOLATIONS_EXIT_CODE, CertoraFoundViolations
25
25
 
@@ -28,8 +28,7 @@ from certoraRun import CertoraRunResult, VIOLATIONS_EXIT_CODE, CertoraFoundViola
28
28
  run_logger = logging.getLogger("run")
29
29
 
30
30
 
31
- def run_solana_prover(args: List[str], attrs_class: Optional[Type[AttrUtil.Attributes]] = None) \
32
- -> Optional[CertoraRunResult]:
31
+ def run_solana_prover(args: List[str]) -> Optional[CertoraRunResult]:
33
32
  """
34
33
  The main function that is responsible for the general flow of the script.
35
34
  The general flow is:
@@ -77,7 +76,7 @@ def run_solana_prover(args: List[str], attrs_class: Optional[Type[AttrUtil.Attri
77
76
  run_logger.debug("Build Solana target")
78
77
  build_start = time.perf_counter()
79
78
 
80
- Ctx.build_rust_app(context)
79
+ build_rust_app(context)
81
80
  build_end = time.perf_counter()
82
81
  timings["buildTime"] = round(build_end - build_start, 4)
83
82
  if context.test == str(Util.TestValue.AFTER_BUILD):
@@ -1,6 +1,11 @@
1
1
  #!/usr/bin/env python3
2
2
 
3
3
  import sys
4
+ from pathlib import Path
5
+
6
+ scripts_dir_path = Path(__file__).parent.resolve() # containing directory
7
+ sys.path.insert(0, str(scripts_dir_path))
8
+
4
9
  import EVMVerifier.certoraContextAttributes as Attrs
5
10
  from certoraRun import run_certora, CertoraRunResult
6
11
  from typing import List, Optional
@@ -9,6 +14,8 @@ from typing import List, Optional
9
14
  def run_soroban_prover(args: List[str]) -> Optional[CertoraRunResult]:
10
15
  return run_certora(args, Attrs.SorobanProverAttributes)
11
16
 
17
+ def entry_point() -> None:
18
+ run_soroban_prover(sys.argv[1:])
12
19
 
13
20
  if __name__ == '__main__':
14
- run_soroban_prover(sys.argv[1:])
21
+ entry_point()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: certora-cli-alpha-master
3
- Version: 20241224.0.4.890155
3
+ Version: 20241224.12.18.798750
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 b29f53e. Build and Run scripts for executing the Certora Prover on Solidity smart contracts.
26
+ Commit 103751c. Build and Run scripts for executing the Certora Prover on Solidity smart contracts.
@@ -15,6 +15,7 @@ certora_cli/EVMVerifier/__init__.py
15
15
  certora_cli/EVMVerifier/certoraBuild.py
16
16
  certora_cli/EVMVerifier/certoraBuildCacheManager.py
17
17
  certora_cli/EVMVerifier/certoraBuildDataClasses.py
18
+ certora_cli/EVMVerifier/certoraBuildRust.py
18
19
  certora_cli/EVMVerifier/certoraCloudIO.py
19
20
  certora_cli/EVMVerifier/certoraCollectRunMetadata.py
20
21
  certora_cli/EVMVerifier/certoraCompilerParameters.py
@@ -1,5 +1,5 @@
1
1
  [console_scripts]
2
- certoraEVMProver = certora_cli.EVMVerifier.certoraEVMProver:entry_point
2
+ certoraEVMProver = certora_cli.certoraEVMProver:entry_point
3
3
  certoraEqCheck = certora_cli.certoraEqCheck:equiv_check_entry_point
4
4
  certoraMutate = certora_cli.certoraMutate:mutate_entry_point
5
5
  certoraRun = certora_cli.certoraRun:entry_point
@@ -0,0 +1 @@
1
+ {"name": "certora-cli-alpha-master", "tag": "", "branch": "master", "commit": "103751c", "timestamp": "20241224.12.18.798750", "version": "20241224.12.18.798750+103751c"}
@@ -3,11 +3,11 @@ import setuptools
3
3
 
4
4
  setuptools.setup(
5
5
  name="certora-cli-alpha-master",
6
- version="20241224.0.4.890155",
6
+ version="20241224.12.18.798750",
7
7
  author="Certora",
8
8
  author_email="support@certora.com",
9
9
  description="Runner for the Certora Prover",
10
- long_description="Commit b29f53e. Build and Run scripts for executing the Certora Prover on Solidity smart contracts.",
10
+ long_description="Commit 103751c. 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(),
@@ -25,7 +25,7 @@ setuptools.setup(
25
25
  "certoraEqCheck = certora_cli.certoraEqCheck:equiv_check_entry_point",
26
26
  "certoraSolanaProver = certora_cli.certoraSolanaProver:entry_point",
27
27
  "certoraSorobanProver = certora_cli.certoraSorobanProver:entry_point",
28
- "certoraEVMProver = certora_cli.EVMVerifier.certoraEVMProver:entry_point"
28
+ "certoraEVMProver = certora_cli.certoraEVMProver:entry_point"
29
29
  ]
30
30
  },
31
31
  python_requires='>=3.8',
@@ -1 +0,0 @@
1
- Commit b29f53e. Build and Run scripts for executing the Certora Prover on Solidity smart contracts.
@@ -1 +0,0 @@
1
- {"name": "certora-cli-alpha-master", "tag": "", "branch": "master", "commit": "b29f53e", "timestamp": "20241224.0.4.890155", "version": "20241224.0.4.890155+b29f53e"}