Skip to content

v0.6.0

Latest

Choose a tag to compare

@rcarback rcarback released this 24 Nov 15:17
· 1 commit to main since this release

xquad 0.6 hardens the bytecode checker that decides whether a program may run: its analyses are bounded, so no program can make it hang or do more work than its size allows, and it now checks stack heights, registers and jumps exactly. It also fixes two VM issues raised in a security review, and pip install xquad becomes the one way to install the Python toolchain. The migration guide from 0.5 covers every breaking change.

Breaking changes

  • One Python distribution. xquad now carries xqffi, xqcp, xqsa and the xquad CLI in one wheel; those three have no 0.6 release. Replace pip install xqsa (or xqcp, xqffi) with pip install xquad, and xqsa[cuda] with xquad[cuda]. Imports are unchanged. In an environment upgraded in place, run pip uninstall -y xqffi xqcp xqsa, then pip install --force-reinstall xquad; import xquad refuses to run next to the 0.5 distributions until you do.
  • Verifier renamed to checker. xqvm::verifier::verify → xqvm::checker::check, Verifier → Checker, VerifierError → CheckerError, xqffi.verifier.verify → xqffi.checker.check, xquad.verifier → xquad.checker. The migration guide has a script for the fully qualified forms.
  • Removed CLI aliases. xquad asm, dism, run and verify → xquad vm asm, vm dis, vm run, vm check.
  • Bounded data-flow analyses. xqvm::dataflow::solve(analysis, cfg) → solve(analysis, cfg, max_visits), returning Result<_, SolveError>.
  • New error variants. CheckerError gains AnalysisBudgetExceeded and JumpAcrossLoopBoundary; xqvm::Error gains NonBinaryModel. An exhaustive match needs an arm for each.
  • Constraint opcodes need a binary model. ONEHOTR, ONEHOTC, EXCLUDE, IMPLIES, EQUALITY, ATLEAST, ATLEASTW and REDUCE raise NonBinaryModel on a spin or integer model. Allocate with BQMX, or write coefficients with SETLINE, ADDLINE, SETQUAD or ADDQUAD. Programs compiled by xqcp are unaffected.

Highlights

  • The checker runs under a work budget and returns an error instead of stalling.
  • Stack heights are checked in one pass over the control-flow graph, including peaks inside a block.
  • ENERGY reads the sample in place instead of copying it.
  • Python can interrupt a running VM with Ctrl-C.
  • The Linux wheels are built against glibc 2.17; installing needs glibc 2.27, the NumPy floor (0.5 needed 2.34 on x86_64).

Behaviour changes

The default checker accepts some programs 0.5 rejected and rejects some it accepted:

  • Accepted now: a program whose only fault is dead code, such as a DROP on a dead path or a read after HALT.
  • Rejected now: a read whose only earlier write sits after a terminator (ReadUnsetRegister), a stack that overflows inside one block and comes back down (StackOverflowRisk), and a JUMP or JUMPI into, out of or between loop bodies (JumpAcrossLoopBoundary).
  • A program rejected by both versions can report a different error or message.

Run xquad vm check over stored programs to find the ones affected.

Deprecations

The names 0.4 deprecated, apart from the CLI aliases, still work and warn in 0.6, and are removed in v0.7.0. The book's Deprecated APIs table lists each replacement.

Packages

Registry Packages
crates.io xqvm · xqasm
PyPI xquad
pip install xquad==0.6.0

Documentation: developers.quip.network/docs/xquad

Full changelog (32 changes)

Added

  • checker: Reject jumps across loop bodies [BREAKING]
  • xquad: Remove the deprecated top-level CLI commands [BREAKING]

Changed

  • checker: Append JumpAcrossLoopBoundary to CheckerError
  • xqvm: Rename the bytecode verifier to a checker [BREAKING]

Documentation

  • solving: Move the deprecated names' removal to v0.7.0
  • book: Link the 0.6 migration guide from Stability
  • book: Add the migration guide from 0.5 to 0.6
  • checker: Document the jump-span rule and JumpAcrossLoopBoundary
  • xqvm: List NonBinaryModel among the faults the checker cannot see
  • checker: Quote the every-path ReadUnsetRegister message
  • Install xquad as the only distribution
  • Name xqvm plainly and scope its fault-mapping claim
  • xqvm: Cite the spec instead of the removed reference VM
  • List every checker phase, rename Verification to Checking
  • Finish the checker rename and drop the removed CLI row
  • Call the bytecode check a checker

Fixed

  • xqsa: Say the deprecated names are removed in v0.7.0
  • xqvm: Reject constraint opcodes on non-binary models [BREAKING]
  • xqvm: Read the ENERGY sample in place
  • checker: Accept a dead loop closer and fail closed on missing facts
  • checker: Check exact stack heights in one CFG traversal [BREAKING]
  • xqvm: Construct reverse CFG edges without fan-in scans
  • checker: Make register analysis monotone and bounded [BREAKING]
  • checker: Reject transient intra-block stack overflow
  • checker: Stop block analysis at the first terminator
  • checker: Bound both minimum stack-depth walks
  • checker: Separate reachability from register lattice top
  • Refuse to import next to the 0.5 distributions, cover review gaps
  • xqffi: Let Python interrupt a running VM

Performance

  • checker: Propagate sparse register coordinate changes

Build

  • Make the root pyproject the xquad project [BREAKING]

Ci

  • release: Build, smoke and publish one distribution [BREAKING]

Full diff: v0.5.2...v0.6.0