Skip to content

platform: Move the OpenVM platform to this package (bflat manifest schema 2) - #5

Merged
maximmenshikov merged 16 commits into
mainfrom
manifest-schema-2
Oct 27, 2026
Merged

maximmenshikov merged 16 commits into
mainfrom
manifest-schema-2

Conversation

@maximmenshikov

@maximmenshikov maximmenshikov commented Oct 27, 2026 •

Copy link
Copy Markdown
Collaborator

Move the OpenVM platform from bflat-riscv64 to this package, with the schema 2 manifest of bflat.

  • build: the bflat manifest is schema 2.
  • platform/: the manifests and the code of the openvm platform(s): entry, memory map, linker script, the platform interface of the bflat PAL, the RyuJIT tuning and the post-link steps. bflat no longer knows the zkVM by itself; --libc selects the platform and --extlib gives the package.
  • release: the nupkg is signed by the reusable workflow sign.yml of bflat-riscv64. The workflow stops when the release of the version exists, and the tag goes on the commit that was built.

Merge together with NethermindEth/bflat-riscv64 refactor/prep, before it: the CI of bflat-riscv64 takes the platforms from main of this repo.

Testing: release 2.1.0.52 is built and signed from this branch. bflat-riscv64 CI with packages_ref=manifest-schema-2 (run 40440053236) builds the guest for this platform.

Also in this PR (from #6):

  • The runner makes the VM configuration from SdkVmConfig::standard() and takes no openvm.toml (openvm-runelf <elf> <input-bytes>). runner/openvm.toml was the standard configuration, in the same order. ere uses the same configuration, so a guest needs only its ELF. The division hint is still registered only by this runner.
  • The u256 and secp256k1 guests run on the runner image of the commit (built by the division-hint job).
  • link-guest builds bflat from refactor/prep (.NET 11, signature checks on). Change bflat_ref to master when bflat: Move the zkVM platforms to the packages, sign the downloads, build only .NET 11 perf bflat-riscv64#65 is in master.

🤖 Generated with Claude Code

The package manifest uses the bflat manifest, schema 2: objects in place
of static_lib, a platform condition (zkvm_openvm) in place of libc, and
version in place of package_version. Unknown top-level keys are an error
in schema 2, so the release workflow injects openvm_ref under metadata.
The guest-link job checks the new layout path of the OpenVM memory map
(lib/modules/zkvm_openvm).

Needs a bflat that reads schema 2 (bflat-riscv64 refactor/prep).

Signed-off-by: Maxim Menshikov <maksim.menshikov@nethermind.io>
bflat no longer knows OpenVM: the openvm platform is here. platform/
has the entry point (entry.S, from bflat's zkvm_openvm), the memory map
and the platform manifest with the ISA, ABI, RyuJIT options,
ZKVM_OPENVM and the memcpy/memmove/memset wraps that entry.S defines.
platform/build.sh builds it with the RISC-V binutils only;
build/build.sh runs it, and the package and the release carry the files
next to libopenvm.a.

The bindings manifest applies on the openvm platform only and links
libopenvm.a in front of the linker script as before. --extlib with
libopenvm.bflat.manifest reads the platform manifest in the same
directory, so consumers do not change. The guest-link job no longer
compares the layout copy of the memory map: there is none.

The entry-point unit tests came with the code (tests/platform, run
under qemu-user in the new platform-tests job).

Needs the bflat that reads platforms from packages (bflat-riscv64
refactor/prep; the link-guest job takes it through bflat_ref).

Signed-off-by: Maxim Menshikov <maksim.menshikov@nethermind.io>
bflat's pal no longer holds code for any one zkVM; the entry object
defines what it calls, and no longer exports the __zkvm_target_openvm
marker: TERMINATE becomes zkvm_platform_exit and the PrintStr phantom
becomes zkvm_platform_write (the descriptor is ignored, as before).
OpenVM defines no zkvm_platform_syscall, so raw syscalls keep failing.

The unit tests check that zkvm_platform_exit traps under qemu-user
instead of falling back to a Linux exit.

Signed-off-by: Maxim Menshikov <maksim.menshikov@nethermind.io>
Signed-off-by: Maxim Menshikov <maksim.menshikov@nethermind.io>
Signed-off-by: Maxim Menshikov <maksim.menshikov@nethermind.io>
bflat does not read this flag any more. Its only reader was an IL rewrite that bflat removed when the nofp module stopped trapping the exact libm operations.

Signed-off-by: Maxim Menshikov <maksim.menshikov@nethermind.io>
bflat now checks the signature of an --extlib .nupkg (docs/signing.md in bflat-riscv64). The release job signs the package after dotnet pack and before the push and the GitHub release, with the secret BFLAT_SIGNING_KEY. scripts/sign_package.py is a copy of the script in bflat-riscv64. A run that publishes nothing can be unsigned when the secret is not set; a run that publishes stops without the secret.

Signed-off-by: Maxim Menshikov <maksim.menshikov@nethermind.io>
bflat added JitObjectStackAllocation=1, JitObjectStackAllocationSize=2000,
JitExtDefaultPolicyMaxIL=200 and JitExtDefaultPolicyMaxBB=10 to every
optimized build. bflat now takes them from codegen.options of the
platform, so this manifest gives them, with the same condition.
The build job had BFLAT_SIGNING_KEY, so the whole build ran where the key
was. Now the build job lists the package entries without a key
(sign_package.py list-nupkg), the sign job (sign.yml of bflat-riscv64)
signs the lists, and a new publish job adds the signatures
(sign_package.py embed), checks them with BFLAT_SIGNING_PUBLIC_KEY, and
pushes the package. The GitHub release takes the signed package from the
publish job. sign_package.py is the new copy from bflat-riscv64.
A run that is run again keeps its run number, and with it the package
version. The NuGet push skipped the package that was there already
(--skip-duplicate), and the GitHub release step then replaced the files
of the release of that version. The release and the package on NuGet
did not agree after that.

Stop the build when the GitHub release of the version exists, before
the sign job. Let the NuGet push fail on a duplicate version, so that a
release step cannot run without a new package.

Signed-off-by: Maxim Menshikov <maksim.menshikov@nethermind.io>
The release step did not give a commit for the tag, so the tag went on
the head of the default branch. A run from another branch then made a
release whose tag did not name its sources. Tag github.sha.

Signed-off-by: Maxim Menshikov <maksim.menshikov@nethermind.io>
The sign job gets the private key, so a change to sign.yml in bflat-riscv64
must not reach this workflow before this repository takes it. The sign job
gets no token permissions, and the third-party actions are given by SHA. The other jobs get only contents: read.

Signed-off-by: Maxim Menshikov <maksim.menshikov@nethermind.io>
The configuration in openvm.toml was SdkVmConfig::standard() of the SDK,
which is also what ere uses. The runner now makes it from
SdkVmConfig::standard() and the parameters of AppConfig by default, and
takes only the ELF and the input. A guest of bflat --libc openvm then
needs no file next to the ELF.

The jobs that run the published image give it "-", the standard
configuration that the image ships, until the next image is released.

Signed-off-by: Maxim Menshikov <maksim.menshikov@nethermind.io>
The published image takes the path of a configuration file, and the
runner no longer has one. The job of the division hint builds the image
of this commit; it now saves it as an artifact, and the u256 and
secp256k1 jobs load it and run the guests with no configuration.

Signed-off-by: Maxim Menshikov <maksim.menshikov@nethermind.io>
The platform of this package is for the schema 2 manifest, which only the
bflat of refactor/prep reads; the bflat of feature/new_zkvms stops with
"No matching build in manifest". That bflat builds for .NET 11 only, with
no variant arguments of build.sh, and checks the signatures of the
releases that it downloads.

- bflat_ref is refactor/prep. Change it to master when refactor/prep is
  in master.
- The job takes the .NET 11 SDK of the CI of
  bflat-riscv64, and gives bflat BFLAT_SIGNING_PUBLIC_KEY.

Signed-off-by: Maxim Menshikov <maksim.menshikov@nethermind.io>
refactor/prep is in master of bflat-riscv64 (NethermindEth/bflat-riscv64#65),
thus the link-guest job builds bflat from master.

The bflat_ref input is removed: CodeQL reports the checkout of a ref from
a dispatch input, followed by the execution of its code, as a cache
poisoning risk (actions/cache-poisoning/poisonable-step).

Signed-off-by: Maxim Menshikov <maksim.menshikov@nethermind.io>
@maximmenshikov
maximmenshikov merged commit 3ff11ea into main Oct 27, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants