-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
proof verification and dht limits increase
- Loading branch information
Showing
12 changed files
with
430 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,36 @@ | ||
import { z } from "zod"; | ||
|
||
const hexStringSchema = z.string().regex(/^[0-9a-fA-F]+$/, 'Invalid hex string'); | ||
const base58Pattern = /^[123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]+$/; | ||
const base58Schema = z.string().regex(base58Pattern, 'Invalid Base58 string'); | ||
const bytesSchema = z.array(z.number()); | ||
|
||
// Zod for DelegateRequest | ||
export const DelegateRequest = z.object({ | ||
pie: z.array(z.number()), | ||
pie: bytesSchema, | ||
}); | ||
export type DelegateRequest = z.infer<typeof DelegateRequest>; | ||
|
||
// Zod for DelegateResponse | ||
export const DelegateResponse = z.object({ | ||
job_hash: z.coerce.bigint(), | ||
job_key: hexStringSchema | ||
}); | ||
export type DelegateResponse = z.infer<typeof DelegateResponse>; | ||
|
||
// Zod for JobEventsRequest | ||
export const JobEventsRequest = z.object({ | ||
job_hash: z.coerce.bigint(), | ||
job_key: hexStringSchema | ||
}); | ||
export type JobEventsRequest = z.infer<typeof JobEventsRequest>; | ||
|
||
export const JobEventsResponse = z.object({ | ||
type: z.literal("Finished"), | ||
type: z.literal("Finished").or(z.literal("Delegated")).or(z.literal("BidReceived")), | ||
data: z.any(), | ||
}); | ||
export type JobEventsResponse = z.infer<typeof JobEventsResponse>; | ||
|
||
export const JobHash = z.coerce.bigint(); | ||
export type JobHash = z.infer<typeof JobHash>; | ||
|
||
export const Proof = z.array(z.number()); | ||
export const Proof = bytesSchema; | ||
export type Proof = z.infer<typeof Proof>; | ||
|
||
export const PeerId = base58Schema; | ||
export type PeerId = z.infer<typeof PeerId>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.