Skip to content
Merged
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
39 changes: 38 additions & 1 deletion .github/workflows/build-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,12 @@ jobs:
-o guest
riscv64-linux-gnu-readelf -h guest | grep -E 'Class:|Machine:|Entry point'
ls -la guest
bflat-riscv64/src/bflat/bin/Debug/net10.0/bflat build \
bflat-openvm/tests/integration/u256.cs \
--os linux --arch riscv64 --libc openvm --stdlib dotnet \
--no-pie --no-pthread -Ot \
--extlib "$PWD/bflat-openvm/output/libopenvm.bflat.manifest" \
-o u256
bflat-riscv64/src/bflat/bin/Debug/net10.0/bflat build bflat-openvm/tests/secp256k1/guest.cs --os linux --arch riscv64 --libc openvm --stdlib dotnet --no-pie --no-pthread -Ot --extlib "$PWD/bflat-openvm/output/libopenvm.bflat.manifest" -o secp256k1-guest

- name: Upload the linked guests
Expand All @@ -149,6 +155,7 @@ jobs:
name: integration-guest
path: |
guest
u256
secp256k1-guest

- name: Check the linked image
Expand All @@ -161,6 +168,36 @@ jobs:
run: |
python3 bflat-openvm/tests/integration/check_image.py guest --require-custom --no-atomics

run-u256-vectors:
# guest.cs only links the u256 shims; this executes them. A wrong funct7 or
# register order in openvm_intrinsics.S links fine and computes the wrong
# thing, so the vector guest runs on the OpenVM runner and must report zero
# mismatches over its 444 checks.
name: Run the u256 vectors on OpenVM
needs: link-guest
runs-on: ubuntu-latest
env:
OPENVM_IMAGE: nethermindeth/openvm-runner:v2.1.0-rv64@sha256:d8209a5db5d59df6d6f5899b2ce6866f81c30bdc3df952dc78243b8316706baa
steps:
- name: Check out repository
uses: actions/checkout@v7

- name: Download the linked guests
uses: actions/download-artifact@v4
with:
name: integration-guest
path: guests

- name: Execute the vector guest
run: |
cp runner/openvm.toml guests/
: > guests/empty.raw
out=$(docker run --rm -v "$PWD/guests:/n" "$OPENVM_IMAGE" /n/u256 /n/openvm.toml /n/empty.raw | tail -1)
echo "$out"
# Mismatches, then checks, as little-endian u64s.
[ "$out" = "public_values=0000000000000000bc0100000000000000000000000000000000000000000000" ] \
|| { echo "::error::u256 vectors failed: $out"; exit 1; }

run-secp256k1-guest:
# The host test emulates the chips' preconditions; this runs the recovery
# on OpenVM itself, against the same reference, adversarial vectors
Expand Down Expand Up @@ -208,7 +245,7 @@ jobs:

build-nupkg:
name: Build NuGet package
needs: [build-libopenvm, run-divrem-vectors, run-secp256k1-guest]
needs: [build-libopenvm, run-divrem-vectors, run-secp256k1-guest, run-u256-vectors]
runs-on: ubuntu-latest
permissions:
contents: read
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,9 @@ All 19 accelerators, plus both IO entry points:
custom-0 and custom-1 instructions to catch a silent fallback to portable Rust.
CI then links a real bflat guest that calls all 21 through direct P/Invoke
(`tests/integration/guest.cs`) — which is what proves the symbols not only
exist but survive a guest's link.
exist but survive a guest's link. The 256-bit integer shims are also executed:
`tests/integration/u256.cs` runs each against precomputed vectors on the
OpenVM runner, out of place and over either operand.

`zkvm_secp256k1_ecrecover` is ours rather than openvm-eth's, so it is also
tested for results: `tests/secp256k1/test_ecrecover.py` diffs a host build of
Expand Down
Loading
Loading