chikvdf 1.2.1__tar.gz → 1.2.3__tar.gz

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.
Files changed (261) hide show
  1. chikvdf-1.2.3/.github/actions/ensure-modern-clang/action.yml +94 -0
  2. chikvdf-1.2.3/.github/scripts/__init__.py +14 -0
  3. chikvdf-1.2.3/.github/scripts/dcr_fetch.py +556 -0
  4. chikvdf-1.2.3/.github/scripts/dcr_prompt.md +40 -0
  5. chikvdf-1.2.3/.github/scripts/dcr_verdict.py +180 -0
  6. {chikvdf-1.2.1 → chikvdf-1.2.3}/.github/workflows/build-client.yml +18 -10
  7. {chikvdf-1.2.1 → chikvdf-1.2.3}/.github/workflows/build.yml +42 -7
  8. {chikvdf-1.2.1 → chikvdf-1.2.3}/.github/workflows/codeql-analysis.yml +2 -2
  9. {chikvdf-1.2.1 → chikvdf-1.2.3}/.github/workflows/rust.yml +9 -1
  10. {chikvdf-1.2.1 → chikvdf-1.2.3}/.gitignore +2 -0
  11. {chikvdf-1.2.1 → chikvdf-1.2.3}/Cargo.lock +1 -1
  12. {chikvdf-1.2.1/chikvdf.egg-info → chikvdf-1.2.3}/PKG-INFO +79 -5
  13. {chikvdf-1.2.1 → chikvdf-1.2.3}/README.md +77 -3
  14. {chikvdf-1.2.1 → chikvdf-1.2.3}/README_ASIC.md +51 -14
  15. {chikvdf-1.2.1 → chikvdf-1.2.3/chikvdf.egg-info}/PKG-INFO +79 -5
  16. {chikvdf-1.2.1 → chikvdf-1.2.3}/chikvdf.egg-info/SOURCES.txt +11 -0
  17. {chikvdf-1.2.1 → chikvdf-1.2.3}/chikvdf.egg-info/scm_file_list.json +11 -0
  18. chikvdf-1.2.3/chikvdf.egg-info/scm_version.json +8 -0
  19. {chikvdf-1.2.1 → chikvdf-1.2.3}/rust_bindings/Cargo.toml +1 -1
  20. {chikvdf-1.2.1 → chikvdf-1.2.3}/scripts/get-libft4222.ps1 +31 -6
  21. {chikvdf-1.2.1 → chikvdf-1.2.3}/scripts/get-libft4222.sh +75 -25
  22. {chikvdf-1.2.1 → chikvdf-1.2.3}/setup.py +42 -3
  23. {chikvdf-1.2.1 → chikvdf-1.2.3}/src/CMakeLists.txt +37 -0
  24. {chikvdf-1.2.1 → chikvdf-1.2.3}/src/Makefile.vdf-client +19 -3
  25. chikvdf-1.2.3/src/hw/emu_ftdi_test.hpp +47 -0
  26. {chikvdf-1.2.1 → chikvdf-1.2.3}/src/hw/emu_funcs.cpp +69 -19
  27. {chikvdf-1.2.1 → chikvdf-1.2.3}/src/hw/emu_runner.cpp +45 -3
  28. chikvdf-1.2.3/src/hw/emu_runner.hpp +28 -0
  29. {chikvdf-1.2.1 → chikvdf-1.2.3}/src/hw/ftdi_driver.cpp +95 -449
  30. {chikvdf-1.2.1 → chikvdf-1.2.3}/src/hw/ftdi_driver.hpp +7 -3
  31. chikvdf-1.2.3/src/hw/ftdi_i2c.cpp +431 -0
  32. chikvdf-1.2.3/src/hw/ftdi_identity.hpp +52 -0
  33. chikvdf-1.2.3/src/hw/ftdi_identity_test.cpp +201 -0
  34. chikvdf-1.2.3/src/hw/hw_initialization.hpp +54 -0
  35. chikvdf-1.2.3/src/hw/hw_initialization_test.cpp +229 -0
  36. {chikvdf-1.2.1 → chikvdf-1.2.3}/src/hw/hw_interface.cpp +36 -24
  37. {chikvdf-1.2.1 → chikvdf-1.2.3}/src/hw/hw_interface.hpp +5 -1
  38. {chikvdf-1.2.1 → chikvdf-1.2.3}/src/hw/hw_vdf_client.cpp +18 -1
  39. {chikvdf-1.2.1 → chikvdf-1.2.3}/src/hw/vdf_driver.cpp +1 -1
  40. {chikvdf-1.2.1 → chikvdf-1.2.3}/src/hw/vdf_driver.hpp +3 -1
  41. chikvdf-1.2.3/src/verify_vdf_corpus.cpp +336 -0
  42. {chikvdf-1.2.1 → chikvdf-1.2.3}/tests/test_release_publish.sh +25 -0
  43. chikvdf-1.2.1/.github/scripts/__init__.py +0 -14
  44. chikvdf-1.2.1/chikvdf.egg-info/scm_version.json +0 -8
  45. chikvdf-1.2.1/src/hw/emu_runner.hpp +0 -4
  46. {chikvdf-1.2.1 → chikvdf-1.2.3}/.flake8 +0 -0
  47. {chikvdf-1.2.1 → chikvdf-1.2.3}/.github/actions/install-inno-setup/action.yml +0 -0
  48. {chikvdf-1.2.1 → chikvdf-1.2.3}/.github/actions/publish-github-release/action.yml +0 -0
  49. {chikvdf-1.2.1 → chikvdf-1.2.3}/.github/actions/publish-github-release/manifests/chikvdf.txt +0 -0
  50. {chikvdf-1.2.1 → chikvdf-1.2.3}/.github/actions/publish-github-release/manifests/chikvdfc.txt +0 -0
  51. {chikvdf-1.2.1 → chikvdf-1.2.3}/.github/actions/publish-github-release/publish.sh +0 -0
  52. {chikvdf-1.2.1 → chikvdf-1.2.3}/.github/actions/release-policy/action.yml +0 -0
  53. {chikvdf-1.2.1 → chikvdf-1.2.3}/.github/actions/release-policy/policy.sh +0 -0
  54. {chikvdf-1.2.1 → chikvdf-1.2.3}/.github/scripts/check_node_runtime.sh +0 -0
  55. {chikvdf-1.2.1 → chikvdf-1.2.3}/.github/workflows/build-c-libraries.yml +0 -0
  56. {chikvdf-1.2.1 → chikvdf-1.2.3}/.github/workflows/build-packages.yml +0 -0
  57. {chikvdf-1.2.1 → chikvdf-1.2.3}/.github/workflows/build-riscv64.yml +0 -0
  58. {chikvdf-1.2.1 → chikvdf-1.2.3}/Cargo.toml +0 -0
  59. {chikvdf-1.2.1 → chikvdf-1.2.3}/LICENSE +0 -0
  60. {chikvdf-1.2.1 → chikvdf-1.2.3}/README_AVX512.md +0 -0
  61. {chikvdf-1.2.1 → chikvdf-1.2.3}/README_BACKGROUND_COMPETITION.md +0 -0
  62. {chikvdf-1.2.1 → chikvdf-1.2.3}/SECURITY.md +0 -0
  63. {chikvdf-1.2.1 → chikvdf-1.2.3}/assets/deb/control.j2 +0 -0
  64. {chikvdf-1.2.1 → chikvdf-1.2.3}/assets/macos-release-bundle.md +0 -0
  65. {chikvdf-1.2.1 → chikvdf-1.2.3}/assets/windows-installer.md +0 -0
  66. {chikvdf-1.2.1 → chikvdf-1.2.3}/assets/windows-release-signing.md +0 -0
  67. {chikvdf-1.2.1 → chikvdf-1.2.3}/chikvdf/__init__.py +0 -0
  68. {chikvdf-1.2.1 → chikvdf-1.2.3}/chikvdf/__init__.pyi +0 -0
  69. {chikvdf-1.2.1 → chikvdf-1.2.3}/chikvdf/py.typed +0 -0
  70. {chikvdf-1.2.1 → chikvdf-1.2.3}/chikvdf.egg-info/dependency_links.txt +0 -0
  71. {chikvdf-1.2.1 → chikvdf-1.2.3}/chikvdf.egg-info/not-zip-safe +0 -0
  72. {chikvdf-1.2.1 → chikvdf-1.2.3}/chikvdf.egg-info/top_level.txt +0 -0
  73. {chikvdf-1.2.1 → chikvdf-1.2.3}/classgroups.pdf +0 -0
  74. {chikvdf-1.2.1 → chikvdf-1.2.3}/comparenweso.py +0 -0
  75. {chikvdf-1.2.1 → chikvdf-1.2.3}/installer/windows/chikvdf.iss +0 -0
  76. {chikvdf-1.2.1 → chikvdf-1.2.3}/lgtm.yml +0 -0
  77. {chikvdf-1.2.1 → chikvdf-1.2.3}/mypi.ini +0 -0
  78. {chikvdf-1.2.1 → chikvdf-1.2.3}/pyproject.toml +0 -0
  79. {chikvdf-1.2.1 → chikvdf-1.2.3}/rust_bindings/build.rs +0 -0
  80. {chikvdf-1.2.1 → chikvdf-1.2.3}/rust_bindings/fuzz/.gitignore +0 -0
  81. {chikvdf-1.2.1 → chikvdf-1.2.3}/rust_bindings/fuzz/Cargo.toml +0 -0
  82. {chikvdf-1.2.1 → chikvdf-1.2.3}/rust_bindings/fuzz/fuzz_targets/create_discriminant.rs +0 -0
  83. {chikvdf-1.2.1 → chikvdf-1.2.3}/rust_bindings/fuzz/fuzz_targets/prove.rs +0 -0
  84. {chikvdf-1.2.1 → chikvdf-1.2.3}/rust_bindings/fuzz/fuzz_targets/verify.rs +0 -0
  85. {chikvdf-1.2.1 → chikvdf-1.2.3}/rust_bindings/fuzz/fuzz_targets/verify_n_wesolowski.rs +0 -0
  86. {chikvdf-1.2.1 → chikvdf-1.2.3}/rust_bindings/src/lib.rs +0 -0
  87. {chikvdf-1.2.1 → chikvdf-1.2.3}/rust_bindings/wrapper.h +0 -0
  88. {chikvdf-1.2.1 → chikvdf-1.2.3}/scripts/build-macos-gmp.sh +0 -0
  89. {chikvdf-1.2.1 → chikvdf-1.2.3}/scripts/check-macos-gmp-build.sh +0 -0
  90. {chikvdf-1.2.1 → chikvdf-1.2.3}/scripts/get-mpir-gc-x64.sh +0 -0
  91. {chikvdf-1.2.1 → chikvdf-1.2.3}/scripts/macos-bundle-tools.sh +0 -0
  92. {chikvdf-1.2.1 → chikvdf-1.2.3}/scripts/macos-gmp-release.sh +0 -0
  93. {chikvdf-1.2.1 → chikvdf-1.2.3}/scripts/macos-install-names.sh +0 -0
  94. {chikvdf-1.2.1 → chikvdf-1.2.3}/scripts/mpir_gc_x64.commit +0 -0
  95. {chikvdf-1.2.1 → chikvdf-1.2.3}/scripts/package-macos-bundle.sh +0 -0
  96. {chikvdf-1.2.1 → chikvdf-1.2.3}/scripts/package-macos-pkg.sh +0 -0
  97. {chikvdf-1.2.1 → chikvdf-1.2.3}/scripts/package-windows-bundle.ps1 +0 -0
  98. {chikvdf-1.2.1 → chikvdf-1.2.3}/scripts/select-macos-signing-identities.sh +0 -0
  99. {chikvdf-1.2.1 → chikvdf-1.2.3}/scripts/sign-windows-file.ps1 +0 -0
  100. {chikvdf-1.2.1 → chikvdf-1.2.3}/scripts/stage-macos-bundle-dylibs.sh +0 -0
  101. {chikvdf-1.2.1 → chikvdf-1.2.3}/scripts/verify-macos-bundle.sh +0 -0
  102. {chikvdf-1.2.1 → chikvdf-1.2.3}/scripts/windows-ftdi-driver.ps1 +0 -0
  103. {chikvdf-1.2.1 → chikvdf-1.2.3}/scripts/windows-installer.ps1 +0 -0
  104. {chikvdf-1.2.1 → chikvdf-1.2.3}/scripts/windows-pe.ps1 +0 -0
  105. {chikvdf-1.2.1 → chikvdf-1.2.3}/setup.cfg +0 -0
  106. {chikvdf-1.2.1 → chikvdf-1.2.3}/src/1weso_test.cpp +0 -0
  107. {chikvdf-1.2.1 → chikvdf-1.2.3}/src/2weso_test.cpp +0 -0
  108. {chikvdf-1.2.1 → chikvdf-1.2.3}/src/ClassGroup.h +0 -0
  109. {chikvdf-1.2.1 → chikvdf-1.2.3}/src/Reducer.h +0 -0
  110. {chikvdf-1.2.1 → chikvdf-1.2.3}/src/alloc.hpp +0 -0
  111. {chikvdf-1.2.1 → chikvdf-1.2.3}/src/asm_avx512_ifma.h +0 -0
  112. {chikvdf-1.2.1 → chikvdf-1.2.3}/src/asm_base.h +0 -0
  113. {chikvdf-1.2.1 → chikvdf-1.2.3}/src/asm_gcd_128.h +0 -0
  114. {chikvdf-1.2.1 → chikvdf-1.2.3}/src/asm_gcd_base_continued_fractions.h +0 -0
  115. {chikvdf-1.2.1 → chikvdf-1.2.3}/src/asm_gcd_base_divide_table.h +0 -0
  116. {chikvdf-1.2.1 → chikvdf-1.2.3}/src/asm_gcd_unsigned.h +0 -0
  117. {chikvdf-1.2.1 → chikvdf-1.2.3}/src/asm_main.h +0 -0
  118. {chikvdf-1.2.1 → chikvdf-1.2.3}/src/asm_types.h +0 -0
  119. {chikvdf-1.2.1 → chikvdf-1.2.3}/src/asm_vm.h +0 -0
  120. {chikvdf-1.2.1 → chikvdf-1.2.3}/src/avx512_integer.h +0 -0
  121. {chikvdf-1.2.1 → chikvdf-1.2.3}/src/avx512_test.cpp +0 -0
  122. {chikvdf-1.2.1 → chikvdf-1.2.3}/src/bit_manipulation.h +0 -0
  123. {chikvdf-1.2.1 → chikvdf-1.2.3}/src/bqfc.c +0 -0
  124. {chikvdf-1.2.1 → chikvdf-1.2.3}/src/bqfc.h +0 -0
  125. {chikvdf-1.2.1 → chikvdf-1.2.3}/src/c_bindings/c_wrapper.cpp +0 -0
  126. {chikvdf-1.2.1 → chikvdf-1.2.3}/src/c_bindings/c_wrapper.h +0 -0
  127. {chikvdf-1.2.1 → chikvdf-1.2.3}/src/c_bindings/readme.md +0 -0
  128. {chikvdf-1.2.1 → chikvdf-1.2.3}/src/callback.h +0 -0
  129. {chikvdf-1.2.1 → chikvdf-1.2.3}/src/checked_cast.h +0 -0
  130. {chikvdf-1.2.1 → chikvdf-1.2.3}/src/checked_cast_test.cpp +0 -0
  131. {chikvdf-1.2.1 → chikvdf-1.2.3}/src/chikvdf_profile.h +0 -0
  132. {chikvdf-1.2.1 → chikvdf-1.2.3}/src/cmake/FindGMP.cmake +0 -0
  133. {chikvdf-1.2.1 → chikvdf-1.2.3}/src/cmake/FindGMPXX.cmake +0 -0
  134. {chikvdf-1.2.1 → chikvdf-1.2.3}/src/compile_asm.cpp +0 -0
  135. {chikvdf-1.2.1 → chikvdf-1.2.3}/src/create_discriminant.h +0 -0
  136. {chikvdf-1.2.1 → chikvdf-1.2.3}/src/discriminant_bounds_regression_test.cpp +0 -0
  137. {chikvdf-1.2.1 → chikvdf-1.2.3}/src/double_utility.h +0 -0
  138. {chikvdf-1.2.1 → chikvdf-1.2.3}/src/fast_storage.h +0 -0
  139. {chikvdf-1.2.1 → chikvdf-1.2.3}/src/fastpow_nucomp_regression_test.cpp +0 -0
  140. {chikvdf-1.2.1 → chikvdf-1.2.3}/src/gcd_128.h +0 -0
  141. {chikvdf-1.2.1 → chikvdf-1.2.3}/src/gcd_base_continued_fractions.h +0 -0
  142. {chikvdf-1.2.1 → chikvdf-1.2.3}/src/gcd_base_divide_table.h +0 -0
  143. {chikvdf-1.2.1 → chikvdf-1.2.3}/src/gcd_unsigned.h +0 -0
  144. {chikvdf-1.2.1 → chikvdf-1.2.3}/src/generic.h +0 -0
  145. {chikvdf-1.2.1 → chikvdf-1.2.3}/src/generic_macros.h +0 -0
  146. {chikvdf-1.2.1 → chikvdf-1.2.3}/src/gpu_integer.h +0 -0
  147. {chikvdf-1.2.1 → chikvdf-1.2.3}/src/gpu_integer_divide.h +0 -0
  148. {chikvdf-1.2.1 → chikvdf-1.2.3}/src/gpu_integer_gcd.h +0 -0
  149. {chikvdf-1.2.1 → chikvdf-1.2.3}/src/hw/chik_driver.cpp +0 -0
  150. {chikvdf-1.2.1 → chikvdf-1.2.3}/src/hw/chik_driver.hpp +0 -0
  151. {chikvdf-1.2.1 → chikvdf-1.2.3}/src/hw/chik_registers.hpp +0 -0
  152. {chikvdf-1.2.1 → chikvdf-1.2.3}/src/hw/clock.hpp +0 -0
  153. {chikvdf-1.2.1 → chikvdf-1.2.3}/src/hw/hw_client_control_test.cpp +0 -0
  154. {chikvdf-1.2.1 → chikvdf-1.2.3}/src/hw/hw_client_loop_test.cpp +0 -0
  155. {chikvdf-1.2.1 → chikvdf-1.2.3}/src/hw/hw_live_control.cpp +0 -0
  156. {chikvdf-1.2.1 → chikvdf-1.2.3}/src/hw/hw_live_control.hpp +0 -0
  157. {chikvdf-1.2.1 → chikvdf-1.2.3}/src/hw/hw_proof.cpp +0 -0
  158. {chikvdf-1.2.1 → chikvdf-1.2.3}/src/hw/hw_proof.hpp +0 -0
  159. {chikvdf-1.2.1 → chikvdf-1.2.3}/src/hw/hw_proof_fill.cpp +0 -0
  160. {chikvdf-1.2.1 → chikvdf-1.2.3}/src/hw/hw_proof_fill_test.cpp +0 -0
  161. {chikvdf-1.2.1 → chikvdf-1.2.3}/src/hw/hw_proof_internal.hpp +0 -0
  162. {chikvdf-1.2.1 → chikvdf-1.2.3}/src/hw/hw_proof_queue.cpp +0 -0
  163. {chikvdf-1.2.1 → chikvdf-1.2.3}/src/hw/hw_proof_segment_threads_test.cpp +0 -0
  164. {chikvdf-1.2.1 → chikvdf-1.2.3}/src/hw/hw_proof_wait_test.cpp +0 -0
  165. {chikvdf-1.2.1 → chikvdf-1.2.3}/src/hw/hw_test.cpp +0 -0
  166. {chikvdf-1.2.1 → chikvdf-1.2.3}/src/hw/hw_timelord_frame.cpp +0 -0
  167. {chikvdf-1.2.1 → chikvdf-1.2.3}/src/hw/hw_util.cpp +0 -0
  168. {chikvdf-1.2.1 → chikvdf-1.2.3}/src/hw/hw_util.hpp +0 -0
  169. {chikvdf-1.2.1 → chikvdf-1.2.3}/src/hw/pll_freqs.cpp +0 -0
  170. {chikvdf-1.2.1 → chikvdf-1.2.3}/src/hw/pll_freqs.hpp +0 -0
  171. {chikvdf-1.2.1 → chikvdf-1.2.3}/src/hw/pvt.hpp +0 -0
  172. {chikvdf-1.2.1 → chikvdf-1.2.3}/src/hw/real_hw.cpp +0 -0
  173. {chikvdf-1.2.1 → chikvdf-1.2.3}/src/hw/timelord_live_control.cpp +0 -0
  174. {chikvdf-1.2.1 → chikvdf-1.2.3}/src/hw/timelord_live_control.hpp +0 -0
  175. {chikvdf-1.2.1 → chikvdf-1.2.3}/src/hw/timelord_telemetry.hpp +0 -0
  176. {chikvdf-1.2.1 → chikvdf-1.2.3}/src/include.h +0 -0
  177. {chikvdf-1.2.1 → chikvdf-1.2.3}/src/integer.h +0 -0
  178. {chikvdf-1.2.1 → chikvdf-1.2.3}/src/integer_common.h +0 -0
  179. {chikvdf-1.2.1 → chikvdf-1.2.3}/src/lib/gmp-6.2.1.diff +0 -0
  180. {chikvdf-1.2.1 → chikvdf-1.2.3}/src/lib/gmp-6.3.0.diff +0 -0
  181. {chikvdf-1.2.1 → chikvdf-1.2.3}/src/nucomp.h +0 -0
  182. {chikvdf-1.2.1 → chikvdf-1.2.3}/src/nucomp_phases.h +0 -0
  183. {chikvdf-1.2.1 → chikvdf-1.2.3}/src/nucomp_scratch_regression_test.cpp +0 -0
  184. {chikvdf-1.2.1 → chikvdf-1.2.3}/src/nudupl_listener.h +0 -0
  185. {chikvdf-1.2.1 → chikvdf-1.2.3}/src/pair_kernels.cpp +0 -0
  186. {chikvdf-1.2.1 → chikvdf-1.2.3}/src/pair_kernels.h +0 -0
  187. {chikvdf-1.2.1 → chikvdf-1.2.3}/src/pair_kernels_config.h +0 -0
  188. {chikvdf-1.2.1 → chikvdf-1.2.3}/src/pair_kernels_regression_test.cpp +0 -0
  189. {chikvdf-1.2.1 → chikvdf-1.2.3}/src/parallel_prover_witness_test.cpp +0 -0
  190. {chikvdf-1.2.1 → chikvdf-1.2.3}/src/parameters.h +0 -0
  191. {chikvdf-1.2.1 → chikvdf-1.2.3}/src/picosha2.h +0 -0
  192. {chikvdf-1.2.1 → chikvdf-1.2.3}/src/pprods.h +0 -0
  193. {chikvdf-1.2.1 → chikvdf-1.2.3}/src/primetest.h +0 -0
  194. {chikvdf-1.2.1 → chikvdf-1.2.3}/src/primetest_regression_test.cpp +0 -0
  195. {chikvdf-1.2.1 → chikvdf-1.2.3}/src/proof_arithmetic_regression_test.cpp +0 -0
  196. {chikvdf-1.2.1 → chikvdf-1.2.3}/src/proof_block_cache.hpp +0 -0
  197. {chikvdf-1.2.1 → chikvdf-1.2.3}/src/proof_block_cache_regression_test.cpp +0 -0
  198. {chikvdf-1.2.1 → chikvdf-1.2.3}/src/proof_common.h +0 -0
  199. {chikvdf-1.2.1 → chikvdf-1.2.3}/src/proof_deserialization_regression_test.cpp +0 -0
  200. {chikvdf-1.2.1 → chikvdf-1.2.3}/src/prover.hpp +0 -0
  201. {chikvdf-1.2.1 → chikvdf-1.2.3}/src/prover_base.hpp +0 -0
  202. {chikvdf-1.2.1 → chikvdf-1.2.3}/src/prover_impl.hpp +0 -0
  203. {chikvdf-1.2.1 → chikvdf-1.2.3}/src/prover_interface.hpp +0 -0
  204. {chikvdf-1.2.1 → chikvdf-1.2.3}/src/prover_parallel.hpp +0 -0
  205. {chikvdf-1.2.1 → chikvdf-1.2.3}/src/prover_runtime.cpp +0 -0
  206. {chikvdf-1.2.1 → chikvdf-1.2.3}/src/prover_slow.h +0 -0
  207. {chikvdf-1.2.1 → chikvdf-1.2.3}/src/prover_slow_regression_test.cpp +0 -0
  208. {chikvdf-1.2.1 → chikvdf-1.2.3}/src/prover_test.cpp +0 -0
  209. {chikvdf-1.2.1 → chikvdf-1.2.3}/src/provers.h +0 -0
  210. {chikvdf-1.2.1 → chikvdf-1.2.3}/src/python_bindings/fastvdf.cpp +0 -0
  211. {chikvdf-1.2.1 → chikvdf-1.2.3}/src/refcode/README.md +0 -0
  212. {chikvdf-1.2.1 → chikvdf-1.2.3}/src/refcode/lzcnt.c +0 -0
  213. {chikvdf-1.2.1 → chikvdf-1.2.3}/src/reference_golden.h +0 -0
  214. {chikvdf-1.2.1 → chikvdf-1.2.3}/src/reference_golden_regression_test.cpp +0 -0
  215. {chikvdf-1.2.1 → chikvdf-1.2.3}/src/regression_unit_tests.cpp +0 -0
  216. {chikvdf-1.2.1 → chikvdf-1.2.3}/src/stress_test.cpp +0 -0
  217. {chikvdf-1.2.1 → chikvdf-1.2.3}/src/threading.h +0 -0
  218. {chikvdf-1.2.1 → chikvdf-1.2.3}/src/tl_emu.py +0 -0
  219. {chikvdf-1.2.1 → chikvdf-1.2.3}/src/two_weso_callback_regression_test.cpp +0 -0
  220. {chikvdf-1.2.1 → chikvdf-1.2.3}/src/uint128_t/LICENSE +0 -0
  221. {chikvdf-1.2.1 → chikvdf-1.2.3}/src/uint128_t/README.md +0 -0
  222. {chikvdf-1.2.1 → chikvdf-1.2.3}/src/uint128_t/uint128_t.build +0 -0
  223. {chikvdf-1.2.1 → chikvdf-1.2.3}/src/uint128_t/uint128_t.cpp +0 -0
  224. {chikvdf-1.2.1 → chikvdf-1.2.3}/src/uint128_t/uint128_t.h +0 -0
  225. {chikvdf-1.2.1 → chikvdf-1.2.3}/src/uint128_t/uint128_t.include +0 -0
  226. {chikvdf-1.2.1 → chikvdf-1.2.3}/src/uint128_t/uint128_t_config.include +0 -0
  227. {chikvdf-1.2.1 → chikvdf-1.2.3}/src/util.h +0 -0
  228. {chikvdf-1.2.1 → chikvdf-1.2.3}/src/vdf.h +0 -0
  229. {chikvdf-1.2.1 → chikvdf-1.2.3}/src/vdf.txt +0 -0
  230. {chikvdf-1.2.1 → chikvdf-1.2.3}/src/vdf_base.cpp +0 -0
  231. {chikvdf-1.2.1 → chikvdf-1.2.3}/src/vdf_base.hpp +0 -0
  232. {chikvdf-1.2.1 → chikvdf-1.2.3}/src/vdf_base_hw.cpp +0 -0
  233. {chikvdf-1.2.1 → chikvdf-1.2.3}/src/vdf_bench.cpp +0 -0
  234. {chikvdf-1.2.1 → chikvdf-1.2.3}/src/vdf_client.cpp +0 -0
  235. {chikvdf-1.2.1 → chikvdf-1.2.3}/src/vdf_client_session.h +0 -0
  236. {chikvdf-1.2.1 → chikvdf-1.2.3}/src/vdf_client_session_test.cpp +0 -0
  237. {chikvdf-1.2.1 → chikvdf-1.2.3}/src/vdf_fast.h +0 -0
  238. {chikvdf-1.2.1 → chikvdf-1.2.3}/src/vdf_hw_symbol_anchors.cpp +0 -0
  239. {chikvdf-1.2.1 → chikvdf-1.2.3}/src/vdf_new.h +0 -0
  240. {chikvdf-1.2.1 → chikvdf-1.2.3}/src/vdf_original.h +0 -0
  241. {chikvdf-1.2.1 → chikvdf-1.2.3}/src/vdf_test.cpp +0 -0
  242. {chikvdf-1.2.1 → chikvdf-1.2.3}/src/vdf_test.h +0 -0
  243. {chikvdf-1.2.1 → chikvdf-1.2.3}/src/verifier.h +0 -0
  244. {chikvdf-1.2.1 → chikvdf-1.2.3}/src/verifier_test.cpp +0 -0
  245. {chikvdf-1.2.1 → chikvdf-1.2.3}/src/version.hpp +0 -0
  246. {chikvdf-1.2.1 → chikvdf-1.2.3}/src/xgcd_lehmer_step.h +0 -0
  247. {chikvdf-1.2.1 → chikvdf-1.2.3}/src/xgcd_partial.c +0 -0
  248. {chikvdf-1.2.1 → chikvdf-1.2.3}/src/xgcd_partial.h +0 -0
  249. {chikvdf-1.2.1 → chikvdf-1.2.3}/tests/test_bqfc_deserialize.py +0 -0
  250. {chikvdf-1.2.1 → chikvdf-1.2.3}/tests/test_discriminant_validation.py +0 -0
  251. {chikvdf-1.2.1 → chikvdf-1.2.3}/tests/test_macos_bundle_dylibs.sh +0 -0
  252. {chikvdf-1.2.1 → chikvdf-1.2.3}/tests/test_macos_bundle_plan.sh +0 -0
  253. {chikvdf-1.2.1 → chikvdf-1.2.3}/tests/test_macos_gmp_build.sh +0 -0
  254. {chikvdf-1.2.1 → chikvdf-1.2.3}/tests/test_macos_pkg.sh +0 -0
  255. {chikvdf-1.2.1 → chikvdf-1.2.3}/tests/test_macos_select_signing_identities.sh +0 -0
  256. {chikvdf-1.2.1 → chikvdf-1.2.3}/tests/test_n_weso_verifier.py +0 -0
  257. {chikvdf-1.2.1 → chikvdf-1.2.3}/tests/test_prove_low_memory.py +0 -0
  258. {chikvdf-1.2.1 → chikvdf-1.2.3}/tests/test_prove_num_iterations.py +0 -0
  259. {chikvdf-1.2.1 → chikvdf-1.2.3}/tests/test_verifier.py +0 -0
  260. {chikvdf-1.2.1 → chikvdf-1.2.3}/tests/test_windows_installer_version.ps1 +0 -0
  261. {chikvdf-1.2.1 → chikvdf-1.2.3}/tools/gen_pprods.py +0 -0
@@ -0,0 +1,94 @@
1
+ name: Ensure a modern LLVM (Windows)
2
+ description: >
3
+ windows-latest now ships Visual Studio 18 (2026) with MSVC 14.52, whose STL
4
+ headers refuse any Clang older than 22 with "error STL1000". The image's
5
+ standalone LLVM can be older than that, which breaks both clang-cl compiling
6
+ against the MSVC STL and bindgen parsing it through libclang. Select the newest
7
+ available LLVM, install a current one when none is new enough, then export PATH
8
+ for clang-cl and LIBCLANG_PATH for bindgen.
9
+ inputs:
10
+ minimum-major:
11
+ description: Minimum acceptable Clang major version.
12
+ required: false
13
+ default: "22"
14
+ outputs:
15
+ llvm-bin:
16
+ description: Directory that was prepended to PATH.
17
+ value: ${{ steps.select.outputs.llvm-bin }}
18
+ clang-major:
19
+ description: Major version of the selected Clang.
20
+ value: ${{ steps.select.outputs.clang-major }}
21
+ runs:
22
+ using: composite
23
+ steps:
24
+ - id: select
25
+ shell: pwsh
26
+ env:
27
+ MIN_MAJOR: ${{ inputs.minimum-major }}
28
+ run: |
29
+ $ErrorActionPreference = 'Stop'
30
+ $min = [int]$env:MIN_MAJOR
31
+ $candidates = @(
32
+ 'C:\Program Files\LLVM\bin',
33
+ 'C:\Program Files\Microsoft Visual Studio\18\Enterprise\VC\Tools\Llvm\x64\bin',
34
+ 'C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\Llvm\x64\bin'
35
+ )
36
+
37
+ function Get-ClangMajor([string]$dir) {
38
+ foreach ($name in @('clang-cl.exe', 'clang.exe')) {
39
+ $exe = Join-Path $dir $name
40
+ if (Test-Path -LiteralPath $exe) {
41
+ $text = (& $exe --version 2>&1 | Select-Object -First 1)
42
+ Write-Host (" {0} -> {1}" -f $dir, $text)
43
+ if ($text -match 'clang version (\d+)\.') { return [int]$Matches[1] }
44
+ return -1
45
+ }
46
+ }
47
+ Write-Host " $dir -> not present"
48
+ return -1
49
+ }
50
+
51
+ function Select-Best {
52
+ $bestDir = $null
53
+ $bestMajor = -1
54
+ foreach ($dir in $candidates) {
55
+ $major = Get-ClangMajor $dir
56
+ if ($major -gt $bestMajor) {
57
+ $bestMajor = $major
58
+ $bestDir = $dir
59
+ }
60
+ }
61
+ return @($bestDir, $bestMajor)
62
+ }
63
+
64
+ Write-Host 'available LLVM candidates:'
65
+ $sel = Select-Best
66
+ $bestDir = $sel[0]
67
+ $bestMajor = $sel[1]
68
+
69
+ if ($bestMajor -lt $min) {
70
+ Write-Host "newest LLVM on this image is $bestMajor (< $min); installing a current LLVM"
71
+ choco install llvm -y --force --no-progress
72
+ if ($LASTEXITCODE -ne 0) {
73
+ throw "choco install llvm failed with exit code $LASTEXITCODE"
74
+ }
75
+ Write-Host 'available LLVM candidates after install:'
76
+ $sel = Select-Best
77
+ $bestDir = $sel[0]
78
+ $bestMajor = $sel[1]
79
+ }
80
+
81
+ if (-not $bestDir -or $bestMajor -lt $min) {
82
+ throw "No LLVM >= $min is available (best: $bestMajor at $bestDir). MSVC 14.52 refuses any older Clang (error STL1000)."
83
+ }
84
+
85
+ $libclang = Join-Path $bestDir 'libclang.dll'
86
+ if (-not (Test-Path -LiteralPath $libclang)) {
87
+ throw "libclang.dll is missing in $bestDir; bindgen cannot run without it."
88
+ }
89
+
90
+ $bestDir | Out-File -Append -FilePath $env:GITHUB_PATH
91
+ "LIBCLANG_PATH=$bestDir" | Out-File -Append -FilePath $env:GITHUB_ENV
92
+ "llvm-bin=$bestDir" | Out-File -Append -FilePath $env:GITHUB_OUTPUT
93
+ "clang-major=$bestMajor" | Out-File -Append -FilePath $env:GITHUB_OUTPUT
94
+ Write-Host "selected clang $bestMajor from $bestDir"
@@ -0,0 +1,14 @@
1
+ """Mark `.github/scripts` as a package for consumer linters.
2
+
3
+ Ruff INP001 flags non-shebang modules in a directory without `__init__.py`.
4
+ chik-blockchain selects that rule. This file is synced to
5
+ `.github/scripts/__init__.py`.
6
+
7
+ Entry points put their own directory on sys.path and import siblings as
8
+ top-level modules, so this file is never imported. `.github` is not a
9
+ Python identifier, so the directory is not a nested package of the
10
+ consumer repository root. Unittest discovery in this repository reads
11
+ `github_scripts_init.py`, not an `__init__.py` beside the canonical modules.
12
+ """
13
+
14
+ from __future__ import annotations
@@ -0,0 +1,556 @@
1
+ """Fetch old and new dependency artifacts and write a review bundle."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import json
6
+ import os
7
+ import re
8
+ import shlex
9
+ import shutil
10
+ import subprocess
11
+ import tarfile
12
+ import tempfile
13
+ import urllib.parse
14
+ import zipfile
15
+ from collections import Counter
16
+ from dataclasses import asdict, dataclass, replace
17
+ from pathlib import Path, PurePosixPath
18
+ from urllib.request import urlopen
19
+
20
+ SAFE = re.compile(r"^[A-Za-z0-9@][A-Za-z0-9@._/~+-]{0,299}$")
21
+ ACTION_SHA = re.compile(r"^[0-9a-f]{40}$")
22
+ ACTION_TAG = r"v[0-9]+(?:\.[0-9]+){0,2}"
23
+ FULL_TAG = re.compile(r"^v[0-9]+\.[0-9]+\.[0-9]+$")
24
+ ECOSYSTEM_ALIASES = {"go_modules": "gomod"}
25
+ UPDATE_FIELDS = ("dependencyName", "packageEcosystem", "newVersion", "prevVersion")
26
+
27
+
28
+ class FetchError(Exception):
29
+ pass
30
+
31
+
32
+ @dataclass(frozen=True)
33
+ class Update:
34
+ name: str
35
+ ecosystem: str
36
+ directory: str
37
+ prev_version: str
38
+ new_version: str
39
+ status: str = "reviewed"
40
+ note: str = ""
41
+ prev_commit: str = ""
42
+ new_commit: str = ""
43
+ prev_artifact: str = ""
44
+ new_artifact: str = ""
45
+
46
+
47
+ def added_lines(diff: str) -> list[str]:
48
+ return [line[1:] for line in diff.split("\n") if line.startswith("+") and not line.startswith("+++ ")]
49
+
50
+
51
+ def _norm(value: str) -> str:
52
+ return re.sub(r"[-_.]+", "-", value).lower()
53
+
54
+
55
+ def literal_ok(update: Update, added: list[str]) -> bool:
56
+ version = re.compile(rf"(?<![0-9A-Za-z.]){re.escape(update.new_version)}(?![0-9A-Za-z]|\.[0-9])")
57
+ return any(_norm(update.name) in _norm(line) and version.search(line) for line in added)
58
+
59
+
60
+ def _parse_updates(raw: str) -> list[Update]:
61
+ if not raw.strip():
62
+ raise SystemExit("updated-dependencies-json is empty; fetch-metadata did not run or no input was given")
63
+ try:
64
+ payload = json.loads(raw)
65
+ except json.JSONDecodeError as exc:
66
+ raise SystemExit("updated-dependencies-json is not valid JSON") from exc
67
+ if not isinstance(payload, list):
68
+ raise SystemExit("updated-dependencies-json must be a list")
69
+ updates: list[Update] = []
70
+ for item in payload:
71
+ values = [item.get(key) if isinstance(item, dict) else None for key in UPDATE_FIELDS]
72
+ if not all(isinstance(v, str) and v for v in values[:3]) or not isinstance(values[3] or "", str):
73
+ raise SystemExit("updated dependency is missing a required field")
74
+ directory = entry if isinstance(entry := item.get("directory", ""), str) else ""
75
+ name, ecosystem, new_version, prev_version = values
76
+ prev_version = prev_version if isinstance(prev_version, str) else ""
77
+ update = Update(name, ECOSYSTEM_ALIASES.get(ecosystem, ecosystem), directory, prev_version, new_version)
78
+ updates.append(_normalize_versions(update))
79
+ return updates
80
+
81
+
82
+ def _normalize_versions(update: Update) -> Update:
83
+ if update.ecosystem != "gomod":
84
+ return update
85
+ versions = [v if not v or v.startswith("v") else f"v{v}" for v in (update.prev_version, update.new_version)]
86
+ return replace(update, prev_version=versions[0], new_version=versions[1])
87
+
88
+
89
+ def _run(args: list[str], *, cwd: Path, text: bool = True, ok: tuple[int, ...] = (0,)) -> subprocess.CompletedProcess:
90
+ try:
91
+ proc = subprocess.run(args, cwd=cwd, check=False, capture_output=True, text=text, timeout=120)
92
+ except (OSError, subprocess.TimeoutExpired) as exc:
93
+ raise FetchError(f"{args[0]} could not run: {exc}") from exc
94
+ if proc.returncode not in ok:
95
+ detail = proc.stderr if isinstance(proc.stderr, str) else proc.stderr.decode("utf-8", "replace")
96
+ raise FetchError(f"{args[0]} exited {proc.returncode}: {detail.strip()[:500]}")
97
+ return proc
98
+
99
+
100
+ def _read_url(url: str) -> bytes:
101
+ try:
102
+ with urlopen(url, timeout=120) as response: # noqa: S310 # ruff: ignore[noqa-comments]
103
+ return response.read()
104
+ except (OSError, ValueError) as exc:
105
+ raise FetchError(f"download failed: {exc}") from exc
106
+
107
+
108
+ def fetch_npm(work: Path, name: str, version: str) -> Path:
109
+ _run(["npm", "pack", "--ignore-scripts", f"{name}@{version}"], cwd=work)
110
+ archives = sorted(work.glob("*.tgz"))
111
+ if len(archives) != 1 or not archives[0].name.endswith(f"-{version}.tgz"):
112
+ raise FetchError("npm pack did not produce the requested version")
113
+ return archives[0]
114
+
115
+
116
+ def fetch_pypi(work: Path, name: str, version: str) -> Path:
117
+ endpoint = f"https://pypi.org/pypi/{urllib.parse.quote(name, safe='')}/{urllib.parse.quote(version, safe='')}/json"
118
+ try:
119
+ payload = json.loads(_read_url(endpoint))
120
+ except json.JSONDecodeError as exc:
121
+ raise FetchError("PyPI JSON could not be parsed") from exc
122
+ files = payload.get("urls") if isinstance(payload, dict) else None
123
+ if not isinstance(files, list):
124
+ raise FetchError("PyPI response has no file list")
125
+ usable = [item for item in files if isinstance(item, dict) and isinstance(item.get("url"), str)]
126
+ sdists = [item for item in usable if item.get("packagetype") == "sdist"]
127
+ wheels = [item for item in usable if item.get("packagetype") == "bdist_wheel"]
128
+ selected = (
129
+ sdists or [i for i in wheels if str(i.get("filename", "")).endswith("py3-none-any.whl")] or wheels or [None]
130
+ )[0]
131
+ if selected is None:
132
+ raise FetchError("PyPI response has no sdist or wheel")
133
+ filename = PurePosixPath(str(selected.get("filename", ""))).name
134
+ if not filename or filename in {".", ".."}:
135
+ raise FetchError("PyPI distribution has an unsafe filename")
136
+ path = work / filename
137
+ path.write_bytes(_read_url(selected["url"]))
138
+ return path
139
+
140
+
141
+ def fetch_gomod(work: Path, name: str, version: str) -> Path:
142
+ try:
143
+ payload = json.loads(_run(["go", "mod", "download", "-json", f"{name}@{version}"], cwd=work).stdout)
144
+ except json.JSONDecodeError as exc:
145
+ raise FetchError("go mod download did not return JSON") from exc
146
+ archive = payload.get("Zip") if isinstance(payload, dict) else None
147
+ if not isinstance(archive, str) or not archive or payload.get("Version") != version:
148
+ raise FetchError("go mod download did not return the requested version")
149
+ return Path(archive)
150
+
151
+
152
+ def fetch_action(work: Path, name: str, version: str) -> Path:
153
+ _run(["git", "init", "-q"], cwd=work)
154
+ _run(["git", "fetch", "--depth", "1", f"https://github.com/{name}", version], cwd=work)
155
+ _run(["git", "checkout", "-q", "FETCH_HEAD"], cwd=work)
156
+ _run(["rm", "-rf", ".git"], cwd=work)
157
+ return work
158
+
159
+
160
+ FETCHERS = {
161
+ "npm_and_yarn": fetch_npm,
162
+ "pip": fetch_pypi,
163
+ "gomod": fetch_gomod,
164
+ "github_actions": fetch_action,
165
+ }
166
+
167
+
168
+ def _action_refs(name: str, diff: str, ref: str = "[0-9a-f]{40}") -> tuple[dict[str, str], set[str]]:
169
+ """Return removed refs mapped to their diff lines, and added refs, for one action."""
170
+ pattern = re.compile(rf"uses:\s*[\"']?(?i:{re.escape(name)})(?:/[^@\s]*)?@({ref})(?=[\"'\s]|$)")
171
+ found: dict[str, dict[str, str]] = {"-": {}, "+": {}}
172
+ for line in diff.split("\n"):
173
+ if line[:1] in found and not line.startswith(("--- ", "+++ ")) and (match := pattern.search(line)):
174
+ found[line[0]].setdefault(match.group(1), line)
175
+ return found["-"], set(found["+"])
176
+
177
+
178
+ def _prev_sha(old: dict[str, str], version: str) -> str:
179
+ wanted, comment = version.removeprefix("v"), re.compile(r"#\s*v?(\S+)")
180
+ matches = (sha for sha, line in old.items() if (match := comment.search(line)) and match.group(1) == wanted)
181
+ return next(matches, sorted(old)[0])
182
+
183
+
184
+ def _tag_key(tag: str) -> tuple[int, ...]:
185
+ """Numeric sort key for vX, vX.Y or vX.Y.Z; raises FetchError on non-numeric tags."""
186
+ parts = tag.removeprefix("v").split(".")
187
+ if not all(part.isdigit() and part.isascii() for part in parts):
188
+ raise FetchError(f"{tag} is not a numeric version tag")
189
+ return tuple(int(part) for part in parts)
190
+
191
+
192
+ def resolve_tag(name: str, tag: str) -> str:
193
+ """Resolve a tag to its commit with git ls-remote, peeling annotated tags; fail on missing or ambiguous refs."""
194
+ peeled = f"refs/tags/{tag}" + "^{}"
195
+ out = _run(["git", "ls-remote", f"https://github.com/{name}", tag, peeled], cwd=Path(tempfile.gettempdir())).stdout
196
+ refs = dict(reversed(line.split("\t", 1)) for line in out.splitlines() if "\t" in line)
197
+ if f"refs/heads/{tag}" in refs:
198
+ raise FetchError(f"{tag} is ambiguous: a branch has the same name")
199
+ sha = refs.get(peeled) or refs.get(f"refs/tags/{tag}", "")
200
+ if not ACTION_SHA.fullmatch(sha):
201
+ raise FetchError(f"{tag} did not resolve to a commit")
202
+ return sha
203
+
204
+
205
+ def _action_status(update: Update, diff: str) -> Update | None:
206
+ """Pin SHAs or resolve tags for an action; None means fall through to the generic checks."""
207
+ old, new = _action_refs(update.name, diff)
208
+ if len(new) == 1 and old:
209
+ return replace(update, prev_version=_prev_sha(old, update.prev_version), new_version=new.pop())
210
+ if new:
211
+ return replace(update, status="unverified", note="the diff does not identify one old and one new SHA")
212
+ if ACTION_SHA.fullmatch(update.new_version):
213
+ return update
214
+ old_tags, new_tags = _action_refs(update.name, diff, ACTION_TAG)
215
+ if not old_tags and not new_tags:
216
+ return replace(update, status="not_reviewed", note="the pin is not a version tag or a 40-hex commit SHA")
217
+ if len(new_tags) != 1 or not old_tags:
218
+ return replace(update, status="unverified", note="the diff does not identify one old and one new tag")
219
+ try:
220
+ oldest = min(old_tags, key=_tag_key)
221
+ except FetchError as exc:
222
+ return replace(update, status="unverified", note=str(exc))
223
+ prev_tag = next((t for t in old_tags if t.removeprefix("v") == update.prev_version.removeprefix("v")), oldest)
224
+ update = replace(update, prev_version=prev_tag, new_version=new_tags.pop())
225
+ try:
226
+ commits = [resolve_tag(update.name, tag) for tag in (update.prev_version, update.new_version)]
227
+ except FetchError as exc:
228
+ return replace(update, status="unverified", note=f"tag did not resolve: {exc}")
229
+ return replace(update, prev_commit=commits[0], new_commit=commits[1])
230
+
231
+
232
+ def _poetry_previous_version(update: Update, diff: str) -> str:
233
+ """Recover an omitted pip version only from a matching Poetry package change."""
234
+ versions: set[str] = set()
235
+ pattern = re.compile(r'(?m)^ name = "([^"]+)"\n-version = "([^"]+)"\n\+version = "([^"]+)"$')
236
+ wanted = PurePosixPath(update.directory.lstrip("/")) / "poetry.lock"
237
+ for section in diff.split("diff --git ")[1:]:
238
+ if f"\n+++ b/{wanted}\n" not in section:
239
+ continue
240
+ for name, old, new in pattern.findall(section):
241
+ if _norm(name) == _norm(update.name) and new == update.new_version:
242
+ versions.add(old)
243
+ return next(iter(versions)) if len(versions) == 1 else ""
244
+
245
+
246
+ def _status(update: Update, diff: str) -> Update:
247
+ if update.ecosystem not in FETCHERS:
248
+ return replace(update, status="not_reviewed", note="ecosystem is not reviewed")
249
+ if update.ecosystem == "github_actions":
250
+ update = _action_status(update, diff) or update
251
+ if update.status != "reviewed":
252
+ return update
253
+ if update.ecosystem == "pip" and not update.prev_version:
254
+ update = replace(update, prev_version=_poetry_previous_version(update, diff))
255
+ if not update.prev_version:
256
+ return replace(update, status="unverified", note="previous version is missing")
257
+ if not all(SAFE.fullmatch(value) for value in (update.name, update.prev_version, update.new_version)):
258
+ return replace(update, status="unverified", note="name or version contains unsupported characters")
259
+ if not literal_ok(update, added_lines(diff)):
260
+ return replace(update, status="unverified", note="name and new version were not found on an added diff line")
261
+ return update
262
+
263
+
264
+ def extract(source: Path, dest: Path) -> None:
265
+ dest.mkdir(parents=True, exist_ok=True)
266
+ if source.is_dir():
267
+ shutil.copytree(source, dest, dirs_exist_ok=True)
268
+ return
269
+ try:
270
+ if source.name.lower().endswith((".zip", ".whl", ".egg")):
271
+ with zipfile.ZipFile(source) as handle:
272
+ handle.extractall(dest) # ruff: ignore[tarfile-unsafe-members]
273
+ else:
274
+ with tarfile.open(source, "r:*") as handle:
275
+ handle.extractall(dest, filter="data")
276
+ except (tarfile.TarError, zipfile.BadZipFile, OSError) as exc:
277
+ raise FetchError(f"extraction failed: {exc}") from exc
278
+ while len(entries := list(dest.iterdir())) == 1 and entries[0].is_dir():
279
+ top, placeholder = entries[0], Path(tempfile.mkdtemp(dir=dest, prefix=".collapse-"))
280
+ placeholder.rmdir()
281
+ top.rename(placeholder)
282
+ for child in list(placeholder.iterdir()):
283
+ child.rename(dest / child.name)
284
+ placeholder.rmdir()
285
+
286
+
287
+ MANIFESTS = {
288
+ "package.json", "setup.py", "setup.cfg", "pyproject.toml", "go.mod", "action.yml", "action.yaml",
289
+ "PKG-INFO", "METADATA", "Cargo.toml", "Cargo.lock", "build.rs",
290
+ } # fmt: skip
291
+ LOCKFILES = {
292
+ "package-lock.json", "npm-shrinkwrap.json", "yarn.lock", "pnpm-lock.yaml", "poetry.lock", "uv.lock",
293
+ "Pipfile.lock", "Cargo.lock", "go.sum", "composer.lock", "Gemfile.lock",
294
+ } # fmt: skip
295
+ TEST_DIRS = {"test", "tests", "testing", "__tests__", "testdata", "test_data", "fixtures", "__fixtures__", "typings"}
296
+ TEST_FILE = re.compile(r"^(test_.*\.py|.*_test\.(py|go)|.*\.(test|spec)\.[cm]?[jt]sx?|conftest\.py)$")
297
+ # A generated-file marker only counts in a comment within the first lines of the file.
298
+ GENERATED = re.compile(
299
+ rb"^\s*(#|//|/\*|\*|--|<!--)\s*(@generated\b|Generated by Cython|Code generated .* DO NOT EDIT)", re.M
300
+ )
301
+ HEADER_LINES = 5
302
+ LISTED = 50
303
+
304
+
305
+ @dataclass
306
+ class FileDiff:
307
+ path: str
308
+ text: bytes
309
+ binary: bool = False
310
+ excluded: str = ""
311
+
312
+
313
+ def _split_diff(diff: bytes) -> list[FileDiff]:
314
+ """Split a diff -ruN output into one entry per file; paths drop the old/ or new/ prefix."""
315
+ files: list[FileDiff] = []
316
+ for line in diff.splitlines(keepends=True):
317
+ text = line.decode("utf-8", errors="replace").rstrip("\n")
318
+ if text.startswith("diff -ruN "):
319
+ files.append(FileDiff(_diff_header_path(text[len("diff -ruN ") :]).partition("/")[2], b""))
320
+ elif text.startswith("Binary files ") and " and new/" in text:
321
+ path = text.rsplit(" and new/", 1)[1].removesuffix(" differ")
322
+ files.append(FileDiff(path, b"", binary=True))
323
+ elif not files:
324
+ files.append(FileDiff("", b""))
325
+ files[-1].text += line
326
+ return files
327
+
328
+
329
+ def _exclusion(item: FileDiff, out_dir: Path) -> str:
330
+ """Why a file is left out of the agent diff, or "" to keep it."""
331
+ parts = PurePosixPath(item.path).parts[1:]
332
+ if not parts:
333
+ return ""
334
+ dirs, name = parts[:-1], parts[-1]
335
+ if ".github" in dirs:
336
+ return ".github"
337
+ if name in LOCKFILES:
338
+ return "lockfile"
339
+ if any(d.lower() in TEST_DIRS for d in dirs) or TEST_FILE.match(name):
340
+ return "test or fixture"
341
+ if any(d.endswith("-stubs") or d == "stubs" for d in dirs):
342
+ return "type stubs"
343
+ # Judge the new side; a deleted file only has the old one.
344
+ path = out_dir / "new" / item.path
345
+ if not path.is_file():
346
+ path = out_dir / "old" / item.path
347
+ try:
348
+ with path.open("rb") as handle:
349
+ head = b"".join(handle.readline(512) for _ in range(HEADER_LINES))
350
+ except OSError:
351
+ return ""
352
+ return "generated" if GENERATED.search(head) else ""
353
+
354
+
355
+ def _relabel(item: FileDiff, labels: dict[str, tuple[str, str]]) -> bytes:
356
+ """Rewrite header paths old/<slug>/ and new/<slug>/ to carry each side's version."""
357
+ slug = PurePosixPath(item.path).parts[0] if item.path else ""
358
+ if slug not in labels:
359
+ return item.text
360
+ head, sep, body = item.text.partition(b"\n@@")
361
+ for side, version in zip(("old", "new"), labels[slug], strict=True):
362
+ head = head.replace(f"{side}/{slug}/".encode(), f"{side}/{slug}@{version}/".encode())
363
+ return head + sep + body
364
+
365
+
366
+ def write_diff(out_dir: Path, labels: dict[str, tuple[str, str]] | None = None) -> list[FileDiff]:
367
+ """Write changes.diff for the agent and excluded.diff for the rest; return every file diff."""
368
+ (out_dir / "old").mkdir(exist_ok=True)
369
+ (out_dir / "new").mkdir(exist_ok=True)
370
+ result = _run(["diff", "-ruN", "old", "new"], cwd=out_dir, text=False, ok=(0, 1))
371
+ files = _split_diff(result.stdout)
372
+ for item in files:
373
+ item.excluded = _exclusion(item, out_dir)
374
+ item.text = _relabel(item, labels or {})
375
+ # Make the labelled header paths open: old/<slug>@<version> points at old/<slug>.
376
+ for slug, versions in (labels or {}).items():
377
+ for side, version in zip(("old", "new"), versions, strict=True):
378
+ link = out_dir / side / f"{slug}@{version}"
379
+ if (out_dir / side / slug).is_dir() and not link.exists():
380
+ link.symlink_to(slug, target_is_directory=True)
381
+ (out_dir / "changes.diff").write_bytes(b"".join(i.text for i in files if not i.excluded))
382
+ (out_dir / "excluded.diff").write_bytes(b"".join(i.text for i in files if i.excluded))
383
+ return files
384
+
385
+
386
+ def _major(version: str) -> str:
387
+ return re.split(r"[.+-]", version.lstrip("vV"), maxsplit=1)[0]
388
+
389
+
390
+ def _diff_header_path(paths: str) -> str:
391
+ """The new-side path of a "diff -ruN old/P new/P" header; GNU diff quotes P when it has spaces."""
392
+ try:
393
+ parts = shlex.split(paths)
394
+ except ValueError:
395
+ parts = []
396
+ if len(parts) == 2:
397
+ return parts[1]
398
+ # Unquoted "old/P new/P" where P contains spaces: both halves have the same
399
+ # length plus one separating space, so the new-side path starts at the midpoint.
400
+ return paths[(len(paths) + 1) // 2 :]
401
+
402
+
403
+ def _capped(title: str, entries: list[str]) -> list[str]:
404
+ more = [f"{title}: {len(entries) - LISTED} more not listed"] if len(entries) > LISTED else []
405
+ return [f"{title}: {entry}" for entry in entries[:LISTED]] + more
406
+
407
+
408
+ def _metadata_facts(files: list[FileDiff]) -> list[str]:
409
+ """Requires-Python and Requires-Dist changes from PKG-INFO or METADATA diffs."""
410
+ facts: list[str] = []
411
+ for item in files:
412
+ if PurePosixPath(item.path).name not in {"PKG-INFO", "METADATA"} or item.binary:
413
+ continue
414
+ seen: dict[str, dict[str, str]] = {side: {} for side in "-+"}
415
+ for line in item.text.decode("utf-8", errors="replace").splitlines():
416
+ if line[:1] not in seen or line.startswith(("--- ", "+++ ")):
417
+ continue
418
+ key, _, value = line[1:].partition(":")
419
+ if key == "Requires-Python":
420
+ seen[line[0]]["Python"] = value.strip()
421
+ elif key == "Requires-Dist":
422
+ name = re.split(r"[\s<>=!~;\[(]", value.strip(), maxsplit=1)[0]
423
+ seen[line[0]][_norm(name)] = value.strip()
424
+ old, new = seen["-"], seen["+"]
425
+ for dep in sorted(old.keys() | new.keys()):
426
+ label = "Requires-Python" if dep == "Python" else "Requires-Dist"
427
+ if dep not in old:
428
+ facts.append(f"{item.path}: new {label}: {new[dep]}")
429
+ elif dep not in new:
430
+ facts.append(f"{item.path}: removed {label}: {old[dep]}")
431
+ elif old[dep] != new[dep]:
432
+ facts.append(f"{item.path}: {label} changed: {old[dep]} -> {new[dep]}")
433
+ return facts
434
+
435
+
436
+ LOCK_NAME = re.compile(r'^\s*(?:name = "([^"]+)"|"(?:[^"]*node_modules/)?([^"]+)": \{|"?(@?[^@\s"]+)@[^:]*"?:$)')
437
+ LOCK_VERSION = re.compile(r'^\s*(?:version = "([^"]+)"|"version": "([^"]+)"|version "([^"]+)")')
438
+ GO_SUM = re.compile(r"^(\S+) (v[^/\s]+)(?:/go\.mod)? h1:")
439
+
440
+
441
+ def lockfile_changes(pr_diff: str, reviewed: set[str]) -> list[str]:
442
+ """Other packages whose versions change in the PR's lockfile hunks (not artifact-reviewed)."""
443
+ changes: dict[str, dict[str, str]] = {}
444
+ lockfile, current = False, ""
445
+ for line in pr_diff.split("\n"):
446
+ if line.startswith("+++ "):
447
+ lockfile, current = PurePosixPath(line[4:].strip()).name in LOCKFILES, ""
448
+ continue
449
+ if not lockfile or line[:1] not in {" ", "-", "+"} or line.startswith("--- "):
450
+ continue
451
+ sign, body = line[0], line[1:]
452
+ if sign != " " and (match := GO_SUM.match(body)):
453
+ changes.setdefault(match.group(1), {})[sign] = match.group(2)
454
+ elif match := LOCK_NAME.match(body):
455
+ current = next(g for g in match.groups() if g)
456
+ elif sign != " " and current and (match := LOCK_VERSION.match(body)):
457
+ changes.setdefault(current, {})[sign] = next(g for g in match.groups() if g)
458
+ return [
459
+ f"{name} {sides.get('-', '?')} -> {sides.get('+', '?')}"
460
+ for name, sides in sorted(changes.items())
461
+ if sides.get("-") != sides.get("+") and _norm(name) not in reviewed
462
+ ]
463
+
464
+
465
+ def collect_facts(results: list[Update], files: list[FileDiff], pr_diff: str = "") -> list[str]:
466
+ """Plain, script-computed facts about the update for the agent and the comment."""
467
+ facts = [
468
+ f"{r.name}: major version change {r.prev_version} -> {r.new_version}"
469
+ for r in results
470
+ if r.status == "reviewed"
471
+ and r.ecosystem != "github_actions"
472
+ and _major(r.prev_version) != _major(r.new_version)
473
+ ]
474
+ for r in results:
475
+ if r.status != "reviewed":
476
+ continue
477
+ if r.prev_artifact or r.new_artifact:
478
+ facts.append(f"{r.name}: reviewed artifacts: old {r.prev_artifact}, new {r.new_artifact}")
479
+ if not r.new_commit:
480
+ continue
481
+ facts.append(f"{r.name}: tag {r.prev_version} resolved to {r.prev_commit}, {r.new_version} to {r.new_commit}")
482
+ if not FULL_TAG.fullmatch(r.new_version):
483
+ facts.append(f"{r.name}: {r.new_version} can move after review; the reviewed commit was {r.new_commit}")
484
+ manifests = sorted({PurePosixPath(i.path).name for i in files if PurePosixPath(i.path).name in MANIFESTS})
485
+ facts += [f"manifest or build file changed: {name}" for name in manifests]
486
+ facts += _metadata_facts(files)
487
+ facts += _capped("binary file changed", [i.path for i in files if i.binary])
488
+ kept = [i for i in files if not i.excluded]
489
+ if files:
490
+ total, agent = sum(len(i.text) for i in files), sum(len(i.text) for i in kept)
491
+ facts.append(f"diff size: {total} bytes in {len(files)} files; changes.diff has {agent} bytes")
492
+ largest = sorted(kept, key=lambda i: len(i.text), reverse=True)[:10]
493
+ facts += [f"largest change: {i.path} ({len(i.text)} bytes)" for i in largest]
494
+ left_out = sorted((i for i in files if i.excluded), key=lambda i: i.excluded != "generated")
495
+ if left_out:
496
+ reasons = Counter(i.excluded for i in left_out)
497
+ summary = ", ".join(f"{count} {reason}" for reason, count in sorted(reasons.items()))
498
+ size = sum(len(i.text) for i in left_out)
499
+ facts.append(f"not in changes.diff: {len(left_out)} files, {size} bytes ({summary}); all are in excluded.diff")
500
+ excluded = [f"{i.path} ({i.excluded}, {len(i.text)} bytes)" for i in left_out]
501
+ facts += _capped("excluded from changes.diff, see excluded.diff", excluded)
502
+ reviewed = {_norm(r.name) for r in results}
503
+ facts += _capped("lockfile change not reviewed", lockfile_changes(pr_diff, reviewed))
504
+ return facts
505
+
506
+
507
+ def main() -> int:
508
+ out_dir = Path(os.environ["DCR_OUT"])
509
+ out_dir.mkdir(parents=True, exist_ok=True)
510
+ updates = _parse_updates(os.environ.get("UPDATED_DEPENDENCIES_JSON", ""))
511
+ diff_text = Path(os.environ["PR_DIFF_PATH"]).read_text(encoding="utf-8", errors="replace")
512
+ results: list[Update] = []
513
+ labels: dict[str, tuple[str, str]] = {}
514
+ for index, update in enumerate(updates):
515
+ resolved = _status(update, diff_text)
516
+ if resolved.status != "reviewed":
517
+ results.append(resolved)
518
+ continue
519
+ slug = f"{index:02d}-" + re.sub(r"[^A-Za-z0-9._@-]", "_", resolved.name)
520
+ labels[slug] = (resolved.prev_version, resolved.new_version)
521
+ try:
522
+ with tempfile.TemporaryDirectory() as tmp:
523
+ artifacts = []
524
+ sides = (
525
+ ("old", resolved.prev_commit or resolved.prev_version),
526
+ ("new", resolved.new_commit or resolved.new_version),
527
+ )
528
+ for side, version in sides:
529
+ work = Path(tmp) / side
530
+ work.mkdir()
531
+ source = FETCHERS[resolved.ecosystem](work, resolved.name, version)
532
+ artifacts.append(f"commit {version}" if source.is_dir() else source.name)
533
+ extract(source, out_dir / side / slug)
534
+ results.append(replace(resolved, prev_artifact=artifacts[0], new_artifact=artifacts[1]))
535
+ except (FetchError, OSError) as exc:
536
+ results.append(replace(resolved, status="fetch_failed", note=str(exc)))
537
+ files: list[FileDiff] = []
538
+ try:
539
+ files = write_diff(out_dir, labels)
540
+ except FetchError as exc:
541
+ results = [
542
+ replace(r, status="fetch_failed", note=f"diff failed: {exc}") if r.status == "reviewed" else r
543
+ for r in results
544
+ ]
545
+ reviewable = any(result.status == "reviewed" for result in results)
546
+ facts = collect_facts(results, files, diff_text)
547
+ meta = {"schema": 1, "updates": [asdict(result) for result in results], "facts": facts}
548
+ (out_dir / "meta.json").write_text(json.dumps(meta, indent=2, sort_keys=True) + "\n", encoding="utf-8")
549
+ if output := os.environ.get("GITHUB_OUTPUT"):
550
+ with Path(output).open("a", encoding="utf-8") as handle:
551
+ handle.write(f"reviewable={str(reviewable).lower()}\n")
552
+ return 0
553
+
554
+
555
+ if __name__ == "__main__":
556
+ raise SystemExit(main())