Skip to content

Commit 8250cf9

Browse files
committed
fix style
1 parent 8a91b51 commit 8250cf9

File tree

6 files changed

+43
-21
lines changed

6 files changed

+43
-21
lines changed

src/replay/preprocess_transaction.zig

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,11 @@ pub fn preprocessTransaction(
3939
};
4040

4141
if (sig_verify == .run_sig_verify) {
42-
txn.verifySignatures(msg_bytes.constSlice()) catch |err| return switch (err) {
43-
error.SignatureVerificationFailed => .{ .err = .SignatureFailure },
44-
else => .{ .err = .SanitizeFailure },
42+
txn.verifySignatures(msg_bytes.constSlice()) catch |err| {
43+
return switch (err) {
44+
error.SignatureVerificationFailed => .{ .err = .SignatureFailure },
45+
else => .{ .err = .SanitizeFailure },
46+
};
4547
};
4648
}
4749

src/zksdk/range_proof/bulletproofs.zig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -693,12 +693,14 @@ pub fn Data(bit_size: comptime_int) type {
693693
return @bitCast(self);
694694
}
695695

696+
// sig fmt: off
696697
fn newTranscript(self: Context) Transcript {
697698
return .init(.@"batched-range-proof-instruction", &.{
698699
.{ .label = "commitments", .message = .{ .bytes = std.mem.sliceAsBytes(&self.commitments) } },
699700
.{ .label = "bit-lengths", .message = .{ .bytes = std.mem.sliceAsBytes(&self.bit_lengths) } },
700701
});
701702
}
703+
// sig fmt: on
702704
};
703705
};
704706
}

src/zksdk/sigma_proofs/ciphertext_ciphertext.zig

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -281,15 +281,17 @@ pub const Data = struct {
281281
self.first_ciphertext.toBytes() ++ self.second_ciphertext.toBytes();
282282
}
283283

284+
// zig fmt: off
284285
fn newTranscript(self: Context) Transcript {
285286
return .init(.@"ciphertext-ciphertext-equality-instruction", &.{
286-
.{ .label = "first-pubkey", .message = .{ .pubkey = self.first_pubkey } },
287-
.{ .label = "second-pubkey", .message = .{ .pubkey = self.second_pubkey } },
287+
.{ .label = "first-pubkey", .message = .{ .pubkey = self.first_pubkey } },
288+
.{ .label = "second-pubkey", .message = .{ .pubkey = self.second_pubkey } },
288289

289-
.{ .label = "first-ciphertext", .message = .{ .ciphertext = self.first_ciphertext } },
290+
.{ .label = "first-ciphertext", .message = .{ .ciphertext = self.first_ciphertext } },
290291
.{ .label = "second-ciphertext", .message = .{ .ciphertext = self.second_ciphertext } },
291292
});
292293
}
294+
// zig fmt: on
293295
};
294296

295297
pub fn init(

src/zksdk/sigma_proofs/grouped_ciphertext/handles_2.zig

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,10 @@ pub const Proof = struct {
160160
) !void {
161161
// for batched we have the batched contract which includes the initial
162162
// `t` challenge, and then the base one that's shared between batched and non batched.
163-
comptime var session = Transcript.getSession(if (batched) batched_contract ++ contract else contract);
163+
comptime var session = Transcript.getSession(if (batched)
164+
batched_contract ++ contract
165+
else
166+
contract);
164167
defer session.finish();
165168

166169
const t = if (batched) t: {
@@ -350,13 +353,15 @@ pub const Data = struct {
350353
self.grouped_ciphertext.toBytes();
351354
}
352355

356+
// zig fmt: off
353357
fn newTranscript(self: Context) Transcript {
354358
return .init(.@"grouped-ciphertext-validity-2-handles-instruction", &.{
355-
.{ .label = "first-pubkey", .message = .{ .pubkey = self.first_pubkey } },
356-
.{ .label = "second-pubkey", .message = .{ .pubkey = self.second_pubkey } },
359+
.{ .label = "first-pubkey", .message = .{ .pubkey = self.first_pubkey } },
360+
.{ .label = "second-pubkey", .message = .{ .pubkey = self.second_pubkey } },
357361
.{ .label = "grouped-ciphertext", .message = .{ .grouped_2 = self.grouped_ciphertext } },
358362
});
359363
}
364+
// zig fmt: on
360365
};
361366

362367
pub fn init(
@@ -472,14 +477,16 @@ pub const BatchedData = struct {
472477
self.grouped_ciphertext_hi.toBytes();
473478
}
474479

480+
// zig fmt: off
475481
fn newTranscript(self: Context) Transcript {
476482
return .init(.@"batched-grouped-ciphertext-validity-2-handles-instruction", &.{
477-
.{ .label = "first-pubkey", .message = .{ .pubkey = self.first_pubkey } },
478-
.{ .label = "second-pubkey", .message = .{ .pubkey = self.second_pubkey } },
483+
.{ .label = "first-pubkey", .message = .{ .pubkey = self.first_pubkey } },
484+
.{ .label = "second-pubkey", .message = .{ .pubkey = self.second_pubkey } },
479485
.{ .label = "grouped-ciphertext-lo", .message = .{ .grouped_2 = self.grouped_ciphertext_lo } },
480486
.{ .label = "grouped-ciphertext-hi", .message = .{ .grouped_2 = self.grouped_ciphertext_hi } },
481487
});
482488
}
489+
// zig fmt: on
483490
};
484491

485492
pub fn init(

src/zksdk/sigma_proofs/grouped_ciphertext/handles_3.zig

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,10 @@ pub const Proof = struct {
175175
params: Params(batched),
176176
transcript: *Transcript,
177177
) !void {
178-
comptime var session = Transcript.getSession(if (batched) batched_contract ++ contract else contract);
178+
comptime var session = Transcript.getSession(if (batched)
179+
batched_contract ++ contract
180+
else
181+
contract);
179182
defer session.finish();
180183

181184
const t = if (batched) t: {
@@ -358,14 +361,16 @@ pub const Data = struct {
358361
self.grouped_ciphertext.toBytes();
359362
}
360363

364+
// zig fmt: off
361365
fn newTranscript(self: Context) Transcript {
362366
return .init(.@"grouped-ciphertext-validity-3-handles-instruction", &.{
363-
.{ .label = "first-pubkey", .message = .{ .pubkey = self.first_pubkey } },
364-
.{ .label = "second-pubkey", .message = .{ .pubkey = self.second_pubkey } },
365-
.{ .label = "third-pubkey", .message = .{ .pubkey = self.third_pubkey } },
367+
.{ .label = "first-pubkey", .message = .{ .pubkey = self.first_pubkey } },
368+
.{ .label = "second-pubkey", .message = .{ .pubkey = self.second_pubkey } },
369+
.{ .label = "third-pubkey", .message = .{ .pubkey = self.third_pubkey } },
366370
.{ .label = "grouped-ciphertext", .message = .{ .grouped_3 = self.grouped_ciphertext } },
367371
});
368372
}
373+
// zig fmt: on
369374
};
370375

371376
pub fn init(
@@ -494,15 +499,17 @@ pub const BatchedData = struct {
494499
self.grouped_ciphertext_hi.toBytes();
495500
}
496501

502+
// zig fmt: off
497503
fn newTranscript(self: Context) Transcript {
498504
return .init(.@"batched-grouped-ciphertext-validity-3-handles-instruction", &.{
499-
.{ .label = "first-pubkey", .message = .{ .pubkey = self.first_pubkey } },
500-
.{ .label = "second-pubkey", .message = .{ .pubkey = self.second_pubkey } },
501-
.{ .label = "third-pubkey", .message = .{ .pubkey = self.third_pubkey } },
505+
.{ .label = "first-pubkey", .message = .{ .pubkey = self.first_pubkey } },
506+
.{ .label = "second-pubkey", .message = .{ .pubkey = self.second_pubkey } },
507+
.{ .label = "third-pubkey", .message = .{ .pubkey = self.third_pubkey } },
502508
.{ .label = "grouped-ciphertext-lo", .message = .{ .grouped_3 = self.grouped_ciphertext_lo } },
503509
.{ .label = "grouped-ciphertext-hi", .message = .{ .grouped_3 = self.grouped_ciphertext_hi } },
504510
});
505511
}
512+
// zig fmt: on
506513
};
507514

508515
pub fn init(

src/zksdk/sigma_proofs/percentage_with_cap.zig

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -444,14 +444,16 @@ pub const Data = struct {
444444
self.claimed_commitment.toBytes() ++ @as([8]u8, @bitCast(self.max_value));
445445
}
446446

447+
// zig fmt: off
447448
fn newTranscript(self: Context) Transcript {
448449
return .init(.@"percentage-with-cap-instruction", &.{
449450
.{ .label = "percentage-commitment", .message = .{ .commitment = self.percentage_commitment } },
450-
.{ .label = "delta-commitment", .message = .{ .commitment = self.delta_commitment } },
451-
.{ .label = "claimed-commitment", .message = .{ .commitment = self.claimed_commitment } },
452-
.{ .label = "max-value", .message = .{ .u64 = self.max_value } },
451+
.{ .label = "delta-commitment", .message = .{ .commitment = self.delta_commitment } },
452+
.{ .label = "claimed-commitment", .message = .{ .commitment = self.claimed_commitment } },
453+
.{ .label = "max-value", .message = .{ .u64 = self.max_value } },
453454
});
454455
}
456+
// zig fmt: on
455457
};
456458

457459
pub fn init(

0 commit comments

Comments
 (0)