Skip to content

Commit 528b8ae

Browse files
committed
test fix
1 parent 02dee1d commit 528b8ae

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

yarn-project/stdlib/src/logs/tx_scoped_l2_log.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { z } from 'zod';
55

66
import { L2BlockHash } from '../block/block_hash.js';
77
import { TxHash } from '../tx/tx_hash.js';
8+
import { type UInt64, UInt64Schema } from '../types/shared.js';
89
import { PrivateLog } from './private_log.js';
910
import { PublicLog } from './public_log.js';
1011

@@ -36,7 +37,7 @@ export class TxScopedL2Log {
3637
/*
3738
* The timestamp of the block this log is included in
3839
*/
39-
public blockTimestamp: bigint,
40+
public blockTimestamp: UInt64,
4041
/*
4142
* The log data as either a PrivateLog or PublicLog
4243
*/
@@ -55,7 +56,7 @@ export class TxScopedL2Log {
5556
logIndexInTx: z.number(),
5657
blockNumber: BlockNumberSchema,
5758
blockHash: L2BlockHash.schema,
58-
blockTimestamp: z.bigint(),
59+
blockTimestamp: UInt64Schema,
5960
log: z.union([PrivateLog.schema, PublicLog.schema]),
6061
})
6162
.transform(

yarn-project/stdlib/src/types/shared.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import { type Bufferable, serializeToBuffer } from '@aztec/foundation/serialize';
22

3+
import { z } from 'zod';
4+
35
/**
46
* Implementation of a vector. Matches how we are serializing and deserializing vectors in cpp (length in the first position, followed by the items).
57
*/
@@ -30,6 +32,12 @@ export type UInt32 = number;
3032
*/
3133
export type UInt64 = bigint;
3234

35+
/**
36+
* Zod schema for UInt64 that accepts bigint, number, or string (from JSON) and coerces to bigint.
37+
* Inspired by BlockNumberSchema.
38+
*/
39+
export const UInt64Schema = z.union([z.bigint(), z.number(), z.string()]).pipe(z.coerce.bigint());
40+
3341
/**
3442
* A type alias for a 128-bit unsigned integer.
3543
*/

0 commit comments

Comments
 (0)