Skip to content
refcellPublic

About

some zig components

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

zigware

Zig Platform Dependencies Status License

zigware is the Commonware Library rewritten from scratch in Zig: codec, cryptography, a deterministic runtime, storage, authenticated p2p, broadcast, and BFT consensus, with zero dependencies.

It is a ground-up port of the public commonware monorepo and keeps its layout: every crate there is a package here with the same name and the same dependency graph, and wire formats are byte-identical so the two can interoperate.

The estimator simulates a Simplex round across three AWS regions

The estimator runs a consensus protocol written in a small DSL over the deterministic runtime and the simulated p2p network, with real AWS inter-region latencies, and reports when each region crosses each step (video). Here Simplex finalizes across seven validators in three regions in about 114 ms at the mean. zig build run-estimator -- <file.lazy> --distribution <region:count,...> runs any protocol in examples/estimator.

Warning

zigware is pre-alpha and being ported now. Do not use it in production.

Packages

Package What it does Status
codec Serialize structured data ported
cryptography Keys, signatures, hashes, BLS12-381 threshold crypto porting
math Fields, polynomials, NTT porting
runtime Async tasks with a deterministic scheduler or io_uring porting
storage Journals, archives, MMRs, authenticated databases porting
utils Shared functionality across primitives porting
parallel Parallel folds with pluggable strategies porting
actor Coordinate concurrent components ported
stream Encrypted messages over any transport ported
p2p Communicate with authenticated peers porting
broadcast Disseminate data over a wide-area network planned
resolver Resolve data by a fixed-length key porting
collector Collect responses to committable requests planned
coding Erasure-code data for recovery from fragments ported
clearing Settle actions at scale planned
consensus Order messages in a Byzantine environment (simplex, aggregation, marshal) porting
glue Default constructions spanning several primitives planned
deployer Deploy infrastructure across cloud providers planned

Support packages: formatting, conformance, invariants, simd, allocator, bench. docs/ARCHITECTURE.md maps every commonware crate to its package and lists the dependency order.

Design

  • Zero dependencies. Only the Zig standard library: no C libraries, no vendored code, build.zig.zon has an empty .dependencies. BLS12-381, ed25519, secp256r1, the hashes, Reed-Solomon, the runtime, and the storage engines are all implemented here.
  • Same wire formats. Encodings, storage layouts, and network messages match commonware's byte for byte, checked against commonware's own test vectors and conformance hashes.
  • Deterministic simulation testing. All time, randomness, tasks, network, and storage go through the runtime. The deterministic runtime runs real protocol code on a simulated network with fault injection, and any run replays exactly from its seed.
  • TigerStyle. Assertions on every precondition, postcondition, and invariant; every loop, queue, and mailbox bounded; no recursion; functions ≤ 70 lines. See docs/TIGER_STYLE.md.
  • Fuzzed. Every decoder, parser, and state machine has a coverage-guided fuzz target and a seeded fuzz run that executes with the normal test suite.
  • io_uring. The production runtime is completion-based IO on Linux, kqueue on macOS.

Installation

git clone https://github.com/refcell/zigware && cd zigware
just release

just release needs just and curl. It uses Zig 0.17.1 from PATH, or downloads it into .cache/zig, and writes optimized binaries to zig-out/bin. zigware has no other build dependency. There are no tagged releases; build from main.

Use a package from your own build.zig through the zigware module, or one package by name (b.dependency("zigware", .{}).module("codec")).

Contributing

just lists every development recipe. zig build test runs every package's tests and zig build test-<package> runs one. Contributor rules are in AGENTS.md; the port's work split is in docs/lanes and docs/ROADMAP.md.

License

MIT. zigware is a port of the Commonware Library, which is dual-licensed under MIT and Apache 2.0.

About

some zig components

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages