diff --git a/.github/workflows/idris2-abi-ci.yml b/.github/workflows/idris2-abi-ci.yml index 8959e5b2..ed5a2b3e 100644 --- a/.github/workflows/idris2-abi-ci.yml +++ b/.github/workflows/idris2-abi-ci.yml @@ -13,6 +13,7 @@ on: - 'src/idris/**' - 'tests/abi/**' - 'scripts/abi-fixtures.sh' + - 'schemas/echidna.capnp' - 'src/rust/coprocessor/types.rs' - 'scripts/ci/check-coprocessor-tags.sh' - '.github/workflows/idris2-abi-ci.yml' @@ -48,7 +49,7 @@ jobs: GH_TOKEN: ${{ github.token }} run: | set -euo pipefail - PATTERN='^(src/abi/|src/idris/|tests/abi/|scripts/abi-fixtures\.sh$)' + PATTERN='^(src/abi/|src/idris/|tests/abi/|scripts/abi-fixtures\.sh$|schemas/echidna\.capnp$)' if [ "${{ github.event_name }}" = "pull_request" ]; then FILES=$(gh api "repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/files" \ --paginate --jq '.[].filename') @@ -136,6 +137,22 @@ jobs: exit 1 fi + - name: Cap'n Proto schema id matches its Idris mirror + run: | + # EchidnaABI.CapnSchemas.echidnaSchemaId mirrors the file id of + # schemas/echidna.capnp. Its non-zero proof cannot catch a wrong value, + # so compare the two hex literals directly. Runs on every event: it is + # cheap, and a schema-only change must not skip it. + set -euo pipefail + schema=$({ grep -oE '^@0x[0-9a-fA-F]+;' schemas/echidna.capnp || true; } | head -n1 | tr -d '@;' | tr 'A-F' 'a-f') + mirror=$({ grep -oE '^echidnaSchemaId = 0x[0-9a-fA-F]+' src/abi/EchidnaABI/CapnSchemas.idr || true; } | awk '{print $3}' | tr 'A-F' 'a-f') + echo "schemas/echidna.capnp: ${schema:-}" + echo "CapnSchemas.idr: ${mirror:-}" + if [ -z "$schema" ] || [ -z "$mirror" ] || [ "$schema" != "$mirror" ]; then + echo "::error file=src/abi/EchidnaABI/CapnSchemas.idr::echidnaSchemaId does not match the id in schemas/echidna.capnp" + exit 1 + fi + - name: No partial or covering escape in the ABI # %default total is only a default: a `partial` or `covering` annotation, or # a module-wide `%default partial|covering`, turns the totality check off for diff --git a/docs/PROOF-STATUS.adoc b/docs/PROOF-STATUS.adoc index 65ced1b3..028e1883 100644 --- a/docs/PROOF-STATUS.adoc +++ b/docs/PROOF-STATUS.adoc @@ -229,6 +229,14 @@ https://github.com/hyperpolymath/echidna/actions/runs/42624461538/job/1291845356 builds `+verification/proofs/idris2/echidna-verif-proofs.ipkg+` and https://github.com/hyperpolymath/echidna/actions/runs/42624461712/job/129184533713[Type-check Idris2 ABI definitions] builds `+src/abi/echidnaabi.ipkg+`, both on Idris 2 0.8.0, both success. +Those receipts cover the trees at `+2ab7574+` only. `+src/abi/+` has changed since: +hyperpolymath/echidna#511 deleted the seven shadow copies, +hyperpolymath/echidna#512 moved `+Coprocessor.Foreign+` into the package, and +hyperpolymath/echidna#508 changed `+EchidnaABI.CapnSchemas+`. The ABI package as +it stands after #508 checks in +https://github.com/hyperpolymath/echidna/actions/runs/43986065115/job/133714398981[Type-check Idris2 ABI definitions], +success, a pull-request run on head `+7edf44f+`, whose `+src/abi/+` tree is the +one #508 merges. At that receipt `+NatLte.idr+` lacked `+%default total+`, so its totality was not checked. It now declares the directive, and the `+verif-idris+` job fails if any module in `+verification/proofs/idris2/+` does not. A fresh receipt is diff --git a/src/abi/EchidnaABI/CapnSchemas.idr b/src/abi/EchidnaABI/CapnSchemas.idr index 6b992f21..4a997e28 100644 --- a/src/abi/EchidnaABI/CapnSchemas.idr +++ b/src/abi/EchidnaABI/CapnSchemas.idr @@ -31,10 +31,12 @@ import Data.Fin ------------------------------------------------------------------------ ||| The Cap'n Proto schema unique identifier for echidna.capnp. -||| Hex: 0xd3b45f8ae1c79012 = 15,242,516,543,891,767,314 (decimal). +||| Written as the hex literal that `schemas/echidna.capnp` declares (`@0xd3b45f8ae1c79012`, +||| decimal 15254922887908790290), so the two can be compared textually. +||| `idris2-abi-ci.yml` fails if they differ. public export echidnaSchemaId : Nat -echidnaSchemaId = 15242516543891767314 +echidnaSchemaId = 0xd3b45f8ae1c79012 ||| Proof: the schema identifier is non-zero. ||| Cap'n Proto uses 0 as the "no schema" sentinel; a zero schema ID