Skip to content

chore: upgrade zig to 0.15#1225

Open
dnut wants to merge 27 commits intomainfrom
dnut/0.15-upgrade
Open

chore: upgrade zig to 0.15#1225
dnut wants to merge 27 commits intomainfrom
dnut/0.15-upgrade

Conversation

@dnut
Copy link
Contributor

@dnut dnut commented Feb 10, 2026

This upgrades Sig from Zig 0.14 to 0.15. Each commit targets a specific API change and can be reviewed independently. See the commit messages for details.

  • Build system: Version parsing, enum syntax, module patterns, dependency updates
  • Compatibility layer: std14 module to ease migration from removed APIs (BoundedArray, LinearFifo, etc.)
  • Core API migrations: Pointer/alignment, sleep, ArrayList, std.io, DoublyLinkedList, format specifiers
  • Networking: HTTP client/server, RPC, snapshot downloading
  • Encoding: protobuf, base58/leb128, tar parsing, bincode
  • Compiler details: VM tail calls, inline asm syntax, workarounds for bugs in self-hosted x86 backend

Diff Size

It looks like I added a lot of code here. 2900 of the added lines are due to regenerating the protobuf definitions. usingnamespace no longer exists in 0.15, which means the protobuf types need to be represented a lot more verbosely. This is 100% codegen and doesn't need a review, unless you'd like to validate that the protobuf codegen produces the exact file I've included.

Compatibility & Best Practices

This PR does not aim to upgrade every single piece of code to use the greatest features and the best practices of 0.15. There are some lingering items from 0.14 like bounded arrays, managed lists, and deprecated readers and writers. Migrating away from these things is not in scope for this PR. After this PR is merged, we can upgrade these things if desired. The idea here is to enable usage of 0.15 without making anything worse, to facilitate incremental improvement.

@dnut dnut requested review from ultd and yewman as code owners February 10, 2026 04:26
@github-project-automation github-project-automation bot moved this to 🏗 In progress in Sig Feb 10, 2026
@dnut dnut force-pushed the dnut/0.15-upgrade branch 5 times, most recently from ea1e9ca to 3cb08c1 Compare February 11, 2026 15:00
@dnut dnut requested a review from Sobeston February 11, 2026 18:15
@dnut dnut force-pushed the dnut/0.15-upgrade branch from 7355145 to 825a3a5 Compare February 11, 2026 20:58
@github-project-automation github-project-automation bot moved this from 🏗 In progress to 👀 In review in Sig Feb 11, 2026
@dnut dnut force-pushed the dnut/0.15-upgrade branch from 587f8eb to 46a19fa Compare February 12, 2026 03:38
@codecov
Copy link

codecov bot commented Feb 12, 2026

Codecov Report

❌ Patch coverage is 85.16687% with 120 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/accountsdb/snapshot/download.zig 27.58% 21 Missing ⚠️
src/rpc/server/basic.zig 62.50% 18 Missing ⚠️
src/net/echo.zig 0.00% 10 Missing ⚠️
src/ledger/tests.zig 68.18% 7 Missing ⚠️
src/time/estimate.zig 0.00% 7 Missing ⚠️
src/runtime/program/system/execute.zig 0.00% 5 Missing ⚠️
src/shred_network/service.zig 0.00% 4 Missing ⚠️
src/testing.zig 0.00% 4 Missing ⚠️
src/accountsdb/snapshot/load.zig 93.18% 3 Missing ⚠️
src/gossip/shards.zig 50.00% 3 Missing ⚠️
... and 22 more
Files with missing lines Coverage Δ
src/accountsdb/buffer_pool.zig 94.98% <100.00%> (+0.17%) ⬆️
src/accountsdb/index.zig 96.51% <ø> (+0.77%) ⬆️
src/accountsdb/manager.zig 96.57% <100.00%> (+<0.01%) ⬆️
src/accountsdb/two/Unrooted.zig 100.00% <ø> (ø)
src/benchmarks.zig 50.00% <ø> (ø)
src/bincode/bincode.zig 89.89% <100.00%> (ø)
src/bincode/shortvec.zig 89.18% <100.00%> (ø)
src/bloom/bloom.zig 98.98% <ø> (ø)
src/consensus/fork_choice.zig 98.49% <100.00%> (+0.34%) ⬆️
src/consensus/latest_validator_votes.zig 95.41% <100.00%> (ø)
... and 125 more

... and 25 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@dnut dnut force-pushed the dnut/0.15-upgrade branch 4 times, most recently from b6b5603 to d619fa3 Compare February 13, 2026 21:08
dnut added 10 commits February 13, 2026 16:03
- use std.SemanticVersion.parse(@import("build.zig.zon").version) instead of hardcoded version
- update format specifiers from {} to {f} for SemanticVersion
zig 0.15 changed sanitize_c from bool to enum: false -> .off
- add explicit target/optimize to gh_table
- add imports to vm_exe root_module
- rewrite generateTable() to use addWriteFiles() + addCopyFile()
- update send-file executable to use root_module wrapper
- bump minimum_zig_version to 0.15.2
- update dependency URLs and hashes for:
  httpz, zstd, rocksdb, lsquic, xev, prettytable,
  base58, poseidon, tracy, protobuf
- add use_llvm = true for solfuzz_sig_lib (self-hosted backend workaround)
- update pb.RunProtocStep.create() signature (remove first arg)
Vendor implementations from Zig 0.14 standard library that were removed in 0.15:
- BoundedArray (removed, use ArrayListUnmanaged with capacity)
- LinearFifo (removed entirely)
- countingWriter (removed)
- limitedReader (removed)
- deprecatedReader (for GenericReader compatibility)

Wire std14 module into build.zig and migrate all usages across the codebase.
- @aligncast must now come before @ptrCast (order swap)
- Pointer size enum: .One -> .one (lowercase)
- alignment is now enum instead of comptime_int
Type alias update - functionality unchanged.
These APIs have been replaced, with the old structs being relegated to std.io.GenericReader/GenericWriter.

- use new Reader/Writer where simple to integrate
- use adapters like deprecatedReader where it is not straightforward to migrate
- std.json.stringify -> std.json.fmt for format string usage
- std streams now accessed through std.fs.File instead of std.io
dnut and others added 17 commits February 13, 2026 16:08
The list no longer wraps data in nodes automatically. Instead, embed a
DoublyLinkedList.Node field in your struct and use @fieldParentPtr to
recover the containing struct. This affects LRU cache implementation.
- {} no longer auto-formats; must use {any}, {s}, {d}, {f}, etc.
- Durations: std.fmt.fmtDuration() removed, use {D} specifier
- Custom format functions: format(self, comptime fmt, options, writer)
  signature changed to format(self, writer)
- SPIR-V backend enum rename, used for eql_bytes optimization
- Snapshot archive name formatting: use std.fmt.format() directly since
  the old fmt spec approach is no longer compatible
Major breaking changes in 0.15:
- Server: new request/response lifecycle with explicit send() calls
- Client: Request struct changes, header iteration API different
- Connection handling and keep-alive semantics changed
- Response body reading uses different buffer patterns
The self-hosted x86_64 backend doesn't support .always_tail in Debug
builds. Use conditional call modifier based on build mode.
ManagedString type replaced with []const u8 throughout generated code.
Bindings regenerated with zig-protobuf for Zig 0.15.
- base58.decodeBounded/encodeArray -> decode/encode
- leb128.writeULEB128 -> writeUleb128 (case change)
std.tar.iterator() now validates checksums and fails on our snapshots.
Use manual header parsing via TarHeaderMinimal to skip checksum validation.
Clobber list in inline assembly now uses .{} tuple syntax instead of
string literal.
std.EnumMap doesn't work with comptime-only types due to non-zero
runtime alignment requirements. Use inline switch over enum values
at comptime for getBenchmarks dispatch instead.
- std.fmt.allocPrintZ signature changed
- RocksDB liveFiles() returns different iterator type
Cleanup unused empty file.
i updated build.zig to fix a rocksdb issue but the cache still includes the old broken rocksdb. the cache needs to be cleared on build.zig changes so it can rebuild dependencies with the configured options
this test was deadlocking on the macos runner in CI: "loadPrograms: load v3 program" because it creates a program map, loads it (which acquires and releases the lock), then returns the map (which relocates the RwLock to a different memory locations), and uses the lock again. this has UB in pthread's rwlock because pthread expects the rwlock to be pinned to a specific memory location.

to avoid UB we should use DefaultRwLock. pthread's RwLock relies on too many assumptions that sig does not guarantee to uphold.
@dnut dnut force-pushed the dnut/0.15-upgrade branch from d619fa3 to 6a79c2f Compare February 13, 2026 23:09
@dnut dnut enabled auto-merge February 13, 2026 23:26
@dnut dnut disabled auto-merge February 13, 2026 23:28
Copy link
Contributor Author

@dnut dnut left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't merge this until you verify it works with manual testing. i did some preliminary testing and had an issue connecting to gossip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: 👀 In review

Development

Successfully merging this pull request may close these issues.

4 participants