formal-verification.yml 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. name: formal verification
  2. on:
  3. pull_request:
  4. types:
  5. - opened
  6. - reopened
  7. - synchronize
  8. - labeled
  9. workflow_dispatch: {}
  10. env:
  11. PIP_VERSION: '3.11'
  12. JAVA_VERSION: '11'
  13. SOLC_VERSION: '0.8.27'
  14. concurrency: ${{ github.workflow }}-${{ github.ref }}
  15. jobs:
  16. apply-diff:
  17. runs-on: ubuntu-latest
  18. steps:
  19. - uses: actions/checkout@v5
  20. - name: Apply patches
  21. run: make -C certora apply
  22. verify:
  23. runs-on: ubuntu-latest
  24. if: github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'formal-verification')
  25. steps:
  26. - uses: actions/checkout@v5
  27. with:
  28. fetch-depth: 0
  29. - name: Set up environment
  30. uses: ./.github/actions/setup
  31. - name: identify specs that need to be run
  32. id: arguments
  33. run: |
  34. if [[ ${{ github.event_name }} = 'pull_request' ]];
  35. then
  36. RESULT=$(git diff ${{ github.event.pull_request.head.sha }}..${{ github.event.pull_request.base.sha }} --name-only certora/specs/*.spec | while IFS= read -r file; do [[ -f $file ]] && basename "${file%.spec}"; done | tr "\n" " ")
  37. else
  38. RESULT='--all'
  39. fi
  40. echo "result=$RESULT" >> "$GITHUB_OUTPUT"
  41. - name: Install python
  42. uses: actions/setup-python@v5
  43. with:
  44. python-version: ${{ env.PIP_VERSION }}
  45. cache: 'pip'
  46. cache-dependency-path: 'fv-requirements.txt'
  47. - name: Install python packages
  48. run: pip install -r fv-requirements.txt
  49. - name: Install java
  50. uses: actions/setup-java@v5
  51. with:
  52. distribution: temurin
  53. java-version: ${{ env.JAVA_VERSION }}
  54. - name: Install solc
  55. run: |
  56. wget https://github.com/ethereum/solidity/releases/download/v${{ env.SOLC_VERSION }}/solc-static-linux
  57. sudo mv solc-static-linux /usr/local/bin/solc
  58. chmod +x /usr/local/bin/solc
  59. - name: Verify specification
  60. run: |
  61. make -C certora apply
  62. node certora/run.js ${{ steps.arguments.outputs.result }} -p 1 -v >> "$GITHUB_STEP_SUMMARY"
  63. env:
  64. CERTORAKEY: ${{ secrets.CERTORAKEY }}
  65. halmos:
  66. runs-on: ubuntu-latest
  67. steps:
  68. - uses: actions/checkout@v5
  69. - name: Set up environment
  70. uses: ./.github/actions/setup
  71. - name: Install python
  72. uses: actions/setup-python@v5
  73. with:
  74. python-version: ${{ env.PIP_VERSION }}
  75. cache: 'pip'
  76. cache-dependency-path: 'fv-requirements.txt'
  77. - name: Install python packages
  78. run: pip install -r fv-requirements.txt
  79. - name: Run Halmos
  80. run: halmos --match-test '^symbolic|^testSymbolic' -vv
  81. env:
  82. HALMOS_ALLOW_DOWNLOAD: 1