chore: upgrade to Zig 0.16.0#10
Merged
wemeetagain merged 6 commits intoChainSafe:mainfrom Apr 20, 2026
Merged
Conversation
- std.ArrayList is now unmanaged by default; use .empty + explicit allocator - addCSourceFiles/addIncludePath moved from Compile to Module (lib.root_module) - Add zig-pkg/ to .gitignore (new local dep storage in 0.16) 🤖 Generated with AI assistance
1. build.zig: Use ArrayListUnmanaged instead of ArrayList - the managed ArrayList no longer has .empty in Zig 0.16. 2. build.zig.zon: Point to lodekeeper-z/hashtree fork which fixes macOS ARM64 assembly syntax. The upstream assembly files incorrectly mixed ELF (#:lo12:) and Mach-O (@PAGEOFF) relocation syntax, which newer clang (in Zig 0.16) rejects. 🤖 Generated with AI assistance
There was a problem hiding this comment.
Pull request overview
Updates this package to be compatible with Zig 0.16-dev (master) as part of the wider Zig master upgrade effort, primarily by adjusting build-system APIs and aligning dependency metadata/CI.
Changes:
- Update
hashtreedependency pin inbuild.zig.zon. - Migrate build script usage to newer build APIs (e.g.,
root_modulemethods,ArrayListUnmanagedappend signatures). - Update CI Zig version and extend
.gitignorefor newer Zig artifacts.
Reviewed changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
build.zig.zon |
Updates dependency pin/hash for hashtree. |
build.zig |
Adjusts build script to newer Zig build/module APIs. |
.gitignore |
Normalizes .zig-cache/ entry and adds zig-pkg/. |
.github/workflows/ci.yml |
Updates Zig toolchain version used in CI. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 4 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
wemeetagain
approved these changes
Apr 17, 2026
GrapeBaBa
added a commit
to GrapeBaBa/state-transition-z
that referenced
this pull request
Apr 21, 2026
Four of the five Zig-0.16-upgrade PRs on our dependency forks have merged into ChainSafe upstream main: * ChainSafe/blst.zig#4 → 6ad139a * ChainSafe/hashtree-z#10 → 56e406f * ChainSafe/snappy.zig#5 → 7139424 * ChainSafe/zig-yaml#1 → b74f4e8 Switch from `lodekeeper-z/<repo>?ref=chore/zig-master` to the merged commit on `ChainSafe/<repo>` main for each. Content is identical so the existing `hash` fields stay valid. `zapi` (ChainSafe/zapi#9) is still open upstream — bump the `lodekeeper-z/zapi` commit pointer to the current PR head (fefb88ebf5c9) which includes the latest port/refactor work; TODO note to switch to ChainSafe/zapi once ChainSafe#9 merges.
wemeetagain
pushed a commit
to ChainSafe/lodestar-z
that referenced
this pull request
Apr 24, 2026
## Motivation Get the codebase cleanly compatible with **Zig 0.16.0** release, following the new "explicit `io` everywhere, no hidden global state" design — without changing runtime behavior. ## Description - **`std.Io`** — File/Dir operations, `Mutex`/`Condition`/`Event` (cancelable vs uncancelable split), entropy via `io.random`/`io.randomSecure`, timestamps via `std.Io.Timestamp` - **ArrayList unmanaged** — allocator threaded through `deinit`/`append`/`resize`/`ensureCapacity`/`clone`; replace `items.len = N` hacks with `resize` / `expandToCapacity` / `appendNTimesAssumeCapacity` (preserves semantics, matches `initCapacity`'s Precise allocation) - **Struct builder** — `@Type(.@"struct" = ...)` → `@Struct(names, types, attrs)` builtin in `ssz/type/container.zig` - **Copy-elision workaround** — `std.Io` 0.16 result-location semantics pre-write the union tag of the assignment target, so reads from `self.state.init_group.*` during RHS evaluation would observe the new variant. Snapshot pre-upgrade fields to locals in `state_transition.zig` fork-upgrade chain and `era/Writer.zig` - **ThreadPool** — `io` is a parameter on `init`/`deinit`/`verifyMultipleAggregateSignatures`/`aggregateVerify` (not a stored field); normal paths use cancelable `lock`; shutdown + `submitAndWait.done.wait` stay uncancelable with comments explaining the invariant - **Shared `src/time.zig`** — `timestampNow` / `since (Duration)` / `durationSeconds`, replacing four duplicated helper pairs across `state_transition` and `bench` - **IO signature convention** — `(allocator?, io, file, ...)` applied consistently to `e2s.*` and `era.*` - **Reader API polish** — `takeArray` (zero-copy) + `readSliceAll` where appropriate; drop single-buffer `readVecAll` and `catch |err| return err` - **Other**: `RefCount` comptime-reflect on wrapped T's deinit arity (1-arg vs 2-arg) so 0.16 unmanaged `ArrayList` and project types with stored allocators both work; `sanitize_c = .trap` on blst artifact so Debug fuzz builds link without `libubsan`; untrack 426 stale `test/fuzz/zig-pkg/` entries from the git index - **CI**: `ZIG_VERSION` bumped `0.14.1 → 0.16.0`; `zbuild` sync-check + `build-examples` jobs temporarily commented out pending upstream Zig 0.16 support ## Dependency PRs Each Zig 0.16 upgrade landed as a dedicated PR on the upstream repo. `build.zig.zon` points at `lodekeeper-z` forks on the `chore/zig-master` branch until these merge and cut releases: | Dependency | Upstream PR | |---|---| | `blst` | [ChainSafe/blst.zig#4](ChainSafe/blst.zig#4) | | `hashtree` | [ChainSafe/hashtree-z#10](ChainSafe/hashtree-z#10) | | `snappy` | [ChainSafe/snappy.zig#5](ChainSafe/snappy.zig#5) | | `yaml` | [ChainSafe/zig-yaml#1](ChainSafe/zig-yaml#1) | | `zapi` | [ChainSafe/zapi#9](ChainSafe/zapi#9) | | `httpz` (disabled) | [karlseguin/http.zig#191](karlseguin/http.zig#191) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Upgrade to Zig 0.16.0-dev (master) — part of the lodestar-z Zig master upgrade effort.
Key changes:
std.io→std.Iomigrationstd.Io.Dirmethods now require explicitioparameter🤖 Generated with AI assistance