-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathtrace.haskell.d.ts
70 lines (60 loc) · 1.75 KB
/
trace.haskell.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
/** Haskell simulation trace format */
export interface HaskellTraceEvent {
time_s: number;
event: HaskellEvent;
}
type BlockKind = "IB" | "EB" | "RB" | "VT";
type BlockAction = "Generated" | "EnteredState";
type HaskellEvent =
| HaskellCpuEvent
| HaskellBlockEvent // Unified block event type
| HaskellNetworkEvent; // Combine Sent/Received into network events
interface HaskellCpuEvent {
tag: "Cpu";
node: string;
cpu_time_s: number;
// CPU task types: Block validation (ValIB, ValEB, ValRB), Header validation (ValIH, ValRH), Vote validation (ValVote). Format: "<task_type>: <id>"
task_label: string; // e.g., "ValIB: 6-29" or "ValRH: 6253064077348247640"
}
// Base block event interface
interface BaseBlockEvent {
type: `${BlockKind}${BlockAction}`;
node: string;
id: string;
size_bytes: number;
}
interface InputBlockEvent extends BaseBlockEvent {
kind: "IB";
slot: number;
payload_bytes: number;
rb_ref: string; // Reference to ranking block
}
interface EndorserBlockEvent extends BaseBlockEvent {
kind: "EB";
slot: number;
input_blocks: string[]; // References to input blocks
}
interface RankingBlockEvent extends BaseBlockEvent {
kind: "RB";
slot: number;
}
interface VoteEvent extends BaseBlockEvent {
kind: "VT";
votes: number;
endorse_blocks: string[]; // References to endorser blocks
}
type HaskellBlockEvent =
| InputBlockEvent
| EndorserBlockEvent
| RankingBlockEvent
| VoteEvent;
interface HaskellNetworkEvent {
type: "NetworkMessage";
action: "Sent" | "Received"; // Added to distinguish direction
sender: string;
recipient: string;
block_kind: BlockKind;
msg_size_bytes: number;
sending_s: number;
ids: string[];
}