Skip to content

Commit 21dda88

Browse files
committed
chore: replace zlinter with the default zig linter
1 parent 8019f17 commit 21dda88

File tree

8 files changed

+18
-41
lines changed

8 files changed

+18
-41
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
- name: Verify Zig installation
3030
run: zig version
3131

32-
- name: Run lint
32+
- name: Run lint (zig fmt --check)
3333
run: zig build lint
3434

3535
test:

build.zig

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -19,21 +19,10 @@ pub fn build(b: *std.Build) void {
1919
});
2020
b.installArtifact(lib);
2121

22-
// Lint (using zlinter)
23-
const zlinter = @import("zlinter");
24-
const lint_step = b.step("lint", "Run zlinter");
25-
lint_step.dependOn(step: {
26-
var builder = zlinter.builder(b, .{});
27-
builder.addPaths(.{
28-
.include = &.{ b.path("src/"), b.path("examples/"), b.path("test/") },
29-
});
30-
builder.addRule(.{ .builtin = .field_naming }, .{});
31-
builder.addRule(.{ .builtin = .declaration_naming }, .{});
32-
builder.addRule(.{ .builtin = .function_naming }, .{});
33-
builder.addRule(.{ .builtin = .no_unused }, .{});
34-
builder.addRule(.{ .builtin = .no_deprecated }, .{});
35-
break :step builder.build();
36-
});
22+
// Lint (using built-in formatter in check mode)
23+
const lint_cmd = b.addSystemCommand(&.{ "zig", "fmt", "--check", "src", "examples" });
24+
const lint_step = b.step("lint", "Run lint (zig fmt --check)");
25+
lint_step.dependOn(&lint_cmd.step);
3726

3827
// Tests
3928
const lib_unit_tests = b.addTest(.{

build.zig.zon

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,7 @@
44
.fingerprint = 0xc2f8b6b2acaee93c,
55
.minimum_zig_version = "0.14.1",
66

7-
.dependencies = .{
8-
.zlinter = .{
9-
.url = "git+https://github.com/kurtwagner/zlinter?ref=0.14.x#61d13720da00e47855d67397a8a36a7827aba165",
10-
.hash = "1220ef236272ded3155b3fa6e198f3cf57c9c82606fcb18ca4f76e1b2242fad2dfd2",
11-
},
12-
},
7+
.dependencies = .{},
138

149
.paths = .{
1510
"build.zig",

examples/profiling.zig

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -21,52 +21,48 @@ pub fn main() !void {
2121

2222
// Profile individual WOTS operations
2323
std.debug.print("--- Single WOTS Operation Profile ---\n", .{});
24-
24+
2525
const wots_priv_start_ts = std.time.nanoTimestamp();
2626
const priv_key = try sig_scheme.wots.generatePrivateKey(allocator, &seed, 0);
2727
const wots_priv_end_ts = std.time.nanoTimestamp();
28-
28+
2929
const pub_key = try sig_scheme.wots.generatePublicKey(allocator, priv_key);
3030
const wots_pub_end_ts = std.time.nanoTimestamp();
31-
31+
3232
const priv_time = @as(f64, @floatFromInt(wots_priv_end_ts - wots_priv_start_ts)) / 1_000_000.0;
3333
const pub_time = @as(f64, @floatFromInt(wots_pub_end_ts - wots_priv_end_ts)) / 1_000_000.0;
34-
34+
3535
std.debug.print(" generatePrivateKey: {d:.3} ms\n", .{priv_time});
3636
std.debug.print(" generatePublicKey: {d:.3} ms\n", .{pub_time});
3737
std.debug.print(" Total per leaf: {d:.3} ms\n\n", .{priv_time + pub_time});
38-
38+
3939
for (priv_key) |k| allocator.free(k);
4040
allocator.free(priv_key);
4141
allocator.free(pub_key);
4242

4343
// Profile hash operations
4444
std.debug.print("--- Hash Operation Profile ---\n", .{});
4545
const test_data = "test data for hashing";
46-
46+
4747
const hash_start_ts = std.time.nanoTimestamp();
4848
const hash_result = try sig_scheme.wots.hash.hash(allocator, test_data, 0);
4949
const hash_end_ts = std.time.nanoTimestamp();
5050
allocator.free(hash_result);
51-
51+
5252
const hash_time = @as(f64, @floatFromInt(hash_end_ts - hash_start_ts)) / 1_000_000.0;
5353
std.debug.print(" Single hash call: {d:.3} ms\n\n", .{hash_time});
5454

5555
// Calculate expected times
5656
const num_leaves = @as(usize, 1) << @intCast(params.tree_height);
5757
const chain_length = @as(u32, 1) << @intCast(@ctz(params.winternitz_w));
58-
58+
5959
std.debug.print("--- Theoretical Breakdown for 1,024 leaves ---\n", .{});
6060
std.debug.print(" Chain length: {}\n", .{chain_length});
6161
std.debug.print(" Chains per leaf: ~86\n", .{});
6262
std.debug.print(" Hashes per leaf: ~86 * {} = ~{}\n", .{ chain_length, 86 * chain_length });
6363
std.debug.print(" Total hashes: 1024 * {} = ~{}\n", .{ 86 * chain_length, 1024 * 86 * chain_length });
64-
std.debug.print(" Expected hash time: {d:.1} seconds\n", .{
65-
@as(f64, @floatFromInt(1024 * 86 * chain_length)) * hash_time / 1000.0
66-
});
67-
std.debug.print(" Expected leaf gen: {d:.1} seconds\n\n", .{
68-
@as(f64, @floatFromInt(num_leaves)) * (priv_time + pub_time) / 1000.0
69-
});
64+
std.debug.print(" Expected hash time: {d:.1} seconds\n", .{@as(f64, @floatFromInt(1024 * 86 * chain_length)) * hash_time / 1000.0});
65+
std.debug.print(" Expected leaf gen: {d:.1} seconds\n\n", .{@as(f64, @floatFromInt(num_leaves)) * (priv_time + pub_time) / 1000.0});
7066

7167
// Now do full keygen with timing
7268
std.debug.print("--- Full Key Generation ---\n", .{});
@@ -85,4 +81,3 @@ pub fn main() !void {
8581
std.debug.print(" Merkle tree: ~{d:.1}%\n", .{100.0 - leaf_gen_percent});
8682
std.debug.print(" Other overhead: ~{d:.1}%\n", .{@max(0.0, 100.0 - leaf_gen_percent - 10.0)});
8783
}
88-

src/merkle.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ pub const MerkleTree = struct {
132132
defer allocator.free(threads);
133133
// Spawn workers
134134
for (0..num_threads) |t| {
135-
threads[t] = try std.Thread.spawn(.{}, nodeWorker, .{ &ctx });
135+
threads[t] = try std.Thread.spawn(.{}, nodeWorker, .{&ctx});
136136
}
137137
// Join
138138
for (threads) |th| th.join();
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
// KoalaBear field: p = 2^31 - 2^24 + 1 = 127 * 2^24 + 1 = 2130706433 = 0x7f000001
22
pub const montgomery_field = @import("../generic_montgomery.zig").MontgomeryField31(127 * (1 << 24) + 1);
3-

src/poseidon2/poseidon2.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ pub fn Poseidon2(
4040
permutation(&state);
4141
var result: [output_len]F.FieldElem = undefined;
4242
inline for (0..output_len) |i| {
43-
// Add input[i] to montgomery form state[i]
43+
// Add input[i] to montgomery form state[i]
4444
var input_mont: F.MontFieldElem = undefined;
4545
F.toMontgomery(&input_mont, input[i]);
4646
F.add(&state[i], state[i], input_mont);

src/poseidon2/root.zig

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,3 @@ pub const koalabear16 = @import("instances/koalabear16.zig");
1313
// Re-export the main types (snake_case per lint)
1414
pub const poseidon2_koalabear16 = koalabear16.poseidon2_type;
1515
pub const koalabear_field = koalabear_montgomery.montgomery_field;
16-

0 commit comments

Comments
 (0)