Skip to content

Commit 9c2a1c7

Browse files
committed
upgrade to zig 0.14.0
1 parent 2b9cec4 commit 9c2a1c7

File tree

10 files changed

+57
-58
lines changed

10 files changed

+57
-58
lines changed

.github/workflows/CI.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,15 @@ jobs:
2222
submodules: true
2323
- uses: goto-bus-stop/setup-zig@v2
2424
with:
25-
version: 0.13.0
25+
version: 0.14.0
2626
- run: zig build test
2727
lint:
2828
runs-on: ubuntu-latest
2929
steps:
3030
- uses: actions/checkout@v4
3131
- uses: goto-bus-stop/setup-zig@v2
3232
with:
33-
version: 0.13.0
33+
version: 0.14.0
3434
- run: zig fmt --check .
3535
flake-check:
3636
strategy:

build.zig

+12-3
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ pub fn build(b: *std.Build) void {
6060
indexer.root_module.addImport("crypto", crypto);
6161
indexer.linkLibrary(sqlite.artifact("sqlite"));
6262
indexer.root_module.addImport("sqlite", sqlite_module);
63+
6364
indexer.linkSystemLibrary("zmq");
6465
indexer.root_module.addImport("zzmq", zzmq_module);
6566

@@ -75,9 +76,17 @@ pub fn build(b: *std.Build) void {
7576
// This declares intent for the executable to be installed into the
7677
// standard location when the user invokes the "install" step (the default
7778
// step when running `zig build`).
78-
b.installArtifact(indexer);
79-
b.installArtifact(wbx);
80-
b.installArtifact(walle);
79+
80+
const no_bin = b.option(bool, "no-bin", "skip emitting binary") orelse false;
81+
if (no_bin) {
82+
b.getInstallStep().dependOn(&indexer.step);
83+
b.getInstallStep().dependOn(&walle.step);
84+
b.getInstallStep().dependOn(&wbx.step);
85+
} else {
86+
b.installArtifact(indexer);
87+
b.installArtifact(wbx);
88+
b.installArtifact(walle);
89+
}
8190

8291
// This *creates* a Run step in the build graph, to be executed when another
8392
// step is evaluated that depends on it. The next line below will establish

build.zig.zon

+13-10
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
//
77
// It is redundant to include "zig" in this name because it is already
88
// within the Zig package namespace.
9-
.name = "walle",
9+
.name = .walle,
1010

1111
// This is a [Semantic Version](https://semver.org/).
1212
// In a future version of Zig it will be used for package deduplication.
@@ -15,7 +15,10 @@
1515
// This field is optional.
1616
// This is currently advisory only; Zig does not yet do anything
1717
// with this value.
18-
.minimum_zig_version = "0.13.0",
18+
.minimum_zig_version = "0.14.0",
19+
20+
// Fingerprint
21+
.fingerprint = 0xbb17d89c5f908106,
1922

2023
// This field is optional.
2124
// Each dependency must either provide a `url` and `hash`, or a `path`.
@@ -25,20 +28,20 @@
2528
.dependencies = .{
2629
// See `zig fetch --save <url>` for a command-line interface for adding dependencies.
2730
.@"base58-zig" = .{
28-
.url = "https://github.com/iskyd/base58-zig/archive/0.1.2.tar.gz",
29-
.hash = "12206e5050a03cd9dcb896781de0cf541081488006532675371653f61d00c1f27433",
31+
.url = "https://github.com/iskyd/base58-zig/archive/v0.1.5.tar.gz",
32+
.hash = "12206c8b081d6c9b9dc565a60e4b9557c127a5ad13ad413dba39ba100bbc8b109779",
3033
},
3134
.clap = .{
32-
.url = "https://github.com/Hejsil/zig-clap/archive/0.9.1.tar.gz",
33-
.hash = "122062d301a203d003547b414237229b09a7980095061697349f8bef41be9c30266b",
35+
.url = "https://github.com/Hejsil/zig-clap/archive/0.10.0.tar.gz",
36+
.hash = "12204387e122dd8b6828847165a7153c5d624b0a77217fd907c7f4f718ecce36e217",
3437
},
3538
.sqlite = .{
36-
.url = "https://github.com/vrischmann/zig-sqlite/archive/91e5fedd15c5ea3cb42ccceefb3d0f4bb9bad68f.tar.gz",
37-
.hash = "1220ba277845cb3cece7a7a1f929b920c97e9085bb644471c5dc8c72571f1485c75f",
39+
.url = "https://github.com/vrischmann/zig-sqlite/archive/59c06617d5b86546c0c739e73ae01d3965dbe8ce.tar.gz",
40+
.hash = "12209f387e54109623b8e09ef878b19cb8d3a3139d106004337c6417e05f8e4d6864",
3841
},
3942
.zzmq = .{
40-
.url = "https://github.com/iskyd/zzmq/archive/refs/tags/v0.2.4.tar.gz",
41-
.hash = "1220f525d289055025de07d396ba2e7a995105f898cd588c721a87426e21ba809270",
43+
.url = "https://github.com/iskyd/zzmq/archive/refs/tags/v0.3.0.tar.gz",
44+
.hash = "122011cb2acedf8d5688fa3f2affd55265f35fc8254fcb542b7f492c727e8dbcc2f5",
4245
},
4346
},
4447

flake.lock

+20-34
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
pkgs.zig
2727
pkgs.sqlite
2828
pkgs.zeromq
29+
pkgs.pkg-config
2930
config.pre-commit.settings.enabledPackages
3031
];
3132
shellHook = ''

src/bip39.zig

+5-5
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ pub const WordList = struct {
2020
}
2121

2222
pub fn getWords(self: WordList) [2048][]const u8 {
23-
var lines = std.mem.split(u8, self.data, word_separator);
23+
var lines = std.mem.tokenizeSequence(u8, self.data, word_separator);
2424
var words: [2048][]const u8 = undefined;
2525
var index: u16 = 0;
2626

@@ -41,7 +41,7 @@ pub fn generateEntropy(buffer: []u8, ent: u16) void {
4141
rand.bytes(buffer);
4242
}
4343

44-
pub fn generateMnemonic(allocator: std.mem.Allocator, entropy: []u8, wordlist: WordList, buffer: [][]const u8) !void {
44+
pub fn generateMnemonic(allocator: std.mem.Allocator, entropy: []u8, wordlist: WordList, buffer: [][]u8) !void {
4545
// Checksum is 1 bit for every 32 bits of entropy
4646
const checksum_bits: u8 = @intCast(entropy.len / 4);
4747
var checksum: [32]u8 = undefined;
@@ -96,7 +96,7 @@ test "generateMnemonic" {
9696
defer for (b1) |word| allocator.free(word);
9797

9898
const str1 = "void come effort suffer camp survey warrior heavy shoot primary clutch crush open amazing screen patrol group space point ten exist slush involve unfold";
99-
var expected1 = std.mem.split(u8, str1, " ");
99+
var expected1 = std.mem.tokenizeScalar(u8, str1, ' ');
100100
var i: u16 = 0;
101101
while (expected1.next()) |word| {
102102
try std.testing.expectEqualStrings(word, b1[i]);
@@ -110,7 +110,7 @@ test "generateMnemonic" {
110110
defer for (b2) |word| allocator.free(word);
111111

112112
const str2 = "all hour make first leader extend hole alien behind guard gospel lava path output census museum junior mass reopen famous sing advance salt reform";
113-
var expected2 = std.mem.split(u8, str2, " ");
113+
var expected2 = std.mem.tokenizeScalar(u8, str2, ' ');
114114
i = 0;
115115
while (expected2.next()) |word| {
116116
try std.testing.expectEqualStrings(word, b2[i]);
@@ -123,7 +123,7 @@ test "generateMnemonic" {
123123
try generateMnemonic(allocator, &e3, wordlist, &b3);
124124
defer for (b3) |word| allocator.free(word);
125125
const str3 = "merit police comic universe video security can peace monitor drum crucial traffic";
126-
var expected3 = std.mem.split(u8, str3, " ");
126+
var expected3 = std.mem.tokenizeScalar(u8, str3, ' ');
127127
i = 0;
128128
while (expected3.next()) |word| {
129129
try std.testing.expectEqualStrings(word, b3[i]);

src/script.zig

+1-1
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ pub fn p2pk(allocator: std.mem.Allocator, pubkey: []const u8) !Script {
321321
}
322322

323323
// pubkeys as str
324-
pub fn p2ms(allocator: std.mem.Allocator, pubkeys: [][]const u8, m: u8, n: u8) !Script {
324+
pub fn p2ms(allocator: std.mem.Allocator, pubkeys: [][]u8, m: u8, n: u8) !Script {
325325
assert(m <= n);
326326
assert(m != 0);
327327
assert(n <= 16);

src/seed_signer.zig

Whitespace-only changes.

src/walle.zig

+1-1
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ pub fn main() !void {
119119
// defer wordlist.deinit();
120120
var entropy: [16]u8 = undefined;
121121
bip39.generateEntropy(&entropy, 128);
122-
var mnemonic: [12][]u8 = undefined;
122+
var mnemonic: [12][]const u8 = undefined;
123123
try bip39.generateMnemonic(allocator, &entropy, wordlist, &mnemonic);
124124
std.debug.print("This is your mnemonic. Save it offline and dont forget it, otherwise you will loose your funds\n", .{});
125125
for (mnemonic) |word| {

src/wbx.zig

+2-2
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ pub fn main() !void {
9292
const entropy = try allocator.alloc(u8, ent / 8);
9393
defer allocator.free(entropy);
9494
bip39.generateEntropy(entropy, ent);
95-
var mnemonic: [24][]u8 = undefined;
95+
var mnemonic: [24][]const u8 = undefined;
9696
const wordlist = try bip39.WordList.init(allocator, "wordlist/english.txt");
9797
defer wordlist.deinit();
9898
try bip39.generateMnemonic(allocator, entropy, wordlist, &mnemonic);
@@ -141,7 +141,7 @@ pub fn main() !void {
141141
return;
142142
};
143143
const path = args[3];
144-
var it = std.mem.split(u8, path, "/");
144+
var it = std.mem.tokenizeScalar(u8, path, '/');
145145

146146
var current = epk;
147147
var depth: u8 = 0;

0 commit comments

Comments
 (0)