Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion .github/workflows/idris2-abi-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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')
Expand Down Expand Up @@ -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:-<none>}"
echo "CapnSchemas.idr: ${mirror:-<none>}"
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
Expand Down
8 changes: 8 additions & 0 deletions docs/PROOF-STATUS.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 4 additions & 2 deletions src/abi/EchidnaABI/CapnSchemas.idr
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading