Skip to content

Commit 3f092e1

Browse files
committed
fix style
1 parent 6f6467a commit 3f092e1

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
@@ -282,15 +282,17 @@ pub const Data = struct {
282282
self.first_ciphertext.toBytes() ++ self.second_ciphertext.toBytes();
283283
}
284284

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

290-
.{ .label = "first-ciphertext", .message = .{ .ciphertext = self.first_ciphertext } },
291+
.{ .label = "first-ciphertext", .message = .{ .ciphertext = self.first_ciphertext } },
291292
.{ .label = "second-ciphertext", .message = .{ .ciphertext = self.second_ciphertext } },
292293
});
293294
}
295+
// zig fmt: on
294296
};
295297

296298
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
@@ -161,7 +161,10 @@ pub const Proof = struct {
161161
) !void {
162162
// for batched we have the batched contract which includes the initial
163163
// `t` challenge, and then the base one that's shared between batched and non batched.
164-
comptime var session = Transcript.getSession(if (batched) batched_contract ++ contract else contract);
164+
comptime var session = Transcript.getSession(if (batched)
165+
batched_contract ++ contract
166+
else
167+
contract);
165168
defer session.finish();
166169

167170
const t = if (batched) t: {
@@ -351,13 +354,15 @@ pub const Data = struct {
351354
self.grouped_ciphertext.toBytes();
352355
}
353356

357+
// zig fmt: off
354358
fn newTranscript(self: Context) Transcript {
355359
return .init(.@"grouped-ciphertext-validity-2-handles-instruction", &.{
356-
.{ .label = "first-pubkey", .message = .{ .pubkey = self.first_pubkey } },
357-
.{ .label = "second-pubkey", .message = .{ .pubkey = self.second_pubkey } },
360+
.{ .label = "first-pubkey", .message = .{ .pubkey = self.first_pubkey } },
361+
.{ .label = "second-pubkey", .message = .{ .pubkey = self.second_pubkey } },
358362
.{ .label = "grouped-ciphertext", .message = .{ .grouped_2 = self.grouped_ciphertext } },
359363
});
360364
}
365+
// zig fmt: on
361366
};
362367

363368
pub fn init(
@@ -473,14 +478,16 @@ pub const BatchedData = struct {
473478
self.grouped_ciphertext_hi.toBytes();
474479
}
475480

481+
// zig fmt: off
476482
fn newTranscript(self: Context) Transcript {
477483
return .init(.@"batched-grouped-ciphertext-validity-2-handles-instruction", &.{
478-
.{ .label = "first-pubkey", .message = .{ .pubkey = self.first_pubkey } },
479-
.{ .label = "second-pubkey", .message = .{ .pubkey = self.second_pubkey } },
484+
.{ .label = "first-pubkey", .message = .{ .pubkey = self.first_pubkey } },
485+
.{ .label = "second-pubkey", .message = .{ .pubkey = self.second_pubkey } },
480486
.{ .label = "grouped-ciphertext-lo", .message = .{ .grouped_2 = self.grouped_ciphertext_lo } },
481487
.{ .label = "grouped-ciphertext-hi", .message = .{ .grouped_2 = self.grouped_ciphertext_hi } },
482488
});
483489
}
490+
// zig fmt: on
484491
};
485492

486493
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
@@ -176,7 +176,10 @@ pub const Proof = struct {
176176
params: Params(batched),
177177
transcript: *Transcript,
178178
) !void {
179-
comptime var session = Transcript.getSession(if (batched) batched_contract ++ contract else contract);
179+
comptime var session = Transcript.getSession(if (batched)
180+
batched_contract ++ contract
181+
else
182+
contract);
180183
defer session.finish();
181184

182185
const t = if (batched) t: {
@@ -359,14 +362,16 @@ pub const Data = struct {
359362
self.grouped_ciphertext.toBytes();
360363
}
361364

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

372377
pub fn init(
@@ -495,15 +500,17 @@ pub const BatchedData = struct {
495500
self.grouped_ciphertext_hi.toBytes();
496501
}
497502

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

509516
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
@@ -453,14 +453,16 @@ pub const Data = struct {
453453
self.claimed_commitment.toBytes() ++ @as([8]u8, @bitCast(self.max_value));
454454
}
455455

456+
// zig fmt: off
456457
fn newTranscript(self: Context) Transcript {
457458
return .init(.@"percentage-with-cap-instruction", &.{
458459
.{ .label = "percentage-commitment", .message = .{ .commitment = self.percentage_commitment } },
459-
.{ .label = "delta-commitment", .message = .{ .commitment = self.delta_commitment } },
460-
.{ .label = "claimed-commitment", .message = .{ .commitment = self.claimed_commitment } },
461-
.{ .label = "max-value", .message = .{ .u64 = self.max_value } },
460+
.{ .label = "delta-commitment", .message = .{ .commitment = self.delta_commitment } },
461+
.{ .label = "claimed-commitment", .message = .{ .commitment = self.claimed_commitment } },
462+
.{ .label = "max-value", .message = .{ .u64 = self.max_value } },
462463
});
463464
}
465+
// zig fmt: on
464466
};
465467

466468
pub fn init(

0 commit comments

Comments
 (0)